@bluepic/embed 0.4.0-next.84 → 0.4.0-next.86
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/bluepic-embed.iife.js +74 -74
- package/dist/bluepic-embed.umd.js +74 -74
- package/dist/components/TemplateEditor/ExportPopoup.vue.d.ts +7 -0
- package/dist/index-CWm6zOv7.js +175 -0
- package/dist/index-DFXQWOGQ.cjs +1 -0
- package/dist/main.cjs +90 -90
- package/dist/main.mjs +19029 -19704
- package/dist/style.css +1 -1
- package/dist/unzipit.module-4zGfAuq6.cjs +1 -0
- package/dist/unzipit.module-qN5XWVVT.js +649 -0
- package/dist/util/export.d.ts +1 -1
- package/package.json +5 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function ie(e){return e.arrayBuffer?e.arrayBuffer():new Promise((t,r)=>{const n=new FileReader;n.addEventListener("loadend",()=>{t(n.result)}),n.addEventListener("error",r),n.readAsArrayBuffer(e)})}async function pe(e){const t=await ie(e);return new Uint8Array(t)}function se(e){return typeof Blob<"u"&&e instanceof Blob}function D(e){return typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer}const ye=typeof process<"u"&&process.versions&&typeof process.versions.node<"u"&&typeof process.versions.electron>"u";function ge(e){return e.byteOffset===0&&e.byteLength===e.buffer.byteLength}class te{constructor(t){this.typedArray=t instanceof ArrayBuffer||D(t)?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}async getLength(){return this.typedArray.byteLength}async read(t,r){return new Uint8Array(this.typedArray.buffer,this.typedArray.byteOffset+t,r)}}class re{constructor(t){this.blob=t}async getLength(){return this.blob.size}async read(t,r){const n=this.blob.slice(t,t+r),o=await ie(n);return new Uint8Array(o)}async sliceAsBlob(t,r,n=""){return this.blob.slice(t,t+r,n)}}class ve{constructor(t){this.url=t}async getLength(){if(this.length===void 0){const t=await fetch(this.url,{method:"HEAD"});if(!t.ok)throw new Error(`failed http request ${this.url}, status: ${t.status}: ${t.statusText}`);if(this.length=parseInt(t.headers.get("content-length")),Number.isNaN(this.length))throw Error("could not get length")}return this.length}async read(t,r){if(r===0)return new Uint8Array(0);const n=await fetch(this.url,{headers:{Range:`bytes=${t}-${t+r-1}`}});if(!n.ok)throw new Error(`failed http request ${this.url}, status: ${n.status} offset: ${t} size: ${r}: ${n.statusText}`);const o=await n.arrayBuffer();return new Uint8Array(o)}}function be(e,t){var r=Uint8Array;if(e[0]==3&&e[1]==0)return t||new r(0);var n=Ae,o=ae,i=xe,a=fe,c=t==null;c&&(t=new r(e.length>>>2<<3));for(var l=0,w=0,h=0,u=0,v=0,f=0,L=0,m=0,d=0,E,k;l==0;){if(l=n(e,d,1),w=n(e,d+1,2),d+=3,w==0){d&7&&(d+=8-(d&7));var y=(d>>>3)+4,x=e[y-4]|e[y-3]<<8;c&&(t=j(t,m+x)),t.set(new r(e.buffer,e.byteOffset+y,x),m),d=y+x<<3,m+=x;continue}if(c&&(t=j(t,m+(1<<17))),w==1&&(E=s.flmap,k=s.fdmap,f=511,L=31),w==2){h=o(e,d,5)+257,u=o(e,d+5,5)+1,v=o(e,d+10,4)+4,d+=14;for(var p=0;p<38;p+=2)s.itree[p]=0,s.itree[p+1]=0;for(var z=1,p=0;p<v;p++){var M=o(e,d+p*3,3);s.itree[(s.ordr[p]<<1)+1]=M,M>z&&(z=M)}d+=3*v,U(s.itree,z),_(s.itree,z,s.imap),E=s.lmap,k=s.dmap,d=i(s.imap,(1<<z)-1,h+u,e,d,s.ttree);var C=ne(s.ttree,0,h,s.ltree);f=(1<<C)-1;var H=ne(s.ttree,h,u,s.dtree);L=(1<<H)-1,U(s.ltree,C),_(s.ltree,C,E),U(s.dtree,H),_(s.dtree,H,k)}for(;;){var V=E[a(e,d)&f];d+=V&15;var R=V>>>4;if(!(R>>>8))t[m++]=R;else{if(R==256)break;var I=m+R-254;if(R>264){var P=s.ldef[R-257];I=m+(P>>>3)+o(e,d,P&7),d+=P&7}var ee=k[a(e,d)&L];d+=ee&15;var we=ee>>>4,q=s.ddef[we],$=(q>>>4)+n(e,d,q&15);for(d+=q&15,c&&(t=j(t,m+(1<<17)));m<I;)t[m]=t[m++-$],t[m]=t[m++-$],t[m]=t[m++-$],t[m]=t[m++-$];m=I}}}return t.length==m?t:t.slice(0,m)}function j(e,t){var r=e.length;if(t<=r)return e;var n=new Uint8Array(Math.max(r<<1,t));return n.set(e,0),n}function xe(e,t,r,n,o,i){for(var a=ae,c=fe,l=0;l<r;){var w=e[c(n,o)&t];o+=w&15;var h=w>>>4;if(h<=15)i[l]=h,l++;else{var u=0,v=0;h==16?(v=3+a(n,o,2),o+=2,u=i[l-1]):h==17?(v=3+a(n,o,3),o+=3):h==18&&(v=11+a(n,o,7),o+=7);for(var f=l+v;l<f;)i[l]=u,l++}}return o}function ne(e,t,r,n){for(var o=0,i=0,a=n.length>>>1;i<r;){var c=e[i+t];n[i<<1]=0,n[(i<<1)+1]=c,c>o&&(o=c),i++}for(;i<a;)n[i<<1]=0,n[(i<<1)+1]=0,i++;return o}function U(e,t){for(var r=e.length,n,o,i,a,c,l=s.bl_count,a=0;a<=t;a++)l[a]=0;for(a=1;a<r;a+=2)l[e[a]]++;var w=s.next_code;for(n=0,l[0]=0,o=1;o<=t;o++)n=n+l[o-1]<<1,w[o]=n;for(i=0;i<r;i+=2)c=e[i+1],c!=0&&(e[i]=w[c],w[c]++)}function _(e,t,r){for(var n=e.length,o=s.rev15,i=0;i<n;i+=2)if(e[i+1]!=0)for(var a=i>>1,c=e[i+1],l=a<<4|c,w=t-c,h=e[i]<<w,u=h+(1<<w);h!=u;){var v=o[h]>>>15-t;r[v]=l,h++}}function oe(e,t){for(var r=s.rev15,n=15-t,o=0;o<e.length;o+=2){var i=e[o]<<t-e[o+1];e[o]=r[i]>>>n}}function ae(e,t,r){return(e[t>>>3]|e[(t>>>3)+1]<<8)>>>(t&7)&(1<<r)-1}function Ae(e,t,r){return(e[t>>>3]|e[(t>>>3)+1]<<8|e[(t>>>3)+2]<<16)>>>(t&7)&(1<<r)-1}function fe(e,t){return(e[t>>>3]|e[(t>>>3)+1]<<8|e[(t>>>3)+2]<<16)>>>(t&7)}const s=function(){var e=Uint16Array,t=Uint32Array;return{next_code:new e(16),bl_count:new e(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[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],ldef:new e(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[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],ddef:new t(32),flmap:new e(512),fltree:[],fdmap:new e(32),fdtree:[],lmap:new e(32768),ltree:[],ttree:[],dmap:new e(32768),dtree:[],imap:new e(512),itree:[],rev15:new e(32768),lhst:new t(286),dhst:new t(30),ihst:new t(19),lits:new t(15e3),strt:new e(65536),prev:new e(32768)}}();(function(){for(var e=32768,t=0;t<e;t++){var r=t;r=(r&2863311530)>>>1|(r&1431655765)<<1,r=(r&3435973836)>>>2|(r&858993459)<<2,r=(r&4042322160)>>>4|(r&252645135)<<4,r=(r&4278255360)>>>8|(r&16711935)<<8,s.rev15[t]=(r>>>16|r<<16)>>>17}function n(o,i,a){for(;i--!=0;)o.push(0,a)}for(var t=0;t<32;t++)s.ldef[t]=s.of0[t]<<3|s.exb[t],s.ddef[t]=s.df0[t]<<4|s.dxb[t];n(s.fltree,144,8),n(s.fltree,112,9),n(s.fltree,24,7),n(s.fltree,8,8),U(s.fltree,9),_(s.fltree,9,s.flmap),oe(s.fltree,9),n(s.fdtree,32,5),U(s.fdtree,5),_(s.fdtree,5,s.fdmap),oe(s.fdtree,5),n(s.itree,19,0),n(s.ltree,286,0),n(s.dtree,30,0),n(s.ttree,320,0)})();(function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var r=t,n=0;n<8;n++)r&1?r=3988292384^r>>>1:r=r>>>1;e[t]=r}return e})();function Le(e,t){return be(e,t)}const A={numWorkers:1,workerURL:"",useWorkers:!1};let ze=0,Q=0,W=!0;const J=[],F=[],B=[],N=new Map;function Ee(e){ce(e.target);const{id:t,error:r,data:n}=e.data,o=N.get(t);N.delete(t),r?o.reject(r):o.resolve(n)}function G(e){return new Promise((t,r)=>{const n=new Worker(e);n.onmessage=o=>{o.data==="start"?(n.onerror=void 0,n.onmessage=void 0,t(n)):r(new Error(`unexpected message: ${o.data}`))},n.onerror=r})}function ke(e,t){return e.require?e.require(t):{}}const K=function(){if(ye){const{Worker:e}=ke(module,"worker_threads");return{async createWorker(t){return new e(t)},addEventListener(t,r){t.on("message",n=>{r({target:t,data:n})})},async terminate(t){await t.terminate()}}}else return{async createWorker(e){try{return await G(e)}catch{console.warn("could not load worker:",e)}let t;try{const r=await fetch(e,{mode:"cors"});if(!r.ok)throw new Error(`could not load: ${e}`);t=await r.text(),e=URL.createObjectURL(new Blob([t],{type:"application/javascript"}));const n=await G(e);return A.workerURL=e,n}catch{console.warn("could not load worker via fetch:",e)}if(t!==void 0)try{e=`data:application/javascript;base64,${btoa(t)}`;const r=await G(e);return A.workerURL=e,r}catch{console.warn("could not load worker via dataURI")}throw console.warn("workers will not be used"),new Error("can not start workers")},addEventListener(e,t){e.addEventListener("message",t)},async terminate(e){e.terminate()}}}();function ce(e){F.push(e),le()}async function Be(){if(F.length===0&&Q<A.numWorkers){++Q;try{const e=await K.createWorker(A.workerURL);J.push(e),F.push(e),K.addEventListener(e,Ee)}catch{W=!1}}return F.pop()}function Se(e,t,r,n){const o=new Uint8Array(t);Le(e,o),n(r?new Blob([o],{type:r}):o.buffer)}async function le(){if(B.length!==0){if(A.useWorkers&&W){const e=await Be();if(W){if(e){if(B.length===0){ce(e);return}const{id:t,src:r,uncompressedSize:n,type:o,resolve:i,reject:a}=B.shift();N.set(t,{id:t,resolve:i,reject:a});const c=[];e.postMessage({type:"inflate",data:{id:t,type:o,src:r,uncompressedSize:n}},c)}return}}for(;B.length;){const{src:e,uncompressedSize:t,type:r,resolve:n}=B.shift();let o=e;se(e)&&(o=await pe(e)),Se(o,t,r,n)}}}function Re(e){A.workerURL=e.workerURL||A.workerURL,e.workerURL&&(A.useWorkers=!0),A.useWorkers=e.useWorkers!==void 0?e.useWorkers:A.useWorkers,A.numWorkers=e.numWorkers||A.numWorkers}function de(e,t,r){return new Promise((n,o)=>{B.push({src:e,uncompressedSize:t,type:r,resolve:n,reject:o,id:ze++}),le()})}function Z(e){e.splice(0,e.length)}async function Oe(){for(const e of J)await K.terminate(e);Z(J),Z(F),Z(B),N.clear(),Q=0,W=!0}function Ue(e,t){const r=e&31,n=(e>>5&15)-1,o=(e>>9&127)+1980,i=0,a=(t&31)*2,c=t>>5&63,l=t>>11&31;return new Date(o,n,r,l,c,a,i)}class _e{constructor(t,r){this._reader=t,this._rawEntry=r,this.name=r.name,this.nameBytes=r.nameBytes,this.size=r.uncompressedSize,this.compressedSize=r.compressedSize,this.comment=r.comment,this.commentBytes=r.commentBytes,this.compressionMethod=r.compressionMethod,this.lastModDate=Ue(r.lastModFileDate,r.lastModFileTime),this.isDirectory=r.uncompressedSize===0&&r.name.endsWith("/"),this.encrypted=!!(r.generalPurposeBitFlag&1),this.externalFileAttributes=r.externalFileAttributes,this.versionMadeBy=r.versionMadeBy}async blob(t="application/octet-stream"){return await Pe(this._reader,this._rawEntry,t)}async arrayBuffer(){return await Ie(this._reader,this._rawEntry)}async text(){const t=await this.arrayBuffer();return T(new Uint8Array(t))}async json(){const t=await this.text();return JSON.parse(t)}}const Y=22,Fe=65535,Te=101010256,De=101075792;async function O(e,t,r){return await e.read(t,r)}async function X(e,t,r,n){return e.sliceAsBlob?await e.sliceAsBlob(t,r,n):await e.read(t,r)}const $e={unsigned(){return 0}};function g(e,t){return e[t]+e[t+1]*256}function b(e,t){return e[t]+e[t+1]*256+e[t+2]*65536+e[t+3]*16777216}function S(e,t){return b(e,t)+b(e,t+4)*4294967296}const We=new TextDecoder;function T(e,t){return D(e.buffer)&&(e=new Uint8Array(e)),We.decode(e)}async function Ne(e,t){const r=Math.min(Y+Fe,t),n=t-r,o=await O(e,n,r);for(let i=r-Y;i>=0;--i){if(b(o,i)!==Te)continue;const a=new Uint8Array(o.buffer,o.byteOffset+i,o.byteLength-i),c=g(a,4);if(c!==0)throw new Error(`multi-volume zip files are not supported. This is volume: ${c}`);const l=g(a,10),w=b(a,12),h=b(a,16),u=g(a,20),v=a.length-Y;if(u!==v)throw new Error(`invalid comment length. expected: ${v}, actual: ${u}`);const f=new Uint8Array(a.buffer,a.byteOffset+22,u),L=T(f);return l===65535||h===4294967295?await Ce(e,n+i,L,f):await ue(e,h,w,l,L,f)}throw new Error("could not find end of central directory. maybe not zip file")}const Me=117853008;async function Ce(e,t,r,n){const o=t-20,i=await O(e,o,20);if(b(i,0)!==Me)throw new Error("invalid zip64 end of central directory locator signature");const a=S(i,8),c=await O(e,a,56);if(b(c,0)!==De)throw new Error("invalid zip64 end of central directory record signature");const l=S(c,32),w=S(c,40),h=S(c,48);return ue(e,h,w,l,r,n)}const He=33639248;async function ue(e,t,r,n,o,i){let a=0;const c=await O(e,t,r),l=[];for(let h=0;h<n;++h){const u=c.subarray(a,a+46),v=b(u,0);if(v!==He)throw new Error(`invalid central directory file header signature: 0x${v.toString(16)}`);const f={versionMadeBy:g(u,4),versionNeededToExtract:g(u,6),generalPurposeBitFlag:g(u,8),compressionMethod:g(u,10),lastModFileTime:g(u,12),lastModFileDate:g(u,14),crc32:b(u,16),compressedSize:b(u,20),uncompressedSize:b(u,24),fileNameLength:g(u,28),extraFieldLength:g(u,30),fileCommentLength:g(u,32),internalFileAttributes:g(u,36),externalFileAttributes:b(u,38),relativeOffsetOfLocalHeader:b(u,42)};if(f.generalPurposeBitFlag&64)throw new Error("strong encryption is not supported");a+=46;const L=c.subarray(a,a+f.fileNameLength+f.extraFieldLength+f.fileCommentLength);f.nameBytes=L.slice(0,f.fileNameLength),f.name=T(f.nameBytes);const m=f.fileNameLength+f.extraFieldLength,d=L.slice(f.fileNameLength,m);f.extraFields=[];let E=0;for(;E<d.length-3;){const y=g(d,E+0),x=g(d,E+2),p=E+4,z=p+x;if(z>d.length)throw new Error("extra field length exceeds extra field buffer size");f.extraFields.push({id:y,data:d.slice(p,z)}),E=z}if(f.commentBytes=L.slice(m,m+f.fileCommentLength),f.comment=T(f.commentBytes),a+=L.length,f.uncompressedSize===4294967295||f.compressedSize===4294967295||f.relativeOffsetOfLocalHeader===4294967295){const y=f.extraFields.find(z=>z.id===1);if(!y)throw new Error("expected zip64 extended information extra field");const x=y.data;let p=0;if(f.uncompressedSize===4294967295){if(p+8>x.length)throw new Error("zip64 extended information extra field does not include uncompressed size");f.uncompressedSize=S(x,p),p+=8}if(f.compressedSize===4294967295){if(p+8>x.length)throw new Error("zip64 extended information extra field does not include compressed size");f.compressedSize=S(x,p),p+=8}if(f.relativeOffsetOfLocalHeader===4294967295){if(p+8>x.length)throw new Error("zip64 extended information extra field does not include relative header offset");f.relativeOffsetOfLocalHeader=S(x,p),p+=8}}const k=f.extraFields.find(y=>y.id===28789&&y.data.length>=6&&y.data[0]===1&&b(y.data,1),$e.unsigned(f.nameBytes));if(k&&(f.fileName=T(k.data.slice(5))),f.compressionMethod===0){let y=f.uncompressedSize;if(f.generalPurposeBitFlag&1&&(y+=12),f.compressedSize!==y)throw new Error(`compressed size mismatch for stored file: ${f.compressedSize} != ${y}`)}l.push(f)}return{zip:{comment:o,commentBytes:i},entries:l.map(h=>new _e(e,h))}}async function he(e,t){if(t.generalPurposeBitFlag&1)throw new Error("encrypted entries not supported");const r=await O(e,t.relativeOffsetOfLocalHeader,30),n=await e.getLength(),o=b(r,0);if(o!==67324752)throw new Error(`invalid local file header signature: 0x${o.toString(16)}`);const i=g(r,26),a=g(r,28),c=t.relativeOffsetOfLocalHeader+r.length+i+a;let l;if(t.compressionMethod===0)l=!1;else if(t.compressionMethod===8)l=!0;else throw new Error(`unsupported compression method: ${t.compressionMethod}`);const w=c,h=w+t.compressedSize;if(t.compressedSize!==0&&h>n)throw new Error(`file data overflows file bounds: ${w} + ${t.compressedSize} > ${n}`);return{decompress:l,fileDataStart:w}}async function Ie(e,t){const{decompress:r,fileDataStart:n}=await he(e,t);if(!r){const a=await O(e,n,t.compressedSize);return ge(a)?a.buffer:a.slice().buffer}const o=await X(e,n,t.compressedSize);return await de(o,t.uncompressedSize)}async function Pe(e,t,r){const{decompress:n,fileDataStart:o}=await he(e,t);if(!n){const c=await X(e,o,t.compressedSize,r);return se(c)?c:new Blob([D(c.buffer)?new Uint8Array(c):c],{type:r})}const i=await X(e,o,t.compressedSize);return await de(i,t.uncompressedSize,r)}function qe(e){Re(e)}async function me(e){let t;if(typeof Blob<"u"&&e instanceof Blob)t=new re(e);else if(e instanceof ArrayBuffer||e&&e.buffer&&e.buffer instanceof ArrayBuffer)t=new te(e);else if(D(e)||D(e.buffer))t=new te(e);else if(typeof e=="string"){const n=await fetch(e);if(!n.ok)throw new Error(`failed http request ${e}, status: ${n.status}: ${n.statusText}`);const o=await n.blob();t=new re(o)}else if(typeof e.getLength=="function"&&typeof e.read=="function")t=e;else throw new Error("unsupported source type");const r=await t.getLength();if(r>Number.MAX_SAFE_INTEGER)throw new Error(`file too large. size: ${r}. Only file sizes up 4503599627370496 bytes are supported`);return await Ne(t,r)}async function je(e){const{zip:t,entries:r}=await me(e);return{zip:t,entries:Object.fromEntries(r.map(n=>[n.name,n]))}}function Ge(){Oe()}exports.HTTPRangeReader=ve;exports.cleanup=Ge;exports.setOptions=qe;exports.unzip=je;exports.unzipRaw=me;
|
|
@@ -0,0 +1,649 @@
|
|
|
1
|
+
function se(e) {
|
|
2
|
+
return e.arrayBuffer ? e.arrayBuffer() : new Promise((t, r) => {
|
|
3
|
+
const n = new FileReader();
|
|
4
|
+
n.addEventListener("loadend", () => {
|
|
5
|
+
t(n.result);
|
|
6
|
+
}), n.addEventListener("error", r), n.readAsArrayBuffer(e);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
async function we(e) {
|
|
10
|
+
const t = await se(e);
|
|
11
|
+
return new Uint8Array(t);
|
|
12
|
+
}
|
|
13
|
+
function ie(e) {
|
|
14
|
+
return typeof Blob < "u" && e instanceof Blob;
|
|
15
|
+
}
|
|
16
|
+
function T(e) {
|
|
17
|
+
return typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer;
|
|
18
|
+
}
|
|
19
|
+
const pe = typeof process < "u" && process.versions && typeof process.versions.node < "u" && typeof process.versions.electron > "u";
|
|
20
|
+
function ye(e) {
|
|
21
|
+
return e.byteOffset === 0 && e.byteLength === e.buffer.byteLength;
|
|
22
|
+
}
|
|
23
|
+
class te {
|
|
24
|
+
constructor(t) {
|
|
25
|
+
this.typedArray = t instanceof ArrayBuffer || T(t) ? new Uint8Array(t) : new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
|
|
26
|
+
}
|
|
27
|
+
async getLength() {
|
|
28
|
+
return this.typedArray.byteLength;
|
|
29
|
+
}
|
|
30
|
+
async read(t, r) {
|
|
31
|
+
return new Uint8Array(this.typedArray.buffer, this.typedArray.byteOffset + t, r);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
class re {
|
|
35
|
+
constructor(t) {
|
|
36
|
+
this.blob = t;
|
|
37
|
+
}
|
|
38
|
+
async getLength() {
|
|
39
|
+
return this.blob.size;
|
|
40
|
+
}
|
|
41
|
+
async read(t, r) {
|
|
42
|
+
const n = this.blob.slice(t, t + r), o = await se(n);
|
|
43
|
+
return new Uint8Array(o);
|
|
44
|
+
}
|
|
45
|
+
async sliceAsBlob(t, r, n = "") {
|
|
46
|
+
return this.blob.slice(t, t + r, n);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
class qe {
|
|
50
|
+
constructor(t) {
|
|
51
|
+
this.url = t;
|
|
52
|
+
}
|
|
53
|
+
async getLength() {
|
|
54
|
+
if (this.length === void 0) {
|
|
55
|
+
const t = await fetch(this.url, { method: "HEAD" });
|
|
56
|
+
if (!t.ok)
|
|
57
|
+
throw new Error(`failed http request ${this.url}, status: ${t.status}: ${t.statusText}`);
|
|
58
|
+
if (this.length = parseInt(t.headers.get("content-length")), Number.isNaN(this.length))
|
|
59
|
+
throw Error("could not get length");
|
|
60
|
+
}
|
|
61
|
+
return this.length;
|
|
62
|
+
}
|
|
63
|
+
async read(t, r) {
|
|
64
|
+
if (r === 0)
|
|
65
|
+
return new Uint8Array(0);
|
|
66
|
+
const n = await fetch(this.url, {
|
|
67
|
+
headers: {
|
|
68
|
+
Range: `bytes=${t}-${t + r - 1}`
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
if (!n.ok)
|
|
72
|
+
throw new Error(`failed http request ${this.url}, status: ${n.status} offset: ${t} size: ${r}: ${n.statusText}`);
|
|
73
|
+
const o = await n.arrayBuffer();
|
|
74
|
+
return new Uint8Array(o);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function ge(e, t) {
|
|
78
|
+
var r = Uint8Array;
|
|
79
|
+
if (e[0] == 3 && e[1] == 0) return t || new r(0);
|
|
80
|
+
var n = be, o = ae, s = ve, a = fe, c = t == null;
|
|
81
|
+
c && (t = new r(e.length >>> 2 << 3));
|
|
82
|
+
for (var l = 0, w = 0, h = 0, u = 0, v = 0, f = 0, L = 0, m = 0, d = 0, k, z; l == 0; ) {
|
|
83
|
+
if (l = n(e, d, 1), w = n(e, d + 1, 2), d += 3, w == 0) {
|
|
84
|
+
d & 7 && (d += 8 - (d & 7));
|
|
85
|
+
var y = (d >>> 3) + 4, x = e[y - 4] | e[y - 3] << 8;
|
|
86
|
+
c && (t = j(t, m + x)), t.set(new r(e.buffer, e.byteOffset + y, x), m), d = y + x << 3, m += x;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (c && (t = j(t, m + (1 << 17))), w == 1 && (k = i.flmap, z = i.fdmap, f = 511, L = 31), w == 2) {
|
|
90
|
+
h = o(e, d, 5) + 257, u = o(e, d + 5, 5) + 1, v = o(e, d + 10, 4) + 4, d += 14;
|
|
91
|
+
for (var p = 0; p < 38; p += 2)
|
|
92
|
+
i.itree[p] = 0, i.itree[p + 1] = 0;
|
|
93
|
+
for (var E = 1, p = 0; p < v; p++) {
|
|
94
|
+
var M = o(e, d + p * 3, 3);
|
|
95
|
+
i.itree[(i.ordr[p] << 1) + 1] = M, M > E && (E = M);
|
|
96
|
+
}
|
|
97
|
+
d += 3 * v, R(i.itree, E), _(i.itree, E, i.imap), k = i.lmap, z = i.dmap, d = s(i.imap, (1 << E) - 1, h + u, e, d, i.ttree);
|
|
98
|
+
var C = ne(i.ttree, 0, h, i.ltree);
|
|
99
|
+
f = (1 << C) - 1;
|
|
100
|
+
var I = ne(i.ttree, h, u, i.dtree);
|
|
101
|
+
L = (1 << I) - 1, R(i.ltree, C), _(i.ltree, C, k), R(i.dtree, I), _(i.dtree, I, z);
|
|
102
|
+
}
|
|
103
|
+
for (; ; ) {
|
|
104
|
+
var V = k[a(e, d) & f];
|
|
105
|
+
d += V & 15;
|
|
106
|
+
var O = V >>> 4;
|
|
107
|
+
if (!(O >>> 8))
|
|
108
|
+
t[m++] = O;
|
|
109
|
+
else {
|
|
110
|
+
if (O == 256)
|
|
111
|
+
break;
|
|
112
|
+
var H = m + O - 254;
|
|
113
|
+
if (O > 264) {
|
|
114
|
+
var q = i.ldef[O - 257];
|
|
115
|
+
H = m + (q >>> 3) + o(e, d, q & 7), d += q & 7;
|
|
116
|
+
}
|
|
117
|
+
var ee = z[a(e, d) & L];
|
|
118
|
+
d += ee & 15;
|
|
119
|
+
var me = ee >>> 4, P = i.ddef[me], $ = (P >>> 4) + n(e, d, P & 15);
|
|
120
|
+
for (d += P & 15, c && (t = j(t, m + (1 << 17))); m < H; )
|
|
121
|
+
t[m] = t[m++ - $], t[m] = t[m++ - $], t[m] = t[m++ - $], t[m] = t[m++ - $];
|
|
122
|
+
m = H;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return t.length == m ? t : t.slice(0, m);
|
|
127
|
+
}
|
|
128
|
+
function j(e, t) {
|
|
129
|
+
var r = e.length;
|
|
130
|
+
if (t <= r) return e;
|
|
131
|
+
var n = new Uint8Array(Math.max(r << 1, t));
|
|
132
|
+
return n.set(e, 0), n;
|
|
133
|
+
}
|
|
134
|
+
function ve(e, t, r, n, o, s) {
|
|
135
|
+
for (var a = ae, c = fe, l = 0; l < r; ) {
|
|
136
|
+
var w = e[c(n, o) & t];
|
|
137
|
+
o += w & 15;
|
|
138
|
+
var h = w >>> 4;
|
|
139
|
+
if (h <= 15)
|
|
140
|
+
s[l] = h, l++;
|
|
141
|
+
else {
|
|
142
|
+
var u = 0, v = 0;
|
|
143
|
+
h == 16 ? (v = 3 + a(n, o, 2), o += 2, u = s[l - 1]) : h == 17 ? (v = 3 + a(n, o, 3), o += 3) : h == 18 && (v = 11 + a(n, o, 7), o += 7);
|
|
144
|
+
for (var f = l + v; l < f; )
|
|
145
|
+
s[l] = u, l++;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return o;
|
|
149
|
+
}
|
|
150
|
+
function ne(e, t, r, n) {
|
|
151
|
+
for (var o = 0, s = 0, a = n.length >>> 1; s < r; ) {
|
|
152
|
+
var c = e[s + t];
|
|
153
|
+
n[s << 1] = 0, n[(s << 1) + 1] = c, c > o && (o = c), s++;
|
|
154
|
+
}
|
|
155
|
+
for (; s < a; )
|
|
156
|
+
n[s << 1] = 0, n[(s << 1) + 1] = 0, s++;
|
|
157
|
+
return o;
|
|
158
|
+
}
|
|
159
|
+
function R(e, t) {
|
|
160
|
+
for (var r = e.length, n, o, s, a, c, l = i.bl_count, a = 0; a <= t; a++) l[a] = 0;
|
|
161
|
+
for (a = 1; a < r; a += 2) l[e[a]]++;
|
|
162
|
+
var w = i.next_code;
|
|
163
|
+
for (n = 0, l[0] = 0, o = 1; o <= t; o++)
|
|
164
|
+
n = n + l[o - 1] << 1, w[o] = n;
|
|
165
|
+
for (s = 0; s < r; s += 2)
|
|
166
|
+
c = e[s + 1], c != 0 && (e[s] = w[c], w[c]++);
|
|
167
|
+
}
|
|
168
|
+
function _(e, t, r) {
|
|
169
|
+
for (var n = e.length, o = i.rev15, s = 0; s < n; s += 2) if (e[s + 1] != 0)
|
|
170
|
+
for (var a = s >> 1, c = e[s + 1], l = a << 4 | c, w = t - c, h = e[s] << w, u = h + (1 << w); h != u; ) {
|
|
171
|
+
var v = o[h] >>> 15 - t;
|
|
172
|
+
r[v] = l, h++;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function oe(e, t) {
|
|
176
|
+
for (var r = i.rev15, n = 15 - t, o = 0; o < e.length; o += 2) {
|
|
177
|
+
var s = e[o] << t - e[o + 1];
|
|
178
|
+
e[o] = r[s] >>> n;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function ae(e, t, r) {
|
|
182
|
+
return (e[t >>> 3] | e[(t >>> 3) + 1] << 8) >>> (t & 7) & (1 << r) - 1;
|
|
183
|
+
}
|
|
184
|
+
function be(e, t, r) {
|
|
185
|
+
return (e[t >>> 3] | e[(t >>> 3) + 1] << 8 | e[(t >>> 3) + 2] << 16) >>> (t & 7) & (1 << r) - 1;
|
|
186
|
+
}
|
|
187
|
+
function fe(e, t) {
|
|
188
|
+
return (e[t >>> 3] | e[(t >>> 3) + 1] << 8 | e[(t >>> 3) + 2] << 16) >>> (t & 7);
|
|
189
|
+
}
|
|
190
|
+
const i = function() {
|
|
191
|
+
var e = Uint16Array, t = Uint32Array;
|
|
192
|
+
return {
|
|
193
|
+
next_code: new e(16),
|
|
194
|
+
bl_count: new e(16),
|
|
195
|
+
ordr: [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15],
|
|
196
|
+
of0: [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 999, 999, 999],
|
|
197
|
+
exb: [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],
|
|
198
|
+
ldef: new e(32),
|
|
199
|
+
df0: [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 65535, 65535],
|
|
200
|
+
dxb: [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],
|
|
201
|
+
ddef: new t(32),
|
|
202
|
+
flmap: new e(512),
|
|
203
|
+
fltree: [],
|
|
204
|
+
fdmap: new e(32),
|
|
205
|
+
fdtree: [],
|
|
206
|
+
lmap: new e(32768),
|
|
207
|
+
ltree: [],
|
|
208
|
+
ttree: [],
|
|
209
|
+
dmap: new e(32768),
|
|
210
|
+
dtree: [],
|
|
211
|
+
imap: new e(512),
|
|
212
|
+
itree: [],
|
|
213
|
+
//rev9 : new u16( 512)
|
|
214
|
+
rev15: new e(32768),
|
|
215
|
+
lhst: new t(286),
|
|
216
|
+
dhst: new t(30),
|
|
217
|
+
ihst: new t(19),
|
|
218
|
+
lits: new t(15e3),
|
|
219
|
+
strt: new e(65536),
|
|
220
|
+
prev: new e(32768)
|
|
221
|
+
};
|
|
222
|
+
}();
|
|
223
|
+
(function() {
|
|
224
|
+
for (var e = 32768, t = 0; t < e; t++) {
|
|
225
|
+
var r = t;
|
|
226
|
+
r = (r & 2863311530) >>> 1 | (r & 1431655765) << 1, r = (r & 3435973836) >>> 2 | (r & 858993459) << 2, r = (r & 4042322160) >>> 4 | (r & 252645135) << 4, r = (r & 4278255360) >>> 8 | (r & 16711935) << 8, i.rev15[t] = (r >>> 16 | r << 16) >>> 17;
|
|
227
|
+
}
|
|
228
|
+
function n(o, s, a) {
|
|
229
|
+
for (; s-- != 0; ) o.push(0, a);
|
|
230
|
+
}
|
|
231
|
+
for (var t = 0; t < 32; t++)
|
|
232
|
+
i.ldef[t] = i.of0[t] << 3 | i.exb[t], i.ddef[t] = i.df0[t] << 4 | i.dxb[t];
|
|
233
|
+
n(i.fltree, 144, 8), n(i.fltree, 112, 9), n(i.fltree, 24, 7), n(i.fltree, 8, 8), R(i.fltree, 9), _(i.fltree, 9, i.flmap), oe(i.fltree, 9), n(i.fdtree, 32, 5), R(i.fdtree, 5), _(i.fdtree, 5, i.fdmap), oe(i.fdtree, 5), n(i.itree, 19, 0), n(i.ltree, 286, 0), n(i.dtree, 30, 0), n(i.ttree, 320, 0);
|
|
234
|
+
})();
|
|
235
|
+
(function() {
|
|
236
|
+
for (var e = new Uint32Array(256), t = 0; t < 256; t++) {
|
|
237
|
+
for (var r = t, n = 0; n < 8; n++)
|
|
238
|
+
r & 1 ? r = 3988292384 ^ r >>> 1 : r = r >>> 1;
|
|
239
|
+
e[t] = r;
|
|
240
|
+
}
|
|
241
|
+
return e;
|
|
242
|
+
})();
|
|
243
|
+
function xe(e, t) {
|
|
244
|
+
return ge(e, t);
|
|
245
|
+
}
|
|
246
|
+
const A = {
|
|
247
|
+
numWorkers: 1,
|
|
248
|
+
workerURL: "",
|
|
249
|
+
useWorkers: !1
|
|
250
|
+
};
|
|
251
|
+
let Ae = 0, Q = 0, W = !0;
|
|
252
|
+
const J = [], F = [], B = [], N = /* @__PURE__ */ new Map();
|
|
253
|
+
function Le(e) {
|
|
254
|
+
ce(e.target);
|
|
255
|
+
const { id: t, error: r, data: n } = e.data, o = N.get(t);
|
|
256
|
+
N.delete(t), r ? o.reject(r) : o.resolve(n);
|
|
257
|
+
}
|
|
258
|
+
function G(e) {
|
|
259
|
+
return new Promise((t, r) => {
|
|
260
|
+
const n = new Worker(e);
|
|
261
|
+
n.onmessage = (o) => {
|
|
262
|
+
o.data === "start" ? (n.onerror = void 0, n.onmessage = void 0, t(n)) : r(new Error(`unexpected message: ${o.data}`));
|
|
263
|
+
}, n.onerror = r;
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
function Ee(e, t) {
|
|
267
|
+
return e.require ? e.require(t) : {};
|
|
268
|
+
}
|
|
269
|
+
const K = function() {
|
|
270
|
+
if (pe) {
|
|
271
|
+
const { Worker: e } = Ee(module, "worker_threads");
|
|
272
|
+
return {
|
|
273
|
+
async createWorker(t) {
|
|
274
|
+
return new e(t);
|
|
275
|
+
},
|
|
276
|
+
addEventListener(t, r) {
|
|
277
|
+
t.on("message", (n) => {
|
|
278
|
+
r({ target: t, data: n });
|
|
279
|
+
});
|
|
280
|
+
},
|
|
281
|
+
async terminate(t) {
|
|
282
|
+
await t.terminate();
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
} else
|
|
286
|
+
return {
|
|
287
|
+
async createWorker(e) {
|
|
288
|
+
try {
|
|
289
|
+
return await G(e);
|
|
290
|
+
} catch {
|
|
291
|
+
console.warn("could not load worker:", e);
|
|
292
|
+
}
|
|
293
|
+
let t;
|
|
294
|
+
try {
|
|
295
|
+
const r = await fetch(e, { mode: "cors" });
|
|
296
|
+
if (!r.ok)
|
|
297
|
+
throw new Error(`could not load: ${e}`);
|
|
298
|
+
t = await r.text(), e = URL.createObjectURL(new Blob([t], { type: "application/javascript" }));
|
|
299
|
+
const n = await G(e);
|
|
300
|
+
return A.workerURL = e, n;
|
|
301
|
+
} catch {
|
|
302
|
+
console.warn("could not load worker via fetch:", e);
|
|
303
|
+
}
|
|
304
|
+
if (t !== void 0)
|
|
305
|
+
try {
|
|
306
|
+
e = `data:application/javascript;base64,${btoa(t)}`;
|
|
307
|
+
const r = await G(e);
|
|
308
|
+
return A.workerURL = e, r;
|
|
309
|
+
} catch {
|
|
310
|
+
console.warn("could not load worker via dataURI");
|
|
311
|
+
}
|
|
312
|
+
throw console.warn("workers will not be used"), new Error("can not start workers");
|
|
313
|
+
},
|
|
314
|
+
addEventListener(e, t) {
|
|
315
|
+
e.addEventListener("message", t);
|
|
316
|
+
},
|
|
317
|
+
async terminate(e) {
|
|
318
|
+
e.terminate();
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
}();
|
|
322
|
+
function ce(e) {
|
|
323
|
+
F.push(e), le();
|
|
324
|
+
}
|
|
325
|
+
async function ke() {
|
|
326
|
+
if (F.length === 0 && Q < A.numWorkers) {
|
|
327
|
+
++Q;
|
|
328
|
+
try {
|
|
329
|
+
const e = await K.createWorker(A.workerURL);
|
|
330
|
+
J.push(e), F.push(e), K.addEventListener(e, Le);
|
|
331
|
+
} catch {
|
|
332
|
+
W = !1;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return F.pop();
|
|
336
|
+
}
|
|
337
|
+
function ze(e, t, r, n) {
|
|
338
|
+
const o = new Uint8Array(t);
|
|
339
|
+
xe(e, o), n(r ? new Blob([o], { type: r }) : o.buffer);
|
|
340
|
+
}
|
|
341
|
+
async function le() {
|
|
342
|
+
if (B.length !== 0) {
|
|
343
|
+
if (A.useWorkers && W) {
|
|
344
|
+
const e = await ke();
|
|
345
|
+
if (W) {
|
|
346
|
+
if (e) {
|
|
347
|
+
if (B.length === 0) {
|
|
348
|
+
ce(e);
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
const { id: t, src: r, uncompressedSize: n, type: o, resolve: s, reject: a } = B.shift();
|
|
352
|
+
N.set(t, { id: t, resolve: s, reject: a });
|
|
353
|
+
const c = [];
|
|
354
|
+
e.postMessage({
|
|
355
|
+
type: "inflate",
|
|
356
|
+
data: {
|
|
357
|
+
id: t,
|
|
358
|
+
type: o,
|
|
359
|
+
src: r,
|
|
360
|
+
uncompressedSize: n
|
|
361
|
+
}
|
|
362
|
+
}, c);
|
|
363
|
+
}
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
for (; B.length; ) {
|
|
368
|
+
const { src: e, uncompressedSize: t, type: r, resolve: n } = B.shift();
|
|
369
|
+
let o = e;
|
|
370
|
+
ie(e) && (o = await we(e)), ze(o, t, r, n);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
function Be(e) {
|
|
375
|
+
A.workerURL = e.workerURL || A.workerURL, e.workerURL && (A.useWorkers = !0), A.useWorkers = e.useWorkers !== void 0 ? e.useWorkers : A.useWorkers, A.numWorkers = e.numWorkers || A.numWorkers;
|
|
376
|
+
}
|
|
377
|
+
function de(e, t, r) {
|
|
378
|
+
return new Promise((n, o) => {
|
|
379
|
+
B.push({ src: e, uncompressedSize: t, type: r, resolve: n, reject: o, id: Ae++ }), le();
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
function Z(e) {
|
|
383
|
+
e.splice(0, e.length);
|
|
384
|
+
}
|
|
385
|
+
async function Se() {
|
|
386
|
+
for (const e of J)
|
|
387
|
+
await K.terminate(e);
|
|
388
|
+
Z(J), Z(F), Z(B), N.clear(), Q = 0, W = !0;
|
|
389
|
+
}
|
|
390
|
+
function Oe(e, t) {
|
|
391
|
+
const r = e & 31, n = (e >> 5 & 15) - 1, o = (e >> 9 & 127) + 1980, s = 0, a = (t & 31) * 2, c = t >> 5 & 63, l = t >> 11 & 31;
|
|
392
|
+
return new Date(o, n, r, l, c, a, s);
|
|
393
|
+
}
|
|
394
|
+
class Ue {
|
|
395
|
+
constructor(t, r) {
|
|
396
|
+
this._reader = t, this._rawEntry = r, this.name = r.name, this.nameBytes = r.nameBytes, this.size = r.uncompressedSize, this.compressedSize = r.compressedSize, this.comment = r.comment, this.commentBytes = r.commentBytes, this.compressionMethod = r.compressionMethod, this.lastModDate = Oe(r.lastModFileDate, r.lastModFileTime), this.isDirectory = r.uncompressedSize === 0 && r.name.endsWith("/"), this.encrypted = !!(r.generalPurposeBitFlag & 1), this.externalFileAttributes = r.externalFileAttributes, this.versionMadeBy = r.versionMadeBy;
|
|
397
|
+
}
|
|
398
|
+
// returns a promise that returns a Blob for this entry
|
|
399
|
+
async blob(t = "application/octet-stream") {
|
|
400
|
+
return await Ie(this._reader, this._rawEntry, t);
|
|
401
|
+
}
|
|
402
|
+
// returns a promise that returns an ArrayBuffer for this entry
|
|
403
|
+
async arrayBuffer() {
|
|
404
|
+
return await Ce(this._reader, this._rawEntry);
|
|
405
|
+
}
|
|
406
|
+
// returns text, assumes the text is valid utf8. If you want more options decode arrayBuffer yourself
|
|
407
|
+
async text() {
|
|
408
|
+
const t = await this.arrayBuffer();
|
|
409
|
+
return D(new Uint8Array(t));
|
|
410
|
+
}
|
|
411
|
+
// returns text with JSON.parse called on it. If you want more options decode arrayBuffer yourself
|
|
412
|
+
async json() {
|
|
413
|
+
const t = await this.text();
|
|
414
|
+
return JSON.parse(t);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
const Y = 22, Re = 65535, _e = 101010256, Fe = 101075792;
|
|
418
|
+
async function U(e, t, r) {
|
|
419
|
+
return await e.read(t, r);
|
|
420
|
+
}
|
|
421
|
+
async function X(e, t, r, n) {
|
|
422
|
+
return e.sliceAsBlob ? await e.sliceAsBlob(t, r, n) : await e.read(t, r);
|
|
423
|
+
}
|
|
424
|
+
const De = {
|
|
425
|
+
unsigned() {
|
|
426
|
+
return 0;
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
function g(e, t) {
|
|
430
|
+
return e[t] + e[t + 1] * 256;
|
|
431
|
+
}
|
|
432
|
+
function b(e, t) {
|
|
433
|
+
return e[t] + e[t + 1] * 256 + e[t + 2] * 65536 + e[t + 3] * 16777216;
|
|
434
|
+
}
|
|
435
|
+
function S(e, t) {
|
|
436
|
+
return b(e, t) + b(e, t + 4) * 4294967296;
|
|
437
|
+
}
|
|
438
|
+
const Te = new TextDecoder();
|
|
439
|
+
function D(e, t) {
|
|
440
|
+
return T(e.buffer) && (e = new Uint8Array(e)), Te.decode(e);
|
|
441
|
+
}
|
|
442
|
+
async function $e(e, t) {
|
|
443
|
+
const r = Math.min(Y + Re, t), n = t - r, o = await U(e, n, r);
|
|
444
|
+
for (let s = r - Y; s >= 0; --s) {
|
|
445
|
+
if (b(o, s) !== _e)
|
|
446
|
+
continue;
|
|
447
|
+
const a = new Uint8Array(o.buffer, o.byteOffset + s, o.byteLength - s), c = g(a, 4);
|
|
448
|
+
if (c !== 0)
|
|
449
|
+
throw new Error(`multi-volume zip files are not supported. This is volume: ${c}`);
|
|
450
|
+
const l = g(a, 10), w = b(a, 12), h = b(a, 16), u = g(a, 20), v = a.length - Y;
|
|
451
|
+
if (u !== v)
|
|
452
|
+
throw new Error(`invalid comment length. expected: ${v}, actual: ${u}`);
|
|
453
|
+
const f = new Uint8Array(a.buffer, a.byteOffset + 22, u), L = D(f);
|
|
454
|
+
return l === 65535 || h === 4294967295 ? await Ne(e, n + s, L, f) : await ue(e, h, w, l, L, f);
|
|
455
|
+
}
|
|
456
|
+
throw new Error("could not find end of central directory. maybe not zip file");
|
|
457
|
+
}
|
|
458
|
+
const We = 117853008;
|
|
459
|
+
async function Ne(e, t, r, n) {
|
|
460
|
+
const o = t - 20, s = await U(e, o, 20);
|
|
461
|
+
if (b(s, 0) !== We)
|
|
462
|
+
throw new Error("invalid zip64 end of central directory locator signature");
|
|
463
|
+
const a = S(s, 8), c = await U(e, a, 56);
|
|
464
|
+
if (b(c, 0) !== Fe)
|
|
465
|
+
throw new Error("invalid zip64 end of central directory record signature");
|
|
466
|
+
const l = S(c, 32), w = S(c, 40), h = S(c, 48);
|
|
467
|
+
return ue(e, h, w, l, r, n);
|
|
468
|
+
}
|
|
469
|
+
const Me = 33639248;
|
|
470
|
+
async function ue(e, t, r, n, o, s) {
|
|
471
|
+
let a = 0;
|
|
472
|
+
const c = await U(e, t, r), l = [];
|
|
473
|
+
for (let h = 0; h < n; ++h) {
|
|
474
|
+
const u = c.subarray(a, a + 46), v = b(u, 0);
|
|
475
|
+
if (v !== Me)
|
|
476
|
+
throw new Error(`invalid central directory file header signature: 0x${v.toString(16)}`);
|
|
477
|
+
const f = {
|
|
478
|
+
// 4 - Version made by
|
|
479
|
+
versionMadeBy: g(u, 4),
|
|
480
|
+
// 6 - Version needed to extract (minimum)
|
|
481
|
+
versionNeededToExtract: g(u, 6),
|
|
482
|
+
// 8 - General purpose bit flag
|
|
483
|
+
generalPurposeBitFlag: g(u, 8),
|
|
484
|
+
// 10 - Compression method
|
|
485
|
+
compressionMethod: g(u, 10),
|
|
486
|
+
// 12 - File last modification time
|
|
487
|
+
lastModFileTime: g(u, 12),
|
|
488
|
+
// 14 - File last modification date
|
|
489
|
+
lastModFileDate: g(u, 14),
|
|
490
|
+
// 16 - CRC-32
|
|
491
|
+
crc32: b(u, 16),
|
|
492
|
+
// 20 - Compressed size
|
|
493
|
+
compressedSize: b(u, 20),
|
|
494
|
+
// 24 - Uncompressed size
|
|
495
|
+
uncompressedSize: b(u, 24),
|
|
496
|
+
// 28 - File name length (n)
|
|
497
|
+
fileNameLength: g(u, 28),
|
|
498
|
+
// 30 - Extra field length (m)
|
|
499
|
+
extraFieldLength: g(u, 30),
|
|
500
|
+
// 32 - File comment length (k)
|
|
501
|
+
fileCommentLength: g(u, 32),
|
|
502
|
+
// 34 - Disk number where file starts
|
|
503
|
+
// 36 - Internal file attributes
|
|
504
|
+
internalFileAttributes: g(u, 36),
|
|
505
|
+
// 38 - External file attributes
|
|
506
|
+
externalFileAttributes: b(u, 38),
|
|
507
|
+
// 42 - Relative offset of local file header
|
|
508
|
+
relativeOffsetOfLocalHeader: b(u, 42)
|
|
509
|
+
};
|
|
510
|
+
if (f.generalPurposeBitFlag & 64)
|
|
511
|
+
throw new Error("strong encryption is not supported");
|
|
512
|
+
a += 46;
|
|
513
|
+
const L = c.subarray(a, a + f.fileNameLength + f.extraFieldLength + f.fileCommentLength);
|
|
514
|
+
f.nameBytes = L.slice(0, f.fileNameLength), f.name = D(f.nameBytes);
|
|
515
|
+
const m = f.fileNameLength + f.extraFieldLength, d = L.slice(f.fileNameLength, m);
|
|
516
|
+
f.extraFields = [];
|
|
517
|
+
let k = 0;
|
|
518
|
+
for (; k < d.length - 3; ) {
|
|
519
|
+
const y = g(d, k + 0), x = g(d, k + 2), p = k + 4, E = p + x;
|
|
520
|
+
if (E > d.length)
|
|
521
|
+
throw new Error("extra field length exceeds extra field buffer size");
|
|
522
|
+
f.extraFields.push({
|
|
523
|
+
id: y,
|
|
524
|
+
data: d.slice(p, E)
|
|
525
|
+
}), k = E;
|
|
526
|
+
}
|
|
527
|
+
if (f.commentBytes = L.slice(m, m + f.fileCommentLength), f.comment = D(f.commentBytes), a += L.length, f.uncompressedSize === 4294967295 || f.compressedSize === 4294967295 || f.relativeOffsetOfLocalHeader === 4294967295) {
|
|
528
|
+
const y = f.extraFields.find((E) => E.id === 1);
|
|
529
|
+
if (!y)
|
|
530
|
+
throw new Error("expected zip64 extended information extra field");
|
|
531
|
+
const x = y.data;
|
|
532
|
+
let p = 0;
|
|
533
|
+
if (f.uncompressedSize === 4294967295) {
|
|
534
|
+
if (p + 8 > x.length)
|
|
535
|
+
throw new Error("zip64 extended information extra field does not include uncompressed size");
|
|
536
|
+
f.uncompressedSize = S(x, p), p += 8;
|
|
537
|
+
}
|
|
538
|
+
if (f.compressedSize === 4294967295) {
|
|
539
|
+
if (p + 8 > x.length)
|
|
540
|
+
throw new Error("zip64 extended information extra field does not include compressed size");
|
|
541
|
+
f.compressedSize = S(x, p), p += 8;
|
|
542
|
+
}
|
|
543
|
+
if (f.relativeOffsetOfLocalHeader === 4294967295) {
|
|
544
|
+
if (p + 8 > x.length)
|
|
545
|
+
throw new Error("zip64 extended information extra field does not include relative header offset");
|
|
546
|
+
f.relativeOffsetOfLocalHeader = S(x, p), p += 8;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
const z = f.extraFields.find((y) => y.id === 28789 && y.data.length >= 6 && // too short to be meaningful
|
|
550
|
+
y.data[0] === 1 && // Version 1 byte version of this extra field, currently 1
|
|
551
|
+
b(y.data, 1), De.unsigned(f.nameBytes));
|
|
552
|
+
if (z && (f.fileName = D(z.data.slice(5))), f.compressionMethod === 0) {
|
|
553
|
+
let y = f.uncompressedSize;
|
|
554
|
+
if (f.generalPurposeBitFlag & 1 && (y += 12), f.compressedSize !== y)
|
|
555
|
+
throw new Error(`compressed size mismatch for stored file: ${f.compressedSize} != ${y}`);
|
|
556
|
+
}
|
|
557
|
+
l.push(f);
|
|
558
|
+
}
|
|
559
|
+
return {
|
|
560
|
+
zip: {
|
|
561
|
+
comment: o,
|
|
562
|
+
commentBytes: s
|
|
563
|
+
},
|
|
564
|
+
entries: l.map((h) => new Ue(e, h))
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
async function he(e, t) {
|
|
568
|
+
if (t.generalPurposeBitFlag & 1)
|
|
569
|
+
throw new Error("encrypted entries not supported");
|
|
570
|
+
const r = await U(e, t.relativeOffsetOfLocalHeader, 30), n = await e.getLength(), o = b(r, 0);
|
|
571
|
+
if (o !== 67324752)
|
|
572
|
+
throw new Error(`invalid local file header signature: 0x${o.toString(16)}`);
|
|
573
|
+
const s = g(r, 26), a = g(r, 28), c = t.relativeOffsetOfLocalHeader + r.length + s + a;
|
|
574
|
+
let l;
|
|
575
|
+
if (t.compressionMethod === 0)
|
|
576
|
+
l = !1;
|
|
577
|
+
else if (t.compressionMethod === 8)
|
|
578
|
+
l = !0;
|
|
579
|
+
else
|
|
580
|
+
throw new Error(`unsupported compression method: ${t.compressionMethod}`);
|
|
581
|
+
const w = c, h = w + t.compressedSize;
|
|
582
|
+
if (t.compressedSize !== 0 && h > n)
|
|
583
|
+
throw new Error(`file data overflows file bounds: ${w} + ${t.compressedSize} > ${n}`);
|
|
584
|
+
return {
|
|
585
|
+
decompress: l,
|
|
586
|
+
fileDataStart: w
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
async function Ce(e, t) {
|
|
590
|
+
const { decompress: r, fileDataStart: n } = await he(e, t);
|
|
591
|
+
if (!r) {
|
|
592
|
+
const a = await U(e, n, t.compressedSize);
|
|
593
|
+
return ye(a) ? a.buffer : a.slice().buffer;
|
|
594
|
+
}
|
|
595
|
+
const o = await X(e, n, t.compressedSize);
|
|
596
|
+
return await de(o, t.uncompressedSize);
|
|
597
|
+
}
|
|
598
|
+
async function Ie(e, t, r) {
|
|
599
|
+
const { decompress: n, fileDataStart: o } = await he(e, t);
|
|
600
|
+
if (!n) {
|
|
601
|
+
const c = await X(e, o, t.compressedSize, r);
|
|
602
|
+
return ie(c) ? c : new Blob([T(c.buffer) ? new Uint8Array(c) : c], { type: r });
|
|
603
|
+
}
|
|
604
|
+
const s = await X(e, o, t.compressedSize);
|
|
605
|
+
return await de(s, t.uncompressedSize, r);
|
|
606
|
+
}
|
|
607
|
+
function Pe(e) {
|
|
608
|
+
Be(e);
|
|
609
|
+
}
|
|
610
|
+
async function He(e) {
|
|
611
|
+
let t;
|
|
612
|
+
if (typeof Blob < "u" && e instanceof Blob)
|
|
613
|
+
t = new re(e);
|
|
614
|
+
else if (e instanceof ArrayBuffer || e && e.buffer && e.buffer instanceof ArrayBuffer)
|
|
615
|
+
t = new te(e);
|
|
616
|
+
else if (T(e) || T(e.buffer))
|
|
617
|
+
t = new te(e);
|
|
618
|
+
else if (typeof e == "string") {
|
|
619
|
+
const n = await fetch(e);
|
|
620
|
+
if (!n.ok)
|
|
621
|
+
throw new Error(`failed http request ${e}, status: ${n.status}: ${n.statusText}`);
|
|
622
|
+
const o = await n.blob();
|
|
623
|
+
t = new re(o);
|
|
624
|
+
} else if (typeof e.getLength == "function" && typeof e.read == "function")
|
|
625
|
+
t = e;
|
|
626
|
+
else
|
|
627
|
+
throw new Error("unsupported source type");
|
|
628
|
+
const r = await t.getLength();
|
|
629
|
+
if (r > Number.MAX_SAFE_INTEGER)
|
|
630
|
+
throw new Error(`file too large. size: ${r}. Only file sizes up 4503599627370496 bytes are supported`);
|
|
631
|
+
return await $e(t, r);
|
|
632
|
+
}
|
|
633
|
+
async function je(e) {
|
|
634
|
+
const { zip: t, entries: r } = await He(e);
|
|
635
|
+
return {
|
|
636
|
+
zip: t,
|
|
637
|
+
entries: Object.fromEntries(r.map((n) => [n.name, n]))
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
function Ge() {
|
|
641
|
+
Se();
|
|
642
|
+
}
|
|
643
|
+
export {
|
|
644
|
+
qe as HTTPRangeReader,
|
|
645
|
+
Ge as cleanup,
|
|
646
|
+
Pe as setOptions,
|
|
647
|
+
je as unzip,
|
|
648
|
+
He as unzipRaw
|
|
649
|
+
};
|
package/dist/util/export.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare function renderVideoRemote(serial: Template.Serial, data: {
|
|
|
43
43
|
}>;
|
|
44
44
|
export declare function renderSerialAsImages(bxLiveTemplateComponent: InstanceType<typeof BxLiveTemplate>, serial: Template.Serial, data: {
|
|
45
45
|
[k: string]: unknown;
|
|
46
|
-
}, format: keyof typeof imageFormats, campaignId: number, templateId: string, remoteOptions: RenderRemoteOptions, enforceServerSideRendering: boolean,
|
|
46
|
+
}, format: keyof typeof imageFormats, campaignId: number, templateId: string, remoteOptions: RenderRemoteOptions, enforceServerSideRendering: boolean, watermark: boolean, sessionState: string): Promise<{
|
|
47
47
|
files: Blob[];
|
|
48
48
|
renderLocation: RenderLocation;
|
|
49
49
|
clientRenderFailed: boolean;
|