@knighttower/utility
Advanced tools
Comparing version 7.21.0 to 7.22.0
@@ -1,1 +0,1 @@ | ||
(()=>{"use strict";var r={d:(t,n)=>{for(var e in n){r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})}},o:(r,t)=>Object.prototype.hasOwnProperty.call(r,t),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},t={};function n(r,t){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!n){if(Array.isArray(r)||(n=function(r,t){if(r){if("string"==typeof r){return e(r,t)}var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(r,t):void 0}}(r))||t&&r&&"number"==typeof r.length){n&&(r=n);var o=0,i=function(){};return{s:i,n:function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}},e:function(r){throw r},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,a=!0,c=!1;return{s:function(){n=n.call(r)},n:function(){var r=n.next();return a=r.done,r},e:function(r){c=!0,u=r},f:function(){try{a||null==n.return||n.return()}finally{if(c){throw u}}}}}function e(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=Array(t);n<t;n++){e[n]=r[n]}return e}function o(r){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},o(r)}function i(r){switch(o(r)){case"boolean":return r;case"string":return"false"!==r&&"0"!==r;case"number":return 0!==r;default:return Boolean(r)}}function u(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null!==s(r)||"boolean"==typeof r?r:f(r)?t:r}r.r(t),r.d(t,{addQuotes:()=>S,cleanStr:()=>w,convertKeysToSymbols:()=>A,findAndReplaceInArray:()=>j,findNested:()=>O,fixQuotes:()=>E,getArrObjFromString:()=>x,getChunks:()=>T,getDirectivesFromString:()=>P,getMatchBlock:()=>k,getMatchInBetween:()=>I,getObjectFromPath:()=>_,getObjectValue:()=>h,removeQuotes:()=>M,setExpString:()=>N,setLookUpExp:()=>R,setWildCardString:()=>C,startAndEndWith:()=>$,wildCardStringSearch:()=>B});var a=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;r=r||40;for(var t="",n=0;n<r/3+1;n++){t+=Math.random().toString(36).substring(2,15)}return t.substring(0,r)};function c(){return"id__"+a(8)+"__"+(new Date).getTime()}var l=c;function f(r){return null==r||("string"==typeof r||Array.isArray(r)?0===r.length:r instanceof Map||r instanceof Set?0===r.size:ArrayBuffer.isView(r)?0===r.byteLength:"object"===o(r)&&0===Object.keys(r).length)}function s(r){var t=o(r);switch(r){case null:case void 0:case"":return null;case"0":case 0:return 0;default:if(!("number"!==t&&"string"!==t||"number"!=typeof r&&Number.isNaN(Number(r)))){return+r}}return null}function y(r,t){if(null===r){return t?null===t||"null"===t:"null"}var e;switch(o(r)){case"number":case"string":case"boolean":case"undefined":case"bigint":case"symbol":case"function":e=o(r);break;case"object":e=Array.isArray(r)?"array":"object";break;default:e="unknown"}if(t){if(t.includes("|")){var i,u=n(t.split("|"));try{for(u.s();!(i=u.n()).done;){var a=i.value;if(e===a){return a}}}catch(r){u.e(r)}finally{u.f()}return!1}return t===e}return e}function v(r){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},v(r)}var m=function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof r&&"object"!==v(r)){throw new Error("doPoll: The first argument must be a function or Promise.")}var n,e,o,i,u=function(r){return r instanceof Promise},a=t.interval,c=void 0===a?200:a,l=t.timeout,f=void 0===l?1e3:l,s=t.timeoutMsg,y=void 0===s?"===> doPoll: cancelled or timed out.":s,m=!1,g=!1,d=function(){p(),i(console.info(y))},b=function(r){p(),o(r)};function p(){m=!0,clearTimeout(n),clearInterval(e)}var h=new Promise((function(t,a){o=t,i=a;var l=function(){if(!m&&!g){var t=u(r)?r:r();u(t)?(g=!0,t.then((function(r){g=!1,r&&b(r)})).catch(i)):(Boolean(t)||t)&&b(t)}};e=setInterval(l,c),l(),n=setTimeout((function(){m||d()}),f)}));return h.catch((function(){d()})),{promise:h,stop:d}};function g(r,t){return function(r){if(Array.isArray(r)){return r}}(r)||function(r,t){var n=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=n){var e,o,i,u,a=[],c=!0,l=!1;try{if(i=(n=n.call(r)).next,0===t){if(Object(n)!==n){return}c=!1}else{for(;!(c=(e=i.call(n)).done)&&(a.push(e.value),a.length!==t);c=!0){}}}catch(r){l=!0,o=r}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u)){return}}finally{if(l){throw o}}}return a}}(r,t)||function(r,t){if(r){if("string"==typeof r){return d(r,t)}var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(r,t):void 0}}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=Array(t);n<t;n++){e[n]=r[n]}return e}function b(r,t,n){return(t=function(r){var t=function(r,t){if("object"!=p(r)||!r){return r}var n=r[Symbol.toPrimitive];if(void 0!==n){var e=n.call(r,t||"default");if("object"!=p(e)){return e}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(r)}(r,"string");return"symbol"==p(t)?t:t+""}(t))in r?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r}function p(r){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},p(r)}function h(r,t,n,e){var o=e||{},i=o.queryTime,u=void 0===i?15e3:i,a=o.isFalsy,c=void 0!==a&&a;if("function"==typeof n&&m((function(){var e=h(r,t);return c&&!1===e||e?n(e):void 0}),{timeout:u,interval:100,timeoutMsg:"Object prop no found:"+t}),!r){return!1}for(var l in r){if(l===t){return r[l]}if("object"===p(r[l])){var f=h(r[l],t);return f||!1}}return!1}function S(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'"';return"".concat(t).concat(r).concat(t)}function w(r){if(r){if("string"!=typeof r){return r}for(var t=arguments.length,n=new Array(t>1?t-1:0),e=1;e<t;e++){n[e-1]=arguments[e]}return n.reduce((function(r,t){var n=t instanceof RegExp?t:new RegExp(N(t));return r.replace(n,"")}),r).trim()}}function A(r){if(null===u(r,null)){return{}}var t={},n={};for(var e in r){var o=Symbol(e);t[o]=r[e],n[e]=o}return t.keyToSymbolMap=n,t}function j(r,t,n){var e=!1,o=r.map((function(r){if(Array.isArray(r)){var o=j(r,t,n);return o?(e=!0,o):r}return r===t?(e=!0,Array.isArray(n)?n.map((function(r){return Array.isArray(r)?r:r.trim()})):n):r}));return e?o:null}function O(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"[",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"]";if("string"!=typeof r){return r}var e=r.lastIndexOf(t);if(-1===e){return null}var o=r.substring(e),i=o.indexOf(n);return-1===i?null:o.substring(0,i+1)}function E(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'"';return"string"!=typeof r?r:r.replace(/`|'|"/g,t)}function _(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return r.split(".").reduce((function(r,t){return r&&r[t]}),t)}function x(r){if(y(r,"object")||y(r,"array")){return r}var t=$(r,"{","}"),n=$(r,"[","]");if(!t&&!n){return r}var e=t?{}:[],o={},i=function(r){var t=r.match(/^(\[|\{)(.*?)(\]|\})$/);return t?t[2].trim():r}(r),a=function(){for(var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];;){var t=r?O(i,"{","}"):O(i);if(!t){break}var n="__".concat(l(),"__");o[n]=t,i=i.replace(t,n)}};return a(),a(!0),T(i).forEach((function(r,n){var i,a,c=r.includes(":")&&t,l=c?T(r,":"):[],f=M(u(l[0],n));(r=c?l[1]:r)in o&&(r=x(o[r])),i=M(r),r=null!==(a=s(i))?a:i,t?e[f]=r:e.push(r)})),e}function P(r){var t=r;if(!u(t)){return null}var n=function(){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return{type:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,directive:r}},e=/([a-zA-Z]+)\[((.|\n)*?)\]\(((.|\n)*?)\)/gm,o=p(t);if("object"===o||"array"===o){return n(o,t)}switch(!0){case!!t.match(/^\[((.|\n)*?)\]$/gm):o="array";break;case!!t.match(/^\{((.|\n)*?)\:((.|\n)*?)\}/gm):o="object";break;case!!t.match(/^([a-zA-Z]+)(\()(\.|\#)(.*)(\))/g):return n("idOrClassWithDirective",b({},t.split("(")[0].trim(),I(t,"(",")")));case!!t.match(/([a-zA-Z]+)\.(.*?)\(((.|\n)*?)\)/gm):case!!t.match(e):o="dotObject";break;default:return n("string",t)}if("array"===o||"object"===o){var i=E(t);try{return n(o,JSON.parse(i))}catch(r){}return n(o,x(i))}if("dotObject"===o){var a,c,l,f={};return T(t,"&&").forEach((function(r){if(r.match(e)){a=I(r,"](",")"),c=I(r,"[","]"),l=r.split("[")[0].trim()}else{a=I(r,"(",")");var t=g(T(r=r.replace(k(r,"(",")"),""),"."),2);l=t[0],c=t[1]}a=x(a),f[l]||(f[l]={}),T(c,"|").forEach((function(r){f[l][r]=a}))})),n("dotObject",f)}}function k(r,t,n){var e=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"!=typeof r){return r}t=N(t),n=N(n);var o=new RegExp(R(t,n),"gm"),i=r.match(o);return i?e?i:i[0]:null}function T(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";if("string"!=typeof r){return r}if(f(r)){return[]}var n=(r=w(r)).split(t).map((function(r){return w(r)}));return 1===n.length&&""===n[0]?[r]:n}function I(r,t,n){var e,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"!=typeof r){return r}var i=null!==(e=k(r,t,n,o))&&void 0!==e?e:o?[]:r;return o?i.map((function(r){return w(r,t,n)})):w(i,t,n)}function M(r){return"string"!=typeof r?r:r.replace(/`|'|"/g,"")}function $(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return(!t||r.startsWith(t))&&(!n||r.endsWith(n))}function N(r){return r instanceof RegExp?r:r.split("").map((function(r){return["$","^",".","*","+","?","(",")","[","]","{","}","|","\\"].includes(r)?"\\".concat(r):r})).join("")}function R(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++){t[n]=arguments[n]}if(t.length<2){throw new Error("You need to pass at least two arguments")}var e="";return t.forEach((function(r,t){r instanceof RegExp&&(r=r.source),0===t?e=r:e+="((.|\n)*?)".concat(r)})),e}function C(r){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"!=typeof r){return r}if(!r){return null}t=i(t),n=i(n);var e=r.replace(/([.+?^${}()|\[\]\/\\])/g,"\\$&"),o=t?"^":"",u=n?"$":"";return e=e.replace(/\*\*/g,"[_g_]").replace(/\*/g,"(.*?)").replace(/\[_g_\]/g,".*"),"".concat(o).concat(e).concat(u)}function B(r,t){if(!r||!t){return null}var n=new RegExp(C(r,arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]&&arguments[3]));if("string"==typeof t){return u(t.match(n))}return u(t.filter((function(r){return n.test(r)})))}window.helpers=t})(); | ||
(()=>{"use strict";var r={d:(t,n)=>{for(var e in n){r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})}},o:(r,t)=>Object.prototype.hasOwnProperty.call(r,t),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},t={};function n(r,t){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!n){if(Array.isArray(r)||(n=function(r,t){if(r){if("string"==typeof r){return e(r,t)}var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(r,t):void 0}}(r))||t&&r&&"number"==typeof r.length){n&&(r=n);var o=0,i=function(){};return{s:i,n:function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}},e:function(r){throw r},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,a=!0,c=!1;return{s:function(){n=n.call(r)},n:function(){var r=n.next();return a=r.done,r},e:function(r){c=!0,u=r},f:function(){try{a||null==n.return||n.return()}finally{if(c){throw u}}}}}function e(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=Array(t);n<t;n++){e[n]=r[n]}return e}function o(r){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},o(r)}function i(r){switch(o(r)){case"boolean":return r;case"string":return"false"!==r&&"0"!==r;case"number":return 0!==r;default:return Boolean(r)}}function u(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null!==s(r)||"boolean"==typeof r?r:f(r)?t:r}r.r(t),r.d(t,{addQuotes:()=>S,cleanStr:()=>w,convertKeysToSymbols:()=>A,findAndReplaceInArray:()=>j,findNested:()=>O,fixQuotes:()=>E,getArrObjFromString:()=>x,getChunks:()=>k,getDirectivesFromString:()=>P,getMatchBlock:()=>T,getMatchInBetween:()=>I,getObjectFromPath:()=>_,getObjectValue:()=>h,removeQuotes:()=>M,setExpString:()=>N,setLookUpExp:()=>R,setWildCardString:()=>C,startAndEndWith:()=>$,wildCardStringSearch:()=>B});var a=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;r=r||40;for(var t="",n=0;n<r/3+1;n++){t+=Math.random().toString(36).substring(2,15)}return t.substring(0,r)};function c(){return"id__"+a(8)+"__"+(new Date).getTime()}var l=c;function f(r){return null==r||("string"==typeof r||Array.isArray(r)?0===r.length:r instanceof Map||r instanceof Set?0===r.size:ArrayBuffer.isView(r)?0===r.byteLength:"object"===o(r)&&0===Object.keys(r).length)}function s(r){var t=o(r);switch(r){case null:case void 0:case"":return null;case"0":case 0:return 0;default:if(!("number"!==t&&"string"!==t||"number"!=typeof r&&Number.isNaN(Number(r)))){return+r}}return null}function v(r,t){if(null===r){return t?null===t||"null"===t:"null"}var e;switch(o(r)){case"number":case"string":case"boolean":case"undefined":case"bigint":case"symbol":case"function":e=o(r);break;case"object":e=Array.isArray(r)?"array":"object";break;default:e="unknown"}if(t){if(t.includes("|")){var i,u=n(t.split("|"));try{for(u.s();!(i=u.n()).done;){var a=i.value;if(e===a){return a}}}catch(r){u.e(r)}finally{u.f()}return!1}return t===e}return e}function y(r){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},y(r)}var m=function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof r&&"object"!==y(r)){throw new Error("doPoll: The first argument must be a function or Promise.")}var n,e,o,i,u=function(r){return r instanceof Promise},a=t.msg,c=t.interval,l=void 0===c?200:c,f=t.timeout,s=void 0===f?1e3:f,m=t.timeoutMsg,g=void 0===m?null!=a?a:"===> doPoll: cancelled or timed out.":m,d=!1,b=!1,p=function(){if(S(),v(g,"string")){return console.info(g),void i(g)}i()},h=function(r){S(),o(r)};function S(){d=!0,clearTimeout(n),clearInterval(e)}var w=new Promise((function(t,a){o=t,i=a;var c=function(){if(!d&&!b){var t=u(r)?r:r();u(t)?(b=!0,t.then((function(r){b=!1,r&&h(r)})).catch(i)):(Boolean(t)||t)&&h(t)}};e=setInterval(c,l),c(),n=setTimeout((function(){d||p()}),s)}));return w.catch((function(){p()})),{promise:w,stop:p}};function g(r,t){return function(r){if(Array.isArray(r)){return r}}(r)||function(r,t){var n=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=n){var e,o,i,u,a=[],c=!0,l=!1;try{if(i=(n=n.call(r)).next,0===t){if(Object(n)!==n){return}c=!1}else{for(;!(c=(e=i.call(n)).done)&&(a.push(e.value),a.length!==t);c=!0){}}}catch(r){l=!0,o=r}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u)){return}}finally{if(l){throw o}}}return a}}(r,t)||function(r,t){if(r){if("string"==typeof r){return d(r,t)}var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(r,t):void 0}}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=Array(t);n<t;n++){e[n]=r[n]}return e}function b(r,t,n){return(t=function(r){var t=function(r,t){if("object"!=p(r)||!r){return r}var n=r[Symbol.toPrimitive];if(void 0!==n){var e=n.call(r,t||"default");if("object"!=p(e)){return e}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(r)}(r,"string");return"symbol"==p(t)?t:t+""}(t))in r?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r}function p(r){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},p(r)}function h(r,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e=v(e,"number")?{queryTime:e}:e,i=o.queryTime,u=void 0===i?15e3:i,a=o.isFalsy,c=void 0!==a&&a;if(n){return m((function(){var n=h(r,t);return c&&!1===n||n&&!1!==n?n:void 0}),{timeout:u,interval:100,msg:!1}).promise}if(!r){return!1}for(var l=t.split(".");0<l.length;){var f=l[0];for(var s in r){if(s===f){return l[1]?h(r[s],l[1]):r[s]}if("object"===p(r[s])){var y=h(r[s],f);return y||!1}}return!1}}function S(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'"';return"".concat(t).concat(r).concat(t)}function w(r){if(r){if("string"!=typeof r){return r}for(var t=arguments.length,n=new Array(t>1?t-1:0),e=1;e<t;e++){n[e-1]=arguments[e]}return n.reduce((function(r,t){var n=t instanceof RegExp?t:new RegExp(N(t));return r.replace(n,"")}),r).trim()}}function A(r){if(null===u(r,null)){return{}}var t={},n={};for(var e in r){var o=Symbol(e);t[o]=r[e],n[e]=o}return t.keyToSymbolMap=n,t}function j(r,t,n){var e=!1,o=r.map((function(r){if(Array.isArray(r)){var o=j(r,t,n);return o?(e=!0,o):r}return r===t?(e=!0,Array.isArray(n)?n.map((function(r){return Array.isArray(r)?r:r.trim()})):n):r}));return e?o:null}function O(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"[",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"]";if("string"!=typeof r){return r}var e=r.lastIndexOf(t);if(-1===e){return null}var o=r.substring(e),i=o.indexOf(n);return-1===i?null:o.substring(0,i+1)}function E(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'"';return"string"!=typeof r?r:r.replace(/`|'|"/g,t)}function _(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return r.split(".").reduce((function(r,t){return r&&r[t]}),t)}function x(r){if(v(r,"object")||v(r,"array")){return r}var t=$(r,"{","}"),n=$(r,"[","]");if(!t&&!n){return r}var e=t?{}:[],o={},i=function(r){var t=r.match(/^(\[|\{)(.*?)(\]|\})$/);return t?t[2].trim():r}(r),a=function(){for(var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];;){var t=r?O(i,"{","}"):O(i);if(!t){break}var n="__".concat(l(),"__");o[n]=t,i=i.replace(t,n)}};return a(),a(!0),k(i).forEach((function(r,n){var i,a,c=r.includes(":")&&t,l=c?k(r,":"):[],f=M(u(l[0],n));(r=c?l[1]:r)in o&&(r=x(o[r])),i=M(r),r=null!==(a=s(i))?a:i,t?e[f]=r:e.push(r)})),e}function P(r){var t=r;if(!u(t)){return null}var n=function(){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return{type:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,directive:r}},e=/([a-zA-Z]+)\[((.|\n)*?)\]\(((.|\n)*?)\)/gm,o=p(t);if("object"===o||"array"===o){return n(o,t)}switch(!0){case!!t.match(/^\[((.|\n)*?)\]$/gm):o="array";break;case!!t.match(/^\{((.|\n)*?)\:((.|\n)*?)\}/gm):o="object";break;case!!t.match(/^([a-zA-Z]+)(\()(\.|\#)(.*)(\))/g):return n("idOrClassWithDirective",b({},t.split("(")[0].trim(),I(t,"(",")")));case!!t.match(/([a-zA-Z]+)\.(.*?)\(((.|\n)*?)\)/gm):case!!t.match(e):o="dotObject";break;default:return n("string",t)}if("array"===o||"object"===o){var i=E(t);try{return n(o,JSON.parse(i))}catch(r){}return n(o,x(i))}if("dotObject"===o){var a,c,l,f={};return k(t,"&&").forEach((function(r){if(r.match(e)){a=I(r,"](",")"),c=I(r,"[","]"),l=r.split("[")[0].trim()}else{a=I(r,"(",")");var t=g(k(r=r.replace(T(r,"(",")"),""),"."),2);l=t[0],c=t[1]}a=x(a),f[l]||(f[l]={}),k(c,"|").forEach((function(r){f[l][r]=a}))})),n("dotObject",f)}}function T(r,t,n){var e=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"!=typeof r){return r}t=N(t),n=N(n);var o=new RegExp(R(t,n),"gm"),i=r.match(o);return i?e?i:i[0]:null}function k(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";if("string"!=typeof r){return r}if(f(r)){return[]}var n=(r=w(r)).split(t).map((function(r){return w(r)}));return 1===n.length&&""===n[0]?[r]:n}function I(r,t,n){var e,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"!=typeof r){return r}var i=null!==(e=T(r,t,n,o))&&void 0!==e?e:o?[]:r;return o?i.map((function(r){return w(r,t,n)})):w(i,t,n)}function M(r){return"string"!=typeof r?r:r.replace(/`|'|"/g,"")}function $(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return(!t||r.startsWith(t))&&(!n||r.endsWith(n))}function N(r){return r instanceof RegExp?r:r.split("").map((function(r){return["$","^",".","*","+","?","(",")","[","]","{","}","|","\\"].includes(r)?"\\".concat(r):r})).join("")}function R(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++){t[n]=arguments[n]}if(t.length<2){throw new Error("You need to pass at least two arguments")}var e="";return t.forEach((function(r,t){r instanceof RegExp&&(r=r.source),0===t?e=r:e+="((.|\n)*?)".concat(r)})),e}function C(r){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"!=typeof r){return r}if(!r){return null}t=i(t),n=i(n);var e=r.replace(/([.+?^${}()|\[\]\/\\])/g,"\\$&"),o=t?"^":"",u=n?"$":"";return e=e.replace(/\*\*/g,"[_g_]").replace(/\*/g,"(.*?)").replace(/\[_g_\]/g,".*"),"".concat(o).concat(e).concat(u)}function B(r,t){if(!r||!t){return null}var n=new RegExp(C(r,arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]&&arguments[3]));if("string"==typeof t){return u(t.match(n))}return u(t.filter((function(r){return n.test(r)})))}window.helpers=t})(); |
@@ -1,1 +0,1 @@ | ||
(()=>{"use strict";var r={d:(t,n)=>{for(var e in n){r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})}},o:(r,t)=>Object.prototype.hasOwnProperty.call(r,t),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},t={};function n(r,t){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!n){if(Array.isArray(r)||(n=function(r,t){if(r){if("string"==typeof r){return e(r,t)}var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(r,t):void 0}}(r))||t&&r&&"number"==typeof r.length){n&&(r=n);var o=0,i=function(){};return{s:i,n:function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}},e:function(r){throw r},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,a=!0,c=!1;return{s:function(){n=n.call(r)},n:function(){var r=n.next();return a=r.done,r},e:function(r){c=!0,u=r},f:function(){try{a||null==n.return||n.return()}finally{if(c){throw u}}}}}function e(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=Array(t);n<t;n++){e[n]=r[n]}return e}function o(r){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},o(r)}function i(r){switch(o(r)){case"boolean":return r;case"string":return"false"!==r&&"0"!==r;case"number":return 0!==r;default:return Boolean(r)}}function u(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null!==s(r)||"boolean"==typeof r?r:f(r)?t:r}r.r(t),r.d(t,{addQuotes:()=>S,cleanStr:()=>w,convertKeysToSymbols:()=>A,findAndReplaceInArray:()=>j,findNested:()=>O,fixQuotes:()=>E,getArrObjFromString:()=>x,getChunks:()=>T,getDirectivesFromString:()=>P,getMatchBlock:()=>k,getMatchInBetween:()=>I,getObjectFromPath:()=>_,getObjectValue:()=>h,removeQuotes:()=>M,setExpString:()=>N,setLookUpExp:()=>R,setWildCardString:()=>C,startAndEndWith:()=>$,wildCardStringSearch:()=>B});var a=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;r=r||40;for(var t="",n=0;n<r/3+1;n++){t+=Math.random().toString(36).substring(2,15)}return t.substring(0,r)};function c(){return"id__"+a(8)+"__"+(new Date).getTime()}var l=c;function f(r){return null==r||("string"==typeof r||Array.isArray(r)?0===r.length:r instanceof Map||r instanceof Set?0===r.size:ArrayBuffer.isView(r)?0===r.byteLength:"object"===o(r)&&0===Object.keys(r).length)}function s(r){var t=o(r);switch(r){case null:case void 0:case"":return null;case"0":case 0:return 0;default:if(!("number"!==t&&"string"!==t||"number"!=typeof r&&Number.isNaN(Number(r)))){return+r}}return null}function y(r,t){if(null===r){return t?null===t||"null"===t:"null"}var e;switch(o(r)){case"number":case"string":case"boolean":case"undefined":case"bigint":case"symbol":case"function":e=o(r);break;case"object":e=Array.isArray(r)?"array":"object";break;default:e="unknown"}if(t){if(t.includes("|")){var i,u=n(t.split("|"));try{for(u.s();!(i=u.n()).done;){var a=i.value;if(e===a){return a}}}catch(r){u.e(r)}finally{u.f()}return!1}return t===e}return e}function v(r){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},v(r)}var m=function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof r&&"object"!==v(r)){throw new Error("doPoll: The first argument must be a function or Promise.")}var n,e,o,i,u=function(r){return r instanceof Promise},a=t.interval,c=void 0===a?200:a,l=t.timeout,f=void 0===l?1e3:l,s=t.timeoutMsg,y=void 0===s?"===> doPoll: cancelled or timed out.":s,m=!1,g=!1,d=function(){b(),i(console.info(y))},p=function(r){b(),o(r)};function b(){m=!0,clearTimeout(n),clearInterval(e)}var h=new Promise((function(t,a){o=t,i=a;var l=function(){if(!m&&!g){var t=u(r)?r:r();u(t)?(g=!0,t.then((function(r){g=!1,r&&p(r)})).catch(i)):(Boolean(t)||t)&&p(t)}};e=setInterval(l,c),l(),n=setTimeout((function(){m||d()}),f)}));return h.catch((function(){d()})),{promise:h,stop:d}};function g(r,t){return function(r){if(Array.isArray(r)){return r}}(r)||function(r,t){var n=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=n){var e,o,i,u,a=[],c=!0,l=!1;try{if(i=(n=n.call(r)).next,0===t){if(Object(n)!==n){return}c=!1}else{for(;!(c=(e=i.call(n)).done)&&(a.push(e.value),a.length!==t);c=!0){}}}catch(r){l=!0,o=r}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u)){return}}finally{if(l){throw o}}}return a}}(r,t)||function(r,t){if(r){if("string"==typeof r){return d(r,t)}var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(r,t):void 0}}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=Array(t);n<t;n++){e[n]=r[n]}return e}function p(r,t,n){return(t=function(r){var t=function(r,t){if("object"!=b(r)||!r){return r}var n=r[Symbol.toPrimitive];if(void 0!==n){var e=n.call(r,t||"default");if("object"!=b(e)){return e}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(r)}(r,"string");return"symbol"==b(t)?t:t+""}(t))in r?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r}function b(r){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},b(r)}function h(r,t,n,e){var o=e||{},i=o.queryTime,u=void 0===i?15e3:i,a=o.isFalsy,c=void 0!==a&&a;if("function"==typeof n&&m((function(){var e=h(r,t);return c&&!1===e||e?n(e):void 0}),{timeout:u,interval:100,timeoutMsg:"Object prop no found:"+t}),!r){return!1}for(var l in r){if(l===t){return r[l]}if("object"===b(r[l])){var f=h(r[l],t);return f||!1}}return!1}function S(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'"';return"".concat(t).concat(r).concat(t)}function w(r){if(r){if("string"!=typeof r){return r}for(var t=arguments.length,n=new Array(t>1?t-1:0),e=1;e<t;e++){n[e-1]=arguments[e]}return n.reduce((function(r,t){var n=t instanceof RegExp?t:new RegExp(N(t));return r.replace(n,"")}),r).trim()}}function A(r){if(null===u(r,null)){return{}}var t={},n={};for(var e in r){var o=Symbol(e);t[o]=r[e],n[e]=o}return t.keyToSymbolMap=n,t}function j(r,t,n){var e=!1,o=r.map((function(r){if(Array.isArray(r)){var o=j(r,t,n);return o?(e=!0,o):r}return r===t?(e=!0,Array.isArray(n)?n.map((function(r){return Array.isArray(r)?r:r.trim()})):n):r}));return e?o:null}function O(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"[",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"]";if("string"!=typeof r){return r}var e=r.lastIndexOf(t);if(-1===e){return null}var o=r.substring(e),i=o.indexOf(n);return-1===i?null:o.substring(0,i+1)}function E(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'"';return"string"!=typeof r?r:r.replace(/`|'|"/g,t)}function _(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return r.split(".").reduce((function(r,t){return r&&r[t]}),t)}function x(r){if(y(r,"object")||y(r,"array")){return r}var t=$(r,"{","}"),n=$(r,"[","]");if(!t&&!n){return r}var e=t?{}:[],o={},i=function(r){var t=r.match(/^(\[|\{)(.*?)(\]|\})$/);return t?t[2].trim():r}(r),a=function(){for(var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];;){var t=r?O(i,"{","}"):O(i);if(!t){break}var n="__".concat(l(),"__");o[n]=t,i=i.replace(t,n)}};return a(),a(!0),T(i).forEach((function(r,n){var i,a,c=r.includes(":")&&t,l=c?T(r,":"):[],f=M(u(l[0],n));(r=c?l[1]:r)in o&&(r=x(o[r])),i=M(r),r=null!==(a=s(i))?a:i,t?e[f]=r:e.push(r)})),e}function P(r){var t=r;if(!u(t)){return null}var n=function(){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return{type:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,directive:r}},e=/([a-zA-Z]+)\[((.|\n)*?)\]\(((.|\n)*?)\)/gm,o=b(t);if("object"===o||"array"===o){return n(o,t)}switch(!0){case!!t.match(/^\[((.|\n)*?)\]$/gm):o="array";break;case!!t.match(/^\{((.|\n)*?)\:((.|\n)*?)\}/gm):o="object";break;case!!t.match(/^([a-zA-Z]+)(\()(\.|\#)(.*)(\))/g):return n("idOrClassWithDirective",p({},t.split("(")[0].trim(),I(t,"(",")")));case!!t.match(/([a-zA-Z]+)\.(.*?)\(((.|\n)*?)\)/gm):case!!t.match(e):o="dotObject";break;default:return n("string",t)}if("array"===o||"object"===o){var i=E(t);try{return n(o,JSON.parse(i))}catch(r){}return n(o,x(i))}if("dotObject"===o){var a,c,l,f={};return T(t,"&&").forEach((function(r){if(r.match(e)){a=I(r,"](",")"),c=I(r,"[","]"),l=r.split("[")[0].trim()}else{a=I(r,"(",")");var t=g(T(r=r.replace(k(r,"(",")"),""),"."),2);l=t[0],c=t[1]}a=x(a),f[l]||(f[l]={}),T(c,"|").forEach((function(r){f[l][r]=a}))})),n("dotObject",f)}}function k(r,t,n){var e=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"!=typeof r){return r}t=N(t),n=N(n);var o=new RegExp(R(t,n),"gm"),i=r.match(o);return i?e?i:i[0]:null}function T(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";if("string"!=typeof r){return r}if(f(r)){return[]}var n=(r=w(r)).split(t).map((function(r){return w(r)}));return 1===n.length&&""===n[0]?[r]:n}function I(r,t,n){var e,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"!=typeof r){return r}var i=null!==(e=k(r,t,n,o))&&void 0!==e?e:o?[]:r;return o?i.map((function(r){return w(r,t,n)})):w(i,t,n)}function M(r){return"string"!=typeof r?r:r.replace(/`|'|"/g,"")}function $(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return(!t||r.startsWith(t))&&(!n||r.endsWith(n))}function N(r){return r instanceof RegExp?r:r.split("").map((function(r){return["$","^",".","*","+","?","(",")","[","]","{","}","|","\\"].includes(r)?"\\".concat(r):r})).join("")}function R(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++){t[n]=arguments[n]}if(t.length<2){throw new Error("You need to pass at least two arguments")}var e="";return t.forEach((function(r,t){r instanceof RegExp&&(r=r.source),0===t?e=r:e+="((.|\n)*?)".concat(r)})),e}function C(r){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"!=typeof r){return r}if(!r){return null}t=i(t),n=i(n);var e=r.replace(/([.+?^${}()|\[\]\/\\])/g,"\\$&"),o=t?"^":"",u=n?"$":"";return e=e.replace(/\*\*/g,"[_g_]").replace(/\*/g,"(.*?)").replace(/\[_g_\]/g,".*"),"".concat(o).concat(e).concat(u)}function B(r,t){if(!r||!t){return null}var n=new RegExp(C(r,arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]&&arguments[3]));if("string"==typeof t){return u(t.match(n))}return u(t.filter((function(r){return n.test(r)})))}window.powerHelper=t})(); | ||
(()=>{"use strict";var r={d:(t,n)=>{for(var e in n){r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})}},o:(r,t)=>Object.prototype.hasOwnProperty.call(r,t),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},t={};function n(r,t){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!n){if(Array.isArray(r)||(n=function(r,t){if(r){if("string"==typeof r){return e(r,t)}var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(r,t):void 0}}(r))||t&&r&&"number"==typeof r.length){n&&(r=n);var o=0,i=function(){};return{s:i,n:function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}},e:function(r){throw r},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,a=!0,c=!1;return{s:function(){n=n.call(r)},n:function(){var r=n.next();return a=r.done,r},e:function(r){c=!0,u=r},f:function(){try{a||null==n.return||n.return()}finally{if(c){throw u}}}}}function e(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=Array(t);n<t;n++){e[n]=r[n]}return e}function o(r){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},o(r)}function i(r){switch(o(r)){case"boolean":return r;case"string":return"false"!==r&&"0"!==r;case"number":return 0!==r;default:return Boolean(r)}}function u(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null!==s(r)||"boolean"==typeof r?r:f(r)?t:r}r.r(t),r.d(t,{addQuotes:()=>S,cleanStr:()=>w,convertKeysToSymbols:()=>A,findAndReplaceInArray:()=>j,findNested:()=>O,fixQuotes:()=>E,getArrObjFromString:()=>x,getChunks:()=>k,getDirectivesFromString:()=>P,getMatchBlock:()=>T,getMatchInBetween:()=>I,getObjectFromPath:()=>_,getObjectValue:()=>h,removeQuotes:()=>M,setExpString:()=>N,setLookUpExp:()=>R,setWildCardString:()=>C,startAndEndWith:()=>$,wildCardStringSearch:()=>B});var a=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;r=r||40;for(var t="",n=0;n<r/3+1;n++){t+=Math.random().toString(36).substring(2,15)}return t.substring(0,r)};function c(){return"id__"+a(8)+"__"+(new Date).getTime()}var l=c;function f(r){return null==r||("string"==typeof r||Array.isArray(r)?0===r.length:r instanceof Map||r instanceof Set?0===r.size:ArrayBuffer.isView(r)?0===r.byteLength:"object"===o(r)&&0===Object.keys(r).length)}function s(r){var t=o(r);switch(r){case null:case void 0:case"":return null;case"0":case 0:return 0;default:if(!("number"!==t&&"string"!==t||"number"!=typeof r&&Number.isNaN(Number(r)))){return+r}}return null}function v(r,t){if(null===r){return t?null===t||"null"===t:"null"}var e;switch(o(r)){case"number":case"string":case"boolean":case"undefined":case"bigint":case"symbol":case"function":e=o(r);break;case"object":e=Array.isArray(r)?"array":"object";break;default:e="unknown"}if(t){if(t.includes("|")){var i,u=n(t.split("|"));try{for(u.s();!(i=u.n()).done;){var a=i.value;if(e===a){return a}}}catch(r){u.e(r)}finally{u.f()}return!1}return t===e}return e}function y(r){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},y(r)}var m=function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof r&&"object"!==y(r)){throw new Error("doPoll: The first argument must be a function or Promise.")}var n,e,o,i,u=function(r){return r instanceof Promise},a=t.msg,c=t.interval,l=void 0===c?200:c,f=t.timeout,s=void 0===f?1e3:f,m=t.timeoutMsg,g=void 0===m?null!=a?a:"===> doPoll: cancelled or timed out.":m,d=!1,b=!1,p=function(){if(S(),v(g,"string")){return console.info(g),void i(g)}i()},h=function(r){S(),o(r)};function S(){d=!0,clearTimeout(n),clearInterval(e)}var w=new Promise((function(t,a){o=t,i=a;var c=function(){if(!d&&!b){var t=u(r)?r:r();u(t)?(b=!0,t.then((function(r){b=!1,r&&h(r)})).catch(i)):(Boolean(t)||t)&&h(t)}};e=setInterval(c,l),c(),n=setTimeout((function(){d||p()}),s)}));return w.catch((function(){p()})),{promise:w,stop:p}};function g(r,t){return function(r){if(Array.isArray(r)){return r}}(r)||function(r,t){var n=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=n){var e,o,i,u,a=[],c=!0,l=!1;try{if(i=(n=n.call(r)).next,0===t){if(Object(n)!==n){return}c=!1}else{for(;!(c=(e=i.call(n)).done)&&(a.push(e.value),a.length!==t);c=!0){}}}catch(r){l=!0,o=r}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u)){return}}finally{if(l){throw o}}}return a}}(r,t)||function(r,t){if(r){if("string"==typeof r){return d(r,t)}var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(r,t):void 0}}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=Array(t);n<t;n++){e[n]=r[n]}return e}function b(r,t,n){return(t=function(r){var t=function(r,t){if("object"!=p(r)||!r){return r}var n=r[Symbol.toPrimitive];if(void 0!==n){var e=n.call(r,t||"default");if("object"!=p(e)){return e}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(r)}(r,"string");return"symbol"==p(t)?t:t+""}(t))in r?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r}function p(r){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},p(r)}function h(r,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e=v(e,"number")?{queryTime:e}:e,i=o.queryTime,u=void 0===i?15e3:i,a=o.isFalsy,c=void 0!==a&&a;if(n){return m((function(){var n=h(r,t);return c&&!1===n||n&&!1!==n?n:void 0}),{timeout:u,interval:100,msg:!1}).promise}if(!r){return!1}for(var l=t.split(".");0<l.length;){var f=l[0];for(var s in r){if(s===f){return l[1]?h(r[s],l[1]):r[s]}if("object"===p(r[s])){var y=h(r[s],f);return y||!1}}return!1}}function S(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'"';return"".concat(t).concat(r).concat(t)}function w(r){if(r){if("string"!=typeof r){return r}for(var t=arguments.length,n=new Array(t>1?t-1:0),e=1;e<t;e++){n[e-1]=arguments[e]}return n.reduce((function(r,t){var n=t instanceof RegExp?t:new RegExp(N(t));return r.replace(n,"")}),r).trim()}}function A(r){if(null===u(r,null)){return{}}var t={},n={};for(var e in r){var o=Symbol(e);t[o]=r[e],n[e]=o}return t.keyToSymbolMap=n,t}function j(r,t,n){var e=!1,o=r.map((function(r){if(Array.isArray(r)){var o=j(r,t,n);return o?(e=!0,o):r}return r===t?(e=!0,Array.isArray(n)?n.map((function(r){return Array.isArray(r)?r:r.trim()})):n):r}));return e?o:null}function O(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"[",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"]";if("string"!=typeof r){return r}var e=r.lastIndexOf(t);if(-1===e){return null}var o=r.substring(e),i=o.indexOf(n);return-1===i?null:o.substring(0,i+1)}function E(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'"';return"string"!=typeof r?r:r.replace(/`|'|"/g,t)}function _(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return r.split(".").reduce((function(r,t){return r&&r[t]}),t)}function x(r){if(v(r,"object")||v(r,"array")){return r}var t=$(r,"{","}"),n=$(r,"[","]");if(!t&&!n){return r}var e=t?{}:[],o={},i=function(r){var t=r.match(/^(\[|\{)(.*?)(\]|\})$/);return t?t[2].trim():r}(r),a=function(){for(var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];;){var t=r?O(i,"{","}"):O(i);if(!t){break}var n="__".concat(l(),"__");o[n]=t,i=i.replace(t,n)}};return a(),a(!0),k(i).forEach((function(r,n){var i,a,c=r.includes(":")&&t,l=c?k(r,":"):[],f=M(u(l[0],n));(r=c?l[1]:r)in o&&(r=x(o[r])),i=M(r),r=null!==(a=s(i))?a:i,t?e[f]=r:e.push(r)})),e}function P(r){var t=r;if(!u(t)){return null}var n=function(){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return{type:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,directive:r}},e=/([a-zA-Z]+)\[((.|\n)*?)\]\(((.|\n)*?)\)/gm,o=p(t);if("object"===o||"array"===o){return n(o,t)}switch(!0){case!!t.match(/^\[((.|\n)*?)\]$/gm):o="array";break;case!!t.match(/^\{((.|\n)*?)\:((.|\n)*?)\}/gm):o="object";break;case!!t.match(/^([a-zA-Z]+)(\()(\.|\#)(.*)(\))/g):return n("idOrClassWithDirective",b({},t.split("(")[0].trim(),I(t,"(",")")));case!!t.match(/([a-zA-Z]+)\.(.*?)\(((.|\n)*?)\)/gm):case!!t.match(e):o="dotObject";break;default:return n("string",t)}if("array"===o||"object"===o){var i=E(t);try{return n(o,JSON.parse(i))}catch(r){}return n(o,x(i))}if("dotObject"===o){var a,c,l,f={};return k(t,"&&").forEach((function(r){if(r.match(e)){a=I(r,"](",")"),c=I(r,"[","]"),l=r.split("[")[0].trim()}else{a=I(r,"(",")");var t=g(k(r=r.replace(T(r,"(",")"),""),"."),2);l=t[0],c=t[1]}a=x(a),f[l]||(f[l]={}),k(c,"|").forEach((function(r){f[l][r]=a}))})),n("dotObject",f)}}function T(r,t,n){var e=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"!=typeof r){return r}t=N(t),n=N(n);var o=new RegExp(R(t,n),"gm"),i=r.match(o);return i?e?i:i[0]:null}function k(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";if("string"!=typeof r){return r}if(f(r)){return[]}var n=(r=w(r)).split(t).map((function(r){return w(r)}));return 1===n.length&&""===n[0]?[r]:n}function I(r,t,n){var e,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"!=typeof r){return r}var i=null!==(e=T(r,t,n,o))&&void 0!==e?e:o?[]:r;return o?i.map((function(r){return w(r,t,n)})):w(i,t,n)}function M(r){return"string"!=typeof r?r:r.replace(/`|'|"/g,"")}function $(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return(!t||r.startsWith(t))&&(!n||r.endsWith(n))}function N(r){return r instanceof RegExp?r:r.split("").map((function(r){return["$","^",".","*","+","?","(",")","[","]","{","}","|","\\"].includes(r)?"\\".concat(r):r})).join("")}function R(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++){t[n]=arguments[n]}if(t.length<2){throw new Error("You need to pass at least two arguments")}var e="";return t.forEach((function(r,t){r instanceof RegExp&&(r=r.source),0===t?e=r:e+="((.|\n)*?)".concat(r)})),e}function C(r){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"!=typeof r){return r}if(!r){return null}t=i(t),n=i(n);var e=r.replace(/([.+?^${}()|\[\]\/\\])/g,"\\$&"),o=t?"^":"",u=n?"$":"";return e=e.replace(/\*\*/g,"[_g_]").replace(/\*/g,"(.*?)").replace(/\[_g_\]/g,".*"),"".concat(o).concat(e).concat(u)}function B(r,t){if(!r||!t){return null}var n=new RegExp(C(r,arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]&&arguments[3]));if("string"==typeof t){return u(t.match(n))}return u(t.filter((function(r){return n.test(r)})))}window.powerHelper=t})(); |
@@ -1,1 +0,1 @@ | ||
(()=>{"use strict";var t={d:(e,r)=>{for(var n in r){t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})}},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t){return function(t){if(Array.isArray(t)){return o(t)}}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"]){return Array.from(t)}}(t)||function(t,e){if(t){if("string"==typeof t){return o(t,e)}var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++){n[r]=t[r]}return n}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function u(t){var e=function(t,e){if("object"!=r(t)||!t){return t}var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=r(o)){return o}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==r(e)?e:e+""}t.r(e),t.d(e,{doAsync:()=>N,doPoll:()=>A,doTimeout:()=>q,promisePool:()=>I,promiseQueue:()=>T});var a=function(){return t=function t(){!function(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}(this,t),this.listeners={}},e=[{key:"on",value:function(t,e){this.registerListener(t,e)}},{key:"once",value:function(t,e){this.registerListener(t,e,1)}},{key:"exactly",value:function(t,e,r){this.registerListener(t,e,r)}},{key:"off",value:function(t){delete this.listeners[t]}},{key:"detach",value:function(t,e){var r=(this.listeners[t]||[]).filter((function(t){return t.callback!==e}));return t in this.listeners&&(this.listeners[t]=r,!0)}},{key:"emit",value:function(t){for(var e=this,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++){o[i-1]=arguments[i]}var u=[],a=null,c=this.extractContextFromArgs(o),s=c[0];if(o=c[1],this.hasListener(t)){u=this.listeners[t]}else if(t.includes("*")){(a=this.patternSearch(t,Object.keys(this.listeners))).length>0&&a.forEach((function(t){u=u.concat(e.listeners[t])}))}else{for(var l in this.listeners){l.includes("*")&&(a=this.patternSearch(l,[t]))&&(u=u.concat(this.listeners[l]))}}u.forEach((function(r,i){var a=r.callback;s&&(a=a.bind(s)),void 0!==r.triggerCapacity&&(r.triggerCapacity--,u[i].triggerCapacity=r.triggerCapacity),e.checkToRemoveListener(r)&&e.listeners[t].splice(i,1),a.apply(void 0,n(o))}))}},{key:"patternSearch",value:function(t,e){var r,n=new RegExp(this.setWildCardString(t),"g");return 0===(r=e.filter((function(t){return n.test(t)}))).length?null:r}},{key:"setWildCardString",value:function(t){var e=t.replace(/([.+?^${}()|\[\]\/\\])/g,"\\$&");return e=e.replace(/\*/g,"(.*?)"),"^".concat(e)}},{key:"extractContextFromArgs",value:function(t){for(var e=null,n=0;n<t.length;n++){var o=t[n];if(o&&"object"===r(o)&&o.hasOwnProperty("__context")){e=o.__context,t.splice(n,1);break}}return[e,t]}},{key:"registerListener",value:function(t,e,r){this.hasListener(t)||(this.listeners[t]=[]),this.listeners[t].push({callback:e,triggerCapacity:r})}},{key:"checkToRemoveListener",value:function(t){return void 0!==t.triggerCapacity&&t.triggerCapacity<=0}},{key:"hasListener",value:function(t){return t in this.listeners}}],e&&i(t.prototype,e),o&&i(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o}();function c(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t){return s(t,e)}var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a){throw i}}}}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++){n[r]=t[r]}return n}function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}var f=function(t){return Array.isArray(t)?t:[t]},h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;t=t||40;for(var e="",r=0;r<t/3+1;r++){e+=Math.random().toString(36).substring(2,15)}return e.substring(0,t)};function p(){return"id__"+h(8)+"__"+(new Date).getTime()}function y(t,e){if(null===t){return e?null===e||"null"===e:"null"}var r;switch(l(t)){case"number":case"string":case"boolean":case"undefined":case"bigint":case"symbol":case"function":r=l(t);break;case"object":r=Array.isArray(t)?"array":"object";break;default:r="unknown"}if(e){if(e.includes("|")){var n,o=c(e.split("|"));try{for(o.s();!(n=o.n()).done;){var i=n.value;if(r===i){return i}}}catch(t){o.e(t)}finally{o.f()}return!1}return e===r}return r}function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function d(){d=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,u=Object.create(i.prototype),a=new I(n||[]);return o(u,"_invoke",{value:x(t,r,a)}),u}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var h="suspendedStart",p="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function _(){}var j={};s(j,u,(function(){return this}));var P=Object.getPrototypeOf,O=P&&P(P(C([])));O&&O!==r&&n.call(O,u)&&(j=O);var S=_.prototype=b.prototype=Object.create(j);function k(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function r(o,i,u,a){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==v(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){s.value=t,u(s)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function x(e,r,n){var o=h;return function(i,u){if(o===y){throw Error("Generator is already running")}if(o===m){if("throw"===i){throw u}return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=L(a,n);if(c){if(c===g){continue}return c}}if("next"===n.method){n.sent=n._sent=n.arg}else if("throw"===n.method){if(o===h){throw o=m,n.arg}n.dispatchException(n.arg)}else{"return"===n.method&&n.abrupt("return",n.arg)}o=y;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?m:p,s.arg===g){continue}return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function L(e,r){var n=r.method,o=e.iterator[n];if(o===t){return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,L(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g}var i=f(o,e.iterator,r.arg);if("throw"===i.type){return r.method="throw",r.arg=i.arg,r.delegate=null,g}var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r){return r.call(e)}if("function"==typeof e.next){return e}if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;){if(n.call(e,o)){return r.value=e[o],r.done=!1,r}}return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(v(e)+" is not iterable")}return w.prototype=_,o(S,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:w,configurable:!0}),w.displayName=s(_,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,s(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},k(E.prototype),s(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new E(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},k(S),s(S,c,"Generator"),s(S,u,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e){r.push(n)}return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e){return t.value=n,t.done=!1,t}}return t.done=!0,t}},e.values=C,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e){for(var r in this){"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)}}},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type){throw t.arg}return this.rval},dispatchException:function(e){if(this.done){throw e}var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc){return o("end")}if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),s=n.call(u,"finallyLoc");if(c&&s){if(this.prev<u.catchLoc){return o(u.catchLoc,!0)}if(this.prev<u.finallyLoc){return o(u.finallyLoc)}}else if(c){if(this.prev<u.catchLoc){return o(u.catchLoc,!0)}}else{if(!s){throw Error("try statement without catch or finally")}if(this.prev<u.finallyLoc){return o(u.finallyLoc)}}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(u)},complete:function(t,e){if("throw"===t.type){throw t.arg}return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t){return this.complete(r.completion,r.afterLoc),A(r),g}}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function m(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function g(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?g(Object(r),!0).forEach((function(e){w(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function w(t,e,r){return(e=O(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}function j(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,O(n.key),n)}}function P(t,e,r){return e&&j(t.prototype,e),r&&j(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function O(t){var e=function(t,e){if("object"!=v(t)||!t){return t}var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=v(n)){return n}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==v(e)?e:e+""}function S(t,e,r){return e=E(e),function(t,e){if(e&&("object"==v(e)||"function"==typeof e)){return e}if(void 0!==e){throw new TypeError("Derived constructors may only return object or undefined")}return function(t){if(void 0===t){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}(t)}(t,k()?Reflect.construct(e,r||[],E(t).constructor):e.apply(t,r))}function k(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(k=function(){return!!t})()}function E(t){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},E(t)}function x(t,e){if("function"!=typeof e&&null!==e){throw new TypeError("Super expression must either be null or a function")}t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&L(t,e)}function L(t,e){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},L(t,e)}var T=function(){var t={completed:0,rejected:0,pending:0,total:0,errors:"",promises:[]};return new(function(e){function r(){var e;return _(this,r),(e=S(this,r)).queue=[],e.inProgress=!1,e._timer=null,e._stats=b({},t),e}return x(r,e),P(r,[{key:"add",value:function(t){var e=this;if(!(t instanceof Promise||!!Array.isArray(t)&&t.length>0&&t.every((function(t){return t instanceof Promise})))){if(!y(t,"function")){return console.error("---\x3e Invalid promise added to the Queue:",t.toString()),this.emit("fail",t.toString())}t=new Promise(function(){var e,r=(e=d().mark((function e(r){var n;return d().wrap((function(e){for(;;){switch(e.prev=e.next){case 0:return e.next=2,t();case 2:return n=e.sent,e.abrupt("return",r(n));case 4:case"end":return e.stop()}}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(t){m(i,n,o,u,a,"next",t)}function a(t){m(i,n,o,u,a,"throw",t)}u(void 0)}))});return function(t){return r.apply(this,arguments)}}())}f(t).forEach((function(t){e._stats.total++,e._stats.pending++,e.queue.push({promiseFunction:t,response:null,status:"pending",error:null})})),this.inProgress||this._next(),this._setTimer()}},{key:"clear",value:function(){return this._timer&&clearInterval(this._timer),this._timer=null,this.queue=[],this.inProgress=!1,this._stats=b({},t),this}},{key:"_setTimer",value:function(){var t=this;this._timer&&clearInterval(this._timer),this._timer=setInterval((function(){"done"===t.status()&&(clearInterval(t._timer),t._timer=null,t.emit("completed",t._stats),t.emit("done",t._stats))}),10)}},{key:"_next",value:function(){var t=this;0!==this.queue.length?(this.inProgress=!0,this.queue[0].promiseFunction.then((function(e){t.queue[0].status="fulfilled",t.queue[0].response=e,t._stats.completed++})).catch((function(e){t._stats.errors+=e+"\n",t.queue[0].status="rejected",t._stats.rejected++})).finally((function(){t._stats.promises.push(t.queue[0]),t._stats.pending--,t.queue.shift(),t._next()}))):this.inProgress=!1}},{key:"stats",value:function(){return this._stats}},{key:"status",value:function(){return 0===this.queue.length?"done":"in-progress"}}])}(a))},A=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof t&&"object"!==v(t)){throw new Error("doPoll: The first argument must be a function or Promise.")}var r,n,o,i,u=function(t){return t instanceof Promise},a=e.interval,c=void 0===a?200:a,s=e.timeout,l=void 0===s?1e3:s,f=e.timeoutMsg,h=void 0===f?"===> doPoll: cancelled or timed out.":f,p=!1,y=!1,d=function(){g(),i(console.info(h))},m=function(t){g(),o(t)};function g(){p=!0,clearTimeout(r),clearInterval(n)}var b=new Promise((function(e,a){o=e,i=a;var s=function(){if(!p&&!y){var e=u(t)?t:t();u(e)?(y=!0,e.then((function(t){y=!1,t&&m(t)})).catch(i)):(Boolean(e)||e)&&m(e)}};n=setInterval(s,c),s(),r=setTimeout((function(){p||d()}),l)}));return b.catch((function(){d()})),{promise:b,stop:d}},I=function(){var t="not-started",e={},r=[],n={completed:0,rejected:0,pending:0,total:0,errors:""};return new(function(o){function i(){var t;_(this,i);var e=t=S(this,i);return t._currentPoll=null,setTimeout((function(){e._poll()}),100),t}return x(i,o),P(i,[{key:"_poll",value:function(){var t=this;return this._currentPoll&&this._currentPoll.stop(),this._currentPoll=A((function(){if(t.isDone()){return!0}}),{timeoutMsg:""}),this._currentPoll}},{key:"clear",value:function(){t="not-started",n={completed:0,rejected:0,pending:0,total:0,errors:""},r.length=0,Object.keys(e).forEach((function(t){e[t].rejecter("Promise pool cleared."),delete e[t]})),this._currentPoll=this._poll()}},{key:"add",value:function(o){var i=this;o?(t="in-progress",f(o).forEach((function(t){if(!(t instanceof Promise)){if("function"!=typeof t){return console.info("---\x3e Invalid promise added to the pool."),void r.push(t.toString())}t=N((function(){return t()}))}n.total++;var o=p();e[o]={status:"in-progress",response:null,error:null,resolver:null,rejecter:null},new Promise((function(n,u){e[o].resolver=function(t){"rejected"!==e[o].status&&(e[o].status="completed",e[o].response=t,i._updateStatus(),n(t))},e[o].rejecter=function(t){e[o].status="rejected",e[o].error=t,r.push(t),i._updateStatus(),u()},t.then((function(t){var r;null===(r=e[o])||void 0===r||r.resolver(t)})).catch((function(t){var r;null===(r=e[o])||void 0===r||r.rejecter(t)}))})).catch((function(t){var r;null===(r=e[o])||void 0===r||r.rejecter(t)}))}))):i._updateStatus()}},{key:"status",value:function(){return this._updateStatus(),t}},{key:"isDone",value:function(){return this._updateStatus(),"done"===t}},{key:"isEmpty",value:function(){return 0===n.total}},{key:"results",value:function(){return this._updateStatus(),n}},{key:"stats",value:function(){return this.results()}},{key:"_updateStatus",value:function(){if("done"!==t){var o=Object.values(e);n={completed:o.filter((function(t){return"completed"===t.status})).length,rejected:o.filter((function(t){return"rejected"===t.status})).length,pending:o.filter((function(t){return"in-progress"===t.status})).length,total:o.length,errors:r.join("\n"),promises:e},this.emit("stats",n);var i=o.every((function(t){return"completed"===t.status||"rejected"===t.status}));"done"===(t=i||0===n.total?"done":"in-progress")&&(this.emit("done",n),n.total>0&&(this.emit("completed",n),this.emit("rejected",r,n)))}}}])}(a))},C={};function q(t,e,r){for(var n=arguments.length,o=new Array(n>3?n-3:0),i=3;i<n;i++){o[i-3]=arguments[i]}var u,a;if("string"==typeof t&&"number"==typeof e){u=t,a=e}else if("number"==typeof t&&"function"==typeof e){a=t,r=e}else{if(e||"string"!=typeof t){throw new Error("Invalid parameters")}u=t}var c=u?"_doTimeout_"+u:null;function s(){c&&c in C&&delete C[c]}if(c&&c in C&&(clearTimeout(C[c]),delete C[c]),"function"==typeof r&&"number"==typeof a){return function t(){C[c]=setTimeout((function(){!0===r.apply(void 0,o)?t():s()}),a)}(),!0}u&&void 0===a&&s()}function N(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++){r[n-1]=arguments[n]}return new Promise((function(e,n){try{Promise.resolve(t.apply(void 0,r)).then((function(t){return e(t)})).catch((function(t){return n(t)}))}catch(t){n(t)}}))}window.promiseQueue=e})(); | ||
(()=>{"use strict";var t={d:(e,r)=>{for(var n in r){t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})}},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t){return function(t){if(Array.isArray(t)){return o(t)}}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"]){return Array.from(t)}}(t)||function(t,e){if(t){if("string"==typeof t){return o(t,e)}var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++){n[r]=t[r]}return n}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function u(t){var e=function(t,e){if("object"!=r(t)||!t){return t}var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=r(o)){return o}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==r(e)?e:e+""}t.r(e),t.d(e,{doAsync:()=>N,doPoll:()=>A,doTimeout:()=>q,promisePool:()=>I,promiseQueue:()=>T});var a=function(){return t=function t(){!function(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}(this,t),this.listeners={}},e=[{key:"on",value:function(t,e){this.registerListener(t,e)}},{key:"once",value:function(t,e){this.registerListener(t,e,1)}},{key:"exactly",value:function(t,e,r){this.registerListener(t,e,r)}},{key:"off",value:function(t){delete this.listeners[t]}},{key:"detach",value:function(t,e){var r=(this.listeners[t]||[]).filter((function(t){return t.callback!==e}));return t in this.listeners&&(this.listeners[t]=r,!0)}},{key:"emit",value:function(t){for(var e=this,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++){o[i-1]=arguments[i]}var u=[],a=null,c=this.extractContextFromArgs(o),s=c[0];if(o=c[1],this.hasListener(t)){u=this.listeners[t]}else if(t.includes("*")){(a=this.patternSearch(t,Object.keys(this.listeners))).length>0&&a.forEach((function(t){u=u.concat(e.listeners[t])}))}else{for(var l in this.listeners){l.includes("*")&&(a=this.patternSearch(l,[t]))&&(u=u.concat(this.listeners[l]))}}u.forEach((function(r,i){var a=r.callback;s&&(a=a.bind(s)),void 0!==r.triggerCapacity&&(r.triggerCapacity--,u[i].triggerCapacity=r.triggerCapacity),e.checkToRemoveListener(r)&&e.listeners[t].splice(i,1),a.apply(void 0,n(o))}))}},{key:"patternSearch",value:function(t,e){var r,n=new RegExp(this.setWildCardString(t),"g");return 0===(r=e.filter((function(t){return n.test(t)}))).length?null:r}},{key:"setWildCardString",value:function(t){var e=t.replace(/([.+?^${}()|\[\]\/\\])/g,"\\$&");return e=e.replace(/\*/g,"(.*?)"),"^".concat(e)}},{key:"extractContextFromArgs",value:function(t){for(var e=null,n=0;n<t.length;n++){var o=t[n];if(o&&"object"===r(o)&&o.hasOwnProperty("__context")){e=o.__context,t.splice(n,1);break}}return[e,t]}},{key:"registerListener",value:function(t,e,r){this.hasListener(t)||(this.listeners[t]=[]),this.listeners[t].push({callback:e,triggerCapacity:r})}},{key:"checkToRemoveListener",value:function(t){return void 0!==t.triggerCapacity&&t.triggerCapacity<=0}},{key:"hasListener",value:function(t){return t in this.listeners}}],e&&i(t.prototype,e),o&&i(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o}();function c(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t){return s(t,e)}var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a){throw i}}}}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++){n[r]=t[r]}return n}function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}var f=function(t){return Array.isArray(t)?t:[t]},h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;t=t||40;for(var e="",r=0;r<t/3+1;r++){e+=Math.random().toString(36).substring(2,15)}return e.substring(0,t)};function p(){return"id__"+h(8)+"__"+(new Date).getTime()}function y(t,e){if(null===t){return e?null===e||"null"===e:"null"}var r;switch(l(t)){case"number":case"string":case"boolean":case"undefined":case"bigint":case"symbol":case"function":r=l(t);break;case"object":r=Array.isArray(t)?"array":"object";break;default:r="unknown"}if(e){if(e.includes("|")){var n,o=c(e.split("|"));try{for(o.s();!(n=o.n()).done;){var i=n.value;if(r===i){return i}}}catch(t){o.e(t)}finally{o.f()}return!1}return e===r}return r}function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function d(){d=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,u=Object.create(i.prototype),a=new I(n||[]);return o(u,"_invoke",{value:x(t,r,a)}),u}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var h="suspendedStart",p="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function _(){}var j={};s(j,u,(function(){return this}));var P=Object.getPrototypeOf,O=P&&P(P(C([])));O&&O!==r&&n.call(O,u)&&(j=O);var S=_.prototype=b.prototype=Object.create(j);function k(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function r(o,i,u,a){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==v(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){s.value=t,u(s)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function x(e,r,n){var o=h;return function(i,u){if(o===y){throw Error("Generator is already running")}if(o===m){if("throw"===i){throw u}return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=L(a,n);if(c){if(c===g){continue}return c}}if("next"===n.method){n.sent=n._sent=n.arg}else if("throw"===n.method){if(o===h){throw o=m,n.arg}n.dispatchException(n.arg)}else{"return"===n.method&&n.abrupt("return",n.arg)}o=y;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?m:p,s.arg===g){continue}return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function L(e,r){var n=r.method,o=e.iterator[n];if(o===t){return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,L(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g}var i=f(o,e.iterator,r.arg);if("throw"===i.type){return r.method="throw",r.arg=i.arg,r.delegate=null,g}var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r){return r.call(e)}if("function"==typeof e.next){return e}if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;){if(n.call(e,o)){return r.value=e[o],r.done=!1,r}}return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(v(e)+" is not iterable")}return w.prototype=_,o(S,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:w,configurable:!0}),w.displayName=s(_,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,s(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},k(E.prototype),s(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new E(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},k(S),s(S,c,"Generator"),s(S,u,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e){r.push(n)}return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e){return t.value=n,t.done=!1,t}}return t.done=!0,t}},e.values=C,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e){for(var r in this){"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)}}},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type){throw t.arg}return this.rval},dispatchException:function(e){if(this.done){throw e}var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc){return o("end")}if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),s=n.call(u,"finallyLoc");if(c&&s){if(this.prev<u.catchLoc){return o(u.catchLoc,!0)}if(this.prev<u.finallyLoc){return o(u.finallyLoc)}}else if(c){if(this.prev<u.catchLoc){return o(u.catchLoc,!0)}}else{if(!s){throw Error("try statement without catch or finally")}if(this.prev<u.finallyLoc){return o(u.finallyLoc)}}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(u)},complete:function(t,e){if("throw"===t.type){throw t.arg}return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t){return this.complete(r.completion,r.afterLoc),A(r),g}}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function m(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function g(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?g(Object(r),!0).forEach((function(e){w(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function w(t,e,r){return(e=O(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}function j(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,O(n.key),n)}}function P(t,e,r){return e&&j(t.prototype,e),r&&j(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function O(t){var e=function(t,e){if("object"!=v(t)||!t){return t}var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=v(n)){return n}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==v(e)?e:e+""}function S(t,e,r){return e=E(e),function(t,e){if(e&&("object"==v(e)||"function"==typeof e)){return e}if(void 0!==e){throw new TypeError("Derived constructors may only return object or undefined")}return function(t){if(void 0===t){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}(t)}(t,k()?Reflect.construct(e,r||[],E(t).constructor):e.apply(t,r))}function k(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(k=function(){return!!t})()}function E(t){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},E(t)}function x(t,e){if("function"!=typeof e&&null!==e){throw new TypeError("Super expression must either be null or a function")}t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&L(t,e)}function L(t,e){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},L(t,e)}var T=function(){var t={completed:0,rejected:0,pending:0,total:0,errors:"",promises:[]};return new(function(e){function r(){var e;return _(this,r),(e=S(this,r)).queue=[],e.inProgress=!1,e._timer=null,e._stats=b({},t),e}return x(r,e),P(r,[{key:"add",value:function(t){var e=this;if(!(t instanceof Promise||!!Array.isArray(t)&&t.length>0&&t.every((function(t){return t instanceof Promise})))){if(!y(t,"function")){return console.error("---\x3e Invalid promise added to the Queue:",t.toString()),this.emit("fail",t.toString())}t=new Promise(function(){var e,r=(e=d().mark((function e(r){var n;return d().wrap((function(e){for(;;){switch(e.prev=e.next){case 0:return e.next=2,t();case 2:return n=e.sent,e.abrupt("return",r(n));case 4:case"end":return e.stop()}}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(t){m(i,n,o,u,a,"next",t)}function a(t){m(i,n,o,u,a,"throw",t)}u(void 0)}))});return function(t){return r.apply(this,arguments)}}())}f(t).forEach((function(t){e._stats.total++,e._stats.pending++,e.queue.push({promiseFunction:t,response:null,status:"pending",error:null})})),this.inProgress||this._next(),this._setTimer()}},{key:"clear",value:function(){return this._timer&&clearInterval(this._timer),this._timer=null,this.queue=[],this.inProgress=!1,this._stats=b({},t),this}},{key:"_setTimer",value:function(){var t=this;this._timer&&clearInterval(this._timer),this._timer=setInterval((function(){"done"===t.status()&&(clearInterval(t._timer),t._timer=null,t.emit("completed",t._stats),t.emit("done",t._stats))}),10)}},{key:"_next",value:function(){var t=this;0!==this.queue.length?(this.inProgress=!0,this.queue[0].promiseFunction.then((function(e){t.queue[0].status="fulfilled",t.queue[0].response=e,t._stats.completed++})).catch((function(e){t._stats.errors+=e+"\n",t.queue[0].status="rejected",t._stats.rejected++})).finally((function(){t._stats.promises.push(t.queue[0]),t._stats.pending--,t.queue.shift(),t._next()}))):this.inProgress=!1}},{key:"stats",value:function(){return this._stats}},{key:"status",value:function(){return 0===this.queue.length?"done":"in-progress"}}])}(a))},A=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof t&&"object"!==v(t)){throw new Error("doPoll: The first argument must be a function or Promise.")}var r,n,o,i,u=function(t){return t instanceof Promise},a=e.msg,c=e.interval,s=void 0===c?200:c,l=e.timeout,f=void 0===l?1e3:l,h=e.timeoutMsg,p=void 0===h?null!=a?a:"===> doPoll: cancelled or timed out.":h,d=!1,m=!1,g=function(){if(w(),y(p,"string")){return console.info(p),void i(p)}i()},b=function(t){w(),o(t)};function w(){d=!0,clearTimeout(r),clearInterval(n)}var _=new Promise((function(e,a){o=e,i=a;var c=function(){if(!d&&!m){var e=u(t)?t:t();u(e)?(m=!0,e.then((function(t){m=!1,t&&b(t)})).catch(i)):(Boolean(e)||e)&&b(e)}};n=setInterval(c,s),c(),r=setTimeout((function(){d||g()}),f)}));return _.catch((function(){g()})),{promise:_,stop:g}},I=function(){var t="not-started",e={},r=[],n={completed:0,rejected:0,pending:0,total:0,errors:""};return new(function(o){function i(){var t;_(this,i);var e=t=S(this,i);return t._currentPoll=null,setTimeout((function(){e._poll()}),100),t}return x(i,o),P(i,[{key:"_poll",value:function(){var t=this;return this._currentPoll&&this._currentPoll.stop(),this._currentPoll=A((function(){if(t.isDone()){return!0}}),{timeoutMsg:""}),this._currentPoll}},{key:"clear",value:function(){t="not-started",n={completed:0,rejected:0,pending:0,total:0,errors:""},r.length=0,Object.keys(e).forEach((function(t){e[t].rejecter("Promise pool cleared."),delete e[t]})),this._currentPoll=this._poll()}},{key:"add",value:function(o){var i=this;o?(t="in-progress",f(o).forEach((function(t){if(!(t instanceof Promise)){if("function"!=typeof t){return console.info("---\x3e Invalid promise added to the pool."),void r.push(t.toString())}t=N((function(){return t()}))}n.total++;var o=p();e[o]={status:"in-progress",response:null,error:null,resolver:null,rejecter:null},new Promise((function(n,u){e[o].resolver=function(t){"rejected"!==e[o].status&&(e[o].status="completed",e[o].response=t,i._updateStatus(),n(t))},e[o].rejecter=function(t){e[o].status="rejected",e[o].error=t,r.push(t),i._updateStatus(),u()},t.then((function(t){var r;null===(r=e[o])||void 0===r||r.resolver(t)})).catch((function(t){var r;null===(r=e[o])||void 0===r||r.rejecter(t)}))})).catch((function(t){var r;null===(r=e[o])||void 0===r||r.rejecter(t)}))}))):i._updateStatus()}},{key:"status",value:function(){return this._updateStatus(),t}},{key:"isDone",value:function(){return this._updateStatus(),"done"===t}},{key:"isEmpty",value:function(){return 0===n.total}},{key:"results",value:function(){return this._updateStatus(),n}},{key:"stats",value:function(){return this.results()}},{key:"_updateStatus",value:function(){if("done"!==t){var o=Object.values(e);n={completed:o.filter((function(t){return"completed"===t.status})).length,rejected:o.filter((function(t){return"rejected"===t.status})).length,pending:o.filter((function(t){return"in-progress"===t.status})).length,total:o.length,errors:r.join("\n"),promises:e},this.emit("stats",n);var i=o.every((function(t){return"completed"===t.status||"rejected"===t.status}));"done"===(t=i||0===n.total?"done":"in-progress")&&(this.emit("done",n),n.total>0&&(this.emit("completed",n),this.emit("rejected",r,n)))}}}])}(a))},C={};function q(t,e,r){for(var n=arguments.length,o=new Array(n>3?n-3:0),i=3;i<n;i++){o[i-3]=arguments[i]}var u,a;if("string"==typeof t&&"number"==typeof e){u=t,a=e}else if("number"==typeof t&&"function"==typeof e){a=t,r=e}else{if(e||"string"!=typeof t){throw new Error("Invalid parameters")}u=t}var c=u?"_doTimeout_"+u:null;function s(){c&&c in C&&delete C[c]}if(c&&c in C&&(clearTimeout(C[c]),delete C[c]),"function"==typeof r&&"number"==typeof a){return function t(){C[c]=setTimeout((function(){!0===r.apply(void 0,o)?t():s()}),a)}(),!0}u&&void 0===a&&s()}function N(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++){r[n-1]=arguments[n]}return new Promise((function(e,n){try{Promise.resolve(t.apply(void 0,r)).then((function(t){return e(t)})).catch((function(t){return n(t)}))}catch(t){n(t)}}))}window.promiseQueue=e})(); |
@@ -1,1 +0,1 @@ | ||
(()=>{"use strict";var t={d:(e,r)=>{for(var n in r){t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})}},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t){return function(t){if(Array.isArray(t)){return o(t)}}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"]){return Array.from(t)}}(t)||function(t,e){if(t){if("string"==typeof t){return o(t,e)}var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++){n[r]=t[r]}return n}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function u(t){var e=function(t,e){if("object"!=r(t)||!t){return t}var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=r(o)){return o}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==r(e)?e:e+""}t.r(e),t.d(e,{doAsync:()=>N,doPoll:()=>A,doTimeout:()=>q,promisePool:()=>I,promiseQueue:()=>T});var a=function(){return t=function t(){!function(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}(this,t),this.listeners={}},e=[{key:"on",value:function(t,e){this.registerListener(t,e)}},{key:"once",value:function(t,e){this.registerListener(t,e,1)}},{key:"exactly",value:function(t,e,r){this.registerListener(t,e,r)}},{key:"off",value:function(t){delete this.listeners[t]}},{key:"detach",value:function(t,e){var r=(this.listeners[t]||[]).filter((function(t){return t.callback!==e}));return t in this.listeners&&(this.listeners[t]=r,!0)}},{key:"emit",value:function(t){for(var e=this,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++){o[i-1]=arguments[i]}var u=[],a=null,c=this.extractContextFromArgs(o),s=c[0];if(o=c[1],this.hasListener(t)){u=this.listeners[t]}else if(t.includes("*")){(a=this.patternSearch(t,Object.keys(this.listeners))).length>0&&a.forEach((function(t){u=u.concat(e.listeners[t])}))}else{for(var l in this.listeners){l.includes("*")&&(a=this.patternSearch(l,[t]))&&(u=u.concat(this.listeners[l]))}}u.forEach((function(r,i){var a=r.callback;s&&(a=a.bind(s)),void 0!==r.triggerCapacity&&(r.triggerCapacity--,u[i].triggerCapacity=r.triggerCapacity),e.checkToRemoveListener(r)&&e.listeners[t].splice(i,1),a.apply(void 0,n(o))}))}},{key:"patternSearch",value:function(t,e){var r,n=new RegExp(this.setWildCardString(t),"g");return 0===(r=e.filter((function(t){return n.test(t)}))).length?null:r}},{key:"setWildCardString",value:function(t){var e=t.replace(/([.+?^${}()|\[\]\/\\])/g,"\\$&");return e=e.replace(/\*/g,"(.*?)"),"^".concat(e)}},{key:"extractContextFromArgs",value:function(t){for(var e=null,n=0;n<t.length;n++){var o=t[n];if(o&&"object"===r(o)&&o.hasOwnProperty("__context")){e=o.__context,t.splice(n,1);break}}return[e,t]}},{key:"registerListener",value:function(t,e,r){this.hasListener(t)||(this.listeners[t]=[]),this.listeners[t].push({callback:e,triggerCapacity:r})}},{key:"checkToRemoveListener",value:function(t){return void 0!==t.triggerCapacity&&t.triggerCapacity<=0}},{key:"hasListener",value:function(t){return t in this.listeners}}],e&&i(t.prototype,e),o&&i(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o}();function c(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t){return s(t,e)}var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a){throw i}}}}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++){n[r]=t[r]}return n}function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}var f=function(t){return Array.isArray(t)?t:[t]},h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;t=t||40;for(var e="",r=0;r<t/3+1;r++){e+=Math.random().toString(36).substring(2,15)}return e.substring(0,t)};function p(){return"id__"+h(8)+"__"+(new Date).getTime()}function y(t,e){if(null===t){return e?null===e||"null"===e:"null"}var r;switch(l(t)){case"number":case"string":case"boolean":case"undefined":case"bigint":case"symbol":case"function":r=l(t);break;case"object":r=Array.isArray(t)?"array":"object";break;default:r="unknown"}if(e){if(e.includes("|")){var n,o=c(e.split("|"));try{for(o.s();!(n=o.n()).done;){var i=n.value;if(r===i){return i}}}catch(t){o.e(t)}finally{o.f()}return!1}return e===r}return r}function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function d(){d=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,u=Object.create(i.prototype),a=new I(n||[]);return o(u,"_invoke",{value:x(t,r,a)}),u}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var h="suspendedStart",p="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function _(){}var j={};s(j,u,(function(){return this}));var P=Object.getPrototypeOf,O=P&&P(P(C([])));O&&O!==r&&n.call(O,u)&&(j=O);var S=_.prototype=b.prototype=Object.create(j);function k(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function r(o,i,u,a){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==v(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){s.value=t,u(s)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function x(e,r,n){var o=h;return function(i,u){if(o===y){throw Error("Generator is already running")}if(o===m){if("throw"===i){throw u}return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=L(a,n);if(c){if(c===g){continue}return c}}if("next"===n.method){n.sent=n._sent=n.arg}else if("throw"===n.method){if(o===h){throw o=m,n.arg}n.dispatchException(n.arg)}else{"return"===n.method&&n.abrupt("return",n.arg)}o=y;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?m:p,s.arg===g){continue}return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function L(e,r){var n=r.method,o=e.iterator[n];if(o===t){return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,L(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g}var i=f(o,e.iterator,r.arg);if("throw"===i.type){return r.method="throw",r.arg=i.arg,r.delegate=null,g}var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r){return r.call(e)}if("function"==typeof e.next){return e}if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;){if(n.call(e,o)){return r.value=e[o],r.done=!1,r}}return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(v(e)+" is not iterable")}return w.prototype=_,o(S,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:w,configurable:!0}),w.displayName=s(_,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,s(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},k(E.prototype),s(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new E(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},k(S),s(S,c,"Generator"),s(S,u,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e){r.push(n)}return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e){return t.value=n,t.done=!1,t}}return t.done=!0,t}},e.values=C,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e){for(var r in this){"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)}}},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type){throw t.arg}return this.rval},dispatchException:function(e){if(this.done){throw e}var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc){return o("end")}if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),s=n.call(u,"finallyLoc");if(c&&s){if(this.prev<u.catchLoc){return o(u.catchLoc,!0)}if(this.prev<u.finallyLoc){return o(u.finallyLoc)}}else if(c){if(this.prev<u.catchLoc){return o(u.catchLoc,!0)}}else{if(!s){throw Error("try statement without catch or finally")}if(this.prev<u.finallyLoc){return o(u.finallyLoc)}}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(u)},complete:function(t,e){if("throw"===t.type){throw t.arg}return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t){return this.complete(r.completion,r.afterLoc),A(r),g}}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function m(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function g(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?g(Object(r),!0).forEach((function(e){w(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function w(t,e,r){return(e=O(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}function j(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,O(n.key),n)}}function P(t,e,r){return e&&j(t.prototype,e),r&&j(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function O(t){var e=function(t,e){if("object"!=v(t)||!t){return t}var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=v(n)){return n}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==v(e)?e:e+""}function S(t,e,r){return e=E(e),function(t,e){if(e&&("object"==v(e)||"function"==typeof e)){return e}if(void 0!==e){throw new TypeError("Derived constructors may only return object or undefined")}return function(t){if(void 0===t){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}(t)}(t,k()?Reflect.construct(e,r||[],E(t).constructor):e.apply(t,r))}function k(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(k=function(){return!!t})()}function E(t){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},E(t)}function x(t,e){if("function"!=typeof e&&null!==e){throw new TypeError("Super expression must either be null or a function")}t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&L(t,e)}function L(t,e){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},L(t,e)}var T=function(){var t={completed:0,rejected:0,pending:0,total:0,errors:"",promises:[]};return new(function(e){function r(){var e;return _(this,r),(e=S(this,r)).queue=[],e.inProgress=!1,e._timer=null,e._stats=b({},t),e}return x(r,e),P(r,[{key:"add",value:function(t){var e=this;if(!(t instanceof Promise||!!Array.isArray(t)&&t.length>0&&t.every((function(t){return t instanceof Promise})))){if(!y(t,"function")){return console.error("---\x3e Invalid promise added to the Queue:",t.toString()),this.emit("fail",t.toString())}t=new Promise(function(){var e,r=(e=d().mark((function e(r){var n;return d().wrap((function(e){for(;;){switch(e.prev=e.next){case 0:return e.next=2,t();case 2:return n=e.sent,e.abrupt("return",r(n));case 4:case"end":return e.stop()}}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(t){m(i,n,o,u,a,"next",t)}function a(t){m(i,n,o,u,a,"throw",t)}u(void 0)}))});return function(t){return r.apply(this,arguments)}}())}f(t).forEach((function(t){e._stats.total++,e._stats.pending++,e.queue.push({promiseFunction:t,response:null,status:"pending",error:null})})),this.inProgress||this._next(),this._setTimer()}},{key:"clear",value:function(){return this._timer&&clearInterval(this._timer),this._timer=null,this.queue=[],this.inProgress=!1,this._stats=b({},t),this}},{key:"_setTimer",value:function(){var t=this;this._timer&&clearInterval(this._timer),this._timer=setInterval((function(){"done"===t.status()&&(clearInterval(t._timer),t._timer=null,t.emit("completed",t._stats),t.emit("done",t._stats))}),10)}},{key:"_next",value:function(){var t=this;0!==this.queue.length?(this.inProgress=!0,this.queue[0].promiseFunction.then((function(e){t.queue[0].status="fulfilled",t.queue[0].response=e,t._stats.completed++})).catch((function(e){t._stats.errors+=e+"\n",t.queue[0].status="rejected",t._stats.rejected++})).finally((function(){t._stats.promises.push(t.queue[0]),t._stats.pending--,t.queue.shift(),t._next()}))):this.inProgress=!1}},{key:"stats",value:function(){return this._stats}},{key:"status",value:function(){return 0===this.queue.length?"done":"in-progress"}}])}(a))},A=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof t&&"object"!==v(t)){throw new Error("doPoll: The first argument must be a function or Promise.")}var r,n,o,i,u=function(t){return t instanceof Promise},a=e.interval,c=void 0===a?200:a,s=e.timeout,l=void 0===s?1e3:s,f=e.timeoutMsg,h=void 0===f?"===> doPoll: cancelled or timed out.":f,p=!1,y=!1,d=function(){g(),i(console.info(h))},m=function(t){g(),o(t)};function g(){p=!0,clearTimeout(r),clearInterval(n)}var b=new Promise((function(e,a){o=e,i=a;var s=function(){if(!p&&!y){var e=u(t)?t:t();u(e)?(y=!0,e.then((function(t){y=!1,t&&m(t)})).catch(i)):(Boolean(e)||e)&&m(e)}};n=setInterval(s,c),s(),r=setTimeout((function(){p||d()}),l)}));return b.catch((function(){d()})),{promise:b,stop:d}},I=function(){var t="not-started",e={},r=[],n={completed:0,rejected:0,pending:0,total:0,errors:""};return new(function(o){function i(){var t;_(this,i);var e=t=S(this,i);return t._currentPoll=null,setTimeout((function(){e._poll()}),100),t}return x(i,o),P(i,[{key:"_poll",value:function(){var t=this;return this._currentPoll&&this._currentPoll.stop(),this._currentPoll=A((function(){if(t.isDone()){return!0}}),{timeoutMsg:""}),this._currentPoll}},{key:"clear",value:function(){t="not-started",n={completed:0,rejected:0,pending:0,total:0,errors:""},r.length=0,Object.keys(e).forEach((function(t){e[t].rejecter("Promise pool cleared."),delete e[t]})),this._currentPoll=this._poll()}},{key:"add",value:function(o){var i=this;o?(t="in-progress",f(o).forEach((function(t){if(!(t instanceof Promise)){if("function"!=typeof t){return console.info("---\x3e Invalid promise added to the pool."),void r.push(t.toString())}t=N((function(){return t()}))}n.total++;var o=p();e[o]={status:"in-progress",response:null,error:null,resolver:null,rejecter:null},new Promise((function(n,u){e[o].resolver=function(t){"rejected"!==e[o].status&&(e[o].status="completed",e[o].response=t,i._updateStatus(),n(t))},e[o].rejecter=function(t){e[o].status="rejected",e[o].error=t,r.push(t),i._updateStatus(),u()},t.then((function(t){var r;null===(r=e[o])||void 0===r||r.resolver(t)})).catch((function(t){var r;null===(r=e[o])||void 0===r||r.rejecter(t)}))})).catch((function(t){var r;null===(r=e[o])||void 0===r||r.rejecter(t)}))}))):i._updateStatus()}},{key:"status",value:function(){return this._updateStatus(),t}},{key:"isDone",value:function(){return this._updateStatus(),"done"===t}},{key:"isEmpty",value:function(){return 0===n.total}},{key:"results",value:function(){return this._updateStatus(),n}},{key:"stats",value:function(){return this.results()}},{key:"_updateStatus",value:function(){if("done"!==t){var o=Object.values(e);n={completed:o.filter((function(t){return"completed"===t.status})).length,rejected:o.filter((function(t){return"rejected"===t.status})).length,pending:o.filter((function(t){return"in-progress"===t.status})).length,total:o.length,errors:r.join("\n"),promises:e},this.emit("stats",n);var i=o.every((function(t){return"completed"===t.status||"rejected"===t.status}));"done"===(t=i||0===n.total?"done":"in-progress")&&(this.emit("done",n),n.total>0&&(this.emit("completed",n),this.emit("rejected",r,n)))}}}])}(a))},C={};function q(t,e,r){for(var n=arguments.length,o=new Array(n>3?n-3:0),i=3;i<n;i++){o[i-3]=arguments[i]}var u,a;if("string"==typeof t&&"number"==typeof e){u=t,a=e}else if("number"==typeof t&&"function"==typeof e){a=t,r=e}else{if(e||"string"!=typeof t){throw new Error("Invalid parameters")}u=t}var c=u?"_doTimeout_"+u:null;function s(){c&&c in C&&delete C[c]}if(c&&c in C&&(clearTimeout(C[c]),delete C[c]),"function"==typeof r&&"number"==typeof a){return function t(){C[c]=setTimeout((function(){!0===r.apply(void 0,o)?t():s()}),a)}(),!0}u&&void 0===a&&s()}function N(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++){r[n-1]=arguments[n]}return new Promise((function(e,n){try{Promise.resolve(t.apply(void 0,r)).then((function(t){return e(t)})).catch((function(t){return n(t)}))}catch(t){n(t)}}))}window.promises=e})(); | ||
(()=>{"use strict";var t={d:(e,r)=>{for(var n in r){t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})}},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t){return function(t){if(Array.isArray(t)){return o(t)}}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"]){return Array.from(t)}}(t)||function(t,e){if(t){if("string"==typeof t){return o(t,e)}var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++){n[r]=t[r]}return n}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function u(t){var e=function(t,e){if("object"!=r(t)||!t){return t}var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=r(o)){return o}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==r(e)?e:e+""}t.r(e),t.d(e,{doAsync:()=>N,doPoll:()=>A,doTimeout:()=>q,promisePool:()=>I,promiseQueue:()=>T});var a=function(){return t=function t(){!function(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}(this,t),this.listeners={}},e=[{key:"on",value:function(t,e){this.registerListener(t,e)}},{key:"once",value:function(t,e){this.registerListener(t,e,1)}},{key:"exactly",value:function(t,e,r){this.registerListener(t,e,r)}},{key:"off",value:function(t){delete this.listeners[t]}},{key:"detach",value:function(t,e){var r=(this.listeners[t]||[]).filter((function(t){return t.callback!==e}));return t in this.listeners&&(this.listeners[t]=r,!0)}},{key:"emit",value:function(t){for(var e=this,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++){o[i-1]=arguments[i]}var u=[],a=null,c=this.extractContextFromArgs(o),s=c[0];if(o=c[1],this.hasListener(t)){u=this.listeners[t]}else if(t.includes("*")){(a=this.patternSearch(t,Object.keys(this.listeners))).length>0&&a.forEach((function(t){u=u.concat(e.listeners[t])}))}else{for(var l in this.listeners){l.includes("*")&&(a=this.patternSearch(l,[t]))&&(u=u.concat(this.listeners[l]))}}u.forEach((function(r,i){var a=r.callback;s&&(a=a.bind(s)),void 0!==r.triggerCapacity&&(r.triggerCapacity--,u[i].triggerCapacity=r.triggerCapacity),e.checkToRemoveListener(r)&&e.listeners[t].splice(i,1),a.apply(void 0,n(o))}))}},{key:"patternSearch",value:function(t,e){var r,n=new RegExp(this.setWildCardString(t),"g");return 0===(r=e.filter((function(t){return n.test(t)}))).length?null:r}},{key:"setWildCardString",value:function(t){var e=t.replace(/([.+?^${}()|\[\]\/\\])/g,"\\$&");return e=e.replace(/\*/g,"(.*?)"),"^".concat(e)}},{key:"extractContextFromArgs",value:function(t){for(var e=null,n=0;n<t.length;n++){var o=t[n];if(o&&"object"===r(o)&&o.hasOwnProperty("__context")){e=o.__context,t.splice(n,1);break}}return[e,t]}},{key:"registerListener",value:function(t,e,r){this.hasListener(t)||(this.listeners[t]=[]),this.listeners[t].push({callback:e,triggerCapacity:r})}},{key:"checkToRemoveListener",value:function(t){return void 0!==t.triggerCapacity&&t.triggerCapacity<=0}},{key:"hasListener",value:function(t){return t in this.listeners}}],e&&i(t.prototype,e),o&&i(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o}();function c(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t){return s(t,e)}var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a){throw i}}}}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++){n[r]=t[r]}return n}function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}var f=function(t){return Array.isArray(t)?t:[t]},h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;t=t||40;for(var e="",r=0;r<t/3+1;r++){e+=Math.random().toString(36).substring(2,15)}return e.substring(0,t)};function p(){return"id__"+h(8)+"__"+(new Date).getTime()}function y(t,e){if(null===t){return e?null===e||"null"===e:"null"}var r;switch(l(t)){case"number":case"string":case"boolean":case"undefined":case"bigint":case"symbol":case"function":r=l(t);break;case"object":r=Array.isArray(t)?"array":"object";break;default:r="unknown"}if(e){if(e.includes("|")){var n,o=c(e.split("|"));try{for(o.s();!(n=o.n()).done;){var i=n.value;if(r===i){return i}}}catch(t){o.e(t)}finally{o.f()}return!1}return e===r}return r}function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function d(){d=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,u=Object.create(i.prototype),a=new I(n||[]);return o(u,"_invoke",{value:x(t,r,a)}),u}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var h="suspendedStart",p="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function _(){}var j={};s(j,u,(function(){return this}));var P=Object.getPrototypeOf,O=P&&P(P(C([])));O&&O!==r&&n.call(O,u)&&(j=O);var S=_.prototype=b.prototype=Object.create(j);function k(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function r(o,i,u,a){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==v(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){s.value=t,u(s)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function x(e,r,n){var o=h;return function(i,u){if(o===y){throw Error("Generator is already running")}if(o===m){if("throw"===i){throw u}return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=L(a,n);if(c){if(c===g){continue}return c}}if("next"===n.method){n.sent=n._sent=n.arg}else if("throw"===n.method){if(o===h){throw o=m,n.arg}n.dispatchException(n.arg)}else{"return"===n.method&&n.abrupt("return",n.arg)}o=y;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?m:p,s.arg===g){continue}return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function L(e,r){var n=r.method,o=e.iterator[n];if(o===t){return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,L(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g}var i=f(o,e.iterator,r.arg);if("throw"===i.type){return r.method="throw",r.arg=i.arg,r.delegate=null,g}var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r){return r.call(e)}if("function"==typeof e.next){return e}if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;){if(n.call(e,o)){return r.value=e[o],r.done=!1,r}}return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(v(e)+" is not iterable")}return w.prototype=_,o(S,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:w,configurable:!0}),w.displayName=s(_,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,s(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},k(E.prototype),s(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new E(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},k(S),s(S,c,"Generator"),s(S,u,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e){r.push(n)}return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e){return t.value=n,t.done=!1,t}}return t.done=!0,t}},e.values=C,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e){for(var r in this){"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)}}},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type){throw t.arg}return this.rval},dispatchException:function(e){if(this.done){throw e}var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc){return o("end")}if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),s=n.call(u,"finallyLoc");if(c&&s){if(this.prev<u.catchLoc){return o(u.catchLoc,!0)}if(this.prev<u.finallyLoc){return o(u.finallyLoc)}}else if(c){if(this.prev<u.catchLoc){return o(u.catchLoc,!0)}}else{if(!s){throw Error("try statement without catch or finally")}if(this.prev<u.finallyLoc){return o(u.finallyLoc)}}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(u)},complete:function(t,e){if("throw"===t.type){throw t.arg}return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t){return this.complete(r.completion,r.afterLoc),A(r),g}}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function m(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function g(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?g(Object(r),!0).forEach((function(e){w(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function w(t,e,r){return(e=O(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}function j(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,O(n.key),n)}}function P(t,e,r){return e&&j(t.prototype,e),r&&j(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function O(t){var e=function(t,e){if("object"!=v(t)||!t){return t}var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=v(n)){return n}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==v(e)?e:e+""}function S(t,e,r){return e=E(e),function(t,e){if(e&&("object"==v(e)||"function"==typeof e)){return e}if(void 0!==e){throw new TypeError("Derived constructors may only return object or undefined")}return function(t){if(void 0===t){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}(t)}(t,k()?Reflect.construct(e,r||[],E(t).constructor):e.apply(t,r))}function k(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(k=function(){return!!t})()}function E(t){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},E(t)}function x(t,e){if("function"!=typeof e&&null!==e){throw new TypeError("Super expression must either be null or a function")}t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&L(t,e)}function L(t,e){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},L(t,e)}var T=function(){var t={completed:0,rejected:0,pending:0,total:0,errors:"",promises:[]};return new(function(e){function r(){var e;return _(this,r),(e=S(this,r)).queue=[],e.inProgress=!1,e._timer=null,e._stats=b({},t),e}return x(r,e),P(r,[{key:"add",value:function(t){var e=this;if(!(t instanceof Promise||!!Array.isArray(t)&&t.length>0&&t.every((function(t){return t instanceof Promise})))){if(!y(t,"function")){return console.error("---\x3e Invalid promise added to the Queue:",t.toString()),this.emit("fail",t.toString())}t=new Promise(function(){var e,r=(e=d().mark((function e(r){var n;return d().wrap((function(e){for(;;){switch(e.prev=e.next){case 0:return e.next=2,t();case 2:return n=e.sent,e.abrupt("return",r(n));case 4:case"end":return e.stop()}}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(t){m(i,n,o,u,a,"next",t)}function a(t){m(i,n,o,u,a,"throw",t)}u(void 0)}))});return function(t){return r.apply(this,arguments)}}())}f(t).forEach((function(t){e._stats.total++,e._stats.pending++,e.queue.push({promiseFunction:t,response:null,status:"pending",error:null})})),this.inProgress||this._next(),this._setTimer()}},{key:"clear",value:function(){return this._timer&&clearInterval(this._timer),this._timer=null,this.queue=[],this.inProgress=!1,this._stats=b({},t),this}},{key:"_setTimer",value:function(){var t=this;this._timer&&clearInterval(this._timer),this._timer=setInterval((function(){"done"===t.status()&&(clearInterval(t._timer),t._timer=null,t.emit("completed",t._stats),t.emit("done",t._stats))}),10)}},{key:"_next",value:function(){var t=this;0!==this.queue.length?(this.inProgress=!0,this.queue[0].promiseFunction.then((function(e){t.queue[0].status="fulfilled",t.queue[0].response=e,t._stats.completed++})).catch((function(e){t._stats.errors+=e+"\n",t.queue[0].status="rejected",t._stats.rejected++})).finally((function(){t._stats.promises.push(t.queue[0]),t._stats.pending--,t.queue.shift(),t._next()}))):this.inProgress=!1}},{key:"stats",value:function(){return this._stats}},{key:"status",value:function(){return 0===this.queue.length?"done":"in-progress"}}])}(a))},A=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof t&&"object"!==v(t)){throw new Error("doPoll: The first argument must be a function or Promise.")}var r,n,o,i,u=function(t){return t instanceof Promise},a=e.msg,c=e.interval,s=void 0===c?200:c,l=e.timeout,f=void 0===l?1e3:l,h=e.timeoutMsg,p=void 0===h?null!=a?a:"===> doPoll: cancelled or timed out.":h,d=!1,m=!1,g=function(){if(w(),y(p,"string")){return console.info(p),void i(p)}i()},b=function(t){w(),o(t)};function w(){d=!0,clearTimeout(r),clearInterval(n)}var _=new Promise((function(e,a){o=e,i=a;var c=function(){if(!d&&!m){var e=u(t)?t:t();u(e)?(m=!0,e.then((function(t){m=!1,t&&b(t)})).catch(i)):(Boolean(e)||e)&&b(e)}};n=setInterval(c,s),c(),r=setTimeout((function(){d||g()}),f)}));return _.catch((function(){g()})),{promise:_,stop:g}},I=function(){var t="not-started",e={},r=[],n={completed:0,rejected:0,pending:0,total:0,errors:""};return new(function(o){function i(){var t;_(this,i);var e=t=S(this,i);return t._currentPoll=null,setTimeout((function(){e._poll()}),100),t}return x(i,o),P(i,[{key:"_poll",value:function(){var t=this;return this._currentPoll&&this._currentPoll.stop(),this._currentPoll=A((function(){if(t.isDone()){return!0}}),{timeoutMsg:""}),this._currentPoll}},{key:"clear",value:function(){t="not-started",n={completed:0,rejected:0,pending:0,total:0,errors:""},r.length=0,Object.keys(e).forEach((function(t){e[t].rejecter("Promise pool cleared."),delete e[t]})),this._currentPoll=this._poll()}},{key:"add",value:function(o){var i=this;o?(t="in-progress",f(o).forEach((function(t){if(!(t instanceof Promise)){if("function"!=typeof t){return console.info("---\x3e Invalid promise added to the pool."),void r.push(t.toString())}t=N((function(){return t()}))}n.total++;var o=p();e[o]={status:"in-progress",response:null,error:null,resolver:null,rejecter:null},new Promise((function(n,u){e[o].resolver=function(t){"rejected"!==e[o].status&&(e[o].status="completed",e[o].response=t,i._updateStatus(),n(t))},e[o].rejecter=function(t){e[o].status="rejected",e[o].error=t,r.push(t),i._updateStatus(),u()},t.then((function(t){var r;null===(r=e[o])||void 0===r||r.resolver(t)})).catch((function(t){var r;null===(r=e[o])||void 0===r||r.rejecter(t)}))})).catch((function(t){var r;null===(r=e[o])||void 0===r||r.rejecter(t)}))}))):i._updateStatus()}},{key:"status",value:function(){return this._updateStatus(),t}},{key:"isDone",value:function(){return this._updateStatus(),"done"===t}},{key:"isEmpty",value:function(){return 0===n.total}},{key:"results",value:function(){return this._updateStatus(),n}},{key:"stats",value:function(){return this.results()}},{key:"_updateStatus",value:function(){if("done"!==t){var o=Object.values(e);n={completed:o.filter((function(t){return"completed"===t.status})).length,rejected:o.filter((function(t){return"rejected"===t.status})).length,pending:o.filter((function(t){return"in-progress"===t.status})).length,total:o.length,errors:r.join("\n"),promises:e},this.emit("stats",n);var i=o.every((function(t){return"completed"===t.status||"rejected"===t.status}));"done"===(t=i||0===n.total?"done":"in-progress")&&(this.emit("done",n),n.total>0&&(this.emit("completed",n),this.emit("rejected",r,n)))}}}])}(a))},C={};function q(t,e,r){for(var n=arguments.length,o=new Array(n>3?n-3:0),i=3;i<n;i++){o[i-3]=arguments[i]}var u,a;if("string"==typeof t&&"number"==typeof e){u=t,a=e}else if("number"==typeof t&&"function"==typeof e){a=t,r=e}else{if(e||"string"!=typeof t){throw new Error("Invalid parameters")}u=t}var c=u?"_doTimeout_"+u:null;function s(){c&&c in C&&delete C[c]}if(c&&c in C&&(clearTimeout(C[c]),delete C[c]),"function"==typeof r&&"number"==typeof a){return function t(){C[c]=setTimeout((function(){!0===r.apply(void 0,o)?t():s()}),a)}(),!0}u&&void 0===a&&s()}function N(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++){r[n-1]=arguments[n]}return new Promise((function(e,n){try{Promise.resolve(t.apply(void 0,r)).then((function(t){return e(t)})).catch((function(t){return n(t)}))}catch(t){n(t)}}))}window.promises=e})(); |
@@ -311,5 +311,6 @@ // // ----------------------------------------- | ||
const { | ||
msg, | ||
interval = 200, | ||
timeout = 1000, | ||
timeoutMsg = '===> doPoll: cancelled or timed out.', | ||
timeoutMsg = msg ?? '===> doPoll: cancelled or timed out.', | ||
} = options; | ||
@@ -323,3 +324,9 @@ let timeoutId, intervalId; | ||
clearTimers(); | ||
rejectPromise(console.info(timeoutMsg)); | ||
if (typeOf(timeoutMsg, 'string')) { | ||
console.info(timeoutMsg); | ||
rejectPromise(timeoutMsg); | ||
return; | ||
} | ||
rejectPromise(); | ||
}; | ||
@@ -399,12 +406,14 @@ | ||
*/ | ||
function getObjectValue(obj, name, callback, options) { | ||
const { queryTime = 15000, isFalsy = false } = options || {}; | ||
if (typeof callback === 'function') { | ||
doPoll( | ||
function getObjectValue(obj, name, async = false, options = {}) { | ||
options = typeOf(options, 'number') ? { queryTime: options } : options; | ||
const { queryTime = 15000, isFalsy = false } = options; | ||
if (async) { | ||
return doPoll( | ||
() => { | ||
const value = getObjectValue(obj, name); | ||
if (isFalsy && value === false) { | ||
return callback(value); | ||
} else if (value) { | ||
return callback(value); | ||
return value; | ||
} else if (value && value !== false) { | ||
return value; | ||
} | ||
@@ -415,5 +424,5 @@ }, | ||
interval: 100, | ||
timeoutMsg: 'Object prop no found:' + name, | ||
msg: false, | ||
} | ||
); | ||
).promise; | ||
} | ||
@@ -425,16 +434,22 @@ | ||
for (const key in obj) { | ||
if (key === name) { | ||
return obj[key]; | ||
} else if (typeof obj[key] === 'object') { | ||
let result = getObjectValue(obj[key], name); | ||
if (result) { | ||
return result; | ||
const keys = name.split('.'); | ||
let index = 0; | ||
while (index < keys.length) { | ||
const target = keys[index]; | ||
for (const key in obj) { | ||
if (key === target) { | ||
if (keys[index + 1]) { | ||
return getObjectValue(obj[key], keys[index + 1]); | ||
} | ||
return obj[key]; | ||
} else if (typeof obj[key] === 'object') { | ||
let result = getObjectValue(obj[key], target); | ||
if (result) { | ||
return result; | ||
} | ||
return false; | ||
} | ||
return false; | ||
} | ||
return false; | ||
} | ||
return false; | ||
} | ||
@@ -441,0 +456,0 @@ |
@@ -245,5 +245,6 @@ class EventBus { | ||
if (input === null) { | ||
{ | ||
return false; | ||
if (test) { | ||
return test === null || test === 'null' ? true : false; | ||
} | ||
return 'null'; | ||
} | ||
@@ -271,3 +272,3 @@ | ||
{ | ||
if (test) { | ||
if (test.includes('|')) { | ||
@@ -284,2 +285,4 @@ for (let type of test.split('|')) { | ||
} | ||
return inputType; | ||
} | ||
@@ -497,5 +500,6 @@ | ||
const { | ||
msg, | ||
interval = 200, | ||
timeout = 1000, | ||
timeoutMsg = '===> doPoll: cancelled or timed out.', | ||
timeoutMsg = msg ?? '===> doPoll: cancelled or timed out.', | ||
} = options; | ||
@@ -509,3 +513,9 @@ let timeoutId, intervalId; | ||
clearTimers(); | ||
rejectPromise(console.info(timeoutMsg)); | ||
if (typeOf(timeoutMsg, 'string')) { | ||
console.info(timeoutMsg); | ||
rejectPromise(timeoutMsg); | ||
return; | ||
} | ||
rejectPromise(); | ||
}; | ||
@@ -512,0 +522,0 @@ |
@@ -1,1 +0,1 @@ | ||
var r,t;r=this,t=()=>(()=>{"use strict";var r={d:(t,n)=>{for(var e in n){r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})}},o:(r,t)=>Object.prototype.hasOwnProperty.call(r,t),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},t={};function n(r,t){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!n){if(Array.isArray(r)||(n=function(r,t){if(r){if("string"==typeof r){return e(r,t)}var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(r,t):void 0}}(r))||t&&r&&"number"==typeof r.length){n&&(r=n);var o=0,i=function(){};return{s:i,n:function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}},e:function(r){throw r},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,a=!0,c=!1;return{s:function(){n=n.call(r)},n:function(){var r=n.next();return a=r.done,r},e:function(r){c=!0,u=r},f:function(){try{a||null==n.return||n.return()}finally{if(c){throw u}}}}}function e(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=Array(t);n<t;n++){e[n]=r[n]}return e}function o(r){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},o(r)}function i(r){switch(o(r)){case"boolean":return r;case"string":return"false"!==r&&"0"!==r;case"number":return 0!==r;default:return Boolean(r)}}function u(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null!==s(r)||"boolean"==typeof r?r:f(r)?t:r}r.r(t),r.d(t,{addQuotes:()=>S,cleanStr:()=>j,convertKeysToSymbols:()=>w,findAndReplaceInArray:()=>A,findNested:()=>O,fixQuotes:()=>E,getArrObjFromString:()=>_,getChunks:()=>T,getDirectivesFromString:()=>P,getMatchBlock:()=>k,getMatchInBetween:()=>I,getObjectFromPath:()=>x,getObjectValue:()=>h,removeQuotes:()=>M,setExpString:()=>N,setLookUpExp:()=>R,setWildCardString:()=>C,startAndEndWith:()=>$,wildCardStringSearch:()=>B});var a=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;r=r||40;for(var t="",n=0;n<r/3+1;n++){t+=Math.random().toString(36).substring(2,15)}return t.substring(0,r)};function c(){return"id__"+a(8)+"__"+(new Date).getTime()}var l=c;function f(r){return null==r||("string"==typeof r||Array.isArray(r)?0===r.length:r instanceof Map||r instanceof Set?0===r.size:ArrayBuffer.isView(r)?0===r.byteLength:"object"===o(r)&&0===Object.keys(r).length)}function s(r){var t=o(r);switch(r){case null:case void 0:case"":return null;case"0":case 0:return 0;default:if(!("number"!==t&&"string"!==t||"number"!=typeof r&&Number.isNaN(Number(r)))){return+r}}return null}function y(r,t){if(null===r){return t?null===t||"null"===t:"null"}var e;switch(o(r)){case"number":case"string":case"boolean":case"undefined":case"bigint":case"symbol":case"function":e=o(r);break;case"object":e=Array.isArray(r)?"array":"object";break;default:e="unknown"}if(t){if(t.includes("|")){var i,u=n(t.split("|"));try{for(u.s();!(i=u.n()).done;){var a=i.value;if(e===a){return a}}}catch(r){u.e(r)}finally{u.f()}return!1}return t===e}return e}function v(r){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},v(r)}var m=function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof r&&"object"!==v(r)){throw new Error("doPoll: The first argument must be a function or Promise.")}var n,e,o,i,u=function(r){return r instanceof Promise},a=t.interval,c=void 0===a?200:a,l=t.timeout,f=void 0===l?1e3:l,s=t.timeoutMsg,y=void 0===s?"===> doPoll: cancelled or timed out.":s,m=!1,p=!1,d=function(){b(),i(console.info(y))},g=function(r){b(),o(r)};function b(){m=!0,clearTimeout(n),clearInterval(e)}var h=new Promise((function(t,a){o=t,i=a;var l=function(){if(!m&&!p){var t=u(r)?r:r();u(t)?(p=!0,t.then((function(r){p=!1,r&&g(r)})).catch(i)):(Boolean(t)||t)&&g(t)}};e=setInterval(l,c),l(),n=setTimeout((function(){m||d()}),f)}));return h.catch((function(){d()})),{promise:h,stop:d}};function p(r,t){return function(r){if(Array.isArray(r)){return r}}(r)||function(r,t){var n=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=n){var e,o,i,u,a=[],c=!0,l=!1;try{if(i=(n=n.call(r)).next,0===t){if(Object(n)!==n){return}c=!1}else{for(;!(c=(e=i.call(n)).done)&&(a.push(e.value),a.length!==t);c=!0){}}}catch(r){l=!0,o=r}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u)){return}}finally{if(l){throw o}}}return a}}(r,t)||function(r,t){if(r){if("string"==typeof r){return d(r,t)}var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(r,t):void 0}}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=Array(t);n<t;n++){e[n]=r[n]}return e}function g(r,t,n){return(t=function(r){var t=function(r,t){if("object"!=b(r)||!r){return r}var n=r[Symbol.toPrimitive];if(void 0!==n){var e=n.call(r,t||"default");if("object"!=b(e)){return e}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(r)}(r,"string");return"symbol"==b(t)?t:t+""}(t))in r?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r}function b(r){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},b(r)}function h(r,t,n,e){var o=e||{},i=o.queryTime,u=void 0===i?15e3:i,a=o.isFalsy,c=void 0!==a&&a;if("function"==typeof n&&m((function(){var e=h(r,t);return c&&!1===e||e?n(e):void 0}),{timeout:u,interval:100,timeoutMsg:"Object prop no found:"+t}),!r){return!1}for(var l in r){if(l===t){return r[l]}if("object"===b(r[l])){var f=h(r[l],t);return f||!1}}return!1}function S(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'"';return"".concat(t).concat(r).concat(t)}function j(r){if(r){if("string"!=typeof r){return r}for(var t=arguments.length,n=new Array(t>1?t-1:0),e=1;e<t;e++){n[e-1]=arguments[e]}return n.reduce((function(r,t){var n=t instanceof RegExp?t:new RegExp(N(t));return r.replace(n,"")}),r).trim()}}function w(r){if(null===u(r,null)){return{}}var t={},n={};for(var e in r){var o=Symbol(e);t[o]=r[e],n[e]=o}return t.keyToSymbolMap=n,t}function A(r,t,n){var e=!1,o=r.map((function(r){if(Array.isArray(r)){var o=A(r,t,n);return o?(e=!0,o):r}return r===t?(e=!0,Array.isArray(n)?n.map((function(r){return Array.isArray(r)?r:r.trim()})):n):r}));return e?o:null}function O(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"[",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"]";if("string"!=typeof r){return r}var e=r.lastIndexOf(t);if(-1===e){return null}var o=r.substring(e),i=o.indexOf(n);return-1===i?null:o.substring(0,i+1)}function E(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'"';return"string"!=typeof r?r:r.replace(/`|'|"/g,t)}function x(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return r.split(".").reduce((function(r,t){return r&&r[t]}),t)}function _(r){if(y(r,"object")||y(r,"array")){return r}var t=$(r,"{","}"),n=$(r,"[","]");if(!t&&!n){return r}var e=t?{}:[],o={},i=function(r){var t=r.match(/^(\[|\{)(.*?)(\]|\})$/);return t?t[2].trim():r}(r),a=function(){for(var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];;){var t=r?O(i,"{","}"):O(i);if(!t){break}var n="__".concat(l(),"__");o[n]=t,i=i.replace(t,n)}};return a(),a(!0),T(i).forEach((function(r,n){var i,a,c=r.includes(":")&&t,l=c?T(r,":"):[],f=M(u(l[0],n));(r=c?l[1]:r)in o&&(r=_(o[r])),i=M(r),r=null!==(a=s(i))?a:i,t?e[f]=r:e.push(r)})),e}function P(r){var t=r;if(!u(t)){return null}var n=function(){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return{type:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,directive:r}},e=/([a-zA-Z]+)\[((.|\n)*?)\]\(((.|\n)*?)\)/gm,o=b(t);if("object"===o||"array"===o){return n(o,t)}switch(!0){case!!t.match(/^\[((.|\n)*?)\]$/gm):o="array";break;case!!t.match(/^\{((.|\n)*?)\:((.|\n)*?)\}/gm):o="object";break;case!!t.match(/^([a-zA-Z]+)(\()(\.|\#)(.*)(\))/g):return n("idOrClassWithDirective",g({},t.split("(")[0].trim(),I(t,"(",")")));case!!t.match(/([a-zA-Z]+)\.(.*?)\(((.|\n)*?)\)/gm):case!!t.match(e):o="dotObject";break;default:return n("string",t)}if("array"===o||"object"===o){var i=E(t);try{return n(o,JSON.parse(i))}catch(r){}return n(o,_(i))}if("dotObject"===o){var a,c,l,f={};return T(t,"&&").forEach((function(r){if(r.match(e)){a=I(r,"](",")"),c=I(r,"[","]"),l=r.split("[")[0].trim()}else{a=I(r,"(",")");var t=p(T(r=r.replace(k(r,"(",")"),""),"."),2);l=t[0],c=t[1]}a=_(a),f[l]||(f[l]={}),T(c,"|").forEach((function(r){f[l][r]=a}))})),n("dotObject",f)}}function k(r,t,n){var e=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"!=typeof r){return r}t=N(t),n=N(n);var o=new RegExp(R(t,n),"gm"),i=r.match(o);return i?e?i:i[0]:null}function T(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";if("string"!=typeof r){return r}if(f(r)){return[]}var n=(r=j(r)).split(t).map((function(r){return j(r)}));return 1===n.length&&""===n[0]?[r]:n}function I(r,t,n){var e,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"!=typeof r){return r}var i=null!==(e=k(r,t,n,o))&&void 0!==e?e:o?[]:r;return o?i.map((function(r){return j(r,t,n)})):j(i,t,n)}function M(r){return"string"!=typeof r?r:r.replace(/`|'|"/g,"")}function $(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return(!t||r.startsWith(t))&&(!n||r.endsWith(n))}function N(r){return r instanceof RegExp?r:r.split("").map((function(r){return["$","^",".","*","+","?","(",")","[","]","{","}","|","\\"].includes(r)?"\\".concat(r):r})).join("")}function R(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++){t[n]=arguments[n]}if(t.length<2){throw new Error("You need to pass at least two arguments")}var e="";return t.forEach((function(r,t){r instanceof RegExp&&(r=r.source),0===t?e=r:e+="((.|\n)*?)".concat(r)})),e}function C(r){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"!=typeof r){return r}if(!r){return null}t=i(t),n=i(n);var e=r.replace(/([.+?^${}()|\[\]\/\\])/g,"\\$&"),o=t?"^":"",u=n?"$":"";return e=e.replace(/\*\*/g,"[_g_]").replace(/\*/g,"(.*?)").replace(/\[_g_\]/g,".*"),"".concat(o).concat(e).concat(u)}function B(r,t){if(!r||!t){return null}var n=new RegExp(C(r,arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]&&arguments[3]));return u("string"==typeof t?t.match(n):t.filter((function(r){return n.test(r)})))}return t})(),"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("helpers",[],t):"object"==typeof exports?exports.helpers=t():r.helpers=t(); | ||
var r,t;r=this,t=()=>(()=>{"use strict";var r={d:(t,n)=>{for(var e in n){r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})}},o:(r,t)=>Object.prototype.hasOwnProperty.call(r,t),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},t={};function n(r,t){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!n){if(Array.isArray(r)||(n=function(r,t){if(r){if("string"==typeof r){return e(r,t)}var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(r,t):void 0}}(r))||t&&r&&"number"==typeof r.length){n&&(r=n);var o=0,i=function(){};return{s:i,n:function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}},e:function(r){throw r},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,a=!0,c=!1;return{s:function(){n=n.call(r)},n:function(){var r=n.next();return a=r.done,r},e:function(r){c=!0,u=r},f:function(){try{a||null==n.return||n.return()}finally{if(c){throw u}}}}}function e(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=Array(t);n<t;n++){e[n]=r[n]}return e}function o(r){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},o(r)}function i(r){switch(o(r)){case"boolean":return r;case"string":return"false"!==r&&"0"!==r;case"number":return 0!==r;default:return Boolean(r)}}function u(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null!==s(r)||"boolean"==typeof r?r:f(r)?t:r}r.r(t),r.d(t,{addQuotes:()=>S,cleanStr:()=>j,convertKeysToSymbols:()=>w,findAndReplaceInArray:()=>A,findNested:()=>O,fixQuotes:()=>E,getArrObjFromString:()=>_,getChunks:()=>k,getDirectivesFromString:()=>P,getMatchBlock:()=>T,getMatchInBetween:()=>I,getObjectFromPath:()=>x,getObjectValue:()=>h,removeQuotes:()=>M,setExpString:()=>N,setLookUpExp:()=>R,setWildCardString:()=>C,startAndEndWith:()=>$,wildCardStringSearch:()=>B});var a=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;r=r||40;for(var t="",n=0;n<r/3+1;n++){t+=Math.random().toString(36).substring(2,15)}return t.substring(0,r)};function c(){return"id__"+a(8)+"__"+(new Date).getTime()}var l=c;function f(r){return null==r||("string"==typeof r||Array.isArray(r)?0===r.length:r instanceof Map||r instanceof Set?0===r.size:ArrayBuffer.isView(r)?0===r.byteLength:"object"===o(r)&&0===Object.keys(r).length)}function s(r){var t=o(r);switch(r){case null:case void 0:case"":return null;case"0":case 0:return 0;default:if(!("number"!==t&&"string"!==t||"number"!=typeof r&&Number.isNaN(Number(r)))){return+r}}return null}function y(r,t){if(null===r){return t?null===t||"null"===t:"null"}var e;switch(o(r)){case"number":case"string":case"boolean":case"undefined":case"bigint":case"symbol":case"function":e=o(r);break;case"object":e=Array.isArray(r)?"array":"object";break;default:e="unknown"}if(t){if(t.includes("|")){var i,u=n(t.split("|"));try{for(u.s();!(i=u.n()).done;){var a=i.value;if(e===a){return a}}}catch(r){u.e(r)}finally{u.f()}return!1}return t===e}return e}function v(r){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},v(r)}var m=function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof r&&"object"!==v(r)){throw new Error("doPoll: The first argument must be a function or Promise.")}var n,e,o,i,u=function(r){return r instanceof Promise},a=t.msg,c=t.interval,l=void 0===c?200:c,f=t.timeout,s=void 0===f?1e3:f,m=t.timeoutMsg,g=void 0===m?null!=a?a:"===> doPoll: cancelled or timed out.":m,p=!1,d=!1,b=function(){if(S(),y(g,"string")){return console.info(g),void i(g)}i()},h=function(r){S(),o(r)};function S(){p=!0,clearTimeout(n),clearInterval(e)}var j=new Promise((function(t,a){o=t,i=a;var c=function(){if(!p&&!d){var t=u(r)?r:r();u(t)?(d=!0,t.then((function(r){d=!1,r&&h(r)})).catch(i)):(Boolean(t)||t)&&h(t)}};e=setInterval(c,l),c(),n=setTimeout((function(){p||b()}),s)}));return j.catch((function(){b()})),{promise:j,stop:b}};function g(r,t){return function(r){if(Array.isArray(r)){return r}}(r)||function(r,t){var n=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=n){var e,o,i,u,a=[],c=!0,l=!1;try{if(i=(n=n.call(r)).next,0===t){if(Object(n)!==n){return}c=!1}else{for(;!(c=(e=i.call(n)).done)&&(a.push(e.value),a.length!==t);c=!0){}}}catch(r){l=!0,o=r}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u)){return}}finally{if(l){throw o}}}return a}}(r,t)||function(r,t){if(r){if("string"==typeof r){return p(r,t)}var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(r,t):void 0}}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=Array(t);n<t;n++){e[n]=r[n]}return e}function d(r,t,n){return(t=function(r){var t=function(r,t){if("object"!=b(r)||!r){return r}var n=r[Symbol.toPrimitive];if(void 0!==n){var e=n.call(r,t||"default");if("object"!=b(e)){return e}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(r)}(r,"string");return"symbol"==b(t)?t:t+""}(t))in r?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r}function b(r){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},b(r)}function h(r,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e=y(e,"number")?{queryTime:e}:e,i=o.queryTime,u=void 0===i?15e3:i,a=o.isFalsy,c=void 0!==a&&a;if(n){return m((function(){var n=h(r,t);return c&&!1===n||n&&!1!==n?n:void 0}),{timeout:u,interval:100,msg:!1}).promise}if(!r){return!1}for(var l=t.split(".");0<l.length;){var f=l[0];for(var s in r){if(s===f){return l[1]?h(r[s],l[1]):r[s]}if("object"===b(r[s])){var v=h(r[s],f);return v||!1}}return!1}}function S(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'"';return"".concat(t).concat(r).concat(t)}function j(r){if(r){if("string"!=typeof r){return r}for(var t=arguments.length,n=new Array(t>1?t-1:0),e=1;e<t;e++){n[e-1]=arguments[e]}return n.reduce((function(r,t){var n=t instanceof RegExp?t:new RegExp(N(t));return r.replace(n,"")}),r).trim()}}function w(r){if(null===u(r,null)){return{}}var t={},n={};for(var e in r){var o=Symbol(e);t[o]=r[e],n[e]=o}return t.keyToSymbolMap=n,t}function A(r,t,n){var e=!1,o=r.map((function(r){if(Array.isArray(r)){var o=A(r,t,n);return o?(e=!0,o):r}return r===t?(e=!0,Array.isArray(n)?n.map((function(r){return Array.isArray(r)?r:r.trim()})):n):r}));return e?o:null}function O(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"[",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"]";if("string"!=typeof r){return r}var e=r.lastIndexOf(t);if(-1===e){return null}var o=r.substring(e),i=o.indexOf(n);return-1===i?null:o.substring(0,i+1)}function E(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'"';return"string"!=typeof r?r:r.replace(/`|'|"/g,t)}function x(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return r.split(".").reduce((function(r,t){return r&&r[t]}),t)}function _(r){if(y(r,"object")||y(r,"array")){return r}var t=$(r,"{","}"),n=$(r,"[","]");if(!t&&!n){return r}var e=t?{}:[],o={},i=function(r){var t=r.match(/^(\[|\{)(.*?)(\]|\})$/);return t?t[2].trim():r}(r),a=function(){for(var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];;){var t=r?O(i,"{","}"):O(i);if(!t){break}var n="__".concat(l(),"__");o[n]=t,i=i.replace(t,n)}};return a(),a(!0),k(i).forEach((function(r,n){var i,a,c=r.includes(":")&&t,l=c?k(r,":"):[],f=M(u(l[0],n));(r=c?l[1]:r)in o&&(r=_(o[r])),i=M(r),r=null!==(a=s(i))?a:i,t?e[f]=r:e.push(r)})),e}function P(r){var t=r;if(!u(t)){return null}var n=function(){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return{type:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,directive:r}},e=/([a-zA-Z]+)\[((.|\n)*?)\]\(((.|\n)*?)\)/gm,o=b(t);if("object"===o||"array"===o){return n(o,t)}switch(!0){case!!t.match(/^\[((.|\n)*?)\]$/gm):o="array";break;case!!t.match(/^\{((.|\n)*?)\:((.|\n)*?)\}/gm):o="object";break;case!!t.match(/^([a-zA-Z]+)(\()(\.|\#)(.*)(\))/g):return n("idOrClassWithDirective",d({},t.split("(")[0].trim(),I(t,"(",")")));case!!t.match(/([a-zA-Z]+)\.(.*?)\(((.|\n)*?)\)/gm):case!!t.match(e):o="dotObject";break;default:return n("string",t)}if("array"===o||"object"===o){var i=E(t);try{return n(o,JSON.parse(i))}catch(r){}return n(o,_(i))}if("dotObject"===o){var a,c,l,f={};return k(t,"&&").forEach((function(r){if(r.match(e)){a=I(r,"](",")"),c=I(r,"[","]"),l=r.split("[")[0].trim()}else{a=I(r,"(",")");var t=g(k(r=r.replace(T(r,"(",")"),""),"."),2);l=t[0],c=t[1]}a=_(a),f[l]||(f[l]={}),k(c,"|").forEach((function(r){f[l][r]=a}))})),n("dotObject",f)}}function T(r,t,n){var e=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"!=typeof r){return r}t=N(t),n=N(n);var o=new RegExp(R(t,n),"gm"),i=r.match(o);return i?e?i:i[0]:null}function k(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";if("string"!=typeof r){return r}if(f(r)){return[]}var n=(r=j(r)).split(t).map((function(r){return j(r)}));return 1===n.length&&""===n[0]?[r]:n}function I(r,t,n){var e,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"!=typeof r){return r}var i=null!==(e=T(r,t,n,o))&&void 0!==e?e:o?[]:r;return o?i.map((function(r){return j(r,t,n)})):j(i,t,n)}function M(r){return"string"!=typeof r?r:r.replace(/`|'|"/g,"")}function $(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return(!t||r.startsWith(t))&&(!n||r.endsWith(n))}function N(r){return r instanceof RegExp?r:r.split("").map((function(r){return["$","^",".","*","+","?","(",")","[","]","{","}","|","\\"].includes(r)?"\\".concat(r):r})).join("")}function R(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++){t[n]=arguments[n]}if(t.length<2){throw new Error("You need to pass at least two arguments")}var e="";return t.forEach((function(r,t){r instanceof RegExp&&(r=r.source),0===t?e=r:e+="((.|\n)*?)".concat(r)})),e}function C(r){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"!=typeof r){return r}if(!r){return null}t=i(t),n=i(n);var e=r.replace(/([.+?^${}()|\[\]\/\\])/g,"\\$&"),o=t?"^":"",u=n?"$":"";return e=e.replace(/\*\*/g,"[_g_]").replace(/\*/g,"(.*?)").replace(/\[_g_\]/g,".*"),"".concat(o).concat(e).concat(u)}function B(r,t){if(!r||!t){return null}var n=new RegExp(C(r,arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]&&arguments[3]));return u("string"==typeof t?t.match(n):t.filter((function(r){return n.test(r)})))}return t})(),"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("helpers",[],t):"object"==typeof exports?exports.helpers=t():r.helpers=t(); |
@@ -1,1 +0,1 @@ | ||
var r,t;r=this,t=()=>(()=>{"use strict";var r={d:(t,n)=>{for(var e in n){r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})}},o:(r,t)=>Object.prototype.hasOwnProperty.call(r,t),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},t={};function n(r,t){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!n){if(Array.isArray(r)||(n=function(r,t){if(r){if("string"==typeof r){return e(r,t)}var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(r,t):void 0}}(r))||t&&r&&"number"==typeof r.length){n&&(r=n);var o=0,i=function(){};return{s:i,n:function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}},e:function(r){throw r},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,a=!0,c=!1;return{s:function(){n=n.call(r)},n:function(){var r=n.next();return a=r.done,r},e:function(r){c=!0,u=r},f:function(){try{a||null==n.return||n.return()}finally{if(c){throw u}}}}}function e(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=Array(t);n<t;n++){e[n]=r[n]}return e}function o(r){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},o(r)}function i(r){switch(o(r)){case"boolean":return r;case"string":return"false"!==r&&"0"!==r;case"number":return 0!==r;default:return Boolean(r)}}function u(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null!==s(r)||"boolean"==typeof r?r:f(r)?t:r}r.r(t),r.d(t,{addQuotes:()=>S,cleanStr:()=>w,convertKeysToSymbols:()=>j,findAndReplaceInArray:()=>A,findNested:()=>O,fixQuotes:()=>E,getArrObjFromString:()=>_,getChunks:()=>T,getDirectivesFromString:()=>P,getMatchBlock:()=>k,getMatchInBetween:()=>I,getObjectFromPath:()=>x,getObjectValue:()=>h,removeQuotes:()=>M,setExpString:()=>N,setLookUpExp:()=>R,setWildCardString:()=>C,startAndEndWith:()=>$,wildCardStringSearch:()=>B});var a=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;r=r||40;for(var t="",n=0;n<r/3+1;n++){t+=Math.random().toString(36).substring(2,15)}return t.substring(0,r)};function c(){return"id__"+a(8)+"__"+(new Date).getTime()}var l=c;function f(r){return null==r||("string"==typeof r||Array.isArray(r)?0===r.length:r instanceof Map||r instanceof Set?0===r.size:ArrayBuffer.isView(r)?0===r.byteLength:"object"===o(r)&&0===Object.keys(r).length)}function s(r){var t=o(r);switch(r){case null:case void 0:case"":return null;case"0":case 0:return 0;default:if(!("number"!==t&&"string"!==t||"number"!=typeof r&&Number.isNaN(Number(r)))){return+r}}return null}function y(r,t){if(null===r){return t?null===t||"null"===t:"null"}var e;switch(o(r)){case"number":case"string":case"boolean":case"undefined":case"bigint":case"symbol":case"function":e=o(r);break;case"object":e=Array.isArray(r)?"array":"object";break;default:e="unknown"}if(t){if(t.includes("|")){var i,u=n(t.split("|"));try{for(u.s();!(i=u.n()).done;){var a=i.value;if(e===a){return a}}}catch(r){u.e(r)}finally{u.f()}return!1}return t===e}return e}function v(r){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},v(r)}var p=function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof r&&"object"!==v(r)){throw new Error("doPoll: The first argument must be a function or Promise.")}var n,e,o,i,u=function(r){return r instanceof Promise},a=t.interval,c=void 0===a?200:a,l=t.timeout,f=void 0===l?1e3:l,s=t.timeoutMsg,y=void 0===s?"===> doPoll: cancelled or timed out.":s,p=!1,m=!1,d=function(){b(),i(console.info(y))},g=function(r){b(),o(r)};function b(){p=!0,clearTimeout(n),clearInterval(e)}var h=new Promise((function(t,a){o=t,i=a;var l=function(){if(!p&&!m){var t=u(r)?r:r();u(t)?(m=!0,t.then((function(r){m=!1,r&&g(r)})).catch(i)):(Boolean(t)||t)&&g(t)}};e=setInterval(l,c),l(),n=setTimeout((function(){p||d()}),f)}));return h.catch((function(){d()})),{promise:h,stop:d}};function m(r,t){return function(r){if(Array.isArray(r)){return r}}(r)||function(r,t){var n=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=n){var e,o,i,u,a=[],c=!0,l=!1;try{if(i=(n=n.call(r)).next,0===t){if(Object(n)!==n){return}c=!1}else{for(;!(c=(e=i.call(n)).done)&&(a.push(e.value),a.length!==t);c=!0){}}}catch(r){l=!0,o=r}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u)){return}}finally{if(l){throw o}}}return a}}(r,t)||function(r,t){if(r){if("string"==typeof r){return d(r,t)}var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(r,t):void 0}}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=Array(t);n<t;n++){e[n]=r[n]}return e}function g(r,t,n){return(t=function(r){var t=function(r,t){if("object"!=b(r)||!r){return r}var n=r[Symbol.toPrimitive];if(void 0!==n){var e=n.call(r,t||"default");if("object"!=b(e)){return e}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(r)}(r,"string");return"symbol"==b(t)?t:t+""}(t))in r?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r}function b(r){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},b(r)}function h(r,t,n,e){var o=e||{},i=o.queryTime,u=void 0===i?15e3:i,a=o.isFalsy,c=void 0!==a&&a;if("function"==typeof n&&p((function(){var e=h(r,t);return c&&!1===e||e?n(e):void 0}),{timeout:u,interval:100,timeoutMsg:"Object prop no found:"+t}),!r){return!1}for(var l in r){if(l===t){return r[l]}if("object"===b(r[l])){var f=h(r[l],t);return f||!1}}return!1}function S(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'"';return"".concat(t).concat(r).concat(t)}function w(r){if(r){if("string"!=typeof r){return r}for(var t=arguments.length,n=new Array(t>1?t-1:0),e=1;e<t;e++){n[e-1]=arguments[e]}return n.reduce((function(r,t){var n=t instanceof RegExp?t:new RegExp(N(t));return r.replace(n,"")}),r).trim()}}function j(r){if(null===u(r,null)){return{}}var t={},n={};for(var e in r){var o=Symbol(e);t[o]=r[e],n[e]=o}return t.keyToSymbolMap=n,t}function A(r,t,n){var e=!1,o=r.map((function(r){if(Array.isArray(r)){var o=A(r,t,n);return o?(e=!0,o):r}return r===t?(e=!0,Array.isArray(n)?n.map((function(r){return Array.isArray(r)?r:r.trim()})):n):r}));return e?o:null}function O(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"[",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"]";if("string"!=typeof r){return r}var e=r.lastIndexOf(t);if(-1===e){return null}var o=r.substring(e),i=o.indexOf(n);return-1===i?null:o.substring(0,i+1)}function E(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'"';return"string"!=typeof r?r:r.replace(/`|'|"/g,t)}function x(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return r.split(".").reduce((function(r,t){return r&&r[t]}),t)}function _(r){if(y(r,"object")||y(r,"array")){return r}var t=$(r,"{","}"),n=$(r,"[","]");if(!t&&!n){return r}var e=t?{}:[],o={},i=function(r){var t=r.match(/^(\[|\{)(.*?)(\]|\})$/);return t?t[2].trim():r}(r),a=function(){for(var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];;){var t=r?O(i,"{","}"):O(i);if(!t){break}var n="__".concat(l(),"__");o[n]=t,i=i.replace(t,n)}};return a(),a(!0),T(i).forEach((function(r,n){var i,a,c=r.includes(":")&&t,l=c?T(r,":"):[],f=M(u(l[0],n));(r=c?l[1]:r)in o&&(r=_(o[r])),i=M(r),r=null!==(a=s(i))?a:i,t?e[f]=r:e.push(r)})),e}function P(r){var t=r;if(!u(t)){return null}var n=function(){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return{type:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,directive:r}},e=/([a-zA-Z]+)\[((.|\n)*?)\]\(((.|\n)*?)\)/gm,o=b(t);if("object"===o||"array"===o){return n(o,t)}switch(!0){case!!t.match(/^\[((.|\n)*?)\]$/gm):o="array";break;case!!t.match(/^\{((.|\n)*?)\:((.|\n)*?)\}/gm):o="object";break;case!!t.match(/^([a-zA-Z]+)(\()(\.|\#)(.*)(\))/g):return n("idOrClassWithDirective",g({},t.split("(")[0].trim(),I(t,"(",")")));case!!t.match(/([a-zA-Z]+)\.(.*?)\(((.|\n)*?)\)/gm):case!!t.match(e):o="dotObject";break;default:return n("string",t)}if("array"===o||"object"===o){var i=E(t);try{return n(o,JSON.parse(i))}catch(r){}return n(o,_(i))}if("dotObject"===o){var a,c,l,f={};return T(t,"&&").forEach((function(r){if(r.match(e)){a=I(r,"](",")"),c=I(r,"[","]"),l=r.split("[")[0].trim()}else{a=I(r,"(",")");var t=m(T(r=r.replace(k(r,"(",")"),""),"."),2);l=t[0],c=t[1]}a=_(a),f[l]||(f[l]={}),T(c,"|").forEach((function(r){f[l][r]=a}))})),n("dotObject",f)}}function k(r,t,n){var e=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"!=typeof r){return r}t=N(t),n=N(n);var o=new RegExp(R(t,n),"gm"),i=r.match(o);return i?e?i:i[0]:null}function T(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";if("string"!=typeof r){return r}if(f(r)){return[]}var n=(r=w(r)).split(t).map((function(r){return w(r)}));return 1===n.length&&""===n[0]?[r]:n}function I(r,t,n){var e,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"!=typeof r){return r}var i=null!==(e=k(r,t,n,o))&&void 0!==e?e:o?[]:r;return o?i.map((function(r){return w(r,t,n)})):w(i,t,n)}function M(r){return"string"!=typeof r?r:r.replace(/`|'|"/g,"")}function $(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return(!t||r.startsWith(t))&&(!n||r.endsWith(n))}function N(r){return r instanceof RegExp?r:r.split("").map((function(r){return["$","^",".","*","+","?","(",")","[","]","{","}","|","\\"].includes(r)?"\\".concat(r):r})).join("")}function R(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++){t[n]=arguments[n]}if(t.length<2){throw new Error("You need to pass at least two arguments")}var e="";return t.forEach((function(r,t){r instanceof RegExp&&(r=r.source),0===t?e=r:e+="((.|\n)*?)".concat(r)})),e}function C(r){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"!=typeof r){return r}if(!r){return null}t=i(t),n=i(n);var e=r.replace(/([.+?^${}()|\[\]\/\\])/g,"\\$&"),o=t?"^":"",u=n?"$":"";return e=e.replace(/\*\*/g,"[_g_]").replace(/\*/g,"(.*?)").replace(/\[_g_\]/g,".*"),"".concat(o).concat(e).concat(u)}function B(r,t){if(!r||!t){return null}var n=new RegExp(C(r,arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]&&arguments[3]));return u("string"==typeof t?t.match(n):t.filter((function(r){return n.test(r)})))}return t})(),"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("powerHelper",[],t):"object"==typeof exports?exports.powerHelper=t():r.powerHelper=t(); | ||
var r,t;r=this,t=()=>(()=>{"use strict";var r={d:(t,n)=>{for(var e in n){r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})}},o:(r,t)=>Object.prototype.hasOwnProperty.call(r,t),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},t={};function n(r,t){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!n){if(Array.isArray(r)||(n=function(r,t){if(r){if("string"==typeof r){return e(r,t)}var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(r,t):void 0}}(r))||t&&r&&"number"==typeof r.length){n&&(r=n);var o=0,i=function(){};return{s:i,n:function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}},e:function(r){throw r},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,a=!0,c=!1;return{s:function(){n=n.call(r)},n:function(){var r=n.next();return a=r.done,r},e:function(r){c=!0,u=r},f:function(){try{a||null==n.return||n.return()}finally{if(c){throw u}}}}}function e(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=Array(t);n<t;n++){e[n]=r[n]}return e}function o(r){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},o(r)}function i(r){switch(o(r)){case"boolean":return r;case"string":return"false"!==r&&"0"!==r;case"number":return 0!==r;default:return Boolean(r)}}function u(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null!==s(r)||"boolean"==typeof r?r:f(r)?t:r}r.r(t),r.d(t,{addQuotes:()=>S,cleanStr:()=>w,convertKeysToSymbols:()=>j,findAndReplaceInArray:()=>A,findNested:()=>O,fixQuotes:()=>E,getArrObjFromString:()=>_,getChunks:()=>k,getDirectivesFromString:()=>P,getMatchBlock:()=>T,getMatchInBetween:()=>I,getObjectFromPath:()=>x,getObjectValue:()=>h,removeQuotes:()=>M,setExpString:()=>N,setLookUpExp:()=>R,setWildCardString:()=>C,startAndEndWith:()=>$,wildCardStringSearch:()=>B});var a=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;r=r||40;for(var t="",n=0;n<r/3+1;n++){t+=Math.random().toString(36).substring(2,15)}return t.substring(0,r)};function c(){return"id__"+a(8)+"__"+(new Date).getTime()}var l=c;function f(r){return null==r||("string"==typeof r||Array.isArray(r)?0===r.length:r instanceof Map||r instanceof Set?0===r.size:ArrayBuffer.isView(r)?0===r.byteLength:"object"===o(r)&&0===Object.keys(r).length)}function s(r){var t=o(r);switch(r){case null:case void 0:case"":return null;case"0":case 0:return 0;default:if(!("number"!==t&&"string"!==t||"number"!=typeof r&&Number.isNaN(Number(r)))){return+r}}return null}function y(r,t){if(null===r){return t?null===t||"null"===t:"null"}var e;switch(o(r)){case"number":case"string":case"boolean":case"undefined":case"bigint":case"symbol":case"function":e=o(r);break;case"object":e=Array.isArray(r)?"array":"object";break;default:e="unknown"}if(t){if(t.includes("|")){var i,u=n(t.split("|"));try{for(u.s();!(i=u.n()).done;){var a=i.value;if(e===a){return a}}}catch(r){u.e(r)}finally{u.f()}return!1}return t===e}return e}function v(r){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},v(r)}var m=function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof r&&"object"!==v(r)){throw new Error("doPoll: The first argument must be a function or Promise.")}var n,e,o,i,u=function(r){return r instanceof Promise},a=t.msg,c=t.interval,l=void 0===c?200:c,f=t.timeout,s=void 0===f?1e3:f,m=t.timeoutMsg,p=void 0===m?null!=a?a:"===> doPoll: cancelled or timed out.":m,g=!1,d=!1,b=function(){if(S(),y(p,"string")){return console.info(p),void i(p)}i()},h=function(r){S(),o(r)};function S(){g=!0,clearTimeout(n),clearInterval(e)}var w=new Promise((function(t,a){o=t,i=a;var c=function(){if(!g&&!d){var t=u(r)?r:r();u(t)?(d=!0,t.then((function(r){d=!1,r&&h(r)})).catch(i)):(Boolean(t)||t)&&h(t)}};e=setInterval(c,l),c(),n=setTimeout((function(){g||b()}),s)}));return w.catch((function(){b()})),{promise:w,stop:b}};function p(r,t){return function(r){if(Array.isArray(r)){return r}}(r)||function(r,t){var n=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=n){var e,o,i,u,a=[],c=!0,l=!1;try{if(i=(n=n.call(r)).next,0===t){if(Object(n)!==n){return}c=!1}else{for(;!(c=(e=i.call(n)).done)&&(a.push(e.value),a.length!==t);c=!0){}}}catch(r){l=!0,o=r}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u)){return}}finally{if(l){throw o}}}return a}}(r,t)||function(r,t){if(r){if("string"==typeof r){return g(r,t)}var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(r,t):void 0}}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=Array(t);n<t;n++){e[n]=r[n]}return e}function d(r,t,n){return(t=function(r){var t=function(r,t){if("object"!=b(r)||!r){return r}var n=r[Symbol.toPrimitive];if(void 0!==n){var e=n.call(r,t||"default");if("object"!=b(e)){return e}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(r)}(r,"string");return"symbol"==b(t)?t:t+""}(t))in r?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r}function b(r){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},b(r)}function h(r,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e=y(e,"number")?{queryTime:e}:e,i=o.queryTime,u=void 0===i?15e3:i,a=o.isFalsy,c=void 0!==a&&a;if(n){return m((function(){var n=h(r,t);return c&&!1===n||n&&!1!==n?n:void 0}),{timeout:u,interval:100,msg:!1}).promise}if(!r){return!1}for(var l=t.split(".");0<l.length;){var f=l[0];for(var s in r){if(s===f){return l[1]?h(r[s],l[1]):r[s]}if("object"===b(r[s])){var v=h(r[s],f);return v||!1}}return!1}}function S(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'"';return"".concat(t).concat(r).concat(t)}function w(r){if(r){if("string"!=typeof r){return r}for(var t=arguments.length,n=new Array(t>1?t-1:0),e=1;e<t;e++){n[e-1]=arguments[e]}return n.reduce((function(r,t){var n=t instanceof RegExp?t:new RegExp(N(t));return r.replace(n,"")}),r).trim()}}function j(r){if(null===u(r,null)){return{}}var t={},n={};for(var e in r){var o=Symbol(e);t[o]=r[e],n[e]=o}return t.keyToSymbolMap=n,t}function A(r,t,n){var e=!1,o=r.map((function(r){if(Array.isArray(r)){var o=A(r,t,n);return o?(e=!0,o):r}return r===t?(e=!0,Array.isArray(n)?n.map((function(r){return Array.isArray(r)?r:r.trim()})):n):r}));return e?o:null}function O(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"[",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"]";if("string"!=typeof r){return r}var e=r.lastIndexOf(t);if(-1===e){return null}var o=r.substring(e),i=o.indexOf(n);return-1===i?null:o.substring(0,i+1)}function E(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'"';return"string"!=typeof r?r:r.replace(/`|'|"/g,t)}function x(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return r.split(".").reduce((function(r,t){return r&&r[t]}),t)}function _(r){if(y(r,"object")||y(r,"array")){return r}var t=$(r,"{","}"),n=$(r,"[","]");if(!t&&!n){return r}var e=t?{}:[],o={},i=function(r){var t=r.match(/^(\[|\{)(.*?)(\]|\})$/);return t?t[2].trim():r}(r),a=function(){for(var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];;){var t=r?O(i,"{","}"):O(i);if(!t){break}var n="__".concat(l(),"__");o[n]=t,i=i.replace(t,n)}};return a(),a(!0),k(i).forEach((function(r,n){var i,a,c=r.includes(":")&&t,l=c?k(r,":"):[],f=M(u(l[0],n));(r=c?l[1]:r)in o&&(r=_(o[r])),i=M(r),r=null!==(a=s(i))?a:i,t?e[f]=r:e.push(r)})),e}function P(r){var t=r;if(!u(t)){return null}var n=function(){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return{type:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,directive:r}},e=/([a-zA-Z]+)\[((.|\n)*?)\]\(((.|\n)*?)\)/gm,o=b(t);if("object"===o||"array"===o){return n(o,t)}switch(!0){case!!t.match(/^\[((.|\n)*?)\]$/gm):o="array";break;case!!t.match(/^\{((.|\n)*?)\:((.|\n)*?)\}/gm):o="object";break;case!!t.match(/^([a-zA-Z]+)(\()(\.|\#)(.*)(\))/g):return n("idOrClassWithDirective",d({},t.split("(")[0].trim(),I(t,"(",")")));case!!t.match(/([a-zA-Z]+)\.(.*?)\(((.|\n)*?)\)/gm):case!!t.match(e):o="dotObject";break;default:return n("string",t)}if("array"===o||"object"===o){var i=E(t);try{return n(o,JSON.parse(i))}catch(r){}return n(o,_(i))}if("dotObject"===o){var a,c,l,f={};return k(t,"&&").forEach((function(r){if(r.match(e)){a=I(r,"](",")"),c=I(r,"[","]"),l=r.split("[")[0].trim()}else{a=I(r,"(",")");var t=p(k(r=r.replace(T(r,"(",")"),""),"."),2);l=t[0],c=t[1]}a=_(a),f[l]||(f[l]={}),k(c,"|").forEach((function(r){f[l][r]=a}))})),n("dotObject",f)}}function T(r,t,n){var e=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"!=typeof r){return r}t=N(t),n=N(n);var o=new RegExp(R(t,n),"gm"),i=r.match(o);return i?e?i:i[0]:null}function k(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";if("string"!=typeof r){return r}if(f(r)){return[]}var n=(r=w(r)).split(t).map((function(r){return w(r)}));return 1===n.length&&""===n[0]?[r]:n}function I(r,t,n){var e,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"!=typeof r){return r}var i=null!==(e=T(r,t,n,o))&&void 0!==e?e:o?[]:r;return o?i.map((function(r){return w(r,t,n)})):w(i,t,n)}function M(r){return"string"!=typeof r?r:r.replace(/`|'|"/g,"")}function $(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return(!t||r.startsWith(t))&&(!n||r.endsWith(n))}function N(r){return r instanceof RegExp?r:r.split("").map((function(r){return["$","^",".","*","+","?","(",")","[","]","{","}","|","\\"].includes(r)?"\\".concat(r):r})).join("")}function R(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++){t[n]=arguments[n]}if(t.length<2){throw new Error("You need to pass at least two arguments")}var e="";return t.forEach((function(r,t){r instanceof RegExp&&(r=r.source),0===t?e=r:e+="((.|\n)*?)".concat(r)})),e}function C(r){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"!=typeof r){return r}if(!r){return null}t=i(t),n=i(n);var e=r.replace(/([.+?^${}()|\[\]\/\\])/g,"\\$&"),o=t?"^":"",u=n?"$":"";return e=e.replace(/\*\*/g,"[_g_]").replace(/\*/g,"(.*?)").replace(/\[_g_\]/g,".*"),"".concat(o).concat(e).concat(u)}function B(r,t){if(!r||!t){return null}var n=new RegExp(C(r,arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]&&arguments[3]));return u("string"==typeof t?t.match(n):t.filter((function(r){return n.test(r)})))}return t})(),"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("powerHelper",[],t):"object"==typeof exports?exports.powerHelper=t():r.powerHelper=t(); |
@@ -1,1 +0,1 @@ | ||
var t,e;t=this,e=()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r){t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})}},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t){return function(t){if(Array.isArray(t)){return o(t)}}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"]){return Array.from(t)}}(t)||function(t,e){if(t){if("string"==typeof t){return o(t,e)}var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++){n[r]=t[r]}return n}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function u(t){var e=function(t,e){if("object"!=r(t)||!t){return t}var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=r(o)){return o}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==r(e)?e:e+""}t.r(e),t.d(e,{doAsync:()=>N,doPoll:()=>A,doTimeout:()=>q,promisePool:()=>I,promiseQueue:()=>T});var a=function(){return t=function t(){!function(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}(this,t),this.listeners={}},e=[{key:"on",value:function(t,e){this.registerListener(t,e)}},{key:"once",value:function(t,e){this.registerListener(t,e,1)}},{key:"exactly",value:function(t,e,r){this.registerListener(t,e,r)}},{key:"off",value:function(t){delete this.listeners[t]}},{key:"detach",value:function(t,e){var r=(this.listeners[t]||[]).filter((function(t){return t.callback!==e}));return t in this.listeners&&(this.listeners[t]=r,!0)}},{key:"emit",value:function(t){for(var e=this,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++){o[i-1]=arguments[i]}var u=[],a=null,c=this.extractContextFromArgs(o),s=c[0];if(o=c[1],this.hasListener(t)){u=this.listeners[t]}else if(t.includes("*")){(a=this.patternSearch(t,Object.keys(this.listeners))).length>0&&a.forEach((function(t){u=u.concat(e.listeners[t])}))}else{for(var l in this.listeners){l.includes("*")&&(a=this.patternSearch(l,[t]))&&(u=u.concat(this.listeners[l]))}}u.forEach((function(r,i){var a=r.callback;s&&(a=a.bind(s)),void 0!==r.triggerCapacity&&(r.triggerCapacity--,u[i].triggerCapacity=r.triggerCapacity),e.checkToRemoveListener(r)&&e.listeners[t].splice(i,1),a.apply(void 0,n(o))}))}},{key:"patternSearch",value:function(t,e){var r,n=new RegExp(this.setWildCardString(t),"g");return 0===(r=e.filter((function(t){return n.test(t)}))).length?null:r}},{key:"setWildCardString",value:function(t){var e=t.replace(/([.+?^${}()|\[\]\/\\])/g,"\\$&");return e=e.replace(/\*/g,"(.*?)"),"^".concat(e)}},{key:"extractContextFromArgs",value:function(t){for(var e=null,n=0;n<t.length;n++){var o=t[n];if(o&&"object"===r(o)&&o.hasOwnProperty("__context")){e=o.__context,t.splice(n,1);break}}return[e,t]}},{key:"registerListener",value:function(t,e,r){this.hasListener(t)||(this.listeners[t]=[]),this.listeners[t].push({callback:e,triggerCapacity:r})}},{key:"checkToRemoveListener",value:function(t){return void 0!==t.triggerCapacity&&t.triggerCapacity<=0}},{key:"hasListener",value:function(t){return t in this.listeners}}],e&&i(t.prototype,e),o&&i(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o}();function c(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t){return s(t,e)}var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a){throw i}}}}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++){n[r]=t[r]}return n}function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}var f=function(t){return Array.isArray(t)?t:[t]},h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;t=t||40;for(var e="",r=0;r<t/3+1;r++){e+=Math.random().toString(36).substring(2,15)}return e.substring(0,t)};function p(){return"id__"+h(8)+"__"+(new Date).getTime()}function y(t,e){if(null===t){return e?null===e||"null"===e:"null"}var r;switch(l(t)){case"number":case"string":case"boolean":case"undefined":case"bigint":case"symbol":case"function":r=l(t);break;case"object":r=Array.isArray(t)?"array":"object";break;default:r="unknown"}if(e){if(e.includes("|")){var n,o=c(e.split("|"));try{for(o.s();!(n=o.n()).done;){var i=n.value;if(r===i){return i}}}catch(t){o.e(t)}finally{o.f()}return!1}return e===r}return r}function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function d(){d=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,u=Object.create(i.prototype),a=new I(n||[]);return o(u,"_invoke",{value:E(t,r,a)}),u}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var h="suspendedStart",p="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function j(){}var _={};s(_,u,(function(){return this}));var P=Object.getPrototypeOf,O=P&&P(P(C([])));O&&O!==r&&n.call(O,u)&&(_=O);var S=j.prototype=b.prototype=Object.create(_);function k(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(o,i,u,a){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==v(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){s.value=t,u(s)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function E(e,r,n){var o=h;return function(i,u){if(o===y){throw Error("Generator is already running")}if(o===m){if("throw"===i){throw u}return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=L(a,n);if(c){if(c===g){continue}return c}}if("next"===n.method){n.sent=n._sent=n.arg}else if("throw"===n.method){if(o===h){throw o=m,n.arg}n.dispatchException(n.arg)}else{"return"===n.method&&n.abrupt("return",n.arg)}o=y;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?m:p,s.arg===g){continue}return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function L(e,r){var n=r.method,o=e.iterator[n];if(o===t){return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,L(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g}var i=f(o,e.iterator,r.arg);if("throw"===i.type){return r.method="throw",r.arg=i.arg,r.delegate=null,g}var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r){return r.call(e)}if("function"==typeof e.next){return e}if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;){if(n.call(e,o)){return r.value=e[o],r.done=!1,r}}return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(v(e)+" is not iterable")}return w.prototype=j,o(S,"constructor",{value:j,configurable:!0}),o(j,"constructor",{value:w,configurable:!0}),w.displayName=s(j,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,j):(t.__proto__=j,s(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},k(x.prototype),s(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new x(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},k(S),s(S,c,"Generator"),s(S,u,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e){r.push(n)}return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e){return t.value=n,t.done=!1,t}}return t.done=!0,t}},e.values=C,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e){for(var r in this){"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)}}},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type){throw t.arg}return this.rval},dispatchException:function(e){if(this.done){throw e}var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc){return o("end")}if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),s=n.call(u,"finallyLoc");if(c&&s){if(this.prev<u.catchLoc){return o(u.catchLoc,!0)}if(this.prev<u.finallyLoc){return o(u.finallyLoc)}}else if(c){if(this.prev<u.catchLoc){return o(u.catchLoc,!0)}}else{if(!s){throw Error("try statement without catch or finally")}if(this.prev<u.finallyLoc){return o(u.finallyLoc)}}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(u)},complete:function(t,e){if("throw"===t.type){throw t.arg}return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t){return this.complete(r.completion,r.afterLoc),A(r),g}}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function m(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function g(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?g(Object(r),!0).forEach((function(e){w(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function w(t,e,r){return(e=O(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function j(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}function _(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,O(n.key),n)}}function P(t,e,r){return e&&_(t.prototype,e),r&&_(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function O(t){var e=function(t,e){if("object"!=v(t)||!t){return t}var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=v(n)){return n}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==v(e)?e:e+""}function S(t,e,r){return e=x(e),function(t,e){if(e&&("object"==v(e)||"function"==typeof e)){return e}if(void 0!==e){throw new TypeError("Derived constructors may only return object or undefined")}return function(t){if(void 0===t){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}(t)}(t,k()?Reflect.construct(e,r||[],x(t).constructor):e.apply(t,r))}function k(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(k=function(){return!!t})()}function x(t){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},x(t)}function E(t,e){if("function"!=typeof e&&null!==e){throw new TypeError("Super expression must either be null or a function")}t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&L(t,e)}function L(t,e){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},L(t,e)}var T=function(){var t={completed:0,rejected:0,pending:0,total:0,errors:"",promises:[]};return new(function(e){function r(){var e;return j(this,r),(e=S(this,r)).queue=[],e.inProgress=!1,e._timer=null,e._stats=b({},t),e}return E(r,e),P(r,[{key:"add",value:function(t){var e=this;if(!(t instanceof Promise||Array.isArray(t)&&t.length>0&&t.every((function(t){return t instanceof Promise})))){if(!y(t,"function")){return console.error("---\x3e Invalid promise added to the Queue:",t.toString()),this.emit("fail",t.toString())}t=new Promise(function(){var e,r=(e=d().mark((function e(r){var n;return d().wrap((function(e){for(;;){switch(e.prev=e.next){case 0:return e.next=2,t();case 2:return n=e.sent,e.abrupt("return",r(n));case 4:case"end":return e.stop()}}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(t){m(i,n,o,u,a,"next",t)}function a(t){m(i,n,o,u,a,"throw",t)}u(void 0)}))});return function(t){return r.apply(this,arguments)}}())}f(t).forEach((function(t){e._stats.total++,e._stats.pending++,e.queue.push({promiseFunction:t,response:null,status:"pending",error:null})})),this.inProgress||this._next(),this._setTimer()}},{key:"clear",value:function(){return this._timer&&clearInterval(this._timer),this._timer=null,this.queue=[],this.inProgress=!1,this._stats=b({},t),this}},{key:"_setTimer",value:function(){var t=this;this._timer&&clearInterval(this._timer),this._timer=setInterval((function(){"done"===t.status()&&(clearInterval(t._timer),t._timer=null,t.emit("completed",t._stats),t.emit("done",t._stats))}),10)}},{key:"_next",value:function(){var t=this;0!==this.queue.length?(this.inProgress=!0,this.queue[0].promiseFunction.then((function(e){t.queue[0].status="fulfilled",t.queue[0].response=e,t._stats.completed++})).catch((function(e){t._stats.errors+=e+"\n",t.queue[0].status="rejected",t._stats.rejected++})).finally((function(){t._stats.promises.push(t.queue[0]),t._stats.pending--,t.queue.shift(),t._next()}))):this.inProgress=!1}},{key:"stats",value:function(){return this._stats}},{key:"status",value:function(){return 0===this.queue.length?"done":"in-progress"}}])}(a))},A=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof t&&"object"!==v(t)){throw new Error("doPoll: The first argument must be a function or Promise.")}var r,n,o,i,u=function(t){return t instanceof Promise},a=e.interval,c=void 0===a?200:a,s=e.timeout,l=void 0===s?1e3:s,f=e.timeoutMsg,h=void 0===f?"===> doPoll: cancelled or timed out.":f,p=!1,y=!1,d=function(){g(),i(console.info(h))},m=function(t){g(),o(t)};function g(){p=!0,clearTimeout(r),clearInterval(n)}var b=new Promise((function(e,a){o=e,i=a;var s=function(){if(!p&&!y){var e=u(t)?t:t();u(e)?(y=!0,e.then((function(t){y=!1,t&&m(t)})).catch(i)):(Boolean(e)||e)&&m(e)}};n=setInterval(s,c),s(),r=setTimeout((function(){p||d()}),l)}));return b.catch((function(){d()})),{promise:b,stop:d}},I=function(){var t="not-started",e={},r=[],n={completed:0,rejected:0,pending:0,total:0,errors:""};return new(function(o){function i(){var t;j(this,i);var e=t=S(this,i);return t._currentPoll=null,setTimeout((function(){e._poll()}),100),t}return E(i,o),P(i,[{key:"_poll",value:function(){var t=this;return this._currentPoll&&this._currentPoll.stop(),this._currentPoll=A((function(){if(t.isDone()){return!0}}),{timeoutMsg:""}),this._currentPoll}},{key:"clear",value:function(){t="not-started",n={completed:0,rejected:0,pending:0,total:0,errors:""},r.length=0,Object.keys(e).forEach((function(t){e[t].rejecter("Promise pool cleared."),delete e[t]})),this._currentPoll=this._poll()}},{key:"add",value:function(o){var i=this;o?(t="in-progress",f(o).forEach((function(t){if(!(t instanceof Promise)){if("function"!=typeof t){return console.info("---\x3e Invalid promise added to the pool."),void r.push(t.toString())}t=N((function(){return t()}))}n.total++;var o=p();e[o]={status:"in-progress",response:null,error:null,resolver:null,rejecter:null},new Promise((function(n,u){e[o].resolver=function(t){"rejected"!==e[o].status&&(e[o].status="completed",e[o].response=t,i._updateStatus(),n(t))},e[o].rejecter=function(t){e[o].status="rejected",e[o].error=t,r.push(t),i._updateStatus(),u()},t.then((function(t){var r;null===(r=e[o])||void 0===r||r.resolver(t)})).catch((function(t){var r;null===(r=e[o])||void 0===r||r.rejecter(t)}))})).catch((function(t){var r;null===(r=e[o])||void 0===r||r.rejecter(t)}))}))):i._updateStatus()}},{key:"status",value:function(){return this._updateStatus(),t}},{key:"isDone",value:function(){return this._updateStatus(),"done"===t}},{key:"isEmpty",value:function(){return 0===n.total}},{key:"results",value:function(){return this._updateStatus(),n}},{key:"stats",value:function(){return this.results()}},{key:"_updateStatus",value:function(){if("done"!==t){var o=Object.values(e);n={completed:o.filter((function(t){return"completed"===t.status})).length,rejected:o.filter((function(t){return"rejected"===t.status})).length,pending:o.filter((function(t){return"in-progress"===t.status})).length,total:o.length,errors:r.join("\n"),promises:e},this.emit("stats",n);var i=o.every((function(t){return"completed"===t.status||"rejected"===t.status}));"done"==(t=i||0===n.total?"done":"in-progress")&&(this.emit("done",n),n.total>0&&(this.emit("completed",n),this.emit("rejected",r,n)))}}}])}(a))},C={};function q(t,e,r){for(var n=arguments.length,o=new Array(n>3?n-3:0),i=3;i<n;i++){o[i-3]=arguments[i]}var u,a;if("string"==typeof t&&"number"==typeof e){u=t,a=e}else if("number"==typeof t&&"function"==typeof e){a=t,r=e}else{if(e||"string"!=typeof t){throw new Error("Invalid parameters")}u=t}var c=u?"_doTimeout_"+u:null;function s(){c&&c in C&&delete C[c]}if(c&&c in C&&(clearTimeout(C[c]),delete C[c]),"function"==typeof r&&"number"==typeof a){return function t(){C[c]=setTimeout((function(){!0===r.apply(void 0,o)?t():s()}),a)}(),!0}u&&void 0===a&&s()}function N(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++){r[n-1]=arguments[n]}return new Promise((function(e,n){try{Promise.resolve(t.apply(void 0,r)).then((function(t){return e(t)})).catch((function(t){return n(t)}))}catch(t){n(t)}}))}return e})(),"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("promiseQueue",[],e):"object"==typeof exports?exports.promiseQueue=e():t.promiseQueue=e(); | ||
var t,e;t=this,e=()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r){t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})}},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t){return function(t){if(Array.isArray(t)){return o(t)}}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"]){return Array.from(t)}}(t)||function(t,e){if(t){if("string"==typeof t){return o(t,e)}var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++){n[r]=t[r]}return n}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function u(t){var e=function(t,e){if("object"!=r(t)||!t){return t}var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=r(o)){return o}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==r(e)?e:e+""}t.r(e),t.d(e,{doAsync:()=>N,doPoll:()=>A,doTimeout:()=>q,promisePool:()=>I,promiseQueue:()=>T});var a=function(){return t=function t(){!function(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}(this,t),this.listeners={}},e=[{key:"on",value:function(t,e){this.registerListener(t,e)}},{key:"once",value:function(t,e){this.registerListener(t,e,1)}},{key:"exactly",value:function(t,e,r){this.registerListener(t,e,r)}},{key:"off",value:function(t){delete this.listeners[t]}},{key:"detach",value:function(t,e){var r=(this.listeners[t]||[]).filter((function(t){return t.callback!==e}));return t in this.listeners&&(this.listeners[t]=r,!0)}},{key:"emit",value:function(t){for(var e=this,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++){o[i-1]=arguments[i]}var u=[],a=null,c=this.extractContextFromArgs(o),s=c[0];if(o=c[1],this.hasListener(t)){u=this.listeners[t]}else if(t.includes("*")){(a=this.patternSearch(t,Object.keys(this.listeners))).length>0&&a.forEach((function(t){u=u.concat(e.listeners[t])}))}else{for(var l in this.listeners){l.includes("*")&&(a=this.patternSearch(l,[t]))&&(u=u.concat(this.listeners[l]))}}u.forEach((function(r,i){var a=r.callback;s&&(a=a.bind(s)),void 0!==r.triggerCapacity&&(r.triggerCapacity--,u[i].triggerCapacity=r.triggerCapacity),e.checkToRemoveListener(r)&&e.listeners[t].splice(i,1),a.apply(void 0,n(o))}))}},{key:"patternSearch",value:function(t,e){var r,n=new RegExp(this.setWildCardString(t),"g");return 0===(r=e.filter((function(t){return n.test(t)}))).length?null:r}},{key:"setWildCardString",value:function(t){var e=t.replace(/([.+?^${}()|\[\]\/\\])/g,"\\$&");return e=e.replace(/\*/g,"(.*?)"),"^".concat(e)}},{key:"extractContextFromArgs",value:function(t){for(var e=null,n=0;n<t.length;n++){var o=t[n];if(o&&"object"===r(o)&&o.hasOwnProperty("__context")){e=o.__context,t.splice(n,1);break}}return[e,t]}},{key:"registerListener",value:function(t,e,r){this.hasListener(t)||(this.listeners[t]=[]),this.listeners[t].push({callback:e,triggerCapacity:r})}},{key:"checkToRemoveListener",value:function(t){return void 0!==t.triggerCapacity&&t.triggerCapacity<=0}},{key:"hasListener",value:function(t){return t in this.listeners}}],e&&i(t.prototype,e),o&&i(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o}();function c(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t){return s(t,e)}var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a){throw i}}}}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++){n[r]=t[r]}return n}function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}var f=function(t){return Array.isArray(t)?t:[t]},h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;t=t||40;for(var e="",r=0;r<t/3+1;r++){e+=Math.random().toString(36).substring(2,15)}return e.substring(0,t)};function p(){return"id__"+h(8)+"__"+(new Date).getTime()}function y(t,e){if(null===t){return e?null===e||"null"===e:"null"}var r;switch(l(t)){case"number":case"string":case"boolean":case"undefined":case"bigint":case"symbol":case"function":r=l(t);break;case"object":r=Array.isArray(t)?"array":"object";break;default:r="unknown"}if(e){if(e.includes("|")){var n,o=c(e.split("|"));try{for(o.s();!(n=o.n()).done;){var i=n.value;if(r===i){return i}}}catch(t){o.e(t)}finally{o.f()}return!1}return e===r}return r}function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function d(){d=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,u=Object.create(i.prototype),a=new I(n||[]);return o(u,"_invoke",{value:E(t,r,a)}),u}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var h="suspendedStart",p="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function j(){}var _={};s(_,u,(function(){return this}));var P=Object.getPrototypeOf,O=P&&P(P(C([])));O&&O!==r&&n.call(O,u)&&(_=O);var S=j.prototype=b.prototype=Object.create(_);function k(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(o,i,u,a){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==v(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){s.value=t,u(s)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function E(e,r,n){var o=h;return function(i,u){if(o===y){throw Error("Generator is already running")}if(o===m){if("throw"===i){throw u}return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=L(a,n);if(c){if(c===g){continue}return c}}if("next"===n.method){n.sent=n._sent=n.arg}else if("throw"===n.method){if(o===h){throw o=m,n.arg}n.dispatchException(n.arg)}else{"return"===n.method&&n.abrupt("return",n.arg)}o=y;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?m:p,s.arg===g){continue}return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function L(e,r){var n=r.method,o=e.iterator[n];if(o===t){return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,L(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g}var i=f(o,e.iterator,r.arg);if("throw"===i.type){return r.method="throw",r.arg=i.arg,r.delegate=null,g}var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r){return r.call(e)}if("function"==typeof e.next){return e}if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;){if(n.call(e,o)){return r.value=e[o],r.done=!1,r}}return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(v(e)+" is not iterable")}return w.prototype=j,o(S,"constructor",{value:j,configurable:!0}),o(j,"constructor",{value:w,configurable:!0}),w.displayName=s(j,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,j):(t.__proto__=j,s(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},k(x.prototype),s(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new x(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},k(S),s(S,c,"Generator"),s(S,u,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e){r.push(n)}return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e){return t.value=n,t.done=!1,t}}return t.done=!0,t}},e.values=C,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e){for(var r in this){"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)}}},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type){throw t.arg}return this.rval},dispatchException:function(e){if(this.done){throw e}var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc){return o("end")}if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),s=n.call(u,"finallyLoc");if(c&&s){if(this.prev<u.catchLoc){return o(u.catchLoc,!0)}if(this.prev<u.finallyLoc){return o(u.finallyLoc)}}else if(c){if(this.prev<u.catchLoc){return o(u.catchLoc,!0)}}else{if(!s){throw Error("try statement without catch or finally")}if(this.prev<u.finallyLoc){return o(u.finallyLoc)}}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(u)},complete:function(t,e){if("throw"===t.type){throw t.arg}return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t){return this.complete(r.completion,r.afterLoc),A(r),g}}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function m(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function g(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?g(Object(r),!0).forEach((function(e){w(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function w(t,e,r){return(e=O(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function j(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}function _(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,O(n.key),n)}}function P(t,e,r){return e&&_(t.prototype,e),r&&_(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function O(t){var e=function(t,e){if("object"!=v(t)||!t){return t}var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=v(n)){return n}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==v(e)?e:e+""}function S(t,e,r){return e=x(e),function(t,e){if(e&&("object"==v(e)||"function"==typeof e)){return e}if(void 0!==e){throw new TypeError("Derived constructors may only return object or undefined")}return function(t){if(void 0===t){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}(t)}(t,k()?Reflect.construct(e,r||[],x(t).constructor):e.apply(t,r))}function k(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(k=function(){return!!t})()}function x(t){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},x(t)}function E(t,e){if("function"!=typeof e&&null!==e){throw new TypeError("Super expression must either be null or a function")}t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&L(t,e)}function L(t,e){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},L(t,e)}var T=function(){var t={completed:0,rejected:0,pending:0,total:0,errors:"",promises:[]};return new(function(e){function r(){var e;return j(this,r),(e=S(this,r)).queue=[],e.inProgress=!1,e._timer=null,e._stats=b({},t),e}return E(r,e),P(r,[{key:"add",value:function(t){var e=this;if(!(t instanceof Promise||Array.isArray(t)&&t.length>0&&t.every((function(t){return t instanceof Promise})))){if(!y(t,"function")){return console.error("---\x3e Invalid promise added to the Queue:",t.toString()),this.emit("fail",t.toString())}t=new Promise(function(){var e,r=(e=d().mark((function e(r){var n;return d().wrap((function(e){for(;;){switch(e.prev=e.next){case 0:return e.next=2,t();case 2:return n=e.sent,e.abrupt("return",r(n));case 4:case"end":return e.stop()}}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(t){m(i,n,o,u,a,"next",t)}function a(t){m(i,n,o,u,a,"throw",t)}u(void 0)}))});return function(t){return r.apply(this,arguments)}}())}f(t).forEach((function(t){e._stats.total++,e._stats.pending++,e.queue.push({promiseFunction:t,response:null,status:"pending",error:null})})),this.inProgress||this._next(),this._setTimer()}},{key:"clear",value:function(){return this._timer&&clearInterval(this._timer),this._timer=null,this.queue=[],this.inProgress=!1,this._stats=b({},t),this}},{key:"_setTimer",value:function(){var t=this;this._timer&&clearInterval(this._timer),this._timer=setInterval((function(){"done"===t.status()&&(clearInterval(t._timer),t._timer=null,t.emit("completed",t._stats),t.emit("done",t._stats))}),10)}},{key:"_next",value:function(){var t=this;0!==this.queue.length?(this.inProgress=!0,this.queue[0].promiseFunction.then((function(e){t.queue[0].status="fulfilled",t.queue[0].response=e,t._stats.completed++})).catch((function(e){t._stats.errors+=e+"\n",t.queue[0].status="rejected",t._stats.rejected++})).finally((function(){t._stats.promises.push(t.queue[0]),t._stats.pending--,t.queue.shift(),t._next()}))):this.inProgress=!1}},{key:"stats",value:function(){return this._stats}},{key:"status",value:function(){return 0===this.queue.length?"done":"in-progress"}}])}(a))},A=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof t&&"object"!==v(t)){throw new Error("doPoll: The first argument must be a function or Promise.")}var r,n,o,i,u=function(t){return t instanceof Promise},a=e.msg,c=e.interval,s=void 0===c?200:c,l=e.timeout,f=void 0===l?1e3:l,h=e.timeoutMsg,p=void 0===h?null!=a?a:"===> doPoll: cancelled or timed out.":h,d=!1,m=!1,g=function(){if(w(),y(p,"string")){return console.info(p),void i(p)}i()},b=function(t){w(),o(t)};function w(){d=!0,clearTimeout(r),clearInterval(n)}var j=new Promise((function(e,a){o=e,i=a;var c=function(){if(!d&&!m){var e=u(t)?t:t();u(e)?(m=!0,e.then((function(t){m=!1,t&&b(t)})).catch(i)):(Boolean(e)||e)&&b(e)}};n=setInterval(c,s),c(),r=setTimeout((function(){d||g()}),f)}));return j.catch((function(){g()})),{promise:j,stop:g}},I=function(){var t="not-started",e={},r=[],n={completed:0,rejected:0,pending:0,total:0,errors:""};return new(function(o){function i(){var t;j(this,i);var e=t=S(this,i);return t._currentPoll=null,setTimeout((function(){e._poll()}),100),t}return E(i,o),P(i,[{key:"_poll",value:function(){var t=this;return this._currentPoll&&this._currentPoll.stop(),this._currentPoll=A((function(){if(t.isDone()){return!0}}),{timeoutMsg:""}),this._currentPoll}},{key:"clear",value:function(){t="not-started",n={completed:0,rejected:0,pending:0,total:0,errors:""},r.length=0,Object.keys(e).forEach((function(t){e[t].rejecter("Promise pool cleared."),delete e[t]})),this._currentPoll=this._poll()}},{key:"add",value:function(o){var i=this;o?(t="in-progress",f(o).forEach((function(t){if(!(t instanceof Promise)){if("function"!=typeof t){return console.info("---\x3e Invalid promise added to the pool."),void r.push(t.toString())}t=N((function(){return t()}))}n.total++;var o=p();e[o]={status:"in-progress",response:null,error:null,resolver:null,rejecter:null},new Promise((function(n,u){e[o].resolver=function(t){"rejected"!==e[o].status&&(e[o].status="completed",e[o].response=t,i._updateStatus(),n(t))},e[o].rejecter=function(t){e[o].status="rejected",e[o].error=t,r.push(t),i._updateStatus(),u()},t.then((function(t){var r;null===(r=e[o])||void 0===r||r.resolver(t)})).catch((function(t){var r;null===(r=e[o])||void 0===r||r.rejecter(t)}))})).catch((function(t){var r;null===(r=e[o])||void 0===r||r.rejecter(t)}))}))):i._updateStatus()}},{key:"status",value:function(){return this._updateStatus(),t}},{key:"isDone",value:function(){return this._updateStatus(),"done"===t}},{key:"isEmpty",value:function(){return 0===n.total}},{key:"results",value:function(){return this._updateStatus(),n}},{key:"stats",value:function(){return this.results()}},{key:"_updateStatus",value:function(){if("done"!==t){var o=Object.values(e);n={completed:o.filter((function(t){return"completed"===t.status})).length,rejected:o.filter((function(t){return"rejected"===t.status})).length,pending:o.filter((function(t){return"in-progress"===t.status})).length,total:o.length,errors:r.join("\n"),promises:e},this.emit("stats",n);var i=o.every((function(t){return"completed"===t.status||"rejected"===t.status}));"done"==(t=i||0===n.total?"done":"in-progress")&&(this.emit("done",n),n.total>0&&(this.emit("completed",n),this.emit("rejected",r,n)))}}}])}(a))},C={};function q(t,e,r){for(var n=arguments.length,o=new Array(n>3?n-3:0),i=3;i<n;i++){o[i-3]=arguments[i]}var u,a;if("string"==typeof t&&"number"==typeof e){u=t,a=e}else if("number"==typeof t&&"function"==typeof e){a=t,r=e}else{if(e||"string"!=typeof t){throw new Error("Invalid parameters")}u=t}var c=u?"_doTimeout_"+u:null;function s(){c&&c in C&&delete C[c]}if(c&&c in C&&(clearTimeout(C[c]),delete C[c]),"function"==typeof r&&"number"==typeof a){return function t(){C[c]=setTimeout((function(){!0===r.apply(void 0,o)?t():s()}),a)}(),!0}u&&void 0===a&&s()}function N(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++){r[n-1]=arguments[n]}return new Promise((function(e,n){try{Promise.resolve(t.apply(void 0,r)).then((function(t){return e(t)})).catch((function(t){return n(t)}))}catch(t){n(t)}}))}return e})(),"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("promiseQueue",[],e):"object"==typeof exports?exports.promiseQueue=e():t.promiseQueue=e(); |
@@ -1,1 +0,1 @@ | ||
var t,e;t=this,e=()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r){t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})}},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t){return function(t){if(Array.isArray(t)){return o(t)}}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"]){return Array.from(t)}}(t)||function(t,e){if(t){if("string"==typeof t){return o(t,e)}var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++){n[r]=t[r]}return n}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function u(t){var e=function(t,e){if("object"!=r(t)||!t){return t}var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=r(o)){return o}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==r(e)?e:e+""}t.r(e),t.d(e,{doAsync:()=>N,doPoll:()=>A,doTimeout:()=>q,promisePool:()=>I,promiseQueue:()=>T});var a=function(){return t=function t(){!function(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}(this,t),this.listeners={}},e=[{key:"on",value:function(t,e){this.registerListener(t,e)}},{key:"once",value:function(t,e){this.registerListener(t,e,1)}},{key:"exactly",value:function(t,e,r){this.registerListener(t,e,r)}},{key:"off",value:function(t){delete this.listeners[t]}},{key:"detach",value:function(t,e){var r=(this.listeners[t]||[]).filter((function(t){return t.callback!==e}));return t in this.listeners&&(this.listeners[t]=r,!0)}},{key:"emit",value:function(t){for(var e=this,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++){o[i-1]=arguments[i]}var u=[],a=null,c=this.extractContextFromArgs(o),s=c[0];if(o=c[1],this.hasListener(t)){u=this.listeners[t]}else if(t.includes("*")){(a=this.patternSearch(t,Object.keys(this.listeners))).length>0&&a.forEach((function(t){u=u.concat(e.listeners[t])}))}else{for(var l in this.listeners){l.includes("*")&&(a=this.patternSearch(l,[t]))&&(u=u.concat(this.listeners[l]))}}u.forEach((function(r,i){var a=r.callback;s&&(a=a.bind(s)),void 0!==r.triggerCapacity&&(r.triggerCapacity--,u[i].triggerCapacity=r.triggerCapacity),e.checkToRemoveListener(r)&&e.listeners[t].splice(i,1),a.apply(void 0,n(o))}))}},{key:"patternSearch",value:function(t,e){var r,n=new RegExp(this.setWildCardString(t),"g");return 0===(r=e.filter((function(t){return n.test(t)}))).length?null:r}},{key:"setWildCardString",value:function(t){var e=t.replace(/([.+?^${}()|\[\]\/\\])/g,"\\$&");return e=e.replace(/\*/g,"(.*?)"),"^".concat(e)}},{key:"extractContextFromArgs",value:function(t){for(var e=null,n=0;n<t.length;n++){var o=t[n];if(o&&"object"===r(o)&&o.hasOwnProperty("__context")){e=o.__context,t.splice(n,1);break}}return[e,t]}},{key:"registerListener",value:function(t,e,r){this.hasListener(t)||(this.listeners[t]=[]),this.listeners[t].push({callback:e,triggerCapacity:r})}},{key:"checkToRemoveListener",value:function(t){return void 0!==t.triggerCapacity&&t.triggerCapacity<=0}},{key:"hasListener",value:function(t){return t in this.listeners}}],e&&i(t.prototype,e),o&&i(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o}();function c(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t){return s(t,e)}var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a){throw i}}}}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++){n[r]=t[r]}return n}function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}var f=function(t){return Array.isArray(t)?t:[t]},h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;t=t||40;for(var e="",r=0;r<t/3+1;r++){e+=Math.random().toString(36).substring(2,15)}return e.substring(0,t)};function p(){return"id__"+h(8)+"__"+(new Date).getTime()}function y(t,e){if(null===t){return e?null===e||"null"===e:"null"}var r;switch(l(t)){case"number":case"string":case"boolean":case"undefined":case"bigint":case"symbol":case"function":r=l(t);break;case"object":r=Array.isArray(t)?"array":"object";break;default:r="unknown"}if(e){if(e.includes("|")){var n,o=c(e.split("|"));try{for(o.s();!(n=o.n()).done;){var i=n.value;if(r===i){return i}}}catch(t){o.e(t)}finally{o.f()}return!1}return e===r}return r}function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function d(){d=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,u=Object.create(i.prototype),a=new I(n||[]);return o(u,"_invoke",{value:E(t,r,a)}),u}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var h="suspendedStart",p="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function j(){}var _={};s(_,u,(function(){return this}));var P=Object.getPrototypeOf,O=P&&P(P(C([])));O&&O!==r&&n.call(O,u)&&(_=O);var S=j.prototype=b.prototype=Object.create(_);function k(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(o,i,u,a){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==v(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){s.value=t,u(s)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function E(e,r,n){var o=h;return function(i,u){if(o===y){throw Error("Generator is already running")}if(o===m){if("throw"===i){throw u}return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=L(a,n);if(c){if(c===g){continue}return c}}if("next"===n.method){n.sent=n._sent=n.arg}else if("throw"===n.method){if(o===h){throw o=m,n.arg}n.dispatchException(n.arg)}else{"return"===n.method&&n.abrupt("return",n.arg)}o=y;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?m:p,s.arg===g){continue}return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function L(e,r){var n=r.method,o=e.iterator[n];if(o===t){return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,L(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g}var i=f(o,e.iterator,r.arg);if("throw"===i.type){return r.method="throw",r.arg=i.arg,r.delegate=null,g}var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r){return r.call(e)}if("function"==typeof e.next){return e}if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;){if(n.call(e,o)){return r.value=e[o],r.done=!1,r}}return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(v(e)+" is not iterable")}return w.prototype=j,o(S,"constructor",{value:j,configurable:!0}),o(j,"constructor",{value:w,configurable:!0}),w.displayName=s(j,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,j):(t.__proto__=j,s(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},k(x.prototype),s(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new x(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},k(S),s(S,c,"Generator"),s(S,u,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e){r.push(n)}return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e){return t.value=n,t.done=!1,t}}return t.done=!0,t}},e.values=C,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e){for(var r in this){"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)}}},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type){throw t.arg}return this.rval},dispatchException:function(e){if(this.done){throw e}var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc){return o("end")}if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),s=n.call(u,"finallyLoc");if(c&&s){if(this.prev<u.catchLoc){return o(u.catchLoc,!0)}if(this.prev<u.finallyLoc){return o(u.finallyLoc)}}else if(c){if(this.prev<u.catchLoc){return o(u.catchLoc,!0)}}else{if(!s){throw Error("try statement without catch or finally")}if(this.prev<u.finallyLoc){return o(u.finallyLoc)}}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(u)},complete:function(t,e){if("throw"===t.type){throw t.arg}return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t){return this.complete(r.completion,r.afterLoc),A(r),g}}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function m(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function g(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?g(Object(r),!0).forEach((function(e){w(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function w(t,e,r){return(e=O(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function j(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}function _(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,O(n.key),n)}}function P(t,e,r){return e&&_(t.prototype,e),r&&_(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function O(t){var e=function(t,e){if("object"!=v(t)||!t){return t}var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=v(n)){return n}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==v(e)?e:e+""}function S(t,e,r){return e=x(e),function(t,e){if(e&&("object"==v(e)||"function"==typeof e)){return e}if(void 0!==e){throw new TypeError("Derived constructors may only return object or undefined")}return function(t){if(void 0===t){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}(t)}(t,k()?Reflect.construct(e,r||[],x(t).constructor):e.apply(t,r))}function k(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(k=function(){return!!t})()}function x(t){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},x(t)}function E(t,e){if("function"!=typeof e&&null!==e){throw new TypeError("Super expression must either be null or a function")}t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&L(t,e)}function L(t,e){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},L(t,e)}var T=function(){var t={completed:0,rejected:0,pending:0,total:0,errors:"",promises:[]};return new(function(e){function r(){var e;return j(this,r),(e=S(this,r)).queue=[],e.inProgress=!1,e._timer=null,e._stats=b({},t),e}return E(r,e),P(r,[{key:"add",value:function(t){var e=this;if(!(t instanceof Promise||Array.isArray(t)&&t.length>0&&t.every((function(t){return t instanceof Promise})))){if(!y(t,"function")){return console.error("---\x3e Invalid promise added to the Queue:",t.toString()),this.emit("fail",t.toString())}t=new Promise(function(){var e,r=(e=d().mark((function e(r){var n;return d().wrap((function(e){for(;;){switch(e.prev=e.next){case 0:return e.next=2,t();case 2:return n=e.sent,e.abrupt("return",r(n));case 4:case"end":return e.stop()}}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(t){m(i,n,o,u,a,"next",t)}function a(t){m(i,n,o,u,a,"throw",t)}u(void 0)}))});return function(t){return r.apply(this,arguments)}}())}f(t).forEach((function(t){e._stats.total++,e._stats.pending++,e.queue.push({promiseFunction:t,response:null,status:"pending",error:null})})),this.inProgress||this._next(),this._setTimer()}},{key:"clear",value:function(){return this._timer&&clearInterval(this._timer),this._timer=null,this.queue=[],this.inProgress=!1,this._stats=b({},t),this}},{key:"_setTimer",value:function(){var t=this;this._timer&&clearInterval(this._timer),this._timer=setInterval((function(){"done"===t.status()&&(clearInterval(t._timer),t._timer=null,t.emit("completed",t._stats),t.emit("done",t._stats))}),10)}},{key:"_next",value:function(){var t=this;0!==this.queue.length?(this.inProgress=!0,this.queue[0].promiseFunction.then((function(e){t.queue[0].status="fulfilled",t.queue[0].response=e,t._stats.completed++})).catch((function(e){t._stats.errors+=e+"\n",t.queue[0].status="rejected",t._stats.rejected++})).finally((function(){t._stats.promises.push(t.queue[0]),t._stats.pending--,t.queue.shift(),t._next()}))):this.inProgress=!1}},{key:"stats",value:function(){return this._stats}},{key:"status",value:function(){return 0===this.queue.length?"done":"in-progress"}}])}(a))},A=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof t&&"object"!==v(t)){throw new Error("doPoll: The first argument must be a function or Promise.")}var r,n,o,i,u=function(t){return t instanceof Promise},a=e.interval,c=void 0===a?200:a,s=e.timeout,l=void 0===s?1e3:s,f=e.timeoutMsg,h=void 0===f?"===> doPoll: cancelled or timed out.":f,p=!1,y=!1,d=function(){g(),i(console.info(h))},m=function(t){g(),o(t)};function g(){p=!0,clearTimeout(r),clearInterval(n)}var b=new Promise((function(e,a){o=e,i=a;var s=function(){if(!p&&!y){var e=u(t)?t:t();u(e)?(y=!0,e.then((function(t){y=!1,t&&m(t)})).catch(i)):(Boolean(e)||e)&&m(e)}};n=setInterval(s,c),s(),r=setTimeout((function(){p||d()}),l)}));return b.catch((function(){d()})),{promise:b,stop:d}},I=function(){var t="not-started",e={},r=[],n={completed:0,rejected:0,pending:0,total:0,errors:""};return new(function(o){function i(){var t;j(this,i);var e=t=S(this,i);return t._currentPoll=null,setTimeout((function(){e._poll()}),100),t}return E(i,o),P(i,[{key:"_poll",value:function(){var t=this;return this._currentPoll&&this._currentPoll.stop(),this._currentPoll=A((function(){if(t.isDone()){return!0}}),{timeoutMsg:""}),this._currentPoll}},{key:"clear",value:function(){t="not-started",n={completed:0,rejected:0,pending:0,total:0,errors:""},r.length=0,Object.keys(e).forEach((function(t){e[t].rejecter("Promise pool cleared."),delete e[t]})),this._currentPoll=this._poll()}},{key:"add",value:function(o){var i=this;o?(t="in-progress",f(o).forEach((function(t){if(!(t instanceof Promise)){if("function"!=typeof t){return console.info("---\x3e Invalid promise added to the pool."),void r.push(t.toString())}t=N((function(){return t()}))}n.total++;var o=p();e[o]={status:"in-progress",response:null,error:null,resolver:null,rejecter:null},new Promise((function(n,u){e[o].resolver=function(t){"rejected"!==e[o].status&&(e[o].status="completed",e[o].response=t,i._updateStatus(),n(t))},e[o].rejecter=function(t){e[o].status="rejected",e[o].error=t,r.push(t),i._updateStatus(),u()},t.then((function(t){var r;null===(r=e[o])||void 0===r||r.resolver(t)})).catch((function(t){var r;null===(r=e[o])||void 0===r||r.rejecter(t)}))})).catch((function(t){var r;null===(r=e[o])||void 0===r||r.rejecter(t)}))}))):i._updateStatus()}},{key:"status",value:function(){return this._updateStatus(),t}},{key:"isDone",value:function(){return this._updateStatus(),"done"===t}},{key:"isEmpty",value:function(){return 0===n.total}},{key:"results",value:function(){return this._updateStatus(),n}},{key:"stats",value:function(){return this.results()}},{key:"_updateStatus",value:function(){if("done"!==t){var o=Object.values(e);n={completed:o.filter((function(t){return"completed"===t.status})).length,rejected:o.filter((function(t){return"rejected"===t.status})).length,pending:o.filter((function(t){return"in-progress"===t.status})).length,total:o.length,errors:r.join("\n"),promises:e},this.emit("stats",n);var i=o.every((function(t){return"completed"===t.status||"rejected"===t.status}));"done"==(t=i||0===n.total?"done":"in-progress")&&(this.emit("done",n),n.total>0&&(this.emit("completed",n),this.emit("rejected",r,n)))}}}])}(a))},C={};function q(t,e,r){for(var n=arguments.length,o=new Array(n>3?n-3:0),i=3;i<n;i++){o[i-3]=arguments[i]}var u,a;if("string"==typeof t&&"number"==typeof e){u=t,a=e}else if("number"==typeof t&&"function"==typeof e){a=t,r=e}else{if(e||"string"!=typeof t){throw new Error("Invalid parameters")}u=t}var c=u?"_doTimeout_"+u:null;function s(){c&&c in C&&delete C[c]}if(c&&c in C&&(clearTimeout(C[c]),delete C[c]),"function"==typeof r&&"number"==typeof a){return function t(){C[c]=setTimeout((function(){!0===r.apply(void 0,o)?t():s()}),a)}(),!0}u&&void 0===a&&s()}function N(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++){r[n-1]=arguments[n]}return new Promise((function(e,n){try{Promise.resolve(t.apply(void 0,r)).then((function(t){return e(t)})).catch((function(t){return n(t)}))}catch(t){n(t)}}))}return e})(),"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("promises",[],e):"object"==typeof exports?exports.promises=e():t.promises=e(); | ||
var t,e;t=this,e=()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r){t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})}},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t){return function(t){if(Array.isArray(t)){return o(t)}}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"]){return Array.from(t)}}(t)||function(t,e){if(t){if("string"==typeof t){return o(t,e)}var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++){n[r]=t[r]}return n}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function u(t){var e=function(t,e){if("object"!=r(t)||!t){return t}var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=r(o)){return o}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==r(e)?e:e+""}t.r(e),t.d(e,{doAsync:()=>N,doPoll:()=>A,doTimeout:()=>q,promisePool:()=>I,promiseQueue:()=>T});var a=function(){return t=function t(){!function(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}(this,t),this.listeners={}},e=[{key:"on",value:function(t,e){this.registerListener(t,e)}},{key:"once",value:function(t,e){this.registerListener(t,e,1)}},{key:"exactly",value:function(t,e,r){this.registerListener(t,e,r)}},{key:"off",value:function(t){delete this.listeners[t]}},{key:"detach",value:function(t,e){var r=(this.listeners[t]||[]).filter((function(t){return t.callback!==e}));return t in this.listeners&&(this.listeners[t]=r,!0)}},{key:"emit",value:function(t){for(var e=this,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++){o[i-1]=arguments[i]}var u=[],a=null,c=this.extractContextFromArgs(o),s=c[0];if(o=c[1],this.hasListener(t)){u=this.listeners[t]}else if(t.includes("*")){(a=this.patternSearch(t,Object.keys(this.listeners))).length>0&&a.forEach((function(t){u=u.concat(e.listeners[t])}))}else{for(var l in this.listeners){l.includes("*")&&(a=this.patternSearch(l,[t]))&&(u=u.concat(this.listeners[l]))}}u.forEach((function(r,i){var a=r.callback;s&&(a=a.bind(s)),void 0!==r.triggerCapacity&&(r.triggerCapacity--,u[i].triggerCapacity=r.triggerCapacity),e.checkToRemoveListener(r)&&e.listeners[t].splice(i,1),a.apply(void 0,n(o))}))}},{key:"patternSearch",value:function(t,e){var r,n=new RegExp(this.setWildCardString(t),"g");return 0===(r=e.filter((function(t){return n.test(t)}))).length?null:r}},{key:"setWildCardString",value:function(t){var e=t.replace(/([.+?^${}()|\[\]\/\\])/g,"\\$&");return e=e.replace(/\*/g,"(.*?)"),"^".concat(e)}},{key:"extractContextFromArgs",value:function(t){for(var e=null,n=0;n<t.length;n++){var o=t[n];if(o&&"object"===r(o)&&o.hasOwnProperty("__context")){e=o.__context,t.splice(n,1);break}}return[e,t]}},{key:"registerListener",value:function(t,e,r){this.hasListener(t)||(this.listeners[t]=[]),this.listeners[t].push({callback:e,triggerCapacity:r})}},{key:"checkToRemoveListener",value:function(t){return void 0!==t.triggerCapacity&&t.triggerCapacity<=0}},{key:"hasListener",value:function(t){return t in this.listeners}}],e&&i(t.prototype,e),o&&i(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o}();function c(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t){return s(t,e)}var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a){throw i}}}}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++){n[r]=t[r]}return n}function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}var f=function(t){return Array.isArray(t)?t:[t]},h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;t=t||40;for(var e="",r=0;r<t/3+1;r++){e+=Math.random().toString(36).substring(2,15)}return e.substring(0,t)};function p(){return"id__"+h(8)+"__"+(new Date).getTime()}function y(t,e){if(null===t){return e?null===e||"null"===e:"null"}var r;switch(l(t)){case"number":case"string":case"boolean":case"undefined":case"bigint":case"symbol":case"function":r=l(t);break;case"object":r=Array.isArray(t)?"array":"object";break;default:r="unknown"}if(e){if(e.includes("|")){var n,o=c(e.split("|"));try{for(o.s();!(n=o.n()).done;){var i=n.value;if(r===i){return i}}}catch(t){o.e(t)}finally{o.f()}return!1}return e===r}return r}function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function d(){d=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,u=Object.create(i.prototype),a=new I(n||[]);return o(u,"_invoke",{value:E(t,r,a)}),u}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var h="suspendedStart",p="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function j(){}var _={};s(_,u,(function(){return this}));var P=Object.getPrototypeOf,O=P&&P(P(C([])));O&&O!==r&&n.call(O,u)&&(_=O);var S=j.prototype=b.prototype=Object.create(_);function k(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(o,i,u,a){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==v(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){s.value=t,u(s)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function E(e,r,n){var o=h;return function(i,u){if(o===y){throw Error("Generator is already running")}if(o===m){if("throw"===i){throw u}return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=L(a,n);if(c){if(c===g){continue}return c}}if("next"===n.method){n.sent=n._sent=n.arg}else if("throw"===n.method){if(o===h){throw o=m,n.arg}n.dispatchException(n.arg)}else{"return"===n.method&&n.abrupt("return",n.arg)}o=y;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?m:p,s.arg===g){continue}return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function L(e,r){var n=r.method,o=e.iterator[n];if(o===t){return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,L(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g}var i=f(o,e.iterator,r.arg);if("throw"===i.type){return r.method="throw",r.arg=i.arg,r.delegate=null,g}var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r){return r.call(e)}if("function"==typeof e.next){return e}if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;){if(n.call(e,o)){return r.value=e[o],r.done=!1,r}}return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(v(e)+" is not iterable")}return w.prototype=j,o(S,"constructor",{value:j,configurable:!0}),o(j,"constructor",{value:w,configurable:!0}),w.displayName=s(j,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,j):(t.__proto__=j,s(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},k(x.prototype),s(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new x(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},k(S),s(S,c,"Generator"),s(S,u,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e){r.push(n)}return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e){return t.value=n,t.done=!1,t}}return t.done=!0,t}},e.values=C,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e){for(var r in this){"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)}}},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type){throw t.arg}return this.rval},dispatchException:function(e){if(this.done){throw e}var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc){return o("end")}if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),s=n.call(u,"finallyLoc");if(c&&s){if(this.prev<u.catchLoc){return o(u.catchLoc,!0)}if(this.prev<u.finallyLoc){return o(u.finallyLoc)}}else if(c){if(this.prev<u.catchLoc){return o(u.catchLoc,!0)}}else{if(!s){throw Error("try statement without catch or finally")}if(this.prev<u.finallyLoc){return o(u.finallyLoc)}}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(u)},complete:function(t,e){if("throw"===t.type){throw t.arg}return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t){return this.complete(r.completion,r.afterLoc),A(r),g}}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function m(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function g(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?g(Object(r),!0).forEach((function(e){w(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function w(t,e,r){return(e=O(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function j(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}function _(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,O(n.key),n)}}function P(t,e,r){return e&&_(t.prototype,e),r&&_(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function O(t){var e=function(t,e){if("object"!=v(t)||!t){return t}var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=v(n)){return n}throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==v(e)?e:e+""}function S(t,e,r){return e=x(e),function(t,e){if(e&&("object"==v(e)||"function"==typeof e)){return e}if(void 0!==e){throw new TypeError("Derived constructors may only return object or undefined")}return function(t){if(void 0===t){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}(t)}(t,k()?Reflect.construct(e,r||[],x(t).constructor):e.apply(t,r))}function k(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(k=function(){return!!t})()}function x(t){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},x(t)}function E(t,e){if("function"!=typeof e&&null!==e){throw new TypeError("Super expression must either be null or a function")}t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&L(t,e)}function L(t,e){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},L(t,e)}var T=function(){var t={completed:0,rejected:0,pending:0,total:0,errors:"",promises:[]};return new(function(e){function r(){var e;return j(this,r),(e=S(this,r)).queue=[],e.inProgress=!1,e._timer=null,e._stats=b({},t),e}return E(r,e),P(r,[{key:"add",value:function(t){var e=this;if(!(t instanceof Promise||Array.isArray(t)&&t.length>0&&t.every((function(t){return t instanceof Promise})))){if(!y(t,"function")){return console.error("---\x3e Invalid promise added to the Queue:",t.toString()),this.emit("fail",t.toString())}t=new Promise(function(){var e,r=(e=d().mark((function e(r){var n;return d().wrap((function(e){for(;;){switch(e.prev=e.next){case 0:return e.next=2,t();case 2:return n=e.sent,e.abrupt("return",r(n));case 4:case"end":return e.stop()}}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(t){m(i,n,o,u,a,"next",t)}function a(t){m(i,n,o,u,a,"throw",t)}u(void 0)}))});return function(t){return r.apply(this,arguments)}}())}f(t).forEach((function(t){e._stats.total++,e._stats.pending++,e.queue.push({promiseFunction:t,response:null,status:"pending",error:null})})),this.inProgress||this._next(),this._setTimer()}},{key:"clear",value:function(){return this._timer&&clearInterval(this._timer),this._timer=null,this.queue=[],this.inProgress=!1,this._stats=b({},t),this}},{key:"_setTimer",value:function(){var t=this;this._timer&&clearInterval(this._timer),this._timer=setInterval((function(){"done"===t.status()&&(clearInterval(t._timer),t._timer=null,t.emit("completed",t._stats),t.emit("done",t._stats))}),10)}},{key:"_next",value:function(){var t=this;0!==this.queue.length?(this.inProgress=!0,this.queue[0].promiseFunction.then((function(e){t.queue[0].status="fulfilled",t.queue[0].response=e,t._stats.completed++})).catch((function(e){t._stats.errors+=e+"\n",t.queue[0].status="rejected",t._stats.rejected++})).finally((function(){t._stats.promises.push(t.queue[0]),t._stats.pending--,t.queue.shift(),t._next()}))):this.inProgress=!1}},{key:"stats",value:function(){return this._stats}},{key:"status",value:function(){return 0===this.queue.length?"done":"in-progress"}}])}(a))},A=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof t&&"object"!==v(t)){throw new Error("doPoll: The first argument must be a function or Promise.")}var r,n,o,i,u=function(t){return t instanceof Promise},a=e.msg,c=e.interval,s=void 0===c?200:c,l=e.timeout,f=void 0===l?1e3:l,h=e.timeoutMsg,p=void 0===h?null!=a?a:"===> doPoll: cancelled or timed out.":h,d=!1,m=!1,g=function(){if(w(),y(p,"string")){return console.info(p),void i(p)}i()},b=function(t){w(),o(t)};function w(){d=!0,clearTimeout(r),clearInterval(n)}var j=new Promise((function(e,a){o=e,i=a;var c=function(){if(!d&&!m){var e=u(t)?t:t();u(e)?(m=!0,e.then((function(t){m=!1,t&&b(t)})).catch(i)):(Boolean(e)||e)&&b(e)}};n=setInterval(c,s),c(),r=setTimeout((function(){d||g()}),f)}));return j.catch((function(){g()})),{promise:j,stop:g}},I=function(){var t="not-started",e={},r=[],n={completed:0,rejected:0,pending:0,total:0,errors:""};return new(function(o){function i(){var t;j(this,i);var e=t=S(this,i);return t._currentPoll=null,setTimeout((function(){e._poll()}),100),t}return E(i,o),P(i,[{key:"_poll",value:function(){var t=this;return this._currentPoll&&this._currentPoll.stop(),this._currentPoll=A((function(){if(t.isDone()){return!0}}),{timeoutMsg:""}),this._currentPoll}},{key:"clear",value:function(){t="not-started",n={completed:0,rejected:0,pending:0,total:0,errors:""},r.length=0,Object.keys(e).forEach((function(t){e[t].rejecter("Promise pool cleared."),delete e[t]})),this._currentPoll=this._poll()}},{key:"add",value:function(o){var i=this;o?(t="in-progress",f(o).forEach((function(t){if(!(t instanceof Promise)){if("function"!=typeof t){return console.info("---\x3e Invalid promise added to the pool."),void r.push(t.toString())}t=N((function(){return t()}))}n.total++;var o=p();e[o]={status:"in-progress",response:null,error:null,resolver:null,rejecter:null},new Promise((function(n,u){e[o].resolver=function(t){"rejected"!==e[o].status&&(e[o].status="completed",e[o].response=t,i._updateStatus(),n(t))},e[o].rejecter=function(t){e[o].status="rejected",e[o].error=t,r.push(t),i._updateStatus(),u()},t.then((function(t){var r;null===(r=e[o])||void 0===r||r.resolver(t)})).catch((function(t){var r;null===(r=e[o])||void 0===r||r.rejecter(t)}))})).catch((function(t){var r;null===(r=e[o])||void 0===r||r.rejecter(t)}))}))):i._updateStatus()}},{key:"status",value:function(){return this._updateStatus(),t}},{key:"isDone",value:function(){return this._updateStatus(),"done"===t}},{key:"isEmpty",value:function(){return 0===n.total}},{key:"results",value:function(){return this._updateStatus(),n}},{key:"stats",value:function(){return this.results()}},{key:"_updateStatus",value:function(){if("done"!==t){var o=Object.values(e);n={completed:o.filter((function(t){return"completed"===t.status})).length,rejected:o.filter((function(t){return"rejected"===t.status})).length,pending:o.filter((function(t){return"in-progress"===t.status})).length,total:o.length,errors:r.join("\n"),promises:e},this.emit("stats",n);var i=o.every((function(t){return"completed"===t.status||"rejected"===t.status}));"done"==(t=i||0===n.total?"done":"in-progress")&&(this.emit("done",n),n.total>0&&(this.emit("completed",n),this.emit("rejected",r,n)))}}}])}(a))},C={};function q(t,e,r){for(var n=arguments.length,o=new Array(n>3?n-3:0),i=3;i<n;i++){o[i-3]=arguments[i]}var u,a;if("string"==typeof t&&"number"==typeof e){u=t,a=e}else if("number"==typeof t&&"function"==typeof e){a=t,r=e}else{if(e||"string"!=typeof t){throw new Error("Invalid parameters")}u=t}var c=u?"_doTimeout_"+u:null;function s(){c&&c in C&&delete C[c]}if(c&&c in C&&(clearTimeout(C[c]),delete C[c]),"function"==typeof r&&"number"==typeof a){return function t(){C[c]=setTimeout((function(){!0===r.apply(void 0,o)?t():s()}),a)}(),!0}u&&void 0===a&&s()}function N(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++){r[n-1]=arguments[n]}return new Promise((function(e,n){try{Promise.resolve(t.apply(void 0,r)).then((function(t){return e(t)})).catch((function(t){return n(t)}))}catch(t){n(t)}}))}return e})(),"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("promises",[],e):"object"==typeof exports?exports.promises=e():t.promises=e(); |
{ | ||
"name": "@knighttower/utility", | ||
"version": "7.21.0", | ||
"version": "7.22.0", | ||
"main": "index.cjs", | ||
@@ -5,0 +5,0 @@ "module": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
523998
8984