compressed-script-loader 1.4.19 → 1.4.21

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/index.d.ts CHANGED
@@ -34,7 +34,7 @@ declare let setConfig: (base: string, insertionSelector?: string) => void;
34
34
  * @param {(msg: string) => void} [log] default: `console.log`
35
35
  */
36
36
  declare let loadCompressedScript: (baseName: string, log?: (msg: string) => void) => Promise<void>;
37
- declare const version = "v1.4.19";
37
+ declare const version = "v1.4.21";
38
38
  /**
39
39
  * `importmap` zip entry name
40
40
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compressed-script-loader",
3
- "version": "1.4.19",
3
+ "version": "1.4.21",
4
4
  "description": "Reduces network traffic for huge source files built by webpack etc.",
5
5
  "private": false,
6
6
  "browser": "./umd/index.js",
package/umd/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see index.js.LICENSE.txt */
2
- ((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,{IM_MAP_ID:()=>te,cleanUp:()=>G,loadCompressedScript:()=>X,setConfig:()=>Q,unzipSync:()=>Y,version:()=>ee});const n=String.fromCharCode,o=Uint8Array,r=Uint16Array,l=Uint32Array,i=new o([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]),a=new o([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 o([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),c=(e,t)=>{const n=new r(31);for(let o=0;o<31;++o)n[o]=t+=1<<e[o-1];const o=new l(n[30]);for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)o[t]=t-n[e]<<5|e;return[n,o]},[d,f]=c(i,2);d[28]=258,f[258]=28;const[u,p]=c(a,0),y=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,y[e]=((65280&t)>>>8|(255&t)<<8)>>>1}const g=(e,t,n)=>{const o=e.length;let l=0;const i=new r(t);for(;l<o;++l)e[l]&&++i[e[l]-1];const a=new r(t);for(l=0;l<t;++l)a[l]=a[l-1]+i[l-1]<<1;let s;if(n){s=new r(1<<t);const n=15-t;for(l=0;l<o;++l)if(e[l]){const o=l<<4|e[l],r=t-e[l];let i=a[e[l]-1]++<<r;for(const e=i|(1<<r)-1;i<=e;++i)s[y[i]>>>n]=o}}else for(s=new r(o),l=0;l<o;++l)e[l]&&(s[l]=y[a[e[l]-1]++]>>>15-e[l]);return s},m=new o(288),b=new o(32);{let e=0;for(;e<144;)m[e++]=8;for(;e<256;)m[e++]=9;for(;e<280;)m[e++]=7;for(;e<288;)m[e++]=8;for(e=0;e<32;)b[e++]=5}const h=g(m,9,1),w=g(b,5,1),v=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},k=(e,t)=>{const n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},x=[,o,r,,l],$=(e,t,n)=>{(!t||t<0)&&(t=0),(!n||n>e.length)&&(n=e.length);const o=new x[e.BYTES_PER_ELEMENT](n-t);return o.set(e.subarray(t,n)),o},E=["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"];let O=Error.captureStackTrace;const T=(e,t,n)=>{const o=new Error(t||E[e]);if(o.code=e,O&&O(o,T),!n)throw o;return o},j=(e,t,n)=>{const r=e.length;if(!r||n&&n.f&&!n.l)return t||new o(0);const l=!t||!!n,c=!n||n.i;!n&&(n={}),!t&&(t=new o(3*r));const f=e=>{let n=t.length;if(e>n){const r=new o(Math.max(2*n,e));r.set(t),t=r}};let p=n.f||0,y=n.p||0,m=n.b||0,b=n.l,x=n.d,E=n.m,O=n.n;const j=8*r;do{if(!b){p=S(e,y,1);const i=S(e,y+1,3);if(y+=3,!i){const o=4+((y+7)/8|0),i=e[o-4]|e[o-3]<<8,a=o+i;if(a>r){c&&T(0);break}l&&f(m+i),t.set(e.subarray(o,a),m),n.b=m+=i,n.p=y=8*a,n.f=p;continue}if(1===i)b=h,x=w,E=9,O=5;else if(2===i){const t=S(e,y,31)+257,n=S(e,y+10,15)+4,r=t+S(e,y+5,31)+1;y+=14;const l=new o(r),i=new o(19);for(let t=0;t<n;++t)i[s[t]]=S(e,y+3*t,7);y+=3*n;const a=v(i),c=(1<<a)-1,d=g(i,a,1);for(let t=0;t<r;){const n=d[S(e,y,c)];y+=15&n;const o=n>>>4;if(o<16)l[t++]=o;else{let n=0,r=0;for(16===o?(r=3+S(e,y,3),y+=2,n=l[t-1]):17===o?(r=3+S(e,y,7),y+=3):18===o&&(r=11+S(e,y,127),y+=7);r--;)l[t++]=n}}const f=l.subarray(0,t),u=l.subarray(t);E=v(f),O=v(u),b=g(f,E,1),x=g(u,O,1)}else T(1);if(y>j){c&&T(0);break}}l&&f(m+131072);const $=(1<<E)-1,C=(1<<O)-1;let A=y;for(;;A=y){const n=b[k(e,y)&$],o=n>>>4;if(y+=15&n,y>j){c&&T(0);break}if(n||T(2),o<256)t[m++]=o;else{if(256===o){A=y,b=void 0;break}{let n=o-254;if(o>264){const t=o-257,r=i[t];n=S(e,y,(1<<r)-1)+d[t],y+=r}const r=x[k(e,y)&C],s=r>>>4;r||T(3),y+=15&r;let p=u[s];if(s>3){const t=a[s];p+=k(e,y)&(1<<t)-1,y+=t}if(y>j){c&&T(0);break}l&&f(m+131072);const g=m+n;for(;m<g;m+=4)t[m]=t[m-p],t[m+1]=t[m+1-p],t[m+2]=t[m+2-p],t[m+3]=t[m+3-p];m=g}}}n.l=b,n.p=A,n.b=m,n.f=p,b&&(p=1,n.m=E,n.d=x,n.n=O)}while(!p);return m===t.length?t:$(t,0,m)},C=(e,t)=>e[t]|e[t+1]<<8,A=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,M=(e,t)=>A(e,t)+4294967296*A(e,t+4),z=(e,t)=>t+30+C(e,t+26)+C(e,t+28),P=(e,t,n)=>{const o=!(2048&C(e,t+8)),r=C(e,t+28),l=R(e.subarray(t+46,t+46+r),o),i=t+46+r,a=A(e,t+20),[s,c,d]=n&&4294967295===a?U(e,i):[a,A(e,t+24),A(e,t+42)],f=i+C(e,t+30);return[C(e,t+10),s,c,l,i+C(e,t+30)+C(e,t+32),d,R(e.subarray(f,f+C(e,t+32)),o)]},U=(e,t)=>{for(;1!=C(e,t);t+=4+C(e,t+2));return[M(e,t+12),M(e,t+4),M(e,t+20)]};let L;const N=new o(0);try{const e=new TextDecoder;e.decode(N,{stream:!0}),L=e}catch{}const _=e=>{for(let t="",o=0;;){let r=e[o++];const l=+(r>127)+ +(r>223)+ +(r>239);if(o+l>e.length)return[t,$(e,o-1)];l?3===l?(r=((15&r)<<18|(63&e[o++])<<12|(63&e[o++])<<6|63&e[o++])-65536,
3
- t+=n(55296|r>>10,56320|1023&r)):t+=n(1&l?(31&r)<<6|63&e[o++]:(15&r)<<12|(63&e[o++])<<6|63&e[o++]):t+=n(r)}};function R(e,t){if(t){let t="";for(let o=0;o<e.length;o+=16384)t+=n.apply(null,e.subarray(o,o+16384));return t}if(L)return L.decode(e);{const[t,n]=_(e);return n.length&&T(8),t}}let B,D,J=console.log,q=document,F=Object.keys,I=new TextDecoder,Y=function(e,t){const n={};let r=e.length-22;for(;101010256!=A(e,r);--r)(!r||e.length-r>65558)&&T(13);let l=C(e,r+8);if(!l)return{};let i=A(e,r+16);const a=4294967295===i;a&&(r=A(e,r-12),101075792!=A(e,r)&&T(13),l=A(e,r+32),i=A(e,r+48));const s=t&&t.filter;for(let t=0;t<l;++t){const[t,r,l,c,d,f,u]=P(e,i,a),p=z(e,f);if(i=d,!s||s({name:c,size:r,originalSize:l,compression:t,comment:u})){let i;t?8===t?i=j(e.subarray(p,p+r),new o(l)):T(14,"unknown compression type "+t):i=$(e,p,p+r),i&&(n[c]={data:i,comment:u})}}return n},G=()=>{I=void 0,V=Q=X=G=void 0,B=D=void 0,W=K=H=Y=void 0},H=e=>{let t=/^(?:sha\d{3}-)?([a-z0-9+/=]{44,88})$/i.exec(e);if(t){let n=(e=t[1]).length;if(!(88^n&&64^n&&44^n))return`sha${64==n?384:88==n?512:256}-${e}`}},K=(e,t="text/javascript")=>URL.createObjectURL(new Blob([e],{type:t})),Q=(e,t)=>{B=e,D=t||""},V=(e,t,n=(()=>{}),o={})=>{let r=()=>{n(),J(`script ${t} is ready`)},l=D?q.querySelector(D).nextElementSibling:void 0,i=q.head[l?"insertBefore":"appendChild"](q.createElement("script"),l);i.id=t,o.type&&(i.type=o.type);let a=o.integrity;a?(i.integrity=a,i.crossOrigin="",i.onload=r,i.src=o.url||K(e)):(i.text=e,r())},W=e=>{let t,n=F(e);if(n.includes(te)){n=n.filter((e=>e!==te));let o,r=I.decode(e[te].data),l=JSON.parse(r),i=l.map.imports,a=[],s=new Map;const c=F(i);for(let t=0;t<c.length;){const n=c[t++];let r=s.get(n);r||s.set(n,r=K(I.decode(e[n].data))),i[n]=r,n!==l.main||o||(o=r),!a.includes(n)&&a.push(n)}V(JSON.stringify(l.map,null,2),te,void 0,{type:"importmap"}),n=n.filter((e=>!a.includes(e))),t={entryMain:o,imdata:l}}return[n,t]},X=async(e,t=J)=>{let n=e+".zip",o=await fetch(`${B||"."}/${n}`).then((async e=>{let n=!!e.headers.get("content-encoding"),o=e.body.getReader(),r=(l=+e.headers.get("content-length"),n?l<<1|0:l);var l;let i=new Uint8Array(r),a=0;for(;;){let{done:e,value:n}=await o.read();if(e)break;i.set(n,a),a+=n.length,t(`loading zip: ${a.toLocaleString()} bytes(${a/r*100|0}%)`)}return n?i.slice(0,a):i})).catch((e=>{console.error(e)}));if(o&&o.length){t(`loaded ${n}, decompressing binary...`);let e=`unzip: ${n}`;console.time(e);let r=Y(o);return console.timeEnd(e),t(`${n} decompressed 😃`),new Promise((e=>{let[t,{entryMain:n,imdata:o}={}]=W(r),l=t.length,i=o?.main,a=()=>{! --l&&e()};for(let e,o=0;e=t[o++];){let t=r[e],o=e===i;V(I.decode(t.data),e,a,{integrity:H(t.comment),url:o?n:void 0,type:o?"module":void 0})}}))}throw new Error(`Could not load "${n}"`)},Z=async()=>{Z=void 0;let e=q.querySelector("script[data-csl-config]");if(e){let t=e.dataset.cslConfig;if(t){t=JSON.parse(t);let e=t.load?(Q(t.base,t.selector),Array.isArray(t.load)?t.load:[t.load]):Array.isArray(t)?t:"string"==typeof t?[t]:[],n=[];for(let t of e)n.push(X(t).catch((e=>e)));let o=(await Promise.all(n)).filter((e=>e&&e.name));setTimeout((()=>{let e="function"==typeof cslCallback?cslCallback:window[t.callback||"cslCallback"];"function"==typeof e&&e(o.length?o:void 0)}),60),t.cleanup&&G()}}};setTimeout(Z,99);const ee="v1.4.19",te="$importmap.dat";return t})()));
2
+ ((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,{IM_MAP_ID:()=>te,cleanUp:()=>G,loadCompressedScript:()=>X,setConfig:()=>Q,unzipSync:()=>Y,version:()=>ee});const n=String.fromCharCode,o=Uint8Array,r=Uint16Array,l=Uint32Array,i=new o([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]),a=new o([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 o([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),c=(e,t)=>{const n=new r(31);for(let o=0;o<31;++o)n[o]=t+=1<<e[o-1];const o=new l(n[30]);for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)o[t]=t-n[e]<<5|e;return[n,o]},[f,d]=c(i,2);f[28]=258,d[258]=28;const[u,p]=c(a,0),y=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,y[e]=((65280&t)>>>8|(255&t)<<8)>>>1}const g=(e,t,n)=>{const o=e.length;let l=0;const i=new r(t);for(;l<o;++l)e[l]&&++i[e[l]-1];const a=new r(t);for(l=0;l<t;++l)a[l]=a[l-1]+i[l-1]<<1;let s;if(n){s=new r(1<<t);const n=15-t;for(l=0;l<o;++l)if(e[l]){const o=l<<4|e[l],r=t-e[l];let i=a[e[l]-1]++<<r;for(const e=i|(1<<r)-1;i<=e;++i)s[y[i]>>>n]=o}}else for(s=new r(o),l=0;l<o;++l)e[l]&&(s[l]=y[a[e[l]-1]++]>>>15-e[l]);return s},m=new o(288),h=new o(32);{let e=0;for(;e<144;)m[e++]=8;for(;e<256;)m[e++]=9;for(;e<280;)m[e++]=7;for(;e<288;)m[e++]=8;for(e=0;e<32;)h[e++]=5}const b=g(m,9,1),w=g(h,5,1),v=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},k=(e,t)=>{const n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},x=[,o,r,,l],$=(e,t,n)=>{(!t||t<0)&&(t=0),(!n||n>e.length)&&(n=e.length);const o=new x[e.BYTES_PER_ELEMENT](n-t);return o.set(e.subarray(t,n)),o},E=["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"];let O=Error.captureStackTrace;const T=(e,t,n)=>{const o=new Error(t||E[e]);if(o.code=e,O&&O(o,T),!n)throw o;return o},j=(e,t,n)=>{const r=e.length;if(!r||n&&n.f&&!n.l)return t||new o(0);const l=!t||!!n,c=!n||n.i;!n&&(n={}),!t&&(t=new o(3*r));const d=e=>{let n=t.length;if(e>n){const r=new o(Math.max(2*n,e));r.set(t),t=r}};let p=n.f||0,y=n.p||0,m=n.b||0,h=n.l,x=n.d,E=n.m,O=n.n;const j=8*r;do{if(!h){p=S(e,y,1);const i=S(e,y+1,3);if(y+=3,!i){const o=4+((y+7)/8|0),i=e[o-4]|e[o-3]<<8,a=o+i;if(a>r){c&&T(0);break}l&&d(m+i),t.set(e.subarray(o,a),m),n.b=m+=i,n.p=y=8*a,n.f=p;continue}if(1===i)h=b,x=w,E=9,O=5;else if(2===i){const t=S(e,y,31)+257,n=S(e,y+10,15)+4,r=t+S(e,y+5,31)+1;y+=14;const l=new o(r),i=new o(19);for(let t=0;t<n;++t)i[s[t]]=S(e,y+3*t,7);y+=3*n;const a=v(i),c=(1<<a)-1,f=g(i,a,1);for(let t=0;t<r;){const n=f[S(e,y,c)];y+=15&n;const o=n>>>4;if(o<16)l[t++]=o;else{let n=0,r=0;for(16===o?(r=3+S(e,y,3),y+=2,n=l[t-1]):17===o?(r=3+S(e,y,7),y+=3):18===o&&(r=11+S(e,y,127),y+=7);r--;)l[t++]=n}}const d=l.subarray(0,t),u=l.subarray(t);E=v(d),O=v(u),h=g(d,E,1),x=g(u,O,1)}else T(1);if(y>j){c&&T(0);break}}l&&d(m+131072);const $=(1<<E)-1,A=(1<<O)-1;let C=y;for(;;C=y){const n=h[k(e,y)&$],o=n>>>4;if(y+=15&n,y>j){c&&T(0);break}if(n||T(2),o<256)t[m++]=o;else{if(256===o){C=y,h=void 0;break}{let n=o-254;if(o>264){const t=o-257,r=i[t];n=S(e,y,(1<<r)-1)+f[t],y+=r}const r=x[k(e,y)&A],s=r>>>4;r||T(3),y+=15&r;let p=u[s];if(s>3){const t=a[s];p+=k(e,y)&(1<<t)-1,y+=t}if(y>j){c&&T(0);break}l&&d(m+131072);const g=m+n;for(;m<g;m+=4)t[m]=t[m-p],t[m+1]=t[m+1-p],t[m+2]=t[m+2-p],t[m+3]=t[m+3-p];m=g}}}n.l=h,n.p=C,n.b=m,n.f=p,h&&(p=1,n.m=E,n.d=x,n.n=O)}while(!p);return m===t.length?t:$(t,0,m)},A=(e,t)=>e[t]|e[t+1]<<8,C=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,M=(e,t)=>C(e,t)+4294967296*C(e,t+4),U=(e,t)=>t+30+A(e,t+26)+A(e,t+28),z=(e,t,n)=>{const o=!(2048&A(e,t+8)),r=A(e,t+28),l=R(e.subarray(t+46,t+46+r),o),i=t+46+r,a=C(e,t+20),[s,c,f]=n&&4294967295===a?P(e,i):[a,C(e,t+24),C(e,t+42)],d=i+A(e,t+30);return[A(e,t+10),s,c,l,i+A(e,t+30)+A(e,t+32),f,R(e.subarray(d,d+A(e,t+32)),o)]},P=(e,t)=>{for(;1!=A(e,t);t+=4+A(e,t+2));return[M(e,t+12),M(e,t+4),M(e,t+20)]};let L;const N=new o(0);try{const e=new TextDecoder;e.decode(N,{stream:!0}),L=e}catch{}const _=e=>{for(let t="",o=0;;){let r=e[o++];const l=+(r>127)+ +(r>223)+ +(r>239);if(o+l>e.length)return[t,$(e,o-1)];l?3===l?(r=((15&r)<<18|(63&e[o++])<<12|(63&e[o++])<<6|63&e[o++])-65536,
3
+ t+=n(55296|r>>10,56320|1023&r)):t+=n(1&l?(31&r)<<6|63&e[o++]:(15&r)<<12|(63&e[o++])<<6|63&e[o++]):t+=n(r)}};function R(e,t){if(t){let t="";for(let o=0;o<e.length;o+=16384)t+=n.apply(null,e.subarray(o,o+16384));return t}if(L)return L.decode(e);{const[t,n]=_(e);return n.length&&T(8),t}}let B,D,J=console.log,q=document,F=Object.keys,I=new TextDecoder,Y=function(e,t){const n={};let r=e.length-22;for(;101010256!=C(e,r);--r)(!r||e.length-r>65558)&&T(13);let l=A(e,r+8);if(!l)return{};let i=C(e,r+16);const a=4294967295===i;a&&(r=C(e,r-12),101075792!=C(e,r)&&T(13),l=C(e,r+32),i=C(e,r+48));const s=t&&t.filter;for(let t=0;t<l;++t){const[t,r,l,c,f,d,u]=z(e,i,a),p=U(e,d);if(i=f,!s||s({name:c,size:r,originalSize:l,compression:t,comment:u})){let i;t?8===t?i=j(e.subarray(p,p+r),new o(l)):T(14,"unknown compression type "+t):i=$(e,p,p+r),i&&(n[c]={data:i,comment:u})}}return n},G=()=>{I=void 0,V=Q=X=G=void 0,B=D=void 0,W=K=H=Y=void 0},H=e=>{let t=/^(?:sha\d{3}-)?([a-z0-9+/=]{44,88})$/i.exec(e);if(t){let n=(e=t[1]).length;if(!(88^n&&64^n&&44^n))return`sha${64==n?384:88==n?512:256}-${e}`}},K=(e,t="text/javascript")=>URL.createObjectURL(new Blob([e],{type:t})),Q=(e,t)=>{B=e,D=t||""},V=(e,t,n=(()=>{}),o={})=>{let r=()=>{n(),J(`script ${t} is ready`)},l=D?q.querySelector(D).nextElementSibling:void 0,i=q.head[l?"insertBefore":"appendChild"](q.createElement("script"),l);i.id=t,o.type&&(i.type=o.type);let a=o.integrity;a?(i.integrity=a,i.crossOrigin="",i.onload=r,i.src=o.url||K(e)):(i.text=e,r())},W=e=>{let t,n=F(e);if(n.includes(te)){n=n.filter((e=>e!==te));let o,r=I.decode(e[te].data),l=JSON.parse(r),i=l.map.imports,a=[],s=new Map;const c=F(i);for(let t=0;t<c.length;){const n=c[t++];let r=s.get(n);r||s.set(n,r=K(I.decode(e[n].data))),i[n]=r,n!==l.main||o||(o=r),!a.includes(n)&&a.push(n)}V(JSON.stringify(l.map,null,2),te,void 0,{type:"importmap"}),n=n.filter((e=>!a.includes(e))),t={entryMain:o,imdata:l}}return[n,t]},X=async(e,t=J)=>{let n=e+".zip",o=await fetch(`${B||"."}/${n}`).then((async e=>{let n=!!e.headers.get("content-encoding"),o=e.body.getReader(),r=(l=+e.headers.get("content-length"),n?l<<1|0:l);var l;r||(r=5e5,n=!0);let i=new Uint8Array(r),a=0;for(;;){let{value:e}=await o.read();if(!e)break;if(r<a+e.length){r=(r<<1)+e.length;let t=new Uint8Array(r);t.set(i),i=t}i.set(e,a),a+=e.length,t(`loading zip: ${a.toLocaleString()} bytes(${a/r*100|0}%)`)}return n?i.slice(0,a):i})).catch((e=>{console.error(e)}));if(o&&o.length){t(`loaded ${n}, decompressing binary...`);let e=`unzip: ${n}`;console.time(e);let r=Y(o);return console.timeEnd(e),t(`${n} decompressed 😃`),new Promise((e=>{let[t,{entryMain:n,imdata:o}={}]=W(r),l=t.length,i=o?.main,a=()=>{! --l&&e()};for(let e,o=0;e=t[o++];){let t=r[e],o=e===i;V(I.decode(t.data),e,a,{integrity:H(t.comment),url:o?n:void 0,type:o?"module":void 0})}}))}throw new Error(`Could not load "${n}"`)},Z=async()=>{Z=void 0;let e=q.querySelector("script[data-csl-config]");if(e){let t=e.dataset.cslConfig;if(t){t=JSON.parse(t);let e=t.load?(Q(t.base,t.selector),Array.isArray(t.load)?t.load:[t.load]):Array.isArray(t)?t:"string"==typeof t?[t]:[],n=[];for(let t of e)n.push(X(t).catch((e=>e)));let o=(await Promise.all(n)).filter((e=>e&&e.name));setTimeout((()=>{let e="function"==typeof cslCallback?cslCallback:window[t.callback||"cslCallback"];"function"==typeof e&&e(o.length?o:void 0)}),60),t.cleanup&&G()}}};setTimeout(Z,99);const ee="v1.4.21",te="$importmap.dat";return t})()));
package/unzip-sync.d.ts CHANGED
@@ -71,24 +71,4 @@ export interface Unzipped {
71
71
  * @param {UnzipOptions} [opts] The ZIP extraction options
72
72
  * @returns {Unzipped} The decompressed files
73
73
  */
74
- export declare function unzipSync(data: Uint8Array, opts?: UnzipOptions): Unzipped;
75
- {number} originalSize The original size of the file
76
- * @prop {number} compression The compression format for the data stream.
77
- * @prop {string} [comment]
78
- *
79
- * This number is determined bythe spec in PKZIP's APPNOTE.txt, section 4.4.5. For example,
80
- * 0 = nocompression, 8 = deflate, 14 = LZMA.
81
- *
82
- * If the filter function returns truebut this value is not 8, the unzip function will throw.
83
- */
84
- /**
85
- * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better
86
- * performance with more than one file.
87
- *
88
- * NOTE: Added comment extraction feature (by jeffy-g
89
- *
90
- * @param {Uint8Array} data The raw compressed ZIP file
91
- * @param {UnzipOptions} [opts] The ZIP extraction options
92
- * @returns {Unzipped} The decompressed files
93
- */
94
- export declare function unzipSync(data: Uint8Array, opts?: UnzipOptions): Unzipped;
74
+ export declare function unzipSync(data: Uint8Array, opts?: UnzipOptions): Unzipped;
package/webpack/index.js CHANGED
@@ -1,3 +1,3 @@
1
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,{IM_MAP_ID:()=>te,cleanUp:()=>G,loadCompressedScript:()=>X,setConfig:()=>Q,unzipSync:()=>Y,version:()=>ee});const n=String.fromCharCode,r=Uint8Array,o=Uint16Array,l=Uint32Array,i=new r([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]),a=new r([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 r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),c=(e,t)=>{const n=new o(31);for(let r=0;r<31;++r)n[r]=t+=1<<e[r-1];const r=new l(n[30]);for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)r[t]=t-n[e]<<5|e;return[n,r]},[d,f]=c(i,2);d[28]=258,f[258]=28;const[u,p]=c(a,0),y=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,y[e]=((65280&t)>>>8|(255&t)<<8)>>>1}const g=(e,t,n)=>{const r=e.length;let l=0;const i=new o(t);for(;l<r;++l)e[l]&&++i[e[l]-1];const a=new o(t);for(l=0;l<t;++l)a[l]=a[l-1]+i[l-1]<<1;let s;if(n){s=new o(1<<t);const n=15-t;for(l=0;l<r;++l)if(e[l]){const r=l<<4|e[l],o=t-e[l];let i=a[e[l]-1]++<<o;for(const e=i|(1<<o)-1;i<=e;++i)s[y[i]>>>n]=r}}else for(s=new o(r),l=0;l<r;++l)e[l]&&(s[l]=y[a[e[l]-1]++]>>>15-e[l]);return s},m=new r(288),h=new r(32);{let e=0;for(;e<144;)m[e++]=8;for(;e<256;)m[e++]=9;for(;e<280;)m[e++]=7;for(;e<288;)m[e++]=8;for(e=0;e<32;)h[e++]=5}const b=g(m,9,1),w=g(h,5,1),v=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},k=(e,t)=>{const n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},$=[,r,o,,l],E=(e,t,n)=>{(!t||t<0)&&(t=0),(!n||n>e.length)&&(n=e.length);const r=new $[e.BYTES_PER_ELEMENT](n-t);return r.set(e.subarray(t,n)),r},O=["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"];let x=Error.captureStackTrace;const C=(e,t,n)=>{const r=new Error(t||O[e]);if(r.code=e,x&&x(r,C),!n)throw r;return r},T=(e,t,n)=>{const o=e.length;if(!o||n&&n.f&&!n.l)return t||new r(0);const l=!t||!!n,c=!n||n.i;!n&&(n={}),!t&&(t=new r(3*o));const f=e=>{let n=t.length;if(e>n){const o=new r(Math.max(2*n,e));o.set(t),t=o}};let p=n.f||0,y=n.p||0,m=n.b||0,h=n.l,$=n.d,O=n.m,x=n.n;const T=8*o;do{if(!h){p=S(e,y,1);const i=S(e,y+1,3);if(y+=3,!i){const r=4+((y+7)/8|0),i=e[r-4]|e[r-3]<<8,a=r+i;if(a>o){c&&C(0);break}l&&f(m+i),t.set(e.subarray(r,a),m),n.b=m+=i,n.p=y=8*a,n.f=p;continue}if(1===i)h=b,$=w,O=9,x=5;else if(2===i){const t=S(e,y,31)+257,n=S(e,y+10,15)+4,o=t+S(e,y+5,31)+1;y+=14;const l=new r(o),i=new r(19);for(let t=0;t<n;++t)i[s[t]]=S(e,y+3*t,7);y+=3*n;const a=v(i),c=(1<<a)-1,d=g(i,a,1);for(let t=0;t<o;){const n=d[S(e,y,c)];y+=15&n;const r=n>>>4;if(r<16)l[t++]=r;else{let n=0,o=0;for(16===r?(o=3+S(e,y,3),y+=2,n=l[t-1]):17===r?(o=3+S(e,y,7),y+=3):18===r&&(o=11+S(e,y,127),y+=7);o--;)l[t++]=n}}const f=l.subarray(0,t),u=l.subarray(t);O=v(f),x=v(u),h=g(f,O,1),$=g(u,x,1)}else C(1);if(y>T){c&&C(0);break}}l&&f(m+131072);const E=(1<<O)-1,A=(1<<x)-1;let M=y;for(;;M=y){const n=h[k(e,y)&E],r=n>>>4;if(y+=15&n,y>T){c&&C(0);break}if(n||C(2),r<256)t[m++]=r;else{if(256===r){M=y,h=void 0;break}{let n=r-254;if(r>264){const t=r-257,o=i[t];n=S(e,y,(1<<o)-1)+d[t],y+=o}const o=$[k(e,y)&A],s=o>>>4;o||C(3),y+=15&o;let p=u[s];if(s>3){const t=a[s];p+=k(e,y)&(1<<t)-1,y+=t}if(y>T){c&&C(0);break}l&&f(m+131072);const g=m+n;for(;m<g;m+=4)t[m]=t[m-p],t[m+1]=t[m+1-p],t[m+2]=t[m+2-p],t[m+3]=t[m+3-p];m=g}}}n.l=h,n.p=M,n.b=m,n.f=p,h&&(p=1,n.m=O,n.d=$,n.n=x)}while(!p);return m===t.length?t:E(t,0,m)},A=(e,t)=>e[t]|e[t+1]<<8,M=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,z=(e,t)=>M(e,t)+4294967296*M(e,t+4),P=(e,t)=>t+30+A(e,t+26)+A(e,t+28),U=(e,t,n)=>{const r=!(2048&A(e,t+8)),o=A(e,t+28),l=R(e.subarray(t+46,t+46+o),r),i=t+46+o,a=M(e,t+20),[s,c,d]=n&&4294967295===a?j(e,i):[a,M(e,t+24),M(e,t+42)],f=i+A(e,t+30);return[A(e,t+10),s,c,l,i+A(e,t+30)+A(e,t+32),d,R(e.subarray(f,f+A(e,t+32)),r)]},j=(e,t)=>{for(;1!=A(e,t);t+=4+A(e,t+2));return[z(e,t+12),z(e,t+4),z(e,t+20)]};let _;const L=new r(0);try{const e=new TextDecoder;e.decode(L,{stream:!0}),_=e}catch{}const N=e=>{for(let t="",r=0;;){let o=e[r++];const l=+(o>127)+ +(o>223)+ +(o>239);if(r+l>e.length)return[t,E(e,r-1)];l?3===l?(o=((15&o)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t+=n(55296|o>>10,56320|1023&o)):t+=n(1&l?(31&o)<<6|63&e[r++]:(15&o)<<12|(63&e[r++])<<6|63&e[r++]):t+=n(o)}};function R(e,t){if(t){let t="";for(let r=0;r<e.length;r+=16384)t+=n.apply(null,e.subarray(r,r+16384));return t}if(_)return _.decode(e);{const[t,n]=N(e)
3
- ;return n.length&&C(8),t}}let B,D,J=console.log,q=document,F=Object.keys,I=new TextDecoder,Y=function(e,t){const n={};let o=e.length-22;for(;101010256!=M(e,o);--o)(!o||e.length-o>65558)&&C(13);let l=A(e,o+8);if(!l)return{};let i=M(e,o+16);const a=4294967295===i;a&&(o=M(e,o-12),101075792!=M(e,o)&&C(13),l=M(e,o+32),i=M(e,o+48));const s=t&&t.filter;for(let t=0;t<l;++t){const[t,o,l,c,d,f,u]=U(e,i,a),p=P(e,f);if(i=d,!s||s({name:c,size:o,originalSize:l,compression:t,comment:u})){let i;t?8===t?i=T(e.subarray(p,p+o),new r(l)):C(14,"unknown compression type "+t):i=E(e,p,p+o),i&&(n[c]={data:i,comment:u})}}return n},G=()=>{I=void 0,V=Q=X=G=void 0,B=D=void 0,W=K=H=Y=void 0},H=e=>{let t=/^(?:sha\d{3}-)?([a-z0-9+/=]{44,88})$/i.exec(e);if(t){let n=(e=t[1]).length;if(!(88^n&&64^n&&44^n))return`sha${64==n?384:88==n?512:256}-${e}`}},K=(e,t="text/javascript")=>URL.createObjectURL(new Blob([e],{type:t})),Q=(e,t)=>{B=e,D=t||""},V=(e,t,n=(()=>{}),r={})=>{let o=()=>{n(),J(`script ${t} is ready`)},l=D?q.querySelector(D).nextElementSibling:void 0,i=q.head[l?"insertBefore":"appendChild"](q.createElement("script"),l);i.id=t,r.type&&(i.type=r.type);let a=r.integrity;a?(i.integrity=a,i.crossOrigin="",i.onload=o,i.src=r.url||K(e)):(i.text=e,o())},W=e=>{let t,n=F(e);if(n.includes(te)){n=n.filter((e=>e!==te));let r,o=I.decode(e[te].data),l=JSON.parse(o),i=l.map.imports,a=[],s=new Map;const c=F(i);for(let t=0;t<c.length;){const n=c[t++];let o=s.get(n);o||s.set(n,o=K(I.decode(e[n].data))),i[n]=o,n!==l.main||r||(r=o),!a.includes(n)&&a.push(n)}V(JSON.stringify(l.map,null,2),te,void 0,{type:"importmap"}),n=n.filter((e=>!a.includes(e))),t={entryMain:r,imdata:l}}return[n,t]},X=async(e,t=J)=>{let n=e+".zip",r=await fetch(`${B||"."}/${n}`).then((async e=>{let n=!!e.headers.get("content-encoding"),r=e.body.getReader(),o=(l=+e.headers.get("content-length"),n?l<<1|0:l);var l;let i=new Uint8Array(o),a=0;for(;;){let{done:e,value:n}=await r.read();if(e)break;i.set(n,a),a+=n.length,t(`loading zip: ${a.toLocaleString()} bytes(${a/o*100|0}%)`)}return n?i.slice(0,a):i})).catch((e=>{console.error(e)}));if(r&&r.length){t(`loaded ${n}, decompressing binary...`);let e=`unzip: ${n}`;console.time(e);let o=Y(r);return console.timeEnd(e),t(`${n} decompressed 😃`),new Promise((e=>{let[t,{entryMain:n,imdata:r}={}]=W(o),l=t.length,i=r?.main,a=()=>{! --l&&e()};for(let e,r=0;e=t[r++];){let t=o[e],r=e===i;V(I.decode(t.data),e,a,{integrity:H(t.comment),url:r?n:void 0,type:r?"module":void 0})}}))}throw new Error(`Could not load "${n}"`)},Z=async()=>{Z=void 0;let e=q.querySelector("script[data-csl-config]");if(e){let t=e.dataset.cslConfig;if(t){t=JSON.parse(t);let e=t.load?(Q(t.base,t.selector),Array.isArray(t.load)?t.load:[t.load]):Array.isArray(t)?t:"string"==typeof t?[t]:[],n=[];for(let t of e)n.push(X(t).catch((e=>e)));let r=(await Promise.all(n)).filter((e=>e&&e.name));setTimeout((()=>{let e="function"==typeof cslCallback?cslCallback:window[t.callback||"cslCallback"];"function"==typeof e&&e(r.length?r:void 0)}),60),t.cleanup&&G()}}};setTimeout(Z,99);const ee="v1.4.19",te="$importmap.dat";module.exports=t})();
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,{IM_MAP_ID:()=>te,cleanUp:()=>G,loadCompressedScript:()=>X,setConfig:()=>Q,unzipSync:()=>Y,version:()=>ee});const n=String.fromCharCode,r=Uint8Array,o=Uint16Array,l=Uint32Array,i=new r([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]),a=new r([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 r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),c=(e,t)=>{const n=new o(31);for(let r=0;r<31;++r)n[r]=t+=1<<e[r-1];const r=new l(n[30]);for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)r[t]=t-n[e]<<5|e;return[n,r]},[d,f]=c(i,2);d[28]=258,f[258]=28;const[u,p]=c(a,0),y=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,y[e]=((65280&t)>>>8|(255&t)<<8)>>>1}const g=(e,t,n)=>{const r=e.length;let l=0;const i=new o(t);for(;l<r;++l)e[l]&&++i[e[l]-1];const a=new o(t);for(l=0;l<t;++l)a[l]=a[l-1]+i[l-1]<<1;let s;if(n){s=new o(1<<t);const n=15-t;for(l=0;l<r;++l)if(e[l]){const r=l<<4|e[l],o=t-e[l];let i=a[e[l]-1]++<<o;for(const e=i|(1<<o)-1;i<=e;++i)s[y[i]>>>n]=r}}else for(s=new o(r),l=0;l<r;++l)e[l]&&(s[l]=y[a[e[l]-1]++]>>>15-e[l]);return s},m=new r(288),h=new r(32);{let e=0;for(;e<144;)m[e++]=8;for(;e<256;)m[e++]=9;for(;e<280;)m[e++]=7;for(;e<288;)m[e++]=8;for(e=0;e<32;)h[e++]=5}const b=g(m,9,1),w=g(h,5,1),v=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},k=(e,t)=>{const n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},$=[,r,o,,l],E=(e,t,n)=>{(!t||t<0)&&(t=0),(!n||n>e.length)&&(n=e.length);const r=new $[e.BYTES_PER_ELEMENT](n-t);return r.set(e.subarray(t,n)),r},O=["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"];let x=Error.captureStackTrace;const A=(e,t,n)=>{const r=new Error(t||O[e]);if(r.code=e,x&&x(r,A),!n)throw r;return r},C=(e,t,n)=>{const o=e.length;if(!o||n&&n.f&&!n.l)return t||new r(0);const l=!t||!!n,c=!n||n.i;!n&&(n={}),!t&&(t=new r(3*o));const f=e=>{let n=t.length;if(e>n){const o=new r(Math.max(2*n,e));o.set(t),t=o}};let p=n.f||0,y=n.p||0,m=n.b||0,h=n.l,$=n.d,O=n.m,x=n.n;const C=8*o;do{if(!h){p=S(e,y,1);const i=S(e,y+1,3);if(y+=3,!i){const r=4+((y+7)/8|0),i=e[r-4]|e[r-3]<<8,a=r+i;if(a>o){c&&A(0);break}l&&f(m+i),t.set(e.subarray(r,a),m),n.b=m+=i,n.p=y=8*a,n.f=p;continue}if(1===i)h=b,$=w,O=9,x=5;else if(2===i){const t=S(e,y,31)+257,n=S(e,y+10,15)+4,o=t+S(e,y+5,31)+1;y+=14;const l=new r(o),i=new r(19);for(let t=0;t<n;++t)i[s[t]]=S(e,y+3*t,7);y+=3*n;const a=v(i),c=(1<<a)-1,d=g(i,a,1);for(let t=0;t<o;){const n=d[S(e,y,c)];y+=15&n;const r=n>>>4;if(r<16)l[t++]=r;else{let n=0,o=0;for(16===r?(o=3+S(e,y,3),y+=2,n=l[t-1]):17===r?(o=3+S(e,y,7),y+=3):18===r&&(o=11+S(e,y,127),y+=7);o--;)l[t++]=n}}const f=l.subarray(0,t),u=l.subarray(t);O=v(f),x=v(u),h=g(f,O,1),$=g(u,x,1)}else A(1);if(y>C){c&&A(0);break}}l&&f(m+131072);const E=(1<<O)-1,T=(1<<x)-1;let M=y;for(;;M=y){const n=h[k(e,y)&E],r=n>>>4;if(y+=15&n,y>C){c&&A(0);break}if(n||A(2),r<256)t[m++]=r;else{if(256===r){M=y,h=void 0;break}{let n=r-254;if(r>264){const t=r-257,o=i[t];n=S(e,y,(1<<o)-1)+d[t],y+=o}const o=$[k(e,y)&T],s=o>>>4;o||A(3),y+=15&o;let p=u[s];if(s>3){const t=a[s];p+=k(e,y)&(1<<t)-1,y+=t}if(y>C){c&&A(0);break}l&&f(m+131072);const g=m+n;for(;m<g;m+=4)t[m]=t[m-p],t[m+1]=t[m+1-p],t[m+2]=t[m+2-p],t[m+3]=t[m+3-p];m=g}}}n.l=h,n.p=M,n.b=m,n.f=p,h&&(p=1,n.m=O,n.d=$,n.n=x)}while(!p);return m===t.length?t:E(t,0,m)},T=(e,t)=>e[t]|e[t+1]<<8,M=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,U=(e,t)=>M(e,t)+4294967296*M(e,t+4),z=(e,t)=>t+30+T(e,t+26)+T(e,t+28),P=(e,t,n)=>{const r=!(2048&T(e,t+8)),o=T(e,t+28),l=R(e.subarray(t+46,t+46+o),r),i=t+46+o,a=M(e,t+20),[s,c,d]=n&&4294967295===a?j(e,i):[a,M(e,t+24),M(e,t+42)],f=i+T(e,t+30);return[T(e,t+10),s,c,l,i+T(e,t+30)+T(e,t+32),d,R(e.subarray(f,f+T(e,t+32)),r)]},j=(e,t)=>{for(;1!=T(e,t);t+=4+T(e,t+2));return[U(e,t+12),U(e,t+4),U(e,t+20)]};let _;const L=new r(0);try{const e=new TextDecoder;e.decode(L,{stream:!0}),_=e}catch{}const N=e=>{for(let t="",r=0;;){let o=e[r++];const l=+(o>127)+ +(o>223)+ +(o>239);if(r+l>e.length)return[t,E(e,r-1)];l?3===l?(o=((15&o)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t+=n(55296|o>>10,56320|1023&o)):t+=n(1&l?(31&o)<<6|63&e[r++]:(15&o)<<12|(63&e[r++])<<6|63&e[r++]):t+=n(o)}};function R(e,t){if(t){let t="";for(let r=0;r<e.length;r+=16384)t+=n.apply(null,e.subarray(r,r+16384));return t}if(_)return _.decode(e);{const[t,n]=N(e)
3
+ ;return n.length&&A(8),t}}let B,D,J=console.log,q=document,F=Object.keys,I=new TextDecoder,Y=function(e,t){const n={};let o=e.length-22;for(;101010256!=M(e,o);--o)(!o||e.length-o>65558)&&A(13);let l=T(e,o+8);if(!l)return{};let i=M(e,o+16);const a=4294967295===i;a&&(o=M(e,o-12),101075792!=M(e,o)&&A(13),l=M(e,o+32),i=M(e,o+48));const s=t&&t.filter;for(let t=0;t<l;++t){const[t,o,l,c,d,f,u]=P(e,i,a),p=z(e,f);if(i=d,!s||s({name:c,size:o,originalSize:l,compression:t,comment:u})){let i;t?8===t?i=C(e.subarray(p,p+o),new r(l)):A(14,"unknown compression type "+t):i=E(e,p,p+o),i&&(n[c]={data:i,comment:u})}}return n},G=()=>{I=void 0,V=Q=X=G=void 0,B=D=void 0,W=K=H=Y=void 0},H=e=>{let t=/^(?:sha\d{3}-)?([a-z0-9+/=]{44,88})$/i.exec(e);if(t){let n=(e=t[1]).length;if(!(88^n&&64^n&&44^n))return`sha${64==n?384:88==n?512:256}-${e}`}},K=(e,t="text/javascript")=>URL.createObjectURL(new Blob([e],{type:t})),Q=(e,t)=>{B=e,D=t||""},V=(e,t,n=(()=>{}),r={})=>{let o=()=>{n(),J(`script ${t} is ready`)},l=D?q.querySelector(D).nextElementSibling:void 0,i=q.head[l?"insertBefore":"appendChild"](q.createElement("script"),l);i.id=t,r.type&&(i.type=r.type);let a=r.integrity;a?(i.integrity=a,i.crossOrigin="",i.onload=o,i.src=r.url||K(e)):(i.text=e,o())},W=e=>{let t,n=F(e);if(n.includes(te)){n=n.filter((e=>e!==te));let r,o=I.decode(e[te].data),l=JSON.parse(o),i=l.map.imports,a=[],s=new Map;const c=F(i);for(let t=0;t<c.length;){const n=c[t++];let o=s.get(n);o||s.set(n,o=K(I.decode(e[n].data))),i[n]=o,n!==l.main||r||(r=o),!a.includes(n)&&a.push(n)}V(JSON.stringify(l.map,null,2),te,void 0,{type:"importmap"}),n=n.filter((e=>!a.includes(e))),t={entryMain:r,imdata:l}}return[n,t]},X=async(e,t=J)=>{let n=e+".zip",r=await fetch(`${B||"."}/${n}`).then((async e=>{let n=!!e.headers.get("content-encoding"),r=e.body.getReader(),o=(l=+e.headers.get("content-length"),n?l<<1|0:l);var l;o||(o=5e5,n=!0);let i=new Uint8Array(o),a=0;for(;;){let{value:e}=await r.read();if(!e)break;if(o<a+e.length){o=(o<<1)+e.length;let t=new Uint8Array(o);t.set(i),i=t}i.set(e,a),a+=e.length,t(`loading zip: ${a.toLocaleString()} bytes(${a/o*100|0}%)`)}return n?i.slice(0,a):i})).catch((e=>{console.error(e)}));if(r&&r.length){t(`loaded ${n}, decompressing binary...`);let e=`unzip: ${n}`;console.time(e);let o=Y(r);return console.timeEnd(e),t(`${n} decompressed 😃`),new Promise((e=>{let[t,{entryMain:n,imdata:r}={}]=W(o),l=t.length,i=r?.main,a=()=>{! --l&&e()};for(let e,r=0;e=t[r++];){let t=o[e],r=e===i;V(I.decode(t.data),e,a,{integrity:H(t.comment),url:r?n:void 0,type:r?"module":void 0})}}))}throw new Error(`Could not load "${n}"`)},Z=async()=>{Z=void 0;let e=q.querySelector("script[data-csl-config]");if(e){let t=e.dataset.cslConfig;if(t){t=JSON.parse(t);let e=t.load?(Q(t.base,t.selector),Array.isArray(t.load)?t.load:[t.load]):Array.isArray(t)?t:"string"==typeof t?[t]:[],n=[];for(let t of e)n.push(X(t).catch((e=>e)));let r=(await Promise.all(n)).filter((e=>e&&e.name));setTimeout((()=>{let e="function"==typeof cslCallback?cslCallback:window[t.callback||"cslCallback"];"function"==typeof e&&e(r.length?r:void 0)}),60),t.cleanup&&G()}}};setTimeout(Z,99);const ee="v1.4.21",te="$importmap.dat";module.exports=t})();
@@ -1,3 +1,3 @@
1
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,{Hx:()=>te,Lx:()=>I,aN:()=>W,v6:()=>K,GZ:()=>H,i8:()=>ee});const n=String.fromCharCode,r=Uint8Array,o=Uint16Array,l=Uint32Array,a=new r([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]),i=new r([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 r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),c=(e,t)=>{const n=new o(31);for(let r=0;r<31;++r)n[r]=t+=1<<e[r-1];const r=new l(n[30]);for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)r[t]=t-n[e]<<5|e;return[n,r]},[d,f]=c(a,2);d[28]=258,f[258]=28;const[u,p]=c(i,0),y=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,y[e]=((65280&t)>>>8|(255&t)<<8)>>>1}const g=(e,t,n)=>{const r=e.length;let l=0;const a=new o(t);for(;l<r;++l)e[l]&&++a[e[l]-1];const i=new o(t);for(l=0;l<t;++l)i[l]=i[l-1]+a[l-1]<<1;let s;if(n){s=new o(1<<t);const n=15-t;for(l=0;l<r;++l)if(e[l]){const r=l<<4|e[l],o=t-e[l];let a=i[e[l]-1]++<<o;for(const e=a|(1<<o)-1;a<=e;++a)s[y[a]>>>n]=r}}else for(s=new o(r),l=0;l<r;++l)e[l]&&(s[l]=y[i[e[l]-1]++]>>>15-e[l]);return s},m=new r(288),h=new r(32);{let e=0;for(;e<144;)m[e++]=8;for(;e<256;)m[e++]=9;for(;e<280;)m[e++]=7;for(;e<288;)m[e++]=8;for(e=0;e<32;)h[e++]=5}const w=g(m,9,1),b=g(h,5,1),v=e=>{let t=e[0];for(let n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},k=(e,t,n)=>{const r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},x=(e,t)=>{const n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},S=[,r,o,,l],$=(e,t,n)=>{(!t||t<0)&&(t=0),(!n||n>e.length)&&(n=e.length);const r=new S[e.BYTES_PER_ELEMENT](n-t);return r.set(e.subarray(t,n)),r},E=["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"];let C=Error.captureStackTrace;const O=(e,t,n)=>{const r=new Error(t||E[e]);if(r.code=e,C&&C(r,O),!n)throw r;return r},A=(e,t,n)=>{const o=e.length;if(!o||n&&n.f&&!n.l)return t||new r(0);const l=!t||!!n,c=!n||n.i;!n&&(n={}),!t&&(t=new r(3*o));const f=e=>{let n=t.length;if(e>n){const o=new r(Math.max(2*n,e));o.set(t),t=o}};let p=n.f||0,y=n.p||0,m=n.b||0,h=n.l,S=n.d,E=n.m,C=n.n;const A=8*o;do{if(!h){p=k(e,y,1);const a=k(e,y+1,3);if(y+=3,!a){const r=4+((y+7)/8|0),a=e[r-4]|e[r-3]<<8,i=r+a;if(i>o){c&&O(0);break}l&&f(m+a),t.set(e.subarray(r,i),m),n.b=m+=a,n.p=y=8*i,n.f=p;continue}if(1===a)h=w,S=b,E=9,C=5;else if(2===a){const t=k(e,y,31)+257,n=k(e,y+10,15)+4,o=t+k(e,y+5,31)+1;y+=14;const l=new r(o),a=new r(19);for(let t=0;t<n;++t)a[s[t]]=k(e,y+3*t,7);y+=3*n;const i=v(a),c=(1<<i)-1,d=g(a,i,1);for(let t=0;t<o;){const n=d[k(e,y,c)];y+=15&n;const r=n>>>4;if(r<16)l[t++]=r;else{let n=0,o=0;for(16===r?(o=3+k(e,y,3),y+=2,n=l[t-1]):17===r?(o=3+k(e,y,7),y+=3):18===r&&(o=11+k(e,y,127),y+=7);o--;)l[t++]=n}}const f=l.subarray(0,t),u=l.subarray(t);E=v(f),C=v(u),h=g(f,E,1),S=g(u,C,1)}else O(1);if(y>A){c&&O(0);break}}l&&f(m+131072);const $=(1<<E)-1,z=(1<<C)-1;let T=y;for(;;T=y){const n=h[x(e,y)&$],r=n>>>4;if(y+=15&n,y>A){c&&O(0);break}if(n||O(2),r<256)t[m++]=r;else{if(256===r){T=y,h=void 0;break}{let n=r-254;if(r>264){const t=r-257,o=a[t];n=k(e,y,(1<<o)-1)+d[t],y+=o}const o=S[x(e,y)&z],s=o>>>4;o||O(3),y+=15&o;let p=u[s];if(s>3){const t=i[s];p+=x(e,y)&(1<<t)-1,y+=t}if(y>A){c&&O(0);break}l&&f(m+131072);const g=m+n;for(;m<g;m+=4)t[m]=t[m-p],t[m+1]=t[m+1-p],t[m+2]=t[m+2-p],t[m+3]=t[m+3-p];m=g}}}n.l=h,n.p=T,n.b=m,n.f=p,h&&(p=1,n.m=E,n.d=S,n.n=C)}while(!p);return m===t.length?t:$(t,0,m)},z=(e,t)=>e[t]|e[t+1]<<8,T=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,U=(e,t)=>T(e,t)+4294967296*T(e,t+4),M=(e,t)=>t+30+z(e,t+26)+z(e,t+28),L=(e,t,n)=>{const r=!(2048&z(e,t+8)),o=z(e,t+28),l=_(e.subarray(t+46,t+46+o),r),a=t+46+o,i=T(e,t+20),[s,c,d]=n&&4294967295===i?N(e,a):[i,T(e,t+24),T(e,t+42)],f=a+z(e,t+30);return[z(e,t+10),s,c,l,a+z(e,t+30)+z(e,t+32),d,_(e.subarray(f,f+z(e,t+32)),r)]},N=(e,t)=>{for(;1!=z(e,t);t+=4+z(e,t+2));return[U(e,t+12),U(e,t+4),U(e,t+20)]};let P;const j=new r(0);try{const e=new TextDecoder;e.decode(j,{stream:!0}),P=e}catch{}const R=e=>{for(let t="",r=0;;){let o=e[r++];const l=+(o>127)+ +(o>223)+ +(o>239);if(r+l>e.length)return[t,$(e,r-1)];l?3===l?(o=((15&o)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t+=n(55296|o>>10,56320|1023&o)):t+=n(1&l?(31&o)<<6|63&e[r++]:(15&o)<<12|(63&e[r++])<<6|63&e[r++]):t+=n(o)}};function _(e,t){if(t){let t="";for(let r=0;r<e.length;r+=16384)t+=n.apply(null,e.subarray(r,r+16384));return t}if(P)return P.decode(e);{const[t,n]=R(e);return n.length&&O(8),t}}let B,D,J=console.log,q=document,F=Object.keys,G=new TextDecoder,H=function(e,t){const n={};let o=e.length-22;for(;101010256!=T(e,o);--o)(!o||e.length-o>65558)&&O(13);let l=z(e,o+8);if(!l)return{};let a=T(e,o+16)
3
- ;const i=4294967295===a;i&&(o=T(e,o-12),101075792!=T(e,o)&&O(13),l=T(e,o+32),a=T(e,o+48));const s=t&&t.filter;for(let t=0;t<l;++t){const[t,o,l,c,d,f,u]=L(e,a,i),p=M(e,f);if(a=d,!s||s({name:c,size:o,originalSize:l,compression:t,comment:u})){let a;t?8===t?a=A(e.subarray(p,p+o),new r(l)):O(14,"unknown compression type "+t):a=$(e,p,p+o),a&&(n[c]={data:a,comment:u})}}return n},I=()=>{G=void 0,Q=K=W=I=void 0,B=D=void 0,V=Y=Z=H=void 0},Z=e=>{let t=/^(?:sha\d{3}-)?([a-z0-9+/=]{44,88})$/i.exec(e);if(t){let n=(e=t[1]).length;if(!(88^n&&64^n&&44^n))return`sha${64==n?384:88==n?512:256}-${e}`}},Y=(e,t="text/javascript")=>URL.createObjectURL(new Blob([e],{type:t})),K=(e,t)=>{B=e,D=t||""},Q=(e,t,n=(()=>{}),r={})=>{let o=()=>{n(),J(`script ${t} is ready`)},l=D?q.querySelector(D).nextElementSibling:void 0,a=q.head[l?"insertBefore":"appendChild"](q.createElement("script"),l);a.id=t,r.type&&(a.type=r.type);let i=r.integrity;i?(a.integrity=i,a.crossOrigin="",a.onload=o,a.src=r.url||Y(e)):(a.text=e,o())},V=e=>{let t,n=F(e);if(n.includes(te)){n=n.filter((e=>e!==te));let r,o=G.decode(e[te].data),l=JSON.parse(o),a=l.map.imports,i=[],s=new Map;const c=F(a);for(let t=0;t<c.length;){const n=c[t++];let o=s.get(n);o||s.set(n,o=Y(G.decode(e[n].data))),a[n]=o,n!==l.main||r||(r=o),!i.includes(n)&&i.push(n)}Q(JSON.stringify(l.map,null,2),te,void 0,{type:"importmap"}),n=n.filter((e=>!i.includes(e))),t={entryMain:r,imdata:l}}return[n,t]},W=async(e,t=J)=>{let n=e+".zip",r=await fetch(`${B||"."}/${n}`).then((async e=>{let n=!!e.headers.get("content-encoding"),r=e.body.getReader(),o=(l=+e.headers.get("content-length"),n?l<<1|0:l);var l;let a=new Uint8Array(o),i=0;for(;;){let{done:e,value:n}=await r.read();if(e)break;a.set(n,i),i+=n.length,t(`loading zip: ${i.toLocaleString()} bytes(${i/o*100|0}%)`)}return n?a.slice(0,i):a})).catch((e=>{console.error(e)}));if(r&&r.length){t(`loaded ${n}, decompressing binary...`);let e=`unzip: ${n}`;console.time(e);let o=H(r);return console.timeEnd(e),t(`${n} decompressed 😃`),new Promise((e=>{let[t,{entryMain:n,imdata:r}={}]=V(o),l=t.length,a=r?.main,i=()=>{! --l&&e()};for(let e,r=0;e=t[r++];){let t=o[e],r=e===a;Q(G.decode(t.data),e,i,{integrity:Z(t.comment),url:r?n:void 0,type:r?"module":void 0})}}))}throw new Error(`Could not load "${n}"`)},X=async()=>{X=void 0;let e=q.querySelector("script[data-csl-config]");if(e){let t=e.dataset.cslConfig;if(t){t=JSON.parse(t);let e=t.load?(K(t.base,t.selector),Array.isArray(t.load)?t.load:[t.load]):Array.isArray(t)?t:"string"==typeof t?[t]:[],n=[];for(let t of e)n.push(W(t).catch((e=>e)));let r=(await Promise.all(n)).filter((e=>e&&e.name));setTimeout((()=>{let e="function"==typeof cslCallback?cslCallback:window[t.callback||"cslCallback"];"function"==typeof e&&e(r.length?r:void 0)}),60),t.cleanup&&I()}}};setTimeout(X,99);const ee="v1.4.19",te="$importmap.dat";var ne=t.Hx,re=t.Lx,oe=t.aN,le=t.v6,ae=t.GZ,ie=t.i8;export{ne as IM_MAP_ID,re as cleanUp,oe as loadCompressedScript,le as setConfig,ae as unzipSync,ie as version};
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,{Hx:()=>te,Lx:()=>I,aN:()=>W,v6:()=>K,GZ:()=>H,i8:()=>ee});const n=String.fromCharCode,r=Uint8Array,o=Uint16Array,l=Uint32Array,a=new r([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]),i=new r([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 r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),c=(e,t)=>{const n=new o(31);for(let r=0;r<31;++r)n[r]=t+=1<<e[r-1];const r=new l(n[30]);for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)r[t]=t-n[e]<<5|e;return[n,r]},[f,d]=c(a,2);f[28]=258,d[258]=28;const[u,p]=c(i,0),y=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,y[e]=((65280&t)>>>8|(255&t)<<8)>>>1}const g=(e,t,n)=>{const r=e.length;let l=0;const a=new o(t);for(;l<r;++l)e[l]&&++a[e[l]-1];const i=new o(t);for(l=0;l<t;++l)i[l]=i[l-1]+a[l-1]<<1;let s;if(n){s=new o(1<<t);const n=15-t;for(l=0;l<r;++l)if(e[l]){const r=l<<4|e[l],o=t-e[l];let a=i[e[l]-1]++<<o;for(const e=a|(1<<o)-1;a<=e;++a)s[y[a]>>>n]=r}}else for(s=new o(r),l=0;l<r;++l)e[l]&&(s[l]=y[i[e[l]-1]++]>>>15-e[l]);return s},h=new r(288),m=new r(32);{let e=0;for(;e<144;)h[e++]=8;for(;e<256;)h[e++]=9;for(;e<280;)h[e++]=7;for(;e<288;)h[e++]=8;for(e=0;e<32;)m[e++]=5}const w=g(h,9,1),b=g(m,5,1),v=e=>{let t=e[0];for(let n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},k=(e,t,n)=>{const r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},x=(e,t)=>{const n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},S=[,r,o,,l],$=(e,t,n)=>{(!t||t<0)&&(t=0),(!n||n>e.length)&&(n=e.length);const r=new S[e.BYTES_PER_ELEMENT](n-t);return r.set(e.subarray(t,n)),r},E=["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"];let A=Error.captureStackTrace;const C=(e,t,n)=>{const r=new Error(t||E[e]);if(r.code=e,A&&A(r,C),!n)throw r;return r},O=(e,t,n)=>{const o=e.length;if(!o||n&&n.f&&!n.l)return t||new r(0);const l=!t||!!n,c=!n||n.i;!n&&(n={}),!t&&(t=new r(3*o));const d=e=>{let n=t.length;if(e>n){const o=new r(Math.max(2*n,e));o.set(t),t=o}};let p=n.f||0,y=n.p||0,h=n.b||0,m=n.l,S=n.d,E=n.m,A=n.n;const O=8*o;do{if(!m){p=k(e,y,1);const a=k(e,y+1,3);if(y+=3,!a){const r=4+((y+7)/8|0),a=e[r-4]|e[r-3]<<8,i=r+a;if(i>o){c&&C(0);break}l&&d(h+a),t.set(e.subarray(r,i),h),n.b=h+=a,n.p=y=8*i,n.f=p;continue}if(1===a)m=w,S=b,E=9,A=5;else if(2===a){const t=k(e,y,31)+257,n=k(e,y+10,15)+4,o=t+k(e,y+5,31)+1;y+=14;const l=new r(o),a=new r(19);for(let t=0;t<n;++t)a[s[t]]=k(e,y+3*t,7);y+=3*n;const i=v(a),c=(1<<i)-1,f=g(a,i,1);for(let t=0;t<o;){const n=f[k(e,y,c)];y+=15&n;const r=n>>>4;if(r<16)l[t++]=r;else{let n=0,o=0;for(16===r?(o=3+k(e,y,3),y+=2,n=l[t-1]):17===r?(o=3+k(e,y,7),y+=3):18===r&&(o=11+k(e,y,127),y+=7);o--;)l[t++]=n}}const d=l.subarray(0,t),u=l.subarray(t);E=v(d),A=v(u),m=g(d,E,1),S=g(u,A,1)}else C(1);if(y>O){c&&C(0);break}}l&&d(h+131072);const $=(1<<E)-1,U=(1<<A)-1;let z=y;for(;;z=y){const n=m[x(e,y)&$],r=n>>>4;if(y+=15&n,y>O){c&&C(0);break}if(n||C(2),r<256)t[h++]=r;else{if(256===r){z=y,m=void 0;break}{let n=r-254;if(r>264){const t=r-257,o=a[t];n=k(e,y,(1<<o)-1)+f[t],y+=o}const o=S[x(e,y)&U],s=o>>>4;o||C(3),y+=15&o;let p=u[s];if(s>3){const t=i[s];p+=x(e,y)&(1<<t)-1,y+=t}if(y>O){c&&C(0);break}l&&d(h+131072);const g=h+n;for(;h<g;h+=4)t[h]=t[h-p],t[h+1]=t[h+1-p],t[h+2]=t[h+2-p],t[h+3]=t[h+3-p];h=g}}}n.l=m,n.p=z,n.b=h,n.f=p,m&&(p=1,n.m=E,n.d=S,n.n=A)}while(!p);return h===t.length?t:$(t,0,h)},U=(e,t)=>e[t]|e[t+1]<<8,z=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,T=(e,t)=>z(e,t)+4294967296*z(e,t+4),M=(e,t)=>t+30+U(e,t+26)+U(e,t+28),L=(e,t,n)=>{const r=!(2048&U(e,t+8)),o=U(e,t+28),l=_(e.subarray(t+46,t+46+o),r),a=t+46+o,i=z(e,t+20),[s,c,f]=n&&4294967295===i?N(e,a):[i,z(e,t+24),z(e,t+42)],d=a+U(e,t+30);return[U(e,t+10),s,c,l,a+U(e,t+30)+U(e,t+32),f,_(e.subarray(d,d+U(e,t+32)),r)]},N=(e,t)=>{for(;1!=U(e,t);t+=4+U(e,t+2));return[T(e,t+12),T(e,t+4),T(e,t+20)]};let P;const j=new r(0);try{const e=new TextDecoder;e.decode(j,{stream:!0}),P=e}catch{}const R=e=>{for(let t="",r=0;;){let o=e[r++];const l=+(o>127)+ +(o>223)+ +(o>239);if(r+l>e.length)return[t,$(e,r-1)];l?3===l?(o=((15&o)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t+=n(55296|o>>10,56320|1023&o)):t+=n(1&l?(31&o)<<6|63&e[r++]:(15&o)<<12|(63&e[r++])<<6|63&e[r++]):t+=n(o)}};function _(e,t){if(t){let t="";for(let r=0;r<e.length;r+=16384)t+=n.apply(null,e.subarray(r,r+16384));return t}if(P)return P.decode(e);{const[t,n]=R(e);return n.length&&C(8),t}}let B,D,J=console.log,q=document,F=Object.keys,G=new TextDecoder,H=function(e,t){const n={};let o=e.length-22;for(;101010256!=z(e,o);--o)(!o||e.length-o>65558)&&C(13);let l=U(e,o+8);if(!l)return{};let a=z(e,o+16)
3
+ ;const i=4294967295===a;i&&(o=z(e,o-12),101075792!=z(e,o)&&C(13),l=z(e,o+32),a=z(e,o+48));const s=t&&t.filter;for(let t=0;t<l;++t){const[t,o,l,c,f,d,u]=L(e,a,i),p=M(e,d);if(a=f,!s||s({name:c,size:o,originalSize:l,compression:t,comment:u})){let a;t?8===t?a=O(e.subarray(p,p+o),new r(l)):C(14,"unknown compression type "+t):a=$(e,p,p+o),a&&(n[c]={data:a,comment:u})}}return n},I=()=>{G=void 0,Q=K=W=I=void 0,B=D=void 0,V=Y=Z=H=void 0},Z=e=>{let t=/^(?:sha\d{3}-)?([a-z0-9+/=]{44,88})$/i.exec(e);if(t){let n=(e=t[1]).length;if(!(88^n&&64^n&&44^n))return`sha${64==n?384:88==n?512:256}-${e}`}},Y=(e,t="text/javascript")=>URL.createObjectURL(new Blob([e],{type:t})),K=(e,t)=>{B=e,D=t||""},Q=(e,t,n=(()=>{}),r={})=>{let o=()=>{n(),J(`script ${t} is ready`)},l=D?q.querySelector(D).nextElementSibling:void 0,a=q.head[l?"insertBefore":"appendChild"](q.createElement("script"),l);a.id=t,r.type&&(a.type=r.type);let i=r.integrity;i?(a.integrity=i,a.crossOrigin="",a.onload=o,a.src=r.url||Y(e)):(a.text=e,o())},V=e=>{let t,n=F(e);if(n.includes(te)){n=n.filter((e=>e!==te));let r,o=G.decode(e[te].data),l=JSON.parse(o),a=l.map.imports,i=[],s=new Map;const c=F(a);for(let t=0;t<c.length;){const n=c[t++];let o=s.get(n);o||s.set(n,o=Y(G.decode(e[n].data))),a[n]=o,n!==l.main||r||(r=o),!i.includes(n)&&i.push(n)}Q(JSON.stringify(l.map,null,2),te,void 0,{type:"importmap"}),n=n.filter((e=>!i.includes(e))),t={entryMain:r,imdata:l}}return[n,t]},W=async(e,t=J)=>{let n=e+".zip",r=await fetch(`${B||"."}/${n}`).then((async e=>{let n=!!e.headers.get("content-encoding"),r=e.body.getReader(),o=(l=+e.headers.get("content-length"),n?l<<1|0:l);var l;o||(o=5e5,n=!0);let a=new Uint8Array(o),i=0;for(;;){let{value:e}=await r.read();if(!e)break;if(o<i+e.length){o=(o<<1)+e.length;let t=new Uint8Array(o);t.set(a),a=t}a.set(e,i),i+=e.length,t(`loading zip: ${i.toLocaleString()} bytes(${i/o*100|0}%)`)}return n?a.slice(0,i):a})).catch((e=>{console.error(e)}));if(r&&r.length){t(`loaded ${n}, decompressing binary...`);let e=`unzip: ${n}`;console.time(e);let o=H(r);return console.timeEnd(e),t(`${n} decompressed 😃`),new Promise((e=>{let[t,{entryMain:n,imdata:r}={}]=V(o),l=t.length,a=r?.main,i=()=>{! --l&&e()};for(let e,r=0;e=t[r++];){let t=o[e],r=e===a;Q(G.decode(t.data),e,i,{integrity:Z(t.comment),url:r?n:void 0,type:r?"module":void 0})}}))}throw new Error(`Could not load "${n}"`)},X=async()=>{X=void 0;let e=q.querySelector("script[data-csl-config]");if(e){let t=e.dataset.cslConfig;if(t){t=JSON.parse(t);let e=t.load?(K(t.base,t.selector),Array.isArray(t.load)?t.load:[t.load]):Array.isArray(t)?t:"string"==typeof t?[t]:[],n=[];for(let t of e)n.push(W(t).catch((e=>e)));let r=(await Promise.all(n)).filter((e=>e&&e.name));setTimeout((()=>{let e="function"==typeof cslCallback?cslCallback:window[t.callback||"cslCallback"];"function"==typeof e&&e(r.length?r:void 0)}),60),t.cleanup&&I()}}};setTimeout(X,99);const ee="v1.4.21",te="$importmap.dat";var ne=t.Hx,re=t.Lx,oe=t.aN,le=t.v6,ae=t.GZ,ie=t.i8;export{ne as IM_MAP_ID,re as cleanUp,oe as loadCompressedScript,le as setConfig,ae as unzipSync,ie as version};