@queuedash/api
Version:
A stunning, sleek dashboard for Bull, BullMQ, and Bee-Queue
2 lines • 51.1 kB
JavaScript
"use strict";var Re=Object.defineProperty;var Pe=(i,e,t)=>e in i?Re(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var te=(i,e,t)=>Pe(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ne=require("./main-B1qMxbcd.js");function v(i){return new DataView(i.buffer,i.byteOffset)}const qe={len:1,get(i,e){return v(i).getUint8(e)},put(i,e,t){return v(i).setUint8(e,t),e+1}},h={len:2,get(i,e){return v(i).getUint16(e,!0)},put(i,e,t){return v(i).setUint16(e,t,!0),e+2}},V={len:2,get(i,e){return v(i).getUint16(e)},put(i,e,t){return v(i).setUint16(e,t),e+2}},w={len:4,get(i,e){return v(i).getUint32(e,!0)},put(i,e,t){return v(i).setUint32(e,t,!0),e+4}},He={len:4,get(i,e){return v(i).getUint32(e)},put(i,e,t){return v(i).setUint32(e,t),e+4}},Ve={len:4,get(i,e){return v(i).getInt32(e)},put(i,e,t){return v(i).setInt32(e,t),e+4}},_e={len:8,get(i,e){return v(i).getBigUint64(e,!0)},put(i,e,t){return v(i).setBigUint64(e,t,!0),e+8}};class E{constructor(e,t){this.len=e,this.encoding=t,this.textDecoder=new TextDecoder(t)}get(e,t){return this.textDecoder.decode(e.subarray(t,t+this.len))}}const $e="End-Of-Stream";class S extends Error{constructor(){super($e),this.name="EndOfStreamError"}}class We extends Error{constructor(e="The operation was aborted"){super(e),this.name="AbortError"}}class ye{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(e,t=!1){const r=await this.read(e,t);return this.peekQueue.push(e.subarray(0,r)),r}async read(e,t=!1){if(e.length===0)return 0;let r=this.readFromPeekBuffer(e);if(this.endOfStream||(r+=await this.readRemainderFromStream(e.subarray(r),t)),r===0)throw new S;return r}readFromPeekBuffer(e){let t=e.length,r=0;for(;this.peekQueue.length>0&&t>0;){const n=this.peekQueue.pop();if(!n)throw new Error("peekData should be defined");const o=Math.min(n.length,t);e.set(n.subarray(0,o),r),r+=o,t-=o,o<n.length&&this.peekQueue.push(n.subarray(o))}return r}async readRemainderFromStream(e,t){let r=0;for(;r<e.length&&!this.endOfStream;){if(this.interrupted)throw new We;const n=await this.readFromStream(e.subarray(r),t);if(n===0)break;r+=n}if(!t&&r<e.length)throw new S;return r}}class Ze extends ye{constructor(e){super(),this.reader=e}async abort(){return this.close()}async close(){this.reader.releaseLock()}}class Ge extends Ze{async readFromStream(e,t){if(e.length===0)return 0;const r=await this.reader.read(new Uint8Array(e.length),{min:t?void 0:e.length});return r.done&&(this.endOfStream=r.done),r.value?(e.set(r.value),r.value.length):0}}class ve extends ye{constructor(e){super(),this.reader=e,this.buffer=null}writeChunk(e,t){const r=Math.min(t.length,e.length);return e.set(t.subarray(0,r)),r<t.length?this.buffer=t.subarray(r):this.buffer=null,r}async readFromStream(e,t){if(e.length===0)return 0;let r=0;for(this.buffer&&(r+=this.writeChunk(e,this.buffer));r<e.length&&!this.endOfStream;){const n=await this.reader.read();if(n.done){this.endOfStream=!0;break}n.value&&(r+=this.writeChunk(e.subarray(r),n.value))}if(r===0&&this.endOfStream)throw new S;return r}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}function Qe(i){try{const e=i.getReader({mode:"byob"});return e instanceof ReadableStreamDefaultReader?new ve(e):new Ge(e)}catch(e){if(e instanceof TypeError)return new ve(i.getReader());throw e}}class Fe{constructor(e){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=e==null?void 0:e.onClose,e!=null&&e.abortSignal&&e.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(e,t=this.position){const r=new Uint8Array(e.len);if(await this.readBuffer(r,{position:t})<e.len)throw new S;return e.get(r,0)}async peekToken(e,t=this.position){const r=new Uint8Array(e.len);if(await this.peekBuffer(r,{position:t})<e.len)throw new S;return e.get(r,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new S;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new S;return e.get(this.numBuffer,0)}async ignore(e){if(this.fileInfo.size!==void 0){const t=this.fileInfo.size-this.position;if(e>t)return this.position+=t,t}return this.position+=e,e}async close(){var e;await this.abort(),await((e=this.onClose)==null?void 0:e.call(this))}normalizeOptions(e,t){if(!this.supportsRandomAccess()&&t&&t.position!==void 0&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:e.length,position:this.position,...t}}abort(){return Promise.resolve()}}const Je=256e3;class Ke extends Fe{constructor(e,t){super(t),this.streamReader=e,this.fileInfo=(t==null?void 0:t.fileInfo)??{}}async readBuffer(e,t){const r=this.normalizeOptions(e,t),n=r.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(e,t);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(r.length===0)return 0;const o=await this.streamReader.read(e.subarray(0,r.length),r.mayBeLess);if(this.position+=o,(!t||!t.mayBeLess)&&o<r.length)throw new S;return o}async peekBuffer(e,t){const r=this.normalizeOptions(e,t);let n=0;if(r.position){const o=r.position-this.position;if(o>0){const m=new Uint8Array(r.length+o);return n=await this.peekBuffer(m,{mayBeLess:r.mayBeLess}),e.set(m.subarray(o)),n-o}if(o<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{n=await this.streamReader.peek(e.subarray(0,r.length),r.mayBeLess)}catch(o){if(t!=null&&t.mayBeLess&&o instanceof S)return 0;throw o}if(!r.mayBeLess&&n<r.length)throw new S}return n}async ignore(e){const t=Math.min(Je,e),r=new Uint8Array(t);let n=0;for(;n<e;){const o=e-n,m=await this.readBuffer(r,{length:Math.min(t,o)});if(m<0)return m;n+=m}return n}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}class Xe extends Fe{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo={...(t==null?void 0:t.fileInfo)??{},size:e.length}}async readBuffer(e,t){t!=null&&t.position&&(this.position=t.position);const r=await this.peekBuffer(e,t);return this.position+=r,r}async peekBuffer(e,t){const r=this.normalizeOptions(e,t),n=Math.min(this.uint8Array.length-r.position,r.length);if(!r.mayBeLess&&n<r.length)throw new S;return e.set(this.uint8Array.subarray(r.position,r.position+n)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}}function Ye(i,e){const t=Qe(i),r=e??{},n=r.onClose;return r.onClose=async()=>{if(await t.close(),n)return n()},new Ke(t,r)}function et(i,e){return new Xe(i,e)}var C=Uint8Array,P=Uint16Array,tt=Int32Array,Se=new C([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]),Be=new C([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]),it=new C([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ae=function(i,e){for(var t=new P(31),r=0;r<31;++r)t[r]=e+=1<<i[r-1];for(var n=new tt(t[30]),r=1;r<30;++r)for(var o=t[r];o<t[r+1];++o)n[o]=o-t[r]<<5|r;return{b:t,r:n}},ze=Ae(Se,2),De=ze.b,rt=ze.r;De[28]=258,rt[258]=28;var nt=Ae(Be,0),at=nt.b,oe=new P(32768);for(var u=0;u<32768;++u){var L=(u&43690)>>1|(u&21845)<<1;L=(L&52428)>>2|(L&13107)<<2,L=(L&61680)>>4|(L&3855)<<4,oe[u]=((L&65280)>>8|(L&255)<<8)>>1}var _=function(i,e,t){for(var r=i.length,n=0,o=new P(e);n<r;++n)i[n]&&++o[i[n]-1];var m=new P(e);for(n=1;n<e;++n)m[n]=m[n-1]+o[n-1]<<1;var l;if(t){l=new P(1<<e);var f=15-e;for(n=0;n<r;++n)if(i[n])for(var x=n<<4|i[n],s=e-i[n],a=m[i[n]-1]++<<s,c=a|(1<<s)-1;a<=c;++a)l[oe[a]>>f]=x}else for(l=new P(r),n=0;n<r;++n)i[n]&&(l[n]=oe[m[i[n]-1]++]>>15-i[n]);return l},$=new C(288);for(var u=0;u<144;++u)$[u]=8;for(var u=144;u<256;++u)$[u]=9;for(var u=256;u<280;++u)$[u]=7;for(var u=280;u<288;++u)$[u]=8;var Ee=new C(32);for(var u=0;u<32;++u)Ee[u]=5;var st=_($,9,1),ot=_(Ee,5,1),ie=function(i){for(var e=i[0],t=1;t<i.length;++t)i[t]>e&&(e=i[t]);return e},A=function(i,e,t){var r=e/8|0;return(i[r]|i[r+1]<<8)>>(e&7)&t},re=function(i,e){var t=e/8|0;return(i[t]|i[t+1]<<8|i[t+2]<<16)>>(e&7)},ct=function(i){return(i+7)/8|0},ft=function(i,e,t){return(t==null||t>i.length)&&(t=i.length),new C(i.subarray(e,t))},mt=["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"],b=function(i,e,t){var r=new Error(e||mt[i]);if(r.code=i,Error.captureStackTrace&&Error.captureStackTrace(r,b),!t)throw r;return r},fe=function(i,e,t,r){var n=i.length,o=0;if(!n||e.f&&!e.l)return t||new C(0);var m=!t,l=m||e.i!=2,f=e.i;m&&(t=new C(n*3));var x=function(de){var ge=t.length;if(de>ge){var we=new C(Math.max(ge*2,de));we.set(t),t=we}},s=e.f||0,a=e.p||0,c=e.b||0,p=e.l,k=e.d,d=e.m,g=e.n,B=n*8;do{if(!p){s=A(i,a,1);var T=A(i,a+1,3);if(a+=3,T)if(T==1)p=st,k=ot,d=9,g=5;else if(T==2){var M=A(i,a,31)+257,Z=A(i,a+10,15)+4,q=M+A(i,a+5,31)+1;a+=14;for(var j=new C(q),K=new C(19),F=0;F<Z;++F)K[it[F]]=A(i,a+F*3,7);a+=Z*3;for(var me=ie(K),Ie=(1<<me)-1,Le=_(K,me,1),F=0;F<q;){var xe=Le[A(i,a,Ie)];a+=xe&15;var y=xe>>4;if(y<16)j[F++]=y;else{var U=0,G=0;for(y==16?(G=3+A(i,a,3),a+=2,U=j[F-1]):y==17?(G=3+A(i,a,7),a+=3):y==18&&(G=11+A(i,a,127),a+=7);G--;)j[F++]=U}}var le=j.subarray(0,M),I=j.subarray(M);d=ie(le),g=ie(I),p=_(le,d,1),k=_(I,g,1)}else b(1);else{var y=ct(a)+4,O=i[y-4]|i[y-3]<<8,W=y+O;if(W>n){f&&b(0);break}l&&x(c+O),t.set(i.subarray(y,W),c),e.b=c+=O,e.p=a=W*8,e.f=s;continue}if(a>B){f&&b(0);break}}l&&x(c+131072);for(var Me=(1<<d)-1,je=(1<<g)-1,X=a;;X=a){var U=p[re(i,a)&Me],R=U>>4;if(a+=U&15,a>B){f&&b(0);break}if(U||b(2),R<256)t[c++]=R;else if(R==256){X=a,p=null;break}else{var pe=R-254;if(R>264){var F=R-257,H=Se[F];pe=A(i,a,(1<<H)-1)+De[F],a+=H}var Y=k[re(i,a)&je],ee=Y>>4;Y||b(3),a+=Y&15;var I=at[ee];if(ee>3){var H=Be[ee];I+=re(i,a)&(1<<H)-1,a+=H}if(a>B){f&&b(0);break}l&&x(c+131072);var ue=c+pe;if(c<I){var he=o-I,Ue=Math.min(I,ue);for(he+c<0&&b(3);c<Ue;++c)t[c]=r[he+c]}for(;c<ue;++c)t[c]=t[c-I]}}e.l=p,e.p=X,e.b=c,e.f=s,p&&(s=1,e.m=d,e.d=k,e.n=g)}while(!s);return c!=t.length&&m?ft(t,0,c):t.subarray(0,c)},xt=new C(0),lt=function(i){(i[0]!=31||i[1]!=139||i[2]!=8)&&b(6,"invalid gzip data");var e=i[3],t=10;e&4&&(t+=(i[10]|i[11]<<8)+2);for(var r=(e>>3&1)+(e>>4&1);r>0;r-=!i[t++]);return t+(e&2)},pt=function(i){var e=i.length;return(i[e-4]|i[e-3]<<8|i[e-2]<<16|i[e-1]<<24)>>>0},ut=function(i,e){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&b(6,"invalid zlib data"),(i[1]>>5&1)==1&&b(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function ht(i,e){return fe(i,{i:2},e,e)}function dt(i,e){var t=lt(i);return t+8>i.length&&b(6,"invalid gzip data"),fe(i.subarray(t,-8),{i:2},new C(pt(i)),e)}function gt(i,e){return fe(i.subarray(ut(i),-4),{i:2},e,e)}function wt(i,e){return i[0]==31&&i[1]==139&&i[2]==8?dt(i,e):(i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31?ht(i,e):gt(i,e)}var vt=typeof TextDecoder<"u"&&new TextDecoder,kt=0;try{vt.decode(xt,{stream:!0}),kt=1}catch{}var ce={exports:{}},ne,ke;function bt(){if(ke)return ne;ke=1;var i=1e3,e=i*60,t=e*60,r=t*24,n=r*7,o=r*365.25;ne=function(s,a){a=a||{};var c=typeof s;if(c==="string"&&s.length>0)return m(s);if(c==="number"&&isFinite(s))return a.long?f(s):l(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))};function m(s){if(s=String(s),!(s.length>100)){var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(a){var c=parseFloat(a[1]),p=(a[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*n;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*t;case"minutes":case"minute":case"mins":case"min":case"m":return c*e;case"seconds":case"second":case"secs":case"sec":case"s":return c*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}}}function l(s){var a=Math.abs(s);return a>=r?Math.round(s/r)+"d":a>=t?Math.round(s/t)+"h":a>=e?Math.round(s/e)+"m":a>=i?Math.round(s/i)+"s":s+"ms"}function f(s){var a=Math.abs(s);return a>=r?x(s,a,r,"day"):a>=t?x(s,a,t,"hour"):a>=e?x(s,a,e,"minute"):a>=i?x(s,a,i,"second"):s+" ms"}function x(s,a,c,p){var k=a>=c*1.5;return Math.round(s/c)+" "+p+(k?"s":"")}return ne}function Ct(i){t.debug=t,t.default=t,t.coerce=f,t.disable=m,t.enable=n,t.enabled=l,t.humanize=bt(),t.destroy=x,Object.keys(i).forEach(s=>{t[s]=i[s]}),t.names=[],t.skips=[],t.formatters={};function e(s){let a=0;for(let c=0;c<s.length;c++)a=(a<<5)-a+s.charCodeAt(c),a|=0;return t.colors[Math.abs(a)%t.colors.length]}t.selectColor=e;function t(s){let a,c=null,p,k;function d(...g){if(!d.enabled)return;const B=d,T=Number(new Date),y=T-(a||T);B.diff=y,B.prev=a,B.curr=T,a=T,g[0]=t.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let O=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(M,Z)=>{if(M==="%%")return"%";O++;const q=t.formatters[Z];if(typeof q=="function"){const j=g[O];M=q.call(B,j),g.splice(O,1),O--}return M}),t.formatArgs.call(B,g),(B.log||t.log).apply(B,g)}return d.namespace=s,d.useColors=t.useColors(),d.color=t.selectColor(s),d.extend=r,d.destroy=t.destroy,Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,get:()=>c!==null?c:(p!==t.namespaces&&(p=t.namespaces,k=t.enabled(s)),k),set:g=>{c=g}}),typeof t.init=="function"&&t.init(d),d}function r(s,a){const c=t(this.namespace+(typeof a>"u"?":":a)+s);return c.log=this.log,c}function n(s){t.save(s),t.namespaces=s,t.names=[],t.skips=[];const a=(typeof s=="string"?s:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const c of a)c[0]==="-"?t.skips.push(c.slice(1)):t.names.push(c)}function o(s,a){let c=0,p=0,k=-1,d=0;for(;c<s.length;)if(p<a.length&&(a[p]===s[c]||a[p]==="*"))a[p]==="*"?(k=p,d=c,p++):(c++,p++);else if(k!==-1)p=k+1,d++,c=d;else return!1;for(;p<a.length&&a[p]==="*";)p++;return p===a.length}function m(){const s=[...t.names,...t.skips.map(a=>"-"+a)].join(",");return t.enable(""),s}function l(s){for(const a of t.skips)if(o(s,a))return!1;for(const a of t.names)if(o(s,a))return!0;return!1}function f(s){return s instanceof Error?s.stack||s.message:s}function x(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}var yt=Ct;(function(i,e){e.formatArgs=r,e.save=n,e.load=o,e.useColors=t,e.storage=m(),e.destroy=(()=>{let f=!1;return()=>{f||(f=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function t(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let f;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(f=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(f[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(f){if(f[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+f[0]+(this.useColors?"%c ":" ")+"+"+i.exports.humanize(this.diff),!this.useColors)return;const x="color: "+this.color;f.splice(1,0,x,"color: inherit");let s=0,a=0;f[0].replace(/%[a-zA-Z%]/g,c=>{c!=="%%"&&(s++,c==="%c"&&(a=s))}),f.splice(a,0,x)}e.log=console.debug||console.log||(()=>{});function n(f){try{f?e.storage.setItem("debug",f):e.storage.removeItem("debug")}catch{}}function o(){let f;try{f=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!f&&typeof process<"u"&&"env"in process&&(f=process.env.DEBUG),f}function m(){try{return localStorage}catch{}}i.exports=yt(e);const{formatters:l}=i.exports;l.j=function(f){try{return JSON.stringify(f)}catch(x){return"[UnexpectedJSONParseError]: "+x.message}}})(ce,ce.exports);var Ft=ce.exports;const St=Ne.getDefaultExportFromCjs(Ft),N={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},be={get(i){return h.get(i,6),{signature:w.get(i,0),compressedSize:w.get(i,8),uncompressedSize:w.get(i,12)}},len:16},Bt={get(i){const e=h.get(i,6);return{signature:w.get(i,0),minVersion:h.get(i,4),dataDescriptor:!!(e&8),compressedMethod:h.get(i,8),compressedSize:w.get(i,18),uncompressedSize:w.get(i,22),filenameLength:h.get(i,26),extraFieldLength:h.get(i,28),filename:null}},len:30},At={get(i){return{signature:w.get(i,0),nrOfThisDisk:h.get(i,4),nrOfThisDiskWithTheStart:h.get(i,6),nrOfEntriesOnThisDisk:h.get(i,8),nrOfEntriesOfSize:h.get(i,10),sizeOfCd:w.get(i,12),offsetOfStartOfCd:w.get(i,16),zipFileCommentLength:h.get(i,20)}},len:22},zt={get(i){const e=h.get(i,8);return{signature:w.get(i,0),minVersion:h.get(i,6),dataDescriptor:!!(e&8),compressedMethod:h.get(i,10),compressedSize:w.get(i,20),uncompressedSize:w.get(i,24),filenameLength:h.get(i,28),extraFieldLength:h.get(i,30),fileCommentLength:h.get(i,32),relativeOffsetOfLocalHeader:w.get(i,42),filename:null}},len:46};function Te(i){const e=new Uint8Array(w.len);return w.put(e,0,i),e}const z=St("tokenizer:inflate"),ae=256*1024,Dt=Te(N.DataDescriptor),Q=Te(N.EndOfCentralDirectory);class Et{constructor(e){this.tokenizer=e,this.syncBuffer=new Uint8Array(ae)}async isZip(){return await this.peekSignature()===N.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(w)}async findEndOfCentralDirectoryLocator(){const e=this.tokenizer,t=Math.min(16*1024,e.fileInfo.size),r=this.syncBuffer.subarray(0,t);await this.tokenizer.readBuffer(r,{position:e.fileInfo.size-t});for(let n=r.length-4;n>=0;n--)if(r[n]===Q[0]&&r[n+1]===Q[1]&&r[n+2]===Q[2]&&r[n+3]===Q[3])return e.fileInfo.size-t+n;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){z("Cannot reading central-directory without random-read support");return}z("Reading central-directory...");const e=this.tokenizer.position,t=await this.findEndOfCentralDirectoryLocator();if(t>0){z("Central-directory 32-bit signature found");const r=await this.tokenizer.readToken(At,t),n=[];this.tokenizer.setPosition(r.offsetOfStartOfCd);for(let o=0;o<r.nrOfEntriesOfSize;++o){const m=await this.tokenizer.readToken(zt);if(m.signature!==N.CentralFileHeader)throw new Error("Expected Central-File-Header signature");m.filename=await this.tokenizer.readToken(new E(m.filenameLength,"utf-8")),await this.tokenizer.ignore(m.extraFieldLength),await this.tokenizer.ignore(m.fileCommentLength),n.push(m),z(`Add central-directory file-entry: n=${o+1}/${n.length}: filename=${n[o].filename}`)}return this.tokenizer.setPosition(e),n}this.tokenizer.setPosition(e)}async unzip(e){const t=await this.readCentralDirectory();if(t)return this.iterateOverCentralDirectory(t,e);let r=!1;do{const n=await this.readLocalFileHeader();if(!n)break;const o=e(n);r=!!o.stop;let m;if(await this.tokenizer.ignore(n.extraFieldLength),n.dataDescriptor&&n.compressedSize===0){const l=[];let f=ae;z("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let x=-1;for(;x<0&&f===ae;){f=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),x=Tt(this.syncBuffer.subarray(0,f),Dt);const s=x>=0?x:f;if(o.handler){const a=new Uint8Array(s);await this.tokenizer.readBuffer(a),l.push(a)}else await this.tokenizer.ignore(s)}z(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),o.handler&&await this.inflate(n,Ot(l),o.handler)}else o.handler?(z(`Reading compressed-file-data: ${n.compressedSize} bytes`),m=new Uint8Array(n.compressedSize),await this.tokenizer.readBuffer(m),await this.inflate(n,m,o.handler)):(z(`Ignoring compressed-file-data: ${n.compressedSize} bytes`),await this.tokenizer.ignore(n.compressedSize));if(z(`Reading data-descriptor at pos=${this.tokenizer.position}`),n.dataDescriptor&&(await this.tokenizer.readToken(be)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-be.len}`)}while(!r)}async iterateOverCentralDirectory(e,t){for(const r of e){const n=t(r);if(n.handler){this.tokenizer.setPosition(r.relativeOffsetOfLocalHeader);const o=await this.readLocalFileHeader();if(o){await this.tokenizer.ignore(o.extraFieldLength);const m=new Uint8Array(r.compressedSize);await this.tokenizer.readBuffer(m),await this.inflate(o,m,n.handler)}}if(n.stop)break}}inflate(e,t,r){if(e.compressedMethod===0)return r(t);z(`Decompress filename=${e.filename}, compressed-size=${t.length}`);const n=wt(t);return r(n)}async readLocalFileHeader(){const e=await this.tokenizer.peekToken(w);if(e===N.LocalFileHeader){const t=await this.tokenizer.readToken(Bt);return t.filename=await this.tokenizer.readToken(new E(t.filenameLength,"utf-8")),t}if(e===N.CentralFileHeader)return!1;throw e===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}function Tt(i,e){const t=i.length,r=e.length;if(r>t)return-1;for(let n=0;n<=t-r;n++){let o=!0;for(let m=0;m<r;m++)if(i[n+m]!==e[m]){o=!1;break}if(o)return n}return-1}function Ot(i){const e=i.reduce((n,o)=>n+o.length,0),t=new Uint8Array(e);let r=0;for(const n of i)t.set(n,r),r+=n.length;return t}new globalThis.TextDecoder("utf8");new globalThis.TextEncoder;Array.from({length:256},(i,e)=>e.toString(16).padStart(2,"0"));function Ce(i){const{byteLength:e}=i;if(e===6)return i.getUint16(0)*2**32+i.getUint32(2);if(e===5)return i.getUint8(0)*2**32+i.getUint32(1);if(e===4)return i.getUint32(0);if(e===3)return i.getUint8(0)*2**16+i.getUint16(1);if(e===2)return i.getUint16(0);if(e===1)return i.getUint8(0)}function It(i){return[...i].map(e=>e.charCodeAt(0))}function Lt(i,e=0){const t=Number.parseInt(new E(6).get(i,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(t))return!1;let r=8*32;for(let n=e;n<e+148;n++)r+=i[n];for(let n=e+156;n<e+512;n++)r+=i[n];return t===r}const Mt={get:(i,e)=>i[e+3]&127|i[e+2]<<7|i[e+1]<<14|i[e]<<21,len:4},jt=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","rm","ppsm","ppsx"],Ut=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia"],J=4100;async function Rt(i,e){return new Oe(e).fromBlob(i)}function se(i){switch(i=i.toLowerCase(),i){case"application/epub+zip":return{ext:"epub",mime:i};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:i};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:i};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:i};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:i};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:i};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:i};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:i};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:i};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:i};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:i};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:i};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:i};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:i};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:i};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:i};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"}}}function D(i,e,t){t={offset:0,...t};for(const[r,n]of e.entries())if(t.mask){if(n!==(t.mask[r]&i[r+t.offset]))return!1}else if(n!==i[r+t.offset])return!1;return!0}class Oe{constructor(e){te(this,"detectConfident",async e=>{if(this.buffer=new Uint8Array(J),e.fileInfo.size===void 0&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,await e.peekBuffer(this.buffer,{length:12,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.detectConfident(e);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await e.ignore(6);const t=await e.readToken(Mt);return e.position+t>e.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await e.ignore(t),this.fromTokenizer(e))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let t;return await new Et(e).unzip(r=>{switch(r.filename){case"META-INF/mozilla.rsa":return t={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return t={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return{async handler(n){const o=new TextDecoder("utf-8").decode(n).trim();t=se(o)},stop:!0};case"[Content_Types].xml":return{async handler(n){let o=new TextDecoder("utf-8").decode(n);const m=o.indexOf('.main+xml"');if(m===-1){const l="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";o.includes(`ContentType="${l}"`)&&(t=se(l))}else{o=o.slice(0,Math.max(0,m));const l=o.lastIndexOf('"'),f=o.slice(Math.max(0,l+1));t=se(f)}},stop:!0};default:return/classes\d*\.dex/.test(r.filename)?(t={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}}),t??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);const t=new Uint8Array(8);return await e.readBuffer(t),D(t,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:D(t,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:D(t,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:D(t,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:D(t,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:D(t,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const t=await this.readTiffHeader(!1);if(t)return t}if(this.check([77,77])){const t=await this.readTiffHeader(!0);if(t)return t}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function t(){const l=await e.peekNumber(qe);let f=128,x=0;for(;!(l&f)&&f!==0;)++x,f>>=1;const s=new Uint8Array(x+1);return await e.readBuffer(s),s}async function r(){const l=await t(),f=await t();f[0]^=128>>f.length-1;const x=Math.min(6,f.length),s=new DataView(l.buffer),a=new DataView(f.buffer,f.length-x,x);return{id:Ce(s),len:Ce(a)}}async function n(l){for(;l>0;){const f=await r();if(f.id===17026)return(await e.readToken(new E(f.len))).replaceAll(/\00.*$/g,"");await e.ignore(f.len),--l}}const o=await r();switch(await n(o.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const t=new E(4,"latin1").get(this.buffer,2);if(t.match("^d*")&&t>=1e3&&t<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await e.ignore(8),await e.readToken(new E(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
`,"\r"," "," ","\0"].some(t=>this.checkString(t,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){await e.ignore(8);async function t(){return{length:await e.readToken(Ve),type:await e.readToken(new E(4,"latin1"))}}do{const r=await t();if(r.length<0)return;switch(r.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await e.ignore(r.length+4)}}while(e.position+8<e.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&this.buffer[8]&96){const t=new E(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(t){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return t.startsWith("3g")?t.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function t(){const r=new Uint8Array(16);return await e.readBuffer(r),{id:r,size:Number(await e.readToken(_e))}}for(await e.ignore(30);e.position+24<e.fileInfo.size;){const r=await t();let n=r.size-24;if(D(r.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const o=new Uint8Array(16);if(n-=await e.readBuffer(o),D(o,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(D(o,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await e.ignore(n)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await e.ignore(20),await e.readToken(new E(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.check([0,60,0,63,0,120,0,109,0,108],{offset:2})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await e.peekBuffer(this.buffer,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){const t=new DataView(this.buffer.buffer).getUint32(12,!0);if(t>12&&this.buffer.length>=t+16)try{const r=new TextDecoder().decode(this.buffer.subarray(16,t+16));if(JSON.parse(r).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(await e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&Lt(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254]))return this.check([60,0,63,0,120,0,109,0,108,0],{offset:2})?{ext:"xml",mime:"application/xml"}:this.check([255,14,83,0,107,0,101,0,116,0,99,0,104,0,85,0,112,0,32,0,77,0,111,0,100,0,101,0,108,0],{offset:2})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:void 0;if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}});te(this,"detectImprecise",async e=>{if(this.buffer=new Uint8Array(J),await e.peekBuffer(this.buffer,{length:Math.min(8,e.fileInfo.size),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await e.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,e.fileInfo.size),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let t=0;t<=this.options.mpegOffsetTolerance;++t){const r=this.scanMpeg(t);if(r)return r}});this.options={mpegOffsetTolerance:0,...e},this.detectors=[...(e==null?void 0:e.customDetectors)??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:e==null?void 0:e.signal}}async fromTokenizer(e){const t=e.position;for(const r of this.detectors){const n=await r.detect(e);if(n)return n;if(t!==e.position)return}}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``);const t=e instanceof Uint8Array?e:new Uint8Array(e);if((t==null?void 0:t.length)>1)return this.fromTokenizer(et(t,this.tokenizerOptions))}async fromBlob(e){return this.fromStream(e.stream())}async fromStream(e){const t=await Ye(e,this.tokenizerOptions);try{return await this.fromTokenizer(t)}finally{await t.close()}}async toDetectionStream(e,t){const{sampleSize:r=J}=t;let n,o;const m=e.getReader({mode:"byob"});try{const{value:x,done:s}=await m.read(new Uint8Array(r));if(o=x,!s&&x)try{n=await this.fromBuffer(x.subarray(0,r))}catch(a){if(!(a instanceof S))throw a;n=void 0}o=x}finally{m.releaseLock()}const l=new TransformStream({async start(x){x.enqueue(o)},transform(x,s){s.enqueue(x)}}),f=e.pipeThrough(l);return f.fileType=n,f}check(e,t){return D(this.buffer,e,t)}checkString(e,t){return this.check(It(e),t)}async readTiffTag(e){const t=await this.tokenizer.readToken(e?V:h);switch(this.tokenizer.ignore(10),t){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(e){const t=await this.tokenizer.readToken(e?V:h);for(let r=0;r<t;++r){const n=await t