compressed-script-loader 1.0.2
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/LICENSE +21 -0
- package/README.md +3 -0
- package/compressed-script-loader.d.ts +13 -0
- package/package.json +34 -0
- package/umd/index.js +11 -0
- package/umd/index.js.LICENSE.txt +7 -0
- package/unzip-sync.d.ts +22 -0
- package/webpack/index.js +10 -0
- package/webpack/index.js.LICENSE.txt +7 -0
- package/webpack-esm/index.mjs +10 -0
- package/webpack-esm/index.mjs.LICENSE.txt +7 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 jeffy-g
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
3
|
+
Copyright (C) 2022 jeffy-g <hirotom1107@gmail.com>
|
|
4
|
+
Released under the MIT license
|
|
5
|
+
https://opensource.org/licenses/mit-license.php
|
|
6
|
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
|
+
*/
|
|
8
|
+
import * as Uz from "./unzip-sync";
|
|
9
|
+
declare let unzipSync: typeof Uz.unzipSync;
|
|
10
|
+
declare let cleanUp: () => void;
|
|
11
|
+
declare let setConfig: (base: string, testSource: string, insertionSelector?: string | undefined) => void;
|
|
12
|
+
declare let loadCompressedScript: (baseName: string, log?: (msg: string) => void) => Promise<void>;
|
|
13
|
+
export { setConfig, loadCompressedScript, cleanUp, unzipSync };
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "compressed-script-loader",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "A lightweight module project",
|
|
5
|
+
"private": false,
|
|
6
|
+
"main": "./webpack/index.js",
|
|
7
|
+
"module": "./webpack-esm/index.mjs",
|
|
8
|
+
"unpkg": "./umd/index.js",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"types": "./compressed-script-loader.d.ts",
|
|
11
|
+
"author": "jeffy-g",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/jeffy-g/compressed-script-loader/issues"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/jeffy-g/compressed-script-loader#readme",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/jeffy-g/compressed-script-loader.git"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"package.json",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"umd",
|
|
26
|
+
"webpack",
|
|
27
|
+
"webpack-esm",
|
|
28
|
+
"*.d.ts"
|
|
29
|
+
],
|
|
30
|
+
"keywords": [
|
|
31
|
+
"javascript",
|
|
32
|
+
"typescript"
|
|
33
|
+
]
|
|
34
|
+
}
|
package/umd/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
+
!function(e,t){'object'==typeof exports&&'object'==typeof module?module.exports=t():'function'==typeof define&&define.amd?define([],t):'object'==typeof exports?exports.NsLoader=t():e.NsLoader=t()}(globalThis,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(e,'__esModule',{value:!0})}},t={};e.r(t),e.d(t,{cleanUp:()=>F,loadCompressedScript:()=>I,setConfig:()=>q,unzipSync:()=>D})
|
|
3
|
+
;const n=Uint8Array,o=Uint16Array,r=Uint32Array,c=new n([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new n([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),i=new n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=(e,t)=>{const n=new o(31);for(let o=0;o<31;++o)n[o]=t+=1<<e[o-1];const c=new r(n[30]);for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)c[t]=t-n[e]<<5|e;return[n,c]},[l,f]=a(c,2);l[28]=258,f[258]=28;const[d,u]=a(s,0),g=new o(32768);for(let e=0;e<32768;++e){let t=(43690&e)>>>1|(21845&e)<<1;t=(52428&t)>>>2|(13107&t)<<2,t=(61680&t)>>>4|(3855&t)<<4,g[e]=((65280&t)>>>8|(255&t)<<8)>>>1}const y=(e,t,n)=>{const r=e.length;let c=0;const s=new o(t);for(;c<r;++c)e[c]&&++s[e[c]-1];const i=new o(t);for(c=0;c<t;++c)i[c]=i[c-1]+s[c-1]<<1;let a
|
|
4
|
+
;if(n){a=new o(1<<t);const n=15-t;for(c=0;c<r;++c)if(e[c]){const o=c<<4|e[c],r=t-e[c];let s=i[e[c]-1]++<<r;for(const e=s|(1<<r)-1;s<=e;++s)a[g[s]>>>n]=o}}else for(a=new o(r),c=0;c<r;++c)e[c]&&(a[c]=g[i[e[c]-1]++]>>>15-e[c]);return a},h=new n(288);for(let e=0;e<144;++e)h[e]=8;for(let e=144;e<256;++e)h[e]=9;for(let e=256;e<280;++e)h[e]=7;for(let e=280;e<288;++e)h[e]=8;const p=new n(32);for(let e=0;e<32;++e)p[e]=5;const b=y(h,9,1),m=y(p,5,1),w=e=>{let t=e[0];for(let n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},S=(e,t,n)=>{const o=t/8|0;return(e[o]|e[o+1]<<8)>>(7&t)&n},v=(e,t)=>{const n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},E=(e,t,c)=>{(null==t||t<0)&&(t=0),(null==c||c>e.length)&&(c=e.length);const s=new(2==e.BYTES_PER_ELEMENT?o:4==e.BYTES_PER_ELEMENT?r:n)(c-t)
|
|
5
|
+
;return s.set(e.subarray(t,c)),s},C=['unexpected EOF','invalid block type','invalid length/literal','invalid distance','stream finished','no stream handler',,'no callback','invalid UTF-8 data','extra field too long','date not in range 1980-2099','filename too long','stream finishing','invalid zip data'],x=(e,t,n)=>{const o=new Error(t||C[e]);if(o.code=e,Error.captureStackTrace&&Error.captureStackTrace(o,x),!n)throw o;return o},T=(e,t)=>e[t]|e[t+1]<<8,k=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,$=(e,t)=>k(e,t)+4294967296*k(e,t+4),j=(e,t)=>t+30+T(e,t+26)+T(e,t+28),L=(e,t,n)=>{const o=!(2048&T(e,t+8)),r=T(e,t+28),c=P(e.subarray(t+46,t+46+r),o),s=t+46+r,i=k(e,t+20),[a,l,f]=n&&4294967295==i?z(e,s):[i,k(e,t+24),k(e,t+42)],d=s+T(e,t+30)
|
|
6
|
+
;return[T(e,t+10),a,l,c,s+T(e,t+30)+T(e,t+32),f,P(e.subarray(d,d+T(e,t+32)),o)]},z=(e,t)=>{for(;1!=T(e,t);t+=4+T(e,t+2));return[$(e,t+12),$(e,t+4),$(e,t+20)]};let M;const O=new n(0);try{const e=new TextDecoder;e.decode(O,{stream:!0}),M=e}catch(e){}function P(e,t){if(t){let t="";for(let n=0;n<e.length;n+=16384)t+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return t}if(M)return M.decode(e);{const[t,n]=(e=>{for(let t='',n=0;;){let o=e[n++];const r=+(o>127)+ +(o>223)+ +(o>239);if(n+r>e.length)return[t,E(e,n-1)];r?3==r?(o=((15&o)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|o>>10,56320|1023&o)):t+=1&r?String.fromCharCode((31&o)<<6|63&e[n++]):String.fromCharCode((15&o)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(o)}})(e)
|
|
7
|
+
;return n.length&&x(8),t}}function U(e,t){return((e,t,o)=>{const r=e.length;if(!r||o&&o.f&&!o.l)return t||new n(0);const a=!t||o,f=!o||o.i;o||(o={}),t||(t=new n(3*r));const u=e=>{let o=t.length;if(e>o){const r=new n(Math.max(2*o,e));r.set(t),t=r}};let g=o.f||0,h=o.p||0,p=o.b||0,C=o.l,T=o.d,k=o.m,$=o.n;const j=8*r;do{if(!C){g=S(e,h,1);const c=S(e,h+1,3);if(h+=3,!c){const n=4+((h+7)/8|0),c=e[n-4]|e[n-3]<<8,s=n+c;if(s>r){f&&x(0);break}a&&u(p+c),t.set(e.subarray(n,s),p),o.b=p+=c,o.p=h=8*s,o.f=g;continue}if(1==c)C=b,T=m,k=9,$=5;else if(2==c){const t=S(e,h,31)+257,o=S(e,h+10,15)+4,r=t+S(e,h+5,31)+1;h+=14;const c=new n(r),s=new n(19);for(let t=0;t<o;++t)s[i[t]]=S(e,h+3*t,7);h+=3*o;const a=w(s),l=(1<<a)-1,f=y(s,a,1);for(let t=0;t<r;){const n=f[S(e,h,l)];h+=15&n;const o=n>>>4;if(o<16)c[t++]=o;else{
|
|
8
|
+
let n=0,r=0;for(16==o?(r=3+S(e,h,3),h+=2,n=c[t-1]):17==o?(r=3+S(e,h,7),h+=3):18==o&&(r=11+S(e,h,127),h+=7);r--;)c[t++]=n}}const d=c.subarray(0,t),u=c.subarray(t);k=w(d),$=w(u),C=y(d,k,1),T=y(u,$,1)}else x(1);if(h>j){f&&x(0);break}}a&&u(p+131072);const E=(1<<k)-1,L=(1<<$)-1;let z=h;for(;;z=h){const n=C[v(e,h)&E],o=n>>>4;if(h+=15&n,h>j){f&&x(0);break}if(n||x(2),o<256)t[p++]=o;else{if(256==o){z=h,C=void 0;break}{let n=o-254;if(o>264){const t=o-257,r=c[t];n=S(e,h,(1<<r)-1)+l[t],h+=r}const r=T[v(e,h)&L],i=r>>>4;r||x(3),h+=15&r;let g=d[i];if(i>3){const t=s[i];g+=v(e,h)&(1<<t)-1,h+=t}if(h>j){f&&x(0);break}a&&u(p+131072);const y=p+n;for(;p<y;p+=4)t[p]=t[p-g],t[p+1]=t[p+1-g],t[p+2]=t[p+2-g],t[p+3]=t[p+3-g];p=y}}}o.l=C,o.p=z,o.b=p,o.f=g,C&&(g=1,o.m=k,o.d=T,o.n=$)}while(!g)
|
|
9
|
+
;return p==t.length?t:E(t,0,p)})(e,t)}let _,A,N,B,R=new TextDecoder,D=function(e,t){const o={};let r=e.length-22;for(;101010256!=k(e,r);--r)(!r||e.length-r>65558)&&x(13);let c=T(e,r+8);if(!c)return{};let s=k(e,r+16);const i=4294967295==s;i&&(r=k(e,r-12),101075792!=k(e,r)&&x(13),c=k(e,r+32),s=k(e,r+48));const a=t&&t.filter;for(let t=0;t<c;++t){const[t,r,c,l,f,d,u]=L(e,s,i),g=j(e,d);if(s=f,!a||a({name:l,size:r,originalSize:c,compression:t})){let s;t?8===t?s=U(e.subarray(g,g+r),new n(c)):x(14,'unknown compression type '+t):s=E(e,g,g+r),s&&(o[l]={data:s,comment:u})}}return o},F=()=>{R=void 0,G=H=Y=void 0,q=I=F=void 0,_=N=A=void 0,D=void 0},Y=async()=>fetch(A).then((e=>{const t=e.headers.get("content-encoding");B="gzip"===t||"br"===t})),q=(e,t,n)=>{_=e,A=t,N=n||""},G=async(e,t,n)=>{let o="",r=0
|
|
10
|
+
;for(;;){const c=await e.read();if(c.done)return n(`done ${t}: ${r.toLocaleString()} bytes 😃`),void H(o,t);const s=c.value;o+=R.decode(s),n(`extract ${t}: ${(r+=s.length).toLocaleString()} bytes`)}},H=(e,t,n)=>{const o=document.createElement("script"),r=N?document.querySelector(N).nextSibling:document.head.lastElementChild;document.head.insertBefore(o,r),n&&(o.integrity=n),o.id=t,o.text=e},I=async(e,t=console.log)=>{void 0===B&&await Y();const n=e+".js",o=await fetch(`${_}/${e}.${B?"js":"zip"}`).then((async e=>{const o=e.body.getReader();if(B)return G(o,n,t);{const n=+e.headers.get("content-length"),r=new Uint8Array(n);let c=0;for(;;){const e=await o.read();if(e.done)break;r.set(e.value,c),c+=e.value.length,t(`loading script: ${c.toLocaleString()} bytes(${Math.round(c/n*100)}%)`)}return r
|
|
11
|
+
}}));if(o){t(`loaded script ${n}, decompressing binary...`);const e=D(o);t(`${n} decompressed 😃`);const r=e[n];H(R.decode(r.data,{stream:!1}),n,r.comment)}};return t})()));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
3
|
+
Copyright (C) 2022 jeffy-g <hirotom1107@gmail.com>
|
|
4
|
+
Released under the MIT license
|
|
5
|
+
https://opensource.org/licenses/mit-license.php
|
|
6
|
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
|
+
*/
|
package/unzip-sync.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface FlateError extends Error {
|
|
2
|
+
code: number;
|
|
3
|
+
}
|
|
4
|
+
export declare function strFromU8(dat: Uint8Array, latin1?: boolean): string;
|
|
5
|
+
export declare function inflateSync(data: Uint8Array, out?: Uint8Array): Uint8Array;
|
|
6
|
+
export interface UnzipFileInfo {
|
|
7
|
+
name: string;
|
|
8
|
+
size: number;
|
|
9
|
+
originalSize: number;
|
|
10
|
+
compression: number;
|
|
11
|
+
}
|
|
12
|
+
export declare type UnzipFileFilter = (file: UnzipFileInfo) => boolean;
|
|
13
|
+
export interface UnzipOptions {
|
|
14
|
+
filter?: UnzipFileFilter;
|
|
15
|
+
}
|
|
16
|
+
export interface Unzipped {
|
|
17
|
+
[path: string]: {
|
|
18
|
+
data: Uint8Array;
|
|
19
|
+
comment?: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare function unzipSync(data: Uint8Array, opts?: UnzipOptions): Unzipped;
|
package/webpack/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
+
(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(e,'__esModule',{value:!0})}},t={};e.r(t),e.d(t,{cleanUp:()=>N,loadCompressedScript:()=>I,setConfig:()=>q,unzipSync:()=>F});const n=Uint8Array,r=Uint16Array,o=Uint32Array,c=new n([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),l=new n([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),s=new n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=(e,t)=>{const n=new r(31);for(let r=0;r<31;++r)n[r]=t+=1<<e[r-1];const c=new o(n[30])
|
|
3
|
+
;for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)c[t]=t-n[e]<<5|e;return[n,c]},[i,f]=a(c,2);i[28]=258,f[258]=28;const[d,u]=a(l,0),g=new r(32768);for(let e=0;e<32768;++e){let t=(43690&e)>>>1|(21845&e)<<1;t=(52428&t)>>>2|(13107&t)<<2,t=(61680&t)>>>4|(3855&t)<<4,g[e]=((65280&t)>>>8|(255&t)<<8)>>>1}const h=(e,t,n)=>{const o=e.length;let c=0;const l=new r(t);for(;c<o;++c)e[c]&&++l[e[c]-1];const s=new r(t);for(c=0;c<t;++c)s[c]=s[c-1]+l[c-1]<<1;let a;if(n){a=new r(1<<t);const n=15-t;for(c=0;c<o;++c)if(e[c]){const r=c<<4|e[c],o=t-e[c];let l=s[e[c]-1]++<<o;for(const e=l|(1<<o)-1;l<=e;++l)a[g[l]>>>n]=r}}else for(a=new r(o),c=0;c<o;++c)e[c]&&(a[c]=g[s[e[c]-1]++]>>>15-e[c]);return a},y=new n(288);for(let e=0;e<144;++e)y[e]=8;for(let e=144;e<256;++e)y[e]=9;for(let e=256;e<280;++e)y[e]=7
|
|
4
|
+
;for(let e=280;e<288;++e)y[e]=8;const m=new n(32);for(let e=0;e<32;++e)m[e]=5;const b=h(y,9,1),p=h(m,5,1),w=e=>{let t=e[0];for(let n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},S=(e,t,n)=>{const r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},v=(e,t)=>{const n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},E=(e,t,c)=>{(null==t||t<0)&&(t=0),(null==c||c>e.length)&&(c=e.length);const l=new(2==e.BYTES_PER_ELEMENT?r:4==e.BYTES_PER_ELEMENT?o:n)(c-t);return l.set(e.subarray(t,c)),l},C=['unexpected EOF','invalid block type','invalid length/literal','invalid distance','stream finished','no stream handler',,'no callback','invalid UTF-8 data','extra field too long','date not in range 1980-2099','filename too long','stream finishing','invalid zip data'],k=(e,t,n)=>{const r=new Error(t||C[e]);if(r.code=e,
|
|
5
|
+
Error.captureStackTrace&&Error.captureStackTrace(r,k),!n)throw r;return r},T=(e,t)=>e[t]|e[t+1]<<8,$=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,x=(e,t)=>$(e,t)+4294967296*$(e,t+4),j=(e,t)=>t+30+T(e,t+26)+T(e,t+28),z=(e,t,n)=>{const r=!(2048&T(e,t+8)),o=T(e,t+28),c=U(e.subarray(t+46,t+46+o),r),l=t+46+o,s=$(e,t+20),[a,i,f]=n&&4294967295==s?M(e,l):[s,$(e,t+24),$(e,t+42)],d=l+T(e,t+30);return[T(e,t+10),a,i,c,l+T(e,t+30)+T(e,t+32),f,U(e.subarray(d,d+T(e,t+32)),r)]},M=(e,t)=>{for(;1!=T(e,t);t+=4+T(e,t+2));return[x(e,t+12),x(e,t+4),x(e,t+20)]};let O;const P=new n(0);try{const e=new TextDecoder;e.decode(P,{stream:!0}),O=e}catch(e){}function U(e,t){if(t){let t="";for(let n=0;n<e.length;n+=16384)t+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return t}if(O)return O.decode(e);{
|
|
6
|
+
const[t,n]=(e=>{for(let t='',n=0;;){let r=e[n++];const o=+(r>127)+ +(r>223)+ +(r>239);if(n+o>e.length)return[t,E(e,n-1)];o?3==o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}})(e);return n.length&&k(8),t}}function _(e,t){return((e,t,r)=>{const o=e.length;if(!o||r&&r.f&&!r.l)return t||new n(0);const a=!t||r,f=!r||r.i;r||(r={}),t||(t=new n(3*o));const u=e=>{let r=t.length;if(e>r){const o=new n(Math.max(2*r,e));o.set(t),t=o}};let g=r.f||0,y=r.p||0,m=r.b||0,C=r.l,T=r.d,$=r.m,x=r.n;const j=8*o;do{if(!C){g=S(e,y,1);const c=S(e,y+1,3);if(y+=3,!c){const n=4+((y+7)/8|0),c=e[n-4]|e[n-3]<<8,l=n+c;if(l>o){
|
|
7
|
+
f&&k(0);break}a&&u(m+c),t.set(e.subarray(n,l),m),r.b=m+=c,r.p=y=8*l,r.f=g;continue}if(1==c)C=b,T=p,$=9,x=5;else if(2==c){const t=S(e,y,31)+257,r=S(e,y+10,15)+4,o=t+S(e,y+5,31)+1;y+=14;const c=new n(o),l=new n(19);for(let t=0;t<r;++t)l[s[t]]=S(e,y+3*t,7);y+=3*r;const a=w(l),i=(1<<a)-1,f=h(l,a,1);for(let t=0;t<o;){const n=f[S(e,y,i)];y+=15&n;const r=n>>>4;if(r<16)c[t++]=r;else{let n=0,o=0;for(16==r?(o=3+S(e,y,3),y+=2,n=c[t-1]):17==r?(o=3+S(e,y,7),y+=3):18==r&&(o=11+S(e,y,127),y+=7);o--;)c[t++]=n}}const d=c.subarray(0,t),u=c.subarray(t);$=w(d),x=w(u),C=h(d,$,1),T=h(u,x,1)}else k(1);if(y>j){f&&k(0);break}}a&&u(m+131072);const E=(1<<$)-1,z=(1<<x)-1;let M=y;for(;;M=y){const n=C[v(e,y)&E],r=n>>>4;if(y+=15&n,y>j){f&&k(0);break}if(n||k(2),r<256)t[m++]=r;else{if(256==r){M=y,C=void 0;break}{
|
|
8
|
+
let n=r-254;if(r>264){const t=r-257,o=c[t];n=S(e,y,(1<<o)-1)+i[t],y+=o}const o=T[v(e,y)&z],s=o>>>4;o||k(3),y+=15&o;let g=d[s];if(s>3){const t=l[s];g+=v(e,y)&(1<<t)-1,y+=t}if(y>j){f&&k(0);break}a&&u(m+131072);const h=m+n;for(;m<h;m+=4)t[m]=t[m-g],t[m+1]=t[m+1-g],t[m+2]=t[m+2-g],t[m+3]=t[m+3-g];m=h}}}r.l=C,r.p=M,r.b=m,r.f=g,C&&(g=1,r.m=$,r.d=T,r.n=x)}while(!g);return m==t.length?t:E(t,0,m)})(e,t)}let L,A,B,R,D=new TextDecoder,F=function(e,t){const r={};let o=e.length-22;for(;101010256!=$(e,o);--o)(!o||e.length-o>65558)&&k(13);let c=T(e,o+8);if(!c)return{};let l=$(e,o+16);const s=4294967295==l;s&&(o=$(e,o-12),101075792!=$(e,o)&&k(13),c=$(e,o+32),l=$(e,o+48));const a=t&&t.filter;for(let t=0;t<c;++t){const[t,o,c,i,f,d,u]=z(e,l,s),g=j(e,d);if(l=f,!a||a({name:i,size:o,originalSize:c,compression:t
|
|
9
|
+
})){let l;t?8===t?l=_(e.subarray(g,g+o),new n(c)):k(14,'unknown compression type '+t):l=E(e,g,g+o),l&&(r[i]={data:l,comment:u})}}return r},N=()=>{D=void 0,G=H=Y=void 0,q=I=N=void 0,L=B=A=void 0,F=void 0},Y=async()=>fetch(A).then((e=>{const t=e.headers.get("content-encoding");R="gzip"===t||"br"===t})),q=(e,t,n)=>{L=e,A=t,B=n||""},G=async(e,t,n)=>{let r="",o=0;for(;;){const c=await e.read();if(c.done)return n(`done ${t}: ${o.toLocaleString()} bytes 😃`),void H(r,t);const l=c.value;r+=D.decode(l),n(`extract ${t}: ${(o+=l.length).toLocaleString()} bytes`)}},H=(e,t,n)=>{const r=document.createElement("script"),o=B?document.querySelector(B).nextSibling:document.head.lastElementChild;document.head.insertBefore(r,o),n&&(r.integrity=n),r.id=t,r.text=e},I=async(e,t=console.log)=>{
|
|
10
|
+
void 0===R&&await Y();const n=e+".js",r=await fetch(`${L}/${e}.${R?"js":"zip"}`).then((async e=>{const r=e.body.getReader();if(R)return G(r,n,t);{const n=+e.headers.get("content-length"),o=new Uint8Array(n);let c=0;for(;;){const e=await r.read();if(e.done)break;o.set(e.value,c),c+=e.value.length,t(`loading script: ${c.toLocaleString()} bytes(${Math.round(c/n*100)}%)`)}return o}}));if(r){t(`loaded script ${n}, decompressing binary...`);const e=F(r);t(`${n} decompressed 😃`);const o=e[n];H(D.decode(o.data,{stream:!1}),n,o.comment)}};module.exports=t})();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
3
|
+
Copyright (C) 2022 jeffy-g <hirotom1107@gmail.com>
|
|
4
|
+
Released under the MIT license
|
|
5
|
+
https://opensource.org/licenses/mit-license.php
|
|
6
|
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
|
+
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*! For license information please see index.mjs.LICENSE.txt */
|
|
2
|
+
var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{Lx:()=>F,aN:()=>H,v6:()=>Y,GZ:()=>D});const n=Uint8Array,r=Uint16Array,o=Uint32Array,a=new n([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),c=new n([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),s=new n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),i=(e,t)=>{const n=new r(31);for(let r=0;r<31;++r)n[r]=t+=1<<e[r-1];const a=new o(n[30]);for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)a[t]=t-n[e]<<5|e;return[n,a]},[l,f]=i(a,2);l[28]=258,f[258]=28;const[d,u]=i(c,0),g=new r(32768);for(let e=0;e<32768;++e){let t=(43690&e)>>>1|(21845&e)<<1;t=(52428&t)>>>2|(13107&t)<<2,
|
|
3
|
+
t=(61680&t)>>>4|(3855&t)<<4,g[e]=((65280&t)>>>8|(255&t)<<8)>>>1}const h=(e,t,n)=>{const o=e.length;let a=0;const c=new r(t);for(;a<o;++a)e[a]&&++c[e[a]-1];const s=new r(t);for(a=0;a<t;++a)s[a]=s[a-1]+c[a-1]<<1;let i;if(n){i=new r(1<<t);const n=15-t;for(a=0;a<o;++a)if(e[a]){const r=a<<4|e[a],o=t-e[a];let c=s[e[a]-1]++<<o;for(const e=c|(1<<o)-1;c<=e;++c)i[g[c]>>>n]=r}}else for(i=new r(o),a=0;a<o;++a)e[a]&&(i[a]=g[s[e[a]-1]++]>>>15-e[a]);return i},w=new n(288);for(let e=0;e<144;++e)w[e]=8;for(let e=144;e<256;++e)w[e]=9;for(let e=256;e<280;++e)w[e]=7;for(let e=280;e<288;++e)w[e]=8;const m=new n(32);for(let e=0;e<32;++e)m[e]=5;const y=h(w,9,1),b=h(m,5,1),p=e=>{let t=e[0];for(let n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},v=(e,t,n)=>{const r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},S=(e,t)=>{
|
|
4
|
+
const n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},E=(e,t,a)=>{(null==t||t<0)&&(t=0),(null==a||a>e.length)&&(a=e.length);const c=new(2==e.BYTES_PER_ELEMENT?r:4==e.BYTES_PER_ELEMENT?o:n)(a-t);return c.set(e.subarray(t,a)),c},C=['unexpected EOF','invalid block type','invalid length/literal','invalid distance','stream finished','no stream handler',,'no callback','invalid UTF-8 data','extra field too long','date not in range 1980-2099','filename too long','stream finishing','invalid zip data'],k=(e,t,n)=>{const r=new Error(t||C[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,k),!n)throw r;return r},x=(e,t)=>e[t]|e[t+1]<<8,$=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,T=(e,t)=>$(e,t)+4294967296*$(e,t+4),L=(e,t)=>t+30+x(e,t+26)+x(e,t+28),z=(e,t,n)=>{
|
|
5
|
+
const r=!(2048&x(e,t+8)),o=x(e,t+28),a=M(e.subarray(t+46,t+46+o),r),c=t+46+o,s=$(e,t+20),[i,l,f]=n&&4294967295==s?U(e,c):[s,$(e,t+24),$(e,t+42)],d=c+x(e,t+30);return[x(e,t+10),i,l,a,c+x(e,t+30)+x(e,t+32),f,M(e.subarray(d,d+x(e,t+32)),r)]},U=(e,t)=>{for(;1!=x(e,t);t+=4+x(e,t+2));return[T(e,t+12),T(e,t+4),T(e,t+20)]};let j;const A=new n(0);try{const e=new TextDecoder;e.decode(A,{stream:!0}),j=e}catch(e){}function M(e,t){if(t){let t="";for(let n=0;n<e.length;n+=16384)t+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return t}if(j)return j.decode(e);{const[t,n]=(e=>{for(let t='',n=0;;){let r=e[n++];const o=+(r>127)+ +(r>223)+ +(r>239);if(n+o>e.length)return[t,E(e,n-1)];o?3==o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,
|
|
6
|
+
t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}})(e);return n.length&&k(8),t}}function N(e,t){return((e,t,r)=>{const o=e.length;if(!o||r&&r.f&&!r.l)return t||new n(0);const i=!t||r,f=!r||r.i;r||(r={}),t||(t=new n(3*o));const u=e=>{let r=t.length;if(e>r){const o=new n(Math.max(2*r,e));o.set(t),t=o}};let g=r.f||0,w=r.p||0,m=r.b||0,C=r.l,x=r.d,$=r.m,T=r.n;const L=8*o;do{if(!C){g=v(e,w,1);const a=v(e,w+1,3);if(w+=3,!a){const n=4+((w+7)/8|0),a=e[n-4]|e[n-3]<<8,c=n+a;if(c>o){f&&k(0);break}i&&u(m+a),t.set(e.subarray(n,c),m),r.b=m+=a,r.p=w=8*c,r.f=g;continue}if(1==a)C=y,x=b,$=9,T=5;else if(2==a){const t=v(e,w,31)+257,r=v(e,w+10,15)+4,o=t+v(e,w+5,31)+1;w+=14
|
|
7
|
+
;const a=new n(o),c=new n(19);for(let t=0;t<r;++t)c[s[t]]=v(e,w+3*t,7);w+=3*r;const i=p(c),l=(1<<i)-1,f=h(c,i,1);for(let t=0;t<o;){const n=f[v(e,w,l)];w+=15&n;const r=n>>>4;if(r<16)a[t++]=r;else{let n=0,o=0;for(16==r?(o=3+v(e,w,3),w+=2,n=a[t-1]):17==r?(o=3+v(e,w,7),w+=3):18==r&&(o=11+v(e,w,127),w+=7);o--;)a[t++]=n}}const d=a.subarray(0,t),u=a.subarray(t);$=p(d),T=p(u),C=h(d,$,1),x=h(u,T,1)}else k(1);if(w>L){f&&k(0);break}}i&&u(m+131072);const E=(1<<$)-1,z=(1<<T)-1;let U=w;for(;;U=w){const n=C[S(e,w)&E],r=n>>>4;if(w+=15&n,w>L){f&&k(0);break}if(n||k(2),r<256)t[m++]=r;else{if(256==r){U=w,C=void 0;break}{let n=r-254;if(r>264){const t=r-257,o=a[t];n=v(e,w,(1<<o)-1)+l[t],w+=o}const o=x[S(e,w)&z],s=o>>>4;o||k(3),w+=15&o;let g=d[s];if(s>3){const t=c[s];g+=S(e,w)&(1<<t)-1,w+=t}if(w>L){f&&k(0);break
|
|
8
|
+
}i&&u(m+131072);const h=m+n;for(;m<h;m+=4)t[m]=t[m-g],t[m+1]=t[m+1-g],t[m+2]=t[m+2-g],t[m+3]=t[m+3-g];m=h}}}r.l=C,r.p=U,r.b=m,r.f=g,C&&(g=1,r.m=$,r.d=x,r.n=T)}while(!g);return m==t.length?t:E(t,0,m)})(e,t)}let O,P,_,B,R=new TextDecoder,D=function(e,t){const r={};let o=e.length-22;for(;101010256!=$(e,o);--o)(!o||e.length-o>65558)&&k(13);let a=x(e,o+8);if(!a)return{};let c=$(e,o+16);const s=4294967295==c;s&&(o=$(e,o-12),101075792!=$(e,o)&&k(13),a=$(e,o+32),c=$(e,o+48));const i=t&&t.filter;for(let t=0;t<a;++t){const[t,o,a,l,f,d,u]=z(e,c,s),g=L(e,d);if(c=f,!i||i({name:l,size:o,originalSize:a,compression:t})){let c;t?8===t?c=N(e.subarray(g,g+o),new n(a)):k(14,'unknown compression type '+t):c=E(e,g,g+o),c&&(r[l]={data:c,comment:u})}}return r},F=()=>{R=void 0,Z=q=G=void 0,Y=H=F=void 0,
|
|
9
|
+
O=_=P=void 0,D=void 0},G=async()=>fetch(P).then((e=>{const t=e.headers.get("content-encoding");B="gzip"===t||"br"===t})),Y=(e,t,n)=>{O=e,P=t,_=n||""},Z=async(e,t,n)=>{let r="",o=0;for(;;){const a=await e.read();if(a.done)return n(`done ${t}: ${o.toLocaleString()} bytes 😃`),void q(r,t);const c=a.value;r+=R.decode(c),n(`extract ${t}: ${(o+=c.length).toLocaleString()} bytes`)}},q=(e,t,n)=>{const r=document.createElement("script"),o=_?document.querySelector(_).nextSibling:document.head.lastElementChild;document.head.insertBefore(r,o),n&&(r.integrity=n),r.id=t,r.text=e},H=async(e,t=console.log)=>{void 0===B&&await G();const n=e+".js",r=await fetch(`${O}/${e}.${B?"js":"zip"}`).then((async e=>{const r=e.body.getReader();if(B)return Z(r,n,t);{
|
|
10
|
+
const n=+e.headers.get("content-length"),o=new Uint8Array(n);let a=0;for(;;){const e=await r.read();if(e.done)break;o.set(e.value,a),a+=e.value.length,t(`loading script: ${a.toLocaleString()} bytes(${Math.round(a/n*100)}%)`)}return o}}));if(r){t(`loaded script ${n}, decompressing binary...`);const e=D(r);t(`${n} decompressed 😃`);const o=e[n];q(R.decode(o.data,{stream:!1}),n,o.comment)}};var I=t.Lx,J=t.aN,K=t.v6,Q=t.GZ;export{I as cleanUp,J as loadCompressedScript,K as setConfig,Q as unzipSync};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
3
|
+
Copyright (C) 2022 jeffy-g <hirotom1107@gmail.com>
|
|
4
|
+
Released under the MIT license
|
|
5
|
+
https://opensource.org/licenses/mit-license.php
|
|
6
|
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
|
+
*/
|