@onesy/lz77
Version:
7 lines (6 loc) • 34.1 kB
JavaScript
/** @license Lz77 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).Lz77=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 a(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})})),t}var n={exports:{}};!function(e,r){Object.defineProperty(r,"__esModule",{value:!0});const a={},n="undefined"!=typeof window&&void 0!==window.document,s=!(void 0===t||!e.exports);r.default=function e(t,r,o={}){var i;const u=Object.assign(Object.assign({},a),o),{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)||!(n?"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 n&&r instanceof Blob;case"buffer":return!(!s||"function"!=typeof(null===(i=null==r?void 0:r.constructor)||void 0===i?void 0:i.isBuffer)||!r.constructor.isBuffer(r));case"element":if(r)switch(l){case void 0:case"html":case"element":return n&&("object"==typeof HTMLElement?r instanceof HTMLElement:r&&"object"==typeof r&&null!==r&&1===r.nodeType&&"string"==typeof r.nodeName);case"node":return n&&("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}}}(n,n.exports);var s=r(n.exports),o={},i=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0});const u=i(n.exports);var l,c=o.default=function e(t,r){let a;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 a=void 0!==r?r:e("browser")&&window.location.hostname,(0,u.default)("string",a)&&["localhost","127.0.0.1"].some((e=>a.indexOf(e)>-1));default:return!1}},d={},f={},h=new Uint8Array(16);function y(){if(!l&&!(l="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 l(h)}var p=/^(?:[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 g(e){return"string"==typeof e&&p.test(e)}for(var v,b,m=[],w=0;w<256;++w)m.push((w+256).toString(16).substr(1));function _(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(m[e[t+0]]+m[e[t+1]]+m[e[t+2]]+m[e[t+3]]+"-"+m[e[t+4]]+m[e[t+5]]+"-"+m[e[t+6]]+m[e[t+7]]+"-"+m[e[t+8]]+m[e[t+9]]+"-"+m[e[t+10]]+m[e[t+11]]+m[e[t+12]]+m[e[t+13]]+m[e[t+14]]+m[e[t+15]]).toLowerCase();if(!g(r))throw TypeError("Stringified UUID is invalid");return r}var A=0,j=0;function M(e){if(!g(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 O(e,t,r){function a(e,a,n,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 a&&(a=M(a)),16!==a.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var o=new Uint8Array(16+e.length);if(o.set(a),o.set(e,a.length),(o=r(o))[6]=15&o[6]|t,o[8]=63&o[8]|128,n){s=s||0;for(var i=0;i<16;++i)n[s+i]=o[i];return n}return _(o)}try{a.name=e}catch(e){}return a.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",a.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",a}function T(e){return 14+(e+64>>>9<<4)+1}function E(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function x(e,t,r,a,n,s){return E((o=E(E(t,e),E(a,s)))<<(i=n)|o>>>32-i,r);var o,i}function S(e,t,r,a,n,s,o){return x(t&r|~t&a,e,t,n,s,o)}function U(e,t,r,a,n,s,o){return x(t&a|r&~a,e,t,n,s,o)}function z(e,t,r,a,n,s,o){return x(t^r^a,e,t,n,s,o)}function B(e,t,r,a,n,s,o){return x(r^(t|~a),e,t,n,s,o)}var D=O("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,a="0123456789abcdef",n=0;n<r;n+=8){var s=e[n>>5]>>>n%32&255,o=parseInt(a.charAt(s>>>4&15)+a.charAt(15&s),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[T(t)-1]=t;for(var r=1732584193,a=-271733879,n=-1732584194,s=271733878,o=0;o<e.length;o+=16){var i=r,u=a,l=n,c=s;r=S(r,a,n,s,e[o],7,-680876936),s=S(s,r,a,n,e[o+1],12,-389564586),n=S(n,s,r,a,e[o+2],17,606105819),a=S(a,n,s,r,e[o+3],22,-1044525330),r=S(r,a,n,s,e[o+4],7,-176418897),s=S(s,r,a,n,e[o+5],12,1200080426),n=S(n,s,r,a,e[o+6],17,-1473231341),a=S(a,n,s,r,e[o+7],22,-45705983),r=S(r,a,n,s,e[o+8],7,1770035416),s=S(s,r,a,n,e[o+9],12,-1958414417),n=S(n,s,r,a,e[o+10],17,-42063),a=S(a,n,s,r,e[o+11],22,-1990404162),r=S(r,a,n,s,e[o+12],7,1804603682),s=S(s,r,a,n,e[o+13],12,-40341101),n=S(n,s,r,a,e[o+14],17,-1502002290),r=U(r,a=S(a,n,s,r,e[o+15],22,1236535329),n,s,e[o+1],5,-165796510),s=U(s,r,a,n,e[o+6],9,-1069501632),n=U(n,s,r,a,e[o+11],14,643717713),a=U(a,n,s,r,e[o],20,-373897302),r=U(r,a,n,s,e[o+5],5,-701558691),s=U(s,r,a,n,e[o+10],9,38016083),n=U(n,s,r,a,e[o+15],14,-660478335),a=U(a,n,s,r,e[o+4],20,-405537848),r=U(r,a,n,s,e[o+9],5,568446438),s=U(s,r,a,n,e[o+14],9,-1019803690),n=U(n,s,r,a,e[o+3],14,-187363961),a=U(a,n,s,r,e[o+8],20,1163531501),r=U(r,a,n,s,e[o+13],5,-1444681467),s=U(s,r,a,n,e[o+2],9,-51403784),n=U(n,s,r,a,e[o+7],14,1735328473),r=z(r,a=U(a,n,s,r,e[o+12],20,-1926607734),n,s,e[o+5],4,-378558),s=z(s,r,a,n,e[o+8],11,-2022574463),n=z(n,s,r,a,e[o+11],16,1839030562),a=z(a,n,s,r,e[o+14],23,-35309556),r=z(r,a,n,s,e[o+1],4,-1530992060),s=z(s,r,a,n,e[o+4],11,1272893353),n=z(n,s,r,a,e[o+7],16,-155497632),a=z(a,n,s,r,e[o+10],23,-1094730640),r=z(r,a,n,s,e[o+13],4,681279174),s=z(s,r,a,n,e[o],11,-358537222),n=z(n,s,r,a,e[o+3],16,-722521979),a=z(a,n,s,r,e[o+6],23,76029189),r=z(r,a,n,s,e[o+9],4,-640364487),s=z(s,r,a,n,e[o+12],11,-421815835),n=z(n,s,r,a,e[o+15],16,530742520),r=B(r,a=z(a,n,s,r,e[o+2],23,-995338651),n,s,e[o],6,-198630844),s=B(s,r,a,n,e[o+7],10,1126891415),n=B(n,s,r,a,e[o+14],15,-1416354905),a=B(a,n,s,r,e[o+5],21,-57434055),r=B(r,a,n,s,e[o+12],6,1700485571),s=B(s,r,a,n,e[o+3],10,-1894986606),n=B(n,s,r,a,e[o+10],15,-1051523),a=B(a,n,s,r,e[o+1],21,-2054922799),r=B(r,a,n,s,e[o+8],6,1873313359),s=B(s,r,a,n,e[o+15],10,-30611744),n=B(n,s,r,a,e[o+6],15,-1560198380),a=B(a,n,s,r,e[o+13],21,1309151649),r=B(r,a,n,s,e[o+4],6,-145523070),s=B(s,r,a,n,e[o+11],10,-1120210379),n=B(n,s,r,a,e[o+2],15,718787259),a=B(a,n,s,r,e[o+9],21,-343485551),r=E(r,i),a=E(a,u),n=E(n,l),s=E(s,c)}return[r,a,n,s]}(function(e){if(0===e.length)return[];for(var t=8*e.length,r=new Uint32Array(T(t)),a=0;a<t;a+=8)r[a>>5]|=(255&e[a/8])<<a%32;return r}(e),8*e.length))})),N=D;function k(e,t,r,a){switch(e){case 0:return t&r^~t&a;case 1:case 3:return t^r^a;case 2:return t&r^t&a^r&a}}function I(e,t){return e<<t|e>>>32-t}var C=O("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var a=unescape(encodeURIComponent(e));e=[];for(var n=0;n<a.length;++n)e.push(a.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var s=e.length/4+2,o=Math.ceil(s/16),i=new Array(o),u=0;u<o;++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];i[u]=l}i[o-1][14]=8*(e.length-1)/Math.pow(2,32),i[o-1][14]=Math.floor(i[o-1][14]),i[o-1][15]=8*(e.length-1)&4294967295;for(var d=0;d<o;++d){for(var f=new Uint32Array(80),h=0;h<16;++h)f[h]=i[d][h];for(var y=16;y<80;++y)f[y]=I(f[y-3]^f[y-8]^f[y-14]^f[y-16],1);for(var p=r[0],g=r[1],v=r[2],b=r[3],m=r[4],w=0;w<80;++w){var _=Math.floor(w/20),A=I(p,5)+k(_,g,v,b)+m+t[_]+f[w]>>>0;m=b,b=v,v=I(g,30)>>>0,g=p,p=A}r[0]=r[0]+p>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+v>>>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]]})),P=C;var $=Object.freeze({__proto__:null,v1:function(e,t,r){var a=t&&r||0,n=t||new Array(16),s=(e=e||{}).node||v,o=void 0!==e.clockseq?e.clockseq:b;if(null==s||null==o){var i=e.random||(e.rng||y)();null==s&&(s=v=[1|i[0],i[1],i[2],i[3],i[4],i[5]]),null==o&&(o=b=16383&(i[6]<<8|i[7]))}var u=void 0!==e.msecs?e.msecs:Date.now(),l=void 0!==e.nsecs?e.nsecs:j+1,c=u-A+(l-j)/1e4;if(c<0&&void 0===e.clockseq&&(o=o+1&16383),(c<0||u>A)&&void 0===e.nsecs&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");A=u,j=l,b=o;var d=(1e4*(268435455&(u+=122192928e5))+l)%4294967296;n[a++]=d>>>24&255,n[a++]=d>>>16&255,n[a++]=d>>>8&255,n[a++]=255&d;var f=u/4294967296*1e4&268435455;n[a++]=f>>>8&255,n[a++]=255&f,n[a++]=f>>>24&15|16,n[a++]=f>>>16&255,n[a++]=o>>>8|128,n[a++]=255&o;for(var h=0;h<6;++h)n[a+h]=s[h];return t||_(n)},v3:N,v4:function(e,t,r){var a=(e=e||{}).random||(e.rng||y)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){r=r||0;for(var n=0;n<16;++n)t[r+n]=a[n];return t}return _(a)},v5:P,NIL:"00000000-0000-0000-0000-000000000000",version:function(e){if(!g(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)},validate:g,stringify:_,parse:M}),F=a($),R={};Object.defineProperty(R,"__esModule",{value:!0});const W=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),Z=(e,t)=>{if(e===t)return!0;if(Number.isNaN(e)&&Number.isNaN(t))return!0;if(!(typeof e==typeof t||W(e)&&W(t)))return!1;if(Array.isArray(e)&&e.length===t.length)return e.every(((e,r)=>Z(e,t[r])));if(W(e)){const r=Object.assign({},e),a=Object.assign({},t);return Object.keys(r).every((e=>Z(r[e],a[e])))}return!1};R.default=Z;var q=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(f,"__esModule",{value:!0});const L=F,V=q(n.exports),J=q(o),G=q(R),H={};f.default=function e(t,r,a={}){var n;const s=Object.assign(Object.assign({},H),a);let o,i,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,V.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,V.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,"-"),a=null==r?void 0:r.length;return c.test(r)&&!r.startsWith("-")&&!r.endsWith("-")&&t.length===r.length&&a>1&&a<254;case"compare":return({valueA:o,valueB:i,operator:u}=s),l={"less-than":o<i,"less-than-equal":o<=i,equal:(0,G.default)(o,i),"not-equal":!(0,G.default)(o,i),"greater-than-equal":o>=i,"greater-than":o>i,"array-all":(0,V.default)("array",o)&&(0,V.default)("array",i)&&o.every(((e,t)=>(0,G.default)(o[t],i[t]))),"array-some":(0,V.default)("array",o)&&(0,V.default)("array",i)&&o.some(((e,t)=>(0,G.default)(o[t],i[t]))),"starts-with":(0,V.default)("string",o)&&0===o.indexOf(i),contains:(0,V.default)("string",o)&&o.indexOf(i)>-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:o,valueB:i,operator:u}=s),e("semver",o)&&e("semver",i)?(o=(o.match(/\d+(\.|\-|\+){0,1}/g)||[]).map((e=>e.replace(/[,\-\+\.]/g,""))),i=(i.match(/\d+(\.|\-|\+){0,1}/g)||[]).map((e=>e.replace(/[,\-\+\.]/g,""))),l={"less-than":!1,"less-than-equal":!1,equal:o.every(((e,t)=>e===i[t])),"greater-than-equal":!1,"greater-than":!1},o.forEach(((e,t)=>{l["less-than"]||(l["less-than"]=e<i[t])})),o.forEach(((e,t)=>{l["greater-than"]||(l["greater-than"]=e>i[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,V.default)("string",r))return!1;const h=void 0!==s.min?s.min:7,y=void 0!==s.max?s.max:440;return r.length>=h&&r.length<=y&&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,V.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,V.default)("object",d,s)||(0,V.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===(n=d)||void 0===n?void 0:n.hostname));case"js-chunk":return(0,V.default)("object",r,s)&&!!r.__esModule&&(r.default instanceof Function||r.default instanceof Object);case"http-method":const p=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"];return(0,V.default)("string",r,s)&&p.indexOf(r.toUpperCase())>-1;case"base64":return d="string"==typeof r?r.trim():r,(0,V.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,V.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(n.exports),ee={decode:!1,decodeMethod:decodeURIComponent};var te=K.default=(e,t={})=>{const r=Object.assign(Object.assign({},ee),t);let a=e;try{(0,Q.default)("string",e)&&r.decode&&(0,Q.default)("function",r.decodeMethod)&&(a=r.decodeMethod(e))}catch(e){}try{if((0,Q.default)("string",a)){if("undefined"===a)return;return"NaN"===a?NaN:JSON.parse(a)}return a}catch(e){}return a};!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(n.exports),a=t(f),s=t(o),i=t(Y),u=t(K);e.dataUriToBlob=(e,t=!1)=>{if((0,a.default)("datauri",e)||(0,a.default)("base64",e))try{const r=atob((0,a.default)("datauri",e)?e.split(",")[1]:e),n=(0,a.default)("datauri",e)&&e.split(",")[0].split(":")[1].split(";")[0],s=new ArrayBuffer(2*r.length),o=new Uint16Array(s);for(let e=0;e<r.length;e++)o[e]=r.charCodeAt(e);if(t)return s;return new Blob([s],{type:n})}catch(e){return}};e.dataUriToBuffer=e=>{if((0,a.default)("datauri",e)||(0,a.default)("base64",e))try{const t=(0,a.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,a=1e3)=>{if(!(0,r.default)("number",e)||e<=0)return"0 Bytes";const n=a,s=t<0?0:t,o=Math.floor(Math.log(e)/Math.log(n));return`${parseFloat((e/Math.pow(n,o)).toFixed(s))} ${["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][o]}`};const l={thousand:1e3,decimals:2,mime:"text/plain"},c=(t,n="arraybuffer",o={})=>{const d=Object.assign(Object.assign({},l),o);let f=t;switch(n){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,a.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,a.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,a.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,a.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,a.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,a.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,a.default)("base64",f))return(0,e.dataUriToBlob)(f);if((0,a.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,a.default)("base64",f)||(0,a.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,u.default)(f),d.decimals,d.thousand):void 0;case"size":return(0,r.default)("string",f)?(0,e.sizeFormat)((0,u.default)((new TextEncoder).encode(f).byteLength),d.decimals,d.thousand):void 0;default:return}};e.default=c}(d);var re=r(d),ae={},ne={},se={};Object.defineProperty(se,"__esModule",{value:!0});const oe=e=>Array.isArray(e),ie=e=>"object"==typeof e&&!!e&&e.constructor===Object,ue=(e,t)=>{const r=t||new WeakSet;if(r.has(e))return e;if((ie(e)||oe(e))&&r.add(e),oe(e))return e.map((e=>ue(e,r)));if(ie(e)){const t={};return Object.keys(e).forEach((a=>t[a]=ue(e[a],r))),t}return e};se.default=ue;var le=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ne,"__esModule",{value:!0});const ce=le(n.exports),de=le(se),fe={copy:!1,merge:{array:!1}},he=(e,t,r={})=>{const a=Object.assign(Object.assign({},fe),r);if(a.merge.array&&(0,ce.default)("array",e)&&(0,ce.default)("array",t)){const r=Math.max(e.length,t.length);for(let n=0;n<r;n++)void 0===e[n]&&(e[n]=t[n]),((0,ce.default)("object",e[n])&&(0,ce.default)("object",t[n])||(0,ce.default)("array",e[n])&&(0,ce.default)("array",t[n]))&&(e[n]=he(e[n],t[n],a))}return(0,ce.default)("object",e)&&(0,ce.default)("object",t)&&Object.keys(t).forEach((r=>{e.hasOwnProperty(r)?(0,ce.default)("object",e[r])&&(0,ce.default)("object",t[r])&&(e[r]=he(e[r],t[r],a)):e[r]=a.copy?(0,de.default)(t[r]):t[r]})),e};ne.default=he,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(ne),a={};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 n{constructor(e=new Date,t={}){this.value_=e,this.options=t,this.init()}static get utc(){return new n(new Date,{utc:!0})}static get daysInMonth(){return(new n).daysInMonth}static get valueOf(){return(new n).valueOf}static get unix(){return(new n).unix}static get milliseconds(){return(new n).milliseconds}static get iso(){return(new n).iso}static get onesyDate(){return new n}static get local(){return(new n).local}init(){this.options=(0,r.default)(this.options,a),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 n||"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 n(new Date(this.value.toLocaleString("en-us")))}get utc(){return new n(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 n(this.value.toLocaleString("en-us",{timeZone:e}))}}e.default=n}(ae);var ye=r(ae),pe={},ge={},ve=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ge,"__esModule",{value:!0});const be=ve(n.exports);ge.default=(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER)=>(0,be.default)("number",e)?e<t?t:e>r?r:e:e;var me=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(pe,"__esModule",{value:!0});const we=me(n.exports),_e=me(ge);var Ae=pe.default=function(e,t=!1,r=!1,a=" ",n=["year","month","day","hour","minute","second","millisecond"]){if((0,we.default)("number",e)){let s="",o=e;const i=[],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 n)if(l[e]){const r=(0,_e.default)(Math.floor(o/l[e]),0);if(r>0){o-=r*l[e],u[e]=r;let a=r;a=t?`${a} ${c[e]}`:`${a} ${e}${r>1?"s":""}`,i.push(a)}}return i.forEach((e=>s+=`${a}${e}`)),r?u:s.trim()}};class je{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,a=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0,i=arguments.length>7?arguments[7]:void 0;this.value=e,this.original_byte_size=t,this.value_byte_size=r,this.compression_ratio=a,this.compression_percentage=n,this.positive=s,this.performance_milliseconds=o,this.performance=i}}class Me{static get OnesyLZ77Response(){return je}static decode(e){return(new Me).decode(e)}static prefix(e){if(!s("string",e))return"`";const t=["`","'",'"',"(",")","|",",","+","*","-",".","^",";",":","=","?","[","]","_"];let r=0,a=1,n="";for(;;){n=t[r].repeat(a);const s=new RegExp("\\".concat(n,"[^\\").concat(n,"]{1,4},[^\\").concat(n,"]{1,4}\\").concat(n));if(!e.match(s))break;r===t.length-1?(r=0,a++):r++}return n}get encoded(){return this.response}constructor(t){this.value=t,e(this,"variant",void 0),e(this,"response",new je),e(this,"valueString",void 0),e(this,"valueEncoded",void 0),void 0!==this.value&&this.init()}init(){["uint8array","buffer","string"].some((e=>s(e,this.value)))&&(this.getVariant(),s("string",this.value)?(this.valueString=this.value,this.valueEncoded=(new TextEncoder).encode(this.value)):this.valueEncoded=this.value,s("buffer",this.value)&&(this.valueString=this.value.toString("utf-8")),s("uint8array",this.value)&&(this.valueString=(new TextDecoder).decode(this.value)),this.encode())}encode(){const e=ye.milliseconds,t=Me.prefix(this.valueString),r=32e4,a={start:-1,end:0};let n=this.valueEncoded.subarray(a.start,a.end);const o={start:0,end:this.valueEncoded.length>r?r:this.valueEncoded.length};let i=this.valueEncoded.subarray(o.start,o.end),u=[];const l=()=>{const e=[];for(let t=a.end-1;t>-1;t--)this.valueEncoded[t]===i[0]&&e.push(t);if(!e.length)return[0,0,o.start,o.start];let t=[];e.sort();for(let r=0;r<e.length;r++){const a=e[r];let n=2,s=this.equal(this.valueEncoded.subarray(a,a+n),this.valueEncoded.subarray(o.start,o.start+n));for(;s;)n+=1,s=this.equal(this.valueEncoded.subarray(a,a+n),this.valueEncoded.subarray(o.start,o.start+n));(!t.length||n>=t[1])&&(t=[a,n])}return[o.start-t[0],t[1]-1,o.start,o.start+t[1]-1]};for(;i.length;){const[e,s,c,d]=l(),f=Math.abs(e-s);let h="";const y=this.valueEncoded[d],p=this.valueEncoded.subarray(c-e,c-e+s);0===e&&0===s||(h="".concat(t).concat(e===s?this.valueEncode(e):"".concat(this.valueEncode(e),",").concat(this.valueEncode(s))).concat(t)),u.push(...re(p.reduce(((e,t)=>e+String.fromCharCode(t)),""),"byte-size")<=re(h,"byte-size")?p:[h],y);const g=d-c+f;a.start=n.length+i.length>=r?a.start+g:0,a.end=d+1,o.start=a.end,o.end+=g,n=this.valueEncoded.subarray(a.start,a.end),i=this.valueEncoded.subarray(o.start,o.end)}u=u.map((e=>s("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 je(u);return d.performance_milliseconds=ye.milliseconds-e,d.performance=Ae(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 je,r=ye.milliseconds;if(s("string",e)){let a="",n=e;const o=e.indexOf(" ");a=e.substring(0,o),n=e.substring(o+1);let i="0",u="`";["1","2"].indexOf(a[0])>-1&&(i=a[0],a=a.substring(1)),a.length&&(u=a);const l=new RegExp("\\".concat(u,"[^\\").concat(u,"]{1,4}(,[^\\").concat(u,"]{1,4})?\\").concat(u),"g"),c=n.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,a]=t.slice(1,-1).split(",");[r,a]=[r,a].map((e=>this.valueDecode(e)));const s=n.indexOf(e)-r,o=s+a,i=[];if(a>r){let e=a;for(;e>0;){const t=n.substring(s,e<r?s+e:s+r);i.push(t),e-=r}}else{const e=n.substring(s,o);i.push(e)}const l=i.join("");n=n.replace(e,l)}if(n=this.valueToVariant(n,i),s("string",n)){const e=[];n.split("").forEach((t=>e.push(t.charCodeAt(0)))),n=(new TextDecoder).decode(new Uint8Array(e))}t.value=n,t.performance_milliseconds=ye.milliseconds-r,t.performance=Ae(t.performance_milliseconds)||"0 milliseconds",t.original_byte_size=re(n,"byte-size"),t.value_byte_size=re(e,"byte-size")}return t}valueToVariant(e,t){const r=te(t);return c("nodejs")&&1===r?Buffer.from(e):c("browser")&&1===r||2===r?(new TextEncoder).encode(e):e}variantToValue(){let e=0;return c("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(){c("nodejs")&&Buffer.isBuffer(this.value)?this.variant=Buffer:s("uint8array",this.value)?this.variant=Uint8Array:this.variant=String}equal(e,t){return e.join("")===t.join("")}}return Me}));