UNPKG

@onesy/zip

Version:
7 lines (6 loc) 49.3 kB
/** @license Zip v1.0.0 * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Zip=t()}(this,(function(){"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var t="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}var a={exports:{}};!function(e,r){Object.defineProperty(r,"__esModule",{value:!0});const n={},a="undefined"!=typeof window&&void 0!==window.document,s=!(void 0===t||!e.exports);r.default=function e(t,r,i={}){var o;const u=Object.assign(Object.assign({},n),i),{variant:l}=u,c=r&&"object"==typeof r&&Object.getPrototypeOf(r);switch(t){case"string":return"string"==typeof r;case"number":return"number"==typeof r&&!Number.isNaN(r);case"boolean":return"boolean"==typeof r;case"array":return Array.isArray(r);case"object":return"object"==typeof r&&!!r&&r.constructor===Object;case"object-like":return"object"==typeof r&&(null===r||r.constructor!==Object);case"class":return("object"==typeof r||"function"==typeof r)&&(/class/gi.test(String(r))||/class/gi.test(String(null==r?void 0:r.constructor)));case"function":return!!(r&&r instanceof Function);case"async":return!(!e("function",r)||!(a?"AsyncFunction"===r.constructor.name:r()instanceof Promise));case"map":return!(c!==Map.prototype);case"weakmap":return!(c!==WeakMap.prototype);case"set":return!(c!==Set.prototype);case"weakset":return!(c!==WeakSet.prototype);case"promise":return!(c!==Promise.prototype);case"int8array":return!(c!==Int8Array.prototype);case"uint8array":return!(c!==Uint8Array.prototype);case"uint8clampedarray":return!(c!==Uint8ClampedArray.prototype);case"int16array":return!(c!==Int16Array.prototype);case"uint16array":return!(c!==Uint16Array.prototype);case"int32array":return!(c!==Int32Array.prototype);case"uint32array":return!(c!==Uint32Array.prototype);case"float32array":return!(c!==Float32Array.prototype);case"float64array":return!(c!==Float64Array.prototype);case"bigint64array":return!(c!==BigInt64Array.prototype);case"biguint64array":return!(c!==BigUint64Array.prototype);case"typedarray":return e("int8array",r)||e("uint8array",r)||e("uint8clampedarray",r)||e("int16array",r)||e("uint16array",r)||e("int32array",r)||e("uint32array",r)||e("float32array",r)||e("float64array",r)||e("bigint64array",r)||e("biguint64array",r);case"dataview":return!(c!==DataView.prototype);case"arraybuffer":return!(c!==ArrayBuffer.prototype);case"sharedarraybuffer":return"undefined"!=typeof SharedArrayBuffer&&!(c!==SharedArrayBuffer.prototype);case"symbol":return!("symbol"!=typeof r);case"error":return!!(r&&r instanceof Error);case"date":return!!(r&&r instanceof Date);case"regexp":return!!(r&&r instanceof RegExp);case"arguments":return!(!r||"[object Arguments]"!==r.toString());case"null":return null===r;case"undefined":return void 0===r;case"blob":return a&&r instanceof Blob;case"buffer":return!(!s||"function"!=typeof(null===(o=null==r?void 0:r.constructor)||void 0===o?void 0:o.isBuffer)||!r.constructor.isBuffer(r));case"element":if(r)switch(l){case void 0:case"html":case"element":return a&&("object"==typeof HTMLElement?r instanceof HTMLElement:r&&"object"==typeof r&&null!==r&&1===r.nodeType&&"string"==typeof r.nodeName);case"node":return a&&("object"==typeof Node?r instanceof Node:r&&"object"==typeof r&&null!==r&&"number"==typeof r.nodeType&&"string"==typeof r.nodeName);case"react":return r.elementType||r.hasOwnProperty("$$typeof");default:return!1}return!1;case"simple":return e("string",r,u)||e("number",r,u)||e("boolean",r,u)||e("undefined",r,u)||e("null",r,u);case"not-array-object":return!e("array",r,u)&&!e("object",r,u);default:return!1}}}(a,a.exports);var s,i=r(a.exports),o={},u={},l=new Uint8Array(16);function c(){if(!s&&!(s="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return s(l)}var d=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function f(e){return"string"==typeof e&&d.test(e)}for(var h,p,v=[],g=0;g<256;++g)v.push((g+256).toString(16).substr(1));function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(v[e[t+0]]+v[e[t+1]]+v[e[t+2]]+v[e[t+3]]+"-"+v[e[t+4]]+v[e[t+5]]+"-"+v[e[t+6]]+v[e[t+7]]+"-"+v[e[t+8]]+v[e[t+9]]+"-"+v[e[t+10]]+v[e[t+11]]+v[e[t+12]]+v[e[t+13]]+v[e[t+14]]+v[e[t+15]]).toLowerCase();if(!f(r))throw TypeError("Stringified UUID is invalid");return r}var b=0,m=0;function _(e){if(!f(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r}function w(e,t,r){function n(e,n,a,s){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}(e)),"string"==typeof n&&(n=_(n)),16!==n.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var i=new Uint8Array(16+e.length);if(i.set(n),i.set(e,n.length),(i=r(i))[6]=15&i[6]|t,i[8]=63&i[8]|128,a){s=s||0;for(var o=0;o<16;++o)a[s+o]=i[o];return a}return y(i)}try{n.name=e}catch(e){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function j(e){return 14+(e+64>>>9<<4)+1}function O(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function A(e,t,r,n,a,s){return O((i=O(O(t,e),O(n,s)))<<(o=a)|i>>>32-o,r);var i,o}function z(e,t,r,n,a,s,i){return A(t&r|~t&n,e,t,a,s,i)}function M(e,t,r,n,a,s,i){return A(t&n|r&~n,e,t,a,s,i)}function x(e,t,r,n,a,s,i){return A(t^r^n,e,t,a,s,i)}function T(e,t,r,n,a,s,i){return A(r^(t|~n),e,t,a,s,i)}var S=w("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var r=0;r<t.length;++r)e[r]=t.charCodeAt(r)}return function(e){for(var t=[],r=32*e.length,n="0123456789abcdef",a=0;a<r;a+=8){var s=e[a>>5]>>>a%32&255,i=parseInt(n.charAt(s>>>4&15)+n.charAt(15&s),16);t.push(i)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[j(t)-1]=t;for(var r=1732584193,n=-271733879,a=-1732584194,s=271733878,i=0;i<e.length;i+=16){var o=r,u=n,l=a,c=s;r=z(r,n,a,s,e[i],7,-680876936),s=z(s,r,n,a,e[i+1],12,-389564586),a=z(a,s,r,n,e[i+2],17,606105819),n=z(n,a,s,r,e[i+3],22,-1044525330),r=z(r,n,a,s,e[i+4],7,-176418897),s=z(s,r,n,a,e[i+5],12,1200080426),a=z(a,s,r,n,e[i+6],17,-1473231341),n=z(n,a,s,r,e[i+7],22,-45705983),r=z(r,n,a,s,e[i+8],7,1770035416),s=z(s,r,n,a,e[i+9],12,-1958414417),a=z(a,s,r,n,e[i+10],17,-42063),n=z(n,a,s,r,e[i+11],22,-1990404162),r=z(r,n,a,s,e[i+12],7,1804603682),s=z(s,r,n,a,e[i+13],12,-40341101),a=z(a,s,r,n,e[i+14],17,-1502002290),r=M(r,n=z(n,a,s,r,e[i+15],22,1236535329),a,s,e[i+1],5,-165796510),s=M(s,r,n,a,e[i+6],9,-1069501632),a=M(a,s,r,n,e[i+11],14,643717713),n=M(n,a,s,r,e[i],20,-373897302),r=M(r,n,a,s,e[i+5],5,-701558691),s=M(s,r,n,a,e[i+10],9,38016083),a=M(a,s,r,n,e[i+15],14,-660478335),n=M(n,a,s,r,e[i+4],20,-405537848),r=M(r,n,a,s,e[i+9],5,568446438),s=M(s,r,n,a,e[i+14],9,-1019803690),a=M(a,s,r,n,e[i+3],14,-187363961),n=M(n,a,s,r,e[i+8],20,1163531501),r=M(r,n,a,s,e[i+13],5,-1444681467),s=M(s,r,n,a,e[i+2],9,-51403784),a=M(a,s,r,n,e[i+7],14,1735328473),r=x(r,n=M(n,a,s,r,e[i+12],20,-1926607734),a,s,e[i+5],4,-378558),s=x(s,r,n,a,e[i+8],11,-2022574463),a=x(a,s,r,n,e[i+11],16,1839030562),n=x(n,a,s,r,e[i+14],23,-35309556),r=x(r,n,a,s,e[i+1],4,-1530992060),s=x(s,r,n,a,e[i+4],11,1272893353),a=x(a,s,r,n,e[i+7],16,-155497632),n=x(n,a,s,r,e[i+10],23,-1094730640),r=x(r,n,a,s,e[i+13],4,681279174),s=x(s,r,n,a,e[i],11,-358537222),a=x(a,s,r,n,e[i+3],16,-722521979),n=x(n,a,s,r,e[i+6],23,76029189),r=x(r,n,a,s,e[i+9],4,-640364487),s=x(s,r,n,a,e[i+12],11,-421815835),a=x(a,s,r,n,e[i+15],16,530742520),r=T(r,n=x(n,a,s,r,e[i+2],23,-995338651),a,s,e[i],6,-198630844),s=T(s,r,n,a,e[i+7],10,1126891415),a=T(a,s,r,n,e[i+14],15,-1416354905),n=T(n,a,s,r,e[i+5],21,-57434055),r=T(r,n,a,s,e[i+12],6,1700485571),s=T(s,r,n,a,e[i+3],10,-1894986606),a=T(a,s,r,n,e[i+10],15,-1051523),n=T(n,a,s,r,e[i+1],21,-2054922799),r=T(r,n,a,s,e[i+8],6,1873313359),s=T(s,r,n,a,e[i+15],10,-30611744),a=T(a,s,r,n,e[i+6],15,-1560198380),n=T(n,a,s,r,e[i+13],21,1309151649),r=T(r,n,a,s,e[i+4],6,-145523070),s=T(s,r,n,a,e[i+11],10,-1120210379),a=T(a,s,r,n,e[i+2],15,718787259),n=T(n,a,s,r,e[i+9],21,-343485551),r=O(r,o),n=O(n,u),a=O(a,l),s=O(s,c)}return[r,n,a,s]}(function(e){if(0===e.length)return[];for(var t=8*e.length,r=new Uint32Array(j(t)),n=0;n<t;n+=8)r[n>>5]|=(255&e[n/8])<<n%32;return r}(e),8*e.length))})),E=S;function k(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function N(e,t){return e<<t|e>>>32-t}var U=w("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var a=0;a<n.length;++a)e.push(n.charCodeAt(a))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var s=e.length/4+2,i=Math.ceil(s/16),o=new Array(i),u=0;u<i;++u){for(var l=new Uint32Array(16),c=0;c<16;++c)l[c]=e[64*u+4*c]<<24|e[64*u+4*c+1]<<16|e[64*u+4*c+2]<<8|e[64*u+4*c+3];o[u]=l}o[i-1][14]=8*(e.length-1)/Math.pow(2,32),o[i-1][14]=Math.floor(o[i-1][14]),o[i-1][15]=8*(e.length-1)&4294967295;for(var d=0;d<i;++d){for(var f=new Uint32Array(80),h=0;h<16;++h)f[h]=o[d][h];for(var p=16;p<80;++p)f[p]=N(f[p-3]^f[p-8]^f[p-14]^f[p-16],1);for(var v=r[0],g=r[1],y=r[2],b=r[3],m=r[4],_=0;_<80;++_){var w=Math.floor(_/20),j=N(v,5)+k(w,g,y,b)+m+t[w]+f[_]>>>0;m=b,b=y,y=N(g,30)>>>0,g=v,v=j}r[0]=r[0]+v>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+y>>>0,r[3]=r[3]+b>>>0,r[4]=r[4]+m>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]})),D=U;var B=Object.freeze({__proto__:null,v1:function(e,t,r){var n=t&&r||0,a=t||new Array(16),s=(e=e||{}).node||h,i=void 0!==e.clockseq?e.clockseq:p;if(null==s||null==i){var o=e.random||(e.rng||c)();null==s&&(s=h=[1|o[0],o[1],o[2],o[3],o[4],o[5]]),null==i&&(i=p=16383&(o[6]<<8|o[7]))}var u=void 0!==e.msecs?e.msecs:Date.now(),l=void 0!==e.nsecs?e.nsecs:m+1,d=u-b+(l-m)/1e4;if(d<0&&void 0===e.clockseq&&(i=i+1&16383),(d<0||u>b)&&void 0===e.nsecs&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");b=u,m=l,p=i;var f=(1e4*(268435455&(u+=122192928e5))+l)%4294967296;a[n++]=f>>>24&255,a[n++]=f>>>16&255,a[n++]=f>>>8&255,a[n++]=255&f;var v=u/4294967296*1e4&268435455;a[n++]=v>>>8&255,a[n++]=255&v,a[n++]=v>>>24&15|16,a[n++]=v>>>16&255,a[n++]=i>>>8|128,a[n++]=255&i;for(var g=0;g<6;++g)a[n+g]=s[g];return t||y(a)},v3:E,v4:function(e,t,r){var n=(e=e||{}).random||(e.rng||c)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var a=0;a<16;++a)t[r+a]=n[a];return t}return y(n)},v5:D,NIL:"00000000-0000-0000-0000-000000000000",version:function(e){if(!f(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)},validate:f,stringify:y,parse:_}),C=n(B),I={},P=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(I,"__esModule",{value:!0});const F=P(a.exports);var $=I.default=function e(t,r){let n;switch(t){case"browser":return"undefined"!=typeof window&&void 0!==window.document;case"worker":return"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;case"nodejs":return new Function("try {return this===global;}catch(e){return false;}")();case"localhost":return n=void 0!==r?r:e("browser")&&window.location.hostname,(0,F.default)("string",n)&&["localhost","127.0.0.1"].some((e=>n.indexOf(e)>-1));default:return!1}},W={};Object.defineProperty(W,"__esModule",{value:!0});const R=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),V=(e,t)=>{if(e===t)return!0;if(Number.isNaN(e)&&Number.isNaN(t))return!0;if(!(typeof e==typeof t||R(e)&&R(t)))return!1;if(Array.isArray(e)&&e.length===t.length)return e.every(((e,r)=>V(e,t[r])));if(R(e)){const r=Object.assign({},e),n=Object.assign({},t);return Object.keys(r).every((e=>V(r[e],n[e])))}return!1};W.default=V;var Z=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(u,"__esModule",{value:!0});const L=C,q=Z(a.exports),J=Z(I),H=Z(W),G={};u.default=function e(t,r,n={}){var a;const s=Object.assign(Object.assign({},G),n);let i,o,u,l,c,d;switch(t){case"date":return e("timestamp",new Date(r).getTime());case"unix":return Number.isInteger(r)&&10===String(r).length&&new Date(1e3*r).getTime()>0;case"timestamp":return Number.isInteger(r)&&String(r).length>=10&&(new Date(r).getTime()>0||new Date(1e3*r).getTime()>0);case"uuid":return(0,L.validate)(r);case"binary-string":return d=["0","1"],(0,q.default)("string",r)&&[...r].every((e=>d.indexOf(e)>-1));case"hexadecimal-string":return d=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],(0,q.default)("string",r)&&[...r].every((e=>d.indexOf(e)>-1));case"url":return c=/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/,c.test(r);case"url-path":return c=/^\/([^\/][A-Za-z0-9\-._~!$&'()*+,;=:@\/?#%]*)?$/,c.test(r);case"domain-name":c=/^[a-z0-9\-]+$/;const t=r.replace(/--/g,"-"),n=null==r?void 0:r.length;return c.test(r)&&!r.startsWith("-")&&!r.endsWith("-")&&t.length===r.length&&n>1&&n<254;case"compare":return({valueA:i,valueB:o,operator:u}=s),l={"less-than":i<o,"less-than-equal":i<=o,equal:(0,H.default)(i,o),"not-equal":!(0,H.default)(i,o),"greater-than-equal":i>=o,"greater-than":i>o,"array-all":(0,q.default)("array",i)&&(0,q.default)("array",o)&&i.every(((e,t)=>(0,H.default)(i[t],o[t]))),"array-some":(0,q.default)("array",i)&&(0,q.default)("array",o)&&i.some(((e,t)=>(0,H.default)(i[t],o[t]))),"starts-with":(0,q.default)("string",i)&&0===i.indexOf(o),contains:(0,q.default)("string",i)&&i.indexOf(o)>-1},l[u];case"semver":return c=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,c.test(r);case"semver-compare":return({valueA:i,valueB:o,operator:u}=s),e("semver",i)&&e("semver",o)?(i=(i.match(/\d+(\.|\-|\+){0,1}/g)||[]).map((e=>e.replace(/[,\-\+\.]/g,""))),o=(o.match(/\d+(\.|\-|\+){0,1}/g)||[]).map((e=>e.replace(/[,\-\+\.]/g,""))),l={"less-than":!1,"less-than-equal":!1,equal:i.every(((e,t)=>e===o[t])),"greater-than-equal":!1,"greater-than":!1},i.forEach(((e,t)=>{l["less-than"]||(l["less-than"]=e<o[t])})),i.forEach(((e,t)=>{l["greater-than"]||(l["greater-than"]=e>o[t])})),l["less-than-equal"]=l["less-than"]||l.equal,l["greater-than-equal"]=l["greater-than"]||l.equal,l[u]):!1;case"mobile":return c=/^(\+\d{1,2}\s?)?1?-?\.?\s?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/,c.test(r)&&!Number.isInteger(r);case"email":return c=/\S+@\S+\.\S+/,c.test(r);case"password":const f=[];if(!(0,q.default)("string",r))return!1;const h=void 0!==s.min?s.min:7,p=void 0!==s.max?s.max:440;return r.length>=h&&r.length<=p&&f.push("length"),r.match(/[a-z]+/)&&f.push("lowercase"),r.match(/[A-Z]+/)&&f.push("uppercase"),r.match(/[0-9]+/)&&f.push("number"),"value"===s.variant?f:f.length>=4;case"hash":return c=/^(0x)?[a-f0-9]{64}$/gi,(0,q.default)("string",r)&&c.test(r);case"color":return e("color-rgb",r,s)||e("color-hex",r,s)||e("color-hsl",r,s);case"color-rgb":return c=/rgb(a)?\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]))(\.\d+)?,\s*(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]))(\.\d+)?,\s*(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]))(\.\d+)?(,\s*(?:0(?:\.[0-9]{1,2})?|1(?:\.00?)?))?\)/,c.test(r);case"color-hex":return c=/^#((?:[0-9a-fA-F]){3}|(?:[0-9a-fA-F]){6}|(?:[0-9a-fA-F]){8})$/,c.test(r);case"color-hsl":return c=/hsl(a)?\((0|[1-9][0-9]?|[12][0-9][0-9]|3[0-5][0-9])(\.\d+)?,\s*([0-9]|[1-9][0-9]|100)(\.\d+)?%,\s*([0-9]|[1-9][0-9]|100)(\.\d+)?%(,\s*(?:0(?:\.[0-9]{1,2})?|1(?:\.00?)?))?\)/,c.test(r);case"json":try{d=JSON.parse(r)}catch(e){return!1}return(0,q.default)("object",d,s)||(0,q.default)("array",d,s);case"min":return r>=s.min;case"max":return r<=s.max;case"min-max":return e("min",r,s)&&e("max",r,s);case"same-origin":try{d=new URL(r)}catch(e){}return(0,J.default)("browser")&&(e("url-path",r,s)||window.location.hostname===(null===(a=d)||void 0===a?void 0:a.hostname));case"js-chunk":return(0,q.default)("object",r,s)&&!!r.__esModule&&(r.default instanceof Function||r.default instanceof Object);case"http-method":const v=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"];return(0,q.default)("string",r,s)&&v.indexOf(r.toUpperCase())>-1;case"base64":return d="string"==typeof r?r.trim():r,(0,q.default)("string",d,s)&&d.length>=1&&/^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}(==)?|[A-Za-z0-9+\\/]{3}=?)?$/gi.test(d);case"datauri":return d="string"==typeof r?r.trim():r,(0,q.default)("string",d,s)&&/^data:\w+\/[-+.\w]+;base64,(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}(==)?|[A-Za-z0-9+\\/]{3}=?)?$/gi.test(d)||/^data:(\w+\/[-+.\w]+)?(;charset=[\w-]+)?,(.*)?/gi.test(d);case"pascal-case":return c=/^[A-Z][a-z]+(?:[A-Z][a-z]+)*$/,c.test(r);case"camel-case":return c=/^[a-z]+(?:[A-Z][a-z]+)*$/,c.test(r);default:return!1}};var Y={};Object.defineProperty(Y,"__esModule",{value:!0});Y.default=(e,t=2,r=(()=>{const e=new WeakSet;return(t,r)=>{if(void 0!==((t,r)=>{if("object"==typeof r&&null!==r){if(e.has(r))return;e.add(r)}return r})(0,r)&&void 0!==r)return r}})())=>{try{return JSON.stringify(e,r,t)}catch(e){}return String(e)};var K={},X=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(K,"__esModule",{value:!0});const Q=X(a.exports),ee={decode:!1,decodeMethod:decodeURIComponent};var te=K.default=(e,t={})=>{const r=Object.assign(Object.assign({},ee),t);let n=e;try{(0,Q.default)("string",e)&&r.decode&&(0,Q.default)("function",r.decodeMethod)&&(n=r.decodeMethod(e))}catch(e){}try{if((0,Q.default)("string",n)){if("undefined"===n)return;return"NaN"===n?NaN:JSON.parse(n)}return n}catch(e){}return n};!function(e){var t=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.sizeFormat=e.blobToDataURI=e.dataUriToBuffer=e.dataUriToBlob=void 0;const r=t(a.exports),n=t(u),s=t(I),i=t(Y),o=t(K);e.dataUriToBlob=(e,t=!1)=>{if((0,n.default)("datauri",e)||(0,n.default)("base64",e))try{const r=atob((0,n.default)("datauri",e)?e.split(",")[1]:e),a=(0,n.default)("datauri",e)&&e.split(",")[0].split(":")[1].split(";")[0],s=new ArrayBuffer(2*r.length),i=new Uint16Array(s);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);if(t)return s;return new Blob([s],{type:a})}catch(e){return}};e.dataUriToBuffer=e=>{if((0,n.default)("datauri",e)||(0,n.default)("base64",e))try{const t=(0,n.default)("datauri",e)?e.split(",")[1]:e;return Buffer.from(t,"base64")}catch(e){return}};e.blobToDataURI=e=>new Promise((t=>{const r=new FileReader;r.onload=e=>t(e.target.result),r.readAsDataURL(e)}));e.sizeFormat=(e,t=2,n=1e3)=>{if(!(0,r.default)("number",e)||e<=0)return"0 Bytes";const a=n,s=t<0?0:t,i=Math.floor(Math.log(e)/Math.log(a));return`${parseFloat((e/Math.pow(a,i)).toFixed(s))} ${["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][i]}`};const l={thousand:1e3,decimals:2,mime:"text/plain"},c=(t,a="arraybuffer",u={})=>{const d=Object.assign(Object.assign({},l),u);let f=t;switch(a){case"string":if((0,r.default)("arraybuffer",f))return String.fromCharCode.apply(null,new Uint16Array(f));if((0,r.default)("buffer",f))return f.toString("utf-8");if((0,n.default)("base64",f)){if((0,s.default)("browser"))return atob(f);if((0,s.default)("nodejs"))return Buffer.from(f,"base64").toString("binary")}if((0,n.default)("datauri",f)){if((0,s.default)("browser"))return atob(f.split(",")[1]);if((0,s.default)("nodejs"))return Buffer.from(f.split(",")[1],"base64").toString("binary")}return(0,r.default)("string",f)?f:(0,i.default)(f);case"arraybuffer":if((0,n.default)("base64",f)){if((0,s.default)("browser"))return(0,e.dataUriToBlob)(f,!0);if((0,s.default)("nodejs"))return c(Buffer.from(f,"base64"),"arraybuffer",d)}if((0,n.default)("datauri",f)){if((0,s.default)("browser"))return(0,e.dataUriToBlob)(f,!0);if((0,s.default)("nodejs"))return c(f.split(",")[1],"arraybuffer",d)}if((0,r.default)("string",f)){const e=new ArrayBuffer(2*f.length),t=new Uint16Array(e);for(let e=0;e<f.length;e++)t[e]=f.charCodeAt(e);return e}if((0,r.default)("buffer",f)){const e=new ArrayBuffer(2*f.length),t=new Uint16Array(e);for(let e=0;e<f.length;e++)t[e]=f[e];return e}return(0,r.default)("arraybuffer",f)?f:void 0;case"base64":return(0,n.default)("base64",f)?f:(0,r.default)("string",f)?((0,s.default)("browser")&&(f=btoa(f)),(0,s.default)("nodejs")&&(f=Buffer.from(f,"binary").toString("base64")),f):void 0;case"datauri":if((0,n.default)("datauri",f))return f;if((0,r.default)("string",f)){let e;return(0,s.default)("browser")&&(e=btoa(f)),(0,s.default)("nodejs")&&(e=Buffer.from(f,"binary").toString("base64")),`data:${d.mime};base64,${e}`}return;case"blob":if((0,s.default)("browser")){if((0,n.default)("base64",f))return(0,e.dataUriToBlob)(f);if((0,n.default)("datauri",f))return(0,e.dataUriToBlob)(f);if((0,r.default)("string",f))return new Blob([f],{type:"text/plain"});if((0,r.default)("blob",f))return f}return;case"buffer":return(0,s.default)("nodejs")?(0,n.default)("base64",f)||(0,n.default)("datauri",f)?(0,e.dataUriToBuffer)(f):(0,r.default)("string",f)?Buffer.from(f,"utf-8"):(0,r.default)("buffer",f)?f:Buffer.from((0,i.default)(f),"utf-8"):void 0;case"byte-size":return(0,r.default)("string",f)?(new TextEncoder).encode(f).byteLength:(0,r.default)("typedarray",f)||(0,r.default)("buffer",f)?f.byteLength:void 0;case"size-format":return(0,r.default)("string",f)||(0,r.default)("number",f)?(0,e.sizeFormat)((0,o.default)(f),d.decimals,d.thousand):void 0;case"size":return(0,r.default)("string",f)?(0,e.sizeFormat)((0,o.default)((new TextEncoder).encode(f).byteLength),d.decimals,d.thousand):void 0;default:return}};e.default=c}(o);var re=r(o),ne={},ae={};Object.defineProperty(ae,"__esModule",{value:!0});ae.default=()=>"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:void 0;var se={},ie={},oe={},ue=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(oe,"__esModule",{value:!0});const le=ue(a.exports);oe.default=e=>(0,le.default)("string",e)?`${e.charAt(0).toUpperCase()}${e.slice(1)}`:e,function(e){var t=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.optionsDefault=void 0;const r=t(a.exports),n=t(oe);e.optionsDefault={filters:[",",".","-","_","s+"],replaceWith:" ",trim:!0};e.default=(t,a={})=>{try{const s=Object.assign(Object.assign({},e.optionsDefault),a);if(s.className&&(s.replaceWith="-",s.cammelCaseTransform=!0,s.lowercase=!0),(0,r.default)("string",t)){let e=t;if(s.url){const t=e.split("?").filter(Boolean);let r=t[0];const n=t[1];return"/"===r.slice(-1)&&(r=r.slice(0,-1)),e=n?[r,n].join("?"):r,e}return s.cammelCaseTransform&&(e=e.split(/(?=[A-Z])/g).join(s.replaceWith||" ")),s.filters.forEach((t=>{const r=new RegExp(`\\${t}`,"g");e=e.replace(r,s.replaceWith||" ")})),s.trim&&(e=e.trim()),s.capitalize&&(e=(0,n.default)(e)),s.lowercase&&(e=e.toLocaleLowerCase()),e}return t}catch(e){}return t}}(ie);var ce=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(se,"__esModule",{value:!0});const de=ce(a.exports),fe=ce(ie),he=ce(K),pe={valueOverride:!1},ve=(e,t="",r,n={})=>{const a=Object.assign(Object.assign({},pe),n);if(!e&&!t)return e;if((0,de.default)("string",t)){const n=t.split(".").filter(Boolean).map((e=>(0,he.default)(e)));return ve(e,n,r,a)}if((0,de.default)("array",t)){const n=t[0],s=(0,fe.default)(String(n),{filters:[".",","],replaceWith:""});if(1!==t.length){((0,de.default)("array",e)&&(0,de.default)("number",n)||(0,de.default)("object",e))&&((null==e?void 0:e.hasOwnProperty(n))&&!a.valueOverride||(e[s]=(0,de.default)("number",t[1])?[]:{}));const i=e[s];return(0,de.default)("object",i)||(0,de.default)("array",i)?ve(e[n],t.slice(1),r,a):e}((0,de.default)("array",e)&&(0,de.default)("number",n)||(0,de.default)("object",e))&&((null==e?void 0:e.hasOwnProperty(n))&&!a.valueOverride||(e[s]=(0,de.default)("number",t[1])?[]:{}),e[(0,de.default)("string",n)?s:n]=r)}return e};se.default=ve;var ge=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ne,"__esModule",{value:!0});const ye=ge(ae),be=ge(se),me={returnSame:!0};var _e=ne.default=(e,t="JSON",r={})=>{var n,a,s,i;const o=Object.assign(Object.assign({},me),r);if("JSON"===t)try{return JSON.parse(e)}catch(e){if(o.log){console.error("Parse JSON: ",e);const t=(0,ye.default)();"test"===(null===(n=t.AMAUI)||void 0===n?void 0:n.env)&&((null===(i=null===(s=null===(a=t.AMAUI)||void 0===a?void 0:a.test)||void 0===s?void 0:s.parse)||void 0===i?void 0:i.logs)||(0,be.default)(t,"AMAUI.test.parse.logs",[]),t.AMAUI.test.parse.logs.push(e))}}if(o.returnSame)return e},we={},je=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(we,"__esModule",{value:!0});const Oe=je(a.exports),Ae=(e,t)=>{let r=t(e);if(void 0===r)return"";try{(0,Oe.default)("object-like",r)&&(0,Oe.default)("not-array-object",r)&&null!==r&&(r=Object.assign({},r))}catch(e){}return(0,Oe.default)("object",r)?`{${Object.keys(r).sort().map((e=>`"${e}":${Ae(r[e],t)}`)).filter((e=>":"!==e.slice(-1))).join(",")}}`:(0,Oe.default)("array",r)?`[${r.map((e=>Ae(e,t))).filter(Boolean).join(",")}]`:(0,Oe.default)("string",r)?`"${r}"`:(e=>(0,Oe.default)("string",e)?e.replace(/(\s|\r|\n)+/," "):e)(JSON.stringify((e=>void 0===e?"undefined":e instanceof Function||e instanceof Object?e.toString():e)(r)))};var ze=we.default=e=>{const t=new WeakSet;return Ae(e,(e=>{if("object"==typeof e&&null!==e){if(t.has(e))return;t.add(e)}return e}))},Me={},xe={},Te={};Object.defineProperty(Te,"__esModule",{value:!0});const Se=e=>Array.isArray(e),Ee=e=>"object"==typeof e&&!!e&&e.constructor===Object,ke=(e,t)=>{const r=t||new WeakSet;if(r.has(e))return e;if((Ee(e)||Se(e))&&r.add(e),Se(e))return e.map((e=>ke(e,r)));if(Ee(e)){const t={};return Object.keys(e).forEach((n=>t[n]=ke(e[n],r))),t}return e};var Ne=Te.default=ke,Ue=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xe,"__esModule",{value:!0});const De=Ue(a.exports),Be=Ue(Te),Ce={copy:!1,merge:{array:!1}},Ie=(e,t,r={})=>{const n=Object.assign(Object.assign({},Ce),r);if(n.merge.array&&(0,De.default)("array",e)&&(0,De.default)("array",t)){const r=Math.max(e.length,t.length);for(let a=0;a<r;a++)void 0===e[a]&&(e[a]=t[a]),((0,De.default)("object",e[a])&&(0,De.default)("object",t[a])||(0,De.default)("array",e[a])&&(0,De.default)("array",t[a]))&&(e[a]=Ie(e[a],t[a],n))}return(0,De.default)("object",e)&&(0,De.default)("object",t)&&Object.keys(t).forEach((r=>{e.hasOwnProperty(r)?(0,De.default)("object",e[r])&&(0,De.default)("object",t[r])&&(e[r]=Ie(e[r],t[r],n)):e[r]=n.copy?(0,Be.default)(t[r]):t[r]})),e};var Pe=xe.default=Ie;!function(e){var t=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.daysWeekAbr=e.daysWeek=e.monthsAbr=e.months=e.units=void 0;const r=t(xe),n={};e.units=["millisecond","milliseconds","second","minute","minutes","hour","hours","day","days","dayWeek","dayYear","week","weeks","month","months","year"],e.months=["January","February","March","April","May","June","July","August","September","October","November","December"],e.monthsAbr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],e.daysWeek=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],e.daysWeekAbr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];class a{constructor(e=new Date,t={}){this.value_=e,this.options=t,this.init()}static get utc(){return new a(new Date,{utc:!0})}static get daysInMonth(){return(new a).daysInMonth}static get valueOf(){return(new a).valueOf}static get unix(){return(new a).unix}static get milliseconds(){return(new a).milliseconds}static get iso(){return(new a).iso}static get onesyDate(){return new a}static get local(){return(new a).local}init(){this.options=(0,r.default)(this.options,n),this.value=new Date(this.value_.valid?this.value_.value:this.value_),this.valid&&(this.millisecond=this.value[this.options.utc?"getUTCMilliseconds":"getMilliseconds"](),this.milliseconds=this.value.getTime(),this.second=this.value[this.options.utc?"getUTCSeconds":"getSeconds"](),this.minute=this.value[this.options.utc?"getUTCMinutes":"getMinutes"](),this.minutes=Math.ceil(this.milliseconds/6e4),this.hour=this.value[this.options.utc?"getUTCHours":"getHours"](),this.hours=Math.ceil(this.milliseconds/36e5),this.day=this.value[this.options.utc?"getUTCDate":"getDate"](),this.days=Math.ceil(this.milliseconds/864e5),this.dayWeek=this.value[this.options.utc?"getUTCDay":"getDay"](),this.weeks=Math.ceil((this.milliseconds/1e3+345600)/604800),this.month=this.value[this.options.utc?"getUTCMonth":"getMonth"]()+1,this.year=this.value[this.options.utc?"getUTCFullYear":"getFullYear"](),this.dayYear=Math.ceil((this.milliseconds-Number(new Date(this.year,0,0)))/1e3/60/60/24),this.months=12*(this.year-1970)-(12-this.month),this.weekValue())}weekValue(){const e=new Date(this.year,0,1);return e.setDate(e.getDate()+(1-e.getDay()%7)),this.week=Math.round((Number(this.value)-Number(e))/6048e5)+1,this.week}get monthsNames(){var t;return(null===(t=this.options.overrides)||void 0===t?void 0:t.months)||e.months}get monthsAbr(){var t;return(null===(t=this.options.overrides)||void 0===t?void 0:t.monthsAbr)||e.monthsAbr}get daysWeek(){var t;return(null===(t=this.options.overrides)||void 0===t?void 0:t.daysWeek)||e.daysWeek}get daysWeekAbr(){var t;return(null===(t=this.options.overrides)||void 0===t?void 0:t.daysWeekAbr)||e.daysWeekAbr}get valid(){var e;return(void 0===this.value_||this.value_ instanceof Date||this.value_ instanceof a||"number"==typeof this.value_)&&!Number.isNaN(Math.ceil((null===(e=this.value)||void 0===e?void 0:e.getTime())/1e3))}get local(){if(this.valid)return new a(new Date(this.value.toLocaleString("en-us")))}get utc(){return new a(this.value,{utc:!0})}get iso(){if(this.valid)return this.value.toISOString()}get daysInMonth(){return new Date(this.year,this.month,0).getDate()}get weeksInYear(){const e=new Date(this.year,0,1),t=1===new Date(this.year,1,29).getMonth();return 4===e.getDay()||t&&3===e.getDay()?53:52}get valueOf(){return this.milliseconds}get unix(){if(this.valid)return Math.floor(this.value.getTime()/1e3)}timezone(e){if(this.valid&&e)return new a(this.value.toLocaleString("en-us",{timeZone:e}))}}e.default=a}(Me);var Fe=r(Me),$e={},We={},Re=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(We,"__esModule",{value:!0});const Ve=Re(a.exports);We.default=(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER)=>(0,Ve.default)("number",e)?e<t?t:e>r?r:e:e;var Ze=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty($e,"__esModule",{value:!0});const Le=Ze(a.exports),qe=Ze(We);var Je=$e.default=function(e,t=!1,r=!1,n=" ",a=["year","month","day","hour","minute","second","millisecond"]){if((0,Le.default)("number",e)){let s="",i=e;const o=[],u={},l={millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,year:31104e6},c={millisecond:"ms",second:"s",minute:"m",hour:"h",day:"d",month:"mo",year:"y"};for(const e of a)if(l[e]){const r=(0,qe.default)(Math.floor(i/l[e]),0);if(r>0){i-=r*l[e],u[e]=r;let n=r;n=t?`${n} ${c[e]}`:`${n} ${e}${r>1?"s":""}`,o.push(n)}}return o.forEach((e=>s+=`${n}${e}`)),r?u:s.trim()}},He={},Ge=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(He,"__esModule",{value:!0});const Ye=Ge(u);var Ke=He.default=e=>{if((0,Ye.default)("binary-string",e)){let t="";const r=e.match(/.{1,4}/g)||[];for(const[e,n]of r.entries()){const a=[...n].reduce(((e,t)=>2*e+parseInt(t,10)),0).toString(16);e===r.length-1?t=n.length<4?1===n.length&&["0","1"].indexOf(a)>-1||+a>1&&+a<=7?"02"+t+a:"1"+String(n.length)+t+n:"00"+t+a:t+=a}return t}},Xe={},Qe=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Xe,"__esModule",{value:!0});const et=Qe(u);var tt=Xe.default=e=>{if((0,et.default)("hexadecimal-string",e)){let t="";const r=e.substring(0,2),n=e.substring(2),a="02"===r,s=0===r.indexOf("1")&&r.split("").map((e=>+e)),i={0:"0000",1:"0001",2:"0010",3:"0011",4:"0100",5:"0101",6:"0110",7:"0111",8:"1000",9:"1001",a:"1010",b:"1011",c:"1100",d:"1101",e:"1110",f:"1111"};let o=n.toLowerCase().split("");s&&(o=o.slice(0,-s[1]));for(const[e,r]of o.entries())t+=e===o.length-1&&a?parseInt(i[r],2).toString(2):i[r];return s&&(t+=n.slice(n.length-s[1])),t}};class rt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0,i=arguments.length>6?arguments[6]:void 0,o=arguments.length>7?arguments[7]:void 0,u=arguments.length>8?arguments[8]:void 0,l=arguments.length>9?arguments[9]:void 0,c=arguments.length>10?arguments[10]:void 0,d=arguments.length>11?arguments[11]:void 0,f=arguments.length>12?arguments[12]:void 0,h=arguments.length>13?arguments[13]:void 0,p=arguments.length>14?arguments[14]:void 0,v=arguments.length>15?arguments[15]:void 0,g=arguments.length>16?arguments[16]:void 0;this.value=e,this.values=t,this.values_encoded=r,this.probabilities=n,this.efficiency=a,this.redundency=s,this.entropy=i,this.original_byte_size=o,this.values_byte_size=u,this.value_byte_size=l,this.encoded_byte_size=c,this.compression_ratio=d,this.compression_percentage=f,this.positive=h,this.average_code_word_length=p,this.performance_milliseconds=v,this.performance=g}}class nt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1?arguments[1]:void 0;this.value=t,this.word=r,e(this,"left",void 0),e(this,"right",void 0),this.value=Number(t.toFixed(3))}get leaf(){return!(this.left||this.right)}get maxDepth(){const e=t=>void 0===t?0:Math.max(1+e(t.left),1+e(t.right));return e(this)}}class at{constructor(){e(this,"root",void 0)}static make(e){return(new at).make(e)}get array(){const e=[];return this.preorder(this.root,(t=>{var r;e.push(t.word?t.word:t===this.root?0:null===(r=t.path)||void 0===r?void 0:r.slice(-1))})),e}isRoot(e){return e===this.root}preorder(e,t){void 0!==e&&i("function",t)&&(t(e,e.left,e.right),this.preorder(e.left,t),this.preorder(e.right,t))}make(e){const t=Ne(e),r=new at;return r.root=new nt,r.root.index=0,function e(r){"0"!==t[0]||r.left||(r.left=new nt,r.left.index=2*r.index+1,r.left.path="0",t.splice(0,1),e(r.left)),"1"!==t[0]||r.right||(r.right=new nt,r.right.index=2*r.index+2,r.right.path="1",t.splice(0,1),e(r.right)),i("array",t[0])&&(t[0].length?(r.left||(r.left=new nt(1,t[0][0]),r.left.index=2*r.index+1,r.left.path="0",t[0].splice(0,1)),!r.right&&t[0].length&&(r.right=new nt(1,t[0][0]),r.right.index=2*r.index+2,r.right.path="1",t[0].splice(0,1)),t[0].length||t.splice(0,1)):t.splice(0,1)),"1"!==t[0]||r.right||e(r)}(r.root),r}}const st={encode_values:!0,base64:!0};class it{static get OnesyHuffmanCodeResponse(){return rt}static get OnesyNode(){return nt}static get OnesyHuffmanTree(){return at}static encodeValue(e){return i("string",e)&&e.length?Ke((e.match(/.{1,3}/g)||[]).map((e=>1+e)).join("")).match(/.{1,2}/g).flatMap((e=>"0"===e[0]?e.split("").map((e=>String.fromCharCode(parseInt(e,16)))):String.fromCharCode(parseInt(e,16)))).join(""):""}static decodeValue(e){if(!i("string",e)||!e.length)return"";const t=e.split("").map((e=>e.charCodeAt(0).toString(16))).join("");return(tt(t).match(/.{1,4}/g)||[]).map((e=>e.slice(1))).join("")}static encodeValues(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e){let r="";const n=Object.keys(e);return n.forEach(((a,s)=>r+="".concat(a).concat(t?this.encodeValue(e[a]):e[a]).concat(s<n.length-1?" ":""))),"".concat(t?1:0).concat(r)}}static decodeValues(e){const t={},r=[];if(e){const n="1"===e[0],a=e.slice(1).split(" ");a.forEach(((e,t)=>{e?r.push(e):a[t+1]=" ".concat(a[t+1])})),r.forEach((e=>t[e[0]]=n?this.decodeValue(e.slice(1)):e.slice(1)))}return t}static getValues(e){const t={},r=[];return e&&e.preorder(e.root,((t,n,a)=>{e.isRoot(t)&&(t.path=1===t.maxDepth?"0":"",t.leaf&&r.push(t)),n&&(n.path=t.path+0,n.leaf&&r.push(n)),a&&(a.path=t.path+1,a.leaf&&r.push(a))})),r.filter((e=>e.word)).forEach((e=>t[e.word]=e.path)),t}static decode(e,t){const r=new it;return r.values=t,r.decode(e)}static encodeBase64(e){return re(e,"base64")}static decodeBase64(e){return re(e,"string")}get encoded(){return this.response}get entropy(){const e=Object.keys(this.probabilities).reduce(((e,t)=>e+this.probabilities[t]*Math.log2(this.probabilities[t])),0);return Math.abs(Number(e.toFixed(3)))}get averageCodeWordLength(){const e=Object.keys(this.probabilities).reduce(((e,t)=>{var r;return e+this.probabilities[t]*((null===(r=this.values[t])||void 0===r?void 0:r.length)||8)}),0);return Number(e.toFixed(3))}get redundency(){return Number(Math.abs(this.entropy-this.averageCodeWordLength).toFixed(3))}get efficiency(){return Number((this.entropy/this.averageCodeWordLength||0).toFixed(3))}constructor(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:st;this.value=t,e(this,"options",void 0),e(this,"huffmanTree",void 0),e(this,"probabilities",{}),e(this,"values",{}),e(this,"response",new rt),e(this,"startTime",void 0),this.options=Pe(r,st),void 0!==this.value&&this.init()}init(){this.startTime=Fe.milliseconds,!Object.keys(this.probabilities).length&&i("string",this.value)&&this.getProbabilities(),!Object.keys(this.values).length&&Object.keys(this.probabilities).length&&(this.normalizeProbabilities(),this.makeHuffmanTree(),this.values=it.getValues(this.huffmanTree)),this.encode()}encode(){const e=new rt;if(Object.keys(this.values).length&&i("string",this.value)){let t=Array.from(this.value).reduce(((e,t)=>e+(this.values[t]||t)),"");t=it.encodeValue(t),this.options.base64&&(t=it.encodeBase64(t)),e.value=t,e.performance_milliseconds=Fe.milliseconds-this.startTime,e.performance=Je(e.performance_milliseconds)||"0 milliseconds",e.values=this.values,e.values_encoded=it.encodeValues(this.values,this.options.encode_values),e.probabilities=this.probabilities,e.efficiency=this.efficiency,e.redundency=this.redundency,e.entropy=this.entropy,e.average_code_word_length=this.averageCodeWordLength,e.original_byte_size=re(this.value,"byte-size"),e.values_byte_size=re(e.values_encoded,"byte-size"),e.value_byte_size=re(t,"byte-size"),e.encoded_byte_size=e.values_byte_size+e.value_byte_size,e.compression_ratio=Number(((e.encoded_byte_size+e.original_byte_size)/e.encoded_byte_size-1).toFixed(2)),e.compression_percentage=0===e.original_byte_size?0===e.value_byte_size?0:-100*e.value_byte_size:Number(((e.original_byte_size-e.encoded_byte_size)/e.original_byte_size*100).toFixed(2)),e.positive=e.compression_ratio>1,this.response=e}return e}decode(e){if(!e)return new rt(e);const t=new rt(e),r=Fe.milliseconds,n=it.decodeValue(it.decodeBase64(e));if(i("string",n)&&Object.keys(this.values).length){let a=n,s="";for(;a.length;){let e=Object.keys(this.values).find((e=>0===a.indexOf(this.values[e])));if(!e&&(e=Object.keys(this.values).find((e=>0===("0"+a).indexOf(this.values[e])))||Object.keys(this.values).find((e=>0===("00"+a).indexOf(this.values[e]))),!e))break;s+=e,a=a.slice(this.values[e].length)}t.value=s,t.performance_milliseconds=Fe.milliseconds-r,t.performance=Je(t.performance_milliseconds)||"0 milliseconds",t.original_byte_size=re(s,"byte-size"),t.value_byte_size=re(e,"byte-size")}return t}getProbabilities(){const e=this.value||"";for(let t=0;t<e.length;t++)this.probabilities[e[t]]=1+~~this.probabilities[e[t]];return this.probabilities}normalizeProbabilities(){const e=Object.keys(this.probabilities).reduce(((e,t)=>e+this.probabilities[t]),0);return Object.keys(this.probabilities).forEach((t=>this.probabilities[t]=Number((this.probabilities[t]/e).toFixed(4)))),this.probabilities}makeHuffmanTree(){let e=[];for(Object.keys(this.probabilities).forEach((t=>{const r=new nt(this.probabilities[t],t);e.push(r)})),e.sort(((e,t)=>e.value-t.value));e.length>1;){const t=e[0],r=e[1],n=new nt(t.value+r.value),a=[t,r].sort(((e,t)=>{const r=e.maxDepth,n=t.maxDepth;return e.leaf&&t.leaf||r===t.maxDepth?t.value-e.value:e.leaf||t.leaf?e.leaf?-1:1:r-n}));n.left=a[0],n.right=a[1],e.push(n),e=e.slice(2),e.sort(((e,t)=>e.value-t.value))}return this.huffmanTree=new at,this.huffmanTree.root=e[0],this.huffmanTree}}var ot=it;class ut{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0,i=arguments.length>6?arguments[6]:void 0,o=arguments.length>7?arguments[7]:void 0;this.value=e,this.original_byte_size=t,this.value_byte_size=r,this.compression_ratio=n,this.compression_percentage=a,this.positive=s,this.performance_milliseconds=i,this.performance=o}}class lt{static get OnesyLZ77Response(){return ut}static decode(e){return(new lt).decode(e)}static prefix(e){if(!i("string",e))return"`";const t=["`","'",'"',"(",")","|",",","+","*","-",".","^",";",":","=","?","[","]","_"];let r=0,n=1,a="";for(;;){a=t[r].repeat(n);const s=new RegExp("\\".concat(a,"[^\\").concat(a,"]{1,4},[^\\").concat(a,"]{1,4}\\").concat(a));if(!e.match(s))break;r===t.length-1?(r=0,n++):r++}return a}get encoded(){return this.response}constructor(t){this.value=t,e(this,"variant",void 0),e(this,"response",new ut),e(this,"valueString",void 0),e(this,"valueEncoded",void 0),void 0!==this.value&&this.init()}init(){["uint8array","buffer","string"].some((e=>i(e,this.value)))&&(this.getVariant(),i("string",this.value)?(this.valueString=this.value,this.valueEncoded=(new TextEncoder).encode(this.value)):this.valueEncoded=this.value,i("buffer",this.value)&&(this.valueString=this.value.toString("utf-8")),i("uint8array",this.value)&&(this.valueString=(new TextDecoder).decode(this.value)),this.encode())}encode(){const e=Fe.milliseconds,t=lt.prefix(this.valueString),r=32e4,n={start:-1,end:0};let a=this.valueEncoded.subarray(n.start,n.end);const s={start:0,end:this.valueEncoded.length>r?r:this.valueEncoded.length};let o=this.valueEncoded.subarray(s.start,s.end),u=[];const l=()=>{const e=[];for(let t=n.end-1;t>-1;t--)this.valueEncoded[t]===o[0]&&e.push(t);if(!e.length)return[0,0,s.start,s.start];let t=[];e.sort();for(let r=0;r<e.length;r++){const n=e[r];let a=2,i=this.equal(this.valueEncoded.subarray(n,n+a),this.valueEncoded.subarray(s.start,s.start+a));for(;i;)a+=1,i=this.equal(this.valueEncoded.subarray(n,n+a),this.valueEncoded.subarray(s.start,s.start+a));(!t.length||a>=t[1])&&(t=[n,a])}return[s.start-t[0],t[1]-1,s.start,s.start+t[1]-1]};for(;o.length;){const[e,i,c,d]=l(),f=Math.abs(e-i);let h="";const p=this.valueEncoded[d],v=this.valueEncoded.subarray(c-e,c-e+i);0===e&&0===i||(h="".concat(t).concat(e===i?this.valueEncode(e):"".concat(this.valueEncode(e),",").concat(this.valueEncode(i))).concat(t)),u.push(...re(v.reduce(((e,t)=>e+String.fromCharCode(t)),""),"byte-size")<=re(h,"byte-size")?v:[h],p);const g=d-c+f;n.start=a.length+o.length>=r?n.start+g:0,n.end=d+1,s.start=n.end,s.end+=g,a=this.valueEncoded.subarray(n.start,n.end),o=this.valueEncoded.subarray(s.start,s.end)}u=u.map((e=>i("number",e)?String.fromCharCode(e):e)).join(""),u=" ".concat(u);const c=this.variantToValue();(c>0||"`"!==t)&&("`"!==t&&(u="".concat(t).concat(u)),c>0&&(u="".concat(c).concat(u)));const d=new ut(u);return d.performance_milliseconds=Fe.milliseconds-e,d.performance=Je(d.performance_milliseconds)||"0 milliseconds",d.original_byte_size=re(this.valueEncoded,"byte-size"),d.value_byte_size=re(d.value,"byte-size"),d.compression_ratio=Number(((d.value_byte_size+d.original_byte_size)/d.value_byte_size-1).toFixed(2)),d.compression_percentage=0===d.original_byte_size?0===d.value_byte_size?0:-100*d.value_byte_size:Number(((d.original_byte_size-d.value_byte_size)/d.original_byte_size*100).toFixed(2)),d.positive=d.compression_ratio>1,this.response=d,d}decode(e){const t=new ut,r=Fe.milliseconds;if(i("string",e)){let n="",a=e;const s=e.indexOf(" ");n=e.substring(0,s),a=e.substring(s+1);let o="0",u="`";["1","2"].indexOf(n[0])>-1&&(o=n[0],n=n.substring(1)),n.length&&(u=n);const l=new RegExp("\\".concat(u,"[^\\").concat(u,"]{1,4}(,[^\\").concat(u,"]{1,4})?\\").concat(u),"g"),c=a.match(l)||[];for(const e of c){let t=e;t.includes(",")||(t="".concat(u).concat(t.replace(new RegExp("".concat(u),"g"),""),",").concat(t.replace(new RegExp("".concat(u),"g"),"")).concat(u));let[r,n]=t.slice(1,-1).split(",");[r,n]=[r,n].map((e=>this.valueDecode(e)));const s=a.indexOf(e)-r,i=s+n,o=[];if(n>r){let e=n;for(;e>0;){const t=a.substring(s,e<r?s+e:s+r);o.push(t),e-=r}}else{const e=a.substring(s,i);o.push(e)}const l=o.join("");a=a.replace(e,l)}if(a=this.valueToVariant(a,o),i("string",a)){const e=[];a.split("").forEach((t=>e.push(t.charCodeAt(0)))),a=(new TextDecoder).decode(new Uint8Array(e))}t.value=a,t.performance_milliseconds=Fe.milliseconds-r,t.performance=Je(t.performance_milliseconds)||"0 milliseconds",t.original_byte_size=re(a,"byte-size"),t.value_byte_size=re(e,"byte-size")}return t}valueToVariant(e,t){const r=te(t);return $("nodejs")&&1===r?Buffer.from(e):$("browser")&&1===r||2===r?(new TextEncoder).encode(e):e}variantToValue(){let e=0;return $("nodejs")&&this.variant===Buffer?e=1:this.variant===Uint8Array&&(e=2),e}valueEncode(e){return Number(e).toString(36)}valueDecode(e){return parseInt(e,36)}getVariant(){$("nodejs")&&Buffer.isBuffer(this.value)?this.variant=Buffer:i("uint8array",this.value)?this.variant=Uint8Array:this.variant=String}equal(e,t){return e.join("")===t.join("")}}var ct=lt;class dt{constructor(e,t,r,n,a,s,i,o){this.value=e,this.original_byte_size=t,this.value_byte_size=r,this.compression_ratio=n,this.compression_percentage=a,this.positive=s,this.performance_milliseconds=i,this.performance=o}}const ft={encode_values:!0,huffman_code:"auto"};class ht{static get OnesyZipResponse(){return dt}static decode(e){return(new ht).decode(e)}get encoded(){return this.response}constructor(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ft;this.value=t,e(this,"options",{}),e(this,"serialized",!1),e(this,"response",void 0),this.options=Pe(r,ft),void 0!==t&&this.init()}init(){["uint8array","buffer","string"].some((e=>i(e,this.value)))||(this.value=ze(this.value),this.serialized=!0),this.encode()}encode(){const e=Fe.milliseconds,t=new ct(this.value);let r=t.response.value;const n=[this.serialized?1:0];if(["auto",!0].includes(this.options.huffman_code)){var a;const e=new ot(t.response.value,{encode_values:null===(a=this.options)||void 0===a?void 0:a.encode_values});e.response.positive||!0===this.options.huffman_code?(r="".concat(e.response.values_encoded,", ").concat(e.response.value),n.unshift(1)):n.unshift(0)}else n.unshift(0);r="".concat(n.join("")).concat(r);const s=new dt(r);return s.performance_milliseconds=Fe.milliseconds-e,s.performance=Je(s.performance_milliseconds)||"0 milliseconds",s.original_byte_size=re(this.value,"byte-size"),s.value_byte_size=re(s.value,"byte-size"),s.compression_ratio=Number(((s.value_byte_size+s.original_byte_size)/s.value_byte_size-1).toFixed(2)),s.compression_percentage=0===s.original_byte_size?0===s.value_byte_size?0:-100*s.value_byte_size:Number(((s.original_byte_size-s.value_byte_size)/s.original_byte_size*100).toFixed(2)),s.positive=s.compression_ratio>1,this.response=s,s}decode(e){const t=new dt,r=Fe.milliseconds;if(i("string",e)){const n="1"===e[0],a="1"===e[1];let s=e.slice(2);const i=s.indexOf(", ");if(n){let e=s.substring(0,i);const t=s.substring(i+4);if(t&&e){e=ot.decodeValues(e);s=ot.decode(t,e).value}}const o=ct.decode(s);t.value=o.value,a&&(t.value=_e(t.value)),t.performance_milliseconds=Fe.milliseconds-r,t.performance=Je(t.performance_milliseconds)||"0 milliseconds",t.original_byte_size=re(t.value,"byte-size"),t.value_byte_size=re(e,"byte-size")}return t}}return ht}));