@spinacia_/file-viewer
Version:
A file viewer component.
7 lines • 1.89 MB
JavaScript
(function(o,R){typeof exports=="object"&&typeof module<"u"?R(exports,require("vue"),require("docx-preview"),require("pdfjs-dist")):typeof define=="function"&&define.amd?define(["exports","vue","docx-preview","pdfjs-dist"],R):(o=typeof globalThis<"u"?globalThis:o||self,R(o["@spinacia_/file-viewer"]={},o.Vue,o.docxPreview,o.PDFJS))})(this,function(o,R,El,rl){"use strict";function fl(Q){const V=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(Q){for(const d in Q)if(d!=="default"){const c=Object.getOwnPropertyDescriptor(Q,d);Object.defineProperty(V,d,c.get?c:{enumerable:!0,get:()=>Q[d]})}}return V.default=Q,Object.freeze(V)}const dl=fl(rl);var yl={},Ml={};Ml.byteLength=$l,Ml.toByteArray=UU,Ml.fromByteArray=dU;for(var Zl=[],A=[],ql=typeof Uint8Array<"u"?Uint8Array:Array,nl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wl=0,_l=nl.length;Wl<_l;++Wl)Zl[Wl]=nl[Wl],A[nl.charCodeAt(Wl)]=Wl;A[45]=62,A[95]=63;function il(Q){var V=Q.length;if(V%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var d=Q.indexOf("=");d===-1&&(d=V);var c=d===V?0:4-d%4;return[d,c]}function $l(Q){var V=il(Q),d=V[0],c=V[1];return(d+c)*3/4-c}function lU(Q,V,d){return(V+d)*3/4-d}function UU(Q){var V,d=il(Q),c=d[0],W=d[1],J=new ql(lU(Q,c,W)),M=0,a=W>0?c-4:c,X;for(X=0;X<a;X+=4)V=A[Q.charCodeAt(X)]<<18|A[Q.charCodeAt(X+1)]<<12|A[Q.charCodeAt(X+2)]<<6|A[Q.charCodeAt(X+3)],J[M++]=V>>16&255,J[M++]=V>>8&255,J[M++]=V&255;return W===2&&(V=A[Q.charCodeAt(X)]<<2|A[Q.charCodeAt(X+1)]>>4,J[M++]=V&255),W===1&&(V=A[Q.charCodeAt(X)]<<10|A[Q.charCodeAt(X+1)]<<4|A[Q.charCodeAt(X+2)]>>2,J[M++]=V>>8&255,J[M++]=V&255),J}function ZU(Q){return Zl[Q>>18&63]+Zl[Q>>12&63]+Zl[Q>>6&63]+Zl[Q&63]}function FU(Q,V,d){for(var c,W=[],J=V;J<d;J+=3)c=(Q[J]<<16&16711680)+(Q[J+1]<<8&65280)+(Q[J+2]&255),W.push(ZU(c));return W.join("")}function dU(Q){for(var V,d=Q.length,c=d%3,W=[],J=16383,M=0,a=d-c;M<a;M+=J)W.push(FU(Q,M,M+J>a?a:M+J));return c===1?(V=Q[d-1],W.push(Zl[V>>2]+Zl[V<<4&63]+"==")):c===2&&(V=(Q[d-2]<<8)+Q[d-1],W.push(Zl[V>>10]+Zl[V>>4&63]+Zl[V<<2&63]+"=")),W.join("")}var Ll={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Ll.read=function(Q,V,d,c,W){var J,M,a=W*8-c-1,X=(1<<a)-1,B=X>>1,b=-7,S=d?W-1:0,T=d?-1:1,Y=Q[V+S];for(S+=T,J=Y&(1<<-b)-1,Y>>=-b,b+=a;b>0;J=J*256+Q[V+S],S+=T,b-=8);for(M=J&(1<<-b)-1,J>>=-b,b+=c;b>0;M=M*256+Q[V+S],S+=T,b-=8);if(J===0)J=1-B;else{if(J===X)return M?NaN:(Y?-1:1)*(1/0);M=M+Math.pow(2,c),J=J-B}return(Y?-1:1)*M*Math.pow(2,J-c)},Ll.write=function(Q,V,d,c,W,J){var M,a,X,B=J*8-W-1,b=(1<<B)-1,S=b>>1,T=W===23?Math.pow(2,-24)-Math.pow(2,-77):0,Y=c?0:J-1,y=c?1:-1,n=V<0||V===0&&1/V<0?1:0;for(V=Math.abs(V),isNaN(V)||V===1/0?(a=isNaN(V)?1:0,M=b):(M=Math.floor(Math.log(V)/Math.LN2),V*(X=Math.pow(2,-M))<1&&(M--,X*=2),M+S>=1?V+=T/X:V+=T*Math.pow(2,1-S),V*X>=2&&(M++,X/=2),M+S>=b?(a=0,M=b):M+S>=1?(a=(V*X-1)*Math.pow(2,W),M=M+S):(a=V*Math.pow(2,S-1)*Math.pow(2,W),M=0));W>=8;Q[d+Y]=a&255,Y+=y,a/=256,W-=8);for(M=M<<W|a,B+=W;B>0;Q[d+Y]=M&255,Y+=y,M/=256,B-=8);Q[d+Y-y]|=n*128};/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/(function(Q){const V=Ml,d=Ll,c=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Q.Buffer=b,Q.SlowBuffer=r,Q.INSPECT_MAX_BYTES=50;const W=2147483647;Q.kMaxLength=W;const{Uint8Array:J,ArrayBuffer:M,SharedArrayBuffer:a}=globalThis;b.TYPED_ARRAY_SUPPORT=X(),!b.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function X(){try{const Z=new J(1),l={foo:function(){return 42}};return Object.setPrototypeOf(l,J.prototype),Object.setPrototypeOf(Z,l),Z.foo()===42}catch{return!1}}Object.defineProperty(b.prototype,"parent",{enumerable:!0,get:function(){if(b.isBuffer(this))return this.buffer}}),Object.defineProperty(b.prototype,"offset",{enumerable:!0,get:function(){if(b.isBuffer(this))return this.byteOffset}});function B(Z){if(Z>W)throw new RangeError('The value "'+Z+'" is invalid for option "size"');const l=new J(Z);return Object.setPrototypeOf(l,b.prototype),l}function b(Z,l,U){if(typeof Z=="number"){if(typeof l=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return y(Z)}return S(Z,l,U)}b.poolSize=8192;function S(Z,l,U){if(typeof Z=="string")return n(Z,l);if(M.isView(Z))return s(Z);if(Z==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Z);if(Fl(Z,M)||Z&&Fl(Z.buffer,M)||typeof a<"u"&&(Fl(Z,a)||Z&&Fl(Z.buffer,a)))return C(Z,l,U);if(typeof Z=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const F=Z.valueOf&&Z.valueOf();if(F!=null&&F!==Z)return b.from(F,l,U);const N=K(Z);if(N)return N;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Z[Symbol.toPrimitive]=="function")return b.from(Z[Symbol.toPrimitive]("string"),l,U);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Z)}b.from=function(Z,l,U){return S(Z,l,U)},Object.setPrototypeOf(b.prototype,J.prototype),Object.setPrototypeOf(b,J);function T(Z){if(typeof Z!="number")throw new TypeError('"size" argument must be of type number');if(Z<0)throw new RangeError('The value "'+Z+'" is invalid for option "size"')}function Y(Z,l,U){return T(Z),Z<=0?B(Z):l!==void 0?typeof U=="string"?B(Z).fill(l,U):B(Z).fill(l):B(Z)}b.alloc=function(Z,l,U){return Y(Z,l,U)};function y(Z){return T(Z),B(Z<0?0:I(Z)|0)}b.allocUnsafe=function(Z){return y(Z)},b.allocUnsafeSlow=function(Z){return y(Z)};function n(Z,l){if((typeof l!="string"||l==="")&&(l="utf8"),!b.isEncoding(l))throw new TypeError("Unknown encoding: "+l);const U=v(Z,l)|0;let F=B(U);const N=F.write(Z,l);return N!==U&&(F=F.slice(0,N)),F}function k(Z){const l=Z.length<0?0:I(Z.length)|0,U=B(l);for(let F=0;F<l;F+=1)U[F]=Z[F]&255;return U}function s(Z){if(Fl(Z,J)){const l=new J(Z);return C(l.buffer,l.byteOffset,l.byteLength)}return k(Z)}function C(Z,l,U){if(l<0||Z.byteLength<l)throw new RangeError('"offset" is outside of buffer bounds');if(Z.byteLength<l+(U||0))throw new RangeError('"length" is outside of buffer bounds');let F;return l===void 0&&U===void 0?F=new J(Z):U===void 0?F=new J(Z,l):F=new J(Z,l,U),Object.setPrototypeOf(F,b.prototype),F}function K(Z){if(b.isBuffer(Z)){const l=I(Z.length)|0,U=B(l);return U.length===0||Z.copy(U,0,0,l),U}if(Z.length!==void 0)return typeof Z.length!="number"||sl(Z.length)?B(0):k(Z);if(Z.type==="Buffer"&&Array.isArray(Z.data))return k(Z.data)}function I(Z){if(Z>=W)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+W.toString(16)+" bytes");return Z|0}function r(Z){return+Z!=Z&&(Z=0),b.alloc(+Z)}b.isBuffer=function(l){return l!=null&&l._isBuffer===!0&&l!==b.prototype},b.compare=function(l,U){if(Fl(l,J)&&(l=b.from(l,l.offset,l.byteLength)),Fl(U,J)&&(U=b.from(U,U.offset,U.byteLength)),!b.isBuffer(l)||!b.isBuffer(U))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(l===U)return 0;let F=l.length,N=U.length;for(let G=0,m=Math.min(F,N);G<m;++G)if(l[G]!==U[G]){F=l[G],N=U[G];break}return F<N?-1:N<F?1:0},b.isEncoding=function(l){switch(String(l).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},b.concat=function(l,U){if(!Array.isArray(l))throw new TypeError('"list" argument must be an Array of Buffers');if(l.length===0)return b.alloc(0);let F;if(U===void 0)for(U=0,F=0;F<l.length;++F)U+=l[F].length;const N=b.allocUnsafe(U);let G=0;for(F=0;F<l.length;++F){let m=l[F];if(Fl(m,J))G+m.length>N.length?(b.isBuffer(m)||(m=b.from(m)),m.copy(N,G)):J.prototype.set.call(N,m,G);else if(b.isBuffer(m))m.copy(N,G);else throw new TypeError('"list" argument must be an Array of Buffers');G+=m.length}return N};function v(Z,l){if(b.isBuffer(Z))return Z.length;if(M.isView(Z)||Fl(Z,M))return Z.byteLength;if(typeof Z!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Z);const U=Z.length,F=arguments.length>2&&arguments[2]===!0;if(!F&&U===0)return 0;let N=!1;for(;;)switch(l){case"ascii":case"latin1":case"binary":return U;case"utf8":case"utf-8":return ul(Z).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U*2;case"hex":return U>>>1;case"base64":return Al(Z).length;default:if(N)return F?-1:ul(Z).length;l=(""+l).toLowerCase(),N=!0}}b.byteLength=v;function P(Z,l,U){let F=!1;if((l===void 0||l<0)&&(l=0),l>this.length||((U===void 0||U>this.length)&&(U=this.length),U<=0)||(U>>>=0,l>>>=0,U<=l))return"";for(Z||(Z="utf8");;)switch(Z){case"hex":return hl(this,l,U);case"utf8":case"utf-8":return p(this,l,U);case"ascii":return Ul(this,l,U);case"latin1":case"binary":return Gl(this,l,U);case"base64":return q(this,l,U);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return al(this,l,U);default:if(F)throw new TypeError("Unknown encoding: "+Z);Z=(Z+"").toLowerCase(),F=!0}}b.prototype._isBuffer=!0;function h(Z,l,U){const F=Z[l];Z[l]=Z[U],Z[U]=F}b.prototype.swap16=function(){const l=this.length;if(l%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let U=0;U<l;U+=2)h(this,U,U+1);return this},b.prototype.swap32=function(){const l=this.length;if(l%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let U=0;U<l;U+=4)h(this,U,U+3),h(this,U+1,U+2);return this},b.prototype.swap64=function(){const l=this.length;if(l%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let U=0;U<l;U+=8)h(this,U,U+7),h(this,U+1,U+6),h(this,U+2,U+5),h(this,U+3,U+4);return this},b.prototype.toString=function(){const l=this.length;return l===0?"":arguments.length===0?p(this,0,l):P.apply(this,arguments)},b.prototype.toLocaleString=b.prototype.toString,b.prototype.equals=function(l){if(!b.isBuffer(l))throw new TypeError("Argument must be a Buffer");return this===l?!0:b.compare(this,l)===0},b.prototype.inspect=function(){let l="";const U=Q.INSPECT_MAX_BYTES;return l=this.toString("hex",0,U).replace(/(.{2})/g,"$1 ").trim(),this.length>U&&(l+=" ... "),"<Buffer "+l+">"},c&&(b.prototype[c]=b.prototype.inspect),b.prototype.compare=function(l,U,F,N,G){if(Fl(l,J)&&(l=b.from(l,l.offset,l.byteLength)),!b.isBuffer(l))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof l);if(U===void 0&&(U=0),F===void 0&&(F=l?l.length:0),N===void 0&&(N=0),G===void 0&&(G=this.length),U<0||F>l.length||N<0||G>this.length)throw new RangeError("out of range index");if(N>=G&&U>=F)return 0;if(N>=G)return-1;if(U>=F)return 1;if(U>>>=0,F>>>=0,N>>>=0,G>>>=0,this===l)return 0;let m=G-N,D=F-U;const w=Math.min(m,D),t=this.slice(N,G),x=l.slice(U,F);for(let E=0;E<w;++E)if(t[E]!==x[E]){m=t[E],D=x[E];break}return m<D?-1:D<m?1:0};function L(Z,l,U,F,N){if(Z.length===0)return-1;if(typeof U=="string"?(F=U,U=0):U>2147483647?U=2147483647:U<-2147483648&&(U=-2147483648),U=+U,sl(U)&&(U=N?0:Z.length-1),U<0&&(U=Z.length+U),U>=Z.length){if(N)return-1;U=Z.length-1}else if(U<0)if(N)U=0;else return-1;if(typeof l=="string"&&(l=b.from(l,F)),b.isBuffer(l))return l.length===0?-1:z(Z,l,U,F,N);if(typeof l=="number")return l=l&255,typeof J.prototype.indexOf=="function"?N?J.prototype.indexOf.call(Z,l,U):J.prototype.lastIndexOf.call(Z,l,U):z(Z,[l],U,F,N);throw new TypeError("val must be string, number or Buffer")}function z(Z,l,U,F,N){let G=1,m=Z.length,D=l.length;if(F!==void 0&&(F=String(F).toLowerCase(),F==="ucs2"||F==="ucs-2"||F==="utf16le"||F==="utf-16le")){if(Z.length<2||l.length<2)return-1;G=2,m/=2,D/=2,U/=2}function w(x,E){return G===1?x[E]:x.readUInt16BE(E*G)}let t;if(N){let x=-1;for(t=U;t<m;t++)if(w(Z,t)===w(l,x===-1?0:t-x)){if(x===-1&&(x=t),t-x+1===D)return x*G}else x!==-1&&(t-=t-x),x=-1}else for(U+D>m&&(U=m-D),t=U;t>=0;t--){let x=!0;for(let E=0;E<D;E++)if(w(Z,t+E)!==w(l,E)){x=!1;break}if(x)return t}return-1}b.prototype.includes=function(l,U,F){return this.indexOf(l,U,F)!==-1},b.prototype.indexOf=function(l,U,F){return L(this,l,U,F,!0)},b.prototype.lastIndexOf=function(l,U,F){return L(this,l,U,F,!1)};function j(Z,l,U,F){U=Number(U)||0;const N=Z.length-U;F?(F=Number(F),F>N&&(F=N)):F=N;const G=l.length;F>G/2&&(F=G/2);let m;for(m=0;m<F;++m){const D=parseInt(l.substr(m*2,2),16);if(sl(D))return m;Z[U+m]=D}return m}function ll(Z,l,U,F){return zl(ul(l,Z.length-U),Z,U,F)}function f(Z,l,U,F){return zl(KZ(l),Z,U,F)}function e(Z,l,U,F){return zl(Al(l),Z,U,F)}function Ql(Z,l,U,F){return zl(HZ(l,Z.length-U),Z,U,F)}b.prototype.write=function(l,U,F,N){if(U===void 0)N="utf8",F=this.length,U=0;else if(F===void 0&&typeof U=="string")N=U,F=this.length,U=0;else if(isFinite(U))U=U>>>0,isFinite(F)?(F=F>>>0,N===void 0&&(N="utf8")):(N=F,F=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const G=this.length-U;if((F===void 0||F>G)&&(F=G),l.length>0&&(F<0||U<0)||U>this.length)throw new RangeError("Attempt to write outside buffer bounds");N||(N="utf8");let m=!1;for(;;)switch(N){case"hex":return j(this,l,U,F);case"utf8":case"utf-8":return ll(this,l,U,F);case"ascii":case"latin1":case"binary":return f(this,l,U,F);case"base64":return e(this,l,U,F);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ql(this,l,U,F);default:if(m)throw new TypeError("Unknown encoding: "+N);N=(""+N).toLowerCase(),m=!0}},b.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function q(Z,l,U){return l===0&&U===Z.length?V.fromByteArray(Z):V.fromByteArray(Z.slice(l,U))}function p(Z,l,U){U=Math.min(Z.length,U);const F=[];let N=l;for(;N<U;){const G=Z[N];let m=null,D=G>239?4:G>223?3:G>191?2:1;if(N+D<=U){let w,t,x,E;switch(D){case 1:G<128&&(m=G);break;case 2:w=Z[N+1],(w&192)===128&&(E=(G&31)<<6|w&63,E>127&&(m=E));break;case 3:w=Z[N+1],t=Z[N+2],(w&192)===128&&(t&192)===128&&(E=(G&15)<<12|(w&63)<<6|t&63,E>2047&&(E<55296||E>57343)&&(m=E));break;case 4:w=Z[N+1],t=Z[N+2],x=Z[N+3],(w&192)===128&&(t&192)===128&&(x&192)===128&&(E=(G&15)<<18|(w&63)<<12|(t&63)<<6|x&63,E>65535&&E<1114112&&(m=E))}}m===null?(m=65533,D=1):m>65535&&(m-=65536,F.push(m>>>10&1023|55296),m=56320|m&1023),F.push(m),N+=D}return i(F)}const u=4096;function i(Z){const l=Z.length;if(l<=u)return String.fromCharCode.apply(String,Z);let U="",F=0;for(;F<l;)U+=String.fromCharCode.apply(String,Z.slice(F,F+=u));return U}function Ul(Z,l,U){let F="";U=Math.min(Z.length,U);for(let N=l;N<U;++N)F+=String.fromCharCode(Z[N]&127);return F}function Gl(Z,l,U){let F="";U=Math.min(Z.length,U);for(let N=l;N<U;++N)F+=String.fromCharCode(Z[N]);return F}function hl(Z,l,U){const F=Z.length;(!l||l<0)&&(l=0),(!U||U<0||U>F)&&(U=F);let N="";for(let G=l;G<U;++G)N+=gZ[Z[G]];return N}function al(Z,l,U){const F=Z.slice(l,U);let N="";for(let G=0;G<F.length-1;G+=2)N+=String.fromCharCode(F[G]+F[G+1]*256);return N}b.prototype.slice=function(l,U){const F=this.length;l=~~l,U=U===void 0?F:~~U,l<0?(l+=F,l<0&&(l=0)):l>F&&(l=F),U<0?(U+=F,U<0&&(U=0)):U>F&&(U=F),U<l&&(U=l);const N=this.subarray(l,U);return Object.setPrototypeOf(N,b.prototype),N};function O(Z,l,U){if(Z%1!==0||Z<0)throw new RangeError("offset is not uint");if(Z+l>U)throw new RangeError("Trying to access beyond buffer length")}b.prototype.readUintLE=b.prototype.readUIntLE=function(l,U,F){l=l>>>0,U=U>>>0,F||O(l,U,this.length);let N=this[l],G=1,m=0;for(;++m<U&&(G*=256);)N+=this[l+m]*G;return N},b.prototype.readUintBE=b.prototype.readUIntBE=function(l,U,F){l=l>>>0,U=U>>>0,F||O(l,U,this.length);let N=this[l+--U],G=1;for(;U>0&&(G*=256);)N+=this[l+--U]*G;return N},b.prototype.readUint8=b.prototype.readUInt8=function(l,U){return l=l>>>0,U||O(l,1,this.length),this[l]},b.prototype.readUint16LE=b.prototype.readUInt16LE=function(l,U){return l=l>>>0,U||O(l,2,this.length),this[l]|this[l+1]<<8},b.prototype.readUint16BE=b.prototype.readUInt16BE=function(l,U){return l=l>>>0,U||O(l,2,this.length),this[l]<<8|this[l+1]},b.prototype.readUint32LE=b.prototype.readUInt32LE=function(l,U){return l=l>>>0,U||O(l,4,this.length),(this[l]|this[l+1]<<8|this[l+2]<<16)+this[l+3]*16777216},b.prototype.readUint32BE=b.prototype.readUInt32BE=function(l,U){return l=l>>>0,U||O(l,4,this.length),this[l]*16777216+(this[l+1]<<16|this[l+2]<<8|this[l+3])},b.prototype.readBigUInt64LE=Vl(function(l){l=l>>>0,bl(l,"offset");const U=this[l],F=this[l+7];(U===void 0||F===void 0)&&ml(l,this.length-8);const N=U+this[++l]*2**8+this[++l]*2**16+this[++l]*2**24,G=this[++l]+this[++l]*2**8+this[++l]*2**16+F*2**24;return BigInt(N)+(BigInt(G)<<BigInt(32))}),b.prototype.readBigUInt64BE=Vl(function(l){l=l>>>0,bl(l,"offset");const U=this[l],F=this[l+7];(U===void 0||F===void 0)&&ml(l,this.length-8);const N=U*2**24+this[++l]*2**16+this[++l]*2**8+this[++l],G=this[++l]*2**24+this[++l]*2**16+this[++l]*2**8+F;return(BigInt(N)<<BigInt(32))+BigInt(G)}),b.prototype.readIntLE=function(l,U,F){l=l>>>0,U=U>>>0,F||O(l,U,this.length);let N=this[l],G=1,m=0;for(;++m<U&&(G*=256);)N+=this[l+m]*G;return G*=128,N>=G&&(N-=Math.pow(2,8*U)),N},b.prototype.readIntBE=function(l,U,F){l=l>>>0,U=U>>>0,F||O(l,U,this.length);let N=U,G=1,m=this[l+--N];for(;N>0&&(G*=256);)m+=this[l+--N]*G;return G*=128,m>=G&&(m-=Math.pow(2,8*U)),m},b.prototype.readInt8=function(l,U){return l=l>>>0,U||O(l,1,this.length),this[l]&128?(255-this[l]+1)*-1:this[l]},b.prototype.readInt16LE=function(l,U){l=l>>>0,U||O(l,2,this.length);const F=this[l]|this[l+1]<<8;return F&32768?F|4294901760:F},b.prototype.readInt16BE=function(l,U){l=l>>>0,U||O(l,2,this.length);const F=this[l+1]|this[l]<<8;return F&32768?F|4294901760:F},b.prototype.readInt32LE=function(l,U){return l=l>>>0,U||O(l,4,this.length),this[l]|this[l+1]<<8|this[l+2]<<16|this[l+3]<<24},b.prototype.readInt32BE=function(l,U){return l=l>>>0,U||O(l,4,this.length),this[l]<<24|this[l+1]<<16|this[l+2]<<8|this[l+3]},b.prototype.readBigInt64LE=Vl(function(l){l=l>>>0,bl(l,"offset");const U=this[l],F=this[l+7];(U===void 0||F===void 0)&&ml(l,this.length-8);const N=this[l+4]+this[l+5]*2**8+this[l+6]*2**16+(F<<24);return(BigInt(N)<<BigInt(32))+BigInt(U+this[++l]*2**8+this[++l]*2**16+this[++l]*2**24)}),b.prototype.readBigInt64BE=Vl(function(l){l=l>>>0,bl(l,"offset");const U=this[l],F=this[l+7];(U===void 0||F===void 0)&&ml(l,this.length-8);const N=(U<<24)+this[++l]*2**16+this[++l]*2**8+this[++l];return(BigInt(N)<<BigInt(32))+BigInt(this[++l]*2**24+this[++l]*2**16+this[++l]*2**8+F)}),b.prototype.readFloatLE=function(l,U){return l=l>>>0,U||O(l,4,this.length),d.read(this,l,!0,23,4)},b.prototype.readFloatBE=function(l,U){return l=l>>>0,U||O(l,4,this.length),d.read(this,l,!1,23,4)},b.prototype.readDoubleLE=function(l,U){return l=l>>>0,U||O(l,8,this.length),d.read(this,l,!0,52,8)},b.prototype.readDoubleBE=function(l,U){return l=l>>>0,U||O(l,8,this.length),d.read(this,l,!1,52,8)};function H(Z,l,U,F,N,G){if(!b.isBuffer(Z))throw new TypeError('"buffer" argument must be a Buffer instance');if(l>N||l<G)throw new RangeError('"value" argument is out of bounds');if(U+F>Z.length)throw new RangeError("Index out of range")}b.prototype.writeUintLE=b.prototype.writeUIntLE=function(l,U,F,N){if(l=+l,U=U>>>0,F=F>>>0,!N){const D=Math.pow(2,8*F)-1;H(this,l,U,F,D,0)}let G=1,m=0;for(this[U]=l&255;++m<F&&(G*=256);)this[U+m]=l/G&255;return U+F},b.prototype.writeUintBE=b.prototype.writeUIntBE=function(l,U,F,N){if(l=+l,U=U>>>0,F=F>>>0,!N){const D=Math.pow(2,8*F)-1;H(this,l,U,F,D,0)}let G=F-1,m=1;for(this[U+G]=l&255;--G>=0&&(m*=256);)this[U+G]=l/m&255;return U+F},b.prototype.writeUint8=b.prototype.writeUInt8=function(l,U,F){return l=+l,U=U>>>0,F||H(this,l,U,1,255,0),this[U]=l&255,U+1},b.prototype.writeUint16LE=b.prototype.writeUInt16LE=function(l,U,F){return l=+l,U=U>>>0,F||H(this,l,U,2,65535,0),this[U]=l&255,this[U+1]=l>>>8,U+2},b.prototype.writeUint16BE=b.prototype.writeUInt16BE=function(l,U,F){return l=+l,U=U>>>0,F||H(this,l,U,2,65535,0),this[U]=l>>>8,this[U+1]=l&255,U+2},b.prototype.writeUint32LE=b.prototype.writeUInt32LE=function(l,U,F){return l=+l,U=U>>>0,F||H(this,l,U,4,4294967295,0),this[U+3]=l>>>24,this[U+2]=l>>>16,this[U+1]=l>>>8,this[U]=l&255,U+4},b.prototype.writeUint32BE=b.prototype.writeUInt32BE=function(l,U,F){return l=+l,U=U>>>0,F||H(this,l,U,4,4294967295,0),this[U]=l>>>24,this[U+1]=l>>>16,this[U+2]=l>>>8,this[U+3]=l&255,U+4};function ol(Z,l,U,F,N){el(l,F,N,Z,U,7);let G=Number(l&BigInt(4294967295));Z[U++]=G,G=G>>8,Z[U++]=G,G=G>>8,Z[U++]=G,G=G>>8,Z[U++]=G;let m=Number(l>>BigInt(32)&BigInt(4294967295));return Z[U++]=m,m=m>>8,Z[U++]=m,m=m>>8,Z[U++]=m,m=m>>8,Z[U++]=m,U}function Kl(Z,l,U,F,N){el(l,F,N,Z,U,7);let G=Number(l&BigInt(4294967295));Z[U+7]=G,G=G>>8,Z[U+6]=G,G=G>>8,Z[U+5]=G,G=G>>8,Z[U+4]=G;let m=Number(l>>BigInt(32)&BigInt(4294967295));return Z[U+3]=m,m=m>>8,Z[U+2]=m,m=m>>8,Z[U+1]=m,m=m>>8,Z[U]=m,U+8}b.prototype.writeBigUInt64LE=Vl(function(l,U=0){return ol(this,l,U,BigInt(0),BigInt("0xffffffffffffffff"))}),b.prototype.writeBigUInt64BE=Vl(function(l,U=0){return Kl(this,l,U,BigInt(0),BigInt("0xffffffffffffffff"))}),b.prototype.writeIntLE=function(l,U,F,N){if(l=+l,U=U>>>0,!N){const w=Math.pow(2,8*F-1);H(this,l,U,F,w-1,-w)}let G=0,m=1,D=0;for(this[U]=l&255;++G<F&&(m*=256);)l<0&&D===0&&this[U+G-1]!==0&&(D=1),this[U+G]=(l/m>>0)-D&255;return U+F},b.prototype.writeIntBE=function(l,U,F,N){if(l=+l,U=U>>>0,!N){const w=Math.pow(2,8*F-1);H(this,l,U,F,w-1,-w)}let G=F-1,m=1,D=0;for(this[U+G]=l&255;--G>=0&&(m*=256);)l<0&&D===0&&this[U+G+1]!==0&&(D=1),this[U+G]=(l/m>>0)-D&255;return U+F},b.prototype.writeInt8=function(l,U,F){return l=+l,U=U>>>0,F||H(this,l,U,1,127,-128),l<0&&(l=255+l+1),this[U]=l&255,U+1},b.prototype.writeInt16LE=function(l,U,F){return l=+l,U=U>>>0,F||H(this,l,U,2,32767,-32768),this[U]=l&255,this[U+1]=l>>>8,U+2},b.prototype.writeInt16BE=function(l,U,F){return l=+l,U=U>>>0,F||H(this,l,U,2,32767,-32768),this[U]=l>>>8,this[U+1]=l&255,U+2},b.prototype.writeInt32LE=function(l,U,F){return l=+l,U=U>>>0,F||H(this,l,U,4,2147483647,-2147483648),this[U]=l&255,this[U+1]=l>>>8,this[U+2]=l>>>16,this[U+3]=l>>>24,U+4},b.prototype.writeInt32BE=function(l,U,F){return l=+l,U=U>>>0,F||H(this,l,U,4,2147483647,-2147483648),l<0&&(l=4294967295+l+1),this[U]=l>>>24,this[U+1]=l>>>16,this[U+2]=l>>>8,this[U+3]=l&255,U+4},b.prototype.writeBigInt64LE=Vl(function(l,U=0){return ol(this,l,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),b.prototype.writeBigInt64BE=Vl(function(l,U=0){return Kl(this,l,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Hl(Z,l,U,F,N,G){if(U+F>Z.length)throw new RangeError("Index out of range");if(U<0)throw new RangeError("Index out of range")}function gl(Z,l,U,F,N){return l=+l,U=U>>>0,N||Hl(Z,l,U,4),d.write(Z,l,U,F,23,4),U+4}b.prototype.writeFloatLE=function(l,U,F){return gl(this,l,U,!0,F)},b.prototype.writeFloatBE=function(l,U,F){return gl(this,l,U,!1,F)};function vl(Z,l,U,F,N){return l=+l,U=U>>>0,N||Hl(Z,l,U,8),d.write(Z,l,U,F,52,8),U+8}b.prototype.writeDoubleLE=function(l,U,F){return vl(this,l,U,!0,F)},b.prototype.writeDoubleBE=function(l,U,F){return vl(this,l,U,!1,F)},b.prototype.copy=function(l,U,F,N){if(!b.isBuffer(l))throw new TypeError("argument should be a Buffer");if(F||(F=0),!N&&N!==0&&(N=this.length),U>=l.length&&(U=l.length),U||(U=0),N>0&&N<F&&(N=F),N===F||l.length===0||this.length===0)return 0;if(U<0)throw new RangeError("targetStart out of bounds");if(F<0||F>=this.length)throw new RangeError("Index out of range");if(N<0)throw new RangeError("sourceEnd out of bounds");N>this.length&&(N=this.length),l.length-U<N-F&&(N=l.length-U+F);const G=N-F;return this===l&&typeof J.prototype.copyWithin=="function"?this.copyWithin(U,F,N):J.prototype.set.call(l,this.subarray(F,N),U),G},b.prototype.fill=function(l,U,F,N){if(typeof l=="string"){if(typeof U=="string"?(N=U,U=0,F=this.length):typeof F=="string"&&(N=F,F=this.length),N!==void 0&&typeof N!="string")throw new TypeError("encoding must be a string");if(typeof N=="string"&&!b.isEncoding(N))throw new TypeError("Unknown encoding: "+N);if(l.length===1){const m=l.charCodeAt(0);(N==="utf8"&&m<128||N==="latin1")&&(l=m)}}else typeof l=="number"?l=l&255:typeof l=="boolean"&&(l=Number(l));if(U<0||this.length<U||this.length<F)throw new RangeError("Out of range index");if(F<=U)return this;U=U>>>0,F=F===void 0?this.length:F>>>0,l||(l=0);let G;if(typeof l=="number")for(G=U;G<F;++G)this[G]=l;else{const m=b.isBuffer(l)?l:b.from(l,N),D=m.length;if(D===0)throw new TypeError('The value "'+l+'" is invalid for argument "value"');for(G=0;G<F-U;++G)this[G+U]=m[G%D]}return this};const cl={};function Il(Z,l,U){cl[Z]=class extends U{constructor(){super(),Object.defineProperty(this,"message",{value:l.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${Z}]`,this.stack,delete this.name}get code(){return Z}set code(N){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:N,writable:!0})}toString(){return`${this.name} [${Z}]: ${this.message}`}}}Il("ERR_BUFFER_OUT_OF_BOUNDS",function(Z){return Z?`${Z} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Il("ERR_INVALID_ARG_TYPE",function(Z,l){return`The "${Z}" argument must be of type number. Received type ${typeof l}`},TypeError),Il("ERR_OUT_OF_RANGE",function(Z,l,U){let F=`The value of "${Z}" is out of range.`,N=U;return Number.isInteger(U)&&Math.abs(U)>2**32?N=Pl(String(U)):typeof U=="bigint"&&(N=String(U),(U>BigInt(2)**BigInt(32)||U<-(BigInt(2)**BigInt(32)))&&(N=Pl(N)),N+="n"),F+=` It must be ${l}. Received ${N}`,F},RangeError);function Pl(Z){let l="",U=Z.length;const F=Z[0]==="-"?1:0;for(;U>=F+4;U-=3)l=`_${Z.slice(U-3,U)}${l}`;return`${Z.slice(0,U)}${l}`}function jZ(Z,l,U){bl(l,"offset"),(Z[l]===void 0||Z[l+U]===void 0)&&ml(l,Z.length-(U+1))}function el(Z,l,U,F,N,G){if(Z>U||Z<l){const m=typeof l=="bigint"?"n":"";let D;throw l===0||l===BigInt(0)?D=`>= 0${m} and < 2${m} ** ${(G+1)*8}${m}`:D=`>= -(2${m} ** ${(G+1)*8-1}${m}) and < 2 ** ${(G+1)*8-1}${m}`,new cl.ERR_OUT_OF_RANGE("value",D,Z)}jZ(F,N,G)}function bl(Z,l){if(typeof Z!="number")throw new cl.ERR_INVALID_ARG_TYPE(l,"number",Z)}function ml(Z,l,U){throw Math.floor(Z)!==Z?(bl(Z,U),new cl.ERR_OUT_OF_RANGE("offset","an integer",Z)):l<0?new cl.ERR_BUFFER_OUT_OF_BOUNDS:new cl.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${l}`,Z)}const OZ=/[^+/0-9A-Za-z-_]/g;function oZ(Z){if(Z=Z.split("=")[0],Z=Z.trim().replace(OZ,""),Z.length<2)return"";for(;Z.length%4!==0;)Z=Z+"=";return Z}function ul(Z,l){l=l||1/0;let U;const F=Z.length;let N=null;const G=[];for(let m=0;m<F;++m){if(U=Z.charCodeAt(m),U>55295&&U<57344){if(!N){if(U>56319){(l-=3)>-1&&G.push(239,191,189);continue}else if(m+1===F){(l-=3)>-1&&G.push(239,191,189);continue}N=U;continue}if(U<56320){(l-=3)>-1&&G.push(239,191,189),N=U;continue}U=(N-55296<<10|U-56320)+65536}else N&&(l-=3)>-1&&G.push(239,191,189);if(N=null,U<128){if((l-=1)<0)break;G.push(U)}else if(U<2048){if((l-=2)<0)break;G.push(U>>6|192,U&63|128)}else if(U<65536){if((l-=3)<0)break;G.push(U>>12|224,U>>6&63|128,U&63|128)}else if(U<1114112){if((l-=4)<0)break;G.push(U>>18|240,U>>12&63|128,U>>6&63|128,U&63|128)}else throw new Error("Invalid code point")}return G}function KZ(Z){const l=[];for(let U=0;U<Z.length;++U)l.push(Z.charCodeAt(U)&255);return l}function HZ(Z,l){let U,F,N;const G=[];for(let m=0;m<Z.length&&!((l-=2)<0);++m)U=Z.charCodeAt(m),F=U>>8,N=U%256,G.push(N),G.push(F);return G}function Al(Z){return V.toByteArray(oZ(Z))}function zl(Z,l,U,F){let N;for(N=0;N<F&&!(N+U>=l.length||N>=Z.length);++N)l[N+U]=Z[N];return N}function Fl(Z,l){return Z instanceof l||Z!=null&&Z.constructor!=null&&Z.constructor.name!=null&&Z.constructor.name===l.name}function sl(Z){return Z!==Z}const gZ=function(){const Z="0123456789abcdef",l=new Array(256);for(let U=0;U<16;++U){const F=U*16;for(let N=0;N<16;++N)l[F+N]=Z[U]+Z[N]}return l}();function Vl(Z){return typeof BigInt>"u"?vZ:Z}function vZ(){throw new Error("BigInt not supported")}})(yl);const QU=yl.Buffer,pl=yl.Buffer,VU="End-Of-Stream";class Rl extends Error{constructor(){super(VU)}}class WU{constructor(V){this.position=0,this.numBuffer=new Uint8Array(8),this.fileInfo=V||{}}async readToken(V,d=this.position){const c=pl.alloc(V.len);if(await this.readBuffer(c,{position:d})<V.len)throw new Rl;return V.get(c,0)}async peekToken(V,d=this.position){const c=pl.alloc(V.len);if(await this.peekBuffer(c,{position:d})<V.len)throw new Rl;return V.get(c,0)}async readNumber(V){if(await this.readBuffer(this.numBuffer,{length:V.len})<V.len)throw new Rl;return V.get(this.numBuffer,0)}async peekNumber(V){if(await this.peekBuffer(this.numBuffer,{length:V.len})<V.len)throw new Rl;return V.get(this.numBuffer,0)}async ignore(V){if(this.fileInfo.size!==void 0){const d=this.fileInfo.size-this.position;if(V>d)return this.position+=d,d}return this.position+=V,V}async close(){}normalizeOptions(V,d){if(d&&d.position!==void 0&&d.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return d?{mayBeLess:d.mayBeLess===!0,offset:d.offset?d.offset:0,length:d.length?d.length:V.length-(d.offset?d.offset:0),position:d.position?d.position:this.position}:{mayBeLess:!1,offset:0,length:V.length,position:this.position}}}class RU extends WU{constructor(V,d){super(d),this.uint8Array=V,this.fileInfo.size=this.fileInfo.size?this.fileInfo.size:V.length}async readBuffer(V,d){if(d&&d.position){if(d.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");this.position=d.position}const c=await this.peekBuffer(V,d);return this.position+=c,c}async peekBuffer(V,d){const c=this.normalizeOptions(V,d),W=Math.min(this.uint8Array.length-c.position,c.length);if(!c.mayBeLess&&W<c.length)throw new Rl;return V.set(this.uint8Array.subarray(c.position,c.position+W),c.offset),W}async close(){}}function NU(Q,V){return new RU(Q,V)}class Cl{constructor(V,d){this.len=V,this.encoding=d}get(V,d){return pl.from(V).toString(this.encoding,d,d+this.len)}}const cU=4100,bU=[137,80,78,71,13,10,26,10],JU=[255,216,255],GU=[66,77],mU=[71,73,70],MU=[77,90],TU=[80,75,3,4],XU=[39,10,0,0,0,0,0,0,0,0,0,0],YU=[0,0,1,0],kl=Q=>[...Q].map(V=>V.charCodeAt(0)),SU=kl("WEBP"),BU=kl("%PDF"),hU=kl("SCRM"),aU=(Q,V=0,d=2)=>new Promise((c,W)=>{const J=new FileReader;J.onload=()=>{c(J.result)},J.onerror=W,J.readAsArrayBuffer(Q.slice(V,d))}),zU=Q=>new Promise((V,d)=>{const c=new FileReader;c.onload=()=>{V(c.result)},c.onerror=d,c.readAsArrayBuffer(Q)}),_=async(Q,V,d=0)=>{const c=await aU(Q,d,V.length+d),W=new Uint8Array(c);return V.every((J,M)=>J===W[M])},Dl=async Q=>{if(await _(Q,bU))return{ext:"png",mime:"image/png"};if(await _(Q,JU))return{ext:"jpg",mime:"image/jpeg"};if(await _(Q,SU,8))return{ext:"webp",mime:"image/webp"};if(await _(Q,GU))return{ext:"bmp",mime:"image/bmp"};if(await _(Q,mU))return{ext:"gif",mime:"image/gif"};if(await _(Q,BU))return{ext:"pdf",mime:"application/pdf"};if(await _(Q,YU))return{ext:"ico",mime:"image/x-icon"};if(await _(Q,TU)){const V=QU.alloc(cU),d=new Uint8Array(await zU(Q)),c=NU(d);c.fileInfo.size===void 0&&(c.fileInfo.size=Number.MAX_SAFE_INTEGER),await c.peekBuffer(V,{length:12,mayBeLess:!0});try{for(;c.position+30<c.fileInfo.size;){await c.readBuffer(V,{length:30});const W={compressedSize:V.readUInt32LE(18),uncompressedSize:V.readUInt32LE(22),filenameLength:V.readUInt16LE(26),extraFieldLength:V.readUInt16LE(28),filename:""};if(W.filename=await c.readToken(new Cl(W.filenameLength,"utf-8")),await c.ignore(W.extraFieldLength),W.filename==="META-INF/mozilla.rsa")return{ext:"xpi",mime:"application/x-xpinstall"};if(W.filename.endsWith(".rels")||W.filename.endsWith(".xml"))switch(W.filename.split("/")[0]){case"_rels":break;case"word":return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};case"ppt":return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};case"xl":return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};default:break}if(W.filename.startsWith("xl/"))return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(W.filename.startsWith("3D/")&&W.filename.endsWith(".model"))return{ext:"3mf",mime:"model/3mf"};if(W.filename==="mimetype"&&W.compressedSize===W.uncompressedSize){let J=await c.readToken(new Cl(W.compressedSize,"utf-8"));switch(J=J.trim(),J){case"application/epub+zip":return{ext:"epub",mime:"application/epub+zip"};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"};default:break}}if(W.compressedSize===0){let J=-1;for(;J<0&&c.position<c.fileInfo.size;)await c.peekBuffer(V,{mayBeLess:!0}),J=V.indexOf("504B0304",0,"hex"),await c.ignore(J>=0?J:V.length)}else await c.ignore(W.compressedSize)}}catch(W){if(!(W instanceof Rl))throw W}return{ext:"zip",mime:"application/zip"}}if(await _(Q,MU))return{ext:"exe",mime:"application/x-msdownload"};if(await _(Q,hU))return{ext:"s3m",mime:"audio/x-s3m"};if(await _(Q,XU,2))return{ext:"shp",mime:"application/x-esri-shape"};switch(Q.type){case"text/plain":return{ext:"txt",mime:"text/plain"};case"image/svg+xml":return{ext:"svg",mime:"image/svg+xml"}}return{ext:"unknown",mime:"unknown"}},Tl=["png","jpg","webp","bmp","gif","svg","ico"],Xl=["pdf"],Yl=["docx"],yU=["xlsx","csv"],Sl=["txt"],nU=["zip"];var LU=Object.defineProperty,pU=(Q,V,d)=>V in Q?LU(Q,V,{enumerable:!0,configurable:!0,writable:!0,value:d}):Q[V]=d,kU=(Q,V,d)=>(pU(Q,V+"",d),d);const Bl="internal-link",DU="link",IU="file-attachment",uU="form-text",sU="form-select",EU="form-checkbox",iU="form-radio",CU="form-button",tl=["click","dblclick","mouseover","input","change"];function Jl(Q,V,d){const c=[];if(d)for(const W of d)W[Q]===V&&c.push(W);return c}function $(Q,V){return{type:Q,data:V}}function Nl(Q,V){switch(Q.type){case"textarea":case"text":return $(uU,{fieldName:Q.name,value:Q.value});case"select-one":case"select-multiple":const d=[];for(const W of Q.options)d.push({value:W.value,label:W.label});const c=[];for(const W of Q.selectedOptions)c.push({value:W.value,label:W.label});return $(sU,{fieldName:Q.name,value:c,options:d});case"checkbox":return $(EU,{fieldName:Q.name,checked:Q.checked});case"radio":return $(iU,{fieldName:Q.name,...V});case"button":return $(CU,{fieldName:Q.name,...V})}}function tU(Q){return $(IU,Q.file)}async function wU(Q,V){if(Q.dest){let d;if(typeof Q.dest=="string"?d=await V.getDestination(Q.dest):d=Q.dest,!Array.isArray(d))return console.warn(`Destination "${d}" is not a valid destination (dest="${Q.dest}")`),$(Bl,{referencedPage:null,offset:null});let c=null;d.length===5&&(c={left:Q.dest[2],bottom:Q.dest[3]});const[W]=d;if(Number.isInteger(W))return $(Bl,{referencedPage:Number(W)+1,offset:c});if(typeof W=="object"){const J=await V.getPageIndex(W);return $(Bl,{referencedPage:J+1,offset:c})}else return console.warn(`Destination "${W}" is not a valid destination (dest="${Q.dest}")`),$(Bl,{referencedPage:null,offset:null})}else if(Q.url)return $(DU,{url:Q.url,unsafeUrl:Q.unsafeUrl})}function wl(Q){for(const V of Q.getElementsByTagName("span")){let d=V.textContent;const c=JSON.parse(V.dataset.l10nArgs??"{}");if(d)for(const W in c)d=d.replace(`{{${W}}}`,c[W]);V.textContent=d}}function xU(Q,V,d){var c;let W=Q.target.parentNode;if(W.tagName==="DIV"&&(W=W.firstChild),W.className==="linkAnnotation"&&Q.type==="click"){const J=(c=W.dataset)==null?void 0:c.annotationId;if(J)return wU(Jl("id",J,d)[0],V)}else if(W.className.includes("popupAnnotation")||W.className.includes("textAnnotation"))wl(W);else if(W.className.includes("fileAttachmentAnnotation")){wl(W);const J=W.dataset.annotationId;if(J&&Q.type==="dblclick")return tU(Jl("id",J,d)[0])}else if(W.className.includes("textWidgetAnnotation")&&Q.type==="input"){let J=W.getElementsByTagName("input")[0];return J||(J=W.getElementsByTagName("textarea")[0]),Nl(J)}else{if(W.className.includes("choiceWidgetAnnotation")&&Q.type==="input")return Nl(W.getElementsByTagName("select")[0]);if(W.className.includes("buttonWidgetAnnotation checkBox")&&Q.type==="change")return Nl(W.getElementsByTagName("input")[0]);if(W.className.includes("buttonWidgetAnnotation radioButton")&&Q.type==="change"){const J=W.dataset.annotationId;if(J){const M=Jl("id",J,d)[0],a=[];for(const X of Jl("fieldName",M.fieldName,d))X.buttonValue&&a.push(X.buttonValue);return Nl(W.getElementsByTagName("input")[0],{value:M.buttonValue,defaultValue:M.fieldValue,options:a})}}else if(W.className.includes("buttonWidgetAnnotation pushButton")&&Q.type==="click"){const J=W.dataset.annotationId;if(J){const M=Jl("id",J,d)[0];return M.resetForm?Nl({name:M.fieldName,type:"button"},{actions:M.actions,reset:!0}):Nl({name:M.fieldName,type:"button"},{actions:M.actions,reset:!1})}}}}class xl{constructor(){kU(this,"externalLinkEnabled"),this.externalLinkEnabled=!0}get pagesCount(){return 0}get page(){return 0}set page(V){}get rotation(){return 0}set rotation(V){}get isInPresentationMode(){return!1}async goToDestination(V){}goToPage(V){}addLinkAttributes(V,d,c=!1){}getDestinationHash(V){return"#"}getAnchorUrl(V){return"#"}setHash(V){}executeNamedAction(V){}executeSetOCGState(V){}cachePageRef(V,d){}}const jU=R.defineComponent({__name:"AnnotationLayer",props:{page:{},viewport:{},document:{},annotationsFilter:{},annotationsMap:{},imageResourcesPath:{},hideForms:{type:Boolean},enableScripting:{type:Boolean},intent:{}},emits:["annotation","annotationLoaded"],setup(Q,{emit:V}){const d=Q,c=V,W=R.ref(),J=R.ref();function M(S){const T=xU(S,d.document,J.value);Promise.resolve(T).then(Y=>{Y&&c("annotation",Y)})}async function a(){var S;return await((S=R.toRaw(d.document))==null?void 0:S.getFieldObjects())}async function X(){var S;return await((S=R.toRaw(d.document))==null?void 0:S.hasJSActions())}async function B(){const S=d.page;let T=await S?.getAnnotations({intent:d.intent});if(d.annotationsFilter){const Y=d.annotationsFilter;T=T.filter(y=>{const n=y.subtype,k=y.fieldType?`${n}.${y.fieldType}`:null;return Y?.includes(n)||k!==null&&Y?.includes(k)})}return T}async function b(){var S,T;(T=(S=W.value).replaceChildren)==null||T.call(S);for(const I of tl)W.value.removeEventListener(I,M);const Y=R.toRaw(d.document),y=d.page,n=d.viewport;J.value=await B();const k=new Map([]);for(const I of J.value)if(I.subtype==="Widget"&&I.fieldType==="Btn"&&I.pushButton){const r=I.rect[2]-I.rect[0],v=I.rect[3]-I.rect[1],P=document.createElement("canvas");P.setAttribute("width",(r*n.scale).toString()),P.setAttribute("height",(v*n.scale).toString()),k.set(I.id,P)}const s=Y.annotationStorage;if(d.annotationsMap)for(const[I,r]of Object.entries(d.annotationsMap))s.setValue(I,r);const C={accessibilityManager:void 0,annotationCanvasMap:k,div:W.value,page:y,viewport:n.clone({dontFlip:!0}),annotationEditorUIManager:null,l10n:null,structTreeLayer:null},K={annotations:J.value,viewport:n.clone({dontFlip:!0}),linkService:new xl,annotationCanvasMap:k,div:W.value,annotationStorage:s,renderForms:!d.hideForms,page:y,enableScripting:!1,hasJSActions:await X(),fieldObjects:await a(),downloadManager:null,imageResourcesPath:d.imageResourcesPath};new dl.AnnotationLayer(C).render(K).then(async()=>{c("annotationLoaded",await B())});for(const I of tl)W.value.addEventListener(I,M)}return R.watch(()=>d.viewport,()=>{d.page&&d.viewport&&W.value&&b()}),R.onMounted(()=>{d.page&&d.viewport&&W.value&&b()}),(S,T)=>(R.openBlock(),R.createElementBlock("div",{ref_key:"layer",ref:W,class:"annotationLayer",style:{display:"block"}},null,512))}});function OU(Q,V,d){const c=[];for(const b of Q.items)if(b.hasEOL)if(b.str.endsWith("-")){const S=b.str.lastIndexOf("-");c.push(b.str.substring(0,S))}else c.push(b.str,`
`);else c.push(b.str);const W=c.join("").replace(/\n/g," "),J=["g"];d.ignoreCase&&J.push("i");let M=V.trim().replace(/[.*+?^${}()|[\]\\]/g,"\\$&");d.completeWords&&(M=`\\b${M}\\b`);const a=new RegExp(M,J.join("")),X=[];let B;for(;(B=a.exec(W))!==null;)X.push([B.index,B[0].length,B[0]]);return X}function oU(Q,V){function d(X){return X.hasEOL?X.str.endsWith("-")?-1:1:0}let c=0,W=0;const J=V.items,M=J.length-1,a=[];for(let X=0;X<Q.length;X++){let B=Q[X][0];for(;c!==M&&B>=W+J[c].str.length;){const T=J[c];W+=T.str.length+d(T),c++}const b={idx:c,offset:B-W};for(B+=Q[X][1];c!==M&&B>W+J[c].str.length;){const T=J[c];W+=T.str.length+d(T),c++}const S={idx:c,offset:B-W};a.push({start:b,end:S,str:Q[X][2],oindex:Q[X][0]})}return a}function KU(Q,V,d){function c(W,J=-1,M=-1){const a=V.items[W],X=[];let B="",b="",S="",T=d[W];if(!T)return;if(T.nodeType===Node.TEXT_NODE){const n=document.createElement("span");T.before(n),n.append(T),d[W]=n,T=n}J>=0&&M>=0?B=a.str.substring(J,M):J<0&&M<0?B=a.str:J>=0?B=a.str.substring(J):M>=0&&(B=a.str.substring(0,M));const Y=document.createTextNode(B),y=document.createElement("span");if(y.className="highlight appended",y.append(Y),X.push(y),J>0)if(T.childNodes.length===1&&T.childNodes[0].nodeType===Node.TEXT_NODE){b=a.str.substring(0,J);const n=document.createTextNode(b);X.unshift(n)}else{let n=0;const k=[];for(const s of T.childNodes){const C=s.nodeType===Node.TEXT_NODE?s.nodeValue:s.firstChild.nodeValue;n+=C.length,n<=J?k.push(s):J>=n-C.length&&M<=n&&k.push(document.createTextNode(C.substring(0,J-(n-C.length))))}X.unshift(...k)}if(M>0){S=a.str.substring(M);const n=document.createTextNode(S);X.push(n)}T.replaceChildren(...X)}for(const W of Q)if(W.start.idx===W.end.idx)c(W.start.idx,W.start.offset,W.end.offset);else for(let J=W.start.idx,M=W.end.idx;J<=M;J++)J===W.start.idx?c(J,W.start.offset):J===W.end.idx?c(J,-1,W.end.offset):c(J)}function HU(Q,V){const d=Q.items.map(c=>c.str);for(let c=0;c<V.length;c++){const W=V[c];if(W&&W.nodeType!==Node.TEXT_NODE){const J=document.createTextNode(d[c]);W.replaceChildren(J)}}}function gU(Q,V,d){const c=[];for(const W of Q){const J=OU(V,W,d);c.push(...oU(J,V))}return c}const vU=R.defineComponent({__name:"TextLayer",props:{page:{},viewport:{},highlightText:{},highlightOptions:{},hightlightPages:{}},emits:["highlight","textLoaded"],setup(Q,{emit:V}){const d=Q,c=V,W=R.ref(),J=R.ref();let M=[];function a(){return Object.assign({},{ignoreCase:!0,completeWords:!1},d.highlightOptions)}async function X(T=!1){const Y=d.page,y=await Y?.getTextContent();if(y&&(T&&HU(y,M),d.highlightText&&(!d.hightlightPages||d.hightlightPages.includes(Y.pageNumber)))){const n=typeof d.highlightText=="string"?[d.highlightText]:d.highlightText,k=gU(n,y,a());KU(k,y,M),c("highlight",{matches:k,textContent:y,textDivs:M,page:Y?.pageNumber||1})}}function B(){var T,Y;(Y=(T=W.value).replaceChildren)==null||Y.call(T);const y=d.page,n=d.viewport,k=y?.streamTextContent({includeMarkedContent:!0,disableNormalization:!0}),s=new dl.TextLayer({container:W.value,textContentSource:k,viewport:n});s.render().then(async()=>{var C;M=s.textDivs;const K=await y?.getTextContent();c("textLoaded",{textDivs:M,textContent:K});const I=document.createElement("div");I.className="endOfContent",(C=W.value)==null||C.appendChild(I),J.value=I,X()})}function b(){J.value&&J.value.classList.add("active")}function S(){J.value&&J.value.classList.remove("active")}return R.watch(()=>d.viewport,T=>{d.page&&d.viewport&&W.value&&B()}),R.watch(()=>[d.highlightText,d.highlightOptions],T=>{X(!0)},{deep:!0}),R.onMounted(()=>{d.page&&d.viewport&&W.value&&B()}),(T,Y)=>(R.openBlock(),R.createElementBlock("div",{ref_key:"layer",ref:W,class:"textLayer",style:{display:"block"},onMousedown:b,onMouseup:S},null,544))}}),PU=R.defineComponent({__name:"XFALayer",props:{page:{},document:{},viewport:{}},emits:["xfaLoaded"],setup(Q,{emit:V}){const d=Q,c=V,W=R.ref();async function J(){var M,a;(a=(M=W.value).replaceChildren)==null||a.call(M);const X=R.toRaw(d.document),B=d.page,b=d.viewport;if(X.isPureXfa){const S=await B.getXfa(),T={div:W.value,viewport:b.clone({dontFlip:!0}),linkService:new xl,annotationStorage:X?.annotationStorage,xfaHtml:S};dl.XfaLayer.render(T),c("xfaLoaded")}}return R.watch(()=>d.viewport,M=>{d.page&&d.viewport&&W.value&&J()}),R.onMounted(()=>{d.page&&d.viewport&&W.value&&J()}),(M,a)=>(R.openBlock(),R.createElementBlock("div",{ref_key:"layer",ref:W,style:{display:"block"}},null,512))}}),eU=R.createElementVNode("canvas",{dir:"ltr",style:{display:"block"},role:"main"},null,-1),AU=R.defineComponent({__name:"VuePDF",props:{pdf:{},page:{default:1},scale:{default:1},rotation:{},fitParent:{type:Boolean},width:{},height:{},textLayer:{type:Boolean},autoDestroy:{type:Boolean,default:!1},imageResourcesPath:{},hideForms:{type:Boolean},intent:{default:"display"},annotationLayer:{type:Boolean},annotationsFilter:{},annotationsMap:{},watermarkText:{},watermarkOptions:{},highlightText:{},highlightOptions:{},highlightPages:{}},emits:["annotation","highlight","loaded","textLoaded","annotationLoaded","xfaLoaded"],setup(Q,{expose:V,emit:d}){const c=Q,W=d,J=R.ref(),M=R.ref(),a=R.ref(!1);let X;const B=R.computed(()=>({viewport:void 0,document:void 0,page:void 0})),b=R.computed(()=>({annotationsMap:c.annotationsMap,annotationsFilter:c.annotationsFilter,imageResourcesPath:c.imageResourcesPath,hideForms:c.hideForms,intent:c.intent})),S=R.computed(()=>({highlightText:c.highlightText,highlightOptions:c.highlightOptions,highlightPages:c.highlightPages}));function T(){return Object.assign({},{columns:4,rows:4,rotation:45,fontSize:18,color:"rgba(211, 210, 211, 0.4)"},c.watermarkOptions)}function Y(h){if(!(typeof h=="number"&&h%90===0))return 0;const L=h/90;return L>4?Y(h-360):L<0?Y(h+360):h}function y(h){let L=c.scale;if(c.fitParent){const z=J.value.parentNode.clientWidth,j=h.getViewport({scale:1}).width;L=z/j}else if(c.width){const z=h.getViewport({scale:1}).width;L=c.width/z}else if(c.height){const z=h.getViewport({scale:1}).height;L=c.height/z}return L}function n(h=1){if(!c.watermarkText)return;const L=k();if(!L)return;const z=L.getContext("2d");if(!z)return;const j=T(),ll=c.watermarkText,f=j.columns,e=j.rows,Ql=f*e,q=j.rotation,p=j.fontSize*h;z.font=`${p}px Trebuchet MS`,z.fillStyle=j.color;for(let u=0;u<Ql;u++){const i=u%f*(L.width/f)+L.width/(f*2),Ul=Math.floor(u/f)*(L.height/e)+L.height/(e*2),Gl=z.measureText(ll).width;z.save(),z.translate(i,Ul),z.rotate(-q*(Math.PI/180)),z.fillText(ll,-Gl/2,p/2),z.restore()}}function k(){var h;let L=null;return(h=J.value)==null||h.childNodes.forEach(z=>{z.tagName==="CANVAS"&&(L=z)}),L}function s(h){var L;let z;const j=k();j&&j?.getAttribute("role")==="main"?z=j:(z=document.createElement("canvas"),z.style.display="block",z.setAttribute("dir","ltr"));const ll=window.devicePixelRatio||1;return z.width=Math.floor(h.width*ll),z.height=Math.floor(h.height*ll),z.style.width=`${Math.floor(h.width)}px`,z.style.height=`${Math.floor(h.height)}px`,(L=J.value)==null||L.style.setProperty("--scale-factor",`${h.scale}`),M.value.style.width=`${Math.floor(h.width)}px`,M.value.style.height=`${Math.floor(h.height)}px`,M.value.style.top="0",M.value.style.left="0",a.value=!0,z}function C(){X&&X.cancel()}function K(h){var L;(L=R.toRaw(B.value.document))==null||L.getPage(h).then(z=>{var j;C();const ll=z.getViewport(),f={scale:y(z),rotation:Y((c.rotation||0)+ll.rotation)},e=z.getViewport(f),Ql=k(),q=s(e),p=window.devicePixelRatio||1,u=p!==1?[p,0,0,p,0,0]:void 0,i={canvasContext:q.getContext("2d"),viewport:e,annotationMode:c.hideForms?dl.AnnotationMode.ENABLE:dl.AnnotationMode.ENABLE_FORMS,transform:u,intent:c.intent};q?.getAttribute("role")!=="main"?Ql&&((j=J.value)==null||j.replaceChild(q,Ql)):q.removeAttribute("role"),B.value.page=z,B.value.viewport=e,X=z.render(i),X.promise.then(()=>{a.value=!1,n(e.scale),W("loaded",B.value.viewport)}).catch(()=>{})})}function I(h){h.promise.then(async L=>{B.value.document=L,K(c.page)})}R.watch(()=>c.pdf,h=>{h!==void 0&&I(h)}),R.watch(()=>[c.scale,c.width,c.height,c.rotation,c.page,c.hideForms,c.intent],()=>{K(c.page)}),R.onMounted(()=>{c.pdf!==void 0&&I(c.pdf)}),R.onUnmounted(()=>{var h;c.autoDestroy&&((h=c.pdf)==null||h.destroy())});function r(){var h;(h=c.pdf)==null||h.destroy()}function v(){K(c.page)}function P(){C()}return V({reload:v,cancel:P,destroy:r}),(h,L)=>(R.openBlock(),R.createElementBlock("div",{ref_key:"container",ref:J,style:{position:"relative",display:"block"}},[eU,h.annotationLayer?(R.openBlock(),R.createBlock(jU,R.mergeProps({key:0},{...B.value,...b.value},{onAnnotation:L[0]||(L[0]=z=>W("annotation",z)),onAnnotationLoaded:L[1]||(L[1]=z=>W("annotationLoaded",z))}),null,16)):R.createCommentVNode("",!0),h.textLayer?(R.openBlock(),R.createBlock(vU,R.mergeProps({key:1},{...B.value,...S.value},{onHighlight:L[2]||(L[2]=z=>W("highlight",z)),onTextLoaded:L[3]||(L[3]=z=>W("textLoaded",z))}),null,16)):R.createCommentVNode("",!0),R.createVNode(PU,R.mergeProps({...B.value},{onXfaLoaded:L[4]||(L[4]=z=>W("xfaLoaded"))}),null,16),R.withDirectives(R.createElementVNode("div",{ref_key:"loadingLayer",ref:M,style:{position:"absolute"}},[R.renderSlot(h.$slots,"default")],512),[[R.vShow,a.value]])],512))}}),rU="data:application/javascript;base64,LyoqCiAqIEBsaWNzdGFydCBUaGUgZm9sbG93aW5nIGlzIHRoZSBlbnRpcmUgbGljZW5zZSBub3RpY2UgZm9yIHRoZQogKiBKYXZhU2NyaXB0IGNvZGUgaW4gdGhpcyBwYWdlCiAqCiAqIENvcHlyaWdodCAyMDI0IE1vemlsbGEgRm91bmRhdGlvbgogKgogKiBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wICh0aGUgIkxpY2Vuc2UiKTsKICogeW91IG1heSBub3QgdXNlIHRoaXMgZmlsZSBleGNlcHQgaW4gY29tcGxpYW5jZSB3aXRoIHRoZSBMaWNlbnNlLgogKiBZb3UgbWF5IG9idGFpbiBhIGNvcHkgb2YgdGhlIExpY2Vuc2UgYXQKICoKICogICAgIGh0dHA6Ly93d3cuYXBhY2hlLm9yZy9saWNlbnNlcy9MSUNFTlNFLTIuMAogKgogKiBVbmxlc3MgcmVxdWlyZWQgYnkgYXBwbGljYWJsZSBsYXcgb3IgYWdyZWVkIHRvIGluIHdyaXRpbmcsIHNvZnR3YXJlCiAqIGRpc3RyaWJ1dGVkIHVuZGVy