strc 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/jssc.cjs +1 -1
- package/dist/jssc.js +4 -6
- package/dist/jssc.mjs +1 -1
- package/index.js +4 -6
- package/index.min.js +1 -1
- package/package.json +1 -1
- package/src/index.js +1 -1
package/dist/jssc.cjs
CHANGED
package/dist/jssc.js
CHANGED
|
@@ -38,12 +38,10 @@ SOFTWARE.
|
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
40
|
(function (global, factory) {
|
|
41
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
42
|
-
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
43
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSSC = {}));
|
|
44
|
-
})(this, (function (exports) { 'use strict';
|
|
45
|
-
|
|
46
|
-
const JUSTC = require('justc');
|
|
41
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('justc')) :
|
|
42
|
+
typeof define === 'function' && define.amd ? define(['exports', 'justc'], factory) :
|
|
43
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSSC = {}, global.JUSTC));
|
|
44
|
+
})(this, (function (exports, JUSTC) { 'use strict';
|
|
47
45
|
|
|
48
46
|
const name__ = 'JSSC';
|
|
49
47
|
const prefix = name__+': ';
|
package/dist/jssc.mjs
CHANGED
package/index.js
CHANGED
|
@@ -38,12 +38,10 @@ SOFTWARE.
|
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
40
|
(function (global, factory) {
|
|
41
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
42
|
-
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
43
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSSC = {}));
|
|
44
|
-
})(this, (function (exports) { 'use strict';
|
|
45
|
-
|
|
46
|
-
const JUSTC = require('justc');
|
|
41
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('justc')) :
|
|
42
|
+
typeof define === 'function' && define.amd ? define(['exports', 'justc'], factory) :
|
|
43
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSSC = {}, global.JUSTC));
|
|
44
|
+
})(this, (function (exports, JUSTC) { 'use strict';
|
|
47
45
|
|
|
48
46
|
const name__ = 'JSSC';
|
|
49
47
|
const prefix = name__+': ';
|
package/index.min.js
CHANGED
|
@@ -37,4 +37,4 @@ SOFTWARE.
|
|
|
37
37
|
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
|
-
((e,r)=>{"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).JSSC={})})(this,function(e){let x=require("justc"),U="JSSC",J=U+": ";if(65536===String.fromCharCode(65536).charCodeAt(0)||256!==String.fromCharCode(256).charCodeAt(0))throw new Error(J+"Supported UTF-16 only!");function _(e){let r=[],t=0,n=0,o=1/0;return String(e).split("").forEach(e=>{e=e.charCodeAt();r.push(e),t=Math.max(t,e.toString().length),n=Math.max(n,e),o=Math.min(o,e.toString().length)}),{max:t,output:r,maxCharCode:n,min:o}}function b(e){return String.fromCharCode(e+32)}function E(e){return e%65535===e}function q(r,t){var n=[];for(let e=0;e<r.length;e+=t)n.push(r.slice(e,e+t));return n}function I(r,t){var n=[];for(let e=0;e<r.length;e+=t)n.push(r.slice(e,e+t));return n}function H(e,r){return e.toString(2).padStart(r,"0")}function P(e){return parseInt(e,2)}function o(){let r={};function t(e){r[e]=String.fromCharCode(e)}for(let e=0;e<65;e++)t(e);for(let e=91;e<97;e++)t(e);for(let e=123;e<128;e++)t(e);return r}function n(){var r={};for(let e=0;e<128;e++)r[e]=String.fromCharCode(e);return r}let k={};function L(e,r=!1,t=!1,n=!1,o=-1,a=0,i=!1,s=-1){var f,c,l;return r?(f=(r=H(e,16)).slice(8,11).split(""),c=P(r.slice(11)),l=P(r.slice(5,8)),{code:c,repeatBefore:"1"===f[0],repeatAfter:"1"===f[1],beginId:"1"===f[2]?l:-1,code2:P(r.slice(0,4)),sequences:"1"===r.slice(4,5),code3:"0"===f[2]?l:-1,bin:r}):P(H(a,4)+(i?"1":"0")+H(0<=o?o:s<0?0:s,3)+(t?"1":"0")+(n?"1":"0")+(0<=o?"1":"0")+H(e,5))}k._char=e=>String.fromCharCode(e),k._IDs={BASE:0,RU:1,ENRU:2,ENKK:3,HI:4,ENHI:5,BN:6,ENBN:7,HIBN:8,JA:9,Telu:10,MR:11,B:12,E:13,AR:14},k.BASE=function(){var e,r=o(),t=[215,247,8722,11800,174,169,171,10003,182,9834,183,10005,177,181,8960,8211,8212,8228,8229,8230,8240,8241,8249,8250,8252,8253,8263,8264,8267,8270,8274,8451,8457,8470,8471,8482,402,1423,1547,65020,2547,2553,2555,2801,3065,3647,6107,8499,2546,8304,185,178,179,8585,8319,8305,8709,8730,8734];for(let e=161;e<168;e++)t.push(e);for(let e=187;e<192;e++)t.push(e);for(let e=8308;e<8317;e++)t.push(e);for(let e=8528;e<8576;e++)t.push(e);for(let e=8352;e<8385;e++)t.push(e);for(let e=8320;e<8333;e++)t.push(e);for(let e=8712;e<8718;e++)t.push(e);let n=65;for(e of t)r[n++]=k._char(e),91===n?n=97:123===n&&(n=128);return r},k._BASE=[167,8722,8451,169,8211,215,247,8457,174,8470,8482,8471,8249,8250,171,187,8242,8245,8216,8217,8218,8219,8243,8246,8220,8221,8222,8223,8226,182,8267,8270,8240,8241,9834,183,8228,8229,8230,161,191,8252,8264],k._MATH=[8544,8547,8550,8553,8556,8572,8545,8548,8551,8554,8557,8573,8546,8549,8552,8555,8558,8574,8560,8563,8566,8569,8559,8575,8561,8564,8567,8570,8562,8565,8568,8571,8712,8715,8713,8716,8730,8721,8734,8804,8805],k._CURR=[165,3647,8363,8361,1423,8364,8377,8362,8378,8353,8358,163,8381,8354,8369,2547,8370,8366,8376,8382,8357,6107,8360,8372,8373,8365,1547,2801,162,65020,8355,8383,8380,3065,164,8384,8379,402,8359,2546,8371,8367,8356,8375,2553,8368,8352,8499,8374,2555],k._RU=function(e){var r=e();let t=0;for(let e=1040;e<1104;e++){var n=e-912;r[n]=k._char(e),t=Math.max(t,n)}return r[t+1]=k._char(1025),r[t+2]=k._char(1105),r},k.RU=function(){var e,r=k._RU(o);let t=65;for(e of k._BASE.concat(k._MATH,[105,239,1028,1030,1031,1108,1110,1111,1118,1038,1241,1181,1171,1199,1201,1179,1257,1211,1240,1186,1170,1198,1200,1178,1256,1210,8381,8364,165,8376,8372]))r[t++]=k._char(e),91===t?t=97:123===t&&(t=193);return r[110]="i",r[111]="I",r},k.ENRU=function(){var e,r=k._RU(n);let t=194;for(e of k._BASE.concat([105,239,1028,1030,1031,1108,1110,1111,1118,1038,8381,8364,165,8376,8372,163,8380],[215,247]))r[t++]=k._char(e);return r},k.ENKK=function(){var e,r=k._RU(n);let t=194;for(e of k._BASE.concat([1241,1181,1171,1199,1201,1179,1257,1211,1240,1186,1170,1198,1200,1178,1256,1210,8381,163,8376]))r[t++]=k._char(e);return r},k._HI=function(e){var r=e();for(let e=2304;e<2432;e++)r[e-2176]=k._char(e);return r},k._Ind=[8377,8360,78,2547,2404,215,247],k.HI=function(){var e,r=k._HI(o);let t=65;for(e of k._BASE.concat(k._Ind))r[t++]=k._char(e),91===t&&(t=97);return r},k.ENHI=function(){return k._HI(n)},k._BN=function(e){var r=e();for(let e=2432;e<2559;e++)r[e-2304]=k._char(e);return r[255]=k._char(2404),r},k.BN=function(){var e,r=k._BN(o);let t=65;for(e of k._BASE.concat(k._Ind))r[t++]=k._char(e),91===t&&(t=97);return r},k.ENBN=function(){return k._BN(n)},k.HIBN=function(){var r={};for(let e=2304;e<2559;e++)r[e-2176-128]=k._char(e);return r[255]=" ",r},k._JA=[[65371,65373,65288,65289,65339,65341,12304,12305,12289,65292,12290,12349,12300,12301,12302,12303,12288,12316,65306,65281,65311,12445,12541,183],[8230,8229,165]],k.JA=function(){var e,r=n();let t=128;for(e of k._JA[0].concat(Array.from({length:46},(e,r)=>r+12352),Array.from({length:46},(e,r)=>r+12448),k._JA[1],[19968,20108,19977,22235,20116,20845,19971,20843,20061]))r[t++]=k._char(e);return r[17]=k._char(21313),r[18]=k._char(30334),r[19]=k._char(21315),r[20]=k._char(19975),r},k.Telu=function(){var e,r=n();for(let e=3073;e<3184;e++)r[e-2945]=k._char(e);let t=239;for(e of k._Ind.concat([8364,163,162,165,167,169,174,8482,8240,8241]))r[t++]=k._char(e);return r},k.MR=function(){var r=n();for(let e=2304;e<2432;e++)r[e-2176]=k._char(e);return r},k.B=function(){var r=n();for(let e=256;e<383;e++)r[e-128]=k._char(e);return r[255]=k._char(383),r},k.E=function(){var r=n();for(let e=128;e<255;e++)r[e]=k._char(e);return r[255]=k._char(383),r},k.AR=function(){var r={};for(let e=1536;e<1791;e++)r[e-1536]=k._char(e);return r},k.use=class{constructor(){var e,r,t={};for([e,r]of Object.entries(k))"function"!=typeof r||e.startsWith("_")||"use"==e||(t[U+e]=r);return Object.freeze(t),t}},k._begin=["https://","http://","file://","mailto:","ftp://","data:","tel:","sms:"],Object.freeze(k.use);let D="\udbff";function N(e){if(e.length<20)return{compressed:e,sequences:!1};if(e.includes(D))return{compressed:e,sequences:!1};var r=((o,e,a)=>{var i=[],s=o.length;for(let n=0;n<s-e*a+1;n++)for(let t=2;t<=Math.min(30,Math.floor((s-n)/a));t++){var f=o.substr(n,t);if(!f.includes(D)){let r=1;for(let e=n+t;e<=s-t&&o.substr(e,t)===f;e+=t)r++;if(r>=a){var c,l=n+t*r;let e=!1;for(c of i)if(n<c.end&&l>c.start){e=!0;break}if(!e){i.push({start:n,end:l,length:t,pattern:f,count:r,saved:t*r-(t+3)}),n=l-1;break}}}}return i.sort((e,r)=>r.saved-e.saved)})(e,2,3);if(0===r.length)return{compressed:e,sequences:!1};var t,n,o=[],a=new Array(e.length).fill(!1);for(t of r){let r=!0;for(let e=t.start;e<t.end;e++)if(a[e]){r=!1;break}if(r&&0<t.saved){o.push(t);for(let e=t.start;e<t.end;e++)a[e]=!0}}if(0===o.length)return{compressed:e,sequences:!1};let i="",s=0;for(n of o){s<n.start&&(i+=e.slice(s,n.start));var f=String.fromCharCode(Math.min(n.length,30)+32),c=String.fromCharCode(Math.min(n.count,65535)+32);i+=D+f+c+n.pattern,s=n.end}return s<e.length&&(i+=e.slice(s)),i.length<.9*e.length?{compressed:i,sequences:!0}:{compressed:e,sequences:!1}}let F={ESCAPE_BYTE:255,TOP_COUNT:254,SPLITTER:" ",compress(e,r=this.SPLITTER){var t,n={};for(t of e)n[t]=(n[t]||0)+1;var o,a,i=Object.entries(n).sort((e,r)=>r[1]-e[1]).slice(0,this.TOP_COUNT).map(e=>e[0]),s=new Map(i.map((e,r)=>[e,r])),i=String.fromCharCode(i.length)+i.join(""),f=[];for(o of e)s.has(o)?f.push(s.get(o)):(f.push(this.ESCAPE_BYTE),a=o.charCodeAt(0),f.push(a>>8&255),f.push(255&a));let c="";for(let e=0;e<f.length;e+=2){var l=f[e],u=e+1<f.length?f[e+1]:0;c+=String.fromCharCode(l<<8|u)}return i+r+c},decompress(e,r=this.SPLITTER){e=e.split(r);if(e.length<2)throw new Error(J+"Invalid freqMap data: splitter not found");var t=e[0],n=e.slice(1).join(r),o=t.charCodeAt(0),a=t.substring(1,o+1),i=[];for(let e=0;e<n.length;e++){var s=n.charCodeAt(e);i.push(s>>8&255),i.push(255&s)}let f="";for(let e=0;e<i.length;e++){var c,l=i[e];l===this.ESCAPE_BYTE?(c=i[e+1]<<8|i[e+2],f+=String.fromCharCode(c),e+=2):l<o&&(f+=a[l])}return f},test(e,r=this.SPLITTER){try{var t,n;return e.includes(r)?0:(t=this.compress(e,r),n=this.decompress(t,r),t.length<e.length?n==e?[1,t.length,r,t]:n.slice(0,-1)==e?[2,t.length,r,t]:0:0)}catch(e){return 0}}},z=[" ","\0","","","�","•","|§|","\ufeff"];async function compress(e,r){if("string"!=typeof e&&"object"!=typeof e&&"number"!=typeof e)throw new Error(J+"Invalid input.");let o={segmentation:!0,recursivecompression:!0,justc:!!x};if(r){if("object"!=typeof r)throw new Error(J+"Invalid options input.");for(var[t,n]of Object.entries(r))if(void 0!==n){if("boolean"!=typeof n)throw new Error(J+"Invalid options input.");t.toLowerCase()in o?o[t.toLowerCase()]=n:console.warn(J+`Unknown option: "${t}".`)}}let a=e,g=e,c=!1;if("number"==typeof g&&(c=!0,(g=g.toString()).includes(".")))throw new Error(J+"Invalid input.");let v=!1;function i(e){return e.replace(/(.)\1+/g,(e,r)=>r+e.length)}let C=-1;if("string"==typeof g)for(var s of k._begin)if(g.startsWith(s)){C=k._begin.indexOf(s),g=g.slice(s.length);break}let m=-1;async function f(r){try{var e=await x.stringify(r);return e&&"function"==typeof e.then?await e:e}catch(e){return await x.initialize(),x.stringify(r)}}if(-1==C)if("object"==typeof g&&Array.isArray(g))g=JSON.stringify(g).slice(1,-1),m=4;else if("object"==typeof g)try{m=o.justc?(p=await f(g),g=p,2):(g=JSON.stringify(g),6)}catch(e){r=new Error(J+"Invalid input.");throw new AggregateError([r,e],r.message)}else try{var l=JSON.parse(g);m=Array.isArray(l)?(g=g.slice(1,-1),3):(h=!!o.justc&&await f(l))&&h.length<g.length&&g==JSON.stringify(l)?(g=h,1):(g=g.slice(1,-1),5)}catch(e){}function S(e,r=!1){let t=!1,n=!1;if(/\d/.test(e)||(t=!0,e=i(e)),!r){r=N(e);if(r.sequences)return n=!0,[r.compressed,t,n]}return[e,t,n]}/\d/.test(g)||(g=i(g),v=!0);let y=async e=>{try{return await decompress(e,!0)===String(a)}catch{return!1}};e=[];/^\d+$/.test(g)&&(e.push(async()=>{var e=await((e=parseInt(g))<15?b(L(c?6:0,!1,!1,!1,-1,e+1,!1,m)):null);return e&&await y(e)?e:null}),e.push(async()=>{var e,r,t,n,o={A:10,B:11,C:12,D:13,E:14},a=[];for(e of g.replaceAll("10","A").replaceAll("11","B").replaceAll("12","C").replaceAll("13","D").replaceAll("14","E").split(""))/\d/.test(e)?a.push(H(parseInt(e),4)):a.push(H(o[e],4));let[i,s,f]=["",!1,!1];for(r of I(a,4))i+=String.fromCharCode(P((t=r.join(""),n=void 0,t.length<16?(n=4-q(t,4).length,H(15,4).repeat(n)+t):t)));return[i,s,f]=S(i),i=b(L(3,!1,c,s,-1,0,f,m))+i,await y(i)?i:null})),e.push(async()=>{var e=_(g);if(2!==e.max||2!==e.min)return null;let r=e.output,[t,n,o]=["",!1,!1];function a(e){t+=String.fromCharCode(e)}function i(e){r=r.slice(e)}for(;0<r.length;)if(1===r.length)a(r[0]),i(1);else if(r.length<3){for(var s of r)a(s);i(r.length)}else{var f=parseInt(String(r[0])+String(r[1])+String(r[2])),c=parseInt(String(r[0])+String(r[1]));E(f)?(a(f),i(3)):E(c)?(a(c),i(2)):(a(r[0]),i(1))}[t,n,o]=S(out);e=b(L(1,!1,v,n,C,0,o,m))+t;return await y(e)?e:null}),e.push(async()=>{var r;if(256<=_(g).maxCharCode)return null;let[t,e,n]=["",!1,!1];for(r of q(g,2)){let e="";for(var o of r)e+=H(o.charCodeAt(0),8);t+=String.fromCharCode(P(e))}[t,e,n]=S(t);var a=b(L(2,!1,v,e,C,0,n,m))+t;return await y(a)?a:null}),e.push(async()=>{var r,t,e=new k.use,n=g.split("");let o,a=NaN;for([r,t]of Object.entries(e)){var i,s=t(),f=(s.length=256,Array.from(s));let e=!0;for(i of n)if(!f.includes(i)){e=!1;break}if(e){o=t(),a=k._IDs[r.slice(4)];break}}if(o){var c={};for(let[e,r]of Object.entries(o))c[r]=e;var l,u,h,p=[],d=[];for(l of n)p.push(H(parseInt(c[l]),8));for(u of I(p,2))d.push(u.join("").padStart(16,"0"));let[e,r,t]=["",!1,!1];for(h of d)e+=String.fromCharCode(P(h));if([e,r,t]=S(e),e=b(L(5,!1,v,r,C,a,t,m))+e,await y(e))return e}return null}),e.push(async()=>{var e=[...new Set(g.split("").map(e=>e.charCodeAt(0)))];if(16<=e.length)return null;let r=e.map(e=>String.fromCharCode(e)).join(""),t=[];var n,[o,a]=[!1,!1];for(n of g)t.push(e.indexOf(n.charCodeAt(0))),4===t.length&&(r+=String.fromCharCode(P(t.map(e=>H(e,4)).join(""))),t=[]);t.length&&(r+=String.fromCharCode(P(t.map(e=>H(e,4)).join("").padStart(16,"1")))),[r,o,a]=S(r);o=b(L(4,!1,v,o,C,e.length,a,m))+r;return await y(o)?o:null}),e.push(async()=>{for(var e of z){e=F.test(g,e);if(Array.isArray(e)){var[,,r,t]=e,e=b(L(7,!1,!1,!1,-1,P((e[0]-1).toString()+H(z.indexOf(r),3))))+t;if(await y(e))return e}}return null}),e.push(async()=>{if("string"!=typeof g)return null;let e;try{e=new URL(k._begin[C]+g)}catch{return null}var r=e.href,t=/%[0-9A-Fa-f]{2}/.test(r),n=e.hostname.includes("xn--"),o=!!e.search,a=!!e.hash;let i=r.slice(k._begin[C].length);n&&"undefined"!=typeof punycode&&(e.hostname=punycode.toUnicode(e.hostname),i=e.href.slice(k._begin[C].length));var s=[];for(let e=0;e<i.length;e++){if("%"===i[e]&&e+2<i.length){var f=i.slice(e+1,e+3);if(/^[0-9A-Fa-f]{2}$/.test(f)){s.push(parseInt(f,16)),e+=2;continue}}s.push(i.charCodeAt(e))}r=1&s.length;r&&s.push(0);let c="";for(let e=0;e<s.length;e+=2)c+=String.fromCharCode(s[e]<<8|(s[e+1]??0));t=(t?1:0)|(n?2:0)|(o?4:0)|(a?8:0),n=!1,[c,n]=S(c,!0),o=b(L(8,!1,v,n,C,t,r,m))+c;return await y(o)?o:null}),o.segmentation&&e.push(async()=>{var e,r=(r=>{if("string"!=typeof r||0===r.length)return[];var t=[];let n=r[0];for(let e=1;e<r.length;e++){var o=r.charCodeAt(e-1),a=r.charCodeAt(e);128<Math.abs(a-o)?(t.push(n),n=r[e]):n+=r[e]}return n&&t.push(n),t})(g);if(r.length<2)return null;let t=r.length-2<15?"":String.fromCharCode(r.length-2);for(e of r){var n={...o,segmentation:!1},n=await compress(e,n);t=t+String.fromCharCode(e.length)+n}r=b(L(9,!1,v,o.justc,C,Math.min(r.length-2,15),o.recursivecompression,m))+t;return await y(r)?r:null});let u=g.match(/^(.{1,7}?)(?:\1)+$/);u&&e.push(async()=>{var e,r,t,n=u[1],o=g.length/n.length;return!(Math.floor(o)!=o||o<1||65550<o)&&([e,r,t]=["",!1,!1],[e,r,t]=S(n),n=b(L(10,!1,v,r,C,Math.min(o-1,15),t,m))+(14<o-1?String.fromCharCode(o-15):"")+e,await y(n))?n:null});var h,p=(await Promise.all(e.map(e=>(async e=>{try{return await e()}catch{return null}})(e)))).filter(e=>"string"==typeof e&&e.length<=String(g).length);let d;if(d=p.length?p.reduce((e,r)=>r.length<e.length?r:e):([r,l]=[!1,!1],[g,r,l]=S(h=g),await y(g)?b(L(0,!1,v,r,C,0,l,m))+g:b(L(0,!1,v,!1,C,0,!1,m))+h),o.recursivecompression)try{for(var A of p){var w=await(async(e,r)=>{if(!r.recursivecompression)return e;let t=e,n=0;for(;n<15;){n++;var o=await compress(t,{...r,recursivecompression:!1});if(o.length>=t.length)break;if(await decompress(o,!0)!==t)break;t=o}return 0===n?null:b(L(31,!1,!1,!1,-1,n,!1,-1))+t})(A,o);w&&w.length<=d.length&&await y(w)&&(d=w)}}catch(e){}return d}async function decompress(e,t=!1){if("string"!=typeof e)throw new Error(J+"Invalid input.");let n=L((e.charCodeAt(0)-32+65535)%65535,!0),o=n.code;function a(e){return e.replace(/(\D)(\d+)/g,(e,r,t)=>r.repeat(t))}let i=e.slice(1);async function s(e){var r;return 0<=n.beginId?k._begin[n.beginId]+e:1==n.code3||2==n.code3?(r=await(async r=>{try{var e=x.parse(r);return e&&"function"==typeof e.then?await e:e}catch(e){if("undefined"!=typeof window)try{await x.initialize();var t=x.parse(r);return t&&"function"==typeof t.then?await t:t}catch{}return null}})(e))&&"function"==typeof r.then?JSON.stringify(await r):JSON.stringify(r):e}async function f(e){let r=e;return r=n.repeatBefore&&3!=o?a(await s(e)):await s(e),n.repeatBefore&&3==o||30==o?r=parseInt(r):(3==n.code3||4==n.code3?r="["+r+"]":5==n.code3&&(r="{"+r+"}"),2!=n.code3&&4!=n.code3&&6!=n.code3||(r=JSON.parse(r))),t&&("object"==typeof r?r=JSON.stringify(r):"number"==typeof r&&(r=r.toString())),r}n.sequences&&8!=o&&9!=o&&(i=(e=>{let r="",t=0;for(;t<e.length;)if(56319===e.charCodeAt(t))if(++t+2>=e.length)r+=D;else{var n=e.charCodeAt(t)-32,o=e.charCodeAt(t+1)-32;if((t+=2)+n>e.length){r+=D+String.fromCharCode(32+n)+String.fromCharCode(32+o)+e.slice(t);break}var a=e.substr(t,n);t+=n;for(let e=0;e<o;e++)r+=a}else r+=e.charAt(t),t++;return r})(i)),n.repeatAfter&&9!=o&&(i=a(i));let r="";switch(o){case 0:case 6:return 0<n.code2?f(String(n.code2-1)):f(i);case 1:function c(e){r+=String.fromCharCode(e)}for(var l of i.split("")){var u,h=String(l.charCodeAt(0));if(2<h.length)for(u of q(h,2))c(parseInt(u));else c(l.charCodeAt(0))}return f(r);case 2:function p(e){return String.fromCharCode(P(e))}for(var d of i.split("")){var g,v=H(d.charCodeAt(0),16);8<H(d.charCodeAt(0),0).length?([v,g]=q(v,8),r+=p(v)+p(g)):(v=H(d.charCodeAt(0),8),r+=p(v))}return f(r);case 3:for(var C of i.split("")){var m;for(m of q(H(C.charCodeAt(0),16),4)){var S=P(m);15!=S&&(r+=S.toString(10))}}return f(r);case 4:var y,A,w,_,b=[];for(y of i.slice(0,n.code2).split(""))b.push(y);for(A of i.slice(n.code2).split(""))for(w of q(H(A.charCodeAt(0),16),4))"1111"!=w&&(_=P(w),r+=b[_]);return f(r);case 5:var E=((t,n)=>{var e,r,o,a={};for([e,r]of Object.entries(k._IDs))a[r]=e;if(t=a[t]){let r=(new k.use)[U+t](),e="";for(o of n.split("")){var i,s,f=o.charCodeAt();function c(e){return String(r[String(P(e))])}8<H(f,0).length?([s,i]=q(H(f,16),8),e+=c(s)+c(i)):(s=H(f,8),e+=c(s))}return e}})(n.code2,i);if(E)return f(E);throw new Error(J+"Invalid compressed string");case 7:E=z[P(H(n.code2).slice(1))];return r=F.decompress(i,E),f(r=1==parseInt(H(n.code2).slice(0,1))?r.slice(0,-1):r);case 8:{var I,N,j=[];for(I of i){var B=I.charCodeAt(0);j.push(B>>8&255,255&B)}n.sequences&&j.pop();let e="";for(N of j)e+=String.fromCharCode(N);return 1&n.code2&&(e=e.replace(/[\x00-\x20\x7F-\xFF]/g,e=>"%"+e.charCodeAt(0).toString(16).padStart(2,"0").toUpperCase())),2&n.code2&&"undefined"!=typeof punycode&&((E=new URL(e)).hostname=punycode.toASCII(E.hostname),e=E.href),f(e)}case 9:{let r=0;var O=n.code2<15?n.code2+2:i.charCodeAt(r++)+2;let t="";for(let e=0;e<O;e++){var T=i.charCodeAt(r++),T=(await decompress(i.slice(r),!0)).slice(0,T);t+=T,r+=(await compress(T,{segmentation:!1,justc:n.repeatAfter,recursivecompression:n.sequences})).length}return f(t)}case 10:var E=15==n.code2,R=E?i.charCodeAt(0)+15:n.code2;return f((i=E?i.slice(1):i).repeat(R));case 31:{let r=i;var M=n.code2;for(let e=0;e<M;e++){if(31===L(r.charCodeAt(0)-32,!0).code)throw new Error(J+"Attempt to nested recursive compression");r=await decompress(r,!0)}return r}default:throw new Error(J+"Invalid compressed string")}}var r={compress:compress,decompress:decompress,get[Symbol.toStringTag](){return U}};e.compress=compress,e.decompress=decompress,e.default=r,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
40
|
+
((e,r)=>{"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("justc")):"function"==typeof define&&define.amd?define(["exports","justc"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).JSSC={},e.JUSTC)})(this,function(e,x){let U="JSSC",J=U+": ";if(65536===String.fromCharCode(65536).charCodeAt(0)||256!==String.fromCharCode(256).charCodeAt(0))throw new Error(J+"Supported UTF-16 only!");function _(e){let r=[],t=0,n=0,o=1/0;return String(e).split("").forEach(e=>{e=e.charCodeAt();r.push(e),t=Math.max(t,e.toString().length),n=Math.max(n,e),o=Math.min(o,e.toString().length)}),{max:t,output:r,maxCharCode:n,min:o}}function b(e){return String.fromCharCode(e+32)}function E(e){return e%65535===e}function q(r,t){var n=[];for(let e=0;e<r.length;e+=t)n.push(r.slice(e,e+t));return n}function I(r,t){var n=[];for(let e=0;e<r.length;e+=t)n.push(r.slice(e,e+t));return n}function H(e,r){return e.toString(2).padStart(r,"0")}function P(e){return parseInt(e,2)}function o(){let r={};function t(e){r[e]=String.fromCharCode(e)}for(let e=0;e<65;e++)t(e);for(let e=91;e<97;e++)t(e);for(let e=123;e<128;e++)t(e);return r}function n(){var r={};for(let e=0;e<128;e++)r[e]=String.fromCharCode(e);return r}let k={};function L(e,r=!1,t=!1,n=!1,o=-1,a=0,i=!1,s=-1){var f,c,l;return r?(f=(r=H(e,16)).slice(8,11).split(""),c=P(r.slice(11)),l=P(r.slice(5,8)),{code:c,repeatBefore:"1"===f[0],repeatAfter:"1"===f[1],beginId:"1"===f[2]?l:-1,code2:P(r.slice(0,4)),sequences:"1"===r.slice(4,5),code3:"0"===f[2]?l:-1,bin:r}):P(H(a,4)+(i?"1":"0")+H(0<=o?o:s<0?0:s,3)+(t?"1":"0")+(n?"1":"0")+(0<=o?"1":"0")+H(e,5))}k._char=e=>String.fromCharCode(e),k._IDs={BASE:0,RU:1,ENRU:2,ENKK:3,HI:4,ENHI:5,BN:6,ENBN:7,HIBN:8,JA:9,Telu:10,MR:11,B:12,E:13,AR:14},k.BASE=function(){var e,r=o(),t=[215,247,8722,11800,174,169,171,10003,182,9834,183,10005,177,181,8960,8211,8212,8228,8229,8230,8240,8241,8249,8250,8252,8253,8263,8264,8267,8270,8274,8451,8457,8470,8471,8482,402,1423,1547,65020,2547,2553,2555,2801,3065,3647,6107,8499,2546,8304,185,178,179,8585,8319,8305,8709,8730,8734];for(let e=161;e<168;e++)t.push(e);for(let e=187;e<192;e++)t.push(e);for(let e=8308;e<8317;e++)t.push(e);for(let e=8528;e<8576;e++)t.push(e);for(let e=8352;e<8385;e++)t.push(e);for(let e=8320;e<8333;e++)t.push(e);for(let e=8712;e<8718;e++)t.push(e);let n=65;for(e of t)r[n++]=k._char(e),91===n?n=97:123===n&&(n=128);return r},k._BASE=[167,8722,8451,169,8211,215,247,8457,174,8470,8482,8471,8249,8250,171,187,8242,8245,8216,8217,8218,8219,8243,8246,8220,8221,8222,8223,8226,182,8267,8270,8240,8241,9834,183,8228,8229,8230,161,191,8252,8264],k._MATH=[8544,8547,8550,8553,8556,8572,8545,8548,8551,8554,8557,8573,8546,8549,8552,8555,8558,8574,8560,8563,8566,8569,8559,8575,8561,8564,8567,8570,8562,8565,8568,8571,8712,8715,8713,8716,8730,8721,8734,8804,8805],k._CURR=[165,3647,8363,8361,1423,8364,8377,8362,8378,8353,8358,163,8381,8354,8369,2547,8370,8366,8376,8382,8357,6107,8360,8372,8373,8365,1547,2801,162,65020,8355,8383,8380,3065,164,8384,8379,402,8359,2546,8371,8367,8356,8375,2553,8368,8352,8499,8374,2555],k._RU=function(e){var r=e();let t=0;for(let e=1040;e<1104;e++){var n=e-912;r[n]=k._char(e),t=Math.max(t,n)}return r[t+1]=k._char(1025),r[t+2]=k._char(1105),r},k.RU=function(){var e,r=k._RU(o);let t=65;for(e of k._BASE.concat(k._MATH,[105,239,1028,1030,1031,1108,1110,1111,1118,1038,1241,1181,1171,1199,1201,1179,1257,1211,1240,1186,1170,1198,1200,1178,1256,1210,8381,8364,165,8376,8372]))r[t++]=k._char(e),91===t?t=97:123===t&&(t=193);return r[110]="i",r[111]="I",r},k.ENRU=function(){var e,r=k._RU(n);let t=194;for(e of k._BASE.concat([105,239,1028,1030,1031,1108,1110,1111,1118,1038,8381,8364,165,8376,8372,163,8380],[215,247]))r[t++]=k._char(e);return r},k.ENKK=function(){var e,r=k._RU(n);let t=194;for(e of k._BASE.concat([1241,1181,1171,1199,1201,1179,1257,1211,1240,1186,1170,1198,1200,1178,1256,1210,8381,163,8376]))r[t++]=k._char(e);return r},k._HI=function(e){var r=e();for(let e=2304;e<2432;e++)r[e-2176]=k._char(e);return r},k._Ind=[8377,8360,78,2547,2404,215,247],k.HI=function(){var e,r=k._HI(o);let t=65;for(e of k._BASE.concat(k._Ind))r[t++]=k._char(e),91===t&&(t=97);return r},k.ENHI=function(){return k._HI(n)},k._BN=function(e){var r=e();for(let e=2432;e<2559;e++)r[e-2304]=k._char(e);return r[255]=k._char(2404),r},k.BN=function(){var e,r=k._BN(o);let t=65;for(e of k._BASE.concat(k._Ind))r[t++]=k._char(e),91===t&&(t=97);return r},k.ENBN=function(){return k._BN(n)},k.HIBN=function(){var r={};for(let e=2304;e<2559;e++)r[e-2176-128]=k._char(e);return r[255]=" ",r},k._JA=[[65371,65373,65288,65289,65339,65341,12304,12305,12289,65292,12290,12349,12300,12301,12302,12303,12288,12316,65306,65281,65311,12445,12541,183],[8230,8229,165]],k.JA=function(){var e,r=n();let t=128;for(e of k._JA[0].concat(Array.from({length:46},(e,r)=>r+12352),Array.from({length:46},(e,r)=>r+12448),k._JA[1],[19968,20108,19977,22235,20116,20845,19971,20843,20061]))r[t++]=k._char(e);return r[17]=k._char(21313),r[18]=k._char(30334),r[19]=k._char(21315),r[20]=k._char(19975),r},k.Telu=function(){var e,r=n();for(let e=3073;e<3184;e++)r[e-2945]=k._char(e);let t=239;for(e of k._Ind.concat([8364,163,162,165,167,169,174,8482,8240,8241]))r[t++]=k._char(e);return r},k.MR=function(){var r=n();for(let e=2304;e<2432;e++)r[e-2176]=k._char(e);return r},k.B=function(){var r=n();for(let e=256;e<383;e++)r[e-128]=k._char(e);return r[255]=k._char(383),r},k.E=function(){var r=n();for(let e=128;e<255;e++)r[e]=k._char(e);return r[255]=k._char(383),r},k.AR=function(){var r={};for(let e=1536;e<1791;e++)r[e-1536]=k._char(e);return r},k.use=class{constructor(){var e,r,t={};for([e,r]of Object.entries(k))"function"!=typeof r||e.startsWith("_")||"use"==e||(t[U+e]=r);return Object.freeze(t),t}},k._begin=["https://","http://","file://","mailto:","ftp://","data:","tel:","sms:"],Object.freeze(k.use);let D="\udbff";function j(e){if(e.length<20)return{compressed:e,sequences:!1};if(e.includes(D))return{compressed:e,sequences:!1};var r=((o,e,a)=>{var i=[],s=o.length;for(let n=0;n<s-e*a+1;n++)for(let t=2;t<=Math.min(30,Math.floor((s-n)/a));t++){var f=o.substr(n,t);if(!f.includes(D)){let r=1;for(let e=n+t;e<=s-t&&o.substr(e,t)===f;e+=t)r++;if(r>=a){var c,l=n+t*r;let e=!1;for(c of i)if(n<c.end&&l>c.start){e=!0;break}if(!e){i.push({start:n,end:l,length:t,pattern:f,count:r,saved:t*r-(t+3)}),n=l-1;break}}}}return i.sort((e,r)=>r.saved-e.saved)})(e,2,3);if(0===r.length)return{compressed:e,sequences:!1};var t,n,o=[],a=new Array(e.length).fill(!1);for(t of r){let r=!0;for(let e=t.start;e<t.end;e++)if(a[e]){r=!1;break}if(r&&0<t.saved){o.push(t);for(let e=t.start;e<t.end;e++)a[e]=!0}}if(0===o.length)return{compressed:e,sequences:!1};let i="",s=0;for(n of o){s<n.start&&(i+=e.slice(s,n.start));var f=String.fromCharCode(Math.min(n.length,30)+32),c=String.fromCharCode(Math.min(n.count,65535)+32);i+=D+f+c+n.pattern,s=n.end}return s<e.length&&(i+=e.slice(s)),i.length<.9*e.length?{compressed:i,sequences:!0}:{compressed:e,sequences:!1}}let F={ESCAPE_BYTE:255,TOP_COUNT:254,SPLITTER:" ",compress(e,r=this.SPLITTER){var t,n={};for(t of e)n[t]=(n[t]||0)+1;var o,a,i=Object.entries(n).sort((e,r)=>r[1]-e[1]).slice(0,this.TOP_COUNT).map(e=>e[0]),s=new Map(i.map((e,r)=>[e,r])),i=String.fromCharCode(i.length)+i.join(""),f=[];for(o of e)s.has(o)?f.push(s.get(o)):(f.push(this.ESCAPE_BYTE),a=o.charCodeAt(0),f.push(a>>8&255),f.push(255&a));let c="";for(let e=0;e<f.length;e+=2){var l=f[e],u=e+1<f.length?f[e+1]:0;c+=String.fromCharCode(l<<8|u)}return i+r+c},decompress(e,r=this.SPLITTER){e=e.split(r);if(e.length<2)throw new Error(J+"Invalid freqMap data: splitter not found");var t=e[0],n=e.slice(1).join(r),o=t.charCodeAt(0),a=t.substring(1,o+1),i=[];for(let e=0;e<n.length;e++){var s=n.charCodeAt(e);i.push(s>>8&255),i.push(255&s)}let f="";for(let e=0;e<i.length;e++){var c,l=i[e];l===this.ESCAPE_BYTE?(c=i[e+1]<<8|i[e+2],f+=String.fromCharCode(c),e+=2):l<o&&(f+=a[l])}return f},test(e,r=this.SPLITTER){try{var t,n;return e.includes(r)?0:(t=this.compress(e,r),n=this.decompress(t,r),t.length<e.length?n==e?[1,t.length,r,t]:n.slice(0,-1)==e?[2,t.length,r,t]:0:0)}catch(e){return 0}}},z=[" ","\0","","","�","•","|§|","\ufeff"];async function compress(e,r){if("string"!=typeof e&&"object"!=typeof e&&"number"!=typeof e)throw new Error(J+"Invalid input.");let o={segmentation:!0,recursivecompression:!0,justc:!!x};if(r){if("object"!=typeof r)throw new Error(J+"Invalid options input.");for(var[t,n]of Object.entries(r))if(void 0!==n){if("boolean"!=typeof n)throw new Error(J+"Invalid options input.");t.toLowerCase()in o?o[t.toLowerCase()]=n:console.warn(J+`Unknown option: "${t}".`)}}let a=e,g=e,c=!1;if("number"==typeof g&&(c=!0,(g=g.toString()).includes(".")))throw new Error(J+"Invalid input.");let v=!1;function i(e){return e.replace(/(.)\1+/g,(e,r)=>r+e.length)}let C=-1;if("string"==typeof g)for(var s of k._begin)if(g.startsWith(s)){C=k._begin.indexOf(s),g=g.slice(s.length);break}let m=-1;async function f(r){try{var e=await x.stringify(r);return e&&"function"==typeof e.then?await e:e}catch(e){return await x.initialize(),x.stringify(r)}}if(-1==C)if("object"==typeof g&&Array.isArray(g))g=JSON.stringify(g).slice(1,-1),m=4;else if("object"==typeof g)try{m=o.justc?(p=await f(g),g=p,2):(g=JSON.stringify(g),6)}catch(e){r=new Error(J+"Invalid input.");throw new AggregateError([r,e],r.message)}else try{var l=JSON.parse(g);m=Array.isArray(l)?(g=g.slice(1,-1),3):(h=!!o.justc&&await f(l))&&h.length<g.length&&g==JSON.stringify(l)?(g=h,1):(g=g.slice(1,-1),5)}catch(e){}function S(e,r=!1){let t=!1,n=!1;if(/\d/.test(e)||(t=!0,e=i(e)),!r){r=j(e);if(r.sequences)return n=!0,[r.compressed,t,n]}return[e,t,n]}/\d/.test(g)||(g=i(g),v=!0);let y=async e=>{try{return await decompress(e,!0)===String(a)}catch{return!1}};e=[];/^\d+$/.test(g)&&(e.push(async()=>{var e=await((e=parseInt(g))<15?b(L(c?6:0,!1,!1,!1,-1,e+1,!1,m)):null);return e&&await y(e)?e:null}),e.push(async()=>{var e,r,t,n,o={A:10,B:11,C:12,D:13,E:14},a=[];for(e of g.replaceAll("10","A").replaceAll("11","B").replaceAll("12","C").replaceAll("13","D").replaceAll("14","E").split(""))/\d/.test(e)?a.push(H(parseInt(e),4)):a.push(H(o[e],4));let[i,s,f]=["",!1,!1];for(r of I(a,4))i+=String.fromCharCode(P((t=r.join(""),n=void 0,t.length<16?(n=4-q(t,4).length,H(15,4).repeat(n)+t):t)));return[i,s,f]=S(i),i=b(L(3,!1,c,s,-1,0,f,m))+i,await y(i)?i:null})),e.push(async()=>{var e=_(g);if(2!==e.max||2!==e.min)return null;let r=e.output,[t,n,o]=["",!1,!1];function a(e){t+=String.fromCharCode(e)}function i(e){r=r.slice(e)}for(;0<r.length;)if(1===r.length)a(r[0]),i(1);else if(r.length<3){for(var s of r)a(s);i(r.length)}else{var f=parseInt(String(r[0])+String(r[1])+String(r[2])),c=parseInt(String(r[0])+String(r[1]));E(f)?(a(f),i(3)):E(c)?(a(c),i(2)):(a(r[0]),i(1))}[t,n,o]=S(out);e=b(L(1,!1,v,n,C,0,o,m))+t;return await y(e)?e:null}),e.push(async()=>{var r;if(256<=_(g).maxCharCode)return null;let[t,e,n]=["",!1,!1];for(r of q(g,2)){let e="";for(var o of r)e+=H(o.charCodeAt(0),8);t+=String.fromCharCode(P(e))}[t,e,n]=S(t);var a=b(L(2,!1,v,e,C,0,n,m))+t;return await y(a)?a:null}),e.push(async()=>{var r,t,e=new k.use,n=g.split("");let o,a=NaN;for([r,t]of Object.entries(e)){var i,s=t(),f=(s.length=256,Array.from(s));let e=!0;for(i of n)if(!f.includes(i)){e=!1;break}if(e){o=t(),a=k._IDs[r.slice(4)];break}}if(o){var c={};for(let[e,r]of Object.entries(o))c[r]=e;var l,u,h,p=[],d=[];for(l of n)p.push(H(parseInt(c[l]),8));for(u of I(p,2))d.push(u.join("").padStart(16,"0"));let[e,r,t]=["",!1,!1];for(h of d)e+=String.fromCharCode(P(h));if([e,r,t]=S(e),e=b(L(5,!1,v,r,C,a,t,m))+e,await y(e))return e}return null}),e.push(async()=>{var e=[...new Set(g.split("").map(e=>e.charCodeAt(0)))];if(16<=e.length)return null;let r=e.map(e=>String.fromCharCode(e)).join(""),t=[];var n,[o,a]=[!1,!1];for(n of g)t.push(e.indexOf(n.charCodeAt(0))),4===t.length&&(r+=String.fromCharCode(P(t.map(e=>H(e,4)).join(""))),t=[]);t.length&&(r+=String.fromCharCode(P(t.map(e=>H(e,4)).join("").padStart(16,"1")))),[r,o,a]=S(r);o=b(L(4,!1,v,o,C,e.length,a,m))+r;return await y(o)?o:null}),e.push(async()=>{for(var e of z){e=F.test(g,e);if(Array.isArray(e)){var[,,r,t]=e,e=b(L(7,!1,!1,!1,-1,P((e[0]-1).toString()+H(z.indexOf(r),3))))+t;if(await y(e))return e}}return null}),e.push(async()=>{if("string"!=typeof g)return null;let e;try{e=new URL(k._begin[C]+g)}catch{return null}var r=e.href,t=/%[0-9A-Fa-f]{2}/.test(r),n=e.hostname.includes("xn--"),o=!!e.search,a=!!e.hash;let i=r.slice(k._begin[C].length);n&&"undefined"!=typeof punycode&&(e.hostname=punycode.toUnicode(e.hostname),i=e.href.slice(k._begin[C].length));var s=[];for(let e=0;e<i.length;e++){if("%"===i[e]&&e+2<i.length){var f=i.slice(e+1,e+3);if(/^[0-9A-Fa-f]{2}$/.test(f)){s.push(parseInt(f,16)),e+=2;continue}}s.push(i.charCodeAt(e))}r=1&s.length;r&&s.push(0);let c="";for(let e=0;e<s.length;e+=2)c+=String.fromCharCode(s[e]<<8|(s[e+1]??0));t=(t?1:0)|(n?2:0)|(o?4:0)|(a?8:0),n=!1,[c,n]=S(c,!0),o=b(L(8,!1,v,n,C,t,r,m))+c;return await y(o)?o:null}),o.segmentation&&e.push(async()=>{var e,r=(r=>{if("string"!=typeof r||0===r.length)return[];var t=[];let n=r[0];for(let e=1;e<r.length;e++){var o=r.charCodeAt(e-1),a=r.charCodeAt(e);128<Math.abs(a-o)?(t.push(n),n=r[e]):n+=r[e]}return n&&t.push(n),t})(g);if(r.length<2)return null;let t=r.length-2<15?"":String.fromCharCode(r.length-2);for(e of r){var n={...o,segmentation:!1},n=await compress(e,n);t=t+String.fromCharCode(e.length)+n}r=b(L(9,!1,v,o.justc,C,Math.min(r.length-2,15),o.recursivecompression,m))+t;return await y(r)?r:null});let u=g.match(/^(.{1,7}?)(?:\1)+$/);u&&e.push(async()=>{var e,r,t,n=u[1],o=g.length/n.length;return!(Math.floor(o)!=o||o<1||65550<o)&&([e,r,t]=["",!1,!1],[e,r,t]=S(n),n=b(L(10,!1,v,r,C,Math.min(o-1,15),t,m))+(14<o-1?String.fromCharCode(o-15):"")+e,await y(n))?n:null});var h,p=(await Promise.all(e.map(e=>(async e=>{try{return await e()}catch{return null}})(e)))).filter(e=>"string"==typeof e&&e.length<=String(g).length);let d;if(d=p.length?p.reduce((e,r)=>r.length<e.length?r:e):([r,l]=[!1,!1],[g,r,l]=S(h=g),await y(g)?b(L(0,!1,v,r,C,0,l,m))+g:b(L(0,!1,v,!1,C,0,!1,m))+h),o.recursivecompression)try{for(var A of p){var w=await(async(e,r)=>{if(!r.recursivecompression)return e;let t=e,n=0;for(;n<15;){n++;var o=await compress(t,{...r,recursivecompression:!1});if(o.length>=t.length)break;if(await decompress(o,!0)!==t)break;t=o}return 0===n?null:b(L(31,!1,!1,!1,-1,n,!1,-1))+t})(A,o);w&&w.length<=d.length&&await y(w)&&(d=w)}}catch(e){}return d}async function decompress(e,t=!1){if("string"!=typeof e)throw new Error(J+"Invalid input.");let n=L((e.charCodeAt(0)-32+65535)%65535,!0),o=n.code;function a(e){return e.replace(/(\D)(\d+)/g,(e,r,t)=>r.repeat(t))}let i=e.slice(1);async function s(e){var r;return 0<=n.beginId?k._begin[n.beginId]+e:1==n.code3||2==n.code3?(r=await(async r=>{try{var e=x.parse(r);return e&&"function"==typeof e.then?await e:e}catch(e){if("undefined"!=typeof window)try{await x.initialize();var t=x.parse(r);return t&&"function"==typeof t.then?await t:t}catch{}return null}})(e))&&"function"==typeof r.then?JSON.stringify(await r):JSON.stringify(r):e}async function f(e){let r=e;return r=n.repeatBefore&&3!=o?a(await s(e)):await s(e),n.repeatBefore&&3==o||30==o?r=parseInt(r):(3==n.code3||4==n.code3?r="["+r+"]":5==n.code3&&(r="{"+r+"}"),2!=n.code3&&4!=n.code3&&6!=n.code3||(r=JSON.parse(r))),t&&("object"==typeof r?r=JSON.stringify(r):"number"==typeof r&&(r=r.toString())),r}n.sequences&&8!=o&&9!=o&&(i=(e=>{let r="",t=0;for(;t<e.length;)if(56319===e.charCodeAt(t))if(++t+2>=e.length)r+=D;else{var n=e.charCodeAt(t)-32,o=e.charCodeAt(t+1)-32;if((t+=2)+n>e.length){r+=D+String.fromCharCode(32+n)+String.fromCharCode(32+o)+e.slice(t);break}var a=e.substr(t,n);t+=n;for(let e=0;e<o;e++)r+=a}else r+=e.charAt(t),t++;return r})(i)),n.repeatAfter&&9!=o&&(i=a(i));let r="";switch(o){case 0:case 6:return 0<n.code2?f(String(n.code2-1)):f(i);case 1:function c(e){r+=String.fromCharCode(e)}for(var l of i.split("")){var u,h=String(l.charCodeAt(0));if(2<h.length)for(u of q(h,2))c(parseInt(u));else c(l.charCodeAt(0))}return f(r);case 2:function p(e){return String.fromCharCode(P(e))}for(var d of i.split("")){var g,v=H(d.charCodeAt(0),16);8<H(d.charCodeAt(0),0).length?([v,g]=q(v,8),r+=p(v)+p(g)):(v=H(d.charCodeAt(0),8),r+=p(v))}return f(r);case 3:for(var C of i.split("")){var m;for(m of q(H(C.charCodeAt(0),16),4)){var S=P(m);15!=S&&(r+=S.toString(10))}}return f(r);case 4:var y,A,w,_,b=[];for(y of i.slice(0,n.code2).split(""))b.push(y);for(A of i.slice(n.code2).split(""))for(w of q(H(A.charCodeAt(0),16),4))"1111"!=w&&(_=P(w),r+=b[_]);return f(r);case 5:var E=((t,n)=>{var e,r,o,a={};for([e,r]of Object.entries(k._IDs))a[r]=e;if(t=a[t]){let r=(new k.use)[U+t](),e="";for(o of n.split("")){var i,s,f=o.charCodeAt();function c(e){return String(r[String(P(e))])}8<H(f,0).length?([s,i]=q(H(f,16),8),e+=c(s)+c(i)):(s=H(f,8),e+=c(s))}return e}})(n.code2,i);if(E)return f(E);throw new Error(J+"Invalid compressed string");case 7:E=z[P(H(n.code2).slice(1))];return r=F.decompress(i,E),f(r=1==parseInt(H(n.code2).slice(0,1))?r.slice(0,-1):r);case 8:{var I,j,N=[];for(I of i){var B=I.charCodeAt(0);N.push(B>>8&255,255&B)}n.sequences&&N.pop();let e="";for(j of N)e+=String.fromCharCode(j);return 1&n.code2&&(e=e.replace(/[\x00-\x20\x7F-\xFF]/g,e=>"%"+e.charCodeAt(0).toString(16).padStart(2,"0").toUpperCase())),2&n.code2&&"undefined"!=typeof punycode&&((E=new URL(e)).hostname=punycode.toASCII(E.hostname),e=E.href),f(e)}case 9:{let r=0;var O=n.code2<15?n.code2+2:i.charCodeAt(r++)+2;let t="";for(let e=0;e<O;e++){var T=i.charCodeAt(r++),T=(await decompress(i.slice(r),!0)).slice(0,T);t+=T,r+=(await compress(T,{segmentation:!1,justc:n.repeatAfter,recursivecompression:n.sequences})).length}return f(t)}case 10:var E=15==n.code2,R=E?i.charCodeAt(0)+15:n.code2;return f((i=E?i.slice(1):i).repeat(R));case 31:{let r=i;var M=n.code2;for(let e=0;e<M;e++){if(31===L(r.charCodeAt(0)-32,!0).code)throw new Error(J+"Attempt to nested recursive compression");r=await decompress(r,!0)}return r}default:throw new Error(J+"Invalid compressed string")}}var r={compress:compress,decompress:decompress,get[Symbol.toStringTag](){return U}};e.compress=compress,e.decompress=decompress,e.default=r,Object.defineProperty(e,"__esModule",{value:!0})});
|
package/package.json
CHANGED
package/src/index.js
CHANGED