@openread/mcp 0.0.1-test.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +147 -0
  3. package/dist/cli.mjs +229 -0
  4. package/package.json +49 -0
package/dist/cli.mjs ADDED
@@ -0,0 +1,229 @@
1
+ #!/usr/bin/env node
2
+ if(typeof globalThis.DOMMatrix==="undefined"){globalThis.DOMMatrix=class DOMMatrix{constructor(init){const v=init||[];this.a=v[0]??1;this.b=v[1]??0;this.c=v[2]??0;this.d=v[3]??1;this.e=v[4]??0;this.f=v[5]??0;this.m11=this.a;this.m12=this.b;this.m21=this.c;this.m22=this.d;this.m41=this.e;this.m42=this.f;this.is2D=true;this.isIdentity=this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.e===0&&this.f===0;}static fromMatrix(o){return new DOMMatrix([o.a,o.b,o.c,o.d,o.e,o.f]);}static fromFloat64Array(a){return new DOMMatrix(Array.from(a));}static fromFloat32Array(a){return new DOMMatrix(Array.from(a));}inverse(){return new DOMMatrix();}multiply(){return new DOMMatrix();}scale(){return new DOMMatrix();}translate(){return new DOMMatrix();}transformPoint(p){return p||{x:0,y:0};}}}
3
+ if(typeof globalThis.Path2D==="undefined"){globalThis.Path2D=class Path2D{constructor(){}addPath(){}closePath(){}moveTo(){}lineTo(){}bezierCurveTo(){}quadraticCurveTo(){}arc(){}arcTo(){}rect(){}}}
4
+ if(typeof globalThis.ImageData==="undefined"){globalThis.ImageData=class ImageData{constructor(w,h){this.width=w;this.height=h;this.data=new Uint8ClampedArray(w*h*4);}}}
5
+ var Z_=Object.create;var Qm=Object.defineProperty;var J_=Object.getOwnPropertyDescriptor;var eC=Object.getOwnPropertyNames;var tC=Object.getPrototypeOf,rC=Object.prototype.hasOwnProperty;var Ue=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var j=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var nC=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of eC(e))!rC.call(r,i)&&i!==t&&Qm(r,i,{get:()=>e[i],enumerable:!(n=J_(e,i))||n.enumerable});return r};var Sh=(r,e,t)=>(t=r!=null?Z_(tC(r)):{},nC(e||!r||!r.__esModule?Qm(t,"default",{value:r,enumerable:!0}):t,r));var kh=j((BF,ob)=>{"use strict";var Ps=r=>r&&typeof r.message=="string",Ch=r=>{if(!r)return;let e=r.cause;if(typeof e=="function"){let t=r.cause();return Ps(t)?t:void 0}else return Ps(e)?e:void 0},sb=(r,e)=>{if(!Ps(r))return"";let t=r.stack||"";if(e.has(r))return t+`
6
+ causes have become circular...`;let n=Ch(r);return n?(e.add(r),t+`
7
+ caused by: `+sb(n,e)):t},dC=r=>sb(r,new Set),ab=(r,e,t)=>{if(!Ps(r))return"";let n=t?"":r.message||"";if(e.has(r))return n+": ...";let i=Ch(r);if(i){e.add(r);let s=typeof r.cause=="function";return n+(s?"":": ")+ab(i,e,s)}else return n},fC=r=>ab(r,new Set);ob.exports={isErrorLike:Ps,getErrorCause:Ch,stackWithCauses:dC,messageWithCauses:fC}});var Ih=j((DF,lb)=>{"use strict";var pC=Symbol("circular-ref-tag"),Vo=Symbol("pino-raw-err-ref"),ub=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[Vo]},set:function(r){this[Vo]=r}}});Object.defineProperty(ub,Vo,{writable:!0,value:{}});lb.exports={pinoErrProto:ub,pinoErrorSymbols:{seen:pC,rawSymbol:Vo}}});var db=j((FF,hb)=>{"use strict";hb.exports=Ph;var{messageWithCauses:gC,stackWithCauses:mC,isErrorLike:cb}=kh(),{pinoErrProto:bC,pinoErrorSymbols:yC}=Ih(),{seen:Rh}=yC,{toString:vC}=Object.prototype;function Ph(r){if(!cb(r))return r;r[Rh]=void 0;let e=Object.create(bC);e.type=vC.call(r.constructor)==="[object Function]"?r.constructor.name:r.name,e.message=gC(r),e.stack=mC(r),Array.isArray(r.errors)&&(e.aggregateErrors=r.errors.map(t=>Ph(t)));for(let t in r)if(e[t]===void 0){let n=r[t];cb(n)?t!=="cause"&&!Object.prototype.hasOwnProperty.call(n,Rh)&&(e[t]=Ph(n)):e[t]=n}return delete r[Rh],e.raw=r,e}});var pb=j(($F,fb)=>{"use strict";fb.exports=qo;var{isErrorLike:Oh}=kh(),{pinoErrProto:wC,pinoErrorSymbols:xC}=Ih(),{seen:Go}=xC,{toString:SC}=Object.prototype;function qo(r){if(!Oh(r))return r;r[Go]=void 0;let e=Object.create(wC);e.type=SC.call(r.constructor)==="[object Function]"?r.constructor.name:r.name,e.message=r.message,e.stack=r.stack,Array.isArray(r.errors)&&(e.aggregateErrors=r.errors.map(t=>qo(t))),Oh(r.cause)&&!Object.prototype.hasOwnProperty.call(r.cause,Go)&&(e.cause=qo(r.cause));for(let t in r)if(e[t]===void 0){let n=r[t];Oh(n)?Object.prototype.hasOwnProperty.call(n,Go)||(e[t]=qo(n)):e[t]=n}return delete r[Go],e.raw=r,e}});var yb=j((UF,bb)=>{"use strict";bb.exports={mapHttpRequest:EC,reqSerializer:mb};var Lh=Symbol("pino-raw-req-ref"),gb=Object.create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[Lh]},set:function(r){this[Lh]=r}}});Object.defineProperty(gb,Lh,{writable:!0,value:{}});function mb(r){let e=r.info||r.socket,t=Object.create(gb);if(t.id=typeof r.id=="function"?r.id():r.id||(r.info?r.info.id:void 0),t.method=r.method,r.originalUrl)t.url=r.originalUrl;else{let n=r.path;t.url=typeof n=="string"?n:r.url?r.url.path||r.url:void 0}return r.query&&(t.query=r.query),r.params&&(t.params=r.params),t.headers=r.headers,t.remoteAddress=e&&e.remoteAddress,t.remotePort=e&&e.remotePort,t.raw=r.raw||r,t}function EC(r){return{req:mb(r)}}});var Sb=j((zF,xb)=>{"use strict";xb.exports={mapHttpResponse:AC,resSerializer:wb};var Nh=Symbol("pino-raw-res-ref"),vb=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[Nh]},set:function(r){this[Nh]=r}}});Object.defineProperty(vb,Nh,{writable:!0,value:{}});function wb(r){let e=Object.create(vb);return e.statusCode=r.headersSent?r.statusCode:null,e.headers=r.getHeaders?r.getHeaders():r._headers,e.raw=r,e}function AC(r){return{res:wb(r)}}});var Bh=j((jF,Eb)=>{"use strict";var Mh=db(),TC=pb(),Ko=yb(),Xo=Sb();Eb.exports={err:Mh,errWithCause:TC,mapHttpRequest:Ko.mapHttpRequest,mapHttpResponse:Xo.mapHttpResponse,req:Ko.reqSerializer,res:Xo.resSerializer,wrapErrorSerializer:function(e){return e===Mh?e:function(n){return e(Mh(n))}},wrapRequestSerializer:function(e){return e===Ko.reqSerializer?e:function(n){return e(Ko.reqSerializer(n))}},wrapResponseSerializer:function(e){return e===Xo.resSerializer?e:function(n){return e(Xo.resSerializer(n))}}}});var Dh=j((HF,Ab)=>{"use strict";function _C(r,e){return e}Ab.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=_C;let t=new Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(t))return;let n=t.slice(2),i=[];for(let s of n)s&&i.push(s.getFileName());return i}});var _b=j((WF,Tb)=>{"use strict";Tb.exports=CC;function CC(r={}){let{ERR_PATHS_MUST_BE_STRINGS:e=()=>"fast-redact - Paths must be (non-empty) strings",ERR_INVALID_PATH:t=n=>`fast-redact \u2013 Invalid path (${n})`}=r;return function({paths:i}){i.forEach(s=>{if(typeof s!="string")throw Error(e());try{if(/〇/.test(s))throw Error();let a=(s[0]==="["?"":".")+s.replace(/^\*/,"\u3007").replace(/\.\*/g,".\u3007").replace(/\[\*\]/g,"[\u3007]");if(/\n|\r|;/.test(a)||/\/\*/.test(a))throw Error();Function(`
8
+ 'use strict'
9
+ const o = new Proxy({}, { get: () => o, set: () => { throw Error() } });
10
+ const \u3007 = null;
11
+ o${a}
12
+ if ([o${a}].length !== 1) throw Error()`)()}catch{throw Error(t(s))}})}}});var Yo=j((VF,Cb)=>{"use strict";Cb.exports=/[^.[\]]+|\[((?:.)*?)\]/g});var Ib=j((GF,kb)=>{"use strict";var kC=Yo();kb.exports=IC;function IC({paths:r}){let e=[];var t=0;let n=r.reduce(function(i,s,a){var o=s.match(kC).map(c=>c.replace(/'|"|`/g,""));let u=s[0]==="[";o=o.map(c=>c[0]==="["?c.substr(1,c.length-2):c);let l=o.indexOf("*");if(l>-1){let c=o.slice(0,l),h=c.join("."),d=o.slice(l+1,o.length),f=d.length>0;t++,e.push({before:c,beforeStr:h,after:d,nested:f})}else i[s]={path:o,val:void 0,precensored:!1,circle:"",escPath:JSON.stringify(s),leadingBracket:u};return i},{});return{wildcards:e,wcLen:t,secret:n}}});var Pb=j((qF,Rb)=>{"use strict";var RC=Yo();Rb.exports=PC;function PC({secret:r,serialize:e,wcLen:t,strict:n,isCensorFct:i,censorFctTakesPath:s},a){let o=Function("o",`
13
+ if (typeof o !== 'object' || o == null) {
14
+ ${MC(n,e)}
15
+ }
16
+ const { censor, secret } = this
17
+ const originalSecret = {}
18
+ const secretKeys = Object.keys(secret)
19
+ for (var i = 0; i < secretKeys.length; i++) {
20
+ originalSecret[secretKeys[i]] = secret[secretKeys[i]]
21
+ }
22
+
23
+ ${OC(r,i,s)}
24
+ this.compileRestore()
25
+ ${LC(t>0,i,s)}
26
+ this.secret = originalSecret
27
+ ${NC(e)}
28
+ `).bind(a);return o.state=a,e===!1&&(o.restore=u=>a.restore(u)),o}function OC(r,e,t){return Object.keys(r).map(n=>{let{escPath:i,leadingBracket:s,path:a}=r[n],o=s?1:0,u=s?"":".",l=[];for(var c;(c=RC.exec(n))!==null;){let[,p]=c,{index:g,input:b}=c;g>o&&l.push(b.substring(0,g-(p?0:1)))}var h=l.map(p=>`o${u}${p}`).join(" && ");h.length===0?h+=`o${u}${n} != null`:h+=` && o${u}${n} != null`;let d=`
29
+ switch (true) {
30
+ ${l.reverse().map(p=>`
31
+ case o${u}${p} === censor:
32
+ secret[${i}].circle = ${JSON.stringify(p)}
33
+ break
34
+ `).join(`
35
+ `)}
36
+ }
37
+ `,f=t?`val, ${JSON.stringify(a)}`:"val";return`
38
+ if (${h}) {
39
+ const val = o${u}${n}
40
+ if (val === censor) {
41
+ secret[${i}].precensored = true
42
+ } else {
43
+ secret[${i}].val = val
44
+ o${u}${n} = ${e?`censor(${f})`:"censor"}
45
+ ${d}
46
+ }
47
+ }
48
+ `}).join(`
49
+ `)}function LC(r,e,t){return r===!0?`
50
+ {
51
+ const { wildcards, wcLen, groupRedact, nestedRedact } = this
52
+ for (var i = 0; i < wcLen; i++) {
53
+ const { before, beforeStr, after, nested } = wildcards[i]
54
+ if (nested === true) {
55
+ secret[beforeStr] = secret[beforeStr] || []
56
+ nestedRedact(secret[beforeStr], o, before, after, censor, ${e}, ${t})
57
+ } else secret[beforeStr] = groupRedact(o, before, censor, ${e}, ${t})
58
+ }
59
+ }
60
+ `:""}function NC(r){return r===!1?"return o":`
61
+ var s = this.serialize(o)
62
+ this.restore(o)
63
+ return s
64
+ `}function MC(r,e){return r===!0?"throw Error('fast-redact: primitives cannot be redacted')":e===!1?"return o":"return this.serialize(o)"}});var $h=j((KF,Nb)=>{"use strict";Nb.exports={groupRedact:DC,groupRestore:BC,nestedRedact:$C,nestedRestore:FC};function BC({keys:r,values:e,target:t}){if(t==null||typeof t=="string")return;let n=r.length;for(var i=0;i<n;i++){let s=r[i];t[s]=e[i]}}function DC(r,e,t,n,i){let s=Ob(r,e);if(s==null||typeof s=="string")return{keys:null,values:null,target:s,flat:!0};let a=Object.keys(s),o=a.length,u=e.length,l=i?[...e]:void 0,c=new Array(o);for(var h=0;h<o;h++){let d=a[h];c[h]=s[d],i?(l[u]=d,s[d]=t(s[d],l)):n?s[d]=t(s[d]):s[d]=t}return{keys:a,values:c,target:s,flat:!0}}function FC(r){for(let e=0;e<r.length;e++){let{target:t,path:n,value:i}=r[e],s=t;for(let a=n.length-1;a>0;a--)s=s[n[a]];s[n[0]]=i}}function $C(r,e,t,n,i,s,a){let o=Ob(e,t);if(o==null)return;let u=Object.keys(o),l=u.length;for(var c=0;c<l;c++){let h=u[c];UC(r,o,h,t,n,i,s,a)}return r}function Fh(r,e){return r!=null?"hasOwn"in Object?Object.hasOwn(r,e):Object.prototype.hasOwnProperty.call(r,e):!1}function UC(r,e,t,n,i,s,a,o){let u=i.length,l=u-1,c=t;var h=-1,d,f,p,g=null,b=null,m,y,v=!1,x=0,w=0,S=zC();if(p=d=e[t],typeof d=="object"){for(;d!=null&&++h<u&&(w+=1,t=i[h],g=p,!(t!=="*"&&!b&&!(typeof d=="object"&&t in d)));)if(!(t==="*"&&(b==="*"&&(v=!0),b=t,h!==l))){if(b){let _=Object.keys(d);for(var E=0;E<_.length;E++){let T=_[E];if(y=d[T],m=t==="*",v)S=Ur(S,T,w),x=h,p=Lb(y,x-1,t,n,i,s,a,o,c,d,f,p,m,T,h,l,S,r,e[c],w+1);else if(m||typeof y=="object"&&y!==null&&t in y){if(m?p=y:p=y[t],f=h!==l?p:a?o?s(p,[...n,c,...i]):s(p):s,m){let k=Os(Ur(S,T,w),p,e[c]);r.push(k),d[T]=f}else if(y[t]!==f)if(f===void 0&&s!==void 0||Fh(y,t)&&f===p)S=Ur(S,T,w);else{S=Ur(S,T,w);let k=Os(Ur(S,t,w+1),p,e[c]);r.push(k),y[t]=f}}}b=null}else{if(p=d[t],S=Ur(S,t,w),f=h!==l?p:a?o?s(p,[...n,c,...i]):s(p):s,!(Fh(d,t)&&f===p||f===void 0&&s!==void 0)){let _=Os(S,p,e[c]);r.push(_),d[t]=f}d=d[t]}if(typeof d!="object")break}}}function Ob(r,e){for(var t=-1,n=e.length,i=r;i!=null&&++t<n;)i=i[e[t]];return i}function Lb(r,e,t,n,i,s,a,o,u,l,c,h,d,f,p,g,b,m,y,v){if(e===0&&(d||typeof r=="object"&&r!==null&&t in r)){if(d?h=r:h=r[t],c=p!==g?h:a?o?s(h,[...n,u,...i]):s(h):s,d){let x=Os(b,h,y);m.push(x),l[f]=c}else if(r[t]!==c){if(!(c===void 0&&s!==void 0||Fh(r,t)&&c===h)){let x=Os(Ur(b,t,v+1),h,y);m.push(x),r[t]=c}}}for(let x in r)typeof r[x]=="object"&&(b=Ur(b,x,v),Lb(r[x],e-1,t,n,i,s,a,o,u,l,c,h,d,f,p,g,b,m,y,v+1))}function zC(){return{parent:null,key:null,children:[],depth:0}}function Ur(r,e,t){if(r.depth===t)return Ur(r.parent,e,t);var n={parent:r,key:e,depth:t,children:[]};return r.children.push(n),n}function Os(r,e,t){let n=r,i=[];do i.push(n.key),n=n.parent;while(n.parent!=null);return{path:i,value:e,target:t}}});var Bb=j((XF,Mb)=>{"use strict";var{groupRestore:jC,nestedRestore:HC}=$h();Mb.exports=WC;function WC(){return function(){if(this.restore){this.restore.state.secret=this.secret;return}let{secret:e,wcLen:t}=this,n=Object.keys(e),i=VC(e,n),s=t>0,a=s?{secret:e,groupRestore:jC,nestedRestore:HC}:{secret:e};this.restore=Function("o",GC(i,n,s)).bind(a),this.restore.state=a}}function VC(r,e){return e.map(t=>{let{circle:n,escPath:i,leadingBracket:s}=r[t],o=n?`o.${n} = secret[${i}].val`:`o${s?"":"."}${t} = secret[${i}].val`,u=`secret[${i}].val = undefined`;return`
65
+ if (secret[${i}].val !== undefined) {
66
+ try { ${o} } catch (e) {}
67
+ ${u}
68
+ }
69
+ `}).join("")}function GC(r,e,t){return`
70
+ const secret = this.secret
71
+ ${t===!0?`
72
+ const keys = Object.keys(secret)
73
+ const len = keys.length
74
+ for (var i = len - 1; i >= ${e.length}; i--) {
75
+ const k = keys[i]
76
+ const o = secret[k]
77
+ if (o) {
78
+ if (o.flat === true) this.groupRestore(o)
79
+ else this.nestedRestore(o)
80
+ secret[k] = null
81
+ }
82
+ }
83
+ `:""}
84
+ ${r}
85
+ return o
86
+ `}});var Fb=j((YF,Db)=>{"use strict";Db.exports=qC;function qC(r){let{secret:e,censor:t,compileRestore:n,serialize:i,groupRedact:s,nestedRedact:a,wildcards:o,wcLen:u}=r,l=[{secret:e,censor:t,compileRestore:n}];return i!==!1&&l.push({serialize:i}),u>0&&l.push({groupRedact:s,nestedRedact:a,wildcards:o,wcLen:u}),Object.assign(...l)}});var zb=j((QF,Ub)=>{"use strict";var $b=_b(),KC=Ib(),XC=Pb(),YC=Bb(),{groupRedact:QC,nestedRedact:ZC}=$h(),JC=Fb(),e3=Yo(),t3=$b(),Uh=r=>r;Uh.restore=Uh;var r3="[REDACTED]";zh.rx=e3;zh.validator=$b;Ub.exports=zh;function zh(r={}){let e=Array.from(new Set(r.paths||[])),t="serialize"in r&&(r.serialize===!1||typeof r.serialize=="function")?r.serialize:JSON.stringify,n=r.remove;if(n===!0&&t!==JSON.stringify)throw Error("fast-redact \u2013 remove option may only be set when serializer is JSON.stringify");let i=n===!0?void 0:"censor"in r?r.censor:r3,s=typeof i=="function",a=s&&i.length>1;if(e.length===0)return t||Uh;t3({paths:e,serialize:t,censor:i});let{wildcards:o,wcLen:u,secret:l}=KC({paths:e,censor:i}),c=YC(),h="strict"in r?r.strict:!0;return XC({secret:l,wcLen:u,serialize:t,strict:h,isCensorFct:s,censorFctTakesPath:a},JC({secret:l,censor:i,compileRestore:c,serialize:t,groupRedact:QC,nestedRedact:ZC,wildcards:o,wcLen:u}))}});var mi=j((ZF,jb)=>{"use strict";var n3=Symbol("pino.setLevel"),i3=Symbol("pino.getLevel"),s3=Symbol("pino.levelVal"),a3=Symbol("pino.levelComp"),o3=Symbol("pino.useLevelLabels"),u3=Symbol("pino.useOnlyCustomLevels"),l3=Symbol("pino.mixin"),c3=Symbol("pino.lsCache"),h3=Symbol("pino.chindings"),d3=Symbol("pino.asJson"),f3=Symbol("pino.write"),p3=Symbol("pino.redactFmt"),g3=Symbol("pino.time"),m3=Symbol("pino.timeSliceIndex"),b3=Symbol("pino.stream"),y3=Symbol("pino.stringify"),v3=Symbol("pino.stringifySafe"),w3=Symbol("pino.stringifiers"),x3=Symbol("pino.end"),S3=Symbol("pino.formatOpts"),E3=Symbol("pino.messageKey"),A3=Symbol("pino.errorKey"),T3=Symbol("pino.nestedKey"),_3=Symbol("pino.nestedKeyStr"),C3=Symbol("pino.mixinMergeStrategy"),k3=Symbol("pino.msgPrefix"),I3=Symbol("pino.wildcardFirst"),R3=Symbol.for("pino.serializers"),P3=Symbol.for("pino.formatters"),O3=Symbol.for("pino.hooks"),L3=Symbol.for("pino.metadata");jb.exports={setLevelSym:n3,getLevelSym:i3,levelValSym:s3,levelCompSym:a3,useLevelLabelsSym:o3,mixinSym:l3,lsCacheSym:c3,chindingsSym:h3,asJsonSym:d3,writeSym:f3,serializersSym:R3,redactFmtSym:p3,timeSym:g3,timeSliceIndexSym:m3,streamSym:b3,stringifySym:y3,stringifySafeSym:v3,stringifiersSym:w3,endSym:x3,formatOptsSym:S3,messageKeySym:E3,errorKeySym:A3,nestedKeySym:T3,wildcardFirstSym:I3,needsMetadataGsym:L3,useOnlyCustomLevelsSym:u3,formattersSym:P3,hooksSym:O3,nestedKeyStrSym:_3,mixinMergeStrategySym:C3,msgPrefixSym:k3}});var Wh=j((JF,Gb)=>{"use strict";var Hh=zb(),{redactFmtSym:N3,wildcardFirstSym:Qo}=mi(),{rx:jh,validator:M3}=Hh,Hb=M3({ERR_PATHS_MUST_BE_STRINGS:()=>"pino \u2013 redacted paths must be strings",ERR_INVALID_PATH:r=>`pino \u2013 redact paths array contains an invalid path (${r})`}),Wb="[Redacted]",Vb=!1;function B3(r,e){let{paths:t,censor:n}=D3(r),i=t.reduce((o,u)=>{jh.lastIndex=0;let l=jh.exec(u),c=jh.exec(u),h=l[1]!==void 0?l[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):l[0];if(h==="*"&&(h=Qo),c===null)return o[h]=null,o;if(o[h]===null)return o;let{index:d}=c,f=`${u.substr(d,u.length-1)}`;return o[h]=o[h]||[],h!==Qo&&o[h].length===0&&o[h].push(...o[Qo]||[]),h===Qo&&Object.keys(o).forEach(function(p){o[p]&&o[p].push(f)}),o[h].push(f),o},{}),s={[N3]:Hh({paths:t,censor:n,serialize:e,strict:Vb})},a=(...o)=>e(typeof n=="function"?n(...o):n);return[...Object.keys(i),...Object.getOwnPropertySymbols(i)].reduce((o,u)=>{if(i[u]===null)o[u]=l=>a(l,[u]);else{let l=typeof n=="function"?(c,h)=>n(c,[u,...h]):n;o[u]=Hh({paths:i[u],censor:l,serialize:e,strict:Vb})}return o},s)}function D3(r){if(Array.isArray(r))return r={paths:r,censor:Wb},Hb(r),r;let{paths:e,censor:t=Wb,remove:n}=r;if(Array.isArray(e)===!1)throw Error("pino \u2013 redact must contain an array of strings");return n===!0&&(t=void 0),Hb({paths:e,censor:t}),{paths:e,censor:t}}Gb.exports=B3});var Kb=j((e9,qb)=>{"use strict";var F3=()=>"",$3=()=>`,"time":${Date.now()}`,U3=()=>`,"time":${Math.round(Date.now()/1e3)}`,z3=()=>`,"time":"${new Date(Date.now()).toISOString()}"`;qb.exports={nullTime:F3,epochTime:$3,unixTime:U3,isoTime:z3}});var Yb=j((t9,Xb)=>{"use strict";function j3(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}Xb.exports=H3;function H3(r,e,t){var n=t&&t.stringify||j3,i=1;if(typeof r=="object"&&r!==null){var s=e.length+i;if(s===1)return r;var a=new Array(s);a[0]=n(r);for(var o=1;o<s;o++)a[o]=n(e[o]);return a.join(" ")}if(typeof r!="string")return r;var u=e.length;if(u===0)return r;for(var l="",c=1-i,h=-1,d=r&&r.length||0,f=0;f<d;){if(r.charCodeAt(f)===37&&f+1<d){switch(h=h>-1?h:0,r.charCodeAt(f+1)){case 100:case 102:if(c>=u||e[c]==null)break;h<f&&(l+=r.slice(h,f)),l+=Number(e[c]),h=f+2,f++;break;case 105:if(c>=u||e[c]==null)break;h<f&&(l+=r.slice(h,f)),l+=Math.floor(Number(e[c])),h=f+2,f++;break;case 79:case 111:case 106:if(c>=u||e[c]===void 0)break;h<f&&(l+=r.slice(h,f));var p=typeof e[c];if(p==="string"){l+="'"+e[c]+"'",h=f+2,f++;break}if(p==="function"){l+=e[c].name||"<anonymous>",h=f+2,f++;break}l+=n(e[c]),h=f+2,f++;break;case 115:if(c>=u)break;h<f&&(l+=r.slice(h,f)),l+=String(e[c]),h=f+2,f++;break;case 37:h<f&&(l+=r.slice(h,f)),l+="%",h=f+2,f++,c--;break}++c}++f}return h===-1?r:(h<d&&(l+=r.slice(h)),l)}});var Gh=j((r9,Vh)=>{"use strict";if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let e=function(t){if((t>0&&t<1/0)===!1)throw typeof t!="number"&&typeof t!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");Atomics.wait(r,0,0,Number(t))},r=new Int32Array(new SharedArrayBuffer(4));Vh.exports=e}else{let r=function(e){if((e>0&&e<1/0)===!1)throw typeof e!="number"&&typeof e!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");let n=Date.now()+Number(e);for(;n>Date.now(););};Vh.exports=r}});var iy=j((n9,ny)=>{"use strict";var Ye=Ue("fs"),W3=Ue("events"),V3=Ue("util").inherits,Qb=Ue("path"),Kh=Gh(),Zo=100,Jo=Buffer.allocUnsafe(0),G3=16*1024,Zb="buffer",Jb="utf8";function ey(r,e){e._opening=!0,e._writing=!0,e._asyncDrainScheduled=!1;function t(s,a){if(s){e._reopening=!1,e._writing=!1,e._opening=!1,e.sync?process.nextTick(()=>{e.listenerCount("error")>0&&e.emit("error",s)}):e.emit("error",s);return}let o=e._reopening;e.fd=a,e.file=r,e._reopening=!1,e._opening=!1,e._writing=!1,e.sync?process.nextTick(()=>e.emit("ready")):e.emit("ready"),!e.destroyed&&(!e._writing&&e._len>e.minLength||e._flushPending?e._actualWrite():o&&process.nextTick(()=>e.emit("drain")))}let n=e.append?"a":"w",i=e.mode;if(e.sync)try{e.mkdir&&Ye.mkdirSync(Qb.dirname(r),{recursive:!0});let s=Ye.openSync(r,n,i);t(null,s)}catch(s){throw t(s),s}else e.mkdir?Ye.mkdir(Qb.dirname(r),{recursive:!0},s=>{if(s)return t(s);Ye.open(r,n,i,t)}):Ye.open(r,n,i,t)}function dr(r){if(!(this instanceof dr))return new dr(r);let{fd:e,dest:t,minLength:n,maxLength:i,maxWrite:s,sync:a,append:o=!0,mkdir:u,retryEAGAIN:l,fsync:c,contentMode:h,mode:d}=r||{};e=e||t,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(n||0,16387),this.file=null,this.destroyed=!1,this.minLength=n||0,this.maxLength=i||0,this.maxWrite=s||G3,this.sync=a||!1,this.writable=!0,this._fsync=c||!1,this.append=o||!1,this.mode=d,this.retryEAGAIN=l||(()=>!0),this.mkdir=u||!1;let f,p;if(h===Zb)this._writingBuf=Jo,this.write=X3,this.flush=Q3,this.flushSync=J3,this._actualWrite=tk,f=()=>Ye.writeSync(this.fd,this._writingBuf),p=()=>Ye.write(this.fd,this._writingBuf,this.release);else if(h===void 0||h===Jb)this._writingBuf="",this.write=K3,this.flush=Y3,this.flushSync=Z3,this._actualWrite=ek,f=()=>Ye.writeSync(this.fd,this._writingBuf,"utf8"),p=()=>Ye.write(this.fd,this._writingBuf,"utf8",this.release);else throw new Error(`SonicBoom supports "${Jb}" and "${Zb}", but passed ${h}`);if(typeof e=="number")this.fd=e,process.nextTick(()=>this.emit("ready"));else if(typeof e=="string")ey(e,this);else throw new Error("SonicBoom supports only file descriptors and files");if(this.minLength>=this.maxWrite)throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(g,b)=>{if(g){if((g.code==="EAGAIN"||g.code==="EBUSY")&&this.retryEAGAIN(g,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{Kh(Zo),this.release(void 0,0)}catch(v){this.release(v)}else setTimeout(p,Zo);else this._writing=!1,this.emit("error",g);return}this.emit("write",b);let m=qh(this._writingBuf,this._len,b);if(this._len=m.len,this._writingBuf=m.writingBuf,this._writingBuf.length){if(!this.sync){p();return}try{do{let v=f(),x=qh(this._writingBuf,this._len,v);this._len=x.len,this._writingBuf=x.writingBuf}while(this._writingBuf.length)}catch(v){this.release(v);return}}this._fsync&&Ye.fsyncSync(this.fd);let y=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):y>this.minLength?this._actualWrite():this._ending?y>0?this._actualWrite():(this._writing=!1,eu(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(q3,this)):this.emit("drain"))},this.on("newListener",function(g){g==="drain"&&(this._asyncDrainScheduled=!1)})}function qh(r,e,t){return typeof r=="string"&&Buffer.byteLength(r)!==t&&(t=Buffer.from(r).subarray(0,t).toString().length),e=Math.max(e-t,0),r=r.slice(t),{writingBuf:r,len:e}}function q3(r){r.listenerCount("drain")>0&&(r._asyncDrainScheduled=!1,r.emit("drain"))}V3(dr,W3);function ty(r,e){return r.length===0?Jo:r.length===1?r[0]:Buffer.concat(r,e)}function K3(r){if(this.destroyed)throw new Error("SonicBoom destroyed");let e=this._len+r.length,t=this._bufs;return this.maxLength&&e>this.maxLength?(this.emit("drop",r),this._len<this._hwm):(t.length===0||t[t.length-1].length+r.length>this.maxWrite?t.push(""+r):t[t.length-1]+=r,this._len=e,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function X3(r){if(this.destroyed)throw new Error("SonicBoom destroyed");let e=this._len+r.length,t=this._bufs,n=this._lens;return this.maxLength&&e>this.maxLength?(this.emit("drop",r),this._len<this._hwm):(t.length===0||n[n.length-1]+r.length>this.maxWrite?(t.push([r]),n.push(r.length)):(t[t.length-1].push(r),n[n.length-1]+=r.length),this._len=e,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function ry(r){this._flushPending=!0;let e=()=>{this._fsync?(this._flushPending=!1,r()):Ye.fsync(this.fd,n=>{this._flushPending=!1,r(n)}),this.off("error",t)},t=n=>{this._flushPending=!1,r(n),this.off("drain",e)};this.once("drain",e),this.once("error",t)}function Y3(r){if(r!=null&&typeof r!="function")throw new Error("flush cb must be a function");if(this.destroyed){let e=new Error("SonicBoom destroyed");if(r){r(e);return}throw e}if(this.minLength<=0){r?.();return}r&&ry.call(this,r),!this._writing&&(this._bufs.length===0&&this._bufs.push(""),this._actualWrite())}function Q3(r){if(r!=null&&typeof r!="function")throw new Error("flush cb must be a function");if(this.destroyed){let e=new Error("SonicBoom destroyed");if(r){r(e);return}throw e}if(this.minLength<=0){r?.();return}r&&ry.call(this,r),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}dr.prototype.reopen=function(r){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen(r)});return}if(this._ending)return;if(!this.file)throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if(r&&(this.file=r),this._reopening=!0,this._writing)return;let e=this.fd;this.once("ready",()=>{e!==this.fd&&Ye.close(e,t=>{if(t)return this.emit("error",t)})}),ey(this.file,this)};dr.prototype.end=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():eu(this)))};function Z3(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf="");let r="";for(;this._bufs.length||r;){r.length<=0&&(r=this._bufs[0]);try{let e=Ye.writeSync(this.fd,r,"utf8"),t=qh(r,this._len,e);r=t.writingBuf,this._len=t.len,r.length<=0&&this._bufs.shift()}catch(e){if((e.code==="EAGAIN"||e.code==="EBUSY")&&!this.retryEAGAIN(e,r.length,this._len-r.length))throw e;Kh(Zo)}}try{Ye.fsyncSync(this.fd)}catch{}}function J3(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=Jo);let r=Jo;for(;this._bufs.length||r.length;){r.length<=0&&(r=ty(this._bufs[0],this._lens[0]));try{let e=Ye.writeSync(this.fd,r);r=r.subarray(e),this._len=Math.max(this._len-e,0),r.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(e){if((e.code==="EAGAIN"||e.code==="EBUSY")&&!this.retryEAGAIN(e,r.length,this._len-r.length))throw e;Kh(Zo)}}}dr.prototype.destroy=function(){this.destroyed||eu(this)};function ek(){let r=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf||this._bufs.shift()||"",this.sync)try{let e=Ye.writeSync(this.fd,this._writingBuf,"utf8");r(null,e)}catch(e){r(e)}else Ye.write(this.fd,this._writingBuf,"utf8",r)}function tk(){let r=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:ty(this._bufs.shift(),this._lens.shift()),this.sync)try{let e=Ye.writeSync(this.fd,this._writingBuf);r(null,e)}catch(e){r(e)}else Ye.write(this.fd,this._writingBuf,r)}function eu(r){if(r.fd===-1){r.once("ready",eu.bind(null,r));return}r.destroyed=!0,r._bufs=[],r._lens=[],Ye.fsync(r.fd,e);function e(){r.fd!==1&&r.fd!==2?Ye.close(r.fd,t):t()}function t(n){if(n){r.emit("error",n);return}r._ending&&!r._writing&&r.emit("finish"),r.emit("close")}}dr.SonicBoom=dr;dr.default=dr;ny.exports=dr});var Xh=j((i9,ly)=>{"use strict";var fr={exit:[],beforeExit:[]},sy={exit:ik,beforeExit:sk},bi;function rk(){bi===void 0&&(bi=new FinalizationRegistry(ak))}function nk(r){fr[r].length>0||process.on(r,sy[r])}function ay(r){fr[r].length>0||(process.removeListener(r,sy[r]),fr.exit.length===0&&fr.beforeExit.length===0&&(bi=void 0))}function ik(){oy("exit")}function sk(){oy("beforeExit")}function oy(r){for(let e of fr[r]){let t=e.deref(),n=e.fn;t!==void 0&&n(t,r)}fr[r]=[]}function ak(r){for(let e of["exit","beforeExit"]){let t=fr[e].indexOf(r);fr[e].splice(t,t+1),ay(e)}}function uy(r,e,t){if(e===void 0)throw new Error("the object can't be undefined");nk(r);let n=new WeakRef(e);n.fn=t,rk(),bi.register(e,n),fr[r].push(n)}function ok(r,e){uy("exit",r,e)}function uk(r,e){uy("beforeExit",r,e)}function lk(r){if(bi!==void 0){bi.unregister(r);for(let e of["exit","beforeExit"])fr[e]=fr[e].filter(t=>{let n=t.deref();return n&&n!==r}),ay(e)}}ly.exports={register:ok,registerBeforeExit:uk,unregister:lk}});var cy=j((s9,ck)=>{ck.exports={name:"thread-stream",version:"2.7.0",description:"A streaming way to send data to a Node.js Worker Thread",main:"index.js",types:"index.d.ts",dependencies:{"real-require":"^0.2.0"},devDependencies:{"@types/node":"^20.1.0","@types/tap":"^15.0.0","@yao-pkg/pkg":"^5.11.5",desm:"^1.3.0",fastbench:"^1.0.1",husky:"^9.0.6","pino-elasticsearch":"^8.0.0","sonic-boom":"^3.0.0",standard:"^17.0.0",tap:"^16.2.0","ts-node":"^10.8.0",typescript:"^5.3.2","why-is-node-running":"^2.2.2"},scripts:{test:'standard && npm run transpile && tap "test/**/*.test.*js" && tap --ts test/*.test.*ts',"test:ci":"standard && npm run transpile && npm run test:ci:js && npm run test:ci:ts","test:ci:js":'tap --no-check-coverage --timeout=120 --coverage-report=lcovonly "test/**/*.test.*js"',"test:ci:ts":'tap --ts --no-check-coverage --coverage-report=lcovonly "test/**/*.test.*ts"',"test:yarn":'npm run transpile && tap "test/**/*.test.js" --no-check-coverage',transpile:"sh ./test/ts/transpile.sh",prepare:"husky install"},standard:{ignore:["test/ts/**/*"]},repository:{type:"git",url:"git+https://github.com/mcollina/thread-stream.git"},keywords:["worker","thread","threads","stream"],author:"Matteo Collina <hello@matteocollina.com>",license:"MIT",bugs:{url:"https://github.com/mcollina/thread-stream/issues"},homepage:"https://github.com/mcollina/thread-stream#readme"}});var dy=j((a9,hy)=>{"use strict";function hk(r,e,t,n,i){let s=Date.now()+n,a=Atomics.load(r,e);if(a===t){i(null,"ok");return}let o=a,u=l=>{Date.now()>s?i(null,"timed-out"):setTimeout(()=>{o=a,a=Atomics.load(r,e),a===o?u(l>=1e3?1e3:l*2):a===t?i(null,"ok"):i(null,"not-equal")},l)};u(1)}function dk(r,e,t,n,i){let s=Date.now()+n,a=Atomics.load(r,e);if(a!==t){i(null,"ok");return}let o=u=>{Date.now()>s?i(null,"timed-out"):setTimeout(()=>{a=Atomics.load(r,e),a!==t?i(null,"ok"):o(u>=1e3?1e3:u*2)},u)};o(1)}hy.exports={wait:hk,waitDiff:dk}});var py=j((o9,fy)=>{"use strict";fy.exports={WRITE_INDEX:4,READ_INDEX:8}});var vy=j((u9,yy)=>{"use strict";var{version:fk}=cy(),{EventEmitter:pk}=Ue("events"),{Worker:gk}=Ue("worker_threads"),{join:mk}=Ue("path"),{pathToFileURL:bk}=Ue("url"),{wait:yk}=dy(),{WRITE_INDEX:Nt,READ_INDEX:Er}=py(),vk=Ue("buffer"),wk=Ue("assert"),U=Symbol("kImpl"),xk=vk.constants.MAX_STRING_LENGTH,Ls=class{constructor(e){this._value=e}deref(){return this._value}},ru=class{register(){}unregister(){}},Sk=process.env.NODE_V8_COVERAGE?ru:global.FinalizationRegistry||ru,Ek=process.env.NODE_V8_COVERAGE?Ls:global.WeakRef||Ls,gy=new Sk(r=>{r.exited||r.terminate()});function Ak(r,e){let{filename:t,workerData:n}=e,s=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||mk(__dirname,"lib","worker.js"),a=new gk(s,{...e.workerOpts,trackUnmanagedFds:!1,workerData:{filename:t.indexOf("file://")===0?t:bk(t).href,dataBuf:r[U].dataBuf,stateBuf:r[U].stateBuf,workerData:{$context:{threadStreamVersion:fk},...n}}});return a.stream=new Ls(r),a.on("message",Tk),a.on("exit",by),gy.register(r,a),a}function my(r){wk(!r[U].sync),r[U].needDrain&&(r[U].needDrain=!1,r.emit("drain"))}function tu(r){let e=Atomics.load(r[U].state,Nt),t=r[U].data.length-e;if(t>0){if(r[U].buf.length===0){r[U].flushing=!1,r[U].ending?ed(r):r[U].needDrain&&process.nextTick(my,r);return}let n=r[U].buf.slice(0,t),i=Buffer.byteLength(n);i<=t?(r[U].buf=r[U].buf.slice(t),nu(r,n,tu.bind(null,r))):r.flush(()=>{if(!r.destroyed){for(Atomics.store(r[U].state,Er,0),Atomics.store(r[U].state,Nt,0);i>r[U].data.length;)t=t/2,n=r[U].buf.slice(0,t),i=Buffer.byteLength(n);r[U].buf=r[U].buf.slice(t),nu(r,n,tu.bind(null,r))}})}else if(t===0){if(e===0&&r[U].buf.length===0)return;r.flush(()=>{Atomics.store(r[U].state,Er,0),Atomics.store(r[U].state,Nt,0),tu(r)})}else Ar(r,new Error("overwritten"))}function Tk(r){let e=this.stream.deref();if(e===void 0){this.exited=!0,this.terminate();return}switch(r.code){case"READY":this.stream=new Ek(e),e.flush(()=>{e[U].ready=!0,e.emit("ready")});break;case"ERROR":Ar(e,r.err);break;case"EVENT":Array.isArray(r.args)?e.emit(r.name,...r.args):e.emit(r.name,r.args);break;case"WARNING":process.emitWarning(r.err);break;default:Ar(e,new Error("this should not happen: "+r.code))}}function by(r){let e=this.stream.deref();e!==void 0&&(gy.unregister(e),e.worker.exited=!0,e.worker.off("exit",by),Ar(e,r!==0?new Error("the worker thread exited"):null))}var Qh=class extends pk{constructor(e={}){if(super(),e.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[U]={},this[U].stateBuf=new SharedArrayBuffer(128),this[U].state=new Int32Array(this[U].stateBuf),this[U].dataBuf=new SharedArrayBuffer(e.bufferSize||4*1024*1024),this[U].data=Buffer.from(this[U].dataBuf),this[U].sync=e.sync||!1,this[U].ending=!1,this[U].ended=!1,this[U].needDrain=!1,this[U].destroyed=!1,this[U].flushing=!1,this[U].ready=!1,this[U].finished=!1,this[U].errored=null,this[U].closed=!1,this[U].buf="",this.worker=Ak(this,e),this.on("message",(t,n)=>{this.worker.postMessage(t,n)})}write(e){if(this[U].destroyed)return Zh(this,new Error("the worker has exited")),!1;if(this[U].ending)return Zh(this,new Error("the worker is ending")),!1;if(this[U].flushing&&this[U].buf.length+e.length>=xk)try{Yh(this),this[U].flushing=!0}catch(t){return Ar(this,t),!1}if(this[U].buf+=e,this[U].sync)try{return Yh(this),!0}catch(t){return Ar(this,t),!1}return this[U].flushing||(this[U].flushing=!0,setImmediate(tu,this)),this[U].needDrain=this[U].data.length-this[U].buf.length-Atomics.load(this[U].state,Nt)<=0,!this[U].needDrain}end(){this[U].destroyed||(this[U].ending=!0,ed(this))}flush(e){if(this[U].destroyed){typeof e=="function"&&process.nextTick(e,new Error("the worker has exited"));return}let t=Atomics.load(this[U].state,Nt);yk(this[U].state,Er,t,1/0,(n,i)=>{if(n){Ar(this,n),process.nextTick(e,n);return}if(i==="not-equal"){this.flush(e);return}process.nextTick(e)})}flushSync(){this[U].destroyed||(Yh(this),Jh(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[U].ready}get destroyed(){return this[U].destroyed}get closed(){return this[U].closed}get writable(){return!this[U].destroyed&&!this[U].ending}get writableEnded(){return this[U].ending}get writableFinished(){return this[U].finished}get writableNeedDrain(){return this[U].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[U].errored}};function Zh(r,e){setImmediate(()=>{r.emit("error",e)})}function Ar(r,e){r[U].destroyed||(r[U].destroyed=!0,e&&(r[U].errored=e,Zh(r,e)),r.worker.exited?setImmediate(()=>{r[U].closed=!0,r.emit("close")}):r.worker.terminate().catch(()=>{}).then(()=>{r[U].closed=!0,r.emit("close")}))}function nu(r,e,t){let n=Atomics.load(r[U].state,Nt),i=Buffer.byteLength(e);return r[U].data.write(e,n),Atomics.store(r[U].state,Nt,n+i),Atomics.notify(r[U].state,Nt),t(),!0}function ed(r){if(!(r[U].ended||!r[U].ending||r[U].flushing)){r[U].ended=!0;try{r.flushSync();let e=Atomics.load(r[U].state,Er);Atomics.store(r[U].state,Nt,-1),Atomics.notify(r[U].state,Nt);let t=0;for(;e!==-1;){if(Atomics.wait(r[U].state,Er,e,1e3),e=Atomics.load(r[U].state,Er),e===-2){Ar(r,new Error("end() failed"));return}if(++t===10){Ar(r,new Error("end() took too long (10s)"));return}}process.nextTick(()=>{r[U].finished=!0,r.emit("finish")})}catch(e){Ar(r,e)}}}function Yh(r){let e=()=>{r[U].ending?ed(r):r[U].needDrain&&process.nextTick(my,r)};for(r[U].flushing=!1;r[U].buf.length!==0;){let t=Atomics.load(r[U].state,Nt),n=r[U].data.length-t;if(n===0){Jh(r),Atomics.store(r[U].state,Er,0),Atomics.store(r[U].state,Nt,0);continue}else if(n<0)throw new Error("overwritten");let i=r[U].buf.slice(0,n),s=Buffer.byteLength(i);if(s<=n)r[U].buf=r[U].buf.slice(n),nu(r,i,e);else{for(Jh(r),Atomics.store(r[U].state,Er,0),Atomics.store(r[U].state,Nt,0);s>r[U].buf.length;)n=n/2,i=r[U].buf.slice(0,n),s=Buffer.byteLength(i);r[U].buf=r[U].buf.slice(n),nu(r,i,e)}}}function Jh(r){if(r[U].flushing)throw new Error("unable to flush while flushing");let e=Atomics.load(r[U].state,Nt),t=0;for(;;){let n=Atomics.load(r[U].state,Er);if(n===-2)throw Error("_flushSync failed");if(n!==e)Atomics.wait(r[U].state,Er,n,1e3);else break;if(++t===10)throw new Error("_flushSync took too long (10s)")}}yy.exports=Qh});var nd=j((l9,wy)=>{"use strict";var{createRequire:_k}=Ue("module"),Ck=Dh(),{join:td,isAbsolute:kk,sep:Ik}=Ue("path"),Rk=Gh(),rd=Xh(),Pk=vy();function Ok(r){rd.register(r,Nk),rd.registerBeforeExit(r,Mk),r.on("close",function(){rd.unregister(r)})}function Lk(r,e,t){let n=new Pk({filename:r,workerData:e,workerOpts:t});n.on("ready",i),n.on("close",function(){process.removeListener("exit",s)}),process.on("exit",s);function i(){process.removeListener("exit",s),n.unref(),t.autoEnd!==!1&&Ok(n)}function s(){n.closed||(n.flushSync(),Rk(100),n.end())}return n}function Nk(r){r.ref(),r.flushSync(),r.end(),r.once("close",function(){r.unref()})}function Mk(r){r.flushSync()}function Bk(r){let{pipeline:e,targets:t,levels:n,dedupe:i,options:s={},worker:a={},caller:o=Ck()}=r,u=typeof o=="string"?[o]:o,l="__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{},c=r.target;if(c&&t)throw new Error("only one of target or targets can be specified");return t?(c=l["pino-worker"]||td(__dirname,"worker.js"),s.targets=t.map(d=>({...d,target:h(d.target)}))):e&&(c=l["pino-pipeline-worker"]||td(__dirname,"worker-pipeline.js"),s.targets=e.map(d=>({...d,target:h(d.target)}))),n&&(s.levels=n),i&&(s.dedupe=i),s.pinoWillSendConfig=!0,Lk(h(c),s,a);function h(d){if(d=l[d]||d,kk(d)||d.indexOf("file://")===0)return d;if(d==="pino/file")return td(__dirname,"..","file.js");let f;for(let p of u)try{let g=p==="node:repl"?process.cwd()+Ik:p;f=_k(g).resolve(d);break}catch{continue}if(!f)throw new Error(`unable to determine transport target for "${d}"`);return f}}wy.exports=Bk});var au=j((c9,Py)=>{"use strict";var xy=Yb(),{mapHttpRequest:Dk,mapHttpResponse:Fk}=Bh(),sd=iy(),Sy=Xh(),{lsCacheSym:$k,chindingsSym:Ty,writeSym:Ey,serializersSym:_y,formatOptsSym:Ay,endSym:Uk,stringifiersSym:Cy,stringifySym:ky,stringifySafeSym:ad,wildcardFirstSym:Iy,nestedKeySym:zk,formattersSym:Ry,messageKeySym:jk,errorKeySym:Hk,nestedKeyStrSym:Wk,msgPrefixSym:iu}=mi(),{isMainThread:Vk}=Ue("worker_threads"),Gk=nd();function yi(){}function qk(r,e){if(!e)return t;return function(...i){e.call(this,i,t,r)};function t(n,...i){if(typeof n=="object"){let s=n;n!==null&&(n.method&&n.headers&&n.socket?n=Dk(n):typeof n.setHeader=="function"&&(n=Fk(n)));let a;s===null&&i.length===0?a=[null]:(s=i.shift(),a=i),typeof this[iu]=="string"&&s!==void 0&&s!==null&&(s=this[iu]+s),this[Ey](n,xy(s,a,this[Ay]),r)}else{let s=n===void 0?i.shift():n;typeof this[iu]=="string"&&s!==void 0&&s!==null&&(s=this[iu]+s),this[Ey](null,xy(s,i,this[Ay]),r)}}}function id(r){let e="",t=0,n=!1,i=255,s=r.length;if(s>100)return JSON.stringify(r);for(var a=0;a<s&&i>=32;a++)i=r.charCodeAt(a),(i===34||i===92)&&(e+=r.slice(t,a)+"\\",t=a,n=!0);return n?e+=r.slice(t):e=r,i<32?JSON.stringify(r):'"'+e+'"'}function Kk(r,e,t,n){let i=this[ky],s=this[ad],a=this[Cy],o=this[Uk],u=this[Ty],l=this[_y],c=this[Ry],h=this[jk],d=this[Hk],f=this[$k][t]+n;f=f+u;let p;c.log&&(r=c.log(r));let g=a[Iy],b="";for(let y in r)if(p=r[y],Object.prototype.hasOwnProperty.call(r,y)&&p!==void 0){l[y]?p=l[y](p):y===d&&l.err&&(p=l.err(p));let v=a[y]||g;switch(typeof p){case"undefined":case"function":continue;case"number":Number.isFinite(p)===!1&&(p=null);case"boolean":v&&(p=v(p));break;case"string":p=(v||id)(p);break;default:p=(v||i)(p,s)}if(p===void 0)continue;let x=id(y);b+=","+x+":"+p}let m="";if(e!==void 0){p=l[h]?l[h](e):e;let y=a[h]||g;switch(typeof p){case"function":break;case"number":Number.isFinite(p)===!1&&(p=null);case"boolean":y&&(p=y(p)),m=',"'+h+'":'+p;break;case"string":p=(y||id)(p),m=',"'+h+'":'+p;break;default:p=(y||i)(p,s),m=',"'+h+'":'+p}}return this[zk]&&b?f+this[Wk]+b.slice(1)+"}"+m+o:f+b+m+o}function Xk(r,e){let t,n=r[Ty],i=r[ky],s=r[ad],a=r[Cy],o=a[Iy],u=r[_y],l=r[Ry].bindings;e=l(e);for(let c in e)if(t=e[c],(c!=="level"&&c!=="serializers"&&c!=="formatters"&&c!=="customLevels"&&e.hasOwnProperty(c)&&t!==void 0)===!0){if(t=u[c]?u[c](t):t,t=(a[c]||o||i)(t,s),t===void 0)continue;n+=',"'+c+'":'+t}return n}function Yk(r){return r.write!==r.constructor.prototype.write}var Qk=process.env.NODE_V8_COVERAGE||process.env.V8_COVERAGE;function su(r){let e=new sd(r);return e.on("error",t),!Qk&&!r.sync&&Vk&&(Sy.register(e,Zk),e.on("close",function(){Sy.unregister(e)})),e;function t(n){if(n.code==="EPIPE"){e.write=yi,e.end=yi,e.flushSync=yi,e.destroy=yi;return}e.removeListener("error",t),e.emit("error",n)}}function Zk(r,e){r.destroyed||(e==="beforeExit"?(r.flush(),r.on("drain",function(){r.end()})):r.flushSync())}function Jk(r){return function(t,n,i={},s){if(typeof i=="string")s=su({dest:i}),i={};else if(typeof s=="string"){if(i&&i.transport)throw Error("only one of option.transport or stream can be specified");s=su({dest:s})}else if(i instanceof sd||i.writable||i._writableState)s=i,i={};else if(i.transport){if(i.transport instanceof sd||i.transport.writable||i.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(i.transport.targets&&i.transport.targets.length&&i.formatters&&typeof i.formatters.level=="function")throw Error("option.transport.targets do not allow custom level formatters");let u;i.customLevels&&(u=i.useOnlyCustomLevels?i.customLevels:Object.assign({},i.levels,i.customLevels)),s=Gk({caller:n,...i.transport,levels:u})}if(i=Object.assign({},r,i),i.serializers=Object.assign({},r.serializers,i.serializers),i.formatters=Object.assign({},r.formatters,i.formatters),i.prettyPrint)throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");let{enabled:a,onChild:o}=i;return a===!1&&(i.level="silent"),o||(i.onChild=yi),s||(Yk(process.stdout)?s=process.stdout:s=su({fd:process.stdout.fd||1})),{opts:i,stream:s}}}function eI(r,e){try{return JSON.stringify(r)}catch{try{return(e||this[ad])(r)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function tI(r,e,t){return{level:r,bindings:e,log:t}}function rI(r){let e=Number(r);return typeof r=="string"&&Number.isFinite(e)?e:r===void 0?1:r}Py.exports={noop:yi,buildSafeSonicBoom:su,asChindings:Xk,asJson:Kk,genLog:qk,createArgsNormalizer:Jk,stringify:eI,buildFormatters:tI,normalizeDestFileDescriptor:rI}});var ou=j((h9,Oy)=>{var nI={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},iI={ASC:"ASC",DESC:"DESC"};Oy.exports={DEFAULT_LEVELS:nI,SORTING_ORDER:iI}});var ld=j((d9,By)=>{"use strict";var{lsCacheSym:sI,levelValSym:od,useOnlyCustomLevelsSym:aI,streamSym:oI,formattersSym:uI,hooksSym:lI,levelCompSym:Ly}=mi(),{noop:cI,genLog:Pn}=au(),{DEFAULT_LEVELS:Tr,SORTING_ORDER:Ny}=ou(),My={fatal:r=>{let e=Pn(Tr.fatal,r);return function(...t){let n=this[oI];if(e.call(this,...t),typeof n.flushSync=="function")try{n.flushSync()}catch{}}},error:r=>Pn(Tr.error,r),warn:r=>Pn(Tr.warn,r),info:r=>Pn(Tr.info,r),debug:r=>Pn(Tr.debug,r),trace:r=>Pn(Tr.trace,r)},ud=Object.keys(Tr).reduce((r,e)=>(r[Tr[e]]=e,r),{}),hI=Object.keys(ud).reduce((r,e)=>(r[e]='{"level":'+Number(e),r),{});function dI(r){let e=r[uI].level,{labels:t}=r.levels,n={};for(let i in t){let s=e(t[i],Number(i));n[i]=JSON.stringify(s).slice(0,-1)}return r[sI]=n,r}function fI(r,e){if(e)return!1;switch(r){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}function pI(r){let{labels:e,values:t}=this.levels;if(typeof r=="number"){if(e[r]===void 0)throw Error("unknown level value"+r);r=e[r]}if(t[r]===void 0)throw Error("unknown level "+r);let n=this[od],i=this[od]=t[r],s=this[aI],a=this[Ly],o=this[lI].logMethod;for(let u in t){if(a(t[u],i)===!1){this[u]=cI;continue}this[u]=fI(u,s)?My[u](o):Pn(t[u],o)}this.emit("level-change",r,i,e[n],n,this)}function gI(r){let{levels:e,levelVal:t}=this;return e&&e.labels?e.labels[t]:""}function mI(r){let{values:e}=this.levels,t=e[r];return t!==void 0&&this[Ly](t,this[od])}function bI(r,e,t){return r===Ny.DESC?e<=t:e>=t}function yI(r){return typeof r=="string"?bI.bind(null,r):r}function vI(r=null,e=!1){let t=r?Object.keys(r).reduce((s,a)=>(s[r[a]]=a,s),{}):null,n=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),e?null:ud,t),i=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),e?null:Tr,r);return{labels:n,values:i}}function wI(r,e,t){if(typeof r=="number"){if(![].concat(Object.keys(e||{}).map(s=>e[s]),t?[]:Object.keys(ud).map(s=>+s),1/0).includes(r))throw Error(`default level:${r} must be included in custom levels`);return}let n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),t?null:Tr,e);if(!(r in n))throw Error(`default level:${r} must be included in custom levels`)}function xI(r,e){let{labels:t,values:n}=r;for(let i in e){if(i in n)throw Error("levels cannot be overridden");if(e[i]in t)throw Error("pre-existing level values cannot be used for new levels")}}function SI(r){if(typeof r!="function"&&!(typeof r=="string"&&Object.values(Ny).includes(r)))throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}By.exports={initialLsCache:hI,genLsCache:dI,levelMethods:My,getLevel:gI,setLevel:pI,isLevelEnabled:mI,mappings:vI,assertNoLevelCollisions:xI,assertDefaultLevelFound:wI,genLevelComparison:yI,assertLevelComparison:SI}});var cd=j((f9,Dy)=>{"use strict";Dy.exports={version:"8.21.0"}});var Ky=j((g9,qy)=>{"use strict";var{EventEmitter:EI}=Ue("events"),{lsCacheSym:AI,levelValSym:TI,setLevelSym:dd,getLevelSym:Fy,chindingsSym:fd,parsedChindingsSym:_I,mixinSym:CI,asJsonSym:Hy,writeSym:kI,mixinMergeStrategySym:II,timeSym:RI,timeSliceIndexSym:PI,streamSym:Wy,serializersSym:On,formattersSym:hd,errorKeySym:OI,messageKeySym:LI,useOnlyCustomLevelsSym:NI,needsMetadataGsym:MI,redactFmtSym:BI,stringifySym:DI,formatOptsSym:FI,stringifiersSym:$I,msgPrefixSym:$y}=mi(),{getLevel:UI,setLevel:zI,isLevelEnabled:jI,mappings:HI,initialLsCache:WI,genLsCache:VI,assertNoLevelCollisions:GI}=ld(),{asChindings:Vy,asJson:qI,buildFormatters:Uy,stringify:zy}=au(),{version:KI}=cd(),XI=Wh(),YI=class{},Gy={constructor:YI,child:QI,bindings:ZI,setBindings:JI,flush:n6,isLevelEnabled:jI,version:KI,get level(){return this[Fy]()},set level(r){this[dd](r)},get levelVal(){return this[TI]},set levelVal(r){throw Error("levelVal is read-only")},[AI]:WI,[kI]:t6,[Hy]:qI,[Fy]:UI,[dd]:zI};Object.setPrototypeOf(Gy,EI.prototype);qy.exports=function(){return Object.create(Gy)};var jy=r=>r;function QI(r,e){if(!r)throw Error("missing bindings for child Pino");e=e||{};let t=this[On],n=this[hd],i=Object.create(this);if(e.hasOwnProperty("serializers")===!0){i[On]=Object.create(null);for(let c in t)i[On][c]=t[c];let u=Object.getOwnPropertySymbols(t);for(var s=0;s<u.length;s++){let c=u[s];i[On][c]=t[c]}for(let c in e.serializers)i[On][c]=e.serializers[c];let l=Object.getOwnPropertySymbols(e.serializers);for(var a=0;a<l.length;a++){let c=l[a];i[On][c]=e.serializers[c]}}else i[On]=t;if(e.hasOwnProperty("formatters")){let{level:u,bindings:l,log:c}=e.formatters;i[hd]=Uy(u||n.level,l||jy,c||n.log)}else i[hd]=Uy(n.level,jy,n.log);if(e.hasOwnProperty("customLevels")===!0&&(GI(this.levels,e.customLevels),i.levels=HI(e.customLevels,i[NI]),VI(i)),typeof e.redact=="object"&&e.redact!==null||Array.isArray(e.redact)){i.redact=e.redact;let u=XI(i.redact,zy),l={stringify:u[BI]};i[DI]=zy,i[$I]=u,i[FI]=l}typeof e.msgPrefix=="string"&&(i[$y]=(this[$y]||"")+e.msgPrefix),i[fd]=Vy(i,r);let o=e.level||this.level;return i[dd](o),this.onChild(i),i}function ZI(){let e=`{${this[fd].substr(1)}}`,t=JSON.parse(e);return delete t.pid,delete t.hostname,t}function JI(r){let e=Vy(this,r);this[fd]=e,delete this[_I]}function e6(r,e){return Object.assign(e,r)}function t6(r,e,t){let n=this[RI](),i=this[CI],s=this[OI],a=this[LI],o=this[II]||e6,u;r==null?u={}:r instanceof Error?(u={[s]:r},e===void 0&&(e=r.message)):(u=r,e===void 0&&r[a]===void 0&&r[s]&&(e=r[s].message)),i&&(u=o(u,i(u,t,this)));let l=this[Hy](u,e,t,n),c=this[Wy];c[MI]===!0&&(c.lastLevel=t,c.lastObj=u,c.lastMsg=e,c.lastTime=n.slice(this[PI]),c.lastLogger=this),c.write(l)}function r6(){}function n6(r){if(r!=null&&typeof r!="function")throw Error("callback must be a function");let e=this[Wy];typeof e.flush=="function"?e.flush(r||r6):r&&r()}});var Zy=j((bd,Qy)=>{"use strict";var{hasOwnProperty:Ns}=Object.prototype,Nn=md();Nn.configure=md;Nn.stringify=Nn;Nn.default=Nn;bd.stringify=Nn;bd.configure=md;Qy.exports=Nn;var i6=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function ln(r){return r.length<5e3&&!i6.test(r)?`"${r}"`:JSON.stringify(r)}function pd(r,e){if(r.length>200||e)return r.sort(e);for(let t=1;t<r.length;t++){let n=r[t],i=t;for(;i!==0&&r[i-1]>n;)r[i]=r[i-1],i--;r[i]=n}return r}var s6=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function gd(r){return s6.call(r)!==void 0&&r.length!==0}function Xy(r,e,t){r.length<t&&(t=r.length);let n=e===","?"":" ",i=`"0":${n}${r[0]}`;for(let s=1;s<t;s++)i+=`${e}"${s}":${n}${r[s]}`;return i}function a6(r){if(Ns.call(r,"circularValue")){let e=r.circularValue;if(typeof e=="string")return`"${e}"`;if(e==null)return e;if(e===Error||e===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function o6(r){let e;if(Ns.call(r,"deterministic")&&(e=r.deterministic,typeof e!="boolean"&&typeof e!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return e===void 0?!0:e}function u6(r,e){let t;if(Ns.call(r,e)&&(t=r[e],typeof t!="boolean"))throw new TypeError(`The "${e}" argument must be of type boolean`);return t===void 0?!0:t}function Yy(r,e){let t;if(Ns.call(r,e)){if(t=r[e],typeof t!="number")throw new TypeError(`The "${e}" argument must be of type number`);if(!Number.isInteger(t))throw new TypeError(`The "${e}" argument must be an integer`);if(t<1)throw new RangeError(`The "${e}" argument must be >= 1`)}return t===void 0?1/0:t}function Ln(r){return r===1?"1 item":`${r} items`}function l6(r){let e=new Set;for(let t of r)(typeof t=="string"||typeof t=="number")&&e.add(String(t));return e}function c6(r){if(Ns.call(r,"strict")){let e=r.strict;if(typeof e!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(e)return t=>{let n=`Object can not safely be stringified. Received type ${typeof t}`;throw typeof t!="function"&&(n+=` (${t.toString()})`),new Error(n)}}}function md(r){r={...r};let e=c6(r);e&&(r.bigint===void 0&&(r.bigint=!1),"circularValue"in r||(r.circularValue=Error));let t=a6(r),n=u6(r,"bigint"),i=o6(r),s=typeof i=="function"?i:void 0,a=Yy(r,"maximumDepth"),o=Yy(r,"maximumBreadth");function u(f,p,g,b,m,y){let v=p[f];switch(typeof v=="object"&&v!==null&&typeof v.toJSON=="function"&&(v=v.toJSON(f)),v=b.call(p,f,v),typeof v){case"string":return ln(v);case"object":{if(v===null)return"null";if(g.indexOf(v)!==-1)return t;let x="",w=",",S=y;if(Array.isArray(v)){if(v.length===0)return"[]";if(a<g.length+1)return'"[Array]"';g.push(v),m!==""&&(y+=m,x+=`
87
+ ${y}`,w=`,
88
+ ${y}`);let B=Math.min(v.length,o),D=0;for(;D<B-1;D++){let M=u(String(D),v,g,b,m,y);x+=M!==void 0?M:"null",x+=w}let P=u(String(D),v,g,b,m,y);if(x+=P!==void 0?P:"null",v.length-1>o){let M=v.length-o-1;x+=`${w}"... ${Ln(M)} not stringified"`}return m!==""&&(x+=`
89
+ ${S}`),g.pop(),`[${x}]`}let E=Object.keys(v),_=E.length;if(_===0)return"{}";if(a<g.length+1)return'"[Object]"';let T="",k="";m!==""&&(y+=m,w=`,
90
+ ${y}`,T=" ");let A=Math.min(_,o);i&&!gd(v)&&(E=pd(E,s)),g.push(v);for(let B=0;B<A;B++){let D=E[B],P=u(D,v,g,b,m,y);P!==void 0&&(x+=`${k}${ln(D)}:${T}${P}`,k=w)}if(_>o){let B=_-o;x+=`${k}"...":${T}"${Ln(B)} not stringified"`,k=w}return m!==""&&k.length>1&&(x=`
91
+ ${y}${x}
92
+ ${S}`),g.pop(),`{${x}}`}case"number":return isFinite(v)?String(v):e?e(v):"null";case"boolean":return v===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(v);default:return e?e(v):void 0}}function l(f,p,g,b,m,y){switch(typeof p=="object"&&p!==null&&typeof p.toJSON=="function"&&(p=p.toJSON(f)),typeof p){case"string":return ln(p);case"object":{if(p===null)return"null";if(g.indexOf(p)!==-1)return t;let v=y,x="",w=",";if(Array.isArray(p)){if(p.length===0)return"[]";if(a<g.length+1)return'"[Array]"';g.push(p),m!==""&&(y+=m,x+=`
93
+ ${y}`,w=`,
94
+ ${y}`);let _=Math.min(p.length,o),T=0;for(;T<_-1;T++){let A=l(String(T),p[T],g,b,m,y);x+=A!==void 0?A:"null",x+=w}let k=l(String(T),p[T],g,b,m,y);if(x+=k!==void 0?k:"null",p.length-1>o){let A=p.length-o-1;x+=`${w}"... ${Ln(A)} not stringified"`}return m!==""&&(x+=`
95
+ ${v}`),g.pop(),`[${x}]`}g.push(p);let S="";m!==""&&(y+=m,w=`,
96
+ ${y}`,S=" ");let E="";for(let _ of b){let T=l(_,p[_],g,b,m,y);T!==void 0&&(x+=`${E}${ln(_)}:${S}${T}`,E=w)}return m!==""&&E.length>1&&(x=`
97
+ ${y}${x}
98
+ ${v}`),g.pop(),`{${x}}`}case"number":return isFinite(p)?String(p):e?e(p):"null";case"boolean":return p===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(p);default:return e?e(p):void 0}}function c(f,p,g,b,m){switch(typeof p){case"string":return ln(p);case"object":{if(p===null)return"null";if(typeof p.toJSON=="function"){if(p=p.toJSON(f),typeof p!="object")return c(f,p,g,b,m);if(p===null)return"null"}if(g.indexOf(p)!==-1)return t;let y=m;if(Array.isArray(p)){if(p.length===0)return"[]";if(a<g.length+1)return'"[Array]"';g.push(p),m+=b;let T=`
99
+ ${m}`,k=`,
100
+ ${m}`,A=Math.min(p.length,o),B=0;for(;B<A-1;B++){let P=c(String(B),p[B],g,b,m);T+=P!==void 0?P:"null",T+=k}let D=c(String(B),p[B],g,b,m);if(T+=D!==void 0?D:"null",p.length-1>o){let P=p.length-o-1;T+=`${k}"... ${Ln(P)} not stringified"`}return T+=`
101
+ ${y}`,g.pop(),`[${T}]`}let v=Object.keys(p),x=v.length;if(x===0)return"{}";if(a<g.length+1)return'"[Object]"';m+=b;let w=`,
102
+ ${m}`,S="",E="",_=Math.min(x,o);gd(p)&&(S+=Xy(p,w,o),v=v.slice(p.length),_-=p.length,E=w),i&&(v=pd(v,s)),g.push(p);for(let T=0;T<_;T++){let k=v[T],A=c(k,p[k],g,b,m);A!==void 0&&(S+=`${E}${ln(k)}: ${A}`,E=w)}if(x>o){let T=x-o;S+=`${E}"...": "${Ln(T)} not stringified"`,E=w}return E!==""&&(S=`
103
+ ${m}${S}
104
+ ${y}`),g.pop(),`{${S}}`}case"number":return isFinite(p)?String(p):e?e(p):"null";case"boolean":return p===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(p);default:return e?e(p):void 0}}function h(f,p,g){switch(typeof p){case"string":return ln(p);case"object":{if(p===null)return"null";if(typeof p.toJSON=="function"){if(p=p.toJSON(f),typeof p!="object")return h(f,p,g);if(p===null)return"null"}if(g.indexOf(p)!==-1)return t;let b="",m=p.length!==void 0;if(m&&Array.isArray(p)){if(p.length===0)return"[]";if(a<g.length+1)return'"[Array]"';g.push(p);let S=Math.min(p.length,o),E=0;for(;E<S-1;E++){let T=h(String(E),p[E],g);b+=T!==void 0?T:"null",b+=","}let _=h(String(E),p[E],g);if(b+=_!==void 0?_:"null",p.length-1>o){let T=p.length-o-1;b+=`,"... ${Ln(T)} not stringified"`}return g.pop(),`[${b}]`}let y=Object.keys(p),v=y.length;if(v===0)return"{}";if(a<g.length+1)return'"[Object]"';let x="",w=Math.min(v,o);m&&gd(p)&&(b+=Xy(p,",",o),y=y.slice(p.length),w-=p.length,x=","),i&&(y=pd(y,s)),g.push(p);for(let S=0;S<w;S++){let E=y[S],_=h(E,p[E],g);_!==void 0&&(b+=`${x}${ln(E)}:${_}`,x=",")}if(v>o){let S=v-o;b+=`${x}"...":"${Ln(S)} not stringified"`}return g.pop(),`{${b}}`}case"number":return isFinite(p)?String(p):e?e(p):"null";case"boolean":return p===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(p);default:return e?e(p):void 0}}function d(f,p,g){if(arguments.length>1){let b="";if(typeof g=="number"?b=" ".repeat(Math.min(g,10)):typeof g=="string"&&(b=g.slice(0,10)),p!=null){if(typeof p=="function")return u("",{"":f},[],p,b,"");if(Array.isArray(p))return l("",f,[],l6(p),b,"")}if(b.length!==0)return c("",f,[],b,"")}return h("",f,[])}return d}});var t1=j((m9,e1)=>{"use strict";var yd=Symbol.for("pino.metadata"),{DEFAULT_LEVELS:Jy}=ou(),h6=Jy.info;function d6(r,e){let t=0;r=r||[],e=e||{dedupe:!1};let n=Object.create(Jy);n.silent=1/0,e.levels&&typeof e.levels=="object"&&Object.keys(e.levels).forEach(h=>{n[h]=e.levels[h]});let i={write:s,add:u,emit:a,flushSync:o,end:l,minLevel:0,streams:[],clone:c,[yd]:!0,streamLevels:n};return Array.isArray(r)?r.forEach(u,i):u.call(i,r),r=null,i;function s(h){let d,f=this.lastLevel,{streams:p}=this,g=0,b;for(let m=p6(p.length,e.dedupe);m6(m,p.length,e.dedupe);m=g6(m,e.dedupe))if(d=p[m],d.level<=f){if(g!==0&&g!==d.level)break;if(b=d.stream,b[yd]){let{lastTime:y,lastMsg:v,lastObj:x,lastLogger:w}=this;b.lastLevel=f,b.lastTime=y,b.lastMsg=v,b.lastObj=x,b.lastLogger=w}b.write(h),e.dedupe&&(g=d.level)}else if(!e.dedupe)break}function a(...h){for(let{stream:d}of this.streams)typeof d.emit=="function"&&d.emit(...h)}function o(){for(let{stream:h}of this.streams)typeof h.flushSync=="function"&&h.flushSync()}function u(h){if(!h)return i;let d=typeof h.write=="function"||h.stream,f=h.write?h:h.stream;if(!d)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:p,streamLevels:g}=this,b;typeof h.levelVal=="number"?b=h.levelVal:typeof h.level=="string"?b=g[h.level]:typeof h.level=="number"?b=h.level:b=h6;let m={stream:f,level:b,levelVal:void 0,id:t++};return p.unshift(m),p.sort(f6),this.minLevel=p[0].level,i}function l(){for(let{stream:h}of this.streams)typeof h.flushSync=="function"&&h.flushSync(),h.end()}function c(h){let d=new Array(this.streams.length);for(let f=0;f<d.length;f++)d[f]={level:h,stream:this.streams[f].stream};return{write:s,add:u,minLevel:h,streams:d,clone:c,emit:a,flushSync:o,[yd]:!0}}}function f6(r,e){return r.level-e.level}function p6(r,e){return e?r-1:0}function g6(r,e){return e?r-1:r+1}function m6(r,e,t){return t?r>=0:r<e}e1.exports=d6});var p1=j((b9,Jt)=>{"use strict";var b6=Ue("os"),l1=Bh(),y6=Dh(),v6=Wh(),c1=Kb(),w6=Ky(),h1=mi(),{configure:x6}=Zy(),{assertDefaultLevelFound:S6,mappings:d1,genLsCache:E6,genLevelComparison:A6,assertLevelComparison:T6}=ld(),{DEFAULT_LEVELS:_6,SORTING_ORDER:C6}=ou(),{createArgsNormalizer:k6,asChindings:I6,buildSafeSonicBoom:r1,buildFormatters:R6,stringify:vd,normalizeDestFileDescriptor:n1,noop:P6}=au(),{version:O6}=cd(),{chindingsSym:i1,redactFmtSym:L6,serializersSym:s1,timeSym:N6,timeSliceIndexSym:M6,streamSym:B6,stringifySym:a1,stringifySafeSym:wd,stringifiersSym:o1,setLevelSym:D6,endSym:F6,formatOptsSym:$6,messageKeySym:U6,errorKeySym:z6,nestedKeySym:j6,mixinSym:H6,levelCompSym:W6,useOnlyCustomLevelsSym:V6,formattersSym:u1,hooksSym:G6,nestedKeyStrSym:q6,mixinMergeStrategySym:K6,msgPrefixSym:X6}=h1,{epochTime:f1,nullTime:Y6}=c1,{pid:Q6}=process,Z6=b6.hostname(),J6=l1.err,eR={level:"info",levelComparison:C6.ASC,levels:_6,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:Q6,hostname:Z6},serializers:Object.assign(Object.create(null),{err:J6}),formatters:Object.assign(Object.create(null),{bindings(r){return r},level(r,e){return{level:e}}}),hooks:{logMethod:void 0},timestamp:f1,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},tR=k6(eR),rR=Object.assign(Object.create(null),l1);function xd(...r){let e={},{opts:t,stream:n}=tR(e,y6(),...r),{redact:i,crlf:s,serializers:a,timestamp:o,messageKey:u,errorKey:l,nestedKey:c,base:h,name:d,level:f,customLevels:p,levelComparison:g,mixin:b,mixinMergeStrategy:m,useOnlyCustomLevels:y,formatters:v,hooks:x,depthLimit:w,edgeLimit:S,onChild:E,msgPrefix:_}=t,T=x6({maximumDepth:w,maximumBreadth:S}),k=R6(v.level,v.bindings,v.log),A=vd.bind({[wd]:T}),B=i?v6(i,A):{},D=i?{stringify:B[L6]}:{stringify:A},P="}"+(s?`\r
105
+ `:`
106
+ `),M=I6.bind(null,{[i1]:"",[s1]:a,[o1]:B,[a1]:vd,[wd]:T,[u1]:k}),L="";h!==null&&(d===void 0?L=M(h):L=M(Object.assign({},h,{name:d})));let N=o instanceof Function?o:o?f1:Y6,I=N().indexOf(":")+1;if(y&&!p)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(b&&typeof b!="function")throw Error(`Unknown mixin type "${typeof b}" - expected "function"`);if(_&&typeof _!="string")throw Error(`Unknown msgPrefix type "${typeof _}" - expected "string"`);S6(f,p,y);let H=d1(p,y);typeof n.emit=="function"&&n.emit("message",{code:"PINO_CONFIG",config:{levels:H,messageKey:u,errorKey:l}}),T6(g);let J=A6(g);return Object.assign(e,{levels:H,[W6]:J,[V6]:y,[B6]:n,[N6]:N,[M6]:I,[a1]:vd,[wd]:T,[o1]:B,[F6]:P,[$6]:D,[U6]:u,[z6]:l,[j6]:c,[q6]:c?`,${JSON.stringify(c)}:{`:"",[s1]:a,[H6]:b,[K6]:m,[i1]:L,[u1]:k,[G6]:x,silent:P6,onChild:E,[X6]:_}),Object.setPrototypeOf(e,w6()),E6(e),e[D6](f),e}Jt.exports=xd;Jt.exports.destination=(r=process.stdout.fd)=>typeof r=="object"?(r.dest=n1(r.dest||process.stdout.fd),r1(r)):r1({dest:n1(r),minLength:0});Jt.exports.transport=nd();Jt.exports.multistream=t1();Jt.exports.levels=d1();Jt.exports.stdSerializers=rR;Jt.exports.stdTimeFunctions=Object.assign({},c1);Jt.exports.symbols=h1;Jt.exports.version=O6;Jt.exports.default=xd;Jt.exports.pino=xd});var Ms=j((C9,Sd)=>{"use strict";typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?Sd.exports={nextTick:sR}:Sd.exports=process;function sR(r,e,t,n){if(typeof r!="function")throw new TypeError('"callback" argument must be a function');var i=arguments.length,s,a;switch(i){case 0:case 1:return process.nextTick(r);case 2:return process.nextTick(function(){r.call(null,e)});case 3:return process.nextTick(function(){r.call(null,e,t)});case 4:return process.nextTick(function(){r.call(null,e,t,n)});default:for(s=new Array(i-1),a=0;a<s.length;)s[a++]=arguments[a];return process.nextTick(function(){r.apply(null,s)})}}});var y1=j((k9,b1)=>{var aR={}.toString;b1.exports=Array.isArray||function(r){return aR.call(r)=="[object Array]"}});var Ed=j((I9,v1)=>{v1.exports=Ue("stream")});var Bs=j((Ad,x1)=>{var lu=Ue("buffer"),zr=lu.Buffer;function w1(r,e){for(var t in r)e[t]=r[t]}zr.from&&zr.alloc&&zr.allocUnsafe&&zr.allocUnsafeSlow?x1.exports=lu:(w1(lu,Ad),Ad.Buffer=vi);function vi(r,e,t){return zr(r,e,t)}w1(zr,vi);vi.from=function(r,e,t){if(typeof r=="number")throw new TypeError("Argument must not be a number");return zr(r,e,t)};vi.alloc=function(r,e,t){if(typeof r!="number")throw new TypeError("Argument must be a number");var n=zr(r);return e!==void 0?typeof t=="string"?n.fill(e,t):n.fill(e):n.fill(0),n};vi.allocUnsafe=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return zr(r)};vi.allocUnsafeSlow=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return lu.SlowBuffer(r)}});var wi=j(yt=>{function oR(r){return Array.isArray?Array.isArray(r):cu(r)==="[object Array]"}yt.isArray=oR;function uR(r){return typeof r=="boolean"}yt.isBoolean=uR;function lR(r){return r===null}yt.isNull=lR;function cR(r){return r==null}yt.isNullOrUndefined=cR;function hR(r){return typeof r=="number"}yt.isNumber=hR;function dR(r){return typeof r=="string"}yt.isString=dR;function fR(r){return typeof r=="symbol"}yt.isSymbol=fR;function pR(r){return r===void 0}yt.isUndefined=pR;function gR(r){return cu(r)==="[object RegExp]"}yt.isRegExp=gR;function mR(r){return typeof r=="object"&&r!==null}yt.isObject=mR;function bR(r){return cu(r)==="[object Date]"}yt.isDate=bR;function yR(r){return cu(r)==="[object Error]"||r instanceof Error}yt.isError=yR;function vR(r){return typeof r=="function"}yt.isFunction=vR;function wR(r){return r===null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||typeof r=="symbol"||typeof r>"u"}yt.isPrimitive=wR;yt.isBuffer=Ue("buffer").Buffer.isBuffer;function cu(r){return Object.prototype.toString.call(r)}});var S1=j((P9,Td)=>{typeof Object.create=="function"?Td.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Td.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}});var xi=j((O9,Cd)=>{try{if(_d=Ue("util"),typeof _d.inherits!="function")throw"";Cd.exports=_d.inherits}catch{Cd.exports=S1()}var _d});var A1=j((L9,kd)=>{"use strict";function xR(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var E1=Bs().Buffer,Ds=Ue("util");function SR(r,e,t){r.copy(e,t)}kd.exports=(function(){function r(){xR(this,r),this.head=null,this.tail=null,this.length=0}return r.prototype.push=function(t){var n={data:t,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},r.prototype.unshift=function(t){var n={data:t,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length},r.prototype.shift=function(){if(this.length!==0){var t=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},r.prototype.clear=function(){this.head=this.tail=null,this.length=0},r.prototype.join=function(t){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=t+n.data;return i},r.prototype.concat=function(t){if(this.length===0)return E1.alloc(0);for(var n=E1.allocUnsafe(t>>>0),i=this.head,s=0;i;)SR(i.data,n,s),s+=i.data.length,i=i.next;return n},r})();Ds&&Ds.inspect&&Ds.inspect.custom&&(kd.exports.prototype[Ds.inspect.custom]=function(){var r=Ds.inspect({length:this.length});return this.constructor.name+" "+r})});var Id=j((N9,T1)=>{"use strict";var hu=Ms();function ER(r,e){var t=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,hu.nextTick(du,this,r)):hu.nextTick(du,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,function(s){!e&&s?t._writableState?t._writableState.errorEmitted||(t._writableState.errorEmitted=!0,hu.nextTick(du,t,s)):hu.nextTick(du,t,s):e&&e(s)}),this)}function AR(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function du(r,e){r.emit("error",e)}T1.exports={destroy:ER,undestroy:AR}});var C1=j((M9,_1)=>{_1.exports=Ue("util").deprecate});var Pd=j((B9,M1)=>{"use strict";var Mn=Ms();M1.exports=tt;function I1(r){var e=this;this.next=null,this.entry=null,this.finish=function(){jR(e,r)}}var TR=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:Mn.nextTick,Si;tt.WritableState=$s;var R1=Object.create(wi());R1.inherits=xi();var _R={deprecate:C1()},P1=Ed(),pu=Bs().Buffer,CR=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function kR(r){return pu.from(r)}function IR(r){return pu.isBuffer(r)||r instanceof CR}var O1=Id();R1.inherits(tt,P1);function RR(){}function $s(r,e){Si=Si||Bn(),r=r||{};var t=e instanceof Si;this.objectMode=!!r.objectMode,t&&(this.objectMode=this.objectMode||!!r.writableObjectMode);var n=r.highWaterMark,i=r.writableHighWaterMark,s=this.objectMode?16:16*1024;n||n===0?this.highWaterMark=n:t&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=s,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=r.decodeStrings===!1;this.decodeStrings=!a,this.defaultEncoding=r.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(o){DR(e,o)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new I1(this)}$s.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t};(function(){try{Object.defineProperty($s.prototype,"buffer",{get:_R.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var fu;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(fu=Function.prototype[Symbol.hasInstance],Object.defineProperty(tt,Symbol.hasInstance,{value:function(r){return fu.call(this,r)?!0:this!==tt?!1:r&&r._writableState instanceof $s}})):fu=function(r){return r instanceof this};function tt(r){if(Si=Si||Bn(),!fu.call(tt,this)&&!(this instanceof Si))return new tt(r);this._writableState=new $s(r,this),this.writable=!0,r&&(typeof r.write=="function"&&(this._write=r.write),typeof r.writev=="function"&&(this._writev=r.writev),typeof r.destroy=="function"&&(this._destroy=r.destroy),typeof r.final=="function"&&(this._final=r.final)),P1.call(this)}tt.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function PR(r,e){var t=new Error("write after end");r.emit("error",t),Mn.nextTick(e,t)}function OR(r,e,t,n){var i=!0,s=!1;return t===null?s=new TypeError("May not write null values to stream"):typeof t!="string"&&t!==void 0&&!e.objectMode&&(s=new TypeError("Invalid non-string/buffer chunk")),s&&(r.emit("error",s),Mn.nextTick(n,s),i=!1),i}tt.prototype.write=function(r,e,t){var n=this._writableState,i=!1,s=!n.objectMode&&IR(r);return s&&!pu.isBuffer(r)&&(r=kR(r)),typeof e=="function"&&(t=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof t!="function"&&(t=RR),n.ended?PR(this,t):(s||OR(this,n,r,t))&&(n.pendingcb++,i=NR(this,n,s,r,e,t)),i};tt.prototype.cork=function(){var r=this._writableState;r.corked++};tt.prototype.uncork=function(){var r=this._writableState;r.corked&&(r.corked--,!r.writing&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&L1(this,r))};tt.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this};function LR(r,e,t){return!r.objectMode&&r.decodeStrings!==!1&&typeof e=="string"&&(e=pu.from(e,t)),e}Object.defineProperty(tt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function NR(r,e,t,n,i,s){if(!t){var a=LR(e,n,i);n!==a&&(t=!0,i="buffer",n=a)}var o=e.objectMode?1:n.length;e.length+=o;var u=e.length<e.highWaterMark;if(u||(e.needDrain=!0),e.writing||e.corked){var l=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:t,callback:s,next:null},l?l.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else Rd(r,e,!1,o,n,i,s);return u}function Rd(r,e,t,n,i,s,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,t?r._writev(i,e.onwrite):r._write(i,s,e.onwrite),e.sync=!1}function MR(r,e,t,n,i){--e.pendingcb,t?(Mn.nextTick(i,n),Mn.nextTick(Fs,r,e),r._writableState.errorEmitted=!0,r.emit("error",n)):(i(n),r._writableState.errorEmitted=!0,r.emit("error",n),Fs(r,e))}function BR(r){r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0}function DR(r,e){var t=r._writableState,n=t.sync,i=t.writecb;if(BR(t),e)MR(r,t,n,e,i);else{var s=N1(t);!s&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&L1(r,t),n?TR(k1,r,t,s,i):k1(r,t,s,i)}}function k1(r,e,t,n){t||FR(r,e),e.pendingcb--,n(),Fs(r,e)}function FR(r,e){e.length===0&&e.needDrain&&(e.needDrain=!1,r.emit("drain"))}function L1(r,e){e.bufferProcessing=!0;var t=e.bufferedRequest;if(r._writev&&t&&t.next){var n=e.bufferedRequestCount,i=new Array(n),s=e.corkedRequestsFree;s.entry=t;for(var a=0,o=!0;t;)i[a]=t,t.isBuf||(o=!1),t=t.next,a+=1;i.allBuffers=o,Rd(r,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new I1(e),e.bufferedRequestCount=0}else{for(;t;){var u=t.chunk,l=t.encoding,c=t.callback,h=e.objectMode?1:u.length;if(Rd(r,e,!1,h,u,l,c),t=t.next,e.bufferedRequestCount--,e.writing)break}t===null&&(e.lastBufferedRequest=null)}e.bufferedRequest=t,e.bufferProcessing=!1}tt.prototype._write=function(r,e,t){t(new Error("_write() is not implemented"))};tt.prototype._writev=null;tt.prototype.end=function(r,e,t){var n=this._writableState;typeof r=="function"?(t=r,r=null,e=null):typeof e=="function"&&(t=e,e=null),r!=null&&this.write(r,e),n.corked&&(n.corked=1,this.uncork()),n.ending||zR(this,n,t)};function N1(r){return r.ending&&r.length===0&&r.bufferedRequest===null&&!r.finished&&!r.writing}function $R(r,e){r._final(function(t){e.pendingcb--,t&&r.emit("error",t),e.prefinished=!0,r.emit("prefinish"),Fs(r,e)})}function UR(r,e){!e.prefinished&&!e.finalCalled&&(typeof r._final=="function"?(e.pendingcb++,e.finalCalled=!0,Mn.nextTick($R,r,e)):(e.prefinished=!0,r.emit("prefinish")))}function Fs(r,e){var t=N1(e);return t&&(UR(r,e),e.pendingcb===0&&(e.finished=!0,r.emit("finish"))),t}function zR(r,e,t){e.ending=!0,Fs(r,e),t&&(e.finished?Mn.nextTick(t):r.once("finish",t)),e.ended=!0,r.writable=!1}function jR(r,e,t){var n=r.entry;for(r.entry=null;n;){var i=n.callback;e.pendingcb--,i(t),n=n.next}e.corkedRequestsFree.next=r}Object.defineProperty(tt.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(r){this._writableState&&(this._writableState.destroyed=r)}});tt.prototype.destroy=O1.destroy;tt.prototype._undestroy=O1.undestroy;tt.prototype._destroy=function(r,e){this.end(),e(r)}});var Bn=j((D9,$1)=>{"use strict";var B1=Ms(),HR=Object.keys||function(r){var e=[];for(var t in r)e.push(t);return e};$1.exports=jr;var D1=Object.create(wi());D1.inherits=xi();var F1=Nd(),Ld=Pd();D1.inherits(jr,F1);for(Od=HR(Ld.prototype),gu=0;gu<Od.length;gu++)mu=Od[gu],jr.prototype[mu]||(jr.prototype[mu]=Ld.prototype[mu]);var Od,mu,gu;function jr(r){if(!(this instanceof jr))return new jr(r);F1.call(this,r),Ld.call(this,r),r&&r.readable===!1&&(this.readable=!1),r&&r.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,r&&r.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",WR)}Object.defineProperty(jr.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function WR(){this.allowHalfOpen||this._writableState.ended||B1.nextTick(VR,this)}function VR(r){r.end()}Object.defineProperty(jr.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(r){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=r,this._writableState.destroyed=r)}});jr.prototype._destroy=function(r,e){this.push(null),this.end(),B1.nextTick(e,r)}});var Dd=j(z1=>{"use strict";var Bd=Bs().Buffer,U1=Bd.isEncoding||function(r){switch(r=""+r,r&&r.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function GR(r){if(!r)return"utf8";for(var e;;)switch(r){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return r;default:if(e)return;r=(""+r).toLowerCase(),e=!0}}function qR(r){var e=GR(r);if(typeof e!="string"&&(Bd.isEncoding===U1||!U1(r)))throw new Error("Unknown encoding: "+r);return e||r}z1.StringDecoder=Us;function Us(r){this.encoding=qR(r);var e;switch(this.encoding){case"utf16le":this.text=JR,this.end=eP,e=4;break;case"utf8":this.fillLast=YR,e=4;break;case"base64":this.text=tP,this.end=rP,e=3;break;default:this.write=nP,this.end=iP;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Bd.allocUnsafe(e)}Us.prototype.write=function(r){if(r.length===0)return"";var e,t;if(this.lastNeed){if(e=this.fillLast(r),e===void 0)return"";t=this.lastNeed,this.lastNeed=0}else t=0;return t<r.length?e?e+this.text(r,t):this.text(r,t):e||""};Us.prototype.end=ZR;Us.prototype.text=QR;Us.prototype.fillLast=function(r){if(this.lastNeed<=r.length)return r.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);r.copy(this.lastChar,this.lastTotal-this.lastNeed,0,r.length),this.lastNeed-=r.length};function Md(r){return r<=127?0:r>>5===6?2:r>>4===14?3:r>>3===30?4:r>>6===2?-1:-2}function KR(r,e,t){var n=e.length-1;if(n<t)return 0;var i=Md(e[n]);return i>=0?(i>0&&(r.lastNeed=i-1),i):--n<t||i===-2?0:(i=Md(e[n]),i>=0?(i>0&&(r.lastNeed=i-2),i):--n<t||i===-2?0:(i=Md(e[n]),i>=0?(i>0&&(i===2?i=0:r.lastNeed=i-3),i):0))}function XR(r,e,t){if((e[0]&192)!==128)return r.lastNeed=0,"\uFFFD";if(r.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return r.lastNeed=1,"\uFFFD";if(r.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return r.lastNeed=2,"\uFFFD"}}function YR(r){var e=this.lastTotal-this.lastNeed,t=XR(this,r,e);if(t!==void 0)return t;if(this.lastNeed<=r.length)return r.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);r.copy(this.lastChar,e,0,r.length),this.lastNeed-=r.length}function QR(r,e){var t=KR(this,r,e);if(!this.lastNeed)return r.toString("utf8",e);this.lastTotal=t;var n=r.length-(t-this.lastNeed);return r.copy(this.lastChar,0,n),r.toString("utf8",e,n)}function ZR(r){var e=r&&r.length?this.write(r):"";return this.lastNeed?e+"\uFFFD":e}function JR(r,e){if((r.length-e)%2===0){var t=r.toString("utf16le",e);if(t){var n=t.charCodeAt(t.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=r[r.length-2],this.lastChar[1]=r[r.length-1],t.slice(0,-1)}return t}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=r[r.length-1],r.toString("utf16le",e,r.length-1)}function eP(r){var e=r&&r.length?this.write(r):"";if(this.lastNeed){var t=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,t)}return e}function tP(r,e){var t=(r.length-e)%3;return t===0?r.toString("base64",e):(this.lastNeed=3-t,this.lastTotal=3,t===1?this.lastChar[0]=r[r.length-1]:(this.lastChar[0]=r[r.length-2],this.lastChar[1]=r[r.length-1]),r.toString("base64",e,r.length-t))}function rP(r){var e=r&&r.length?this.write(r):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function nP(r){return r.toString(this.encoding)}function iP(r){return r&&r.length?this.write(r):""}});var Nd=j((U9,J1)=>{"use strict";var Ai=Ms();J1.exports=Fe;var sP=y1(),zs;Fe.ReadableState=K1;var $9=Ue("events").EventEmitter,V1=function(r,e){return r.listeners(e).length},jd=Ed(),js=Bs().Buffer,aP=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function oP(r){return js.from(r)}function uP(r){return js.isBuffer(r)||r instanceof aP}var G1=Object.create(wi());G1.inherits=xi();var Fd=Ue("util"),Ce=void 0;Fd&&Fd.debuglog?Ce=Fd.debuglog("stream"):Ce=function(){};var lP=A1(),q1=Id(),Ei;G1.inherits(Fe,jd);var $d=["error","close","destroy","pause","resume"];function cP(r,e,t){if(typeof r.prependListener=="function")return r.prependListener(e,t);!r._events||!r._events[e]?r.on(e,t):sP(r._events[e])?r._events[e].unshift(t):r._events[e]=[t,r._events[e]]}function K1(r,e){zs=zs||Bn(),r=r||{};var t=e instanceof zs;this.objectMode=!!r.objectMode,t&&(this.objectMode=this.objectMode||!!r.readableObjectMode);var n=r.highWaterMark,i=r.readableHighWaterMark,s=this.objectMode?16:16*1024;n||n===0?this.highWaterMark=n:t&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new lP,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=r.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,r.encoding&&(Ei||(Ei=Dd().StringDecoder),this.decoder=new Ei(r.encoding),this.encoding=r.encoding)}function Fe(r){if(zs=zs||Bn(),!(this instanceof Fe))return new Fe(r);this._readableState=new K1(r,this),this.readable=!0,r&&(typeof r.read=="function"&&(this._read=r.read),typeof r.destroy=="function"&&(this._destroy=r.destroy)),jd.call(this)}Object.defineProperty(Fe.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(r){this._readableState&&(this._readableState.destroyed=r)}});Fe.prototype.destroy=q1.destroy;Fe.prototype._undestroy=q1.undestroy;Fe.prototype._destroy=function(r,e){this.push(null),e(r)};Fe.prototype.push=function(r,e){var t=this._readableState,n;return t.objectMode?n=!0:typeof r=="string"&&(e=e||t.defaultEncoding,e!==t.encoding&&(r=js.from(r,e),e=""),n=!0),X1(this,r,e,!1,n)};Fe.prototype.unshift=function(r){return X1(this,r,null,!0,!1)};function X1(r,e,t,n,i){var s=r._readableState;if(e===null)s.reading=!1,pP(r,s);else{var a;i||(a=hP(s,e)),a?r.emit("error",a):s.objectMode||e&&e.length>0?(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==js.prototype&&(e=oP(e)),n?s.endEmitted?r.emit("error",new Error("stream.unshift() after end event")):Ud(r,s,e,!0):s.ended?r.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!t?(e=s.decoder.write(e),s.objectMode||e.length!==0?Ud(r,s,e,!1):Y1(r,s)):Ud(r,s,e,!1))):n||(s.reading=!1)}return dP(s)}function Ud(r,e,t,n){e.flowing&&e.length===0&&!e.sync?(r.emit("data",t),r.read(0)):(e.length+=e.objectMode?1:t.length,n?e.buffer.unshift(t):e.buffer.push(t),e.needReadable&&bu(r)),Y1(r,e)}function hP(r,e){var t;return!uP(e)&&typeof e!="string"&&e!==void 0&&!r.objectMode&&(t=new TypeError("Invalid non-string/buffer chunk")),t}function dP(r){return!r.ended&&(r.needReadable||r.length<r.highWaterMark||r.length===0)}Fe.prototype.isPaused=function(){return this._readableState.flowing===!1};Fe.prototype.setEncoding=function(r){return Ei||(Ei=Dd().StringDecoder),this._readableState.decoder=new Ei(r),this._readableState.encoding=r,this};var j1=8388608;function fP(r){return r>=j1?r=j1:(r--,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r++),r}function H1(r,e){return r<=0||e.length===0&&e.ended?0:e.objectMode?1:r!==r?e.flowing&&e.length?e.buffer.head.data.length:e.length:(r>e.highWaterMark&&(e.highWaterMark=fP(r)),r<=e.length?r:e.ended?e.length:(e.needReadable=!0,0))}Fe.prototype.read=function(r){Ce("read",r),r=parseInt(r,10);var e=this._readableState,t=r;if(r!==0&&(e.emittedReadable=!1),r===0&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return Ce("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?zd(this):bu(this),null;if(r=H1(r,e),r===0&&e.ended)return e.length===0&&zd(this),null;var n=e.needReadable;Ce("need readable",n),(e.length===0||e.length-r<e.highWaterMark)&&(n=!0,Ce("length less than watermark",n)),e.ended||e.reading?(n=!1,Ce("reading or ended",n)):n&&(Ce("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(r=H1(t,e)));var i;return r>0?i=Q1(r,e):i=null,i===null?(e.needReadable=!0,r=0):e.length-=r,e.length===0&&(e.ended||(e.needReadable=!0),t!==r&&e.ended&&zd(this)),i!==null&&this.emit("data",i),i};function pP(r,e){if(!e.ended){if(e.decoder){var t=e.decoder.end();t&&t.length&&(e.buffer.push(t),e.length+=e.objectMode?1:t.length)}e.ended=!0,bu(r)}}function bu(r){var e=r._readableState;e.needReadable=!1,e.emittedReadable||(Ce("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?Ai.nextTick(W1,r):W1(r))}function W1(r){Ce("emit readable"),r.emit("readable"),Hd(r)}function Y1(r,e){e.readingMore||(e.readingMore=!0,Ai.nextTick(gP,r,e))}function gP(r,e){for(var t=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(Ce("maybeReadMore read 0"),r.read(0),t!==e.length);)t=e.length;e.readingMore=!1}Fe.prototype._read=function(r){this.emit("error",new Error("_read() is not implemented"))};Fe.prototype.pipe=function(r,e){var t=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=r;break;case 1:n.pipes=[n.pipes,r];break;default:n.pipes.push(r);break}n.pipesCount+=1,Ce("pipe count=%d opts=%j",n.pipesCount,e);var i=(!e||e.end!==!1)&&r!==process.stdout&&r!==process.stderr,s=i?o:b;n.endEmitted?Ai.nextTick(s):t.once("end",s),r.on("unpipe",a);function a(m,y){Ce("onunpipe"),m===t&&y&&y.hasUnpiped===!1&&(y.hasUnpiped=!0,c())}function o(){Ce("onend"),r.end()}var u=mP(t);r.on("drain",u);var l=!1;function c(){Ce("cleanup"),r.removeListener("close",p),r.removeListener("finish",g),r.removeListener("drain",u),r.removeListener("error",f),r.removeListener("unpipe",a),t.removeListener("end",o),t.removeListener("end",b),t.removeListener("data",d),l=!0,n.awaitDrain&&(!r._writableState||r._writableState.needDrain)&&u()}var h=!1;t.on("data",d);function d(m){Ce("ondata"),h=!1;var y=r.write(m);y===!1&&!h&&((n.pipesCount===1&&n.pipes===r||n.pipesCount>1&&Z1(n.pipes,r)!==-1)&&!l&&(Ce("false write response, pause",n.awaitDrain),n.awaitDrain++,h=!0),t.pause())}function f(m){Ce("onerror",m),b(),r.removeListener("error",f),V1(r,"error")===0&&r.emit("error",m)}cP(r,"error",f);function p(){r.removeListener("finish",g),b()}r.once("close",p);function g(){Ce("onfinish"),r.removeListener("close",p),b()}r.once("finish",g);function b(){Ce("unpipe"),t.unpipe(r)}return r.emit("pipe",t),n.flowing||(Ce("pipe resume"),t.resume()),r};function mP(r){return function(){var e=r._readableState;Ce("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,e.awaitDrain===0&&V1(r,"data")&&(e.flowing=!0,Hd(r))}}Fe.prototype.unpipe=function(r){var e=this._readableState,t={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return r&&r!==e.pipes?this:(r||(r=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,r&&r.emit("unpipe",this,t),this);if(!r){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s<i;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}var a=Z1(e.pipes,r);return a===-1?this:(e.pipes.splice(a,1),e.pipesCount-=1,e.pipesCount===1&&(e.pipes=e.pipes[0]),r.emit("unpipe",this,t),this)};Fe.prototype.on=function(r,e){var t=jd.prototype.on.call(this,r,e);if(r==="data")this._readableState.flowing!==!1&&this.resume();else if(r==="readable"){var n=this._readableState;!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&bu(this):Ai.nextTick(bP,this))}return t};Fe.prototype.addListener=Fe.prototype.on;function bP(r){Ce("readable nexttick read 0"),r.read(0)}Fe.prototype.resume=function(){var r=this._readableState;return r.flowing||(Ce("resume"),r.flowing=!0,yP(this,r)),this};function yP(r,e){e.resumeScheduled||(e.resumeScheduled=!0,Ai.nextTick(vP,r,e))}function vP(r,e){e.reading||(Ce("resume read 0"),r.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,r.emit("resume"),Hd(r),e.flowing&&!e.reading&&r.read(0)}Fe.prototype.pause=function(){return Ce("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Ce("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function Hd(r){var e=r._readableState;for(Ce("flow",e.flowing);e.flowing&&r.read()!==null;);}Fe.prototype.wrap=function(r){var e=this,t=this._readableState,n=!1;r.on("end",function(){if(Ce("wrapped end"),t.decoder&&!t.ended){var a=t.decoder.end();a&&a.length&&e.push(a)}e.push(null)}),r.on("data",function(a){if(Ce("wrapped data"),t.decoder&&(a=t.decoder.write(a)),!(t.objectMode&&a==null)&&!(!t.objectMode&&(!a||!a.length))){var o=e.push(a);o||(n=!0,r.pause())}});for(var i in r)this[i]===void 0&&typeof r[i]=="function"&&(this[i]=(function(a){return function(){return r[a].apply(r,arguments)}})(i));for(var s=0;s<$d.length;s++)r.on($d[s],this.emit.bind(this,$d[s]));return this._read=function(a){Ce("wrapped _read",a),n&&(n=!1,r.resume())},this};Object.defineProperty(Fe.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Fe._fromList=Q1;function Q1(r,e){if(e.length===0)return null;var t;return e.objectMode?t=e.buffer.shift():!r||r>=e.length?(e.decoder?t=e.buffer.join(""):e.buffer.length===1?t=e.buffer.head.data:t=e.buffer.concat(e.length),e.buffer.clear()):t=wP(r,e.buffer,e.decoder),t}function wP(r,e,t){var n;return r<e.head.data.length?(n=e.head.data.slice(0,r),e.head.data=e.head.data.slice(r)):r===e.head.data.length?n=e.shift():n=t?xP(r,e):SP(r,e),n}function xP(r,e){var t=e.head,n=1,i=t.data;for(r-=i.length;t=t.next;){var s=t.data,a=r>s.length?s.length:r;if(a===s.length?i+=s:i+=s.slice(0,r),r-=a,r===0){a===s.length?(++n,t.next?e.head=t.next:e.head=e.tail=null):(e.head=t,t.data=s.slice(a));break}++n}return e.length-=n,i}function SP(r,e){var t=js.allocUnsafe(r),n=e.head,i=1;for(n.data.copy(t),r-=n.data.length;n=n.next;){var s=n.data,a=r>s.length?s.length:r;if(s.copy(t,t.length-r,0,a),r-=a,r===0){a===s.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=s.slice(a));break}++i}return e.length-=i,t}function zd(r){var e=r._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,Ai.nextTick(EP,e,r))}function EP(r,e){!r.endEmitted&&r.length===0&&(r.endEmitted=!0,e.readable=!1,e.emit("end"))}function Z1(r,e){for(var t=0,n=r.length;t<n;t++)if(r[t]===e)return t;return-1}});var Wd=j((z9,rv)=>{"use strict";rv.exports=Hr;var yu=Bn(),tv=Object.create(wi());tv.inherits=xi();tv.inherits(Hr,yu);function AP(r,e){var t=this._transformState;t.transforming=!1;var n=t.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));t.writechunk=null,t.writecb=null,e!=null&&this.push(e),n(r);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Hr(r){if(!(this instanceof Hr))return new Hr(r);yu.call(this,r),this._transformState={afterTransform:AP.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,r&&(typeof r.transform=="function"&&(this._transform=r.transform),typeof r.flush=="function"&&(this._flush=r.flush)),this.on("prefinish",TP)}function TP(){var r=this;typeof this._flush=="function"?this._flush(function(e,t){ev(r,e,t)}):ev(this,null,null)}Hr.prototype.push=function(r,e){return this._transformState.needTransform=!1,yu.prototype.push.call(this,r,e)};Hr.prototype._transform=function(r,e,t){throw new Error("_transform() is not implemented")};Hr.prototype._write=function(r,e,t){var n=this._transformState;if(n.writecb=t,n.writechunk=r,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};Hr.prototype._read=function(r){var e=this._transformState;e.writechunk!==null&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0};Hr.prototype._destroy=function(r,e){var t=this;yu.prototype._destroy.call(this,r,function(n){e(n),t.emit("close")})};function ev(r,e,t){if(e)return r.emit("error",e);if(t!=null&&r.push(t),r._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(r._transformState.transforming)throw new Error("Calling transform done when still transforming");return r.push(null)}});var av=j((j9,sv)=>{"use strict";sv.exports=Hs;var nv=Wd(),iv=Object.create(wi());iv.inherits=xi();iv.inherits(Hs,nv);function Hs(r){if(!(this instanceof Hs))return new Hs(r);nv.call(this,r)}Hs.prototype._transform=function(r,e,t){t(null,r)}});var Vd=j((dt,vu)=>{var _r=Ue("stream");process.env.READABLE_STREAM==="disable"&&_r?(vu.exports=_r,dt=vu.exports=_r.Readable,dt.Readable=_r.Readable,dt.Writable=_r.Writable,dt.Duplex=_r.Duplex,dt.Transform=_r.Transform,dt.PassThrough=_r.PassThrough,dt.Stream=_r):(dt=vu.exports=Nd(),dt.Stream=_r||dt,dt.Readable=dt,dt.Writable=Pd(),dt.Duplex=Bn(),dt.Transform=Wd(),dt.PassThrough=av())});var Wr=j(jt=>{"use strict";jt.base64=!0;jt.array=!0;jt.string=!0;jt.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";jt.nodebuffer=typeof Buffer<"u";jt.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")jt.blob=!1;else{Gd=new ArrayBuffer(0);try{jt.blob=new Blob([Gd],{type:"application/zip"}).size===0}catch{try{ov=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,qd=new ov,qd.append(Gd),jt.blob=qd.getBlob("application/zip").size===0}catch{jt.blob=!1}}}var Gd,ov,qd;try{jt.nodestream=!!Vd().Readable}catch{jt.nodestream=!1}});var Xd=j(Kd=>{"use strict";var _P=je(),CP=Wr(),Cr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";Kd.encode=function(r){for(var e=[],t,n,i,s,a,o,u,l=0,c=r.length,h=c,d=_P.getTypeOf(r)!=="string";l<r.length;)h=c-l,d?(t=r[l++],n=l<c?r[l++]:0,i=l<c?r[l++]:0):(t=r.charCodeAt(l++),n=l<c?r.charCodeAt(l++):0,i=l<c?r.charCodeAt(l++):0),s=t>>2,a=(t&3)<<4|n>>4,o=h>1?(n&15)<<2|i>>6:64,u=h>2?i&63:64,e.push(Cr.charAt(s)+Cr.charAt(a)+Cr.charAt(o)+Cr.charAt(u));return e.join("")};Kd.decode=function(r){var e,t,n,i,s,a,o,u=0,l=0,c="data:";if(r.substr(0,c.length)===c)throw new Error("Invalid base64 input, it looks like a data url.");r=r.replace(/[^A-Za-z0-9+/=]/g,"");var h=r.length*3/4;if(r.charAt(r.length-1)===Cr.charAt(64)&&h--,r.charAt(r.length-2)===Cr.charAt(64)&&h--,h%1!==0)throw new Error("Invalid base64 input, bad content length.");var d;for(CP.uint8array?d=new Uint8Array(h|0):d=new Array(h|0);u<r.length;)i=Cr.indexOf(r.charAt(u++)),s=Cr.indexOf(r.charAt(u++)),a=Cr.indexOf(r.charAt(u++)),o=Cr.indexOf(r.charAt(u++)),e=i<<2|s>>4,t=(s&15)<<4|a>>2,n=(a&3)<<6|o,d[l++]=e,a!==64&&(d[l++]=t),o!==64&&(d[l++]=n);return d}});var Ws=j((V9,uv)=>{"use strict";uv.exports={isNode:typeof Buffer<"u",newBufferFrom:function(r,e){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(r,e);if(typeof r=="number")throw new Error('The "data" argument must not be a number');return new Buffer(r,e)},allocBuffer:function(r){if(Buffer.alloc)return Buffer.alloc(r);var e=new Buffer(r);return e.fill(0),e},isBuffer:function(r){return Buffer.isBuffer(r)},isStream:function(r){return r&&typeof r.on=="function"&&typeof r.pause=="function"&&typeof r.resume=="function"}}});var dv=j((G9,hv)=>{"use strict";var lv=global.MutationObserver||global.WebKitMutationObserver,Ti;process.browser?lv?(Yd=0,cv=new lv(Vs),Qd=global.document.createTextNode(""),cv.observe(Qd,{characterData:!0}),Ti=function(){Qd.data=Yd=++Yd%2}):!global.setImmediate&&typeof global.MessageChannel<"u"?(Zd=new global.MessageChannel,Zd.port1.onmessage=Vs,Ti=function(){Zd.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?Ti=function(){var r=global.document.createElement("script");r.onreadystatechange=function(){Vs(),r.onreadystatechange=null,r.parentNode.removeChild(r),r=null},global.document.documentElement.appendChild(r)}:Ti=function(){setTimeout(Vs,0)}:Ti=function(){process.nextTick(Vs)};var Yd,cv,Qd,Zd,Jd,Gs=[];function Vs(){Jd=!0;for(var r,e,t=Gs.length;t;){for(e=Gs,Gs=[],r=-1;++r<t;)e[r]();t=Gs.length}Jd=!1}hv.exports=kP;function kP(r){Gs.push(r)===1&&!Jd&&Ti()}});var vv=j((q9,yv)=>{"use strict";var fv=dv();function _i(){}var vt={},pv=["REJECTED"],ef=["FULFILLED"],gv=["PENDING"];process.browser||(qs=["UNHANDLED"]);var qs;yv.exports=cn;function cn(r){if(typeof r!="function")throw new TypeError("resolver must be a function");this.state=gv,this.queue=[],this.outcome=void 0,process.browser||(this.handled=qs),r!==_i&&mv(this,r)}cn.prototype.finally=function(r){if(typeof r!="function")return this;var e=this.constructor;return this.then(t,n);function t(i){function s(){return i}return e.resolve(r()).then(s)}function n(i){function s(){throw i}return e.resolve(r()).then(s)}};cn.prototype.catch=function(r){return this.then(null,r)};cn.prototype.then=function(r,e){if(typeof r!="function"&&this.state===ef||typeof e!="function"&&this.state===pv)return this;var t=new this.constructor(_i);if(process.browser||this.handled===qs&&(this.handled=null),this.state!==gv){var n=this.state===ef?r:e;tf(t,n,this.outcome)}else this.queue.push(new Ks(t,r,e));return t};function Ks(r,e,t){this.promise=r,typeof e=="function"&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),typeof t=="function"&&(this.onRejected=t,this.callRejected=this.otherCallRejected)}Ks.prototype.callFulfilled=function(r){vt.resolve(this.promise,r)};Ks.prototype.otherCallFulfilled=function(r){tf(this.promise,this.onFulfilled,r)};Ks.prototype.callRejected=function(r){vt.reject(this.promise,r)};Ks.prototype.otherCallRejected=function(r){tf(this.promise,this.onRejected,r)};function tf(r,e,t){fv(function(){var n;try{n=e(t)}catch(i){return vt.reject(r,i)}n===r?vt.reject(r,new TypeError("Cannot resolve promise with itself")):vt.resolve(r,n)})}vt.resolve=function(r,e){var t=bv(IP,e);if(t.status==="error")return vt.reject(r,t.value);var n=t.value;if(n)mv(r,n);else{r.state=ef,r.outcome=e;for(var i=-1,s=r.queue.length;++i<s;)r.queue[i].callFulfilled(e)}return r};vt.reject=function(r,e){r.state=pv,r.outcome=e,process.browser||r.handled===qs&&fv(function(){r.handled===qs&&process.emit("unhandledRejection",e,r)});for(var t=-1,n=r.queue.length;++t<n;)r.queue[t].callRejected(e);return r};function IP(r){var e=r&&r.then;if(r&&(typeof r=="object"||typeof r=="function")&&typeof e=="function")return function(){e.apply(r,arguments)}}function mv(r,e){var t=!1;function n(o){t||(t=!0,vt.reject(r,o))}function i(o){t||(t=!0,vt.resolve(r,o))}function s(){e(i,n)}var a=bv(s);a.status==="error"&&n(a.value)}function bv(r,e){var t={};try{t.value=r(e),t.status="success"}catch(n){t.status="error",t.value=n}return t}cn.resolve=RP;function RP(r){return r instanceof this?r:vt.resolve(new this(_i),r)}cn.reject=PP;function PP(r){var e=new this(_i);return vt.reject(e,r)}cn.all=OP;function OP(r){var e=this;if(Object.prototype.toString.call(r)!=="[object Array]")return this.reject(new TypeError("must be an array"));var t=r.length,n=!1;if(!t)return this.resolve([]);for(var i=new Array(t),s=0,a=-1,o=new this(_i);++a<t;)u(r[a],a);return o;function u(l,c){e.resolve(l).then(h,function(d){n||(n=!0,vt.reject(o,d))});function h(d){i[c]=d,++s===t&&!n&&(n=!0,vt.resolve(o,i))}}}cn.race=LP;function LP(r){var e=this;if(Object.prototype.toString.call(r)!=="[object Array]")return this.reject(new TypeError("must be an array"));var t=r.length,n=!1;if(!t)return this.resolve([]);for(var i=-1,s=new this(_i);++i<t;)a(r[i]);return s;function a(o){e.resolve(o).then(function(u){n||(n=!0,vt.resolve(s,u))},function(u){n||(n=!0,vt.reject(s,u))})}}});var Ci=j((K9,wv)=>{"use strict";var rf=null;typeof Promise<"u"?rf=Promise:rf=vv();wv.exports={Promise:rf}});var Sv=j(xv=>{(function(r,e){"use strict";if(r.setImmediate)return;var t=1,n={},i=!1,s=r.document,a;function o(y){typeof y!="function"&&(y=new Function(""+y));for(var v=new Array(arguments.length-1),x=0;x<v.length;x++)v[x]=arguments[x+1];var w={callback:y,args:v};return n[t]=w,a(t),t++}function u(y){delete n[y]}function l(y){var v=y.callback,x=y.args;switch(x.length){case 0:v();break;case 1:v(x[0]);break;case 2:v(x[0],x[1]);break;case 3:v(x[0],x[1],x[2]);break;default:v.apply(e,x);break}}function c(y){if(i)setTimeout(c,0,y);else{var v=n[y];if(v){i=!0;try{l(v)}finally{u(y),i=!1}}}}function h(){a=function(y){process.nextTick(function(){c(y)})}}function d(){if(r.postMessage&&!r.importScripts){var y=!0,v=r.onmessage;return r.onmessage=function(){y=!1},r.postMessage("","*"),r.onmessage=v,y}}function f(){var y="setImmediate$"+Math.random()+"$",v=function(x){x.source===r&&typeof x.data=="string"&&x.data.indexOf(y)===0&&c(+x.data.slice(y.length))};r.addEventListener?r.addEventListener("message",v,!1):r.attachEvent("onmessage",v),a=function(x){r.postMessage(y+x,"*")}}function p(){var y=new MessageChannel;y.port1.onmessage=function(v){var x=v.data;c(x)},a=function(v){y.port2.postMessage(v)}}function g(){var y=s.documentElement;a=function(v){var x=s.createElement("script");x.onreadystatechange=function(){c(v),x.onreadystatechange=null,y.removeChild(x),x=null},y.appendChild(x)}}function b(){a=function(y){setTimeout(c,0,y)}}var m=Object.getPrototypeOf&&Object.getPrototypeOf(r);m=m&&m.setTimeout?m:r,{}.toString.call(r.process)==="[object process]"?h():d()?f():r.MessageChannel?p():s&&"onreadystatechange"in s.createElement("script")?g():b(),m.setImmediate=o,m.clearImmediate=u})(typeof self>"u"?typeof global>"u"?xv:global:self)});var je=j(rt=>{"use strict";var hn=Wr(),NP=Xd(),ki=Ws(),nf=Ci();Sv();function MP(r){var e=null;return hn.uint8array?e=new Uint8Array(r.length):e=new Array(r.length),xu(r,e)}rt.newBlob=function(r,e){rt.checkSupport("blob");try{return new Blob([r],{type:e})}catch{try{var t=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,n=new t;return n.append(r),n.getBlob(e)}catch{throw new Error("Bug : can't construct the Blob.")}}};function Xs(r){return r}function xu(r,e){for(var t=0;t<r.length;++t)e[t]=r.charCodeAt(t)&255;return e}var wu={stringifyByChunk:function(r,e,t){var n=[],i=0,s=r.length;if(s<=t)return String.fromCharCode.apply(null,r);for(;i<s;)e==="array"||e==="nodebuffer"?n.push(String.fromCharCode.apply(null,r.slice(i,Math.min(i+t,s)))):n.push(String.fromCharCode.apply(null,r.subarray(i,Math.min(i+t,s)))),i+=t;return n.join("")},stringifyByChar:function(r){for(var e="",t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},applyCanBeUsed:{uint8array:(function(){try{return hn.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return hn.nodebuffer&&String.fromCharCode.apply(null,ki.allocBuffer(1)).length===1}catch{return!1}})()}};function Ys(r){var e=65536,t=rt.getTypeOf(r),n=!0;if(t==="uint8array"?n=wu.applyCanBeUsed.uint8array:t==="nodebuffer"&&(n=wu.applyCanBeUsed.nodebuffer),n)for(;e>1;)try{return wu.stringifyByChunk(r,t,e)}catch{e=Math.floor(e/2)}return wu.stringifyByChar(r)}rt.applyFromCharCode=Ys;function Su(r,e){for(var t=0;t<r.length;t++)e[t]=r[t];return e}var dn={};dn.string={string:Xs,array:function(r){return xu(r,new Array(r.length))},arraybuffer:function(r){return dn.string.uint8array(r).buffer},uint8array:function(r){return xu(r,new Uint8Array(r.length))},nodebuffer:function(r){return xu(r,ki.allocBuffer(r.length))}};dn.array={string:Ys,array:Xs,arraybuffer:function(r){return new Uint8Array(r).buffer},uint8array:function(r){return new Uint8Array(r)},nodebuffer:function(r){return ki.newBufferFrom(r)}};dn.arraybuffer={string:function(r){return Ys(new Uint8Array(r))},array:function(r){return Su(new Uint8Array(r),new Array(r.byteLength))},arraybuffer:Xs,uint8array:function(r){return new Uint8Array(r)},nodebuffer:function(r){return ki.newBufferFrom(new Uint8Array(r))}};dn.uint8array={string:Ys,array:function(r){return Su(r,new Array(r.length))},arraybuffer:function(r){return r.buffer},uint8array:Xs,nodebuffer:function(r){return ki.newBufferFrom(r)}};dn.nodebuffer={string:Ys,array:function(r){return Su(r,new Array(r.length))},arraybuffer:function(r){return dn.nodebuffer.uint8array(r).buffer},uint8array:function(r){return Su(r,new Uint8Array(r.length))},nodebuffer:Xs};rt.transformTo=function(r,e){if(e||(e=""),!r)return e;rt.checkSupport(r);var t=rt.getTypeOf(e),n=dn[t][r](e);return n};rt.resolve=function(r){for(var e=r.split("/"),t=[],n=0;n<e.length;n++){var i=e[n];i==="."||i===""&&n!==0&&n!==e.length-1||(i===".."?t.pop():t.push(i))}return t.join("/")};rt.getTypeOf=function(r){if(typeof r=="string")return"string";if(Object.prototype.toString.call(r)==="[object Array]")return"array";if(hn.nodebuffer&&ki.isBuffer(r))return"nodebuffer";if(hn.uint8array&&r instanceof Uint8Array)return"uint8array";if(hn.arraybuffer&&r instanceof ArrayBuffer)return"arraybuffer"};rt.checkSupport=function(r){var e=hn[r.toLowerCase()];if(!e)throw new Error(r+" is not supported by this platform")};rt.MAX_VALUE_16BITS=65535;rt.MAX_VALUE_32BITS=-1;rt.pretty=function(r){var e="",t,n;for(n=0;n<(r||"").length;n++)t=r.charCodeAt(n),e+="\\x"+(t<16?"0":"")+t.toString(16).toUpperCase();return e};rt.delay=function(r,e,t){setImmediate(function(){r.apply(t||null,e||[])})};rt.inherits=function(r,e){var t=function(){};t.prototype=e.prototype,r.prototype=new t};rt.extend=function(){var r={},e,t;for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&typeof r[t]>"u"&&(r[t]=arguments[e][t]);return r};rt.prepareContent=function(r,e,t,n,i){var s=nf.Promise.resolve(e).then(function(a){var o=hn.blob&&(a instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(a))!==-1);return o&&typeof FileReader<"u"?new nf.Promise(function(u,l){var c=new FileReader;c.onload=function(h){u(h.target.result)},c.onerror=function(h){l(h.target.error)},c.readAsArrayBuffer(a)}):a});return s.then(function(a){var o=rt.getTypeOf(a);return o?(o==="arraybuffer"?a=rt.transformTo("uint8array",a):o==="string"&&(i?a=NP.decode(a):t&&n!==!0&&(a=MP(a))),a):nf.Promise.reject(new Error("Can't read the data of '"+r+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}});var Ht=j((Q9,Av)=>{"use strict";function Ev(r){this.name=r||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}Ev.prototype={push:function(r){this.emit("data",r)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(r){this.emit("error",r)}return!0},error:function(r){return this.isFinished?!1:(this.isPaused?this.generatedError=r:(this.isFinished=!0,this.emit("error",r),this.previous&&this.previous.error(r),this.cleanUp()),!0)},on:function(r,e){return this._listeners[r].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(r,e){if(this._listeners[r])for(var t=0;t<this._listeners[r].length;t++)this._listeners[r][t].call(this,e)},pipe:function(r){return r.registerPrevious(this)},registerPrevious:function(r){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=r.streamInfo,this.mergeStreamInfo(),this.previous=r;var e=this;return r.on("data",function(t){e.processChunk(t)}),r.on("end",function(){e.end()}),r.on("error",function(t){e.error(t)}),this},pause:function(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var r=!1;return this.generatedError&&(this.error(this.generatedError),r=!0),this.previous&&this.previous.resume(),!r},flush:function(){},processChunk:function(r){this.push(r)},withStreamInfo:function(r,e){return this.extraStreamInfo[r]=e,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var r in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,r)&&(this.streamInfo[r]=this.extraStreamInfo[r])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var r="Worker "+this.name;return this.previous?this.previous+" -> "+r:r}};Av.exports=Ev});var Ri=j(fn=>{"use strict";var Ii=je(),Dn=Wr(),BP=Ws(),Eu=Ht(),Qs=new Array(256);for(Vr=0;Vr<256;Vr++)Qs[Vr]=Vr>=252?6:Vr>=248?5:Vr>=240?4:Vr>=224?3:Vr>=192?2:1;var Vr;Qs[254]=Qs[254]=1;var DP=function(r){var e,t,n,i,s,a=r.length,o=0;for(i=0;i<a;i++)t=r.charCodeAt(i),(t&64512)===55296&&i+1<a&&(n=r.charCodeAt(i+1),(n&64512)===56320&&(t=65536+(t-55296<<10)+(n-56320),i++)),o+=t<128?1:t<2048?2:t<65536?3:4;for(Dn.uint8array?e=new Uint8Array(o):e=new Array(o),s=0,i=0;s<o;i++)t=r.charCodeAt(i),(t&64512)===55296&&i+1<a&&(n=r.charCodeAt(i+1),(n&64512)===56320&&(t=65536+(t-55296<<10)+(n-56320),i++)),t<128?e[s++]=t:t<2048?(e[s++]=192|t>>>6,e[s++]=128|t&63):t<65536?(e[s++]=224|t>>>12,e[s++]=128|t>>>6&63,e[s++]=128|t&63):(e[s++]=240|t>>>18,e[s++]=128|t>>>12&63,e[s++]=128|t>>>6&63,e[s++]=128|t&63);return e},FP=function(r,e){var t;for(e=e||r.length,e>r.length&&(e=r.length),t=e-1;t>=0&&(r[t]&192)===128;)t--;return t<0||t===0?e:t+Qs[r[t]]>e?t:e},$P=function(r){var e,t,n,i,s=r.length,a=new Array(s*2);for(t=0,e=0;e<s;){if(n=r[e++],n<128){a[t++]=n;continue}if(i=Qs[n],i>4){a[t++]=65533,e+=i-1;continue}for(n&=i===2?31:i===3?15:7;i>1&&e<s;)n=n<<6|r[e++]&63,i--;if(i>1){a[t++]=65533;continue}n<65536?a[t++]=n:(n-=65536,a[t++]=55296|n>>10&1023,a[t++]=56320|n&1023)}return a.length!==t&&(a.subarray?a=a.subarray(0,t):a.length=t),Ii.applyFromCharCode(a)};fn.utf8encode=function(e){return Dn.nodebuffer?BP.newBufferFrom(e,"utf-8"):DP(e)};fn.utf8decode=function(e){return Dn.nodebuffer?Ii.transformTo("nodebuffer",e).toString("utf-8"):(e=Ii.transformTo(Dn.uint8array?"uint8array":"array",e),$P(e))};function Au(){Eu.call(this,"utf-8 decode"),this.leftOver=null}Ii.inherits(Au,Eu);Au.prototype.processChunk=function(r){var e=Ii.transformTo(Dn.uint8array?"uint8array":"array",r.data);if(this.leftOver&&this.leftOver.length){if(Dn.uint8array){var t=e;e=new Uint8Array(t.length+this.leftOver.length),e.set(this.leftOver,0),e.set(t,this.leftOver.length)}else e=this.leftOver.concat(e);this.leftOver=null}var n=FP(e),i=e;n!==e.length&&(Dn.uint8array?(i=e.subarray(0,n),this.leftOver=e.subarray(n,e.length)):(i=e.slice(0,n),this.leftOver=e.slice(n,e.length))),this.push({data:fn.utf8decode(i),meta:r.meta})};Au.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:fn.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)};fn.Utf8DecodeWorker=Au;function sf(){Eu.call(this,"utf-8 encode")}Ii.inherits(sf,Eu);sf.prototype.processChunk=function(r){this.push({data:fn.utf8encode(r.data),meta:r.meta})};fn.Utf8EncodeWorker=sf});var kv=j((J9,Cv)=>{"use strict";var Tv=Ht(),_v=je();function af(r){Tv.call(this,"ConvertWorker to "+r),this.destType=r}_v.inherits(af,Tv);af.prototype.processChunk=function(r){this.push({data:_v.transformTo(this.destType,r.data),meta:r.meta})};Cv.exports=af});var Pv=j((e7,Rv)=>{"use strict";var Iv=Vd().Readable,UP=je();UP.inherits(of,Iv);function of(r,e,t){Iv.call(this,e),this._helper=r;var n=this;r.on("data",function(i,s){n.push(i)||n._helper.pause(),t&&t(s)}).on("error",function(i){n.emit("error",i)}).on("end",function(){n.push(null)})}of.prototype._read=function(){this._helper.resume()};Rv.exports=of});var uf=j((t7,Nv)=>{"use strict";var Fn=je(),zP=kv(),jP=Ht(),HP=Xd(),WP=Wr(),VP=Ci(),Ov=null;if(WP.nodestream)try{Ov=Pv()}catch{}function GP(r,e,t){switch(r){case"blob":return Fn.newBlob(Fn.transformTo("arraybuffer",e),t);case"base64":return HP.encode(e);default:return Fn.transformTo(r,e)}}function qP(r,e){var t,n=0,i=null,s=0;for(t=0;t<e.length;t++)s+=e[t].length;switch(r){case"string":return e.join("");case"array":return Array.prototype.concat.apply([],e);case"uint8array":for(i=new Uint8Array(s),t=0;t<e.length;t++)i.set(e[t],n),n+=e[t].length;return i;case"nodebuffer":return Buffer.concat(e);default:throw new Error("concat : unsupported type '"+r+"'")}}function KP(r,e){return new VP.Promise(function(t,n){var i=[],s=r._internalType,a=r._outputType,o=r._mimeType;r.on("data",function(u,l){i.push(u),e&&e(l)}).on("error",function(u){i=[],n(u)}).on("end",function(){try{var u=GP(a,qP(s,i),o);t(u)}catch(l){n(l)}i=[]}).resume()})}function Lv(r,e,t){var n=e;switch(e){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string";break}try{this._internalType=n,this._outputType=e,this._mimeType=t,Fn.checkSupport(n),this._worker=r.pipe(new zP(n)),r.lock()}catch(i){this._worker=new jP("error"),this._worker.error(i)}}Lv.prototype={accumulate:function(r){return KP(this,r)},on:function(r,e){var t=this;return r==="data"?this._worker.on(r,function(n){e.call(t,n.data,n.meta)}):this._worker.on(r,function(){Fn.delay(e,arguments,t)}),this},resume:function(){return Fn.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(r){if(Fn.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new Ov(this,{objectMode:this._outputType!=="nodebuffer"},r)}};Nv.exports=Lv});var lf=j(pr=>{"use strict";pr.base64=!1;pr.binary=!1;pr.dir=!1;pr.createFolders=!0;pr.date=null;pr.compression=null;pr.compressionOptions=null;pr.comment=null;pr.unixPermissions=null;pr.dosPermissions=null});var cf=j((n7,Mv)=>{"use strict";var Tu=je(),_u=Ht(),XP=16*1024;function Pi(r){_u.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,r.then(function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=Tu.getTypeOf(t),e.isPaused||e._tickAndRepeat()},function(t){e.error(t)})}Tu.inherits(Pi,_u);Pi.prototype.cleanUp=function(){_u.prototype.cleanUp.call(this),this.data=null};Pi.prototype.resume=function(){return _u.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,Tu.delay(this._tickAndRepeat,[],this)),!0):!1};Pi.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(Tu.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};Pi.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var r=XP,e=null,t=Math.min(this.max,this.index+r);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t);break}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})};Mv.exports=Pi});var Cu=j((i7,Dv)=>{"use strict";var YP=je();function QP(){for(var r,e=[],t=0;t<256;t++){r=t;for(var n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r}return e}var Bv=QP();function ZP(r,e,t,n){var i=Bv,s=n+t;r=r^-1;for(var a=n;a<s;a++)r=r>>>8^i[(r^e[a])&255];return r^-1}function JP(r,e,t,n){var i=Bv,s=n+t;r=r^-1;for(var a=n;a<s;a++)r=r>>>8^i[(r^e.charCodeAt(a))&255];return r^-1}Dv.exports=function(e,t){if(typeof e>"u"||!e.length)return 0;var n=YP.getTypeOf(e)!=="string";return n?ZP(t|0,e,e.length,0):JP(t|0,e,e.length,0)}});var df=j((s7,$v)=>{"use strict";var Fv=Ht(),e4=Cu(),t4=je();function hf(){Fv.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t4.inherits(hf,Fv);hf.prototype.processChunk=function(r){this.streamInfo.crc32=e4(r.data,this.streamInfo.crc32||0),this.push(r)};$v.exports=hf});var zv=j((a7,Uv)=>{"use strict";var r4=je(),ff=Ht();function pf(r){ff.call(this,"DataLengthProbe for "+r),this.propName=r,this.withStreamInfo(r,0)}r4.inherits(pf,ff);pf.prototype.processChunk=function(r){if(r){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+r.data.length}ff.prototype.processChunk.call(this,r)};Uv.exports=pf});var ku=j((o7,Wv)=>{"use strict";var jv=Ci(),Hv=cf(),n4=df(),gf=zv();function mf(r,e,t,n,i){this.compressedSize=r,this.uncompressedSize=e,this.crc32=t,this.compression=n,this.compressedContent=i}mf.prototype={getContentWorker:function(){var r=new Hv(jv.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new gf("data_length")),e=this;return r.on("end",function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),r},getCompressedWorker:function(){return new Hv(jv.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};mf.createWorkerFrom=function(r,e,t){return r.pipe(new n4).pipe(new gf("uncompressedSize")).pipe(e.compressWorker(t)).pipe(new gf("compressedSize")).withStreamInfo("compression",e)};Wv.exports=mf});var Kv=j((u7,qv)=>{"use strict";var i4=uf(),s4=cf(),bf=Ri(),yf=ku(),Vv=Ht(),vf=function(r,e,t){this.name=r,this.dir=t.dir,this.date=t.date,this.comment=t.comment,this.unixPermissions=t.unixPermissions,this.dosPermissions=t.dosPermissions,this._data=e,this._dataBinary=t.binary,this.options={compression:t.compression,compressionOptions:t.compressionOptions}};vf.prototype={internalStream:function(r){var e=null,t="string";try{if(!r)throw new Error("No output type specified.");t=r.toLowerCase();var n=t==="string"||t==="text";(t==="binarystring"||t==="text")&&(t="string"),e=this._decompressWorker();var i=!this._dataBinary;i&&!n&&(e=e.pipe(new bf.Utf8EncodeWorker)),!i&&n&&(e=e.pipe(new bf.Utf8DecodeWorker))}catch(s){e=new Vv("error"),e.error(s)}return new i4(e,t,"")},async:function(r,e){return this.internalStream(r).accumulate(e)},nodeStream:function(r,e){return this.internalStream(r||"nodebuffer").toNodejsStream(e)},_compressWorker:function(r,e){if(this._data instanceof yf&&this._data.compression.magic===r.magic)return this._data.getCompressedWorker();var t=this._decompressWorker();return this._dataBinary||(t=t.pipe(new bf.Utf8EncodeWorker)),yf.createWorkerFrom(t,r,e)},_decompressWorker:function(){return this._data instanceof yf?this._data.getContentWorker():this._data instanceof Vv?this._data:new s4(this._data)}};var Gv=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],a4=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(Iu=0;Iu<Gv.length;Iu++)vf.prototype[Gv[Iu]]=a4;var Iu;qv.exports=vf});var Gr=j(Ct=>{"use strict";var o4=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function u4(r,e){return Object.prototype.hasOwnProperty.call(r,e)}Ct.assign=function(r){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var t=e.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(var n in t)u4(t,n)&&(r[n]=t[n])}}return r};Ct.shrinkBuf=function(r,e){return r.length===e?r:r.subarray?r.subarray(0,e):(r.length=e,r)};var l4={arraySet:function(r,e,t,n,i){if(e.subarray&&r.subarray){r.set(e.subarray(t,t+n),i);return}for(var s=0;s<n;s++)r[i+s]=e[t+s]},flattenChunks:function(r){var e,t,n,i,s,a;for(n=0,e=0,t=r.length;e<t;e++)n+=r[e].length;for(a=new Uint8Array(n),i=0,e=0,t=r.length;e<t;e++)s=r[e],a.set(s,i),i+=s.length;return a}},c4={arraySet:function(r,e,t,n,i){for(var s=0;s<n;s++)r[i+s]=e[t+s]},flattenChunks:function(r){return[].concat.apply([],r)}};Ct.setTyped=function(r){r?(Ct.Buf8=Uint8Array,Ct.Buf16=Uint16Array,Ct.Buf32=Int32Array,Ct.assign(Ct,l4)):(Ct.Buf8=Array,Ct.Buf16=Array,Ct.Buf32=Array,Ct.assign(Ct,c4))};Ct.setTyped(o4)});var bw=j(Ni=>{"use strict";var h4=Gr(),d4=4,Xv=0,Yv=1,f4=2;function Li(r){for(var e=r.length;--e>=0;)r[e]=0}var p4=0,rw=1,g4=2,m4=3,b4=258,_f=29,na=256,Js=na+1+_f,Oi=30,Cf=19,nw=2*Js+1,$n=15,wf=16,y4=7,kf=256,iw=16,sw=17,aw=18,Af=[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],Ru=[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],v4=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ow=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],w4=512,qr=new Array((Js+2)*2);Li(qr);var Zs=new Array(Oi*2);Li(Zs);var ea=new Array(w4);Li(ea);var ta=new Array(b4-m4+1);Li(ta);var If=new Array(_f);Li(If);var Pu=new Array(Oi);Li(Pu);function xf(r,e,t,n,i){this.static_tree=r,this.extra_bits=e,this.extra_base=t,this.elems=n,this.max_length=i,this.has_stree=r&&r.length}var uw,lw,cw;function Sf(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}function hw(r){return r<256?ea[r]:ea[256+(r>>>7)]}function ra(r,e){r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255}function Mt(r,e,t){r.bi_valid>wf-t?(r.bi_buf|=e<<r.bi_valid&65535,ra(r,r.bi_buf),r.bi_buf=e>>wf-r.bi_valid,r.bi_valid+=t-wf):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)}function kr(r,e,t){Mt(r,t[e*2],t[e*2+1])}function dw(r,e){var t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1}function x4(r){r.bi_valid===16?(ra(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)}function S4(r,e){var t=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,s=e.stat_desc.has_stree,a=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,u=e.stat_desc.max_length,l,c,h,d,f,p,g=0;for(d=0;d<=$n;d++)r.bl_count[d]=0;for(t[r.heap[r.heap_max]*2+1]=0,l=r.heap_max+1;l<nw;l++)c=r.heap[l],d=t[t[c*2+1]*2+1]+1,d>u&&(d=u,g++),t[c*2+1]=d,!(c>n)&&(r.bl_count[d]++,f=0,c>=o&&(f=a[c-o]),p=t[c*2],r.opt_len+=p*(d+f),s&&(r.static_len+=p*(i[c*2+1]+f)));if(g!==0){do{for(d=u-1;r.bl_count[d]===0;)d--;r.bl_count[d]--,r.bl_count[d+1]+=2,r.bl_count[u]--,g-=2}while(g>0);for(d=u;d!==0;d--)for(c=r.bl_count[d];c!==0;)h=r.heap[--l],!(h>n)&&(t[h*2+1]!==d&&(r.opt_len+=(d-t[h*2+1])*t[h*2],t[h*2+1]=d),c--)}}function fw(r,e,t){var n=new Array($n+1),i=0,s,a;for(s=1;s<=$n;s++)n[s]=i=i+t[s-1]<<1;for(a=0;a<=e;a++){var o=r[a*2+1];o!==0&&(r[a*2]=dw(n[o]++,o))}}function E4(){var r,e,t,n,i,s=new Array($n+1);for(t=0,n=0;n<_f-1;n++)for(If[n]=t,r=0;r<1<<Af[n];r++)ta[t++]=n;for(ta[t-1]=n,i=0,n=0;n<16;n++)for(Pu[n]=i,r=0;r<1<<Ru[n];r++)ea[i++]=n;for(i>>=7;n<Oi;n++)for(Pu[n]=i<<7,r=0;r<1<<Ru[n]-7;r++)ea[256+i++]=n;for(e=0;e<=$n;e++)s[e]=0;for(r=0;r<=143;)qr[r*2+1]=8,r++,s[8]++;for(;r<=255;)qr[r*2+1]=9,r++,s[9]++;for(;r<=279;)qr[r*2+1]=7,r++,s[7]++;for(;r<=287;)qr[r*2+1]=8,r++,s[8]++;for(fw(qr,Js+1,s),r=0;r<Oi;r++)Zs[r*2+1]=5,Zs[r*2]=dw(r,5);uw=new xf(qr,Af,na+1,Js,$n),lw=new xf(Zs,Ru,0,Oi,$n),cw=new xf(new Array(0),v4,0,Cf,y4)}function pw(r){var e;for(e=0;e<Js;e++)r.dyn_ltree[e*2]=0;for(e=0;e<Oi;e++)r.dyn_dtree[e*2]=0;for(e=0;e<Cf;e++)r.bl_tree[e*2]=0;r.dyn_ltree[kf*2]=1,r.opt_len=r.static_len=0,r.last_lit=r.matches=0}function gw(r){r.bi_valid>8?ra(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0}function A4(r,e,t,n){gw(r),n&&(ra(r,t),ra(r,~t)),h4.arraySet(r.pending_buf,r.window,e,t,r.pending),r.pending+=t}function Qv(r,e,t,n){var i=e*2,s=t*2;return r[i]<r[s]||r[i]===r[s]&&n[e]<=n[t]}function Ef(r,e,t){for(var n=r.heap[t],i=t<<1;i<=r.heap_len&&(i<r.heap_len&&Qv(e,r.heap[i+1],r.heap[i],r.depth)&&i++,!Qv(e,n,r.heap[i],r.depth));)r.heap[t]=r.heap[i],t=i,i<<=1;r.heap[t]=n}function Zv(r,e,t){var n,i,s=0,a,o;if(r.last_lit!==0)do n=r.pending_buf[r.d_buf+s*2]<<8|r.pending_buf[r.d_buf+s*2+1],i=r.pending_buf[r.l_buf+s],s++,n===0?kr(r,i,e):(a=ta[i],kr(r,a+na+1,e),o=Af[a],o!==0&&(i-=If[a],Mt(r,i,o)),n--,a=hw(n),kr(r,a,t),o=Ru[a],o!==0&&(n-=Pu[a],Mt(r,n,o)));while(s<r.last_lit);kr(r,kf,e)}function Tf(r,e){var t=e.dyn_tree,n=e.stat_desc.static_tree,i=e.stat_desc.has_stree,s=e.stat_desc.elems,a,o,u=-1,l;for(r.heap_len=0,r.heap_max=nw,a=0;a<s;a++)t[a*2]!==0?(r.heap[++r.heap_len]=u=a,r.depth[a]=0):t[a*2+1]=0;for(;r.heap_len<2;)l=r.heap[++r.heap_len]=u<2?++u:0,t[l*2]=1,r.depth[l]=0,r.opt_len--,i&&(r.static_len-=n[l*2+1]);for(e.max_code=u,a=r.heap_len>>1;a>=1;a--)Ef(r,t,a);l=s;do a=r.heap[1],r.heap[1]=r.heap[r.heap_len--],Ef(r,t,1),o=r.heap[1],r.heap[--r.heap_max]=a,r.heap[--r.heap_max]=o,t[l*2]=t[a*2]+t[o*2],r.depth[l]=(r.depth[a]>=r.depth[o]?r.depth[a]:r.depth[o])+1,t[a*2+1]=t[o*2+1]=l,r.heap[1]=l++,Ef(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],S4(r,e),fw(t,u,r.bl_count)}function Jv(r,e,t){var n,i=-1,s,a=e[1],o=0,u=7,l=4;for(a===0&&(u=138,l=3),e[(t+1)*2+1]=65535,n=0;n<=t;n++)s=a,a=e[(n+1)*2+1],!(++o<u&&s===a)&&(o<l?r.bl_tree[s*2]+=o:s!==0?(s!==i&&r.bl_tree[s*2]++,r.bl_tree[iw*2]++):o<=10?r.bl_tree[sw*2]++:r.bl_tree[aw*2]++,o=0,i=s,a===0?(u=138,l=3):s===a?(u=6,l=3):(u=7,l=4))}function ew(r,e,t){var n,i=-1,s,a=e[1],o=0,u=7,l=4;for(a===0&&(u=138,l=3),n=0;n<=t;n++)if(s=a,a=e[(n+1)*2+1],!(++o<u&&s===a)){if(o<l)do kr(r,s,r.bl_tree);while(--o!==0);else s!==0?(s!==i&&(kr(r,s,r.bl_tree),o--),kr(r,iw,r.bl_tree),Mt(r,o-3,2)):o<=10?(kr(r,sw,r.bl_tree),Mt(r,o-3,3)):(kr(r,aw,r.bl_tree),Mt(r,o-11,7));o=0,i=s,a===0?(u=138,l=3):s===a?(u=6,l=3):(u=7,l=4)}}function T4(r){var e;for(Jv(r,r.dyn_ltree,r.l_desc.max_code),Jv(r,r.dyn_dtree,r.d_desc.max_code),Tf(r,r.bl_desc),e=Cf-1;e>=3&&r.bl_tree[ow[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e}function _4(r,e,t,n){var i;for(Mt(r,e-257,5),Mt(r,t-1,5),Mt(r,n-4,4),i=0;i<n;i++)Mt(r,r.bl_tree[ow[i]*2+1],3);ew(r,r.dyn_ltree,e-1),ew(r,r.dyn_dtree,t-1)}function C4(r){var e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return Xv;if(r.dyn_ltree[18]!==0||r.dyn_ltree[20]!==0||r.dyn_ltree[26]!==0)return Yv;for(t=32;t<na;t++)if(r.dyn_ltree[t*2]!==0)return Yv;return Xv}var tw=!1;function k4(r){tw||(E4(),tw=!0),r.l_desc=new Sf(r.dyn_ltree,uw),r.d_desc=new Sf(r.dyn_dtree,lw),r.bl_desc=new Sf(r.bl_tree,cw),r.bi_buf=0,r.bi_valid=0,pw(r)}function mw(r,e,t,n){Mt(r,(p4<<1)+(n?1:0),3),A4(r,e,t,!0)}function I4(r){Mt(r,rw<<1,3),kr(r,kf,qr),x4(r)}function R4(r,e,t,n){var i,s,a=0;r.level>0?(r.strm.data_type===f4&&(r.strm.data_type=C4(r)),Tf(r,r.l_desc),Tf(r,r.d_desc),a=T4(r),i=r.opt_len+3+7>>>3,s=r.static_len+3+7>>>3,s<=i&&(i=s)):i=s=t+5,t+4<=i&&e!==-1?mw(r,e,t,n):r.strategy===d4||s===i?(Mt(r,(rw<<1)+(n?1:0),3),Zv(r,qr,Zs)):(Mt(r,(g4<<1)+(n?1:0),3),_4(r,r.l_desc.max_code+1,r.d_desc.max_code+1,a+1),Zv(r,r.dyn_ltree,r.dyn_dtree)),pw(r),n&&gw(r)}function P4(r,e,t){return r.pending_buf[r.d_buf+r.last_lit*2]=e>>>8&255,r.pending_buf[r.d_buf+r.last_lit*2+1]=e&255,r.pending_buf[r.l_buf+r.last_lit]=t&255,r.last_lit++,e===0?r.dyn_ltree[t*2]++:(r.matches++,e--,r.dyn_ltree[(ta[t]+na+1)*2]++,r.dyn_dtree[hw(e)*2]++),r.last_lit===r.lit_bufsize-1}Ni._tr_init=k4;Ni._tr_stored_block=mw;Ni._tr_flush_block=R4;Ni._tr_tally=P4;Ni._tr_align=I4});var Rf=j((h7,yw)=>{"use strict";function O4(r,e,t,n){for(var i=r&65535|0,s=r>>>16&65535|0,a=0;t!==0;){a=t>2e3?2e3:t,t-=a;do i=i+e[n++]|0,s=s+i|0;while(--a);i%=65521,s%=65521}return i|s<<16|0}yw.exports=O4});var Pf=j((d7,vw)=>{"use strict";function L4(){for(var r,e=[],t=0;t<256;t++){r=t;for(var n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r}return e}var N4=L4();function M4(r,e,t,n){var i=N4,s=n+t;r^=-1;for(var a=n;a<s;a++)r=r>>>8^i[(r^e[a])&255];return r^-1}vw.exports=M4});var Ou=j((f7,ww)=>{"use strict";ww.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var Iw=j(Pr=>{"use strict";var kt=Gr(),er=bw(),Aw=Rf(),pn=Pf(),B4=Ou(),Hn=0,D4=1,F4=3,vn=4,xw=5,Rr=0,Sw=1,tr=-2,$4=-3,Of=-5,U4=-1,z4=1,Lu=2,j4=3,H4=4,W4=0,V4=2,Du=8,G4=9,q4=15,K4=8,X4=29,Y4=256,Nf=Y4+1+X4,Q4=30,Z4=19,J4=2*Nf+1,eO=15,ve=3,bn=258,gr=bn+ve+1,tO=32,Fu=42,Mf=69,Nu=73,Mu=91,Bu=103,Un=113,sa=666,at=1,aa=2,zn=3,Di=4,rO=3;function yn(r,e){return r.msg=B4[e],e}function Ew(r){return(r<<1)-(r>4?9:0)}function mn(r){for(var e=r.length;--e>=0;)r[e]=0}function gn(r){var e=r.state,t=e.pending;t>r.avail_out&&(t=r.avail_out),t!==0&&(kt.arraySet(r.output,e.pending_buf,e.pending_out,t,r.next_out),r.next_out+=t,e.pending_out+=t,r.total_out+=t,r.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))}function ft(r,e){er._tr_flush_block(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,gn(r.strm)}function Te(r,e){r.pending_buf[r.pending++]=e}function ia(r,e){r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255}function nO(r,e,t,n){var i=r.avail_in;return i>n&&(i=n),i===0?0:(r.avail_in-=i,kt.arraySet(e,r.input,r.next_in,i,t),r.state.wrap===1?r.adler=Aw(r.adler,e,i,t):r.state.wrap===2&&(r.adler=pn(r.adler,e,i,t)),r.next_in+=i,r.total_in+=i,i)}function Tw(r,e){var t=r.max_chain_length,n=r.strstart,i,s,a=r.prev_length,o=r.nice_match,u=r.strstart>r.w_size-gr?r.strstart-(r.w_size-gr):0,l=r.window,c=r.w_mask,h=r.prev,d=r.strstart+bn,f=l[n+a-1],p=l[n+a];r.prev_length>=r.good_match&&(t>>=2),o>r.lookahead&&(o=r.lookahead);do if(i=e,!(l[i+a]!==p||l[i+a-1]!==f||l[i]!==l[n]||l[++i]!==l[n+1])){n+=2,i++;do;while(l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&n<d);if(s=bn-(d-n),n=d-bn,s>a){if(r.match_start=e,a=s,s>=o)break;f=l[n+a-1],p=l[n+a]}}while((e=h[e&c])>u&&--t!==0);return a<=r.lookahead?a:r.lookahead}function jn(r){var e=r.w_size,t,n,i,s,a;do{if(s=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-gr)){kt.arraySet(r.window,r.window,e,e,0),r.match_start-=e,r.strstart-=e,r.block_start-=e,n=r.hash_size,t=n;do i=r.head[--t],r.head[t]=i>=e?i-e:0;while(--n);n=e,t=n;do i=r.prev[--t],r.prev[t]=i>=e?i-e:0;while(--n);s+=e}if(r.strm.avail_in===0)break;if(n=nO(r.strm,r.window,r.strstart+r.lookahead,s),r.lookahead+=n,r.lookahead+r.insert>=ve)for(a=r.strstart-r.insert,r.ins_h=r.window[a],r.ins_h=(r.ins_h<<r.hash_shift^r.window[a+1])&r.hash_mask;r.insert&&(r.ins_h=(r.ins_h<<r.hash_shift^r.window[a+ve-1])&r.hash_mask,r.prev[a&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=a,a++,r.insert--,!(r.lookahead+r.insert<ve)););}while(r.lookahead<gr&&r.strm.avail_in!==0)}function iO(r,e){var t=65535;for(t>r.pending_buf_size-5&&(t=r.pending_buf_size-5);;){if(r.lookahead<=1){if(jn(r),r.lookahead===0&&e===Hn)return at;if(r.lookahead===0)break}r.strstart+=r.lookahead,r.lookahead=0;var n=r.block_start+t;if((r.strstart===0||r.strstart>=n)&&(r.lookahead=r.strstart-n,r.strstart=n,ft(r,!1),r.strm.avail_out===0)||r.strstart-r.block_start>=r.w_size-gr&&(ft(r,!1),r.strm.avail_out===0))return at}return r.insert=0,e===vn?(ft(r,!0),r.strm.avail_out===0?zn:Di):(r.strstart>r.block_start&&(ft(r,!1),r.strm.avail_out===0),at)}function Lf(r,e){for(var t,n;;){if(r.lookahead<gr){if(jn(r),r.lookahead<gr&&e===Hn)return at;if(r.lookahead===0)break}if(t=0,r.lookahead>=ve&&(r.ins_h=(r.ins_h<<r.hash_shift^r.window[r.strstart+ve-1])&r.hash_mask,t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),t!==0&&r.strstart-t<=r.w_size-gr&&(r.match_length=Tw(r,t)),r.match_length>=ve)if(n=er._tr_tally(r,r.strstart-r.match_start,r.match_length-ve),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=ve){r.match_length--;do r.strstart++,r.ins_h=(r.ins_h<<r.hash_shift^r.window[r.strstart+ve-1])&r.hash_mask,t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=(r.ins_h<<r.hash_shift^r.window[r.strstart+1])&r.hash_mask;else n=er._tr_tally(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(n&&(ft(r,!1),r.strm.avail_out===0))return at}return r.insert=r.strstart<ve-1?r.strstart:ve-1,e===vn?(ft(r,!0),r.strm.avail_out===0?zn:Di):r.last_lit&&(ft(r,!1),r.strm.avail_out===0)?at:aa}function Mi(r,e){for(var t,n,i;;){if(r.lookahead<gr){if(jn(r),r.lookahead<gr&&e===Hn)return at;if(r.lookahead===0)break}if(t=0,r.lookahead>=ve&&(r.ins_h=(r.ins_h<<r.hash_shift^r.window[r.strstart+ve-1])&r.hash_mask,t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=ve-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-gr&&(r.match_length=Tw(r,t),r.match_length<=5&&(r.strategy===z4||r.match_length===ve&&r.strstart-r.match_start>4096)&&(r.match_length=ve-1)),r.prev_length>=ve&&r.match_length<=r.prev_length){i=r.strstart+r.lookahead-ve,n=er._tr_tally(r,r.strstart-1-r.prev_match,r.prev_length-ve),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=i&&(r.ins_h=(r.ins_h<<r.hash_shift^r.window[r.strstart+ve-1])&r.hash_mask,t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=ve-1,r.strstart++,n&&(ft(r,!1),r.strm.avail_out===0))return at}else if(r.match_available){if(n=er._tr_tally(r,0,r.window[r.strstart-1]),n&&ft(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return at}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(n=er._tr_tally(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<ve-1?r.strstart:ve-1,e===vn?(ft(r,!0),r.strm.avail_out===0?zn:Di):r.last_lit&&(ft(r,!1),r.strm.avail_out===0)?at:aa}function sO(r,e){for(var t,n,i,s,a=r.window;;){if(r.lookahead<=bn){if(jn(r),r.lookahead<=bn&&e===Hn)return at;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=ve&&r.strstart>0&&(i=r.strstart-1,n=a[i],n===a[++i]&&n===a[++i]&&n===a[++i])){s=r.strstart+bn;do;while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<s);r.match_length=bn-(s-i),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=ve?(t=er._tr_tally(r,1,r.match_length-ve),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=er._tr_tally(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&(ft(r,!1),r.strm.avail_out===0))return at}return r.insert=0,e===vn?(ft(r,!0),r.strm.avail_out===0?zn:Di):r.last_lit&&(ft(r,!1),r.strm.avail_out===0)?at:aa}function aO(r,e){for(var t;;){if(r.lookahead===0&&(jn(r),r.lookahead===0)){if(e===Hn)return at;break}if(r.match_length=0,t=er._tr_tally(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&(ft(r,!1),r.strm.avail_out===0))return at}return r.insert=0,e===vn?(ft(r,!0),r.strm.avail_out===0?zn:Di):r.last_lit&&(ft(r,!1),r.strm.avail_out===0)?at:aa}function Ir(r,e,t,n,i){this.good_length=r,this.max_lazy=e,this.nice_length=t,this.max_chain=n,this.func=i}var Bi;Bi=[new Ir(0,0,0,0,iO),new Ir(4,4,8,4,Lf),new Ir(4,5,16,8,Lf),new Ir(4,6,32,32,Lf),new Ir(4,4,16,16,Mi),new Ir(8,16,32,32,Mi),new Ir(8,16,128,128,Mi),new Ir(8,32,128,256,Mi),new Ir(32,128,258,1024,Mi),new Ir(32,258,258,4096,Mi)];function oO(r){r.window_size=2*r.w_size,mn(r.head),r.max_lazy_match=Bi[r.level].max_lazy,r.good_match=Bi[r.level].good_length,r.nice_match=Bi[r.level].nice_length,r.max_chain_length=Bi[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=ve-1,r.match_available=0,r.ins_h=0}function uO(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Du,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new kt.Buf16(J4*2),this.dyn_dtree=new kt.Buf16((2*Q4+1)*2),this.bl_tree=new kt.Buf16((2*Z4+1)*2),mn(this.dyn_ltree),mn(this.dyn_dtree),mn(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new kt.Buf16(eO+1),this.heap=new kt.Buf16(2*Nf+1),mn(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new kt.Buf16(2*Nf+1),mn(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function _w(r){var e;return!r||!r.state?yn(r,tr):(r.total_in=r.total_out=0,r.data_type=V4,e=r.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?Fu:Un,r.adler=e.wrap===2?0:1,e.last_flush=Hn,er._tr_init(e),Rr)}function Cw(r){var e=_w(r);return e===Rr&&oO(r.state),e}function lO(r,e){return!r||!r.state||r.state.wrap!==2?tr:(r.state.gzhead=e,Rr)}function kw(r,e,t,n,i,s){if(!r)return tr;var a=1;if(e===U4&&(e=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>G4||t!==Du||n<8||n>15||e<0||e>9||s<0||s>H4)return yn(r,tr);n===8&&(n=9);var o=new uO;return r.state=o,o.strm=r,o.wrap=a,o.gzhead=null,o.w_bits=n,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=i+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+ve-1)/ve),o.window=new kt.Buf8(o.w_size*2),o.head=new kt.Buf16(o.hash_size),o.prev=new kt.Buf16(o.w_size),o.lit_bufsize=1<<i+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new kt.Buf8(o.pending_buf_size),o.d_buf=1*o.lit_bufsize,o.l_buf=3*o.lit_bufsize,o.level=e,o.strategy=s,o.method=t,Cw(r)}function cO(r,e){return kw(r,e,Du,q4,K4,W4)}function hO(r,e){var t,n,i,s;if(!r||!r.state||e>xw||e<0)return r?yn(r,tr):tr;if(n=r.state,!r.output||!r.input&&r.avail_in!==0||n.status===sa&&e!==vn)return yn(r,r.avail_out===0?Of:tr);if(n.strm=r,t=n.last_flush,n.last_flush=e,n.status===Fu)if(n.wrap===2)r.adler=0,Te(n,31),Te(n,139),Te(n,8),n.gzhead?(Te(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Te(n,n.gzhead.time&255),Te(n,n.gzhead.time>>8&255),Te(n,n.gzhead.time>>16&255),Te(n,n.gzhead.time>>24&255),Te(n,n.level===9?2:n.strategy>=Lu||n.level<2?4:0),Te(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Te(n,n.gzhead.extra.length&255),Te(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(r.adler=pn(r.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Mf):(Te(n,0),Te(n,0),Te(n,0),Te(n,0),Te(n,0),Te(n,n.level===9?2:n.strategy>=Lu||n.level<2?4:0),Te(n,rO),n.status=Un);else{var a=Du+(n.w_bits-8<<4)<<8,o=-1;n.strategy>=Lu||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,a|=o<<6,n.strstart!==0&&(a|=tO),a+=31-a%31,n.status=Un,ia(n,a),n.strstart!==0&&(ia(n,r.adler>>>16),ia(n,r.adler&65535)),r.adler=1}if(n.status===Mf)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(n.gzhead.extra.length&65535)&&!(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(r.adler=pn(r.adler,n.pending_buf,n.pending-i,i)),gn(r),i=n.pending,n.pending===n.pending_buf_size));)Te(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(r.adler=pn(r.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=Nu)}else n.status=Nu;if(n.status===Nu)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(r.adler=pn(r.adler,n.pending_buf,n.pending-i,i)),gn(r),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}n.gzindex<n.gzhead.name.length?s=n.gzhead.name.charCodeAt(n.gzindex++)&255:s=0,Te(n,s)}while(s!==0);n.gzhead.hcrc&&n.pending>i&&(r.adler=pn(r.adler,n.pending_buf,n.pending-i,i)),s===0&&(n.gzindex=0,n.status=Mu)}else n.status=Mu;if(n.status===Mu)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(r.adler=pn(r.adler,n.pending_buf,n.pending-i,i)),gn(r),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}n.gzindex<n.gzhead.comment.length?s=n.gzhead.comment.charCodeAt(n.gzindex++)&255:s=0,Te(n,s)}while(s!==0);n.gzhead.hcrc&&n.pending>i&&(r.adler=pn(r.adler,n.pending_buf,n.pending-i,i)),s===0&&(n.status=Bu)}else n.status=Bu;if(n.status===Bu&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&gn(r),n.pending+2<=n.pending_buf_size&&(Te(n,r.adler&255),Te(n,r.adler>>8&255),r.adler=0,n.status=Un)):n.status=Un),n.pending!==0){if(gn(r),r.avail_out===0)return n.last_flush=-1,Rr}else if(r.avail_in===0&&Ew(e)<=Ew(t)&&e!==vn)return yn(r,Of);if(n.status===sa&&r.avail_in!==0)return yn(r,Of);if(r.avail_in!==0||n.lookahead!==0||e!==Hn&&n.status!==sa){var u=n.strategy===Lu?aO(n,e):n.strategy===j4?sO(n,e):Bi[n.level].func(n,e);if((u===zn||u===Di)&&(n.status=sa),u===at||u===zn)return r.avail_out===0&&(n.last_flush=-1),Rr;if(u===aa&&(e===D4?er._tr_align(n):e!==xw&&(er._tr_stored_block(n,0,0,!1),e===F4&&(mn(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),gn(r),r.avail_out===0))return n.last_flush=-1,Rr}return e!==vn?Rr:n.wrap<=0?Sw:(n.wrap===2?(Te(n,r.adler&255),Te(n,r.adler>>8&255),Te(n,r.adler>>16&255),Te(n,r.adler>>24&255),Te(n,r.total_in&255),Te(n,r.total_in>>8&255),Te(n,r.total_in>>16&255),Te(n,r.total_in>>24&255)):(ia(n,r.adler>>>16),ia(n,r.adler&65535)),gn(r),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Rr:Sw)}function dO(r){var e;return!r||!r.state?tr:(e=r.state.status,e!==Fu&&e!==Mf&&e!==Nu&&e!==Mu&&e!==Bu&&e!==Un&&e!==sa?yn(r,tr):(r.state=null,e===Un?yn(r,$4):Rr))}function fO(r,e){var t=e.length,n,i,s,a,o,u,l,c;if(!r||!r.state||(n=r.state,a=n.wrap,a===2||a===1&&n.status!==Fu||n.lookahead))return tr;for(a===1&&(r.adler=Aw(r.adler,e,t,0)),n.wrap=0,t>=n.w_size&&(a===0&&(mn(n.head),n.strstart=0,n.block_start=0,n.insert=0),c=new kt.Buf8(n.w_size),kt.arraySet(c,e,t-n.w_size,n.w_size,0),e=c,t=n.w_size),o=r.avail_in,u=r.next_in,l=r.input,r.avail_in=t,r.next_in=0,r.input=e,jn(n);n.lookahead>=ve;){i=n.strstart,s=n.lookahead-(ve-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[i+ve-1])&n.hash_mask,n.prev[i&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=i,i++;while(--s);n.strstart=i,n.lookahead=ve-1,jn(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=ve-1,n.match_available=0,r.next_in=u,r.input=l,r.avail_in=o,n.wrap=a,Rr}Pr.deflateInit=cO;Pr.deflateInit2=kw;Pr.deflateReset=Cw;Pr.deflateResetKeep=_w;Pr.deflateSetHeader=lO;Pr.deflate=hO;Pr.deflateEnd=dO;Pr.deflateSetDictionary=fO;Pr.deflateInfo="pako deflate (from Nodeca project)"});var Bf=j(Fi=>{"use strict";var $u=Gr(),Rw=!0,Pw=!0;try{String.fromCharCode.apply(null,[0])}catch{Rw=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Pw=!1}var oa=new $u.Buf8(256);for(Kr=0;Kr<256;Kr++)oa[Kr]=Kr>=252?6:Kr>=248?5:Kr>=240?4:Kr>=224?3:Kr>=192?2:1;var Kr;oa[254]=oa[254]=1;Fi.string2buf=function(r){var e,t,n,i,s,a=r.length,o=0;for(i=0;i<a;i++)t=r.charCodeAt(i),(t&64512)===55296&&i+1<a&&(n=r.charCodeAt(i+1),(n&64512)===56320&&(t=65536+(t-55296<<10)+(n-56320),i++)),o+=t<128?1:t<2048?2:t<65536?3:4;for(e=new $u.Buf8(o),s=0,i=0;s<o;i++)t=r.charCodeAt(i),(t&64512)===55296&&i+1<a&&(n=r.charCodeAt(i+1),(n&64512)===56320&&(t=65536+(t-55296<<10)+(n-56320),i++)),t<128?e[s++]=t:t<2048?(e[s++]=192|t>>>6,e[s++]=128|t&63):t<65536?(e[s++]=224|t>>>12,e[s++]=128|t>>>6&63,e[s++]=128|t&63):(e[s++]=240|t>>>18,e[s++]=128|t>>>12&63,e[s++]=128|t>>>6&63,e[s++]=128|t&63);return e};function Ow(r,e){if(e<65534&&(r.subarray&&Pw||!r.subarray&&Rw))return String.fromCharCode.apply(null,$u.shrinkBuf(r,e));for(var t="",n=0;n<e;n++)t+=String.fromCharCode(r[n]);return t}Fi.buf2binstring=function(r){return Ow(r,r.length)};Fi.binstring2buf=function(r){for(var e=new $u.Buf8(r.length),t=0,n=e.length;t<n;t++)e[t]=r.charCodeAt(t);return e};Fi.buf2string=function(r,e){var t,n,i,s,a=e||r.length,o=new Array(a*2);for(n=0,t=0;t<a;){if(i=r[t++],i<128){o[n++]=i;continue}if(s=oa[i],s>4){o[n++]=65533,t+=s-1;continue}for(i&=s===2?31:s===3?15:7;s>1&&t<a;)i=i<<6|r[t++]&63,s--;if(s>1){o[n++]=65533;continue}i<65536?o[n++]=i:(i-=65536,o[n++]=55296|i>>10&1023,o[n++]=56320|i&1023)}return Ow(o,n)};Fi.utf8border=function(r,e){var t;for(e=e||r.length,e>r.length&&(e=r.length),t=e-1;t>=0&&(r[t]&192)===128;)t--;return t<0||t===0?e:t+oa[r[t]]>e?t:e}});var Df=j((m7,Lw)=>{"use strict";function pO(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}Lw.exports=pO});var Dw=j(ca=>{"use strict";var ua=Iw(),la=Gr(),$f=Bf(),Uf=Ou(),gO=Df(),Bw=Object.prototype.toString,mO=0,Ff=4,$i=0,Nw=1,Mw=2,bO=-1,yO=0,vO=8;function Wn(r){if(!(this instanceof Wn))return new Wn(r);this.options=la.assign({level:bO,method:vO,chunkSize:16384,windowBits:15,memLevel:8,strategy:yO,to:""},r||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gO,this.strm.avail_out=0;var t=ua.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==$i)throw new Error(Uf[t]);if(e.header&&ua.deflateSetHeader(this.strm,e.header),e.dictionary){var n;if(typeof e.dictionary=="string"?n=$f.string2buf(e.dictionary):Bw.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,t=ua.deflateSetDictionary(this.strm,n),t!==$i)throw new Error(Uf[t]);this._dict_set=!0}}Wn.prototype.push=function(r,e){var t=this.strm,n=this.options.chunkSize,i,s;if(this.ended)return!1;s=e===~~e?e:e===!0?Ff:mO,typeof r=="string"?t.input=$f.string2buf(r):Bw.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;do{if(t.avail_out===0&&(t.output=new la.Buf8(n),t.next_out=0,t.avail_out=n),i=ua.deflate(t,s),i!==Nw&&i!==$i)return this.onEnd(i),this.ended=!0,!1;(t.avail_out===0||t.avail_in===0&&(s===Ff||s===Mw))&&(this.options.to==="string"?this.onData($f.buf2binstring(la.shrinkBuf(t.output,t.next_out))):this.onData(la.shrinkBuf(t.output,t.next_out)))}while((t.avail_in>0||t.avail_out===0)&&i!==Nw);return s===Ff?(i=ua.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===$i):(s===Mw&&(this.onEnd($i),t.avail_out=0),!0)};Wn.prototype.onData=function(r){this.chunks.push(r)};Wn.prototype.onEnd=function(r){r===$i&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=la.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function zf(r,e){var t=new Wn(e);if(t.push(r,!0),t.err)throw t.msg||Uf[t.err];return t.result}function wO(r,e){return e=e||{},e.raw=!0,zf(r,e)}function xO(r,e){return e=e||{},e.gzip=!0,zf(r,e)}ca.Deflate=Wn;ca.deflate=zf;ca.deflateRaw=wO;ca.gzip=xO});var $w=j((y7,Fw)=>{"use strict";var Uu=30,SO=12;Fw.exports=function(e,t){var n,i,s,a,o,u,l,c,h,d,f,p,g,b,m,y,v,x,w,S,E,_,T,k,A;n=e.state,i=e.next_in,k=e.input,s=i+(e.avail_in-5),a=e.next_out,A=e.output,o=a-(t-e.avail_out),u=a+(e.avail_out-257),l=n.dmax,c=n.wsize,h=n.whave,d=n.wnext,f=n.window,p=n.hold,g=n.bits,b=n.lencode,m=n.distcode,y=(1<<n.lenbits)-1,v=(1<<n.distbits)-1;e:do{g<15&&(p+=k[i++]<<g,g+=8,p+=k[i++]<<g,g+=8),x=b[p&y];t:for(;;){if(w=x>>>24,p>>>=w,g-=w,w=x>>>16&255,w===0)A[a++]=x&65535;else if(w&16){S=x&65535,w&=15,w&&(g<w&&(p+=k[i++]<<g,g+=8),S+=p&(1<<w)-1,p>>>=w,g-=w),g<15&&(p+=k[i++]<<g,g+=8,p+=k[i++]<<g,g+=8),x=m[p&v];r:for(;;){if(w=x>>>24,p>>>=w,g-=w,w=x>>>16&255,w&16){if(E=x&65535,w&=15,g<w&&(p+=k[i++]<<g,g+=8,g<w&&(p+=k[i++]<<g,g+=8)),E+=p&(1<<w)-1,E>l){e.msg="invalid distance too far back",n.mode=Uu;break e}if(p>>>=w,g-=w,w=a-o,E>w){if(w=E-w,w>h&&n.sane){e.msg="invalid distance too far back",n.mode=Uu;break e}if(_=0,T=f,d===0){if(_+=c-w,w<S){S-=w;do A[a++]=f[_++];while(--w);_=a-E,T=A}}else if(d<w){if(_+=c+d-w,w-=d,w<S){S-=w;do A[a++]=f[_++];while(--w);if(_=0,d<S){w=d,S-=w;do A[a++]=f[_++];while(--w);_=a-E,T=A}}}else if(_+=d-w,w<S){S-=w;do A[a++]=f[_++];while(--w);_=a-E,T=A}for(;S>2;)A[a++]=T[_++],A[a++]=T[_++],A[a++]=T[_++],S-=3;S&&(A[a++]=T[_++],S>1&&(A[a++]=T[_++]))}else{_=a-E;do A[a++]=A[_++],A[a++]=A[_++],A[a++]=A[_++],S-=3;while(S>2);S&&(A[a++]=A[_++],S>1&&(A[a++]=A[_++]))}}else if((w&64)===0){x=m[(x&65535)+(p&(1<<w)-1)];continue r}else{e.msg="invalid distance code",n.mode=Uu;break e}break}}else if((w&64)===0){x=b[(x&65535)+(p&(1<<w)-1)];continue t}else if(w&32){n.mode=SO;break e}else{e.msg="invalid literal/length code",n.mode=Uu;break e}break}}while(i<s&&a<u);S=g>>3,i-=S,g-=S<<3,p&=(1<<g)-1,e.next_in=i,e.next_out=a,e.avail_in=i<s?5+(s-i):5-(i-s),e.avail_out=a<u?257+(u-a):257-(a-u),n.hold=p,n.bits=g}});var Gw=j((v7,Vw)=>{"use strict";var Uw=Gr(),Ui=15,zw=852,jw=592,Hw=0,jf=1,Ww=2,EO=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],AO=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],TO=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],_O=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];Vw.exports=function(e,t,n,i,s,a,o,u){var l=u.bits,c=0,h=0,d=0,f=0,p=0,g=0,b=0,m=0,y=0,v=0,x,w,S,E,_,T=null,k=0,A,B=new Uw.Buf16(Ui+1),D=new Uw.Buf16(Ui+1),P=null,M=0,L,N,I;for(c=0;c<=Ui;c++)B[c]=0;for(h=0;h<i;h++)B[t[n+h]]++;for(p=l,f=Ui;f>=1&&B[f]===0;f--);if(p>f&&(p=f),f===0)return s[a++]=1<<24|64<<16|0,s[a++]=1<<24|64<<16|0,u.bits=1,0;for(d=1;d<f&&B[d]===0;d++);for(p<d&&(p=d),m=1,c=1;c<=Ui;c++)if(m<<=1,m-=B[c],m<0)return-1;if(m>0&&(e===Hw||f!==1))return-1;for(D[1]=0,c=1;c<Ui;c++)D[c+1]=D[c]+B[c];for(h=0;h<i;h++)t[n+h]!==0&&(o[D[t[n+h]]++]=h);if(e===Hw?(T=P=o,A=19):e===jf?(T=EO,k-=257,P=AO,M-=257,A=256):(T=TO,P=_O,A=-1),v=0,h=0,c=d,_=a,g=p,b=0,S=-1,y=1<<p,E=y-1,e===jf&&y>zw||e===Ww&&y>jw)return 1;for(;;){L=c-b,o[h]<A?(N=0,I=o[h]):o[h]>A?(N=P[M+o[h]],I=T[k+o[h]]):(N=96,I=0),x=1<<c-b,w=1<<g,d=w;do w-=x,s[_+(v>>b)+w]=L<<24|N<<16|I|0;while(w!==0);for(x=1<<c-1;v&x;)x>>=1;if(x!==0?(v&=x-1,v+=x):v=0,h++,--B[c]===0){if(c===f)break;c=t[n+o[h]]}if(c>p&&(v&E)!==S){for(b===0&&(b=p),_+=d,g=c-b,m=1<<g;g+b<f&&(m-=B[g+b],!(m<=0));)g++,m<<=1;if(y+=1<<g,e===jf&&y>zw||e===Ww&&y>jw)return 1;S=v&E,s[S]=p<<24|g<<16|_-a|0}}return v!==0&&(s[_+v]=c-b<<24|64<<16|0),u.bits=p,0}});var Cx=j(mr=>{"use strict";var Wt=Gr(),Kf=Rf(),Or=Pf(),CO=$w(),ha=Gw(),kO=0,yx=1,vx=2,qw=4,IO=5,zu=6,Vn=0,RO=1,PO=2,rr=-2,wx=-3,Xf=-4,OO=-5,Kw=8,xx=1,Xw=2,Yw=3,Qw=4,Zw=5,Jw=6,ex=7,tx=8,rx=9,nx=10,Wu=11,Xr=12,Hf=13,ix=14,Wf=15,sx=16,ax=17,ox=18,ux=19,ju=20,Hu=21,lx=22,cx=23,hx=24,dx=25,fx=26,Vf=27,px=28,gx=29,ze=30,Yf=31,LO=32,NO=852,MO=592,BO=15,DO=BO;function mx(r){return(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24)}function FO(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Wt.Buf16(320),this.work=new Wt.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Sx(r){var e;return!r||!r.state?rr:(e=r.state,r.total_in=r.total_out=e.total=0,r.msg="",e.wrap&&(r.adler=e.wrap&1),e.mode=xx,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Wt.Buf32(NO),e.distcode=e.distdyn=new Wt.Buf32(MO),e.sane=1,e.back=-1,Vn)}function Ex(r){var e;return!r||!r.state?rr:(e=r.state,e.wsize=0,e.whave=0,e.wnext=0,Sx(r))}function Ax(r,e){var t,n;return!r||!r.state||(n=r.state,e<0?(t=0,e=-e):(t=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?rr:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=t,n.wbits=e,Ex(r))}function Tx(r,e){var t,n;return r?(n=new FO,r.state=n,n.window=null,t=Ax(r,e),t!==Vn&&(r.state=null),t):rr}function $O(r){return Tx(r,DO)}var bx=!0,Gf,qf;function UO(r){if(bx){var e;for(Gf=new Wt.Buf32(512),qf=new Wt.Buf32(32),e=0;e<144;)r.lens[e++]=8;for(;e<256;)r.lens[e++]=9;for(;e<280;)r.lens[e++]=7;for(;e<288;)r.lens[e++]=8;for(ha(yx,r.lens,0,288,Gf,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;ha(vx,r.lens,0,32,qf,0,r.work,{bits:5}),bx=!1}r.lencode=Gf,r.lenbits=9,r.distcode=qf,r.distbits=5}function _x(r,e,t,n){var i,s=r.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Wt.Buf8(s.wsize)),n>=s.wsize?(Wt.arraySet(s.window,e,t-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>n&&(i=n),Wt.arraySet(s.window,e,t-n,i,s.wnext),n-=i,n?(Wt.arraySet(s.window,e,t-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0}function zO(r,e){var t,n,i,s,a,o,u,l,c,h,d,f,p,g,b=0,m,y,v,x,w,S,E,_,T=new Wt.Buf8(4),k,A,B=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!r||!r.state||!r.output||!r.input&&r.avail_in!==0)return rr;t=r.state,t.mode===Xr&&(t.mode=Hf),a=r.next_out,i=r.output,u=r.avail_out,s=r.next_in,n=r.input,o=r.avail_in,l=t.hold,c=t.bits,h=o,d=u,_=Vn;e:for(;;)switch(t.mode){case xx:if(t.wrap===0){t.mode=Hf;break}for(;c<16;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}if(t.wrap&2&&l===35615){t.check=0,T[0]=l&255,T[1]=l>>>8&255,t.check=Or(t.check,T,2,0),l=0,c=0,t.mode=Xw;break}if(t.flags=0,t.head&&(t.head.done=!1),!(t.wrap&1)||(((l&255)<<8)+(l>>8))%31){r.msg="incorrect header check",t.mode=ze;break}if((l&15)!==Kw){r.msg="unknown compression method",t.mode=ze;break}if(l>>>=4,c-=4,E=(l&15)+8,t.wbits===0)t.wbits=E;else if(E>t.wbits){r.msg="invalid window size",t.mode=ze;break}t.dmax=1<<E,r.adler=t.check=1,t.mode=l&512?nx:Xr,l=0,c=0;break;case Xw:for(;c<16;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}if(t.flags=l,(t.flags&255)!==Kw){r.msg="unknown compression method",t.mode=ze;break}if(t.flags&57344){r.msg="unknown header flags set",t.mode=ze;break}t.head&&(t.head.text=l>>8&1),t.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,t.check=Or(t.check,T,2,0)),l=0,c=0,t.mode=Yw;case Yw:for(;c<32;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}t.head&&(t.head.time=l),t.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,T[2]=l>>>16&255,T[3]=l>>>24&255,t.check=Or(t.check,T,4,0)),l=0,c=0,t.mode=Qw;case Qw:for(;c<16;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}t.head&&(t.head.xflags=l&255,t.head.os=l>>8),t.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,t.check=Or(t.check,T,2,0)),l=0,c=0,t.mode=Zw;case Zw:if(t.flags&1024){for(;c<16;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}t.length=l,t.head&&(t.head.extra_len=l),t.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,t.check=Or(t.check,T,2,0)),l=0,c=0}else t.head&&(t.head.extra=null);t.mode=Jw;case Jw:if(t.flags&1024&&(f=t.length,f>o&&(f=o),f&&(t.head&&(E=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Array(t.head.extra_len)),Wt.arraySet(t.head.extra,n,s,f,E)),t.flags&512&&(t.check=Or(t.check,n,f,s)),o-=f,s+=f,t.length-=f),t.length))break e;t.length=0,t.mode=ex;case ex:if(t.flags&2048){if(o===0)break e;f=0;do E=n[s+f++],t.head&&E&&t.length<65536&&(t.head.name+=String.fromCharCode(E));while(E&&f<o);if(t.flags&512&&(t.check=Or(t.check,n,f,s)),o-=f,s+=f,E)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=tx;case tx:if(t.flags&4096){if(o===0)break e;f=0;do E=n[s+f++],t.head&&E&&t.length<65536&&(t.head.comment+=String.fromCharCode(E));while(E&&f<o);if(t.flags&512&&(t.check=Or(t.check,n,f,s)),o-=f,s+=f,E)break e}else t.head&&(t.head.comment=null);t.mode=rx;case rx:if(t.flags&512){for(;c<16;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}if(l!==(t.check&65535)){r.msg="header crc mismatch",t.mode=ze;break}l=0,c=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),r.adler=t.check=0,t.mode=Xr;break;case nx:for(;c<32;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}r.adler=t.check=mx(l),l=0,c=0,t.mode=Wu;case Wu:if(t.havedict===0)return r.next_out=a,r.avail_out=u,r.next_in=s,r.avail_in=o,t.hold=l,t.bits=c,PO;r.adler=t.check=1,t.mode=Xr;case Xr:if(e===IO||e===zu)break e;case Hf:if(t.last){l>>>=c&7,c-=c&7,t.mode=Vf;break}for(;c<3;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}switch(t.last=l&1,l>>>=1,c-=1,l&3){case 0:t.mode=ix;break;case 1:if(UO(t),t.mode=ju,e===zu){l>>>=2,c-=2;break e}break;case 2:t.mode=ax;break;case 3:r.msg="invalid block type",t.mode=ze}l>>>=2,c-=2;break;case ix:for(l>>>=c&7,c-=c&7;c<32;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}if((l&65535)!==(l>>>16^65535)){r.msg="invalid stored block lengths",t.mode=ze;break}if(t.length=l&65535,l=0,c=0,t.mode=Wf,e===zu)break e;case Wf:t.mode=sx;case sx:if(f=t.length,f){if(f>o&&(f=o),f>u&&(f=u),f===0)break e;Wt.arraySet(i,n,s,f,a),o-=f,s+=f,u-=f,a+=f,t.length-=f;break}t.mode=Xr;break;case ax:for(;c<14;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}if(t.nlen=(l&31)+257,l>>>=5,c-=5,t.ndist=(l&31)+1,l>>>=5,c-=5,t.ncode=(l&15)+4,l>>>=4,c-=4,t.nlen>286||t.ndist>30){r.msg="too many length or distance symbols",t.mode=ze;break}t.have=0,t.mode=ox;case ox:for(;t.have<t.ncode;){for(;c<3;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}t.lens[B[t.have++]]=l&7,l>>>=3,c-=3}for(;t.have<19;)t.lens[B[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,k={bits:t.lenbits},_=ha(kO,t.lens,0,19,t.lencode,0,t.work,k),t.lenbits=k.bits,_){r.msg="invalid code lengths set",t.mode=ze;break}t.have=0,t.mode=ux;case ux:for(;t.have<t.nlen+t.ndist;){for(;b=t.lencode[l&(1<<t.lenbits)-1],m=b>>>24,y=b>>>16&255,v=b&65535,!(m<=c);){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}if(v<16)l>>>=m,c-=m,t.lens[t.have++]=v;else{if(v===16){for(A=m+2;c<A;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}if(l>>>=m,c-=m,t.have===0){r.msg="invalid bit length repeat",t.mode=ze;break}E=t.lens[t.have-1],f=3+(l&3),l>>>=2,c-=2}else if(v===17){for(A=m+3;c<A;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}l>>>=m,c-=m,E=0,f=3+(l&7),l>>>=3,c-=3}else{for(A=m+7;c<A;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}l>>>=m,c-=m,E=0,f=11+(l&127),l>>>=7,c-=7}if(t.have+f>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=ze;break}for(;f--;)t.lens[t.have++]=E}}if(t.mode===ze)break;if(t.lens[256]===0){r.msg="invalid code -- missing end-of-block",t.mode=ze;break}if(t.lenbits=9,k={bits:t.lenbits},_=ha(yx,t.lens,0,t.nlen,t.lencode,0,t.work,k),t.lenbits=k.bits,_){r.msg="invalid literal/lengths set",t.mode=ze;break}if(t.distbits=6,t.distcode=t.distdyn,k={bits:t.distbits},_=ha(vx,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,k),t.distbits=k.bits,_){r.msg="invalid distances set",t.mode=ze;break}if(t.mode=ju,e===zu)break e;case ju:t.mode=Hu;case Hu:if(o>=6&&u>=258){r.next_out=a,r.avail_out=u,r.next_in=s,r.avail_in=o,t.hold=l,t.bits=c,CO(r,d),a=r.next_out,i=r.output,u=r.avail_out,s=r.next_in,n=r.input,o=r.avail_in,l=t.hold,c=t.bits,t.mode===Xr&&(t.back=-1);break}for(t.back=0;b=t.lencode[l&(1<<t.lenbits)-1],m=b>>>24,y=b>>>16&255,v=b&65535,!(m<=c);){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}if(y&&(y&240)===0){for(x=m,w=y,S=v;b=t.lencode[S+((l&(1<<x+w)-1)>>x)],m=b>>>24,y=b>>>16&255,v=b&65535,!(x+m<=c);){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}l>>>=x,c-=x,t.back+=x}if(l>>>=m,c-=m,t.back+=m,t.length=v,y===0){t.mode=fx;break}if(y&32){t.back=-1,t.mode=Xr;break}if(y&64){r.msg="invalid literal/length code",t.mode=ze;break}t.extra=y&15,t.mode=lx;case lx:if(t.extra){for(A=t.extra;c<A;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}t.length+=l&(1<<t.extra)-1,l>>>=t.extra,c-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=cx;case cx:for(;b=t.distcode[l&(1<<t.distbits)-1],m=b>>>24,y=b>>>16&255,v=b&65535,!(m<=c);){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}if((y&240)===0){for(x=m,w=y,S=v;b=t.distcode[S+((l&(1<<x+w)-1)>>x)],m=b>>>24,y=b>>>16&255,v=b&65535,!(x+m<=c);){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}l>>>=x,c-=x,t.back+=x}if(l>>>=m,c-=m,t.back+=m,y&64){r.msg="invalid distance code",t.mode=ze;break}t.offset=v,t.extra=y&15,t.mode=hx;case hx:if(t.extra){for(A=t.extra;c<A;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}t.offset+=l&(1<<t.extra)-1,l>>>=t.extra,c-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){r.msg="invalid distance too far back",t.mode=ze;break}t.mode=dx;case dx:if(u===0)break e;if(f=d-u,t.offset>f){if(f=t.offset-f,f>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=ze;break}f>t.wnext?(f-=t.wnext,p=t.wsize-f):p=t.wnext-f,f>t.length&&(f=t.length),g=t.window}else g=i,p=a-t.offset,f=t.length;f>u&&(f=u),u-=f,t.length-=f;do i[a++]=g[p++];while(--f);t.length===0&&(t.mode=Hu);break;case fx:if(u===0)break e;i[a++]=t.length,u--,t.mode=Hu;break;case Vf:if(t.wrap){for(;c<32;){if(o===0)break e;o--,l|=n[s++]<<c,c+=8}if(d-=u,r.total_out+=d,t.total+=d,d&&(r.adler=t.check=t.flags?Or(t.check,i,d,a-d):Kf(t.check,i,d,a-d)),d=u,(t.flags?l:mx(l))!==t.check){r.msg="incorrect data check",t.mode=ze;break}l=0,c=0}t.mode=px;case px:if(t.wrap&&t.flags){for(;c<32;){if(o===0)break e;o--,l+=n[s++]<<c,c+=8}if(l!==(t.total&4294967295)){r.msg="incorrect length check",t.mode=ze;break}l=0,c=0}t.mode=gx;case gx:_=RO;break e;case ze:_=wx;break e;case Yf:return Xf;case LO:default:return rr}return r.next_out=a,r.avail_out=u,r.next_in=s,r.avail_in=o,t.hold=l,t.bits=c,(t.wsize||d!==r.avail_out&&t.mode<ze&&(t.mode<Vf||e!==qw))&&_x(r,r.output,r.next_out,d-r.avail_out)?(t.mode=Yf,Xf):(h-=r.avail_in,d-=r.avail_out,r.total_in+=h,r.total_out+=d,t.total+=d,t.wrap&&d&&(r.adler=t.check=t.flags?Or(t.check,i,d,r.next_out-d):Kf(t.check,i,d,r.next_out-d)),r.data_type=t.bits+(t.last?64:0)+(t.mode===Xr?128:0)+(t.mode===ju||t.mode===Wf?256:0),(h===0&&d===0||e===qw)&&_===Vn&&(_=OO),_)}function jO(r){if(!r||!r.state)return rr;var e=r.state;return e.window&&(e.window=null),r.state=null,Vn}function HO(r,e){var t;return!r||!r.state||(t=r.state,(t.wrap&2)===0)?rr:(t.head=e,e.done=!1,Vn)}function WO(r,e){var t=e.length,n,i,s;return!r||!r.state||(n=r.state,n.wrap!==0&&n.mode!==Wu)?rr:n.mode===Wu&&(i=1,i=Kf(i,e,t,0),i!==n.check)?wx:(s=_x(r,e,t,t),s?(n.mode=Yf,Xf):(n.havedict=1,Vn))}mr.inflateReset=Ex;mr.inflateReset2=Ax;mr.inflateResetKeep=Sx;mr.inflateInit=$O;mr.inflateInit2=Tx;mr.inflate=zO;mr.inflateEnd=jO;mr.inflateGetHeader=HO;mr.inflateSetDictionary=WO;mr.inflateInfo="pako inflate (from Nodeca project)"});var Qf=j((x7,kx)=>{"use strict";kx.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var Rx=j((S7,Ix)=>{"use strict";function VO(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}Ix.exports=VO});var Ox=j(fa=>{"use strict";var zi=Cx(),da=Gr(),Vu=Bf(),Qe=Qf(),Zf=Ou(),GO=Df(),qO=Rx(),Px=Object.prototype.toString;function Gn(r){if(!(this instanceof Gn))return new Gn(r);this.options=da.assign({chunkSize:16384,windowBits:0,to:""},r||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(r&&r.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new GO,this.strm.avail_out=0;var t=zi.inflateInit2(this.strm,e.windowBits);if(t!==Qe.Z_OK)throw new Error(Zf[t]);if(this.header=new qO,zi.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Vu.string2buf(e.dictionary):Px.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=zi.inflateSetDictionary(this.strm,e.dictionary),t!==Qe.Z_OK)))throw new Error(Zf[t])}Gn.prototype.push=function(r,e){var t=this.strm,n=this.options.chunkSize,i=this.options.dictionary,s,a,o,u,l,c=!1;if(this.ended)return!1;a=e===~~e?e:e===!0?Qe.Z_FINISH:Qe.Z_NO_FLUSH,typeof r=="string"?t.input=Vu.binstring2buf(r):Px.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;do{if(t.avail_out===0&&(t.output=new da.Buf8(n),t.next_out=0,t.avail_out=n),s=zi.inflate(t,Qe.Z_NO_FLUSH),s===Qe.Z_NEED_DICT&&i&&(s=zi.inflateSetDictionary(this.strm,i)),s===Qe.Z_BUF_ERROR&&c===!0&&(s=Qe.Z_OK,c=!1),s!==Qe.Z_STREAM_END&&s!==Qe.Z_OK)return this.onEnd(s),this.ended=!0,!1;t.next_out&&(t.avail_out===0||s===Qe.Z_STREAM_END||t.avail_in===0&&(a===Qe.Z_FINISH||a===Qe.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=Vu.utf8border(t.output,t.next_out),u=t.next_out-o,l=Vu.buf2string(t.output,o),t.next_out=u,t.avail_out=n-u,u&&da.arraySet(t.output,t.output,o,u,0),this.onData(l)):this.onData(da.shrinkBuf(t.output,t.next_out))),t.avail_in===0&&t.avail_out===0&&(c=!0)}while((t.avail_in>0||t.avail_out===0)&&s!==Qe.Z_STREAM_END);return s===Qe.Z_STREAM_END&&(a=Qe.Z_FINISH),a===Qe.Z_FINISH?(s=zi.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Qe.Z_OK):(a===Qe.Z_SYNC_FLUSH&&(this.onEnd(Qe.Z_OK),t.avail_out=0),!0)};Gn.prototype.onData=function(r){this.chunks.push(r)};Gn.prototype.onEnd=function(r){r===Qe.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=da.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Jf(r,e){var t=new Gn(e);if(t.push(r,!0),t.err)throw t.msg||Zf[t.err];return t.result}function KO(r,e){return e=e||{},e.raw=!0,Jf(r,e)}fa.Inflate=Gn;fa.inflate=Jf;fa.inflateRaw=KO;fa.ungzip=Jf});var Mx=j((A7,Nx)=>{"use strict";var XO=Gr().assign,YO=Dw(),QO=Ox(),ZO=Qf(),Lx={};XO(Lx,YO,QO,ZO);Nx.exports=Lx});var Dx=j(qu=>{"use strict";var JO=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",eL=Mx(),Bx=je(),Gu=Ht(),tL=JO?"uint8array":"array";qu.magic="\b\0";function qn(r,e){Gu.call(this,"FlateWorker/"+r),this._pako=null,this._pakoAction=r,this._pakoOptions=e,this.meta={}}Bx.inherits(qn,Gu);qn.prototype.processChunk=function(r){this.meta=r.meta,this._pako===null&&this._createPako(),this._pako.push(Bx.transformTo(tL,r.data),!1)};qn.prototype.flush=function(){Gu.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)};qn.prototype.cleanUp=function(){Gu.prototype.cleanUp.call(this),this._pako=null};qn.prototype._createPako=function(){this._pako=new eL[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var r=this;this._pako.onData=function(e){r.push({data:e,meta:r.meta})}};qu.compressWorker=function(r){return new qn("Deflate",r)};qu.uncompressWorker=function(){return new qn("Inflate",{})}});var tp=j(ep=>{"use strict";var Fx=Ht();ep.STORE={magic:"\0\0",compressWorker:function(){return new Fx("STORE compression")},uncompressWorker:function(){return new Fx("STORE decompression")}};ep.DEFLATE=Dx()});var rp=j(Kn=>{"use strict";Kn.LOCAL_FILE_HEADER="PK";Kn.CENTRAL_FILE_HEADER="PK";Kn.CENTRAL_DIRECTORY_END="PK";Kn.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";Kn.ZIP64_CENTRAL_DIRECTORY_END="PK";Kn.DATA_DESCRIPTOR="PK\x07\b"});var jx=j((k7,zx)=>{"use strict";var ji=je(),Hi=Ht(),np=Ri(),$x=Cu(),Ku=rp(),Be=function(r,e){var t="",n;for(n=0;n<e;n++)t+=String.fromCharCode(r&255),r=r>>>8;return t},rL=function(r,e){var t=r;return r||(t=e?16893:33204),(t&65535)<<16},nL=function(r){return(r||0)&63},Ux=function(r,e,t,n,i,s){var a=r.file,o=r.compression,u=s!==np.utf8encode,l=ji.transformTo("string",s(a.name)),c=ji.transformTo("string",np.utf8encode(a.name)),h=a.comment,d=ji.transformTo("string",s(h)),f=ji.transformTo("string",np.utf8encode(h)),p=c.length!==a.name.length,g=f.length!==h.length,b,m,y="",v="",x="",w=a.dir,S=a.date,E={crc32:0,compressedSize:0,uncompressedSize:0};(!e||t)&&(E.crc32=r.crc32,E.compressedSize=r.compressedSize,E.uncompressedSize=r.uncompressedSize);var _=0;e&&(_|=8),!u&&(p||g)&&(_|=2048);var T=0,k=0;w&&(T|=16),i==="UNIX"?(k=798,T|=rL(a.unixPermissions,w)):(k=20,T|=nL(a.dosPermissions,w)),b=S.getUTCHours(),b=b<<6,b=b|S.getUTCMinutes(),b=b<<5,b=b|S.getUTCSeconds()/2,m=S.getUTCFullYear()-1980,m=m<<4,m=m|S.getUTCMonth()+1,m=m<<5,m=m|S.getUTCDate(),p&&(v=Be(1,1)+Be($x(l),4)+c,y+="up"+Be(v.length,2)+v),g&&(x=Be(1,1)+Be($x(d),4)+f,y+="uc"+Be(x.length,2)+x);var A="";A+=`
107
+ \0`,A+=Be(_,2),A+=o.magic,A+=Be(b,2),A+=Be(m,2),A+=Be(E.crc32,4),A+=Be(E.compressedSize,4),A+=Be(E.uncompressedSize,4),A+=Be(l.length,2),A+=Be(y.length,2);var B=Ku.LOCAL_FILE_HEADER+A+l+y,D=Ku.CENTRAL_FILE_HEADER+Be(k,2)+A+Be(d.length,2)+"\0\0\0\0"+Be(T,4)+Be(n,4)+l+y+d;return{fileRecord:B,dirRecord:D}},iL=function(r,e,t,n,i){var s="",a=ji.transformTo("string",i(n));return s=Ku.CENTRAL_DIRECTORY_END+"\0\0\0\0"+Be(r,2)+Be(r,2)+Be(e,4)+Be(t,4)+Be(a.length,2)+a,s},sL=function(r){var e="";return e=Ku.DATA_DESCRIPTOR+Be(r.crc32,4)+Be(r.compressedSize,4)+Be(r.uncompressedSize,4),e};function br(r,e,t,n){Hi.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=t,this.encodeFileName=n,this.streamFiles=r,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}ji.inherits(br,Hi);br.prototype.push=function(r){var e=r.meta.percent||0,t=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(r):(this.bytesWritten+=r.data.length,Hi.prototype.push.call(this,{data:r.data,meta:{currentFile:this.currentFile,percent:t?(e+100*(t-n-1))/t:100}}))};br.prototype.openedSource=function(r){this.currentSourceOffset=this.bytesWritten,this.currentFile=r.file.name;var e=this.streamFiles&&!r.file.dir;if(e){var t=Ux(r,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:t.fileRecord,meta:{percent:0}})}else this.accumulate=!0};br.prototype.closedSource=function(r){this.accumulate=!1;var e=this.streamFiles&&!r.file.dir,t=Ux(r,e,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(t.dirRecord),e)this.push({data:sL(r),meta:{percent:100}});else for(this.push({data:t.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null};br.prototype.flush=function(){for(var r=this.bytesWritten,e=0;e<this.dirRecords.length;e++)this.push({data:this.dirRecords[e],meta:{percent:100}});var t=this.bytesWritten-r,n=iL(this.dirRecords.length,t,r,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})};br.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()};br.prototype.registerPrevious=function(r){this._sources.push(r);var e=this;return r.on("data",function(t){e.processChunk(t)}),r.on("end",function(){e.closedSource(e.previous.streamInfo),e._sources.length?e.prepareNextSource():e.end()}),r.on("error",function(t){e.error(t)}),this};br.prototype.resume=function(){if(!Hi.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};br.prototype.error=function(r){var e=this._sources;if(!Hi.prototype.error.call(this,r))return!1;for(var t=0;t<e.length;t++)try{e[t].error(r)}catch{}return!0};br.prototype.lock=function(){Hi.prototype.lock.call(this);for(var r=this._sources,e=0;e<r.length;e++)r[e].lock()};zx.exports=br});var Wx=j(Hx=>{"use strict";var aL=tp(),oL=jx(),uL=function(r,e){var t=r||e,n=aL[t];if(!n)throw new Error(t+" is not a valid compression method !");return n};Hx.generateWorker=function(r,e,t){var n=new oL(e.streamFiles,t,e.platform,e.encodeFileName),i=0;try{r.forEach(function(s,a){i++;var o=uL(a.options.compression,e.compression),u=a.options.compressionOptions||e.compressionOptions||{},l=a.dir,c=a.date;a._compressWorker(o,u).withStreamInfo("file",{name:s,dir:l,date:c,comment:a.comment||"",unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions}).pipe(n)}),n.entriesCount=i}catch(s){n.error(s)}return n}});var Gx=j((R7,Vx)=>{"use strict";var lL=je(),Xu=Ht();function pa(r,e){Xu.call(this,"Nodejs stream input adapter for "+r),this._upstreamEnded=!1,this._bindStream(e)}lL.inherits(pa,Xu);pa.prototype._bindStream=function(r){var e=this;this._stream=r,r.pause(),r.on("data",function(t){e.push({data:t,meta:{percent:0}})}).on("error",function(t){e.isPaused?this.generatedError=t:e.error(t)}).on("end",function(){e.isPaused?e._upstreamEnded=!0:e.end()})};pa.prototype.pause=function(){return Xu.prototype.pause.call(this)?(this._stream.pause(),!0):!1};pa.prototype.resume=function(){return Xu.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1};Vx.exports=pa});var r2=j((P7,t2)=>{"use strict";var cL=Ri(),ga=je(),Yx=Ht(),hL=uf(),Qx=lf(),qx=ku(),dL=Kv(),fL=Wx(),Kx=Ws(),pL=Gx(),Zx=function(r,e,t){var n=ga.getTypeOf(e),i,s=ga.extend(t||{},Qx);s.date=s.date||new Date,s.compression!==null&&(s.compression=s.compression.toUpperCase()),typeof s.unixPermissions=="string"&&(s.unixPermissions=parseInt(s.unixPermissions,8)),s.unixPermissions&&s.unixPermissions&16384&&(s.dir=!0),s.dosPermissions&&s.dosPermissions&16&&(s.dir=!0),s.dir&&(r=Jx(r)),s.createFolders&&(i=gL(r))&&e2.call(this,i,!0);var a=n==="string"&&s.binary===!1&&s.base64===!1;(!t||typeof t.binary>"u")&&(s.binary=!a);var o=e instanceof qx&&e.uncompressedSize===0;(o||s.dir||!e||e.length===0)&&(s.base64=!1,s.binary=!0,e="",s.compression="STORE",n="string");var u=null;e instanceof qx||e instanceof Yx?u=e:Kx.isNode&&Kx.isStream(e)?u=new pL(r,e):u=ga.prepareContent(r,e,s.binary,s.optimizedBinaryString,s.base64);var l=new dL(r,u,s);this.files[r]=l},gL=function(r){r.slice(-1)==="/"&&(r=r.substring(0,r.length-1));var e=r.lastIndexOf("/");return e>0?r.substring(0,e):""},Jx=function(r){return r.slice(-1)!=="/"&&(r+="/"),r},e2=function(r,e){return e=typeof e<"u"?e:Qx.createFolders,r=Jx(r),this.files[r]||Zx.call(this,r,null,{dir:!0,createFolders:e}),this.files[r]};function Xx(r){return Object.prototype.toString.call(r)==="[object RegExp]"}var mL={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(r){var e,t,n;for(e in this.files)n=this.files[e],t=e.slice(this.root.length,e.length),t&&e.slice(0,this.root.length)===this.root&&r(t,n)},filter:function(r){var e=[];return this.forEach(function(t,n){r(t,n)&&e.push(n)}),e},file:function(r,e,t){if(arguments.length===1)if(Xx(r)){var n=r;return this.filter(function(s,a){return!a.dir&&n.test(s)})}else{var i=this.files[this.root+r];return i&&!i.dir?i:null}else r=this.root+r,Zx.call(this,r,e,t);return this},folder:function(r){if(!r)return this;if(Xx(r))return this.filter(function(i,s){return s.dir&&r.test(i)});var e=this.root+r,t=e2.call(this,e),n=this.clone();return n.root=t.name,n},remove:function(r){r=this.root+r;var e=this.files[r];if(e||(r.slice(-1)!=="/"&&(r+="/"),e=this.files[r]),e&&!e.dir)delete this.files[r];else for(var t=this.filter(function(i,s){return s.name.slice(0,r.length)===r}),n=0;n<t.length;n++)delete this.files[t[n].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(r){var e,t={};try{if(t=ga.extend(r||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:cL.utf8encode}),t.type=t.type.toLowerCase(),t.compression=t.compression.toUpperCase(),t.type==="binarystring"&&(t.type="string"),!t.type)throw new Error("No output type specified.");ga.checkSupport(t.type),(t.platform==="darwin"||t.platform==="freebsd"||t.platform==="linux"||t.platform==="sunos")&&(t.platform="UNIX"),t.platform==="win32"&&(t.platform="DOS");var n=t.comment||this.comment||"";e=fL.generateWorker(this,t,n)}catch(i){e=new Yx("error"),e.error(i)}return new hL(e,t.type||"string",t.mimeType)},generateAsync:function(r,e){return this.generateInternalStream(r).accumulate(e)},generateNodeStream:function(r,e){return r=r||{},r.type||(r.type="nodebuffer"),this.generateInternalStream(r).toNodejsStream(e)}};t2.exports=mL});var ip=j((O7,i2)=>{"use strict";var bL=je();function n2(r){this.data=r,this.length=r.length,this.index=0,this.zero=0}n2.prototype={checkOffset:function(r){this.checkIndex(this.index+r)},checkIndex:function(r){if(this.length<this.zero+r||r<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+r+"). Corrupted zip ?")},setIndex:function(r){this.checkIndex(r),this.index=r},skip:function(r){this.setIndex(this.index+r)},byteAt:function(){},readInt:function(r){var e=0,t;for(this.checkOffset(r),t=this.index+r-1;t>=this.index;t--)e=(e<<8)+this.byteAt(t);return this.index+=r,e},readString:function(r){return bL.transformTo("string",this.readData(r))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var r=this.readInt(4);return new Date(Date.UTC((r>>25&127)+1980,(r>>21&15)-1,r>>16&31,r>>11&31,r>>5&63,(r&31)<<1))}};i2.exports=n2});var sp=j((L7,a2)=>{"use strict";var s2=ip(),yL=je();function Wi(r){s2.call(this,r);for(var e=0;e<this.data.length;e++)r[e]=r[e]&255}yL.inherits(Wi,s2);Wi.prototype.byteAt=function(r){return this.data[this.zero+r]};Wi.prototype.lastIndexOfSignature=function(r){for(var e=r.charCodeAt(0),t=r.charCodeAt(1),n=r.charCodeAt(2),i=r.charCodeAt(3),s=this.length-4;s>=0;--s)if(this.data[s]===e&&this.data[s+1]===t&&this.data[s+2]===n&&this.data[s+3]===i)return s-this.zero;return-1};Wi.prototype.readAndCheckSignature=function(r){var e=r.charCodeAt(0),t=r.charCodeAt(1),n=r.charCodeAt(2),i=r.charCodeAt(3),s=this.readData(4);return e===s[0]&&t===s[1]&&n===s[2]&&i===s[3]};Wi.prototype.readData=function(r){if(this.checkOffset(r),r===0)return[];var e=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,e};a2.exports=Wi});var l2=j((N7,u2)=>{"use strict";var o2=ip(),vL=je();function Vi(r){o2.call(this,r)}vL.inherits(Vi,o2);Vi.prototype.byteAt=function(r){return this.data.charCodeAt(this.zero+r)};Vi.prototype.lastIndexOfSignature=function(r){return this.data.lastIndexOf(r)-this.zero};Vi.prototype.readAndCheckSignature=function(r){var e=this.readData(4);return r===e};Vi.prototype.readData=function(r){this.checkOffset(r);var e=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,e};u2.exports=Vi});var op=j((M7,h2)=>{"use strict";var c2=sp(),wL=je();function ap(r){c2.call(this,r)}wL.inherits(ap,c2);ap.prototype.readData=function(r){if(this.checkOffset(r),r===0)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+r);return this.index+=r,e};h2.exports=ap});var p2=j((B7,f2)=>{"use strict";var d2=op(),xL=je();function up(r){d2.call(this,r)}xL.inherits(up,d2);up.prototype.readData=function(r){this.checkOffset(r);var e=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,e};f2.exports=up});var lp=j((D7,m2)=>{"use strict";var Yu=je(),g2=Wr(),SL=sp(),EL=l2(),AL=p2(),TL=op();m2.exports=function(r){var e=Yu.getTypeOf(r);return Yu.checkSupport(e),e==="string"&&!g2.uint8array?new EL(r):e==="nodebuffer"?new AL(r):g2.uint8array?new TL(Yu.transformTo("uint8array",r)):new SL(Yu.transformTo("array",r))}});var w2=j((F7,v2)=>{"use strict";var cp=lp(),wn=je(),_L=ku(),b2=Cu(),Qu=Ri(),Zu=tp(),CL=Wr(),kL=0,IL=3,RL=function(r){for(var e in Zu)if(Object.prototype.hasOwnProperty.call(Zu,e)&&Zu[e].magic===r)return Zu[e];return null};function y2(r,e){this.options=r,this.loadOptions=e}y2.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(r){var e,t;if(r.skip(22),this.fileNameLength=r.readInt(2),t=r.readInt(2),this.fileName=r.readData(this.fileNameLength),r.skip(t),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(e=RL(this.compressionMethod),e===null)throw new Error("Corrupted zip : compression "+wn.pretty(this.compressionMethod)+" unknown (inner file : "+wn.transformTo("string",this.fileName)+")");this.decompressed=new _L(this.compressedSize,this.uncompressedSize,this.crc32,e,r.readData(this.compressedSize))},readCentralPart:function(r){this.versionMadeBy=r.readInt(2),r.skip(2),this.bitFlag=r.readInt(2),this.compressionMethod=r.readString(2),this.date=r.readDate(),this.crc32=r.readInt(4),this.compressedSize=r.readInt(4),this.uncompressedSize=r.readInt(4);var e=r.readInt(2);if(this.extraFieldsLength=r.readInt(2),this.fileCommentLength=r.readInt(2),this.diskNumberStart=r.readInt(2),this.internalFileAttributes=r.readInt(2),this.externalFileAttributes=r.readInt(4),this.localHeaderOffset=r.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");r.skip(e),this.readExtraFields(r),this.parseZIP64ExtraField(r),this.fileComment=r.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var r=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),r===kL&&(this.dosPermissions=this.externalFileAttributes&63),r===IL&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var r=cp(this.extraFields[1].value);this.uncompressedSize===wn.MAX_VALUE_32BITS&&(this.uncompressedSize=r.readInt(8)),this.compressedSize===wn.MAX_VALUE_32BITS&&(this.compressedSize=r.readInt(8)),this.localHeaderOffset===wn.MAX_VALUE_32BITS&&(this.localHeaderOffset=r.readInt(8)),this.diskNumberStart===wn.MAX_VALUE_32BITS&&(this.diskNumberStart=r.readInt(4))}},readExtraFields:function(r){var e=r.index+this.extraFieldsLength,t,n,i;for(this.extraFields||(this.extraFields={});r.index+4<e;)t=r.readInt(2),n=r.readInt(2),i=r.readData(n),this.extraFields[t]={id:t,length:n,value:i};r.setIndex(e)},handleUTF8:function(){var r=CL.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=Qu.utf8decode(this.fileName),this.fileCommentStr=Qu.utf8decode(this.fileComment);else{var e=this.findExtraFieldUnicodePath();if(e!==null)this.fileNameStr=e;else{var t=wn.transformTo(r,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(t)}var n=this.findExtraFieldUnicodeComment();if(n!==null)this.fileCommentStr=n;else{var i=wn.transformTo(r,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(i)}}},findExtraFieldUnicodePath:function(){var r=this.extraFields[28789];if(r){var e=cp(r.value);return e.readInt(1)!==1||b2(this.fileName)!==e.readInt(4)?null:Qu.utf8decode(e.readData(r.length-5))}return null},findExtraFieldUnicodeComment:function(){var r=this.extraFields[25461];if(r){var e=cp(r.value);return e.readInt(1)!==1||b2(this.fileComment)!==e.readInt(4)?null:Qu.utf8decode(e.readData(r.length-5))}return null}};v2.exports=y2});var E2=j(($7,S2)=>{"use strict";var PL=lp(),Yr=je(),yr=rp(),OL=w2(),LL=Wr();function x2(r){this.files=[],this.loadOptions=r}x2.prototype={checkSignature:function(r){if(!this.reader.readAndCheckSignature(r)){this.reader.index-=4;var e=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+Yr.pretty(e)+", expected "+Yr.pretty(r)+")")}},isSignature:function(r,e){var t=this.reader.index;this.reader.setIndex(r);var n=this.reader.readString(4),i=n===e;return this.reader.setIndex(t),i},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var r=this.reader.readData(this.zipCommentLength),e=LL.uint8array?"uint8array":"array",t=Yr.transformTo(e,r);this.zipComment=this.loadOptions.decodeFileName(t)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var r=this.zip64EndOfCentralSize-44,e=0,t,n,i;e<r;)t=this.reader.readInt(2),n=this.reader.readInt(4),i=this.reader.readData(n),this.zip64ExtensibleData[t]={id:t,length:n,value:i}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var r,e;for(r=0;r<this.files.length;r++)e=this.files[r],this.reader.setIndex(e.localHeaderOffset),this.checkSignature(yr.LOCAL_FILE_HEADER),e.readLocalPart(this.reader),e.handleUTF8(),e.processAttributes()},readCentralDir:function(){var r;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(yr.CENTRAL_FILE_HEADER);)r=new OL({zip64:this.zip64},this.loadOptions),r.readCentralPart(this.reader),this.files.push(r);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var r=this.reader.lastIndexOfSignature(yr.CENTRAL_DIRECTORY_END);if(r<0){var e=!this.isSignature(0,yr.LOCAL_FILE_HEADER);throw e?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(r);var t=r;if(this.checkSignature(yr.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===Yr.MAX_VALUE_16BITS||this.diskWithCentralDirStart===Yr.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===Yr.MAX_VALUE_16BITS||this.centralDirRecords===Yr.MAX_VALUE_16BITS||this.centralDirSize===Yr.MAX_VALUE_32BITS||this.centralDirOffset===Yr.MAX_VALUE_32BITS){if(this.zip64=!0,r=this.reader.lastIndexOfSignature(yr.ZIP64_CENTRAL_DIRECTORY_LOCATOR),r<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(r),this.checkSignature(yr.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,yr.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(yr.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(yr.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var n=this.centralDirOffset+this.centralDirSize;this.zip64&&(n+=20,n+=12+this.zip64EndOfCentralSize);var i=t-n;if(i>0)this.isSignature(t,yr.CENTRAL_FILE_HEADER)||(this.reader.zero=i);else if(i<0)throw new Error("Corrupted zip: missing "+Math.abs(i)+" bytes.")},prepareReader:function(r){this.reader=PL(r)},load:function(r){this.prepareReader(r),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};S2.exports=x2});var _2=j((U7,T2)=>{"use strict";var hp=je(),Ju=Ci(),NL=Ri(),ML=E2(),BL=df(),A2=Ws();function DL(r){return new Ju.Promise(function(e,t){var n=r.decompressed.getContentWorker().pipe(new BL);n.on("error",function(i){t(i)}).on("end",function(){n.streamInfo.crc32!==r.decompressed.crc32?t(new Error("Corrupted zip : CRC32 mismatch")):e()}).resume()})}T2.exports=function(r,e){var t=this;return e=hp.extend(e||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:NL.utf8decode}),A2.isNode&&A2.isStream(r)?Ju.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):hp.prepareContent("the loaded zip file",r,!0,e.optimizedBinaryString,e.base64).then(function(n){var i=new ML(e);return i.load(n),i}).then(function(i){var s=[Ju.Promise.resolve(i)],a=i.files;if(e.checkCRC32)for(var o=0;o<a.length;o++)s.push(DL(a[o]));return Ju.Promise.all(s)}).then(function(i){for(var s=i.shift(),a=s.files,o=0;o<a.length;o++){var u=a[o],l=u.fileNameStr,c=hp.resolve(u.fileNameStr);t.file(c,u.decompressed,{binary:!0,optimizedBinaryString:!0,date:u.date,dir:u.dir,comment:u.fileCommentStr.length?u.fileCommentStr:null,unixPermissions:u.unixPermissions,dosPermissions:u.dosPermissions,createFolders:e.createFolders}),u.dir||(t.file(c).unsafeOriginalName=l)}return s.zipComment.length&&(t.comment=s.zipComment),t})}});var k2=j((z7,C2)=>{"use strict";function nr(){if(!(this instanceof nr))return new nr;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var r=new nr;for(var e in this)typeof this[e]!="function"&&(r[e]=this[e]);return r}}nr.prototype=r2();nr.prototype.loadAsync=_2();nr.support=Wr();nr.defaults=lf();nr.version="3.10.1";nr.loadAsync=function(r,e){return new nr().loadAsync(r,e)};nr.external=Ci();C2.exports=nr});var WS=j((VU,HS)=>{"use strict";var ZN=function(e){return JN(e)&&!eM(e)};function JN(r){return!!r&&typeof r=="object"}function eM(r){var e=Object.prototype.toString.call(r);return e==="[object RegExp]"||e==="[object Date]"||nM(r)}var tM=typeof Symbol=="function"&&Symbol.for,rM=tM?Symbol.for("react.element"):60103;function nM(r){return r.$$typeof===rM}function iM(r){return Array.isArray(r)?[]:{}}function Ba(r,e){return e.clone!==!1&&e.isMergeableObject(r)?ss(iM(r),r,e):r}function sM(r,e,t){return r.concat(e).map(function(n){return Ba(n,t)})}function aM(r,e){if(!e.customMerge)return ss;var t=e.customMerge(r);return typeof t=="function"?t:ss}function oM(r){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(r).filter(function(e){return Object.propertyIsEnumerable.call(r,e)}):[]}function zS(r){return Object.keys(r).concat(oM(r))}function jS(r,e){try{return e in r}catch{return!1}}function uM(r,e){return jS(r,e)&&!(Object.hasOwnProperty.call(r,e)&&Object.propertyIsEnumerable.call(r,e))}function lM(r,e,t){var n={};return t.isMergeableObject(r)&&zS(r).forEach(function(i){n[i]=Ba(r[i],t)}),zS(e).forEach(function(i){uM(r,i)||(jS(r,i)&&t.isMergeableObject(e[i])?n[i]=aM(i,t)(r[i],e[i],t):n[i]=Ba(e[i],t))}),n}function ss(r,e,t){t=t||{},t.arrayMerge=t.arrayMerge||sM,t.isMergeableObject=t.isMergeableObject||ZN,t.cloneUnlessOtherwiseSpecified=Ba;var n=Array.isArray(e),i=Array.isArray(r),s=n===i;return s?n?t.arrayMerge(r,e,t):lM(r,e,t):Ba(e,t)}ss.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(n,i){return ss(n,i,t)},{})};var cM=ss;HS.exports=cM});import{StdioServerTransport as yF}from"@modelcontextprotocol/sdk/server/stdio.js";import{McpServer as iC}from"@modelcontextprotocol/sdk/server/mcp.js";var ge=class extends Error{constructor(t,n){super(n);this.code=t;this.name="McpError"}};function Zm(r){let e=r instanceof ge?r.code:"INTERNAL_ERROR",t=r.message;return{content:[{type:"text",text:JSON.stringify({error:e,message:t})}],isError:!0}}function Jm(r){return async(e,t)=>{try{let n=await r(e,t);return{content:[{type:"text",text:typeof n=="string"?n:JSON.stringify(n)}]}}catch(n){if(n instanceof ge)return Zm(n);let i=n instanceof Error?n.message:String(n);return console.error("Unhandled error in MCP tool:",n),Zm(new ge("INTERNAL_ERROR",i))}}}function Ie(r,e){let t={book:"BOOK_NOT_FOUND",chapter:"CHAPTER_NOT_FOUND",section:"SECTION_NOT_FOUND"};throw new ge(t[r],`${r} not found: ${e}`)}var sC="1.0.0";function aC(){return new iC({name:"openread",version:sC})}var Eh=null;function gi(){return Eh||(Eh=aC()),Eh}function ke(r,e,t,n){let i=gi(),s=async(a,o)=>{let u=_e(),l=await Jm(n)(a,u);return{content:l.content,isError:l.isError}};i.registerTool(r,{description:e,inputSchema:t},s)}var Ah=null;function eb(r){Ah=r}function _e(){if(!Ah)throw new Error("MCP context not set. Call setContext() before handling requests.");return Ah}import{createClient as oC}from"@supabase/supabase-js";var Sr=class extends Error{constructor(t,n=!1){super(t);this.recoverable=n;this.name="AuthError"}},uC="https://app.openread.ai",tb=300*1e3,Th=3,lC=1e3,rb=3,cC=1e4,Wo=class{constructor(e,t){this.apiKey=e;this.apiUrl=t??process.env.OPENREAD_API_URL??uC}jwt=null;userId=null;expiresAt=0;supabaseClient=null;refreshTimer=null;refreshPromise=null;apiUrl;async initialize(){await this.exchangeToken(),this.scheduleRefresh()}getJwt(){if(!this.jwt)throw new Sr("Not authenticated. Call initialize() first.");let e=Date.now();if(e>=this.expiresAt)throw new Sr("JWT expired. Please restart the server.",!1);return e>=this.expiresAt-tb&&!this.refreshPromise&&this.triggerBackgroundRefresh(),this.jwt}getUserId(){if(!this.userId)throw new Sr("Not authenticated. Call initialize() first.");return this.userId}getSupabaseClient(){if(!this.supabaseClient)throw new Sr("Not authenticated. Call initialize() first.");return this.supabaseClient}getApiUrl(){return this.apiUrl}destroy(){this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null)}async exchangeToken(){let e=null;for(let t=0;t<Th;t++)try{let n=await fetch(`${this.apiUrl}/api/mcp/auth`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey})});if(n.status===401)throw new Sr("API key is invalid or has been revoked. Generate a new key at Settings > API Keys.",!1);if(n.status===429)throw new Sr("Rate limited. Too many authentication attempts.",!0);if(!n.ok)throw new Error(`Auth endpoint returned ${n.status}: ${await n.text()}`);let i=await n.json();this.jwt=i.jwt,this.userId=i.userId,this.expiresAt=i.expiresAt,this.supabaseClient=oC(i.supabaseUrl,i.supabaseAnonKey,{global:{headers:{Authorization:`Bearer ${i.jwt}`}},auth:{persistSession:!1}});return}catch(n){if(n instanceof Sr&&!n.recoverable)throw n;if(e=n instanceof Error?n:new Error(String(n)),t<Th-1){let i=lC*Math.pow(2,t);await new Promise(s=>setTimeout(s,i))}}throw new Sr(`Failed to authenticate after ${Th} attempts. Last error: ${e?.message}. Check your network connection and verify your API key is valid.`,!1)}scheduleRefresh(){this.refreshTimer&&clearTimeout(this.refreshTimer);let e=Math.max(0,this.expiresAt-tb-Date.now());this.refreshTimer=setTimeout(()=>{this.triggerBackgroundRefresh()},e)}triggerBackgroundRefresh(e=0){this.refreshPromise||(this.refreshPromise=this.exchangeToken().then(()=>{this.refreshPromise=null,this.scheduleRefresh()}).catch(t=>{let n=t instanceof Error?t.message:String(t);if(process.stderr.write(`[openread-mcp] JWT refresh failed (attempt ${e+1}/${rb}): ${n}
108
+ `),e+1<rb&&Date.now()<this.expiresAt){let i=cC*Math.pow(2,e);process.stderr.write(`[openread-mcp] Retrying refresh in ${i/1e3}s...
109
+ `),this.refreshTimer=setTimeout(()=>{this.refreshPromise=null,this.triggerBackgroundRefresh(e+1)},i)}else process.stderr.write(`[openread-mcp] JWT refresh exhausted retries. Server will need restart when token expires.
110
+ `),this.refreshPromise=null}))}};import{promises as Tt}from"node:fs";import zo from"node:path";import oD from"env-paths";var OF=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date;var _h=typeof process=="object"&&process?process:{},hC=(r,e,t,n)=>{typeof _h.emitWarning=="function"?_h.emitWarning(r,e,t,n):console.error(`[${t}] ${e}: ${r}`)},nb=globalThis.AbortController,ib=globalThis.AbortSignal;if(typeof nb>"u"){ib=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},nb=class{constructor(){e()}signal=new ib;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let r=_h.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{r&&(r=!1,hC("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var uu=Sh(p1(),1),g1=process.env.NODE_ENV!=="production",nR={level:process.env.LOG_LEVEL||(g1?"debug":"info"),transport:g1?{target:"pino-pretty",options:{colorize:!0,translateTime:"SYS:standard",ignore:"pid,hostname"}}:void 0,timestamp:uu.stdTimeFunctions.isoTime,base:{env:process.env.NODE_ENV||"development",service:"openread-api"},redact:["req.headers.authorization","password","token","secret"]},iR=(0,uu.pino)(nR);function m1(r){return iR.child(r)}var w9=m1({module:"retry"});var T9={epub:100*1024*1024,pdf:200*1024*1024,mobi:100*1024*1024,azw:100*1024*1024,azw3:100*1024*1024,fb2:50*1024*1024,fbz:50*1024*1024,cbz:500*1024*1024,txt:50*1024*1024,md:50*1024*1024};var aE=Sh(k2(),1);var I2=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",FL=I2+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",$L="["+I2+"]["+FL+"]*",UL=new RegExp("^"+$L+"$");function el(r,e){let t=[],n=e.exec(r);for(;n;){let i=[];i.startIndex=e.lastIndex-n[0].length;let s=n.length;for(let a=0;a<s;a++)i.push(n[a]);t.push(i),n=e.exec(r)}return t}var Gi=function(r){let e=UL.exec(r);return!(e===null||typeof e>"u")};function R2(r){return typeof r<"u"}var zL={allowBooleanAttributes:!1,unpairedTags:[]};function M2(r,e){e=Object.assign({},zL,e);let t=[],n=!1,i=!1;r[0]==="\uFEFF"&&(r=r.substr(1));for(let s=0;s<r.length;s++)if(r[s]==="<"&&r[s+1]==="?"){if(s+=2,s=O2(r,s),s.err)return s}else if(r[s]==="<"){let a=s;if(s++,r[s]==="!"){s=L2(r,s);continue}else{let o=!1;r[s]==="/"&&(o=!0,s++);let u="";for(;s<r.length&&r[s]!==">"&&r[s]!==" "&&r[s]!==" "&&r[s]!==`
111
+ `&&r[s]!=="\r";s++)u+=r[s];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),s--),!XL(u)){let h;return u.trim().length===0?h="Invalid space after '<'.":h="Tag '"+u+"' is an invalid name.",Ze("InvalidTag",h,It(r,s))}let l=WL(r,s);if(l===!1)return Ze("InvalidAttr","Attributes for '"+u+"' have open quote.",It(r,s));let c=l.value;if(s=l.index,c[c.length-1]==="/"){let h=s-c.length;c=c.substring(0,c.length-1);let d=N2(c,e);if(d===!0)n=!0;else return Ze(d.err.code,d.err.msg,It(r,h+d.err.line))}else if(o)if(l.tagClosed){if(c.trim().length>0)return Ze("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",It(r,a));if(t.length===0)return Ze("InvalidTag","Closing tag '"+u+"' has not been opened.",It(r,a));{let h=t.pop();if(u!==h.tagName){let d=It(r,h.tagStartPos);return Ze("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+d.line+", col "+d.col+") instead of closing tag '"+u+"'.",It(r,a))}t.length==0&&(i=!0)}}else return Ze("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",It(r,s));else{let h=N2(c,e);if(h!==!0)return Ze(h.err.code,h.err.msg,It(r,s-c.length+h.err.line));if(i===!0)return Ze("InvalidXml","Multiple possible root nodes found.",It(r,s));e.unpairedTags.indexOf(u)!==-1||t.push({tagName:u,tagStartPos:a}),n=!0}for(s++;s<r.length;s++)if(r[s]==="<")if(r[s+1]==="!"){s++,s=L2(r,s);continue}else if(r[s+1]==="?"){if(s=O2(r,++s),s.err)return s}else break;else if(r[s]==="&"){let h=qL(r,s);if(h==-1)return Ze("InvalidChar","char '&' is not expected.",It(r,s));s=h}else if(i===!0&&!P2(r[s]))return Ze("InvalidXml","Extra text at the end",It(r,s));r[s]==="<"&&s--}}else{if(P2(r[s]))continue;return Ze("InvalidChar","char '"+r[s]+"' is not expected.",It(r,s))}if(n){if(t.length==1)return Ze("InvalidTag","Unclosed tag '"+t[0].tagName+"'.",It(r,t[0].tagStartPos));if(t.length>0)return Ze("InvalidXml","Invalid '"+JSON.stringify(t.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Ze("InvalidXml","Start tag expected.",1);return!0}function P2(r){return r===" "||r===" "||r===`
112
+ `||r==="\r"}function O2(r,e){let t=e;for(;e<r.length;e++)if(r[e]=="?"||r[e]==" "){let n=r.substr(t,e-t);if(e>5&&n==="xml")return Ze("InvalidXml","XML declaration allowed only at the start of the document.",It(r,e));if(r[e]=="?"&&r[e+1]==">"){e++;break}else continue}return e}function L2(r,e){if(r.length>e+5&&r[e+1]==="-"&&r[e+2]==="-"){for(e+=3;e<r.length;e++)if(r[e]==="-"&&r[e+1]==="-"&&r[e+2]===">"){e+=2;break}}else if(r.length>e+8&&r[e+1]==="D"&&r[e+2]==="O"&&r[e+3]==="C"&&r[e+4]==="T"&&r[e+5]==="Y"&&r[e+6]==="P"&&r[e+7]==="E"){let t=1;for(e+=8;e<r.length;e++)if(r[e]==="<")t++;else if(r[e]===">"&&(t--,t===0))break}else if(r.length>e+9&&r[e+1]==="["&&r[e+2]==="C"&&r[e+3]==="D"&&r[e+4]==="A"&&r[e+5]==="T"&&r[e+6]==="A"&&r[e+7]==="["){for(e+=8;e<r.length;e++)if(r[e]==="]"&&r[e+1]==="]"&&r[e+2]===">"){e+=2;break}}return e}var jL='"',HL="'";function WL(r,e){let t="",n="",i=!1;for(;e<r.length;e++){if(r[e]===jL||r[e]===HL)n===""?n=r[e]:n!==r[e]||(n="");else if(r[e]===">"&&n===""){i=!0;break}t+=r[e]}return n!==""?!1:{value:t,index:e,tagClosed:i}}var VL=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function N2(r,e){let t=el(r,VL),n={};for(let i=0;i<t.length;i++){if(t[i][1].length===0)return Ze("InvalidAttr","Attribute '"+t[i][2]+"' has no space in starting.",ma(t[i]));if(t[i][3]!==void 0&&t[i][4]===void 0)return Ze("InvalidAttr","Attribute '"+t[i][2]+"' is without value.",ma(t[i]));if(t[i][3]===void 0&&!e.allowBooleanAttributes)return Ze("InvalidAttr","boolean attribute '"+t[i][2]+"' is not allowed.",ma(t[i]));let s=t[i][2];if(!KL(s))return Ze("InvalidAttr","Attribute '"+s+"' is an invalid name.",ma(t[i]));if(!n.hasOwnProperty(s))n[s]=1;else return Ze("InvalidAttr","Attribute '"+s+"' is repeated.",ma(t[i]))}return!0}function GL(r,e){let t=/\d/;for(r[e]==="x"&&(e++,t=/[\da-fA-F]/);e<r.length;e++){if(r[e]===";")return e;if(!r[e].match(t))break}return-1}function qL(r,e){if(e++,r[e]===";")return-1;if(r[e]==="#")return e++,GL(r,e);let t=0;for(;e<r.length;e++,t++)if(!(r[e].match(/\w/)&&t<20)){if(r[e]===";")break;return-1}return e}function Ze(r,e,t){return{err:{code:r,msg:e,line:t.line||t,col:t.col}}}function KL(r){return Gi(r)}function XL(r){return Gi(r)}function It(r,e){let t=r.substring(0,e).split(/\r?\n/);return{line:t.length,col:t[t.length-1].length+1}}function ma(r){return r.startIndex+r[1].length}var YL={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(r,e){return e},attributeValueProcessor:function(r,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(r,e,t){return r},captureMetaData:!1};function B2(r){return typeof r=="boolean"?{enabled:r,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:typeof r=="object"&&r!==null?{enabled:r.enabled!==!1,maxEntitySize:r.maxEntitySize??1e4,maxExpansionDepth:r.maxExpansionDepth??10,maxTotalExpansions:r.maxTotalExpansions??1e3,maxExpandedLength:r.maxExpandedLength??1e5,allowedTags:r.allowedTags??null,tagFilter:r.tagFilter??null}:B2(!0)}var D2=function(r){let e=Object.assign({},YL,r);return e.processEntities=B2(e.processEntities),e};var tl;typeof Symbol!="function"?tl="@@xmlMetadata":tl=Symbol("XML Node Metadata");var Vt=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e,t){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),t!==void 0&&(this.child[this.child.length-1][tl]={startIndex:t})}static getMetaDataSymbol(){return tl}};var ya=class{constructor(e){this.suppressValidationErr=!e,this.options=e}readDocType(e,t){let n={};if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let i=1,s=!1,a=!1,o="";for(;t<e.length;t++)if(e[t]==="<"&&!a){if(s&&Xn(e,"!ENTITY",t)){t+=7;let u,l;if([u,l,t]=this.readEntityExp(e,t+1,this.suppressValidationErr),l.indexOf("&")===-1){let c=u.replace(/[.\-+*:]/g,"\\.");n[u]={regx:RegExp(`&${c};`,"g"),val:l}}}else if(s&&Xn(e,"!ELEMENT",t)){t+=8;let{index:u}=this.readElementExp(e,t+1);t=u}else if(s&&Xn(e,"!ATTLIST",t))t+=8;else if(s&&Xn(e,"!NOTATION",t)){t+=9;let{index:u}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=u}else if(Xn(e,"!--",t))a=!0;else throw new Error("Invalid DOCTYPE");i++,o=""}else if(e[t]===">"){if(a?e[t-1]==="-"&&e[t-2]==="-"&&(a=!1,i--):i--,i===0)break}else e[t]==="["?s=!0:o+=e[t];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:t}}readEntityExp(e,t){t=Bt(e,t);let n="";for(;t<e.length&&!/\s/.test(e[t])&&e[t]!=='"'&&e[t]!=="'";)n+=e[t],t++;if(ba(n),t=Bt(e,t),!this.suppressValidationErr){if(e.substring(t,t+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[t]==="%")throw new Error("Parameter entities are not supported")}let i="";if([t,i]=this.readIdentifierVal(e,t,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize&&i.length>this.options.maxEntitySize)throw new Error(`Entity "${n}" size (${i.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return t--,[n,i,t]}readNotationExp(e,t){t=Bt(e,t);let n="";for(;t<e.length&&!/\s/.test(e[t]);)n+=e[t],t++;!this.suppressValidationErr&&ba(n),t=Bt(e,t);let i=e.substring(t,t+6).toUpperCase();if(!this.suppressValidationErr&&i!=="SYSTEM"&&i!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${i}"`);t+=i.length,t=Bt(e,t);let s=null,a=null;if(i==="PUBLIC")[t,s]=this.readIdentifierVal(e,t,"publicIdentifier"),t=Bt(e,t),(e[t]==='"'||e[t]==="'")&&([t,a]=this.readIdentifierVal(e,t,"systemIdentifier"));else if(i==="SYSTEM"&&([t,a]=this.readIdentifierVal(e,t,"systemIdentifier"),!this.suppressValidationErr&&!a))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:n,publicIdentifier:s,systemIdentifier:a,index:--t}}readIdentifierVal(e,t,n){let i="",s=e[t];if(s!=='"'&&s!=="'")throw new Error(`Expected quoted string, found "${s}"`);for(t++;t<e.length&&e[t]!==s;)i+=e[t],t++;if(e[t]!==s)throw new Error(`Unterminated ${n} value`);return t++,[t,i]}readElementExp(e,t){t=Bt(e,t);let n="";for(;t<e.length&&!/\s/.test(e[t]);)n+=e[t],t++;if(!this.suppressValidationErr&&!Gi(n))throw new Error(`Invalid element name: "${n}"`);t=Bt(e,t);let i="";if(e[t]==="E"&&Xn(e,"MPTY",t))t+=4;else if(e[t]==="A"&&Xn(e,"NY",t))t+=2;else if(e[t]==="("){for(t++;t<e.length&&e[t]!==")";)i+=e[t],t++;if(e[t]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[t]}"`);return{elementName:n,contentModel:i.trim(),index:t}}readAttlistExp(e,t){t=Bt(e,t);let n="";for(;t<e.length&&!/\s/.test(e[t]);)n+=e[t],t++;ba(n),t=Bt(e,t);let i="";for(;t<e.length&&!/\s/.test(e[t]);)i+=e[t],t++;if(!ba(i))throw new Error(`Invalid attribute name: "${i}"`);t=Bt(e,t);let s="";if(e.substring(t,t+8).toUpperCase()==="NOTATION"){if(s="NOTATION",t+=8,t=Bt(e,t),e[t]!=="(")throw new Error(`Expected '(', found "${e[t]}"`);t++;let o=[];for(;t<e.length&&e[t]!==")";){let u="";for(;t<e.length&&e[t]!=="|"&&e[t]!==")";)u+=e[t],t++;if(u=u.trim(),!ba(u))throw new Error(`Invalid notation name: "${u}"`);o.push(u),e[t]==="|"&&(t++,t=Bt(e,t))}if(e[t]!==")")throw new Error("Unterminated list of notations");t++,s+=" ("+o.join("|")+")"}else{for(;t<e.length&&!/\s/.test(e[t]);)s+=e[t],t++;let o=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!o.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}t=Bt(e,t);let a="";return e.substring(t,t+8).toUpperCase()==="#REQUIRED"?(a="#REQUIRED",t+=8):e.substring(t,t+7).toUpperCase()==="#IMPLIED"?(a="#IMPLIED",t+=7):[t,a]=this.readIdentifierVal(e,t,"ATTLIST"),{elementName:n,attributeName:i,attributeType:s,defaultValue:a,index:t}}},Bt=(r,e)=>{for(;e<r.length&&/\s/.test(r[e]);)e++;return e};function Xn(r,e,t){for(let n=0;n<e.length;n++)if(e[n]!==r[t+n+1])return!1;return!0}function ba(r){if(Gi(r))return r;throw new Error(`Invalid entity name ${r}`)}var QL=/^[-+]?0x[a-fA-F0-9]+$/,ZL=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,JL={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function dp(r,e={}){if(e=Object.assign({},JL,e),!r||typeof r!="string")return r;let t=r.trim();if(e.skipLike!==void 0&&e.skipLike.test(t))return r;if(r==="0")return 0;if(e.hex&&QL.test(t))return n8(t,16);if(t.includes("e")||t.includes("E"))return t8(r,t,e);{let n=ZL.exec(t);if(n){let i=n[1]||"",s=n[2],a=r8(n[3]),o=i?r[s.length+1]===".":r[s.length]===".";if(!e.leadingZeros&&(s.length>1||s.length===1&&!o))return r;{let u=Number(t),l=String(u);if(u===0)return u;if(l.search(/[eE]/)!==-1)return e.eNotation?u:r;if(t.indexOf(".")!==-1)return l==="0"||l===a||l===`${i}${a}`?u:r;let c=s?a:t;return s?c===l||i+c===l?u:r:c===l||c===i+l?u:r}}else return r}}var e8=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function t8(r,e,t){if(!t.eNotation)return r;let n=e.match(e8);if(n){let i=n[1]||"",s=n[3].indexOf("e")===-1?"E":"e",a=n[2],o=i?r[a.length+1]===s:r[a.length]===s;return a.length>1&&o?r:a.length===1&&(n[3].startsWith(`.${s}`)||n[3][0]===s)?Number(e):t.leadingZeros&&!o?(e=(n[1]||"")+n[3],Number(e)):r}else return r}function r8(r){return r&&r.indexOf(".")!==-1&&(r=r.replace(/0+$/,""),r==="."?r="0":r[0]==="."?r="0"+r:r[r.length-1]==="."&&(r=r.substring(0,r.length-1))),r}function n8(r,e){if(parseInt)return parseInt(r,e);if(Number.parseInt)return Number.parseInt(r,e);if(window&&window.parseInt)return window.parseInt(r,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function fp(r){return typeof r=="function"?r:Array.isArray(r)?e=>{for(let t of r)if(typeof t=="string"&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1}var va=class{constructor(e){if(this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,n)=>F2(n,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,n)=>F2(n,16,"&#x")}},this.addExternalEntities=i8,this.parseXml=l8,this.parseTextData=s8,this.resolveNameSpace=a8,this.buildAttributesMap=u8,this.isItStopNode=f8,this.replaceEntitiesValue=h8,this.readStopNodeData=g8,this.saveTextToParentTag=d8,this.addChild=c8,this.ignoreAttributesFn=fp(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let t=0;t<this.options.stopNodes.length;t++){let n=this.options.stopNodes[t];typeof n=="string"&&(n.startsWith("*.")?this.stopNodesWildcard.add(n.substring(2)):this.stopNodesExact.add(n))}}}};function i8(r){let e=Object.keys(r);for(let t=0;t<e.length;t++){let n=e[t],i=n.replace(/[.\-+*:]/g,"\\.");this.lastEntities[n]={regex:new RegExp("&"+i+";","g"),val:r[n]}}}function s8(r,e,t,n,i,s,a){if(r!==void 0&&(this.options.trimValues&&!n&&(r=r.trim()),r.length>0)){a||(r=this.replaceEntitiesValue(r,e,t));let o=this.options.tagValueProcessor(e,r,t,i,s);return o==null?r:typeof o!=typeof r||o!==r?o:this.options.trimValues?gp(r,this.options.parseTagValue,this.options.numberParseOptions):r.trim()===r?gp(r,this.options.parseTagValue,this.options.numberParseOptions):r}}function a8(r){if(this.options.removeNSPrefix){let e=r.split(":"),t=r.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(r=t+e[1])}return r}var o8=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function u8(r,e,t){if(this.options.ignoreAttributes!==!0&&typeof r=="string"){let n=el(r,o8),i=n.length,s={};for(let a=0;a<i;a++){let o=this.resolveNameSpace(n[a][1]);if(this.ignoreAttributesFn(o,e))continue;let u=n[a][4],l=this.options.attributeNamePrefix+o;if(o.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),u!==void 0){this.options.trimValues&&(u=u.trim()),u=this.replaceEntitiesValue(u,t,e);let c=this.options.attributeValueProcessor(o,u,e);c==null?s[l]=u:typeof c!=typeof u||c!==u?s[l]=c:s[l]=gp(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[l]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){let a={};return a[this.options.attributesGroupName]=s,a}return s}}var l8=function(r){r=r.replace(/\r\n?/g,`
113
+ `);let e=new Vt("!xml"),t=e,n="",i="";this.entityExpansionCount=0,this.currentExpandedLength=0;let s=new ya(this.options.processEntities);for(let a=0;a<r.length;a++)if(r[a]==="<")if(r[a+1]==="/"){let u=Yn(r,">",a,"Closing Tag is not closed."),l=r.substring(a+2,u).trim();if(this.options.removeNSPrefix){let d=l.indexOf(":");d!==-1&&(l=l.substr(d+1))}this.options.transformTagName&&(l=this.options.transformTagName(l)),t&&(n=this.saveTextToParentTag(n,t,i));let c=i.substring(i.lastIndexOf(".")+1);if(l&&this.options.unpairedTags.indexOf(l)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);let h=0;c&&this.options.unpairedTags.indexOf(c)!==-1?(h=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):h=i.lastIndexOf("."),i=i.substring(0,h),t=this.tagsNodeStack.pop(),n="",a=u}else if(r[a+1]==="?"){let u=pp(r,a,!1,"?>");if(!u)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,t,i),!(this.options.ignoreDeclaration&&u.tagName==="?xml"||this.options.ignorePiTags)){let l=new Vt(u.tagName);l.add(this.options.textNodeName,""),u.tagName!==u.tagExp&&u.attrExpPresent&&(l[":@"]=this.buildAttributesMap(u.tagExp,i,u.tagName)),this.addChild(t,l,i,a)}a=u.closeIndex+1}else if(r.substr(a+1,3)==="!--"){let u=Yn(r,"-->",a+4,"Comment is not closed.");if(this.options.commentPropName){let l=r.substring(a+4,u-2);n=this.saveTextToParentTag(n,t,i),t.add(this.options.commentPropName,[{[this.options.textNodeName]:l}])}a=u}else if(r.substr(a+1,2)==="!D"){let u=s.readDocType(r,a);this.docTypeEntities=u.entities,a=u.i}else if(r.substr(a+1,2)==="!["){let u=Yn(r,"]]>",a,"CDATA is not closed.")-2,l=r.substring(a+9,u);n=this.saveTextToParentTag(n,t,i);let c=this.parseTextData(l,t.tagname,i,!0,!1,!0,!0);c==null&&(c=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:l}]):t.add(this.options.textNodeName,c),a=u+2}else{let u=pp(r,a,this.options.removeNSPrefix),l=u.tagName,c=u.rawTagName,h=u.tagExp,d=u.attrExpPresent,f=u.closeIndex;if(this.options.transformTagName){let b=this.options.transformTagName(l);h===l&&(h=b),l=b}t&&n&&t.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,t,i,!1));let p=t;p&&this.options.unpairedTags.indexOf(p.tagname)!==-1&&(t=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),l!==e.tagname&&(i+=i?"."+l:l);let g=a;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,i,l)){let b="";if(h.length>0&&h.lastIndexOf("/")===h.length-1)l[l.length-1]==="/"?(l=l.substr(0,l.length-1),i=i.substr(0,i.length-1),h=l):h=h.substr(0,h.length-1),a=u.closeIndex;else if(this.options.unpairedTags.indexOf(l)!==-1)a=u.closeIndex;else{let y=this.readStopNodeData(r,c,f+1);if(!y)throw new Error(`Unexpected end of ${c}`);a=y.i,b=y.tagContent}let m=new Vt(l);l!==h&&d&&(m[":@"]=this.buildAttributesMap(h,i,l)),b&&(b=this.parseTextData(b,l,i,!0,d,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),m.add(this.options.textNodeName,b),this.addChild(t,m,i,g)}else{if(h.length>0&&h.lastIndexOf("/")===h.length-1){if(l[l.length-1]==="/"?(l=l.substr(0,l.length-1),i=i.substr(0,i.length-1),h=l):h=h.substr(0,h.length-1),this.options.transformTagName){let m=this.options.transformTagName(l);h===l&&(h=m),l=m}let b=new Vt(l);l!==h&&d&&(b[":@"]=this.buildAttributesMap(h,i,l)),this.addChild(t,b,i,g),i=i.substr(0,i.lastIndexOf("."))}else{let b=new Vt(l);this.tagsNodeStack.push(t),l!==h&&d&&(b[":@"]=this.buildAttributesMap(h,i,l)),this.addChild(t,b,i,g),t=b}n="",a=f}}else n+=r[a];return e.child};function c8(r,e,t,n){this.options.captureMetaData||(n=void 0);let i=this.options.updateTag(e.tagname,t,e[":@"]);i===!1||(typeof i=="string"&&(e.tagname=i),r.addChild(e,n))}var h8=function(r,e,t){if(r.indexOf("&")===-1)return r;let n=this.options.processEntities;if(!n.enabled||n.allowedTags&&!n.allowedTags.includes(e)||n.tagFilter&&!n.tagFilter(e,t))return r;for(let i in this.docTypeEntities){let s=this.docTypeEntities[i],a=r.match(s.regx);if(a){if(this.entityExpansionCount+=a.length,n.maxTotalExpansions&&this.entityExpansionCount>n.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n.maxTotalExpansions}`);let o=r.length;if(r=r.replace(s.regx,s.val),n.maxExpandedLength&&(this.currentExpandedLength+=r.length-o,this.currentExpandedLength>n.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${n.maxExpandedLength}`)}}if(r.indexOf("&")===-1)return r;for(let i in this.lastEntities){let s=this.lastEntities[i];r=r.replace(s.regex,s.val)}if(r.indexOf("&")===-1)return r;if(this.options.htmlEntities)for(let i in this.htmlEntities){let s=this.htmlEntities[i];r=r.replace(s.regex,s.val)}return r=r.replace(this.ampEntity.regex,this.ampEntity.val),r};function d8(r,e,t,n){return r&&(n===void 0&&(n=e.child.length===0),r=this.parseTextData(r,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,n),r!==void 0&&r!==""&&e.add(this.options.textNodeName,r),r=""),r}function f8(r,e,t,n){return!!(e&&e.has(n)||r&&r.has(t))}function p8(r,e,t=">"){let n,i="";for(let s=e;s<r.length;s++){let a=r[s];if(n)a===n&&(n="");else if(a==='"'||a==="'")n=a;else if(a===t[0])if(t[1]){if(r[s+1]===t[1])return{data:i,index:s}}else return{data:i,index:s};else a===" "&&(a=" ");i+=a}}function Yn(r,e,t,n){let i=r.indexOf(e,t);if(i===-1)throw new Error(n);return i+e.length-1}function pp(r,e,t,n=">"){let i=p8(r,e+1,n);if(!i)return;let s=i.data,a=i.index,o=s.search(/\s/),u=s,l=!0;o!==-1&&(u=s.substring(0,o),s=s.substring(o+1).trimStart());let c=u;if(t){let h=u.indexOf(":");h!==-1&&(u=u.substr(h+1),l=u!==i.data.substr(h+1))}return{tagName:u,tagExp:s,closeIndex:a,attrExpPresent:l,rawTagName:c}}function g8(r,e,t){let n=t,i=1;for(;t<r.length;t++)if(r[t]==="<")if(r[t+1]==="/"){let s=Yn(r,">",t,`${e} is not closed`);if(r.substring(t+2,s).trim()===e&&(i--,i===0))return{tagContent:r.substring(n,t),i:s};t=s}else if(r[t+1]==="?")t=Yn(r,"?>",t+1,"StopNode is not closed.");else if(r.substr(t+1,3)==="!--")t=Yn(r,"-->",t+3,"StopNode is not closed.");else if(r.substr(t+1,2)==="![")t=Yn(r,"]]>",t,"StopNode is not closed.")-2;else{let s=pp(r,t,">");s&&((s&&s.tagName)===e&&s.tagExp[s.tagExp.length-1]!=="/"&&i++,t=s.closeIndex)}}function gp(r,e,t){if(e&&typeof r=="string"){let n=r.trim();return n==="true"?!0:n==="false"?!1:dp(r,t)}else return R2(r)?r:""}function F2(r,e,t){let n=Number.parseInt(r,e);return n>=0&&n<=1114111?String.fromCodePoint(n):t+r+";"}var mp=Vt.getMetaDataSymbol();function bp(r,e){return $2(r,e)}function $2(r,e,t){let n,i={};for(let s=0;s<r.length;s++){let a=r[s],o=m8(a),u="";if(t===void 0?u=o:u=t+"."+o,o===e.textNodeName)n===void 0?n=a[o]:n+=""+a[o];else{if(o===void 0)continue;if(a[o]){let l=$2(a[o],e,u),c=y8(l,e);a[mp]!==void 0&&(l[mp]=a[mp]),a[":@"]?b8(l,a[":@"],u,e):Object.keys(l).length===1&&l[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?l=l[e.textNodeName]:Object.keys(l).length===0&&(e.alwaysCreateTextNode?l[e.textNodeName]="":l=""),i[o]!==void 0&&i.hasOwnProperty(o)?(Array.isArray(i[o])||(i[o]=[i[o]]),i[o].push(l)):e.isArray(o,u,c)?i[o]=[l]:i[o]=l}}}return typeof n=="string"?n.length>0&&(i[e.textNodeName]=n):n!==void 0&&(i[e.textNodeName]=n),i}function m8(r){let e=Object.keys(r);for(let t=0;t<e.length;t++){let n=e[t];if(n!==":@")return n}}function b8(r,e,t,n){if(e){let i=Object.keys(e),s=i.length;for(let a=0;a<s;a++){let o=i[a];n.isArray(o,t+"."+o,!0,!0)?r[o]=[e[o]]:r[o]=e[o]}}}function y8(r,e){let{textNodeName:t}=e,n=Object.keys(r).length;return!!(n===0||n===1&&(r[t]||typeof r[t]=="boolean"||r[t]===0))}var qi=class{constructor(e){this.externalEntities={},this.options=D2(e)}parse(e,t){if(typeof e!="string"&&e.toString)e=e.toString();else if(typeof e!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(t){t===!0&&(t={});let s=M2(e,t);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}let n=new va(this.options);n.addExternalEntities(this.externalEntities);let i=n.parseXml(e);return this.options.preserveOrder||i===void 0?i:bp(i,this.options)}addEntity(e,t){if(t.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(t==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}static getMetaDataSymbol(){return Vt.getMetaDataSymbol()}};var Ee;(function(r){r.Root="root",r.Text="text",r.Directive="directive",r.Comment="comment",r.Script="script",r.Style="style",r.Tag="tag",r.CDATA="cdata",r.Doctype="doctype"})(Ee||(Ee={}));function U2(r){return r.type===Ee.Tag||r.type===Ee.Script||r.type===Ee.Style}var z2=Ee.Root,j2=Ee.Text,H2=Ee.Directive,W2=Ee.Comment,V2=Ee.Script,G2=Ee.Style,q2=Ee.Tag,K2=Ee.CDATA,X2=Ee.Doctype;var rl=class{constructor(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}get parentNode(){return this.parent}set parentNode(e){this.parent=e}get previousSibling(){return this.prev}set previousSibling(e){this.prev=e}get nextSibling(){return this.next}set nextSibling(e){this.next=e}cloneNode(e=!1){return Z2(this,e)}},wa=class extends rl{constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},Ki=class extends wa{constructor(){super(...arguments),this.type=Ee.Text}get nodeType(){return 3}},xa=class extends wa{constructor(){super(...arguments),this.type=Ee.Comment}get nodeType(){return 8}},Sa=class extends wa{constructor(e,t){super(t),this.name=e,this.type=Ee.Directive}get nodeType(){return 1}},Ea=class extends rl{constructor(e){super(),this.children=e}get firstChild(){var e;return(e=this.children[0])!==null&&e!==void 0?e:null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(e){this.children=e}},Aa=class extends Ea{constructor(){super(...arguments),this.type=Ee.CDATA}get nodeType(){return 4}},Xi=class extends Ea{constructor(){super(...arguments),this.type=Ee.Root}get nodeType(){return 9}},Ta=class extends Ea{constructor(e,t,n=[],i=e==="script"?Ee.Script:e==="style"?Ee.Style:Ee.Tag){super(n),this.name=e,this.attribs=t,this.type=i}get nodeType(){return 1}get tagName(){return this.name}set tagName(e){this.name=e}get attributes(){return Object.keys(this.attribs).map(e=>{var t,n;return{name:e,value:this.attribs[e],namespace:(t=this["x-attribsNamespace"])===null||t===void 0?void 0:t[e],prefix:(n=this["x-attribsPrefix"])===null||n===void 0?void 0:n[e]}})}};function Qr(r){return U2(r)}function vp(r){return r.type===Ee.CDATA}function nl(r){return r.type===Ee.Text}function wp(r){return r.type===Ee.Comment}function v8(r){return r.type===Ee.Directive}function Q2(r){return r.type===Ee.Root}function Z2(r,e=!1){let t;if(nl(r))t=new Ki(r.data);else if(wp(r))t=new xa(r.data);else if(Qr(r)){let n=e?yp(r.children):[],i=new Ta(r.name,{...r.attribs},n);n.forEach(s=>s.parent=i),r.namespace!=null&&(i.namespace=r.namespace),r["x-attribsNamespace"]&&(i["x-attribsNamespace"]={...r["x-attribsNamespace"]}),r["x-attribsPrefix"]&&(i["x-attribsPrefix"]={...r["x-attribsPrefix"]}),t=i}else if(vp(r)){let n=e?yp(r.children):[],i=new Aa(n);n.forEach(s=>s.parent=i),t=i}else if(Q2(r)){let n=e?yp(r.children):[],i=new Xi(n);n.forEach(s=>s.parent=i),r["x-mode"]&&(i["x-mode"]=r["x-mode"]),t=i}else if(v8(r)){let n=new Sa(r.name,r.data);r["x-name"]!=null&&(n["x-name"]=r["x-name"],n["x-publicId"]=r["x-publicId"],n["x-systemId"]=r["x-systemId"]),t=n}else throw new Error(`Not implemented yet: ${r.type}`);return t.startIndex=r.startIndex,t.endIndex=r.endIndex,r.sourceCodeLocation!=null&&(t.sourceCodeLocation=r.sourceCodeLocation),t}function yp(r){let e=r.map(t=>Z2(t,!0));for(let t=1;t<e.length;t++)e[t].prev=e[t-1],e[t-1].next=e[t];return e}var J2={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},Yi=class{constructor(e,t,n){this.dom=[],this.root=new Xi(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof t=="function"&&(n=t,t=J2),typeof e=="object"&&(t=e,e=void 0),this.callback=e??null,this.options=t??J2,this.elementCB=n??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new Xi(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(e){this.handleCallback(e)}onclosetag(){this.lastNode=null;let e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)}onopentag(e,t){let n=this.options.xmlMode?Ee.Tag:void 0,i=new Ta(e,t,void 0,n);this.addNode(i),this.tagStack.push(i)}ontext(e){let{lastNode:t}=this;if(t&&t.type===Ee.Text)t.data+=e,this.options.withEndIndices&&(t.endIndex=this.parser.endIndex);else{let n=new Ki(e);this.addNode(n),this.lastNode=n}}oncomment(e){if(this.lastNode&&this.lastNode.type===Ee.Comment){this.lastNode.data+=e;return}let t=new xa(e);this.addNode(t),this.lastNode=t}oncommentend(){this.lastNode=null}oncdatastart(){let e=new Ki(""),t=new Aa([e]);this.addNode(t),e.parent=t,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,t){let n=new Sa(e,t);this.addNode(n)}handleCallback(e){if(typeof this.callback=="function")this.callback(e,this.dom);else if(e)throw e}addNode(e){let t=this.tagStack[this.tagStack.length-1],n=t.children[t.children.length-1];this.options.withStartIndices&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),t.children.push(e),n&&(e.prev=n,n.next=e),e.parent=t,this.lastNode=null}};var w8=/\n/g;function x8(r){let e=[...r.matchAll(w8)].map((n=>n.index||0));e.unshift(-1);let t=xp(e,0,e.length);return n=>tS(t,n)}function xp(r,e,t){if(t-e==1)return{offset:r[e],index:e+1};let n=Math.ceil((e+t)/2),i=xp(r,e,n),s=xp(r,n,t);return{offset:i.offset,low:i,high:s}}function tS(r,e){return(function(t){return Object.prototype.hasOwnProperty.call(t,"index")})(r)?{line:r.index,column:e-r.offset}:tS(r.high.offset<e?r.high:r.low,e)}function Sp(r,e="",t={}){let n=typeof e!="string"?e:t,i=typeof e=="string"?e:"",s=r.map(S8),a=!!n.lineNumbers;return function(o,u=0){let l=a?x8(o):()=>({line:0,column:0}),c=u,h=[];e:for(;c<o.length;){let d=!1;for(let f of s){f.regex.lastIndex=c;let p=f.regex.exec(o);if(p&&p[0].length>0){if(!f.discard){let g=l(c),b=typeof f.replace=="string"?p[0].replace(new RegExp(f.regex.source,f.regex.flags),f.replace):p[0];h.push({state:i,name:f.name,text:b,offset:c,len:p[0].length,line:g.line,column:g.column})}if(c=f.regex.lastIndex,d=!0,f.push){let g=f.push(o,c);h.push(...g.tokens),c=g.offset}if(f.pop)break e;break}}if(!d)break}return{tokens:h,offset:c,complete:o.length<=c}}}function S8(r,e){return{...r,regex:E8(r,e)}}function E8(r,e){if(r.name.length===0)throw new Error(`Rule #${e} has empty name, which is not allowed.`);if((function(t){return Object.prototype.hasOwnProperty.call(t,"regex")})(r))return(function(t){if(t.global)throw new Error(`Regular expression /${t.source}/${t.flags} contains the global flag, which is not allowed.`);return t.sticky?t:new RegExp(t.source,t.flags+"y")})(r.regex);if((function(t){return Object.prototype.hasOwnProperty.call(t,"str")})(r)){if(r.str.length===0)throw new Error(`Rule #${e} ("${r.name}") has empty "str" property, which is not allowed.`);return new RegExp(eS(r.str),"y")}return new RegExp(eS(r.name),"y")}function eS(r){return r.replace(/[-[\]{}()*+!<=:?./\\^$|#\s,]/g,"\\$&")}function Lr(r,e){return(t,n)=>{let i=n,s;return n<t.tokens.length?(s=r(t.tokens[n],t,n),s!==void 0&&i++):e?.(t,n),s===void 0?{matched:!1}:{matched:!0,position:i,value:s}}}function Ep(r,e){return r.matched?{matched:!0,position:r.position,value:e(r.value,r.position)}:r}function il(r,e){return r.matched?e(r):r}function pt(r,e){return(t,n)=>Ep(r(t,n),(i,s)=>e(i,t,n,s))}function _a(r,e){return(t,n)=>{let i=r(t,n);return i.matched?i:{matched:!0,position:n,value:e}}}function Qi(...r){return(e,t)=>{for(let n of r){let i=n(e,t);if(i.matched)return i}return{matched:!1}}}function xn(r,e){return(t,n)=>{let i=r(t,n);return i.matched?i:e(t,n)}}function A8(r,e){return(t,n)=>{let i=[],s=!0;do{let a=r(t,n);a.matched&&e(a.value,i.length+1,t,n,a.position)?(i.push(a.value),n=a.position):s=!1}while(s);return{matched:!0,position:n,value:i}}}function sl(r){return A8(r,()=>!0)}function rS(r){return wt(r,sl(r),(e,t)=>[e,...t])}function wt(r,e,t){return(n,i)=>il(r(n,i),s=>Ep(e(n,s.position),(a,o)=>t(s.value,a,n,i,o)))}function nS(r,e){return wt(r,e,t=>t)}function Ap(r,e){return wt(r,e,(t,n)=>n)}function al(r,e,t,n){return(i,s)=>il(r(i,s),a=>il(e(i,a.position),o=>Ep(t(i,o.position),(u,l)=>n(a.value,o.value,u,i,s,l))))}function Tp(r,e,t){return al(r,e,t,(n,i)=>i)}function T8(...r){return(e,t)=>{let n=[],i=t;for(let s of r){let a=s(e,i);if(a.matched)n.push(a.value),i=a.position;else return{matched:!1}}return{matched:!0,position:i,value:n}}}function iS(...r){return _8(T8(...r))}function _8(r){return pt(r,e=>e.flatMap(t=>t))}function C8(r,e){return(t,n)=>{let i=!0,s=r,a=n;do{let o=e(s,t,a)(t,a);o.matched?(s=o.value,a=o.position):i=!1}while(i);return{matched:!0,position:a,value:s}}}function k8(r,e,t){return C8(r,n=>pt(e,(i,s,a,o)=>t(n,i,s,a,o)))}function _p(r,e,t){return I8(r,n=>k8(n,wt(e,t,(i,s)=>[i,s]),(i,[s,a])=>s(i,a)))}function I8(r,e){return(t,n)=>il(r(t,n),i=>e(i.value,t,n,i.position)(t,i.position))}var P8="(?:[ \\t\\r\\n\\f]*)",cS="(?:\\n|\\r\\n|\\r|\\f)",ll="[^\\x00-\\x7F]",Ia="(?:\\\\[0-9a-f]{1,6}(?:\\r\\n|[ \\n\\r\\t\\f])?)",Ra="(?:\\\\[^\\n\\r\\f0-9a-f])",O8=`(?:[_a-z]|${ll}|${Ia}|${Ra})`,hS=`(?:[_a-z0-9-]|${ll}|${Ia}|${Ra})`,L8=`(?:${hS}+)`,N8=`(?:[-]?${O8}${hS}*)`,M8=`'([^\\n\\r\\f\\\\']|\\\\${cS}|${ll}|${Ia}|${Ra})*'`,B8=`"([^\\n\\r\\f\\\\"]|\\\\${cS}|${ll}|${Ia}|${Ra})*"`,D8=Sp([{name:"ws",regex:new RegExp(P8)},{name:"hash",regex:new RegExp(`#${L8}`,"i")},{name:"ident",regex:new RegExp(N8,"i")},{name:"str1",regex:new RegExp(M8,"i")},{name:"str2",regex:new RegExp(B8,"i")},{name:"*"},{name:"."},{name:","},{name:"["},{name:"]"},{name:"="},{name:">"},{name:"|"},{name:"+"},{name:"~"},{name:"^"},{name:"$"}]),F8=Sp([{name:"unicode",regex:new RegExp(Ia,"i")},{name:"escape",regex:new RegExp(Ra,"i")},{name:"any",regex:new RegExp("[\\s\\S]","i")}]);function dS([r,e,t],[n,i,s]){return[r+n,e+i,t+s]}function $8(r){return r.reduce(dS,[0,0,0])}var U8=Lr(r=>r.name==="unicode"?String.fromCodePoint(parseInt(r.text.slice(1),16)):void 0),z8=Lr(r=>r.name==="escape"?r.text.slice(1):void 0),j8=Lr(r=>r.name==="any"?r.text:void 0),H8=pt(sl(Qi(U8,z8,j8)),r=>r.join(""));function Ip(r){let e=F8(r);return H8({tokens:e.tokens,options:void 0},0).value}function $e(r){return Lr(e=>e.name===r?!0:void 0)}var Rp=Lr(r=>r.name==="ws"?null:void 0),Cp=_a(Rp,null);function Ji(r){return Tp(Cp,r,Cp)}var ka=Lr(r=>r.name==="ident"?Ip(r.text):void 0),W8=Lr(r=>r.name==="hash"?Ip(r.text.slice(1)):void 0),V8=Lr(r=>r.name.startsWith("str")?Ip(r.text.slice(1,-1)):void 0),fS=nS(_a(ka,""),$e("|")),Pp=xn(wt(fS,ka,(r,e)=>({name:e,namespace:r})),pt(ka,r=>({name:r,namespace:null}))),G8=xn(wt(fS,$e("*"),r=>({type:"universal",namespace:r,specificity:[0,0,0]})),pt($e("*"),()=>({type:"universal",namespace:null,specificity:[0,0,0]}))),q8=pt(Pp,({name:r,namespace:e})=>({type:"tag",name:r,namespace:e,specificity:[0,0,1]})),K8=wt($e("."),ka,(r,e)=>({type:"class",name:e,specificity:[0,1,0]})),X8=pt(W8,r=>({type:"id",name:r,specificity:[1,0,0]})),sS=Lr(r=>{if(r.name==="ident"){if(r.text==="i"||r.text==="I")return"i";if(r.text==="s"||r.text==="S")return"s"}}),Y8=xn(wt(V8,_a(Ap(Cp,sS),null),(r,e)=>({value:r,modifier:e})),wt(ka,_a(Ap(Rp,sS),null),(r,e)=>({value:r,modifier:e}))),Q8=Qi(pt($e("="),()=>"="),wt($e("~"),$e("="),()=>"~="),wt($e("|"),$e("="),()=>"|="),wt($e("^"),$e("="),()=>"^="),wt($e("$"),$e("="),()=>"$="),wt($e("*"),$e("="),()=>"*=")),Z8=al($e("["),Ji(Pp),$e("]"),(r,{name:e,namespace:t})=>({type:"attrPresence",name:e,namespace:t,specificity:[0,1,0]})),J8=Tp($e("["),al(Ji(Pp),Q8,Ji(Y8),({name:r,namespace:e},t,{value:n,modifier:i})=>({type:"attrValue",name:r,namespace:e,matcher:t,value:n,modifier:i,specificity:[0,1,0]})),$e("]")),eN=xn(Z8,J8),tN=xn(G8,q8),aS=Qi(X8,K8,eN),oS=pt(xn(iS(tN,sl(aS)),rS(aS)),r=>({type:"compound",list:r,specificity:$8(r.map(e=>e.specificity))})),rN=Qi(pt($e(">"),()=>">"),pt($e("+"),()=>"+"),pt($e("~"),()=>"~"),wt($e("|"),$e("|"),()=>"||")),nN=xn(Ji(rN),pt(Rp,()=>" ")),kp=_p(oS,pt(nN,r=>(e,t)=>({type:"compound",list:[...t.list,{type:"combinator",combinator:r,left:e,specificity:e.specificity}],specificity:dS(e.specificity,t.specificity)})),oS),x$=_p(pt(kp,r=>({type:"list",list:[r]})),pt(Ji($e(",")),()=>(r,e)=>({type:"list",list:[...r.list,e]})),kp);function iN(r,e){if(!(typeof e=="string"||e instanceof String))throw new Error("Expected a selector string. Actual input is not a string!");let t=D8(e);if(!t.complete)throw new Error(`The input "${e}" was only partially tokenized, stopped at offset ${t.offset}!
114
+ `+uS(e,t.offset));let n=Ji(r)({tokens:t.tokens,options:void 0},0);if(!n.matched)throw new Error(`No match for "${e}" input!`);if(n.position<t.tokens.length){let i=t.tokens[n.position];throw new Error(`The input "${e}" was only partially parsed, stopped at offset ${i.offset}!
115
+ `+uS(e,i.offset,i.len))}return n.value}function uS(r,e,t=1){return`${r.replace(/(\t)|(\r)|(\n)/g,(n,i,s)=>i?"\u2409":s?"\u240D":"\u240A")}
116
+ ${"".padEnd(e)}${"^".repeat(t)}`}function pS(r){return iN(kp,r)}function vr(r){if(!r.type)throw new Error("This is not an AST node.");switch(r.type){case"universal":return ol(r.namespace)+"*";case"tag":return ol(r.namespace)+Zi(r.name);case"class":return"."+Zi(r.name);case"id":return"#"+Zi(r.name);case"attrPresence":return`[${ol(r.namespace)}${Zi(r.name)}]`;case"attrValue":return`[${ol(r.namespace)}${Zi(r.name)}${r.matcher}"${sN(r.value)}"${r.modifier?r.modifier:""}]`;case"combinator":return vr(r.left)+r.combinator;case"compound":return r.list.reduce((e,t)=>t.type==="combinator"?vr(t)+e:e+vr(t),"");case"list":return r.list.map(vr).join(",")}}function ol(r){return r||r===""?Zi(r)+"|":""}function ul(r){return`\\${r.codePointAt(0).toString(16)} `}function Zi(r){return r.replace(/(^[0-9])|(^-[0-9])|(^-$)|([-0-9a-zA-Z_]|[^\x00-\x7F])|(\x00)|([\x01-\x1f]|\x7f)|([\s\S])/g,(e,t,n,i,s,a,o,u)=>t?ul(t):n?"-"+ul(n.slice(1)):i?"\\-":s||(a?"\uFFFD":o?ul(o):"\\"+u))}function sN(r){return r.replace(/(")|(\\)|(\x00)|([\x01-\x1f]|\x7f)/g,(e,t,n,i,s)=>t?'\\"':n?"\\\\":i?"\uFFFD":ul(s))}function Ca(r){if(!r.type)throw new Error("This is not an AST node.");switch(r.type){case"compound":{r.list.forEach(Ca),r.list.sort((e,t)=>gS(lS(e),lS(t)));break}case"combinator":{Ca(r.left);break}case"list":{r.list.forEach(Ca),r.list.sort((e,t)=>vr(e)<vr(t)?-1:1);break}}return r}function lS(r){switch(r.type){case"universal":return[1];case"tag":return[1];case"id":return[2];case"class":return[3,r.name];case"attrPresence":return[4,vr(r)];case"attrValue":return[5,vr(r)];case"combinator":return[15,vr(r)]}}function Op(r,e){return gS(r,e)}function gS(r,e){if(!Array.isArray(r)||!Array.isArray(e))throw new Error("Arguments must be arrays.");let t=r.length<e.length?r.length:e.length;for(let n=0;n<t;n++)if(r[n]!==e[n])return r[n]<e[n]?-1:1;return r.length-e.length}var Pa=class{constructor(e){this.branches=es(oN(e))}build(e){return e(this.branches)}};function oN(r){let e=r.length,t=new Array(e);for(let n=0;n<e;n++){let[i,s]=r[n],a=uN(pS(i));t[n]={ast:a,terminal:{type:"terminal",valueContainer:{index:n,value:s,specificity:a.specificity}}}}return t}function uN(r){return bS(r),Ca(r),r}function bS(r){let e=[];r.list.forEach(t=>{switch(t.type){case"class":e.push({matcher:"~=",modifier:null,name:"class",namespace:null,specificity:t.specificity,type:"attrValue",value:t.name});break;case"id":e.push({matcher:"=",modifier:null,name:"id",namespace:null,specificity:t.specificity,type:"attrValue",value:t.name});break;case"combinator":bS(t.left),e.push(t);break;case"universal":break;default:e.push(t);break}}),r.list=e}function es(r){let e=[];for(;r.length;){let t=wS(r,a=>!0,yS),{matches:n,nonmatches:i,empty:s}=cN(r,t);r=i,n.length&&e.push(hN(t,n)),s.length&&e.push(...lN(s))}return e}function lN(r){let e=[];for(let t of r){let n=t.terminal;if(n.type==="terminal")e.push(n);else{let{matches:i,rest:s}=mN(n.cont,a=>a.type==="terminal");i.forEach(a=>e.push(a)),s.length&&(n.cont=s,e.push(n))}}return e}function cN(r,e){let t=[],n=[],i=[];for(let s of r){let a=s.ast.list;a.length?(a.some(u=>yS(u)===e)?t:n).push(s):i.push(s)}return{matches:t,nonmatches:n,empty:i}}function yS(r){switch(r.type){case"attrPresence":return`attrPresence ${r.name}`;case"attrValue":return`attrValue ${r.name}`;case"combinator":return`combinator ${r.combinator}`;default:return r.type}}function hN(r,e){if(r==="tag")return dN(e);if(r.startsWith("attrValue "))return pN(r.substring(10),e);if(r.startsWith("attrPresence "))return fN(r.substring(13),e);if(r==="combinator >")return mS(">",e);if(r==="combinator +")return mS("+",e);throw new Error(`Unsupported selector kind: ${r}`)}function dN(r){let e=Lp(r,n=>n.type==="tag",n=>n.name);return{type:"tagName",variants:Object.entries(e).map(([n,i])=>({type:"variant",value:n,cont:es(i.items)}))}}function fN(r,e){for(let t of e)vS(t,n=>n.type==="attrPresence"&&n.name===r);return{type:"attrPresence",name:r,cont:es(e)}}function pN(r,e){let t=Lp(e,i=>i.type==="attrValue"&&i.name===r,i=>`${i.matcher} ${i.modifier||""} ${i.value}`),n=[];for(let i of Object.values(t)){let s=i.oneSimpleSelector,a=gN(s),o=es(i.items);n.push({type:"matcher",matcher:s.matcher,modifier:s.modifier,value:s.value,predicate:a,cont:o})}return{type:"attrValue",name:r,matchers:n}}function gN(r){if(r.modifier==="i"){let e=r.value.toLowerCase();switch(r.matcher){case"=":return t=>e===t.toLowerCase();case"~=":return t=>t.toLowerCase().split(/[ \t]+/).includes(e);case"^=":return t=>t.toLowerCase().startsWith(e);case"$=":return t=>t.toLowerCase().endsWith(e);case"*=":return t=>t.toLowerCase().includes(e);case"|=":return t=>{let n=t.toLowerCase();return e===n||n.startsWith(e)&&n[e.length]==="-"}}}else{let e=r.value;switch(r.matcher){case"=":return t=>e===t;case"~=":return t=>t.split(/[ \t]+/).includes(e);case"^=":return t=>t.startsWith(e);case"$=":return t=>t.endsWith(e);case"*=":return t=>t.includes(e);case"|=":return t=>e===t||t.startsWith(e)&&t[e.length]==="-"}}}function mS(r,e){let t=Lp(e,i=>i.type==="combinator"&&i.combinator===r,i=>vr(i.left)),n=[];for(let i of Object.values(t)){let s=es(i.items),a=i.oneSimpleSelector.left;n.push({ast:a,terminal:{type:"popElement",cont:s}})}return{type:"pushElement",combinator:r,cont:es(n)}}function Lp(r,e,t){let n={};for(;r.length;){let i=wS(r,e,t),s=c=>e(c)&&t(c)===i,a=c=>c.ast.list.some(s),{matches:o,rest:u}=bN(r,a),l=null;for(let c of o){let h=vS(c,s);l||(l=h)}if(l==null)throw new Error("No simple selector is found.");n[i]={oneSimpleSelector:l,items:o},r=u}return n}function vS(r,e){let t=r.ast.list,n=new Array(t.length),i=-1;for(let a=t.length;a-- >0;)e(t[a])&&(n[a]=!0,i=a);if(i==-1)throw new Error("Couldn't find the required simple selector.");let s=t[i];return r.ast.list=t.filter((a,o)=>!n[o]),s}function wS(r,e,t){let n={};for(let a of r){let o={};for(let u of a.ast.list.filter(e))o[t(u)]=!0;for(let u of Object.keys(o))n[u]?n[u]++:n[u]=1}let i="",s=0;for(let a of Object.entries(n))a[1]>s&&(i=a[0],s=a[1]);return i}function mN(r,e){let t=[],n=[];for(let i of r)e(i)?t.push(i):n.push(i);return{matches:t,rest:n}}function bN(r,e){let t=[],n=[];for(let i of r)e(i)?t.push(i):n.push(i);return{matches:t,rest:n}}var cl=class{constructor(e){this.f=e}pickAll(e){return this.f(e)}pick1(e,t=!1){let n=this.f(e),i=n.length;if(i===0)return null;if(i===1)return n[0].value;let s=t?yN:vN,a=n[0];for(let o=1;o<i;o++){let u=n[o];s(a,u)&&(a=u)}return a.value}};function yN(r,e){let t=Op(e.specificity,r.specificity);return t>0||t===0&&e.index<r.index}function vN(r,e){let t=Op(e.specificity,r.specificity);return t>0||t===0&&e.index>r.index}function Np(r){return new cl(ts(r))}function ts(r){let e=r.map(wN);return(t,...n)=>e.flatMap(i=>i(t,...n))}function wN(r){switch(r.type){case"terminal":{let e=[r.valueContainer];return(t,...n)=>e}case"tagName":return xN(r);case"attrValue":return EN(r);case"attrPresence":return SN(r);case"pushElement":return AN(r);case"popElement":return _N(r)}}function xN(r){let e={};for(let t of r.variants)e[t.value]=ts(t.cont);return(t,...n)=>{let i=e[t.name];return i?i(t,...n):[]}}function SN(r){let e=r.name,t=ts(r.cont);return(n,...i)=>Object.prototype.hasOwnProperty.call(n.attribs,e)?t(n,...i):[]}function EN(r){let e=[];for(let n of r.matchers){let i=n.predicate,s=ts(n.cont);e.push((a,o,...u)=>i(a)?s(o,...u):[])}let t=r.name;return(n,...i)=>{let s=n.attribs[t];return s||s===""?e.flatMap(a=>a(s,n,...i)):[]}}function AN(r){let e=ts(r.cont),t=r.combinator==="+"?xS:TN;return(n,...i)=>{let s=t(n);return s===null?[]:e(s,n,...i)}}var xS=r=>{let e=r.prev;return e===null?null:Qr(e)?e:xS(e)},TN=r=>{let e=r.parent;return e&&Qr(e)?e:null};function _N(r){let e=ts(r.cont);return(t,n,...i)=>e(n,...i)}var hl=new Uint16Array('\u1D41<\xD5\u0131\u028A\u049D\u057B\u05D0\u0675\u06DE\u07A2\u07D6\u080F\u0A4A\u0A91\u0DA1\u0E6D\u0F09\u0F26\u10CA\u1228\u12E1\u1415\u149D\u14C3\u14DF\u1525\0\0\0\0\0\0\u156B\u16CD\u198D\u1C12\u1DDD\u1F7E\u2060\u21B0\u228D\u23C0\u23FB\u2442\u2824\u2912\u2D08\u2E48\u2FCE\u3016\u32BA\u3639\u37AC\u38FE\u3A28\u3A71\u3AE0\u3B2E\u0800EMabcfglmnoprstu\\bfms\x7F\x84\x8B\x90\x95\x98\xA6\xB3\xB9\xC8\xCFlig\u803B\xC6\u40C6P\u803B&\u4026cute\u803B\xC1\u40C1reve;\u4102\u0100iyx}rc\u803B\xC2\u40C2;\u4410r;\uC000\u{1D504}rave\u803B\xC0\u40C0pha;\u4391acr;\u4100d;\u6A53\u0100gp\x9D\xA1on;\u4104f;\uC000\u{1D538}plyFunction;\u6061ing\u803B\xC5\u40C5\u0100cs\xBE\xC3r;\uC000\u{1D49C}ign;\u6254ilde\u803B\xC3\u40C3ml\u803B\xC4\u40C4\u0400aceforsu\xE5\xFB\xFE\u0117\u011C\u0122\u0127\u012A\u0100cr\xEA\xF2kslash;\u6216\u0176\xF6\xF8;\u6AE7ed;\u6306y;\u4411\u0180crt\u0105\u010B\u0114ause;\u6235noullis;\u612Ca;\u4392r;\uC000\u{1D505}pf;\uC000\u{1D539}eve;\u42D8c\xF2\u0113mpeq;\u624E\u0700HOacdefhilorsu\u014D\u0151\u0156\u0180\u019E\u01A2\u01B5\u01B7\u01BA\u01DC\u0215\u0273\u0278\u027Ecy;\u4427PY\u803B\xA9\u40A9\u0180cpy\u015D\u0162\u017Aute;\u4106\u0100;i\u0167\u0168\u62D2talDifferentialD;\u6145leys;\u612D\u0200aeio\u0189\u018E\u0194\u0198ron;\u410Cdil\u803B\xC7\u40C7rc;\u4108nint;\u6230ot;\u410A\u0100dn\u01A7\u01ADilla;\u40B8terDot;\u40B7\xF2\u017Fi;\u43A7rcle\u0200DMPT\u01C7\u01CB\u01D1\u01D6ot;\u6299inus;\u6296lus;\u6295imes;\u6297o\u0100cs\u01E2\u01F8kwiseContourIntegral;\u6232eCurly\u0100DQ\u0203\u020FoubleQuote;\u601Duote;\u6019\u0200lnpu\u021E\u0228\u0247\u0255on\u0100;e\u0225\u0226\u6237;\u6A74\u0180git\u022F\u0236\u023Aruent;\u6261nt;\u622FourIntegral;\u622E\u0100fr\u024C\u024E;\u6102oduct;\u6210nterClockwiseContourIntegral;\u6233oss;\u6A2Fcr;\uC000\u{1D49E}p\u0100;C\u0284\u0285\u62D3ap;\u624D\u0580DJSZacefios\u02A0\u02AC\u02B0\u02B4\u02B8\u02CB\u02D7\u02E1\u02E6\u0333\u048D\u0100;o\u0179\u02A5trahd;\u6911cy;\u4402cy;\u4405cy;\u440F\u0180grs\u02BF\u02C4\u02C7ger;\u6021r;\u61A1hv;\u6AE4\u0100ay\u02D0\u02D5ron;\u410E;\u4414l\u0100;t\u02DD\u02DE\u6207a;\u4394r;\uC000\u{1D507}\u0100af\u02EB\u0327\u0100cm\u02F0\u0322ritical\u0200ADGT\u0300\u0306\u0316\u031Ccute;\u40B4o\u0174\u030B\u030D;\u42D9bleAcute;\u42DDrave;\u4060ilde;\u42DCond;\u62C4ferentialD;\u6146\u0470\u033D\0\0\0\u0342\u0354\0\u0405f;\uC000\u{1D53B}\u0180;DE\u0348\u0349\u034D\u40A8ot;\u60DCqual;\u6250ble\u0300CDLRUV\u0363\u0372\u0382\u03CF\u03E2\u03F8ontourIntegra\xEC\u0239o\u0274\u0379\0\0\u037B\xBB\u0349nArrow;\u61D3\u0100eo\u0387\u03A4ft\u0180ART\u0390\u0396\u03A1rrow;\u61D0ightArrow;\u61D4e\xE5\u02CAng\u0100LR\u03AB\u03C4eft\u0100AR\u03B3\u03B9rrow;\u67F8ightArrow;\u67FAightArrow;\u67F9ight\u0100AT\u03D8\u03DErrow;\u61D2ee;\u62A8p\u0241\u03E9\0\0\u03EFrrow;\u61D1ownArrow;\u61D5erticalBar;\u6225n\u0300ABLRTa\u0412\u042A\u0430\u045E\u047F\u037Crrow\u0180;BU\u041D\u041E\u0422\u6193ar;\u6913pArrow;\u61F5reve;\u4311eft\u02D2\u043A\0\u0446\0\u0450ightVector;\u6950eeVector;\u695Eector\u0100;B\u0459\u045A\u61BDar;\u6956ight\u01D4\u0467\0\u0471eeVector;\u695Fector\u0100;B\u047A\u047B\u61C1ar;\u6957ee\u0100;A\u0486\u0487\u62A4rrow;\u61A7\u0100ct\u0492\u0497r;\uC000\u{1D49F}rok;\u4110\u0800NTacdfglmopqstux\u04BD\u04C0\u04C4\u04CB\u04DE\u04E2\u04E7\u04EE\u04F5\u0521\u052F\u0536\u0552\u055D\u0560\u0565G;\u414AH\u803B\xD0\u40D0cute\u803B\xC9\u40C9\u0180aiy\u04D2\u04D7\u04DCron;\u411Arc\u803B\xCA\u40CA;\u442Dot;\u4116r;\uC000\u{1D508}rave\u803B\xC8\u40C8ement;\u6208\u0100ap\u04FA\u04FEcr;\u4112ty\u0253\u0506\0\0\u0512mallSquare;\u65FBerySmallSquare;\u65AB\u0100gp\u0526\u052Aon;\u4118f;\uC000\u{1D53C}silon;\u4395u\u0100ai\u053C\u0549l\u0100;T\u0542\u0543\u6A75ilde;\u6242librium;\u61CC\u0100ci\u0557\u055Ar;\u6130m;\u6A73a;\u4397ml\u803B\xCB\u40CB\u0100ip\u056A\u056Fsts;\u6203onentialE;\u6147\u0280cfios\u0585\u0588\u058D\u05B2\u05CCy;\u4424r;\uC000\u{1D509}lled\u0253\u0597\0\0\u05A3mallSquare;\u65FCerySmallSquare;\u65AA\u0370\u05BA\0\u05BF\0\0\u05C4f;\uC000\u{1D53D}All;\u6200riertrf;\u6131c\xF2\u05CB\u0600JTabcdfgorst\u05E8\u05EC\u05EF\u05FA\u0600\u0612\u0616\u061B\u061D\u0623\u066C\u0672cy;\u4403\u803B>\u403Emma\u0100;d\u05F7\u05F8\u4393;\u43DCreve;\u411E\u0180eiy\u0607\u060C\u0610dil;\u4122rc;\u411C;\u4413ot;\u4120r;\uC000\u{1D50A};\u62D9pf;\uC000\u{1D53E}eater\u0300EFGLST\u0635\u0644\u064E\u0656\u065B\u0666qual\u0100;L\u063E\u063F\u6265ess;\u62DBullEqual;\u6267reater;\u6AA2ess;\u6277lantEqual;\u6A7Eilde;\u6273cr;\uC000\u{1D4A2};\u626B\u0400Aacfiosu\u0685\u068B\u0696\u069B\u069E\u06AA\u06BE\u06CARDcy;\u442A\u0100ct\u0690\u0694ek;\u42C7;\u405Eirc;\u4124r;\u610ClbertSpace;\u610B\u01F0\u06AF\0\u06B2f;\u610DizontalLine;\u6500\u0100ct\u06C3\u06C5\xF2\u06A9rok;\u4126mp\u0144\u06D0\u06D8ownHum\xF0\u012Fqual;\u624F\u0700EJOacdfgmnostu\u06FA\u06FE\u0703\u0707\u070E\u071A\u071E\u0721\u0728\u0744\u0778\u078B\u078F\u0795cy;\u4415lig;\u4132cy;\u4401cute\u803B\xCD\u40CD\u0100iy\u0713\u0718rc\u803B\xCE\u40CE;\u4418ot;\u4130r;\u6111rave\u803B\xCC\u40CC\u0180;ap\u0720\u072F\u073F\u0100cg\u0734\u0737r;\u412AinaryI;\u6148lie\xF3\u03DD\u01F4\u0749\0\u0762\u0100;e\u074D\u074E\u622C\u0100gr\u0753\u0758ral;\u622Bsection;\u62C2isible\u0100CT\u076C\u0772omma;\u6063imes;\u6062\u0180gpt\u077F\u0783\u0788on;\u412Ef;\uC000\u{1D540}a;\u4399cr;\u6110ilde;\u4128\u01EB\u079A\0\u079Ecy;\u4406l\u803B\xCF\u40CF\u0280cfosu\u07AC\u07B7\u07BC\u07C2\u07D0\u0100iy\u07B1\u07B5rc;\u4134;\u4419r;\uC000\u{1D50D}pf;\uC000\u{1D541}\u01E3\u07C7\0\u07CCr;\uC000\u{1D4A5}rcy;\u4408kcy;\u4404\u0380HJacfos\u07E4\u07E8\u07EC\u07F1\u07FD\u0802\u0808cy;\u4425cy;\u440Cppa;\u439A\u0100ey\u07F6\u07FBdil;\u4136;\u441Ar;\uC000\u{1D50E}pf;\uC000\u{1D542}cr;\uC000\u{1D4A6}\u0580JTaceflmost\u0825\u0829\u082C\u0850\u0863\u09B3\u09B8\u09C7\u09CD\u0A37\u0A47cy;\u4409\u803B<\u403C\u0280cmnpr\u0837\u083C\u0841\u0844\u084Dute;\u4139bda;\u439Bg;\u67EAlacetrf;\u6112r;\u619E\u0180aey\u0857\u085C\u0861ron;\u413Ddil;\u413B;\u441B\u0100fs\u0868\u0970t\u0500ACDFRTUVar\u087E\u08A9\u08B1\u08E0\u08E6\u08FC\u092F\u095B\u0390\u096A\u0100nr\u0883\u088FgleBracket;\u67E8row\u0180;BR\u0899\u089A\u089E\u6190ar;\u61E4ightArrow;\u61C6eiling;\u6308o\u01F5\u08B7\0\u08C3bleBracket;\u67E6n\u01D4\u08C8\0\u08D2eeVector;\u6961ector\u0100;B\u08DB\u08DC\u61C3ar;\u6959loor;\u630Aight\u0100AV\u08EF\u08F5rrow;\u6194ector;\u694E\u0100er\u0901\u0917e\u0180;AV\u0909\u090A\u0910\u62A3rrow;\u61A4ector;\u695Aiangle\u0180;BE\u0924\u0925\u0929\u62B2ar;\u69CFqual;\u62B4p\u0180DTV\u0937\u0942\u094CownVector;\u6951eeVector;\u6960ector\u0100;B\u0956\u0957\u61BFar;\u6958ector\u0100;B\u0965\u0966\u61BCar;\u6952ight\xE1\u039Cs\u0300EFGLST\u097E\u098B\u0995\u099D\u09A2\u09ADqualGreater;\u62DAullEqual;\u6266reater;\u6276ess;\u6AA1lantEqual;\u6A7Dilde;\u6272r;\uC000\u{1D50F}\u0100;e\u09BD\u09BE\u62D8ftarrow;\u61DAidot;\u413F\u0180npw\u09D4\u0A16\u0A1Bg\u0200LRlr\u09DE\u09F7\u0A02\u0A10eft\u0100AR\u09E6\u09ECrrow;\u67F5ightArrow;\u67F7ightArrow;\u67F6eft\u0100ar\u03B3\u0A0Aight\xE1\u03BFight\xE1\u03CAf;\uC000\u{1D543}er\u0100LR\u0A22\u0A2CeftArrow;\u6199ightArrow;\u6198\u0180cht\u0A3E\u0A40\u0A42\xF2\u084C;\u61B0rok;\u4141;\u626A\u0400acefiosu\u0A5A\u0A5D\u0A60\u0A77\u0A7C\u0A85\u0A8B\u0A8Ep;\u6905y;\u441C\u0100dl\u0A65\u0A6FiumSpace;\u605Flintrf;\u6133r;\uC000\u{1D510}nusPlus;\u6213pf;\uC000\u{1D544}c\xF2\u0A76;\u439C\u0480Jacefostu\u0AA3\u0AA7\u0AAD\u0AC0\u0B14\u0B19\u0D91\u0D97\u0D9Ecy;\u440Acute;\u4143\u0180aey\u0AB4\u0AB9\u0ABEron;\u4147dil;\u4145;\u441D\u0180gsw\u0AC7\u0AF0\u0B0Eative\u0180MTV\u0AD3\u0ADF\u0AE8ediumSpace;\u600Bhi\u0100cn\u0AE6\u0AD8\xEB\u0AD9eryThi\xEE\u0AD9ted\u0100GL\u0AF8\u0B06reaterGreate\xF2\u0673essLes\xF3\u0A48Line;\u400Ar;\uC000\u{1D511}\u0200Bnpt\u0B22\u0B28\u0B37\u0B3Areak;\u6060BreakingSpace;\u40A0f;\u6115\u0680;CDEGHLNPRSTV\u0B55\u0B56\u0B6A\u0B7C\u0BA1\u0BEB\u0C04\u0C5E\u0C84\u0CA6\u0CD8\u0D61\u0D85\u6AEC\u0100ou\u0B5B\u0B64ngruent;\u6262pCap;\u626DoubleVerticalBar;\u6226\u0180lqx\u0B83\u0B8A\u0B9Bement;\u6209ual\u0100;T\u0B92\u0B93\u6260ilde;\uC000\u2242\u0338ists;\u6204reater\u0380;EFGLST\u0BB6\u0BB7\u0BBD\u0BC9\u0BD3\u0BD8\u0BE5\u626Fqual;\u6271ullEqual;\uC000\u2267\u0338reater;\uC000\u226B\u0338ess;\u6279lantEqual;\uC000\u2A7E\u0338ilde;\u6275ump\u0144\u0BF2\u0BFDownHump;\uC000\u224E\u0338qual;\uC000\u224F\u0338e\u0100fs\u0C0A\u0C27tTriangle\u0180;BE\u0C1A\u0C1B\u0C21\u62EAar;\uC000\u29CF\u0338qual;\u62ECs\u0300;EGLST\u0C35\u0C36\u0C3C\u0C44\u0C4B\u0C58\u626Equal;\u6270reater;\u6278ess;\uC000\u226A\u0338lantEqual;\uC000\u2A7D\u0338ilde;\u6274ested\u0100GL\u0C68\u0C79reaterGreater;\uC000\u2AA2\u0338essLess;\uC000\u2AA1\u0338recedes\u0180;ES\u0C92\u0C93\u0C9B\u6280qual;\uC000\u2AAF\u0338lantEqual;\u62E0\u0100ei\u0CAB\u0CB9verseElement;\u620CghtTriangle\u0180;BE\u0CCB\u0CCC\u0CD2\u62EBar;\uC000\u29D0\u0338qual;\u62ED\u0100qu\u0CDD\u0D0CuareSu\u0100bp\u0CE8\u0CF9set\u0100;E\u0CF0\u0CF3\uC000\u228F\u0338qual;\u62E2erset\u0100;E\u0D03\u0D06\uC000\u2290\u0338qual;\u62E3\u0180bcp\u0D13\u0D24\u0D4Eset\u0100;E\u0D1B\u0D1E\uC000\u2282\u20D2qual;\u6288ceeds\u0200;EST\u0D32\u0D33\u0D3B\u0D46\u6281qual;\uC000\u2AB0\u0338lantEqual;\u62E1ilde;\uC000\u227F\u0338erset\u0100;E\u0D58\u0D5B\uC000\u2283\u20D2qual;\u6289ilde\u0200;EFT\u0D6E\u0D6F\u0D75\u0D7F\u6241qual;\u6244ullEqual;\u6247ilde;\u6249erticalBar;\u6224cr;\uC000\u{1D4A9}ilde\u803B\xD1\u40D1;\u439D\u0700Eacdfgmoprstuv\u0DBD\u0DC2\u0DC9\u0DD5\u0DDB\u0DE0\u0DE7\u0DFC\u0E02\u0E20\u0E22\u0E32\u0E3F\u0E44lig;\u4152cute\u803B\xD3\u40D3\u0100iy\u0DCE\u0DD3rc\u803B\xD4\u40D4;\u441Eblac;\u4150r;\uC000\u{1D512}rave\u803B\xD2\u40D2\u0180aei\u0DEE\u0DF2\u0DF6cr;\u414Cga;\u43A9cron;\u439Fpf;\uC000\u{1D546}enCurly\u0100DQ\u0E0E\u0E1AoubleQuote;\u601Cuote;\u6018;\u6A54\u0100cl\u0E27\u0E2Cr;\uC000\u{1D4AA}ash\u803B\xD8\u40D8i\u016C\u0E37\u0E3Cde\u803B\xD5\u40D5es;\u6A37ml\u803B\xD6\u40D6er\u0100BP\u0E4B\u0E60\u0100ar\u0E50\u0E53r;\u603Eac\u0100ek\u0E5A\u0E5C;\u63DEet;\u63B4arenthesis;\u63DC\u0480acfhilors\u0E7F\u0E87\u0E8A\u0E8F\u0E92\u0E94\u0E9D\u0EB0\u0EFCrtialD;\u6202y;\u441Fr;\uC000\u{1D513}i;\u43A6;\u43A0usMinus;\u40B1\u0100ip\u0EA2\u0EADncareplan\xE5\u069Df;\u6119\u0200;eio\u0EB9\u0EBA\u0EE0\u0EE4\u6ABBcedes\u0200;EST\u0EC8\u0EC9\u0ECF\u0EDA\u627Aqual;\u6AAFlantEqual;\u627Cilde;\u627Eme;\u6033\u0100dp\u0EE9\u0EEEuct;\u620Fortion\u0100;a\u0225\u0EF9l;\u621D\u0100ci\u0F01\u0F06r;\uC000\u{1D4AB};\u43A8\u0200Ufos\u0F11\u0F16\u0F1B\u0F1FOT\u803B"\u4022r;\uC000\u{1D514}pf;\u611Acr;\uC000\u{1D4AC}\u0600BEacefhiorsu\u0F3E\u0F43\u0F47\u0F60\u0F73\u0FA7\u0FAA\u0FAD\u1096\u10A9\u10B4\u10BEarr;\u6910G\u803B\xAE\u40AE\u0180cnr\u0F4E\u0F53\u0F56ute;\u4154g;\u67EBr\u0100;t\u0F5C\u0F5D\u61A0l;\u6916\u0180aey\u0F67\u0F6C\u0F71ron;\u4158dil;\u4156;\u4420\u0100;v\u0F78\u0F79\u611Cerse\u0100EU\u0F82\u0F99\u0100lq\u0F87\u0F8Eement;\u620Builibrium;\u61CBpEquilibrium;\u696Fr\xBB\u0F79o;\u43A1ght\u0400ACDFTUVa\u0FC1\u0FEB\u0FF3\u1022\u1028\u105B\u1087\u03D8\u0100nr\u0FC6\u0FD2gleBracket;\u67E9row\u0180;BL\u0FDC\u0FDD\u0FE1\u6192ar;\u61E5eftArrow;\u61C4eiling;\u6309o\u01F5\u0FF9\0\u1005bleBracket;\u67E7n\u01D4\u100A\0\u1014eeVector;\u695Dector\u0100;B\u101D\u101E\u61C2ar;\u6955loor;\u630B\u0100er\u102D\u1043e\u0180;AV\u1035\u1036\u103C\u62A2rrow;\u61A6ector;\u695Biangle\u0180;BE\u1050\u1051\u1055\u62B3ar;\u69D0qual;\u62B5p\u0180DTV\u1063\u106E\u1078ownVector;\u694FeeVector;\u695Cector\u0100;B\u1082\u1083\u61BEar;\u6954ector\u0100;B\u1091\u1092\u61C0ar;\u6953\u0100pu\u109B\u109Ef;\u611DndImplies;\u6970ightarrow;\u61DB\u0100ch\u10B9\u10BCr;\u611B;\u61B1leDelayed;\u69F4\u0680HOacfhimoqstu\u10E4\u10F1\u10F7\u10FD\u1119\u111E\u1151\u1156\u1161\u1167\u11B5\u11BB\u11BF\u0100Cc\u10E9\u10EEHcy;\u4429y;\u4428FTcy;\u442Ccute;\u415A\u0280;aeiy\u1108\u1109\u110E\u1113\u1117\u6ABCron;\u4160dil;\u415Erc;\u415C;\u4421r;\uC000\u{1D516}ort\u0200DLRU\u112A\u1134\u113E\u1149ownArrow\xBB\u041EeftArrow\xBB\u089AightArrow\xBB\u0FDDpArrow;\u6191gma;\u43A3allCircle;\u6218pf;\uC000\u{1D54A}\u0272\u116D\0\0\u1170t;\u621Aare\u0200;ISU\u117B\u117C\u1189\u11AF\u65A1ntersection;\u6293u\u0100bp\u118F\u119Eset\u0100;E\u1197\u1198\u628Fqual;\u6291erset\u0100;E\u11A8\u11A9\u6290qual;\u6292nion;\u6294cr;\uC000\u{1D4AE}ar;\u62C6\u0200bcmp\u11C8\u11DB\u1209\u120B\u0100;s\u11CD\u11CE\u62D0et\u0100;E\u11CD\u11D5qual;\u6286\u0100ch\u11E0\u1205eeds\u0200;EST\u11ED\u11EE\u11F4\u11FF\u627Bqual;\u6AB0lantEqual;\u627Dilde;\u627FTh\xE1\u0F8C;\u6211\u0180;es\u1212\u1213\u1223\u62D1rset\u0100;E\u121C\u121D\u6283qual;\u6287et\xBB\u1213\u0580HRSacfhiors\u123E\u1244\u1249\u1255\u125E\u1271\u1276\u129F\u12C2\u12C8\u12D1ORN\u803B\xDE\u40DEADE;\u6122\u0100Hc\u124E\u1252cy;\u440By;\u4426\u0100bu\u125A\u125C;\u4009;\u43A4\u0180aey\u1265\u126A\u126Fron;\u4164dil;\u4162;\u4422r;\uC000\u{1D517}\u0100ei\u127B\u1289\u01F2\u1280\0\u1287efore;\u6234a;\u4398\u0100cn\u128E\u1298kSpace;\uC000\u205F\u200ASpace;\u6009lde\u0200;EFT\u12AB\u12AC\u12B2\u12BC\u623Cqual;\u6243ullEqual;\u6245ilde;\u6248pf;\uC000\u{1D54B}ipleDot;\u60DB\u0100ct\u12D6\u12DBr;\uC000\u{1D4AF}rok;\u4166\u0AE1\u12F7\u130E\u131A\u1326\0\u132C\u1331\0\0\0\0\0\u1338\u133D\u1377\u1385\0\u13FF\u1404\u140A\u1410\u0100cr\u12FB\u1301ute\u803B\xDA\u40DAr\u0100;o\u1307\u1308\u619Fcir;\u6949r\u01E3\u1313\0\u1316y;\u440Eve;\u416C\u0100iy\u131E\u1323rc\u803B\xDB\u40DB;\u4423blac;\u4170r;\uC000\u{1D518}rave\u803B\xD9\u40D9acr;\u416A\u0100di\u1341\u1369er\u0100BP\u1348\u135D\u0100ar\u134D\u1350r;\u405Fac\u0100ek\u1357\u1359;\u63DFet;\u63B5arenthesis;\u63DDon\u0100;P\u1370\u1371\u62C3lus;\u628E\u0100gp\u137B\u137Fon;\u4172f;\uC000\u{1D54C}\u0400ADETadps\u1395\u13AE\u13B8\u13C4\u03E8\u13D2\u13D7\u13F3rrow\u0180;BD\u1150\u13A0\u13A4ar;\u6912ownArrow;\u61C5ownArrow;\u6195quilibrium;\u696Eee\u0100;A\u13CB\u13CC\u62A5rrow;\u61A5own\xE1\u03F3er\u0100LR\u13DE\u13E8eftArrow;\u6196ightArrow;\u6197i\u0100;l\u13F9\u13FA\u43D2on;\u43A5ing;\u416Ecr;\uC000\u{1D4B0}ilde;\u4168ml\u803B\xDC\u40DC\u0480Dbcdefosv\u1427\u142C\u1430\u1433\u143E\u1485\u148A\u1490\u1496ash;\u62ABar;\u6AEBy;\u4412ash\u0100;l\u143B\u143C\u62A9;\u6AE6\u0100er\u1443\u1445;\u62C1\u0180bty\u144C\u1450\u147Aar;\u6016\u0100;i\u144F\u1455cal\u0200BLST\u1461\u1465\u146A\u1474ar;\u6223ine;\u407Ceparator;\u6758ilde;\u6240ThinSpace;\u600Ar;\uC000\u{1D519}pf;\uC000\u{1D54D}cr;\uC000\u{1D4B1}dash;\u62AA\u0280cefos\u14A7\u14AC\u14B1\u14B6\u14BCirc;\u4174dge;\u62C0r;\uC000\u{1D51A}pf;\uC000\u{1D54E}cr;\uC000\u{1D4B2}\u0200fios\u14CB\u14D0\u14D2\u14D8r;\uC000\u{1D51B};\u439Epf;\uC000\u{1D54F}cr;\uC000\u{1D4B3}\u0480AIUacfosu\u14F1\u14F5\u14F9\u14FD\u1504\u150F\u1514\u151A\u1520cy;\u442Fcy;\u4407cy;\u442Ecute\u803B\xDD\u40DD\u0100iy\u1509\u150Drc;\u4176;\u442Br;\uC000\u{1D51C}pf;\uC000\u{1D550}cr;\uC000\u{1D4B4}ml;\u4178\u0400Hacdefos\u1535\u1539\u153F\u154B\u154F\u155D\u1560\u1564cy;\u4416cute;\u4179\u0100ay\u1544\u1549ron;\u417D;\u4417ot;\u417B\u01F2\u1554\0\u155BoWidt\xE8\u0AD9a;\u4396r;\u6128pf;\u6124cr;\uC000\u{1D4B5}\u0BE1\u1583\u158A\u1590\0\u15B0\u15B6\u15BF\0\0\0\0\u15C6\u15DB\u15EB\u165F\u166D\0\u1695\u169B\u16B2\u16B9\0\u16BEcute\u803B\xE1\u40E1reve;\u4103\u0300;Ediuy\u159C\u159D\u15A1\u15A3\u15A8\u15AD\u623E;\uC000\u223E\u0333;\u623Frc\u803B\xE2\u40E2te\u80BB\xB4\u0306;\u4430lig\u803B\xE6\u40E6\u0100;r\xB2\u15BA;\uC000\u{1D51E}rave\u803B\xE0\u40E0\u0100ep\u15CA\u15D6\u0100fp\u15CF\u15D4sym;\u6135\xE8\u15D3ha;\u43B1\u0100ap\u15DFc\u0100cl\u15E4\u15E7r;\u4101g;\u6A3F\u0264\u15F0\0\0\u160A\u0280;adsv\u15FA\u15FB\u15FF\u1601\u1607\u6227nd;\u6A55;\u6A5Clope;\u6A58;\u6A5A\u0380;elmrsz\u1618\u1619\u161B\u161E\u163F\u164F\u1659\u6220;\u69A4e\xBB\u1619sd\u0100;a\u1625\u1626\u6221\u0461\u1630\u1632\u1634\u1636\u1638\u163A\u163C\u163E;\u69A8;\u69A9;\u69AA;\u69AB;\u69AC;\u69AD;\u69AE;\u69AFt\u0100;v\u1645\u1646\u621Fb\u0100;d\u164C\u164D\u62BE;\u699D\u0100pt\u1654\u1657h;\u6222\xBB\xB9arr;\u637C\u0100gp\u1663\u1667on;\u4105f;\uC000\u{1D552}\u0380;Eaeiop\u12C1\u167B\u167D\u1682\u1684\u1687\u168A;\u6A70cir;\u6A6F;\u624Ad;\u624Bs;\u4027rox\u0100;e\u12C1\u1692\xF1\u1683ing\u803B\xE5\u40E5\u0180cty\u16A1\u16A6\u16A8r;\uC000\u{1D4B6};\u402Amp\u0100;e\u12C1\u16AF\xF1\u0288ilde\u803B\xE3\u40E3ml\u803B\xE4\u40E4\u0100ci\u16C2\u16C8onin\xF4\u0272nt;\u6A11\u0800Nabcdefiklnoprsu\u16ED\u16F1\u1730\u173C\u1743\u1748\u1778\u177D\u17E0\u17E6\u1839\u1850\u170D\u193D\u1948\u1970ot;\u6AED\u0100cr\u16F6\u171Ek\u0200ceps\u1700\u1705\u170D\u1713ong;\u624Cpsilon;\u43F6rime;\u6035im\u0100;e\u171A\u171B\u623Dq;\u62CD\u0176\u1722\u1726ee;\u62BDed\u0100;g\u172C\u172D\u6305e\xBB\u172Drk\u0100;t\u135C\u1737brk;\u63B6\u0100oy\u1701\u1741;\u4431quo;\u601E\u0280cmprt\u1753\u175B\u1761\u1764\u1768aus\u0100;e\u010A\u0109ptyv;\u69B0s\xE9\u170Cno\xF5\u0113\u0180ahw\u176F\u1771\u1773;\u43B2;\u6136een;\u626Cr;\uC000\u{1D51F}g\u0380costuvw\u178D\u179D\u17B3\u17C1\u17D5\u17DB\u17DE\u0180aiu\u1794\u1796\u179A\xF0\u0760rc;\u65EFp\xBB\u1371\u0180dpt\u17A4\u17A8\u17ADot;\u6A00lus;\u6A01imes;\u6A02\u0271\u17B9\0\0\u17BEcup;\u6A06ar;\u6605riangle\u0100du\u17CD\u17D2own;\u65BDp;\u65B3plus;\u6A04e\xE5\u1444\xE5\u14ADarow;\u690D\u0180ako\u17ED\u1826\u1835\u0100cn\u17F2\u1823k\u0180lst\u17FA\u05AB\u1802ozenge;\u69EBriangle\u0200;dlr\u1812\u1813\u1818\u181D\u65B4own;\u65BEeft;\u65C2ight;\u65B8k;\u6423\u01B1\u182B\0\u1833\u01B2\u182F\0\u1831;\u6592;\u65914;\u6593ck;\u6588\u0100eo\u183E\u184D\u0100;q\u1843\u1846\uC000=\u20E5uiv;\uC000\u2261\u20E5t;\u6310\u0200ptwx\u1859\u185E\u1867\u186Cf;\uC000\u{1D553}\u0100;t\u13CB\u1863om\xBB\u13CCtie;\u62C8\u0600DHUVbdhmptuv\u1885\u1896\u18AA\u18BB\u18D7\u18DB\u18EC\u18FF\u1905\u190A\u1910\u1921\u0200LRlr\u188E\u1890\u1892\u1894;\u6557;\u6554;\u6556;\u6553\u0280;DUdu\u18A1\u18A2\u18A4\u18A6\u18A8\u6550;\u6566;\u6569;\u6564;\u6567\u0200LRlr\u18B3\u18B5\u18B7\u18B9;\u655D;\u655A;\u655C;\u6559\u0380;HLRhlr\u18CA\u18CB\u18CD\u18CF\u18D1\u18D3\u18D5\u6551;\u656C;\u6563;\u6560;\u656B;\u6562;\u655Fox;\u69C9\u0200LRlr\u18E4\u18E6\u18E8\u18EA;\u6555;\u6552;\u6510;\u650C\u0280;DUdu\u06BD\u18F7\u18F9\u18FB\u18FD;\u6565;\u6568;\u652C;\u6534inus;\u629Flus;\u629Eimes;\u62A0\u0200LRlr\u1919\u191B\u191D\u191F;\u655B;\u6558;\u6518;\u6514\u0380;HLRhlr\u1930\u1931\u1933\u1935\u1937\u1939\u193B\u6502;\u656A;\u6561;\u655E;\u653C;\u6524;\u651C\u0100ev\u0123\u1942bar\u803B\xA6\u40A6\u0200ceio\u1951\u1956\u195A\u1960r;\uC000\u{1D4B7}mi;\u604Fm\u0100;e\u171A\u171Cl\u0180;bh\u1968\u1969\u196B\u405C;\u69C5sub;\u67C8\u016C\u1974\u197El\u0100;e\u1979\u197A\u6022t\xBB\u197Ap\u0180;Ee\u012F\u1985\u1987;\u6AAE\u0100;q\u06DC\u06DB\u0CE1\u19A7\0\u19E8\u1A11\u1A15\u1A32\0\u1A37\u1A50\0\0\u1AB4\0\0\u1AC1\0\0\u1B21\u1B2E\u1B4D\u1B52\0\u1BFD\0\u1C0C\u0180cpr\u19AD\u19B2\u19DDute;\u4107\u0300;abcds\u19BF\u19C0\u19C4\u19CA\u19D5\u19D9\u6229nd;\u6A44rcup;\u6A49\u0100au\u19CF\u19D2p;\u6A4Bp;\u6A47ot;\u6A40;\uC000\u2229\uFE00\u0100eo\u19E2\u19E5t;\u6041\xEE\u0693\u0200aeiu\u19F0\u19FB\u1A01\u1A05\u01F0\u19F5\0\u19F8s;\u6A4Don;\u410Ddil\u803B\xE7\u40E7rc;\u4109ps\u0100;s\u1A0C\u1A0D\u6A4Cm;\u6A50ot;\u410B\u0180dmn\u1A1B\u1A20\u1A26il\u80BB\xB8\u01ADptyv;\u69B2t\u8100\xA2;e\u1A2D\u1A2E\u40A2r\xE4\u01B2r;\uC000\u{1D520}\u0180cei\u1A3D\u1A40\u1A4Dy;\u4447ck\u0100;m\u1A47\u1A48\u6713ark\xBB\u1A48;\u43C7r\u0380;Ecefms\u1A5F\u1A60\u1A62\u1A6B\u1AA4\u1AAA\u1AAE\u65CB;\u69C3\u0180;el\u1A69\u1A6A\u1A6D\u42C6q;\u6257e\u0261\u1A74\0\0\u1A88rrow\u0100lr\u1A7C\u1A81eft;\u61BAight;\u61BB\u0280RSacd\u1A92\u1A94\u1A96\u1A9A\u1A9F\xBB\u0F47;\u64C8st;\u629Birc;\u629Aash;\u629Dnint;\u6A10id;\u6AEFcir;\u69C2ubs\u0100;u\u1ABB\u1ABC\u6663it\xBB\u1ABC\u02EC\u1AC7\u1AD4\u1AFA\0\u1B0Aon\u0100;e\u1ACD\u1ACE\u403A\u0100;q\xC7\xC6\u026D\u1AD9\0\0\u1AE2a\u0100;t\u1ADE\u1ADF\u402C;\u4040\u0180;fl\u1AE8\u1AE9\u1AEB\u6201\xEE\u1160e\u0100mx\u1AF1\u1AF6ent\xBB\u1AE9e\xF3\u024D\u01E7\u1AFE\0\u1B07\u0100;d\u12BB\u1B02ot;\u6A6Dn\xF4\u0246\u0180fry\u1B10\u1B14\u1B17;\uC000\u{1D554}o\xE4\u0254\u8100\xA9;s\u0155\u1B1Dr;\u6117\u0100ao\u1B25\u1B29rr;\u61B5ss;\u6717\u0100cu\u1B32\u1B37r;\uC000\u{1D4B8}\u0100bp\u1B3C\u1B44\u0100;e\u1B41\u1B42\u6ACF;\u6AD1\u0100;e\u1B49\u1B4A\u6AD0;\u6AD2dot;\u62EF\u0380delprvw\u1B60\u1B6C\u1B77\u1B82\u1BAC\u1BD4\u1BF9arr\u0100lr\u1B68\u1B6A;\u6938;\u6935\u0270\u1B72\0\0\u1B75r;\u62DEc;\u62DFarr\u0100;p\u1B7F\u1B80\u61B6;\u693D\u0300;bcdos\u1B8F\u1B90\u1B96\u1BA1\u1BA5\u1BA8\u622Arcap;\u6A48\u0100au\u1B9B\u1B9Ep;\u6A46p;\u6A4Aot;\u628Dr;\u6A45;\uC000\u222A\uFE00\u0200alrv\u1BB5\u1BBF\u1BDE\u1BE3rr\u0100;m\u1BBC\u1BBD\u61B7;\u693Cy\u0180evw\u1BC7\u1BD4\u1BD8q\u0270\u1BCE\0\0\u1BD2re\xE3\u1B73u\xE3\u1B75ee;\u62CEedge;\u62CFen\u803B\xA4\u40A4earrow\u0100lr\u1BEE\u1BF3eft\xBB\u1B80ight\xBB\u1BBDe\xE4\u1BDD\u0100ci\u1C01\u1C07onin\xF4\u01F7nt;\u6231lcty;\u632D\u0980AHabcdefhijlorstuwz\u1C38\u1C3B\u1C3F\u1C5D\u1C69\u1C75\u1C8A\u1C9E\u1CAC\u1CB7\u1CFB\u1CFF\u1D0D\u1D7B\u1D91\u1DAB\u1DBB\u1DC6\u1DCDr\xF2\u0381ar;\u6965\u0200glrs\u1C48\u1C4D\u1C52\u1C54ger;\u6020eth;\u6138\xF2\u1133h\u0100;v\u1C5A\u1C5B\u6010\xBB\u090A\u016B\u1C61\u1C67arow;\u690Fa\xE3\u0315\u0100ay\u1C6E\u1C73ron;\u410F;\u4434\u0180;ao\u0332\u1C7C\u1C84\u0100gr\u02BF\u1C81r;\u61CAtseq;\u6A77\u0180glm\u1C91\u1C94\u1C98\u803B\xB0\u40B0ta;\u43B4ptyv;\u69B1\u0100ir\u1CA3\u1CA8sht;\u697F;\uC000\u{1D521}ar\u0100lr\u1CB3\u1CB5\xBB\u08DC\xBB\u101E\u0280aegsv\u1CC2\u0378\u1CD6\u1CDC\u1CE0m\u0180;os\u0326\u1CCA\u1CD4nd\u0100;s\u0326\u1CD1uit;\u6666amma;\u43DDin;\u62F2\u0180;io\u1CE7\u1CE8\u1CF8\u40F7de\u8100\xF7;o\u1CE7\u1CF0ntimes;\u62C7n\xF8\u1CF7cy;\u4452c\u026F\u1D06\0\0\u1D0Arn;\u631Eop;\u630D\u0280lptuw\u1D18\u1D1D\u1D22\u1D49\u1D55lar;\u4024f;\uC000\u{1D555}\u0280;emps\u030B\u1D2D\u1D37\u1D3D\u1D42q\u0100;d\u0352\u1D33ot;\u6251inus;\u6238lus;\u6214quare;\u62A1blebarwedg\xE5\xFAn\u0180adh\u112E\u1D5D\u1D67ownarrow\xF3\u1C83arpoon\u0100lr\u1D72\u1D76ef\xF4\u1CB4igh\xF4\u1CB6\u0162\u1D7F\u1D85karo\xF7\u0F42\u026F\u1D8A\0\0\u1D8Ern;\u631Fop;\u630C\u0180cot\u1D98\u1DA3\u1DA6\u0100ry\u1D9D\u1DA1;\uC000\u{1D4B9};\u4455l;\u69F6rok;\u4111\u0100dr\u1DB0\u1DB4ot;\u62F1i\u0100;f\u1DBA\u1816\u65BF\u0100ah\u1DC0\u1DC3r\xF2\u0429a\xF2\u0FA6angle;\u69A6\u0100ci\u1DD2\u1DD5y;\u445Fgrarr;\u67FF\u0900Dacdefglmnopqrstux\u1E01\u1E09\u1E19\u1E38\u0578\u1E3C\u1E49\u1E61\u1E7E\u1EA5\u1EAF\u1EBD\u1EE1\u1F2A\u1F37\u1F44\u1F4E\u1F5A\u0100Do\u1E06\u1D34o\xF4\u1C89\u0100cs\u1E0E\u1E14ute\u803B\xE9\u40E9ter;\u6A6E\u0200aioy\u1E22\u1E27\u1E31\u1E36ron;\u411Br\u0100;c\u1E2D\u1E2E\u6256\u803B\xEA\u40EAlon;\u6255;\u444Dot;\u4117\u0100Dr\u1E41\u1E45ot;\u6252;\uC000\u{1D522}\u0180;rs\u1E50\u1E51\u1E57\u6A9Aave\u803B\xE8\u40E8\u0100;d\u1E5C\u1E5D\u6A96ot;\u6A98\u0200;ils\u1E6A\u1E6B\u1E72\u1E74\u6A99nters;\u63E7;\u6113\u0100;d\u1E79\u1E7A\u6A95ot;\u6A97\u0180aps\u1E85\u1E89\u1E97cr;\u4113ty\u0180;sv\u1E92\u1E93\u1E95\u6205et\xBB\u1E93p\u01001;\u1E9D\u1EA4\u0133\u1EA1\u1EA3;\u6004;\u6005\u6003\u0100gs\u1EAA\u1EAC;\u414Bp;\u6002\u0100gp\u1EB4\u1EB8on;\u4119f;\uC000\u{1D556}\u0180als\u1EC4\u1ECE\u1ED2r\u0100;s\u1ECA\u1ECB\u62D5l;\u69E3us;\u6A71i\u0180;lv\u1EDA\u1EDB\u1EDF\u43B5on\xBB\u1EDB;\u43F5\u0200csuv\u1EEA\u1EF3\u1F0B\u1F23\u0100io\u1EEF\u1E31rc\xBB\u1E2E\u0269\u1EF9\0\0\u1EFB\xED\u0548ant\u0100gl\u1F02\u1F06tr\xBB\u1E5Dess\xBB\u1E7A\u0180aei\u1F12\u1F16\u1F1Als;\u403Dst;\u625Fv\u0100;D\u0235\u1F20D;\u6A78parsl;\u69E5\u0100Da\u1F2F\u1F33ot;\u6253rr;\u6971\u0180cdi\u1F3E\u1F41\u1EF8r;\u612Fo\xF4\u0352\u0100ah\u1F49\u1F4B;\u43B7\u803B\xF0\u40F0\u0100mr\u1F53\u1F57l\u803B\xEB\u40EBo;\u60AC\u0180cip\u1F61\u1F64\u1F67l;\u4021s\xF4\u056E\u0100eo\u1F6C\u1F74ctatio\xEE\u0559nential\xE5\u0579\u09E1\u1F92\0\u1F9E\0\u1FA1\u1FA7\0\0\u1FC6\u1FCC\0\u1FD3\0\u1FE6\u1FEA\u2000\0\u2008\u205Allingdotse\xF1\u1E44y;\u4444male;\u6640\u0180ilr\u1FAD\u1FB3\u1FC1lig;\u8000\uFB03\u0269\u1FB9\0\0\u1FBDg;\u8000\uFB00ig;\u8000\uFB04;\uC000\u{1D523}lig;\u8000\uFB01lig;\uC000fj\u0180alt\u1FD9\u1FDC\u1FE1t;\u666Dig;\u8000\uFB02ns;\u65B1of;\u4192\u01F0\u1FEE\0\u1FF3f;\uC000\u{1D557}\u0100ak\u05BF\u1FF7\u0100;v\u1FFC\u1FFD\u62D4;\u6AD9artint;\u6A0D\u0100ao\u200C\u2055\u0100cs\u2011\u2052\u03B1\u201A\u2030\u2038\u2045\u2048\0\u2050\u03B2\u2022\u2025\u2027\u202A\u202C\0\u202E\u803B\xBD\u40BD;\u6153\u803B\xBC\u40BC;\u6155;\u6159;\u615B\u01B3\u2034\0\u2036;\u6154;\u6156\u02B4\u203E\u2041\0\0\u2043\u803B\xBE\u40BE;\u6157;\u615C5;\u6158\u01B6\u204C\0\u204E;\u615A;\u615D8;\u615El;\u6044wn;\u6322cr;\uC000\u{1D4BB}\u0880Eabcdefgijlnorstv\u2082\u2089\u209F\u20A5\u20B0\u20B4\u20F0\u20F5\u20FA\u20FF\u2103\u2112\u2138\u0317\u213E\u2152\u219E\u0100;l\u064D\u2087;\u6A8C\u0180cmp\u2090\u2095\u209Dute;\u41F5ma\u0100;d\u209C\u1CDA\u43B3;\u6A86reve;\u411F\u0100iy\u20AA\u20AErc;\u411D;\u4433ot;\u4121\u0200;lqs\u063E\u0642\u20BD\u20C9\u0180;qs\u063E\u064C\u20C4lan\xF4\u0665\u0200;cdl\u0665\u20D2\u20D5\u20E5c;\u6AA9ot\u0100;o\u20DC\u20DD\u6A80\u0100;l\u20E2\u20E3\u6A82;\u6A84\u0100;e\u20EA\u20ED\uC000\u22DB\uFE00s;\u6A94r;\uC000\u{1D524}\u0100;g\u0673\u061Bmel;\u6137cy;\u4453\u0200;Eaj\u065A\u210C\u210E\u2110;\u6A92;\u6AA5;\u6AA4\u0200Eaes\u211B\u211D\u2129\u2134;\u6269p\u0100;p\u2123\u2124\u6A8Arox\xBB\u2124\u0100;q\u212E\u212F\u6A88\u0100;q\u212E\u211Bim;\u62E7pf;\uC000\u{1D558}\u0100ci\u2143\u2146r;\u610Am\u0180;el\u066B\u214E\u2150;\u6A8E;\u6A90\u8300>;cdlqr\u05EE\u2160\u216A\u216E\u2173\u2179\u0100ci\u2165\u2167;\u6AA7r;\u6A7Aot;\u62D7Par;\u6995uest;\u6A7C\u0280adels\u2184\u216A\u2190\u0656\u219B\u01F0\u2189\0\u218Epro\xF8\u209Er;\u6978q\u0100lq\u063F\u2196les\xF3\u2088i\xED\u066B\u0100en\u21A3\u21ADrtneqq;\uC000\u2269\uFE00\xC5\u21AA\u0500Aabcefkosy\u21C4\u21C7\u21F1\u21F5\u21FA\u2218\u221D\u222F\u2268\u227Dr\xF2\u03A0\u0200ilmr\u21D0\u21D4\u21D7\u21DBrs\xF0\u1484f\xBB\u2024il\xF4\u06A9\u0100dr\u21E0\u21E4cy;\u444A\u0180;cw\u08F4\u21EB\u21EFir;\u6948;\u61ADar;\u610Firc;\u4125\u0180alr\u2201\u220E\u2213rts\u0100;u\u2209\u220A\u6665it\xBB\u220Alip;\u6026con;\u62B9r;\uC000\u{1D525}s\u0100ew\u2223\u2229arow;\u6925arow;\u6926\u0280amopr\u223A\u223E\u2243\u225E\u2263rr;\u61FFtht;\u623Bk\u0100lr\u2249\u2253eftarrow;\u61A9ightarrow;\u61AAf;\uC000\u{1D559}bar;\u6015\u0180clt\u226F\u2274\u2278r;\uC000\u{1D4BD}as\xE8\u21F4rok;\u4127\u0100bp\u2282\u2287ull;\u6043hen\xBB\u1C5B\u0AE1\u22A3\0\u22AA\0\u22B8\u22C5\u22CE\0\u22D5\u22F3\0\0\u22F8\u2322\u2367\u2362\u237F\0\u2386\u23AA\u23B4cute\u803B\xED\u40ED\u0180;iy\u0771\u22B0\u22B5rc\u803B\xEE\u40EE;\u4438\u0100cx\u22BC\u22BFy;\u4435cl\u803B\xA1\u40A1\u0100fr\u039F\u22C9;\uC000\u{1D526}rave\u803B\xEC\u40EC\u0200;ino\u073E\u22DD\u22E9\u22EE\u0100in\u22E2\u22E6nt;\u6A0Ct;\u622Dfin;\u69DCta;\u6129lig;\u4133\u0180aop\u22FE\u231A\u231D\u0180cgt\u2305\u2308\u2317r;\u412B\u0180elp\u071F\u230F\u2313in\xE5\u078Ear\xF4\u0720h;\u4131f;\u62B7ed;\u41B5\u0280;cfot\u04F4\u232C\u2331\u233D\u2341are;\u6105in\u0100;t\u2338\u2339\u621Eie;\u69DDdo\xF4\u2319\u0280;celp\u0757\u234C\u2350\u235B\u2361al;\u62BA\u0100gr\u2355\u2359er\xF3\u1563\xE3\u234Darhk;\u6A17rod;\u6A3C\u0200cgpt\u236F\u2372\u2376\u237By;\u4451on;\u412Ff;\uC000\u{1D55A}a;\u43B9uest\u803B\xBF\u40BF\u0100ci\u238A\u238Fr;\uC000\u{1D4BE}n\u0280;Edsv\u04F4\u239B\u239D\u23A1\u04F3;\u62F9ot;\u62F5\u0100;v\u23A6\u23A7\u62F4;\u62F3\u0100;i\u0777\u23AElde;\u4129\u01EB\u23B8\0\u23BCcy;\u4456l\u803B\xEF\u40EF\u0300cfmosu\u23CC\u23D7\u23DC\u23E1\u23E7\u23F5\u0100iy\u23D1\u23D5rc;\u4135;\u4439r;\uC000\u{1D527}ath;\u4237pf;\uC000\u{1D55B}\u01E3\u23EC\0\u23F1r;\uC000\u{1D4BF}rcy;\u4458kcy;\u4454\u0400acfghjos\u240B\u2416\u2422\u2427\u242D\u2431\u2435\u243Bppa\u0100;v\u2413\u2414\u43BA;\u43F0\u0100ey\u241B\u2420dil;\u4137;\u443Ar;\uC000\u{1D528}reen;\u4138cy;\u4445cy;\u445Cpf;\uC000\u{1D55C}cr;\uC000\u{1D4C0}\u0B80ABEHabcdefghjlmnoprstuv\u2470\u2481\u2486\u248D\u2491\u250E\u253D\u255A\u2580\u264E\u265E\u2665\u2679\u267D\u269A\u26B2\u26D8\u275D\u2768\u278B\u27C0\u2801\u2812\u0180art\u2477\u247A\u247Cr\xF2\u09C6\xF2\u0395ail;\u691Barr;\u690E\u0100;g\u0994\u248B;\u6A8Bar;\u6962\u0963\u24A5\0\u24AA\0\u24B1\0\0\0\0\0\u24B5\u24BA\0\u24C6\u24C8\u24CD\0\u24F9ute;\u413Amptyv;\u69B4ra\xEE\u084Cbda;\u43BBg\u0180;dl\u088E\u24C1\u24C3;\u6991\xE5\u088E;\u6A85uo\u803B\xAB\u40ABr\u0400;bfhlpst\u0899\u24DE\u24E6\u24E9\u24EB\u24EE\u24F1\u24F5\u0100;f\u089D\u24E3s;\u691Fs;\u691D\xEB\u2252p;\u61ABl;\u6939im;\u6973l;\u61A2\u0180;ae\u24FF\u2500\u2504\u6AABil;\u6919\u0100;s\u2509\u250A\u6AAD;\uC000\u2AAD\uFE00\u0180abr\u2515\u2519\u251Drr;\u690Crk;\u6772\u0100ak\u2522\u252Cc\u0100ek\u2528\u252A;\u407B;\u405B\u0100es\u2531\u2533;\u698Bl\u0100du\u2539\u253B;\u698F;\u698D\u0200aeuy\u2546\u254B\u2556\u2558ron;\u413E\u0100di\u2550\u2554il;\u413C\xEC\u08B0\xE2\u2529;\u443B\u0200cqrs\u2563\u2566\u256D\u257Da;\u6936uo\u0100;r\u0E19\u1746\u0100du\u2572\u2577har;\u6967shar;\u694Bh;\u61B2\u0280;fgqs\u258B\u258C\u0989\u25F3\u25FF\u6264t\u0280ahlrt\u2598\u25A4\u25B7\u25C2\u25E8rrow\u0100;t\u0899\u25A1a\xE9\u24F6arpoon\u0100du\u25AF\u25B4own\xBB\u045Ap\xBB\u0966eftarrows;\u61C7ight\u0180ahs\u25CD\u25D6\u25DErrow\u0100;s\u08F4\u08A7arpoon\xF3\u0F98quigarro\xF7\u21F0hreetimes;\u62CB\u0180;qs\u258B\u0993\u25FAlan\xF4\u09AC\u0280;cdgs\u09AC\u260A\u260D\u261D\u2628c;\u6AA8ot\u0100;o\u2614\u2615\u6A7F\u0100;r\u261A\u261B\u6A81;\u6A83\u0100;e\u2622\u2625\uC000\u22DA\uFE00s;\u6A93\u0280adegs\u2633\u2639\u263D\u2649\u264Bppro\xF8\u24C6ot;\u62D6q\u0100gq\u2643\u2645\xF4\u0989gt\xF2\u248C\xF4\u099Bi\xED\u09B2\u0180ilr\u2655\u08E1\u265Asht;\u697C;\uC000\u{1D529}\u0100;E\u099C\u2663;\u6A91\u0161\u2669\u2676r\u0100du\u25B2\u266E\u0100;l\u0965\u2673;\u696Alk;\u6584cy;\u4459\u0280;acht\u0A48\u2688\u268B\u2691\u2696r\xF2\u25C1orne\xF2\u1D08ard;\u696Bri;\u65FA\u0100io\u269F\u26A4dot;\u4140ust\u0100;a\u26AC\u26AD\u63B0che\xBB\u26AD\u0200Eaes\u26BB\u26BD\u26C9\u26D4;\u6268p\u0100;p\u26C3\u26C4\u6A89rox\xBB\u26C4\u0100;q\u26CE\u26CF\u6A87\u0100;q\u26CE\u26BBim;\u62E6\u0400abnoptwz\u26E9\u26F4\u26F7\u271A\u272F\u2741\u2747\u2750\u0100nr\u26EE\u26F1g;\u67ECr;\u61FDr\xEB\u08C1g\u0180lmr\u26FF\u270D\u2714eft\u0100ar\u09E6\u2707ight\xE1\u09F2apsto;\u67FCight\xE1\u09FDparrow\u0100lr\u2725\u2729ef\xF4\u24EDight;\u61AC\u0180afl\u2736\u2739\u273Dr;\u6985;\uC000\u{1D55D}us;\u6A2Dimes;\u6A34\u0161\u274B\u274Fst;\u6217\xE1\u134E\u0180;ef\u2757\u2758\u1800\u65CAnge\xBB\u2758ar\u0100;l\u2764\u2765\u4028t;\u6993\u0280achmt\u2773\u2776\u277C\u2785\u2787r\xF2\u08A8orne\xF2\u1D8Car\u0100;d\u0F98\u2783;\u696D;\u600Eri;\u62BF\u0300achiqt\u2798\u279D\u0A40\u27A2\u27AE\u27BBquo;\u6039r;\uC000\u{1D4C1}m\u0180;eg\u09B2\u27AA\u27AC;\u6A8D;\u6A8F\u0100bu\u252A\u27B3o\u0100;r\u0E1F\u27B9;\u601Arok;\u4142\u8400<;cdhilqr\u082B\u27D2\u2639\u27DC\u27E0\u27E5\u27EA\u27F0\u0100ci\u27D7\u27D9;\u6AA6r;\u6A79re\xE5\u25F2mes;\u62C9arr;\u6976uest;\u6A7B\u0100Pi\u27F5\u27F9ar;\u6996\u0180;ef\u2800\u092D\u181B\u65C3r\u0100du\u2807\u280Dshar;\u694Ahar;\u6966\u0100en\u2817\u2821rtneqq;\uC000\u2268\uFE00\xC5\u281E\u0700Dacdefhilnopsu\u2840\u2845\u2882\u288E\u2893\u28A0\u28A5\u28A8\u28DA\u28E2\u28E4\u0A83\u28F3\u2902Dot;\u623A\u0200clpr\u284E\u2852\u2863\u287Dr\u803B\xAF\u40AF\u0100et\u2857\u2859;\u6642\u0100;e\u285E\u285F\u6720se\xBB\u285F\u0100;s\u103B\u2868to\u0200;dlu\u103B\u2873\u2877\u287Bow\xEE\u048Cef\xF4\u090F\xF0\u13D1ker;\u65AE\u0100oy\u2887\u288Cmma;\u6A29;\u443Cash;\u6014asuredangle\xBB\u1626r;\uC000\u{1D52A}o;\u6127\u0180cdn\u28AF\u28B4\u28C9ro\u803B\xB5\u40B5\u0200;acd\u1464\u28BD\u28C0\u28C4s\xF4\u16A7ir;\u6AF0ot\u80BB\xB7\u01B5us\u0180;bd\u28D2\u1903\u28D3\u6212\u0100;u\u1D3C\u28D8;\u6A2A\u0163\u28DE\u28E1p;\u6ADB\xF2\u2212\xF0\u0A81\u0100dp\u28E9\u28EEels;\u62A7f;\uC000\u{1D55E}\u0100ct\u28F8\u28FDr;\uC000\u{1D4C2}pos\xBB\u159D\u0180;lm\u2909\u290A\u290D\u43BCtimap;\u62B8\u0C00GLRVabcdefghijlmoprstuvw\u2942\u2953\u297E\u2989\u2998\u29DA\u29E9\u2A15\u2A1A\u2A58\u2A5D\u2A83\u2A95\u2AA4\u2AA8\u2B04\u2B07\u2B44\u2B7F\u2BAE\u2C34\u2C67\u2C7C\u2CE9\u0100gt\u2947\u294B;\uC000\u22D9\u0338\u0100;v\u2950\u0BCF\uC000\u226B\u20D2\u0180elt\u295A\u2972\u2976ft\u0100ar\u2961\u2967rrow;\u61CDightarrow;\u61CE;\uC000\u22D8\u0338\u0100;v\u297B\u0C47\uC000\u226A\u20D2ightarrow;\u61CF\u0100Dd\u298E\u2993ash;\u62AFash;\u62AE\u0280bcnpt\u29A3\u29A7\u29AC\u29B1\u29CCla\xBB\u02DEute;\u4144g;\uC000\u2220\u20D2\u0280;Eiop\u0D84\u29BC\u29C0\u29C5\u29C8;\uC000\u2A70\u0338d;\uC000\u224B\u0338s;\u4149ro\xF8\u0D84ur\u0100;a\u29D3\u29D4\u666El\u0100;s\u29D3\u0B38\u01F3\u29DF\0\u29E3p\u80BB\xA0\u0B37mp\u0100;e\u0BF9\u0C00\u0280aeouy\u29F4\u29FE\u2A03\u2A10\u2A13\u01F0\u29F9\0\u29FB;\u6A43on;\u4148dil;\u4146ng\u0100;d\u0D7E\u2A0Aot;\uC000\u2A6D\u0338p;\u6A42;\u443Dash;\u6013\u0380;Aadqsx\u0B92\u2A29\u2A2D\u2A3B\u2A41\u2A45\u2A50rr;\u61D7r\u0100hr\u2A33\u2A36k;\u6924\u0100;o\u13F2\u13F0ot;\uC000\u2250\u0338ui\xF6\u0B63\u0100ei\u2A4A\u2A4Ear;\u6928\xED\u0B98ist\u0100;s\u0BA0\u0B9Fr;\uC000\u{1D52B}\u0200Eest\u0BC5\u2A66\u2A79\u2A7C\u0180;qs\u0BBC\u2A6D\u0BE1\u0180;qs\u0BBC\u0BC5\u2A74lan\xF4\u0BE2i\xED\u0BEA\u0100;r\u0BB6\u2A81\xBB\u0BB7\u0180Aap\u2A8A\u2A8D\u2A91r\xF2\u2971rr;\u61AEar;\u6AF2\u0180;sv\u0F8D\u2A9C\u0F8C\u0100;d\u2AA1\u2AA2\u62FC;\u62FAcy;\u445A\u0380AEadest\u2AB7\u2ABA\u2ABE\u2AC2\u2AC5\u2AF6\u2AF9r\xF2\u2966;\uC000\u2266\u0338rr;\u619Ar;\u6025\u0200;fqs\u0C3B\u2ACE\u2AE3\u2AEFt\u0100ar\u2AD4\u2AD9rro\xF7\u2AC1ightarro\xF7\u2A90\u0180;qs\u0C3B\u2ABA\u2AEAlan\xF4\u0C55\u0100;s\u0C55\u2AF4\xBB\u0C36i\xED\u0C5D\u0100;r\u0C35\u2AFEi\u0100;e\u0C1A\u0C25i\xE4\u0D90\u0100pt\u2B0C\u2B11f;\uC000\u{1D55F}\u8180\xAC;in\u2B19\u2B1A\u2B36\u40ACn\u0200;Edv\u0B89\u2B24\u2B28\u2B2E;\uC000\u22F9\u0338ot;\uC000\u22F5\u0338\u01E1\u0B89\u2B33\u2B35;\u62F7;\u62F6i\u0100;v\u0CB8\u2B3C\u01E1\u0CB8\u2B41\u2B43;\u62FE;\u62FD\u0180aor\u2B4B\u2B63\u2B69r\u0200;ast\u0B7B\u2B55\u2B5A\u2B5Flle\xEC\u0B7Bl;\uC000\u2AFD\u20E5;\uC000\u2202\u0338lint;\u6A14\u0180;ce\u0C92\u2B70\u2B73u\xE5\u0CA5\u0100;c\u0C98\u2B78\u0100;e\u0C92\u2B7D\xF1\u0C98\u0200Aait\u2B88\u2B8B\u2B9D\u2BA7r\xF2\u2988rr\u0180;cw\u2B94\u2B95\u2B99\u619B;\uC000\u2933\u0338;\uC000\u219D\u0338ghtarrow\xBB\u2B95ri\u0100;e\u0CCB\u0CD6\u0380chimpqu\u2BBD\u2BCD\u2BD9\u2B04\u0B78\u2BE4\u2BEF\u0200;cer\u0D32\u2BC6\u0D37\u2BC9u\xE5\u0D45;\uC000\u{1D4C3}ort\u026D\u2B05\0\0\u2BD6ar\xE1\u2B56m\u0100;e\u0D6E\u2BDF\u0100;q\u0D74\u0D73su\u0100bp\u2BEB\u2BED\xE5\u0CF8\xE5\u0D0B\u0180bcp\u2BF6\u2C11\u2C19\u0200;Ees\u2BFF\u2C00\u0D22\u2C04\u6284;\uC000\u2AC5\u0338et\u0100;e\u0D1B\u2C0Bq\u0100;q\u0D23\u2C00c\u0100;e\u0D32\u2C17\xF1\u0D38\u0200;Ees\u2C22\u2C23\u0D5F\u2C27\u6285;\uC000\u2AC6\u0338et\u0100;e\u0D58\u2C2Eq\u0100;q\u0D60\u2C23\u0200gilr\u2C3D\u2C3F\u2C45\u2C47\xEC\u0BD7lde\u803B\xF1\u40F1\xE7\u0C43iangle\u0100lr\u2C52\u2C5Ceft\u0100;e\u0C1A\u2C5A\xF1\u0C26ight\u0100;e\u0CCB\u2C65\xF1\u0CD7\u0100;m\u2C6C\u2C6D\u43BD\u0180;es\u2C74\u2C75\u2C79\u4023ro;\u6116p;\u6007\u0480DHadgilrs\u2C8F\u2C94\u2C99\u2C9E\u2CA3\u2CB0\u2CB6\u2CD3\u2CE3ash;\u62ADarr;\u6904p;\uC000\u224D\u20D2ash;\u62AC\u0100et\u2CA8\u2CAC;\uC000\u2265\u20D2;\uC000>\u20D2nfin;\u69DE\u0180Aet\u2CBD\u2CC1\u2CC5rr;\u6902;\uC000\u2264\u20D2\u0100;r\u2CCA\u2CCD\uC000<\u20D2ie;\uC000\u22B4\u20D2\u0100At\u2CD8\u2CDCrr;\u6903rie;\uC000\u22B5\u20D2im;\uC000\u223C\u20D2\u0180Aan\u2CF0\u2CF4\u2D02rr;\u61D6r\u0100hr\u2CFA\u2CFDk;\u6923\u0100;o\u13E7\u13E5ear;\u6927\u1253\u1A95\0\0\0\0\0\0\0\0\0\0\0\0\0\u2D2D\0\u2D38\u2D48\u2D60\u2D65\u2D72\u2D84\u1B07\0\0\u2D8D\u2DAB\0\u2DC8\u2DCE\0\u2DDC\u2E19\u2E2B\u2E3E\u2E43\u0100cs\u2D31\u1A97ute\u803B\xF3\u40F3\u0100iy\u2D3C\u2D45r\u0100;c\u1A9E\u2D42\u803B\xF4\u40F4;\u443E\u0280abios\u1AA0\u2D52\u2D57\u01C8\u2D5Alac;\u4151v;\u6A38old;\u69BClig;\u4153\u0100cr\u2D69\u2D6Dir;\u69BF;\uC000\u{1D52C}\u036F\u2D79\0\0\u2D7C\0\u2D82n;\u42DBave\u803B\xF2\u40F2;\u69C1\u0100bm\u2D88\u0DF4ar;\u69B5\u0200acit\u2D95\u2D98\u2DA5\u2DA8r\xF2\u1A80\u0100ir\u2D9D\u2DA0r;\u69BEoss;\u69BBn\xE5\u0E52;\u69C0\u0180aei\u2DB1\u2DB5\u2DB9cr;\u414Dga;\u43C9\u0180cdn\u2DC0\u2DC5\u01CDron;\u43BF;\u69B6pf;\uC000\u{1D560}\u0180ael\u2DD4\u2DD7\u01D2r;\u69B7rp;\u69B9\u0380;adiosv\u2DEA\u2DEB\u2DEE\u2E08\u2E0D\u2E10\u2E16\u6228r\xF2\u1A86\u0200;efm\u2DF7\u2DF8\u2E02\u2E05\u6A5Dr\u0100;o\u2DFE\u2DFF\u6134f\xBB\u2DFF\u803B\xAA\u40AA\u803B\xBA\u40BAgof;\u62B6r;\u6A56lope;\u6A57;\u6A5B\u0180clo\u2E1F\u2E21\u2E27\xF2\u2E01ash\u803B\xF8\u40F8l;\u6298i\u016C\u2E2F\u2E34de\u803B\xF5\u40F5es\u0100;a\u01DB\u2E3As;\u6A36ml\u803B\xF6\u40F6bar;\u633D\u0AE1\u2E5E\0\u2E7D\0\u2E80\u2E9D\0\u2EA2\u2EB9\0\0\u2ECB\u0E9C\0\u2F13\0\0\u2F2B\u2FBC\0\u2FC8r\u0200;ast\u0403\u2E67\u2E72\u0E85\u8100\xB6;l\u2E6D\u2E6E\u40B6le\xEC\u0403\u0269\u2E78\0\0\u2E7Bm;\u6AF3;\u6AFDy;\u443Fr\u0280cimpt\u2E8B\u2E8F\u2E93\u1865\u2E97nt;\u4025od;\u402Eil;\u6030enk;\u6031r;\uC000\u{1D52D}\u0180imo\u2EA8\u2EB0\u2EB4\u0100;v\u2EAD\u2EAE\u43C6;\u43D5ma\xF4\u0A76ne;\u660E\u0180;tv\u2EBF\u2EC0\u2EC8\u43C0chfork\xBB\u1FFD;\u43D6\u0100au\u2ECF\u2EDFn\u0100ck\u2ED5\u2EDDk\u0100;h\u21F4\u2EDB;\u610E\xF6\u21F4s\u0480;abcdemst\u2EF3\u2EF4\u1908\u2EF9\u2EFD\u2F04\u2F06\u2F0A\u2F0E\u402Bcir;\u6A23ir;\u6A22\u0100ou\u1D40\u2F02;\u6A25;\u6A72n\u80BB\xB1\u0E9Dim;\u6A26wo;\u6A27\u0180ipu\u2F19\u2F20\u2F25ntint;\u6A15f;\uC000\u{1D561}nd\u803B\xA3\u40A3\u0500;Eaceinosu\u0EC8\u2F3F\u2F41\u2F44\u2F47\u2F81\u2F89\u2F92\u2F7E\u2FB6;\u6AB3p;\u6AB7u\xE5\u0ED9\u0100;c\u0ECE\u2F4C\u0300;acens\u0EC8\u2F59\u2F5F\u2F66\u2F68\u2F7Eppro\xF8\u2F43urlye\xF1\u0ED9\xF1\u0ECE\u0180aes\u2F6F\u2F76\u2F7Approx;\u6AB9qq;\u6AB5im;\u62E8i\xED\u0EDFme\u0100;s\u2F88\u0EAE\u6032\u0180Eas\u2F78\u2F90\u2F7A\xF0\u2F75\u0180dfp\u0EEC\u2F99\u2FAF\u0180als\u2FA0\u2FA5\u2FAAlar;\u632Eine;\u6312urf;\u6313\u0100;t\u0EFB\u2FB4\xEF\u0EFBrel;\u62B0\u0100ci\u2FC0\u2FC5r;\uC000\u{1D4C5};\u43C8ncsp;\u6008\u0300fiopsu\u2FDA\u22E2\u2FDF\u2FE5\u2FEB\u2FF1r;\uC000\u{1D52E}pf;\uC000\u{1D562}rime;\u6057cr;\uC000\u{1D4C6}\u0180aeo\u2FF8\u3009\u3013t\u0100ei\u2FFE\u3005rnion\xF3\u06B0nt;\u6A16st\u0100;e\u3010\u3011\u403F\xF1\u1F19\xF4\u0F14\u0A80ABHabcdefhilmnoprstux\u3040\u3051\u3055\u3059\u30E0\u310E\u312B\u3147\u3162\u3172\u318E\u3206\u3215\u3224\u3229\u3258\u326E\u3272\u3290\u32B0\u32B7\u0180art\u3047\u304A\u304Cr\xF2\u10B3\xF2\u03DDail;\u691Car\xF2\u1C65ar;\u6964\u0380cdenqrt\u3068\u3075\u3078\u307F\u308F\u3094\u30CC\u0100eu\u306D\u3071;\uC000\u223D\u0331te;\u4155i\xE3\u116Emptyv;\u69B3g\u0200;del\u0FD1\u3089\u308B\u308D;\u6992;\u69A5\xE5\u0FD1uo\u803B\xBB\u40BBr\u0580;abcfhlpstw\u0FDC\u30AC\u30AF\u30B7\u30B9\u30BC\u30BE\u30C0\u30C3\u30C7\u30CAp;\u6975\u0100;f\u0FE0\u30B4s;\u6920;\u6933s;\u691E\xEB\u225D\xF0\u272El;\u6945im;\u6974l;\u61A3;\u619D\u0100ai\u30D1\u30D5il;\u691Ao\u0100;n\u30DB\u30DC\u6236al\xF3\u0F1E\u0180abr\u30E7\u30EA\u30EEr\xF2\u17E5rk;\u6773\u0100ak\u30F3\u30FDc\u0100ek\u30F9\u30FB;\u407D;\u405D\u0100es\u3102\u3104;\u698Cl\u0100du\u310A\u310C;\u698E;\u6990\u0200aeuy\u3117\u311C\u3127\u3129ron;\u4159\u0100di\u3121\u3125il;\u4157\xEC\u0FF2\xE2\u30FA;\u4440\u0200clqs\u3134\u3137\u313D\u3144a;\u6937dhar;\u6969uo\u0100;r\u020E\u020Dh;\u61B3\u0180acg\u314E\u315F\u0F44l\u0200;ips\u0F78\u3158\u315B\u109Cn\xE5\u10BBar\xF4\u0FA9t;\u65AD\u0180ilr\u3169\u1023\u316Esht;\u697D;\uC000\u{1D52F}\u0100ao\u3177\u3186r\u0100du\u317D\u317F\xBB\u047B\u0100;l\u1091\u3184;\u696C\u0100;v\u318B\u318C\u43C1;\u43F1\u0180gns\u3195\u31F9\u31FCht\u0300ahlrst\u31A4\u31B0\u31C2\u31D8\u31E4\u31EErrow\u0100;t\u0FDC\u31ADa\xE9\u30C8arpoon\u0100du\u31BB\u31BFow\xEE\u317Ep\xBB\u1092eft\u0100ah\u31CA\u31D0rrow\xF3\u0FEAarpoon\xF3\u0551ightarrows;\u61C9quigarro\xF7\u30CBhreetimes;\u62CCg;\u42DAingdotse\xF1\u1F32\u0180ahm\u320D\u3210\u3213r\xF2\u0FEAa\xF2\u0551;\u600Foust\u0100;a\u321E\u321F\u63B1che\xBB\u321Fmid;\u6AEE\u0200abpt\u3232\u323D\u3240\u3252\u0100nr\u3237\u323Ag;\u67EDr;\u61FEr\xEB\u1003\u0180afl\u3247\u324A\u324Er;\u6986;\uC000\u{1D563}us;\u6A2Eimes;\u6A35\u0100ap\u325D\u3267r\u0100;g\u3263\u3264\u4029t;\u6994olint;\u6A12ar\xF2\u31E3\u0200achq\u327B\u3280\u10BC\u3285quo;\u603Ar;\uC000\u{1D4C7}\u0100bu\u30FB\u328Ao\u0100;r\u0214\u0213\u0180hir\u3297\u329B\u32A0re\xE5\u31F8mes;\u62CAi\u0200;efl\u32AA\u1059\u1821\u32AB\u65B9tri;\u69CEluhar;\u6968;\u611E\u0D61\u32D5\u32DB\u32DF\u332C\u3338\u3371\0\u337A\u33A4\0\0\u33EC\u33F0\0\u3428\u3448\u345A\u34AD\u34B1\u34CA\u34F1\0\u3616\0\0\u3633cute;\u415Bqu\xEF\u27BA\u0500;Eaceinpsy\u11ED\u32F3\u32F5\u32FF\u3302\u330B\u330F\u331F\u3326\u3329;\u6AB4\u01F0\u32FA\0\u32FC;\u6AB8on;\u4161u\xE5\u11FE\u0100;d\u11F3\u3307il;\u415Frc;\u415D\u0180Eas\u3316\u3318\u331B;\u6AB6p;\u6ABAim;\u62E9olint;\u6A13i\xED\u1204;\u4441ot\u0180;be\u3334\u1D47\u3335\u62C5;\u6A66\u0380Aacmstx\u3346\u334A\u3357\u335B\u335E\u3363\u336Drr;\u61D8r\u0100hr\u3350\u3352\xEB\u2228\u0100;o\u0A36\u0A34t\u803B\xA7\u40A7i;\u403Bwar;\u6929m\u0100in\u3369\xF0nu\xF3\xF1t;\u6736r\u0100;o\u3376\u2055\uC000\u{1D530}\u0200acoy\u3382\u3386\u3391\u33A0rp;\u666F\u0100hy\u338B\u338Fcy;\u4449;\u4448rt\u026D\u3399\0\0\u339Ci\xE4\u1464ara\xEC\u2E6F\u803B\xAD\u40AD\u0100gm\u33A8\u33B4ma\u0180;fv\u33B1\u33B2\u33B2\u43C3;\u43C2\u0400;deglnpr\u12AB\u33C5\u33C9\u33CE\u33D6\u33DE\u33E1\u33E6ot;\u6A6A\u0100;q\u12B1\u12B0\u0100;E\u33D3\u33D4\u6A9E;\u6AA0\u0100;E\u33DB\u33DC\u6A9D;\u6A9Fe;\u6246lus;\u6A24arr;\u6972ar\xF2\u113D\u0200aeit\u33F8\u3408\u340F\u3417\u0100ls\u33FD\u3404lsetm\xE9\u336Ahp;\u6A33parsl;\u69E4\u0100dl\u1463\u3414e;\u6323\u0100;e\u341C\u341D\u6AAA\u0100;s\u3422\u3423\u6AAC;\uC000\u2AAC\uFE00\u0180flp\u342E\u3433\u3442tcy;\u444C\u0100;b\u3438\u3439\u402F\u0100;a\u343E\u343F\u69C4r;\u633Ff;\uC000\u{1D564}a\u0100dr\u344D\u0402es\u0100;u\u3454\u3455\u6660it\xBB\u3455\u0180csu\u3460\u3479\u349F\u0100au\u3465\u346Fp\u0100;s\u1188\u346B;\uC000\u2293\uFE00p\u0100;s\u11B4\u3475;\uC000\u2294\uFE00u\u0100bp\u347F\u348F\u0180;es\u1197\u119C\u3486et\u0100;e\u1197\u348D\xF1\u119D\u0180;es\u11A8\u11AD\u3496et\u0100;e\u11A8\u349D\xF1\u11AE\u0180;af\u117B\u34A6\u05B0r\u0165\u34AB\u05B1\xBB\u117Car\xF2\u1148\u0200cemt\u34B9\u34BE\u34C2\u34C5r;\uC000\u{1D4C8}tm\xEE\xF1i\xEC\u3415ar\xE6\u11BE\u0100ar\u34CE\u34D5r\u0100;f\u34D4\u17BF\u6606\u0100an\u34DA\u34EDight\u0100ep\u34E3\u34EApsilo\xEE\u1EE0h\xE9\u2EAFs\xBB\u2852\u0280bcmnp\u34FB\u355E\u1209\u358B\u358E\u0480;Edemnprs\u350E\u350F\u3511\u3515\u351E\u3523\u352C\u3531\u3536\u6282;\u6AC5ot;\u6ABD\u0100;d\u11DA\u351Aot;\u6AC3ult;\u6AC1\u0100Ee\u3528\u352A;\u6ACB;\u628Alus;\u6ABFarr;\u6979\u0180eiu\u353D\u3552\u3555t\u0180;en\u350E\u3545\u354Bq\u0100;q\u11DA\u350Feq\u0100;q\u352B\u3528m;\u6AC7\u0100bp\u355A\u355C;\u6AD5;\u6AD3c\u0300;acens\u11ED\u356C\u3572\u3579\u357B\u3326ppro\xF8\u32FAurlye\xF1\u11FE\xF1\u11F3\u0180aes\u3582\u3588\u331Bppro\xF8\u331Aq\xF1\u3317g;\u666A\u0680123;Edehlmnps\u35A9\u35AC\u35AF\u121C\u35B2\u35B4\u35C0\u35C9\u35D5\u35DA\u35DF\u35E8\u35ED\u803B\xB9\u40B9\u803B\xB2\u40B2\u803B\xB3\u40B3;\u6AC6\u0100os\u35B9\u35BCt;\u6ABEub;\u6AD8\u0100;d\u1222\u35C5ot;\u6AC4s\u0100ou\u35CF\u35D2l;\u67C9b;\u6AD7arr;\u697Bult;\u6AC2\u0100Ee\u35E4\u35E6;\u6ACC;\u628Blus;\u6AC0\u0180eiu\u35F4\u3609\u360Ct\u0180;en\u121C\u35FC\u3602q\u0100;q\u1222\u35B2eq\u0100;q\u35E7\u35E4m;\u6AC8\u0100bp\u3611\u3613;\u6AD4;\u6AD6\u0180Aan\u361C\u3620\u362Drr;\u61D9r\u0100hr\u3626\u3628\xEB\u222E\u0100;o\u0A2B\u0A29war;\u692Alig\u803B\xDF\u40DF\u0BE1\u3651\u365D\u3660\u12CE\u3673\u3679\0\u367E\u36C2\0\0\0\0\0\u36DB\u3703\0\u3709\u376C\0\0\0\u3787\u0272\u3656\0\0\u365Bget;\u6316;\u43C4r\xEB\u0E5F\u0180aey\u3666\u366B\u3670ron;\u4165dil;\u4163;\u4442lrec;\u6315r;\uC000\u{1D531}\u0200eiko\u3686\u369D\u36B5\u36BC\u01F2\u368B\0\u3691e\u01004f\u1284\u1281a\u0180;sv\u3698\u3699\u369B\u43B8ym;\u43D1\u0100cn\u36A2\u36B2k\u0100as\u36A8\u36AEppro\xF8\u12C1im\xBB\u12ACs\xF0\u129E\u0100as\u36BA\u36AE\xF0\u12C1rn\u803B\xFE\u40FE\u01EC\u031F\u36C6\u22E7es\u8180\xD7;bd\u36CF\u36D0\u36D8\u40D7\u0100;a\u190F\u36D5r;\u6A31;\u6A30\u0180eps\u36E1\u36E3\u3700\xE1\u2A4D\u0200;bcf\u0486\u36EC\u36F0\u36F4ot;\u6336ir;\u6AF1\u0100;o\u36F9\u36FC\uC000\u{1D565}rk;\u6ADA\xE1\u3362rime;\u6034\u0180aip\u370F\u3712\u3764d\xE5\u1248\u0380adempst\u3721\u374D\u3740\u3751\u3757\u375C\u375Fngle\u0280;dlqr\u3730\u3731\u3736\u3740\u3742\u65B5own\xBB\u1DBBeft\u0100;e\u2800\u373E\xF1\u092E;\u625Cight\u0100;e\u32AA\u374B\xF1\u105Aot;\u65ECinus;\u6A3Alus;\u6A39b;\u69CDime;\u6A3Bezium;\u63E2\u0180cht\u3772\u377D\u3781\u0100ry\u3777\u377B;\uC000\u{1D4C9};\u4446cy;\u445Brok;\u4167\u0100io\u378B\u378Ex\xF4\u1777head\u0100lr\u3797\u37A0eftarro\xF7\u084Fightarrow\xBB\u0F5D\u0900AHabcdfghlmoprstuw\u37D0\u37D3\u37D7\u37E4\u37F0\u37FC\u380E\u381C\u3823\u3834\u3851\u385D\u386B\u38A9\u38CC\u38D2\u38EA\u38F6r\xF2\u03EDar;\u6963\u0100cr\u37DC\u37E2ute\u803B\xFA\u40FA\xF2\u1150r\u01E3\u37EA\0\u37EDy;\u445Eve;\u416D\u0100iy\u37F5\u37FArc\u803B\xFB\u40FB;\u4443\u0180abh\u3803\u3806\u380Br\xF2\u13ADlac;\u4171a\xF2\u13C3\u0100ir\u3813\u3818sht;\u697E;\uC000\u{1D532}rave\u803B\xF9\u40F9\u0161\u3827\u3831r\u0100lr\u382C\u382E\xBB\u0957\xBB\u1083lk;\u6580\u0100ct\u3839\u384D\u026F\u383F\0\0\u384Arn\u0100;e\u3845\u3846\u631Cr\xBB\u3846op;\u630Fri;\u65F8\u0100al\u3856\u385Acr;\u416B\u80BB\xA8\u0349\u0100gp\u3862\u3866on;\u4173f;\uC000\u{1D566}\u0300adhlsu\u114B\u3878\u387D\u1372\u3891\u38A0own\xE1\u13B3arpoon\u0100lr\u3888\u388Cef\xF4\u382Digh\xF4\u382Fi\u0180;hl\u3899\u389A\u389C\u43C5\xBB\u13FAon\xBB\u389Aparrows;\u61C8\u0180cit\u38B0\u38C4\u38C8\u026F\u38B6\0\0\u38C1rn\u0100;e\u38BC\u38BD\u631Dr\xBB\u38BDop;\u630Eng;\u416Fri;\u65F9cr;\uC000\u{1D4CA}\u0180dir\u38D9\u38DD\u38E2ot;\u62F0lde;\u4169i\u0100;f\u3730\u38E8\xBB\u1813\u0100am\u38EF\u38F2r\xF2\u38A8l\u803B\xFC\u40FCangle;\u69A7\u0780ABDacdeflnoprsz\u391C\u391F\u3929\u392D\u39B5\u39B8\u39BD\u39DF\u39E4\u39E8\u39F3\u39F9\u39FD\u3A01\u3A20r\xF2\u03F7ar\u0100;v\u3926\u3927\u6AE8;\u6AE9as\xE8\u03E1\u0100nr\u3932\u3937grt;\u699C\u0380eknprst\u34E3\u3946\u394B\u3952\u395D\u3964\u3996app\xE1\u2415othin\xE7\u1E96\u0180hir\u34EB\u2EC8\u3959op\xF4\u2FB5\u0100;h\u13B7\u3962\xEF\u318D\u0100iu\u3969\u396Dgm\xE1\u33B3\u0100bp\u3972\u3984setneq\u0100;q\u397D\u3980\uC000\u228A\uFE00;\uC000\u2ACB\uFE00setneq\u0100;q\u398F\u3992\uC000\u228B\uFE00;\uC000\u2ACC\uFE00\u0100hr\u399B\u399Fet\xE1\u369Ciangle\u0100lr\u39AA\u39AFeft\xBB\u0925ight\xBB\u1051y;\u4432ash\xBB\u1036\u0180elr\u39C4\u39D2\u39D7\u0180;be\u2DEA\u39CB\u39CFar;\u62BBq;\u625Alip;\u62EE\u0100bt\u39DC\u1468a\xF2\u1469r;\uC000\u{1D533}tr\xE9\u39AEsu\u0100bp\u39EF\u39F1\xBB\u0D1C\xBB\u0D59pf;\uC000\u{1D567}ro\xF0\u0EFBtr\xE9\u39B4\u0100cu\u3A06\u3A0Br;\uC000\u{1D4CB}\u0100bp\u3A10\u3A18n\u0100Ee\u3980\u3A16\xBB\u397En\u0100Ee\u3992\u3A1E\xBB\u3990igzag;\u699A\u0380cefoprs\u3A36\u3A3B\u3A56\u3A5B\u3A54\u3A61\u3A6Airc;\u4175\u0100di\u3A40\u3A51\u0100bg\u3A45\u3A49ar;\u6A5Fe\u0100;q\u15FA\u3A4F;\u6259erp;\u6118r;\uC000\u{1D534}pf;\uC000\u{1D568}\u0100;e\u1479\u3A66at\xE8\u1479cr;\uC000\u{1D4CC}\u0AE3\u178E\u3A87\0\u3A8B\0\u3A90\u3A9B\0\0\u3A9D\u3AA8\u3AAB\u3AAF\0\0\u3AC3\u3ACE\0\u3AD8\u17DC\u17DFtr\xE9\u17D1r;\uC000\u{1D535}\u0100Aa\u3A94\u3A97r\xF2\u03C3r\xF2\u09F6;\u43BE\u0100Aa\u3AA1\u3AA4r\xF2\u03B8r\xF2\u09EBa\xF0\u2713is;\u62FB\u0180dpt\u17A4\u3AB5\u3ABE\u0100fl\u3ABA\u17A9;\uC000\u{1D569}im\xE5\u17B2\u0100Aa\u3AC7\u3ACAr\xF2\u03CEr\xF2\u0A01\u0100cq\u3AD2\u17B8r;\uC000\u{1D4CD}\u0100pt\u17D6\u3ADCr\xE9\u17D4\u0400acefiosu\u3AF0\u3AFD\u3B08\u3B0C\u3B11\u3B15\u3B1B\u3B21c\u0100uy\u3AF6\u3AFBte\u803B\xFD\u40FD;\u444F\u0100iy\u3B02\u3B06rc;\u4177;\u444Bn\u803B\xA5\u40A5r;\uC000\u{1D536}cy;\u4457pf;\uC000\u{1D56A}cr;\uC000\u{1D4CE}\u0100cm\u3B26\u3B29y;\u444El\u803B\xFF\u40FF\u0500acdefhiosw\u3B42\u3B48\u3B54\u3B58\u3B64\u3B69\u3B6D\u3B74\u3B7A\u3B80cute;\u417A\u0100ay\u3B4D\u3B52ron;\u417E;\u4437ot;\u417C\u0100et\u3B5D\u3B61tr\xE6\u155Fa;\u43B6r;\uC000\u{1D537}cy;\u4436grarr;\u61DDpf;\uC000\u{1D56B}cr;\uC000\u{1D4CF}\u0100jn\u3B85\u3B87;\u600Dj;\u600C'.split("").map(r=>r.charCodeAt(0)));var dl=new Uint16Array("\u0200aglq \x1B\u026D\0\0p;\u4026os;\u4027t;\u403Et;\u403Cuot;\u4022".split("").map(r=>r.charCodeAt(0)));var Mp,CN=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),rs=(Mp=String.fromCodePoint)!==null&&Mp!==void 0?Mp:function(r){let e="";return r>65535&&(r-=65536,e+=String.fromCharCode(r>>>10&1023|55296),r=56320|r&1023),e+=String.fromCharCode(r),e};function Oa(r){var e;return r>=55296&&r<=57343||r>1114111?65533:(e=CN.get(r))!==null&&e!==void 0?e:r}var lt;(function(r){r[r.NUM=35]="NUM",r[r.SEMI=59]="SEMI",r[r.EQUALS=61]="EQUALS",r[r.ZERO=48]="ZERO",r[r.NINE=57]="NINE",r[r.LOWER_A=97]="LOWER_A",r[r.LOWER_F=102]="LOWER_F",r[r.LOWER_X=120]="LOWER_X",r[r.LOWER_Z=122]="LOWER_Z",r[r.UPPER_A=65]="UPPER_A",r[r.UPPER_F=70]="UPPER_F",r[r.UPPER_Z=90]="UPPER_Z"})(lt||(lt={}));var kN=32,ir;(function(r){r[r.VALUE_LENGTH=49152]="VALUE_LENGTH",r[r.BRANCH_LENGTH=16256]="BRANCH_LENGTH",r[r.JUMP_TABLE=127]="JUMP_TABLE"})(ir||(ir={}));function Bp(r){return r>=lt.ZERO&&r<=lt.NINE}function IN(r){return r>=lt.UPPER_A&&r<=lt.UPPER_F||r>=lt.LOWER_A&&r<=lt.LOWER_F}function RN(r){return r>=lt.UPPER_A&&r<=lt.UPPER_Z||r>=lt.LOWER_A&&r<=lt.LOWER_Z||Bp(r)}function PN(r){return r===lt.EQUALS||RN(r)}var ut;(function(r){r[r.EntityStart=0]="EntityStart",r[r.NumericStart=1]="NumericStart",r[r.NumericDecimal=2]="NumericDecimal",r[r.NumericHex=3]="NumericHex",r[r.NamedEntity=4]="NamedEntity"})(ut||(ut={}));var Zr;(function(r){r[r.Legacy=0]="Legacy",r[r.Strict=1]="Strict",r[r.Attribute=2]="Attribute"})(Zr||(Zr={}));var fl=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=ut.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Zr.Strict}startEntity(e){this.decodeMode=e,this.state=ut.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case ut.EntityStart:return e.charCodeAt(t)===lt.NUM?(this.state=ut.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=ut.NamedEntity,this.stateNamedEntity(e,t));case ut.NumericStart:return this.stateNumericStart(e,t);case ut.NumericDecimal:return this.stateNumericDecimal(e,t);case ut.NumericHex:return this.stateNumericHex(e,t);case ut.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|kN)===lt.LOWER_X?(this.state=ut.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=ut.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,i){if(t!==n){let s=n-t;this.result=this.result*Math.pow(i,s)+parseInt(e.substr(t,s),i),this.consumed+=s}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let i=e.charCodeAt(t);if(Bp(i)||IN(i))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(i,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let i=e.charCodeAt(t);if(Bp(i))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(i,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)===null||n===void 0||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===lt.SEMI)this.consumed+=1;else if(this.decodeMode===Zr.Strict)return 0;return this.emitCodePoint(Oa(this.result),this.consumed),this.errors&&(e!==lt.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,i=n[this.treeIndex],s=(i&ir.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=Dp(n,i,this.treeIndex+Math.max(1,s),a),this.treeIndex<0)return this.result===0||this.decodeMode===Zr.Attribute&&(s===0||PN(a))?0:this.emitNotTerminatedNamedEntity();if(i=n[this.treeIndex],s=(i&ir.VALUE_LENGTH)>>14,s!==0){if(a===lt.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==Zr.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,i=(n[t]&ir.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,i,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:i}=this;return this.emitCodePoint(t===1?i[e]&~ir.VALUE_LENGTH:i[e+1],n),t===3&&this.emitCodePoint(i[e+2],n),n}end(){var e;switch(this.state){case ut.NamedEntity:return this.result!==0&&(this.decodeMode!==Zr.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case ut.NumericDecimal:return this.emitNumericEntity(0,2);case ut.NumericHex:return this.emitNumericEntity(0,3);case ut.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case ut.EntityStart:return 0}}};function SS(r){let e="",t=new fl(r,n=>e+=rs(n));return function(i,s){let a=0,o=0;for(;(o=i.indexOf("&",o))>=0;){e+=i.slice(a,o),t.startEntity(s);let l=t.write(i,o+1);if(l<0){a=o+t.end();break}a=o+l,o=l===0?a+1:a}let u=e+i.slice(a);return e="",u}}function Dp(r,e,t,n){let i=(e&ir.BRANCH_LENGTH)>>7,s=e&ir.JUMP_TABLE;if(i===0)return s!==0&&n===s?t:-1;if(s){let u=n-s;return u<0||u>=i?-1:r[t+u]-1}let a=t,o=a+i-1;for(;a<=o;){let u=a+o>>>1,l=r[u];if(l<n)a=u+1;else if(l>n)o=u-1;else return r[u+i]}return-1}var N$=SS(hl),M$=SS(dl);var te;(function(r){r[r.Tab=9]="Tab",r[r.NewLine=10]="NewLine",r[r.FormFeed=12]="FormFeed",r[r.CarriageReturn=13]="CarriageReturn",r[r.Space=32]="Space",r[r.ExclamationMark=33]="ExclamationMark",r[r.Number=35]="Number",r[r.Amp=38]="Amp",r[r.SingleQuote=39]="SingleQuote",r[r.DoubleQuote=34]="DoubleQuote",r[r.Dash=45]="Dash",r[r.Slash=47]="Slash",r[r.Zero=48]="Zero",r[r.Nine=57]="Nine",r[r.Semi=59]="Semi",r[r.Lt=60]="Lt",r[r.Eq=61]="Eq",r[r.Gt=62]="Gt",r[r.Questionmark=63]="Questionmark",r[r.UpperA=65]="UpperA",r[r.LowerA=97]="LowerA",r[r.UpperF=70]="UpperF",r[r.LowerF=102]="LowerF",r[r.UpperZ=90]="UpperZ",r[r.LowerZ=122]="LowerZ",r[r.LowerX=120]="LowerX",r[r.OpeningSquareBracket=91]="OpeningSquareBracket"})(te||(te={}));var z;(function(r){r[r.Text=1]="Text",r[r.BeforeTagName=2]="BeforeTagName",r[r.InTagName=3]="InTagName",r[r.InSelfClosingTag=4]="InSelfClosingTag",r[r.BeforeClosingTagName=5]="BeforeClosingTagName",r[r.InClosingTagName=6]="InClosingTagName",r[r.AfterClosingTagName=7]="AfterClosingTagName",r[r.BeforeAttributeName=8]="BeforeAttributeName",r[r.InAttributeName=9]="InAttributeName",r[r.AfterAttributeName=10]="AfterAttributeName",r[r.BeforeAttributeValue=11]="BeforeAttributeValue",r[r.InAttributeValueDq=12]="InAttributeValueDq",r[r.InAttributeValueSq=13]="InAttributeValueSq",r[r.InAttributeValueNq=14]="InAttributeValueNq",r[r.BeforeDeclaration=15]="BeforeDeclaration",r[r.InDeclaration=16]="InDeclaration",r[r.InProcessingInstruction=17]="InProcessingInstruction",r[r.BeforeComment=18]="BeforeComment",r[r.CDATASequence=19]="CDATASequence",r[r.InSpecialComment=20]="InSpecialComment",r[r.InCommentLike=21]="InCommentLike",r[r.BeforeSpecialS=22]="BeforeSpecialS",r[r.SpecialStartSequence=23]="SpecialStartSequence",r[r.InSpecialTag=24]="InSpecialTag",r[r.BeforeEntity=25]="BeforeEntity",r[r.BeforeNumericEntity=26]="BeforeNumericEntity",r[r.InNamedEntity=27]="InNamedEntity",r[r.InNumericEntity=28]="InNumericEntity",r[r.InHexEntity=29]="InHexEntity"})(z||(z={}));function Jr(r){return r===te.Space||r===te.NewLine||r===te.Tab||r===te.FormFeed||r===te.CarriageReturn}function pl(r){return r===te.Slash||r===te.Gt||Jr(r)}function ES(r){return r>=te.Zero&&r<=te.Nine}function ON(r){return r>=te.LowerA&&r<=te.LowerZ||r>=te.UpperA&&r<=te.UpperZ}function LN(r){return r>=te.UpperA&&r<=te.UpperF||r>=te.LowerA&&r<=te.LowerF}var wr;(function(r){r[r.NoValue=0]="NoValue",r[r.Unquoted=1]="Unquoted",r[r.Single=2]="Single",r[r.Double=3]="Double"})(wr||(wr={}));var Dt={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101])},ns=class{constructor({xmlMode:e=!1,decodeEntities:t=!0},n){this.cbs=n,this.state=z.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=z.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.trieIndex=0,this.trieCurrent=0,this.entityResult=0,this.entityExcess=0,this.xmlMode=e,this.decodeEntities=t,this.entityTrie=e?dl:hl}reset(){this.state=z.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=z.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(e){this.offset+=this.buffer.length,this.buffer=e,this.parse()}end(){this.running&&this.finish()}pause(){this.running=!1}resume(){this.running=!0,this.index<this.buffer.length+this.offset&&this.parse()}getIndex(){return this.index}getSectionStart(){return this.sectionStart}stateText(e){e===te.Lt||!this.decodeEntities&&this.fastForwardTo(te.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=z.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&e===te.Amp&&(this.state=z.BeforeEntity)}stateSpecialStartSequence(e){let t=this.sequenceIndex===this.currentSequence.length;if(!(t?pl(e):(e|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!t){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=z.InTagName,this.stateInTagName(e)}stateInSpecialTag(e){if(this.sequenceIndex===this.currentSequence.length){if(e===te.Gt||Jr(e)){let t=this.index-this.currentSequence.length;if(this.sectionStart<t){let n=this.index;this.index=t,this.cbs.ontext(this.sectionStart,t),this.index=n}this.isSpecial=!1,this.sectionStart=t+2,this.stateInClosingTagName(e);return}this.sequenceIndex=0}(e|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===Dt.TitleEnd?this.decodeEntities&&e===te.Amp&&(this.state=z.BeforeEntity):this.fastForwardTo(te.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=+(e===te.Lt)}stateCDATASequence(e){e===Dt.Cdata[this.sequenceIndex]?++this.sequenceIndex===Dt.Cdata.length&&(this.state=z.InCommentLike,this.currentSequence=Dt.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=z.InDeclaration,this.stateInDeclaration(e))}fastForwardTo(e){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===e)return!0;return this.index=this.buffer.length+this.offset-1,!1}stateInCommentLike(e){e===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===Dt.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index,2):this.cbs.oncomment(this.sectionStart,this.index,2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=z.Text):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):e!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(e){return this.xmlMode?!pl(e):ON(e)}startSpecial(e,t){this.isSpecial=!0,this.currentSequence=e,this.sequenceIndex=t,this.state=z.SpecialStartSequence}stateBeforeTagName(e){if(e===te.ExclamationMark)this.state=z.BeforeDeclaration,this.sectionStart=this.index+1;else if(e===te.Questionmark)this.state=z.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(e)){let t=e|32;this.sectionStart=this.index,!this.xmlMode&&t===Dt.TitleEnd[2]?this.startSpecial(Dt.TitleEnd,3):this.state=!this.xmlMode&&t===Dt.ScriptEnd[2]?z.BeforeSpecialS:z.InTagName}else e===te.Slash?this.state=z.BeforeClosingTagName:(this.state=z.Text,this.stateText(e))}stateInTagName(e){pl(e)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=z.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateBeforeClosingTagName(e){Jr(e)||(e===te.Gt?this.state=z.Text:(this.state=this.isTagStartChar(e)?z.InClosingTagName:z.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(e){(e===te.Gt||Jr(e))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=z.AfterClosingTagName,this.stateAfterClosingTagName(e))}stateAfterClosingTagName(e){(e===te.Gt||this.fastForwardTo(te.Gt))&&(this.state=z.Text,this.baseState=z.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(e){e===te.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=z.InSpecialTag,this.sequenceIndex=0):this.state=z.Text,this.baseState=this.state,this.sectionStart=this.index+1):e===te.Slash?this.state=z.InSelfClosingTag:Jr(e)||(this.state=z.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(e){e===te.Gt?(this.cbs.onselfclosingtag(this.index),this.state=z.Text,this.baseState=z.Text,this.sectionStart=this.index+1,this.isSpecial=!1):Jr(e)||(this.state=z.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateInAttributeName(e){(e===te.Eq||pl(e))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=-1,this.state=z.AfterAttributeName,this.stateAfterAttributeName(e))}stateAfterAttributeName(e){e===te.Eq?this.state=z.BeforeAttributeValue:e===te.Slash||e===te.Gt?(this.cbs.onattribend(wr.NoValue,this.index),this.state=z.BeforeAttributeName,this.stateBeforeAttributeName(e)):Jr(e)||(this.cbs.onattribend(wr.NoValue,this.index),this.state=z.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(e){e===te.DoubleQuote?(this.state=z.InAttributeValueDq,this.sectionStart=this.index+1):e===te.SingleQuote?(this.state=z.InAttributeValueSq,this.sectionStart=this.index+1):Jr(e)||(this.sectionStart=this.index,this.state=z.InAttributeValueNq,this.stateInAttributeValueNoQuotes(e))}handleInAttributeValue(e,t){e===t||!this.decodeEntities&&this.fastForwardTo(t)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(t===te.DoubleQuote?wr.Double:wr.Single,this.index),this.state=z.BeforeAttributeName):this.decodeEntities&&e===te.Amp&&(this.baseState=this.state,this.state=z.BeforeEntity)}stateInAttributeValueDoubleQuotes(e){this.handleInAttributeValue(e,te.DoubleQuote)}stateInAttributeValueSingleQuotes(e){this.handleInAttributeValue(e,te.SingleQuote)}stateInAttributeValueNoQuotes(e){Jr(e)||e===te.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(wr.Unquoted,this.index),this.state=z.BeforeAttributeName,this.stateBeforeAttributeName(e)):this.decodeEntities&&e===te.Amp&&(this.baseState=this.state,this.state=z.BeforeEntity)}stateBeforeDeclaration(e){e===te.OpeningSquareBracket?(this.state=z.CDATASequence,this.sequenceIndex=0):this.state=e===te.Dash?z.BeforeComment:z.InDeclaration}stateInDeclaration(e){(e===te.Gt||this.fastForwardTo(te.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=z.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(e){(e===te.Gt||this.fastForwardTo(te.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=z.Text,this.sectionStart=this.index+1)}stateBeforeComment(e){e===te.Dash?(this.state=z.InCommentLike,this.currentSequence=Dt.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=z.InDeclaration}stateInSpecialComment(e){(e===te.Gt||this.fastForwardTo(te.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=z.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(e){let t=e|32;t===Dt.ScriptEnd[3]?this.startSpecial(Dt.ScriptEnd,4):t===Dt.StyleEnd[3]?this.startSpecial(Dt.StyleEnd,4):(this.state=z.InTagName,this.stateInTagName(e))}stateBeforeEntity(e){this.entityExcess=1,this.entityResult=0,e===te.Number?this.state=z.BeforeNumericEntity:e===te.Amp||(this.trieIndex=0,this.trieCurrent=this.entityTrie[0],this.state=z.InNamedEntity,this.stateInNamedEntity(e))}stateInNamedEntity(e){if(this.entityExcess+=1,this.trieIndex=Dp(this.entityTrie,this.trieCurrent,this.trieIndex+1,e),this.trieIndex<0){this.emitNamedEntity(),this.index--;return}this.trieCurrent=this.entityTrie[this.trieIndex];let t=this.trieCurrent&ir.VALUE_LENGTH;if(t){let n=(t>>14)-1;if(!this.allowLegacyEntity()&&e!==te.Semi)this.trieIndex+=n;else{let i=this.index-this.entityExcess+1;i>this.sectionStart&&this.emitPartial(this.sectionStart,i),this.entityResult=this.trieIndex,this.trieIndex+=n,this.entityExcess=0,this.sectionStart=this.index+1,n===0&&this.emitNamedEntity()}}}emitNamedEntity(){if(this.state=this.baseState,this.entityResult===0)return;switch((this.entityTrie[this.entityResult]&ir.VALUE_LENGTH)>>14){case 1:{this.emitCodePoint(this.entityTrie[this.entityResult]&~ir.VALUE_LENGTH);break}case 2:{this.emitCodePoint(this.entityTrie[this.entityResult+1]);break}case 3:this.emitCodePoint(this.entityTrie[this.entityResult+1]),this.emitCodePoint(this.entityTrie[this.entityResult+2])}}stateBeforeNumericEntity(e){(e|32)===te.LowerX?(this.entityExcess++,this.state=z.InHexEntity):(this.state=z.InNumericEntity,this.stateInNumericEntity(e))}emitNumericEntity(e){let t=this.index-this.entityExcess-1;t+2+ +(this.state===z.InHexEntity)!==this.index&&(t>this.sectionStart&&this.emitPartial(this.sectionStart,t),this.sectionStart=this.index+Number(e),this.emitCodePoint(Oa(this.entityResult))),this.state=this.baseState}stateInNumericEntity(e){e===te.Semi?this.emitNumericEntity(!0):ES(e)?(this.entityResult=this.entityResult*10+(e-te.Zero),this.entityExcess++):(this.allowLegacyEntity()?this.emitNumericEntity(!1):this.state=this.baseState,this.index--)}stateInHexEntity(e){e===te.Semi?this.emitNumericEntity(!0):ES(e)?(this.entityResult=this.entityResult*16+(e-te.Zero),this.entityExcess++):LN(e)?(this.entityResult=this.entityResult*16+((e|32)-te.LowerA+10),this.entityExcess++):(this.allowLegacyEntity()?this.emitNumericEntity(!1):this.state=this.baseState,this.index--)}allowLegacyEntity(){return!this.xmlMode&&(this.baseState===z.Text||this.baseState===z.InSpecialTag)}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===z.Text||this.state===z.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===z.InAttributeValueDq||this.state===z.InAttributeValueSq||this.state===z.InAttributeValueNq)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}shouldContinue(){return this.index<this.buffer.length+this.offset&&this.running}parse(){for(;this.shouldContinue();){let e=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case z.Text:{this.stateText(e);break}case z.SpecialStartSequence:{this.stateSpecialStartSequence(e);break}case z.InSpecialTag:{this.stateInSpecialTag(e);break}case z.CDATASequence:{this.stateCDATASequence(e);break}case z.InAttributeValueDq:{this.stateInAttributeValueDoubleQuotes(e);break}case z.InAttributeName:{this.stateInAttributeName(e);break}case z.InCommentLike:{this.stateInCommentLike(e);break}case z.InSpecialComment:{this.stateInSpecialComment(e);break}case z.BeforeAttributeName:{this.stateBeforeAttributeName(e);break}case z.InTagName:{this.stateInTagName(e);break}case z.InClosingTagName:{this.stateInClosingTagName(e);break}case z.BeforeTagName:{this.stateBeforeTagName(e);break}case z.AfterAttributeName:{this.stateAfterAttributeName(e);break}case z.InAttributeValueSq:{this.stateInAttributeValueSingleQuotes(e);break}case z.BeforeAttributeValue:{this.stateBeforeAttributeValue(e);break}case z.BeforeClosingTagName:{this.stateBeforeClosingTagName(e);break}case z.AfterClosingTagName:{this.stateAfterClosingTagName(e);break}case z.BeforeSpecialS:{this.stateBeforeSpecialS(e);break}case z.InAttributeValueNq:{this.stateInAttributeValueNoQuotes(e);break}case z.InSelfClosingTag:{this.stateInSelfClosingTag(e);break}case z.InDeclaration:{this.stateInDeclaration(e);break}case z.BeforeDeclaration:{this.stateBeforeDeclaration(e);break}case z.BeforeComment:{this.stateBeforeComment(e);break}case z.InProcessingInstruction:{this.stateInProcessingInstruction(e);break}case z.InNamedEntity:{this.stateInNamedEntity(e);break}case z.BeforeEntity:{this.stateBeforeEntity(e);break}case z.InHexEntity:{this.stateInHexEntity(e);break}case z.InNumericEntity:{this.stateInNumericEntity(e);break}default:this.stateBeforeNumericEntity(e)}this.index++}this.cleanup()}finish(){this.state===z.InNamedEntity&&this.emitNamedEntity(),this.sectionStart<this.index&&this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){let e=this.buffer.length+this.offset;this.state===z.InCommentLike?this.currentSequence===Dt.CdataEnd?this.cbs.oncdata(this.sectionStart,e,0):this.cbs.oncomment(this.sectionStart,e,0):this.state===z.InNumericEntity&&this.allowLegacyEntity()?this.emitNumericEntity(!1):this.state===z.InHexEntity&&this.allowLegacyEntity()?this.emitNumericEntity(!1):this.state===z.InTagName||this.state===z.BeforeAttributeName||this.state===z.BeforeAttributeValue||this.state===z.AfterAttributeName||this.state===z.InAttributeName||this.state===z.InAttributeValueSq||this.state===z.InAttributeValueDq||this.state===z.InAttributeValueNq||this.state===z.InClosingTagName||this.cbs.ontext(this.sectionStart,e)}emitPartial(e,t){this.baseState!==z.Text&&this.baseState!==z.InSpecialTag?this.cbs.onattribdata(e,t):this.cbs.ontext(e,t)}emitCodePoint(e){this.baseState!==z.Text&&this.baseState!==z.InSpecialTag?this.cbs.onattribentity(e):this.cbs.ontextentity(e)}};var is=new Set(["input","option","optgroup","select","button","datalist","textarea"]),Re=new Set(["p"]),AS=new Set(["thead","tbody"]),TS=new Set(["dd","dt"]),_S=new Set(["rt","rp"]),NN=new Map([["tr",new Set(["tr","th","td"])],["th",new Set(["th"])],["td",new Set(["thead","th","td"])],["body",new Set(["head","link","script"])],["li",new Set(["li"])],["p",Re],["h1",Re],["h2",Re],["h3",Re],["h4",Re],["h5",Re],["h6",Re],["select",is],["input",is],["output",is],["button",is],["datalist",is],["textarea",is],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",TS],["dt",TS],["address",Re],["article",Re],["aside",Re],["blockquote",Re],["details",Re],["div",Re],["dl",Re],["fieldset",Re],["figcaption",Re],["figure",Re],["footer",Re],["form",Re],["header",Re],["hr",Re],["main",Re],["nav",Re],["ol",Re],["pre",Re],["section",Re],["table",Re],["ul",Re],["rt",_S],["rp",_S],["tbody",AS],["tfoot",AS]]),MN=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),CS=new Set(["math","svg"]),kS=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),BN=/\s|\//,La=class{constructor(e,t={}){var n,i,s,a,o;this.options=t,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack=[],this.foreignContext=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=e??{},this.lowerCaseTagNames=(n=t.lowerCaseTags)!==null&&n!==void 0?n:!t.xmlMode,this.lowerCaseAttributeNames=(i=t.lowerCaseAttributeNames)!==null&&i!==void 0?i:!t.xmlMode,this.tokenizer=new((s=t.Tokenizer)!==null&&s!==void 0?s:ns)(this.options,this),(o=(a=this.cbs).onparserinit)===null||o===void 0||o.call(a,this)}ontext(e,t){var n,i;let s=this.getSlice(e,t);this.endIndex=t-1,(i=(n=this.cbs).ontext)===null||i===void 0||i.call(n,s),this.startIndex=t}ontextentity(e){var t,n;let i=this.tokenizer.getSectionStart();this.endIndex=i-1,(n=(t=this.cbs).ontext)===null||n===void 0||n.call(t,rs(e)),this.startIndex=i}isVoidElement(e){return!this.options.xmlMode&&MN.has(e)}onopentagname(e,t){this.endIndex=t;let n=this.getSlice(e,t);this.lowerCaseTagNames&&(n=n.toLowerCase()),this.emitOpenTag(n)}emitOpenTag(e){var t,n,i,s;this.openTagStart=this.startIndex,this.tagname=e;let a=!this.options.xmlMode&&NN.get(e);if(a)for(;this.stack.length>0&&a.has(this.stack[this.stack.length-1]);){let o=this.stack.pop();(n=(t=this.cbs).onclosetag)===null||n===void 0||n.call(t,o,!0)}this.isVoidElement(e)||(this.stack.push(e),CS.has(e)?this.foreignContext.push(!0):kS.has(e)&&this.foreignContext.push(!1)),(s=(i=this.cbs).onopentagname)===null||s===void 0||s.call(i,e),this.cbs.onopentag&&(this.attribs={})}endOpenTag(e){var t,n;this.startIndex=this.openTagStart,this.attribs&&((n=(t=this.cbs).onopentag)===null||n===void 0||n.call(t,this.tagname,this.attribs,e),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""}onopentagend(e){this.endIndex=e,this.endOpenTag(!1),this.startIndex=e+1}onclosetag(e,t){var n,i,s,a,o,u;this.endIndex=t;let l=this.getSlice(e,t);if(this.lowerCaseTagNames&&(l=l.toLowerCase()),(CS.has(l)||kS.has(l))&&this.foreignContext.pop(),this.isVoidElement(l))!this.options.xmlMode&&l==="br"&&((i=(n=this.cbs).onopentagname)===null||i===void 0||i.call(n,"br"),(a=(s=this.cbs).onopentag)===null||a===void 0||a.call(s,"br",{},!0),(u=(o=this.cbs).onclosetag)===null||u===void 0||u.call(o,"br",!1));else{let c=this.stack.lastIndexOf(l);if(c!==-1)if(this.cbs.onclosetag){let h=this.stack.length-c;for(;h--;)this.cbs.onclosetag(this.stack.pop(),h!==0)}else this.stack.length=c;else!this.options.xmlMode&&l==="p"&&(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=t+1}onselfclosingtag(e){this.endIndex=e,this.options.xmlMode||this.options.recognizeSelfClosing||this.foreignContext[this.foreignContext.length-1]?(this.closeCurrentTag(!1),this.startIndex=e+1):this.onopentagend(e)}closeCurrentTag(e){var t,n;let i=this.tagname;this.endOpenTag(e),this.stack[this.stack.length-1]===i&&((n=(t=this.cbs).onclosetag)===null||n===void 0||n.call(t,i,!e),this.stack.pop())}onattribname(e,t){this.startIndex=e;let n=this.getSlice(e,t);this.attribname=this.lowerCaseAttributeNames?n.toLowerCase():n}onattribdata(e,t){this.attribvalue+=this.getSlice(e,t)}onattribentity(e){this.attribvalue+=rs(e)}onattribend(e,t){var n,i;this.endIndex=t,(i=(n=this.cbs).onattribute)===null||i===void 0||i.call(n,this.attribname,this.attribvalue,e===wr.Double?'"':e===wr.Single?"'":e===wr.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""}getInstructionName(e){let t=e.search(BN),n=t<0?e:e.substr(0,t);return this.lowerCaseTagNames&&(n=n.toLowerCase()),n}ondeclaration(e,t){this.endIndex=t;let n=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){let i=this.getInstructionName(n);this.cbs.onprocessinginstruction(`!${i}`,`!${n}`)}this.startIndex=t+1}onprocessinginstruction(e,t){this.endIndex=t;let n=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){let i=this.getInstructionName(n);this.cbs.onprocessinginstruction(`?${i}`,`?${n}`)}this.startIndex=t+1}oncomment(e,t,n){var i,s,a,o;this.endIndex=t,(s=(i=this.cbs).oncomment)===null||s===void 0||s.call(i,this.getSlice(e,t-n)),(o=(a=this.cbs).oncommentend)===null||o===void 0||o.call(a),this.startIndex=t+1}oncdata(e,t,n){var i,s,a,o,u,l,c,h,d,f;this.endIndex=t;let p=this.getSlice(e,t-n);this.options.xmlMode||this.options.recognizeCDATA?((s=(i=this.cbs).oncdatastart)===null||s===void 0||s.call(i),(o=(a=this.cbs).ontext)===null||o===void 0||o.call(a,p),(l=(u=this.cbs).oncdataend)===null||l===void 0||l.call(u)):((h=(c=this.cbs).oncomment)===null||h===void 0||h.call(c,`[CDATA[${p}]]`),(f=(d=this.cbs).oncommentend)===null||f===void 0||f.call(d)),this.startIndex=t+1}onend(){var e,t;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let n=this.stack.length;n>0;this.cbs.onclosetag(this.stack[--n],!0));}(t=(e=this.cbs).onend)===null||t===void 0||t.call(e)}reset(){var e,t,n,i;(t=(e=this.cbs).onreset)===null||t===void 0||t.call(e),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,(i=(n=this.cbs).onparserinit)===null||i===void 0||i.call(n,this),this.buffers.length=0,this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(e){this.reset(),this.end(e)}getSlice(e,t){for(;e-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let n=this.buffers[0].slice(e-this.bufferOffset,t-this.bufferOffset);for(;t-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),n+=this.buffers[0].slice(0,t-this.bufferOffset);return n}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(e){var t,n;if(this.ended){(n=(t=this.cbs).onerror)===null||n===void 0||n.call(t,new Error(".write() after done!"));return}this.buffers.push(e),this.tokenizer.running&&(this.tokenizer.write(e),this.writeIndex++)}end(e){var t,n;if(this.ended){(n=(t=this.cbs).onerror)===null||n===void 0||n.call(t,new Error(".end() after done!"));return}e&&this.write(e),this.ended=!0,this.tokenizer.end()}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex<this.buffers.length;)this.tokenizer.write(this.buffers[this.writeIndex++]);this.ended&&this.tokenizer.end()}parseChunk(e){this.write(e)}done(e){this.end(e)}};function gl(r){for(let e=1;e<r.length;e++)r[e][0]+=r[e-1][0]+1;return r}var DN=new Map(gl([[9,"&Tab;"],[0,"&NewLine;"],[22,"&excl;"],[0,"&quot;"],[0,"&num;"],[0,"&dollar;"],[0,"&percnt;"],[0,"&amp;"],[0,"&apos;"],[0,"&lpar;"],[0,"&rpar;"],[0,"&ast;"],[0,"&plus;"],[0,"&comma;"],[1,"&period;"],[0,"&sol;"],[10,"&colon;"],[0,"&semi;"],[0,{v:"&lt;",n:8402,o:"&nvlt;"}],[0,{v:"&equals;",n:8421,o:"&bne;"}],[0,{v:"&gt;",n:8402,o:"&nvgt;"}],[0,"&quest;"],[0,"&commat;"],[26,"&lbrack;"],[0,"&bsol;"],[0,"&rbrack;"],[0,"&Hat;"],[0,"&lowbar;"],[0,"&DiacriticalGrave;"],[5,{n:106,o:"&fjlig;"}],[20,"&lbrace;"],[0,"&verbar;"],[0,"&rbrace;"],[34,"&nbsp;"],[0,"&iexcl;"],[0,"&cent;"],[0,"&pound;"],[0,"&curren;"],[0,"&yen;"],[0,"&brvbar;"],[0,"&sect;"],[0,"&die;"],[0,"&copy;"],[0,"&ordf;"],[0,"&laquo;"],[0,"&not;"],[0,"&shy;"],[0,"&circledR;"],[0,"&macr;"],[0,"&deg;"],[0,"&PlusMinus;"],[0,"&sup2;"],[0,"&sup3;"],[0,"&acute;"],[0,"&micro;"],[0,"&para;"],[0,"&centerdot;"],[0,"&cedil;"],[0,"&sup1;"],[0,"&ordm;"],[0,"&raquo;"],[0,"&frac14;"],[0,"&frac12;"],[0,"&frac34;"],[0,"&iquest;"],[0,"&Agrave;"],[0,"&Aacute;"],[0,"&Acirc;"],[0,"&Atilde;"],[0,"&Auml;"],[0,"&angst;"],[0,"&AElig;"],[0,"&Ccedil;"],[0,"&Egrave;"],[0,"&Eacute;"],[0,"&Ecirc;"],[0,"&Euml;"],[0,"&Igrave;"],[0,"&Iacute;"],[0,"&Icirc;"],[0,"&Iuml;"],[0,"&ETH;"],[0,"&Ntilde;"],[0,"&Ograve;"],[0,"&Oacute;"],[0,"&Ocirc;"],[0,"&Otilde;"],[0,"&Ouml;"],[0,"&times;"],[0,"&Oslash;"],[0,"&Ugrave;"],[0,"&Uacute;"],[0,"&Ucirc;"],[0,"&Uuml;"],[0,"&Yacute;"],[0,"&THORN;"],[0,"&szlig;"],[0,"&agrave;"],[0,"&aacute;"],[0,"&acirc;"],[0,"&atilde;"],[0,"&auml;"],[0,"&aring;"],[0,"&aelig;"],[0,"&ccedil;"],[0,"&egrave;"],[0,"&eacute;"],[0,"&ecirc;"],[0,"&euml;"],[0,"&igrave;"],[0,"&iacute;"],[0,"&icirc;"],[0,"&iuml;"],[0,"&eth;"],[0,"&ntilde;"],[0,"&ograve;"],[0,"&oacute;"],[0,"&ocirc;"],[0,"&otilde;"],[0,"&ouml;"],[0,"&div;"],[0,"&oslash;"],[0,"&ugrave;"],[0,"&uacute;"],[0,"&ucirc;"],[0,"&uuml;"],[0,"&yacute;"],[0,"&thorn;"],[0,"&yuml;"],[0,"&Amacr;"],[0,"&amacr;"],[0,"&Abreve;"],[0,"&abreve;"],[0,"&Aogon;"],[0,"&aogon;"],[0,"&Cacute;"],[0,"&cacute;"],[0,"&Ccirc;"],[0,"&ccirc;"],[0,"&Cdot;"],[0,"&cdot;"],[0,"&Ccaron;"],[0,"&ccaron;"],[0,"&Dcaron;"],[0,"&dcaron;"],[0,"&Dstrok;"],[0,"&dstrok;"],[0,"&Emacr;"],[0,"&emacr;"],[2,"&Edot;"],[0,"&edot;"],[0,"&Eogon;"],[0,"&eogon;"],[0,"&Ecaron;"],[0,"&ecaron;"],[0,"&Gcirc;"],[0,"&gcirc;"],[0,"&Gbreve;"],[0,"&gbreve;"],[0,"&Gdot;"],[0,"&gdot;"],[0,"&Gcedil;"],[1,"&Hcirc;"],[0,"&hcirc;"],[0,"&Hstrok;"],[0,"&hstrok;"],[0,"&Itilde;"],[0,"&itilde;"],[0,"&Imacr;"],[0,"&imacr;"],[2,"&Iogon;"],[0,"&iogon;"],[0,"&Idot;"],[0,"&imath;"],[0,"&IJlig;"],[0,"&ijlig;"],[0,"&Jcirc;"],[0,"&jcirc;"],[0,"&Kcedil;"],[0,"&kcedil;"],[0,"&kgreen;"],[0,"&Lacute;"],[0,"&lacute;"],[0,"&Lcedil;"],[0,"&lcedil;"],[0,"&Lcaron;"],[0,"&lcaron;"],[0,"&Lmidot;"],[0,"&lmidot;"],[0,"&Lstrok;"],[0,"&lstrok;"],[0,"&Nacute;"],[0,"&nacute;"],[0,"&Ncedil;"],[0,"&ncedil;"],[0,"&Ncaron;"],[0,"&ncaron;"],[0,"&napos;"],[0,"&ENG;"],[0,"&eng;"],[0,"&Omacr;"],[0,"&omacr;"],[2,"&Odblac;"],[0,"&odblac;"],[0,"&OElig;"],[0,"&oelig;"],[0,"&Racute;"],[0,"&racute;"],[0,"&Rcedil;"],[0,"&rcedil;"],[0,"&Rcaron;"],[0,"&rcaron;"],[0,"&Sacute;"],[0,"&sacute;"],[0,"&Scirc;"],[0,"&scirc;"],[0,"&Scedil;"],[0,"&scedil;"],[0,"&Scaron;"],[0,"&scaron;"],[0,"&Tcedil;"],[0,"&tcedil;"],[0,"&Tcaron;"],[0,"&tcaron;"],[0,"&Tstrok;"],[0,"&tstrok;"],[0,"&Utilde;"],[0,"&utilde;"],[0,"&Umacr;"],[0,"&umacr;"],[0,"&Ubreve;"],[0,"&ubreve;"],[0,"&Uring;"],[0,"&uring;"],[0,"&Udblac;"],[0,"&udblac;"],[0,"&Uogon;"],[0,"&uogon;"],[0,"&Wcirc;"],[0,"&wcirc;"],[0,"&Ycirc;"],[0,"&ycirc;"],[0,"&Yuml;"],[0,"&Zacute;"],[0,"&zacute;"],[0,"&Zdot;"],[0,"&zdot;"],[0,"&Zcaron;"],[0,"&zcaron;"],[19,"&fnof;"],[34,"&imped;"],[63,"&gacute;"],[65,"&jmath;"],[142,"&circ;"],[0,"&caron;"],[16,"&breve;"],[0,"&DiacriticalDot;"],[0,"&ring;"],[0,"&ogon;"],[0,"&DiacriticalTilde;"],[0,"&dblac;"],[51,"&DownBreve;"],[127,"&Alpha;"],[0,"&Beta;"],[0,"&Gamma;"],[0,"&Delta;"],[0,"&Epsilon;"],[0,"&Zeta;"],[0,"&Eta;"],[0,"&Theta;"],[0,"&Iota;"],[0,"&Kappa;"],[0,"&Lambda;"],[0,"&Mu;"],[0,"&Nu;"],[0,"&Xi;"],[0,"&Omicron;"],[0,"&Pi;"],[0,"&Rho;"],[1,"&Sigma;"],[0,"&Tau;"],[0,"&Upsilon;"],[0,"&Phi;"],[0,"&Chi;"],[0,"&Psi;"],[0,"&ohm;"],[7,"&alpha;"],[0,"&beta;"],[0,"&gamma;"],[0,"&delta;"],[0,"&epsi;"],[0,"&zeta;"],[0,"&eta;"],[0,"&theta;"],[0,"&iota;"],[0,"&kappa;"],[0,"&lambda;"],[0,"&mu;"],[0,"&nu;"],[0,"&xi;"],[0,"&omicron;"],[0,"&pi;"],[0,"&rho;"],[0,"&sigmaf;"],[0,"&sigma;"],[0,"&tau;"],[0,"&upsi;"],[0,"&phi;"],[0,"&chi;"],[0,"&psi;"],[0,"&omega;"],[7,"&thetasym;"],[0,"&Upsi;"],[2,"&phiv;"],[0,"&piv;"],[5,"&Gammad;"],[0,"&digamma;"],[18,"&kappav;"],[0,"&rhov;"],[3,"&epsiv;"],[0,"&backepsilon;"],[10,"&IOcy;"],[0,"&DJcy;"],[0,"&GJcy;"],[0,"&Jukcy;"],[0,"&DScy;"],[0,"&Iukcy;"],[0,"&YIcy;"],[0,"&Jsercy;"],[0,"&LJcy;"],[0,"&NJcy;"],[0,"&TSHcy;"],[0,"&KJcy;"],[1,"&Ubrcy;"],[0,"&DZcy;"],[0,"&Acy;"],[0,"&Bcy;"],[0,"&Vcy;"],[0,"&Gcy;"],[0,"&Dcy;"],[0,"&IEcy;"],[0,"&ZHcy;"],[0,"&Zcy;"],[0,"&Icy;"],[0,"&Jcy;"],[0,"&Kcy;"],[0,"&Lcy;"],[0,"&Mcy;"],[0,"&Ncy;"],[0,"&Ocy;"],[0,"&Pcy;"],[0,"&Rcy;"],[0,"&Scy;"],[0,"&Tcy;"],[0,"&Ucy;"],[0,"&Fcy;"],[0,"&KHcy;"],[0,"&TScy;"],[0,"&CHcy;"],[0,"&SHcy;"],[0,"&SHCHcy;"],[0,"&HARDcy;"],[0,"&Ycy;"],[0,"&SOFTcy;"],[0,"&Ecy;"],[0,"&YUcy;"],[0,"&YAcy;"],[0,"&acy;"],[0,"&bcy;"],[0,"&vcy;"],[0,"&gcy;"],[0,"&dcy;"],[0,"&iecy;"],[0,"&zhcy;"],[0,"&zcy;"],[0,"&icy;"],[0,"&jcy;"],[0,"&kcy;"],[0,"&lcy;"],[0,"&mcy;"],[0,"&ncy;"],[0,"&ocy;"],[0,"&pcy;"],[0,"&rcy;"],[0,"&scy;"],[0,"&tcy;"],[0,"&ucy;"],[0,"&fcy;"],[0,"&khcy;"],[0,"&tscy;"],[0,"&chcy;"],[0,"&shcy;"],[0,"&shchcy;"],[0,"&hardcy;"],[0,"&ycy;"],[0,"&softcy;"],[0,"&ecy;"],[0,"&yucy;"],[0,"&yacy;"],[1,"&iocy;"],[0,"&djcy;"],[0,"&gjcy;"],[0,"&jukcy;"],[0,"&dscy;"],[0,"&iukcy;"],[0,"&yicy;"],[0,"&jsercy;"],[0,"&ljcy;"],[0,"&njcy;"],[0,"&tshcy;"],[0,"&kjcy;"],[1,"&ubrcy;"],[0,"&dzcy;"],[7074,"&ensp;"],[0,"&emsp;"],[0,"&emsp13;"],[0,"&emsp14;"],[1,"&numsp;"],[0,"&puncsp;"],[0,"&ThinSpace;"],[0,"&hairsp;"],[0,"&NegativeMediumSpace;"],[0,"&zwnj;"],[0,"&zwj;"],[0,"&lrm;"],[0,"&rlm;"],[0,"&dash;"],[2,"&ndash;"],[0,"&mdash;"],[0,"&horbar;"],[0,"&Verbar;"],[1,"&lsquo;"],[0,"&CloseCurlyQuote;"],[0,"&lsquor;"],[1,"&ldquo;"],[0,"&CloseCurlyDoubleQuote;"],[0,"&bdquo;"],[1,"&dagger;"],[0,"&Dagger;"],[0,"&bull;"],[2,"&nldr;"],[0,"&hellip;"],[9,"&permil;"],[0,"&pertenk;"],[0,"&prime;"],[0,"&Prime;"],[0,"&tprime;"],[0,"&backprime;"],[3,"&lsaquo;"],[0,"&rsaquo;"],[3,"&oline;"],[2,"&caret;"],[1,"&hybull;"],[0,"&frasl;"],[10,"&bsemi;"],[7,"&qprime;"],[7,{v:"&MediumSpace;",n:8202,o:"&ThickSpace;"}],[0,"&NoBreak;"],[0,"&af;"],[0,"&InvisibleTimes;"],[0,"&ic;"],[72,"&euro;"],[46,"&tdot;"],[0,"&DotDot;"],[37,"&complexes;"],[2,"&incare;"],[4,"&gscr;"],[0,"&hamilt;"],[0,"&Hfr;"],[0,"&Hopf;"],[0,"&planckh;"],[0,"&hbar;"],[0,"&imagline;"],[0,"&Ifr;"],[0,"&lagran;"],[0,"&ell;"],[1,"&naturals;"],[0,"&numero;"],[0,"&copysr;"],[0,"&weierp;"],[0,"&Popf;"],[0,"&Qopf;"],[0,"&realine;"],[0,"&real;"],[0,"&reals;"],[0,"&rx;"],[3,"&trade;"],[1,"&integers;"],[2,"&mho;"],[0,"&zeetrf;"],[0,"&iiota;"],[2,"&bernou;"],[0,"&Cayleys;"],[1,"&escr;"],[0,"&Escr;"],[0,"&Fouriertrf;"],[1,"&Mellintrf;"],[0,"&order;"],[0,"&alefsym;"],[0,"&beth;"],[0,"&gimel;"],[0,"&daleth;"],[12,"&CapitalDifferentialD;"],[0,"&dd;"],[0,"&ee;"],[0,"&ii;"],[10,"&frac13;"],[0,"&frac23;"],[0,"&frac15;"],[0,"&frac25;"],[0,"&frac35;"],[0,"&frac45;"],[0,"&frac16;"],[0,"&frac56;"],[0,"&frac18;"],[0,"&frac38;"],[0,"&frac58;"],[0,"&frac78;"],[49,"&larr;"],[0,"&ShortUpArrow;"],[0,"&rarr;"],[0,"&darr;"],[0,"&harr;"],[0,"&updownarrow;"],[0,"&nwarr;"],[0,"&nearr;"],[0,"&LowerRightArrow;"],[0,"&LowerLeftArrow;"],[0,"&nlarr;"],[0,"&nrarr;"],[1,{v:"&rarrw;",n:824,o:"&nrarrw;"}],[0,"&Larr;"],[0,"&Uarr;"],[0,"&Rarr;"],[0,"&Darr;"],[0,"&larrtl;"],[0,"&rarrtl;"],[0,"&LeftTeeArrow;"],[0,"&mapstoup;"],[0,"&map;"],[0,"&DownTeeArrow;"],[1,"&hookleftarrow;"],[0,"&hookrightarrow;"],[0,"&larrlp;"],[0,"&looparrowright;"],[0,"&harrw;"],[0,"&nharr;"],[1,"&lsh;"],[0,"&rsh;"],[0,"&ldsh;"],[0,"&rdsh;"],[1,"&crarr;"],[0,"&cularr;"],[0,"&curarr;"],[2,"&circlearrowleft;"],[0,"&circlearrowright;"],[0,"&leftharpoonup;"],[0,"&DownLeftVector;"],[0,"&RightUpVector;"],[0,"&LeftUpVector;"],[0,"&rharu;"],[0,"&DownRightVector;"],[0,"&dharr;"],[0,"&dharl;"],[0,"&RightArrowLeftArrow;"],[0,"&udarr;"],[0,"&LeftArrowRightArrow;"],[0,"&leftleftarrows;"],[0,"&upuparrows;"],[0,"&rightrightarrows;"],[0,"&ddarr;"],[0,"&leftrightharpoons;"],[0,"&Equilibrium;"],[0,"&nlArr;"],[0,"&nhArr;"],[0,"&nrArr;"],[0,"&DoubleLeftArrow;"],[0,"&DoubleUpArrow;"],[0,"&DoubleRightArrow;"],[0,"&dArr;"],[0,"&DoubleLeftRightArrow;"],[0,"&DoubleUpDownArrow;"],[0,"&nwArr;"],[0,"&neArr;"],[0,"&seArr;"],[0,"&swArr;"],[0,"&lAarr;"],[0,"&rAarr;"],[1,"&zigrarr;"],[6,"&larrb;"],[0,"&rarrb;"],[15,"&DownArrowUpArrow;"],[7,"&loarr;"],[0,"&roarr;"],[0,"&hoarr;"],[0,"&forall;"],[0,"&comp;"],[0,{v:"&part;",n:824,o:"&npart;"}],[0,"&exist;"],[0,"&nexist;"],[0,"&empty;"],[1,"&Del;"],[0,"&Element;"],[0,"&NotElement;"],[1,"&ni;"],[0,"&notni;"],[2,"&prod;"],[0,"&coprod;"],[0,"&sum;"],[0,"&minus;"],[0,"&MinusPlus;"],[0,"&dotplus;"],[1,"&Backslash;"],[0,"&lowast;"],[0,"&compfn;"],[1,"&radic;"],[2,"&prop;"],[0,"&infin;"],[0,"&angrt;"],[0,{v:"&ang;",n:8402,o:"&nang;"}],[0,"&angmsd;"],[0,"&angsph;"],[0,"&mid;"],[0,"&nmid;"],[0,"&DoubleVerticalBar;"],[0,"&NotDoubleVerticalBar;"],[0,"&and;"],[0,"&or;"],[0,{v:"&cap;",n:65024,o:"&caps;"}],[0,{v:"&cup;",n:65024,o:"&cups;"}],[0,"&int;"],[0,"&Int;"],[0,"&iiint;"],[0,"&conint;"],[0,"&Conint;"],[0,"&Cconint;"],[0,"&cwint;"],[0,"&ClockwiseContourIntegral;"],[0,"&awconint;"],[0,"&there4;"],[0,"&becaus;"],[0,"&ratio;"],[0,"&Colon;"],[0,"&dotminus;"],[1,"&mDDot;"],[0,"&homtht;"],[0,{v:"&sim;",n:8402,o:"&nvsim;"}],[0,{v:"&backsim;",n:817,o:"&race;"}],[0,{v:"&ac;",n:819,o:"&acE;"}],[0,"&acd;"],[0,"&VerticalTilde;"],[0,"&NotTilde;"],[0,{v:"&eqsim;",n:824,o:"&nesim;"}],[0,"&sime;"],[0,"&NotTildeEqual;"],[0,"&cong;"],[0,"&simne;"],[0,"&ncong;"],[0,"&ap;"],[0,"&nap;"],[0,"&ape;"],[0,{v:"&apid;",n:824,o:"&napid;"}],[0,"&backcong;"],[0,{v:"&asympeq;",n:8402,o:"&nvap;"}],[0,{v:"&bump;",n:824,o:"&nbump;"}],[0,{v:"&bumpe;",n:824,o:"&nbumpe;"}],[0,{v:"&doteq;",n:824,o:"&nedot;"}],[0,"&doteqdot;"],[0,"&efDot;"],[0,"&erDot;"],[0,"&Assign;"],[0,"&ecolon;"],[0,"&ecir;"],[0,"&circeq;"],[1,"&wedgeq;"],[0,"&veeeq;"],[1,"&triangleq;"],[2,"&equest;"],[0,"&ne;"],[0,{v:"&Congruent;",n:8421,o:"&bnequiv;"}],[0,"&nequiv;"],[1,{v:"&le;",n:8402,o:"&nvle;"}],[0,{v:"&ge;",n:8402,o:"&nvge;"}],[0,{v:"&lE;",n:824,o:"&nlE;"}],[0,{v:"&gE;",n:824,o:"&ngE;"}],[0,{v:"&lnE;",n:65024,o:"&lvertneqq;"}],[0,{v:"&gnE;",n:65024,o:"&gvertneqq;"}],[0,{v:"&ll;",n:new Map(gl([[824,"&nLtv;"],[7577,"&nLt;"]]))}],[0,{v:"&gg;",n:new Map(gl([[824,"&nGtv;"],[7577,"&nGt;"]]))}],[0,"&between;"],[0,"&NotCupCap;"],[0,"&nless;"],[0,"&ngt;"],[0,"&nle;"],[0,"&nge;"],[0,"&lesssim;"],[0,"&GreaterTilde;"],[0,"&nlsim;"],[0,"&ngsim;"],[0,"&LessGreater;"],[0,"&gl;"],[0,"&NotLessGreater;"],[0,"&NotGreaterLess;"],[0,"&pr;"],[0,"&sc;"],[0,"&prcue;"],[0,"&sccue;"],[0,"&PrecedesTilde;"],[0,{v:"&scsim;",n:824,o:"&NotSucceedsTilde;"}],[0,"&NotPrecedes;"],[0,"&NotSucceeds;"],[0,{v:"&sub;",n:8402,o:"&NotSubset;"}],[0,{v:"&sup;",n:8402,o:"&NotSuperset;"}],[0,"&nsub;"],[0,"&nsup;"],[0,"&sube;"],[0,"&supe;"],[0,"&NotSubsetEqual;"],[0,"&NotSupersetEqual;"],[0,{v:"&subne;",n:65024,o:"&varsubsetneq;"}],[0,{v:"&supne;",n:65024,o:"&varsupsetneq;"}],[1,"&cupdot;"],[0,"&UnionPlus;"],[0,{v:"&sqsub;",n:824,o:"&NotSquareSubset;"}],[0,{v:"&sqsup;",n:824,o:"&NotSquareSuperset;"}],[0,"&sqsube;"],[0,"&sqsupe;"],[0,{v:"&sqcap;",n:65024,o:"&sqcaps;"}],[0,{v:"&sqcup;",n:65024,o:"&sqcups;"}],[0,"&CirclePlus;"],[0,"&CircleMinus;"],[0,"&CircleTimes;"],[0,"&osol;"],[0,"&CircleDot;"],[0,"&circledcirc;"],[0,"&circledast;"],[1,"&circleddash;"],[0,"&boxplus;"],[0,"&boxminus;"],[0,"&boxtimes;"],[0,"&dotsquare;"],[0,"&RightTee;"],[0,"&dashv;"],[0,"&DownTee;"],[0,"&bot;"],[1,"&models;"],[0,"&DoubleRightTee;"],[0,"&Vdash;"],[0,"&Vvdash;"],[0,"&VDash;"],[0,"&nvdash;"],[0,"&nvDash;"],[0,"&nVdash;"],[0,"&nVDash;"],[0,"&prurel;"],[1,"&LeftTriangle;"],[0,"&RightTriangle;"],[0,{v:"&LeftTriangleEqual;",n:8402,o:"&nvltrie;"}],[0,{v:"&RightTriangleEqual;",n:8402,o:"&nvrtrie;"}],[0,"&origof;"],[0,"&imof;"],[0,"&multimap;"],[0,"&hercon;"],[0,"&intcal;"],[0,"&veebar;"],[1,"&barvee;"],[0,"&angrtvb;"],[0,"&lrtri;"],[0,"&bigwedge;"],[0,"&bigvee;"],[0,"&bigcap;"],[0,"&bigcup;"],[0,"&diam;"],[0,"&sdot;"],[0,"&sstarf;"],[0,"&divideontimes;"],[0,"&bowtie;"],[0,"&ltimes;"],[0,"&rtimes;"],[0,"&leftthreetimes;"],[0,"&rightthreetimes;"],[0,"&backsimeq;"],[0,"&curlyvee;"],[0,"&curlywedge;"],[0,"&Sub;"],[0,"&Sup;"],[0,"&Cap;"],[0,"&Cup;"],[0,"&fork;"],[0,"&epar;"],[0,"&lessdot;"],[0,"&gtdot;"],[0,{v:"&Ll;",n:824,o:"&nLl;"}],[0,{v:"&Gg;",n:824,o:"&nGg;"}],[0,{v:"&leg;",n:65024,o:"&lesg;"}],[0,{v:"&gel;",n:65024,o:"&gesl;"}],[2,"&cuepr;"],[0,"&cuesc;"],[0,"&NotPrecedesSlantEqual;"],[0,"&NotSucceedsSlantEqual;"],[0,"&NotSquareSubsetEqual;"],[0,"&NotSquareSupersetEqual;"],[2,"&lnsim;"],[0,"&gnsim;"],[0,"&precnsim;"],[0,"&scnsim;"],[0,"&nltri;"],[0,"&NotRightTriangle;"],[0,"&nltrie;"],[0,"&NotRightTriangleEqual;"],[0,"&vellip;"],[0,"&ctdot;"],[0,"&utdot;"],[0,"&dtdot;"],[0,"&disin;"],[0,"&isinsv;"],[0,"&isins;"],[0,{v:"&isindot;",n:824,o:"&notindot;"}],[0,"&notinvc;"],[0,"&notinvb;"],[1,{v:"&isinE;",n:824,o:"&notinE;"}],[0,"&nisd;"],[0,"&xnis;"],[0,"&nis;"],[0,"&notnivc;"],[0,"&notnivb;"],[6,"&barwed;"],[0,"&Barwed;"],[1,"&lceil;"],[0,"&rceil;"],[0,"&LeftFloor;"],[0,"&rfloor;"],[0,"&drcrop;"],[0,"&dlcrop;"],[0,"&urcrop;"],[0,"&ulcrop;"],[0,"&bnot;"],[1,"&profline;"],[0,"&profsurf;"],[1,"&telrec;"],[0,"&target;"],[5,"&ulcorn;"],[0,"&urcorn;"],[0,"&dlcorn;"],[0,"&drcorn;"],[2,"&frown;"],[0,"&smile;"],[9,"&cylcty;"],[0,"&profalar;"],[7,"&topbot;"],[6,"&ovbar;"],[1,"&solbar;"],[60,"&angzarr;"],[51,"&lmoustache;"],[0,"&rmoustache;"],[2,"&OverBracket;"],[0,"&bbrk;"],[0,"&bbrktbrk;"],[37,"&OverParenthesis;"],[0,"&UnderParenthesis;"],[0,"&OverBrace;"],[0,"&UnderBrace;"],[2,"&trpezium;"],[4,"&elinters;"],[59,"&blank;"],[164,"&circledS;"],[55,"&boxh;"],[1,"&boxv;"],[9,"&boxdr;"],[3,"&boxdl;"],[3,"&boxur;"],[3,"&boxul;"],[3,"&boxvr;"],[7,"&boxvl;"],[7,"&boxhd;"],[7,"&boxhu;"],[7,"&boxvh;"],[19,"&boxH;"],[0,"&boxV;"],[0,"&boxdR;"],[0,"&boxDr;"],[0,"&boxDR;"],[0,"&boxdL;"],[0,"&boxDl;"],[0,"&boxDL;"],[0,"&boxuR;"],[0,"&boxUr;"],[0,"&boxUR;"],[0,"&boxuL;"],[0,"&boxUl;"],[0,"&boxUL;"],[0,"&boxvR;"],[0,"&boxVr;"],[0,"&boxVR;"],[0,"&boxvL;"],[0,"&boxVl;"],[0,"&boxVL;"],[0,"&boxHd;"],[0,"&boxhD;"],[0,"&boxHD;"],[0,"&boxHu;"],[0,"&boxhU;"],[0,"&boxHU;"],[0,"&boxvH;"],[0,"&boxVh;"],[0,"&boxVH;"],[19,"&uhblk;"],[3,"&lhblk;"],[3,"&block;"],[8,"&blk14;"],[0,"&blk12;"],[0,"&blk34;"],[13,"&square;"],[8,"&blacksquare;"],[0,"&EmptyVerySmallSquare;"],[1,"&rect;"],[0,"&marker;"],[2,"&fltns;"],[1,"&bigtriangleup;"],[0,"&blacktriangle;"],[0,"&triangle;"],[2,"&blacktriangleright;"],[0,"&rtri;"],[3,"&bigtriangledown;"],[0,"&blacktriangledown;"],[0,"&dtri;"],[2,"&blacktriangleleft;"],[0,"&ltri;"],[6,"&loz;"],[0,"&cir;"],[32,"&tridot;"],[2,"&bigcirc;"],[8,"&ultri;"],[0,"&urtri;"],[0,"&lltri;"],[0,"&EmptySmallSquare;"],[0,"&FilledSmallSquare;"],[8,"&bigstar;"],[0,"&star;"],[7,"&phone;"],[49,"&female;"],[1,"&male;"],[29,"&spades;"],[2,"&clubs;"],[1,"&hearts;"],[0,"&diamondsuit;"],[3,"&sung;"],[2,"&flat;"],[0,"&natural;"],[0,"&sharp;"],[163,"&check;"],[3,"&cross;"],[8,"&malt;"],[21,"&sext;"],[33,"&VerticalSeparator;"],[25,"&lbbrk;"],[0,"&rbbrk;"],[84,"&bsolhsub;"],[0,"&suphsol;"],[28,"&LeftDoubleBracket;"],[0,"&RightDoubleBracket;"],[0,"&lang;"],[0,"&rang;"],[0,"&Lang;"],[0,"&Rang;"],[0,"&loang;"],[0,"&roang;"],[7,"&longleftarrow;"],[0,"&longrightarrow;"],[0,"&longleftrightarrow;"],[0,"&DoubleLongLeftArrow;"],[0,"&DoubleLongRightArrow;"],[0,"&DoubleLongLeftRightArrow;"],[1,"&longmapsto;"],[2,"&dzigrarr;"],[258,"&nvlArr;"],[0,"&nvrArr;"],[0,"&nvHarr;"],[0,"&Map;"],[6,"&lbarr;"],[0,"&bkarow;"],[0,"&lBarr;"],[0,"&dbkarow;"],[0,"&drbkarow;"],[0,"&DDotrahd;"],[0,"&UpArrowBar;"],[0,"&DownArrowBar;"],[2,"&Rarrtl;"],[2,"&latail;"],[0,"&ratail;"],[0,"&lAtail;"],[0,"&rAtail;"],[0,"&larrfs;"],[0,"&rarrfs;"],[0,"&larrbfs;"],[0,"&rarrbfs;"],[2,"&nwarhk;"],[0,"&nearhk;"],[0,"&hksearow;"],[0,"&hkswarow;"],[0,"&nwnear;"],[0,"&nesear;"],[0,"&seswar;"],[0,"&swnwar;"],[8,{v:"&rarrc;",n:824,o:"&nrarrc;"}],[1,"&cudarrr;"],[0,"&ldca;"],[0,"&rdca;"],[0,"&cudarrl;"],[0,"&larrpl;"],[2,"&curarrm;"],[0,"&cularrp;"],[7,"&rarrpl;"],[2,"&harrcir;"],[0,"&Uarrocir;"],[0,"&lurdshar;"],[0,"&ldrushar;"],[2,"&LeftRightVector;"],[0,"&RightUpDownVector;"],[0,"&DownLeftRightVector;"],[0,"&LeftUpDownVector;"],[0,"&LeftVectorBar;"],[0,"&RightVectorBar;"],[0,"&RightUpVectorBar;"],[0,"&RightDownVectorBar;"],[0,"&DownLeftVectorBar;"],[0,"&DownRightVectorBar;"],[0,"&LeftUpVectorBar;"],[0,"&LeftDownVectorBar;"],[0,"&LeftTeeVector;"],[0,"&RightTeeVector;"],[0,"&RightUpTeeVector;"],[0,"&RightDownTeeVector;"],[0,"&DownLeftTeeVector;"],[0,"&DownRightTeeVector;"],[0,"&LeftUpTeeVector;"],[0,"&LeftDownTeeVector;"],[0,"&lHar;"],[0,"&uHar;"],[0,"&rHar;"],[0,"&dHar;"],[0,"&luruhar;"],[0,"&ldrdhar;"],[0,"&ruluhar;"],[0,"&rdldhar;"],[0,"&lharul;"],[0,"&llhard;"],[0,"&rharul;"],[0,"&lrhard;"],[0,"&udhar;"],[0,"&duhar;"],[0,"&RoundImplies;"],[0,"&erarr;"],[0,"&simrarr;"],[0,"&larrsim;"],[0,"&rarrsim;"],[0,"&rarrap;"],[0,"&ltlarr;"],[1,"&gtrarr;"],[0,"&subrarr;"],[1,"&suplarr;"],[0,"&lfisht;"],[0,"&rfisht;"],[0,"&ufisht;"],[0,"&dfisht;"],[5,"&lopar;"],[0,"&ropar;"],[4,"&lbrke;"],[0,"&rbrke;"],[0,"&lbrkslu;"],[0,"&rbrksld;"],[0,"&lbrksld;"],[0,"&rbrkslu;"],[0,"&langd;"],[0,"&rangd;"],[0,"&lparlt;"],[0,"&rpargt;"],[0,"&gtlPar;"],[0,"&ltrPar;"],[3,"&vzigzag;"],[1,"&vangrt;"],[0,"&angrtvbd;"],[6,"&ange;"],[0,"&range;"],[0,"&dwangle;"],[0,"&uwangle;"],[0,"&angmsdaa;"],[0,"&angmsdab;"],[0,"&angmsdac;"],[0,"&angmsdad;"],[0,"&angmsdae;"],[0,"&angmsdaf;"],[0,"&angmsdag;"],[0,"&angmsdah;"],[0,"&bemptyv;"],[0,"&demptyv;"],[0,"&cemptyv;"],[0,"&raemptyv;"],[0,"&laemptyv;"],[0,"&ohbar;"],[0,"&omid;"],[0,"&opar;"],[1,"&operp;"],[1,"&olcross;"],[0,"&odsold;"],[1,"&olcir;"],[0,"&ofcir;"],[0,"&olt;"],[0,"&ogt;"],[0,"&cirscir;"],[0,"&cirE;"],[0,"&solb;"],[0,"&bsolb;"],[3,"&boxbox;"],[3,"&trisb;"],[0,"&rtriltri;"],[0,{v:"&LeftTriangleBar;",n:824,o:"&NotLeftTriangleBar;"}],[0,{v:"&RightTriangleBar;",n:824,o:"&NotRightTriangleBar;"}],[11,"&iinfin;"],[0,"&infintie;"],[0,"&nvinfin;"],[4,"&eparsl;"],[0,"&smeparsl;"],[0,"&eqvparsl;"],[5,"&blacklozenge;"],[8,"&RuleDelayed;"],[1,"&dsol;"],[9,"&bigodot;"],[0,"&bigoplus;"],[0,"&bigotimes;"],[1,"&biguplus;"],[1,"&bigsqcup;"],[5,"&iiiint;"],[0,"&fpartint;"],[2,"&cirfnint;"],[0,"&awint;"],[0,"&rppolint;"],[0,"&scpolint;"],[0,"&npolint;"],[0,"&pointint;"],[0,"&quatint;"],[0,"&intlarhk;"],[10,"&pluscir;"],[0,"&plusacir;"],[0,"&simplus;"],[0,"&plusdu;"],[0,"&plussim;"],[0,"&plustwo;"],[1,"&mcomma;"],[0,"&minusdu;"],[2,"&loplus;"],[0,"&roplus;"],[0,"&Cross;"],[0,"&timesd;"],[0,"&timesbar;"],[1,"&smashp;"],[0,"&lotimes;"],[0,"&rotimes;"],[0,"&otimesas;"],[0,"&Otimes;"],[0,"&odiv;"],[0,"&triplus;"],[0,"&triminus;"],[0,"&tritime;"],[0,"&intprod;"],[2,"&amalg;"],[0,"&capdot;"],[1,"&ncup;"],[0,"&ncap;"],[0,"&capand;"],[0,"&cupor;"],[0,"&cupcap;"],[0,"&capcup;"],[0,"&cupbrcap;"],[0,"&capbrcup;"],[0,"&cupcup;"],[0,"&capcap;"],[0,"&ccups;"],[0,"&ccaps;"],[2,"&ccupssm;"],[2,"&And;"],[0,"&Or;"],[0,"&andand;"],[0,"&oror;"],[0,"&orslope;"],[0,"&andslope;"],[1,"&andv;"],[0,"&orv;"],[0,"&andd;"],[0,"&ord;"],[1,"&wedbar;"],[6,"&sdote;"],[3,"&simdot;"],[2,{v:"&congdot;",n:824,o:"&ncongdot;"}],[0,"&easter;"],[0,"&apacir;"],[0,{v:"&apE;",n:824,o:"&napE;"}],[0,"&eplus;"],[0,"&pluse;"],[0,"&Esim;"],[0,"&Colone;"],[0,"&Equal;"],[1,"&ddotseq;"],[0,"&equivDD;"],[0,"&ltcir;"],[0,"&gtcir;"],[0,"&ltquest;"],[0,"&gtquest;"],[0,{v:"&leqslant;",n:824,o:"&nleqslant;"}],[0,{v:"&geqslant;",n:824,o:"&ngeqslant;"}],[0,"&lesdot;"],[0,"&gesdot;"],[0,"&lesdoto;"],[0,"&gesdoto;"],[0,"&lesdotor;"],[0,"&gesdotol;"],[0,"&lap;"],[0,"&gap;"],[0,"&lne;"],[0,"&gne;"],[0,"&lnap;"],[0,"&gnap;"],[0,"&lEg;"],[0,"&gEl;"],[0,"&lsime;"],[0,"&gsime;"],[0,"&lsimg;"],[0,"&gsiml;"],[0,"&lgE;"],[0,"&glE;"],[0,"&lesges;"],[0,"&gesles;"],[0,"&els;"],[0,"&egs;"],[0,"&elsdot;"],[0,"&egsdot;"],[0,"&el;"],[0,"&eg;"],[2,"&siml;"],[0,"&simg;"],[0,"&simlE;"],[0,"&simgE;"],[0,{v:"&LessLess;",n:824,o:"&NotNestedLessLess;"}],[0,{v:"&GreaterGreater;",n:824,o:"&NotNestedGreaterGreater;"}],[1,"&glj;"],[0,"&gla;"],[0,"&ltcc;"],[0,"&gtcc;"],[0,"&lescc;"],[0,"&gescc;"],[0,"&smt;"],[0,"&lat;"],[0,{v:"&smte;",n:65024,o:"&smtes;"}],[0,{v:"&late;",n:65024,o:"&lates;"}],[0,"&bumpE;"],[0,{v:"&PrecedesEqual;",n:824,o:"&NotPrecedesEqual;"}],[0,{v:"&sce;",n:824,o:"&NotSucceedsEqual;"}],[2,"&prE;"],[0,"&scE;"],[0,"&precneqq;"],[0,"&scnE;"],[0,"&prap;"],[0,"&scap;"],[0,"&precnapprox;"],[0,"&scnap;"],[0,"&Pr;"],[0,"&Sc;"],[0,"&subdot;"],[0,"&supdot;"],[0,"&subplus;"],[0,"&supplus;"],[0,"&submult;"],[0,"&supmult;"],[0,"&subedot;"],[0,"&supedot;"],[0,{v:"&subE;",n:824,o:"&nsubE;"}],[0,{v:"&supE;",n:824,o:"&nsupE;"}],[0,"&subsim;"],[0,"&supsim;"],[2,{v:"&subnE;",n:65024,o:"&varsubsetneqq;"}],[0,{v:"&supnE;",n:65024,o:"&varsupsetneqq;"}],[2,"&csub;"],[0,"&csup;"],[0,"&csube;"],[0,"&csupe;"],[0,"&subsup;"],[0,"&supsub;"],[0,"&subsub;"],[0,"&supsup;"],[0,"&suphsub;"],[0,"&supdsub;"],[0,"&forkv;"],[0,"&topfork;"],[0,"&mlcp;"],[8,"&Dashv;"],[1,"&Vdashl;"],[0,"&Barv;"],[0,"&vBar;"],[0,"&vBarv;"],[1,"&Vbar;"],[0,"&Not;"],[0,"&bNot;"],[0,"&rnmid;"],[0,"&cirmid;"],[0,"&midcir;"],[0,"&topcir;"],[0,"&nhpar;"],[0,"&parsim;"],[9,{v:"&parsl;",n:8421,o:"&nparsl;"}],[44343,{n:new Map(gl([[56476,"&Ascr;"],[1,"&Cscr;"],[0,"&Dscr;"],[2,"&Gscr;"],[2,"&Jscr;"],[0,"&Kscr;"],[2,"&Nscr;"],[0,"&Oscr;"],[0,"&Pscr;"],[0,"&Qscr;"],[1,"&Sscr;"],[0,"&Tscr;"],[0,"&Uscr;"],[0,"&Vscr;"],[0,"&Wscr;"],[0,"&Xscr;"],[0,"&Yscr;"],[0,"&Zscr;"],[0,"&ascr;"],[0,"&bscr;"],[0,"&cscr;"],[0,"&dscr;"],[1,"&fscr;"],[1,"&hscr;"],[0,"&iscr;"],[0,"&jscr;"],[0,"&kscr;"],[0,"&lscr;"],[0,"&mscr;"],[0,"&nscr;"],[1,"&pscr;"],[0,"&qscr;"],[0,"&rscr;"],[0,"&sscr;"],[0,"&tscr;"],[0,"&uscr;"],[0,"&vscr;"],[0,"&wscr;"],[0,"&xscr;"],[0,"&yscr;"],[0,"&zscr;"],[52,"&Afr;"],[0,"&Bfr;"],[1,"&Dfr;"],[0,"&Efr;"],[0,"&Ffr;"],[0,"&Gfr;"],[2,"&Jfr;"],[0,"&Kfr;"],[0,"&Lfr;"],[0,"&Mfr;"],[0,"&Nfr;"],[0,"&Ofr;"],[0,"&Pfr;"],[0,"&Qfr;"],[1,"&Sfr;"],[0,"&Tfr;"],[0,"&Ufr;"],[0,"&Vfr;"],[0,"&Wfr;"],[0,"&Xfr;"],[0,"&Yfr;"],[1,"&afr;"],[0,"&bfr;"],[0,"&cfr;"],[0,"&dfr;"],[0,"&efr;"],[0,"&ffr;"],[0,"&gfr;"],[0,"&hfr;"],[0,"&ifr;"],[0,"&jfr;"],[0,"&kfr;"],[0,"&lfr;"],[0,"&mfr;"],[0,"&nfr;"],[0,"&ofr;"],[0,"&pfr;"],[0,"&qfr;"],[0,"&rfr;"],[0,"&sfr;"],[0,"&tfr;"],[0,"&ufr;"],[0,"&vfr;"],[0,"&wfr;"],[0,"&xfr;"],[0,"&yfr;"],[0,"&zfr;"],[0,"&Aopf;"],[0,"&Bopf;"],[1,"&Dopf;"],[0,"&Eopf;"],[0,"&Fopf;"],[0,"&Gopf;"],[1,"&Iopf;"],[0,"&Jopf;"],[0,"&Kopf;"],[0,"&Lopf;"],[0,"&Mopf;"],[1,"&Oopf;"],[3,"&Sopf;"],[0,"&Topf;"],[0,"&Uopf;"],[0,"&Vopf;"],[0,"&Wopf;"],[0,"&Xopf;"],[0,"&Yopf;"],[1,"&aopf;"],[0,"&bopf;"],[0,"&copf;"],[0,"&dopf;"],[0,"&eopf;"],[0,"&fopf;"],[0,"&gopf;"],[0,"&hopf;"],[0,"&iopf;"],[0,"&jopf;"],[0,"&kopf;"],[0,"&lopf;"],[0,"&mopf;"],[0,"&nopf;"],[0,"&oopf;"],[0,"&popf;"],[0,"&qopf;"],[0,"&ropf;"],[0,"&sopf;"],[0,"&topf;"],[0,"&uopf;"],[0,"&vopf;"],[0,"&wopf;"],[0,"&xopf;"],[0,"&yopf;"],[0,"&zopf;"]]))}],[8906,"&fflig;"],[0,"&filig;"],[0,"&fllig;"],[0,"&ffilig;"],[0,"&ffllig;"]]));var Fp=/["&'<>$\x80-\uFFFF]/g,IS=new Map([[34,"&quot;"],[38,"&amp;"],[39,"&apos;"],[60,"&lt;"],[62,"&gt;"]]),RS=String.prototype.codePointAt!=null?(r,e)=>r.codePointAt(e):(r,e)=>(r.charCodeAt(e)&64512)===55296?(r.charCodeAt(e)-55296)*1024+r.charCodeAt(e+1)-56320+65536:r.charCodeAt(e);function Na(r){let e="",t=0,n;for(;(n=Fp.exec(r))!==null;){let i=n.index,s=r.charCodeAt(i),a=IS.get(s);a!==void 0?(e+=r.substring(t,i)+a,t=i+1):(e+=`${r.substring(t,i)}&#x${RS(r,i).toString(16)};`,t=Fp.lastIndex+=+((s&64512)===55296))}return e+r.substr(t)}function $p(r,e){return function(n){let i,s=0,a="";for(;i=r.exec(n);)s!==i.index&&(a+=n.substring(s,i.index)),a+=e.get(i[0].charCodeAt(0)),s=i.index+1;return a+n.substring(s)}}var PS=$p(/[&<>'"]/g,IS),ml=$p(/["&\u00A0]/g,new Map([[34,"&quot;"],[38,"&amp;"],[160,"&nbsp;"]])),bl=$p(/[&<>\u00A0]/g,new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[160,"&nbsp;"]]));var OS;(function(r){r[r.XML=0]="XML",r[r.HTML=1]="HTML"})(OS||(OS={}));var LS;(function(r){r[r.UTF8=0]="UTF8",r[r.ASCII=1]="ASCII",r[r.Extensive=2]="Extensive",r[r.Attribute=3]="Attribute",r[r.Text=4]="Text"})(LS||(LS={}));var BS=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(r=>[r.toLowerCase(),r])),DS=new Map(["definitionURL","attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(r=>[r.toLowerCase(),r]));var $N=new Set(["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"]);function UN(r){return r.replace(/"/g,"&quot;")}function zN(r,e){var t;if(!r)return;let n=((t=e.encodeEntities)!==null&&t!==void 0?t:e.decodeEntities)===!1?UN:e.xmlMode||e.encodeEntities!=="utf8"?Na:ml;return Object.keys(r).map(i=>{var s,a;let o=(s=r[i])!==null&&s!==void 0?s:"";return e.xmlMode==="foreign"&&(i=(a=DS.get(i))!==null&&a!==void 0?a:i),!e.emptyAttrs&&!e.xmlMode&&o===""?i:`${i}="${n(o)}"`}).join(" ")}var FS=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]);function Ma(r,e={}){let t="length"in r?r:[r],n="";for(let i=0;i<t.length;i++)n+=jN(t[i],e);return n}function jN(r,e){switch(r.type){case z2:return Ma(r.children,e);case X2:case H2:return GN(r);case W2:return XN(r);case K2:return KN(r);case V2:case G2:case q2:return VN(r,e);case j2:return qN(r,e)}}var HN=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignObject","desc","title"]),WN=new Set(["svg","math"]);function VN(r,e){var t;e.xmlMode==="foreign"&&(r.name=(t=BS.get(r.name))!==null&&t!==void 0?t:r.name,r.parent&&HN.has(r.parent.name)&&(e={...e,xmlMode:!1})),!e.xmlMode&&WN.has(r.name)&&(e={...e,xmlMode:"foreign"});let n=`<${r.name}`,i=zN(r.attribs,e);return i&&(n+=` ${i}`),r.children.length===0&&(e.xmlMode?e.selfClosingTags!==!1:e.selfClosingTags&&FS.has(r.name))?(e.xmlMode||(n+=" "),n+="/>"):(n+=">",r.children.length>0&&(n+=Ma(r.children,e)),(e.xmlMode||!FS.has(r.name))&&(n+=`</${r.name}>`)),n}function GN(r){return`<${r.data}>`}function qN(r,e){var t;let n=r.data||"";return((t=e.encodeEntities)!==null&&t!==void 0?t:e.decodeEntities)!==!1&&!(!e.xmlMode&&r.parent&&$N.has(r.parent.name))&&(n=e.xmlMode||e.encodeEntities!=="utf8"?Na(n):bl(n)),n}function KN(r){return`<![CDATA[${r.children[0].data}]]>`}function XN(r){return`<!--${r.data}-->`}var $S;(function(r){r[r.DISCONNECTED=1]="DISCONNECTED",r[r.PRECEDING=2]="PRECEDING",r[r.FOLLOWING=4]="FOLLOWING",r[r.CONTAINS=8]="CONTAINS",r[r.CONTAINED_BY=16]="CONTAINED_BY"})($S||($S={}));function US(r,e){let t=new Yi(void 0,e);return new La(t,e).end(r),t.root}var Kp=Sh(WS(),1);function Xp(r,e,t=()=>{}){if(r===void 0){let n=function(...i){return e(n,...i)};return n}return r>=0?function(...n){return e(Xp(r-1,e,t),...n)}:t}function XS(r,e){let t=0,n=r.length;for(;t<n&&r[t]===e;)++t;for(;n>t&&r[n-1]===e;)--n;return t>0||n<r.length?r.substring(t,n):r}function hM(r,e){let t=r.length;for(;t>0&&r[t-1]===e;)--t;return t<r.length?r.substring(0,t):r}function dM(r){return r.replace(/[\s\S]/g,e=>"\\u"+e.charCodeAt().toString(16).padStart(4,"0"))}function YS(r,e){let t=new Map;for(let n=r.length;n-- >0;){let i=r[n],s=e(i);t.set(s,t.has(s)?(0,Kp.default)(i,t.get(s),{arrayMerge:fM}):i)}return[...t.values()].reverse()}var fM=(r,e,t)=>[...e];function as(r,e){for(let t of e){if(!r)return;r=r[t]}return r}function VS(r,e="a",t=26){let n=[];do r-=1,n.push(r%t),r=r/t>>0;while(r>0);let i=e.charCodeAt(0);return n.reverse().map(s=>String.fromCharCode(i+s)).join("")}var jp=["I","X","C","M"],GS=["V","L","D"];function qS(r){return[...r+""].map(e=>+e).reverse().map((e,t)=>e%5<4?(e<5?"":GS[t])+jp[t].repeat(e%5):jp[t]+(e<5?GS[t]:jp[t+1])).reverse().join("")}var wl=class{constructor(e,t=void 0){this.lines=[],this.nextLineWords=[],this.maxLineLength=t||e.wordwrap||Number.MAX_VALUE,this.nextLineAvailableChars=this.maxLineLength,this.wrapCharacters=as(e,["longWordSplit","wrapCharacters"])||[],this.forceWrapOnLimit=as(e,["longWordSplit","forceWrapOnLimit"])||!1,this.stashedSpace=!1,this.wordBreakOpportunity=!1}pushWord(e,t=!1){this.nextLineAvailableChars<=0&&!t&&this.startNewLine();let n=this.nextLineWords.length===0,i=e.length+(n?0:1);if(i<=this.nextLineAvailableChars||t)this.nextLineWords.push(e),this.nextLineAvailableChars-=i;else{let[s,...a]=this.splitLongWord(e);n||this.startNewLine(),this.nextLineWords.push(s),this.nextLineAvailableChars-=s.length;for(let o of a)this.startNewLine(),this.nextLineWords.push(o),this.nextLineAvailableChars-=o.length}}popWord(){let e=this.nextLineWords.pop();if(e!==void 0){let t=this.nextLineWords.length===0,n=e.length+(t?0:1);this.nextLineAvailableChars+=n}return e}concatWord(e,t=!1){if(this.wordBreakOpportunity&&e.length>this.nextLineAvailableChars)this.pushWord(e,t),this.wordBreakOpportunity=!1;else{let n=this.popWord();this.pushWord(n?n.concat(e):e,t)}}startNewLine(e=1){this.lines.push(this.nextLineWords),e>1&&this.lines.push(...Array.from({length:e-1},()=>[])),this.nextLineWords=[],this.nextLineAvailableChars=this.maxLineLength}isEmpty(){return this.lines.length===0&&this.nextLineWords.length===0}clear(){this.lines.length=0,this.nextLineWords.length=0,this.nextLineAvailableChars=this.maxLineLength}toString(){return[...this.lines,this.nextLineWords].map(e=>e.join(" ")).join(`
117
+ `)}splitLongWord(e){let t=[],n=0;for(;e.length>this.maxLineLength;){let i=e.substring(0,this.maxLineLength),s=e.substring(this.maxLineLength),a=i.lastIndexOf(this.wrapCharacters[n]);if(a>-1)e=i.substring(a+1)+s,t.push(i.substring(0,a+1));else if(n++,n<this.wrapCharacters.length)e=i+s;else{if(this.forceWrapOnLimit){if(t.push(i),e=s,e.length>this.maxLineLength)continue}else e=i+s;break}}return t.push(e),t}},Zn=class{constructor(e=null){this.next=e}getRoot(){return this.next?this.next:this}},sr=class extends Zn{constructor(e,t=null,n=1,i=void 0){super(t),this.leadingLineBreaks=n,this.inlineTextBuilder=new wl(e,i),this.rawText="",this.stashedLineBreaks=0,this.isPre=t&&t.isPre,this.isNoWrap=t&&t.isNoWrap}},xl=class extends sr{constructor(e,t=null,{interRowLineBreaks:n=1,leadingLineBreaks:i=2,maxLineLength:s=void 0,maxPrefixLength:a=0,prefixAlign:o="left"}={}){super(e,t,i,s),this.maxPrefixLength=a,this.prefixAlign=o,this.interRowLineBreaks=n}},en=class extends sr{constructor(e,t=null,{leadingLineBreaks:n=1,maxLineLength:i=void 0,prefix:s=""}={}){super(e,t,n,i),this.prefix=s}},Sl=class extends Zn{constructor(e=null){super(e),this.rows=[],this.isPre=e&&e.isPre,this.isNoWrap=e&&e.isNoWrap}},El=class extends Zn{constructor(e=null){super(e),this.cells=[],this.isPre=e&&e.isPre,this.isNoWrap=e&&e.isNoWrap}},tn=class extends Zn{constructor(e,t=null,n=void 0){super(t),this.inlineTextBuilder=new wl(e,n),this.rawText="",this.stashedLineBreaks=0,this.isPre=t&&t.isPre,this.isNoWrap=t&&t.isNoWrap}},Hp=class extends Zn{constructor(e=null,t){super(e),this.transform=t}};function pM(r){return[...r].map(e=>"\\u"+e.charCodeAt(0).toString(16).padStart(4,"0")).join("")}var Wp=class{constructor(e){this.whitespaceChars=e.preserveNewlines?e.whitespaceCharacters.replace(/\n/g,""):e.whitespaceCharacters;let t=pM(this.whitespaceChars);if(this.leadingWhitespaceRe=new RegExp(`^[${t}]`),this.trailingWhitespaceRe=new RegExp(`[${t}]$`),this.allWhitespaceOrEmptyRe=new RegExp(`^[${t}]*$`),this.newlineOrNonWhitespaceRe=new RegExp(`(\\n|[^\\n${t}])`,"g"),this.newlineOrNonNewlineStringRe=new RegExp("(\\n|[^\\n]+)","g"),e.preserveNewlines){let n=new RegExp(`\\n|[^\\n${t}]+`,"gm");this.shrinkWrapAdd=function(i,s,a=(u=>u),o=!1){if(!i)return;let u=s.stashedSpace,l=!1,c=n.exec(i);if(c)for(l=!0,c[0]===`
118
+ `?s.startNewLine():u||this.testLeadingWhitespace(i)?s.pushWord(a(c[0]),o):s.concatWord(a(c[0]),o);(c=n.exec(i))!==null;)c[0]===`
119
+ `?s.startNewLine():s.pushWord(a(c[0]),o);s.stashedSpace=u&&!l||this.testTrailingWhitespace(i)}}else{let n=new RegExp(`[^${t}]+`,"g");this.shrinkWrapAdd=function(i,s,a=(u=>u),o=!1){if(!i)return;let u=s.stashedSpace,l=!1,c=n.exec(i);if(c)for(l=!0,u||this.testLeadingWhitespace(i)?s.pushWord(a(c[0]),o):s.concatWord(a(c[0]),o);(c=n.exec(i))!==null;)s.pushWord(a(c[0]),o);s.stashedSpace=u&&!l||this.testTrailingWhitespace(i)}}}addLiteral(e,t,n=!0){if(!e)return;let i=t.stashedSpace,s=!1,a=this.newlineOrNonNewlineStringRe.exec(e);if(a)for(s=!0,a[0]===`
120
+ `?t.startNewLine():i?t.pushWord(a[0],n):t.concatWord(a[0],n);(a=this.newlineOrNonNewlineStringRe.exec(e))!==null;)a[0]===`
121
+ `?t.startNewLine():t.pushWord(a[0],n);t.stashedSpace=i&&!s}testLeadingWhitespace(e){return this.leadingWhitespaceRe.test(e)}testTrailingWhitespace(e){return this.trailingWhitespaceRe.test(e)}testContainsWords(e){return!this.allWhitespaceOrEmptyRe.test(e)}countNewlinesNoWords(e){this.newlineOrNonWhitespaceRe.lastIndex=0;let t=0,n;for(;(n=this.newlineOrNonWhitespaceRe.exec(e))!==null;)if(n[0]===`
122
+ `)t++;else return 0;return t}},Vp=class{constructor(e,t,n=void 0){this.options=e,this.picker=t,this.metadata=n,this.whitespaceProcessor=new Wp(e),this._stackItem=new sr(e),this._wordTransformer=void 0}pushWordTransform(e){this._wordTransformer=new Hp(this._wordTransformer,e)}popWordTransform(){if(!this._wordTransformer)return;let e=this._wordTransformer.transform;return this._wordTransformer=this._wordTransformer.next,e}startNoWrap(){this._stackItem.isNoWrap=!0}stopNoWrap(){this._stackItem.isNoWrap=!1}_getCombinedWordTransformer(){let e=this._wordTransformer?(n=>QS(n,this._wordTransformer)):void 0,t=this.options.encodeCharacters;return e?t?n=>t(e(n)):e:t}_popStackItem(){let e=this._stackItem;return this._stackItem=e.next,e}addLineBreak(){(this._stackItem instanceof sr||this._stackItem instanceof en||this._stackItem instanceof tn)&&(this._stackItem.isPre?this._stackItem.rawText+=`
123
+ `:this._stackItem.inlineTextBuilder.startNewLine())}addWordBreakOpportunity(){(this._stackItem instanceof sr||this._stackItem instanceof en||this._stackItem instanceof tn)&&(this._stackItem.inlineTextBuilder.wordBreakOpportunity=!0)}addInline(e,{noWordTransform:t=!1}={}){if(this._stackItem instanceof sr||this._stackItem instanceof en||this._stackItem instanceof tn){if(this._stackItem.isPre){this._stackItem.rawText+=e;return}if(!(e.length===0||this._stackItem.stashedLineBreaks&&!this.whitespaceProcessor.testContainsWords(e))){if(this.options.preserveNewlines){let n=this.whitespaceProcessor.countNewlinesNoWords(e);if(n>0){this._stackItem.inlineTextBuilder.startNewLine(n);return}}this._stackItem.stashedLineBreaks&&this._stackItem.inlineTextBuilder.startNewLine(this._stackItem.stashedLineBreaks),this.whitespaceProcessor.shrinkWrapAdd(e,this._stackItem.inlineTextBuilder,t?void 0:this._getCombinedWordTransformer(),this._stackItem.isNoWrap),this._stackItem.stashedLineBreaks=0}}}addLiteral(e){if((this._stackItem instanceof sr||this._stackItem instanceof en||this._stackItem instanceof tn)&&e.length!==0){if(this._stackItem.isPre){this._stackItem.rawText+=e;return}this._stackItem.stashedLineBreaks&&this._stackItem.inlineTextBuilder.startNewLine(this._stackItem.stashedLineBreaks),this.whitespaceProcessor.addLiteral(e,this._stackItem.inlineTextBuilder,this._stackItem.isNoWrap),this._stackItem.stashedLineBreaks=0}}openBlock({leadingLineBreaks:e=1,reservedLineLength:t=0,isPre:n=!1}={}){let i=Math.max(20,this._stackItem.inlineTextBuilder.maxLineLength-t);this._stackItem=new sr(this.options,this._stackItem,e,i),n&&(this._stackItem.isPre=!0)}closeBlock({trailingLineBreaks:e=1,blockTransform:t=void 0}={}){let n=this._popStackItem(),i=t?t(Qn(n)):Qn(n);vl(this._stackItem,i,n.leadingLineBreaks,Math.max(n.stashedLineBreaks,e))}openList({maxPrefixLength:e=0,prefixAlign:t="left",interRowLineBreaks:n=1,leadingLineBreaks:i=2}={}){this._stackItem=new xl(this.options,this._stackItem,{interRowLineBreaks:n,leadingLineBreaks:i,maxLineLength:this._stackItem.inlineTextBuilder.maxLineLength,maxPrefixLength:e,prefixAlign:t})}openListItem({prefix:e=""}={}){if(!(this._stackItem instanceof xl))throw new Error("Can't add a list item to something that is not a list! Check the formatter.");let t=this._stackItem,n=Math.max(e.length,t.maxPrefixLength),i=Math.max(20,t.inlineTextBuilder.maxLineLength-n);this._stackItem=new en(this.options,t,{prefix:e,maxLineLength:i,leadingLineBreaks:t.interRowLineBreaks})}closeListItem(){let e=this._popStackItem(),t=e.next,n=Math.max(e.prefix.length,t.maxPrefixLength),i=`
124
+ `+" ".repeat(n),a=(t.prefixAlign==="right"?e.prefix.padStart(n):e.prefix.padEnd(n))+Qn(e).replace(/\n/g,i);vl(t,a,e.leadingLineBreaks,Math.max(e.stashedLineBreaks,t.interRowLineBreaks))}closeList({trailingLineBreaks:e=2}={}){let t=this._popStackItem(),n=Qn(t);n&&vl(this._stackItem,n,t.leadingLineBreaks,e)}openTable(){this._stackItem=new Sl(this._stackItem)}openTableRow(){if(!(this._stackItem instanceof Sl))throw new Error("Can't add a table row to something that is not a table! Check the formatter.");this._stackItem=new El(this._stackItem)}openTableCell({maxColumnWidth:e=void 0}={}){if(!(this._stackItem instanceof El))throw new Error("Can't add a table cell to something that is not a table row! Check the formatter.");this._stackItem=new tn(this.options,this._stackItem,e)}closeTableCell({colspan:e=1,rowspan:t=1}={}){let n=this._popStackItem(),i=XS(Qn(n),`
125
+ `);n.next.cells.push({colspan:e,rowspan:t,text:i})}closeTableRow(){let e=this._popStackItem();e.next.rows.push(e.cells)}closeTable({tableToString:e,leadingLineBreaks:t=2,trailingLineBreaks:n=2}){let i=this._popStackItem(),s=e(i.rows);s&&vl(this._stackItem,s,t,n)}toString(){return Qn(this._stackItem.getRoot())}};function Qn(r){if(!(r instanceof sr||r instanceof en||r instanceof tn))throw new Error("Only blocks, list items and table cells can be requested for text contents.");return r.inlineTextBuilder.isEmpty()?r.rawText:r.rawText+r.inlineTextBuilder.toString()}function vl(r,e,t,n){if(!(r instanceof sr||r instanceof en||r instanceof tn))throw new Error("Only blocks, list items and table cells can contain text.");let i=Qn(r),s=Math.max(r.stashedLineBreaks,t);r.inlineTextBuilder.clear(),i?r.rawText=i+`
126
+ `.repeat(s)+e:(r.rawText=e,r.leadingLineBreaks=s),r.stashedLineBreaks=n}function QS(r,e){return e?QS(e.transform(r),e.next):r}function gM(r={}){let e=r.selectors.filter(a=>!a.format);if(e.length)throw new Error("Following selectors have no specified format: "+e.map(a=>`\`${a.selector}\``).join(", "));let t=new Pa(r.selectors.map(a=>[a.selector,a])).build(Np);typeof r.encodeCharacters!="function"&&(r.encodeCharacters=vM(r.encodeCharacters));let n=new Pa(r.baseElements.selectors.map((a,o)=>[a,o+1])).build(Np);function i(a){return bM(a,r,n)}let s=Xp(r.limits.maxDepth,yM,function(a,o){o.addInline(r.limits.ellipsis||"")});return function(a,o=void 0){return mM(a,o,r,t,i,s)}}function mM(r,e,t,n,i,s){let a=t.limits.maxInputLength;a&&r&&r.length>a&&(console.warn(`Input length ${r.length} is above allowed limit of ${a}. Truncating without ellipsis.`),r=r.substring(0,a));let o=US(r,{decodeEntities:t.decodeEntities}),u=i(o.children),l=new Vp(t,n,e);return s(u,l),l.toString()}function bM(r,e,t){let n=[];function i(a,o){o=o.slice(0,e.limits.maxChildNodes);for(let u of o){if(u.type!=="tag")continue;let l=t.pick1(u);if(l>0?n.push({selectorIndex:l,element:u}):u.children&&a(u.children),n.length>=e.limits.maxBaseElements)return}}return Xp(e.limits.maxDepth,i)(r),e.baseElements.orderBy!=="occurrence"&&n.sort((a,o)=>a.selectorIndex-o.selectorIndex),e.baseElements.returnDomByDefault&&n.length===0?r:n.map(a=>a.element)}function yM(r,e,t){if(!e)return;let n=t.options;e.length>n.limits.maxChildNodes&&(e=e.slice(0,n.limits.maxChildNodes),e.push({data:n.limits.ellipsis,type:"text"}));for(let s of e)switch(s.type){case"text":{t.addInline(s.data);break}case"tag":{let a=t.picker.pick1(s),o=n.formatters[a.format];o(s,r,t,a.options||{});break}}}function vM(r){if(!r||Object.keys(r).length===0)return;let e=Object.entries(r).filter(([,s])=>s!==!1),t=new RegExp(e.map(([s])=>`(${dM([...s][0])})`).join("|"),"g"),n=e.map(([,s])=>s),i=(s,...a)=>n[a.findIndex(o=>o)];return s=>s.replace(t,i)}function wM(r,e,t,n){}function xM(r,e,t,n){t.addLiteral(n.string||"")}function SM(r,e,t,n){t.openBlock({leadingLineBreaks:n.leadingLineBreaks||2}),t.addLiteral(n.string||""),t.closeBlock({trailingLineBreaks:n.trailingLineBreaks||2})}function EM(r,e,t,n){e(r.children,t)}function AM(r,e,t,n){t.openBlock({leadingLineBreaks:n.leadingLineBreaks||2}),e(r.children,t),t.closeBlock({trailingLineBreaks:n.trailingLineBreaks||2})}function ZS(r){let e=r.attribs&&r.attribs.length?" "+Object.entries(r.attribs).map(([t,n])=>n===""?t:`${t}=${n.replace(/"/g,"&quot;")}`).join(" "):"";return`<${r.name}${e}>`}function JS(r){return`</${r.name}>`}function TM(r,e,t,n){t.startNoWrap(),t.addLiteral(ZS(r)),t.stopNoWrap(),e(r.children,t),t.startNoWrap(),t.addLiteral(JS(r)),t.stopNoWrap()}function _M(r,e,t,n){t.openBlock({leadingLineBreaks:n.leadingLineBreaks||2}),t.startNoWrap(),t.addLiteral(ZS(r)),t.stopNoWrap(),e(r.children,t),t.startNoWrap(),t.addLiteral(JS(r)),t.stopNoWrap(),t.closeBlock({trailingLineBreaks:n.trailingLineBreaks||2})}function CM(r,e,t,n){t.startNoWrap(),t.addLiteral(Ma(r,{decodeEntities:t.options.decodeEntities})),t.stopNoWrap()}function kM(r,e,t,n){t.openBlock({leadingLineBreaks:n.leadingLineBreaks||2}),t.startNoWrap(),t.addLiteral(Ma(r,{decodeEntities:t.options.decodeEntities})),t.stopNoWrap(),t.closeBlock({trailingLineBreaks:n.trailingLineBreaks||2})}function IM(r,e,t,n){t.addLiteral(n.prefix||""),e(r.children,t),t.addLiteral(n.suffix||"")}var RM=Object.freeze({__proto__:null,block:AM,blockHtml:kM,blockString:SM,blockTag:_M,inline:EM,inlineHtml:CM,inlineString:xM,inlineSurround:IM,inlineTag:TM,skip:wM});function Al(r,e){return r[e]||(r[e]=[]),r[e]}function PM(r,e=0){for(;r[e];)e++;return e}function OM(r,e){for(let t=0;t<e;t++){let n=Al(r,t);for(let i=0;i<t;i++){let s=Al(r,i);if(n[i]||s[t]){let a=n[i];n[i]=s[t],s[t]=a}}}}function LM(r,e,t,n){for(let i=0;i<r.rowspan;i++){let s=Al(e,t+i);for(let a=0;a<r.colspan;a++)s[n+a]=r}}function Gp(r,e){return r[e]===void 0&&(r[e]=e===0?0:1+Gp(r,e-1)),r[e]}function KS(r,e,t,n){r[e+t]=Math.max(Gp(r,e+t),Gp(r,e)+n)}function NM(r,e,t){let n=[],i=0,s=r.length,a=[0];for(let l=0;l<s;l++){let c=Al(n,l),h=r[l],d=0;for(let f=0;f<h.length;f++){let p=h[f];d=PM(c,d),LM(p,n,l,d),d+=p.colspan,p.lines=p.text.split(`
127
+ `);let g=p.lines.length;KS(a,l,p.rowspan,g+e)}i=c.length>i?c.length:i}OM(n,s>i?s:i);let o=[],u=[0];for(let l=0;l<i;l++){let c=0,h,d=Math.min(s,n[l].length);for(;c<d;)if(h=n[l][c],h){if(!h.rendered){let f=0;for(let p=0;p<h.lines.length;p++){let g=h.lines[p],b=a[c]+p;o[b]=(o[b]||"").padEnd(u[l])+g,f=g.length>f?g.length:f}KS(u,l,h.colspan,f+t),h.rendered=!0}c+=h.rowspan}else{let f=a[c];o[f]=o[f]||"",c++}}return o.join(`
128
+ `)}function MM(r,e,t,n){t.addLineBreak()}function BM(r,e,t,n){t.addWordBreakOpportunity()}function DM(r,e,t,n){t.openBlock({leadingLineBreaks:n.leadingLineBreaks||2}),t.addInline("-".repeat(n.length||t.options.wordwrap||40)),t.closeBlock({trailingLineBreaks:n.trailingLineBreaks||2})}function FM(r,e,t,n){t.openBlock({leadingLineBreaks:n.leadingLineBreaks||2}),e(r.children,t),t.closeBlock({trailingLineBreaks:n.trailingLineBreaks||2})}function $M(r,e,t,n){t.openBlock({isPre:!0,leadingLineBreaks:n.leadingLineBreaks||2}),e(r.children,t),t.closeBlock({trailingLineBreaks:n.trailingLineBreaks||2})}function UM(r,e,t,n){t.openBlock({leadingLineBreaks:n.leadingLineBreaks||2}),n.uppercase!==!1?(t.pushWordTransform(i=>i.toUpperCase()),e(r.children,t),t.popWordTransform()):e(r.children,t),t.closeBlock({trailingLineBreaks:n.trailingLineBreaks||2})}function zM(r,e,t,n){t.openBlock({leadingLineBreaks:n.leadingLineBreaks||2,reservedLineLength:2}),e(r.children,t),t.closeBlock({trailingLineBreaks:n.trailingLineBreaks||2,blockTransform:i=>(n.trimEmptyLines!==!1?XS(i,`
129
+ `):i).split(`
130
+ `).map(s=>"> "+s).join(`
131
+ `)})}function qp(r,e){if(!e)return r;let t=typeof e[0]=="string"?e[0]:"[",n=typeof e[1]=="string"?e[1]:"]";return t+r+n}function eE(r,e,t,n,i){let s=typeof e=="function"?e(r,n,i):r;return s[0]==="/"&&t?hM(t,"/")+s:s}function jM(r,e,t,n){let i=r.attribs||{},s=i.alt?i.alt:"",a=i.src?eE(i.src,n.pathRewrite,n.baseUrl,t.metadata,r):"",o=a?s?s+" "+qp(a,n.linkBrackets):qp(a,n.linkBrackets):s;t.addInline(o,{noWordTransform:!0})}function HM(r,e,t,n){function i(){if(n.ignoreHref||!r.attribs||!r.attribs.href)return"";let a=r.attribs.href.replace(/^mailto:/,"");return n.noAnchorUrl&&a[0]==="#"?"":(a=eE(a,n.pathRewrite,n.baseUrl,t.metadata,r),a)}let s=i();if(!s)e(r.children,t);else{let a="";t.pushWordTransform(u=>(u&&(a+=u),u)),e(r.children,t),t.popWordTransform(),n.hideLinkHrefIfSameAsText&&s===a||t.addInline(a?" "+qp(s,n.linkBrackets):s,{noWordTransform:!0})}}function tE(r,e,t,n,i){let s=as(r,["parent","name"])==="li",a=0,o=(r.children||[]).filter(u=>u.type!=="text"||!/^\s*$/.test(u.data)).map(function(u){if(u.name!=="li")return{node:u,prefix:""};let l=s?i().trimStart():i();return l.length>a&&(a=l.length),{node:u,prefix:l}});if(o.length){t.openList({interRowLineBreaks:1,leadingLineBreaks:s?1:n.leadingLineBreaks||2,maxPrefixLength:a,prefixAlign:"left"});for(let{node:u,prefix:l}of o)t.openListItem({prefix:l}),e([u],t),t.closeListItem();t.closeList({trailingLineBreaks:s?1:n.trailingLineBreaks||2})}}function WM(r,e,t,n){let i=n.itemPrefix||" * ";return tE(r,e,t,n,()=>i)}function VM(r,e,t,n){let i=Number(r.attribs.start||"1"),s=GM(r.attribs.type);return tE(r,e,t,n,()=>" "+s(i++)+". ")}function GM(r="1"){switch(r){case"a":return e=>VS(e,"a");case"A":return e=>VS(e,"A");case"i":return e=>qS(e).toLowerCase();case"I":return e=>qS(e);default:return e=>e.toString()}}function qM(r){let e=[],t=[];for(let n of r)n.startsWith(".")?e.push(n.substring(1)):n.startsWith("#")&&t.push(n.substring(1));return{classes:e,ids:t}}function KM(r,e){if(e===!0)return!0;if(!r)return!1;let{classes:t,ids:n}=qM(e),i=(r.class||"").split(" "),s=(r.id||"").split(" ");return i.some(a=>t.includes(a))||s.some(a=>n.includes(a))}function XM(r,e,t,n){return KM(r.attribs,t.options.tables)?rE(r,e,t,n):YM(r,e,t,n)}function YM(r,e,t,n){t.openBlock({leadingLineBreaks:n.leadingLineBreaks}),e(r.children,t),t.closeBlock({trailingLineBreaks:n.trailingLineBreaks})}function rE(r,e,t,n){t.openTable(),r.children.forEach(s),t.closeTable({tableToString:a=>NM(a,n.rowSpacing??0,n.colSpacing??3),leadingLineBreaks:n.leadingLineBreaks,trailingLineBreaks:n.trailingLineBreaks});function i(a){let o=+as(a,["attribs","colspan"])||1,u=+as(a,["attribs","rowspan"])||1;t.openTableCell({maxColumnWidth:n.maxColumnWidth}),e(a.children,t),t.closeTableCell({colspan:o,rowspan:u})}function s(a){if(a.type!=="tag")return;let o=n.uppercaseHeaderCells!==!1?u=>{t.pushWordTransform(l=>l.toUpperCase()),i(u),t.popWordTransform()}:i;switch(a.name){case"thead":case"tbody":case"tfoot":case"center":a.children.forEach(s);return;case"tr":{t.openTableRow();for(let u of a.children)if(u.type==="tag")switch(u.name){case"th":{o(u);break}case"td":{i(u);break}}t.closeTableRow();break}}}}var QM=Object.freeze({__proto__:null,anchor:HM,blockquote:zM,dataTable:rE,heading:UM,horizontalLine:DM,image:jM,lineBreak:MM,orderedList:VM,paragraph:FM,pre:$M,table:XM,unorderedList:WM,wbr:BM}),ZM={baseElements:{selectors:["body"],orderBy:"selectors",returnDomByDefault:!0},decodeEntities:!0,encodeCharacters:{},formatters:{},limits:{ellipsis:"...",maxBaseElements:void 0,maxChildNodes:void 0,maxDepth:void 0,maxInputLength:1<<24},longWordSplit:{forceWrapOnLimit:!1,wrapCharacters:[]},preserveNewlines:!1,selectors:[{selector:"*",format:"inline"},{selector:"a",format:"anchor",options:{baseUrl:null,hideLinkHrefIfSameAsText:!1,ignoreHref:!1,linkBrackets:["[","]"],noAnchorUrl:!0}},{selector:"article",format:"block",options:{leadingLineBreaks:1,trailingLineBreaks:1}},{selector:"aside",format:"block",options:{leadingLineBreaks:1,trailingLineBreaks:1}},{selector:"blockquote",format:"blockquote",options:{leadingLineBreaks:2,trailingLineBreaks:2,trimEmptyLines:!0}},{selector:"br",format:"lineBreak"},{selector:"div",format:"block",options:{leadingLineBreaks:1,trailingLineBreaks:1}},{selector:"footer",format:"block",options:{leadingLineBreaks:1,trailingLineBreaks:1}},{selector:"form",format:"block",options:{leadingLineBreaks:1,trailingLineBreaks:1}},{selector:"h1",format:"heading",options:{leadingLineBreaks:3,trailingLineBreaks:2,uppercase:!0}},{selector:"h2",format:"heading",options:{leadingLineBreaks:3,trailingLineBreaks:2,uppercase:!0}},{selector:"h3",format:"heading",options:{leadingLineBreaks:3,trailingLineBreaks:2,uppercase:!0}},{selector:"h4",format:"heading",options:{leadingLineBreaks:2,trailingLineBreaks:2,uppercase:!0}},{selector:"h5",format:"heading",options:{leadingLineBreaks:2,trailingLineBreaks:2,uppercase:!0}},{selector:"h6",format:"heading",options:{leadingLineBreaks:2,trailingLineBreaks:2,uppercase:!0}},{selector:"header",format:"block",options:{leadingLineBreaks:1,trailingLineBreaks:1}},{selector:"hr",format:"horizontalLine",options:{leadingLineBreaks:2,length:void 0,trailingLineBreaks:2}},{selector:"img",format:"image",options:{baseUrl:null,linkBrackets:["[","]"]}},{selector:"main",format:"block",options:{leadingLineBreaks:1,trailingLineBreaks:1}},{selector:"nav",format:"block",options:{leadingLineBreaks:1,trailingLineBreaks:1}},{selector:"ol",format:"orderedList",options:{leadingLineBreaks:2,trailingLineBreaks:2}},{selector:"p",format:"paragraph",options:{leadingLineBreaks:2,trailingLineBreaks:2}},{selector:"pre",format:"pre",options:{leadingLineBreaks:2,trailingLineBreaks:2}},{selector:"section",format:"block",options:{leadingLineBreaks:1,trailingLineBreaks:1}},{selector:"table",format:"table",options:{colSpacing:3,leadingLineBreaks:2,maxColumnWidth:60,rowSpacing:0,trailingLineBreaks:2,uppercaseHeaderCells:!0}},{selector:"ul",format:"unorderedList",options:{itemPrefix:" * ",leadingLineBreaks:2,trailingLineBreaks:2}},{selector:"wbr",format:"wbr"}],tables:[],whitespaceCharacters:` \r
132
+ \f\u200B`,wordwrap:80},JM=(r,e,t)=>[...r,...e],nE=(r,e,t)=>[...e],e5=(r,e,t)=>r.some(n=>typeof n=="object")?JM(r,e):nE(r,e);function t5(r={}){return r=(0,Kp.default)(ZM,r,{arrayMerge:nE,customMerge:e=>e==="selectors"?e5:void 0}),r.formatters=Object.assign({},RM,QM,r.formatters),r.selectors=YS(r.selectors,(e=>e.selector)),r5(r),gM(r)}function iE(r,e={},t=void 0){return t5(e)(r,t)}function r5(r){if(r.tags){let t=Object.entries(r.tags).map(([n,i])=>({...i,selector:n||"*"}));r.selectors.push(...t),r.selectors=YS(r.selectors,(n=>n.selector))}function e(t,n,i){let s=n.pop();for(let a of n){let o=t[a];o||(o={},t[a]=o),t=o}t[s]=i}if(r.baseElement){let t=r.baseElement;e(r,["baseElements","selectors"],Array.isArray(t)?t:[t])}r.returnDomByDefault!==void 0&&e(r,["baseElements","returnDomByDefault"],r.returnDomByDefault);for(let t of r.selectors)t.format==="anchor"&&as(t,["options","noLinkBrackets"])&&e(t,["options","linkBrackets"],!1)}function Tl(r,e){let t=/<h([1-6])[^>]*>([\s\S]*?)<\/h\1>/gi,n=[],i;for(;(i=t.exec(r))!==null;){let s=parseInt(i[1],10),a=i[2].replace(/<[^>]+>/g,"").trim();if(!a)continue;let o=n.length>0?n[n.length-1].offset+1:0,u=e.indexOf(a,o),l=a;if(u===-1){let c=e.toLowerCase(),h=a.toLowerCase();if(u=c.indexOf(h,o),u===-1)continue;l=e.substring(u,u+a.length)}n.push({level:s,text:l,offset:u,length:0})}return _l(n,e.length),n}function _l(r,e){for(let t=0;t<r.length;t++){let n=e;for(let i=t+1;i<r.length;i++)if(r[i].level<=r[t].level){n=r[i].offset;break}r[t].length=n-r[t].offset}}var n5=new Set(["the","and","for","are","but","not","you","all","can","had","her","was","one","our","out","has","have","been","were","they","their","will","when","who","with","this","that","each","which","she","from","other","than","then","them","these","some","would","make","like","into","could","time","very","your","what","about","know","just","take","come","more","only","also","after","there","where","most","here","over","such","through","its","before","between","does","being","under","never","same","another","while","last","might","great","since","against","right","still","back","should","those","even","said","much","every","own","how","may","did","get","him","his","way","any","new","now","old","see","well","because","good","give","first","going","say","both","made","find","use","many","upon","too","down","day","long","little","think","look","hand","part","why","got","let","put","thing","man","seem","went","came","want","yet","without","something","tell","though","keep","thought","help","nothing","again","off","left","end","along","until","high","begin","life","always","around","however","head","must","set","shall","during","number","already","enough","often","small","really","almost","away","done","point","three","whole","ever","next","later","rather","become","able","used","two","sure","using","work","need","turn","call","show","move","place","form","given","case","name","else","quite"]);function i5(r){return r.toLowerCase().split(/[^a-z0-9'-]+/).filter(e=>e.length>=3&&!e.startsWith("'"))}function Nr(r){let e=i5(r),t=new Map;for(let i of e){if(n5.has(i))continue;let s=t.get(i);if(s)s.count++;else{let a=r.toLowerCase().indexOf(i);t.set(i,{count:1,firstOffset:a>=0?a:0})}}let n=[];for(let[i,{count:s,firstOffset:a}]of t)s>=2&&n.push({term:i,frequency:s,firstOffset:a});return n.sort((i,s)=>s.frequency-i.frequency),n.slice(0,20)}var Cl=new qi({ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:"#text",processEntities:!1}),Yp={NCX:"application/x-dtbncx+xml",XHTML:"application/xhtml+xml",HTML:"text/html"},os={MAX_UNCOMPRESSED_SIZE:100*1024*1024,MAX_FILE_SIZE:10*1024*1024,MAX_FILE_COUNT:1e4};function sE(r){if(r.startsWith("/"))throw new Error(`Invalid EPUB: absolute path not allowed: ${r}`);if(r.includes(".."))throw new Error(`Invalid EPUB: path traversal not allowed: ${r}`);if(r.includes("\\")||/^[a-zA-Z]:/.test(r))throw new Error(`Invalid EPUB: Windows path not allowed: ${r}`);return r}function Da(r){if(!r)return"";if(typeof r=="string")return r.trim();if(typeof r=="object"&&r!==null){let e=r;return"#text"in e?String(e["#text"]).trim():Object.values(e).filter(t=>typeof t=="string").join(" ").trim()}return String(r).trim()}function kl(r,e){if(!r)return"";let t=e.substring(0,e.lastIndexOf("/")+1);if(r.startsWith("../")){let n=t.split("/").filter(Boolean),i=r;for(;i.startsWith("../");)n.pop(),i=i.substring(3);return n.length>0?n.join("/")+"/"+i:i}return r.startsWith("./")?t+r.substring(2):r.startsWith("/")?r.substring(1):t+r}function Qp(r){let e=r.indexOf("#");return e>=0?r.substring(0,e):r}function Fa(r){let e=Qp(r),t=e.split("/").pop()||e,n=t.lastIndexOf(".");return n>=0?t.substring(0,n):t}function s5(r,e){let t={toc:[]},n=(s,a=[])=>{if(!s||typeof s!="object")return a;if(Array.isArray(s))for(let o of s)n(o,a);else{let o=s;(o["@_epub:type"]||o["@_type"])&&a.push(o);for(let u of Object.keys(o))u!=="#text"&&!u.startsWith("@_")&&n(o[u],a)}return a},i=n(r);for(let s of i){let a=String(s["@_epub:type"]||s["@_type"]||"");a.includes("toc")?t.toc=Zp(s,e,0):a.includes("page-list")&&(t.pageList=Zp(s,e,0))}return t}function Zp(r,e,t,n={value:0}){let i=[],s=l=>{if(!l||typeof l!="object")return null;if(Array.isArray(l)){for(let h of l){let d=s(h);if(d)return d}return null}let c=l;if("li"in c)return c;for(let h of Object.keys(c))if(h!=="#text"&&!h.startsWith("@_")){let d=s(c[h]);if(d)return d}return null},a=s(r);if(!a)return i;let o=a.li,u=Array.isArray(o)?o:o?[o]:[];for(let l of u){if(!l||typeof l!="object")continue;let c=l,h=b=>{if(!b||typeof b!="object")return null;if(Array.isArray(b)){for(let y of b){let v=h(y);if(v)return v}return null}let m=b;if("@_href"in m)return{href:String(m["@_href"]),label:Da(m["#text"]||m)};if("a"in m)return h(m.a);for(let y of Object.keys(m))if(y!=="#text"&&!y.startsWith("@_")){let v=h(m[y]);if(v)return v}return null},d=h(c);if(!d)continue;let f=kl(d.href,e),p={id:Fa(f),title:d.label||"Untitled",index:n.value++,href:f,level:t},g=s(c);g&&g!==a&&(p.children=Zp({ol:g},e,t+1,n)),i.push(p)}return i}function a5(r,e){let t={toc:[]},n=(a,o)=>{if(!a||typeof a!="object")return null;if(Array.isArray(a)){for(let l of a){let c=n(l,o);if(c)return c}return null}let u=a;if(o in u)return u[o];for(let l of Object.keys(u))if(l!=="#text"&&!l.startsWith("@_")){let c=n(u[l],o);if(c)return c}return null},i=n(r,"navMap");i&&(t.toc=oE(i,e,0,{value:0}));let s=n(r,"pageList");return s&&(t.pageList=o5(s,e,{value:0})),t}function oE(r,e,t,n){let i=[],s=r.navPoint,a=Array.isArray(s)?s:s?[s]:[];for(let o of a){if(!o||typeof o!="object")continue;let u=o,c=u.navLabel?.text,h=Da(c),f=u.content?.["@_src"];if(!f)continue;let p=kl(f,e),g={id:Fa(p),title:h||"Untitled",index:n.value++,href:p,level:t};u.navPoint&&(g.children=oE(u,e,t+1,n)),i.push(g)}return i}function o5(r,e,t){let n=[],i=r.pageTarget,s=Array.isArray(i)?i:i?[i]:[];for(let a of s){if(!a||typeof a!="object")continue;let o=a,l=o.navLabel?.text,c=Da(l),d=o.content?.["@_src"];if(!d)continue;let f=kl(d,e);n.push({id:Fa(f),title:c||String(t.value+1),index:t.value++,href:f,level:0})}return n}function u5(r){let e=r.package||r["opf:package"]||r,t=e.metadata||e["opf:metadata"];if(!t||typeof t!="object")return{title:"Untitled",author:null,language:"en"};let n=t,i=s=>{let a=n[`dc:${s}`]||n[`dc-${s}`]||n[s];return a?Array.isArray(a)?Da(a[0])||null:Da(a)||null:null};return{title:i("title")||"Untitled",author:i("creator"),language:i("language")||"en",publisher:i("publisher")||void 0,publishedDate:i("date")||void 0,description:i("description")||void 0,identifier:i("identifier")||void 0}}var l5={wordwrap:null,preserveNewlines:!0,selectors:[{selector:"img",format:"skip"},{selector:"script",format:"skip"},{selector:"style",format:"skip"},{selector:"a",options:{ignoreHref:!0}}]};async function Il(r){let e=await aE.default.loadAsync(r),t=Object.keys(e.files).length;if(t>os.MAX_FILE_COUNT)throw new Error(`Invalid EPUB: too many files (${t} > ${os.MAX_FILE_COUNT})`);let n=0,i=e.file("META-INF/container.xml");if(!i)throw new Error("Missing container.xml - invalid EPUB");let s=await i.async("string");n+=s.length;let a=Cl.parse(s),o=a.container?.rootfiles?.rootfile||a.container?.rootfiles,u;if(Array.isArray(o)?u=o[0]?.["@_full-path"]:o&&(u=o["@_full-path"]),!u)throw new Error("Cannot find OPF path in container.xml");u=sE(u);let l=e.file(u);if(!l)throw new Error(`Missing OPF file: ${u}`);let c=await l.async("string");if(n+=c.length,n>os.MAX_UNCOMPRESSED_SIZE)throw new Error("Invalid EPUB: exceeds maximum size limit");let h=Cl.parse(c),d=u5(h),f=h.package||h["opf:package"]||h,g=f.manifest?.item,b=Array.isArray(g)?g:g?[g]:[],m=new Map,y=new Map;for(let P of b){if(!P||typeof P!="object")continue;let M=P,L=String(M["@_id"]||""),N=String(M["@_href"]||""),I=String(M["@_media-type"]||""),H=M["@_properties"];if(L&&N){let J=sE(kl(N,u)),ee={id:L,href:J,mediaType:I,properties:H};m.set(L,ee),y.set(J,ee)}}let v=f.spine,x=v?.itemref,w=Array.isArray(x)?x:x?[x]:[],S=v?.["@_toc"],E;S&&(E=m.get(S)?.href);let _=[];for(let P of w){if(!P||typeof P!="object")continue;let M=P["@_idref"],L=m.get(M);L&&_.push(Fa(L.href))}let T=[],k=Array.from(m.values()).find(P=>P.properties?.includes("nav")),A=null;if(k){let P=e.file(k.href);if(P)try{let M=await P.async("string");n+=M.length;let L=Cl.parse(M);T=s5(L,k.href).toc}catch(M){A=`nav: ${M instanceof Error?M.message:String(M)}`}}if(T.length===0&&(E||(E=Array.from(m.values()).find(M=>M.mediaType===Yp.NCX)?.href),E)){let P=e.file(E);if(P)try{let M=await P.async("string");n+=M.length;let L=Cl.parse(M);T=a5(L,E).toc,A=null}catch(M){A?A+=`; ncx: ${M instanceof Error?M.message:String(M)}`:A=`ncx: ${M instanceof Error?M.message:String(M)}`}}A&&T.length===0&&console.warn(`[EPUB] TOC parsing failed (proceeding without TOC): ${A}`);let B=new Map,D=[];for(let[P,M]of m.entries()){let L=M.mediaType;if(L!==Yp.XHTML&&L!==Yp.HTML)continue;let N=e.file(M.href);if(N)try{let I=await N.async("string");if(I.length>os.MAX_FILE_SIZE)throw new Error(`EPUB content file "${M.href}" exceeds size limit (${I.length} bytes > ${os.MAX_FILE_SIZE} bytes)`);if(n+=I.length,n>os.MAX_UNCOMPRESSED_SIZE)throw new Error("Invalid EPUB: total content exceeds maximum size limit");let H=Fa(M.href),ee=uE(T,M.href)?.title||c5(I)||H,X=iE(I,l5),q=Tl(I,X);B.set(H,{id:H,title:ee,html:I,text:X,headings:q,keyTerms:Nr(X)})}catch(I){let H=I instanceof Error?I.message:String(I);D.push({file:M.href,error:H})}}if(B.size===0&&D.length>0)throw new Error(`Failed to parse any chapters. First error: ${D[0].error}`);if(T.length===0&&_.length>0){let P=0;for(let M of _){let L=B.get(M);L&&(L.text.trim().length<100||T.push({id:M,title:L.title,index:P++,href:M,level:0}))}T.length>0&&console.log(`[EPUB] Generated synthetic TOC from spine (${T.length} entries)`)}return{metadata:d,toc:T,chapters:B,spine:_}}function uE(r,e){let t=Qp(e);for(let n of r){let i=Qp(n.href);if(i===t||i.endsWith("/"+t)||t.endsWith("/"+i))return n;if(n.children){let s=uE(n.children,e);if(s)return s}}}function c5(r){let e=r.match(/<h1[^>]*>([\s\S]*?)<\/h1>/i);if(e){let i=e[1].replace(/<[^>]+>/g,"").trim();if(i)return i}let t=r.match(/<h2[^>]*>([\s\S]*?)<\/h2>/i);if(t){let i=t[1].replace(/<[^>]+>/g,"").trim();if(i)return i}let n=r.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(n){let i=n[1].replace(/<[^>]+>/g,"").trim();if(i)return i}}var lE=50*1024*1024;async function Rl(r,e){if(r.byteLength>lE)throw new Error(`File size (${r.byteLength} bytes) exceeds maximum for text parsing (${lE} bytes)`);let n=new TextDecoder("utf-8").decode(r),i=e?e.replace(/\.(txt|md)$/i,""):"Untitled",s={title:i,author:null,language:"en"},a="content",o={id:a,title:i,html:`<pre>${h5(n)}</pre>`,text:n,headings:[],keyTerms:Nr(n)},u=new Map;return u.set(a,o),{metadata:s,toc:[{id:a,title:i,index:0,href:"",level:0}],chapters:u,spine:[a]}}function h5(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var d5={34:((r,e,t)=>{var n=t(4901);r.exports=function(i){return typeof i=="object"?i!==null:n(i)}}),81:((r,e,t)=>{var n=t(9565),i=t(9306),s=t(8551),a=t(6823),o=t(851),u=TypeError;r.exports=function(l,c){var h=arguments.length<2?o(l):c;if(i(h))return s(n(h,l));throw new u(a(l)+" is not iterable")}}),116:((r,e,t)=>{var n=t(6518),i=t(9565),s=t(2652),a=t(9306),o=t(8551),u=t(1767),l=t(9539),c=t(4549),h=c("find",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:h},{find:function(f){o(this);try{a(f)}catch(b){l(this,"throw",b)}if(h)return i(h,this,f);var p=u(this),g=0;return s(p,function(b,m){if(f(b,g++))return m(b)},{IS_RECORD:!0,INTERRUPTED:!0}).result}})}),283:((r,e,t)=>{var n=t(9504),i=t(9039),s=t(4901),a=t(9297),o=t(3724),u=t(350).CONFIGURABLE,l=t(3706),c=t(1181),h=c.enforce,d=c.get,f=String,p=Object.defineProperty,g=n("".slice),b=n("".replace),m=n([].join),y=o&&!i(function(){return p(function(){},"length",{value:8}).length!==8}),v=String(String).split("String"),x=r.exports=function(w,S,E){g(f(S),0,7)==="Symbol("&&(S="["+b(f(S),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),E&&E.getter&&(S="get "+S),E&&E.setter&&(S="set "+S),(!a(w,"name")||u&&w.name!==S)&&(o?p(w,"name",{value:S,configurable:!0}):w.name=S),y&&E&&a(E,"arity")&&w.length!==E.arity&&p(w,"length",{value:E.arity});try{E&&a(E,"constructor")&&E.constructor?o&&p(w,"prototype",{writable:!1}):w.prototype&&(w.prototype=void 0)}catch{}var _=h(w);return a(_,"source")||(_.source=m(v,typeof S=="string"?S:"")),w};Function.prototype.toString=x(function(){return s(this)&&d(this).source||l(this)},"toString")}),350:((r,e,t)=>{var n=t(3724),i=t(9297),s=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,o=i(s,"name"),u=o&&(function(){}).name==="something",l=o&&(!n||n&&a(s,"name").configurable);r.exports={EXISTS:o,PROPER:u,CONFIGURABLE:l}}),397:((r,e,t)=>{var n=t(7751);r.exports=n("document","documentElement")}),421:(r=>{r.exports={}}),456:((r,e,t)=>{var n=t(6518),i=t(4576),s=t(9504),a=t(4154),o=t(5169),u=s(1.1.toString),l=i.Uint8Array,c=!l||!l.prototype.toHex||!(function(){try{var h=new l([255,255,255,255,255,255,255,255]);return h.toHex()==="ffffffffffffffff"}catch{return!1}})();l&&n({target:"Uint8Array",proto:!0,forced:c},{toHex:function(){a(this),o(this.buffer);for(var d="",f=0,p=this.length;f<p;f++){var g=u(this[f],16);d+=g.length===1?"0"+g:g}return d}})}),507:((r,e,t)=>{var n=t(9565);r.exports=function(i,s,a){for(var o=a?i:i.iterator,u=i.next,l,c;!(l=n(u,o)).done;)if(c=s(l.value),c!==void 0)return c}}),531:((r,e,t)=>{var n=t(6518),i=t(9565),s=t(9306),a=t(8551),o=t(1767),u=t(8646),l=t(9462),c=t(9539),h=t(6395),d=t(684),f=t(4549),p=!h&&!d("flatMap",function(){}),g=!h&&!p&&f("flatMap",TypeError),b=h||p||g,m=l(function(){for(var y=this.iterator,v=this.mapper,x,w;;){if(w=this.inner)try{if(x=a(i(w.next,w.iterator)),!x.done)return x.value;this.inner=null}catch(S){c(y,"throw",S)}if(x=a(i(this.next,y)),this.done=!!x.done)return;try{this.inner=u(v(x.value,this.counter++),!1)}catch(S){c(y,"throw",S)}}});n({target:"Iterator",proto:!0,real:!0,forced:b},{flatMap:function(v){a(this);try{s(v)}catch(x){c(this,"throw",x)}return g?i(g,this,v):new m(o(this),{mapper:v,inner:null})}})}),616:((r,e,t)=>{var n=t(9039);r.exports=!n(function(){var i=(function(){}).bind();return typeof i!="function"||i.hasOwnProperty("prototype")})}),655:((r,e,t)=>{var n=t(6955),i=String;r.exports=function(s){if(n(s)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return i(s)}}),679:((r,e,t)=>{var n=t(1625),i=TypeError;r.exports=function(s,a){if(n(a,s))return s;throw new i("Incorrect invocation")}}),684:(r=>{r.exports=function(e,t){var n=typeof Iterator=="function"&&Iterator.prototype[e];if(n)try{n.call({next:null},t).next()}catch{return!0}}}),741:(r=>{var e=Math.ceil,t=Math.floor;r.exports=Math.trunc||function(i){var s=+i;return(s>0?t:e)(s)}}),757:((r,e,t)=>{var n=t(7751),i=t(4901),s=t(1625),a=t(7040),o=Object;r.exports=a?function(u){return typeof u=="symbol"}:function(u){var l=n("Symbol");return i(l)&&s(l.prototype,o(u))}}),851:((r,e,t)=>{var n=t(6955),i=t(5966),s=t(4117),a=t(6269),o=t(8227),u=o("iterator");r.exports=function(l){if(!s(l))return i(l,u)||i(l,"@@iterator")||a[n(l)]}}),944:(r=>{var e=TypeError;r.exports=function(t){var n=t&&t.alphabet;if(n===void 0||n==="base64"||n==="base64url")return n||"base64";throw new e("Incorrect `alphabet` option")}}),1072:((r,e,t)=>{var n=t(1828),i=t(8727);r.exports=Object.keys||function(a){return n(a,i)}}),1103:(r=>{r.exports=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}}}),1108:((r,e,t)=>{var n=t(6955);r.exports=function(i){var s=n(i);return s==="BigInt64Array"||s==="BigUint64Array"}}),1148:((r,e,t)=>{var n=t(6518),i=t(9565),s=t(2652),a=t(9306),o=t(8551),u=t(1767),l=t(9539),c=t(4549),h=c("every",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:h},{every:function(f){o(this);try{a(f)}catch(b){l(this,"throw",b)}if(h)return i(h,this,f);var p=u(this),g=0;return!s(p,function(b,m){if(!f(b,g++))return m()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})}),1181:((r,e,t)=>{var n=t(8622),i=t(4576),s=t(34),a=t(6699),o=t(9297),u=t(7629),l=t(6119),c=t(421),h="Object already initialized",d=i.TypeError,f=i.WeakMap,p,g,b,m=function(w){return b(w)?g(w):p(w,{})},y=function(w){return function(S){var E;if(!s(S)||(E=g(S)).type!==w)throw new d("Incompatible receiver, "+w+" required");return E}};if(n||u.state){var v=u.state||(u.state=new f);v.get=v.get,v.has=v.has,v.set=v.set,p=function(w,S){if(v.has(w))throw new d(h);return S.facade=w,v.set(w,S),S},g=function(w){return v.get(w)||{}},b=function(w){return v.has(w)}}else{var x=l("state");c[x]=!0,p=function(w,S){if(o(w,x))throw new d(h);return S.facade=w,a(w,x,S),S},g=function(w){return o(w,x)?w[x]:{}},b=function(w){return o(w,x)}}r.exports={set:p,get:g,has:b,enforce:m,getterFor:y}}),1291:((r,e,t)=>{var n=t(741);r.exports=function(i){var s=+i;return s!==s||s===0?0:n(s)}}),1385:((r,e,t)=>{var n=t(9539);r.exports=function(i,s,a){for(var o=i.length-1;o>=0;o--)if(i[o]!==void 0)try{a=n(i[o].iterator,s,a)}catch(u){s="throw",a=u}if(s==="throw")throw a;return a}}),1548:((r,e,t)=>{var n=t(4576),i=t(9039),s=t(9519),a=t(4215),o=n.structuredClone;r.exports=!!o&&!i(function(){if(a==="DENO"&&s>92||a==="NODE"&&s>94||a==="BROWSER"&&s>97)return!1;var u=new ArrayBuffer(8),l=o(u,{transfer:[u]});return u.byteLength!==0||l.byteLength!==8})}),1549:((r,e,t)=>{t(6632)}),1625:((r,e,t)=>{var n=t(9504);r.exports=n({}.isPrototypeOf)}),1689:((r,e,t)=>{var n=t(6518),i=t(4576),s=t(8745),a=t(7680),o=t(6043),u=t(9306),l=t(1103),c=i.Promise,h=!1,d=!c||!c.try||l(function(){c.try(function(f){h=f===8},8)}).error||!h;n({target:"Promise",stat:!0,forced:d},{try:function(f){var p=arguments.length>1?a(arguments,1):[],g=o.f(this),b=l(function(){return s(u(f),void 0,p)});return(b.error?g.reject:g.resolve)(b.value),g.promise}})}),1698:((r,e,t)=>{var n=t(6518),i=t(4204),s=t(9835),a=t(4916),o=!a("union")||!s("union");n({target:"Set",proto:!0,real:!0,forced:o},{union:i})}),1701:((r,e,t)=>{var n=t(6518),i=t(9565),s=t(9306),a=t(8551),o=t(1767),u=t(9462),l=t(6319),c=t(9539),h=t(684),d=t(4549),f=t(6395),p=!f&&!h("map",function(){}),g=!f&&!p&&d("map",TypeError),b=f||p||g,m=u(function(){var y=this.iterator,v=a(i(this.next,y)),x=this.done=!!v.done;if(!x)return l(y,this.mapper,[v.value,this.counter++],!0)});n({target:"Iterator",proto:!0,real:!0,forced:b},{map:function(v){a(this);try{s(v)}catch(x){c(this,"throw",x)}return g?i(g,this,v):new m(o(this),{mapper:v})}})}),1767:(r=>{r.exports=function(e){return{iterator:e,next:e.next,done:!1}}}),1828:((r,e,t)=>{var n=t(9504),i=t(9297),s=t(5397),a=t(9617).indexOf,o=t(421),u=n([].push);r.exports=function(l,c){var h=s(l),d=0,f=[],p;for(p in h)!i(o,p)&&i(h,p)&&u(f,p);for(;c.length>d;)i(h,p=c[d++])&&(~a(f,p)||u(f,p));return f}}),2106:((r,e,t)=>{var n=t(283),i=t(4913);r.exports=function(s,a,o){return o.get&&n(o.get,a,{getter:!0}),o.set&&n(o.set,a,{setter:!0}),i.f(s,a,o)}}),2140:((r,e,t)=>{var n=t(8227),i=n("toStringTag"),s={};s[i]="z",r.exports=String(s)==="[object z]"}),2195:((r,e,t)=>{var n=t(9504),i=n({}.toString),s=n("".slice);r.exports=function(a){return s(i(a),8,-1)}}),2211:((r,e,t)=>{var n=t(9039);r.exports=!n(function(){function i(){}return i.prototype.constructor=null,Object.getPrototypeOf(new i)!==i.prototype})}),2303:((r,e,t)=>{var n=t(4576),i=t(9504),s=n.Uint8Array,a=n.SyntaxError,o=n.parseInt,u=Math.min,l=/[^\da-f]/i,c=i(l.exec),h=i("".slice);r.exports=function(d,f){var p=d.length;if(p%2!==0)throw new a("String should be an even number of characters");for(var g=f?u(f.length,p/2):p/2,b=f||new s(g),m=0,y=0;y<g;){var v=h(d,m,m+=2);if(c(l,v))throw new a("String should only contain hex characters");b[y++]=o(v,16)}return{bytes:b,read:m}}}),2360:((r,e,t)=>{var n=t(8551),i=t(6801),s=t(8727),a=t(421),o=t(397),u=t(4055),l=t(6119),c=">",h="<",d="prototype",f="script",p=l("IE_PROTO"),g=function(){},b=function(w){return h+f+c+w+h+"/"+f+c},m=function(w){w.write(b("")),w.close();var S=w.parentWindow.Object;return w=null,S},y=function(){var w=u("iframe"),S="java"+f+":",E;return w.style.display="none",o.appendChild(w),w.src=String(S),E=w.contentWindow.document,E.open(),E.write(b("document.F=Object")),E.close(),E.F},v,x=function(){try{v=new ActiveXObject("htmlfile")}catch{}x=typeof document<"u"?document.domain&&v?m(v):y():m(v);for(var w=s.length;w--;)delete x[d][s[w]];return x()};a[p]=!0,r.exports=Object.create||function(S,E){var _;return S!==null?(g[d]=n(S),_=new g,g[d]=null,_[p]=S):_=x(),E===void 0?_:i.f(_,E)}}),2475:((r,e,t)=>{var n=t(6518),i=t(8527),s=t(4916),a=!s("isSupersetOf",function(o){return!o});n({target:"Set",proto:!0,real:!0,forced:a},{isSupersetOf:i})}),2489:((r,e,t)=>{var n=t(6518),i=t(9565),s=t(9306),a=t(8551),o=t(1767),u=t(9462),l=t(6319),c=t(6395),h=t(9539),d=t(684),f=t(4549),p=!c&&!d("filter",function(){}),g=!c&&!p&&f("filter",TypeError),b=c||p||g,m=u(function(){for(var y=this.iterator,v=this.predicate,x=this.next,w,S,E;;){if(w=a(i(x,y)),S=this.done=!!w.done,S)return;if(E=w.value,l(y,v,[E,this.counter++],!0))return E}});n({target:"Iterator",proto:!0,real:!0,forced:b},{filter:function(v){a(this);try{s(v)}catch(x){h(this,"throw",x)}return g?i(g,this,v):new m(o(this),{predicate:v})}})}),2529:(r=>{r.exports=function(e,t){return{value:e,done:t}}}),2603:((r,e,t)=>{var n=t(655);r.exports=function(i,s){return i===void 0?arguments.length<2?"":s:n(i)}}),2652:((r,e,t)=>{var n=t(6080),i=t(9565),s=t(8551),a=t(6823),o=t(4209),u=t(6198),l=t(1625),c=t(81),h=t(851),d=t(9539),f=TypeError,p=function(b,m){this.stopped=b,this.result=m},g=p.prototype;r.exports=function(b,m,y){var v=y&&y.that,x=!!(y&&y.AS_ENTRIES),w=!!(y&&y.IS_RECORD),S=!!(y&&y.IS_ITERATOR),E=!!(y&&y.INTERRUPTED),_=n(m,v),T,k,A,B,D,P,M,L=function(I){return T&&d(T,"normal"),new p(!0,I)},N=function(I){return x?(s(I),E?_(I[0],I[1],L):_(I[0],I[1])):E?_(I,L):_(I)};if(w)T=b.iterator;else if(S)T=b;else{if(k=h(b),!k)throw new f(a(b)+" is not iterable");if(o(k)){for(A=0,B=u(b);B>A;A++)if(D=N(b[A]),D&&l(g,D))return D;return new p(!1)}T=c(b,k)}for(P=w?b.next:T.next;!(M=i(P,T)).done;){try{D=N(M.value)}catch(I){d(T,"throw",I)}if(typeof D=="object"&&D&&l(g,D))return D}return new p(!1)}}),2777:((r,e,t)=>{var n=t(9565),i=t(34),s=t(757),a=t(5966),o=t(4270),u=t(8227),l=TypeError,c=u("toPrimitive");r.exports=function(h,d){if(!i(h)||s(h))return h;var f=a(h,c),p;if(f){if(d===void 0&&(d="default"),p=n(f,h,d),!i(p)||s(p))return p;throw new l("Can't convert object to primitive value")}return d===void 0&&(d="number"),o(h,d)}}),2787:((r,e,t)=>{var n=t(9297),i=t(4901),s=t(8981),a=t(6119),o=t(2211),u=a("IE_PROTO"),l=Object,c=l.prototype;r.exports=o?l.getPrototypeOf:function(h){var d=s(h);if(n(d,u))return d[u];var f=d.constructor;return i(f)&&d instanceof f?f.prototype:d instanceof l?c:null}}),2796:((r,e,t)=>{var n=t(9039),i=t(4901),s=/#|\.prototype\./,a=function(h,d){var f=u[o(h)];return f===c?!0:f===l?!1:i(d)?n(d):!!d},o=a.normalize=function(h){return String(h).replace(s,".").toLowerCase()},u=a.data={},l=a.NATIVE="N",c=a.POLYFILL="P";r.exports=a}),2804:(r=>{var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=e+"+/",n=e+"-_",i=function(s){for(var a={},o=0;o<64;o++)a[s.charAt(o)]=o;return a};r.exports={i2c:t,c2i:i(t),i2cUrl:n,c2iUrl:i(n)}}),2812:(r=>{var e=TypeError;r.exports=function(t,n){if(t<n)throw new e("Not enough arguments");return t}}),2839:((r,e,t)=>{var n=t(4576),i=n.navigator,s=i&&i.userAgent;r.exports=s?String(s):""}),2967:((r,e,t)=>{var n=t(6706),i=t(34),s=t(7750),a=t(3506);r.exports=Object.setPrototypeOf||("__proto__"in{}?(function(){var o=!1,u={},l;try{l=n(Object.prototype,"__proto__","set"),l(u,[]),o=u instanceof Array}catch{}return function(h,d){return s(h),a(d),i(h)&&(o?l(h,d):h.__proto__=d),h}})():void 0)}),3068:((r,e,t)=>{var n=t(6518),i=t(9504),s=t(2652),a=RangeError,o=TypeError,u=1/0,l=NaN,c=Math.abs,h=Math.pow,d=i([].push),f=h(2,1023),p=h(2,53)-1,g=Number.MAX_VALUE,b=h(2,971),m={},y={},v={},x={},w={},S=function(E,_){var T=E+_,k=_-(T-E);return{hi:T,lo:k}};n({target:"Math",stat:!0},{sumPrecise:function(_){var T=[],k=0,A=x;switch(s(_,function(W){if(++k>=p)throw new a("Maximum allowed index exceeded");if(typeof W!="number")throw new o("Value is not a number");A!==m&&(W!==W?A=m:W===u?A=A===y?m:v:W===-u?A=A===v?m:y:(W!==0||1/W===u)&&(A===x||A===w)&&(A=w,d(T,W)))}),A){case m:return l;case y:return-u;case v:return u;case x:return-0}for(var B=[],D=0,P,M,L,N,I,H,J=0;J<T.length;J++){P=T[J];for(var ee=0,X=0;X<B.length;X++){if(M=B[X],c(P)<c(M)&&(H=P,P=M,M=H),L=S(P,M),N=L.hi,I=L.lo,c(N)===u){var q=N===u?1:-1;D+=q,P=P-q*f-q*f,c(P)<c(M)&&(H=P,P=M,M=H),L=S(P,M),N=L.hi,I=L.lo}I!==0&&(B[ee++]=I),P=N}B.length=ee,P!==0&&d(B,P)}var ie=B.length-1;if(N=0,I=0,D!==0){var pe=ie>=0?B[ie]:0;if(ie--,c(D)>1||D>0&&pe>0||D<0&&pe<0)return D>0?u:-u;if(L=S(D*f,pe/2),N=L.hi,I=L.lo,I*=2,c(2*N)===u)return N>0?N===f&&I===-(b/2)&&ie>=0&&B[ie]<0?g:u:N===-f&&I===b/2&&ie>=0&&B[ie]>0?-g:-u;I!==0&&(B[++ie]=I,I=0),N*=2}for(;ie>=0&&(L=S(N,B[ie--]),N=L.hi,I=L.lo,I===0););return ie>=0&&(I<0&&B[ie]<0||I>0&&B[ie]>0)&&(M=I*2,P=N+M,M===P-N&&(N=P)),N}})}),3167:((r,e,t)=>{var n=t(4901),i=t(34),s=t(2967);r.exports=function(a,o,u){var l,c;return s&&n(l=o.constructor)&&l!==u&&i(c=l.prototype)&&c!==u.prototype&&s(a,c),a}}),3238:((r,e,t)=>{var n=t(4576),i=t(7811),s=t(7394),a=n.DataView;r.exports=function(o){if(!i||s(o)!==0)return!1;try{return new a(o),!1}catch{return!0}}}),3392:((r,e,t)=>{var n=t(9504),i=0,s=Math.random(),a=n(1.1.toString);r.exports=function(o){return"Symbol("+(o===void 0?"":o)+")_"+a(++i+s,36)}}),3440:((r,e,t)=>{var n=t(7080),i=t(4402),s=t(9286),a=t(5170),o=t(3789),u=t(8469),l=t(507),c=i.has,h=i.remove;r.exports=function(f){var p=n(this),g=o(f),b=s(p);return a(p)<=g.size?u(p,function(m){g.includes(m)&&h(b,m)}):l(g.getIterator(),function(m){c(b,m)&&h(b,m)}),b}}),3463:(r=>{var e=TypeError;r.exports=function(t){if(typeof t=="string")return t;throw new e("Argument is not a string")}}),3506:((r,e,t)=>{var n=t(3925),i=String,s=TypeError;r.exports=function(a){if(n(a))return a;throw new s("Can't set "+i(a)+" as a prototype")}}),3579:((r,e,t)=>{var n=t(6518),i=t(9565),s=t(2652),a=t(9306),o=t(8551),u=t(1767),l=t(9539),c=t(4549),h=c("some",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:h},{some:function(f){o(this);try{a(f)}catch(b){l(this,"throw",b)}if(h)return i(h,this,f);var p=u(this),g=0;return s(p,function(b,m){if(f(b,g++))return m()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})}),3650:((r,e,t)=>{var n=t(7080),i=t(4402),s=t(9286),a=t(3789),o=t(507),u=i.add,l=i.has,c=i.remove;r.exports=function(d){var f=n(this),p=a(d).getIterator(),g=s(f);return o(p,function(b){l(f,b)?c(g,b):u(g,b)}),g}}),3706:((r,e,t)=>{var n=t(9504),i=t(4901),s=t(7629),a=n(Function.toString);i(s.inspectSource)||(s.inspectSource=function(o){return a(o)}),r.exports=s.inspectSource}),3717:((r,e)=>{e.f=Object.getOwnPropertySymbols}),3724:((r,e,t)=>{var n=t(9039);r.exports=!n(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})}),3789:((r,e,t)=>{var n=t(9306),i=t(8551),s=t(9565),a=t(1291),o=t(1767),u="Invalid size",l=RangeError,c=TypeError,h=Math.max,d=function(f,p){this.set=f,this.size=h(p,0),this.has=n(f.has),this.keys=n(f.keys)};d.prototype={getIterator:function(){return o(i(s(this.keys,this.set)))},includes:function(f){return s(this.has,this.set,f)}},r.exports=function(f){i(f);var p=+f.size;if(p!==p)throw new c(u);var g=a(p);if(g<0)throw new l(u);return new d(f,g)}}),3838:((r,e,t)=>{var n=t(7080),i=t(5170),s=t(8469),a=t(3789);r.exports=function(u){var l=n(this),c=a(u);return i(l)>c.size?!1:s(l,function(h){if(!c.includes(h))return!1},!0)!==!1}}),3853:((r,e,t)=>{var n=t(6518),i=t(4449),s=t(4916),a=!s("isDisjointFrom",function(o){return!o});n({target:"Set",proto:!0,real:!0,forced:a},{isDisjointFrom:i})}),3925:((r,e,t)=>{var n=t(34);r.exports=function(i){return n(i)||i===null}}),3972:((r,e,t)=>{var n=t(34),i=String,s=TypeError;r.exports=function(a){if(a===void 0||n(a))return a;throw new s(i(a)+" is not an object or undefined")}}),4055:((r,e,t)=>{var n=t(4576),i=t(34),s=n.document,a=i(s)&&i(s.createElement);r.exports=function(o){return a?s.createElement(o):{}}}),4114:((r,e,t)=>{var n=t(6518),i=t(8981),s=t(6198),a=t(4527),o=t(6837),u=t(9039),l=u(function(){return[].push.call({length:4294967296},1)!==4294967297}),c=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(d){return d instanceof TypeError}},h=l||!c();n({target:"Array",proto:!0,arity:1,forced:h},{push:function(f){var p=i(this),g=s(p),b=arguments.length;o(g+b);for(var m=0;m<b;m++)p[g]=arguments[m],g++;return a(p,g),g}})}),4117:(r=>{r.exports=function(e){return e==null}}),4149:(r=>{var e=RangeError;r.exports=function(t){if(t===t)return t;throw new e("NaN is not allowed")}}),4154:((r,e,t)=>{var n=t(6955),i=TypeError;r.exports=function(s){if(n(s)==="Uint8Array")return s;throw new i("Argument is not an Uint8Array")}}),4204:((r,e,t)=>{var n=t(7080),i=t(4402).add,s=t(9286),a=t(3789),o=t(507);r.exports=function(l){var c=n(this),h=a(l).getIterator(),d=s(c);return o(h,function(f){i(d,f)}),d}}),4209:((r,e,t)=>{var n=t(8227),i=t(6269),s=n("iterator"),a=Array.prototype;r.exports=function(o){return o!==void 0&&(i.Array===o||a[s]===o)}}),4215:((r,e,t)=>{var n=t(4576),i=t(2839),s=t(2195),a=function(o){return i.slice(0,o.length)===o};r.exports=(function(){return a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":n.Bun&&typeof Bun.version=="string"?"BUN":n.Deno&&typeof Deno.version=="object"?"DENO":s(n.process)==="process"?"NODE":n.window&&n.document?"BROWSER":"REST"})()}),4226:((r,e,t)=>{var n=t(6518),i=t(4576),s=t(3463),a=t(4154),o=t(5169),u=t(2303);i.Uint8Array&&n({target:"Uint8Array",proto:!0},{setFromHex:function(c){a(this),s(c),o(this.buffer);var h=u(c,this).read;return{read:h,written:h/2}}})}),4235:((r,e,t)=>{t(3068)}),4270:((r,e,t)=>{var n=t(9565),i=t(4901),s=t(34),a=TypeError;r.exports=function(o,u){var l,c;if(u==="string"&&i(l=o.toString)&&!s(c=n(l,o))||i(l=o.valueOf)&&!s(c=n(l,o))||u!=="string"&&i(l=o.toString)&&!s(c=n(l,o)))return c;throw new a("Can't convert object to primitive value")}}),4376:((r,e,t)=>{var n=t(2195);r.exports=Array.isArray||function(s){return n(s)==="Array"}}),4402:((r,e,t)=>{var n=t(9504),i=Set.prototype;r.exports={Set,add:n(i.add),has:n(i.has),remove:n(i.delete),proto:i}}),4449:((r,e,t)=>{var n=t(7080),i=t(4402).has,s=t(5170),a=t(3789),o=t(8469),u=t(507),l=t(9539);r.exports=function(h){var d=n(this),f=a(h);if(s(d)<=f.size)return o(d,function(g){if(f.includes(g))return!1},!0)!==!1;var p=f.getIterator();return u(p,function(g){if(i(d,g))return l(p,"normal",!1)})!==!1}}),4483:((r,e,t)=>{var n=t(4576),i=t(9429),s=t(1548),a=n.structuredClone,o=n.ArrayBuffer,u=n.MessageChannel,l=!1,c,h,d,f;if(s)l=function(p){a(p,{transfer:[p]})};else if(o)try{u||(c=i("worker_threads"),c&&(u=c.MessageChannel)),u&&(h=new u,d=new o(2),f=function(p){h.port1.postMessage(null,[p])},d.byteLength===2&&(f(d),d.byteLength===0&&(l=f)))}catch{}r.exports=l}),4495:((r,e,t)=>{var n=t(9519),i=t(9039),s=t(4576),a=s.String;r.exports=!!Object.getOwnPropertySymbols&&!i(function(){var o=Symbol("symbol detection");return!a(o)||!(Object(o)instanceof Symbol)||!Symbol.sham&&n&&n<41})}),4527:((r,e,t)=>{var n=t(3724),i=t(4376),s=TypeError,a=Object.getOwnPropertyDescriptor,o=n&&!(function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(u){return u instanceof TypeError}})();r.exports=o?function(u,l){if(i(u)&&!a(u,"length").writable)throw new s("Cannot set read only .length");return u.length=l}:function(u,l){return u.length=l}}),4549:((r,e,t)=>{var n=t(4576);r.exports=function(i,s){var a=n.Iterator,o=a&&a.prototype,u=o&&o[i],l=!1;if(u)try{u.call({next:function(){return{done:!0}},return:function(){l=!0}},-1)}catch(c){c instanceof s||(l=!1)}if(!l)return u}}),4576:(function(r){var e=function(t){return t&&t.Math===Math&&t};r.exports=e(typeof globalThis=="object"&&globalThis)||e(typeof window=="object"&&window)||e(typeof self=="object"&&self)||e(typeof global=="object"&&global)||e(typeof this=="object"&&this)||(function(){return this})()||Function("return this")()}),4603:((r,e,t)=>{var n=t(6840),i=t(9504),s=t(655),a=t(2812),o=URLSearchParams,u=o.prototype,l=i(u.append),c=i(u.delete),h=i(u.forEach),d=i([].push),f=new o("a=1&a=2&b=3");f.delete("a",1),f.delete("b",void 0),f+""!="a=2"&&n(u,"delete",function(p){var g=arguments.length,b=g<2?void 0:arguments[1];if(g&&b===void 0)return c(this,p);var m=[];h(this,function(T,k){d(m,{key:k,value:T})}),a(g,1);for(var y=s(p),v=s(b),x=0,w=0,S=!1,E=m.length,_;x<E;)_=m[x++],S||_.key===y?(S=!0,c(this,_.key)):w++;for(;w<E;)_=m[w++],_.key===y&&_.value===v||l(this,_.key,_.value)},{enumerable:!0,unsafe:!0})}),4628:((r,e,t)=>{var n=t(6518),i=t(6043);n({target:"Promise",stat:!0},{withResolvers:function(){var a=i.f(this);return{promise:a.promise,resolve:a.resolve,reject:a.reject}}})}),4644:((r,e,t)=>{var n=t(7811),i=t(3724),s=t(4576),a=t(4901),o=t(34),u=t(9297),l=t(6955),c=t(6823),h=t(6699),d=t(6840),f=t(2106),p=t(1625),g=t(2787),b=t(2967),m=t(8227),y=t(3392),v=t(1181),x=v.enforce,w=v.get,S=s.Int8Array,E=S&&S.prototype,_=s.Uint8ClampedArray,T=_&&_.prototype,k=S&&g(S),A=E&&g(E),B=Object.prototype,D=s.TypeError,P=m("toStringTag"),M=y("TYPED_ARRAY_TAG"),L="TypedArrayConstructor",N=n&&!!b&&l(s.opera)!=="Opera",I=!1,H,J,ee,X={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},q={BigInt64Array:8,BigUint64Array:8},ie=function(ye){if(!o(ye))return!1;var he=l(ye);return he==="DataView"||u(X,he)||u(q,he)},pe=function(ne){var ye=g(ne);if(o(ye)){var he=w(ye);return he&&u(he,L)?he[L]:pe(ye)}},W=function(ne){if(!o(ne))return!1;var ye=l(ne);return u(X,ye)||u(q,ye)},$=function(ne){if(W(ne))return ne;throw new D("Target is not a typed array")},G=function(ne){if(a(ne)&&(!b||p(k,ne)))return ne;throw new D(c(ne)+" is not a typed array constructor")},Y=function(ne,ye,he,be){if(i){if(he)for(var de in X){var Ae=s[de];if(Ae&&u(Ae.prototype,ne))try{delete Ae.prototype[ne]}catch{try{Ae.prototype[ne]=ye}catch{}}}(!A[ne]||he)&&d(A,ne,he?ye:N&&E[ne]||ye,be)}},me=function(ne,ye,he){var be,de;if(i){if(b){if(he){for(be in X)if(de=s[be],de&&u(de,ne))try{delete de[ne]}catch{}}if(!k[ne]||he)try{return d(k,ne,he?ye:N&&k[ne]||ye)}catch{}else return}for(be in X)de=s[be],de&&(!de[ne]||he)&&d(de,ne,ye)}};for(H in X)J=s[H],ee=J&&J.prototype,ee?x(ee)[L]=J:N=!1;for(H in q)J=s[H],ee=J&&J.prototype,ee&&(x(ee)[L]=J);if((!N||!a(k)||k===Function.prototype)&&(k=function(){throw new D("Incorrect invocation")},N))for(H in X)s[H]&&b(s[H],k);if((!N||!A||A===B)&&(A=k.prototype,N))for(H in X)s[H]&&b(s[H].prototype,A);if(N&&g(T)!==A&&b(T,A),i&&!u(A,P)){I=!0,f(A,P,{configurable:!0,get:function(){return o(this)?this[M]:void 0}});for(H in X)s[H]&&h(s[H],M,H)}r.exports={NATIVE_ARRAY_BUFFER_VIEWS:N,TYPED_ARRAY_TAG:I&&M,aTypedArray:$,aTypedArrayConstructor:G,exportTypedArrayMethod:Y,exportTypedArrayStaticMethod:me,getTypedArrayConstructor:pe,isView:ie,isTypedArray:W,TypedArray:k,TypedArrayPrototype:A}}),4659:((r,e,t)=>{var n=t(3724),i=t(4913),s=t(6980);r.exports=function(a,o,u){n?i.f(a,o,s(0,u)):a[o]=u}}),4901:(r=>{var e=typeof document=="object"&&document.all;r.exports=typeof e>"u"&&e!==void 0?function(t){return typeof t=="function"||t===e}:function(t){return typeof t=="function"}}),4913:((r,e,t)=>{var n=t(3724),i=t(5917),s=t(8686),a=t(8551),o=t(6969),u=TypeError,l=Object.defineProperty,c=Object.getOwnPropertyDescriptor,h="enumerable",d="configurable",f="writable";e.f=n?s?function(g,b,m){if(a(g),b=o(b),a(m),typeof g=="function"&&b==="prototype"&&"value"in m&&f in m&&!m[f]){var y=c(g,b);y&&y[f]&&(g[b]=m.value,m={configurable:d in m?m[d]:y[d],enumerable:h in m?m[h]:y[h],writable:!1})}return l(g,b,m)}:l:function(g,b,m){if(a(g),b=o(b),a(m),i)try{return l(g,b,m)}catch{}if("get"in m||"set"in m)throw new u("Accessors not supported");return"value"in m&&(g[b]=m.value),g}}),4916:((r,e,t)=>{var n=t(7751),i=function(a){return{size:a,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},s=function(a){return{size:a,has:function(){return!0},keys:function(){throw new Error("e")}}};r.exports=function(a,o){var u=n("Set");try{new u()[a](i(0));try{return new u()[a](i(-1)),!1}catch{if(!o)return!0;try{return new u()[a](s(-1/0)),!1}catch{var l=new u([1,2]);return o(l[a](s(1/0)))}}}catch{return!1}}}),4972:((r,e,t)=>{var n=t(6518),i=t(9565),s=t(8551),a=t(1767),o=t(4149),u=t(9590),l=t(9462),c=t(9539),h=t(4549),d=t(6395),f=!d&&h("take",RangeError),p=l(function(){var g=this.iterator;if(!this.remaining--)return this.done=!0,c(g,"normal",void 0);var b=s(i(this.next,g)),m=this.done=!!b.done;if(!m)return b.value});n({target:"Iterator",proto:!0,real:!0,forced:d||f},{take:function(b){s(this);var m;try{m=u(o(+b))}catch(y){c(this,"throw",y)}return f?i(f,this,m):new p(a(this),{remaining:m})}})}),4979:((r,e,t)=>{var n=t(6518),i=t(4576),s=t(7751),a=t(6980),o=t(4913).f,u=t(9297),l=t(679),c=t(3167),h=t(2603),d=t(5002),f=t(8574),p=t(3724),g=t(6395),b="DOMException",m=s("Error"),y=s(b),v=function(){l(this,x);var L=arguments.length,N=h(L<1?void 0:arguments[0]),I=h(L<2?void 0:arguments[1],"Error"),H=new y(N,I),J=new m(N);return J.name=b,o(H,"stack",a(1,f(J.stack,1))),c(H,this,v),H},x=v.prototype=y.prototype,w="stack"in new m(b),S="stack"in new y(1,2),E=y&&p&&Object.getOwnPropertyDescriptor(i,b),_=!!E&&!(E.writable&&E.configurable),T=w&&!_&&!S;n({global:!0,constructor:!0,forced:g||T},{DOMException:T?v:y});var k=s(b),A=k.prototype;if(A.constructor!==k){g||o(A,"constructor",a(1,k));for(var B in d)if(u(d,B)){var D=d[B],P=D.s;u(k,P)||o(k,P,a(6,D.c))}}}),5002:(r=>{r.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}}),5024:((r,e,t)=>{var n=t(6518),i=t(3650),s=t(9835),a=t(4916),o=!a("symmetricDifference")||!s("symmetricDifference");n({target:"Set",proto:!0,real:!0,forced:o},{symmetricDifference:i})}),5031:((r,e,t)=>{var n=t(7751),i=t(9504),s=t(8480),a=t(3717),o=t(8551),u=i([].concat);r.exports=n("Reflect","ownKeys")||function(c){var h=s.f(o(c)),d=a.f;return d?u(h,d(c)):h}}),5169:((r,e,t)=>{var n=t(3238),i=TypeError;r.exports=function(s){if(n(s))throw new i("ArrayBuffer is detached");return s}}),5170:((r,e,t)=>{var n=t(6706),i=t(4402);r.exports=n(i.proto,"size","get")||function(s){return s.size}}),5213:((r,e,t)=>{var n=t(6518),i=t(4576),s=t(5370),a=t(9143),o=i.Uint8Array,u=!o||!o.fromBase64||!(function(){try{o.fromBase64("a");return}catch{}try{o.fromBase64("",null)}catch{return!0}})();o&&n({target:"Uint8Array",stat:!0,forced:u},{fromBase64:function(c){var h=a(c,arguments.length>1?arguments[1]:void 0,null,9007199254740991);return s(o,h.bytes)}})}),5370:((r,e,t)=>{var n=t(6198);r.exports=function(i,s,a){for(var o=0,u=arguments.length>2?a:n(s),l=new i(u);u>o;)l[o]=s[o++];return l}}),5397:((r,e,t)=>{var n=t(7055),i=t(7750);r.exports=function(s){return n(i(s))}}),5610:((r,e,t)=>{var n=t(1291),i=Math.max,s=Math.min;r.exports=function(a,o){var u=n(a);return u<0?i(u+o,0):s(u,o)}}),5623:((r,e,t)=>{t(456)}),5636:((r,e,t)=>{var n=t(4576),i=t(9504),s=t(6706),a=t(7696),o=t(5169),u=t(7394),l=t(4483),c=t(1548),h=n.structuredClone,d=n.ArrayBuffer,f=n.DataView,p=Math.min,g=d.prototype,b=f.prototype,m=i(g.slice),y=s(g,"resizable","get"),v=s(g,"maxByteLength","get"),x=i(b.getInt8),w=i(b.setInt8);r.exports=(c||l)&&function(S,E,_){var T=u(S),k=E===void 0?T:a(E),A=!y||!y(S),B;if(o(S),c&&(S=h(S,{transfer:[S]}),T===k&&(_||A)))return S;if(T>=k&&(!_||A))B=m(S,0,k);else{var D=_&&!A&&v?{maxByteLength:v(S)}:void 0;B=new d(k,D);for(var P=new f(S),M=new f(B),L=p(k,T),N=0;N<L;N++)w(M,N,x(P,N))}return c||l(S),B}}),5745:((r,e,t)=>{var n=t(7629);r.exports=function(i,s){return n[i]||(n[i]=s||{})}}),5781:((r,e,t)=>{var n=t(6518),i=t(7751),s=t(2812),a=t(655),o=t(7416),u=i("URL");n({target:"URL",stat:!0,forced:!o},{parse:function(c){var h=s(arguments.length,1),d=a(c),f=h<2||arguments[1]===void 0?void 0:a(arguments[1]);try{return new u(d,f)}catch{return null}}})}),5854:((r,e,t)=>{var n=t(2777),i=TypeError;r.exports=function(s){var a=n(s,"number");if(typeof a=="number")throw new i("Can't convert number to bigint");return BigInt(a)}}),5876:((r,e,t)=>{var n=t(6518),i=t(3838),s=t(4916),a=!s("isSubsetOf",function(o){return o});n({target:"Set",proto:!0,real:!0,forced:a},{isSubsetOf:i})}),5917:((r,e,t)=>{var n=t(3724),i=t(9039),s=t(4055);r.exports=!n&&!i(function(){return Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a!==7})}),5966:((r,e,t)=>{var n=t(9306),i=t(4117);r.exports=function(s,a){var o=s[a];return i(o)?void 0:n(o)}}),6043:((r,e,t)=>{var n=t(9306),i=TypeError,s=function(a){var o,u;this.promise=new a(function(l,c){if(o!==void 0||u!==void 0)throw new i("Bad Promise constructor");o=l,u=c}),this.resolve=n(o),this.reject=n(u)};r.exports.f=function(a){return new s(a)}}),6080:((r,e,t)=>{var n=t(7476),i=t(9306),s=t(616),a=n(n.bind);r.exports=function(o,u){return i(o),u===void 0?o:s?a(o,u):function(){return o.apply(u,arguments)}}}),6119:((r,e,t)=>{var n=t(5745),i=t(3392),s=n("keys");r.exports=function(a){return s[a]||(s[a]=i(a))}}),6193:((r,e,t)=>{var n=t(4215);r.exports=n==="NODE"}),6198:((r,e,t)=>{var n=t(8014);r.exports=function(i){return n(i.length)}}),6269:(r=>{r.exports={}}),6279:((r,e,t)=>{var n=t(6840);r.exports=function(i,s,a){for(var o in s)n(i,o,s[o],a);return i}}),6319:((r,e,t)=>{var n=t(8551),i=t(9539);r.exports=function(s,a,o,u){try{return u?a(n(o)[0],o[1]):a(o)}catch(l){i(s,"throw",l)}}}),6395:(r=>{r.exports=!1}),6518:((r,e,t)=>{var n=t(4576),i=t(7347).f,s=t(6699),a=t(6840),o=t(9433),u=t(7740),l=t(2796);r.exports=function(c,h){var d=c.target,f=c.global,p=c.stat,g,b,m,y,v,x;if(f?b=n:p?b=n[d]||o(d,{}):b=n[d]&&n[d].prototype,b)for(m in h){if(v=h[m],c.dontCallGetSet?(x=i(b,m),y=x&&x.value):y=b[m],g=l(f?m:d+(p?".":"#")+m,c.forced),!g&&y!==void 0){if(typeof v==typeof y)continue;u(v,y)}(c.sham||y&&y.sham)&&s(v,"sham",!0),a(b,m,v,c)}}}),6573:((r,e,t)=>{var n=t(3724),i=t(2106),s=t(3238),a=ArrayBuffer.prototype;n&&!("detached"in a)&&i(a,"detached",{configurable:!0,get:function(){return s(this)}})}),6632:((r,e,t)=>{var n=t(6518),i=t(4576),s=t(9143),a=t(4154),o=i.Uint8Array,u=!o||!o.prototype.setFromBase64||!(function(){var l=new o([255,255,255,255,255]);try{l.setFromBase64("",null);return}catch{}try{l.setFromBase64("a");return}catch{}try{l.setFromBase64("MjYyZg===")}catch{return l[0]===50&&l[1]===54&&l[2]===50&&l[3]===255&&l[4]===255}})();o&&n({target:"Uint8Array",proto:!0,forced:u},{setFromBase64:function(c){a(this);var h=s(c,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:h.read,written:h.written}}})}),6699:((r,e,t)=>{var n=t(3724),i=t(4913),s=t(6980);r.exports=n?function(a,o,u){return i.f(a,o,s(1,u))}:function(a,o,u){return a[o]=u,a}}),6706:((r,e,t)=>{var n=t(9504),i=t(9306);r.exports=function(s,a,o){try{return n(i(Object.getOwnPropertyDescriptor(s,a)[o]))}catch{}}}),6801:((r,e,t)=>{var n=t(3724),i=t(8686),s=t(4913),a=t(8551),o=t(5397),u=t(1072);e.f=n&&!i?Object.defineProperties:function(c,h){a(c);for(var d=o(h),f=u(h),p=f.length,g=0,b;p>g;)s.f(c,b=f[g++],d[b]);return c}}),6823:(r=>{var e=String;r.exports=function(t){try{return e(t)}catch{return"Object"}}}),6837:(r=>{var e=TypeError,t=9007199254740991;r.exports=function(n){if(n>t)throw e("Maximum allowed index exceeded");return n}}),6840:((r,e,t)=>{var n=t(4901),i=t(4913),s=t(283),a=t(9433);r.exports=function(o,u,l,c){c||(c={});var h=c.enumerable,d=c.name!==void 0?c.name:u;if(n(l)&&s(l,d,c),c.global)h?o[u]=l:a(u,l);else{try{c.unsafe?o[u]&&(h=!0):delete o[u]}catch{}h?o[u]=l:i.f(o,u,{value:l,enumerable:!1,configurable:!c.nonConfigurable,writable:!c.nonWritable})}return o}}),6955:((r,e,t)=>{var n=t(2140),i=t(4901),s=t(2195),a=t(8227),o=a("toStringTag"),u=Object,l=s((function(){return arguments})())==="Arguments",c=function(h,d){try{return h[d]}catch{}};r.exports=n?s:function(h){var d,f,p;return h===void 0?"Undefined":h===null?"Null":typeof(f=c(d=u(h),o))=="string"?f:l?s(d):(p=s(d))==="Object"&&i(d.callee)?"Arguments":p}}),6969:((r,e,t)=>{var n=t(2777),i=t(757);r.exports=function(s){var a=n(s,"string");return i(a)?a:a+""}}),6980:(r=>{r.exports=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}}}),7040:((r,e,t)=>{var n=t(4495);r.exports=n&&!Symbol.sham&&typeof Symbol.iterator=="symbol"}),7055:((r,e,t)=>{var n=t(9504),i=t(9039),s=t(2195),a=Object,o=n("".split);r.exports=i(function(){return!a("z").propertyIsEnumerable(0)})?function(u){return s(u)==="String"?o(u,""):a(u)}:a}),7080:((r,e,t)=>{var n=t(4402).has;r.exports=function(i){return n(i),i}}),7347:((r,e,t)=>{var n=t(3724),i=t(9565),s=t(8773),a=t(6980),o=t(5397),u=t(6969),l=t(9297),c=t(5917),h=Object.getOwnPropertyDescriptor;e.f=n?h:function(f,p){if(f=o(f),p=u(p),c)try{return h(f,p)}catch{}if(l(f,p))return a(!i(s.f,f,p),f[p])}}),7394:((r,e,t)=>{var n=t(4576),i=t(6706),s=t(2195),a=n.ArrayBuffer,o=n.TypeError;r.exports=a&&i(a.prototype,"byteLength","get")||function(u){if(s(u)!=="ArrayBuffer")throw new o("ArrayBuffer expected");return u.byteLength}}),7416:((r,e,t)=>{var n=t(9039),i=t(8227),s=t(3724),a=t(6395),o=i("iterator");r.exports=!n(function(){var u=new URL("b?a=1&b=2&c=3","https://a"),l=u.searchParams,c=new URLSearchParams("a=1&a=2&b=3"),h="";return u.pathname="c%20d",l.forEach(function(d,f){l.delete("b"),h+=f+d}),c.delete("a",2),c.delete("b",void 0),a&&(!u.toJSON||!c.has("a",1)||c.has("a",2)||!c.has("a",void 0)||c.has("b"))||!l.size&&(a||!s)||!l.sort||u.href!=="https://a/c%20d?a=1&c=3"||l.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!l[o]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("https://\u0442\u0435\u0441\u0442").host!=="xn--e1aybc"||new URL("https://a#\u0431").hash!=="#%D0%B1"||h!=="a1c3"||new URL("https://x",void 0).host!=="x"})}),7476:((r,e,t)=>{var n=t(2195),i=t(9504);r.exports=function(s){if(n(s)==="Function")return i(s)}}),7566:((r,e,t)=>{var n=t(6840),i=t(9504),s=t(655),a=t(2812),o=URLSearchParams,u=o.prototype,l=i(u.getAll),c=i(u.has),h=new o("a=1");(h.has("a",2)||!h.has("a",void 0))&&n(u,"has",function(f){var p=arguments.length,g=p<2?void 0:arguments[1];if(p&&g===void 0)return c(this,f);var b=l(this,f);a(p,1);for(var m=s(g),y=0;y<b.length;)if(b[y++]===m)return!0;return!1},{enumerable:!0,unsafe:!0})}),7588:((r,e,t)=>{var n=t(6518),i=t(9565),s=t(2652),a=t(9306),o=t(8551),u=t(1767),l=t(9539),c=t(4549),h=c("forEach",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:h},{forEach:function(f){o(this);try{a(f)}catch(b){l(this,"throw",b)}if(h)return i(h,this,f);var p=u(this),g=0;s(p,function(b){f(b,g++)},{IS_RECORD:!0})}})}),7629:((r,e,t)=>{var n=t(6395),i=t(4576),s=t(9433),a="__core-js_shared__",o=r.exports=i[a]||s(a,{});(o.versions||(o.versions=[])).push({version:"3.47.0",mode:n?"pure":"global",copyright:"\xA9 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)",license:"https://github.com/zloirock/core-js/blob/v3.47.0/LICENSE",source:"https://github.com/zloirock/core-js"})}),7642:((r,e,t)=>{var n=t(6518),i=t(3440),s=t(9039),a=t(4916),o=!a("difference",function(l){return l.size===0}),u=o||s(function(){var l={size:1,has:function(){return!0},keys:function(){var h=0;return{next:function(){var d=h++>1;return c.has(1)&&c.clear(),{done:d,value:2}}}}},c=new Set([1,2,3,4]);return c.difference(l).size!==3});n({target:"Set",proto:!0,real:!0,forced:u},{difference:i})}),7657:((r,e,t)=>{var n=t(9039),i=t(4901),s=t(34),a=t(2360),o=t(2787),u=t(6840),l=t(8227),c=t(6395),h=l("iterator"),d=!1,f,p,g;[].keys&&(g=[].keys(),"next"in g?(p=o(o(g)),p!==Object.prototype&&(f=p)):d=!0);var b=!s(f)||n(function(){var m={};return f[h].call(m)!==m});b?f={}:c&&(f=a(f)),i(f[h])||u(f,h,function(){return this}),r.exports={IteratorPrototype:f,BUGGY_SAFARI_ITERATORS:d}}),7680:((r,e,t)=>{var n=t(9504);r.exports=n([].slice)}),7696:((r,e,t)=>{var n=t(1291),i=t(8014),s=RangeError;r.exports=function(a){if(a===void 0)return 0;var o=n(a),u=i(o);if(o!==u)throw new s("Wrong length or index");return u}}),7740:((r,e,t)=>{var n=t(9297),i=t(5031),s=t(7347),a=t(4913);r.exports=function(o,u,l){for(var c=i(u),h=a.f,d=s.f,f=0;f<c.length;f++){var p=c[f];!n(o,p)&&!(l&&n(l,p))&&h(o,p,d(u,p))}}}),7750:((r,e,t)=>{var n=t(4117),i=TypeError;r.exports=function(s){if(n(s))throw new i("Can't call method on "+s);return s}}),7751:((r,e,t)=>{var n=t(4576),i=t(4901),s=function(a){return i(a)?a:void 0};r.exports=function(a,o){return arguments.length<2?s(n[a]):n[a]&&n[a][o]}}),7811:(r=>{r.exports=typeof ArrayBuffer<"u"&&typeof DataView<"u"}),7936:((r,e,t)=>{var n=t(6518),i=t(5636);i&&n({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return i(this,arguments.length?arguments[0]:void 0,!1)}})}),8004:((r,e,t)=>{var n=t(6518),i=t(9039),s=t(8750),a=t(4916),o=!a("intersection",function(u){return u.size===2&&u.has(1)&&u.has(2)})||i(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"});n({target:"Set",proto:!0,real:!0,forced:o},{intersection:s})}),8014:((r,e,t)=>{var n=t(1291),i=Math.min;r.exports=function(s){var a=n(s);return a>0?i(a,9007199254740991):0}}),8100:((r,e,t)=>{var n=t(6518),i=t(5636);i&&n({target:"ArrayBuffer",proto:!0},{transfer:function(){return i(this,arguments.length?arguments[0]:void 0,!0)}})}),8111:((r,e,t)=>{var n=t(6518),i=t(4576),s=t(679),a=t(8551),o=t(4901),u=t(2787),l=t(2106),c=t(4659),h=t(9039),d=t(9297),f=t(8227),p=t(7657).IteratorPrototype,g=t(3724),b=t(6395),m="constructor",y="Iterator",v=f("toStringTag"),x=TypeError,w=i[y],S=b||!o(w)||w.prototype!==p||!h(function(){w({})}),E=function(){if(s(this,p),u(this)===p)throw new x("Abstract class Iterator not directly constructable")},_=function(T,k){g?l(p,T,{configurable:!0,get:function(){return k},set:function(A){if(a(this),this===p)throw new x("You can't redefine this property");d(this,T)?this[T]=A:c(this,T,A)}}):p[T]=k};d(p,v)||_(v,y),(S||!d(p,m)||p[m]===Object)&&_(m,E),E.prototype=p,n({global:!0,constructor:!0,forced:S},{Iterator:E})}),8227:((r,e,t)=>{var n=t(4576),i=t(5745),s=t(9297),a=t(3392),o=t(4495),u=t(7040),l=n.Symbol,c=i("wks"),h=u?l.for||l:l&&l.withoutSetter||a;r.exports=function(d){return s(c,d)||(c[d]=o&&s(l,d)?l[d]:h("Symbol."+d)),c[d]}}),8235:((r,e,t)=>{var n=t(9504),i=t(9297),s=SyntaxError,a=parseInt,o=String.fromCharCode,u=n("".charAt),l=n("".slice),c=n(/./.exec),h={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":`
133
+ `,"\\r":"\r","\\t":" "},d=/^[\da-f]{4}$/i,f=/^[\u0000-\u001F]$/;r.exports=function(p,g){for(var b=!0,m="";g<p.length;){var y=u(p,g);if(y==="\\"){var v=l(p,g,g+2);if(i(h,v))m+=h[v],g+=2;else if(v==="\\u"){g+=2;var x=l(p,g,g+4);if(!c(d,x))throw new s("Bad Unicode escape at: "+g);m+=o(a(x,16)),g+=4}else throw new s('Unknown escape sequence: "'+v+'"')}else if(y==='"'){b=!1,g++;break}else{if(c(f,y))throw new s("Bad control character in string literal at: "+g);m+=y,g++}}if(b)throw new s("Unterminated string at: "+g);return{value:m,end:g}}}),8237:((r,e,t)=>{var n=t(6518),i=t(2652),s=t(9306),a=t(8551),o=t(1767),u=t(9539),l=t(4549),c=t(8745),h=t(9039),d=TypeError,f=h(function(){[].keys().reduce(function(){},void 0)}),p=!f&&l("reduce",d);n({target:"Iterator",proto:!0,real:!0,forced:f||p},{reduce:function(b){a(this);try{s(b)}catch(w){u(this,"throw",w)}var m=arguments.length<2,y=m?void 0:arguments[1];if(p)return c(p,this,m?[b]:[b,y]);var v=o(this),x=0;if(i(v,function(w){m?(m=!1,y=w):y=b(y,w,x),x++},{IS_RECORD:!0}),m)throw new d("Reduce of empty iterator with no initial value");return y}})}),8335:((r,e,t)=>{t(9112)}),8469:((r,e,t)=>{var n=t(9504),i=t(507),s=t(4402),a=s.Set,o=s.proto,u=n(o.forEach),l=n(o.keys),c=l(new a).next;r.exports=function(h,d,f){return f?i({iterator:l(h),next:c},d):u(h,d)}}),8480:((r,e,t)=>{var n=t(1828),i=t(8727),s=i.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(o){return n(o,s)}}),8527:((r,e,t)=>{var n=t(7080),i=t(4402).has,s=t(5170),a=t(3789),o=t(507),u=t(9539);r.exports=function(c){var h=n(this),d=a(c);if(s(h)<d.size)return!1;var f=d.getIterator();return o(f,function(p){if(!i(h,p))return u(f,"normal",!1)})!==!1}}),8551:((r,e,t)=>{var n=t(34),i=String,s=TypeError;r.exports=function(a){if(n(a))return a;throw new s(i(a)+" is not an object")}}),8574:((r,e,t)=>{var n=t(9504),i=Error,s=n("".replace),a=(function(l){return String(new i(l).stack)})("zxcasd"),o=/\n\s*at [^:]*:[^\n]*/,u=o.test(a);r.exports=function(l,c){if(u&&typeof l=="string"&&!i.prepareStackTrace)for(;c--;)l=s(l,o,"");return l}}),8622:((r,e,t)=>{var n=t(4576),i=t(4901),s=n.WeakMap;r.exports=i(s)&&/native code/.test(String(s))}),8646:((r,e,t)=>{var n=t(9565),i=t(8551),s=t(1767),a=t(851);r.exports=function(o,u){(!u||typeof o!="string")&&i(o);var l=a(o);return s(i(l!==void 0?n(l,o):o))}}),8686:((r,e,t)=>{var n=t(3724),i=t(9039);r.exports=n&&i(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})}),8721:((r,e,t)=>{var n=t(3724),i=t(9504),s=t(2106),a=URLSearchParams.prototype,o=i(a.forEach);n&&!("size"in a)&&s(a,"size",{get:function(){var l=0;return o(this,function(){l++}),l},configurable:!0,enumerable:!0})}),8727:(r=>{r.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]}),8745:((r,e,t)=>{var n=t(616),i=Function.prototype,s=i.apply,a=i.call;r.exports=typeof Reflect=="object"&&Reflect.apply||(n?a.bind(s):function(){return a.apply(s,arguments)})}),8750:((r,e,t)=>{var n=t(7080),i=t(4402),s=t(5170),a=t(3789),o=t(8469),u=t(507),l=i.Set,c=i.add,h=i.has;r.exports=function(f){var p=n(this),g=a(f),b=new l;return s(p)>g.size?u(g.getIterator(),function(m){h(p,m)&&c(b,m)}):o(p,function(m){g.includes(m)&&c(b,m)}),b}}),8773:((r,e)=>{var t={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,i=n&&!t.call({1:2},1);e.f=i?function(a){var o=n(this,a);return!!o&&o.enumerable}:t}),8981:((r,e,t)=>{var n=t(7750),i=Object;r.exports=function(s){return i(n(s))}}),9039:(r=>{r.exports=function(e){try{return!!e()}catch{return!0}}}),9112:((r,e,t)=>{var n=t(6518),i=t(3724),s=t(4576),a=t(7751),o=t(9504),u=t(9565),l=t(4901),c=t(34),h=t(4376),d=t(9297),f=t(655),p=t(6198),g=t(4659),b=t(9039),m=t(8235),y=t(4495),v=s.JSON,x=s.Number,w=s.SyntaxError,S=v&&v.parse,E=a("Object","keys"),_=Object.getOwnPropertyDescriptor,T=o("".charAt),k=o("".slice),A=o(/./.exec),B=o([].push),D=/^\d$/,P=/^[1-9]$/,M=/^[\d-]$/,L=/^[\t\n\r ]$/,N=0,I=1,H=function(W,$){W=f(W);var G=new q(W,0,""),Y=G.parse(),me=Y.value,ne=G.skip(L,Y.end);if(ne<W.length)throw new w('Unexpected extra character: "'+T(W,ne)+'" after the parsed data at: '+ne);return l($)?J({"":me},"",$,Y):me},J=function(W,$,G,Y){var me=W[$],ne=Y&&me===Y.value,ye=ne&&typeof Y.source=="string"?{source:Y.source}:{},he,be,de,Ae,hr;if(c(me)){var Rn=h(me),K=ne?Y.nodes:Rn?[]:{};if(Rn)for(he=K.length,de=p(me),Ae=0;Ae<de;Ae++)ee(me,Ae,J(me,""+Ae,G,Ae<he?K[Ae]:void 0));else for(be=E(me),de=p(be),Ae=0;Ae<de;Ae++)hr=be[Ae],ee(me,hr,J(me,hr,G,d(K,hr)?K[hr]:void 0))}return u(G,W,$,me,ye)},ee=function(W,$,G){if(i){var Y=_(W,$);if(Y&&!Y.configurable)return}G===void 0?delete W[$]:g(W,$,G)},X=function(W,$,G,Y){this.value=W,this.end=$,this.source=G,this.nodes=Y},q=function(W,$){this.source=W,this.index=$};q.prototype={fork:function(W){return new q(this.source,W)},parse:function(){var W=this.source,$=this.skip(L,this.index),G=this.fork($),Y=T(W,$);if(A(M,Y))return G.number();switch(Y){case"{":return G.object();case"[":return G.array();case'"':return G.string();case"t":return G.keyword(!0);case"f":return G.keyword(!1);case"n":return G.keyword(null)}throw new w('Unexpected character: "'+Y+'" at: '+$)},node:function(W,$,G,Y,me){return new X($,Y,W?null:k(this.source,G,Y),me)},object:function(){for(var W=this.source,$=this.index+1,G=!1,Y={},me={};$<W.length;){if($=this.until(['"',"}"],$),T(W,$)==="}"&&!G){$++;break}var ne=this.fork($).string(),ye=ne.value;$=ne.end,$=this.until([":"],$)+1,$=this.skip(L,$),ne=this.fork($).parse(),g(me,ye,ne),g(Y,ye,ne.value),$=this.until([",","}"],ne.end);var he=T(W,$);if(he===",")G=!0,$++;else if(he==="}"){$++;break}}return this.node(I,Y,this.index,$,me)},array:function(){for(var W=this.source,$=this.index+1,G=!1,Y=[],me=[];$<W.length;){if($=this.skip(L,$),T(W,$)==="]"&&!G){$++;break}var ne=this.fork($).parse();if(B(me,ne),B(Y,ne.value),$=this.until([",","]"],ne.end),T(W,$)===",")G=!0,$++;else if(T(W,$)==="]"){$++;break}}return this.node(I,Y,this.index,$,me)},string:function(){var W=this.index,$=m(this.source,this.index+1);return this.node(N,$.value,W,$.end)},number:function(){var W=this.source,$=this.index,G=$;if(T(W,G)==="-"&&G++,T(W,G)==="0")G++;else if(A(P,T(W,G)))G=this.skip(D,G+1);else throw new w("Failed to parse number at: "+G);if(T(W,G)==="."&&(G=this.skip(D,G+1)),T(W,G)==="e"||T(W,G)==="E"){G++,(T(W,G)==="+"||T(W,G)==="-")&&G++;var Y=G;if(G=this.skip(D,G),Y===G)throw new w("Failed to parse number's exponent value at: "+G)}return this.node(N,x(k(W,$,G)),$,G)},keyword:function(W){var $=""+W,G=this.index,Y=G+$.length;if(k(this.source,G,Y)!==$)throw new w("Failed to parse value at: "+G);return this.node(N,W,G,Y)},skip:function(W,$){for(var G=this.source;$<G.length&&A(W,T(G,$));$++);return $},until:function(W,$){$=this.skip(L,$);for(var G=T(this.source,$),Y=0;Y<W.length;Y++)if(W[Y]===G)return $;throw new w('Unexpected character: "'+G+'" at: '+$)}};var ie=b(function(){var W="9007199254740993",$;return S(W,function(G,Y,me){$=me.source}),$!==W}),pe=y&&!b(function(){return 1/S("-0 ")!==-1/0});n({target:"JSON",stat:!0,forced:ie},{parse:function($,G){return pe&&!l(G)?S($):H($,G)}})}),9143:((r,e,t)=>{var n=t(4576),i=t(9504),s=t(3972),a=t(3463),o=t(9297),u=t(2804),l=t(944),c=t(5169),h=u.c2i,d=u.c2iUrl,f=n.SyntaxError,p=n.TypeError,g=i("".charAt),b=function(v,x){for(var w=v.length;x<w;x++){var S=g(v,x);if(S!==" "&&S!==" "&&S!==`
134
+ `&&S!=="\f"&&S!=="\r")break}return x},m=function(v,x,w){var S=v.length;S<4&&(v+=S===2?"AA":"A");var E=(x[g(v,0)]<<18)+(x[g(v,1)]<<12)+(x[g(v,2)]<<6)+x[g(v,3)],_=[E>>16&255,E>>8&255,E&255];if(S===2){if(w&&_[1]!==0)throw new f("Extra bits");return[_[0]]}if(S===3){if(w&&_[2]!==0)throw new f("Extra bits");return[_[0],_[1]]}return _},y=function(v,x,w){for(var S=x.length,E=0;E<S;E++)v[w+E]=x[E];return w+S};r.exports=function(v,x,w,S){a(v),s(x);var E=l(x)==="base64"?h:d,_=x?x.lastChunkHandling:void 0;if(_===void 0&&(_="loose"),_!=="loose"&&_!=="strict"&&_!=="stop-before-partial")throw new p("Incorrect `lastChunkHandling` option");w&&c(w.buffer);var T=v.length,k=w||[],A=0,B=0,D="",P=0;if(S)for(;;){if(P=b(v,P),P===T){if(D.length>0){if(_==="stop-before-partial")break;if(_==="loose"){if(D.length===1)throw new f("Malformed padding: exactly one additional character");A=y(k,m(D,E,!1),A)}else throw new f("Missing padding")}B=T;break}var M=g(v,P);if(++P,M==="="){if(D.length<2)throw new f("Padding is too early");if(P=b(v,P),D.length===2){if(P===T){if(_==="stop-before-partial")break;throw new f("Malformed padding: only one =")}g(v,P)==="="&&(++P,P=b(v,P))}if(P<T)throw new f("Unexpected character after padding");A=y(k,m(D,E,_==="strict"),A),B=T;break}if(!o(E,M))throw new f("Unexpected character");var L=S-A;if(L===1&&D.length===2||L===2&&D.length===3||(D+=M,D.length===4&&(A=y(k,m(D,E,!1),A),D="",B=P,A===S)))break}return{bytes:k,read:B,written:A}}}),9286:((r,e,t)=>{var n=t(4402),i=t(8469),s=n.Set,a=n.add;r.exports=function(o){var u=new s;return i(o,function(l){a(u,l)}),u}}),9297:((r,e,t)=>{var n=t(9504),i=t(8981),s=n({}.hasOwnProperty);r.exports=Object.hasOwn||function(o,u){return s(i(o),u)}}),9306:((r,e,t)=>{var n=t(4901),i=t(6823),s=TypeError;r.exports=function(a){if(n(a))return a;throw new s(i(a)+" is not a function")}}),9314:((r,e,t)=>{var n=t(6518),i=t(9565),s=t(8551),a=t(1767),o=t(4149),u=t(9590),l=t(9539),c=t(9462),h=t(684),d=t(4549),f=t(6395),p=!f&&!h("drop",0),g=!f&&!p&&d("drop",RangeError),b=f||p||g,m=c(function(){for(var y=this.iterator,v=this.next,x,w;this.remaining;)if(this.remaining--,x=s(i(v,y)),w=this.done=!!x.done,w)return;if(x=s(i(v,y)),w=this.done=!!x.done,!w)return x.value});n({target:"Iterator",proto:!0,real:!0,forced:b},{drop:function(v){s(this);var x;try{x=u(o(+v))}catch(w){l(this,"throw",w)}return g?i(g,this,x):new m(a(this),{remaining:x})}})}),9429:((r,e,t)=>{var n=t(4576),i=t(6193);r.exports=function(s){if(i){try{return n.process.getBuiltinModule(s)}catch{}try{return Function('return require("'+s+'")')()}catch{}}}}),9432:((r,e,t)=>{t(5213)}),9433:((r,e,t)=>{var n=t(4576),i=Object.defineProperty;r.exports=function(s,a){try{i(n,s,{value:a,configurable:!0,writable:!0})}catch{n[s]=a}return a}}),9462:((r,e,t)=>{var n=t(9565),i=t(2360),s=t(6699),a=t(6279),o=t(8227),u=t(1181),l=t(5966),c=t(7657).IteratorPrototype,h=t(2529),d=t(9539),f=t(1385),p=o("toStringTag"),g="IteratorHelper",b="WrapForValidIterator",m="normal",y="throw",v=u.set,x=function(E){var _=u.getterFor(E?b:g);return a(i(c),{next:function(){var k=_(this);if(E)return k.nextHandler();if(k.done)return h(void 0,!0);try{var A=k.nextHandler();return k.returnHandlerResult?A:h(A,k.done)}catch(B){throw k.done=!0,B}},return:function(){var T=_(this),k=T.iterator;if(T.done=!0,E){var A=l(k,"return");return A?n(A,k):h(void 0,!0)}if(T.inner)try{d(T.inner.iterator,m)}catch(B){return d(k,y,B)}if(T.openIters)try{f(T.openIters,m)}catch(B){return d(k,y,B)}return k&&d(k,m),h(void 0,!0)}})},w=x(!0),S=x(!1);s(S,p,"Iterator Helper"),r.exports=function(E,_,T){var k=function(B,D){D?(D.iterator=B.iterator,D.next=B.next):D=B,D.type=_?b:g,D.returnHandlerResult=!!T,D.nextHandler=E,D.counter=0,D.done=!1,v(this,D)};return k.prototype=_?w:S,k}}),9486:((r,e,t)=>{var n=t(6518),i=t(4576),s=t(9504),a=t(3972),o=t(4154),u=t(5169),l=t(2804),c=t(944),h=l.i2c,d=l.i2cUrl,f=s("".charAt),p=i.Uint8Array,g=!p||!p.prototype.toBase64||!(function(){try{var b=new p;b.toBase64(null)}catch{return!0}})();p&&n({target:"Uint8Array",proto:!0,forced:g},{toBase64:function(){var m=o(this),y=arguments.length?a(arguments[0]):void 0,v=c(y)==="base64"?h:d,x=!!y&&!!y.omitPadding;u(this.buffer);for(var w="",S=0,E=m.length,_,T=function(k){return f(v,_>>6*k&63)};S+2<E;S+=3)_=(m[S]<<16)+(m[S+1]<<8)+m[S+2],w+=T(3)+T(2)+T(1)+T(0);return S+2===E?(_=(m[S]<<16)+(m[S+1]<<8),w+=T(3)+T(2)+T(1)+(x?"":"=")):S+1===E&&(_=m[S]<<16,w+=T(3)+T(2)+(x?"":"==")),w}})}),9504:((r,e,t)=>{var n=t(616),i=Function.prototype,s=i.call,a=n&&i.bind.bind(s,s);r.exports=n?a:function(o){return function(){return s.apply(o,arguments)}}}),9519:((r,e,t)=>{var n=t(4576),i=t(2839),s=n.process,a=n.Deno,o=s&&s.versions||a&&a.version,u=o&&o.v8,l,c;u&&(l=u.split("."),c=l[0]>0&&l[0]<4?1:+(l[0]+l[1])),!c&&i&&(l=i.match(/Edge\/(\d+)/),(!l||l[1]>=74)&&(l=i.match(/Chrome\/(\d+)/),l&&(c=+l[1]))),r.exports=c}),9539:((r,e,t)=>{var n=t(9565),i=t(8551),s=t(5966);r.exports=function(a,o,u){var l,c;i(a);try{if(l=s(a,"return"),!l){if(o==="throw")throw u;return u}l=n(l,a)}catch(h){c=!0,l=h}if(o==="throw")throw u;if(c)throw l;return i(l),u}}),9565:((r,e,t)=>{var n=t(616),i=Function.prototype.call;r.exports=n?i.bind(i):function(){return i.apply(i,arguments)}}),9577:((r,e,t)=>{var n=t(9928),i=t(4644),s=t(1108),a=t(1291),o=t(5854),u=i.aTypedArray,l=i.getTypedArrayConstructor,c=i.exportTypedArrayMethod,h=(function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(f){return f===8}})(),d=h&&(function(){try{new Int8Array(1).with(-.5,1)}catch{return!0}})();c("with",function(f,p){var g=u(this),b=a(f),m=s(g)?o(p):+p;return n(g,l(g),b,m)},!h||d)}),9590:((r,e,t)=>{var n=t(1291),i=RangeError;r.exports=function(s){var a=n(s);if(a<0)throw new i("The argument can't be less than 0");return a}}),9617:((r,e,t)=>{var n=t(5397),i=t(5610),s=t(6198),a=function(o){return function(u,l,c){var h=n(u),d=s(h);if(d===0)return!o&&-1;var f=i(c,d),p;if(o&&l!==l){for(;d>f;)if(p=h[f++],p!==p)return!0}else for(;d>f;f++)if((o||f in h)&&h[f]===l)return o||f||0;return!o&&-1}};r.exports={includes:a(!0),indexOf:a(!1)}}),9631:((r,e,t)=>{t(9486)}),9797:((r,e,t)=>{t(4226)}),9835:(r=>{r.exports=function(e){try{var t=new Set,n={size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){return t.clear(),t.add(4),function(){return{done:!0}}}})}},i=t[e](n);return i.size===1&&i.values().next().value===4}catch{return!1}}}),9928:((r,e,t)=>{var n=t(6198),i=t(1291),s=RangeError;r.exports=function(a,o,u,l){var c=n(a),h=i(u),d=h<0?c+h:h;if(d>=c||d<0)throw new s("Incorrect index");for(var f=new o(c),p=0;p<c;p++)f[p]=p===d?l:a[p];return f}})},cE={};function fe(r){var e=cE[r];if(e!==void 0)return e.exports;var t=cE[r]={exports:{}};return d5[r].call(t.exports,t,t.exports,fe),t.exports}fe.d=(r,e)=>{for(var t in e)fe.o(e,t)&&!fe.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})};fe.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e);var oz=fe(4114),uz=fe(6573),lz=fe(8100),cz=fe(7936),hz=fe(8111),dz=fe(8237),fz=fe(1689),pz=fe(9577),gz=fe(4235),mz=fe(9432),bz=fe(1549),yz=fe(9797),vz=fe(9631),wz=fe(5623),xz=fe(4979),Sz=fe(5781),Rt=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),s0=[.001,0,0,.001,0,0],$l=1.35,f5=.35,Ez=f5/$l,Gt={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Sn={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},qa="pdfjs_internal_editor_",ce={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},we={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},p5={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},a0={TRIANGLES:1,LATTICE:2,PATCH:3},ot={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Ul={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},it={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};var ls={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};var Sc={ERRORS:0,WARNINGS:1,INFOS:5},Ka={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},$a={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},g5={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Ec=Sc.WARNINGS;function m5(r){Number.isInteger(r)&&(Ec=r)}function b5(){return Ec}function Ac(r){Ec>=Sc.INFOS&&console.info(`Info: ${r}`)}function ue(r){Ec>=Sc.WARNINGS&&console.warn(`Warning: ${r}`)}function Oe(r){throw new Error(r)}function xe(r,e){r||Oe(e)}function y5(r){switch(r?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function RE(r,e=null,t=null){if(!r)return null;if(t&&typeof r=="string"&&(t.addDefaultProtocol&&r.startsWith("www.")&&r.match(/\./g)?.length>=2&&(r=`http://${r}`),t.tryConvertEncoding))try{r=S5(r)}catch{}let n=e?URL.parse(r,e):URL.parse(r);return y5(n)?n:null}function PE(r,e,t=!1){let n=URL.parse(r);return n?(n.hash=e,n.href):t&&RE(r,"http://example.com")?r.split("#",1)[0]+`${e?`#${e}`:""}`:""}function le(r,e,t,n=!1){return Object.defineProperty(r,e,{value:t,enumerable:!n,configurable:!0,writable:!1}),t}var ai=(function(){function e(t,n){this.message=t,this.name=n}return e.prototype=new Error,e.constructor=e,e})(),zl=class extends ai{constructor(e,t){super(e,"PasswordException"),this.code=t}},Va=class extends ai{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}},Xa=class extends ai{constructor(e){super(e,"InvalidPDFException")}},gs=class extends ai{constructor(e,t,n){super(e,"ResponseException"),this.status=t,this.missing=n}},o0=class extends ai{constructor(e){super(e,"FormatError")}},Dr=class extends ai{constructor(e){super(e,"AbortException")}};function OE(r){(typeof r!="object"||r?.length===void 0)&&Oe("Invalid argument for bytesToString");let e=r.length,t=8192;if(e<t)return String.fromCharCode.apply(null,r);let n=[];for(let i=0;i<e;i+=t){let s=Math.min(i+t,e),a=r.subarray(i,s);n.push(String.fromCharCode.apply(null,a))}return n.join("")}function co(r){typeof r!="string"&&Oe("Invalid argument for stringToBytes");let e=r.length,t=new Uint8Array(e);for(let n=0;n<e;++n)t[n]=r.charCodeAt(n)&255;return t}function v5(r){return String.fromCharCode(r>>24&255,r>>16&255,r>>8&255,r&255)}function w5(){let r=new Uint8Array(4);return r[0]=1,new Uint32Array(r.buffer,0,1)[0]===1}function x5(){try{return new Function(""),!0}catch{return!1}}var Je=class{static get isLittleEndian(){return le(this,"isLittleEndian",w5())}static get isEvalSupported(){return le(this,"isEvalSupported",x5())}static get isOffscreenCanvasSupported(){return le(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return le(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return le(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return le(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){let{platform:e,userAgent:t}=navigator;return le(this,"platform",{isAndroid:t.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:t.includes("Firefox")})}static get isCSSRoundSupported(){return le(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}},Jp=Array.from(Array(256).keys(),r=>r.toString(16).padStart(2,"0")),Q=class{static makeHexColor(e,t,n){return`#${Jp[e]}${Jp[t]}${Jp[n]}`}static domMatrixToTransform(e){return[e.a,e.b,e.c,e.d,e.e,e.f]}static scaleMinMax(e,t){let n;e[0]?(e[0]<0&&(n=t[0],t[0]=t[2],t[2]=n),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(n=t[1],t[1]=t[3],t[3]=n),t[1]*=e[3],t[3]*=e[3]):(n=t[0],t[0]=t[1],t[1]=n,n=t[2],t[2]=t[3],t[3]=n,e[1]<0&&(n=t[1],t[1]=t[3],t[3]=n),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(n=t[0],t[0]=t[2],t[2]=n),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static multiplyByDOMMatrix(e,t){return[e[0]*t.a+e[2]*t.b,e[1]*t.a+e[3]*t.b,e[0]*t.c+e[2]*t.d,e[1]*t.c+e[3]*t.d,e[0]*t.e+e[2]*t.f+e[4],e[1]*t.e+e[3]*t.f+e[5]]}static applyTransform(e,t,n=0){let i=e[n],s=e[n+1];e[n]=i*t[0]+s*t[2]+t[4],e[n+1]=i*t[1]+s*t[3]+t[5]}static applyTransformToBezier(e,t,n=0){let i=t[0],s=t[1],a=t[2],o=t[3],u=t[4],l=t[5];for(let c=0;c<6;c+=2){let h=e[n+c],d=e[n+c+1];e[n+c]=h*i+d*a+u,e[n+c+1]=h*s+d*o+l}}static applyInverseTransform(e,t){let n=e[0],i=e[1],s=t[0]*t[3]-t[1]*t[2];e[0]=(n*t[3]-i*t[2]+t[2]*t[5]-t[4]*t[3])/s,e[1]=(-n*t[1]+i*t[0]+t[4]*t[1]-t[5]*t[0])/s}static axialAlignedBoundingBox(e,t,n){let i=t[0],s=t[1],a=t[2],o=t[3],u=t[4],l=t[5],c=e[0],h=e[1],d=e[2],f=e[3],p=i*c+u,g=p,b=i*d+u,m=b,y=o*h+l,v=y,x=o*f+l,w=x;if(s!==0||a!==0){let S=s*c,E=s*d,_=a*h,T=a*f;p+=_,m+=_,b+=T,g+=T,y+=S,w+=S,x+=E,v+=E}n[0]=Math.min(n[0],p,b,g,m),n[1]=Math.min(n[1],y,x,v,w),n[2]=Math.max(n[2],p,b,g,m),n[3]=Math.max(n[3],y,x,v,w)}static inverseTransform(e){let t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){let n=e[0],i=e[1],s=e[2],a=e[3],o=n**2+i**2,u=n*s+i*a,l=s**2+a**2,c=(o+l)/2,h=Math.sqrt(c**2-(o*l-u**2));t[0]=Math.sqrt(c+h||1),t[1]=Math.sqrt(c-h||1)}static normalizeRect(e){let t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){let n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),i=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>i)return null;let s=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return s>a?null:[n,s,i,a]}static pointBoundingBox(e,t,n){n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],t),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],t)}static rectBoundingBox(e,t,n,i,s){s[0]=Math.min(s[0],e,n),s[1]=Math.min(s[1],t,i),s[2]=Math.max(s[2],e,n),s[3]=Math.max(s[3],t,i)}static#e(e,t,n,i,s,a,o,u,l,c){if(l<=0||l>=1)return;let h=1-l,d=l*l,f=d*l,p=h*(h*(h*e+3*l*t)+3*d*n)+f*i,g=h*(h*(h*s+3*l*a)+3*d*o)+f*u;c[0]=Math.min(c[0],p),c[1]=Math.min(c[1],g),c[2]=Math.max(c[2],p),c[3]=Math.max(c[3],g)}static#t(e,t,n,i,s,a,o,u,l,c,h,d){if(Math.abs(l)<1e-12){Math.abs(c)>=1e-12&&this.#e(e,t,n,i,s,a,o,u,-h/c,d);return}let f=c**2-4*h*l;if(f<0)return;let p=Math.sqrt(f),g=2*l;this.#e(e,t,n,i,s,a,o,u,(-c+p)/g,d),this.#e(e,t,n,i,s,a,o,u,(-c-p)/g,d)}static bezierBoundingBox(e,t,n,i,s,a,o,u,l){l[0]=Math.min(l[0],e,o),l[1]=Math.min(l[1],t,u),l[2]=Math.max(l[2],e,o),l[3]=Math.max(l[3],t,u),this.#t(e,n,s,o,t,i,a,u,3*(-e+3*(n-s)+o),6*(e-2*n+s),3*(n-e),l),this.#t(e,n,s,o,t,i,a,u,3*(-t+3*(i-a)+u),6*(t-2*i+a),3*(i-t),l)}};function S5(r){return decodeURIComponent(escape(r))}var e0=null,hE=null;function E5(r){return e0||(e0=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,hE=new Map([["\uFB05","\u017Ft"]])),r.replaceAll(e0,(e,t,n)=>t?t.normalize("NFKC"):hE.get(n))}function LE(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();let r=new Uint8Array(32);return crypto.getRandomValues(r),OE(r)}var hs="pdfjs_internal_id_";function A5(r,e,t){if(!Array.isArray(t)||t.length<2)return!1;let[n,i,...s]=t;if(!r(n)&&!Number.isInteger(n)||!e(i))return!1;let a=s.length,o=!0;switch(i.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return a===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(a!==4)return!1;o=!1;break;default:return!1}for(let u of s)if(!(typeof u=="number"||o&&u===null))return!1;return!0}function Pt(r,e,t){return Math.min(Math.max(r,e),t)}function NE(r){return Uint8Array.prototype.toBase64?r.toBase64():btoa(OE(r))}function T5(r){return Uint8Array.fromBase64?Uint8Array.fromBase64(r):co(atob(r))}typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(r){return r.reduce((e,t)=>e+t,0)});typeof AbortSignal.any!="function"&&(AbortSignal.any=function(r){let e=new AbortController,{signal:t}=e;for(let n of r)if(n.aborted)return e.abort(n.reason),t;for(let n of r)n.addEventListener("abort",()=>{e.abort(n.reason)},{signal:t});return t});var Az=fe(1701),Tz=fe(4603),_z=fe(7566),Cz=fe(8721),Ya=class r{static textContent(e){let t=[],n={items:t,styles:Object.create(null)};function i(s){if(!s)return;let a=null,o=s.name;if(o==="#text")a=s.value;else if(r.shouldBuildText(o))s?.attributes?.textContent?a=s.attributes.textContent:s.value&&(a=s.value);else return;if(a!==null&&t.push({str:a}),!!s.children)for(let u of s.children)i(u)}return i(e),n}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}},jl=class{static setupStorage(e,t,n,i,s){let a=i.getValue(t,{value:null});switch(n.name){case"textarea":if(a.value!==null&&(e.textContent=a.value),s==="print")break;e.addEventListener("input",o=>{i.setValue(t,{value:o.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(a.value===n.attributes.xfaOn?e.setAttribute("checked",!0):a.value===n.attributes.xfaOff&&e.removeAttribute("checked"),s==="print")break;e.addEventListener("change",o=>{i.setValue(t,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&e.setAttribute("value",a.value),s==="print")break;e.addEventListener("input",o=>{i.setValue(t,{value:o.target.value})})}break;case"select":if(a.value!==null){e.setAttribute("value",a.value);for(let o of n.children)o.attributes.value===a.value?o.attributes.selected=!0:o.attributes.hasOwnProperty("selected")&&delete o.attributes.selected}e.addEventListener("input",o=>{let u=o.target.options,l=u.selectedIndex===-1?"":u[u.selectedIndex].value;i.setValue(t,{value:l})});break}}static setAttributes({html:e,element:t,storage:n=null,intent:i,linkService:s}){let{attributes:a}=t,o=e instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${i}`);for(let[u,l]of Object.entries(a))if(l!=null)switch(u){case"class":l.length&&e.setAttribute(u,l.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",l);break;case"style":Object.assign(e.style,l);break;case"textContent":e.textContent=l;break;default:(!o||u!=="href"&&u!=="newWindow")&&e.setAttribute(u,l)}o&&s.addLinkAttributes(e,a.href,a.newWindow),n&&a.dataId&&this.setupStorage(e,a.dataId,t,n)}static render(e){let t=e.annotationStorage,n=e.linkService,i=e.xfaHtml,s=e.intent||"display",a=document.createElement(i.name);i.attributes&&this.setAttributes({html:a,element:i,intent:s,linkService:n});let o=s!=="richText",u=e.div;if(u.append(a),e.viewport){let h=`matrix(${e.viewport.transform.join(",")})`;u.style.transform=h}o&&u.setAttribute("class","xfaLayer xfaFont");let l=[];if(i.children.length===0){if(i.value){let h=document.createTextNode(i.value);a.append(h),o&&Ya.shouldBuildText(i.name)&&l.push(h)}return{textDivs:l}}let c=[[i,-1,a]];for(;c.length>0;){let[h,d,f]=c.at(-1);if(d+1===h.children.length){c.pop();continue}let p=h.children[++c.at(-1)[1]];if(p===null)continue;let{name:g}=p;if(g==="#text"){let m=document.createTextNode(p.value);l.push(m),f.append(m);continue}let b=p?.attributes?.xmlns?document.createElementNS(p.attributes.xmlns,g):document.createElement(g);if(f.append(b),p.attributes&&this.setAttributes({html:b,element:p,storage:t,intent:s,linkService:n}),p.children?.length>0)c.push([p,-1,b]);else if(p.value){let m=document.createTextNode(p.value);o&&Ya.shouldBuildText(g)&&l.push(m),b.append(m)}}for(let h of u.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))h.setAttribute("readOnly",!0);return{textDivs:l}}static update(e){let t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}},rn="http://www.w3.org/2000/svg",An=class{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF};async function ho(r,e="text"){if(Wa(r,document.baseURI)){let t=await fetch(r);if(!t.ok)throw new Error(t.statusText);switch(e){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"json":return t.json()}return t.text()}return new Promise((t,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),i.responseType=e,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(e){case"arraybuffer":case"blob":case"json":t(i.response);return}t(i.responseText);return}n(new Error(i.statusText))}},i.send(null)})}var Qa=class r{constructor({viewBox:e,userUnit:t,scale:n,rotation:i,offsetX:s=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=e,this.userUnit=t,this.scale=n,this.rotation=i,this.offsetX=s,this.offsetY=a,n*=t;let u=(e[2]+e[0])/2,l=(e[3]+e[1])/2,c,h,d,f;switch(i%=360,i<0&&(i+=360),i){case 180:c=-1,h=0,d=0,f=1;break;case 90:c=0,h=1,d=1,f=0;break;case 270:c=0,h=-1,d=-1,f=0;break;case 0:c=1,h=0,d=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(d=-d,f=-f);let p,g,b,m;c===0?(p=Math.abs(l-e[1])*n+s,g=Math.abs(u-e[0])*n+a,b=(e[3]-e[1])*n,m=(e[2]-e[0])*n):(p=Math.abs(u-e[0])*n+s,g=Math.abs(l-e[1])*n+a,b=(e[2]-e[0])*n,m=(e[3]-e[1])*n),this.transform=[c*n,h*n,d*n,f*n,p-c*n*u-d*n*l,g-h*n*u-f*n*l],this.width=b,this.height=m}get rawDims(){let e=this.viewBox;return le(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:n=this.offsetX,offsetY:i=this.offsetY,dontFlip:s=!1}={}){return new r({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:t,offsetX:n,offsetY:i,dontFlip:s})}convertToViewportPoint(e,t){let n=[e,t];return Q.applyTransform(n,this.transform),n}convertToViewportRectangle(e){let t=[e[0],e[1]];Q.applyTransform(t,this.transform);let n=[e[2],e[3]];return Q.applyTransform(n,this.transform),[t[0],t[1],n[0],n[1]]}convertToPdfPoint(e,t){let n=[e,t];return Q.applyInverseTransform(n,this.transform),n}},Za=class extends ai{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}};function Tc(r){let e=r.length,t=0;for(;t<e&&r[t].trim()==="";)t++;return r.substring(t,t+5).toLowerCase()==="data:"}function zg(r){return typeof r=="string"&&/\.pdf$/i.test(r)}function _5(r){return[r]=r.split(/[#?]/,1),r.substring(r.lastIndexOf("/")+1)}function C5(r,e="document.pdf"){if(typeof r!="string")return e;if(Tc(r))return ue('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;let n=(o=>{try{return new URL(o)}catch{try{return new URL(decodeURIComponent(o))}catch{try{return new URL(o,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(o),"https://foo.bar")}catch{return null}}}}})(r);if(!n)return e;let i=o=>{try{let u=decodeURIComponent(o);return u.includes("/")?(u=u.split("/").at(-1),u.test(/^\.pdf$/i)?u:o):u}catch{return o}},s=/\.pdf$/i,a=n.pathname.split("/").at(-1);if(s.test(a))return i(a);if(n.searchParams.size>0){let o=Array.from(n.searchParams.values()).reverse();for(let l of o)if(s.test(l))return i(l);let u=Array.from(n.searchParams.keys()).reverse();for(let l of u)if(s.test(l))return i(l)}if(n.hash){let u=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(n.hash);if(u)return i(u[0])}return e}var Hl=class{started=Object.create(null);times=[];time(e){e in this.started&&ue(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||ue(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){let e=[],t=0;for(let{name:n}of this.times)t=Math.max(n.length,t);for(let{name:n,start:i,end:s}of this.times)e.push(`${n.padEnd(t)} ${s-i}ms
135
+ `);return e.join("")}};function Wa(r,e){let t=e?URL.parse(r,e):URL.parse(r);return t?.protocol==="http:"||t?.protocol==="https:"}function ur(r){r.preventDefault()}function Ke(r){r.preventDefault(),r.stopPropagation()}function k5(r){console.log("Deprecated API usage: "+r)}var Ja=class{static#e;static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!="string")return null;this.#e||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");let t=this.#e.exec(e);if(!t)return null;let n=parseInt(t[1],10),i=parseInt(t[2],10);i=i>=1&&i<=12?i-1:0;let s=parseInt(t[3],10);s=s>=1&&s<=31?s:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let u=parseInt(t[6],10);u=u>=0&&u<=59?u:0;let l=t[7]||"Z",c=parseInt(t[8],10);c=c>=0&&c<=23?c:0;let h=parseInt(t[9],10)||0;return h=h>=0&&h<=59?h:0,l==="-"?(a+=c,o+=h):l==="+"&&(a-=c,o-=h),new Date(Date.UTC(n,i,s,a,o,u))}};function I5(r,{scale:e=1,rotation:t=0}){let{width:n,height:i}=r.attributes.style,s=[0,0,parseInt(n),parseInt(i)];return new Qa({viewBox:s,userUnit:1,scale:e,rotation:t})}function fo(r){if(r.startsWith("#")){let e=parseInt(r.slice(1),16);return[(e&16711680)>>16,(e&65280)>>8,e&255]}return r.startsWith("rgb(")?r.slice(4,-1).split(",").map(e=>parseInt(e)):r.startsWith("rgba(")?r.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):(ue(`Not a valid color format: "${r}"`),[0,0,0])}function R5(r){let e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(let t of r.keys()){e.style.color=t;let n=window.getComputedStyle(e).color;r.set(t,fo(n))}e.remove()}function He(r){let{a:e,b:t,c:n,d:i,e:s,f:a}=r.getTransform();return[e,t,n,i,s,a]}function Mr(r){let{a:e,b:t,c:n,d:i,e:s,f:a}=r.getTransform().invertSelf();return[e,t,n,i,s,a]}function ti(r,e,t=!1,n=!0){if(e instanceof Qa){let{pageWidth:i,pageHeight:s}=e.rawDims,{style:a}=r,o=Je.isCSSRoundSupported,u=`var(--total-scale-factor) * ${i}px`,l=`var(--total-scale-factor) * ${s}px`,c=o?`round(down, ${u}, var(--scale-round-x))`:`calc(${u})`,h=o?`round(down, ${l}, var(--scale-round-y))`:`calc(${l})`;!t||e.rotation%180===0?(a.width=c,a.height=h):(a.width=h,a.height=c)}n&&r.setAttribute("data-main-rotation",e.rotation)}var nn=class r{constructor(){let{pixelRatio:e}=r;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(e,t,n,i,s=-1){let a=1/0,o=1/0,u=1/0;n=r.capPixels(n,s),n>0&&(a=Math.sqrt(n/(e*t))),i!==-1&&(o=i/e,u=i/t);let l=Math.min(a,o,u);return this.sx>l||this.sy>l?(this.sx=l,this.sy=l,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){let n=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+t/100));return e>0?Math.min(e,n):n}return e}},u0=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"],l0=class{static get isDarkMode(){return le(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}},c0=class{static get commentForegroundColor(){let e=document.createElement("span");e.classList.add("comment","sidebar");let{style:t}=e;t.width=t.height="0",t.display="none",t.color="var(--comment-fg-color)",document.body.append(e);let{color:n}=window.getComputedStyle(e);return e.remove(),le(this,"commentForegroundColor",fo(n))}};function P5(r,e,t,n){n=Math.min(Math.max(n??1,0),1);let i=255*(1-n);return r=Math.round(r*n+i),e=Math.round(e*n+i),t=Math.round(t*n+i),[r,e,t]}function dE(r,e){let t=r[0]/255,n=r[1]/255,i=r[2]/255,s=Math.max(t,n,i),a=Math.min(t,n,i),o=(s+a)/2;if(s===a)e[0]=e[1]=0;else{let u=s-a;switch(e[1]=o<.5?u/(s+a):u/(2-s-a),s){case t:e[0]=((n-i)/u+(n<i?6:0))*60;break;case n:e[0]=((i-t)/u+2)*60;break;case i:e[0]=((t-n)/u+4)*60;break}}e[2]=o}function h0(r,e){let t=r[0],n=r[1],i=r[2],s=(1-Math.abs(2*i-1))*n,a=s*(1-Math.abs(t/60%2-1)),o=i-s/2;switch(Math.floor(t/60)){case 0:e[0]=s+o,e[1]=a+o,e[2]=o;break;case 1:e[0]=a+o,e[1]=s+o,e[2]=o;break;case 2:e[0]=o,e[1]=s+o,e[2]=a+o;break;case 3:e[0]=o,e[1]=a+o,e[2]=s+o;break;case 4:e[0]=a+o,e[1]=o,e[2]=s+o;break;case 5:case 6:e[0]=s+o,e[1]=o,e[2]=a+o;break}}function fE(r){return r<=.03928?r/12.92:((r+.055)/1.055)**2.4}function pE(r,e,t){h0(r,t),t.map(fE);let n=.2126*t[0]+.7152*t[1]+.0722*t[2];h0(e,t),t.map(fE);let i=.2126*t[0]+.7152*t[1]+.0722*t[2];return n>i?(n+.05)/(i+.05):(i+.05)/(n+.05)}var gE=new Map;function O5(r,e){let t=r[0]+r[1]*256+r[2]*65536+e[0]*16777216+e[1]*4294967296+e[2]*1099511627776,n=gE.get(t);if(n)return n;let i=new Float32Array(9),s=i.subarray(0,3),a=i.subarray(3,6);dE(r,a);let o=i.subarray(6,9);dE(e,o);let u=o[2]<.5,l=u?12:4.5;if(a[2]=u?Math.sqrt(a[2]):1-Math.sqrt(1-a[2]),pE(a,o,s)<l){let c,h;u?(c=a[2],h=1):(c=0,h=a[2]);let d=.005;for(;h-c>d;){let f=a[2]=(c+h)/2;u===pE(a,o,s)<l?c=f:h=f}a[2]=u?h:c}return h0(a,s),n=Q.makeHexColor(Math.round(s[0]*255),Math.round(s[1]*255),Math.round(s[2]*255)),gE.set(t,n),n}function ME({html:r,dir:e,className:t},n){let i=document.createDocumentFragment();if(typeof r=="string"){let s=document.createElement("p");s.dir=e||"auto";let a=r.split(/(?:\r\n?|\n)/);for(let o=0,u=a.length;o<u;++o){let l=a[o];s.append(document.createTextNode(l)),o<u-1&&s.append(document.createElement("br"))}i.append(s)}else jl.render({xfaHtml:r,div:i,intent:"richText"});i.firstElementChild.classList.add("richText",t),n.append(i)}function BE(r){let e=new Path2D;if(!r)return e;for(let t=0,n=r.length;t<n;)switch(r[t++]){case $a.moveTo:e.moveTo(r[t++],r[t++]);break;case $a.lineTo:e.lineTo(r[t++],r[t++]);break;case $a.curveTo:e.bezierCurveTo(r[t++],r[t++],r[t++],r[t++],r[t++],r[t++]);break;case $a.quadraticCurveTo:e.quadraticCurveTo(r[t++],r[t++],r[t++],r[t++]);break;case $a.closePath:e.closePath();break;default:ue(`Unrecognized drawing path operator: ${r[t-1]}`);break}return e}var kz=fe(4972),Iz=fe(4628),Rz=fe(7642),Pz=fe(8004),Oz=fe(3853),Lz=fe(5876),Nz=fe(2475),Mz=fe(5024),Bz=fe(1698),Dz=fe(9314),Fz=fe(1148),$z=fe(3579),Uz=fe(8335),d0=class r{#e=null;#t=null;#n;#r=null;#a=null;#s=null;#i=null;#o=null;static#l=null;constructor(e){this.#n=e,r.#l||=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"})}render(){let e=this.#e=document.createElement("div");e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");let t=this.#n._uiManager._signal;t instanceof AbortSignal&&!t.aborted&&(e.addEventListener("contextmenu",ur,{signal:t}),e.addEventListener("pointerdown",r.#u,{signal:t}));let n=this.#r=document.createElement("div");n.className="buttons",e.append(n);let i=this.#n.toolbarPosition;if(i){let{style:s}=e,a=this.#n._uiManager.direction==="ltr"?1-i[0]:i[0];s.insetInlineEnd=`${100*a}%`,s.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return this.#e}static#u(e){e.stopPropagation()}#d(e){this.#n._focusEventsAllowed=!1,Ke(e)}#h(e){this.#n._focusEventsAllowed=!0,Ke(e)}#f(e){let t=this.#n._uiManager._signal;return!(t instanceof AbortSignal)||t.aborted?!1:(e.addEventListener("focusin",this.#d.bind(this),{capture:!0,signal:t}),e.addEventListener("focusout",this.#h.bind(this),{capture:!0,signal:t}),e.addEventListener("contextmenu",ur,{signal:t}),!0)}hide(){this.#e.classList.add("hidden"),this.#t?.hideDropdown()}show(){this.#e.classList.remove("hidden"),this.#a?.shown(),this.#s?.shown()}addDeleteButton(){let{editorType:e,_uiManager:t}=this.#n,n=document.createElement("button");n.classList.add("basic","deleteButton"),n.tabIndex=0,n.setAttribute("data-l10n-id",r.#l[e]),this.#f(n)&&n.addEventListener("click",i=>{t.delete()},{signal:t._signal}),this.#r.append(n)}get#m(){let e=document.createElement("div");return e.className="divider",e}async addAltText(e){let t=await e.render();this.#f(t),this.#r.append(t,this.#m),this.#a=e}addComment(e,t=null){if(this.#s)return;let n=e.renderForToolbar();if(!n)return;this.#f(n);let i=this.#i=this.#m;t?(this.#r.insertBefore(n,t),this.#r.insertBefore(i,t)):this.#r.append(n,i),this.#s=e,e.toolbar=this}addColorPicker(e){if(this.#t)return;this.#t=e;let t=e.renderButton();this.#f(t),this.#r.append(t,this.#m)}async addEditSignatureButton(e){let t=this.#o=await e.renderEditButton(this.#n);this.#f(t),this.#r.append(t,this.#m)}removeButton(e){e==="comment"&&(this.#s?.removeToolbarCommentButton(),this.#s=null,this.#i?.remove(),this.#i=null)}async addButton(e,t){switch(e){case"colorPicker":t&&this.addColorPicker(t);break;case"altText":t&&await this.addAltText(t);break;case"editSignature":t&&await this.addEditSignatureButton(t);break;case"delete":this.addDeleteButton();break;case"comment":t&&this.addComment(t);break}}async addButtonBefore(e,t,n){if(!t&&e==="comment")return;let i=this.#r.querySelector(n);i&&e==="comment"&&this.addComment(t,i)}updateEditSignatureButton(e){this.#o&&(this.#o.title=e)}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}},f0=class{#e=null;#t=null;#n;constructor(e){this.#n=e}#r(){let e=this.#t=document.createElement("div");e.className="editToolbar",e.setAttribute("role","toolbar");let t=this.#n._signal;t instanceof AbortSignal&&!t.aborted&&e.addEventListener("contextmenu",ur,{signal:t});let n=this.#e=document.createElement("div");return n.className="buttons",e.append(n),this.#n.hasCommentManager()&&this.#s("commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{this.#n.commentSelection("floating_button")}),this.#s("highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{this.#n.highlightSelection("floating_button")}),e}#a(e,t){let n=0,i=0;for(let s of e){let a=s.y+s.height;if(a<n)continue;let o=s.x+(t?s.width:0);if(a>n){i=o,n=a;continue}t?o>i&&(i=o):o<i&&(i=o)}return[t?1-i:i,n]}show(e,t,n){let[i,s]=this.#a(t,n),{style:a}=this.#t||=this.#r();e.append(this.#t),a.insetInlineEnd=`${100*i}%`,a.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){this.#t.remove()}#s(e,t,n,i){let s=document.createElement("button");s.classList.add("basic",e),s.tabIndex=0,s.setAttribute("data-l10n-id",t);let a=document.createElement("span");s.append(a),a.className="visuallyHidden",a.setAttribute("data-l10n-id",n);let o=this.#n._signal;o instanceof AbortSignal&&!o.aborted&&(s.addEventListener("contextmenu",ur,{signal:o}),s.addEventListener("click",i,{signal:o})),this.#e.append(s)}};function DE(r,e,t){for(let n of t)e.addEventListener(n,r[n].bind(r))}var xt=class r{static#e=NaN;static#t=null;static#n=NaN;static#r=null;static initializeAndAddPointerId(e){(r.#t||=new Set).add(e)}static setPointer(e,t){r.#e||=t,r.#r??=e}static setTimeStamp(e){r.#n=e}static isSamePointerId(e){return r.#e===e}static isSamePointerIdOrRemove(e){return r.#e===e?!0:(r.#t?.delete(e),!1)}static isSamePointerType(e){return r.#r===e}static isInitializedAndDifferentPointerType(e){return r.#r!==null&&!r.isSamePointerType(e)}static isSameTimeStamp(e){return r.#n===e}static isUsingMultiplePointers(){return r.#t?.size>=1}static clearPointerType(){r.#r=null}static clearPointerIds(){r.#e=NaN,r.#t=null}static clearTimeStamp(){r.#n=NaN}},p0=class{#e=0;get id(){return`${qa}${this.#e++}`}},g0=class r{#e=LE();#t=0;#n=null;static get _isSVGFittingCanvas(){let e='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',n=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),i=new Image;i.src=e;let s=i.decode().then(()=>(n.drawImage(i,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return le(this,"_isSVGFittingCanvas",s)}async#r(e,t){this.#n||=new Map;let n=this.#n.get(e);if(n===null)return null;if(n?.bitmap)return n.refCounter+=1,n;try{n||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let i;if(typeof t=="string"?(n.url=t,i=await ho(t,"blob")):t instanceof File?i=n.file=t:t instanceof Blob&&(i=t),i.type==="image/svg+xml"){let s=r._isSVGFittingCanvas,a=new FileReader,o=new Image,u=new Promise((l,c)=>{o.onload=()=>{n.bitmap=o,n.isSvg=!0,l()},a.onload=async()=>{let h=n.svgUrl=a.result;o.src=await s?`${h}#svgView(preserveAspectRatio(none))`:h},o.onerror=a.onerror=c});a.readAsDataURL(i),await u}else n.bitmap=await createImageBitmap(i);n.refCounter=1}catch(i){ue(i),n=null}return this.#n.set(e,n),n&&this.#n.set(n.id,n),n}async getFromFile(e){let{lastModified:t,name:n,size:i,type:s}=e;return this.#r(`${t}_${n}_${i}_${s}`,e)}async getFromUrl(e){return this.#r(e,e)}async getFromBlob(e,t){let n=await t;return this.#r(e,n)}async getFromId(e){this.#n||=new Map;let t=this.#n.get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){let{blobPromise:n}=t;return delete t.blobPromise,this.getFromBlob(t.id,n)}return this.getFromUrl(t.url)}getFromCanvas(e,t){this.#n||=new Map;let n=this.#n.get(e);if(n?.bitmap)return n.refCounter+=1,n;let i=new OffscreenCanvas(t.width,t.height);return i.getContext("2d").drawImage(t,0,0),n={bitmap:i.transferToImageBitmap(),id:`image_${this.#e}_${this.#t++}`,refCounter:1,isSvg:!1},this.#n.set(e,n),this.#n.set(n.id,n),n}getSvgUrl(e){let t=this.#n.get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){this.#n||=new Map;let t=this.#n.get(e);if(!t||(t.refCounter-=1,t.refCounter!==0))return;let{bitmap:n}=t;if(!t.url&&!t.file){let i=new OffscreenCanvas(n.width,n.height);i.getContext("bitmaprenderer").transferFromImageBitmap(n),t.blobPromise=i.convertToBlob()}n.close?.(),t.bitmap=null}isValidId(e){return e.startsWith(`image_${this.#e}_`)}},m0=class{#e=[];#t=!1;#n;#r=-1;constructor(e=128){this.#n=e}add({cmd:e,undo:t,post:n,mustExec:i,type:s=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(i&&e(),this.#t)return;let u={cmd:e,undo:t,post:n,type:s};if(this.#r===-1){this.#e.length>0&&(this.#e.length=0),this.#r=0,this.#e.push(u);return}if(a&&this.#e[this.#r].type===s){o&&(u.undo=this.#e[this.#r].undo),this.#e[this.#r]=u;return}let l=this.#r+1;l===this.#n?this.#e.splice(0,1):(this.#r=l,l<this.#e.length&&this.#e.splice(l)),this.#e.push(u)}undo(){if(this.#r===-1)return;this.#t=!0;let{undo:e,post:t}=this.#e[this.#r];e(),t?.(),this.#t=!1,this.#r-=1}redo(){if(this.#r<this.#e.length-1){this.#r+=1,this.#t=!0;let{cmd:e,post:t}=this.#e[this.#r];e(),t?.(),this.#t=!1}}hasSomethingToUndo(){return this.#r!==-1}hasSomethingToRedo(){return this.#r<this.#e.length-1}cleanType(e){if(this.#r!==-1){for(let t=this.#r;t>=0;t--)if(this.#e[t].type!==e){this.#e.splice(t+1,this.#r-t),this.#r=t;return}this.#e.length=0,this.#r=-1}}destroy(){this.#e=null}},ri=class{constructor(e){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:t}=Je.platform;for(let[n,i,s={}]of e)for(let a of n){let o=a.startsWith("mac+");t&&o?(this.callbacks.set(a.slice(4),{callback:i,options:s}),this.allKeys.add(a.split("+").at(-1))):!t&&!o&&(this.callbacks.set(a,{callback:i,options:s}),this.allKeys.add(a.split("+").at(-1)))}}#e(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);let t=this.buffer.join("+");return this.buffer.length=0,t}exec(e,t){if(!this.allKeys.has(t.key))return;let n=this.callbacks.get(this.#e(t));if(!n)return;let{callback:i,options:{bubbles:s=!1,args:a=[],checker:o=null}}=n;o&&!o(e,t)||(i.bind(e,...a,t)(),s||Ke(t))}},b0=class r{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){let e=new Map([["CanvasText",null],["Canvas",null]]);return R5(e),le(this,"_colors",e)}convert(e){let t=fo(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(let[n,i]of this._colors)if(i.every((s,a)=>s===t[a]))return r._colorsMapping.get(n);return t}getHexCode(e){let t=this._colors.get(e);return t?Q.makeHexColor(...t):e}},ni=class r{#e=new AbortController;#t=null;#n=null;#r=new Map;#a=new Map;#s=null;#i=null;#o=null;#l=new m0;#u=null;#d=null;#h=null;#f=0;#m=new Set;#g=null;#c=null;#p=new Set;_editorUndoBar=null;#b=!1;#v=!1;#y=!1;#T=null;#E=null;#x=null;#C=null;#w=!1;#A=null;#R=new p0;#k=!1;#I=!1;#D=!1;#O=null;#N=null;#F=null;#M=null;#W=null;#_=ce.NONE;#S=new Set;#L=null;#$=null;#z=null;#q=null;#G=null;#K={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#j=[0,0];#B=null;#V=null;#Z=null;#J=null;#U=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let e=r.prototype,t=a=>a.#V.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),n=(a,{target:o})=>{if(o instanceof HTMLInputElement){let{type:u}=o;return u!=="text"&&u!=="number"}return!0},i=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return le(this,"_keyboardManager",new ri([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],e.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:n}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:n}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&a.#V.contains(o)&&!a.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&a.#V.contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-s,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[s,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-s],checker:t}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,s],checker:t}]]))}constructor(e,t,n,i,s,a,o,u,l,c,h,d,f,p,g,b){let m=this._signal=this.#e.signal;this.#V=e,this.#Z=t,this.#J=n,this.#s=i,this.#u=s,this.#$=a,this.#G=u,this._eventBus=o,o._on("editingaction",this.onEditingAction.bind(this),{signal:m}),o._on("pagechanging",this.onPageChanging.bind(this),{signal:m}),o._on("scalechanging",this.onScaleChanging.bind(this),{signal:m}),o._on("rotationchanging",this.onRotationChanging.bind(this),{signal:m}),o._on("setpreference",this.onSetPreference.bind(this),{signal:m}),o._on("switchannotationeditorparams",y=>this.updateParams(y.type,y.value),{signal:m}),window.addEventListener("pointerdown",()=>{this.#I=!0},{capture:!0,signal:m}),window.addEventListener("pointerup",()=>{this.#I=!1},{capture:!0,signal:m}),this.#ae(),this.#de(),this.#te(),this.#i=u.annotationStorage,this.#T=u.filterFactory,this.#z=l,this.#C=c||null,this.#b=h,this.#v=d,this.#y=f,this.#W=p||null,this.viewParameters={realScale:An.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=g||null,this._supportsPinchToZoom=b!==!1,s?.setSidebarUiManager(this)}destroy(){this.#U?.resolve(),this.#U=null,this.#e?.abort(),this.#e=null,this._signal=null;for(let e of this.#a.values())e.destroy();this.#a.clear(),this.#r.clear(),this.#p.clear(),this.#M?.clear(),this.#t=null,this.#S.clear(),this.#l.destroy(),this.#s?.destroy(),this.#u?.destroy(),this.#$?.destroy(),this.#A?.hide(),this.#A=null,this.#F?.destroy(),this.#F=null,this.#n=null,this.#E&&(clearTimeout(this.#E),this.#E=null),this.#B&&(clearTimeout(this.#B),this.#B=null),this._editorUndoBar?.destroy(),this.#G=null}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#W}get useNewAltTextFlow(){return this.#v}get useNewAltTextWhenAddingImage(){return this.#y}get hcmFilter(){return le(this,"hcmFilter",this.#z?this.#T.addHCMFilter(this.#z.foreground,this.#z.background):"none")}get direction(){return le(this,"direction",getComputedStyle(this.#V).direction)}get _highlightColors(){return le(this,"_highlightColors",this.#C?new Map(this.#C.split(",").map(e=>(e=e.split("=").map(t=>t.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){let{_highlightColors:e}=this;if(!e)return le(this,"highlightColors",null);let t=new Map,n=!!this.#z;for(let[i,s]of e){let a=i.endsWith("_HCM");if(n&&a){t.set(i.replace("_HCM",""),s);continue}!n&&!a&&t.set(i,s)}return le(this,"highlightColors",t)}get highlightColorNames(){return le(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;let t=this.highlightColorNames.get(e);return this._highlightColors.get(t)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),this.#h=e}setMainHighlightColorPicker(e){this.#F=e}editAltText(e,t=!1){this.#s?.editAltText(this,e,t)}hasCommentManager(){return!!this.#u}editComment(e,t,n,i){this.#u?.showDialog(this,e,t,n,i)}selectComment(e,t){this.#a.get(e)?.getEditorByUID(t)?.toggleComment(!0,!0)}updateComment(e){this.#u?.updateComment(e.getData())}updatePopupColor(e){this.#u?.updatePopupColor(e)}removeComment(e){this.#u?.removeComments([e.uid])}toggleComment(e,t,n=void 0){this.#u?.toggleCommentPopup(e,t,n)}makeCommentColor(e,t){return e&&this.#u?.makeCommentColor(e,t)||null}getCommentDialogElement(){return this.#u?.dialogElement||null}async waitForEditorsRendered(e){if(this.#a.has(e-1))return;let{resolve:t,promise:n}=Promise.withResolvers(),i=s=>{s.pageNumber===e&&(this._eventBus._off("editorsrendered",i),t())};this._eventBus.on("editorsrendered",i),await n}getSignature(e){this.#$?.getSignature({uiManager:this,editor:e})}get signatureManager(){return this.#$}switchToMode(e,t){this._eventBus.on("annotationeditormodechanged",t,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch("setpreference",{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){e==="enableNewAltTextWhenAddingImage"&&(this.#y=t)}onPageChanging({pageNumber:e}){this.#f=e-1}focusMainContainer(){this.#V.focus()}findParent(e,t){for(let n of this.#a.values()){let{x:i,y:s,width:a,height:o}=n.div.getBoundingClientRect();if(e>=i&&e<=i+a&&t>=s&&t<=s+o)return n}return null}disableUserSelect(e=!1){this.#Z.classList.toggle("noUserSelect",e)}addShouldRescale(e){this.#p.add(e)}removeShouldRescale(e){this.#p.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*An.PDF_TO_CSS_UNITS;for(let t of this.#p)t.onScaleChanging();this.#h?.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#Q({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#ee(e){let{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(let n of this.#a.values())if(n.hasTextLayer(e))return n;return null}highlightSelection(e="",t=!1){let n=document.getSelection();if(!n||n.isCollapsed)return;let{anchorNode:i,anchorOffset:s,focusNode:a,focusOffset:o}=n,u=n.toString(),c=this.#Q(n).closest(".textLayer"),h=this.getSelectionBoxes(c);if(!h)return;n.empty();let d=this.#ee(c),f=this.#_===ce.NONE,p=()=>{let g=d?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:h,anchorNode:i,anchorOffset:s,focusNode:a,focusOffset:o,text:u});f&&this.showAllEditors("highlight",!0,!0),t&&g?.editComment()};if(f){this.switchToMode(ce.HIGHLIGHT,p);return}p()}commentSelection(e=""){this.highlightSelection(e,!0)}#ie(){let e=document.getSelection();if(!e||e.isCollapsed)return;let n=this.#Q(e).closest(".textLayer"),i=this.getSelectionBoxes(n);i&&(this.#A||=new f0(this),this.#A.show(n,i,this.direction==="ltr"))}getAndRemoveDataFromAnnotationStorage(e){if(!this.#i)return null;let t=`${qa}${e}`,n=this.#i.getRawValue(t);return n&&this.#i.remove(t),n}addToAnnotationStorage(e){!e.isEmpty()&&this.#i&&!this.#i.has(e.id)&&this.#i.setValue(e.id,e)}a11yAlert(e,t=null){let n=this.#J;n&&(n.setAttribute("data-l10n-id",e),t?n.setAttribute("data-l10n-args",JSON.stringify(t)):n.removeAttribute("data-l10n-args"))}#se(){let e=document.getSelection();if(!e||e.isCollapsed){this.#L&&(this.#A?.hide(),this.#L=null,this.#P({hasSelectedText:!1}));return}let{anchorNode:t}=e;if(t===this.#L)return;let i=this.#Q(e).closest(".textLayer");if(!i){this.#L&&(this.#A?.hide(),this.#L=null,this.#P({hasSelectedText:!1}));return}if(this.#A?.hide(),this.#L=t,this.#P({hasSelectedText:!0}),!(this.#_!==ce.HIGHLIGHT&&this.#_!==ce.NONE)&&(this.#_===ce.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#w=this.isShiftKeyDown,!this.isShiftKeyDown)){let s=this.#_===ce.HIGHLIGHT?this.#ee(i):null;if(s?.toggleDrawing(),this.#I){let a=new AbortController,o=this.combinedSignal(a),u=l=>{l.type==="pointerup"&&l.button!==0||(a.abort(),s?.toggleDrawing(!0),l.type==="pointerup"&&this.#X("main_toolbar"))};window.addEventListener("pointerup",u,{signal:o}),window.addEventListener("blur",u,{signal:o})}else s?.toggleDrawing(!0),this.#X("main_toolbar")}}#X(e=""){this.#_===ce.HIGHLIGHT?this.highlightSelection(e):this.#b&&this.#ie()}#ae(){document.addEventListener("selectionchange",this.#se.bind(this),{signal:this._signal})}#oe(){if(this.#x)return;this.#x=new AbortController;let e=this.combinedSignal(this.#x);window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})}#ue(){this.#x?.abort(),this.#x=null}blur(){if(this.isShiftKeyDown=!1,this.#w&&(this.#w=!1,this.#X("main_toolbar")),!this.hasSelection)return;let{activeElement:e}=document;for(let t of this.#S)if(t.div.contains(e)){this.#N=[t,e],t._focusEventsAllowed=!1;break}}focus(){if(!this.#N)return;let[e,t]=this.#N;this.#N=null,t.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}#te(){if(this.#O)return;this.#O=new AbortController;let e=this.combinedSignal(this.#O);window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})}#le(){this.#O?.abort(),this.#O=null}#ce(){if(this.#d)return;this.#d=new AbortController;let e=this.combinedSignal(this.#d);document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})}#he(){this.#d?.abort(),this.#d=null}#de(){let e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})}addEditListeners(){this.#te(),this.setEditingState(!0)}removeEditListeners(){this.#le(),this.setEditingState(!1)}dragOver(e){for(let{type:t}of e.dataTransfer.items)for(let n of this.#c)if(n.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(let t of e.dataTransfer.items)for(let n of this.#c)if(n.isHandlingMimeForPasting(t.type)){n.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){if(e.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;let t=[];for(let n of this.#S){let i=n.serialize(!0);i&&t.push(i)}t.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();let{clipboardData:t}=e;for(let s of t.items)for(let a of this.#c)if(a.isHandlingMimeForPasting(s.type)){a.paste(s,this.currentLayer);return}let n=t.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(s){ue(`paste: "${s.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();let i=this.currentLayer;try{let s=[];for(let u of n){let l=await i.deserialize(u);if(!l)return;s.push(l)}let a=()=>{for(let u of s)this.#re(u);this.#ne(s)},o=()=>{for(let u of s)u.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(s){ue(`paste: "${s.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),this.#_!==ce.NONE&&!this.isEditorHandlingKeyboard&&r._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,this.#w&&(this.#w=!1,this.#X("main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}#P(e){Object.entries(e).some(([n,i])=>this.#K[n]!==i)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#K,e)}),this.#_===ce.HIGHLIGHT&&e.hasSelectedEditor===!1&&this.#H([[we.HIGHLIGHT_FREE,!0]]))}#H(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){e?(this.#oe(),this.#ce(),this.#P({isEditing:this.#_!==ce.NONE,isEmpty:this.#Y(),hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:this.#l.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ue(),this.#he(),this.#P({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#c){this.#c=e;for(let t of this.#c)this.#H(t.defaultPropertiesToUpdate)}}getId(){return this.#R.id}get currentLayer(){return this.#a.get(this.#f)}getLayer(e){return this.#a.get(e)}get currentPageIndex(){return this.#f}addLayer(e){this.#a.set(e.pageIndex,e),this.#k?e.enable():e.disable()}removeLayer(e){this.#a.delete(e.pageIndex)}async updateMode(e,t=null,n=!1,i=!1,s=!1,a=!1){if(this.#_!==e&&!(this.#U&&(await this.#U.promise,!this.#U))){if(this.#U=Promise.withResolvers(),this.#h?.commitOrRemove(),this.#_===ce.POPUP&&this.#u?.hideSidebar(),this.#u?.destroyPopup(),this.#_=e,e===ce.NONE){this.setEditingState(!1),this.#pe();for(let o of this.#r.values())o.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#U.resolve();return}for(let o of this.#r.values())o.addStandaloneCommentButton();e===ce.SIGNATURE&&await this.#$?.loadSignatures(),n&&xt.clearPointerType(),this.setEditingState(!0),await this.#fe(),this.unselectAll();for(let o of this.#a.values())o.updateMode(e);if(e===ce.POPUP){this.#n||=await this.#G.getAnnotationsByType(new Set(this.#c.map(l=>l._editorType)));let o=new Set,u=[];for(let l of this.#r.values()){let{annotationElementId:c,hasComment:h,deleted:d}=l;c&&o.add(c),h&&!d&&u.push(l.getData())}for(let l of this.#n){let{id:c,popupRef:h,contentsObj:d}=l;h&&d?.str&&!o.has(c)&&!this.#m.has(c)&&u.push(l)}this.#u?.showSidebar(u)}if(!t){i&&this.addNewEditorFromKeyboard(),this.#U.resolve();return}for(let o of this.#r.values())o.uid===t?(this.setSelected(o),a?o.editComment():s?o.enterInEditMode():o.focus()):o.unselect();this.#U.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==this.#_&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,t){if(this.#c){switch(e){case we.CREATE:this.currentLayer.addNewEditor(t);return;case we.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#q||=new Map).set(e,t),this.showAllEditors("highlight",t);break}if(this.hasSelection)for(let n of this.#S)n.updateParams(e,t);else for(let n of this.#c)n.updateDefaultParams(e,t)}}showAllEditors(e,t,n=!1){for(let s of this.#r.values())s.editorType===e&&s.show(t);(this.#q?.get(we.HIGHLIGHT_SHOW_ALL)??!0)!==t&&this.#H([[we.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(this.#D!==e){this.#D=e;for(let t of this.#a.values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}async#fe(){if(!this.#k){this.#k=!0;let e=[];for(let t of this.#a.values())e.push(t.enable());await Promise.all(e);for(let t of this.#r.values())t.enable()}}#pe(){if(this.unselectAll(),this.#k){this.#k=!1;for(let e of this.#a.values())e.disable();for(let e of this.#r.values())e.disable()}}*getEditors(e){for(let t of this.#r.values())t.pageIndex===e&&(yield t)}getEditor(e){return this.#r.get(e)}addEditor(e){this.#r.set(e.id,e)}removeEditor(e){e.div.contains(document.activeElement)&&(this.#E&&clearTimeout(this.#E),this.#E=setTimeout(()=>{this.focusMainContainer(),this.#E=null},0)),this.#r.delete(e.id),e.annotationElementId&&this.#M?.delete(e.annotationElementId),this.unselect(e),(!e.annotationElementId||!this.#m.has(e.annotationElementId))&&this.#i?.remove(e.id)}addDeletedAnnotationElement(e){this.#m.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#m.has(e)}removeDeletedAnnotationElement(e){this.#m.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#re(e){let t=this.#a.get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}setActiveEditor(e){this.#t!==e&&(this.#t=e,e&&this.#H(e.propertiesToUpdate))}get#ge(){let e=null;for(e of this.#S);return e}updateUI(e){this.#ge===e&&this.#H(e.propertiesToUpdate)}updateUIForDefaultProperties(e){this.#H(e.defaultPropertiesToUpdate)}toggleSelected(e){if(this.#S.has(e)){this.#S.delete(e),e.unselect(),this.#P({hasSelectedEditor:this.hasSelection});return}this.#S.add(e),e.select(),this.#H(e.propertiesToUpdate),this.#P({hasSelectedEditor:!0})}setSelected(e){this.updateToolbar({mode:e.mode,editId:e.uid}),this.#h?.commitOrRemove();for(let t of this.#S)t!==e&&t.unselect();this.#S.clear(),this.#S.add(e),e.select(),this.#H(e.propertiesToUpdate),this.#P({hasSelectedEditor:!0})}isSelected(e){return this.#S.has(e)}get firstSelectedEditor(){return this.#S.values().next().value}unselect(e){e.unselect(),this.#S.delete(e),this.#P({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#S.size!==0}get isEnterHandled(){return this.#S.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#l.undo(),this.#P({hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#Y()}),this._editorUndoBar?.hide()}redo(){this.#l.redo(),this.#P({hasSomethingToUndo:!0,hasSomethingToRedo:this.#l.hasSomethingToRedo(),isEmpty:this.#Y()})}addCommands(e){this.#l.add(e),this.#P({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#Y()})}cleanUndoStack(e){this.#l.cleanType(e)}#Y(){if(this.#r.size===0)return!0;if(this.#r.size===1)for(let e of this.#r.values())return e.isEmpty();return!1}delete(){this.commitOrRemove();let e=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!e)return;let t=e?[e]:[...this.#S],n=()=>{this._editorUndoBar?.show(i,t.length===1?t[0].editorType:t.length);for(let s of t)s.remove()},i=()=>{for(let s of t)this.#re(s)};this.addCommands({cmd:n,undo:i,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#ne(e){for(let t of this.#S)t.unselect();this.#S.clear();for(let t of e)t.isEmpty()||(this.#S.add(t),t.select());this.#P({hasSelectedEditor:this.hasSelection})}selectAll(){for(let e of this.#S)e.commit();this.#ne(this.#r.values())}unselectAll(){if(!(this.#t&&(this.#t.commitOrRemove(),this.#_!==ce.NONE))&&!this.#h?.commitOrRemove()&&this.hasSelection){for(let e of this.#S)e.unselect();this.#S.clear(),this.#P({hasSelectedEditor:!1})}}translateSelectedEditors(e,t,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#j[0]+=e,this.#j[1]+=t;let[i,s]=this.#j,a=[...this.#S],o=1e3;this.#B&&clearTimeout(this.#B),this.#B=setTimeout(()=>{this.#B=null,this.#j[0]=this.#j[1]=0,this.addCommands({cmd:()=>{for(let u of a)this.#r.has(u.id)&&(u.translateInPage(i,s),u.translationDone())},undo:()=>{for(let u of a)this.#r.has(u.id)&&(u.translateInPage(-i,-s),u.translationDone())},mustExec:!1})},o);for(let u of a)u.translateInPage(e,t),u.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#g=new Map;for(let e of this.#S)this.#g.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#g)return!1;this.disableUserSelect(!1);let e=this.#g;this.#g=null;let t=!1;for(let[{x:i,y:s,pageIndex:a},o]of e)o.newX=i,o.newY=s,o.newPageIndex=a,t||=i!==o.savedX||s!==o.savedY||a!==o.savedPageIndex;if(!t)return!1;let n=(i,s,a,o)=>{if(this.#r.has(i.id)){let u=this.#a.get(o);u?i._setParentAndPosition(u,s,a):(i.pageIndex=o,i.x=s,i.y=a)}};return this.addCommands({cmd:()=>{for(let[i,{newX:s,newY:a,newPageIndex:o}]of e)n(i,s,a,o)},undo:()=>{for(let[i,{savedX:s,savedY:a,savedPageIndex:o}]of e)n(i,s,a,o)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(this.#g)for(let n of this.#g.keys())n.drag(e,t)}rebuild(e){if(e.parent===null){let t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#S.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#t===e}getActive(){return this.#t}getMode(){return this.#_}isEditingMode(){return this.#_!==ce.NONE}get imageManager(){return le(this,"imageManager",new g0)}getSelectionBoxes(e){if(!e)return null;let t=document.getSelection();for(let l=0,c=t.rangeCount;l<c;l++)if(!e.contains(t.getRangeAt(l).commonAncestorContainer))return null;let{x:n,y:i,width:s,height:a}=e.getBoundingClientRect(),o;switch(e.getAttribute("data-main-rotation")){case"90":o=(l,c,h,d)=>({x:(c-i)/a,y:1-(l+h-n)/s,width:d/a,height:h/s});break;case"180":o=(l,c,h,d)=>({x:1-(l+h-n)/s,y:1-(c+d-i)/a,width:h/s,height:d/a});break;case"270":o=(l,c,h,d)=>({x:1-(c+d-i)/a,y:(l-n)/s,width:d/a,height:h/s});break;default:o=(l,c,h,d)=>({x:(l-n)/s,y:(c-i)/a,width:h/s,height:d/a});break}let u=[];for(let l=0,c=t.rangeCount;l<c;l++){let h=t.getRangeAt(l);if(!h.collapsed)for(let{x:d,y:f,width:p,height:g}of h.getClientRects())p===0||g===0||u.push(o(d,f,p,g))}return u.length===0?null:u}addChangedExistingAnnotation({annotationElementId:e,id:t}){(this.#o||=new Map).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){this.#o?.delete(e)}renderAnnotationElement(e){let t=this.#o?.get(e.data.id);if(!t)return;let n=this.#i.getRawValue(t);n&&(this.#_===ce.NONE&&!n.hasBeenModified||n.renderAnnotationElement(e))}setMissingCanvas(e,t,n){let i=this.#M?.get(e);i&&(i.setCanvas(t,n),this.#M.delete(e))}addMissingCanvas(e,t){(this.#M||=new Map).set(e,t)}},Wl=class r{#e=null;#t=!1;#n=null;#r=null;#a=null;#s=null;#i=!1;#o=null;#l=null;#u=null;#d=null;#h=!1;static#f=null;static _l10n=null;constructor(e){this.#l=e,this.#h=e._uiManager.useNewAltTextFlow,r.#f||=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"})}static initialize(e){r._l10n??=e}async render(){let e=this.#n=document.createElement("button");e.className="altText",e.tabIndex="0";let t=this.#r=document.createElement("span");e.append(t),this.#h?(e.classList.add("new"),e.setAttribute("data-l10n-id",r.#f.missing),t.setAttribute("data-l10n-id",r.#f["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));let n=this.#l._uiManager._signal;e.addEventListener("contextmenu",ur,{signal:n}),e.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:n});let i=s=>{s.preventDefault(),this.#l._uiManager.editAltText(this.#l),this.#h&&this.#l._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#m}})};return e.addEventListener("click",i,{capture:!0,signal:n}),e.addEventListener("keydown",s=>{s.target===e&&s.key==="Enter"&&(this.#i=!0,i(s))},{signal:n}),await this.#g(),e}get#m(){return this.#e&&"added"||this.#e===null&&this.guessedText&&"review"||"missing"}finish(){this.#n&&(this.#n.focus({focusVisible:this.#i}),this.#i=!1)}isEmpty(){return this.#h?this.#e===null:!this.#e&&!this.#t}hasData(){return this.#h?this.#e!==null||!!this.#u:this.isEmpty()}get guessedText(){return this.#u}async setGuessedText(e){this.#e===null&&(this.#u=e,this.#d=await r._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e}),this.#g())}toggleAltTextBadge(e=!1){if(!this.#h||this.#e){this.#o?.remove(),this.#o=null;return}if(!this.#o){let t=this.#o=document.createElement("div");t.className="noAltTextBadge",this.#l.div.append(t)}this.#o.classList.toggle("hidden",!e)}serialize(e){let t=this.#e;return!e&&this.#u===t&&(t=this.#d),{altText:t,decorative:this.#t,guessedText:this.#u,textWithDisclaimer:this.#d}}get data(){return{altText:this.#e,decorative:this.#t}}set data({altText:e,decorative:t,guessedText:n,textWithDisclaimer:i,cancel:s=!1}){n&&(this.#u=n,this.#d=i),!(this.#e===e&&this.#t===t)&&(s||(this.#e=e,this.#t=t),this.#g())}toggle(e=!1){this.#n&&(!e&&this.#s&&(clearTimeout(this.#s),this.#s=null),this.#n.disabled=!e)}shown(){this.#l._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#m}})}destroy(){this.#n?.remove(),this.#n=null,this.#r=null,this.#a=null,this.#o?.remove(),this.#o=null}async#g(){let e=this.#n;if(!e)return;if(this.#h){if(e.classList.toggle("done",!!this.#e),e.setAttribute("data-l10n-id",r.#f[this.#m]),this.#r?.setAttribute("data-l10n-id",r.#f[`${this.#m}-label`]),!this.#e){this.#a?.remove();return}}else{if(!this.#e&&!this.#t){e.classList.remove("done"),this.#a?.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let t=this.#a;if(!t){this.#a=t=document.createElement("span"),t.className="tooltip",t.setAttribute("role","tooltip"),t.id=`alt-text-tooltip-${this.#l.id}`;let i=100,s=this.#l._uiManager._signal;s.addEventListener("abort",()=>{clearTimeout(this.#s),this.#s=null},{once:!0}),e.addEventListener("mouseenter",()=>{this.#s=setTimeout(()=>{this.#s=null,this.#a.classList.add("show"),this.#l._reportTelemetry({action:"alt_text_tooltip"})},i)},{signal:s}),e.addEventListener("mouseleave",()=>{this.#s&&(clearTimeout(this.#s),this.#s=null),this.#a?.classList.remove("show")},{signal:s})}this.#t?t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(t.removeAttribute("data-l10n-id"),t.textContent=this.#e),t.parentNode||e.append(t),this.#l.getElementForAltText()?.setAttribute("aria-describedby",t.id)}},ds=class{#e=null;#t=null;#n=!1;#r=null;#a=null;#s=null;#i=null;#o=null;#l=!1;#u=null;constructor(e){this.#r=e}renderForToolbar(){let e=this.#t=document.createElement("button");return e.className="comment",this.#d(e,!1)}renderForStandalone(){let e=this.#e=document.createElement("button");e.className="annotationCommentButton";let t=this.#r.commentButtonPosition;if(t){let{style:n}=e;n.insetInlineEnd=`calc(${100*(this.#r._uiManager.direction==="ltr"?1-t[0]:t[0])}% - var(--comment-button-dim))`,n.top=`calc(${100*t[1]}% - var(--comment-button-dim))`;let i=this.#r.commentButtonColor;i&&(n.backgroundColor=i)}return this.#d(e,!0)}focusButton(){setTimeout(()=>{(this.#e??this.#t)?.focus()},0)}onUpdatedColor(){if(!this.#e)return;let e=this.#r.commentButtonColor;e&&(this.#e.style.backgroundColor=e),this.#r._uiManager.updatePopupColor(this.#r)}get commentButtonWidth(){return(this.#e?.getBoundingClientRect().width??0)/this.#r.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#u)return this.#u;if(!this.#e)return null;let{x:e,y:t,height:n}=this.#e.getBoundingClientRect(),{x:i,y:s,width:a,height:o}=this.#r.parent.boundingClientRect;return[(e-i)/a,(t+n-s)/o]}set commentPopupPositionInLayer(e){this.#u=e}hasDefaultPopupPosition(){return this.#u===null}removeStandaloneCommentButton(){this.#e?.remove(),this.#e=null}removeToolbarCommentButton(){this.#t?.remove(),this.#t=null}setCommentButtonStates({selected:e,hasPopup:t}){this.#e&&(this.#e.classList.toggle("selected",e),this.#e.ariaExpanded=t)}#d(e,t){if(!this.#r._uiManager.hasCommentManager())return null;e.tabIndex="0",e.ariaHasPopup="dialog",t?(e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(e.ariaControlsElements=[this.#r._uiManager.getCommentDialogElement()],e.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));let n=this.#r._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return e;e.addEventListener("contextmenu",ur,{signal:n}),t&&(e.addEventListener("focusin",s=>{this.#r._focusEventsAllowed=!1,Ke(s)},{capture:!0,signal:n}),e.addEventListener("focusout",s=>{this.#r._focusEventsAllowed=!0,Ke(s)},{capture:!0,signal:n})),e.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:n});let i=s=>{s.preventDefault(),e===this.#t?this.edit():this.#r.toggleComment(!0)};return e.addEventListener("click",i,{capture:!0,signal:n}),e.addEventListener("keydown",s=>{s.target===e&&s.key==="Enter"&&(this.#n=!0,i(s))},{signal:n}),e.addEventListener("pointerenter",()=>{this.#r.toggleComment(!1,!0)},{signal:n}),e.addEventListener("pointerleave",()=>{this.#r.toggleComment(!1,!1)},{signal:n}),e}edit(e){let t=this.commentPopupPositionInLayer,n,i;if(t)[n,i]=t;else{[n,i]=this.#r.commentButtonPosition;let{width:c,height:h,x:d,y:f}=this.#r;n=d+n*c,i=f+i*h}let s=this.#r.parent.boundingClientRect,{x:a,y:o,width:u,height:l}=s;this.#r._uiManager.editComment(this.#r,a+n*u,o+i*l,{...e,parentDimensions:s})}finish(){this.#t&&(this.#t.focus({focusVisible:this.#n}),this.#n=!1)}isDeleted(){return this.#l||this.#i===""}isEmpty(){return this.#i===null}hasBeenEdited(){return this.isDeleted()||this.#i!==this.#a}serialize(){return this.data}get data(){return{text:this.#i,richText:this.#s,date:this.#o,deleted:this.isDeleted()}}set data(e){if(e!==this.#i&&(this.#s=null),e===null){this.#i="",this.#l=!0;return}this.#i=e,this.#o=new Date,this.#l=!1}setInitialText(e,t=null){this.#a=e,this.data=e,this.#o=null,this.#s=t}shown(){}destroy(){this.#t?.remove(),this.#t=null,this.#e?.remove(),this.#e=null,this.#i="",this.#s=null,this.#o=null,this.#r=null,this.#n=!1,this.#l=!1}},Vl=class r{#e;#t=!1;#n=null;#r;#a;#s;#i;#o=null;#l;#u=null;#d;#h=null;constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:n=null,onPinchStart:i=null,onPinching:s=null,onPinchEnd:a=null,signal:o}){this.#e=e,this.#n=n,this.#r=t,this.#a=i,this.#s=s,this.#i=a,this.#d=new AbortController,this.#l=AbortSignal.any([o,this.#d.signal]),e.addEventListener("touchstart",this.#f.bind(this),{passive:!1,signal:this.#l})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/nn.pixelRatio}#f(e){if(this.#r?.())return;if(e.touches.length===1){if(this.#o)return;let i=this.#o=new AbortController,s=AbortSignal.any([this.#l,i.signal]),a=this.#e,o={capture:!0,signal:s,passive:!1},u=l=>{l.pointerType==="touch"&&(this.#o?.abort(),this.#o=null)};a.addEventListener("pointerdown",l=>{l.pointerType==="touch"&&(Ke(l),u(l))},o),a.addEventListener("pointerup",u,o),a.addEventListener("pointercancel",u,o);return}if(!this.#h){this.#h=new AbortController;let i=AbortSignal.any([this.#l,this.#h.signal]),s=this.#e,a={signal:i,capture:!1,passive:!1};s.addEventListener("touchmove",this.#m.bind(this),a);let o=this.#g.bind(this);s.addEventListener("touchend",o,a),s.addEventListener("touchcancel",o,a),a.capture=!0,s.addEventListener("pointerdown",Ke,a),s.addEventListener("pointermove",Ke,a),s.addEventListener("pointercancel",Ke,a),s.addEventListener("pointerup",Ke,a),this.#a?.()}if(Ke(e),e.touches.length!==2||this.#n?.()){this.#u=null;return}let[t,n]=e.touches;t.identifier>n.identifier&&([t,n]=[n,t]),this.#u={touch0X:t.screenX,touch0Y:t.screenY,touch1X:n.screenX,touch1Y:n.screenY}}#m(e){if(!this.#u||e.touches.length!==2)return;Ke(e);let[t,n]=e.touches;t.identifier>n.identifier&&([t,n]=[n,t]);let{screenX:i,screenY:s}=t,{screenX:a,screenY:o}=n,u=this.#u,{touch0X:l,touch0Y:c,touch1X:h,touch1Y:d}=u,f=h-l,p=d-c,g=a-i,b=o-s,m=Math.hypot(g,b)||1,y=Math.hypot(f,p)||1;if(!this.#t&&Math.abs(y-m)<=r.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(u.touch0X=i,u.touch0Y=s,u.touch1X=a,u.touch1Y=o,!this.#t){this.#t=!0;return}let v=[(i+a)/2,(s+o)/2];this.#s?.(v,y,m)}#g(e){e.touches.length>=2||(this.#h&&(this.#h.abort(),this.#h=null,this.#i?.()),this.#u&&(Ke(e),this.#u=null,this.#t=!1))}destroy(){this.#d?.abort(),this.#d=null,this.#o?.abort(),this.#o=null}},De=class r{#e=null;#t=null;#n=null;#r=null;#a=null;#s=!1;#i=null;#o="";#l=null;#u=null;#d=null;#h=null;#f=null;#m="";#g=!1;#c=null;#p=!1;#b=!1;#v=!1;#y=null;#T=0;#E=0;#x=null;#C=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nResizer=null;#w=!1;#A=r._zIndex++;static _borderLineWidth=-1;static _colorManager=new b0;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let e=r.prototype._resizeWithKeyboard,t=ni.TRANSLATE_SMALL,n=ni.TRANSLATE_BIG;return le(this,"_resizerKeyboardManager",new ri([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,n]}],[["Escape","mac+Escape"],r.prototype._stopResizingWithKeyboard]]))}constructor(e){this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null,this.annotationElementId=e.annotationElementId||null,this.creationDate=e.creationDate||new Date,this.modificationDate=e.modificationDate||null,this.canAddComment=!0;let{rotation:t,rawDims:{pageWidth:n,pageHeight:i,pageX:s,pageY:a}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,i],this.pageTranslation=[s,a];let[o,u]=this.parentDimensions;this.x=e.x/o,this.y=e.y/u,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return le(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){let t=new y0({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,t){if(r._l10n??=e,r._l10nResizer||=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"}),r._borderLineWidth!==-1)return;let n=getComputedStyle(document.documentElement);r._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){Oe("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#w}set _isDraggable(e){this.#w=e,this.div?.classList.toggle("draggable",e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#A}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):(this.#B(),this.#h?.remove(),this.#h=null),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#g?this.#g=!1:this.parent.setSelected(this))}focusout(e){!this._focusEventsAllowed||!this.isAttachedToDOM||e.relatedTarget?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,n,i){let[s,a]=this.parentDimensions;[n,i]=this.screenToPageTranslation(n,i),this.x=(e+n)/s,this.y=(t+i)/a,this.fixAndSetPosition()}_moveAfterPaste(e,t){let[n,i]=this.parentDimensions;this.setAt(e*n,t*i,this.width*n,this.height*i),this._onTranslated()}#R([e,t],n,i){[n,i]=this.screenToPageTranslation(n,i),this.x+=n/e,this.y+=i/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(e,t){this.#R(this.parentDimensions,e,t)}translateInPage(e,t){this.#c||=[this.x,this.y,this.width,this.height],this.#R(this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){this.#c||=[this.x,this.y,this.width,this.height];let{div:n,parentDimensions:[i,s]}=this;if(this.x+=e/i,this.y+=t/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:h,y:d}=this.div.getBoundingClientRect();this.parent.findNewParent(this,h,d)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this,[u,l]=this.getBaseTranslation();a+=u,o+=l;let{style:c}=n;c.left=`${(100*a).toFixed(2)}%`,c.top=`${(100*o).toFixed(2)}%`,this._onTranslating(a,o),n.scrollIntoView({block:"nearest"})}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!this.#c&&(this.#c[0]!==this.x||this.#c[1]!==this.y)}get _hasBeenResized(){return!!this.#c&&(this.#c[2]!==this.width||this.#c[3]!==this.height)}getBaseTranslation(){let[e,t]=this.parentDimensions,{_borderLineWidth:n}=r,i=n/e,s=n/t;switch(this.rotation){case 90:return[-i,s];case 180:return[i,s];case 270:return[i,-s];default:return[-i,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){let{div:{style:t},pageDimensions:[n,i]}=this,{x:s,y:a,width:o,height:u}=this;if(o*=n,u*=i,s*=n,a*=i,this._mustFixPosition)switch(e){case 0:s=Pt(s,0,n-o),a=Pt(a,0,i-u);break;case 90:s=Pt(s,0,n-u),a=Pt(a,o,i);break;case 180:s=Pt(s,o,n),a=Pt(a,u,i);break;case 270:s=Pt(s,u,n),a=Pt(a,0,i-o);break}this.x=s/=n,this.y=a/=i;let[l,c]=this.getBaseTranslation();s+=l,a+=c,t.left=`${(100*s).toFixed(2)}%`,t.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}static#k(e,t,n){switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}screenToPageTranslation(e,t){return r.#k(e,t,this.parentRotation)}pageTranslationToScreen(e,t){return r.#k(e,t,360-this.parentRotation)}#I(e){switch(e){case 90:{let[t,n]=this.pageDimensions;return[0,-t/n,n/t,0]}case 180:return[-1,0,0,-1];case 270:{let[t,n]=this.pageDimensions;return[0,t/n,-n/t,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:e,pageDimensions:[t,n]}=this;return[t*e,n*e]}setDims(){let{div:{style:e},width:t,height:n}=this;e.width=`${(100*t).toFixed(2)}%`,e.height=`${(100*n).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#D(){if(this.#l)return;this.#l=document.createElement("div"),this.#l.classList.add("resizers");let e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],t=this._uiManager._signal;for(let n of e){let i=document.createElement("div");this.#l.append(i),i.classList.add("resizer",n),i.setAttribute("data-resizer-name",n),i.addEventListener("pointerdown",this.#O.bind(this,n),{signal:t}),i.addEventListener("contextmenu",ur,{signal:t}),i.tabIndex=-1}this.div.prepend(this.#l)}#O(e,t){t.preventDefault();let{isMac:n}=Je.platform;if(t.button!==0||t.ctrlKey&&n)return;this.#n?.toggle(!1);let i=this._isDraggable;this._isDraggable=!1,this.#u=[t.screenX,t.screenY];let s=new AbortController,a=this._uiManager.combinedSignal(s);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#M.bind(this,e),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",Ke,{passive:!1,signal:a}),window.addEventListener("contextmenu",ur,{signal:a}),this.#d={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let o=this.parent.div.style.cursor,u=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;let l=()=>{s.abort(),this.parent.togglePointerEvents(!0),this.#n?.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=o,this.div.style.cursor=u,this.#F()};window.addEventListener("pointerup",l,{signal:a}),window.addEventListener("blur",l,{signal:a})}#N(e,t,n,i){this.width=n,this.height=i,this.x=e,this.y=t,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#F(){if(!this.#d)return;let{savedX:e,savedY:t,savedWidth:n,savedHeight:i}=this.#d;this.#d=null;let s=this.x,a=this.y,o=this.width,u=this.height;s===e&&a===t&&o===n&&u===i||this.addCommands({cmd:this.#N.bind(this,s,a,o,u),undo:this.#N.bind(this,e,t,n,i),mustExec:!0})}static _round(e){return Math.round(e*1e4)/1e4}#M(e,t){let[n,i]=this.parentDimensions,s=this.x,a=this.y,o=this.width,u=this.height,l=r.MIN_SIZE/n,c=r.MIN_SIZE/i,h=this.#I(this.rotation),d=(L,N)=>[h[0]*L+h[2]*N,h[1]*L+h[3]*N],f=this.#I(360-this.rotation),p=(L,N)=>[f[0]*L+f[2]*N,f[1]*L+f[3]*N],g,b,m=!1,y=!1;switch(e){case"topLeft":m=!0,g=(L,N)=>[0,0],b=(L,N)=>[L,N];break;case"topMiddle":g=(L,N)=>[L/2,0],b=(L,N)=>[L/2,N];break;case"topRight":m=!0,g=(L,N)=>[L,0],b=(L,N)=>[0,N];break;case"middleRight":y=!0,g=(L,N)=>[L,N/2],b=(L,N)=>[0,N/2];break;case"bottomRight":m=!0,g=(L,N)=>[L,N],b=(L,N)=>[0,0];break;case"bottomMiddle":g=(L,N)=>[L/2,N],b=(L,N)=>[L/2,0];break;case"bottomLeft":m=!0,g=(L,N)=>[0,N],b=(L,N)=>[L,0];break;case"middleLeft":y=!0,g=(L,N)=>[0,N/2],b=(L,N)=>[L,N/2];break}let v=g(o,u),x=b(o,u),w=d(...x),S=r._round(s+w[0]),E=r._round(a+w[1]),_=1,T=1,k,A;if(t.fromKeyboard)({deltaX:k,deltaY:A}=t);else{let{screenX:L,screenY:N}=t,[I,H]=this.#u;[k,A]=this.screenToPageTranslation(L-I,N-H),this.#u[0]=L,this.#u[1]=N}if([k,A]=p(k/n,A/i),m){let L=Math.hypot(o,u);_=T=Math.max(Math.min(Math.hypot(x[0]-v[0]-k,x[1]-v[1]-A)/L,1/o,1/u),l/o,c/u)}else y?_=Pt(Math.abs(x[0]-v[0]-k),l,1)/o:T=Pt(Math.abs(x[1]-v[1]-A),c,1)/u;let B=r._round(o*_),D=r._round(u*T);w=d(...b(B,D));let P=S-w[0],M=E-w[1];this.#c||=[this.x,this.y,this.width,this.height],this.width=B,this.height=D,this.x=P,this.y=M,this.setDims(),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#n?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#b)return this._editToolbar;this._editToolbar=new d0(this),this.div.append(this._editToolbar.render());let{toolbarButtons:e}=this;if(e)for(let[t,n]of e)await this._editToolbar.addButton(t,n);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton("comment")}removeEditToolbar(){this._editToolbar?.remove(),this._editToolbar=null,this.#n?.destroy()}addContainer(e){let t=this._editToolbar?.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return this.#n||(Wl.initialize(r._l10n),this.#n=new Wl(this),this.#e&&(this.#n.data=this.#e,this.#e=null)),this.#n}get altTextData(){return this.#n?.data}set altTextData(e){this.#n&&(this.#n.data=e)}get guessedAltText(){return this.#n?.guessedText}async setGuessedAltText(e){await this.#n?.setGuessedText(e)}serializeAltText(e){return this.#n?.serialize(e)}hasAltText(){return!!this.#n&&!this.#n.isEmpty()}hasAltTextData(){return this.#n?.hasData()??!1}focusCommentButton(){this.#r?.focusButton()}addCommentButton(){return this.canAddComment?this.#r||=new ds(this):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(this.#a){this._uiManager.isEditingMode()&&this.#a.classList.remove("hidden");return}this.hasComment&&(this.#a=this.#r.renderForStandalone(),this.div.append(this.#a))}}removeStandaloneCommentButton(){this.#r.removeStandaloneCommentButton(),this.#a=null}hideStandaloneCommentButton(){this.#a?.classList.add("hidden")}get comment(){let{data:{richText:e,text:t,date:n,deleted:i}}=this.#r;return{text:t,richText:e,date:n,deleted:i,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){this.#r||=new ds(this),this.#r.data=e,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:e,popupRef:t,richText:n}){if(!t||(this.#r||=new ds(this),this.#r.setInitialText(e,n),!this.annotationElementId))return;let i=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);i&&this.updateFromAnnotationLayer(i)}get hasEditedComment(){return this.#r?.hasBeenEdited()}get hasDeletedComment(){return this.#r?.isDeleted()}get hasComment(){return!!this.#r&&!this.#r.isEmpty()&&!this.#r.isDeleted()}async editComment(e){this.#r||=new ds(this),this.#r.edit(e)}toggleComment(e,t=void 0){this.hasComment&&this._uiManager.toggleComment(this,e,t)}setSelectedCommentButton(e){this.#r.setSelectedButton(e)}addComment(e){if(this.hasEditedComment){let[,,,i]=e.rect,[s]=this.pageDimensions,[a]=this.pageTranslation,o=a+s+1,u=i-100,l=o+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[o,u,l,i]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:t}}){this.#r.data=t?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){let e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=this.#s?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),this.#z();let[t,n]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth=`${(100*n/t).toFixed(2)}%`,e.style.maxHeight=`${(100*t/n).toFixed(2)}%`);let[i,s]=this.getInitialTranslation();return this.translate(i,s),DE(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(this.#C||=new Vl({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#W.bind(this),onPinching:this.#_.bind(this),onPinchEnd:this.#S.bind(this),signal:this._uiManager._signal})),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),e}#W(){this.#d={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#n?.toggle(!1),this.parent.togglePointerEvents(!1)}#_(e,t,n){let s=.7*(n/t)+1-.7;if(s===1)return;let a=this.#I(this.rotation),o=(S,E)=>[a[0]*S+a[2]*E,a[1]*S+a[3]*E],[u,l]=this.parentDimensions,c=this.x,h=this.y,d=this.width,f=this.height,p=r.MIN_SIZE/u,g=r.MIN_SIZE/l;s=Math.max(Math.min(s,1/d,1/f),p/d,g/f);let b=r._round(d*s),m=r._round(f*s);if(b===d&&m===f)return;this.#c||=[c,h,d,f];let y=o(d/2,f/2),v=r._round(c+y[0]),x=r._round(h+y[1]),w=o(b/2,m/2);this.x=v-w[0],this.y=x-w[1],this.width=b,this.height=m,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#S(){this.#n?.toggle(!0),this.parent.togglePointerEvents(!0),this.#F()}pointerdown(e){let{isMac:t}=Je.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(this.#g=!0,this._isDraggable){this.#$(e);return}this.#L(e)}#L(e){let{isMac:t}=Je.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}#$(e){let{isSelected:t}=this;this._uiManager.setUpDragSession();let n=!1,i=new AbortController,s=this._uiManager.combinedSignal(i),a={capture:!0,passive:!1,signal:s},o=l=>{i.abort(),this.#i=null,this.#g=!1,this._uiManager.endDragSession()||this.#L(l),n&&this._onStopDragging()};t&&(this.#T=e.clientX,this.#E=e.clientY,this.#i=e.pointerId,this.#o=e.pointerType,window.addEventListener("pointermove",l=>{n||(n=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:c,clientY:h,pointerId:d}=l;if(d!==this.#i){Ke(l);return}let[f,p]=this.screenToPageTranslation(c-this.#T,h-this.#E);this.#T=c,this.#E=h,this._uiManager.dragSelectedEditors(f,p)},a),window.addEventListener("touchmove",Ke,a),window.addEventListener("pointerdown",l=>{l.pointerType===this.#o&&(this.#C||l.isPrimary)&&o(l),Ke(l)},a));let u=l=>{if(!this.#i||this.#i===l.pointerId){o(l);return}Ke(l)};window.addEventListener("pointerup",u,{signal:s}),window.addEventListener("blur",u,{signal:s})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(e,t,n){e.changeParent(this),this.x=t,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(e,t,n=this.rotation){let i=this.parentScale,[s,a]=this.pageDimensions,[o,u]=this.pageTranslation,l=e/i,c=t/i,h=this.x*s,d=this.y*a,f=this.width*s,p=this.height*a;switch(n){case 0:return[h+l+o,a-d-c-p+u,h+l+f+o,a-d-c+u];case 90:return[h+c+o,a-d+l+u,h+c+p+o,a-d+l+f+u];case 180:return[h-l-f+o,a-d+c+u,h-l+o,a-d+c+p+u];case 270:return[h-c-p+o,a-d-l-f+u,h-c+o,a-d-l+u];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){let[n,i,s,a]=e,o=s-n,u=a-i;switch(this.rotation){case 0:return[n,t-a,o,u];case 90:return[n,t-i,u,o];case 180:return[s,t-i,o,u];case 270:return[s,t-a,u,o];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&r._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#r?.onUpdatedColor()}getData(){let{comment:{text:e,color:t,date:n,opacity:i,deleted:s,richText:a},uid:o,pageIndex:u,creationDate:l,modificationDate:c}=this;return{id:o,pageIndex:u,rect:this.getPDFRect(),richText:a,contentsObj:{str:e},creationDate:l,modificationDate:n||c,popupRef:!s,color:t,opacity:i}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),this.#b=!0,!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),this.#b=!1,!0):!1}isInEditMode(){return this.#b}shouldGetKeyboardEvents(){return this.#v}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:e,left:t,bottom:n,right:i}=this.getClientDimensions(),{innerHeight:s,innerWidth:a}=window;return t<a&&i>0&&e<s&&n>0}#z(){if(this.#f||!this.div)return;this.#f=new AbortController;let e=this._uiManager.combinedSignal(this.#f);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})}rebuild(){this.#z()}rotate(e){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(e=!1,t=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||""}}static async deserialize(e,t,n){let i=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:n,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});i.rotation=e.rotation,i.#e=e.accessibilityData,i._isCopy=e.isCopy||!1;let[s,a]=i.pageDimensions,[o,u,l,c]=i.getRectInCurrentCoords(e.rect,a);return i.x=o/s,i.y=u/a,i.width=l/s,i.height=c/a,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#f?.abort(),this.#f=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),this.#y&&(clearTimeout(this.#y),this.#y=null),this.#B(),this.removeEditToolbar(),this.#x){for(let e of this.#x.values())clearTimeout(e);this.#x=null}this.parent=null,this.#C?.destroy(),this.#C=null,this.#h?.remove(),this.#h=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#D(),this.#l.classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[e,t]}=this,[n,i,s,a]=this.getPDFRect();return[r._round(n+(s-n)*e),r._round(i+(a-i)*(1-t))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#r.commentPopupPositionInLayer}set commentPopupPosition(e){this.#r.commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return this.#r.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#r.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){this.#r?.setCommentButtonStates(e)}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),this.#d={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let t=this.#l.children;if(!this.#t){this.#t=Array.from(t);let a=this.#q.bind(this),o=this.#G.bind(this),u=this._uiManager._signal;for(let l of this.#t){let c=l.getAttribute("data-resizer-name");l.setAttribute("role","spinbutton"),l.addEventListener("keydown",a,{signal:u}),l.addEventListener("blur",o,{signal:u}),l.addEventListener("focus",this.#K.bind(this,c),{signal:u}),l.setAttribute("data-l10n-id",r._l10nResizer[c])}}let n=this.#t[0],i=0;for(let a of t){if(a===n)break;i++}let s=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(s!==i){if(s<i)for(let o=0;o<i-s;o++)this.#l.append(this.#l.firstElementChild);else if(s>i)for(let o=0;o<s-i;o++)this.#l.firstElementChild.before(this.#l.lastElementChild);let a=0;for(let o of t){let l=this.#t[a++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",r._l10nResizer[l])}}this.#j(0),this.#v=!0,this.#l.firstElementChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}#q(e){r._resizerKeyboardManager.exec(this,e)}#G(e){this.#v&&e.relatedTarget?.parentNode!==this.#l&&this.#B()}#K(e){this.#m=this.#v?e:""}#j(e){if(this.#t)for(let t of this.#t)t.tabIndex=e}_resizeWithKeyboard(e,t){this.#v&&this.#M(this.#m,{deltaX:e,deltaY:t,fromKeyboard:!0})}#B(){this.#v=!1,this.#j(-1),this.#F()}_stopResizingWithKeyboard(){this.#B(),this.div.focus()}select(){if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),this.div?.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()});return}this._editToolbar?.show(),this.#n?.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){this.isSelected&&(this.isSelected=!1,this.#l?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#n?.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(e,t){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){e.target.nodeName!=="BUTTON"&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#p}set isEditing(e){this.#p=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,t=!1){if(t){this.#x||=new Map;let{action:n}=e,i=this.#x.get(n);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(e),this.#x.delete(n),this.#x.size===0&&(this.#x=null)},r._telemetryTimeout),this.#x.set(n,i);return}e.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),this.#s=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#s=!0}updateFakeAnnotationElement(e){if(!this.#h&&!this.deleted){this.#h=e.addFakeAnnotation(this);return}if(this.deleted){this.#h.remove(),this.#h=null;return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&this.#h.updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let t=e.container.querySelector(".annotationContent");if(!t)t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.container.prepend(t);else if(t.nodeName==="CANVAS"){let n=t;t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),n.before(t)}return t}resetAnnotationElement(e){let{firstElementChild:t}=e.container;t?.nodeName==="DIV"&&t.classList.contains("annotationContent")&&t.remove()}},y0=class extends De{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},mE=3285377520,ar=4294901760,Br=65535,Gl=class{constructor(e){this.h1=e?e&4294967295:mE,this.h2=e?e&4294967295:mE}update(e){let t,n;if(typeof e=="string"){t=new Uint8Array(e.length*2),n=0;for(let g=0,b=e.length;g<b;g++){let m=e.charCodeAt(g);m<=255?t[n++]=m:(t[n++]=m>>>8,t[n++]=m&255)}}else if(ArrayBuffer.isView(e))t=e.slice(),n=t.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");let i=n>>2,s=n-i*4,a=new Uint32Array(t.buffer,0,i),o=0,u=0,l=this.h1,c=this.h2,h=3432918353,d=461845907,f=h&Br,p=d&Br;for(let g=0;g<i;g++)g&1?(o=a[g],o=o*h&ar|o*f&Br,o=o<<15|o>>>17,o=o*d&ar|o*p&Br,l^=o,l=l<<13|l>>>19,l=l*5+3864292196):(u=a[g],u=u*h&ar|u*f&Br,u=u<<15|u>>>17,u=u*d&ar|u*p&Br,c^=u,c=c<<13|c>>>19,c=c*5+3864292196);switch(o=0,s){case 3:o^=t[i*4+2]<<16;case 2:o^=t[i*4+1]<<8;case 1:o^=t[i*4],o=o*h&ar|o*f&Br,o=o<<15|o>>>17,o=o*d&ar|o*p&Br,i&1?l^=o:c^=o}this.h1=l,this.h2=c}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&ar|e*36045&Br,t=t*4283543511&ar|((t<<16|e>>>16)*2950163797&ar)>>>16,e^=t>>>1,e=e*444984403&ar|e*60499&Br,t=t*3301882366&ar|((t<<16|e>>>16)*3120437893&ar)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}},v0=Object.freeze({map:null,hash:"",transfer:void 0}),eo=class{#e=!1;#t=null;#n=null;#r=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){let n=this.#r.get(e);return n===void 0?t:Object.assign(t,n)}getRawValue(e){return this.#r.get(e)}remove(e){let t=this.#r.get(e);if(t!==void 0&&(t instanceof De&&this.#n.delete(t.annotationElementId),this.#r.delete(e),this.#r.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function")){for(let n of this.#r.values())if(n instanceof De)return;this.onAnnotationEditor(null)}}setValue(e,t){let n=this.#r.get(e),i=!1;if(n!==void 0)for(let[s,a]of Object.entries(t))n[s]!==a&&(i=!0,n[s]=a);else i=!0,this.#r.set(e,t);i&&this.#a(),t instanceof De&&((this.#n||=new Map).set(t.annotationElementId,t),typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(t.constructor._type))}has(e){return this.#r.has(e)}get size(){return this.#r.size}#a(){this.#e||(this.#e=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#e&&(this.#e=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new ql(this)}get serializable(){if(this.#r.size===0)return v0;let e=new Map,t=new Gl,n=[],i=Object.create(null),s=!1;for(let[a,o]of this.#r){let u=o instanceof De?o.serialize(!1,i):o;u&&(e.set(a,u),t.update(`${a}:${JSON.stringify(u)}`),s||=!!u.bitmap)}if(s)for(let a of e.values())a.bitmap&&n.push(a.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:n}:v0}get editorStats(){let e=null,t=new Map,n=0,i=0;for(let s of this.#r.values()){if(!(s instanceof De)){s.popup&&(s.popup.deleted?i+=1:n+=1);continue}s.isCommentDeleted?i+=1:s.hasEditedComment&&(n+=1);let a=s.telemetryFinalData;if(!a)continue;let{type:o}=a;t.has(o)||t.set(o,Object.getPrototypeOf(s).constructor),e||=Object.create(null);let u=e[o]||=new Map;for(let[l,c]of Object.entries(a)){if(l==="type")continue;let h=u.get(l);h||(h=new Map,u.set(l,h));let d=h.get(c)??0;h.set(c,d+1)}}if((i>0||n>0)&&(e||=Object.create(null),e.comments={deleted:i,edited:n}),!e)return null;for(let[s,a]of t)e[s]=a.computeTelemetryFinalData(e[s]);return e}resetModifiedIds(){this.#t=null}updateEditor(e,t){let n=this.#n?.get(e);return n?(n.updateFromAnnotationLayer(t),!0):!1}getEditor(e){return this.#n?.get(e)||null}get modifiedIds(){if(this.#t)return this.#t;let e=[];if(this.#n)for(let t of this.#n.values())t.serialize()&&e.push(t.annotationElementId);return this.#t={ids:new Set(e),hash:e.join(",")}}[Symbol.iterator](){return this.#r.entries()}},ql=class extends eo{#e;constructor(e){super();let{map:t,hash:n,transfer:i}=e.serializable,s=structuredClone(t,i?{transfer:i}:null);this.#e={map:s,hash:n,transfer:i}}get print(){Oe("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}get modifiedIds(){return le(this,"modifiedIds",{ids:new Set,hash:""})}},w0=class{#e=new Set;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));let t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(let e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),this.#e.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:t,_inspectFont:n}){if(!(!e||this.#e.has(e.loadedName))){if(xe(!t,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:i,src:s,style:a}=e,o=new FontFace(i,s,a);this.addNativeFontFace(o);try{await o.load(),this.#e.add(i),n?.(e)}catch{ue(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}Oe("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){let n=e.createNativeFontFace();if(n){this.addNativeFontFace(n);try{await n.loaded}catch(i){throw ue(`Failed to load font '${n.family}': '${i}'.`),e.disableFontFace=!0,i}}return}let t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(n=>{let i=this._queueLoadingCallback(n);this._prepareFontLoadEvent(e,i)})}}get isFontLoadingAPISupported(){let e=!!this._document?.fonts;return le(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return le(this,"isSyncFontLoadingSupported",Rt||Je.platform.isFirefox)}_queueLoadingCallback(e){function t(){for(xe(!i.done,"completeRequest() cannot be called twice."),i.done=!0;n.length>0&&n[0].done;){let s=n.shift();setTimeout(s.callback,0)}}let{loadingRequests:n}=this,i={done:!1,complete:t,callback:e};return n.push(i),i}get _loadTestFont(){let e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return le(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,t){function n(x,w){return x.charCodeAt(w)<<24|x.charCodeAt(w+1)<<16|x.charCodeAt(w+2)<<8|x.charCodeAt(w+3)&255}function i(x,w,S,E){let _=x.substring(0,w),T=x.substring(w+S);return _+E+T}let s,a,o=this._document.createElement("canvas");o.width=1,o.height=1;let u=o.getContext("2d"),l=0;function c(x,w){if(++l>30){ue("Load test font never loaded."),w();return}if(u.font="30px "+x,u.fillText(".",0,20),u.getImageData(0,0,1,1).data[3]>0){w();return}setTimeout(c.bind(null,x,w))}let h=`lt${Date.now()}${this.loadTestFontId++}`,d=this._loadTestFont;d=i(d,976,h.length,h);let p=16,g=1482184792,b=n(d,p);for(s=0,a=h.length-3;s<a;s+=4)b=b-g+n(h,s)|0;s<h.length&&(b=b-g+n(h+"XXX",s)|0),d=i(d,p,4,v5(b));let m=`url(data:font/opentype;base64,${btoa(d)});`,y=`@font-face {font-family:"${h}";src:${m}}`;this.insertRule(y);let v=this._document.createElement("div");v.style.visibility="hidden",v.style.width=v.style.height="10px",v.style.position="absolute",v.style.top=v.style.left="0px";for(let x of[e.loadedName,h]){let w=this._document.createElement("span");w.textContent="Hi",w.style.fontFamily=x,v.append(w)}this._document.body.append(v),c(h,()=>{v.remove(),t.complete()})}},x0=class{#e;constructor(e,t=null,n,i){this.compiledGlyphs=Object.create(null),this.#e=e,this._inspectFont=t,n&&Object.assign(this,n),i&&(this.charProcOperatorList=i)}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{let t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;let e=`url(data:${this.mimetype};base64,${NE(this.data)});`,t;if(!this.cssFontInfo)t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${n}src:${e}}`}return this._inspectFont?.(this,e),t}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];let n=this.loadedName+"_path_"+t,i;try{i=e.get(n)}catch(a){ue(`getPathGenerator - ignoring character: "${a}".`)}let s=BE(i?.path);return this.fontExtraProperties||e.delete(n),this.compiledGlyphs[t]=s}get black(){return this.#e.black}get bold(){return this.#e.bold}get disableFontFace(){return this.#e.disableFontFace??!1}set disableFontFace(e){le(this,"disableFontFace",!!e)}get fontExtraProperties(){return this.#e.fontExtraProperties??!1}get isInvalidPDFjsFont(){return this.#e.isInvalidPDFjsFont}get isType3Font(){return this.#e.isType3Font}get italic(){return this.#e.italic}get missingFile(){return this.#e.missingFile}get remeasure(){return this.#e.remeasure}get vertical(){return this.#e.vertical}get ascent(){return this.#e.ascent}get defaultWidth(){return this.#e.defaultWidth}get descent(){return this.#e.descent}get bbox(){return this.#e.bbox}set bbox(e){le(this,"bbox",e)}get fontMatrix(){return this.#e.fontMatrix}get fallbackName(){return this.#e.fallbackName}get loadedName(){return this.#e.loadedName}get mimetype(){return this.#e.mimetype}get name(){return this.#e.name}get data(){return this.#e.data}clearData(){this.#e.clearData()}get cssFontInfo(){return this.#e.cssFontInfo}get systemFontInfo(){return this.#e.systemFontInfo}get defaultVMetrics(){return this.#e.defaultVMetrics}},Kl=class r{#e;#t;#n;static strings=["fontFamily","fontWeight","italicAngle"];static write(e){let t=new TextEncoder,n={},i=0;for(let l of r.strings){let c=t.encode(e[l]);n[l]=c,i+=4+c.length}let s=new ArrayBuffer(i),a=new Uint8Array(s),o=new DataView(s),u=0;for(let l of r.strings){let c=n[l],h=c.length;o.setUint32(u,h),a.set(c,u+4),u+=4+h}return xe(u===s.byteLength,"CssFontInfo.write: Buffer overflow"),s}constructor(e){this.#e=e,this.#t=new DataView(this.#e),this.#n=new TextDecoder}#r(e){xe(e<r.strings.length,"Invalid string index");let t=0;for(let i=0;i<e;i++)t+=this.#t.getUint32(t)+4;let n=this.#t.getUint32(t);return this.#n.decode(new Uint8Array(this.#e,t+4,n))}get fontFamily(){return this.#r(0)}get fontWeight(){return this.#r(1)}get italicAngle(){return this.#r(2)}},Xl=class r{#e;#t;#n;static strings=["css","loadedName","baseFontName","src"];static write(e){let t=new TextEncoder,n={},i=0;for(let d of r.strings){let f=t.encode(e[d]);n[d]=f,i+=4+f.length}i+=4;let s,a,o=1+i;e.style&&(s=t.encode(e.style.style),a=t.encode(e.style.weight),o+=4+s.length+4+a.length);let u=new ArrayBuffer(o),l=new Uint8Array(u),c=new DataView(u),h=0;c.setUint8(h++,e.guessFallback?1:0),c.setUint32(h,0),h+=4,i=0;for(let d of r.strings){let f=n[d],p=f.length;i+=4+p,c.setUint32(h,p),l.set(f,h+4),h+=4+p}return c.setUint32(h-i-4,i),e.style&&(c.setUint32(h,s.length),l.set(s,h+4),h+=4+s.length,c.setUint32(h,a.length),l.set(a,h+4),h+=4+a.length),xe(h<=u.byteLength,"SubstitionInfo.write: Buffer overflow"),u.transferToFixedLength(h)}constructor(e){this.#e=e,this.#t=new DataView(this.#e),this.#n=new TextDecoder}get guessFallback(){return this.#t.getUint8(0)!==0}#r(e){xe(e<r.strings.length,"Invalid string index");let t=5;for(let i=0;i<e;i++)t+=this.#t.getUint32(t)+4;let n=this.#t.getUint32(t);return this.#n.decode(new Uint8Array(this.#e,t+4,n))}get css(){return this.#r(0)}get loadedName(){return this.#r(1)}get baseFontName(){return this.#r(2)}get src(){return this.#r(3)}get style(){let e=1;e+=4+this.#t.getUint32(e);let t=this.#t.getUint32(e),n=this.#n.decode(new Uint8Array(this.#e,e+4,t));e+=4+t;let i=this.#t.getUint32(e),s=this.#n.decode(new Uint8Array(this.#e,e+4,i));return{style:n,weight:s}}},S0=class r{static bools=["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"];static numbers=["ascent","defaultWidth","descent"];static strings=["fallbackName","loadedName","mimetype","name"];static#e=Math.ceil(this.bools.length*2/8);static#t=this.#e+this.numbers.length*8;static#n=this.#t+1+8;static#r=this.#n+1+48;static#a=this.#r+1+6;#s;#i;#o;constructor({data:e,extra:t}){this.#s=e,this.#i=new TextDecoder,this.#o=new DataView(this.#s),t&&Object.assign(this,t)}#l(e){xe(e<r.bools.length,"Invalid boolean index");let t=Math.floor(e/4),n=e*2%8,i=this.#o.getUint8(t)>>n&3;return i===0?void 0:i===2}get black(){return this.#l(0)}get bold(){return this.#l(1)}get disableFontFace(){return this.#l(2)}get fontExtraProperties(){return this.#l(3)}get isInvalidPDFjsFont(){return this.#l(4)}get isType3Font(){return this.#l(5)}get italic(){return this.#l(6)}get missingFile(){return this.#l(7)}get remeasure(){return this.#l(8)}get vertical(){return this.#l(9)}#u(e){return xe(e<r.numbers.length,"Invalid number index"),this.#o.getFloat64(r.#e+e*8)}get ascent(){return this.#u(0)}get defaultWidth(){return this.#u(1)}get descent(){return this.#u(2)}get bbox(){let e=r.#t;if(this.#o.getUint8(e)===0)return;e+=1;let n=[];for(let i=0;i<4;i++)n.push(this.#o.getInt16(e,!0)),e+=2;return n}get fontMatrix(){let e=r.#n;if(this.#o.getUint8(e)===0)return;e+=1;let n=[];for(let i=0;i<6;i++)n.push(this.#o.getFloat64(e,!0)),e+=8;return n}get defaultVMetrics(){let e=r.#r;if(this.#o.getUint8(e)===0)return;e+=1;let n=[];for(let i=0;i<3;i++)n.push(this.#o.getInt16(e,!0)),e+=2;return n}#d(e){xe(e<r.strings.length,"Invalid string index");let t=r.#a+4;for(let s=0;s<e;s++)t+=this.#o.getUint32(t)+4;let n=this.#o.getUint32(t),i=new Uint8Array(n);return i.set(new Uint8Array(this.#s,t+4,n)),this.#i.decode(i)}get fallbackName(){return this.#d(0)}get loadedName(){return this.#d(1)}get mimetype(){return this.#d(2)}get name(){return this.#d(3)}get data(){let e=r.#a,t=this.#o.getUint32(e);e+=4+t;let n=this.#o.getUint32(e);e+=4+n;let i=this.#o.getUint32(e);e+=4+i;let s=this.#o.getUint32(e);if(s!==0)return new Uint8Array(this.#s,e+4,s)}clearData(){let e=r.#a,t=this.#o.getUint32(e);e+=4+t;let n=this.#o.getUint32(e);e+=4+n;let i=this.#o.getUint32(e);e+=4+i;let s=this.#o.getUint32(e);new Uint8Array(this.#s,e+4,s).fill(0),this.#o.setUint32(e,0)}get cssFontInfo(){let e=r.#a,t=this.#o.getUint32(e);e+=4+t;let n=this.#o.getUint32(e);e+=4+n;let i=this.#o.getUint32(e);if(i===0)return null;let s=new Uint8Array(i);return s.set(new Uint8Array(this.#s,e+4,i)),new Kl(s.buffer)}get systemFontInfo(){let e=r.#a,t=this.#o.getUint32(e);e+=4+t;let n=this.#o.getUint32(e);if(n===0)return null;let i=new Uint8Array(n);return i.set(new Uint8Array(this.#s,e+4,n)),new Xl(i.buffer)}static write(e){let t=e.systemFontInfo?Xl.write(e.systemFontInfo):null,n=e.cssFontInfo?Kl.write(e.cssFontInfo):null,i=new TextEncoder,s={},a=0;for(let g of r.strings)s[g]=i.encode(e[g]),a+=4+s[g].length;let o=r.#a+4+a+4+(t?t.byteLength:0)+4+(n?n.byteLength:0)+4+(e.data?e.data.length:0),u=new ArrayBuffer(o),l=new Uint8Array(u),c=new DataView(u),h=0,d=r.bools.length,f=0,p=0;for(let g=0;g<d;g++){let b=e[r.bools[g]];f|=(b===void 0?0:b?2:1)<<p,p+=2,(p===8||g===d-1)&&(c.setUint8(h++,f),f=0,p=0)}xe(h===r.#e,"FontInfo.write: Boolean properties offset mismatch");for(let g of r.numbers)c.setFloat64(h,e[g]),h+=8;if(xe(h===r.#t,"FontInfo.write: Number properties offset mismatch"),e.bbox){c.setUint8(h++,4);for(let g of e.bbox)c.setInt16(h,g,!0),h+=2}else c.setUint8(h++,0),h+=8;if(xe(h===r.#n,"FontInfo.write: BBox properties offset mismatch"),e.fontMatrix){c.setUint8(h++,6);for(let g of e.fontMatrix)c.setFloat64(h,g,!0),h+=8}else c.setUint8(h++,0),h+=48;if(xe(h===r.#r,"FontInfo.write: FontMatrix properties offset mismatch"),e.defaultVMetrics){c.setUint8(h++,1);for(let g of e.defaultVMetrics)c.setInt16(h,g,!0),h+=2}else c.setUint8(h++,0),h+=6;xe(h===r.#a,"FontInfo.write: DefaultVMetrics properties offset mismatch"),c.setUint32(r.#a,0),h+=4;for(let g of r.strings){let b=s[g],m=b.length;c.setUint32(h,m),l.set(b,h+4),h+=4+m}if(c.setUint32(r.#a,h-r.#a-4),!t)c.setUint32(h,0),h+=4;else{let g=t.byteLength;c.setUint32(h,g),xe(h+4+g<=u.byteLength,"FontInfo.write: Buffer overflow at systemFontInfo"),l.set(new Uint8Array(t),h+4),h+=4+g}if(!n)c.setUint32(h,0),h+=4;else{let g=n.byteLength;c.setUint32(h,g),xe(h+4+g<=u.byteLength,"FontInfo.write: Buffer overflow at cssFontInfo"),l.set(new Uint8Array(n),h+4),h+=4+g}return e.data===void 0?(c.setUint32(h,0),h+=4):(c.setUint32(h,e.data.length),l.set(e.data,h+4),h+=4+e.data.length),xe(h<=u.byteLength,"FontInfo.write: Buffer overflow"),u.transferToFixedLength(h)}},E0=class r{static#e=0;static#t=1;static#n=2;static#r=3;static#a=4;static#s=8;static#i=12;static#o=16;constructor(e){this.buffer=e,this.view=new DataView(e),this.data=new Uint8Array(e)}static write(e){let t,n=null,i=[],s=[],a=[],o=[],u=null,l=null;switch(e[0]){case"RadialAxial":t=e[1]==="axial"?1:2,n=e[2],a=e[3],t===1?i.push(...e[4],...e[5]):i.push(e[4][0],e[4][1],e[6],e[5][0],e[5][1],e[7]);break;case"Mesh":t=3,u=e[1],i=e[2],s=e[3],o=e[4]||[],n=e[6],l=e[7];break;default:throw new Error(`Unsupported pattern type: ${e[0]}`)}let c=Math.floor(i.length/2),h=Math.floor(s.length/3),d=a.length,f=o.length,p=0;for(let w of o)p+=1,p=Math.ceil(p/4)*4,p+=4+w.coords.length*4,p+=4+w.colors.length*4,w.verticesPerRow!==void 0&&(p+=4);let g=20+c*8+h*3+d*8+(n?16:0)+(l?3:0)+p,b=new ArrayBuffer(g),m=new DataView(b),y=new Uint8Array(b);m.setUint8(r.#e,t),m.setUint8(r.#t,n?1:0),m.setUint8(r.#n,l?1:0),m.setUint8(r.#r,u),m.setUint32(r.#a,c,!0),m.setUint32(r.#s,h,!0),m.setUint32(r.#i,d,!0),m.setUint32(r.#o,f,!0);let v=20;new Float32Array(b,v,c*2).set(i),v+=c*8,y.set(s,v),v+=h*3;for(let[w,S]of a)m.setFloat32(v,w,!0),v+=4,m.setUint32(v,parseInt(S.slice(1),16),!0),v+=4;if(n)for(let w of n)m.setFloat32(v,w,!0),v+=4;l&&(y.set(l,v),v+=3);for(let w=0;w<o.length;w++){let S=o[w];m.setUint8(v,S.type),v+=1,v=Math.ceil(v/4)*4,m.setUint32(v,S.coords.length,!0),v+=4,new Int32Array(b,v,S.coords.length).set(S.coords),v+=S.coords.length*4,m.setUint32(v,S.colors.length,!0),v+=4,new Int32Array(b,v,S.colors.length).set(S.colors),v+=S.colors.length*4,S.verticesPerRow!==void 0&&(m.setUint32(v,S.verticesPerRow,!0),v+=4)}return b}getIR(){let e=this.view,t=this.data[r.#e],n=!!this.data[r.#t],i=!!this.data[r.#n],s=e.getUint32(r.#a,!0),a=e.getUint32(r.#s,!0),o=e.getUint32(r.#i,!0),u=e.getUint32(r.#o,!0),l=20,c=new Float32Array(this.buffer,l,s*2);l+=s*8;let h=new Uint8Array(this.buffer,l,a*3);l+=a*3;let d=[];for(let b=0;b<o;++b){let m=e.getFloat32(l,!0);l+=4;let y=e.getUint32(l,!0);l+=4,d.push([m,`#${y.toString(16).padStart(6,"0")}`])}let f=null;if(n){f=[];for(let b=0;b<4;++b)f.push(e.getFloat32(l,!0)),l+=4}let p=null;i&&(p=new Uint8Array(this.buffer,l,3),l+=3);let g=[];for(let b=0;b<u;++b){let m=e.getUint8(l);l+=1,l=Math.ceil(l/4)*4;let y=e.getUint32(l,!0);l+=4;let v=new Int32Array(this.buffer,l,y);l+=y*4;let x=e.getUint32(l,!0);l+=4;let w=new Int32Array(this.buffer,l,x);l+=x*4;let S={type:m,coords:v,colors:w};m===a0.LATTICE&&(S.verticesPerRow=e.getUint32(l,!0),l+=4),g.push(S)}if(t===1)return["RadialAxial","axial",f,d,Array.from(c.slice(0,2)),Array.from(c.slice(2,4)),null,null];if(t===2)return["RadialAxial","radial",f,d,[c[0],c[1]],[c[3],c[4]],c[2],c[5]];if(t===3){let b=this.data[r.#r],m=null;if(c.length>0){let y=c[0],v=c[0],x=c[1],w=c[1];for(let S=0;S<c.length;S+=2){let E=c[S],_=c[S+1];y=y>E?E:y,x=x>_?_:x,v=v<E?E:v,w=w<_?_:w}m=[y,x,v,w]}return["Mesh",b,c,h,g,m,f,p]}throw new Error(`Unsupported pattern kind: ${t}`)}},A0=class{static write(e){let t,n;return Je.isFloat16ArraySupported?(n=new ArrayBuffer(e.length*2),t=new Float16Array(n)):(n=new ArrayBuffer(e.length*4),t=new Float32Array(n)),t.set(e),n}#e;constructor(e){this.#e=e}get path(){return Je.isFloat16ArraySupported?new Float16Array(this.#e):new Float32Array(this.#e)}};function L5(r){if(r instanceof URL)return r.href;if(typeof r=="string"){if(Rt)return r;let e=URL.parse(r,window.location);if(e)return e.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function N5(r){if(Rt&&typeof Buffer<"u"&&r instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength)return r;if(typeof r=="string")return co(r);if(r instanceof ArrayBuffer||ArrayBuffer.isView(r)||typeof r=="object"&&!isNaN(r?.length))return new Uint8Array(r);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function Pl(r){if(typeof r!="string")return null;if(r.endsWith("/"))return r;throw new Error(`Invalid factory url: "${r}" must include trailing slash.`)}var T0=r=>typeof r=="object"&&Number.isInteger(r?.num)&&r.num>=0&&Number.isInteger(r?.gen)&&r.gen>=0,M5=r=>typeof r=="object"&&typeof r?.name=="string",B5=A5.bind(null,T0,M5),_0=class{#e=new Map;#t=Promise.resolve();postMessage(e,t){let n={data:structuredClone(e,t?{transfer:t}:null)};this.#t.then(()=>{for(let[i]of this.#e)i.call(this,n)})}addEventListener(e,t,n=null){let i=null;if(n?.signal instanceof AbortSignal){let{signal:s}=n;if(s.aborted){ue("LoopbackPort - cannot use an `aborted` signal.");return}let a=()=>this.removeEventListener(e,t);i=()=>s.removeEventListener("abort",a),s.addEventListener("abort",a)}this.#e.set(t,i)}removeEventListener(e,t){this.#e.get(t)?.(),this.#e.delete(t)}terminate(){for(let[,e]of this.#e)e?.();this.#e.clear()}},Ol={DATA:1,ERROR:2},nt={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function bE(){}function Ft(r){if(r instanceof Dr||r instanceof Xa||r instanceof zl||r instanceof gs||r instanceof Va)return r;switch(r instanceof Error||typeof r=="object"&&r!==null||Oe('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),r.name){case"AbortException":return new Dr(r.message);case"InvalidPDFException":return new Xa(r.message);case"PasswordException":return new zl(r.message,r.code);case"ResponseException":return new gs(r.message,r.status,r.missing);case"UnknownErrorException":return new Va(r.message,r.details)}return new Va(r.message,r.toString())}var Jn=class{#e=new AbortController;constructor(e,t,n){this.sourceName=e,this.targetName=t,this.comObj=n,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),n.addEventListener("message",this.#t.bind(this),{signal:this.#e.signal})}#t({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){this.#r(e);return}if(e.callback){let n=e.callbackId,i=this.callbackCapabilities[n];if(!i)throw new Error(`Cannot resolve callback ${n}`);if(delete this.callbackCapabilities[n],e.callback===Ol.DATA)i.resolve(e.data);else if(e.callback===Ol.ERROR)i.reject(Ft(e.reason));else throw new Error("Unexpected callback case");return}let t=this.actionHandler[e.action];if(!t)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){let n=this.sourceName,i=e.sourceName,s=this.comObj;Promise.try(t,e.data).then(function(a){s.postMessage({sourceName:n,targetName:i,callback:Ol.DATA,callbackId:e.callbackId,data:a})},function(a){s.postMessage({sourceName:n,targetName:i,callback:Ol.ERROR,callbackId:e.callbackId,reason:Ft(a)})});return}if(e.streamId){this.#n(e);return}t(e.data)}on(e,t){let n=this.actionHandler;if(n[e])throw new Error(`There is already an actionName called "${e}"`);n[e]=t}send(e,t,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},n)}sendWithPromise(e,t,n){let i=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[i]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:i,data:t},n)}catch(a){s.reject(a)}return s.promise}sendWithStream(e,t,n,i){let s=this.streamId++,a=this.sourceName,o=this.targetName,u=this.comObj;return new ReadableStream({start:l=>{let c=Promise.withResolvers();return this.streamControllers[s]={controller:l,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},u.postMessage({sourceName:a,targetName:o,action:e,streamId:s,data:t,desiredSize:l.desiredSize},i),c.promise},pull:l=>{let c=Promise.withResolvers();return this.streamControllers[s].pullCall=c,u.postMessage({sourceName:a,targetName:o,stream:nt.PULL,streamId:s,desiredSize:l.desiredSize}),c.promise},cancel:l=>{xe(l instanceof Error,"cancel must have a valid reason");let c=Promise.withResolvers();return this.streamControllers[s].cancelCall=c,this.streamControllers[s].isClosed=!0,u.postMessage({sourceName:a,targetName:o,stream:nt.CANCEL,streamId:s,reason:Ft(l)}),c.promise}},n)}#n(e){let t=e.streamId,n=this.sourceName,i=e.sourceName,s=this.comObj,a=this,o=this.actionHandler[e.action],u={enqueue(l,c=1,h){if(this.isCancelled)return;let d=this.desiredSize;this.desiredSize-=c,d>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),s.postMessage({sourceName:n,targetName:i,stream:nt.ENQUEUE,streamId:t,chunk:l},h)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:n,targetName:i,stream:nt.CLOSE,streamId:t}),delete a.streamSinks[t])},error(l){xe(l instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,s.postMessage({sourceName:n,targetName:i,stream:nt.ERROR,streamId:t,reason:Ft(l)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};u.sinkCapability.resolve(),u.ready=u.sinkCapability.promise,this.streamSinks[t]=u,Promise.try(o,e.data,u).then(function(){s.postMessage({sourceName:n,targetName:i,stream:nt.START_COMPLETE,streamId:t,success:!0})},function(l){s.postMessage({sourceName:n,targetName:i,stream:nt.START_COMPLETE,streamId:t,reason:Ft(l)})})}#r(e){let t=e.streamId,n=this.sourceName,i=e.sourceName,s=this.comObj,a=this.streamControllers[t],o=this.streamSinks[t];switch(e.stream){case nt.START_COMPLETE:e.success?a.startCall.resolve():a.startCall.reject(Ft(e.reason));break;case nt.PULL_COMPLETE:e.success?a.pullCall.resolve():a.pullCall.reject(Ft(e.reason));break;case nt.PULL:if(!o){s.postMessage({sourceName:n,targetName:i,stream:nt.PULL_COMPLETE,streamId:t,success:!0});break}o.desiredSize<=0&&e.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=e.desiredSize,Promise.try(o.onPull||bE).then(function(){s.postMessage({sourceName:n,targetName:i,stream:nt.PULL_COMPLETE,streamId:t,success:!0})},function(l){s.postMessage({sourceName:n,targetName:i,stream:nt.PULL_COMPLETE,streamId:t,reason:Ft(l)})});break;case nt.ENQUEUE:if(xe(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(e.chunk);break;case nt.CLOSE:if(xe(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),this.#a(a,t);break;case nt.ERROR:xe(a,"error should have stream controller"),a.controller.error(Ft(e.reason)),this.#a(a,t);break;case nt.CANCEL_COMPLETE:e.success?a.cancelCall.resolve():a.cancelCall.reject(Ft(e.reason)),this.#a(a,t);break;case nt.CANCEL:if(!o)break;let u=Ft(e.reason);Promise.try(o.onCancel||bE,u).then(function(){s.postMessage({sourceName:n,targetName:i,stream:nt.CANCEL_COMPLETE,streamId:t,success:!0})},function(l){s.postMessage({sourceName:n,targetName:i,stream:nt.CANCEL_COMPLETE,streamId:t,reason:Ft(l)})}),o.sinkCapability.reject(u),o.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async#a(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.#e?.abort(),this.#e=null}},Yl=class{#e=!1;constructor({enableHWA:e=!1}){this.#e=e}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");let n=this._createCanvas(e,t);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!this.#e})}}reset(e,t,n){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||n<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=n}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){Oe("Abstract method `_createCanvas` called.")}},C0=class extends Yl{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){let n=this._document.createElement("canvas");return n.width=e,n.height=t,n}},Ql=class{constructor({baseUrl:e=null,isCompressed:t=!0}){this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");let t=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(t).then(n=>({cMapData:n,isCompressed:this.isCompressed})).catch(n=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)})}async _fetch(e){Oe("Abstract method `_fetch` called.")}},Zl=class extends Ql{async _fetch(e){let t=await ho(e,this.isCompressed?"arraybuffer":"text");return t instanceof ArrayBuffer?new Uint8Array(t):co(t)}},zz=fe(2489),Jl=class{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,n,i,s){return"none"}destroy(e=!1){}},k0=class extends Jl{#e;#t;#n;#r;#a;#s;#i=0;constructor({docId:e,ownerDocument:t=globalThis.document}){super(),this.#r=e,this.#a=t}get#o(){return this.#t||=new Map}get#l(){return this.#s||=new Map}get#u(){if(!this.#n){let e=this.#a.createElement("div"),{style:t}=e;t.visibility="hidden",t.contain="strict",t.width=t.height=0,t.position="absolute",t.top=t.left=0,t.zIndex=-1;let n=this.#a.createElementNS(rn,"svg");n.setAttribute("width",0),n.setAttribute("height",0),this.#n=this.#a.createElementNS(rn,"defs"),e.append(n),n.append(this.#n),this.#a.body.append(e)}return this.#n}#d(e){if(e.length===1){let u=e[0],l=new Array(256);for(let h=0;h<256;h++)l[h]=u[h]/255;let c=l.join(",");return[c,c,c]}let[t,n,i]=e,s=new Array(256),a=new Array(256),o=new Array(256);for(let u=0;u<256;u++)s[u]=t[u]/255,a[u]=n[u]/255,o[u]=i[u]/255;return[s.join(","),a.join(","),o.join(",")]}#h(e){if(this.#e===void 0){this.#e="";let t=this.#a.URL;t!==this.#a.baseURI&&(Tc(t)?ue('#createUrl: ignore "data:"-URL for performance reasons.'):this.#e=PE(t,""))}return`url(${this.#e}#${e})`}addFilter(e){if(!e)return"none";let t=this.#o.get(e);if(t)return t;let[n,i,s]=this.#d(e),a=e.length===1?n:`${n}${i}${s}`;if(t=this.#o.get(a),t)return this.#o.set(e,t),t;let o=`g_${this.#r}_transfer_map_${this.#i++}`,u=this.#h(o);this.#o.set(e,u),this.#o.set(a,u);let l=this.#g(o);return this.#p(n,i,s,l),u}addHCMFilter(e,t){let n=`${e}-${t}`,i="base",s=this.#l.get(i);if(s?.key===n||(s?(s.filter?.remove(),s.key=n,s.url="none",s.filter=null):(s={key:n,url:"none",filter:null},this.#l.set(i,s)),!e||!t))return s.url;let a=this.#v(e);e=Q.makeHexColor(...a);let o=this.#v(t);if(t=Q.makeHexColor(...o),this.#u.style.color="",e==="#000000"&&t==="#ffffff"||e===t)return s.url;let u=new Array(256);for(let f=0;f<=255;f++){let p=f/255;u[f]=p<=.03928?p/12.92:((p+.055)/1.055)**2.4}let l=u.join(","),c=`g_${this.#r}_hcm_filter`,h=s.filter=this.#g(c);this.#p(l,l,l,h),this.#m(h);let d=(f,p)=>{let g=a[f]/255,b=o[f]/255,m=new Array(p+1);for(let y=0;y<=p;y++)m[y]=g+y/p*(b-g);return m.join(",")};return this.#p(d(0,5),d(1,5),d(2,5),h),s.url=this.#h(c),s.url}addAlphaFilter(e){let t=this.#o.get(e);if(t)return t;let[n]=this.#d([e]),i=`alpha_${n}`;if(t=this.#o.get(i),t)return this.#o.set(e,t),t;let s=`g_${this.#r}_alpha_map_${this.#i++}`,a=this.#h(s);this.#o.set(e,a),this.#o.set(i,a);let o=this.#g(s);return this.#b(n,o),a}addLuminosityFilter(e){let t=this.#o.get(e||"luminosity");if(t)return t;let n,i;if(e?([n]=this.#d([e]),i=`luminosity_${n}`):i="luminosity",t=this.#o.get(i),t)return this.#o.set(e,t),t;let s=`g_${this.#r}_luminosity_map_${this.#i++}`,a=this.#h(s);this.#o.set(e,a),this.#o.set(i,a);let o=this.#g(s);return this.#f(o),e&&this.#b(n,o),a}addHighlightHCMFilter(e,t,n,i,s){let a=`${t}-${n}-${i}-${s}`,o=this.#l.get(e);if(o?.key===a||(o?(o.filter?.remove(),o.key=a,o.url="none",o.filter=null):(o={key:a,url:"none",filter:null},this.#l.set(e,o)),!t||!n))return o.url;let[u,l]=[t,n].map(this.#v.bind(this)),c=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),h=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),[d,f]=[i,s].map(this.#v.bind(this));h<c&&([c,h,d,f]=[h,c,f,d]),this.#u.style.color="";let p=(m,y,v)=>{let x=new Array(256),w=(h-c)/v,S=m/255,E=(y-m)/(255*v),_=0;for(let T=0;T<=v;T++){let k=Math.round(c+T*w),A=S+T*E;for(let B=_;B<=k;B++)x[B]=A;_=k+1}for(let T=_;T<256;T++)x[T]=x[_-1];return x.join(",")},g=`g_${this.#r}_hcm_${e}_filter`,b=o.filter=this.#g(g);return this.#m(b),this.#p(p(d[0],f[0],5),p(d[1],f[1],5),p(d[2],f[2],5),b),o.url=this.#h(g),o.url}destroy(e=!1){e&&this.#s?.size||(this.#n?.parentNode.parentNode.remove(),this.#n=null,this.#t?.clear(),this.#t=null,this.#s?.clear(),this.#s=null,this.#i=0)}#f(e){let t=this.#a.createElementNS(rn,"feColorMatrix");t.setAttribute("type","matrix"),t.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(t)}#m(e){let t=this.#a.createElementNS(rn,"feColorMatrix");t.setAttribute("type","matrix"),t.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(t)}#g(e){let t=this.#a.createElementNS(rn,"filter");return t.setAttribute("color-interpolation-filters","sRGB"),t.setAttribute("id",e),this.#u.append(t),t}#c(e,t,n){let i=this.#a.createElementNS(rn,t);i.setAttribute("type","discrete"),i.setAttribute("tableValues",n),e.append(i)}#p(e,t,n,i){let s=this.#a.createElementNS(rn,"feComponentTransfer");i.append(s),this.#c(s,"feFuncR",e),this.#c(s,"feFuncG",t),this.#c(s,"feFuncB",n)}#b(e,t){let n=this.#a.createElementNS(rn,"feComponentTransfer");t.append(n),this.#c(n,"feFuncA",e)}#v(e){return this.#u.style.color=e,fo(getComputedStyle(this.#u).getPropertyValue("color"))}},ec=class{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");let t=`${this.baseUrl}${e}`;return this._fetch(t).catch(n=>{throw new Error(`Unable to load font data at: ${t}`)})}async _fetch(e){Oe("Abstract method `_fetch` called.")}},tc=class extends ec{async _fetch(e){let t=await ho(e,"arraybuffer");return new Uint8Array(t)}},rc=class{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!e)throw new Error("Wasm filename must be specified.");let t=`${this.baseUrl}${e}`;return this._fetch(t).catch(n=>{throw new Error(`Unable to load wasm data at: ${t}`)})}async _fetch(e){Oe("Abstract method `_fetch` called.")}},nc=class extends rc{async _fetch(e){let t=await ho(e,"arraybuffer");return new Uint8Array(t)}};if(Rt){let r;try{let e=process.getBuiltinModule("module").createRequire(import.meta.url);try{r=e("@napi-rs/canvas")}catch(t){ue(`Cannot load "@napi-rs/canvas" package: "${t}".`)}}catch(e){ue(`Cannot access the \`require\` function: "${e}".`)}globalThis.DOMMatrix||(r?.DOMMatrix?globalThis.DOMMatrix=r.DOMMatrix:ue("Cannot polyfill `DOMMatrix`, rendering may be broken.")),globalThis.ImageData||(r?.ImageData?globalThis.ImageData=r.ImageData:ue("Cannot polyfill `ImageData`, rendering may be broken.")),globalThis.Path2D||(r?.Path2D?globalThis.Path2D=r.Path2D:ue("Cannot polyfill `Path2D`, rendering may be broken.")),globalThis.navigator?.language||(globalThis.navigator={language:"en-US",platform:"",userAgent:""})}async function jg(r){let t=await process.getBuiltinModule("fs").promises.readFile(r);return new Uint8Array(t)}var I0=class extends Jl{},R0=class extends Yl{_createCanvas(e,t){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,t)}},P0=class extends Ql{async _fetch(e){return jg(e)}},O0=class extends ec{async _fetch(e){return jg(e)}},L0=class extends rc{async _fetch(e){return jg(e)}},jz=fe(7588),us="__forcedDependency",{floor:yE,ceil:vE}=Math;function Ll(r,e,t,n,i,s){r[e*4+0]=Math.min(r[e*4+0],t),r[e*4+1]=Math.min(r[e*4+1],n),r[e*4+2]=Math.max(r[e*4+2],i),r[e*4+3]=Math.max(r[e*4+3],s)}var N0=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],M0=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get length(){return this.#e.length}isEmpty(e){return this.#e[e]===N0}minX(e){return this.#t[e*4+0]/256}minY(e){return this.#t[e*4+1]/256}maxX(e){return(this.#t[e*4+2]+1)/256}maxY(e){return(this.#t[e*4+3]+1)/256}},Nl=(r,e)=>{if(!r)return;let t=r.get(e);return t||(t={dependencies:new Set,isRenderingOperation:!1},r.set(e,t)),t},B0=class{#e={__proto__:null};#t={__proto__:null,transform:[],moveText:[],sameLineText:[],[us]:[]};#n=new Map;#r=[];#a=[];#s=[[1,0,0,1,0,0]];#i=[-1/0,-1/0,1/0,1/0];#o=new Float64Array([1/0,1/0,-1/0,-1/0]);#l=-1;#u=new Set;#d=new Map;#h=new Map;#f;#m;#g;#c;#p;constructor(e,t,n=!1){this.#f=e.width,this.#m=e.height,this.#b(t),n&&(this.#p=new Map)}growOperationsCount(e){e>=this.#c.length&&this.#b(e,this.#c)}#b(e,t){let n=new ArrayBuffer(e*4);this.#g=new Uint8ClampedArray(n),this.#c=new Uint32Array(n),t&&t.length>0?(this.#c.set(t),this.#c.fill(N0,t.length)):this.#c.fill(N0)}save(e){return this.#e={__proto__:this.#e},this.#t={__proto__:this.#t,transform:{__proto__:this.#t.transform},moveText:{__proto__:this.#t.moveText},sameLineText:{__proto__:this.#t.sameLineText},[us]:{__proto__:this.#t[us]}},this.#i={__proto__:this.#i},this.#r.push(e),this}restore(e){let t=Object.getPrototypeOf(this.#e);if(t===null)return this;this.#e=t,this.#t=Object.getPrototypeOf(this.#t),this.#i=Object.getPrototypeOf(this.#i);let n=this.#r.pop();return n!==void 0&&(Nl(this.#p,e)?.dependencies.add(n),this.#c[e]=this.#c[n]),this}recordOpenMarker(e){return this.#r.push(e),this}getOpenMarker(){return this.#r.length===0?null:this.#r.at(-1)}recordCloseMarker(e){let t=this.#r.pop();return t!==void 0&&(Nl(this.#p,e)?.dependencies.add(t),this.#c[e]=this.#c[t]),this}beginMarkedContent(e){return this.#a.push(e),this}endMarkedContent(e){let t=this.#a.pop();return t!==void 0&&(Nl(this.#p,e)?.dependencies.add(t),this.#c[e]=this.#c[t]),this}pushBaseTransform(e){return this.#s.push(Q.multiplyByDOMMatrix(this.#s.at(-1),e.getTransform())),this}popBaseTransform(){return this.#s.length>1&&this.#s.pop(),this}recordSimpleData(e,t){return this.#e[e]=t,this}recordIncrementalData(e,t){return this.#t[e].push(t),this}resetIncrementalData(e,t){return this.#t[e].length=0,this}recordNamedData(e,t){return this.#n.set(e,t),this}recordSimpleDataFromNamed(e,t,n){this.#e[e]=this.#n.get(t)??n}recordFutureForcedDependency(e,t){return this.recordIncrementalData(us,t),this}inheritSimpleDataAsFutureForcedDependencies(e){for(let t of e)t in this.#e&&this.recordFutureForcedDependency(t,this.#e[t]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let e of this.#u)this.recordFutureForcedDependency(us,e);return this}resetBBox(e){return this.#l!==e&&(this.#l=e,this.#o[0]=1/0,this.#o[1]=1/0,this.#o[2]=-1/0,this.#o[3]=-1/0),this}recordClipBox(e,t,n,i,s,a){let o=Q.multiplyByDOMMatrix(this.#s.at(-1),t.getTransform()),u=[1/0,1/0,-1/0,-1/0];Q.axialAlignedBoundingBox([n,s,i,a],o,u);let l=Q.intersect(this.#i,u);return l?(this.#i[0]=l[0],this.#i[1]=l[1],this.#i[2]=l[2],this.#i[3]=l[3]):(this.#i[0]=this.#i[1]=1/0,this.#i[2]=this.#i[3]=-1/0),this}recordBBox(e,t,n,i,s,a){let o=this.#i;if(o[0]===1/0)return this;let u=Q.multiplyByDOMMatrix(this.#s.at(-1),t.getTransform());if(o[0]===-1/0)return Q.axialAlignedBoundingBox([n,s,i,a],u,this.#o),this;let l=[1/0,1/0,-1/0,-1/0];return Q.axialAlignedBoundingBox([n,s,i,a],u,l),this.#o[0]=Math.min(this.#o[0],Math.max(l[0],o[0])),this.#o[1]=Math.min(this.#o[1],Math.max(l[1],o[1])),this.#o[2]=Math.max(this.#o[2],Math.min(l[2],o[2])),this.#o[3]=Math.max(this.#o[3],Math.min(l[3],o[3])),this}recordCharacterBBox(e,t,n,i=1,s=0,a=0,o){let u=n.bbox,l,c;if(u&&(l=u[2]!==u[0]&&u[3]!==u[1]&&this.#h.get(n),l!==!1&&(c=[0,0,0,0],Q.axialAlignedBoundingBox(u,n.fontMatrix,c),(i!==1||s!==0||a!==0)&&Q.scaleMinMax([i,0,0,-i,s,a],c),l)))return this.recordBBox(e,t,c[0],c[2],c[1],c[3]);if(!o)return this.recordFullPageBBox(e);let h=o();return u&&c&&l===void 0&&(l=c[0]<=s-h.actualBoundingBoxLeft&&c[2]>=s+h.actualBoundingBoxRight&&c[1]<=a-h.actualBoundingBoxAscent&&c[3]>=a+h.actualBoundingBoxDescent,this.#h.set(n,l),l)?this.recordBBox(e,t,c[0],c[2],c[1],c[3]):this.recordBBox(e,t,s-h.actualBoundingBoxLeft,s+h.actualBoundingBoxRight,a-h.actualBoundingBoxAscent,a+h.actualBoundingBoxDescent)}recordFullPageBBox(e){return this.#o[0]=Math.max(0,this.#i[0]),this.#o[1]=Math.max(0,this.#i[1]),this.#o[2]=Math.min(this.#f,this.#i[2]),this.#o[3]=Math.min(this.#m,this.#i[3]),this}getSimpleIndex(e){return this.#e[e]}recordDependencies(e,t){let n=this.#u,i=this.#e,s=this.#t;for(let a of t)a in this.#e?n.add(i[a]):a in s&&s[a].forEach(n.add,n);return this}recordNamedDependency(e,t){return this.#n.has(t)&&this.#u.add(this.#n.get(t)),this}recordOperation(e,t=!1){if(this.recordDependencies(e,[us]),this.#p){let n=Nl(this.#p,e),{dependencies:i}=n;this.#u.forEach(i.add,i),this.#r.forEach(i.add,i),this.#a.forEach(i.add,i),i.delete(e),n.isRenderingOperation=!0}if(this.#l===e){let n=yE(this.#o[0]*256/this.#f),i=yE(this.#o[1]*256/this.#m),s=vE(this.#o[2]*256/this.#f),a=vE(this.#o[3]*256/this.#m);Ll(this.#g,e,n,i,s,a);for(let o of this.#u)o!==e&&Ll(this.#g,o,n,i,s,a);for(let o of this.#r)o!==e&&Ll(this.#g,o,n,i,s,a);for(let o of this.#a)o!==e&&Ll(this.#g,o,n,i,s,a);t||(this.#u.clear(),this.#l=-1)}return this}recordShowTextOperation(e,t=!1){let n=Array.from(this.#u);this.recordOperation(e,t),this.recordIncrementalData("sameLineText",e);for(let i of n)this.recordIncrementalData("sameLineText",i);return this}bboxToClipBoxDropOperation(e,t=!1){return this.#l===e&&(this.#l=-1,this.#i[0]=Math.max(this.#i[0],this.#o[0]),this.#i[1]=Math.max(this.#i[1],this.#o[1]),this.#i[2]=Math.min(this.#i[2],this.#o[2]),this.#i[3]=Math.min(this.#i[3],this.#o[3]),t||this.#u.clear()),this}_takePendingDependencies(){let e=this.#u;return this.#u=new Set,e}_extractOperation(e){let t=this.#d.get(e);return this.#d.delete(e),t}_pushPendingDependencies(e){for(let t of e)this.#u.add(t)}take(){return this.#h.clear(),new M0(this.#c,this.#g)}takeDebugMetadata(){return this.#p}},ic=class r{#e;#t;#n;#r=0;#a=0;constructor(e,t,n){if(e instanceof r&&e.#n===!!n)return e;this.#e=e,this.#t=t,this.#n=!!n}growOperationsCount(){throw new Error("Unreachable")}save(e){return this.#a++,this.#e.save(this.#t),this}restore(e){return this.#a>0&&(this.#e.restore(this.#t),this.#a--),this}recordOpenMarker(e){return this.#r++,this}getOpenMarker(){return this.#r>0?this.#t:this.#e.getOpenMarker()}recordCloseMarker(e){return this.#r--,this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return this.#e.pushBaseTransform(e),this}popBaseTransform(){return this.#e.popBaseTransform(),this}recordSimpleData(e,t){return this.#e.recordSimpleData(e,this.#t),this}recordIncrementalData(e,t){return this.#e.recordIncrementalData(e,this.#t),this}resetIncrementalData(e,t){return this.#e.resetIncrementalData(e,this.#t),this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return this.#e.recordSimpleDataFromNamed(e,t,this.#t),this}recordFutureForcedDependency(e,t){return this.#e.recordFutureForcedDependency(e,this.#t),this}inheritSimpleDataAsFutureForcedDependencies(e){return this.#e.inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return this.#e.inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){return this.#n||this.#e.resetBBox(this.#t),this}recordClipBox(e,t,n,i,s,a){return this.#n||this.#e.recordClipBox(this.#t,t,n,i,s,a),this}recordBBox(e,t,n,i,s,a){return this.#n||this.#e.recordBBox(this.#t,t,n,i,s,a),this}recordCharacterBBox(e,t,n,i,s,a,o){return this.#n||this.#e.recordCharacterBBox(this.#t,t,n,i,s,a,o),this}recordFullPageBBox(e){return this.#n||this.#e.recordFullPageBBox(this.#t),this}getSimpleIndex(e){return this.#e.getSimpleIndex(e)}recordDependencies(e,t){return this.#e.recordDependencies(this.#t,t),this}recordNamedDependency(e,t){return this.#e.recordNamedDependency(this.#t,t),this}recordOperation(e){return this.#e.recordOperation(this.#t,!0),this}recordShowTextOperation(e){return this.#e.recordShowTextOperation(this.#t,!0),this}bboxToClipBoxDropOperation(e){return this.#n||this.#e.bboxToClipBoxDropOperation(this.#t,!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}},or={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["filter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","fillColor"]},gt={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function D0(r,e){if(!e)return;let t=e[2]-e[0],n=e[3]-e[1],i=new Path2D;i.rect(e[0],e[1],t,n),r.clip(i)}var to=class{isModifyingCurrentTransform(){return!1}getPattern(){Oe("Abstract method `getPattern` called.")}},F0=class extends to{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type==="radial"}_createGradient(e,t=null){let n,i=this._p0,s=this._p1;if(t&&(i=i.slice(),s=s.slice(),Q.applyTransform(i,t),Q.applyTransform(s,t)),this._type==="axial")n=e.createLinearGradient(i[0],i[1],s[0],s[1]);else if(this._type==="radial"){let a=this._r0,o=this._r1;if(t){let u=new Float32Array(2);Q.singularValueDecompose2dScale(t,u),a*=u[0],o*=u[0]}n=e.createRadialGradient(i[0],i[1],a,s[0],s[1],o)}for(let a of this._colorStops)n.addColorStop(a[0],a[1]);return n}getPattern(e,t,n,i){let s;if(i===gt.STROKE||i===gt.FILL){if(this.isOriginBased()){let d=Q.transform(n,t.baseTransform);this.matrix&&(d=Q.transform(d,this.matrix));let f=.001,p=Math.hypot(d[0],d[1]),g=Math.hypot(d[2],d[3]),b=(d[0]*d[2]+d[1]*d[3])/(p*g);if(Math.abs(b)<f)if(this.isRadial()){if(Math.abs(p-g)<f)return this._createGradient(e,d)}else return this._createGradient(e,d)}let a=t.current.getClippedPathBoundingBox(i,He(e))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,u=Math.ceil(a[3]-a[1])||1,l=t.cachedCanvases.getCanvas("pattern",o,u),c=l.context;c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-a[0],-a[1]),n=Q.transform(n,[1,0,0,1,a[0],a[1]]),c.transform(...t.baseTransform),this.matrix&&c.transform(...this.matrix),D0(c,this._bbox),c.fillStyle=this._createGradient(c),c.fill(),s=e.createPattern(l.canvas,"no-repeat");let h=new DOMMatrix(n);s.setTransform(h)}else D0(e,this._bbox),s=this._createGradient(e);return s}};function t0(r,e,t,n,i,s,a,o){let u=e.coords,l=e.colors,c=r.data,h=r.width*4,d;u[t+1]>u[n+1]&&(d=t,t=n,n=d,d=s,s=a,a=d),u[n+1]>u[i+1]&&(d=n,n=i,i=d,d=a,a=o,o=d),u[t+1]>u[n+1]&&(d=t,t=n,n=d,d=s,s=a,a=d);let f=(u[t]+e.offsetX)*e.scaleX,p=(u[t+1]+e.offsetY)*e.scaleY,g=(u[n]+e.offsetX)*e.scaleX,b=(u[n+1]+e.offsetY)*e.scaleY,m=(u[i]+e.offsetX)*e.scaleX,y=(u[i+1]+e.offsetY)*e.scaleY;if(p>=y)return;let v=l[s],x=l[s+1],w=l[s+2],S=l[a],E=l[a+1],_=l[a+2],T=l[o],k=l[o+1],A=l[o+2],B=Math.round(p),D=Math.round(y),P,M,L,N,I,H,J,ee;for(let X=B;X<=D;X++){if(X<b){let $=X<p?0:(p-X)/(p-b);P=f-(f-g)*$,M=v-(v-S)*$,L=x-(x-E)*$,N=w-(w-_)*$}else{let $;X>y?$=1:b===y?$=0:$=(b-X)/(b-y),P=g-(g-m)*$,M=S-(S-T)*$,L=E-(E-k)*$,N=_-(_-A)*$}let q;X<p?q=0:X>y?q=1:q=(p-X)/(p-y),I=f-(f-m)*q,H=v-(v-T)*q,J=x-(x-k)*q,ee=w-(w-A)*q;let ie=Math.round(Math.min(P,I)),pe=Math.round(Math.max(P,I)),W=h*X+ie*4;for(let $=ie;$<=pe;$++)q=(P-$)/(P-I),q<0?q=0:q>1&&(q=1),c[W++]=M-(M-H)*q|0,c[W++]=L-(L-J)*q|0,c[W++]=N-(N-ee)*q|0,c[W++]=255}}function D5(r,e,t){let n=e.coords,i=e.colors,s,a;switch(e.type){case a0.LATTICE:let o=e.verticesPerRow,u=Math.floor(n.length/o)-1,l=o-1;for(s=0;s<u;s++){let c=s*o;for(let h=0;h<l;h++,c++)t0(r,t,n[c],n[c+1],n[c+o],i[c],i[c+1],i[c+o]),t0(r,t,n[c+o+1],n[c+1],n[c+o],i[c+o+1],i[c+1],i[c+o])}break;case a0.TRIANGLES:for(s=0,a=n.length;s<a;s+=3)t0(r,t,n[s],n[s+1],n[s+2],i[s],i[s+1],i[s+2]);break;default:throw new Error("illegal figure")}}var $0=class extends to{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],this.matrix=null}_createMeshCanvas(e,t,n){let o=Math.floor(this._bounds[0]),u=Math.floor(this._bounds[1]),l=Math.ceil(this._bounds[2])-o,c=Math.ceil(this._bounds[3])-u,h=Math.min(Math.ceil(Math.abs(l*e[0]*1.1)),3e3),d=Math.min(Math.ceil(Math.abs(c*e[1]*1.1)),3e3),f=l/h,p=c/d,g={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-u,scaleX:1/f,scaleY:1/p},b=h+4,m=d+4,y=n.getCanvas("mesh",b,m),v=y.context,x=v.createImageData(h,d);if(t){let S=x.data;for(let E=0,_=S.length;E<_;E+=4)S[E]=t[0],S[E+1]=t[1],S[E+2]=t[2],S[E+3]=255}for(let S of this._figures)D5(x,S,g);return v.putImageData(x,2,2),{canvas:y.canvas,offsetX:o-2*f,offsetY:u-2*p,scaleX:f,scaleY:p}}isModifyingCurrentTransform(){return!0}getPattern(e,t,n,i){D0(e,this._bbox);let s=new Float32Array(2);if(i===gt.SHADING)Q.singularValueDecompose2dScale(He(e),s);else if(this.matrix){Q.singularValueDecompose2dScale(this.matrix,s);let[o,u]=s;Q.singularValueDecompose2dScale(t.baseTransform,s),s[0]*=o,s[1]*=u}else Q.singularValueDecompose2dScale(t.baseTransform,s);let a=this._createMeshCanvas(s,i===gt.SHADING?null:this._background,t.cachedCanvases);return i!==gt.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(a.offsetX,a.offsetY),e.scale(a.scaleX,a.scaleY),e.createPattern(a.canvas,"no-repeat")}},U0=class extends to{getPattern(){return"hotpink"}};function F5(r){switch(r[0]){case"RadialAxial":return new F0(r);case"Mesh":return new $0(r);case"Dummy":return new U0}throw new Error(`Unknown IR type: ${r[0]}`)}var wE={COLORED:1,UNCOLORED:2},z0=class r{static MAX_PATTERN_SIZE=3e3;constructor(e,t,n,i){this.color=e[1],this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.ctx=t,this.canvasGraphicsFactory=n,this.baseTransform=i}createPatternCanvas(e,t){let{bbox:n,operatorList:i,paintType:s,tilingType:a,color:o,canvasGraphicsFactory:u}=this,{xstep:l,ystep:c}=this;l=Math.abs(l),c=Math.abs(c),Ac("TilingType: "+a);let h=n[0],d=n[1],f=n[2],p=n[3],g=f-h,b=p-d,m=new Float32Array(2);Q.singularValueDecompose2dScale(this.matrix,m);let[y,v]=m;Q.singularValueDecompose2dScale(this.baseTransform,m);let x=y*m[0],w=v*m[1],S=g,E=b,_=!1,T=!1,k=Math.ceil(l*x),A=Math.ceil(c*w),B=Math.ceil(g*x),D=Math.ceil(b*w);k>=B?S=l:_=!0,A>=D?E=c:T=!0;let P=this.getSizeAndScale(S,this.ctx.canvas.width,x),M=this.getSizeAndScale(E,this.ctx.canvas.height,w),L=e.cachedCanvases.getCanvas("pattern",P.size,M.size),N=L.context,I=u.createCanvasGraphics(N,t);if(I.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(I,s,o),N.translate(-P.scale*h,-M.scale*d),I.transform(0,P.scale,0,0,M.scale,0,0),N.save(),I.dependencyTracker?.save(),this.clipBbox(I,h,d,f,p),I.baseTransform=He(I.ctx),I.executeOperatorList(i),I.endDrawing(),I.dependencyTracker?.restore(),N.restore(),_||T){let H=L.canvas;_&&(S=l),T&&(E=c);let J=this.getSizeAndScale(S,this.ctx.canvas.width,x),ee=this.getSizeAndScale(E,this.ctx.canvas.height,w),X=J.size,q=ee.size,ie=e.cachedCanvases.getCanvas("pattern-workaround",X,q),pe=ie.context,W=_?Math.floor(g/l):0,$=T?Math.floor(b/c):0;for(let G=0;G<=W;G++)for(let Y=0;Y<=$;Y++)pe.drawImage(H,X*G,q*Y,X,q,0,0,X,q);return{canvas:ie.canvas,scaleX:J.scale,scaleY:ee.scale,offsetX:h,offsetY:d}}return{canvas:L.canvas,scaleX:P.scale,scaleY:M.scale,offsetX:h,offsetY:d}}getSizeAndScale(e,t,n){let i=Math.max(r.MAX_PATTERN_SIZE,t),s=Math.ceil(e*n);return s>=i?s=i:n=s/e,{scale:n,size:s}}clipBbox(e,t,n,i,s){let a=i-t,o=s-n;e.ctx.rect(t,n,a,o),Q.axialAlignedBoundingBox([t,n,i,s],He(e.ctx),e.current.minMax),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,n){let i=e.ctx,s=e.current;switch(t){case wE.COLORED:let{fillStyle:a,strokeStyle:o}=this.ctx;i.fillStyle=s.fillColor=a,i.strokeStyle=s.strokeColor=o;break;case wE.UNCOLORED:i.fillStyle=i.strokeStyle=n,s.fillColor=s.strokeColor=n;break;default:throw new o0(`Unsupported paint type: ${t}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,t,n,i,s){let a=n;i!==gt.SHADING&&(a=Q.transform(a,t.baseTransform),this.matrix&&(a=Q.transform(a,this.matrix)));let o=this.createPatternCanvas(t,s),u=new DOMMatrix(a);u=u.translate(o.offsetX,o.offsetY),u=u.scale(1/o.scaleX,1/o.scaleY);let l=e.createPattern(o.canvas,"repeat");return l.setTransform(u),l}};function $5({src:r,srcPos:e=0,dest:t,width:n,height:i,nonBlackColor:s=4294967295,inverseDecode:a=!1}){let o=Je.isLittleEndian?4278190080:255,[u,l]=a?[s,o]:[o,s],c=n>>3,h=n&7,d=r.length;t=new Uint32Array(t.buffer);let f=0;for(let p=0;p<i;p++){for(let b=e+c;e<b;e++){let m=e<d?r[e]:255;t[f++]=m&128?l:u,t[f++]=m&64?l:u,t[f++]=m&32?l:u,t[f++]=m&16?l:u,t[f++]=m&8?l:u,t[f++]=m&4?l:u,t[f++]=m&2?l:u,t[f++]=m&1?l:u}if(h===0)continue;let g=e<d?r[e++]:255;for(let b=0;b<h;b++)t[f++]=g&1<<7-b?l:u}return{srcPos:e,destPos:f}}var xE=16,SE=100,U5=15,EE=10,$t=16,r0=new DOMMatrix,qt=new Float32Array(2),fs=new Float32Array([1/0,1/0,-1/0,-1/0]);function z5(r,e){if(r._removeMirroring)throw new Error("Context is already forwarding operations.");r.__originalSave=r.save,r.__originalRestore=r.restore,r.__originalRotate=r.rotate,r.__originalScale=r.scale,r.__originalTranslate=r.translate,r.__originalTransform=r.transform,r.__originalSetTransform=r.setTransform,r.__originalResetTransform=r.resetTransform,r.__originalClip=r.clip,r.__originalMoveTo=r.moveTo,r.__originalLineTo=r.lineTo,r.__originalBezierCurveTo=r.bezierCurveTo,r.__originalRect=r.rect,r.__originalClosePath=r.closePath,r.__originalBeginPath=r.beginPath,r._removeMirroring=()=>{r.save=r.__originalSave,r.restore=r.__originalRestore,r.rotate=r.__originalRotate,r.scale=r.__originalScale,r.translate=r.__originalTranslate,r.transform=r.__originalTransform,r.setTransform=r.__originalSetTransform,r.resetTransform=r.__originalResetTransform,r.clip=r.__originalClip,r.moveTo=r.__originalMoveTo,r.lineTo=r.__originalLineTo,r.bezierCurveTo=r.__originalBezierCurveTo,r.rect=r.__originalRect,r.closePath=r.__originalClosePath,r.beginPath=r.__originalBeginPath,delete r._removeMirroring},r.save=function(){e.save(),this.__originalSave()},r.restore=function(){e.restore(),this.__originalRestore()},r.translate=function(t,n){e.translate(t,n),this.__originalTranslate(t,n)},r.scale=function(t,n){e.scale(t,n),this.__originalScale(t,n)},r.transform=function(t,n,i,s,a,o){e.transform(t,n,i,s,a,o),this.__originalTransform(t,n,i,s,a,o)},r.setTransform=function(t,n,i,s,a,o){e.setTransform(t,n,i,s,a,o),this.__originalSetTransform(t,n,i,s,a,o)},r.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},r.rotate=function(t){e.rotate(t),this.__originalRotate(t)},r.clip=function(t){e.clip(t),this.__originalClip(t)},r.moveTo=function(t,n){e.moveTo(t,n),this.__originalMoveTo(t,n)},r.lineTo=function(t,n){e.lineTo(t,n),this.__originalLineTo(t,n)},r.bezierCurveTo=function(t,n,i,s,a,o){e.bezierCurveTo(t,n,i,s,a,o),this.__originalBezierCurveTo(t,n,i,s,a,o)},r.rect=function(t,n,i,s){e.rect(t,n,i,s),this.__originalRect(t,n,i,s)},r.closePath=function(){e.closePath(),this.__originalClosePath()},r.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}var j0=class{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,n){let i;return this.cache[e]!==void 0?(i=this.cache[e],this.canvasFactory.reset(i,t,n)):(i=this.canvasFactory.create(t,n),this.cache[e]=i),i}delete(e){delete this.cache[e]}clear(){for(let e in this.cache){let t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}};function Ml(r,e,t,n,i,s,a,o,u,l){let[c,h,d,f,p,g]=He(r);if(h===0&&d===0){let y=a*c+p,v=Math.round(y),x=o*f+g,w=Math.round(x),S=(a+u)*c+p,E=Math.abs(Math.round(S)-v)||1,_=(o+l)*f+g,T=Math.abs(Math.round(_)-w)||1;return r.setTransform(Math.sign(c),0,0,Math.sign(f),v,w),r.drawImage(e,t,n,i,s,0,0,E,T),r.setTransform(c,h,d,f,p,g),[E,T]}if(c===0&&f===0){let y=o*d+p,v=Math.round(y),x=a*h+g,w=Math.round(x),S=(o+l)*d+p,E=Math.abs(Math.round(S)-v)||1,_=(a+u)*h+g,T=Math.abs(Math.round(_)-w)||1;return r.setTransform(0,Math.sign(h),Math.sign(d),0,v,w),r.drawImage(e,t,n,i,s,0,0,T,E),r.setTransform(c,h,d,f,p,g),[T,E]}r.drawImage(e,t,n,i,s,a,o,u,l);let b=Math.hypot(c,h),m=Math.hypot(d,f);return[b*u,m*l]}var sc=class{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=s0;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=ot.FILL;textRise=0;fillColor="#000000";strokeColor="#000000";patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps="none";constructor(e,t,n){n?.(this),this.clipBox=new Float32Array([0,0,e,t]),this.minMax=fs.slice()}clone(){let e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e}getPathBoundingBox(e=gt.FILL,t=null){let n=this.minMax.slice();if(e===gt.STROKE){t||Oe("Stroke bounding box must include transform."),Q.singularValueDecompose2dScale(t,qt);let i=qt[0]*this.lineWidth/2,s=qt[1]*this.lineWidth/2;n[0]-=i,n[1]-=s,n[2]+=i,n[3]+=s}return n}updateClipFromPath(){let e=Q.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set(fs,0)}getClippedPathBoundingBox(e=gt.FILL,t=null){return Q.intersect(this.clipBox,this.getPathBoundingBox(e,t))}};function AE(r,e){if(e instanceof ImageData){r.putImageData(e,0,0);return}let t=e.height,n=e.width,i=t%$t,s=(t-i)/$t,a=i===0?s:s+1,o=r.createImageData(n,$t),u=0,l,c=e.data,h=o.data,d,f,p,g;if(e.kind===Ul.GRAYSCALE_1BPP){let b=c.byteLength,m=new Uint32Array(h.buffer,0,h.byteLength>>2),y=m.length,v=n+7>>3,x=4294967295,w=Je.isLittleEndian?4278190080:255;for(d=0;d<a;d++){for(p=d<s?$t:i,l=0,f=0;f<p;f++){let S=b-u,E=0,_=S>v?n:S*8-7,T=_&-8,k=0,A=0;for(;E<T;E+=8)A=c[u++],m[l++]=A&128?x:w,m[l++]=A&64?x:w,m[l++]=A&32?x:w,m[l++]=A&16?x:w,m[l++]=A&8?x:w,m[l++]=A&4?x:w,m[l++]=A&2?x:w,m[l++]=A&1?x:w;for(;E<_;E++)k===0&&(A=c[u++],k=128),m[l++]=A&k?x:w,k>>=1}for(;l<y;)m[l++]=0;r.putImageData(o,0,d*$t)}}else if(e.kind===Ul.RGBA_32BPP){for(f=0,g=n*$t*4,d=0;d<s;d++)h.set(c.subarray(u,u+g)),u+=g,r.putImageData(o,0,f),f+=$t;d<a&&(g=n*i*4,h.set(c.subarray(u,u+g)),r.putImageData(o,0,f))}else if(e.kind===Ul.RGB_24BPP)for(p=$t,g=n*p,d=0;d<a;d++){for(d>=s&&(p=i,g=n*p),l=0,f=g;f--;)h[l++]=c[u++],h[l++]=c[u++],h[l++]=c[u++],h[l++]=255;r.putImageData(o,0,d*$t)}else throw new Error(`bad image kind: ${e.kind}`)}function TE(r,e){if(e.bitmap){r.drawImage(e.bitmap,0,0);return}let t=e.height,n=e.width,i=t%$t,s=(t-i)/$t,a=i===0?s:s+1,o=r.createImageData(n,$t),u=0,l=e.data,c=o.data;for(let h=0;h<a;h++){let d=h<s?$t:i;({srcPos:u}=$5({src:l,srcPos:u,dest:c,width:n,height:d,nonBlackColor:0})),r.putImageData(o,0,h*$t)}}function Ua(r,e){let t=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(let n of t)r[n]!==void 0&&(e[n]=r[n]);r.setLineDash!==void 0&&(e.setLineDash(r.getLineDash()),e.lineDashOffset=r.lineDashOffset)}function Bl(r){r.strokeStyle=r.fillStyle="#000000",r.fillRule="nonzero",r.globalAlpha=1,r.lineWidth=1,r.lineCap="butt",r.lineJoin="miter",r.miterLimit=10,r.globalCompositeOperation="source-over",r.font="10px sans-serif",r.setLineDash!==void 0&&(r.setLineDash([]),r.lineDashOffset=0);let{filter:e}=r;e!=="none"&&e!==""&&(r.filter="none")}function _E(r,e){if(e)return!0;Q.singularValueDecompose2dScale(r,qt);let t=Math.fround(nn.pixelRatio*An.PDF_TO_CSS_UNITS);return qt[0]<=t&&qt[1]<=t}var j5=["butt","round","square"],H5=["miter","round","bevel"],W5={},CE={},ps=class r{constructor(e,t,n,i,s,{optionalContentConfig:a,markedContentStack:o=null},u,l,c){this.ctx=e,this.current=new sc(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=n,this.canvasFactory=i,this.filterFactory=s,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=a,this.cachedCanvases=new j0(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=u,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=c??null}getObject(e,t,n=null){return typeof t=="string"?(this.dependencyTracker?.recordNamedDependency(e,t),t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t)):n}beginDrawing({transform:e,viewport:t,transparency:n=!1,background:i=null}){let s=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,s,a),this.ctx.fillStyle=o,n){let u=this.cachedCanvases.getCanvas("transparent",s,a);this.compositeCtx=this.ctx,this.transparentCanvas=u.canvas,this.ctx=u.context,this.ctx.save(),this.ctx.transform(...He(this.compositeCtx))}this.ctx.save(),Bl(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=He(this.ctx)}executeOperatorList(e,t,n,i,s){let a=e.argsArray,o=e.fnArray,u=t||0,l=a.length;if(l===u)return u;let c=l-u>EE&&typeof n=="function",h=c?Date.now()+U5:0,d=0,f=this.commonObjs,p=this.objs,g,b;for(;;){if(i!==void 0&&u===i.nextBreakPoint)return i.breakIt(u,n),u;if(!s||s(u))if(g=o[u],b=a[u]??null,g!==Ka.dependency)b===null?this[g](u):this[g](u,...b);else for(let m of b){this.dependencyTracker?.recordNamedData(m,u);let y=m.startsWith("g_")?f:p;if(!y.has(m))return y.get(m,n),u}if(u++,u===l)return u;if(c&&++d>EE){if(Date.now()>h)return n(),u;d=0}}}#e(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){this.#e(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(let e of this._cachedBitmapsMap.values()){for(let t of e.values())typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#t()}#t(){if(this.pageColors){let e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){let t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(e,t){let n=e.width??e.displayWidth,i=e.height??e.displayHeight,s=Math.max(Math.hypot(t[0],t[1]),1),a=Math.max(Math.hypot(t[2],t[3]),1),o=n,u=i,l="prescale1",c,h;for(;s>2&&o>1||a>2&&u>1;){let d=o,f=u;s>2&&o>1&&(d=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),s/=o/d),a>2&&u>1&&(f=u>=16384?Math.floor(u/2)-1||1:Math.ceil(u)/2,a/=u/f),c=this.cachedCanvases.getCanvas(l,d,f),h=c.context,h.clearRect(0,0,d,f),h.drawImage(e,0,0,o,u,0,0,d,f),e=c.canvas,o=d,u=f,l=l==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:o,paintHeight:u}}_createMaskCanvas(e,t){let n=this.ctx,{width:i,height:s}=t,a=this.current.fillColor,o=this.current.patternFill,u=He(n),l,c,h,d;if((t.bitmap||t.data)&&t.count>1){let k=t.bitmap||t.data.buffer;c=JSON.stringify(o?u:[u.slice(0,4),a]),l=this._cachedBitmapsMap.get(k),l||(l=new Map,this._cachedBitmapsMap.set(k,l));let A=l.get(c);if(A&&!o){let B=Math.round(Math.min(u[0],u[2])+u[4]),D=Math.round(Math.min(u[1],u[3])+u[5]);return this.dependencyTracker?.recordDependencies(e,or.transformAndFill),{canvas:A,offsetX:B,offsetY:D}}h=A}h||(d=this.cachedCanvases.getCanvas("maskCanvas",i,s),TE(d.context,t));let f=Q.transform(u,[1/i,0,0,-1/s,0,0]);f=Q.transform(f,[1,0,0,1,0,-s]);let p=fs.slice();Q.axialAlignedBoundingBox([0,0,i,s],f,p);let[g,b,m,y]=p,v=Math.round(m-g)||1,x=Math.round(y-b)||1,w=this.cachedCanvases.getCanvas("fillCanvas",v,x),S=w.context,E=g,_=b;S.translate(-E,-_),S.transform(...f),h||(h=this._scaleImage(d.canvas,Mr(S)),h=h.img,l&&o&&l.set(c,h)),S.imageSmoothingEnabled=_E(He(S),t.interpolate),Ml(S,h,0,0,h.width,h.height,0,0,i,s),S.globalCompositeOperation="source-in";let T=Q.transform(Mr(S),[1,0,0,1,-E,-_]);return S.fillStyle=o?a.getPattern(n,this,T,gt.FILL,e):a,S.fillRect(0,0,i,s),l&&!o&&(this.cachedCanvases.delete("fillCanvas"),l.set(c,w.canvas)),this.dependencyTracker?.recordDependencies(e,or.transformAndFill),{canvas:w.canvas,offsetX:Math.round(E),offsetY:Math.round(_)}}setLineWidth(e,t){this.dependencyTracker?.recordSimpleData("lineWidth",e),t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(e,t){this.dependencyTracker?.recordSimpleData("lineCap",e),this.ctx.lineCap=j5[t]}setLineJoin(e,t){this.dependencyTracker?.recordSimpleData("lineJoin",e),this.ctx.lineJoin=H5[t]}setMiterLimit(e,t){this.dependencyTracker?.recordSimpleData("miterLimit",e),this.ctx.miterLimit=t}setDash(e,t,n){this.dependencyTracker?.recordSimpleData("dash",e);let i=this.ctx;i.setLineDash!==void 0&&(i.setLineDash(t),i.lineDashOffset=n)}setRenderingIntent(e,t){}setFlatness(e,t){}setGState(e,t){for(let[n,i]of t)switch(n){case"LW":this.setLineWidth(e,i);break;case"LC":this.setLineCap(e,i);break;case"LJ":this.setLineJoin(e,i);break;case"ML":this.setMiterLimit(e,i);break;case"D":this.setDash(e,i[0],i[1]);break;case"RI":this.setRenderingIntent(e,i);break;case"FL":this.setFlatness(e,i);break;case"Font":this.setFont(e,i[0],i[1]);break;case"CA":this.dependencyTracker?.recordSimpleData("strokeAlpha",e),this.current.strokeAlpha=i;break;case"ca":this.dependencyTracker?.recordSimpleData("fillAlpha",e),this.ctx.globalAlpha=this.current.fillAlpha=i;break;case"BM":this.dependencyTracker?.recordSimpleData("globalCompositeOperation",e),this.ctx.globalCompositeOperation=i;break;case"SMask":this.dependencyTracker?.recordSimpleData("SMask",e),this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.dependencyTracker?.recordSimpleData("filter",e),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){let e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(e){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");let t=this.ctx.canvas.width,n=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(i,t,n);this.suspendedCtx=this.ctx;let a=this.ctx=s.context;a.setTransform(this.suspendedCtx.getTransform()),Ua(this.suspendedCtx,a),z5(a,this.suspendedCtx),this.setGState(e,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Ua(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let t=this.current.activeSMask,n=this.suspendedCtx;this.composeSMask(n,t,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(e,t,n,i){let s=i[0],a=i[1],o=i[2]-s,u=i[3]-a;o===0||u===0||(this.genericComposeSMask(t.context,n,o,u,t.subtype,t.backdrop,t.transferMap,s,a,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,0,0),e.restore())}genericComposeSMask(e,t,n,i,s,a,o,u,l,c,h){let d=e.canvas,f=u-c,p=l-h;if(a)if(f<0||p<0||f+n>d.width||p+i>d.height){let b=this.cachedCanvases.getCanvas("maskExtension",n,i),m=b.context;m.drawImage(d,-f,-p),m.globalCompositeOperation="destination-atop",m.fillStyle=a,m.fillRect(0,0,n,i),m.globalCompositeOperation="source-over",d=b.canvas,f=p=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);let b=new Path2D;b.rect(f,p,n,i),e.clip(b),e.globalCompositeOperation="destination-atop",e.fillStyle=a,e.fillRect(f,p,n,i),e.restore()}t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0),s==="Alpha"&&o?t.filter=this.filterFactory.addAlphaFilter(o):s==="Luminosity"&&(t.filter=this.filterFactory.addLuminosityFilter(o));let g=new Path2D;g.rect(u,l,n,i),t.clip(g),t.globalCompositeOperation="destination-in",t.drawImage(d,f,p,n,i,u,l,n,i),t.restore()}save(e){this.inSMaskMode&&Ua(this.ctx,this.suspendedCtx),this.ctx.save();let t=this.current;this.stateStack.push(t),this.current=t.clone(),this.dependencyTracker?.save(e)}restore(e){if(this.dependencyTracker?.restore(e),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&Ua(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,t,n,i,s,a,o){this.dependencyTracker?.recordIncrementalData("transform",e),this.ctx.transform(t,n,i,s,a,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,n,i){let[s]=n;if(!i){s||=n[0]=new Path2D,this[t](e,s);return}if(this.dependencyTracker!==null){let a=t===Ka.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(e).recordBBox(e,this.ctx,i[0]-a,i[2]+a,i[1]-a,i[3]+a).recordDependencies(e,["transform"])}s instanceof Path2D||(s=n[0]=BE(s)),Q.axialAlignedBoundingBox(i,He(this.ctx),this.current.minMax),this[t](e,s),this._pathStartIdx=e}closePath(e){this.ctx.closePath()}stroke(e,t,n=!0){let i=this.ctx,s=this.current.strokeColor;if(i.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof s=="object"&&s?.getPattern){let a=s.isModifyingCurrentTransform()?i.getTransform():null;if(i.save(),i.strokeStyle=s.getPattern(i,this,Mr(i),gt.STROKE,e),a){let o=new Path2D;o.addPath(t,i.getTransform().invertSelf().multiplySelf(a)),t=o}this.rescaleAndStroke(t,!1),i.restore()}else this.rescaleAndStroke(t,!0);this.dependencyTracker?.recordDependencies(e,or.stroke),n&&this.consumePath(e,t,this.current.getClippedPathBoundingBox(gt.STROKE,He(this.ctx))),i.globalAlpha=this.current.fillAlpha}closeStroke(e,t){this.stroke(e,t)}fill(e,t,n=!0){let i=this.ctx,s=this.current.fillColor,a=this.current.patternFill,o=!1;if(a){let l=s.isModifyingCurrentTransform()?i.getTransform():null;if(this.dependencyTracker?.save(e),i.save(),i.fillStyle=s.getPattern(i,this,Mr(i),gt.FILL,e),l){let c=new Path2D;c.addPath(t,i.getTransform().invertSelf().multiplySelf(l)),t=c}o=!0}let u=this.current.getClippedPathBoundingBox();this.contentVisible&&u!==null&&(this.pendingEOFill?(i.fill(t,"evenodd"),this.pendingEOFill=!1):i.fill(t)),this.dependencyTracker?.recordDependencies(e,or.fill),o&&(i.restore(),this.dependencyTracker?.restore(e)),n&&this.consumePath(e,t,u)}eoFill(e,t){this.pendingEOFill=!0,this.fill(e,t)}fillStroke(e,t){this.fill(e,t,!1),this.stroke(e,t,!1),this.consumePath(e,t)}eoFillStroke(e,t){this.pendingEOFill=!0,this.fillStroke(e,t)}closeFillStroke(e,t){this.fillStroke(e,t)}closeEOFillStroke(e,t){this.pendingEOFill=!0,this.fillStroke(e,t)}endPath(e,t){this.consumePath(e,t)}rawFillPath(e,t){this.ctx.fill(t),this.dependencyTracker?.recordDependencies(e,or.rawFillPath).recordOperation(e)}clip(e){this.dependencyTracker?.recordFutureForcedDependency("clipMode",e),this.pendingClip=W5}eoClip(e){this.dependencyTracker?.recordFutureForcedDependency("clipMode",e),this.pendingClip=CE}beginText(e){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.dependencyTracker?.recordOpenMarker(e).resetIncrementalData("sameLineText").resetIncrementalData("moveText",e)}endText(e){let t=this.pendingTextPaths,n=this.ctx;if(this.dependencyTracker){let{dependencyTracker:i}=this;t!==void 0&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",e),i.recordCloseMarker(e)}if(t!==void 0){let i=new Path2D,s=n.getTransform().invertSelf();for(let{transform:a,x:o,y:u,fontSize:l,path:c}of t)c&&i.addPath(c,new DOMMatrix(a).preMultiplySelf(s).translate(o,u).scale(l,-l));n.clip(i)}delete this.pendingTextPaths}setCharSpacing(e,t){this.dependencyTracker?.recordSimpleData("charSpacing",e),this.current.charSpacing=t}setWordSpacing(e,t){this.dependencyTracker?.recordSimpleData("wordSpacing",e),this.current.wordSpacing=t}setHScale(e,t){this.dependencyTracker?.recordSimpleData("hScale",e),this.current.textHScale=t/100}setLeading(e,t){this.dependencyTracker?.recordSimpleData("leading",e),this.current.leading=-t}setFont(e,t,n){this.dependencyTracker?.recordSimpleData("font",e).recordSimpleDataFromNamed("fontObj",t,e);let i=this.commonObjs.get(t),s=this.current;if(!i)throw new Error(`Can't find font for ${t}`);if(s.fontMatrix=i.fontMatrix||s0,(s.fontMatrix[0]===0||s.fontMatrix[3]===0)&&ue("Invalid font matrix for font "+t),n<0?(n=-n,s.fontDirection=-1):s.fontDirection=1,this.current.font=i,this.current.fontSize=n,i.isType3Font)return;let a=i.loadedName||"sans-serif",o=i.systemFontInfo?.css||`"${a}", ${i.fallbackName}`,u="normal";i.black?u="900":i.bold&&(u="bold");let l=i.italic?"italic":"normal",c=n;n<xE?c=xE:n>SE&&(c=SE),this.current.fontSizeScale=n/c,this.ctx.font=`${l} ${u} ${c}px ${o}`}setTextRenderingMode(e,t){this.dependencyTracker?.recordSimpleData("textRenderingMode",e),this.current.textRenderingMode=t}setTextRise(e,t){this.dependencyTracker?.recordSimpleData("textRise",e),this.current.textRise=t}moveText(e,t,n){this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText",e),this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=n}setLeadingMoveText(e,t,n){this.setLeading(e,-n),this.moveText(e,t,n)}setTextMatrix(e,t){this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",e);let{current:n}=this;n.textMatrix=t,n.textMatrixScale=Math.hypot(t[0],t[1]),n.x=n.lineX=0,n.y=n.lineY=0}nextLine(e){this.moveText(e,0,this.current.leading),this.dependencyTracker?.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??e)}#n(e,t,n){let i=new Path2D;return i.addPath(e,new DOMMatrix(n).invertSelf().multiplySelf(t)),i}paintChar(e,t,n,i,s,a){let o=this.ctx,u=this.current,l=u.font,c=u.textRenderingMode,h=u.fontSize/u.fontSizeScale,d=c&ot.FILL_STROKE_MASK,f=!!(c&ot.ADD_TO_PATH_FLAG),p=u.patternFill&&!l.missingFile,g=u.patternStroke&&!l.missingFile,b;if((l.disableFontFace||f||p||g)&&!l.missingFile&&(b=l.getPathGenerator(this.commonObjs,t)),b&&(l.disableFontFace||p||g)){o.save(),o.translate(n,i),o.scale(h,-h),this.dependencyTracker?.recordCharacterBBox(e,o,l);let m;if(d===ot.FILL||d===ot.FILL_STROKE)if(s){m=o.getTransform(),o.setTransform(...s);let y=this.#n(b,m,s);o.fill(y)}else o.fill(b);if(d===ot.STROKE||d===ot.FILL_STROKE)if(a){m||=o.getTransform(),o.setTransform(...a);let{a:y,b:v,c:x,d:w}=m,S=Q.inverseTransform(a),E=Q.transform([y,v,x,w,0,0],S);Q.singularValueDecompose2dScale(E,qt),o.lineWidth*=Math.max(qt[0],qt[1])/h,o.stroke(this.#n(b,m,a))}else o.lineWidth/=h,o.stroke(b);o.restore()}else(d===ot.FILL||d===ot.FILL_STROKE)&&(o.fillText(t,n,i),this.dependencyTracker?.recordCharacterBBox(e,o,l,h,n,i,()=>o.measureText(t))),(d===ot.STROKE||d===ot.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(e,o,l,h,n,i,()=>o.measureText(t)).recordDependencies(e,or.stroke),o.strokeText(t,n,i));f&&((this.pendingTextPaths||=[]).push({transform:He(o),x:n,y:i,fontSize:h,path:b}),this.dependencyTracker?.recordCharacterBBox(e,o,l,h,n,i))}get isFontSubpixelAAEnabled(){let{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);let t=e.getImageData(0,0,10,10).data,n=!1;for(let i=3;i<t.length;i+=4)if(t[i]>0&&t[i]<255){n=!0;break}return le(this,"isFontSubpixelAAEnabled",n)}showText(e,t){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(e,or.showText).resetBBox(e),this.current.textRenderingMode&ot.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",e).inheritPendingDependenciesAsFutureForcedDependencies());let n=this.current,i=n.font;if(i.isType3Font){this.showType3Text(e,t),this.dependencyTracker?.recordShowTextOperation(e);return}let s=n.fontSize;if(s===0){this.dependencyTracker?.recordOperation(e);return}let a=this.ctx,o=n.fontSizeScale,u=n.charSpacing,l=n.wordSpacing,c=n.fontDirection,h=n.textHScale*c,d=t.length,f=i.vertical,p=f?1:-1,g=i.defaultVMetrics,b=s*n.fontMatrix[0],m=n.textRenderingMode===ot.FILL&&!i.disableFontFace&&!n.patternFill;a.save(),n.textMatrix&&a.transform(...n.textMatrix),a.translate(n.x,n.y+n.textRise),c>0?a.scale(h,-1):a.scale(h,1);let y,v,x=n.textRenderingMode&ot.FILL_STROKE_MASK,w=x===ot.FILL||x===ot.FILL_STROKE,S=x===ot.STROKE||x===ot.FILL_STROKE;if(w&&n.patternFill){a.save();let A=n.fillColor.getPattern(a,this,Mr(a),gt.FILL,e);y=He(a),a.restore(),a.fillStyle=A}if(S&&n.patternStroke){a.save();let A=n.strokeColor.getPattern(a,this,Mr(a),gt.STROKE,e);v=He(a),a.restore(),a.strokeStyle=A}let E=n.lineWidth,_=n.textMatrixScale;if(_===0||E===0?S&&(E=this.getSinglePixelWidth()):E/=_,o!==1&&(a.scale(o,o),E/=o),a.lineWidth=E,i.isInvalidPDFjsFont){let A=[],B=0;for(let P of t)A.push(P.unicode),B+=P.width;let D=A.join("");if(a.fillText(D,0,0),this.dependencyTracker!==null){let P=a.measureText(D);this.dependencyTracker.recordBBox(e,this.ctx,-P.actualBoundingBoxLeft,P.actualBoundingBoxRight,-P.actualBoundingBoxAscent,P.actualBoundingBoxDescent).recordShowTextOperation(e)}n.x+=B*b*h,a.restore(),this.compose();return}let T=0,k;for(k=0;k<d;++k){let A=t[k];if(typeof A=="number"){T+=p*A*s/1e3;continue}let B=!1,D=(A.isSpace?l:0)+u,P=A.fontChar,M=A.accent,L,N,I=A.width;if(f){let ee=A.vmetric||g,X=-(A.vmetric?ee[1]:I*.5)*b,q=ee[2]*b;I=ee?-ee[0]:I,L=X/o,N=(T+q)/o}else L=T/o,N=0;let H;if(i.remeasure&&I>0){H=a.measureText(P);let ee=H.width*1e3/s*o;if(I<ee&&this.isFontSubpixelAAEnabled){let X=I/ee;B=!0,a.save(),a.scale(X,1),L/=X}else I!==ee&&(L+=(I-ee)/2e3*s/o)}if(this.contentVisible&&(A.isInFont||i.missingFile)){if(m&&!M)a.fillText(P,L,N),this.dependencyTracker?.recordCharacterBBox(e,a,H?{bbox:null}:i,s/o,L,N,()=>H??a.measureText(P));else if(this.paintChar(e,P,L,N,y,v),M){let ee=L+s*M.offset.x/o,X=N-s*M.offset.y/o;this.paintChar(e,M.fontChar,ee,X,y,v)}}let J=f?I*b-D*c:I*b+D*c;T+=J,B&&a.restore()}f?n.y-=T:n.x+=T*h,a.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(e)}showType3Text(e,t){let n=this.ctx,i=this.current,s=i.font,a=i.fontSize,o=i.fontDirection,u=s.vertical?1:-1,l=i.charSpacing,c=i.wordSpacing,h=i.textHScale*o,d=i.fontMatrix||s0,f=t.length,p=i.textRenderingMode===ot.INVISIBLE,g,b,m,y;if(p||a===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,n.save(),i.textMatrix&&n.transform(...i.textMatrix),n.translate(i.x,i.y+i.textRise),n.scale(h,o);let v=this.dependencyTracker;for(this.dependencyTracker=v?new ic(v,e):null,g=0;g<f;++g){if(b=t[g],typeof b=="number"){y=u*b*a/1e3,this.ctx.translate(y,0),i.x+=y*h;continue}let x=(b.isSpace?c:0)+l,w=s.charProcOperatorList[b.operatorListId];w?this.contentVisible&&(this.save(),n.scale(a,a),n.transform(...d),this.executeOperatorList(w),this.restore()):ue(`Type3 character "${b.operatorListId}" is not available.`);let S=[b.width,0];Q.applyTransform(S,d),m=S[0]*a+x,n.translate(m,0),i.x+=m*h}n.restore(),v&&(this.dependencyTracker=v)}setCharWidth(e,t,n){}setCharWidthAndBounds(e,t,n,i,s,a,o){let u=new Path2D;u.rect(i,s,a-i,o-s),this.ctx.clip(u),this.dependencyTracker?.recordBBox(e,this.ctx,i,a,s,o).recordClipBox(e,this.ctx,i,a,s,o),this.endPath(e)}getColorN_Pattern(e,t){let n;if(t[0]==="TilingPattern"){let i=this.baseTransform||He(this.ctx),s={createCanvasGraphics:(a,o)=>new r(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new ic(this.dependencyTracker,o,!0):null)};n=new z0(t,this.ctx,s,i)}else n=this._getPattern(e,t[1],t[2]);return n}setStrokeColorN(e,...t){this.dependencyTracker?.recordSimpleData("strokeColor",e),this.current.strokeColor=this.getColorN_Pattern(e,t),this.current.patternStroke=!0}setFillColorN(e,...t){this.dependencyTracker?.recordSimpleData("fillColor",e),this.current.fillColor=this.getColorN_Pattern(e,t),this.current.patternFill=!0}setStrokeRGBColor(e,t){this.dependencyTracker?.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor=t,this.current.patternStroke=!1}setStrokeTransparent(e){this.dependencyTracker?.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e,t){this.dependencyTracker?.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor=t,this.current.patternFill=!1}setFillTransparent(e){this.dependencyTracker?.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,t,n=null){let i;return this.cachedPatterns.has(t)?i=this.cachedPatterns.get(t):(i=F5(this.getObject(e,t)),this.cachedPatterns.set(t,i)),n&&(i.matrix=n),i}shadingFill(e,t){if(!this.contentVisible)return;let n=this.ctx;this.save(e);let i=this._getPattern(e,t);n.fillStyle=i.getPattern(n,this,Mr(n),gt.SHADING,e);let s=Mr(n);if(s){let{width:a,height:o}=n.canvas,u=fs.slice();Q.axialAlignedBoundingBox([0,0,a,o],s,u);let[l,c,h,d]=u;this.ctx.fillRect(l,c,h-l,d-c)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(e).recordFullPageBBox(e).recordDependencies(e,or.transform).recordDependencies(e,or.fill).recordOperation(e),this.compose(this.current.getClippedPathBoundingBox()),this.restore(e)}beginInlineImage(){Oe("Should not call beginInlineImage")}beginImageData(){Oe("Should not call beginImageData")}paintFormXObjectBegin(e,t,n){if(this.contentVisible&&(this.save(e),this.baseTransformStack.push(this.baseTransform),t&&this.transform(e,...t),this.baseTransform=He(this.ctx),n)){Q.axialAlignedBoundingBox(n,this.baseTransform,this.current.minMax);let[i,s,a,o]=n,u=new Path2D;u.rect(i,s,a-i,o-s),this.ctx.clip(u),this.dependencyTracker?.recordClipBox(e,this.ctx,i,a,s,o),this.endPath(e)}}paintFormXObjectEnd(e){this.contentVisible&&(this.restore(e),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e,t){if(!this.contentVisible)return;this.save(e),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);let n=this.ctx;t.isolated||Ac("TODO: Support non-isolated groups."),t.knockout&&ue("Knockout groups not supported.");let i=He(n);if(t.matrix&&n.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let s=fs.slice();Q.axialAlignedBoundingBox(t.bbox,He(n),s);let a=[0,0,n.canvas.width,n.canvas.height];s=Q.intersect(s,a)||[0,0,0,0];let o=Math.floor(s[0]),u=Math.floor(s[1]),l=Math.max(Math.ceil(s[2])-o,1),c=Math.max(Math.ceil(s[3])-u,1);this.current.startNewPathAndClipBox([0,0,l,c]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);let d=this.cachedCanvases.getCanvas(h,l,c),f=d.context;f.translate(-o,-u),f.transform(...i);let p=new Path2D,[g,b,m,y]=t.bbox;if(p.rect(g,b,m-g,y-b),t.matrix){let v=new Path2D;v.addPath(p,new DOMMatrix(t.matrix)),p=v}f.clip(p),t.smask&&this.smaskStack.push({canvas:d.canvas,context:f,offsetX:o,offsetY:u,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}),(!t.smask||this.dependencyTracker)&&(n.setTransform(1,0,0,1,0,0),n.translate(o,u),n.save()),Ua(n,f),this.ctx=f,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(n),this.setGState(e,[["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(n),this.groupLevel++}endGroup(e,t){if(!this.contentVisible)return;this.groupLevel--;let n=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),t.smask)this.tempSMask=this.smaskStack.pop(),this.restore(e),this.dependencyTracker&&this.ctx.restore();else{this.ctx.restore();let s=He(this.ctx);this.restore(e),this.ctx.save(),this.ctx.setTransform(...s);let a=fs.slice();Q.axialAlignedBoundingBox([0,0,n.canvas.width,n.canvas.height],s,a),this.ctx.drawImage(n.canvas,0,0),this.ctx.restore(),this.compose(a)}}beginAnnotation(e,t,n,i,s,a){if(this.#e(),Bl(this.ctx),this.ctx.save(),this.save(e),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),n){let o=n[2]-n[0],u=n[3]-n[1];if(a&&this.annotationCanvasMap){i=i.slice(),i[4]-=n[0],i[5]-=n[1],n=n.slice(),n[0]=n[1]=0,n[2]=o,n[3]=u,Q.singularValueDecompose2dScale(He(this.ctx),qt);let{viewportScale:l}=this,c=Math.ceil(o*this.outputScaleX*l),h=Math.ceil(u*this.outputScaleY*l);this.annotationCanvas=this.canvasFactory.create(c,h);let{canvas:d,context:f}=this.annotationCanvas;this.annotationCanvasMap.set(t,d),this.annotationCanvas.savedCtx=this.ctx,this.ctx=f,this.ctx.save(),this.ctx.setTransform(qt[0],0,0,-qt[1],0,u*qt[1]),Bl(this.ctx)}else{Bl(this.ctx),this.endPath(e);let l=new Path2D;l.rect(n[0],n[1],o,u),this.ctx.clip(l)}}this.current=new sc(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(e,...i),this.transform(e,...s)}endAnnotation(e){this.annotationCanvas&&(this.ctx.restore(),this.#t(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e,t){if(!this.contentVisible)return;let n=t.count;t=this.getObject(e,t.data,t),t.count=n;let i=this.ctx,s=this._createMaskCanvas(e,t),a=s.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(a,s.offsetX,s.offsetY),this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,s.offsetX,s.offsetX+a.width,s.offsetY,s.offsetY+a.height).recordOperation(e),i.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,n,i=0,s=0,a,o){if(!this.contentVisible)return;t=this.getObject(e,t.data,t);let u=this.ctx;u.save();let l=He(u);u.transform(n,i,s,a,0,0);let c=this._createMaskCanvas(e,t);u.setTransform(1,0,0,1,c.offsetX-l[4],c.offsetY-l[5]),this.dependencyTracker?.resetBBox(e);for(let h=0,d=o.length;h<d;h+=2){let f=Q.transform(l,[n,i,s,a,o[h],o[h+1]]);u.drawImage(c.canvas,f[4],f[5]),this.dependencyTracker?.recordBBox(e,this.ctx,f[4],f[4]+c.canvas.width,f[5],f[5]+c.canvas.height)}u.restore(),this.compose(),this.dependencyTracker?.recordOperation(e)}paintImageMaskXObjectGroup(e,t){if(!this.contentVisible)return;let n=this.ctx,i=this.current.fillColor,s=this.current.patternFill;this.dependencyTracker?.resetBBox(e).recordDependencies(e,or.transformAndFill);for(let a of t){let{data:o,width:u,height:l,transform:c}=a,h=this.cachedCanvases.getCanvas("maskCanvas",u,l),d=h.context;d.save();let f=this.getObject(e,o,a);TE(d,f),d.globalCompositeOperation="source-in",d.fillStyle=s?i.getPattern(d,this,Mr(n),gt.FILL,e):i,d.fillRect(0,0,u,l),d.restore(),n.save(),n.transform(...c),n.scale(1,-1),Ml(n,h.canvas,0,0,u,l,0,-1,1,1),this.dependencyTracker?.recordBBox(e,n,0,u,0,l),n.restore()}this.compose(),this.dependencyTracker?.recordOperation(e)}paintImageXObject(e,t){if(!this.contentVisible)return;let n=this.getObject(e,t);if(!n){ue("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e,n)}paintImageXObjectRepeat(e,t,n,i,s){if(!this.contentVisible)return;let a=this.getObject(e,t);if(!a){ue("Dependent image isn't ready yet");return}let o=a.width,u=a.height,l=[];for(let c=0,h=s.length;c<h;c+=2)l.push({transform:[n,0,0,i,s[c],s[c+1]],x:0,y:0,w:o,h:u});this.paintInlineImageXObjectGroup(e,a,l)}applyTransferMapsToCanvas(e){return this.current.transferMaps!=="none"&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return e.bitmap;let{bitmap:t,width:n,height:i}=e,s=this.cachedCanvases.getCanvas("inlineImage",n,i),a=s.context;return a.filter=this.current.transferMaps,a.drawImage(t,0,0),a.filter="none",s.canvas}paintInlineImageXObject(e,t){if(!this.contentVisible)return;let n=t.width,i=t.height,s=this.ctx;this.save(e);let{filter:a}=s;a!=="none"&&a!==""&&(s.filter="none"),s.scale(1/n,-1/i);let o;if(t.bitmap)o=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)o=t;else{let c=this.cachedCanvases.getCanvas("inlineImage",n,i).context;AE(c,t),o=this.applyTransferMapsToCanvas(c)}let u=this._scaleImage(o,Mr(s));s.imageSmoothingEnabled=_E(He(s),t.interpolate),this.dependencyTracker?.resetBBox(e).recordBBox(e,s,0,n,-i,0).recordDependencies(e,or.imageXObject).recordOperation(e),Ml(s,u.img,0,0,u.paintWidth,u.paintHeight,0,-i,n,i),this.compose(),this.restore(e)}paintInlineImageXObjectGroup(e,t,n){if(!this.contentVisible)return;let i=this.ctx,s;if(t.bitmap)s=t.bitmap;else{let a=t.width,o=t.height,l=this.cachedCanvases.getCanvas("inlineImage",a,o).context;AE(l,t),s=this.applyTransferMapsToCanvas(l)}this.dependencyTracker?.resetBBox(e);for(let a of n)i.save(),i.transform(...a.transform),i.scale(1,-1),Ml(i,s,a.x,a.y,a.w,a.h,0,-1,1,1),this.dependencyTracker?.recordBBox(e,i,0,1,-1,0),i.restore();this.dependencyTracker?.recordOperation(e),this.compose()}paintSolidColorImageMask(e){this.contentVisible&&(this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,0,1,0,1).recordDependencies(e,or.fill).recordOperation(e),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e,t){}markPointProps(e,t,n){}beginMarkedContent(e,t){this.dependencyTracker?.beginMarkedContent(e),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t,n){this.dependencyTracker?.beginMarkedContent(e),t==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(n)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(e){this.dependencyTracker?.endMarkedContent(e),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(e){}endCompat(e){}consumePath(e,t,n){let i=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(n);let s=this.ctx;this.pendingClip?(i||(this.pendingClip===CE?s.clip(t,"evenodd"):s.clip(t)),this.pendingClip=null,this.dependencyTracker?.bboxToClipBoxDropOperation(e).recordFutureForcedDependency("clipPath",e)):this.dependencyTracker?.recordOperation(e),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let e=He(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{let t=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),i=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(n,i)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:e}=this.current,{a:t,b:n,c:i,d:s}=this.ctx.getTransform(),a,o;if(n===0&&i===0){let u=Math.abs(t),l=Math.abs(s);if(u===l)if(e===0)a=o=1/u;else{let c=u*e;a=o=c<1?1/c:1}else if(e===0)a=1/u,o=1/l;else{let c=u*e,h=l*e;a=c<1?1/c:1,o=h<1?1/h:1}}else{let u=Math.abs(t*s-n*i),l=Math.hypot(t,n),c=Math.hypot(i,s);if(e===0)a=c/u,o=l/u;else{let h=e*u;a=c>h?c/h:1,o=l>h?l/h:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(e,t){let{ctx:n,current:{lineWidth:i}}=this,[s,a]=this.getScaleForStroking();if(s===a){n.lineWidth=(i||1)*s,n.stroke(e);return}let o=n.getLineDash();t&&n.save(),n.scale(s,a),r0.a=1/s,r0.d=1/a;let u=new Path2D;if(u.addPath(e,r0),o.length>0){let l=Math.max(s,a);n.setLineDash(o.map(c=>c/l)),n.lineDashOffset/=l}n.lineWidth=i||1,n.stroke(u),t&&n.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};for(let r in Ka)ps.prototype[r]!==void 0&&(ps.prototype[Ka[r]]=ps.prototype[r]);var ei=class{static#e=null;static#t="";static get workerPort(){return this.#e}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");this.#e=e}static get workerSrc(){return this.#t}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");this.#t=e}},H0=class{#e;#t;constructor({parsedData:e,rawData:t}){this.#e=e,this.#t=t}getRaw(){return this.#t}get(e){return this.#e.get(e)??null}[Symbol.iterator](){return this.#e.entries()}},cs=Symbol("INTERNAL"),W0=class{#e=!1;#t=!1;#n=!1;#r=!0;constructor(e,{name:t,intent:n,usage:i,rbGroups:s}){this.#e=!!(e&Gt.DISPLAY),this.#t=!!(e&Gt.PRINT),this.name=t,this.intent=n,this.usage=i,this.rbGroups=s}get visible(){if(this.#n)return this.#r;if(!this.#r)return!1;let{print:e,view:t}=this.usage;return this.#e?t?.viewState!=="OFF":this.#t?e?.printState!=="OFF":!0}_setVisible(e,t,n=!1){e!==cs&&Oe("Internal method `_setVisible` called."),this.#n=n,this.#r=t}},V0=class{#e=null;#t=new Map;#n=null;#r=null;constructor(e,t=Gt.DISPLAY){if(this.renderingIntent=t,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,this.#r=e.order;for(let n of e.groups)this.#t.set(n.id,new W0(t,n));if(e.baseState==="OFF")for(let n of this.#t.values())n._setVisible(cs,!1);for(let n of e.on)this.#t.get(n)._setVisible(cs,!0);for(let n of e.off)this.#t.get(n)._setVisible(cs,!1);this.#n=this.getHash()}}#a(e){let t=e.length;if(t<2)return!0;let n=e[0];for(let i=1;i<t;i++){let s=e[i],a;if(Array.isArray(s))a=this.#a(s);else if(this.#t.has(s))a=this.#t.get(s).visible;else return ue(`Optional content group not found: ${s}`),!0;switch(n){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return n==="And"}isVisible(e){if(this.#t.size===0)return!0;if(!e)return Ac("Optional content group not defined."),!0;if(e.type==="OCG")return this.#t.has(e.id)?this.#t.get(e.id).visible:(ue(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return this.#a(e.expression);if(!e.policy||e.policy==="AnyOn"){for(let t of e.ids){if(!this.#t.has(t))return ue(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!0}return!1}else if(e.policy==="AllOn"){for(let t of e.ids){if(!this.#t.has(t))return ue(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(let t of e.ids){if(!this.#t.has(t))return ue(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!0}return!1}else if(e.policy==="AllOff"){for(let t of e.ids){if(!this.#t.has(t))return ue(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!1}return!0}return ue(`Unknown optional content policy ${e.policy}.`),!0}return ue(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,n=!0){let i=this.#t.get(e);if(!i){ue(`Optional content group not found: ${e}`);return}if(n&&t&&i.rbGroups.length)for(let s of i.rbGroups)for(let a of s)a!==e&&this.#t.get(a)?._setVisible(cs,!1,!0);i._setVisible(cs,!!t,!0),this.#e=null}setOCGState({state:e,preserveRB:t}){let n;for(let i of e){switch(i){case"ON":case"OFF":case"Toggle":n=i;continue}let s=this.#t.get(i);if(s)switch(n){case"ON":this.setVisibility(i,!0,t);break;case"OFF":this.setVisibility(i,!1,t);break;case"Toggle":this.setVisibility(i,!s.visible,t);break}}this.#e=null}get hasInitialVisibility(){return this.#n===null||this.getHash()===this.#n}getOrder(){return this.#t.size?this.#r?this.#r.slice():[...this.#t.keys()]:null}getGroup(e){return this.#t.get(e)||null}getHash(){if(this.#e!==null)return this.#e;let e=new Gl;for(let[t,n]of this.#t)e.update(`${t}:${n.visible}`);return this.#e=e.hexdigest()}[Symbol.iterator](){return this.#t.entries()}},G0=class{constructor(e,{disableRange:t=!1,disableStream:n=!1}){xe(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');let{length:i,initialData:s,progressiveDone:a,contentDispositionFilename:o}=e;if(this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=o,s?.length>0){let u=s instanceof Uint8Array&&s.byteLength===s.buffer.byteLength?s.buffer:new Uint8Array(s).buffer;this._queuedChunks.push(u)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!n,this._isRangeSupported=!t,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener((u,l)=>{this._onReceiveData({begin:u,chunk:l})}),e.addProgressListener((u,l)=>{this._onProgress({loaded:u,total:l})}),e.addProgressiveReadListener(u=>{this._onReceiveData({chunk:u})}),e.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),e.transportReady()}_onReceiveData({begin:e,chunk:t}){let n=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{let i=this._rangeReaders.some(function(s){return s._begin!==e?!1:(s._enqueue(n),!0)});xe(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){e.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){let t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){xe(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");let e=this._queuedChunks;return this._queuedChunks=null,new q0(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;let n=new K0(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(let t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}},q0=class{constructor(e,t,n=!1,i=null){this._stream=e,this._done=n||!1,this._filename=zg(i)?i:null,this._queuedChunks=t||[],this._loaded=0;for(let s of this._queuedChunks)this._loaded+=s.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(let t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}},K0=class{constructor(e,t,n){this._stream=e,this._begin=t,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length===0)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(let n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){let t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(let t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}};function V5(r){let e=!0,t=n("filename\\*","i").exec(r);if(t){t=t[1];let c=o(t);return c=unescape(c),c=u(c),c=l(c),s(c)}if(t=a(r),t){let c=l(t);return s(c)}if(t=n("filename","i").exec(r),t){t=t[1];let c=o(t);return c=l(c),s(c)}function n(c,h){return new RegExp("(?:^|;)\\s*"+c+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',h)}function i(c,h){if(c){if(!/^[\x00-\xFF]+$/.test(h))return h;try{let d=new TextDecoder(c,{fatal:!0}),f=co(h);h=d.decode(f),e=!1}catch{}}return h}function s(c){return e&&/[\x80-\xff]/.test(c)&&(c=i("utf-8",c),e&&(c=i("iso-8859-1",c))),c}function a(c){let h=[],d,f=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(d=f.exec(c))!==null;){let[,g,b,m]=d;if(g=parseInt(g,10),g in h){if(g===0)break;continue}h[g]=[b,m]}let p=[];for(let g=0;g<h.length&&g in h;++g){let[b,m]=h[g];m=o(m),b&&(m=unescape(m),g===0&&(m=u(m))),p.push(m)}return p.join("")}function o(c){if(c.startsWith('"')){let h=c.slice(1).split('\\"');for(let d=0;d<h.length;++d){let f=h[d].indexOf('"');f!==-1&&(h[d]=h[d].slice(0,f),h.length=d+1),h[d]=h[d].replaceAll(/\\(.)/g,"$1")}c=h.join('"')}return c}function u(c){let h=c.indexOf("'");if(h===-1)return c;let d=c.slice(0,h),p=c.slice(h+1).replace(/^[^']*'/,"");return i(d,p)}function l(c){return!c.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(c)?c:c.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(h,d,f,p){if(f==="q"||f==="Q")return p=p.replaceAll("_"," "),p=p.replaceAll(/=([0-9a-fA-F]{2})/g,function(g,b){return String.fromCharCode(parseInt(b,16))}),i(d,p);try{p=atob(p)}catch{}return i(d,p)})}return""}function FE(r,e){let t=new Headers;if(!r||!e||typeof e!="object")return t;for(let n in e){let i=e[n];i!==void 0&&t.append(n,i)}return t}function _c(r){return URL.parse(r)?.origin??null}function $E({responseHeaders:r,isHttp:e,rangeChunkSize:t,disableRange:n}){let i={allowRangeRequests:!1,suggestedLength:void 0},s=parseInt(r.get("Content-Length"),10);return!Number.isInteger(s)||(i.suggestedLength=s,s<=2*t)||n||!e||r.get("Accept-Ranges")!=="bytes"||(r.get("Content-Encoding")||"identity")!=="identity"||(i.allowRangeRequests=!0),i}function UE(r){let e=r.get("Content-Disposition");if(e){let t=V5(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(zg(t))return t}return null}function po(r,e){return new gs(`Unexpected server response (${r}) while retrieving PDF "${e}".`,r,r===404||r===0&&e.startsWith("file:"))}function zE(r){return r===200||r===206}function jE(r,e,t){return{method:"GET",headers:r,signal:t.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function HE(r){return r instanceof Uint8Array?r.buffer:r instanceof ArrayBuffer?r:(ue(`getArrayBuffer - unexpected data format: ${r}`),new Uint8Array(r).buffer)}var X0=class{_responseOrigin=null;constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=FE(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return xe(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Y0(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;let n=new Q0(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(let t of this._rangeRequestReaders.slice(0))t.cancel(e)}},Y0=class{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;let t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange;let n=new Headers(e.headers),i=t.url;fetch(i,jE(n,this._withCredentials,this._abortController)).then(s=>{if(e._responseOrigin=_c(s.url),!zE(s.status))throw po(s.status,i);this._reader=s.body.getReader(),this._headersCapability.resolve();let a=s.headers,{allowRangeRequests:o,suggestedLength:u}=$E({responseHeaders:a,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=u||this._contentLength,this._filename=UE(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Dr("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:HE(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}},Q0=class{constructor(e,t,n){this._stream=e,this._reader=null,this._loaded=0;let i=e.source;this._withCredentials=i.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!i.disableStream,this._abortController=new AbortController;let s=new Headers(e.headers);s.append("Range",`bytes=${t}-${n-1}`);let a=i.url;fetch(a,jE(s,this._withCredentials,this._abortController)).then(o=>{let u=_c(o.url);if(u!==e._responseOrigin)throw new Error(`Expected range response-origin "${u}" to match "${e._responseOrigin}".`);if(!zE(o.status))throw po(o.status,a);this._readCapability.resolve(),this._reader=o.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded}),{value:HE(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}},n0=200,i0=206;function G5(r){let e=r.response;return typeof e!="string"?e:co(e).buffer}var Z0=class{_responseOrigin=null;constructor({url:e,httpHeaders:t,withCredentials:n}){this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=FE(this.isHttp,t),this.withCredentials=n||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(e){let t=new XMLHttpRequest,n=this.currXhrId++,i=this.pendingRequests[n]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(let[s,a]of this.headers)t.setRequestHeader(s,a);return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),i.expectedStatus=i0):i.expectedStatus=n0,t.responseType="arraybuffer",xe(e.onError,"Expected `onError` callback to be provided."),t.onerror=()=>{e.onError(t.status)},t.onreadystatechange=this.onStateChange.bind(this,n),t.onprogress=this.onProgress.bind(this,n),i.onHeadersReceived=e.onHeadersReceived,i.onDone=e.onDone,i.onError=e.onError,i.onProgress=e.onProgress,t.send(null),n}onProgress(e,t){let n=this.pendingRequests[e];n&&n.onProgress?.(t)}onStateChange(e,t){let n=this.pendingRequests[e];if(!n)return;let i=n.xhr;if(i.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),i.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],i.status===0&&this.isHttp){n.onError(i.status);return}let s=i.status||n0;if(!(s===n0&&n.expectedStatus===i0)&&s!==n.expectedStatus){n.onError(i.status);return}let o=G5(i);if(s===i0){let u=i.getResponseHeader("Content-Range"),l=/bytes (\d+)-(\d+)\/(\d+)/.exec(u);l?n.onDone({begin:parseInt(l[1],10),chunk:o}):(ue('Missing or invalid "Content-Range" header.'),n.onError(0))}else o?n.onDone({begin:0,chunk:o}):n.onError(i.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){let t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}},J0=class{constructor(e){this._source=e,this._manager=new Z0(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){let t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return xe(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new eg(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){let n=new tg(this._manager,e,t);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(let t of this._rangeRequestReaders.slice(0))t.cancel(e)}},eg=class{constructor(e,t){this._manager=e,this._url=t.url,this._fullRequestId=e.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){let e=this._fullRequestId,t=this._manager.getRequestXhr(e);this._manager._responseOrigin=_c(t.responseURL);let n=t.getAllResponseHeaders(),i=new Headers(n?n.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(o=>{let[u,...l]=o.split(": ");return[u,l.join(": ")]}):[]),{allowRangeRequests:s,suggestedLength:a}=$E({responseHeaders:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=a||this._contentLength,this._filename=UE(i),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(let t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=po(e,this._url),this._headersCapability.reject(this._storedError);for(let t of this._requests)t.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e);for(let t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}},tg=class{constructor(e,t,n){this._manager=e,this._url=e.url,this._requestId=e.request({begin:t,end:n,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){let e=_c(this._manager.getRequestXhr(this._requestId)?.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){this.onClosed?.(this)}_onDone(e){let t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(let n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError??=po(e,this._url);for(let t of this._requests)t.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){let t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(let t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}},q5=/^[a-z][a-z0-9\-+.]+:/i;function K5(r){if(q5.test(r))return new URL(r);let e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(r))}var rg=class{constructor(e){this.source=e,this.url=K5(e.url),xe(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return xe(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new ng(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;let n=new ig(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(let t of this._rangeRequestReaders.slice(0))t.cancel(e)}},ng=class{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;let t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();let n=process.getBuiltinModule("fs");n.promises.lstat(this._url).then(i=>{this._contentLength=i.size,this._setReadableStream(n.createReadStream(this._url)),this._headersCapability.resolve()},i=>{i.code==="ENOENT"&&(i=po(0,this._url.href)),this._storedError=i,this._headersCapability.reject(i)})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new Dr("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}},ig=class{constructor(e,t,n){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();let i=e.source;this._isStreamingSupported=!i.disableStream;let s=process.getBuiltinModule("fs");this._setReadableStream(s.createReadStream(this._url,{start:t,end:n-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}},za=Symbol("INITIAL_DATA"),ac=class{#e=Object.create(null);#t(e){return this.#e[e]||={...Promise.withResolvers(),data:za}}get(e,t=null){if(t){let i=this.#t(e);return i.promise.then(()=>t(i.data)),null}let n=this.#e[e];if(!n||n.data===za)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){let t=this.#e[e];return!!t&&t.data!==za}delete(e){let t=this.#e[e];return!t||t.data===za?!1:(delete this.#e[e],!0)}resolve(e,t=null){let n=this.#t(e);n.data=t,n.resolve()}clear(){for(let e in this.#e){let{data:t}=this.#e[e];t?.bitmap?.close()}this.#e=Object.create(null)}*[Symbol.iterator](){for(let e in this.#e){let{data:t}=this.#e[e];t!==za&&(yield[e,t])}}},X5=1e5,kE=30,ro=class r{#e=Promise.withResolvers();#t=null;#n=!1;#r=!!globalThis.FontInspector?.enabled;#a=null;#s=null;#i=0;#o=0;#l=null;#u=null;#d=0;#h=0;#f=Object.create(null);#m=[];#g=null;#c=[];#p=new WeakMap;#b=null;static#v=new Map;static#y=new Map;static#T=new WeakMap;static#E=null;static#x=new Set;constructor({textContentSource:e,container:t,viewport:n}){if(e instanceof ReadableStream)this.#g=e;else if(typeof e=="object")this.#g=new ReadableStream({start(u){u.enqueue(e),u.close()}});else throw new Error('No "textContentSource" parameter specified.');this.#t=this.#u=t,this.#h=n.scale*nn.pixelRatio,this.#d=n.rotation,this.#s={div:null,properties:null,ctx:null};let{pageWidth:i,pageHeight:s,pageX:a,pageY:o}=n.rawDims;this.#b=[1,0,0,-1,-a,o+s],this.#o=i,this.#i=s,r.#I(),t.style.setProperty("--min-font-size",r.#E),ti(t,n),this.#e.promise.finally(()=>{r.#x.delete(this),this.#s=null,this.#f=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:e,isFirefox:t}=Je.platform;return le(this,"fontFamilyMap",new Map([["sans-serif",`${e&&t?"Calibri, ":""}sans-serif`],["monospace",`${e&&t?"Lucida Console, ":""}monospace`]]))}render(){let e=()=>{this.#l.read().then(({value:t,done:n})=>{if(n){this.#e.resolve();return}this.#a??=t.lang,Object.assign(this.#f,t.styles),this.#C(t.items),e()},this.#e.reject)};return this.#l=this.#g.getReader(),r.#x.add(this),e(),this.#e.promise}update({viewport:e,onBefore:t=null}){let n=e.scale*nn.pixelRatio,i=e.rotation;if(i!==this.#d&&(t?.(),this.#d=i,ti(this.#u,{rotation:i})),n!==this.#h){t?.(),this.#h=n;let s={div:null,properties:null,ctx:r.#R(this.#a)};for(let a of this.#c)s.properties=this.#p.get(a),s.div=a,this.#A(s)}}cancel(){let e=new Dr("TextLayer task cancelled.");this.#l?.cancel(e).catch(()=>{}),this.#l=null,this.#e.reject(e)}get textDivs(){return this.#c}get textContentItemsStr(){return this.#m}#C(e){if(this.#n)return;this.#s.ctx??=r.#R(this.#a);let t=this.#c,n=this.#m;for(let i of e){if(t.length>X5){ue("Ignoring additional textDivs for performance reasons."),this.#n=!0;return}if(i.str===void 0){if(i.type==="beginMarkedContentProps"||i.type==="beginMarkedContent"){let s=this.#t;this.#t=document.createElement("span"),this.#t.classList.add("markedContent"),i.id&&this.#t.setAttribute("id",`${i.id}`),s.append(this.#t)}else i.type==="endMarkedContent"&&(this.#t=this.#t.parentNode);continue}n.push(i.str),this.#w(i)}}#w(e){let t=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};this.#c.push(t);let i=Q.transform(this.#b,e.transform),s=Math.atan2(i[1],i[0]),a=this.#f[e.fontName];a.vertical&&(s+=Math.PI/2);let o=this.#r&&a.fontSubstitution||a.fontFamily;o=r.fontFamilyMap.get(o)||o;let u=Math.hypot(i[2],i[3]),l=u*r.#D(o,a,this.#a),c,h;s===0?(c=i[4],h=i[5]-l):(c=i[4]+l*Math.sin(s),h=i[5]-l*Math.cos(s));let d=t.style;d.left=`${(100*c/this.#o).toFixed(2)}%`,d.top=`${(100*h/this.#i).toFixed(2)}%`,d.setProperty("--font-height",`${u.toFixed(2)}px`),d.fontFamily=o,n.fontSize=u,t.setAttribute("role","presentation"),t.textContent=e.str,t.dir=e.dir,this.#r&&(t.dataset.fontName=a.fontSubstitutionLoadedName||e.fontName),s!==0&&(n.angle=s*(180/Math.PI));let f=!1;if(e.str.length>1)f=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){let p=Math.abs(e.transform[0]),g=Math.abs(e.transform[3]);p!==g&&Math.max(p,g)/Math.min(p,g)>1.5&&(f=!0)}if(f&&(n.canvasWidth=a.vertical?e.height:e.width),this.#p.set(t,n),this.#s.div=t,this.#s.properties=n,this.#A(this.#s),n.hasText&&this.#t.append(t),n.hasEOL){let p=document.createElement("br");p.setAttribute("role","presentation"),this.#t.append(p)}}#A(e){let{div:t,properties:n,ctx:i}=e,{style:s}=t;if(n.canvasWidth!==0&&n.hasText){let{fontFamily:a}=s,{canvasWidth:o,fontSize:u}=n;r.#k(i,u*this.#h,a);let{width:l}=i.measureText(t.textContent);l>0&&s.setProperty("--scale-x",o*this.#h/l)}n.angle!==0&&s.setProperty("--rotate",`${n.angle}deg`)}static cleanup(){if(!(this.#x.size>0)){this.#v.clear();for(let{canvas:e}of this.#y.values())e.remove();this.#y.clear()}}static#R(e=null){let t=this.#y.get(e||="");if(!t){let n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=e,document.body.append(n),t=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#y.set(e,t),this.#T.set(t,{size:0,family:""})}return t}static#k(e,t,n){let i=this.#T.get(e);t===i.size&&n===i.family||(e.font=`${t}px ${n}`,i.size=t,i.family=n)}static#I(){if(this.#E!==null)return;let e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),this.#E=e.getBoundingClientRect().height,e.remove()}static#D(e,t,n){let i=this.#v.get(e);if(i)return i;let s=this.#R(n);s.canvas.width=s.canvas.height=kE,this.#k(s,kE,e);let a=s.measureText(""),o=a.fontBoundingBoxAscent,u=Math.abs(a.fontBoundingBoxDescent);s.canvas.width=s.canvas.height=0;let l=.8;return o?l=o/(o+u):(Je.platform.isFirefox&&ue("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),t.ascent?l=t.ascent:t.descent&&(l=1+t.descent)),this.#v.set(e,l),l}},Y5=100;function Hg(r={}){typeof r=="string"||r instanceof URL?r={url:r}:(r instanceof ArrayBuffer||ArrayBuffer.isView(r))&&(r={data:r});let e=new sg,{docId:t}=e,n=r.url?L5(r.url):null,i=r.data?N5(r.data):null,s=r.httpHeaders||null,a=r.withCredentials===!0,o=r.password??null,u=r.range instanceof oc?r.range:null,l=Number.isInteger(r.rangeChunkSize)&&r.rangeChunkSize>0?r.rangeChunkSize:2**16,c=r.worker instanceof no?r.worker:null,h=r.verbosity,d=typeof r.docBaseUrl=="string"&&!Tc(r.docBaseUrl)?r.docBaseUrl:null,f=Pl(r.cMapUrl),p=r.cMapPacked!==!1,g=r.CMapReaderFactory||(Rt?P0:Zl),b=Pl(r.iccUrl),m=Pl(r.standardFontDataUrl),y=r.StandardFontDataFactory||(Rt?O0:tc),v=Pl(r.wasmUrl),x=r.WasmFactory||(Rt?L0:nc),w=r.stopAtErrors!==!0,S=Number.isInteger(r.maxImageSize)&&r.maxImageSize>-1?r.maxImageSize:-1,E=r.isEvalSupported!==!1,_=typeof r.isOffscreenCanvasSupported=="boolean"?r.isOffscreenCanvasSupported:!Rt,T=typeof r.isImageDecoderSupported=="boolean"?r.isImageDecoderSupported:!Rt&&(Je.platform.isFirefox||!globalThis.chrome),k=Number.isInteger(r.canvasMaxAreaInBytes)?r.canvasMaxAreaInBytes:-1,A=typeof r.disableFontFace=="boolean"?r.disableFontFace:Rt,B=r.fontExtraProperties===!0,D=r.enableXfa===!0,P=r.ownerDocument||globalThis.document,M=r.disableRange===!0,L=r.disableStream===!0,N=r.disableAutoFetch===!0,I=r.pdfBug===!0,H=r.CanvasFactory||(Rt?R0:C0),J=r.FilterFactory||(Rt?I0:k0),ee=r.enableHWA===!0,X=r.useWasm!==!1,q=u?u.length:r.length??NaN,ie=typeof r.useSystemFonts=="boolean"?r.useSystemFonts:!Rt&&!A,pe=typeof r.useWorkerFetch=="boolean"?r.useWorkerFetch:!!(g===Zl&&y===tc&&x===nc&&f&&m&&v&&Wa(f,document.baseURI)&&Wa(m,document.baseURI)&&Wa(v,document.baseURI)),W=null;m5(h);let $={canvasFactory:new H({ownerDocument:P,enableHWA:ee}),filterFactory:new J({docId:t,ownerDocument:P}),cMapReaderFactory:pe?null:new g({baseUrl:f,isCompressed:p}),standardFontDataFactory:pe?null:new y({baseUrl:m}),wasmFactory:pe?null:new x({baseUrl:v})};c||(c=no.create({verbosity:h,port:ei.workerPort}),e._worker=c);let G={docId:t,apiVersion:"5.4.530",data:i,password:o,disableAutoFetch:N,rangeChunkSize:l,length:q,docBaseUrl:d,enableXfa:D,evaluatorOptions:{maxImageSize:S,disableFontFace:A,ignoreErrors:w,isEvalSupported:E,isOffscreenCanvasSupported:_,isImageDecoderSupported:T,canvasMaxAreaInBytes:k,fontExtraProperties:B,useSystemFonts:ie,useWasm:X,useWorkerFetch:pe,cMapUrl:f,iccUrl:b,standardFontDataUrl:m,wasmUrl:v}},Y={ownerDocument:P,pdfBug:I,styleElement:W,loadingParams:{disableAutoFetch:N,enableXfa:D}};return c.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");let me=c.messageHandler.sendWithPromise("GetDocRequest",G,i?[i.buffer]:null),ne;if(u)ne=new G0(u,{disableRange:M,disableStream:L});else if(!i){if(!n)throw new Error("getDocument - no `url` parameter provided.");let ye=Wa(n)?X0:Rt?rg:J0;ne=new ye({url:n,length:q,httpHeaders:s,withCredentials:a,rangeChunkSize:l,disableRange:M,disableStream:L})}return me.then(ye=>{if(e.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");let he=new Jn(t,ye,c.port),be=new ug(he,e,ne,Y,$,ee);e._transport=be,he.send("Ready",null)})}).catch(e._capability.reject),e}var sg=class r{static#e=0;_capability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${r.#e++}`;destroyed=!1;onPassword=null;onProgress=null;get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}},oc=class{#e=Promise.withResolvers();#t=[];#n=[];#r=[];#a=[];constructor(e,t,n=!1,i=null){this.length=e,this.initialData=t,this.progressiveDone=n,this.contentDispositionFilename=i}addRangeListener(e){this.#a.push(e)}addProgressListener(e){this.#r.push(e)}addProgressiveReadListener(e){this.#n.push(e)}addProgressiveDoneListener(e){this.#t.push(e)}onDataRange(e,t){for(let n of this.#a)n(e,t)}onDataProgress(e,t){this.#e.promise.then(()=>{for(let n of this.#r)n(e,t)})}onDataProgressiveRead(e){this.#e.promise.then(()=>{for(let t of this.#n)t(e)})}onDataProgressiveDone(){this.#e.promise.then(()=>{for(let e of this.#t)e()})}transportReady(){this.#e.resolve()}requestDataRange(e,t){Oe("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},ag=class{constructor(e,t){this._pdfInfo=e,this._transport=t}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return le(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAnnotationsByType(e,t){return this._transport.getAnnotationsByType(e,t)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){let{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}extractPages(e){return this._transport.extractPages(e)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}},og=class{#e=!1;constructor(e,t,n,i=!1){this._pageIndex=e,this._pageInfo=t,this._transport=n,this._stats=i?new Hl:null,this._pdfBug=i,this.commonObjs=n.commonObjs,this.objs=new ac,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:t=this.rotate,offsetX:n=0,offsetY:i=0,dontFlip:s=!1}={}){return new Qa({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:n,offsetY:i,dontFlip:s})}getAnnotations({intent:e="display"}={}){let{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return le(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,canvas:t=e.canvas,viewport:n,intent:i="display",annotationMode:s=Sn.ENABLE,transform:a=null,background:o=null,optionalContentConfigPromise:u=null,annotationCanvasMap:l=null,pageColors:c=null,printAnnotationStorage:h=null,isEditing:d=!1,recordOperations:f=!1,operationsFilter:p=null}){this._stats?.time("Overall");let g=this._transport.getRenderingIntent(i,s,h,d),{renderingIntent:b,cacheKey:m}=g;this.#e=!1,u||=this._transport.getOptionalContentConfig(b);let y=this._intentStates.get(m);y||(y=Object.create(null),this._intentStates.set(m,y)),y.streamReaderCancelTimeout&&(clearTimeout(y.streamReaderCancelTimeout),y.streamReaderCancelTimeout=null);let v=!!(b&Gt.PRINT);y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(g));let x=!!(this._pdfBug&&globalThis.StepperManager?.enabled),w=!this.recordedBBoxes&&(f||x),S=T=>{if(y.renderTasks.delete(E),w){let k=E.gfx?.dependencyTracker.take();k&&(E.stepper&&E.stepper.setOperatorBBoxes(k,E.gfx.dependencyTracker.takeDebugMetadata()),f&&(this.recordedBBoxes=k))}v&&(this.#e=!0),this.#t(),T?(E.capability.reject(T),this._abortOperatorList({intentState:y,reason:T instanceof Error?T:new Error(T)})):E.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},E=new cg({callback:S,params:{canvas:t,canvasContext:e,dependencyTracker:w?new B0(t,y.operatorList.length,x):null,viewport:n,transform:a,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!v,pdfBug:this._pdfBug,pageColors:c,enableHWA:this._transport.enableHWA,operationsFilter:p});(y.renderTasks||=new Set).add(E);let _=E.task;return Promise.all([y.displayReadyCapability.promise,u]).then(([T,k])=>{if(this.destroyed){S();return}if(this._stats?.time("Rendering"),!(k.renderingIntent&b))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");E.initializeGraphics({transparency:T,optionalContentConfig:k}),E.operatorListChanged()}).catch(S),_}getOperatorList({intent:e="display",annotationMode:t=Sn.ENABLE,printAnnotationStorage:n=null,isEditing:i=!1}={}){function s(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(u))}let a=this._transport.getRenderingIntent(e,t,n,i,!0),o=this._intentStates.get(a.cacheKey);o||(o=Object.create(null),this._intentStates.set(a.cacheKey,o));let u;return o.opListReadCapability||(u=Object.create(null),u.operatorListChanged=s,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||=new Set).add(u),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:t===!0},{highWaterMark:100,size(i){return i.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(n=>Ya.textContent(n));let t=this.streamTextContent(e);return new Promise(function(n,i){function s(){a.read().then(function({value:u,done:l}){if(l){n(o);return}o.lang??=u.lang,Object.assign(o.styles,u.styles),o.items.push(...u.items),s()},i)}let a=t.getReader(),o={items:[],styles:Object.create(null),lang:null};s()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let e=[];for(let t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(let n of t.renderTasks)e.push(n.completed),n.cancel();return this.objs.clear(),this.#e=!1,Promise.all(e)}cleanup(e=!1){this.#e=!0;let t=this.#t();return e&&t&&(this._stats&&=new Hl),t}#t(){if(!this.#e||this.destroyed)return!1;for(let{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#e=!1,!0}_startRenderPage(e,t){let n=this._intentStates.get(t);n&&(this._stats?.timeEnd("Page Request"),n.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let n=0,i=e.length;n<i;n++)t.operatorList.fnArray.push(e.fnArray[n]),t.operatorList.argsArray.push(e.argsArray[n]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(let n of t.renderTasks)n.operatorListChanged();e.lastChunk&&this.#t()}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:n,modifiedIds:i}){let{map:s,transfer:a}=n,u=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:s,modifiedIds:i},a).getReader(),l=this._intentStates.get(t);l.streamReader=u;let c=()=>{u.read().then(({value:h,done:d})=>{if(d){l.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,l),c())},h=>{if(l.streamReader=null,!this._transport.destroyed){if(l.operatorList){l.operatorList.lastChunk=!0;for(let d of l.renderTasks)d.operatorListChanged();this.#t()}if(l.displayReadyCapability)l.displayReadyCapability.reject(h);else if(l.opListReadCapability)l.opListReadCapability.reject(h);else throw h}})};c()}_abortOperatorList({intentState:e,reason:t,force:n=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!n){if(e.renderTasks.size>0)return;if(t instanceof Za){let i=Y5;t.extraDelay>0&&t.extraDelay<1e3&&(i+=t.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})},i);return}}if(e.streamReader.cancel(new Dr(t.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(let[i,s]of this._intentStates)if(s===e){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}},no=class r{#e=Promise.withResolvers();#t=null;#n=null;#r=null;static#a=0;static#s=!1;static#i=new WeakMap;static{Rt&&(this.#s=!0,ei.workerSrc||="./pdf.worker.mjs"),this._isSameOrigin=(e,t)=>{let n=URL.parse(e);if(!n?.origin||n.origin==="null")return!1;let i=new URL(t,n);return n.origin===i.origin},this._createCDNWrapper=e=>{let t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))},this.fromPort=e=>{if(k5("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!e?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return this.create(e)}}constructor({name:e=null,port:t=null,verbosity:n=b5()}={}){if(this.name=e,this.destroyed=!1,this.verbosity=n,t){if(r.#i.has(t))throw new Error("Cannot use more than one PDFWorker per port.");r.#i.set(t,this),this.#l(t)}else this.#u()}get promise(){return this.#e.promise}#o(){this.#e.resolve(),this.#t.send("configure",{verbosity:this.verbosity})}get port(){return this.#n}get messageHandler(){return this.#t}#l(e){this.#n=e,this.#t=new Jn("main","worker",e),this.#t.on("ready",()=>{}),this.#o()}#u(){if(r.#s||r.#h){this.#d();return}let{workerSrc:e}=r;try{r._isSameOrigin(window.location,e)||(e=r._createCDNWrapper(new URL(e,window.location).href));let t=new Worker(e,{type:"module"}),n=new Jn("main","worker",t),i=()=>{s.abort(),n.destroy(),t.terminate(),this.destroyed?this.#e.reject(new Error("Worker was destroyed")):this.#d()},s=new AbortController;t.addEventListener("error",()=>{this.#r||i()},{signal:s.signal}),n.on("test",o=>{if(s.abort(),this.destroyed||!o){i();return}this.#t=n,this.#n=t,this.#r=t,this.#o()}),n.on("ready",o=>{if(s.abort(),this.destroyed){i();return}try{a()}catch{this.#d()}});let a=()=>{let o=new Uint8Array;n.send("test",o,[o.buffer])};a();return}catch{Ac("The worker has been disabled.")}this.#d()}#d(){r.#s||(ue("Setting up fake worker."),r.#s=!0),r._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){this.#e.reject(new Error("Worker was destroyed"));return}let t=new _0;this.#n=t;let n=`fake${r.#a++}`,i=new Jn(n+"_worker",n,t);e.setup(i,t),this.#t=new Jn(n,n+"_worker",t),this.#o()}).catch(e=>{this.#e.reject(new Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){this.destroyed=!0,this.#r?.terminate(),this.#r=null,r.#i.delete(this.#n),this.#n=null,this.#t?.destroy(),this.#t=null}static create(e){let t=this.#i.get(e?.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new r(e)}static get workerSrc(){if(ei.workerSrc)return ei.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#h(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return le(this,"_setupFakeWorkerGlobal",(async()=>this.#h?this.#h:(await import(this.workerSrc)).WorkerMessageHandler)())}},ug=class{#e=new Map;#t=new Map;#n=new Map;#r=new Map;#a=null;constructor(e,t,n,i,s,a){this.messageHandler=e,this.loadingTask=t,this.commonObjs=new ac,this.fontLoader=new w0({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.wasmFactory=s.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.enableHWA=a,this.setupMessageHandler()}#s(e,t=null){let n=this.#e.get(e);if(n)return n;let i=this.messageHandler.sendWithPromise(e,t);return this.#e.set(e,i),i}get annotationStorage(){return le(this,"annotationStorage",new eo)}getRenderingIntent(e,t=Sn.ENABLE,n=null,i=!1,s=!1){let a=Gt.DISPLAY,o=v0;switch(e){case"any":a=Gt.ANY;break;case"display":break;case"print":a=Gt.PRINT;break;default:ue(`getRenderingIntent - invalid intent: ${e}`)}let u=a&Gt.PRINT&&n instanceof ql?n:this.annotationStorage;switch(t){case Sn.DISABLE:a+=Gt.ANNOTATIONS_DISABLE;break;case Sn.ENABLE:break;case Sn.ENABLE_FORMS:a+=Gt.ANNOTATIONS_FORMS;break;case Sn.ENABLE_STORAGE:a+=Gt.ANNOTATIONS_STORAGE,o=u.serializable;break;default:ue(`getRenderingIntent - invalid annotationMode: ${t}`)}i&&(a+=Gt.IS_EDITING),s&&(a+=Gt.OPLIST);let{ids:l,hash:c}=u.modifiedIds,h=[a,o.hash,c];return{renderingIntent:a,cacheKey:h.join("_"),annotationStorageSerializable:o,modifiedIds:l}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#a?.reject(new Error("Worker was destroyed during onPassword callback"));let e=[];for(let n of this.#t.values())e.push(n._destroy());this.#t.clear(),this.#n.clear(),this.#r.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),ro.cleanup(),this._networkStream?.cancelAllRequests(new Dr("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:e,loadingTask:t}=this;e.on("GetReader",(n,i)=>{xe(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=s=>{this._lastProgress={loaded:s.loaded,total:s.total}},i.onPull=()=>{this._fullReader.read().then(function({value:s,done:a}){if(a){i.close();return}xe(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{i.error(s)})},i.onCancel=s=>{this._fullReader.cancel(s),i.ready.catch(a=>{if(!this.destroyed)throw a})}}),e.on("ReaderHeadersReady",async n=>{await this._fullReader.headersReady;let{isStreamingSupported:i,isRangeSupported:s,contentLength:a}=this._fullReader;return(!i||!s)&&(this._lastProgress&&t.onProgress?.(this._lastProgress),this._fullReader.onProgress=o=>{t.onProgress?.({loaded:o.loaded,total:o.total})}),{isStreamingSupported:i,isRangeSupported:s,contentLength:a}}),e.on("GetRangeReader",(n,i)=>{xe(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");let s=this._networkStream.getRangeReader(n.begin,n.end);if(!s){i.close();return}i.onPull=()=>{s.read().then(function({value:a,done:o}){if(o){i.close();return}xe(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{i.error(a)})},i.onCancel=a=>{s.cancel(a),i.ready.catch(o=>{if(!this.destroyed)throw o})}}),e.on("GetDoc",({pdfInfo:n})=>{this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,t._capability.resolve(new ag(n,this))}),e.on("DocException",n=>{t._capability.reject(Ft(n))}),e.on("PasswordRequest",n=>{this.#a=Promise.withResolvers();try{if(!t.onPassword)throw Ft(n);let i=s=>{s instanceof Error?this.#a.reject(s):this.#a.resolve({password:s})};t.onPassword(i,n.code)}catch(i){this.#a.reject(i)}return this.#a.promise}),e.on("DataLoaded",n=>{t.onProgress?.({loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),e.on("StartRenderPage",n=>{if(this.destroyed)return;this.#t.get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),e.on("commonobj",([n,i,s])=>{if(this.destroyed||this.commonObjs.has(n))return null;switch(i){case"Font":if("error"in s){let h=s.error;ue(`Error during font loading: ${h}`),this.commonObjs.resolve(n,h);break}let a=new S0(s),o=this._params.pdfBug&&globalThis.FontInspector?.enabled?(h,d)=>globalThis.FontInspector.fontAdded(h,d):null,u=new x0(a,o,s.extra,s.charProcOperatorList);this.fontLoader.bind(u).catch(()=>e.sendWithPromise("FontFallback",{id:n})).finally(()=>{!u.fontExtraProperties&&u.data&&u.clearData(),this.commonObjs.resolve(n,u)});break;case"CopyLocalImage":let{imageRef:l}=s;xe(l,"The imageRef must be defined.");for(let h of this.#t.values())for(let[,d]of h.objs)if(d?.ref===l)return d.dataLen?(this.commonObjs.resolve(n,structuredClone(d)),d.dataLen):null;break;case"FontPath":this.commonObjs.resolve(n,new A0(s));break;case"Image":this.commonObjs.resolve(n,s);break;case"Pattern":let c=new E0(s);this.commonObjs.resolve(n,c.getIR());break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),e.on("obj",([n,i,s,a])=>{if(this.destroyed)return;let o=this.#t.get(i);if(!o.objs.has(n)){if(o._intentStates.size===0){a?.bitmap?.close();return}switch(s){case"Image":case"Pattern":o.objs.resolve(n,a);break;default:throw new Error(`Got unknown object type ${s}`)}}}),e.on("DocProgress",n=>{this.destroyed||t.onProgress?.({loaded:n.loaded,total:n.total})}),e.on("FetchBinaryData",async n=>{if(this.destroyed)throw new Error("Worker was destroyed.");let i=this[n.type];if(!i)throw new Error(`${n.type} not initialized, see the \`useWorkerFetch\` parameter.`);return i.fetch(n)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&ue("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this._fullReader?.filename??null},t).finally(()=>{this.annotationStorage.resetModified()})}extractPages(e){return this.messageHandler.sendWithPromise("ExtractPages",{pageInfos:e})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));let t=e-1,n=this.#n.get(t);if(n)return n;let i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then(s=>{if(this.destroyed)throw new Error("Transport destroyed");s.refStr&&this.#r.set(s.refStr,e);let a=new og(t,s,this,this._params.pdfBug);return this.#t.set(t,a),a});return this.#n.set(t,i),i}getPageIndex(e){return T0(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getFieldObjects(){return this.#s("GetFieldObjects")}hasJSActions(){return this.#s("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return typeof e!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAnnotationsByType(e,t){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:e,pageIndexesToSkip:t})}getDocJSActions(){return this.#s("GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return this.#s("GetOptionalContentConfig").then(t=>new V0(t,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let e="GetMetadata",t=this.#e.get(e);if(t)return t;let n=this.messageHandler.sendWithPromise(e,null).then(i=>({info:i[0],metadata:i[1]?new H0(i[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null,hasStructTree:i[2]}));return this.#e.set(e,n),n}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(let t of this.#t.values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0),ro.cleanup()}}cachedPageNumber(e){if(!T0(e))return null;let t=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return this.#r.get(t)??null}},lg=class{#e=null;onContinue=null;onError=null;constructor(e){this.#e=e}get promise(){return this.#e.capability.promise}cancel(e=0){this.#e.cancel(null,e)}get separateAnnots(){let{separateAnnots:e}=this.#e.operatorList;if(!e)return!1;let{annotationCanvasMap:t}=this.#e;return e.form||e.canvas&&t?.size>0}},cg=class r{#e=null;static#t=new WeakSet;constructor({callback:e,params:t,objs:n,commonObjs:i,annotationCanvasMap:s,operatorList:a,pageIndex:o,canvasFactory:u,filterFactory:l,useRequestAnimationFrame:c=!1,pdfBug:h=!1,pageColors:d=null,enableHWA:f=!1,operationsFilter:p=null}){this.callback=e,this.params=t,this.objs=n,this.commonObjs=i,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=u,this.filterFactory=l,this._pdfBug=h,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=c===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new lg(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvas,this._canvasContext=t.canvas?null:t.canvasContext,this._enableHWA=f,this._dependencyTracker=t.dependencyTracker,this._operationsFilter=p}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){if(this.cancelled)return;if(this._canvas){if(r.#t.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");r.#t.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{viewport:n,transform:i,background:s,dependencyTracker:a}=this.params,o=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new ps(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors,a),this.gfx.beginDrawing({transform:i,viewport:n,transparency:e,background:s}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,t=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e&&(window.cancelAnimationFrame(this.#e),this.#e=null),r.#t.delete(this._canvas),e||=new Za(`Rendering cancelled, page ${this._pageIndex+1}`,t),this.callback(e),this.task.onError?.(e)}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#e=window.requestAnimationFrame(()=>{this.#e=null,this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),r.#t.delete(this._canvas),this.callback())))}},Q5="5.4.530",Z5="50cc4adac",uc=class r{#e=null;#t=null;#n;#r=null;#a=!1;#s=!1;#i=null;#o;#l=null;#u=null;static#d=null;static get _keyboardManager(){return le(this,"_keyboardManager",new ri([[["Escape","mac+Escape"],r.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],r.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],r.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],r.prototype._moveToPrevious],[["Home","mac+Home"],r.prototype._moveToBeginning],[["End","mac+End"],r.prototype._moveToEnd]]))}constructor({editor:e=null,uiManager:t=null}){e?(this.#s=!1,this.#i=e):this.#s=!0,this.#u=e?._uiManager||t,this.#o=this.#u._eventBus,this.#n=e?.color?.toUpperCase()||this.#u?.highlightColors.values().next().value||"#FFFF98",r.#d||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){let e=this.#e=document.createElement("button");e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",this.#i&&(e.ariaControls=`${this.#i.id}_colorpicker_dropdown`);let t=this.#u._signal;e.addEventListener("click",this.#g.bind(this),{signal:t}),e.addEventListener("keydown",this.#m.bind(this),{signal:t});let n=this.#t=document.createElement("span");return n.className="swatch",n.ariaHidden="true",n.style.backgroundColor=this.#n,e.append(n),e}renderMainDropdown(){let e=this.#r=this.#h();return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}#h(){let e=document.createElement("div"),t=this.#u._signal;e.addEventListener("contextmenu",ur,{signal:t}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),this.#i&&(e.id=`${this.#i.id}_colorpicker_dropdown`);for(let[n,i]of this.#u.highlightColors){let s=document.createElement("button");s.tabIndex="0",s.role="option",s.setAttribute("data-color",i),s.title=n,s.setAttribute("data-l10n-id",r.#d[n]);let a=document.createElement("span");s.append(a),a.className="swatch",a.style.backgroundColor=i,s.ariaSelected=i===this.#n,s.addEventListener("click",this.#f.bind(this,i),{signal:t}),e.append(s)}return e.addEventListener("keydown",this.#m.bind(this),{signal:t}),e}#f(e,t){t.stopPropagation(),this.#o.dispatch("switchannotationeditorparams",{source:this,type:we.HIGHLIGHT_COLOR,value:e}),this.updateColor(e)}_colorSelectFromKeyboard(e){if(e.target===this.#e){this.#g(e);return}let t=e.target.getAttribute("data-color");t&&this.#f(t,e)}_moveToNext(e){if(!this.#p){this.#g(e);return}if(e.target===this.#e){this.#r.firstElementChild?.focus();return}e.target.nextSibling?.focus()}_moveToPrevious(e){if(e.target===this.#r?.firstElementChild||e.target===this.#e){this.#p&&this._hideDropdownFromKeyboard();return}this.#p||this.#g(e),e.target.previousSibling?.focus()}_moveToBeginning(e){if(!this.#p){this.#g(e);return}this.#r.firstElementChild?.focus()}_moveToEnd(e){if(!this.#p){this.#g(e);return}this.#r.lastElementChild?.focus()}#m(e){r._keyboardManager.exec(this,e)}#g(e){if(this.#p){this.hideDropdown();return}if(this.#a=e.detail===0,this.#l||(this.#l=new AbortController,window.addEventListener("pointerdown",this.#c.bind(this),{signal:this.#u.combinedSignal(this.#l)})),this.#e.ariaExpanded="true",this.#r){this.#r.classList.remove("hidden");return}let t=this.#r=this.#h();this.#e.append(t)}#c(e){this.#r?.contains(e.target)||this.hideDropdown()}hideDropdown(){this.#r?.classList.add("hidden"),this.#e.ariaExpanded="false",this.#l?.abort(),this.#l=null}get#p(){return this.#r&&!this.#r.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(!this.#s){if(!this.#p){this.#i?.unselect();return}this.hideDropdown(),this.#e.focus({preventScroll:!0,focusVisible:this.#a})}}updateColor(e){if(this.#t&&(this.#t.style.backgroundColor=e),!this.#r)return;let t=this.#u.highlightColors.values();for(let n of this.#r.children)n.ariaSelected=t.next().value===e.toUpperCase()}destroy(){this.#e?.remove(),this.#e=null,this.#t=null,this.#r?.remove(),this.#r=null}},lc=class r{#e=null;#t=null;#n=null;static#r=null;constructor(e){this.#t=e,this.#n=e._uiManager,r.#r||=Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"})}renderButton(){if(this.#e)return this.#e;let{editorType:e,colorType:t,color:n}=this.#t,i=this.#e=document.createElement("input");return i.type="color",i.value=n||"#000000",i.className="basicColorPicker",i.tabIndex=0,i.setAttribute("data-l10n-id",r.#r[e]),i.addEventListener("input",()=>{this.#n.updateParams(t,i.value)},{signal:this.#n._signal}),i}update(e){this.#e&&(this.#e.value=e)}destroy(){this.#e?.remove(),this.#e=null}hideDropdown(){}},Hz=fe(116),Wz=fe(531);function IE(r){return Math.floor(Math.max(0,Math.min(1,r))*255).toString(16).padStart(2,"0")}function ja(r){return Math.max(0,Math.min(255,255*r))}var cc=class{static CMYK_G([e,t,n,i]){return["G",1-Math.min(1,.3*e+.59*n+.11*t+i)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return e=ja(e),[e,e,e]}static G_HTML([e]){let t=IE(e);return`#${t}${t}${t}`}static RGB_G([e,t,n]){return["G",.3*e+.59*t+.11*n]}static RGB_rgb(e){return e.map(ja)}static RGB_HTML(e){return`#${e.map(IE).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,n,i]){return["RGB",1-Math.min(1,e+i),1-Math.min(1,n+i),1-Math.min(1,t+i)]}static CMYK_rgb([e,t,n,i]){return[ja(1-Math.min(1,e+i)),ja(1-Math.min(1,n+i)),ja(1-Math.min(1,t+i))]}static CMYK_HTML(e){let t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,n]){let i=1-e,s=1-t,a=1-n,o=Math.min(i,s,a);return["CMYK",i,s,a,o]}};var hg=class{create(e,t,n=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");let i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),n||(i.setAttribute("width",`${e}px`),i.setAttribute("height",`${t}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${e} ${t}`),i}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){Oe("Abstract method `_createSVG` called.")}},ms=class extends hg{_createSVG(e){return document.createElementNS(rn,e)}},J5=9,ii=new WeakSet,eB=new Date().getTimezoneOffset()*60*1e3,Ga=class{static create(e){switch(e.data.annotationType){case it.LINK:return new io(e);case it.TEXT:return new fg(e);case it.WIDGET:switch(e.data.fieldType){case"Tx":return new pg(e);case"Btn":return e.data.radioButton?new hc(e):e.data.checkBox?new mg(e):new bg(e);case"Ch":return new yg(e);case"Sig":return new gg(e)}return new sn(e);case it.POPUP:return new so(e);case it.FREETEXT:return new dc(e);case it.LINE:return new wg(e);case it.SQUARE:return new xg(e);case it.CIRCLE:return new Sg(e);case it.POLYLINE:return new fc(e);case it.CARET:return new Ag(e);case it.INK:return new ao(e);case it.POLYGON:return new Eg(e);case it.HIGHLIGHT:return new pc(e);case it.UNDERLINE:return new Tg(e);case it.SQUIGGLY:return new _g(e);case it.STRIKEOUT:return new Cg(e);case it.STAMP:return new gc(e);case it.FILEATTACHMENT:return new kg(e);default:return new We(e)}}},We=class r{#e=null;#t=!1;#n=null;constructor(e,{isRenderable:t=!1,ignoreBorder:n=!1,createQuadrilaterals:i=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableComment=e.enableComment,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,this.hasOwnCommentButton=!1,t&&(this.contentElement=this.container=this._createContainer(n)),i&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:t}){return!!(e?.str||t?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return r._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){let{data:e}=this,t=this.annotationStorage?.getEditor(e.id);return t?t.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){let e=this.annotationStorage?.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;let{quadPoints:t,inkLists:n,rect:i}=this.data,s=-1/0,a=-1/0;if(t?.length>=8){for(let o=0;o<t.length;o+=8)t[o+1]>a?(a=t[o+1],s=t[o+2]):t[o+1]===a&&(s=Math.max(s,t[o+2]));return[s,a]}if(n?.length>=1){for(let o of n)for(let u=0,l=o.length;u<l;u+=2)o[u+1]>a?(a=o[u+1],s=o[u]):o[u+1]===a&&(s=Math.max(s,o[u]));if(s!==1/0)return[s,a]}return i?[i[2],i[3]]:null}_normalizePoint(e){let{page:{view:t},viewport:{rawDims:{pageWidth:n,pageHeight:i,pageX:s,pageY:a}}}=this.parent;return e[1]=t[3]-e[1]+t[1],e[0]=100*(e[0]-s)/n,e[1]=100*(e[1]-a)/i,e}get commentText(){let{data:e}=this;return this.annotationStorage.getRawValue(`${qa}${e.id}`)?.popup?.contents||e.contentsObj?.str||""}set commentText(e){let{data:t}=this,n={deleted:!e,contents:e||""};this.annotationStorage.updateEditor(t.id,{popup:n})||this.annotationStorage.setValue(`${qa}${t.id}`,{id:t.id,annotationType:t.annotationType,pageIndex:this.parent.page._pageIndex,popup:n,popupRef:t.popupRef,modificationDate:new Date}),e||this.removePopup()}removePopup(){(this.#n?.popup||this.popup)?.remove(),this.#n=this.popup=null}updateEdited(e){if(!this.container)return;e.rect&&(this.#e||={rect:this.data.rect.slice(0)});let{rect:t,popup:n}=e;t&&this.#r(t);let i=this.#n?.popup||this.popup;!i&&n?.text&&(this._createPopup(n),i=this.#n.popup),i&&(i.updateEdited(e),n?.deleted&&(i.remove(),this.#n=null,this.popup=null))}resetEdited(){this.#e&&(this.#r(this.#e.rect),this.#n?.popup.resetEdited(),this.#e=null)}#r(e){let{container:{style:t},data:{rect:n,rotation:i},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:a,pageX:o,pageY:u}}}}=this;n?.splice(0,4,...e),t.left=`${100*(e[0]-o)/s}%`,t.top=`${100*(a-e[3]+u)/a}%`,i===0?(t.width=`${100*(e[2]-e[0])/s}%`,t.height=`${100*(e[3]-e[1])/a}%`):this.setRotation(i)}_createContainer(e){let{data:t,parent:{page:n,viewport:i}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",t.id),!(this instanceof sn)&&!(this instanceof io)&&(s.tabIndex=0);let{style:a}=s;if(a.zIndex=this.parent.zIndex,this.parent.zIndex+=2,t.alternativeText&&(s.title=t.alternativeText),t.noRotate&&s.classList.add("norotate"),!t.rect||this instanceof so){let{rotation:g}=t;return!t.hasOwnCanvas&&g!==0&&this.setRotation(g,s),s}let{width:o,height:u}=this;if(!e&&t.borderStyle.width>0){a.borderWidth=`${t.borderStyle.width}px`;let g=t.borderStyle.horizontalCornerRadius,b=t.borderStyle.verticalCornerRadius;if(g>0||b>0){let y=`calc(${g}px * var(--total-scale-factor)) / calc(${b}px * var(--total-scale-factor))`;a.borderRadius=y}else if(this instanceof hc){let y=`calc(${o}px * var(--total-scale-factor)) / calc(${u}px * var(--total-scale-factor))`;a.borderRadius=y}switch(t.borderStyle.style){case ls.SOLID:a.borderStyle="solid";break;case ls.DASHED:a.borderStyle="dashed";break;case ls.BEVELED:ue("Unimplemented border style: beveled");break;case ls.INSET:ue("Unimplemented border style: inset");break;case ls.UNDERLINE:a.borderBottomStyle="solid";break;default:break}let m=t.borderColor||null;m?(this.#t=!0,a.borderColor=Q.makeHexColor(m[0]|0,m[1]|0,m[2]|0)):a.borderWidth=0}let l=Q.normalizeRect([t.rect[0],n.view[3]-t.rect[1]+n.view[1],t.rect[2],n.view[3]-t.rect[3]+n.view[1]]),{pageWidth:c,pageHeight:h,pageX:d,pageY:f}=i.rawDims;a.left=`${100*(l[0]-d)/c}%`,a.top=`${100*(l[1]-f)/h}%`;let{rotation:p}=t;return t.hasOwnCanvas||p===0?(a.width=`${100*o/c}%`,a.height=`${100*u/h}%`):this.setRotation(p,s),s}setRotation(e,t=this.container){if(!this.data.rect)return;let{pageWidth:n,pageHeight:i}=this.parent.viewport.rawDims,{width:s,height:a}=this;e%180!==0&&([s,a]=[a,s]),t.style.width=`${100*s/n}%`,t.style.height=`${100*a/i}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){let e=(t,n,i)=>{let s=i.detail[t],a=s[0],o=s.slice(1);i.target.style[n]=cc[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[n]:cc[`${a}_rgb`](o)})};return le(this,"_commonActions",{display:t=>{let{display:n}=t.detail,i=n%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:n===1||n===2})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{let{hidden:n}=t.detail;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:n,noView:n})},focus:t=>{setTimeout(()=>t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},rotation:t=>{let n=t.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(e,t){let n=this._commonActions;for(let i of Object.keys(t.detail))(e[i]||n[i])?.(t)}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;let t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;let n=this._commonActions;for(let[i,s]of Object.entries(t)){let a=n[i];if(a){let o={detail:{[i]:s},target:e};a(o),delete t[i]}}}_createQuadrilaterals(){if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[t,n,i,s]=this.data.rect.map(g=>Math.fround(g));if(e.length===8){let[g,b,m,y]=e.subarray(2,6);if(i===g&&s===b&&t===m&&n===y)return}let{style:a}=this.container,o;if(this.#t){let{borderColor:g,borderWidth:b}=a;a.borderWidth=0,o=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${g}" stroke-width="${b}">`],this.container.classList.add("hasBorder")}let u=i-t,l=s-n,{svgFactory:c}=this,h=c.createElement("svg");h.classList.add("quadrilateralsContainer"),h.setAttribute("width",0),h.setAttribute("height",0),h.role="none";let d=c.createElement("defs");h.append(d);let f=c.createElement("clipPath"),p=`clippath_${this.data.id}`;f.setAttribute("id",p),f.setAttribute("clipPathUnits","objectBoundingBox"),d.append(f);for(let g=2,b=e.length;g<b;g+=8){let m=e[g],y=e[g+1],v=e[g+2],x=e[g+3],w=c.createElement("rect"),S=(v-t)/u,E=(s-y)/l,_=(m-v)/u,T=(y-x)/l;w.setAttribute("x",S),w.setAttribute("y",E),w.setAttribute("width",_),w.setAttribute("height",T),f.append(w),o?.push(`<rect vector-effect="non-scaling-stroke" x="${S}" y="${E}" width="${_}" height="${T}"/>`)}this.#t&&(o.push("</g></svg>')"),a.backgroundImage=o.join("")),this.container.append(h),this.container.style.clipPath=`url(#${p})`}_createPopup(e=null){let{data:t}=this,n,i;e?(n={str:e.text},i=e.date):(n=t.contentsObj,i=t.modificationDate),this.#n=new so({data:{color:t.color,titleObj:t.titleObj,modificationDate:i,contentsObj:n,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]})}get hasPopupElement(){return!!(this.#n||this.popup||this.data.popupRef)}get extraPopupElement(){return this.#n}render(){Oe("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){let n=[];if(this._fieldObjects){let i=this._fieldObjects[e];if(i)for(let{page:s,id:a,exportValues:o}of i){if(s===-1||a===t)continue;let u=typeof o=="string"?o:null,l=document.querySelector(`[data-element-id="${a}"]`);if(l&&!ii.has(l)){ue(`_getElementsByName - element not allowed: ${a}`);continue}n.push({id:a,exportValue:u,domElement:l})}return n}for(let i of document.getElementsByName(e)){let{exportValue:s}=i,a=i.getAttribute("data-element-id");a!==t&&ii.has(i)&&n.push({id:a,exportValue:s,domElement:i})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(let t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}},dg=class extends We{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.editor=e.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){let{editor:e}=this;e.hasComment&&this._createPopup(e.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(e){this.editor.comment=e,e||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}},io=class extends We{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){let{data:e,linkService:t}=this,n=document.createElement("a");n.setAttribute("data-element-id",e.id);let i=!1;return e.url?(t.addLinkAttributes(n,e.url,e.newWindow),i=!0):e.action?(this._bindNamedAction(n,e.action,e.overlaidText),i=!0):e.attachment?(this.#t(n,e.attachment,e.overlaidText,e.attachmentDest),i=!0):e.setOCGState?(this.#n(n,e.setOCGState,e.overlaidText),i=!0):e.dest?(this._bindLink(n,e.dest,e.overlaidText),i=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,e),i=!0),e.resetForm?(this._bindResetFormAction(n,e.resetForm),i=!0):this.isTooltipOnly&&!i&&(this._bindLink(n,""),i=!0)),this.container.classList.add("linkAnnotation"),i&&(this.contentElement=n,this.container.append(n)),this.container}#e(){this.container.setAttribute("data-internal-link","")}_bindLink(e,t,n=""){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||t==="")&&this.#e(),n&&(e.title=n)}_bindNamedAction(e,t,n=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),n&&(e.title=n),this.#e()}#t(e,t,n="",i=null){e.href=this.linkService.getAnchorUrl(""),t.description?e.title=t.description:n&&(e.title=n),e.onclick=()=>(this.downloadManager?.openOrDownloadData(t.content,t.filename,i),!1),this.#e()}#n(e,t,n=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),n&&(e.title=n),this.#e()}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");let n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let i of Object.keys(t.actions)){let s=n.get(i);s&&(e[s]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:i}}),!1))}t.overlaidText&&(e.title=t.overlaidText),e.onclick||(e.onclick=()=>!1),this.#e()}_bindResetFormAction(e,t){let n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl("")),this.#e(),!this._fieldObjects){ue('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(e.onclick=()=>!1);return}e.onclick=()=>{n?.();let{fields:i,refs:s,include:a}=t,o=[];if(i.length!==0||s.length!==0){let c=new Set(s);for(let h of i){let d=this._fieldObjects[h]||[];for(let{id:f}of d)c.add(f)}for(let h of Object.values(this._fieldObjects))for(let d of h)c.has(d.id)===a&&o.push(d)}else for(let c of Object.values(this._fieldObjects))o.push(...c);let u=this.annotationStorage,l=[];for(let c of o){let{id:h}=c;switch(l.push(h),c.type){case"text":{let f=c.defaultValue||"";u.setValue(h,{value:f});break}case"checkbox":case"radiobutton":{let f=c.defaultValue===c.exportValues;u.setValue(h,{value:f});break}case"combobox":case"listbox":{let f=c.defaultValue||"";u.setValue(h,{value:f});break}default:continue}let d=document.querySelector(`[data-element-id="${h}"]`);if(d){if(!ii.has(d)){ue(`_bindResetFormAction - element not allowed: ${h}`);continue}}else continue;d.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:l,name:"ResetForm"}}),!1}}},fg=class extends We{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");let e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(e),this.container}},sn=class extends We{render(){return this.container}showElementAndHideCanvas(e){this.data.hasOwnCanvas&&(e.previousSibling?.nodeName==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return Je.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,n,i,s){n.includes("mouse")?e.addEventListener(n,a=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:s(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):e.addEventListener(n,a=>{if(n==="blur"){if(!t.focused||!a.relatedTarget)return;t.focused=!1}else if(n==="focus"){if(t.focused)return;t.focused=!0}s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:s(a)}})})}_setEventListeners(e,t,n,i){for(let[s,a]of n)(a==="Action"||this.data.actions?.[a])&&((a==="Focus"||a==="Blur")&&(t||={focused:!1}),this._setEventListener(e,t,s,a,i),a==="Focus"&&!this.data.actions?.Blur?this._setEventListener(e,t,"blur","Blur",null):a==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(e,t,"focus","Focus",null))}_setBackgroundColor(e){let t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?"transparent":Q.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){let t=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||J5,s=e.style,a,o=2,u=l=>Math.round(10*l)/10;if(this.data.multiLine){let l=Math.abs(this.data.rect[3]-this.data.rect[1]-o),c=Math.round(l/($l*i))||1,h=l/c;a=Math.min(i,u(h/$l))}else{let l=Math.abs(this.data.rect[3]-this.data.rect[1]-o);a=Math.min(i,u(l/$l))}s.fontSize=`calc(${a}px * var(--total-scale-factor))`,s.color=Q.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(s.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}},pg=class extends sn{constructor(e){let t=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:t})}setPropertyOnSiblings(e,t,n,i){let s=this.annotationStorage;for(let a of this._getElementsByName(e.name,e.id))a.domElement&&(a.domElement[t]=n),s.setValue(a.id,{[i]:n})}render(){let e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){let i=e.getValue(t,{value:this.data.fieldValue}),s=i.value||"",a=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;a&&s.length>a&&(s=s.slice(0,a));let o=i.formattedValue||this.data.textContent?.join(`
136
+ `)||null;o&&this.data.comb&&(o=o.replaceAll(/\s+/g,""));let u={userValue:s,formattedValue:o,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=o??s,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type=this.data.password?"password":"text",n.setAttribute("value",o??s),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),ii.add(n),this.contentElement=n,n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=0;let{datetimeFormat:l,datetimeType:c,timeStep:h}=this.data,d=!!c&&this.enableScripting;l&&(n.title=l),this._setRequired(n,this.data.required),a&&(n.maxLength=a),n.addEventListener("input",p=>{e.setValue(t,{value:p.target.value}),this.setPropertyOnSiblings(n,"value",p.target.value,"value"),u.formattedValue=null}),n.addEventListener("resetform",p=>{let g=this.data.defaultFieldValue??"";n.value=u.userValue=g,u.formattedValue=null});let f=p=>{let{formattedValue:g}=u;g!=null&&(p.target.value=g),p.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",g=>{if(u.focused)return;let{target:b}=g;if(d&&(b.type=c,h&&(b.step=h)),u.userValue){let m=u.userValue;if(d)if(c==="time"){let y=new Date(m),v=[y.getHours(),y.getMinutes(),y.getSeconds()];b.value=v.map(x=>x.toString().padStart(2,"0")).join(":")}else b.value=new Date(m-eB).toISOString().split(c==="date"?"T":".",1)[0];else b.value=m}u.lastCommittedValue=b.value,u.commitKey=1,this.data.actions?.Focus||(u.focused=!0)}),n.addEventListener("updatefromsandbox",g=>{this.showElementAndHideCanvas(g.target);let b={value(m){u.userValue=m.detail.value??"",d||e.setValue(t,{value:u.userValue.toString()}),m.target.value=u.userValue},formattedValue(m){let{formattedValue:y}=m.detail;u.formattedValue=y,y!=null&&m.target!==document.activeElement&&(m.target.value=y);let v={formattedValue:y};d&&(v.value=y),e.setValue(t,v)},selRange(m){m.target.setSelectionRange(...m.detail.selRange)},charLimit:m=>{let{charLimit:y}=m.detail,{target:v}=m;if(y===0){v.removeAttribute("maxLength");return}v.setAttribute("maxLength",y);let x=u.userValue;!x||x.length<=y||(x=x.slice(0,y),v.value=u.userValue=x,e.setValue(t,{value:x}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:x,willCommit:!0,commitKey:1,selStart:v.selectionStart,selEnd:v.selectionEnd}}))}};this._dispatchEventFromSandbox(b,g)}),n.addEventListener("keydown",g=>{u.commitKey=1;let b=-1;if(g.key==="Escape"?b=0:g.key==="Enter"&&!this.data.multiLine?b=2:g.key==="Tab"&&(u.commitKey=3),b===-1)return;let{value:m}=g.target;u.lastCommittedValue!==m&&(u.lastCommittedValue=m,u.userValue=m,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:m,willCommit:!0,commitKey:b,selStart:g.target.selectionStart,selEnd:g.target.selectionEnd}}))});let p=f;f=null,n.addEventListener("blur",g=>{if(!u.focused||!g.relatedTarget)return;this.data.actions?.Blur||(u.focused=!1);let{target:b}=g,{value:m}=b;if(d){if(m&&c==="time"){let y=m.split(":").map(v=>parseInt(v,10));m=new Date(2e3,0,1,y[0],y[1],y[2]||0).valueOf(),b.step=""}else m.includes("T")||(m=`${m}T00:00`),m=new Date(m).valueOf();b.type="text"}u.userValue=m,u.lastCommittedValue!==m&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:m,willCommit:!0,commitKey:u.commitKey,selStart:g.target.selectionStart,selEnd:g.target.selectionEnd}}),p(g)}),this.data.actions?.Keystroke&&n.addEventListener("beforeinput",g=>{u.lastCommittedValue=null;let{data:b,target:m}=g,{value:y,selectionStart:v,selectionEnd:x}=m,w=v,S=x;switch(g.inputType){case"deleteWordBackward":{let E=y.substring(0,v).match(/\w*[^\w]*$/);E&&(w-=E[0].length);break}case"deleteWordForward":{let E=y.substring(v).match(/^[^\w]*\w*/);E&&(S+=E[0].length);break}case"deleteContentBackward":v===x&&(w-=1);break;case"deleteContentForward":v===x&&(S+=1);break}g.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:y,change:b||"",willCommit:!1,selStart:w,selEnd:S}})}),this._setEventListeners(n,u,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],g=>g.target.value)}if(f&&n.addEventListener("blur",f),this.data.comb){let g=(this.data.rect[2]-this.data.rect[0])/a;n.classList.add("comb"),n.style.letterSpacing=`calc(${g}px * var(--total-scale-factor) - 1ch)`}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell",this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}},gg=class extends sn{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}},mg=class extends sn{constructor(e){super(e,{isRenderable:e.renderForms})}render(){let e=this.annotationStorage,t=this.data,n=t.id,i=e.getValue(n,{value:t.exportValue===t.fieldValue}).value;typeof i=="string"&&(i=i!=="Off",e.setValue(n,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let s=document.createElement("input");return ii.add(s),s.setAttribute("data-element-id",n),s.disabled=t.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=t.fieldName,i&&s.setAttribute("checked",!0),s.setAttribute("exportValue",t.exportValue),s.tabIndex=0,s.addEventListener("change",a=>{let{name:o,checked:u}=a.target;for(let l of this._getElementsByName(o,n)){let c=u&&l.exportValue===t.exportValue;l.domElement&&(l.domElement.checked=c),e.setValue(l.id,{value:c})}e.setValue(n,{value:u})}),s.addEventListener("resetform",a=>{let o=t.defaultFieldValue||"Off";a.target.checked=o===t.exportValue}),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",a=>{let o={value(u){u.target.checked=u.detail.value!=="Off",e.setValue(n,{value:u.target.checked})}};this._dispatchEventFromSandbox(o,a)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}},hc=class extends sn{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let e=this.annotationStorage,t=this.data,n=t.id,i=e.getValue(n,{value:t.fieldValue===t.buttonValue}).value;if(typeof i=="string"&&(i=i!==t.buttonValue,e.setValue(n,{value:i})),i)for(let a of this._getElementsByName(t.fieldName,n))e.setValue(a.id,{value:!1});let s=document.createElement("input");if(ii.add(s),s.setAttribute("data-element-id",n),s.disabled=t.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=t.fieldName,i&&s.setAttribute("checked",!0),s.tabIndex=0,s.addEventListener("change",a=>{let{name:o,checked:u}=a.target;for(let l of this._getElementsByName(o,n))e.setValue(l.id,{value:!1});e.setValue(n,{value:u})}),s.addEventListener("resetform",a=>{let o=t.defaultFieldValue;a.target.checked=o!=null&&o===t.buttonValue}),this.enableScripting&&this.hasJSActions){let a=t.buttonValue;s.addEventListener("updatefromsandbox",o=>{let u={value:l=>{let c=a===l.detail.value;for(let h of this._getElementsByName(l.target.name)){let d=c&&h.id===n;h.domElement&&(h.domElement.checked=d),e.setValue(h.id,{value:d})}}};this._dispatchEventFromSandbox(u,o)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)}return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}},bg=class extends io{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){let e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");let t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",n=>{this._dispatchEventFromSandbox({},n)})),e}},yg=class extends sn{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let e=this.annotationStorage,t=this.data.id,n=e.getValue(t,{value:this.data.fieldValue}),i=document.createElement("select");ii.add(i),i.setAttribute("data-element-id",t),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=0;let s=this.data.combo&&this.data.options.length>0;this.data.combo||(i.size=this.data.options.length,this.data.multiSelect&&(i.multiple=!0)),i.addEventListener("resetform",c=>{let h=this.data.defaultFieldValue;for(let d of i.options)d.selected=d.value===h});for(let c of this.data.options){let h=document.createElement("option");h.textContent=c.displayValue,h.value=c.exportValue,n.value.includes(c.exportValue)&&(h.setAttribute("selected",!0),s=!1),i.append(h)}let a=null;if(s){let c=document.createElement("option");c.value=" ",c.setAttribute("hidden",!0),c.setAttribute("selected",!0),i.prepend(c),a=()=>{c.remove(),i.removeEventListener("input",a),a=null},i.addEventListener("input",a)}let o=c=>{let h=c?"value":"textContent",{options:d,multiple:f}=i;return f?Array.prototype.filter.call(d,p=>p.selected).map(p=>p[h]):d.selectedIndex===-1?null:d[d.selectedIndex][h]},u=o(!1),l=c=>{let h=c.target.options;return Array.prototype.map.call(h,d=>({displayValue:d.textContent,exportValue:d.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",c=>{let h={value(d){a?.();let f=d.detail.value,p=new Set(Array.isArray(f)?f:[f]);for(let g of i.options)g.selected=p.has(g.value);e.setValue(t,{value:o(!0)}),u=o(!1)},multipleSelection(d){i.multiple=!0},remove(d){let f=i.options,p=d.detail.remove;f[p].selected=!1,i.remove(p),f.length>0&&Array.prototype.findIndex.call(f,b=>b.selected)===-1&&(f[0].selected=!0),e.setValue(t,{value:o(!0),items:l(d)}),u=o(!1)},clear(d){for(;i.length!==0;)i.remove(0);e.setValue(t,{value:null,items:[]}),u=o(!1)},insert(d){let{index:f,displayValue:p,exportValue:g}=d.detail.insert,b=i.children[f],m=document.createElement("option");m.textContent=p,m.value=g,b?b.before(m):i.append(m),e.setValue(t,{value:o(!0),items:l(d)}),u=o(!1)},items(d){let{items:f}=d.detail;for(;i.length!==0;)i.remove(0);for(let p of f){let{displayValue:g,exportValue:b}=p,m=document.createElement("option");m.textContent=g,m.value=b,i.append(m)}i.options.length>0&&(i.options[0].selected=!0),e.setValue(t,{value:o(!0),items:l(d)}),u=o(!1)},indices(d){let f=new Set(d.detail.indices);for(let p of d.target.options)p.selected=f.has(p.index);e.setValue(t,{value:o(!0)}),u=o(!1)},editable(d){d.target.disabled=!d.detail.editable}};this._dispatchEventFromSandbox(h,c)}),i.addEventListener("input",c=>{let h=o(!0),d=o(!1);e.setValue(t,{value:h}),c.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:u,change:d,changeEx:h,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(i,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],c=>c.target.value)):i.addEventListener("input",function(c){e.setValue(t,{value:o(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}},so=class extends We{constructor(e){let{data:t,elements:n,parent:i}=e,s=!!i._commentManager;if(super(e,{isRenderable:!s&&We._hasPopupData(t)}),this.elements=n,s&&We._hasPopupData(t)){let a=this.popup=this.#e();for(let o of n)o.popup=a}else this.popup=null}#e(){return new vg({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})}render(){let{container:e}=this;e.classList.add("popupAnnotation"),e.role="comment";let t=this.popup=this.#e(),n=[];for(let i of this.elements)i.popup=t,i.container.ariaHasPopup="dialog",n.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",n.map(i=>`${hs}${i}`).join(",")),this.container}},vg=class{#e=null;#t=this.#W.bind(this);#n=this.#$.bind(this);#r=this.#L.bind(this);#a=this.#S.bind(this);#s=null;#i=null;#o=null;#l=null;#u=null;#d=null;#h=null;#f=!1;#m=null;#g=null;#c=null;#p=null;#b=null;#v=null;#y=null;#T=null;#E=null;#x=null;#C=!1;#w=null;#A=null;constructor({container:e,color:t,elements:n,titleObj:i,modificationDate:s,contentsObj:a,richText:o,parent:u,rect:l,parentRect:c,open:h,commentManager:d=null}){this.#i=e,this.#E=i,this.#o=a,this.#T=o,this.#d=u,this.#s=t,this.#y=l,this.#h=c,this.#u=n,this.#e=d,this.#w=n[0],this.#l=Ja.toDateObject(s),this.trigger=n.flatMap(f=>f.getElementsToTriggerPopup()),d||(this.#R(),this.#i.hidden=!0,h&&this.#S())}#R(){if(this.#g)return;this.#g=new AbortController;let{signal:e}=this.#g;for(let t of this.trigger)t.addEventListener("click",this.#a,{signal:e}),t.addEventListener("pointerenter",this.#r,{signal:e}),t.addEventListener("pointerleave",this.#n,{signal:e}),t.classList.add("popupTriggerArea");for(let t of this.#u)t.container?.addEventListener("keydown",this.#t,{signal:e})}#k(){let e=this.#u.find(t=>t.hasCommentButton);e&&(this.#b=e._normalizePoint(e.commentButtonPosition))}renderCommentButton(){if(this.#p){this.#p.parentNode||this.#w.container.after(this.#p);return}if(this.#b||this.#k(),!this.#b)return;let{signal:e}=this.#g=new AbortController,t=this.#w.hasOwnCommentButton,n=()=>{this.#e.toggleCommentPopup(this,!0,void 0,!t)},i=()=>{this.#e.toggleCommentPopup(this,!1,!0,!t)},s=()=>{this.#e.toggleCommentPopup(this,!1,!1)};if(t){this.#p=this.#w.container;for(let a of this.trigger)a.ariaHasPopup="dialog",a.ariaControls="commentPopup",a.addEventListener("keydown",this.#t,{signal:e}),a.addEventListener("click",n,{signal:e}),a.addEventListener("pointerenter",i,{signal:e}),a.addEventListener("pointerleave",s,{signal:e}),a.classList.add("popupTriggerArea")}else{let a=this.#p=document.createElement("button");a.className="annotationCommentButton";let o=this.#w.container;a.style.zIndex=o.style.zIndex+1,a.tabIndex=0,a.ariaHasPopup="dialog",a.ariaControls="commentPopup",a.setAttribute("data-l10n-id","pdfjs-show-comment-button"),this.#D(),this.#I(),a.addEventListener("keydown",this.#t,{signal:e}),a.addEventListener("click",n,{signal:e}),a.addEventListener("pointerenter",i,{signal:e}),a.addEventListener("pointerleave",s,{signal:e}),o.after(a)}}#I(){if(this.#w.extraPopupElement&&!this.#w.editor)return;this.#p||this.renderCommentButton();let[e,t]=this.#b,{style:n}=this.#p;n.left=`calc(${e}%)`,n.top=`calc(${t}% - var(--comment-button-dim))`}#D(){this.#w.extraPopupElement||(this.#p||this.renderCommentButton(),this.#p.style.backgroundColor=this.commentButtonColor||"")}get commentButtonColor(){let{color:e,opacity:t}=this.#w.commentData;return e?this.#d._commentManager.makeCommentColor(e,t):null}focusCommentButton(){setTimeout(()=>{this.#p?.focus()},0)}getData(){let{richText:e,color:t,opacity:n,creationDate:i,modificationDate:s}=this.#w.commentData;return{contentsObj:{str:this.comment},richText:e,color:t,opacity:n,creationDate:i,modificationDate:s}}get elementBeforePopup(){return this.#p}get comment(){return this.#A||=this.#w.commentText,this.#A}set comment(e){e!==this.comment&&(this.#w.commentText=this.#A=e)}focus(){this.#w.container?.focus()}get parentBoundingClientRect(){return this.#w.layer.getBoundingClientRect()}setCommentButtonStates({selected:e,hasPopup:t}){this.#p&&(this.#p.classList.toggle("selected",e),this.#p.ariaExpanded=t)}setSelectedCommentButton(e){this.#p.classList.toggle("selected",e)}get commentPopupPosition(){if(this.#v)return this.#v;let{x:e,y:t,height:n}=this.#p.getBoundingClientRect(),{x:i,y:s,width:a,height:o}=this.#w.layer.getBoundingClientRect();return[(e-i)/a,(t+n-s)/o]}set commentPopupPosition(e){this.#v=e}hasDefaultPopupPosition(){return this.#v===null}get commentButtonPosition(){return this.#b}get commentButtonWidth(){return this.#p.getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(e){let[t,n]=this.#v||this.commentButtonPosition.map(l=>l/100),i=this.parentBoundingClientRect,{x:s,y:a,width:o,height:u}=i;this.#e.showDialog(null,this,s+t*o,a+n*u,{...e,parentDimensions:i})}render(){if(this.#m)return;let e=this.#m=document.createElement("div");if(e.className="popup",this.#s){let n=e.style.outlineColor=Q.makeHexColor(...this.#s);e.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`}let t=document.createElement("span");if(t.className="header",this.#E?.str){let n=document.createElement("span");n.className="title",t.append(n),{dir:n.dir,str:n.textContent}=this.#E}if(e.append(t),this.#l){let n=document.createElement("time");n.className="popupDate",n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#l.valueOf()})),n.dateTime=this.#l.toISOString(),t.append(n)}ME({html:this.#O||this.#o.str,dir:this.#o?.dir,className:"popupContent"},e),this.#i.append(e)}get#O(){let e=this.#T,t=this.#o;return e?.str&&(!t?.str||t.str===e.str)&&this.#T.html||null}get#N(){return this.#O?.attributes?.style?.fontSize||0}get#F(){return this.#O?.attributes?.style?.color||null}#M(e){let t=[],n={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},i={style:{color:this.#F,fontSize:this.#N?`calc(${this.#N}px * var(--total-scale-factor))`:""}};for(let s of e.split(`
137
+ `))t.push({name:"span",value:s,attributes:i});return n}#W(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&this.#f)&&this.#S()}updateEdited({rect:e,popup:t,deleted:n}){if(this.#e){n?(this.remove(),this.#A=null):t&&(t.deleted?this.remove():(this.#D(),this.#A=t.text)),e&&(this.#b=null,this.#k(),this.#I());return}if(n||t?.deleted){this.remove();return}this.#R(),this.#x||={contentsObj:this.#o,richText:this.#T},e&&(this.#c=null),t&&t.text&&(this.#T=this.#M(t.text),this.#l=Ja.toDateObject(t.date),this.#o=null),this.#m?.remove(),this.#m=null}resetEdited(){this.#x&&({contentsObj:this.#o,richText:this.#T}=this.#x,this.#x=null,this.#m?.remove(),this.#m=null,this.#c=null)}remove(){if(this.#g?.abort(),this.#g=null,this.#m?.remove(),this.#m=null,this.#C=!1,this.#f=!1,this.#p?.remove(),this.#p=null,this.trigger)for(let e of this.trigger)e.classList.remove("popupTriggerArea")}#_(){if(this.#c!==null)return;let{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:n,pageX:i,pageY:s}}}=this.#d,a=!!this.#h,o=a?this.#h:this.#y;for(let p of this.#u)if(!o||Q.intersect(p.data.rect,o)!==null){o=p.data.rect,a=!0;break}let u=Q.normalizeRect([o[0],e[3]-o[1]+e[1],o[2],e[3]-o[3]+e[1]]),c=a?o[2]-o[0]+5:0,h=u[0]+c,d=u[1];this.#c=[100*(h-i)/t,100*(d-s)/n];let{style:f}=this.#i;f.left=`${this.#c[0]}%`,f.top=`${this.#c[1]}%`}#S(){if(this.#e){this.#e.toggleCommentPopup(this,!1);return}this.#f=!this.#f,this.#f?(this.#L(),this.#i.addEventListener("click",this.#a),this.#i.addEventListener("keydown",this.#t)):(this.#$(),this.#i.removeEventListener("click",this.#a),this.#i.removeEventListener("keydown",this.#t))}#L(){this.#m||this.render(),this.isVisible?this.#f&&this.#i.classList.add("focused"):(this.#_(),this.#i.hidden=!1,this.#i.style.zIndex=parseInt(this.#i.style.zIndex)+1e3)}#$(){this.#i.classList.remove("focused"),!(this.#f||!this.isVisible)&&(this.#i.hidden=!0,this.#i.style.zIndex=parseInt(this.#i.style.zIndex)-1e3)}forceHide(){this.#C=this.isVisible,this.#C&&(this.#i.hidden=!0)}maybeShow(){this.#e||(this.#R(),this.#C&&(this.#m||this.#L(),this.#C=!1,this.#i.hidden=!1))}get isVisible(){return this.#e?!1:this.#i.hidden===!1}},dc=class extends We{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=ce.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let e=this.contentElement=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(let t of this.textContent){let n=document.createElement("span");n.textContent=t,e.append(n)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},wg=class extends We{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");let{data:e,width:t,height:n}=this,i=this.svgFactory.create(t,n,!0),s=this.#e=this.svgFactory.createElement("svg:line");return s.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),s.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),s.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),s.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),s.setAttribute("stroke-width",e.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),i.append(s),this.container.append(i),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}},xg=class extends We{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");let{data:e,width:t,height:n}=this,i=this.svgFactory.create(t,n,!0),s=e.borderStyle.width,a=this.#e=this.svgFactory.createElement("svg:rect");return a.setAttribute("x",s/2),a.setAttribute("y",s/2),a.setAttribute("width",t-s),a.setAttribute("height",n-s),a.setAttribute("stroke-width",s||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),i.append(a),this.container.append(i),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}},Sg=class extends We{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");let{data:e,width:t,height:n}=this,i=this.svgFactory.create(t,n,!0),s=e.borderStyle.width,a=this.#e=this.svgFactory.createElement("svg:ellipse");return a.setAttribute("cx",t/2),a.setAttribute("cy",n/2),a.setAttribute("rx",t/2-s/2),a.setAttribute("ry",n/2-s/2),a.setAttribute("stroke-width",s||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),i.append(a),this.container.append(i),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}},fc=class extends We{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,vertices:t,borderStyle:n,popupRef:i},width:s,height:a}=this;if(!t)return this.container;let o=this.svgFactory.create(s,a,!0),u=[];for(let c=0,h=t.length;c<h;c+=2){let d=t[c]-e[0],f=e[3]-t[c+1];u.push(`${d},${f}`)}u=u.join(" ");let l=this.#e=this.svgFactory.createElement(this.svgElementName);return l.setAttribute("points",u),l.setAttribute("stroke-width",n.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),o.append(l),this.container.append(o),!i&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}},Eg=class extends fc{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}},Ag=class extends We{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}},ao=class extends We{#e=null;#t=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?ce.HIGHLIGHT:ce.INK}#n(e,t){switch(e){case 90:return{transform:`rotate(90) translate(${-t[0]},${t[1]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};case 180:return{transform:`rotate(180) translate(${-t[2]},${t[1]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]};case 270:return{transform:`rotate(270) translate(${-t[2]},${t[3]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};default:return{transform:`translate(${-t[0]},${t[3]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]}}}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,rotation:t,inkLists:n,borderStyle:i,popupRef:s}}=this,{transform:a,width:o,height:u}=this.#n(t,e),l=this.svgFactory.create(o,u,!0),c=this.#e=this.svgFactory.createElement("svg:g");l.append(c),c.setAttribute("stroke-width",i.width||1),c.setAttribute("stroke-linecap","round"),c.setAttribute("stroke-linejoin","round"),c.setAttribute("stroke-miterlimit",10),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),c.setAttribute("transform",a);for(let h=0,d=n.length;h<d;h++){let f=this.svgFactory.createElement(this.svgElementName);this.#t.push(f),f.setAttribute("points",n[h].join(",")),c.append(f)}return!s&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(l),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);let{thickness:t,points:n,rect:i}=e,s=this.#e;if(t>=0&&s.setAttribute("stroke-width",t||1),n)for(let a=0,o=this.#t.length;a<o;a++)this.#t[a].setAttribute("points",n[a].join(","));if(i){let{transform:a,width:o,height:u}=this.#n(this.data.rotation,i);s.parentElement.setAttribute("viewBox",`0 0 ${o} ${u}`),s.setAttribute("transform",a)}}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},pc=class extends We{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=ce.HIGHLIGHT}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),e){let n=document.createElement("mark");n.classList.add("overlaidText"),n.textContent=e,this.container.append(n)}return this.container}},Tg=class extends We{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("underlineAnnotation"),e){let n=document.createElement("u");n.classList.add("overlaidText"),n.textContent=e,this.container.append(n)}return this.container}},_g=class extends We{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("squigglyAnnotation"),e){let n=document.createElement("u");n.classList.add("overlaidText"),n.textContent=e,this.container.append(n)}return this.container}},Cg=class extends We{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("strikeoutAnnotation"),e){let n=document.createElement("s");n.classList.add("overlaidText"),n.textContent=e,this.container.append(n)}return this.container}},gc=class extends We{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=ce.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},kg=class extends We{#e=null;constructor(e){super(e,{isRenderable:!0});let{file:t}=this.data;this.filename=t.filename,this.content=t.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...t})}render(){this.container.classList.add("fileAttachmentAnnotation");let{container:e,data:t}=this,n;t.hasAppearance||t.fillAlpha===0?n=document.createElement("div"):(n=document.createElement("img"),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?"paperclip":"pushpin"}.svg`,t.fillAlpha&&t.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(t.fillAlpha*100)}%);`)),n.addEventListener("dblclick",this.#t.bind(this)),this.#e=n;let{isMac:i}=Je.platform;return e.addEventListener("keydown",s=>{s.key==="Enter"&&(i?s.metaKey:s.ctrlKey)&&this.#t()}),!t.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):n.classList.add("popupTriggerArea"),e.append(n),e}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}#t(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}},Ig=class r{#e=null;#t=null;#n=null;#r=new Map;#a=null;#s=null;#i=[];#o=!1;constructor({div:e,accessibilityManager:t,annotationCanvasMap:n,annotationEditorUIManager:i,page:s,viewport:a,structTreeLayer:o,commentManager:u,linkService:l,annotationStorage:c}){this.div=e,this.#e=t,this.#t=n,this.#a=o||null,this.#s=l||null,this.#n=c||new eo,this.page=s,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=i,this._commentManager=u||null}hasEditableAnnotations(){return this.#r.size>0}async render(e){let{annotations:t}=e,n=this.div;ti(n,this.viewport);let i=new Map,s=[],a={data:null,layer:n,linkService:this.#s,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new ms,annotationStorage:this.#n,enableComment:e.enableComment===!0,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(let o of t){if(o.noHTML)continue;let u=o.annotationType===it.POPUP;if(u){let h=i.get(o.id);if(!h)continue;if(!this._commentManager){s.push(o);continue}a.elements=h}else if(o.rect[2]===o.rect[0]||o.rect[3]===o.rect[1])continue;a.data=o;let l=Ga.create(a);if(!l.isRenderable)continue;if(!u&&(this.#i.push(l),o.popupRef)){let h=i.get(o.popupRef);h?h.push(l):i.set(o.popupRef,[l])}let c=l.render();o.hidden&&(c.style.visibility="hidden"),l._isEditable&&(this.#r.set(l.data.id,l),this._annotationEditorUIManager?.renderAnnotationElement(l))}await this.#l();for(let o of s){let u=a.elements=i.get(o.id);a.data=o;let l=Ga.create(a);if(!l.isRenderable)continue;let c=l.render();l.contentElement.id=`${hs}${o.id}`,o.hidden&&(c.style.visibility="hidden"),u.at(-1).container.after(c)}this.#u()}async#l(){if(this.#i.length===0)return;this.div.replaceChildren();let e=[];if(!this.#o){this.#o=!0;for(let{contentElement:n,data:{id:i}}of this.#i){let s=n.id=`${hs}${i}`;e.push(this.#a?.getAriaAttributes(s).then(a=>{if(a)for(let[o,u]of a)n.setAttribute(o,u)}))}}this.#i.sort(({data:{rect:[n,i,s,a]}},{data:{rect:[o,u,l,c]}})=>{if(n===s&&i===a)return 1;if(o===l&&u===c)return-1;let h=a,d=i,f=(i+a)/2,p=c,g=u,b=(u+c)/2;if(f>=p&&b<=d)return-1;if(b>=h&&f<=g)return 1;let m=(n+s)/2,y=(o+l)/2;return m-y});let t=document.createDocumentFragment();for(let n of this.#i)t.append(n.container),this._commentManager?(n.extraPopupElement?.popup||n.popup)?.renderCommentButton():n.extraPopupElement&&t.append(n.extraPopupElement.render());if(this.div.append(t),await Promise.all(e),this.#e)for(let n of this.#i)this.#e.addPointerInTextLayer(n.contentElement,!1)}async addLinkAnnotations(e){let t={data:null,layer:this.div,linkService:this.#s,svgFactory:new ms,parent:this};for(let n of e){n.borderStyle||=r._defaultBorderStyle,t.data=n;let i=Ga.create(t);i.isRenderable&&(i.render(),i.contentElement.id=`${hs}${n.id}`,this.#i.push(i))}await this.#l()}update({viewport:e}){let t=this.div;this.viewport=e,ti(t,{rotation:e.rotation}),this.#u(),t.hidden=!1}#u(){if(!this.#t)return;let e=this.div;for(let[t,n]of this.#t){let i=e.querySelector(`[data-annotation-id="${t}"]`);if(!i)continue;n.className="annotationContent";let{firstChild:s}=i;s?s.nodeName==="CANVAS"?s.replaceWith(n):s.classList.contains("annotationContent")?s.after(n):s.before(n):i.append(n);let a=this.#r.get(t);a&&(a._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(t,i.id,n),a._hasNoCanvas=!1):a.canvas=n)}this.#t.clear()}getEditableAnnotations(){return Array.from(this.#r.values())}getEditableAnnotation(e){return this.#r.get(e)}addFakeAnnotation(e){let{div:t}=this,{id:n,rotation:i}=e,s=new dg({data:{id:n,rect:e.getPDFRect(),rotation:i},editor:e,layer:t,parent:this,enableComment:!!this._commentManager,linkService:this.#s,annotationStorage:this.#n});return s.render(),s.contentElement.id=`${hs}${n}`,s.createOrUpdatePopup(),this.#i.push(s),s}removeAnnotation(e){let t=this.#i.findIndex(i=>i.data.id===e);if(t<0)return;let[n]=this.#i.splice(t,1);this.#e?.removePointerInTextLayer(n.contentElement)}updateFakeAnnotations(e){if(e.length!==0){for(let t of e)t.updateFakeAnnotationElement(this);this.#l()}}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}static get _defaultBorderStyle(){return le(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:ls.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},Dl=/\r\n?|\n/g,Rg=class r extends De{#e="";#t=`${this.id}-editor`;#n=null;#r;_colorPicker=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let e=r.prototype,t=s=>s.isEmpty(),n=ni.TRANSLATE_SMALL,i=ni.TRANSLATE_BIG;return le(this,"_keyboardManager",new ri([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-n,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-i,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[n,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[i,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:t}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,n],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,i],checker:t}]]))}static _type="freetext";static _editorType=ce.FREETEXT;constructor(e){super({...e,name:"freeTextEditor"}),this.color=e.color||r._defaultColor||De._defaultLineColor,this.#r=e.fontSize||r._defaultFontSize,this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert"),this.canAddComment=!1}static initialize(e,t){De.initialize(e,t);let n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,t){switch(e){case we.FREETEXT_SIZE:r._defaultFontSize=t;break;case we.FREETEXT_COLOR:r._defaultColor=t;break}}updateParams(e,t){switch(e){case we.FREETEXT_SIZE:this.#a(t);break;case we.FREETEXT_COLOR:this.#s(t);break}}static get defaultPropertiesToUpdate(){return[[we.FREETEXT_SIZE,r._defaultFontSize],[we.FREETEXT_COLOR,r._defaultColor||De._defaultLineColor]]}get propertiesToUpdate(){return[[we.FREETEXT_SIZE,this.#r],[we.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||=new lc(this),[["colorPicker",this._colorPicker]]}get colorType(){return we.FREETEXT_COLOR}#a(e){let t=i=>{this.editorDiv.style.fontSize=`calc(${i}px * var(--total-scale-factor))`,this.translate(0,-(i-this.#r)*this.parentScale),this.#r=i,this.#o()},n=this.#r;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:we.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}#s(e){let t=i=>{this.color=i,this.onUpdatedColor()},n=this.color;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:we.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,t){this._uiManager.translateSelectedEditors(e,t,!0)}getInitialTranslation(){let e=this.parentScale;return[-r._internalPadding*e,-(r._internalPadding+this.#r)*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.#n=new AbortController;let e=this._uiManager.combinedSignal(this.#n);return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e}),!0}disableEditMode(){return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#t),this._isDraggable=!0,this.#n?.abort(),this.#n=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}#i(){let e=[];this.editorDiv.normalize();let t=null;for(let n of this.editorDiv.childNodes)t?.nodeType===Node.TEXT_NODE&&n.nodeName==="BR"||(e.push(r.#l(n)),t=n);return e.join(`
138
+ `)}#o(){let[e,t]=this.parentDimensions,n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{let{currentLayer:i,div:s}=this,a=s.style.display,o=s.classList.contains("hidden");s.classList.remove("hidden"),s.style.display="hidden",i.div.append(this.div),n=s.getBoundingClientRect(),s.remove(),s.style.display=a,s.classList.toggle("hidden",o)}this.rotation%180===this.parentRotation%180?(this.width=n.width/e,this.height=n.height/t):(this.width=n.height/e,this.height=n.width/t),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let e=this.#e,t=this.#e=this.#i().trimEnd();if(e===t)return;let n=i=>{if(this.#e=i,!i){this.remove();return}this.#u(),this._uiManager.rebuild(this),this.#o()};this.addCommands({cmd:()=>{n(t)},undo:()=>{n(e)},mustExec:!1}),this.#o()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){r._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,t;(this._isCopy||this.annotationElementId)&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#t),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:n}=this.editorDiv;if(n.fontSize=`calc(${this.#r}px * var(--total-scale-factor))`,n.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){let[i,s]=this.parentDimensions;if(this.annotationElementId){let{position:a}=this._initialData,[o,u]=this.getInitialTranslation();[o,u]=this.pageTranslationToScreen(o,u);let[l,c]=this.pageDimensions,[h,d]=this.pageTranslation,f,p;switch(this.rotation){case 0:f=e+(a[0]-h)/l,p=t+this.height-(a[1]-d)/c;break;case 90:f=e+(a[0]-h)/l,p=t-(a[1]-d)/c,[o,u]=[u,-o];break;case 180:f=e-this.width+(a[0]-h)/l,p=t-(a[1]-d)/c,[o,u]=[-o,-u];break;case 270:f=e+(a[0]-h-this.height*c)/l,p=t+(a[1]-d-this.width*l)/c,[o,u]=[-u,o];break}this.setAt(f*i,p*s,o,u)}else this._moveAfterPaste(e,t);this.#u(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#l(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Dl,"")}editorDivPaste(e){let t=e.clipboardData||window.clipboardData,{types:n}=t;if(n.length===1&&n[0]==="text/plain")return;e.preventDefault();let i=r.#h(t.getData("text")||"").replaceAll(Dl,`
139
+ `);if(!i)return;let s=window.getSelection();if(!s.rangeCount)return;this.editorDiv.normalize(),s.deleteFromDocument();let a=s.getRangeAt(0);if(!i.includes(`
140
+ `)){a.insertNode(document.createTextNode(i)),this.editorDiv.normalize(),s.collapseToStart();return}let{startContainer:o,startOffset:u}=a,l=[],c=[];if(o.nodeType===Node.TEXT_NODE){let f=o.parentElement;if(c.push(o.nodeValue.slice(u).replaceAll(Dl,"")),f!==this.editorDiv){let p=l;for(let g of this.editorDiv.childNodes){if(g===f){p=c;continue}p.push(r.#l(g))}}l.push(o.nodeValue.slice(0,u).replaceAll(Dl,""))}else if(o===this.editorDiv){let f=l,p=0;for(let g of this.editorDiv.childNodes)p++===u&&(f=c),f.push(r.#l(g))}this.#e=`${l.join(`
141
+ `)}${i}${c.join(`
142
+ `)}`,this.#u();let h=new Range,d=Math.sumPrecise(l.map(f=>f.length));for(let{firstChild:f}of this.editorDiv.childNodes)if(f.nodeType===Node.TEXT_NODE){let p=f.nodeValue.length;if(d<=p){h.setStart(f,d),h.setEnd(f,d);break}d-=p}s.removeAllRanges(),s.addRange(h)}#u(){if(this.editorDiv.replaceChildren(),!!this.#e)for(let e of this.#e.split(`
143
+ `)){let t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(t)}}#d(){return this.#e.replaceAll("\xA0"," ")}static#h(e){return e.replaceAll(" ","\xA0")}get contentDiv(){return this.editorDiv}getPDFRect(){let e=r._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,t,n){let i=null;if(e instanceof dc){let{data:{defaultAppearanceData:{fontSize:a,fontColor:o},rect:u,rotation:l,id:c,popupRef:h,richText:d,contentsObj:f,creationDate:p,modificationDate:g},textContent:b,textPosition:m,parent:{page:{pageNumber:y}}}=e;if(!b||b.length===0)return null;i=e={annotationType:ce.FREETEXT,color:Array.from(o),fontSize:a,value:b.join(`
144
+ `),position:m,pageIndex:y-1,rect:u.slice(0),rotation:l,annotationElementId:c,id:c,deleted:!1,popupRef:h,comment:f?.str||null,richText:d,creationDate:p,modificationDate:g}}let s=await super.deserialize(e,t,n);return s.#r=e.fontSize,s.color=Q.makeHexColor(...e.color),s.#e=r.#h(e.value),s._initialData=i,e.comment&&s.setCommentData(e),s}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let t=De._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),n=Object.assign(super.serialize(e),{color:t,fontSize:this.#r,value:this.#d()});return this.addComment(n),e?(n.isCopy=!0,n):this.annotationElementId&&!this.#f(n)?null:(n.id=this.annotationElementId,n)}#f(e){let{value:t,fontSize:n,color:i,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==t||e.fontSize!==n||e.color.some((a,o)=>a!==i[o])||e.pageIndex!==s}renderAnnotationElement(e){let t=super.renderAnnotationElement(e);if(!t)return null;let{style:n}=t;n.fontSize=`calc(${this.#r}px * var(--total-scale-factor))`,n.color=this.color,t.replaceChildren();for(let i of this.#e.split(`
145
+ `)){let s=document.createElement("div");s.append(i?document.createTextNode(i):document.createElement("br")),t.append(s)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#e}}),t}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}},Z=class{static PRECISION=1e-4;toSVGPath(){Oe("Abstract method `toSVGPath` must be implemented.")}get box(){Oe("Abstract getter `box` must be implemented.")}serialize(e,t){Oe("Abstract method `serialize` must be implemented.")}static _rescale(e,t,n,i,s,a){a||=new Float32Array(e.length);for(let o=0,u=e.length;o<u;o+=2)a[o]=t+e[o]*i,a[o+1]=n+e[o+1]*s;return a}static _rescaleAndSwap(e,t,n,i,s,a){a||=new Float32Array(e.length);for(let o=0,u=e.length;o<u;o+=2)a[o]=t+e[o+1]*i,a[o+1]=n+e[o]*s;return a}static _translate(e,t,n,i){i||=new Float32Array(e.length);for(let s=0,a=e.length;s<a;s+=2)i[s]=t+e[s],i[s+1]=n+e[s+1];return i}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,n,i,s){switch(s){case 90:return[1-t/n,e/i];case 180:return[1-e/n,1-t/i];case 270:return[t/n,1-e/i];default:return[e/n,t/i]}}static _normalizePagePoint(e,t,n){switch(n){case 90:return[1-t,e];case 180:return[1-e,1-t];case 270:return[t,1-e];default:return[e,t]}}static createBezierPoints(e,t,n,i,s,a){return[(e+5*n)/6,(t+5*i)/6,(5*n+s)/6,(5*i+a)/6,(n+s)/2,(i+a)/2]}},mc=class r{#e;#t=[];#n;#r;#a=[];#s=new Float32Array(18);#i;#o;#l;#u;#d;#h;#f=[];static#m=8;static#g=2;static#c=r.#m+r.#g;constructor({x:e,y:t},n,i,s,a,o=0){this.#e=n,this.#h=s*i,this.#r=a,this.#s.set([NaN,NaN,NaN,NaN,e,t],6),this.#n=o,this.#u=r.#m*i,this.#l=r.#c*i,this.#d=i,this.#f.push(e,t)}isEmpty(){return isNaN(this.#s[8])}#p(){let e=this.#s.subarray(4,6),t=this.#s.subarray(16,18),[n,i,s,a]=this.#e;return[(this.#i+(e[0]-t[0])/2-n)/s,(this.#o+(e[1]-t[1])/2-i)/a,(this.#i+(t[0]-e[0])/2-n)/s,(this.#o+(t[1]-e[1])/2-i)/a]}add({x:e,y:t}){this.#i=e,this.#o=t;let[n,i,s,a]=this.#e,[o,u,l,c]=this.#s.subarray(8,12),h=e-l,d=t-c,f=Math.hypot(h,d);if(f<this.#l)return!1;let p=f-this.#u,g=p/f,b=g*h,m=g*d,y=o,v=u;o=l,u=c,l+=b,c+=m,this.#f?.push(e,t);let x=-m/p,w=b/p,S=x*this.#h,E=w*this.#h;return this.#s.set(this.#s.subarray(2,8),0),this.#s.set([l+S,c+E],4),this.#s.set(this.#s.subarray(14,18),12),this.#s.set([l-S,c-E],16),isNaN(this.#s[6])?(this.#a.length===0&&(this.#s.set([o+S,u+E],2),this.#a.push(NaN,NaN,NaN,NaN,(o+S-n)/s,(u+E-i)/a),this.#s.set([o-S,u-E],14),this.#t.push(NaN,NaN,NaN,NaN,(o-S-n)/s,(u-E-i)/a)),this.#s.set([y,v,o,u,l,c],6),!this.isEmpty()):(this.#s.set([y,v,o,u,l,c],6),Math.abs(Math.atan2(v-u,y-o)-Math.atan2(m,b))<Math.PI/2?([o,u,l,c]=this.#s.subarray(2,6),this.#a.push(NaN,NaN,NaN,NaN,((o+l)/2-n)/s,((u+c)/2-i)/a),[o,u,y,v]=this.#s.subarray(14,18),this.#t.push(NaN,NaN,NaN,NaN,((y+o)/2-n)/s,((v+u)/2-i)/a),!0):([y,v,o,u,l,c]=this.#s.subarray(0,6),this.#a.push(((y+5*o)/6-n)/s,((v+5*u)/6-i)/a,((5*o+l)/6-n)/s,((5*u+c)/6-i)/a,((o+l)/2-n)/s,((u+c)/2-i)/a),[l,c,o,u,y,v]=this.#s.subarray(12,18),this.#t.push(((y+5*o)/6-n)/s,((v+5*u)/6-i)/a,((5*o+l)/6-n)/s,((5*u+c)/6-i)/a,((o+l)/2-n)/s,((u+c)/2-i)/a),!0))}toSVGPath(){if(this.isEmpty())return"";let e=this.#a,t=this.#t;if(isNaN(this.#s[6])&&!this.isEmpty())return this.#b();let n=[];n.push(`M${e[4]} ${e[5]}`);for(let i=6;i<e.length;i+=6)isNaN(e[i])?n.push(`L${e[i+4]} ${e[i+5]}`):n.push(`C${e[i]} ${e[i+1]} ${e[i+2]} ${e[i+3]} ${e[i+4]} ${e[i+5]}`);this.#y(n);for(let i=t.length-6;i>=6;i-=6)isNaN(t[i])?n.push(`L${t[i+4]} ${t[i+5]}`):n.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);return this.#v(n),n.join(" ")}#b(){let[e,t,n,i]=this.#e,[s,a,o,u]=this.#p();return`M${(this.#s[2]-e)/n} ${(this.#s[3]-t)/i} L${(this.#s[4]-e)/n} ${(this.#s[5]-t)/i} L${s} ${a} L${o} ${u} L${(this.#s[16]-e)/n} ${(this.#s[17]-t)/i} L${(this.#s[14]-e)/n} ${(this.#s[15]-t)/i} Z`}#v(e){let t=this.#t;e.push(`L${t[4]} ${t[5]} Z`)}#y(e){let[t,n,i,s]=this.#e,a=this.#s.subarray(4,6),o=this.#s.subarray(16,18),[u,l,c,h]=this.#p();e.push(`L${(a[0]-t)/i} ${(a[1]-n)/s} L${u} ${l} L${c} ${h} L${(o[0]-t)/i} ${(o[1]-n)/s}`)}newFreeDrawOutline(e,t,n,i,s,a){return new bc(e,t,n,i,s,a)}getOutlines(){let e=this.#a,t=this.#t,n=this.#s,[i,s,a,o]=this.#e,u=new Float32Array((this.#f?.length??0)+2);for(let h=0,d=u.length-2;h<d;h+=2)u[h]=(this.#f[h]-i)/a,u[h+1]=(this.#f[h+1]-s)/o;if(u[u.length-2]=(this.#i-i)/a,u[u.length-1]=(this.#o-s)/o,isNaN(n[6])&&!this.isEmpty())return this.#T(u);let l=new Float32Array(this.#a.length+24+this.#t.length),c=e.length;for(let h=0;h<c;h+=2){if(isNaN(e[h])){l[h]=l[h+1]=NaN;continue}l[h]=e[h],l[h+1]=e[h+1]}c=this.#x(l,c);for(let h=t.length-6;h>=6;h-=6)for(let d=0;d<6;d+=2){if(isNaN(t[h+d])){l[c]=l[c+1]=NaN,c+=2;continue}l[c]=t[h+d],l[c+1]=t[h+d+1],c+=2}return this.#E(l,c),this.newFreeDrawOutline(l,u,this.#e,this.#d,this.#n,this.#r)}#T(e){let t=this.#s,[n,i,s,a]=this.#e,[o,u,l,c]=this.#p(),h=new Float32Array(36);return h.set([NaN,NaN,NaN,NaN,(t[2]-n)/s,(t[3]-i)/a,NaN,NaN,NaN,NaN,(t[4]-n)/s,(t[5]-i)/a,NaN,NaN,NaN,NaN,o,u,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,(t[16]-n)/s,(t[17]-i)/a,NaN,NaN,NaN,NaN,(t[14]-n)/s,(t[15]-i)/a],0),this.newFreeDrawOutline(h,e,this.#e,this.#d,this.#n,this.#r)}#E(e,t){let n=this.#t;return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],t),t+=6}#x(e,t){let n=this.#s.subarray(4,6),i=this.#s.subarray(16,18),[s,a,o,u]=this.#e,[l,c,h,d]=this.#p();return e.set([NaN,NaN,NaN,NaN,(n[0]-s)/o,(n[1]-a)/u,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,(i[0]-s)/o,(i[1]-a)/u],t),t+=24}},bc=class extends Z{#e;#t=new Float32Array(4);#n;#r;#a;#s;#i;constructor(e,t,n,i,s,a){super(),this.#i=e,this.#a=t,this.#e=n,this.#s=i,this.#n=s,this.#r=a,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#o(a);let[o,u,l,c]=this.#t;for(let h=0,d=e.length;h<d;h+=2)e[h]=(e[h]-o)/l,e[h+1]=(e[h+1]-u)/c;for(let h=0,d=t.length;h<d;h+=2)t[h]=(t[h]-o)/l,t[h+1]=(t[h+1]-u)/c}toSVGPath(){let e=[`M${this.#i[4]} ${this.#i[5]}`];for(let t=6,n=this.#i.length;t<n;t+=6){if(isNaN(this.#i[t])){e.push(`L${this.#i[t+4]} ${this.#i[t+5]}`);continue}e.push(`C${this.#i[t]} ${this.#i[t+1]} ${this.#i[t+2]} ${this.#i[t+3]} ${this.#i[t+4]} ${this.#i[t+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,t,n,i],s){let a=n-e,o=i-t,u,l;switch(s){case 0:u=Z._rescale(this.#i,e,i,a,-o),l=Z._rescale(this.#a,e,i,a,-o);break;case 90:u=Z._rescaleAndSwap(this.#i,e,t,a,o),l=Z._rescaleAndSwap(this.#a,e,t,a,o);break;case 180:u=Z._rescale(this.#i,n,t,-a,o),l=Z._rescale(this.#a,n,t,-a,o);break;case 270:u=Z._rescaleAndSwap(this.#i,n,i,-a,-o),l=Z._rescaleAndSwap(this.#a,n,i,-a,-o);break}return{outline:Array.from(u),points:[Array.from(l)]}}#o(e){let t=this.#i,n=t[4],i=t[5],s=[n,i,n,i],a=n,o=i,u=n,l=i,c=e?Math.max:Math.min,h=new Float32Array(4);for(let f=6,p=t.length;f<p;f+=6){let g=t[f+4],b=t[f+5];isNaN(t[f])?(Q.pointBoundingBox(g,b,s),o>b?(a=g,o=b):o===b&&(a=c(a,g)),l<b?(u=g,l=b):l===b&&(u=c(u,g))):(h[0]=h[1]=1/0,h[2]=h[3]=-1/0,Q.bezierBoundingBox(n,i,...t.slice(f,f+6),h),Q.rectBoundingBox(h[0],h[1],h[2],h[3],s),o>h[1]?(a=h[0],o=h[1]):o===h[1]&&(a=c(a,h[0])),l<h[3]?(u=h[2],l=h[3]):l===h[3]&&(u=c(u,h[2]))),n=g,i=b}let d=this.#t;d[0]=s[0]-this.#n,d[1]=s[1]-this.#n,d[2]=s[2]-s[0]+2*this.#n,d[3]=s[3]-s[1]+2*this.#n,this.firstPoint=[a,o],this.lastPoint=[u,l]}get box(){return this.#t}newOutliner(e,t,n,i,s,a=0){return new mc(e,t,n,i,s,a)}getNewOutline(e,t){let[n,i,s,a]=this.#t,[o,u,l,c]=this.#e,h=s*l,d=a*c,f=n*l+o,p=i*c+u,g=this.newOutliner({x:this.#a[0]*h+f,y:this.#a[1]*d+p},this.#e,this.#s,e,this.#r,t??this.#n);for(let b=2;b<this.#a.length;b+=2)g.add({x:this.#a[b]*h+f,y:this.#a[b+1]*d+p});return g.getOutlines()}},oo=class{#e;#t;#n;#r=[];#a=[];constructor(e,t=0,n=0,i=!0){let s=[1/0,1/0,-1/0,-1/0],o=10**-4;for(let{x:b,y:m,width:y,height:v}of e){let x=Math.floor((b-t)/o)*o,w=Math.ceil((b+y+t)/o)*o,S=Math.floor((m-t)/o)*o,E=Math.ceil((m+v+t)/o)*o,_=[x,S,E,!0],T=[w,S,E,!1];this.#r.push(_,T),Q.rectBoundingBox(x,S,w,E,s)}let u=s[2]-s[0]+2*n,l=s[3]-s[1]+2*n,c=s[0]-n,h=s[1]-n,d=i?-1/0:1/0,f=1/0,p=this.#r.at(i?-1:-2),g=[p[0],p[2]];for(let b of this.#r){let[m,y,v,x]=b;!x&&i?y<f?(f=y,d=m):y===f&&(d=Math.max(d,m)):x&&!i&&(y<f?(f=y,d=m):y===f&&(d=Math.min(d,m))),b[0]=(m-c)/u,b[1]=(y-h)/l,b[2]=(v-h)/l}this.#e=new Float32Array([c,h,u,l]),this.#t=[d,f],this.#n=g}getOutlines(){this.#r.sort((t,n)=>t[0]-n[0]||t[1]-n[1]||t[2]-n[2]);let e=[];for(let t of this.#r)t[3]?(e.push(...this.#u(t)),this.#o(t)):(this.#l(t),e.push(...this.#u(t)));return this.#s(e)}#s(e){let t=[],n=new Set;for(let a of e){let[o,u,l]=a;t.push([o,u,a],[o,l,a])}t.sort((a,o)=>a[1]-o[1]||a[0]-o[0]);for(let a=0,o=t.length;a<o;a+=2){let u=t[a][2],l=t[a+1][2];u.push(l),l.push(u),n.add(u),n.add(l)}let i=[],s;for(;n.size>0;){let a=n.values().next().value,[o,u,l,c,h]=a;n.delete(a);let d=o,f=u;for(s=[o,l],i.push(s);;){let p;if(n.has(c))p=c;else if(n.has(h))p=h;else break;n.delete(p),[o,u,l,c,h]=p,d!==o&&(s.push(d,f,o,f===u?u:l),d=o),f=f===u?l:u}s.push(d,f)}return new Pg(i,this.#e,this.#t,this.#n)}#i(e){let t=this.#a,n=0,i=t.length-1;for(;n<=i;){let s=n+i>>1,a=t[s][0];if(a===e)return s;a<e?n=s+1:i=s-1}return i+1}#o([,e,t]){let n=this.#i(e);this.#a.splice(n,0,[e,t])}#l([,e,t]){let n=this.#i(e);for(let i=n;i<this.#a.length;i++){let[s,a]=this.#a[i];if(s!==e)break;if(s===e&&a===t){this.#a.splice(i,1);return}}for(let i=n-1;i>=0;i--){let[s,a]=this.#a[i];if(s!==e)break;if(s===e&&a===t){this.#a.splice(i,1);return}}}#u(e){let[t,n,i]=e,s=[[t,n,i]],a=this.#i(i);for(let o=0;o<a;o++){let[u,l]=this.#a[o];for(let c=0,h=s.length;c<h;c++){let[,d,f]=s[c];if(!(l<=d||f<=u)){if(d>=u){if(f>l)s[c][1]=l;else{if(h===1)return[];s.splice(c,1),c--,h--}continue}s[c][2]=u,f>l&&s.push([t,l,f])}}}return s}},Pg=class extends Z{#e;#t;constructor(e,t,n,i){super(),this.#t=e,this.#e=t,this.firstPoint=n,this.lastPoint=i}toSVGPath(){let e=[];for(let t of this.#t){let[n,i]=t;e.push(`M${n} ${i}`);for(let s=2;s<t.length;s+=2){let a=t[s],o=t[s+1];a===n?(e.push(`V${o}`),i=o):o===i&&(e.push(`H${a}`),n=a)}e.push("Z")}return e.join(" ")}serialize([e,t,n,i],s){let a=[],o=n-e,u=i-t;for(let l of this.#t){let c=new Array(l.length);for(let h=0;h<l.length;h+=2)c[h]=e+l[h]*o,c[h+1]=i-l[h+1]*u;a.push(c)}return a}get box(){return this.#e}get classNamesForOutlining(){return["highlightOutline"]}},uo=class extends mc{newFreeDrawOutline(e,t,n,i,s,a){return new Og(e,t,n,i,s,a)}},Og=class extends bc{newOutliner(e,t,n,i,s,a=0){return new uo(e,t,n,i,s,a)}},yc=class r extends De{#e=null;#t=0;#n;#r=null;#a=null;#s=null;#i=null;#o=0;#l=null;#u=null;#d=null;#h=!1;#f=null;#m=null;#g=null;#c="";#p;#b="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=ce.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){let e=r.prototype;return le(this,"_keyboardManager",new ri([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:"highlightEditor"}),this.color=e.color||r._defaultColor,this.#p=e.thickness||r._defaultThickness,this.opacity=e.opacity||r._defaultOpacity,this.#n=e.boxes||null,this.#b=e.methodOfCreation||"",this.#c=e.text||"",this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",e.highlightId>-1?(this.#h=!0,this.#y(e),this.#w()):this.#n&&(this.#e=e.anchorNode,this.#t=e.anchorOffset,this.#i=e.focusNode,this.#o=e.focusOffset,this.#v(),this.#w(),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}get telemetryInitialData(){return{action:"added",type:this.#h?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this.#p,methodOfCreation:this.#b}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}#v(){let e=new oo(this.#n,.001);this.#u=e.getOutlines(),[this.x,this.y,this.width,this.height]=this.#u.box;let t=new oo(this.#n,.0025,.001,this._uiManager.direction==="ltr");this.#s=t.getOutlines();let{firstPoint:n}=this.#u;this.#f=[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height];let{lastPoint:i}=this.#s;this.#m=[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]}#y({highlightOutlines:e,highlightId:t,clipPathId:n}){this.#u=e;let i=1.5;if(this.#s=e.getNewOutline(this.#p/2+i,.0025),t>=0)this.#d=t,this.#r=n,this.parent.drawLayer.finalizeDraw(t,{bbox:e.box,path:{d:e.toSVGPath()}}),this.#g=this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:this.#s.box,path:{d:this.#s.toSVGPath()}},!0);else if(this.parent){let h=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(this.#d,{bbox:r.#A(this.#u.box,(h-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#g,{bbox:r.#A(this.#s.box,h),path:{d:this.#s.toSVGPath()}})}let[s,a,o,u]=e.box;switch(this.rotation){case 0:this.x=s,this.y=a,this.width=o,this.height=u;break;case 90:{let[h,d]=this.parentDimensions;this.x=a,this.y=1-s,this.width=o*d/h,this.height=u*h/d;break}case 180:this.x=1-s,this.y=1-a,this.width=o,this.height=u;break;case 270:{let[h,d]=this.parentDimensions;this.x=1-a,this.y=s,this.width=o*d/h,this.height=u*h/d;break}}let{firstPoint:l}=e;this.#f=[(l[0]-s)/o,(l[1]-a)/u];let{lastPoint:c}=this.#s;this.#m=[(c[0]-s)/o,(c[1]-a)/u]}static initialize(e,t){De.initialize(e,t),r._defaultColor||=t.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(e,t){switch(e){case we.HIGHLIGHT_COLOR:r._defaultColor=t;break;case we.HIGHLIGHT_THICKNESS:r._defaultThickness=t;break}}translateInPage(e,t){}get toolbarPosition(){return this.#m}get commentButtonPosition(){return this.#f}updateParams(e,t){switch(e){case we.HIGHLIGHT_COLOR:this.#T(t);break;case we.HIGHLIGHT_THICKNESS:this.#E(t);break}}static get defaultPropertiesToUpdate(){return[[we.HIGHLIGHT_COLOR,r._defaultColor],[we.HIGHLIGHT_THICKNESS,r._defaultThickness]]}get propertiesToUpdate(){return[[we.HIGHLIGHT_COLOR,this.color||r._defaultColor],[we.HIGHLIGHT_THICKNESS,this.#p||r._defaultThickness],[we.HIGHLIGHT_FREE,this.#h]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(this.#d,{root:{fill:this.color,"fill-opacity":this.opacity}}),this.#a?.updateColor(this.color),super.onUpdatedColor()}#T(e){let t=(s,a)=>{this.color=s,this.opacity=a,this.onUpdatedColor()},n=this.color,i=this.opacity;this.addCommands({cmd:t.bind(this,e,r._defaultOpacity),undo:t.bind(this,n,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:we.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(e)},!0)}#E(e){let t=this.#p,n=i=>{this.#p=i,this.#x(i)};this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:we.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",this.#a=new uc({editor:this})]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#I())}getBaseTranslation(){return[0,0]}getRect(e,t){return super.getRect(e,t,this.#I())}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){this.#C(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#w(),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?this.#C():e&&(this.#w(e),t=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),this.show(this._isVisible),t&&this.select()}#x(e){this.#h&&(this.#y({highlightOutlines:this.#u.getNewOutline(e/2)}),this.fixAndSetPosition(),this.setDims())}#C(){this.#d===null||!this.parent||(this.parent.drawLayer.remove(this.#d),this.#d=null,this.parent.drawLayer.remove(this.#g),this.#g=null)}#w(e=this.parent){this.#d===null&&({id:this.#d,clipPathId:this.#r}=e.drawLayer.draw({bbox:this.#u.box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:this.#h},path:{d:this.#u.toSVGPath()}},!1,!0),this.#g=e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#h},bbox:this.#s.box,path:{d:this.#s.toSVGPath()}},this.#h),this.#l&&(this.#l.style.clipPath=this.#r))}static#A([e,t,n,i],s){switch(s){case 90:return[1-t-i,e,i,n];case 180:return[1-e-n,1-t-i,n,i];case 270:return[t,1-e-n,i,n]}return[e,t,n,i]}rotate(e){let{drawLayer:t}=this.parent,n;this.#h?(e=(e-this.rotation+360)%360,n=r.#A(this.#u.box,e)):n=r.#A([this.x,this.y,this.width,this.height],e),t.updateProperties(this.#d,{bbox:n,root:{"data-main-rotation":e}}),t.updateProperties(this.#g,{bbox:r.#A(this.#s.box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;let e=super.render();this.#c&&(e.setAttribute("aria-label",this.#c),e.setAttribute("role","mark")),this.#h?e.classList.add("free"):this.div.addEventListener("keydown",this.#R.bind(this),{signal:this._uiManager._signal});let t=this.#l=document.createElement("div");return e.append(t),t.setAttribute("aria-hidden","true"),t.className="internal",t.style.clipPath=this.#r,this.setDims(),DE(this,this.#l,["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#g,{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#g,{rootClass:{hovered:!1}})}#R(e){r._keyboardManager.exec(this,e)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#k(!0);break;case 1:case 3:this.#k(!1);break}}#k(e){if(!this.#e)return;let t=window.getSelection();e?t.setPosition(this.#e,this.#t):t.setPosition(this.#i,this.#o)}select(){super.select(),this.#g&&this.parent?.drawLayer.updateProperties(this.#g,{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),this.#g&&(this.parent?.drawLayer.updateProperties(this.#g,{rootClass:{selected:!1}}),this.#h||this.#k(!1))}get _mustFixPosition(){return!this.#h}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(this.#d,{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(this.#g,{rootClass:{hidden:!e}}))}#I(){return this.#h?this.rotation:0}#D(){if(this.#h)return null;let[e,t]=this.pageDimensions,[n,i]=this.pageTranslation,s=this.#n,a=new Float32Array(s.length*8),o=0;for(let{x:u,y:l,width:c,height:h}of s){let d=u*e+n,f=(1-l)*t+i;a[o]=a[o+4]=d,a[o+1]=a[o+3]=f,a[o+2]=a[o+6]=d+c*e,a[o+5]=a[o+7]=f-h*t,o+=8}return a}#O(e){return this.#u.serialize(e,this.#I())}static startHighlighting(e,t,{target:n,x:i,y:s}){let{x:a,y:o,width:u,height:l}=n.getBoundingClientRect(),c=new AbortController,h=e.combinedSignal(c),d=f=>{c.abort(),this.#F(e,f)};window.addEventListener("blur",d,{signal:h}),window.addEventListener("pointerup",d,{signal:h}),window.addEventListener("pointerdown",Ke,{capture:!0,passive:!1,signal:h}),window.addEventListener("contextmenu",ur,{signal:h}),n.addEventListener("pointermove",this.#N.bind(this,e),{signal:h}),this._freeHighlight=new uo({x:i,y:s},[a,o,u,l],e.scale,this._defaultThickness/2,t,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static#N(e,t){this._freeHighlight.add(t)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}static#F(e,t){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(t,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(e,t,n){let i=null;if(e instanceof pc){let{data:{quadPoints:p,rect:g,rotation:b,id:m,color:y,opacity:v,popupRef:x,richText:w,contentsObj:S,creationDate:E,modificationDate:_},parent:{page:{pageNumber:T}}}=e;i=e={annotationType:ce.HIGHLIGHT,color:Array.from(y),opacity:v,quadPoints:p,boxes:null,pageIndex:T-1,rect:g.slice(0),rotation:b,annotationElementId:m,id:m,deleted:!1,popupRef:x,richText:w,comment:S?.str||null,creationDate:E,modificationDate:_}}else if(e instanceof ao){let{data:{inkLists:p,rect:g,rotation:b,id:m,color:y,borderStyle:{rawWidth:v},popupRef:x,richText:w,contentsObj:S,creationDate:E,modificationDate:_},parent:{page:{pageNumber:T}}}=e;i=e={annotationType:ce.HIGHLIGHT,color:Array.from(y),thickness:v,inkLists:p,boxes:null,pageIndex:T-1,rect:g.slice(0),rotation:b,annotationElementId:m,id:m,deleted:!1,popupRef:x,richText:w,comment:S?.str||null,creationDate:E,modificationDate:_}}let{color:s,quadPoints:a,inkLists:o,opacity:u}=e,l=await super.deserialize(e,t,n);l.color=Q.makeHexColor(...s),l.opacity=u||1,o&&(l.#p=e.thickness),l._initialData=i,e.comment&&l.setCommentData(e);let[c,h]=l.pageDimensions,[d,f]=l.pageTranslation;if(a){let p=l.#n=[];for(let g=0;g<a.length;g+=8)p.push({x:(a[g]-d)/c,y:1-(a[g+1]-f)/h,width:(a[g+2]-a[g])/c,height:(a[g+1]-a[g+5])/h});l.#v(),l.#w(),l.rotate(l.rotation)}else if(o){l.#h=!0;let p=o[0],g={x:p[0]-d,y:h-(p[1]-f)},b=new uo(g,[0,0,c,h],1,l.#p/2,!0,.001);for(let v=0,x=p.length;v<x;v+=2)g.x=p[v]-d,g.y=h-(p[v+1]-f),b.add(g);let{id:m,clipPathId:y}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:l.color,"fill-opacity":l._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:b.toSVGPath()}},!0,!0);l.#y({highlightOutlines:b.getOutlines(),highlightId:m,clipPathId:y}),l.#w(),l.rotate(l.parentRotation)}return l}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();let t=De._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),n=super.serialize(e);return Object.assign(n,{color:t,opacity:this.opacity,thickness:this.#p,quadPoints:this.#D(),outlines:this.#O(n.rect)}),this.addComment(n),this.annotationElementId&&!this.#M(n)?null:(n.id=this.annotationElementId,n)}#M(e){let{color:t}=this._initialData;return this.hasEditedComment||e.color.some((n,i)=>n!==t[i])}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}},vc=class{#e=Object.create(null);updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(let[t,n]of Object.entries(e))t.startsWith("_")||this.updateProperty(t,n)}updateSVGProperty(e,t){this.#e[e]=t}toSVGProperties(){let e=this.#e;return this.#e=Object.create(null),{root:e}}reset(){this.#e=Object.create(null)}updateAll(e=this){this.updateProperties(e)}clone(){Oe("Not implemented")}},wc=class r extends De{#e=null;#t;_colorPicker=null;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static#n=null;static#r=null;static#a=null;static _INNER_MARGIN=3;constructor(e){super(e),this.#t=e.mustBeCommitted||!1,this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}_addOutlines(e){e.drawOutlines&&(this.#s(e),this.#l())}#s({drawOutlines:e,drawId:t,drawingOptions:n}){this.#e=e,this._drawingOptions||=n,this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),t>=0?(this._drawId=t,this.parent.drawLayer.finalizeDraw(t,e.defaultProperties)):this._drawId=this.#i(e,this.parent),this.#h(e.box)}#i(e,t){let{id:n}=t.drawLayer.draw(r._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return n}static _mergeSVGProperties(e,t){let n=new Set(Object.keys(e));for(let[i,s]of Object.entries(t))n.has(i)?Object.assign(e[i],s):e[i]=s;return e}static getDefaultDrawingOptions(e){Oe("Not implemented")}static get typesMap(){Oe("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,t){let n=this.typesMap.get(e);n&&this._defaultDrawingOptions.updateProperty(n,t),this._currentParent&&(r.#n.updateProperty(n,t),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,t){let n=this.constructor.typesMap.get(e);n&&this._updateProperty(e,n,t)}static get defaultPropertiesToUpdate(){let e=[],t=this._defaultDrawingOptions;for(let[n,i]of this.typesMap)e.push([n,t[i]]);return e}get propertiesToUpdate(){let e=[],{_drawingOptions:t}=this;for(let[n,i]of this.constructor.typesMap)e.push([n,t[i]]);return e}_updateProperty(e,t,n){let i=this._drawingOptions,s=i[t],a=o=>{i.updateProperty(t,o);let u=this.#e.updateProperty(t,o);u&&this.#h(u),this.parent?.drawLayer.updateProperties(this._drawId,i.toSVGProperties()),e===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:a.bind(this,n),undo:a.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,r._mergeSVGProperties(this.#e.getPathResizingSVGProperties(this.#d()),{bbox:this.#f()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,r._mergeSVGProperties(this.#e.getPathResizedSVGProperties(this.#d()),{bbox:this.#f()}))}_onTranslating(e,t){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#f()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,r._mergeSVGProperties(this.#e.getPathTranslatedSVGProperties(this.#d(),this.parentDimensions),{bbox:this.#f()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#t&&(this.#t=!1,this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){this.#o(),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#l(),this.#h(this.#e.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),this.#o()):e&&(this._uiManager.addShouldRescale(this),this.#l(e),t=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),t&&this.select()}#o(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}#l(e=this.parent){if(!(this._drawId!==null&&this.parent===e)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=this.#i(this.#e,e)}}#u([e,t,n,i]){let{parentDimensions:[s,a],rotation:o}=this;switch(o){case 90:return[t,1-e,n*(a/s),i*(s/a)];case 180:return[1-e,1-t,n,i];case 270:return[1-t,e,n*(a/s),i*(s/a)];default:return[e,t,n,i]}}#d(){let{x:e,y:t,width:n,height:i,parentDimensions:[s,a],rotation:o}=this;switch(o){case 90:return[1-t,e,n*(s/a),i*(a/s)];case 180:return[1-e,1-t,n,i];case 270:return[t,1-e,n*(s/a),i*(a/s)];default:return[e,t,n,i]}}#h(e){[this.x,this.y,this.width,this.height]=this.#u(e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#f(){let{x:e,y:t,width:n,height:i,rotation:s,parentRotation:a,parentDimensions:[o,u]}=this;switch((s*4+a)/90){case 1:return[1-t-i,e,i,n];case 2:return[1-e-n,1-t-i,n,i];case 3:return[t,1-e-n,i,n];case 4:return[e,t-n*(o/u),i*(u/o),n*(o/u)];case 5:return[1-t,e,n*(o/u),i*(u/o)];case 6:return[1-e-i*(u/o),1-t,i*(u/o),n*(o/u)];case 7:return[t-n*(o/u),1-e-i*(u/o),n*(o/u),i*(u/o)];case 8:return[e-n,t-i,n,i];case 9:return[1-t,e-n,i,n];case 10:return[1-e,1-t,n,i];case 11:return[t-i,1-e,i,n];case 12:return[e-i*(u/o),t,i*(u/o),n*(o/u)];case 13:return[1-t-n*(o/u),e-i*(u/o),n*(o/u),i*(u/o)];case 14:return[1-e,1-t-n*(o/u),i*(u/o),n*(o/u)];case 15:return[t,1-e,n*(o/u),i*(u/o)];default:return[e,t,n,i]}}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,r._mergeSVGProperties({bbox:this.#f()},this.#e.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&this.#h(this.#e.updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,t;this._isCopy&&(e=this.x,t=this.y);let n=super.render();n.classList.add("draw");let i=document.createElement("div");return n.append(i),i.setAttribute("aria-hidden","true"),i.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,t),n}static createDrawerInstance(e,t,n,i,s){Oe("Not implemented")}static startDrawing(e,t,n,i){let{target:s,offsetX:a,offsetY:o,pointerId:u,pointerType:l}=i;if(xt.isInitializedAndDifferentPointerType(l))return;let{viewport:{rotation:c}}=e,{width:h,height:d}=s.getBoundingClientRect(),f=r.#r=new AbortController,p=e.combinedSignal(f);if(xt.setPointer(l,u),window.addEventListener("pointerup",g=>{xt.isSamePointerIdOrRemove(g.pointerId)&&this._endDraw(g)},{signal:p}),window.addEventListener("pointercancel",g=>{xt.isSamePointerIdOrRemove(g.pointerId)&&this._currentParent.endDrawingSession()},{signal:p}),window.addEventListener("pointerdown",g=>{xt.isSamePointerType(g.pointerType)&&(xt.initializeAndAddPointerId(g.pointerId),r.#n.isCancellable()&&(r.#n.removeLastElement(),r.#n.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:p}),window.addEventListener("contextmenu",ur,{signal:p}),s.addEventListener("pointermove",this._drawMove.bind(this),{signal:p}),s.addEventListener("touchmove",g=>{xt.isSameTimeStamp(g.timeStamp)&&Ke(g)},{signal:p}),e.toggleDrawing(),t._editorUndoBar?.hide(),r.#n){e.drawLayer.updateProperties(this._currentDrawId,r.#n.startNew(a,o,h,d,c));return}t.updateUIForDefaultProperties(this),r.#n=this.createDrawerInstance(a,o,h,d,c),r.#a=this.getDefaultDrawingOptions(),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(r.#a.toSVGProperties(),r.#n.defaultSVGProperties),!0,!1)}static _drawMove(e){if(xt.isSameTimeStamp(e.timeStamp),!r.#n)return;let{offsetX:t,offsetY:n,pointerId:i}=e;if(xt.isSamePointerId(i)){if(xt.isUsingMultiplePointers()){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,r.#n.add(t,n)),xt.setTimeStamp(e.timeStamp),Ke(e)}}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,r.#n=null,r.#a=null,xt.clearTimeStamp()),r.#r&&(r.#r.abort(),r.#r=null,xt.clearPointerIds())}static _endDraw(e){let t=this._currentParent;if(t){if(t.toggleDrawing(!0),this._cleanup(!1),e?.target===t.div&&t.drawLayer.updateProperties(this._currentDrawId,r.#n.end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){let n=r.#n,i=this._currentDrawId,s=n.getLastElement();t.addCommands({cmd:()=>{t.drawLayer.updateProperties(i,n.setLastElement(s))},undo:()=>{t.drawLayer.updateProperties(i,n.removeLastElement())},mustExec:!1,type:we.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){let t=this._currentParent;if(!t)return null;if(t.toggleDrawing(!0),t.cleanUndoStack(we.DRAW_STEP),!r.#n.isEmpty()){let{pageDimensions:[n,i],scale:s}=t,a=t.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:r.#n.getOutlines(n*s,i*s,s,this._INNER_MARGIN),drawingOptions:r.#a,mustBeCommitted:!e});return this._cleanup(!0),a}return t.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,t,n,i,s,a){Oe("Not implemented")}static async deserialize(e,t,n){let{rawDims:{pageWidth:i,pageHeight:s,pageX:a,pageY:o}}=t.viewport,u=this.deserializeDraw(a,o,i,s,this._INNER_MARGIN,e),l=await super.deserialize(e,t,n);return l.createDrawingOptions(e),l.#s({drawOutlines:u}),l.#l(),l.onScaleChanging(),l.rotate(),l}serializeDraw(e){let[t,n]=this.pageTranslation,[i,s]=this.pageDimensions;return this.#e.serialize([t,n,i,s],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}},Lg=class{#e=new Float64Array(6);#t;#n;#r;#a;#s;#i="";#o=0;#l=new si;#u;#d;constructor(e,t,n,i,s,a){this.#u=n,this.#d=i,this.#r=s,this.#a=a,[e,t]=this.#h(e,t);let o=this.#t=[NaN,NaN,NaN,NaN,e,t];this.#s=[e,t],this.#n=[{line:o,points:this.#s}],this.#e.set(o,0)}updateProperty(e,t){e==="stroke-width"&&(this.#a=t)}#h(e,t){return Z._normalizePoint(e,t,this.#u,this.#d,this.#r)}isEmpty(){return!this.#n||this.#n.length===0}isCancellable(){return this.#s.length<=10}add(e,t){[e,t]=this.#h(e,t);let[n,i,s,a]=this.#e.subarray(2,6),o=e-s,u=t-a;return Math.hypot(this.#u*o,this.#d*u)<=2?null:(this.#s.push(e,t),isNaN(n)?(this.#e.set([s,a,e,t],2),this.#t.push(NaN,NaN,NaN,NaN,e,t),{path:{d:this.toSVGPath()}}):(isNaN(this.#e[0])&&this.#t.splice(6,6),this.#e.set([n,i,s,a,e,t],0),this.#t.push(...Z.createBezierPoints(n,i,s,a,e,t)),{path:{d:this.toSVGPath()}}))}end(e,t){let n=this.add(e,t);return n||(this.#s.length===2?{path:{d:this.toSVGPath()}}:null)}startNew(e,t,n,i,s){this.#u=n,this.#d=i,this.#r=s,[e,t]=this.#h(e,t);let a=this.#t=[NaN,NaN,NaN,NaN,e,t];this.#s=[e,t];let o=this.#n.at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),this.#n.push({line:a,points:this.#s}),this.#e.set(a,0),this.#o=0,this.toSVGPath(),null}getLastElement(){return this.#n.at(-1)}setLastElement(e){return this.#n?(this.#n.push(e),this.#t=e.line,this.#s=e.points,this.#o=0,{path:{d:this.toSVGPath()}}):this.#l.setLastElement(e)}removeLastElement(){if(!this.#n)return this.#l.removeLastElement();this.#n.pop(),this.#i="";for(let e=0,t=this.#n.length;e<t;e++){let{line:n,points:i}=this.#n[e];this.#t=n,this.#s=i,this.#o=0,this.toSVGPath()}return{path:{d:this.#i}}}toSVGPath(){let e=Z.svgRound(this.#t[4]),t=Z.svgRound(this.#t[5]);if(this.#s.length===2)return this.#i=`${this.#i} M ${e} ${t} Z`,this.#i;if(this.#s.length<=6){let i=this.#i.lastIndexOf("M");this.#i=`${this.#i.slice(0,i)} M ${e} ${t}`,this.#o=6}if(this.#s.length===4){let i=Z.svgRound(this.#t[10]),s=Z.svgRound(this.#t[11]);return this.#i=`${this.#i} L ${i} ${s}`,this.#o=12,this.#i}let n=[];this.#o===0&&(n.push(`M ${e} ${t}`),this.#o=6);for(let i=this.#o,s=this.#t.length;i<s;i+=6){let[a,o,u,l,c,h]=this.#t.slice(i,i+6).map(Z.svgRound);n.push(`C${a} ${o} ${u} ${l} ${c} ${h}`)}return this.#i+=n.join(" "),this.#o=this.#t.length,this.#i}getOutlines(e,t,n,i){let s=this.#n.at(-1);return s.line=new Float32Array(s.line),s.points=new Float32Array(s.points),this.#l.build(this.#n,e,t,n,this.#r,this.#a,i),this.#e=null,this.#t=null,this.#n=null,this.#i=null,this.#l}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}},si=class extends Z{#e;#t=0;#n;#r;#a;#s;#i;#o;#l;build(e,t,n,i,s,a,o){this.#a=t,this.#s=n,this.#i=i,this.#o=s,this.#l=a,this.#n=o??0,this.#r=e,this.#h()}get thickness(){return this.#l}setLastElement(e){return this.#r.push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#r.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let e=[];for(let{line:t}of this.#r){if(e.push(`M${Z.svgRound(t[4])} ${Z.svgRound(t[5])}`),t.length===6){e.push("Z");continue}if(t.length===12&&isNaN(t[6])){e.push(`L${Z.svgRound(t[10])} ${Z.svgRound(t[11])}`);continue}for(let n=6,i=t.length;n<i;n+=6){let[s,a,o,u,l,c]=t.subarray(n,n+6).map(Z.svgRound);e.push(`C${s} ${a} ${o} ${u} ${l} ${c}`)}}return e.join("")}serialize([e,t,n,i],s){let a=[],o=[],[u,l,c,h]=this.#d(),d,f,p,g,b,m,y,v,x;switch(this.#o){case 0:x=Z._rescale,d=e,f=t+i,p=n,g=-i,b=e+u*n,m=t+(1-l-h)*i,y=e+(u+c)*n,v=t+(1-l)*i;break;case 90:x=Z._rescaleAndSwap,d=e,f=t,p=n,g=i,b=e+l*n,m=t+u*i,y=e+(l+h)*n,v=t+(u+c)*i;break;case 180:x=Z._rescale,d=e+n,f=t,p=-n,g=i,b=e+(1-u-c)*n,m=t+l*i,y=e+(1-u)*n,v=t+(l+h)*i;break;case 270:x=Z._rescaleAndSwap,d=e+n,f=t+i,p=-n,g=-i,b=e+(1-l-h)*n,m=t+(1-u-c)*i,y=e+(1-l)*n,v=t+(1-u)*i;break}for(let{line:w,points:S}of this.#r)a.push(x(w,d,f,p,g,s?new Array(w.length):null)),o.push(x(S,d,f,p,g,s?new Array(S.length):null));return{lines:a,points:o,rect:[b,m,y,v]}}static deserialize(e,t,n,i,s,{paths:{lines:a,points:o},rotation:u,thickness:l}){let c=[],h,d,f,p,g;switch(u){case 0:g=Z._rescale,h=-e/n,d=t/i+1,f=1/n,p=-1/i;break;case 90:g=Z._rescaleAndSwap,h=-t/i,d=-e/n,f=1/i,p=1/n;break;case 180:g=Z._rescale,h=e/n+1,d=-t/i,f=-1/n,p=1/i;break;case 270:g=Z._rescaleAndSwap,h=t/i+1,d=e/n+1,f=-1/i,p=-1/n;break}if(!a){a=[];for(let m of o){let y=m.length;if(y===2){a.push(new Float32Array([NaN,NaN,NaN,NaN,m[0],m[1]]));continue}if(y===4){a.push(new Float32Array([NaN,NaN,NaN,NaN,m[0],m[1],NaN,NaN,NaN,NaN,m[2],m[3]]));continue}let v=new Float32Array(3*(y-2));a.push(v);let[x,w,S,E]=m.subarray(0,4);v.set([NaN,NaN,NaN,NaN,x,w],0);for(let _=4;_<y;_+=2){let T=m[_],k=m[_+1];v.set(Z.createBezierPoints(x,w,S,E,T,k),(_-2)*3),[x,w,S,E]=[S,E,T,k]}}}for(let m=0,y=a.length;m<y;m++)c.push({line:g(a[m].map(v=>v??NaN),h,d,f,p),points:g(o[m].map(v=>v??NaN),h,d,f,p)});let b=new this.prototype.constructor;return b.build(c,n,i,1,u,l,s),b}#u(e=this.#l){let t=this.#n+e/2*this.#i;return this.#o%180===0?[t/this.#a,t/this.#s]:[t/this.#s,t/this.#a]}#d(){let[e,t,n,i]=this.#e,[s,a]=this.#u(0);return[e+s,t+a,n-2*s,i-2*a]}#h(){let e=this.#e=new Float32Array([1/0,1/0,-1/0,-1/0]);for(let{line:i}of this.#r){if(i.length<=12){for(let o=4,u=i.length;o<u;o+=6)Q.pointBoundingBox(i[o],i[o+1],e);continue}let s=i[4],a=i[5];for(let o=6,u=i.length;o<u;o+=6){let[l,c,h,d,f,p]=i.subarray(o,o+6);Q.bezierBoundingBox(s,a,l,c,h,d,f,p,e),s=f,a=p}}let[t,n]=this.#u();e[0]=Pt(e[0]-t,0,1),e[1]=Pt(e[1]-n,0,1),e[2]=Pt(e[2]+t,0,1),e[3]=Pt(e[3]+n,0,1),e[2]-=e[0],e[3]-=e[1]}get box(){return this.#e}updateProperty(e,t){return e==="stroke-width"?this.#f(t):null}#f(e){let[t,n]=this.#u();this.#l=e;let[i,s]=this.#u(),[a,o]=[i-t,s-n],u=this.#e;return u[0]-=a,u[1]-=o,u[2]+=2*a,u[3]+=2*o,u}updateParentDimensions([e,t],n){let[i,s]=this.#u();this.#a=e,this.#s=t,this.#i=n;let[a,o]=this.#u(),u=a-i,l=o-s,c=this.#e;return c[0]-=u,c[1]-=l,c[2]+=2*u,c[3]+=2*l,c}updateRotation(e){return this.#t=e,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#e.map(Z.svgRound).join(" ")}get defaultProperties(){let[e,t]=this.#e;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Z.svgRound(e)} ${Z.svgRound(t)}`}}}get rotationTransform(){let[,,e,t]=this.#e,n=0,i=0,s=0,a=0,o=0,u=0;switch(this.#t){case 90:i=t/e,s=-e/t,o=e;break;case 180:n=-1,a=-1,o=e,u=t;break;case 270:i=-t/e,s=e/t,u=t;break;default:return""}return`matrix(${n} ${i} ${s} ${a} ${Z.svgRound(o)} ${Z.svgRound(u)})`}getPathResizingSVGProperties([e,t,n,i]){let[s,a]=this.#u(),[o,u,l,c]=this.#e;if(Math.abs(l-s)<=Z.PRECISION||Math.abs(c-a)<=Z.PRECISION){let g=e+n/2-(o+l/2),b=t+i/2-(u+c/2);return{path:{"transform-origin":`${Z.svgRound(e)} ${Z.svgRound(t)}`,transform:`${this.rotationTransform} translate(${g} ${b})`}}}let h=(n-2*s)/(l-2*s),d=(i-2*a)/(c-2*a),f=l/n,p=c/i;return{path:{"transform-origin":`${Z.svgRound(o)} ${Z.svgRound(u)}`,transform:`${this.rotationTransform} scale(${f} ${p}) translate(${Z.svgRound(s)} ${Z.svgRound(a)}) scale(${h} ${d}) translate(${Z.svgRound(-s)} ${Z.svgRound(-a)})`}}}getPathResizedSVGProperties([e,t,n,i]){let[s,a]=this.#u(),o=this.#e,[u,l,c,h]=o;if(o[0]=e,o[1]=t,o[2]=n,o[3]=i,Math.abs(c-s)<=Z.PRECISION||Math.abs(h-a)<=Z.PRECISION){let b=e+n/2-(u+c/2),m=t+i/2-(l+h/2);for(let{line:y,points:v}of this.#r)Z._translate(y,b,m,y),Z._translate(v,b,m,v);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Z.svgRound(e)} ${Z.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let d=(n-2*s)/(c-2*s),f=(i-2*a)/(h-2*a),p=-d*(u+s)+e+s,g=-f*(l+a)+t+a;if(d!==1||f!==1||p!==0||g!==0)for(let{line:b,points:m}of this.#r)Z._rescale(b,p,g,d,f,b),Z._rescale(m,p,g,d,f,m);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Z.svgRound(e)} ${Z.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,t],n){let[i,s]=n,a=this.#e,o=e-a[0],u=t-a[1];if(this.#a===i&&this.#s===s)for(let{line:l,points:c}of this.#r)Z._translate(l,o,u,l),Z._translate(c,o,u,c);else{let l=this.#a/i,c=this.#s/s;this.#a=i,this.#s=s;for(let{line:h,points:d}of this.#r)Z._rescale(h,o,u,l,c,h),Z._rescale(d,o,u,l,c,d);a[2]*=l,a[3]*=c}return a[0]=e,a[1]=t,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Z.svgRound(e)} ${Z.svgRound(t)}`}}}get defaultSVGProperties(){let e=this.#e;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Z.svgRound(e[0])} ${Z.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}},xc=class r extends vc{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:"none",stroke:De._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,t){e==="stroke-width"&&(t??=this["stroke-width"],t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){let e=new r(this._viewParameters);return e.updateAll(this),e}},Ng=class r extends wc{static _type="ink";static _editorType=ce.INK;static _defaultDrawingOptions=null;constructor(e){super({...e,name:"inkEditor"}),this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,t){De.initialize(e,t),this._defaultDrawingOptions=new xc(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!0}static get typesMap(){return le(this,"typesMap",new Map([[we.INK_THICKNESS,"stroke-width"],[we.INK_COLOR,"stroke"],[we.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,t,n,i,s){return new Lg(e,t,n,i,s,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,t,n,i,s,a){return si.deserialize(e,t,n,i,s,a)}static async deserialize(e,t,n){let i=null;if(e instanceof ao){let{data:{inkLists:a,rect:o,rotation:u,id:l,color:c,opacity:h,borderStyle:{rawWidth:d},popupRef:f,richText:p,contentsObj:g,creationDate:b,modificationDate:m},parent:{page:{pageNumber:y}}}=e;i=e={annotationType:ce.INK,color:Array.from(c),thickness:d,opacity:h,paths:{points:a},boxes:null,pageIndex:y-1,rect:o.slice(0),rotation:u,annotationElementId:l,id:l,deleted:!1,popupRef:f,richText:p,comment:g?.str||null,creationDate:b,modificationDate:m}}let s=await super.deserialize(e,t,n);return s._initialData=i,e.comment&&s.setCommentData(e),s}get toolbarButtons(){return this._colorPicker||=new lc(this),[["colorPicker",this._colorPicker]]}get colorType(){return we.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:e,_drawingOptions:t,parent:n}=this;t.updateSVGProperty("stroke-width"),n.drawLayer.updateProperties(e,t.toSVGProperties())}static onScaleChangingWhenDrawing(){let e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:t,opacity:n}){this._drawingOptions=r.getDefaultDrawingOptions({stroke:Q.makeHexColor(...e),"stroke-width":t,"stroke-opacity":n})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{stroke:i,"stroke-opacity":s,"stroke-width":a}}=this,o=Object.assign(super.serialize(e),{color:De._colorManager.convert(i),opacity:s,thickness:a,paths:{lines:t,points:n}});return this.addComment(o),e?(o.isCopy=!0,o):this.annotationElementId&&!this.#e(o)?null:(o.id=this.annotationElementId,o)}#e(e){let{color:t,thickness:n,opacity:i,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((a,o)=>a!==t[o])||e.thickness!==n||e.opacity!==i||e.pageIndex!==s}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let{points:t,rect:n}=this.serializeDraw(!1);return e.updateEdited({rect:n,thickness:this._drawingOptions["stroke-width"],points:t,popup:this.comment}),null}},lo=class extends si{toSVGPath(){let e=super.toSVGPath();return e.endsWith("Z")||(e+="Z"),e}},Fl=8,Ha=3,En=class{static#e={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static#t(e,t,n,i){return n-=e,i-=t,n===0?i>0?0:4:n===1?i+6:2-i}static#n=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#r(e,t,n,i,s,a,o){let u=this.#t(n,i,s,a);for(let l=0;l<8;l++){let c=(-l+u-o+16)%8,h=this.#n[2*c],d=this.#n[2*c+1];if(e[(n+h)*t+(i+d)]!==0)return c}return-1}static#a(e,t,n,i,s,a,o){let u=this.#t(n,i,s,a);for(let l=0;l<8;l++){let c=(l+u+o+16)%8,h=this.#n[2*c],d=this.#n[2*c+1];if(e[(n+h)*t+(i+d)]!==0)return c}return-1}static#s(e,t,n,i){let s=e.length,a=new Int32Array(s);for(let c=0;c<s;c++)a[c]=e[c]<=i?1:0;for(let c=1;c<n-1;c++)a[c*t]=a[c*t+t-1]=0;for(let c=0;c<t;c++)a[c]=a[t*n-1-c]=0;let o=1,u,l=[];for(let c=1;c<n-1;c++){u=1;for(let h=1;h<t-1;h++){let d=c*t+h,f=a[d];if(f===0)continue;let p=c,g=h;if(f===1&&a[d-1]===0)o+=1,g-=1;else if(f>=1&&a[d+1]===0)o+=1,g+=1,f>1&&(u=f);else{f!==1&&(u=Math.abs(f));continue}let b=[h,c],m=g===h+1,y={isHole:m,points:b,id:o,parent:0};l.push(y);let v;for(let A of l)if(A.id===u){v=A;break}v?v.isHole?y.parent=m?v.parent:u:y.parent=m?u:v.parent:y.parent=m?u:0;let x=this.#r(a,t,c,h,p,g,0);if(x===-1){a[d]=-o,a[d]!==1&&(u=Math.abs(a[d]));continue}let w=this.#n[2*x],S=this.#n[2*x+1],E=c+w,_=h+S;p=E,g=_;let T=c,k=h;for(;;){let A=this.#a(a,t,T,k,p,g,1);w=this.#n[2*A],S=this.#n[2*A+1];let B=T+w,D=k+S;b.push(D,B);let P=T*t+k;if(a[P+1]===0?a[P]=-o:a[P]===1&&(a[P]=o),B===c&&D===h&&T===E&&k===_){a[d]!==1&&(u=Math.abs(a[d]));break}else p=T,g=k,T=B,k=D}}}return l}static#i(e,t,n,i){if(n-t<=4){for(let E=t;E<n-2;E+=2)i.push(e[E],e[E+1]);return}let s=e[t],a=e[t+1],o=e[n-4]-s,u=e[n-3]-a,l=Math.hypot(o,u),c=o/l,h=u/l,d=c*a-h*s,f=u/o,p=1/l,g=Math.atan(f),b=Math.cos(g),m=Math.sin(g),y=p*(Math.abs(b)+Math.abs(m)),v=p*(1-y+y**2),x=Math.max(Math.atan(Math.abs(m+b)*v),Math.atan(Math.abs(m-b)*v)),w=0,S=t;for(let E=t+2;E<n-2;E+=2){let _=Math.abs(d-c*e[E+1]+h*e[E]);_>w&&(S=E,w=_)}w>(l*x)**2?(this.#i(e,t,S+2,i),this.#i(e,S,n,i)):i.push(s,a)}static#o(e){let t=[],n=e.length;return this.#i(e,0,n,t),t.push(e[n-2],e[n-1]),t.length<=4?null:t}static#l(e,t,n,i,s,a){let o=new Float32Array(a**2),u=-2*i**2,l=a>>1;for(let g=0;g<a;g++){let b=(g-l)**2;for(let m=0;m<a;m++)o[g*a+m]=Math.exp((b+(m-l)**2)/u)}let c=new Float32Array(256),h=-2*s**2;for(let g=0;g<256;g++)c[g]=Math.exp(g**2/h);let d=e.length,f=new Uint8Array(d),p=new Uint32Array(256);for(let g=0;g<n;g++)for(let b=0;b<t;b++){let m=g*t+b,y=e[m],v=0,x=0;for(let S=0;S<a;S++){let E=g+S-l;if(!(E<0||E>=n))for(let _=0;_<a;_++){let T=b+_-l;if(T<0||T>=t)continue;let k=e[E*t+T],A=o[S*a+_]*c[Math.abs(k-y)];v+=k*A,x+=A}}let w=f[m]=Math.round(v/x);p[w]++}return[f,p]}static#u(e){let t=new Uint32Array(256);for(let n of e)t[n]++;return t}static#d(e){let t=e.length,n=new Uint8ClampedArray(t>>2),i=-1/0,s=1/0;for(let o=0,u=n.length;o<u;o++){let l=n[o]=e[o<<2];i=Math.max(i,l),s=Math.min(s,l)}let a=255/(i-s);for(let o=0,u=n.length;o<u;o++)n[o]=(n[o]-s)*a;return n}static#h(e){let t,n=-1/0,i=-1/0,s=e.findIndex(u=>u!==0),a=s,o=s;for(t=s;t<256;t++){let u=e[t];u>n&&(t-a>i&&(i=t-a,o=t-1),n=u,a=t)}for(t=o-1;t>=0&&!(e[t]>e[t+1]);t--);return t}static#f(e){let t=e,{width:n,height:i}=e,{maxDim:s}=this.#e,a=n,o=i;if(n>s||i>s){let d=n,f=i,p=Math.log2(Math.max(n,i)/s),g=Math.floor(p);p=p===g?g-1:g;for(let m=0;m<p;m++){a=Math.ceil(d/2),o=Math.ceil(f/2);let y=new OffscreenCanvas(a,o);y.getContext("2d").drawImage(e,0,0,d,f,0,0,a,o),d=a,f=o,e!==t&&e.close(),e=y.transferToImageBitmap()}let b=Math.min(s/a,s/o);a=Math.round(a*b),o=Math.round(o*b)}let l=new OffscreenCanvas(a,o).getContext("2d",{willReadFrequently:!0});l.fillStyle="white",l.fillRect(0,0,a,o),l.filter="grayscale(1)",l.drawImage(e,0,0,e.width,e.height,0,0,a,o);let c=l.getImageData(0,0,a,o).data;return[this.#d(c),a,o]}static extractContoursFromText(e,{fontFamily:t,fontStyle:n,fontWeight:i},s,a,o,u){let l=new OffscreenCanvas(1,1),c=l.getContext("2d",{alpha:!1}),h=200,d=c.font=`${n} ${i} ${h}px ${t}`,{actualBoundingBoxLeft:f,actualBoundingBoxRight:p,actualBoundingBoxAscent:g,actualBoundingBoxDescent:b,fontBoundingBoxAscent:m,fontBoundingBoxDescent:y,width:v}=c.measureText(e),x=1.5,w=Math.ceil(Math.max(Math.abs(f)+Math.abs(p)||0,v)*x),S=Math.ceil(Math.max(Math.abs(g)+Math.abs(b)||h,Math.abs(m)+Math.abs(y)||h)*x);l=new OffscreenCanvas(w,S),c=l.getContext("2d",{alpha:!0,willReadFrequently:!0}),c.font=d,c.filter="grayscale(1)",c.fillStyle="white",c.fillRect(0,0,w,S),c.fillStyle="black",c.fillText(e,w*(x-1)/2,S*(3-x)/2);let E=this.#d(c.getImageData(0,0,w,S).data),_=this.#u(E),T=this.#h(_),k=this.#s(E,w,S,T);return this.processDrawnLines({lines:{curves:k,width:w,height:S},pageWidth:s,pageHeight:a,rotation:o,innerMargin:u,mustSmooth:!0,areContours:!0})}static process(e,t,n,i,s){let[a,o,u]=this.#f(e),[l,c]=this.#l(a,o,u,Math.hypot(o,u)*this.#e.sigmaSFactor,this.#e.sigmaR,this.#e.kernelSize),h=this.#h(c),d=this.#s(l,o,u,h);return this.processDrawnLines({lines:{curves:d,width:o,height:u},pageWidth:t,pageHeight:n,rotation:i,innerMargin:s,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:n,rotation:i,innerMargin:s,mustSmooth:a,areContours:o}){i%180!==0&&([t,n]=[n,t]);let{curves:u,width:l,height:c}=e,h=e.thickness??0,d=[],f=Math.min(t/l,n/c),p=f/t,g=f/n,b=[];for(let{points:y}of u){let v=a?this.#o(y):y;if(!v)continue;b.push(v);let x=v.length,w=new Float32Array(x),S=new Float32Array(3*(x===2?2:x-2));if(d.push({line:S,points:w}),x===2){w[0]=v[0]*p,w[1]=v[1]*g,S.set([NaN,NaN,NaN,NaN,w[0],w[1]],0);continue}let[E,_,T,k]=v;E*=p,_*=g,T*=p,k*=g,w.set([E,_,T,k],0),S.set([NaN,NaN,NaN,NaN,E,_],0);for(let A=4;A<x;A+=2){let B=w[A]=v[A]*p,D=w[A+1]=v[A+1]*g;S.set(Z.createBezierPoints(E,_,T,k,B,D),(A-2)*3),[E,_,T,k]=[T,k,B,D]}}if(d.length===0)return null;let m=o?new lo:new si;return m.build(d,t,n,1,i,o?0:h,s),{outline:m,newCurves:b,areContours:o,thickness:h,width:l,height:c}}static async compressSignature({outlines:e,areContours:t,thickness:n,width:i,height:s}){let a=1/0,o=-1/0,u=0;for(let v of e){u+=v.length;for(let x=2,w=v.length;x<w;x++){let S=v[x]-v[x-2];a=Math.min(a,S),o=Math.max(o,S)}}let l;a>=-128&&o<=127?l=Int8Array:a>=-32768&&o<=32767?l=Int16Array:l=Int32Array;let c=e.length,h=Fl+Ha*c,d=new Uint32Array(h),f=0;d[f++]=h*Uint32Array.BYTES_PER_ELEMENT+(u-2*c)*l.BYTES_PER_ELEMENT,d[f++]=0,d[f++]=i,d[f++]=s,d[f++]=t?0:1,d[f++]=Math.max(0,Math.floor(n??0)),d[f++]=c,d[f++]=l.BYTES_PER_ELEMENT;for(let v of e)d[f++]=v.length-2,d[f++]=v[0],d[f++]=v[1];let p=new CompressionStream("deflate-raw"),g=p.writable.getWriter();await g.ready,g.write(d);let b=l.prototype.constructor;for(let v of e){let x=new b(v.length-2);for(let w=2,S=v.length;w<S;w++)x[w-2]=v[w]-v[w-2];g.write(x)}g.close();let m=await new Response(p.readable).arrayBuffer(),y=new Uint8Array(m);return NE(y)}static async decompressSignature(e){try{let t=T5(e),{readable:n,writable:i}=new DecompressionStream("deflate-raw"),s=i.getWriter();await s.ready,s.write(t).then(async()=>{await s.ready,await s.close()}).catch(()=>{});let a=null,o=0;for await(let v of n)a||=new Uint8Array(new Uint32Array(v.buffer,0,4)[0]),a.set(v,o),o+=v.length;let u=new Uint32Array(a.buffer,0,a.length>>2),l=u[1];if(l!==0)throw new Error(`Invalid version: ${l}`);let c=u[2],h=u[3],d=u[4]===0,f=u[5],p=u[6],g=u[7],b=[],m=(Fl+Ha*p)*Uint32Array.BYTES_PER_ELEMENT,y;switch(g){case Int8Array.BYTES_PER_ELEMENT:y=new Int8Array(a.buffer,m);break;case Int16Array.BYTES_PER_ELEMENT:y=new Int16Array(a.buffer,m);break;case Int32Array.BYTES_PER_ELEMENT:y=new Int32Array(a.buffer,m);break}o=0;for(let v=0;v<p;v++){let x=u[Ha*v+Fl],w=new Float32Array(x+2);b.push(w);for(let S=0;S<Ha-1;S++)w[S]=u[Ha*v+Fl+S+1];for(let S=0;S<x;S++)w[S+2]=w[S]+y[o++]}return{areContours:d,thickness:f,outlines:b,width:c,height:h}}catch(t){return ue(`decompressSignature: ${t}`),null}}},Mg=class r extends vc{constructor(){super(),super.updateProperties({fill:De._defaultLineColor,"stroke-width":0})}clone(){let e=new r;return e.updateAll(this),e}},Bg=class r extends xc{constructor(e){super(e),super.updateProperties({stroke:De._defaultLineColor,"stroke-width":1})}clone(){let e=new r(this._viewParameters);return e.updateAll(this),e}},Dg=class r extends wc{#e=!1;#t=null;#n=null;#r=null;static _type="signature";static _editorType=ce.SIGNATURE;static _defaultDrawingOptions=null;constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"}),this._willKeepAspectRatio=!0,this.#n=e.signatureData||null,this.#t=null,this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,t){De.initialize(e,t),this._defaultDrawingOptions=new Mg,this._defaultDrawnSignatureOptions=new Bg(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!1}static get typesMap(){return le(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!this.#t}}static computeTelemetryFinalData(e){let t=e.get("hasDescription");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let e,t,{_isCopy:n}=this;if(n&&(this._isCopy=!1,e=this.x,t=this.y),super.render(),this._drawId===null)if(this.#n){let{lines:i,mustSmooth:s,areContours:a,description:o,uuid:u,heightInPage:l}=this.#n,{rawDims:{pageWidth:c,pageHeight:h},rotation:d}=this.parent.viewport,f=En.processDrawnLines({lines:i,pageWidth:c,pageHeight:h,rotation:d,innerMargin:r._INNER_MARGIN,mustSmooth:s,areContours:a});this.addSignature(f,l,o,u)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:this.#t||""}));return n&&(this._isCopy=!0,this._moveAfterPaste(e,t)),this.div}setUuid(e){this.#r=e,this.addEditToolbar()}getUuid(){return this.#r}get description(){return this.#t}set description(e){this.#t=e,this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:e})),super.addEditToolbar().then(t=>{t?.updateEditSignatureButton(e)}))}getSignaturePreview(){let{newCurves:e,areContours:t,thickness:n,width:i,height:s}=this.#n,a=Math.max(i,s),o=En.processDrawnLines({lines:{curves:e.map(u=>({points:u})),thickness:n,width:i,height:s},pageWidth:a,pageHeight:a,rotation:0,innerMargin:0,mustSmooth:!1,areContours:t});return{areContours:t,outline:o.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,t,n,i){let{x:s,y:a}=this,{outline:o}=this.#n=e;this.#e=o instanceof lo,this.description=n;let u;this.#e?u=r.getDefaultDrawingOptions():(u=r._defaultDrawnSignatureOptions.clone(),u.updateProperties({"stroke-width":o.thickness})),this._addOutlines({drawOutlines:o,drawingOptions:u});let[,l]=this.pageDimensions,c=t/l;c=c>=1?.5:c,this.width*=c/this.height,this.width>=1&&(c*=.9/this.width,this.width=.9),this.height=c,this.setDims(),this.x=s,this.y=a,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!i,hasDescription:!!n}}),this.div.hidden=!1}getFromImage(e){let{rawDims:{pageWidth:t,pageHeight:n},rotation:i}=this.parent.viewport;return En.process(e,t,n,i,r._INNER_MARGIN)}getFromText(e,t){let{rawDims:{pageWidth:n,pageHeight:i},rotation:s}=this.parent.viewport;return En.extractContoursFromText(e,t,n,i,s,r._INNER_MARGIN)}getDrawnSignature(e){let{rawDims:{pageWidth:t,pageHeight:n},rotation:i}=this.parent.viewport;return En.processDrawnLines({lines:e,pageWidth:t,pageHeight:n,rotation:i,innerMargin:r._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:t}){e?this._drawingOptions=r.getDefaultDrawingOptions():(this._drawingOptions=r._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":t}))}serialize(e=!1){if(this.isEmpty())return null;let{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":i}}=this,s=Object.assign(super.serialize(e),{isSignature:!0,areContours:this.#e,color:[0,0,0],thickness:this.#e?0:i});return this.addComment(s),e?(s.paths={lines:t,points:n},s.uuid=this.#r,s.isCopy=!0):s.lines=t,this.#t&&(s.accessibilityData={type:"Figure",alt:this.#t}),s}static deserializeDraw(e,t,n,i,s,a){return a.areContours?lo.deserialize(e,t,n,i,s,a):si.deserialize(e,t,n,i,s,a)}static async deserialize(e,t,n){let i=await super.deserialize(e,t,n);return i.#e=e.areContours,i.description=e.accessibilityData?.alt||"",i.#r=e.uuid,i}},Fg=class extends De{#e=null;#t=null;#n=null;#r=null;#a=null;#s="";#i=null;#o=!1;#l=null;#u=!1;#d=!1;static _type="stamp";static _editorType=ce.STAMP;constructor(e){super({...e,name:"stampEditor"}),this.#r=e.bitmapUrl,this.#a=e.bitmapFile,this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,t){De.initialize(e,t)}static isHandlingMimeForPasting(e){return u0.includes(e)}static paste(e,t){t.pasteEditor({mode:ce.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){let t=e.get("hasAltText");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}#h(e,t=!1){if(!e){this.remove();return}this.#e=e.bitmap,t||(this.#t=e.id,this.#u=e.isSvg),e.file&&(this.#s=e.file.name),this.#g()}#f(){if(this.#n=null,this._uiManager.enableWaiting(!1),!!this.#i){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(e=null,t=!0){if(this.hasAltTextData())return null;let{mlManager:n}=this._uiManager;if(!n)throw new Error("No ML.");if(!await n.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");let{data:i,width:s,height:a}=e||this.copyCanvas(null,null,!0).imageData,o=await n.guess({name:"altText",request:{data:i,width:s,height:a,channels:i.length/(s*a)}});if(!o)throw new Error("No response from the AI service.");if(o.error)throw new Error("Error from the AI service.");if(o.cancel)return null;if(!o.output)throw new Error("No valid response from the AI service.");let u=o.output;return await this.setGuessedAltText(u),t&&!this.hasAltTextData()&&(this.altTextData={alt:u,decorative:!1}),u}#m(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then(n=>this.#h(n,!0)).finally(()=>this.#f());return}if(this.#r){let n=this.#r;this.#r=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromUrl(n).then(i=>this.#h(i)).finally(()=>this.#f());return}if(this.#a){let n=this.#a;this.#a=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromFile(n).then(i=>this.#h(i)).finally(()=>this.#f());return}let e=document.createElement("input");e.type="file",e.accept=u0.join(",");let t=this._uiManager._signal;this.#n=new Promise(n=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let i=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#h(i)}n()},{signal:t}),e.addEventListener("cancel",()=>{this.remove(),n()},{signal:t})}).finally(()=>this.#f()),e.click()}remove(){this.#t&&(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#i?.remove(),this.#i=null,this.#l&&(clearTimeout(this.#l),this.#l=null)),super.remove()}rebuild(){if(!this.parent){this.#t&&this.#m();return}super.rebuild(),this.div!==null&&(this.#t&&this.#i===null&&this.#m(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(this.#n||this.#e||this.#r||this.#a||this.#t||this.#o)}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;return this._isCopy&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.createAltText(),this.#o||(this.#e?this.#g():this.#m()),this._isCopy&&this._moveAfterPaste(e,t),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,t){let{id:n,bitmap:i}=this._uiManager.imageManager.getFromCanvas(e,t);t.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(this.#t=n,i&&(this.#e=i),this.#o=!1,this.#g())}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;this.#l!==null&&clearTimeout(this.#l);let e=200;this.#l=setTimeout(()=>{this.#l=null,this.#p()},e)}#g(){let{div:e}=this,{width:t,height:n}=this.#e,[i,s]=this.pageDimensions,a=.75;if(this.width)t=this.width*i,n=this.height*s;else if(t>a*i||n>a*s){let u=Math.min(a*i/t,a*s/n);t*=u,n*=u}this._uiManager.enableWaiting(!1);let o=this.#i=document.createElement("canvas");o.setAttribute("role","img"),this.addContainer(o),this.width=t/i,this.height=n/s,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),this.#p(),this.#d||(this.parent.addUndoableEditor(this),this.#d=!0),this._reportTelemetry({action:"inserted_image"}),this.#s&&this.div.setAttribute("aria-description",this.#s),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")}copyCanvas(e,t,n=!1){e||(e=224);let{width:i,height:s}=this.#e,a=new nn,o=this.#e,u=i,l=s,c=null;if(t){if(i>t||s>t){let S=Math.min(t/i,t/s);u=Math.floor(i*S),l=Math.floor(s*S)}c=document.createElement("canvas");let d=c.width=Math.ceil(u*a.sx),f=c.height=Math.ceil(l*a.sy);this.#u||(o=this.#c(d,f));let p=c.getContext("2d");p.filter=this._uiManager.hcmFilter;let g="white",b="#cfcfd8";this._uiManager.hcmFilter!=="none"?b="black":l0.isDarkMode&&(g="#8f8f9d",b="#42414d");let m=15,y=m*a.sx,v=m*a.sy,x=new OffscreenCanvas(y*2,v*2),w=x.getContext("2d");w.fillStyle=g,w.fillRect(0,0,y*2,v*2),w.fillStyle=b,w.fillRect(0,0,y,v),w.fillRect(y,v,y,v),p.fillStyle=p.createPattern(x,"repeat"),p.fillRect(0,0,d,f),p.drawImage(o,0,0,o.width,o.height,0,0,d,f)}let h=null;if(n){let d,f;if(a.symmetric&&o.width<e&&o.height<e)d=o.width,f=o.height;else if(o=this.#e,i>e||s>e){let b=Math.min(e/i,e/s);d=Math.floor(i*b),f=Math.floor(s*b),this.#u||(o=this.#c(d,f))}let g=new OffscreenCanvas(d,f).getContext("2d",{willReadFrequently:!0});g.drawImage(o,0,0,o.width,o.height,0,0,d,f),h={width:d,height:f,data:g.getImageData(0,0,d,f).data}}return{canvas:c,width:u,height:l,imageData:h}}#c(e,t){let{width:n,height:i}=this.#e,s=n,a=i,o=this.#e;for(;s>2*e||a>2*t;){let u=s,l=a;s>2*e&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2)),a>2*t&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2));let c=new OffscreenCanvas(s,a);c.getContext("2d").drawImage(o,0,0,u,l,0,0,s,a),o=c.transferToImageBitmap()}return o}#p(){let[e,t]=this.parentDimensions,{width:n,height:i}=this,s=new nn,a=Math.ceil(n*e*s.sx),o=Math.ceil(i*t*s.sy),u=this.#i;if(!u||u.width===a&&u.height===o)return;u.width=a,u.height=o;let l=this.#u?this.#e:this.#c(a,o),c=u.getContext("2d");c.filter=this._uiManager.hcmFilter,c.drawImage(l,0,0,l.width,l.height,0,0,a,o)}#b(e){if(e){if(this.#u){let i=this._uiManager.imageManager.getSvgUrl(this.#t);if(i)return i}let t=document.createElement("canvas");return{width:t.width,height:t.height}=this.#e,t.getContext("2d").drawImage(this.#e,0,0),t.toDataURL()}if(this.#u){let[t,n]=this.pageDimensions,i=Math.round(this.width*t*An.PDF_TO_CSS_UNITS),s=Math.round(this.height*n*An.PDF_TO_CSS_UNITS),a=new OffscreenCanvas(i,s);return a.getContext("2d").drawImage(this.#e,0,0,this.#e.width,this.#e.height,0,0,i,s),a.transferToImageBitmap()}return structuredClone(this.#e)}static async deserialize(e,t,n){let i=null,s=!1;if(e instanceof gc){let{data:{rect:g,rotation:b,id:m,structParent:y,popupRef:v,richText:x,contentsObj:w,creationDate:S,modificationDate:E},container:_,parent:{page:{pageNumber:T}},canvas:k}=e,A,B;k?(delete e.canvas,{id:A,bitmap:B}=n.imageManager.getFromCanvas(_.id,k),k.remove()):(s=!0,e._hasNoCanvas=!0);let D=(await t._structTree.getAriaAttributes(`${hs}${m}`))?.get("aria-label")||"";i=e={annotationType:ce.STAMP,bitmapId:A,bitmap:B,pageIndex:T-1,rect:g.slice(0),rotation:b,annotationElementId:m,id:m,deleted:!1,accessibilityData:{decorative:!1,altText:D},isSvg:!1,structParent:y,popupRef:v,richText:x,comment:w?.str||null,creationDate:S,modificationDate:E}}let a=await super.deserialize(e,t,n),{rect:o,bitmap:u,bitmapUrl:l,bitmapId:c,isSvg:h,accessibilityData:d}=e;s?(n.addMissingCanvas(e.id,a),a.#o=!0):c&&n.imageManager.isValidId(c)?(a.#t=c,u&&(a.#e=u)):a.#r=l,a.#u=h;let[f,p]=a.pageDimensions;return a.width=(o[2]-o[0])/f,a.height=(o[3]-o[1])/p,d&&(a.altTextData=d),a._initialData=i,e.comment&&a.setCommentData(e),a.#d=!!i,a}serialize(e=!1,t=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let n=Object.assign(super.serialize(e),{bitmapId:this.#t,isSvg:this.#u});if(this.addComment(n),e)return n.bitmapUrl=this.#b(!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;let{decorative:i,altText:s}=this.serializeAltText(!1);if(!i&&s&&(n.accessibilityData={type:"Figure",alt:s}),this.annotationElementId){let o=this.#v(n);return o.isSame?null:(o.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1,n.id=this.annotationElementId,delete n.bitmapId,n)}if(t===null)return n;t.stamps||=new Map;let a=this.#u?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!t.stamps.has(this.#t))t.stamps.set(this.#t,{area:a,serialized:n}),n.bitmap=this.#b(!1);else if(this.#u){let o=t.stamps.get(this.#t);a>o.area&&(o.area=a,o.serialized.bitmap.close(),o.serialized.bitmap=this.#b(!1))}return n}#v(e){let{pageIndex:t,accessibilityData:{altText:n}}=this._initialData,i=e.pageIndex===t,s=(e.accessibilityData?.alt||"")===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&i&&s,isSameAltText:s}}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},$g=class r{#e;#t=!1;#n=null;#r=null;#a=null;#s=new Map;#i=!1;#o=!1;#l=!1;#u=null;#d=null;#h=null;#f=null;#m=null;#g=-1;#c;static _initialized=!1;static#p=new Map([Rg,Ng,Fg,yc,Dg].map(e=>[e._editorType,e]));constructor({uiManager:e,pageIndex:t,div:n,structTreeLayer:i,accessibilityManager:s,annotationLayer:a,drawLayer:o,textLayer:u,viewport:l,l10n:c}){let h=[...r.#p.values()];if(!r._initialized){r._initialized=!0;for(let d of h)d.initialize(c,e)}e.registerEditorTypes(h),this.#c=e,this.pageIndex=t,this.div=n,this.#e=s,this.#n=a,this.viewport=l,this.#h=u,this.drawLayer=o,this._structTree=i,this.#c.addLayer(this)}get isEmpty(){return this.#s.size===0}get isInvisible(){return this.isEmpty&&this.#c.getMode()===ce.NONE}updateToolbar(e){this.#c.updateToolbar(e)}updateMode(e=this.#c.getMode()){switch(this.#x(),e){case ce.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case ce.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case ce.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:t}=this.div;if(t.toggle("nonEditing",!1),e===ce.POPUP)t.toggle("commentEditing",!0);else{t.toggle("commentEditing",!1);for(let n of r.#p.values())t.toggle(`${n._type}Editing`,e===n._editorType)}this.div.hidden=!1}hasTextLayer(e){return e===this.#h?.div}setEditingState(e){this.#c.setEditingState(e)}addCommands(e){this.#c.addCommands(e)}cleanUndoStack(e){this.#c.cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#n?.togglePointerEvents(e)}get#b(){return this.#s.size!==0?this.#s.values():this.#c.getEditors(this.pageIndex)}async enable(){this.#l=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),this.#m?.abort(),this.#m=null;let e=new Set;for(let n of this.#b)n.enableEditing(),n.show(!0),n.annotationElementId&&(this.#c.removeChangedExistingAnnotation(n),e.add(n.annotationElementId));let t=this.#n;if(t)for(let n of t.getEditableAnnotations()){if(n.hide(),this.#c.isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;let i=await this.deserialize(n);i&&(this.addOrRebuild(i),i.enableEditing())}this.#l=!1,this.#c._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#o=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),this.#h&&!this.#m){this.#m=new AbortController;let i=this.#c.combinedSignal(this.#m);this.#h.div.addEventListener("pointerdown",s=>{let{clientX:o,clientY:u,timeStamp:l}=s,c=this.#g;if(l-c>500){this.#g=l;return}this.#g=-1;let{classList:h}=this.div;h.toggle("getElements",!0);let d=document.elementsFromPoint(o,u);if(h.toggle("getElements",!1),!this.div.contains(d[0]))return;let f,p=new RegExp(`^${qa}[0-9]+$`);for(let b of d)if(p.test(b.id)){f=b.id;break}if(!f)return;let g=this.#s.get(f);g?.annotationElementId===null&&(s.stopPropagation(),s.preventDefault(),g.dblclick(s))},{signal:i,capture:!0})}let e=this.#n,t=[];if(e){let i=new Map,s=new Map;for(let o of this.#b){if(o.disableEditing(),!o.annotationElementId){t.push(o);continue}if(o.serialize()!==null){i.set(o.annotationElementId,o);continue}else s.set(o.annotationElementId,o);this.getEditableAnnotation(o.annotationElementId)?.show(),o.remove()}let a=e.getEditableAnnotations();for(let o of a){let{id:u}=o.data;if(this.#c.isDeletedAnnotationElement(u)){o.updateEdited({deleted:!0});continue}let l=s.get(u);if(l){l.resetAnnotationElement(o),l.show(!1),o.show();continue}l=i.get(u),l&&(this.#c.addChangedExistingAnnotation(l),l.renderAnnotationElement(o)&&l.show(!1)),o.show()}}this.#x(),this.isEmpty&&(this.div.hidden=!0);let{classList:n}=this.div;for(let i of r.#p.values())n.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),e?.updateFakeAnnotations(t),this.#o=!1}getEditableAnnotation(e){return this.#n?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#c.getActive()!==e&&this.#c.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#h?.div&&!this.#f){this.#f=new AbortController;let e=this.#c.combinedSignal(this.#f);this.#h.div.addEventListener("pointerdown",this.#v.bind(this),{signal:e}),this.#h.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#h?.div&&this.#f&&(this.#f.abort(),this.#f=null,this.#h.div.classList.remove("highlighting"))}#v(e){this.#c.unselectAll();let{target:t}=e;if(t===this.#h.div||(t.getAttribute("role")==="img"||t.classList.contains("endOfContent"))&&this.#h.div.contains(t)){let{isMac:n}=Je.platform;if(e.button!==0||e.ctrlKey&&n)return;this.#c.showAllEditors("highlight",!0,!0),this.#h.div.classList.add("free"),this.toggleDrawing(),yc.startHighlighting(this,this.#c.direction==="ltr",{target:this.#h.div,x:e.x,y:e.y}),this.#h.div.addEventListener("pointerup",()=>{this.#h.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#c._signal}),e.preventDefault()}}enableClick(){if(this.#r)return;this.#r=new AbortController;let e=this.#c.combinedSignal(this.#r);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});let t=this.pointerup.bind(this);this.div.addEventListener("pointerup",t,{signal:e}),this.div.addEventListener("pointercancel",t,{signal:e})}disableClick(){this.#r?.abort(),this.#r=null}attach(e){this.#s.set(e.id,e);let{annotationElementId:t}=e;t&&this.#c.isDeletedAnnotationElement(t)&&this.#c.removeDeletedAnnotationElement(e)}detach(e){this.#s.delete(e.id),this.#e?.removePointerInTextLayer(e.contentDiv),!this.#o&&e.annotationElementId&&this.#c.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#c.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){e.parent!==this&&(e.parent&&e.annotationElementId&&(this.#c.addDeletedAnnotationElement(e),De.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),this.#c.addEditor(e),this.attach(e),!e.isAttachedToDOM){let t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!this.#l),this.#c.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;let{activeElement:t}=document;e.div.contains(t)&&!this.#a&&(e._focusEventsAllowed=!1,this.#a=setTimeout(()=>{this.#a=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this.#c._signal}),t.focus())},0)),e._structTreeParentId=this.#e?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){let t=()=>e._uiManager.rebuild(e),n=()=>{e.remove()};this.addCommands({cmd:t,undo:n,mustExec:!1})}getEditorByUID(e){for(let t of this.#s.values())if(t.uid===e)return t;return null}getNextId(){return this.#c.getId()}get#y(){return r.#p.get(this.#c.getMode())}combinedSignal(e){return this.#c.combinedSignal(e)}#T(e){let t=this.#y;return t?new t.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#y?.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await this.#c.updateMode(e.mode);let{offsetX:n,offsetY:i}=this.#E(),s=this.getNextId(),a=this.#T({parent:this,id:s,x:n,y:i,uiManager:this.#c,isCentered:!0,...t});a&&this.add(a)}async deserialize(e){return await r.#p.get(e.annotationType??e.annotationEditorType)?.deserialize(e,this,this.#c)||null}createAndAddNewEditor(e,t,n={}){let i=this.getNextId(),s=this.#T({parent:this,id:i,x:e.offsetX,y:e.offsetY,uiManager:this.#c,isCentered:t,...n});return s&&this.add(s),s}get boundingClientRect(){return this.div.getBoundingClientRect()}#E(){let{x:e,y:t,width:n,height:i}=this.boundingClientRect,s=Math.max(0,e),a=Math.max(0,t),o=Math.min(window.innerWidth,e+n),u=Math.min(window.innerHeight,t+i),l=(s+o)/2-e,c=(a+u)/2-t,[h,d]=this.viewport.rotation%180===0?[l,c]:[c,l];return{offsetX:h,offsetY:d}}addNewEditor(e={}){this.createAndAddNewEditor(this.#E(),!0,e)}setSelected(e){this.#c.setSelected(e)}toggleSelected(e){this.#c.toggleSelected(e)}unselect(e){this.#c.unselect(e)}pointerup(e){let{isMac:t}=Je.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!this.#i||(this.#i=!1,this.#y?.isDrawer&&this.#y.supportMultipleDrawings))return;if(!this.#t){this.#t=!0;return}let n=this.#c.getMode();if(n===ce.STAMP||n===ce.SIGNATURE){this.#c.unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){if(this.#c.getMode()===ce.HIGHLIGHT&&this.enableTextSelection(),this.#i){this.#i=!1;return}let{isMac:t}=Je.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(this.#i=!0,this.#y?.isDrawer){this.startDrawingSession(e);return}let n=this.#c.getActive();this.#t=!n||n.isEmpty()}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),this.#u){this.#y.startDrawing(this,this.#c,!1,e);return}this.#c.setCurrentDrawingSession(this),this.#u=new AbortController;let t=this.#c.combinedSignal(this.#u);this.div.addEventListener("blur",({relatedTarget:n})=>{n&&!this.div.contains(n)&&(this.#d=null,this.commitOrRemove())},{signal:t}),this.#y.startDrawing(this,this.#c,!1,e)}pause(e){if(e){let{activeElement:t}=document;this.div.contains(t)&&(this.#d=t);return}this.#d&&setTimeout(()=>{this.#d?.focus(),this.#d=null},0)}endDrawingSession(e=!1){return this.#u?(this.#c.setCurrentDrawingSession(null),this.#u.abort(),this.#u=null,this.#d=null,this.#y.endDrawing(e)):null}findNewParent(e,t,n){let i=this.#c.findParent(t,n);return i===null||i===this?!1:(i.changeParent(e),!0)}commitOrRemove(){return this.#u?(this.endDrawingSession(),!0):!1}onScaleChanging(){this.#u&&this.#y.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#c.getActive()?.parent===this&&(this.#c.commitOrRemove(),this.#c.setActiveEditor(null)),this.#a&&(clearTimeout(this.#a),this.#a=null);for(let e of this.#s.values())this.#e?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#s.clear(),this.#c.removeLayer(this)}#x(){for(let e of this.#s.values())e.isEmpty()&&e.remove()}render({viewport:e}){this.viewport=e,ti(this.div,e);for(let t of this.#c.getEditors(this.pageIndex))this.add(t),t.rebuild();this.updateMode()}update({viewport:e}){this.#c.commitOrRemove(),this.#x();let t=this.viewport.rotation,n=e.rotation;if(this.viewport=e,ti(this.div,{rotation:n}),t!==n)for(let i of this.#s.values())i.rotate(n)}get pageDimensions(){let{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return this.#c.viewParameters.realScale}},Ug=class r{#e=null;#t=new Map;#n=new Map;static#r=0;constructor({pageIndex:e}){this.pageIndex=e}setParent(e){if(!this.#e){this.#e=e;return}if(this.#e!==e){if(this.#t.size>0)for(let t of this.#t.values())t.remove(),e.append(t);this.#e=e}}static get _svgFactory(){return le(this,"_svgFactory",new ms)}static#a(e,[t,n,i,s]){let{style:a}=e;a.top=`${100*n}%`,a.left=`${100*t}%`,a.width=`${100*i}%`,a.height=`${100*s}%`}#s(){let e=r._svgFactory.create(1,1,!0);return this.#e.append(e),e.setAttribute("aria-hidden",!0),e}#i(e,t){let n=r._svgFactory.createElement("clipPath");e.append(n);let i=`clip_${t}`;n.setAttribute("id",i),n.setAttribute("clipPathUnits","objectBoundingBox");let s=r._svgFactory.createElement("use");return n.append(s),s.setAttribute("href",`#${t}`),s.classList.add("clip"),i}#o(e,t){for(let[n,i]of Object.entries(t))i===null?e.removeAttribute(n):e.setAttribute(n,i)}draw(e,t=!1,n=!1){let i=r.#r++,s=this.#s(),a=r._svgFactory.createElement("defs");s.append(a);let o=r._svgFactory.createElement("path");a.append(o);let u=`path_p${this.pageIndex}_${i}`;o.setAttribute("id",u),o.setAttribute("vector-effect","non-scaling-stroke"),t&&this.#n.set(i,o);let l=n?this.#i(a,u):null,c=r._svgFactory.createElement("use");return s.append(c),c.setAttribute("href",`#${u}`),this.updateProperties(s,e),this.#t.set(i,s),{id:i,clipPathId:`url(#${l})`}}drawOutline(e,t){let n=r.#r++,i=this.#s(),s=r._svgFactory.createElement("defs");i.append(s);let a=r._svgFactory.createElement("path");s.append(a);let o=`path_p${this.pageIndex}_${n}`;a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke");let u;if(t){let h=r._svgFactory.createElement("mask");s.append(h),u=`mask_p${this.pageIndex}_${n}`,h.setAttribute("id",u),h.setAttribute("maskUnits","objectBoundingBox");let d=r._svgFactory.createElement("rect");h.append(d),d.setAttribute("width","1"),d.setAttribute("height","1"),d.setAttribute("fill","white");let f=r._svgFactory.createElement("use");h.append(f),f.setAttribute("href",`#${o}`),f.setAttribute("stroke","none"),f.setAttribute("fill","black"),f.setAttribute("fill-rule","nonzero"),f.classList.add("mask")}let l=r._svgFactory.createElement("use");i.append(l),l.setAttribute("href",`#${o}`),u&&l.setAttribute("mask",`url(#${u})`);let c=l.cloneNode();return i.append(c),l.classList.add("mainOutline"),c.classList.add("secondaryOutline"),this.updateProperties(i,e),this.#t.set(n,i),n}finalizeDraw(e,t){this.#n.delete(e),this.updateProperties(e,t)}updateProperties(e,t){if(!t)return;let{root:n,bbox:i,rootClass:s,path:a}=t,o=typeof e=="number"?this.#t.get(e):e;if(o){if(n&&this.#o(o,n),i&&r.#a(o,i),s){let{classList:u}=o;for(let[l,c]of Object.entries(s))u.toggle(l,c)}if(a){let l=o.firstElementChild.firstElementChild;this.#o(l,a)}}}updateParent(e,t){if(t===this)return;let n=this.#t.get(e);n&&(t.#e.append(n),this.#t.delete(e),t.#t.set(e,n))}remove(e){this.#n.delete(e),this.#e!==null&&(this.#t.get(e).remove(),this.#t.delete(e))}destroy(){this.#e=null;for(let e of this.#t.values())e.remove();this.#t.clear(),this.#n.clear()}};globalThis._pdfjsTestingUtils={HighlightOutliner:oo};globalThis.pdfjsLib={AbortException:Dr,AnnotationEditorLayer:$g,AnnotationEditorParamsType:we,AnnotationEditorType:ce,AnnotationEditorUIManager:ni,AnnotationLayer:Ig,AnnotationMode:Sn,AnnotationType:it,applyOpacity:P5,build:Z5,ColorPicker:uc,createValidAbsoluteUrl:RE,CSSConstants:c0,DOMSVGFactory:ms,DrawLayer:Ug,FeatureTest:Je,fetchData:ho,findContrastColor:O5,getDocument:Hg,getFilenameFromUrl:_5,getPdfFilenameFromUrl:C5,getRGB:fo,getUuid:LE,getXfaPageViewport:I5,GlobalWorkerOptions:ei,ImageKind:Ul,InvalidPDFException:Xa,isDataScheme:Tc,isPdfFile:zg,isValidExplicitDest:B5,MathClamp:Pt,noContextMenu:ur,normalizeUnicode:E5,OPS:Ka,OutputScale:nn,PasswordResponses:g5,PDFDataRangeTransport:oc,PDFDateString:Ja,PDFWorker:no,PermissionFlag:p5,PixelsPerInch:An,RenderingCancelledException:Za,renderRichText:ME,ResponseException:gs,setLayerDimensions:ti,shadow:le,SignatureExtractor:En,stopEvent:Ke,SupportedImageMimeTypes:u0,TextLayer:ro,TouchManager:Vl,updateUrlHash:PE,Util:Q,VerbosityLevel:Sc,version:Q5,XfaLayer:jl};var WE=50,tB=100;async function Cc(r){let e=await Hg({data:new Uint8Array(r)}).promise;try{let t=await rB(e),n=await nB(e),{chapters:i,spine:s}=await iB(e);return{metadata:t,toc:n,chapters:i,spine:s}}finally{await e.destroy()}}async function rB(r){let t=(await r.getMetadata())?.info;return{title:t?.Title||"Untitled",author:t?.Author||null,language:t?.Language||"en"}}async function nB(r){let e=await r.getOutline();if(e&&e.length>0)return VE(e);let t=r.numPages,n=20,i=[];for(let s=1;s<=t;s+=n){let a=Math.min(s+n-1,t),o=`pages-${s}-${a}`;i.push({id:o,title:`Pages ${s}\u2013${a}`,index:i.length,href:"",level:0})}return i}function VE(r,e=0){let t=[];for(let n of r){let i={id:`outline-${t.length}-${e}`,title:n.title||"Untitled",index:t.length,href:"",level:e};n.items&&Array.isArray(n.items)&&n.items.length>0&&(i.children=VE(n.items,e+1)),t.push(i)}return t}async function iB(r){let e=new Map,t=[],n=r.numPages;for(let i=1;i<=n;i+=WE){let s=Math.min(i+WE,n+1),a=await Promise.all(Array.from({length:s-i},(o,u)=>aB(r,i+u)));for(let o of a)e.set(o.id,o),t.push(o.id)}return{chapters:e,spine:t}}function sB(r,e){let t=[];for(let a of r){if(!a.str||a.str.trim()==="")continue;let o=a.height??(a.transform?a.transform[3]:0);o>0&&t.push(o)}if(t.length===0)return[];t.sort((a,o)=>a-o);let n=t[Math.floor(t.length/2)];if(n<=0)return[];let i=[],s=0;for(let a of r){if(!a.str||a.str.trim()==="")continue;let o=a.height??(a.transform?a.transform[3]:0);if(o<=0)continue;let u=o/n;if(u<1.3)continue;let l;u>=1.8?l=1:u>=1.5?l=2:l=3;let c=a.str.trim(),h=e.indexOf(c,s);h!==-1&&(i.push({level:l,text:c,offset:h,length:0}),s=h+1)}return _l(i,e.length),i}async function aB(r,e){let n=await(await r.getPage(e)).getTextContent(),i=n.items.map(u=>"str"in u?u.str:"").join(" ").trim(),s=`page-${e}`,a=i.length<tB,o=a?[]:sB(n.items,i);return{id:s,title:`Page ${e}`,html:a?`[scanned-page:${e}]`:i,text:a?"[This page appears to be a scanned image with minimal text content.]":i,headings:o,keyTerms:a?[]:Nr(i)}}function Wg(r,e){return r.getUint8(e)}function go(r,e){return r.getUint16(e,!1)}function lr(r,e){return r.getUint32(e,!1)}function mo(r,e,t){return new TextDecoder().decode(new Uint8Array(r,e,t))}var oB={1252:"windows-1252",65001:"utf-8"},uB={1:["ar"],2:["bg"],3:["ca"],4:["zh"],5:["cs"],6:["da"],7:["de"],8:["el"],9:["en"],10:["es"],11:["fi"],12:["fr"],13:["he"],14:["hu"],15:["is"],16:["it"],17:["ja"],18:["ko"],19:["nl"],20:["no"],21:["pl"],22:["pt"],23:["rm"],24:["ro"],25:["ru"],26:["hr"],27:["sk"],28:["sq"],29:["sv"],30:["th"],31:["tr"],32:["ur"],33:["id"],34:["uk"],35:["be"],36:["sl"],37:["et"],38:["lv"],39:["lt"],41:["fa"],42:["vi"],43:["hy"],44:["az"],45:["eu"]};async function kc(r){let e=new DataView(r),t=lB(r,e);if(t.header.type!=="BOOK"||t.header.creator!=="MOBI")throw new Error("Not a valid MOBI file");let n=GE(r,t.records,0),i=new DataView(n),s=cB(n,i);if(s.encryption!==0)throw new Error("This book has DRM protection and cannot be read by AI tools");if(s.compression!==1&&s.compression!==2)throw new Error(`Unsupported compression type: ${s.compression}. Only uncompressed and PalmDOC compression are supported.`);let a=new TextDecoder(oB[s.encoding]||"utf-8"),o=hB(n,s),u=dB(n,s,o,a),l=gB(r,t.records,s,a),{chapters:c,spine:h,toc:d}=mB(l);return{metadata:u,toc:d,chapters:c,spine:h}}function lB(r,e){let t={name:mo(r,0,32).replace(/\0+$/,""),type:mo(r,60,4),creator:mo(r,64,4),numRecords:go(e,76)},n=[];for(let i=0;i<t.numRecords;i++){let s=78+i*8;n.push({offset:lr(e,s),attributes:Wg(e,s+4)})}return{header:t,records:n}}function GE(r,e,t){let n=e[t].offset,i=t+1<e.length?e[t+1].offset:r.byteLength;return r.slice(n,i)}function cB(r,e){return{compression:go(e,0),numTextRecords:go(e,8),recordSize:go(e,10),encryption:go(e,12),magic:mo(r,16,4),encoding:lr(e,28),type:lr(e,24),titleOffset:lr(e,84),titleLength:lr(e,88),localeLanguage:Wg(e,95),localeRegion:Wg(e,94),resourceStart:lr(e,108),exthFlag:lr(e,128),trailingFlags:e.byteLength>240?lr(e,240):0}}function hB(r,e){if(!(e.exthFlag&64))return[];let n=16+lr(new DataView(r),20),i=new DataView(r,n);if(mo(r,n,4)!=="EXTH")return[];let a=lr(i,8),o=[],u=12;for(let l=0;l<a&&u<r.byteLength-n-8;l++){let c=lr(i,u),h=lr(i,u+4);if(h<8)break;let d=new TextDecoder().decode(new Uint8Array(r,n+u+8,h-8));o.push({type:c,data:d}),u+=h}return o}function dB(r,e,t,n){let i="Untitled";if(e.titleOffset&&e.titleLength)try{i=n.decode(new Uint8Array(r,e.titleOffset,e.titleLength))}catch{}let s=t.find(c=>c.type===503);s&&(i=s.data);let o=t.find(c=>c.type===100)?.data||null,l=uB[e.localeLanguage]?.[0]||"en";return{title:i,author:o,language:l}}function fB(r){let e=[];for(let t=0;t<r.length;t++){let n=r[t];if(n===0)e.push(0);else if(n<=8)for(let i of r.subarray(t+1,(t+=n)+1))e.push(i);else if(n<=127)e.push(n);else if(n<=191){let i=n<<8|r[++t],s=(i&16383)>>>3,a=(i&7)+3;for(let o=0;o<a;o++)e.push(e[e.length-s])}else e.push(32,n^128)}return Uint8Array.from(e)}function pB(r,e){let t=0;for(let n=15;n>0;n--)if(e&1<<n){let i=0;for(let s of r.subarray(r.length-t-4,r.length-t))s&128&&(i=0),i=i<<7|s&127;t+=i}if(e&1){let n=r[r.length-t-1];t+=(n&3)+1}return t}function gB(r,e,t,n){let i=[];for(let s=1;s<=t.numTextRecords;s++){let a=new Uint8Array(GE(r,e,s));if(t.trailingFlags){let u=pB(a,t.trailingFlags);u>0&&(a=a.subarray(0,a.length-u))}let o;t.compression===2?o=fB(a):o=a,i.push(n.decode(o))}return i.join("")}function mB(r){let e=new Map,t=[],n=[],i=o=>o.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim(),s=/(?:<mbp:pagebreak[^>]*\/?>|<h[12][^>]*>)/gi,a=r.split(s);if(a.length>1)for(let o=0;o<a.length;o++){let u=a[o].trim();if(!u)continue;let l=`chapter-${o}`,c=i(u),h=u.match(/<h[12][^>]*>(.*?)<\/h[12]>/i),d=h?i(h[1]):`Chapter ${t.length+1}`,f=Tl(u,c);e.set(l,{id:l,title:d,html:u,text:c,headings:f,keyTerms:Nr(c)}),t.push(l),n.push({id:l,title:d,index:n.length,href:"",level:0})}else{let u=i(r),l=Math.ceil(u.length/5e3);for(let c=0;c<l;c++){let h=`section-${c}`,d=c*5e3,f=u.slice(d,d+5e3),p=`Section ${c+1}`;e.set(h,{id:h,title:p,html:f,text:f,headings:[],keyTerms:Nr(f)}),t.push(h),n.push({id:h,title:p,index:c,href:"",level:0})}}return{chapters:e,spine:t,toc:n}}function Vg(r,e){let t=r.headings;if(t.length===0)throw new Error(`Chapter "${r.id}" has no structural headings. Use get_chapter to retrieve the full content instead.`);let n=e.trim().toLowerCase(),i=t.findIndex(s=>s.text.trim().toLowerCase()===n);if(i===-1&&(i=t.findIndex(s=>s.text.trim().toLowerCase().includes(n))),i===-1&&(i=t.findIndex(s=>n.includes(s.text.trim().toLowerCase()))),i===-1){let s=t.map(a=>` - "${a.text}" (h${a.level})`).join(`
146
+ `);throw new Error(`Heading "${e}" not found in chapter "${r.id}".
147
+ Available headings:
148
+ ${s}`)}return qE(r,t,i)}function Ic(r,e){let t=r.headings;if(t.length===0)throw new Error(`Chapter "${r.id}" has no structural headings. Use get_chapter to retrieve the full content instead.`);if(e<0||e>=t.length)throw new Error(`Section index ${e} is out of range. Valid range: 0-${t.length-1} (${t.length} headings)`);return qE(r,t,e)}function qE(r,e,t){let n=e[t],i=r.text.slice(n.offset,n.offset+n.length),s=i.split(/\s+/).filter(Boolean).length;return{heading:{level:n.level,text:n.text,index:t},content:i,wordCount:s,previousHeading:t>0?{text:e[t-1].text,index:t-1}:null,nextHeading:t<e.length-1?{text:e[t+1].text,index:t+1}:null}}var F=Symbol.for("drizzle:entityKind");function V(r,e){if(!r||typeof r!="object")return!1;if(r instanceof e)return!0;if(!Object.prototype.hasOwnProperty.call(e,F))throw new Error(`Class "${e.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let t=r.constructor;if(t)for(;t;){if(F in t&&t[F]===e[F])return!0;t=Object.getPrototypeOf(t)}return!1}var Gg=class{static[F]="ConsoleLogWriter";write(e){console.log(e)}},Rc=class{static[F]="DefaultLogger";writer;constructor(e){this.writer=e?.writer??new Gg}logQuery(e,t){let n=t.map(s=>{try{return JSON.stringify(s)}catch{return String(s)}}),i=n.length?` -- params: [${n.join(", ")}]`:"";this.writer.write(`Query: ${e}${i}`)}},Pc=class{static[F]="NoopLogger";logQuery(){}};var St=class{static[F]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}};var Oc=Symbol.for("drizzle:Name"),qg=Symbol.for("drizzle:Schema"),KE=Symbol.for("drizzle:Columns"),Kg=Symbol.for("drizzle:OriginalName"),Xg=Symbol.for("drizzle:BaseName"),XE=Symbol.for("drizzle:IsAlias"),YE=Symbol.for("drizzle:ExtraConfigBuilder"),QE=Symbol.for("drizzle:IsDrizzleTable"),re=class{static[F]="Table";static Symbol={Name:Oc,Schema:qg,OriginalName:Kg,Columns:KE,BaseName:Xg,IsAlias:XE,ExtraConfigBuilder:YE};[Oc];[Kg];[qg];[KE];[Xg];[XE]=!1;[YE]=void 0;[QE]=!0;constructor(e,t,n){this[Oc]=this[Kg]=e,this[qg]=t,this[Xg]=n}};function ZE(r){return typeof r=="object"&&r!==null&&QE in r}function Tn(r){return r[Oc]}function Lc(r,...e){return r(...e)}var JE="0.29.5";var Yg,Qg,Le={startActiveSpan(r,e){return Yg?(Qg||(Qg=Yg.trace.getTracer("drizzle-orm",JE)),Lc((t,n)=>n.startActiveSpan(r,i=>{try{return e(i)}catch(s){throw i.setStatus({code:t.SpanStatusCode.ERROR,message:s instanceof Error?s.message:"Unknown error"}),s}finally{i.end()}}),Yg,Qg)):e()}};var Ne=class{constructor(e,t){this.table=e,this.config=t,this.name=t.name,this.notNull=t.notNull,this.default=t.default,this.defaultFn=t.defaultFn,this.hasDefault=t.hasDefault,this.primary=t.primaryKey,this.isUnique=t.isUnique,this.uniqueName=t.uniqueName,this.uniqueType=t.uniqueType,this.dataType=t.dataType,this.columnType=t.columnType}static[F]="Column";name;primary;notNull;default;defaultFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}};var et=Symbol.for("drizzle:SubqueryConfig"),ct=class{static[F]="Subquery";[et];constructor(e,t,n,i=!1){this[et]={sql:e,selection:t,alias:n,isWith:i}}},bs=class extends ct{static[F]="WithSubquery"};var Ve=Symbol.for("drizzle:ViewBaseConfig");var eA=class{static[F]="FakePrimitiveParam"};function Zg(r){return typeof r=="object"&&r!==null&&"getSQL"in r&&typeof r.getSQL=="function"}function yB(r){let e={sql:"",params:[]};for(let t of r)e.sql+=t.sql,e.params.push(...t.params),t.typings?.length&&(e.typings||(e.typings=[]),e.typings.push(...t.typings));return e}var st=class{static[F]="StringChunk";value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new se([this])}},se=class r{constructor(e){this.queryChunks=e}static[F]="SQL";decoder=rA;shouldInlineParams=!1;append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return Le.startActiveSpan("drizzle.buildSQL",t=>{let n=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":n.sql,"drizzle.query.params":JSON.stringify(n.params)}),n})}buildQueryFromSourceParams(e,t){let n=Object.assign({},t,{inlineParams:t.inlineParams||this.shouldInlineParams,paramStartIndex:t.paramStartIndex||{value:0}}),{escapeName:i,escapeParam:s,prepareTyping:a,inlineParams:o,paramStartIndex:u}=n;return yB(e.map(l=>{if(V(l,st))return{sql:l.value.join(""),params:[]};if(V(l,bo))return{sql:i(l.value),params:[]};if(l===void 0)return{sql:"",params:[]};if(Array.isArray(l)){let c=[new st("(")];for(let[h,d]of l.entries())c.push(d),h<l.length-1&&c.push(new st(", "));return c.push(new st(")")),this.buildQueryFromSourceParams(c,n)}if(V(l,r))return this.buildQueryFromSourceParams(l.queryChunks,{...n,inlineParams:o||l.shouldInlineParams});if(V(l,re)){let c=l[re.Symbol.Schema],h=l[re.Symbol.Name];return{sql:c===void 0?i(h):i(c)+"."+i(h),params:[]}}if(V(l,Ne))return{sql:i(l.table[re.Symbol.Name])+"."+i(l.name),params:[]};if(V(l,Ot)){let c=l[Ve].schema,h=l[Ve].name;return{sql:c===void 0?i(h):i(c)+"."+i(h),params:[]}}if(V(l,Kt)){let c=l.value===null?null:l.encoder.mapToDriverValue(l.value);if(V(c,r))return this.buildQueryFromSourceParams([c],n);if(o)return{sql:this.mapInlineParam(c,n),params:[]};let h;return a!==void 0&&(h=[a(l.encoder)]),{sql:s(u.value++,c),params:[c],typings:h}}return V(l,oi)?{sql:s(u.value++,l),params:[l]}:V(l,r.Aliased)&&l.fieldAlias!==void 0?{sql:i(l.fieldAlias),params:[]}:V(l,ct)?l[et].isWith?{sql:i(l[et].alias),params:[]}:this.buildQueryFromSourceParams([new st("("),l[et].sql,new st(") "),new bo(l[et].alias)],n):Zg(l)?this.buildQueryFromSourceParams([new st("("),l.getSQL(),new st(")")],n):o?{sql:this.mapInlineParam(l,n),params:[]}:{sql:s(u.value++,l),params:[l]}}))}mapInlineParam(e,{escapeString:t}){if(e===null)return"null";if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="string")return t(e);if(typeof e=="object"){let n=e.toString();return t(n==="[object Object]"?JSON.stringify(e):n)}throw new Error("Unexpected param value: "+e)}getSQL(){return this}as(e){return e===void 0?this:new r.Aliased(this,e)}mapWith(e){return this.decoder=typeof e=="function"?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}},bo=class{constructor(e){this.value=e}static[F]="Name";brand;getSQL(){return new se([this])}};function tA(r){return typeof r=="object"&&r!==null&&"mapToDriverValue"in r&&typeof r.mapToDriverValue=="function"}var rA={mapFromDriverValue:r=>r},nA={mapToDriverValue:r=>r},Pj={...rA,...nA},Kt=class{constructor(e,t=nA){this.value=e,this.encoder=t}static[F]="Param";brand;getSQL(){return new se([this])}};function R(r,...e){let t=[];(e.length>0||r.length>0&&r[0]!=="")&&t.push(new st(r[0]));for(let[n,i]of e.entries())t.push(i,new st(r[n+1]));return new se(t)}(r=>{function e(){return new se([])}r.empty=e;function t(u){return new se(u)}r.fromList=t;function n(u){return new se([new st(u)])}r.raw=n;function i(u,l){let c=[];for(let[h,d]of u.entries())h>0&&l!==void 0&&c.push(l),c.push(d);return new se(c)}r.join=i;function s(u){return new bo(u)}r.identifier=s;function a(u){return new oi(u)}r.placeholder=a;function o(u,l){return new Kt(u,l)}r.param=o})(R||(R={}));(r=>{class e{constructor(n,i){this.sql=n,this.fieldAlias=i}static[F]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new e(this.sql,this.fieldAlias)}}r.Aliased=e})(se||(se={}));var oi=class{constructor(e){this.name=e}static[F]="Placeholder";getSQL(){return new se([this])}};function Jg(r,e){return r.map(t=>{if(V(t,oi)){if(!(t.name in e))throw new Error(`No value for placeholder "${t.name}" was provided`);return e[t.name]}return t})}var Ot=class{static[F]="View";[Ve];constructor({name:e,schema:t,selectedFields:n,query:i}){this[Ve]={name:e,originalName:e,schema:t,selectedFields:n,query:i,isExisting:!i,isAlias:!1}}getSQL(){return new se([this])}};Ne.prototype.getSQL=function(){return new se([this])};re.prototype.getSQL=function(){return new se([this])};ct.prototype.getSQL=function(){return new se([this])};function iA(r,e,t){let n={},i=r.reduce((s,{path:a,field:o},u)=>{let l;V(o,Ne)?l=o:V(o,se)?l=o.decoder:l=o.sql.decoder;let c=s;for(let[h,d]of a.entries())if(h<a.length-1)d in c||(c[d]={}),c=c[d];else{let f=e[u],p=c[d]=f===null?null:l.mapFromDriverValue(f);if(t&&V(o,Ne)&&a.length===2){let g=a[0];g in n?typeof n[g]=="string"&&n[g]!==Tn(o.table)&&(n[g]=!1):n[g]=p===null?Tn(o.table):!1}}return s},{});if(t&&Object.keys(n).length>0)for(let[s,a]of Object.entries(n))typeof a=="string"&&!t[a]&&(i[s]=null);return i}function cr(r,e){return Object.entries(r).reduce((t,[n,i])=>{if(typeof n!="string")return t;let s=e?[...e,n]:[n];return V(i,Ne)||V(i,se)||V(i,se.Aliased)?t.push({path:s,field:i}):V(i,re)?t.push(...cr(i[re.Symbol.Columns],s)):t.push(...cr(i,s)),t},[])}function em(r,e){let t=Object.keys(r),n=Object.keys(e);if(t.length!==n.length)return!1;for(let[i,s]of t.entries())if(s!==n[i])return!1;return!0}function Nc(r,e){let t=Object.entries(e).filter(([,n])=>n!==void 0).map(([n,i])=>V(i,se)?[n,i]:[n,new Kt(i,r[re.Symbol.Columns][n])]);if(t.length===0)throw new Error("No values to set");return Object.fromEntries(t)}function sA(r,e){for(let t of e)for(let n of Object.getOwnPropertyNames(t.prototype))n!=="constructor"&&Object.defineProperty(r.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n)||Object.create(null))}function aA(r){return r[re.Symbol.Columns]}function tm(r){return V(r,ct)?r[et].alias:V(r,Ot)?r[Ve].name:V(r,se)?void 0:r[re.Symbol.IsAlias]?r[re.Symbol.Name]:r[re.Symbol.BaseName]}var yo=class extends St{constructor(e,t,n,i){super(),this.session=t,this.dialect=n,this.config={table:e,withList:i}}static[F]="PgDelete";config;where(e){return this.config.where=e,this}returning(e=this.config.table[re.Symbol.Columns]){return this.config.returning=cr(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){return Le.startActiveSpan("drizzle.prepareQuery",()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e))}prepare(e){return this._prepare(e)}execute=e=>Le.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e));$dynamic(){return this}};var vo=class{constructor(e,t,n,i){this.table=e,this.session=t,this.dialect=n,this.withList=i}static[F]="PgInsertBuilder";values(e){if(e=Array.isArray(e)?e:[e],e.length===0)throw new Error("values() must be called with at least one value");let t=e.map(n=>{let i={},s=this.table[re.Symbol.Columns];for(let a of Object.keys(n)){let o=n[a];i[a]=V(o,se)?o:new Kt(o,s[a])}return i});return new rm(this.table,t,this.session,this.dialect,this.withList)}},rm=class extends St{constructor(e,t,n,i,s){super(),this.session=n,this.dialect=i,this.config={table:e,values:t,withList:s}}static[F]="PgInsert";config;returning(e=this.config.table[re.Symbol.Columns]){return this.config.returning=cr(e),this}onConflictDoNothing(e={}){if(e.target===void 0)this.config.onConflict=R`do nothing`;else{let t="";t=Array.isArray(e.target)?e.target.map(i=>this.dialect.escapeName(i.name)).join(","):this.dialect.escapeName(e.target.name);let n=e.where?R` where ${e.where}`:void 0;this.config.onConflict=R`(${R.raw(t)}) do nothing${n}`}return this}onConflictDoUpdate(e){let t=e.where?R` where ${e.where}`:void 0,n=this.dialect.buildUpdateSet(this.config.table,Nc(this.config.table,e.set)),i="";return i=Array.isArray(e.target)?e.target.map(s=>this.dialect.escapeName(s.name)).join(","):this.dialect.escapeName(e.target.name),this.config.onConflict=R`(${R.raw(i)}) do update set ${n}${t}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){return Le.startActiveSpan("drizzle.prepareQuery",()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e))}prepare(e){return this._prepare(e)}execute=e=>Le.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e));$dynamic(){return this}};var ui=class{constructor(e){this.table=e}static[F]="ColumnAliasProxyHandler";get(e,t){return t==="table"?this.table:e[t]}},ys=class{constructor(e,t){this.alias=e,this.replaceOriginalName=t}static[F]="TableAliasProxyHandler";get(e,t){if(t===re.Symbol.IsAlias)return!0;if(t===re.Symbol.Name)return this.alias;if(this.replaceOriginalName&&t===re.Symbol.OriginalName)return this.alias;if(t===Ve)return{...e[Ve],name:this.alias,isAlias:!0};if(t===re.Symbol.Columns){let i=e[re.Symbol.Columns];if(!i)return i;let s={};return Object.keys(i).map(a=>{s[a]=new Proxy(i[a],new ui(new Proxy(e,this)))}),s}let n=e[t];return V(n,Ne)?new Proxy(n,new ui(new Proxy(e,this))):n}},oA=class{constructor(e){this.alias=e}static[F]="RelationTableAliasProxyHandler";get(e,t){return t==="sourceTable"?wo(e.sourceTable,this.alias):e[t]}};function wo(r,e){return new Proxy(r,new ys(e,!1))}function Fr(r,e){return new Proxy(r,new ui(new Proxy(r.table,new ys(e,!1))))}function nm(r,e){return new se.Aliased(xo(r.sql,e),r.fieldAlias)}function xo(r,e){return R.join(r.queryChunks.map(t=>V(t,Ne)?Fr(t,e):V(t,se)?xo(t,e):V(t,se.Aliased)?nm(t,e):t))}var So=class extends Error{static[F]="DrizzleError";constructor({message:e,cause:t}){super(e),this.name="DrizzleError",this.cause=t}},Mc=class extends So{static[F]="TransactionRollbackError";constructor(){super({message:"Rollback"})}};var Bc=class{static[F]="ColumnBuilder";config;constructor(e,t,n){this.config={name:e,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:n}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}};var uA=Symbol.for("drizzle:PgInlineForeignKeys"),Lt=class extends re{static[F]="PgTable";static Symbol=Object.assign({},re.Symbol,{InlineForeignKeys:uA});[uA]=[];[re.Symbol.ExtraConfigBuilder]=void 0};var Dc=class{static[F]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(e,t){this.reference=()=>{let{name:n,columns:i,foreignColumns:s}=e();return{name:n,columns:i,foreignTable:s[0].table,foreignColumns:s}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e===void 0?"no action":e,this}onDelete(e){return this._onDelete=e===void 0?"no action":e,this}build(e){return new im(e,this)}},im=class{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static[F]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:n}=this.reference(),i=t.map(o=>o.name),s=n.map(o=>o.name),a=[this.table[Lt.Symbol.Name],...i,n[0].table[Lt.Symbol.Name],...s];return e??`${a.join("_")}_fk`}};function om(r,e){return`${r[Lt.Symbol.Name]}_${e.join("_")}_unique`}var sm=class{constructor(e,t){this.name=t,this.columns=e}static[F]="PgUniqueConstraintBuilder";columns;nullsNotDistinctConfig=!1;nullsNotDistinct(){return this.nullsNotDistinctConfig=!0,this}build(e){return new am(e,this.columns,this.nullsNotDistinctConfig,this.name)}},lA=class{static[F]="PgUniqueOnConstraintBuilder";name;constructor(e){this.name=e}on(...e){return new sm(e,this.name)}},am=class{constructor(e,t,n,i){this.table=e,this.columns=t,this.name=i??om(this.table,this.columns.map(s=>s.name)),this.nullsNotDistinct=n}static[F]="PgUniqueConstraint";columns;name;nullsNotDistinct=!1;getName(){return this.name}};function cA(r,e,t){for(let n=e;n<r.length;n++){let i=r[n];if(i==="\\"){n++;continue}if(i==='"')return[r.slice(e,n).replace(/\\/g,""),n+1];if(!t&&(i===","||i==="}"))return[r.slice(e,n).replace(/\\/g,""),n]}return[r.slice(e).replace(/\\/g,""),r.length]}function hA(r,e=0){let t=[],n=e,i=!1;for(;n<r.length;){let s=r[n];if(s===","){(i||n===e)&&t.push(""),i=!0,n++;continue}if(i=!1,s==="\\"){n+=2;continue}if(s==='"'){let[u,l]=cA(r,n+1,!0);t.push(u),n=l;continue}if(s==="}")return[t,n+1];if(s==="{"){let[u,l]=hA(r,n+1);t.push(u),n=l;continue}let[a,o]=cA(r,n,!1);t.push(a),n=o}return[t,n]}function dA(r){let[e]=hA(r,1);return e}function um(r){return`{${r.map(e=>Array.isArray(e)?um(e):typeof e=="string"?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${e}`).join(",")}}`}var Xt=class extends Bc{foreignKeyConfigs=[];static[F]="PgColumnBuilder";array(e){return new lm(this.config.name,this,e)}references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e,t){return this.config.isUnique=!0,this.config.uniqueName=e,this.config.uniqueType=t?.nulls,this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:n,actions:i})=>Lc((s,a)=>{let o=new Dc(()=>{let u=s();return{columns:[e],foreignColumns:[u]}});return a.onUpdate&&o.onUpdate(a.onUpdate),a.onDelete&&o.onDelete(a.onDelete),o.build(t)},n,i))}},Ge=class extends Ne{constructor(e,t){t.uniqueName||(t.uniqueName=om(e,[t.name])),super(e,t),this.table=e}static[F]="PgColumn"},lm=class extends Xt{static[F]="PgArrayBuilder";constructor(e,t,n){super(e,"array","PgArray"),this.config.baseBuilder=t,this.config.size=n}build(e){let t=this.config.baseBuilder.build(e);return new cm(e,this.config,t)}},cm=class r extends Ge{constructor(e,t,n,i){super(e,t),this.baseColumn=n,this.range=i,this.size=t.size}size;static[F]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size=="number"?this.size:""}]`}mapFromDriverValue(e){return typeof e=="string"&&(e=dA(e)),e.map(t=>this.baseColumn.mapFromDriverValue(t))}mapToDriverValue(e,t=!1){let n=e.map(i=>i===null?null:V(this.baseColumn,r)?this.baseColumn.mapToDriverValue(i,!0):this.baseColumn.mapToDriverValue(i));return t?n:um(n)}};var $r=class extends Xt{static[F]="PgDateColumnBaseBuilder";defaultNow(){return this.default(R`now()`)}};var fA=class extends $r{static[F]="PgDateBuilder";constructor(e){super(e,"date","PgDate")}build(e){return new Eo(e,this.config)}},Eo=class extends Ge{static[F]="PgDate";getSQLType(){return"date"}mapFromDriverValue(e){return new Date(e)}mapToDriverValue(e){return e.toISOString()}},pA=class extends $r{static[F]="PgDateStringBuilder";constructor(e){super(e,"string","PgDateString")}build(e){return new hm(e,this.config)}},hm=class extends Ge{static[F]="PgDateString";getSQLType(){return"date"}};var gA=class extends Xt{static[F]="PgJsonBuilder";constructor(e){super(e,"json","PgJson")}build(e){return new Ao(e,this.config)}},Ao=class extends Ge{static[F]="PgJson";constructor(e,t){super(e,t)}getSQLType(){return"json"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e}};var mA=class extends Xt{static[F]="PgJsonbBuilder";constructor(e){super(e,"json","PgJsonb")}build(e){return new To(e,this.config)}},To=class extends Ge{static[F]="PgJsonb";constructor(e,t){super(e,t)}getSQLType(){return"jsonb"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e}};var bA=class extends Xt{static[F]="PgNumericBuilder";constructor(e,t,n){super(e,"string","PgNumeric"),this.config.precision=t,this.config.scale=n}build(e){return new _o(e,this.config)}},_o=class extends Ge{static[F]="PgNumeric";precision;scale;constructor(e,t){super(e,t),this.precision=t.precision,this.scale=t.scale}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}};var yA=class extends $r{constructor(e,t,n){super(e,"string","PgTime"),this.withTimezone=t,this.precision=n,this.config.withTimezone=t,this.config.precision=n}static[F]="PgTimeBuilder";build(e){return new Co(e,this.config)}},Co=class extends Ge{static[F]="PgTime";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}};var vA=class extends $r{static[F]="PgTimestampBuilder";constructor(e,t,n){super(e,"date","PgTimestamp"),this.config.withTimezone=t,this.config.precision=n}build(e){return new ko(e,this.config)}},ko=class extends Ge{static[F]="PgTimestamp";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue=e=>new Date(this.withTimezone?e:e+"+0000");mapToDriverValue=e=>this.withTimezone?e.toUTCString():e.toISOString()},wA=class extends $r{static[F]="PgTimestampStringBuilder";constructor(e,t,n){super(e,"string","PgTimestampString"),this.config.withTimezone=t,this.config.precision=n}build(e){return new dm(e,this.config)}},dm=class extends Ge{static[F]="PgTimestampString";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}};var xA=class extends Xt{static[F]="PgUUIDBuilder";constructor(e){super(e,"string","PgUUID")}defaultRandom(){return this.default(R`gen_random_uuid()`)}build(e){return new Io(e,this.config)}},Io=class extends Ge{static[F]="PgUUID";getSQLType(){return"uuid"}};var Fc=class{static[F]="PgPrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new fm(e,this.columns,this.name)}},fm=class{constructor(e,t,n){this.table=e,this.columns=t,this.name=n}static[F]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[Lt.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}};function Ut(r,e){return tA(e)&&!Zg(r)&&!V(r,Kt)&&!V(r,oi)&&!V(r,Ne)&&!V(r,re)&&!V(r,Ot)?new Kt(r,e):r}var $c=(r,e)=>R`${r} = ${Ut(e,r)}`,SA=(r,e)=>R`${r} <> ${Ut(e,r)}`;function Ro(...r){let e=r.filter(t=>t!==void 0);if(e.length!==0)return e.length===1?new se(e):new se([new st("("),R.join(e,new st(" and ")),new st(")")])}function EA(...r){let e=r.filter(t=>t!==void 0);if(e.length!==0)return e.length===1?new se(e):new se([new st("("),R.join(e,new st(" or ")),new st(")")])}function AA(r){return R`not ${r}`}var TA=(r,e)=>R`${r} > ${Ut(e,r)}`,_A=(r,e)=>R`${r} >= ${Ut(e,r)}`,CA=(r,e)=>R`${r} < ${Ut(e,r)}`,kA=(r,e)=>R`${r} <= ${Ut(e,r)}`;function IA(r,e){if(Array.isArray(e)){if(e.length===0)throw new Error("inArray requires at least one value");return R`${r} in ${e.map(t=>Ut(t,r))}`}return R`${r} in ${Ut(e,r)}`}function RA(r,e){if(Array.isArray(e)){if(e.length===0)throw new Error("notInArray requires at least one value");return R`${r} not in ${e.map(t=>Ut(t,r))}`}return R`${r} not in ${Ut(e,r)}`}function PA(r){return R`${r} is null`}function OA(r){return R`${r} is not null`}function LA(r){return R`exists ${r}`}function NA(r){return R`not exists ${r}`}function MA(r,e,t){return R`${r} between ${Ut(e,r)} and ${Ut(t,r)}`}function BA(r,e,t){return R`${r} not between ${Ut(e,r)} and ${Ut(t,r)}`}function DA(r,e){return R`${r} like ${e}`}function FA(r,e){return R`${r} not like ${e}`}function $A(r,e){return R`${r} ilike ${e}`}function UA(r,e){return R`${r} not ilike ${e}`}function zA(r){return R`${r} asc`}function jA(r){return R`${r} desc`}var Uc=class{constructor(e,t,n){this.sourceTable=e,this.referencedTable=t,this.relationName=n,this.referencedTableName=t[re.Symbol.Name]}static[F]="Relation";referencedTableName;fieldName},pm=class{constructor(e,t){this.table=e,this.config=t}static[F]="Relations"},_n=class r extends Uc{constructor(e,t,n,i){super(e,t,n?.relationName),this.config=n,this.isNullable=i}static[F]="One";withFieldName(e){let t=new r(this.sourceTable,this.referencedTable,this.config,this.isNullable);return t.fieldName=e,t}},Po=class r extends Uc{constructor(e,t,n){super(e,t,n?.relationName),this.config=n}static[F]="Many";withFieldName(e){let t=new r(this.sourceTable,this.referencedTable,this.config);return t.fieldName=e,t}};function HA(){return{and:Ro,between:MA,eq:$c,exists:LA,gt:TA,gte:_A,ilike:$A,inArray:IA,isNull:PA,isNotNull:OA,like:DA,lt:CA,lte:kA,ne:SA,not:AA,notBetween:BA,notExists:NA,notLike:FA,notIlike:UA,notInArray:RA,or:EA,sql:R}}function WA(){return{sql:R,asc:zA,desc:jA}}function VA(r,e){Object.keys(r).length===1&&"default"in r&&!V(r.default,re)&&(r=r.default);let t={},n={},i={};for(let[s,a]of Object.entries(r))if(ZE(a)){let o=a[re.Symbol.Name],u=n[o];t[o]=s,i[s]={tsName:s,dbName:a[re.Symbol.Name],schema:a[re.Symbol.Schema],columns:a[re.Symbol.Columns],relations:u?.relations??{},primaryKey:u?.primaryKey??[]};for(let c of Object.values(a[re.Symbol.Columns]))c.primary&&i[s].primaryKey.push(c);let l=a[re.Symbol.ExtraConfigBuilder]?.(a);if(l)for(let c of Object.values(l))V(c,Fc)&&i[s].primaryKey.push(...c.columns)}else if(V(a,pm)){let o=a.table[re.Symbol.Name],u=t[o],l=a.config(e(a.table)),c;for(let[h,d]of Object.entries(l))if(u){let f=i[u];f.relations[h]=d,c&&f.primaryKey.push(...c)}else o in n||(n[o]={relations:{},primaryKey:c}),n[o].relations[h]=d}return{tables:i,tableNamesMap:t}}function vB(r){return function(t,n){return new _n(r,t,n,n?.fields.reduce((i,s)=>i&&s.notNull,!0)??!1)}}function wB(r){return function(t,n){return new Po(r,t,n)}}function GA(r,e,t){if(V(t,_n)&&t.config)return{fields:t.config.fields,references:t.config.references};let n=e[t.referencedTable[re.Symbol.Name]];if(!n)throw new Error(`Table "${t.referencedTable[re.Symbol.Name]}" not found in schema`);let i=r[n];if(!i)throw new Error(`Table "${n}" not found in schema`);let s=t.sourceTable,a=e[s[re.Symbol.Name]];if(!a)throw new Error(`Table "${s[re.Symbol.Name]}" not found in schema`);let o=[];for(let u of Object.values(i.relations))(t.relationName&&t!==u&&u.relationName===t.relationName||!t.relationName&&u.referencedTable===t.sourceTable)&&o.push(u);if(o.length>1)throw t.relationName?new Error(`There are multiple relations with name "${t.relationName}" in table "${n}"`):new Error(`There are multiple relations between "${n}" and "${t.sourceTable[re.Symbol.Name]}". Please specify relation name`);if(o[0]&&V(o[0],_n)&&o[0].config)return{fields:o[0].config.references,references:o[0].config.fields};throw new Error(`There is not enough information to infer relation "${a}.${t.fieldName}"`)}function qA(r){return{one:vB(r),many:wB(r)}}function zc(r,e,t,n,i=s=>s){let s={};for(let[a,o]of n.entries())if(o.isJson){let u=e.relations[o.tsKey],l=t[a],c=typeof l=="string"?JSON.parse(l):l;s[o.tsKey]=V(u,_n)?c&&zc(r,r[o.relationTableTsKey],c,o.selection,i):c.map(h=>zc(r,r[o.relationTableTsKey],h,o.selection,i))}else{let u=i(t[a]),l=o.field,c;V(l,Ne)?c=l:V(l,se)?c=l.decoder:c=l.sql.decoder,s[o.tsKey]=u===null?null:c.mapFromDriverValue(u)}return s}var vs=class extends Ot{static[F]="PgViewBase"};var ws=class{static[F]="PgDialect";async migrate(e,t,n){let i=typeof n=="string"?"__drizzle_migrations":n.migrationsTable??"__drizzle_migrations",s=typeof n=="string"?"drizzle":n.migrationsSchema??"drizzle",a=R`
149
+ CREATE TABLE IF NOT EXISTS ${R.identifier(s)}.${R.identifier(i)} (
150
+ id SERIAL PRIMARY KEY,
151
+ hash text NOT NULL,
152
+ created_at bigint
153
+ )
154
+ `;await t.execute(R`CREATE SCHEMA IF NOT EXISTS ${R.identifier(s)}`),await t.execute(a);let u=(await t.all(R`select id, hash, created_at from ${R.identifier(s)}.${R.identifier(i)} order by created_at desc limit 1`))[0];await t.transaction(async l=>{for await(let c of e)if(!u||Number(u.created_at)<c.folderMillis){for(let h of c.sql)await l.execute(R.raw(h));await l.execute(R`insert into ${R.identifier(s)}.${R.identifier(i)} ("hash", "created_at") values(${c.hash}, ${c.folderMillis})`)}})}escapeName(e){return`"${e}"`}escapeParam(e){return`$${e+1}`}escapeString(e){return`'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;let t=[R`with `];for(let[n,i]of e.entries())t.push(R`${R.identifier(i[et].alias)} as (${i[et].sql})`),n<e.length-1&&t.push(R`, `);return t.push(R` `),R.join(t)}buildDeleteQuery({table:e,where:t,returning:n,withList:i}){let s=this.buildWithCTE(i),a=n?R` returning ${this.buildSelection(n,{isSingleTable:!0})}`:void 0,o=t?R` where ${t}`:void 0;return R`${s}delete from ${e}${o}${a}`}buildUpdateSet(e,t){let n=Object.entries(t),i=n.length;return R.join(n.flatMap(([s,a],o)=>{let u=e[re.Symbol.Columns][s],l=R`${R.identifier(u.name)} = ${a}`;return o<i-1?[l,R.raw(", ")]:[l]}))}buildUpdateQuery({table:e,set:t,where:n,returning:i,withList:s}){let a=this.buildWithCTE(s),o=this.buildUpdateSet(e,t),u=i?R` returning ${this.buildSelection(i,{isSingleTable:!0})}`:void 0,l=n?R` where ${n}`:void 0;return R`${a}update ${e} set ${o}${l}${u}`}buildSelection(e,{isSingleTable:t=!1}={}){let n=e.length,i=e.flatMap(({field:s},a)=>{let o=[];if(V(s,se.Aliased)&&s.isSelectionField)o.push(R.identifier(s.fieldAlias));else if(V(s,se.Aliased)||V(s,se)){let u=V(s,se.Aliased)?s.sql:s;t?o.push(new se(u.queryChunks.map(l=>V(l,Ge)?R.identifier(l.name):l))):o.push(u),V(s,se.Aliased)&&o.push(R` as ${R.identifier(s.fieldAlias)}`)}else V(s,Ne)&&(t?o.push(R.identifier(s.name)):o.push(s));return a<n-1&&o.push(R`, `),o});return R.join(i)}buildSelectQuery({withList:e,fields:t,fieldsFlat:n,where:i,having:s,table:a,joins:o,orderBy:u,groupBy:l,limit:c,offset:h,lockingClause:d,distinct:f,setOperators:p}){let g=n??cr(t);for(let M of g)if(V(M.field,Ne)&&Tn(M.field.table)!==(V(a,ct)?a[et].alias:V(a,vs)?a[Ve].name:V(a,se)?void 0:Tn(a))&&!(L=>o?.some(({alias:N})=>N===(L[re.Symbol.IsAlias]?Tn(L):L[re.Symbol.BaseName])))(M.field.table)){let L=Tn(M.field.table);throw new Error(`Your "${M.path.join("->")}" field references a column "${L}"."${M.field.name}", but the table "${L}" is not part of the query! Did you forget to join it?`)}let b=!o||o.length===0,m=this.buildWithCTE(e),y;f&&(y=f===!0?R` distinct`:R` distinct on (${R.join(f.on,R`, `)})`);let v=this.buildSelection(g,{isSingleTable:b}),x=(()=>{if(V(a,re)&&a[re.Symbol.OriginalName]!==a[re.Symbol.Name]){let M=R`${R.identifier(a[re.Symbol.OriginalName])}`;return a[re.Symbol.Schema]&&(M=R`${R.identifier(a[re.Symbol.Schema])}.${M}`),R`${M} ${R.identifier(a[re.Symbol.Name])}`}return a})(),w=[];if(o)for(let[M,L]of o.entries()){M===0&&w.push(R` `);let N=L.table,I=L.lateral?R` lateral`:void 0;if(V(N,Lt)){let H=N[Lt.Symbol.Name],J=N[Lt.Symbol.Schema],ee=N[Lt.Symbol.OriginalName],X=H===ee?void 0:L.alias;w.push(R`${R.raw(L.joinType)} join${I} ${J?R`${R.identifier(J)}.`:void 0}${R.identifier(ee)}${X&&R` ${R.identifier(X)}`} on ${L.on}`)}else if(V(N,Ot)){let H=N[Ve].name,J=N[Ve].schema,ee=N[Ve].originalName,X=H===ee?void 0:L.alias;w.push(R`${R.raw(L.joinType)} join${I} ${J?R`${R.identifier(J)}.`:void 0}${R.identifier(ee)}${X&&R` ${R.identifier(X)}`} on ${L.on}`)}else w.push(R`${R.raw(L.joinType)} join${I} ${N} on ${L.on}`);M<o.length-1&&w.push(R` `)}let S=R.join(w),E=i?R` where ${i}`:void 0,_=s?R` having ${s}`:void 0,T;u&&u.length>0&&(T=R` order by ${R.join(u,R`, `)}`);let k;l&&l.length>0&&(k=R` group by ${R.join(l,R`, `)}`);let A=c?R` limit ${c}`:void 0,B=h?R` offset ${h}`:void 0,D=R.empty();if(d){let M=R` for ${R.raw(d.strength)}`;d.config.of&&M.append(R` of ${R.join(Array.isArray(d.config.of)?d.config.of:[d.config.of],R`, `)}`),d.config.noWait?M.append(R` no wait`):d.config.skipLocked&&M.append(R` skip locked`),D.append(M)}let P=R`${m}select${y} ${v} from ${x}${S}${E}${k}${_}${T}${A}${B}${D}`;return p.length>0?this.buildSetOperations(P,p):P}buildSetOperations(e,t){let[n,...i]=t;if(!n)throw new Error("Cannot pass undefined values to any set operator");return i.length===0?this.buildSetOperationQuery({leftSelect:e,setOperator:n}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:n}),i)}buildSetOperationQuery({leftSelect:e,setOperator:{type:t,isAll:n,rightSelect:i,limit:s,orderBy:a,offset:o}}){let u=R`(${e.getSQL()}) `,l=R`(${i.getSQL()})`,c;if(a&&a.length>0){let p=[];for(let g of a)if(V(g,Ge))p.push(R.identifier(g.name));else if(V(g,se)){for(let b=0;b<g.queryChunks.length;b++){let m=g.queryChunks[b];V(m,Ge)&&(g.queryChunks[b]=R.identifier(m.name))}p.push(R`${g}`)}else p.push(R`${g}`);c=R` order by ${R.join(p,R`, `)} `}let h=s?R` limit ${s}`:void 0,d=R.raw(`${t} ${n?"all ":""}`),f=o?R` offset ${o}`:void 0;return R`${u}${d}${l}${c}${h}${f}`}buildInsertQuery({table:e,values:t,onConflict:n,returning:i,withList:s}){let a=[],o=e[re.Symbol.Columns],u=Object.entries(o),l=u.map(([,p])=>R.identifier(p.name));for(let[p,g]of t.entries()){let b=[];for(let[m,y]of u){let v=g[m];if(v===void 0||V(v,Kt)&&v.value===void 0)if(y.defaultFn!==void 0){let x=y.defaultFn(),w=V(x,se)?x:R.param(x,y);b.push(w)}else b.push(R`default`);else b.push(v)}a.push(b),p<t.length-1&&a.push(R`, `)}let c=this.buildWithCTE(s),h=R.join(a),d=i?R` returning ${this.buildSelection(i,{isSingleTable:!0})}`:void 0,f=n?R` on conflict ${n}`:void 0;return R`${c}insert into ${e} ${l} values ${h}${f}${d}`}buildRefreshMaterializedViewQuery({view:e,concurrently:t,withNoData:n}){let i=t?R` concurrently`:void 0,s=n?R` with no data`:void 0;return R`refresh materialized view${i} ${e}${s}`}prepareTyping(e){return V(e,To)||V(e,Ao)?"json":V(e,_o)?"decimal":V(e,Co)?"time":V(e,ko)?"timestamp":V(e,Eo)?"date":V(e,Io)?"uuid":"none"}sqlToQuery(e){return e.toQuery({escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,prepareTyping:this.prepareTyping})}buildRelationalQueryWithoutPK({fullSchema:e,schema:t,tableNamesMap:n,table:i,tableConfig:s,queryConfig:a,tableAlias:o,nestedQueryRelation:u,joinOn:l}){let c=[],h,d,f=[],p,g=[];if(a===!0)c=Object.entries(s.columns).map(([y,v])=>({dbKey:v.name,tsKey:y,field:Fr(v,o),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let m=Object.fromEntries(Object.entries(s.columns).map(([E,_])=>[E,Fr(_,o)]));if(a.where){let E=typeof a.where=="function"?a.where(m,HA()):a.where;p=E&&xo(E,o)}let y=[],v=[];if(a.columns){let E=!1;for(let[_,T]of Object.entries(a.columns))T!==void 0&&_ in s.columns&&(!E&&T===!0&&(E=!0),v.push(_));v.length>0&&(v=E?v.filter(_=>a.columns?.[_]===!0):Object.keys(s.columns).filter(_=>!v.includes(_)))}else v=Object.keys(s.columns);for(let E of v){let _=s.columns[E];y.push({tsKey:E,value:_})}let x=[];a.with&&(x=Object.entries(a.with).filter(E=>!!E[1]).map(([E,_])=>({tsKey:E,queryConfig:_,relation:s.relations[E]})));let w;if(a.extras){w=typeof a.extras=="function"?a.extras(m,{sql:R}):a.extras;for(let[E,_]of Object.entries(w))y.push({tsKey:E,value:nm(_,o)})}for(let{tsKey:E,value:_}of y)c.push({dbKey:V(_,se.Aliased)?_.fieldAlias:s.columns[E].name,tsKey:E,field:V(_,Ne)?Fr(_,o):_,relationTableTsKey:void 0,isJson:!1,selection:[]});let S=typeof a.orderBy=="function"?a.orderBy(m,WA()):a.orderBy??[];Array.isArray(S)||(S=[S]),f=S.map(E=>V(E,Ne)?Fr(E,o):xo(E,o)),h=a.limit,d=a.offset;for(let{tsKey:E,queryConfig:_,relation:T}of x){let k=GA(t,n,T),A=T.referencedTable[re.Symbol.Name],B=n[A],D=`${o}_${E}`,P=Ro(...k.fields.map((N,I)=>$c(Fr(k.references[I],D),Fr(N,o)))),M=this.buildRelationalQueryWithoutPK({fullSchema:e,schema:t,tableNamesMap:n,table:e[B],tableConfig:t[B],queryConfig:V(T,_n)?_===!0?{limit:1}:{..._,limit:1}:_,tableAlias:D,joinOn:P,nestedQueryRelation:T}),L=R`${R.identifier(D)}.${R.identifier("data")}`.as(E);g.push({on:R`true`,table:new ct(M.sql,{},D),alias:D,joinType:"left",lateral:!0}),c.push({dbKey:E,tsKey:E,field:L,relationTableTsKey:B,isJson:!0,selection:M.selection})}}if(c.length===0)throw new So({message:`No fields selected for table "${s.tsName}" ("${o}")`});let b;if(p=Ro(l,p),u){let m=R`json_build_array(${R.join(c.map(({field:x,tsKey:w,isJson:S})=>S?R`${R.identifier(`${o}_${w}`)}.${R.identifier("data")}`:V(x,se.Aliased)?x.sql:x),R`, `)})`;V(u,Po)&&(m=R`coalesce(json_agg(${m}${f.length>0?R` order by ${R.join(f,R`, `)}`:void 0}), '[]'::json)`);let y=[{dbKey:"data",tsKey:"data",field:m.as("data"),isJson:!0,relationTableTsKey:s.tsName,selection:c}];h!==void 0||d!==void 0||f.length>0?(b=this.buildSelectQuery({table:wo(i,o),fields:{},fieldsFlat:[{path:[],field:R.raw("*")}],where:p,limit:h,offset:d,orderBy:f,setOperators:[]}),p=void 0,h=void 0,d=void 0,f=[]):b=wo(i,o),b=this.buildSelectQuery({table:V(b,Lt)?b:new ct(b,{},o),fields:{},fieldsFlat:y.map(({field:x})=>({path:[],field:V(x,Ne)?Fr(x,o):x})),joins:g,where:p,limit:h,offset:d,orderBy:f,setOperators:[]})}else b=this.buildSelectQuery({table:wo(i,o),fields:{},fieldsFlat:c.map(({field:m})=>({path:[],field:V(m,Ne)?Fr(m,o):m})),joins:g,where:p,limit:h,offset:d,orderBy:f,setOperators:[]});return{tableTsKey:s.tsName,sql:b,selection:c}}};var jc=class{static[F]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}};var zt=class r{static[F]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(e,t){if(t===et)return{...e[et],selection:new Proxy(e[et].selection,this)};if(t===Ve)return{...e[Ve],selectedFields:new Proxy(e[Ve].selectedFields,this)};if(typeof t=="symbol")return e[t];let i=(V(e,ct)?e[et].selection:V(e,Ot)?e[Ve].selectedFields:e)[t];if(V(i,se.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!i.isSelectionField)return i.sql;let s=i.clone();return s.isSelectionField=!0,s}if(V(i,se)){if(this.config.sqlBehavior==="sql")return i;throw new Error(`You tried to reference "${t}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return V(i,Ne)?this.config.alias?new Proxy(i,new ui(new Proxy(i.table,new ys(this.config.alias,this.config.replaceOriginalName??!1)))):i:typeof i!="object"||i===null?i:new Proxy(i,new r(this.config))}};var Et=class{static[F]="PgSelectBuilder";fields;session;dialect;withList=[];distinct;constructor(e){this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,e.withList&&(this.withList=e.withList),this.distinct=e.distinct}from(e){let t=!!this.fields,n;return this.fields?n=this.fields:V(e,ct)?n=Object.fromEntries(Object.keys(e[et].selection).map(i=>[i,e[i]])):V(e,vs)?n=e[Ve].selectedFields:V(e,se)?n={}:n=aA(e),new Hc({table:e,fields:n,isPartialSelect:t,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}},gm=class extends jc{static[F]="PgSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;constructor({table:e,fields:t,isPartialSelect:n,session:i,dialect:s,withList:a,distinct:o}){super(),this.config={withList:a,table:e,fields:{...t},distinct:o,setOperators:[]},this.isPartialSelect=n,this.session=i,this.dialect=s,this._={selectedFields:t},this.tableName=tm(e),this.joinsNotNullableMap=typeof this.tableName=="string"?{[this.tableName]:!0}:{}}createJoin(e){return(t,n)=>{let i=this.tableName,s=tm(t);if(typeof s=="string"&&this.config.joins?.some(a=>a.alias===s))throw new Error(`Alias "${s}" is already used in this query`);if(!this.isPartialSelect&&(Object.keys(this.joinsNotNullableMap).length===1&&typeof i=="string"&&(this.config.fields={[i]:this.config.fields}),typeof s=="string"&&!V(t,se))){let a=V(t,ct)?t[et].selection:V(t,Ot)?t[Ve].selectedFields:t[re.Symbol.Columns];this.config.fields[s]=a}if(typeof n=="function"&&(n=n(new Proxy(this.config.fields,new zt({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:n,table:t,joinType:e,alias:s}),typeof s=="string")switch(e){case"left":{this.joinsNotNullableMap[s]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([a])=>[a,!1])),this.joinsNotNullableMap[s]=!0;break}case"inner":{this.joinsNotNullableMap[s]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([a])=>[a,!1])),this.joinsNotNullableMap[s]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");createSetOperator(e,t){return n=>{let i=typeof n=="function"?n(xB()):n;if(!em(this.getSelectedFields(),i.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:i}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);intersectAll=this.createSetOperator("intersect",!0);except=this.createSetOperator("except",!1);exceptAll=this.createSetOperator("except",!0);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new zt({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new zt({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if(typeof e[0]=="function"){let t=e[0](new Proxy(this.config.fields,new zt({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if(typeof e[0]=="function"){let t=e[0](new Proxy(this.config.fields,new zt({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),n=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=n:this.config.orderBy=n}else{let t=e;this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=t:this.config.orderBy=t}return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}for(e,t={}){return this.config.lockingClause={strength:e,config:t},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){return new Proxy(new ct(this.getSQL(),this.config.fields,e),new zt({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new zt({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}},Hc=class extends gm{static[F]="PgSelect";_prepare(e){let{session:t,config:n,dialect:i,joinsNotNullableMap:s}=this;if(!t)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");return Le.startActiveSpan("drizzle.prepareQuery",()=>{let a=cr(n.fields),o=t.prepareQuery(i.sqlToQuery(this.getSQL()),a,e);return o.joinsNotNullableMap=s,o})}prepare(e){return this._prepare(e)}execute=e=>Le.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e))};sA(Hc,[St]);function xs(r,e){return(t,n,...i)=>{let s=[n,...i].map(a=>({type:r,isAll:e,rightSelect:a}));for(let a of s)if(!em(t.getSelectedFields(),a.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return t.addSetOperators(s)}}var xB=()=>({union:SB,unionAll:EB,intersect:AB,intersectAll:TB,except:_B,exceptAll:CB}),SB=xs("union",!1),EB=xs("union",!0),AB=xs("intersect",!1),TB=xs("intersect",!0),_B=xs("except",!1),CB=xs("except",!0);var Wc=class{static[F]="PgQueryBuilder";dialect;$with(e){let t=this;return{as(n){return typeof n=="function"&&(n=n(t)),new Proxy(new bs(n.getSQL(),n.getSelectedFields(),e,!0),new zt({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}}with(...e){let t=this;function n(a){return new Et({fields:a??void 0,session:void 0,dialect:t.getDialect(),withList:e})}function i(a){return new Et({fields:a??void 0,session:void 0,dialect:t.getDialect(),distinct:!0})}function s(a,o){return new Et({fields:o??void 0,session:void 0,dialect:t.getDialect(),distinct:{on:a}})}return{select:n,selectDistinct:i,selectDistinctOn:s}}select(e){return new Et({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new Et({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn(e,t){return new Et({fields:t??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:e}})}getDialect(){return this.dialect||(this.dialect=new ws),this.dialect}};var Vc=class extends St{constructor(e,t,n){super(),this.session=t,this.dialect=n,this.config={view:e}}static[F]="PgRefreshMaterializedView";config;concurrently(){if(this.config.withNoData!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.concurrently=!0,this}withNoData(){if(this.config.concurrently!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.withNoData=!0,this}getSQL(){return this.dialect.buildRefreshMaterializedViewQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){return Le.startActiveSpan("drizzle.prepareQuery",()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),void 0,e))}prepare(e){return this._prepare(e)}execute=e=>Le.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e))};var Oo=class{constructor(e,t,n,i){this.table=e,this.session=t,this.dialect=n,this.withList=i}static[F]="PgUpdateBuilder";set(e){return new mm(this.table,Nc(this.table,e),this.session,this.dialect,this.withList)}},mm=class extends St{constructor(e,t,n,i,s){super(),this.session=n,this.dialect=i,this.config={set:t,table:e,withList:s}}static[F]="PgUpdate";config;where(e){return this.config.where=e,this}returning(e=this.config.table[re.Symbol.Columns]){return this.config.returning=cr(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e)}prepare(e){return this._prepare(e)}execute=e=>this._prepare().execute(e);$dynamic(){return this}};var Gc=class{constructor(e,t,n,i,s,a,o){this.fullSchema=e,this.schema=t,this.tableNamesMap=n,this.table=i,this.tableConfig=s,this.dialect=a,this.session=o}static[F]="PgRelationalQueryBuilder";findMany(e){return new qc(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many")}findFirst(e){return new qc(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first")}},qc=class extends St{constructor(e,t,n,i,s,a,o,u,l){super(),this.fullSchema=e,this.schema=t,this.tableNamesMap=n,this.table=i,this.tableConfig=s,this.dialect=a,this.session=o,this.config=u,this.mode=l}static[F]="PgRelationalQuery";_prepare(e){return Le.startActiveSpan("drizzle.prepareQuery",()=>{let{query:t,builtQuery:n}=this._toSQL();return this.session.prepareQuery(n,void 0,e,(i,s)=>{let a=i.map(o=>zc(this.schema,this.tableConfig,o,t.selection,s));return this.mode==="first"?a[0]:a})})}prepare(e){return this._prepare(e)}_getQuery(){return this.dialect.buildRelationalQueryWithoutPK({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName})}getSQL(){return this._getQuery().sql}_toSQL(){let e=this._getQuery(),t=this.dialect.sqlToQuery(e.sql);return{query:e,builtQuery:t}}toSQL(){return this._toSQL().builtQuery}execute(){return Le.startActiveSpan("drizzle.operation",()=>this._prepare().execute())}};var Kc=class extends St{constructor(e,t,n,i){super(),this.execute=e,this.sql=t,this.query=n,this.mapBatchResult=i}static[F]="PgRaw";getSQL(){return this.sql}getQuery(){return this.query}mapResult(e,t){return t?this.mapBatchResult(e):e}_prepare(){return this}};var Ss=class{constructor(e,t,n){if(this.dialect=e,this.session=t,this._=n?{schema:n.schema,tableNamesMap:n.tableNamesMap}:{schema:void 0,tableNamesMap:{}},this.query={},this._.schema)for(let[i,s]of Object.entries(this._.schema))this.query[i]=new Gc(n.fullSchema,this._.schema,this._.tableNamesMap,n.fullSchema[i],s,e,t)}static[F]="PgDatabase";query;$with(e){return{as(t){return typeof t=="function"&&(t=t(new Wc)),new Proxy(new bs(t.getSQL(),t.getSelectedFields(),e,!0),new zt({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}}with(...e){let t=this;function n(l){return new Et({fields:l??void 0,session:t.session,dialect:t.dialect,withList:e})}function i(l){return new Et({fields:l??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:!0})}function s(l,c){return new Et({fields:c??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:{on:l}})}function a(l){return new Oo(l,t.session,t.dialect,e)}function o(l){return new vo(l,t.session,t.dialect,e)}function u(l){return new yo(l,t.session,t.dialect,e)}return{select:n,selectDistinct:i,selectDistinctOn:s,update:a,insert:o,delete:u}}select(e){return new Et({fields:e??void 0,session:this.session,dialect:this.dialect})}selectDistinct(e){return new Et({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:!0})}selectDistinctOn(e,t){return new Et({fields:t??void 0,session:this.session,dialect:this.dialect,distinct:{on:e}})}update(e){return new Oo(e,this.session,this.dialect)}insert(e){return new vo(e,this.session,this.dialect)}delete(e){return new yo(e,this.session,this.dialect)}refreshMaterializedView(e){return new Vc(e,this.session,this.dialect)}execute(e){let t=e.getSQL(),n=this.dialect.sqlToQuery(t),i=this.session.prepareQuery(n,void 0,void 0);return new Kc(()=>i.execute(),t,n,s=>i.mapResult(s,!1))}transaction(e,t){return this.session.transaction(e,t)}};var Xc=class{constructor(e){this.query=e}getQuery(){return this.query}mapResult(e,t){return e}static[F]="PgPreparedQuery";joinsNotNullableMap},Yc=class{constructor(e){this.dialect=e}static[F]="PgSession";execute(e){return Le.startActiveSpan("drizzle.operation",()=>Le.startActiveSpan("drizzle.prepareQuery",()=>this.prepareQuery(this.dialect.sqlToQuery(e),void 0,void 0)).execute())}all(e){return this.prepareQuery(this.dialect.sqlToQuery(e),void 0,void 0).all()}},Qc=class extends Ss{constructor(e,t,n,i=0){super(e,t,n),this.schema=n,this.nestedIndex=i}static[F]="PgTransaction";rollback(){throw new Mc}getTransactionConfigSQL(e){let t=[];return e.isolationLevel&&t.push(`isolation level ${e.isolationLevel}`),e.accessMode&&t.push(e.accessMode),typeof e.deferrable=="boolean"&&t.push(e.deferrable?"deferrable":"not deferrable"),R.raw(t.join(" "))}setTransaction(e){return this.session.execute(R`set transaction ${this.getTransactionConfigSQL(e)}`)}};var bm=class extends Xc{constructor(e,t,n,i,s,a){super({sql:t,params:n}),this.client=e,this.queryString=t,this.params=n,this.logger=i,this.fields=s,this.customResultMapper=a}static[F]="PostgresJsPreparedQuery";async execute(e={}){return Le.startActiveSpan("drizzle.execute",async t=>{let n=Jg(this.params,e);t?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(n)}),this.logger.logQuery(this.queryString,n);let{fields:i,queryString:s,client:a,joinsNotNullableMap:o,customResultMapper:u}=this;if(!i&&!u)return Le.startActiveSpan("drizzle.driver.execute",()=>a.unsafe(s,n));let l=await Le.startActiveSpan("drizzle.driver.execute",()=>(t?.setAttributes({"drizzle.query.text":s,"drizzle.query.params":JSON.stringify(n)}),a.unsafe(s,n).values()));return Le.startActiveSpan("drizzle.mapResponse",()=>u?u(l):l.map(c=>iA(i,c,o)))})}all(e={}){return Le.startActiveSpan("drizzle.execute",async t=>{let n=Jg(this.params,e);return t?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(n)}),this.logger.logQuery(this.queryString,n),Le.startActiveSpan("drizzle.driver.execute",()=>(t?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(n)}),this.client.unsafe(this.queryString,n)))})}},Lo=class r extends Yc{constructor(e,t,n,i={}){super(t),this.client=e,this.schema=n,this.options=i,this.logger=i.logger??new Pc}static[F]="PostgresJsSession";logger;prepareQuery(e,t,n,i){return new bm(this.client,e.sql,e.params,this.logger,t,i)}query(e,t){return this.logger.logQuery(e,t),this.client.unsafe(e,t).values()}queryObjects(e,t){return this.client.unsafe(e,t)}transaction(e,t){return this.client.begin(async n=>{let i=new r(n,this.dialect,this.schema,this.options),s=new ym(this.dialect,i,this.schema);return t&&await s.setTransaction(t),e(s)})}},ym=class r extends Qc{constructor(e,t,n,i=0){super(e,t,n,i),this.session=t}static[F]="PostgresJsTransaction";transaction(e){return this.session.client.savepoint(t=>{let n=new Lo(t,this.dialect,this.schema,this.session.options),i=new r(this.dialect,n,this.schema);return e(i)})}};function KA(r,e={}){let t=new ws,n;e.logger===!0?n=new Rc:e.logger!==!1&&(n=e.logger);let i;if(e.schema){let a=VA(e.schema,qA);i={fullSchema:e.schema,schema:a.tables,tableNamesMap:a.tableNamesMap}}let s=new Lo(r,t,i,{logger:n});return new Ss(t,s,i)}import QB from"os";import ZB from"fs";var Zc=new Map,vm=new Map,wm=Symbol("OriginError"),Es={},Yt=class extends Promise{constructor(e,t,n,i,s={}){let a,o;super((u,l)=>{a=u,o=l}),this.tagged=Array.isArray(e.raw),this.strings=e,this.args=t,this.handler=n,this.canceller=i,this.options=s,this.state=null,this.statement=null,this.resolve=u=>(this.active=!1,a(u)),this.reject=u=>(this.active=!1,o(u)),this.active=!1,this.cancelled=null,this.executed=!1,this.signature="",this[wm]=this.handler.debug?new Error:this.tagged&&kB(this.strings)}get origin(){return(this.handler.debug?this[wm].stack:this.tagged&&vm.has(this.strings)?vm.get(this.strings):vm.set(this.strings,this[wm].stack).get(this.strings))||""}static get[Symbol.species](){return Promise}cancel(){return this.canceller&&(this.canceller(this),this.canceller=null)}simple(){return this.options.simple=!0,this.options.prepare=!1,this}async readable(){return this.simple(),this.streaming=!0,this}async writable(){return this.simple(),this.streaming=!0,this}cursor(e=1,t){if(this.options.simple=!1,typeof e=="function"&&(t=e,e=1),this.cursorRows=e,typeof t=="function")return this.cursorFn=t,this;let n;return{[Symbol.asyncIterator]:()=>({next:()=>{if(this.executed&&!this.active)return{done:!0};n&&n();let i=new Promise((s,a)=>{this.cursorFn=o=>(s({value:o,done:!1}),new Promise(u=>n=u)),this.resolve=()=>(this.active=!1,s({done:!0})),this.reject=o=>(this.active=!1,a(o))});return this.execute(),i},return(){return n&&n(Es),{done:!0}}})}}describe(){return this.options.simple=!1,this.onlyDescribe=this.options.prepare=!0,this}stream(){throw new Error(".stream has been renamed to .forEach")}forEach(e){return this.forEachFn=e,this.handle(),this}raw(){return this.isRaw=!0,this}values(){return this.isRaw="values",this}async handle(){!this.executed&&(this.executed=!0)&&await 1&&this.handler(this)}execute(){return this.handle(),this}then(){return this.handle(),super.then.apply(this,arguments)}catch(){return this.handle(),super.catch.apply(this,arguments)}finally(){return this.handle(),super.finally.apply(this,arguments)}};function kB(r){if(Zc.has(r))return Zc.get(r);let e=Error.stackTraceLimit;return Error.stackTraceLimit=4,Zc.set(r,new Error),Error.stackTraceLimit=e,Zc.get(r)}var li=class extends Error{constructor(e){super(e.message),this.name=this.constructor.name,Object.assign(this,e)}},Xe={connection:XA,postgres:YA,generic:QA,notSupported:ZA};function XA(r,e,t){let{host:n,port:i}=t||e,s=Object.assign(new Error("write "+r+" "+(e.path||n+":"+i)),{code:r,errno:r,address:e.path||n},e.path?{}:{port:i});return Error.captureStackTrace(s,XA),s}function YA(r){let e=new li(r);return Error.captureStackTrace(e,YA),e}function QA(r,e){let t=Object.assign(new Error(r+": "+e),{code:r});return Error.captureStackTrace(t,QA),t}function ZA(r){let e=Object.assign(new Error(r+" (B) is not supported"),{code:"MESSAGE_NOT_SUPPORTED",name:r});return Error.captureStackTrace(e,ZA),e}var IB={string:{to:25,from:null,serialize:r=>""+r},number:{to:0,from:[21,23,26,700,701],serialize:r=>""+r,parse:r=>+r},json:{to:114,from:[114,3802],serialize:r=>JSON.stringify(r),parse:r=>JSON.parse(r)},boolean:{to:16,from:16,serialize:r=>r===!0?"t":"f",parse:r=>r==="t"},date:{to:1184,from:[1082,1114,1184],serialize:r=>(r instanceof Date?r:new Date(r)).toISOString(),parse:r=>new Date(r)},bytea:{to:17,from:17,serialize:r=>"\\x"+Buffer.from(r).toString("hex"),parse:r=>Buffer.from(r.slice(2),"hex")}},No=class{then(){xm()}catch(){xm()}finally(){xm()}},As=class extends No{constructor(e){super(),this.value=rh(e)}},xr=class extends No{constructor(e,t,n){super(),this.value=e,this.type=t,this.array=n}},Mo=class extends No{constructor(e,t){super(),this.first=e,this.rest=t}build(e,t,n,i){let s=RB.map(([a,o])=>({fn:o,i:e.search(a)})).sort((a,o)=>a.i-o.i).pop();return s.i===-1?_m(this.first,i):s.fn(this.first,this.rest,t,n,i)}};function th(r,e,t,n){let i=r instanceof xr?r.value:r;if(i===void 0&&(r instanceof xr?r.value=n.transform.undefined:i=r=n.transform.undefined,i===void 0))throw Xe.generic("UNDEFINED_VALUE","Undefined values are not allowed");return"$"+t.push(r instanceof xr?(e.push(r.value),r.array?r.array[r.type||eh(r.value)]||r.type||rT(r.value):r.type):(e.push(r),eh(r)))}var eT=iT(IB);function Am(r,e,t,n,i,s){for(let a=1;a<r.strings.length;a++)e+=Tm(e,t,n,i,s)+r.strings[a],t=r.args[a];return e}function Tm(r,e,t,n,i){return e instanceof Mo?e.build(r,t,n,i):e instanceof Yt?Em(e,t,n,i):e instanceof As?e.value:e&&e[0]instanceof Yt?e.reduce((s,a)=>s+" "+Em(a,t,n,i),""):th(e,t,n,i)}function Em(r,e,t,n){return r.fragment=!0,Am(r,r.strings[0],r.args[0],e,t,n)}function tT(r,e,t,n,i){return r.map(s=>"("+n.map(a=>Tm("values",s[a],e,t,i)).join(",")+")").join(",")}function JA(r,e,t,n,i){let s=Array.isArray(r[0]),a=e.length?e.flat():Object.keys(s?r[0]:r);return tT(s?r:[r],t,n,a,i)}function Jc(r,e,t,n,i){if(typeof r=="string"&&(r=[r].concat(e)),Array.isArray(r))return _m(r,i);let s;return(e.length?e.flat():Object.keys(r)).map(o=>(s=r[o],(s instanceof Yt?Em(s,t,n,i):s instanceof As?s.value:th(s,t,n,i))+" as "+rh(i.transform.column.to?i.transform.column.to(o):o))).join(",")}var RB=Object.entries({values:JA,in:(...r)=>{let e=JA(...r);return e==="()"?"(null)":e},select:Jc,as:Jc,returning:Jc,"\\(":Jc,update(r,e,t,n,i){return(e.length?e.flat():Object.keys(r)).map(s=>rh(i.transform.column.to?i.transform.column.to(s):s)+"="+Tm("values",r[s],t,n,i))},insert(r,e,t,n,i){let s=e.length?e.flat():Object.keys(Array.isArray(r)?r[0]:r);return"("+_m(s,i)+")values"+tT(Array.isArray(r)?r:[r],t,n,s,i)}}).map(([r,e])=>[new RegExp("((?:^|[\\s(])"+r+"(?:$|[\\s(]))(?![\\s\\S]*\\1)","i"),e]);function xm(){throw Xe.generic("NOT_TAGGED_CALL","Query not called as a tagged template literal")}var PB=eT.serializers,OB=eT.parsers;function rT(r){return Array.isArray(r)?rT(r[0]):typeof r=="string"?1009:0}var nT=function(r){let e=iT(r||{});return{serializers:Object.assign({},PB,e.serializers),parsers:Object.assign({},OB,e.parsers)}};function iT(r){return Object.keys(r).reduce((e,t)=>(r[t].from&&[].concat(r[t].from).forEach(n=>e.parsers[n]=r[t].parse),r[t].serialize&&(e.serializers[r[t].to]=r[t].serialize,r[t].from&&[].concat(r[t].from).forEach(n=>e.serializers[n]=r[t].serialize)),e),{parsers:{},serializers:{}})}function _m(r,{transform:{column:e}}){return r.map(t=>rh(e.to?e.to(t):t)).join(",")}var rh=function(e){return'"'+e.replace(/"/g,'""').replace(/\./g,'"."')+'"'},eh=function r(e){return e instanceof xr?e.type:e instanceof Date?1184:e instanceof Uint8Array?17:e===!0||e===!1?16:typeof e=="bigint"?20:Array.isArray(e)?r(e[0]):0},LB=/\\/g,NB=/"/g;function MB(r){return r.replace(LB,"\\\\").replace(NB,'\\"')}var sT=function r(e,t,n,i){if(Array.isArray(e)===!1)return e;if(!e.length)return"{}";let s=e[0],a=i===1020?";":",";return Array.isArray(s)&&!s.type?"{"+e.map(o=>r(o,t,n,i)).join(a)+"}":"{"+e.map(o=>{if(o===void 0&&(o=n.transform.undefined,o===void 0))throw Xe.generic("UNDEFINED_VALUE","Undefined values are not allowed");return o===null?"null":'"'+MB(t?t(o.type?o.value:o):""+o)+'"'}).join(a)+"}"},Sm={i:0,char:null,str:"",quoted:!1,last:0},aT=function(e,t,n){return Sm.i=Sm.last=0,oT(Sm,e,t,n)};function oT(r,e,t,n){let i=[],s=n===1020?";":",";for(;r.i<e.length;r.i++){if(r.char=e[r.i],r.quoted)r.char==="\\"?r.str+=e[++r.i]:r.char==='"'?(i.push(t?t(r.str):r.str),r.str="",r.quoted=e[r.i+1]==='"',r.last=r.i+2):r.str+=r.char;else if(r.char==='"')r.quoted=!0;else if(r.char==="{")r.last=++r.i,i.push(oT(r,e,t,n));else if(r.char==="}"){r.quoted=!1,r.last<r.i&&i.push(t?t(e.slice(r.last,r.i)):e.slice(r.last,r.i)),r.last=r.i+1;break}else r.char===s&&r.p!=="}"&&r.p!=='"'&&(i.push(t?t(e.slice(r.last,r.i)):e.slice(r.last,r.i)),r.last=r.i+1);r.p=r.char}return r.last<r.i&&i.push(t?t(e.slice(r.last,r.i+1)):e.slice(r.last,r.i+1)),i}var ci=r=>{let e=r[0];for(let t=1;t<r.length;t++)e+=r[t]==="_"?r[++t].toUpperCase():r[t];return e},hi=r=>{let e=r[0].toUpperCase();for(let t=1;t<r.length;t++)e+=r[t]==="_"?r[++t].toUpperCase():r[t];return e},di=r=>r.replace(/_/g,"-"),Bo=r=>r.replace(/([A-Z])/g,"_$1").toLowerCase(),Do=r=>(r.slice(0,1)+r.slice(1).replace(/([A-Z])/g,"_$1")).toLowerCase(),Fo=r=>r.replace(/-/g,"_");function Cm(r){return function e(t,n){return typeof t=="object"&&t!==null&&(n.type===114||n.type===3802)?Array.isArray(t)?t.map(i=>e(i,n)):Object.entries(t).reduce((i,[s,a])=>Object.assign(i,{[r(s)]:e(a,n)}),{}):t}}ci.column={from:ci};ci.value={from:Cm(ci)};Bo.column={to:Bo};var km={...ci};km.column.to=Bo;hi.column={from:hi};hi.value={from:Cm(hi)};Do.column={to:Do};var Im={...hi};Im.column.to=Do;di.column={from:di};di.value={from:Cm(di)};Fo.column={to:Fo};var Rm={...di};Rm.column.to=Fo;import uT from"net";import $B from"tls";import $o from"crypto";import Pm from"stream";import{performance as lT}from"perf_hooks";var Cn=class extends Array{constructor(){super(),Object.defineProperties(this,{count:{value:null,writable:!0},state:{value:null,writable:!0},command:{value:null,writable:!0},columns:{value:null,writable:!0},statement:{value:null,writable:!0}})}static get[Symbol.species](){return Array}};var Qt=BB;function BB(r=[]){let e=r.slice(),t=0;return{get length(){return e.length-t},remove:n=>{let i=e.indexOf(n);return i===-1?null:(e.splice(i,1),n)},push:n=>(e.push(n),n),shift:()=>{let n=e[t++];return t===e.length?(t=0,e=[]):e[t-1]=void 0,n}}}var At=Buffer.allocUnsafe(256),DB="BCcDdEFfHPpQSX".split("").reduce((r,e)=>{let t=e.charCodeAt(0);return r[e]=()=>(At[0]=t,Pe.i=5,Pe),r},{}),Pe=Object.assign(FB,DB,{N:"\0",i:0,inc(r){return Pe.i+=r,Pe},str(r){let e=Buffer.byteLength(r);return nh(e),Pe.i+=At.write(r,Pe.i,e,"utf8"),Pe},i16(r){return nh(2),At.writeUInt16BE(r,Pe.i),Pe.i+=2,Pe},i32(r,e){return e||e===0?(At.writeUInt32BE(r,e),Pe):(nh(4),At.writeUInt32BE(r,Pe.i),Pe.i+=4,Pe)},z(r){return nh(r),At.fill(0,Pe.i,Pe.i+r),Pe.i+=r,Pe},raw(r){return At=Buffer.concat([At.subarray(0,Pe.i),r]),Pe.i=At.length,Pe},end(r=1){At.writeUInt32BE(Pe.i-r,r);let e=At.subarray(0,Pe.i);return Pe.i=0,At=Buffer.allocUnsafe(256),e}}),ae=Pe;function nh(r){if(At.length-Pe.i<r){let e=At,t=e.length;At=Buffer.allocUnsafe(t+(t>>1)+r),e.copy(At)}}function FB(){return Pe.i=0,Pe}var Lm=dT,UB=1,kn=ae().S().end(),cT=ae().H().end(),zB=ae().i32(8).i32(80877103).end(8),jB=Buffer.concat([ae().E().str(ae.N).i32(0).end(),kn]),HB=ae().D().str("S").str(ae.N).end(),Ts=()=>{},WB=new Set(["FetchPreparedStatement","RevalidateCachedQuery","transformAssignedExpr"]),VB={83:"severity_local",86:"severity",67:"code",77:"message",68:"detail",72:"hint",80:"position",112:"internal_position",113:"internal_query",87:"where",115:"schema_name",116:"table_name",99:"column_name",100:"data type_name",110:"constraint_name",70:"file",76:"line",82:"routine"};function dT(r,e={},{onopen:t=Ts,onend:n=Ts,onclose:i=Ts}={}){let{sslnegotiation:s,ssl:a,max:o,user:u,host:l,port:c,database:h,parsers:d,transform:f,onnotice:p,onnotify:g,onparameter:b,max_pipeline:m,keep_alive:y,backoff:v,target_session_attrs:x}=r,w=Qt(),S=UB++,E={pid:null,secret:null},_=Om(wh,r.idle_timeout),T=Om(wh,r.max_lifetime),k=Om(h_,r.connect_timeout),A=null,B,D=null,P=new Cn,M=Buffer.alloc(0),L=r.fetch_types,N={},I={},H=Math.random().toString(36).slice(2),J=1,ee=0,X=0,q=0,ie=0,pe=0,W=0,$=0,G=null,Y=null,me=!1,ne=null,ye=null,he=null,be=null,de=null,Ae=null,hr=null,Rn=null,K=null,Cs=null,mt={queue:e.closed,idleTimer:_,connect(C){he=C,Gm()},terminate:Rs,execute:ks,cancel:o_,end:wh,count:0,id:S};return e.closed&&e.closed.push(mt),mt;async function a_(){let C;try{C=r.socket?await Promise.resolve(r.socket(r)):new uT.Socket}catch(O){pi(O);return}return C.on("error",pi),C.on("close",qm),C.on("drain",Wm),C}async function o_({pid:C,secret:O},oe,Se){try{B=ae().i32(16).i32(80877102).i32(C).i32(O).end(16),await Vm(),A.once("error",Se),A.once("close",oe)}catch(qe){Se(qe)}}function ks(C){if(me)return Is(C,Xe.connection("CONNECTION_DESTROYED",r));if(de)return Is(C,Xe.generic("COPY_IN_PROGRESS","You cannot execute queries during copy"));if(!C.cancelled)try{return C.state=E,K?w.push(C):(K=C,K.active=!0),c_(C),ht(u_(C))&&!C.describeFirst&&!C.cursorFn&&w.length<m&&(!C.options.onexecute||C.options.onexecute(mt))}catch(O){return w.length===0&&ht(kn),Zt(O),!0}}function u_(C){if(C.parameters.length>=65534)throw Xe.generic("MAX_PARAMETERS_EXCEEDED","Max number of parameters (65534) exceeded");return C.options.simple?ae().Q().str(C.statement.string+ae.N).end():C.describeFirst?Buffer.concat([zm(C),cT]):C.prepare?C.prepared?Ho(C):Buffer.concat([zm(C),Ho(C)]):l_(C)}function zm(C){return Buffer.concat([Xm(C.statement.string,C.parameters,C.statement.types,C.statement.name),X_("S",C.statement.name)])}function Ho(C){return Buffer.concat([K_(C.parameters,C.statement.types,C.statement.name,C.cursorName),C.cursorFn?Ym("",C.cursorRows):jB])}function l_(C){return Buffer.concat([Xm(C.statement.string,C.parameters,C.statement.types),HB,Ho(C)])}function c_(C){let O=[],oe=[],Se=Am(C,C.strings[0],C.args[0],O,oe,r);!C.tagged&&C.args.forEach(qe=>th(qe,O,oe,r)),C.prepare=r.prepare&&("prepare"in C.options?C.options.prepare:!0),C.string=Se,C.signature=C.prepare&&oe+Se,C.onlyDescribe&&delete I[C.signature],C.parameters=C.parameters||O,C.prepared=C.prepare&&C.signature in I,C.describeFirst=C.onlyDescribe||O.length&&!C.prepared,C.statement=C.prepared?I[C.signature]:{string:Se,types:oe,name:C.prepare?H+J++:""},typeof r.debug=="function"&&r.debug(S,Se,O,oe)}function ht(C,O){return Ae=Ae?Buffer.concat([Ae,C]):Buffer.from(C),O||Ae.length>=1024?jm(O):(Y===null&&(Y=setImmediate(jm)),!0)}function jm(C){let O=A.write(Ae,C);return Y!==null&&clearImmediate(Y),Ae=Y=null,O}function h_(){Zt(Xe.connection("CONNECT_TIMEOUT",r,A)),A.destroy()}async function Hm(){if(s!=="direct"&&(ht(zB),!await new Promise(oe=>A.once("data",Se=>oe(Se[0]===83)))&&a==="prefer"))return fi();let C={socket:A,servername:uT.isIP(A.host)?void 0:A.host};s==="direct"&&(C.ALPNProtocols=["postgresql"]),a==="require"||a==="allow"||a==="prefer"?C.rejectUnauthorized=!1:typeof a=="object"&&Object.assign(C,a),A.removeAllListeners(),A=$B.connect(C),A.on("secureConnect",fi),A.on("error",pi),A.on("close",qm),A.on("drain",Wm)}function Wm(){!K&&t(mt)}function vh(C){if(!(ne&&(ne.push(C),X-=C.length,X>0)))for(M=ne?Buffer.concat(ne,pe-X):M.length===0?C:Buffer.concat([M,C],M.length+C.length);M.length>4;){if(pe=M.readUInt32BE(1),pe>=M.length){X=pe-M.length,ne=[M];break}try{d_(M.subarray(0,pe+1))}catch(O){K&&(K.cursorFn||K.describeFirst)&&ht(kn),Zt(O)}M=M.subarray(pe+1),X=0,ne=null}}async function Vm(){if(me=!1,N={},A||(A=await a_()),!!A){if(k.start(),r.socket)return a?Hm():fi();if(A.on("connect",a?Hm:fi),r.path)return A.connect(r.path);A.ssl=a,A.connect(c[q],l[q]),A.host=l[q],A.port=c[q],q=(q+1)%c.length}}function Gm(){setTimeout(Vm,ee?Math.max(0,ee+W-lT.now()):0)}function fi(){try{I={},L=r.fetch_types,H=Math.random().toString(36).slice(2),J=1,T.start(),A.on("data",vh),y&&A.setKeepAlive&&A.setKeepAlive(!0,1e3*y);let C=Q_();ht(C)}catch(C){pi(C)}}function pi(C){if(!(mt.queue===e.connecting&&r.host[ie+1]))for(Zt(C);w.length;)Is(w.shift(),C)}function Zt(C){de&&(de.destroy(C),de=null),K&&Is(K,C),he&&(Is(he,C),he=null)}function Is(C,O){if(C.reserve)return C.reject(O);(!O||typeof O!="object")&&(O=new Error(O)),"query"in O||"parameters"in O||Object.defineProperties(O,{stack:{value:O.stack+C.origin.replace(/.*\n/,`
155
+ `),enumerable:r.debug},query:{value:C.string,enumerable:r.debug},parameters:{value:C.parameters,enumerable:r.debug},args:{value:C.args,enumerable:r.debug},types:{value:C.statement&&C.statement.types,enumerable:r.debug}}),C.reject(O)}function wh(){return be||(!mt.reserved&&n(mt),!mt.reserved&&!he&&!K&&w.length===0?(Rs(),new Promise(C=>A&&A.readyState!=="closed"?A.once("close",C):C())):be=new Promise(C=>hr=C))}function Rs(){me=!0,(de||K||he||w.length)&&pi(Xe.connection("CONNECTION_DESTROYED",r)),clearImmediate(Y),A&&(A.removeListener("data",vh),A.removeListener("connect",fi),A.readyState==="open"&&A.end(ae().X().end())),hr&&(hr(),be=hr=null)}async function qm(C){if(M=Buffer.alloc(0),X=0,ne=null,clearImmediate(Y),A.removeListener("data",vh),A.removeListener("connect",fi),_.cancel(),T.cancel(),k.cancel(),A.removeAllListeners(),A=null,he)return Gm();!C&&(K||w.length)&&pi(Xe.connection("CONNECTION_CLOSED",r,A)),ee=lT.now(),C&&r.shared.retries++,W=(typeof v=="function"?v(r.shared.retries):v)*1e3,i(mt,Xe.connection("CONNECTION_CLOSED",r,A))}function d_(C,O=C[0]){(O===68?f_:O===100?U_:O===65?N_:O===83?p_:O===90?g_:O===67?m_:O===50?Km:O===49?b_:O===116?y_:O===84?v_:O===82?w_:O===110?__:O===75?C_:O===69?O_:O===115?M_:O===51?B_:O===71?D_:O===78?j_:O===72?F_:O===99?z_:O===73?H_:O===86?W_:O===118?V_:O===87?$_:G_)(C)}function f_(C){let O=7,oe,Se,qe,bt=K.isRaw?new Array(K.statement.columns.length):{};for(let _t=0;_t<K.statement.columns.length;_t++)Se=K.statement.columns[_t],oe=C.readInt32BE(O),O+=4,qe=oe===-1?null:K.isRaw===!0?C.subarray(O,O+=oe):Se.parser===void 0?C.toString("utf8",O,O+=oe):Se.parser.array===!0?Se.parser(C.toString("utf8",O+1,O+=oe)):Se.parser(C.toString("utf8",O,O+=oe)),K.isRaw?bt[_t]=K.isRaw===!0?qe:f.value.from?f.value.from(qe,Se):qe:bt[Se.name]=f.value.from?f.value.from(qe,Se):qe;K.forEachFn?K.forEachFn(f.row.from?f.row.from(bt):bt,P):P[$++]=f.row.from?f.row.from(bt):bt}function p_(C){let[O,oe]=C.toString("utf8",5,C.length-1).split(ae.N);N[O]=oe,r.parameters[O]!==oe&&(r.parameters[O]=oe,b&&b(O,oe))}function g_(C){if(K?D?K.retried?Zt(K.retried):K.prepared&&WB.has(D.routine)?L_(K,D):Zt(D):K.resolve(ye||P):D&&Zt(D),K=ye=D=null,P=new Cn,k.cancel(),he){if(x){if(!N.in_hot_standby||!N.default_transaction_read_only)return P_();if(R_(x,N))return Rs()}if(L)return he.reserve&&(he=null),k_();he&&!he.reserve&&ks(he),r.shared.retries=ie=0,he=null;return}for(;w.length&&(K=w.shift())&&(K.active=!0,K.cancelled);)dT(r).cancel(K.state,K.cancelled.resolve,K.cancelled.reject);K||(mt.reserved?!mt.reserved.release&&C[5]===73?be?Rs():(mt.reserved=null,t(mt)):mt.reserved():be?Rs():t(mt))}function m_(C){$=0;for(let O=C.length-1;O>0;O--)if(C[O]===32&&C[O+1]<58&&P.count===null&&(P.count=+C.toString("utf8",O+1,C.length-1)),C[O-1]>=65){P.command=C.toString("utf8",5,O),P.state=E;break}if(Cs&&(Cs(),Cs=null),P.command==="BEGIN"&&o!==1&&!mt.reserved)return Zt(Xe.generic("UNSAFE_TRANSACTION","Only use sql.begin, sql.reserved or max: 1"));if(K.options.simple)return Km();K.cursorFn&&(P.count&&K.cursorFn(P),ht(kn))}function b_(){K.parsing=!1}function Km(){!P.statement&&(P.statement=K.statement),P.columns=K.statement.columns}function y_(C){let O=C.readUInt16BE(5);for(let oe=0;oe<O;++oe)!K.statement.types[oe]&&(K.statement.types[oe]=C.readUInt32BE(7+oe*4));K.prepare&&(I[K.signature]=K.statement),K.describeFirst&&!K.onlyDescribe&&(ht(Ho(K)),K.describeFirst=!1)}function v_(C){P.command&&(ye=ye||[P],ye.push(P=new Cn),P.count=null,K.statement.columns=null);let O=C.readUInt16BE(5),oe=7,Se;K.statement.columns=Array(O);for(let qe=0;qe<O;++qe){for(Se=oe;C[oe++]!==0;);let bt=C.readUInt32BE(oe),_t=C.readUInt16BE(oe+4),un=C.readUInt32BE(oe+6);K.statement.columns[qe]={name:f.column.from?f.column.from(C.toString("utf8",Se,oe-1)):C.toString("utf8",Se,oe-1),parser:d[un],table:bt,number:_t,type:un},oe+=18}if(P.statement=K.statement,K.onlyDescribe)return K.resolve(K.statement),ht(kn)}async function w_(C,O=C.readUInt32BE(5)){(O===3?x_:O===5?S_:O===10?E_:O===11?A_:O===12?T_:O!==0?q_:Ts)(C,O)}async function x_(){let C=await xh();ht(ae().p().str(C).z(1).end())}async function S_(C){let O="md5"+await hT(Buffer.concat([Buffer.from(await hT(await xh()+u)),C.subarray(9)]));ht(ae().p().str(O).z(1).end())}async function E_(){Rn=(await $o.randomBytes(18)).toString("base64"),ae().p().str("SCRAM-SHA-256"+ae.N);let C=ae.i;ht(ae.inc(4).str("n,,n=*,r="+Rn).i32(ae.i-C-4,C).end())}async function A_(C){let O=C.toString("utf8",9).split(",").reduce((_t,un)=>(_t[un[0]]=un.slice(2),_t),{}),oe=await $o.pbkdf2Sync(await xh(),Buffer.from(O.s,"base64"),parseInt(O.i),32,"sha256"),Se=await sh(oe,"Client Key"),qe="n=*,r="+Rn+",r="+O.r+",s="+O.s+",i="+O.i+",c=biws,r="+O.r;G=(await sh(await sh(oe,"Server Key"),qe)).toString("base64");let bt="c=biws,r="+O.r+",p="+qB(Se,Buffer.from(await sh(await GB(Se),qe))).toString("base64");ht(ae().p().str(bt).end())}function T_(C){C.toString("utf8",9).split(ae.N,1)[0].slice(2)!==G&&(Zt(Xe.generic("SASL_SIGNATURE_MISMATCH","The server did not return the correct signature")),A.destroy())}function xh(){return Promise.resolve(typeof r.pass=="function"?r.pass():r.pass)}function __(){if(P.statement=K.statement,P.statement.columns=[],K.onlyDescribe)return K.resolve(K.statement),ht(kn)}function C_(C){E.pid=C.readUInt32BE(5),E.secret=C.readUInt32BE(9)}async function k_(){L=!1,(await new Yt([`
156
+ select b.oid, b.typarray
157
+ from pg_catalog.pg_type a
158
+ left join pg_catalog.pg_type b on b.oid = a.typelem
159
+ where a.typcategory = 'A'
160
+ group by b.oid, b.typarray
161
+ order by b.oid
162
+ `],[],ks)).forEach(({oid:O,typarray:oe})=>I_(O,oe))}function I_(C,O){if(r.parsers[O]&&r.serializers[O])return;let oe=r.parsers[C];r.shared.typeArrayMap[C]=O,r.parsers[O]=Se=>aT(Se,oe,O),r.parsers[O].array=!0,r.serializers[O]=Se=>sT(Se,r.serializers[C],r,O)}function R_(C,O){return C==="read-write"&&O.default_transaction_read_only==="on"||C==="read-only"&&O.default_transaction_read_only==="off"||C==="primary"&&O.in_hot_standby==="on"||C==="standby"&&O.in_hot_standby==="off"||C==="prefer-standby"&&O.in_hot_standby==="off"&&r.host[ie]}function P_(){let C=new Yt([`
163
+ show transaction_read_only;
164
+ select pg_catalog.pg_is_in_recovery()
165
+ `],[],ks,null,{simple:!0});C.resolve=([[O],[oe]])=>{N.default_transaction_read_only=O.transaction_read_only,N.in_hot_standby=oe.pg_is_in_recovery?"on":"off"},C.execute()}function O_(C){K?((K.cursorFn||K.describeFirst)&&ht(kn),D=Xe.postgres(ih(C))):Zt(Xe.postgres(ih(C)))}function L_(C,O){delete I[C.signature],C.retried=O,ks(C)}function N_(C){if(!g)return;let O=9;for(;C[O++]!==0;);g(C.toString("utf8",9,O-1),C.toString("utf8",O,C.length-1))}async function M_(){try{let C=await Promise.resolve(K.cursorFn(P));$=0,C===Es?ht(Y_(K.portal)):(P=new Cn,ht(Ym("",K.cursorRows)))}catch(C){ht(kn),K.reject(C)}}function B_(){P.count&&K.cursorFn(P),K.resolve(P)}function D_(){de=new Pm.Writable({autoDestroy:!0,write(C,O,oe){A.write(ae().d().raw(C).end(),oe)},destroy(C,O){O(C),A.write(ae().f().str(C+ae.N).end()),de=null},final(C){A.write(ae().c().end()),Cs=C,de=null}}),K.resolve(de)}function F_(){de=new Pm.Readable({read(){A.resume()}}),K.resolve(de)}function $_(){de=new Pm.Duplex({autoDestroy:!0,read(){A.resume()},write(C,O,oe){A.write(ae().d().raw(C).end(),oe)},destroy(C,O){O(C),A.write(ae().f().str(C+ae.N).end()),de=null},final(C){A.write(ae().c().end()),Cs=C}}),K.resolve(de)}function U_(C){de&&(de.push(C.subarray(5))||A.pause())}function z_(){de&&de.push(null),de=null}function j_(C){p?p(ih(C)):console.log(ih(C))}function H_(){}function W_(){Zt(Xe.notSupported("FunctionCallResponse"))}function V_(){Zt(Xe.notSupported("NegotiateProtocolVersion"))}function G_(C){console.error("Postgres.js : Unknown Message:",C[0])}function q_(C,O){console.error("Postgres.js : Unknown Auth:",O)}function K_(C,O,oe="",Se=""){let qe,bt;return ae().B().str(Se+ae.N).str(oe+ae.N).i16(0).i16(C.length),C.forEach((_t,un)=>{if(_t===null)return ae.i32(4294967295);bt=O[un],C[un]=_t=bt in r.serializers?r.serializers[bt](_t):""+_t,qe=ae.i,ae.inc(4).str(_t).i32(ae.i-qe-4,qe)}),ae.i16(0),ae.end()}function Xm(C,O,oe,Se=""){return ae().P().str(Se+ae.N).str(C+ae.N).i16(O.length),O.forEach((qe,bt)=>ae.i32(oe[bt]||0)),ae.end()}function X_(C,O=""){return ae().D().str(C).str(O+ae.N).end()}function Ym(C="",O=0){return Buffer.concat([ae().E().str(C+ae.N).i32(O).end(),cT])}function Y_(C=""){return Buffer.concat([ae().C().str("P").str(C+ae.N).end(),ae().S().end()])}function Q_(){return B||ae().inc(4).i16(3).z(2).str(Object.entries(Object.assign({user:u,database:h,client_encoding:"UTF8"},r.connection)).filter(([,C])=>C).map(([C,O])=>C+ae.N+O).join(ae.N)).z(2).end(0)}}function ih(r){let e={},t=5;for(let n=5;n<r.length-1;n++)r[n]===0&&(e[VB[r[t]]]=r.toString("utf8",t+1,n),t=n+1);return e}function hT(r){return $o.createHash("md5").update(r).digest("hex")}function sh(r,e){return $o.createHmac("sha256",r).update(e).digest()}function GB(r){return $o.createHash("sha256").update(r).digest()}function qB(r,e){let t=Math.max(r.length,e.length),n=Buffer.allocUnsafe(t);for(let i=0;i<t;i++)n[i]=r[i]^e[i];return n}function Om(r,e){if(e=typeof e=="function"?e():e,!e)return{cancel:Ts,start:Ts};let t;return{cancel(){t&&(clearTimeout(t),t=null)},start(){t&&clearTimeout(t),t=setTimeout(n,e*1e3,arguments)}};function n(i){r.apply(null,i),t=null}}var fT=()=>{};function Nm(r,e){let t=new Map,n="postgresjs_"+Math.random().toString(36).slice(2),i={},s,a,o=!1,u=h.sql=r({...e,transform:{column:{},value:{},row:{}},max:1,fetch_types:!1,idle_timeout:null,max_lifetime:null,connection:{...e.connection,replication:"database"},onclose:async function(){o||(a=null,i.pid=i.secret=void 0,d(await f(u,n,e.publications)),t.forEach(g=>g.forEach(({onsubscribe:b})=>b())))},no_subscribe:!0}),l=u.end,c=u.close;return u.end=async()=>(o=!0,a&&await new Promise(g=>(a.once("close",g),a.end())),l()),u.close=async()=>(a&&await new Promise(g=>(a.once("close",g),a.end())),c()),h;async function h(g,b,m=fT,y=fT){g=YB(g),s||(s=f(u,n,e.publications));let v={fn:b,onsubscribe:m},x=t.has(g)?t.get(g).add(v):t.set(g,new Set([v])).get(g),w=()=>{x.delete(v),x.size===0&&t.delete(g)};return s.then(S=>(d(S),m(),a&&a.on("error",y),{unsubscribe:w,state:i,sql:u}))}function d(g){a=g.stream,i.pid=g.state.pid,i.secret=g.state.secret}async function f(g,b,m){if(!m)throw new Error("Missing publication names");let y=await g.unsafe(`CREATE_REPLICATION_SLOT ${b} TEMPORARY LOGICAL pgoutput NOEXPORT_SNAPSHOT`),[v]=y,x=await g.unsafe(`START_REPLICATION SLOT ${b} LOGICAL ${v.consistent_point} (proto_version '1', publication_names '${m}')`).writable(),w={lsn:Buffer.concat(v.consistent_point.split("/").map(k=>Buffer.from(("00000000"+k).slice(-8),"hex")))};return x.on("data",E),x.on("error",S),x.on("close",g.close),{stream:x,state:y.state};function S(k){console.error("Unexpected error during logical streaming - reconnecting",k)}function E(k){k[0]===119?XB(k.subarray(25),w,g.options.parsers,_,e.transform):k[0]===107&&k[17]&&(w.lsn=k.subarray(1,9),T())}function _(k,A){let B=A.relation.schema+"."+A.relation.table;p("*",k,A),p("*:"+B,k,A),A.relation.keys.length&&p("*:"+B+"="+A.relation.keys.map(D=>k[D.name]),k,A),p(A.command,k,A),p(A.command+":"+B,k,A),A.relation.keys.length&&p(A.command+":"+B+"="+A.relation.keys.map(D=>k[D.name]),k,A)}function T(){let k=Buffer.alloc(34);k[0]=114,k.fill(w.lsn,1),k.writeBigInt64BE(BigInt(Date.now()-Date.UTC(2e3,0,1))*BigInt(1e3),25),x.write(k)}}function p(g,b,m){t.has(g)&&t.get(g).forEach(({fn:y})=>y(b,m,g))}}function KB(r){return new Date(Date.UTC(2e3,0,1)+Number(r/BigInt(1e3)))}function XB(r,e,t,n,i){let s=(a,[o,u])=>(a[o.charCodeAt(0)]=u,a);Object.entries({R:a=>{let o=1,u=e[a.readUInt32BE(o)]={schema:a.toString("utf8",o+=4,o=a.indexOf(0,o))||"pg_catalog",table:a.toString("utf8",o+1,o=a.indexOf(0,o+1)),columns:Array(a.readUInt16BE(o+=2)),keys:[]};o+=2;let l=0,c;for(;o<a.length;)c=u.columns[l++]={key:a[o++],name:i.column.from?i.column.from(a.toString("utf8",o,o=a.indexOf(0,o))):a.toString("utf8",o,o=a.indexOf(0,o)),type:a.readUInt32BE(o+=1),parser:t[a.readUInt32BE(o)],atttypmod:a.readUInt32BE(o+=4)},c.key&&u.keys.push(c),o+=4},Y:()=>{},O:()=>{},B:a=>{e.date=KB(a.readBigInt64BE(9)),e.lsn=a.subarray(1,9)},I:a=>{let o=1,u=e[a.readUInt32BE(o)],{row:l}=ah(a,u.columns,o+=7,i);n(l,{command:"insert",relation:u})},D:a=>{let o=1,u=e[a.readUInt32BE(o)];o+=4;let l=a[o]===75;n(l||a[o]===79?ah(a,u.columns,o+=3,i).row:null,{command:"delete",relation:u,key:l})},U:a=>{let o=1,u=e[a.readUInt32BE(o)];o+=4;let l=a[o]===75,c=l||a[o]===79?ah(a,u.columns,o+=3,i):null;c&&(o=c.i);let{row:h}=ah(a,u.columns,o+3,i);n(h,{command:"update",relation:u,key:l,old:c&&c.row})},T:()=>{},C:()=>{}}).reduce(s,{})[r[0]](r)}function ah(r,e,t,n){let i,s,a,o=n.raw?new Array(e.length):{};for(let u=0;u<e.length;u++)i=r[t++],s=e[u],a=i===110?null:i===117?void 0:s.parser===void 0?r.toString("utf8",t+4,t+=4+r.readUInt32BE(t)):s.parser.array===!0?s.parser(r.toString("utf8",t+5,t+=4+r.readUInt32BE(t))):s.parser(r.toString("utf8",t+4,t+=4+r.readUInt32BE(t))),n.raw?o[u]=n.raw===!0?a:n.value.from?n.value.from(a,s):a:o[s.name]=n.value.from?n.value.from(a,s):a;return{i:t,row:n.row.from?n.row.from(o):o}}function YB(r){let e=r.match(/^(\*|insert|update|delete)?:?([^.]+?\.?[^=]+)?=?(.+)?/i)||[];if(!e)throw new Error("Malformed subscribe pattern: "+r);let[,t,n,i]=e;return(t||"*")+(n?":"+(n.indexOf(".")===-1?"public."+n:n):"")+(i?"="+i:"")}import pT from"stream";function Mm(r,e,t=393216){return new Promise(async(n,i)=>{await r.begin(async s=>{let a;!e&&([{oid:e}]=await s`select lo_creat(-1) as oid`);let[{fd:o}]=await s`select lo_open(${e}, ${t}) as fd`,u={writable:c,readable:l,close:()=>s`select lo_close(${o})`.then(a),tell:()=>s`select lo_tell64(${o})`,read:h=>s`select loread(${o}, ${h}) as data`,write:h=>s`select lowrite(${o}, ${h})`,truncate:h=>s`select lo_truncate64(${o}, ${h})`,seek:(h,d=0)=>s`select lo_lseek64(${o}, ${h}, ${d})`,size:()=>s`
166
+ select
167
+ lo_lseek64(${o}, location, 0) as position,
168
+ seek.size
169
+ from (
170
+ select
171
+ lo_lseek64($1, 0, 2) as size,
172
+ tell.location
173
+ from (select lo_tell64($1) as location) tell
174
+ ) seek
175
+ `};return n(u),new Promise(async h=>a=h);async function l({highWaterMark:h=2048*8,start:d=0,end:f=1/0}={}){let p=f-d;return d&&await u.seek(d),new pT.Readable({highWaterMark:h,async read(g){let b=g>p?g-p:g;p-=g;let[{data:m}]=await u.read(b);this.push(m),m.length<g&&this.push(null)}})}async function c({highWaterMark:h=2048*8,start:d=0}={}){return d&&await u.seek(d),new pT.Writable({highWaterMark:h,write(f,p,g){u.write(f).then(()=>g(),g)}})}}).catch(i)})}Object.assign(oh,{PostgresError:li,toPascal:hi,pascal:Im,toCamel:ci,camel:km,toKebab:di,kebab:Rm,fromPascal:Do,fromCamel:Bo,fromKebab:Fo,BigInt:{to:20,from:[20],parse:r=>BigInt(r),serialize:r=>r.toString()}});var gT=oh;function oh(r,e){let t=JB(r,e),n=t.no_subscribe||Nm(oh,{...t}),i=!1,s=Qt(),a=Qt(),o=Qt(),u=Qt(),l=Qt(),c=Qt(),h=Qt(),d=Qt(),f={connecting:a,reserved:o,closed:u,ended:l,open:c,busy:h,full:d},p=[...Array(t.max)].map(()=>Lm(t,f,{onopen:L,onend:M,onclose:N})),g=b(_);return Object.assign(g,{get parameters(){return t.parameters},largeObject:Mm.bind(null,g),subscribe:n,CLOSE:Es,END:Es,PostgresError:li,options:t,reserve:v,listen:m,begin:x,close:B,end:A}),g;function b(I){return I.debug=t.debug,Object.entries(t.types).reduce((q,[ie,pe])=>(q[ie]=W=>new xr(W,pe.to),q),H),Object.assign(J,{types:H,typed:H,unsafe:ee,notify:y,array:E,json:S,file:X}),J;function H(q,ie){return new xr(q,ie)}function J(q,...ie){return q&&Array.isArray(q.raw)?new Yt(q,ie,I,k):typeof q=="string"&&!ie.length?new As(t.transform.column.to?t.transform.column.to(q):q):new Mo(q,ie)}function ee(q,ie=[],pe={}){return arguments.length===2&&!Array.isArray(ie)&&(pe=ie,ie=[]),new Yt([q],ie,I,k,{prepare:!1,...pe,simple:"simple"in pe?pe.simple:ie.length===0})}function X(q,ie=[],pe={}){return arguments.length===2&&!Array.isArray(ie)&&(pe=ie,ie=[]),new Yt([],ie,$=>{ZB.readFile(q,"utf8",(G,Y)=>{if(G)return $.reject(G);$.strings=[Y],I($)})},k,{...pe,simple:"simple"in pe?pe.simple:ie.length===0})}}async function m(I,H,J){let ee={fn:H,onlisten:J},X=m.sql||(m.sql=oh({...t,max:1,idle_timeout:null,max_lifetime:null,fetch_types:!1,onclose(){Object.entries(m.channels).forEach(([$,{listeners:G}])=>{delete m.channels[$],Promise.all(G.map(Y=>m($,Y.fn,Y.onlisten).catch(()=>{})))})},onnotify($,G){$ in m.channels&&m.channels[$].listeners.forEach(Y=>Y.fn(G))}})),q=m.channels||(m.channels={});if(I in q){q[I].listeners.push(ee);let $=await q[I].result;return ee.onlisten&&ee.onlisten(),{state:$.state,unlisten:W}}q[I]={result:X`listen ${X.unsafe('"'+I.replace(/"/g,'""')+'"')}`,listeners:[ee]};let pe=await q[I].result;return ee.onlisten&&ee.onlisten(),{state:pe.state,unlisten:W};async function W(){if(I in q&&(q[I].listeners=q[I].listeners.filter($=>$!==ee),!q[I].listeners.length))return delete q[I],X`unlisten ${X.unsafe('"'+I.replace(/"/g,'""')+'"')}`}}async function y(I,H){return await g`select pg_notify(${I}, ${""+H})`}async function v(){let I=Qt(),H=c.length?c.shift():await new Promise((X,q)=>{let ie={reserve:X,reject:q};s.push(ie),u.length&&P(u.shift(),ie)});w(H,o),H.reserved=()=>I.length?H.execute(I.shift()):w(H,o),H.reserved.release=!0;let J=b(ee);return J.release=()=>{H.reserved=null,L(H)},J;function ee(X){H.queue===d?I.push(X):H.execute(X)||w(H,d)}}async function x(I,H){!H&&(H=I,I="");let J=Qt(),ee=0,X,q=null;try{return await g.unsafe("begin "+I.replace(/[^a-z ]/ig,""),[],{onexecute:pe}).execute(),await Promise.race([ie(X,H),new Promise((W,$)=>X.onclose=$)])}catch(W){throw W}async function ie(W,$,G){let Y=b(he);Y.savepoint=ye,Y.prepare=be=>q=be.replace(/[^a-z0-9$-_. ]/gi);let me,ne;G&&await Y`savepoint ${Y(G)}`;try{if(ne=await new Promise((be,de)=>{let Ae=$(Y);Promise.resolve(Array.isArray(Ae)?Promise.all(Ae):Ae).then(be,de)}),me)throw me}catch(be){throw await(G?Y`rollback to ${Y(G)}`:Y`rollback`),be instanceof li&&be.code==="25P02"&&me||be}return G||(q?await Y`prepare transaction '${Y.unsafe(q)}'`:await Y`commit`),ne;function ye(be,de){return be&&Array.isArray(be.raw)?ye(Ae=>Ae.apply(Ae,arguments)):(arguments.length===1&&(de=be,be=null),ie(W,de,"s"+ee+++(be?"_"+be:"")))}function he(be){be.catch(de=>me||(me=de)),W.queue===d?J.push(be):W.execute(be)||w(W,d)}}function pe(W){X=W,w(W,o),W.reserved=()=>J.length?W.execute(J.shift()):w(W,o)}}function w(I,H){return I.queue.remove(I),H.push(I),I.queue=H,H===c?I.idleTimer.start():I.idleTimer.cancel(),I}function S(I){return new xr(I,3802)}function E(I,H){return Array.isArray(I)?new xr(I,H||(I.length?eh(I)||25:0),t.shared.typeArrayMap):E(Array.from(arguments))}function _(I){if(i)return I.reject(Xe.connection("CONNECTION_ENDED",t,t));if(c.length)return T(c.shift(),I);if(u.length)return P(u.shift(),I);h.length?T(h.shift(),I):s.push(I)}function T(I,H){return I.execute(H)?w(I,h):w(I,d)}function k(I){return new Promise((H,J)=>{I.state?I.active?Lm(t).cancel(I.state,H,J):I.cancelled={resolve:H,reject:J}:(s.remove(I),I.cancelled=!0,I.reject(Xe.generic("57014","canceling statement due to user request")),H())})}async function A({timeout:I=null}={}){if(i)return i;await 1;let H;return i=Promise.race([new Promise(J=>I!==null&&(H=setTimeout(D,I*1e3,J))),Promise.all(p.map(J=>J.end()).concat(m.sql?m.sql.end({timeout:0}):[],n.sql?n.sql.end({timeout:0}):[]))]).then(()=>clearTimeout(H))}async function B(){await Promise.all(p.map(I=>I.end()))}async function D(I){for(await Promise.all(p.map(H=>H.terminate()));s.length;)s.shift().reject(Xe.connection("CONNECTION_DESTROYED",t));I()}function P(I,H){return w(I,a),I.connect(H),I}function M(I){w(I,l)}function L(I){if(s.length===0)return w(I,c);let H=Math.ceil(s.length/(a.length+1)),J=!0;for(;J&&s.length&&H-- >0;){let ee=s.shift();if(ee.reserve)return ee.reserve(I);J=I.execute(ee)}J?w(I,h):w(I,d)}function N(I,H){w(I,u),I.reserved=null,I.onclose&&(I.onclose(H),I.onclose=null),t.onclose&&t.onclose(I.id),s.length&&P(I,s.shift())}}function JB(r,e){if(r&&r.shared)return r;let t=process.env,n=(!r||typeof r=="string"?e:r)||{},{url:i,multihost:s}=iD(r),a=[...i.searchParams].reduce((d,[f,p])=>(d[f]=p,d),{}),o=n.hostname||n.host||s||i.hostname||t.PGHOST||"localhost",u=n.port||i.port||t.PGPORT||5432,l=n.user||n.username||i.username||t.PGUSERNAME||t.PGUSER||sD();n.no_prepare&&(n.prepare=!1),a.sslmode&&(a.ssl=a.sslmode,delete a.sslmode),"timeout"in n&&(console.log("The timeout option is deprecated, use idle_timeout instead"),n.idle_timeout=n.timeout),a.sslrootcert==="system"&&(a.ssl="verify-full");let c=["idle_timeout","connect_timeout","max_lifetime","max_pipeline","backoff","keep_alive"],h={max:globalThis.Cloudflare?3:10,ssl:!1,sslnegotiation:null,idle_timeout:null,connect_timeout:30,max_lifetime:rD,max_pipeline:100,backoff:tD,keep_alive:60,prepare:!0,debug:!1,fetch_types:!0,publications:"alltables",target_session_attrs:null};return{host:Array.isArray(o)?o:o.split(",").map(d=>d.split(":")[0]),port:Array.isArray(u)?u:o.split(",").map(d=>parseInt(d.split(":")[1]||u)),path:n.path||o.indexOf("/")>-1&&o+"/.s.PGSQL."+u,database:n.database||n.db||(i.pathname||"").slice(1)||t.PGDATABASE||l,user:l,pass:n.pass||n.password||i.password||t.PGPASSWORD||"",...Object.entries(h).reduce((d,[f,p])=>{let g=f in n?n[f]:f in a?a[f]==="disable"||a[f]==="false"?!1:a[f]:t["PG"+f.toUpperCase()]||p;return d[f]=typeof g=="string"&&c.includes(f)?+g:g,d},{}),connection:{application_name:t.PGAPPNAME||"postgres.js",...n.connection,...Object.entries(a).reduce((d,[f,p])=>(f in h||(d[f]=p),d),{})},types:n.types||{},target_session_attrs:eD(n,i,t),onnotice:n.onnotice,onnotify:n.onnotify,onclose:n.onclose,onparameter:n.onparameter,socket:n.socket,transform:nD(n.transform||{undefined:void 0}),parameters:{},shared:{retries:0,typeArrayMap:{}},...nT(n.types)}}function eD(r,e,t){let n=r.target_session_attrs||e.searchParams.get("target_session_attrs")||t.PGTARGETSESSIONATTRS;if(!n||["read-write","read-only","primary","standby","prefer-standby"].includes(n))return n;throw new Error("target_session_attrs "+n+" is not supported")}function tD(r){return(.5+Math.random()/2)*Math.min(3**r/100,20)}function rD(){return 60*(30+Math.random()*30)}function nD(r){return{undefined:r.undefined,column:{from:typeof r.column=="function"?r.column:r.column&&r.column.from,to:r.column&&r.column.to},value:{from:typeof r.value=="function"?r.value:r.value&&r.value.from,to:r.value&&r.value.to},row:{from:typeof r.row=="function"?r.row:r.row&&r.row.from,to:r.row&&r.row.to}}}function iD(r){if(!r||typeof r!="string")return{url:{searchParams:new Map}};let e=r;e=e.slice(e.indexOf("://")+3).split(/[?/]/)[0],e=decodeURIComponent(e.slice(e.indexOf("@")+1));let t=new URL(r.replace(e,e.split(",")[0]));return{url:{username:decodeURIComponent(t.username),password:decodeURIComponent(t.password),host:t.host,hostname:t.hostname,port:t.port,pathname:t.pathname,searchParams:t.searchParams},multihost:e.indexOf(",")>-1&&e}}function sD(){try{return QB.userInfo().username}catch{return process.env.USERNAME||process.env.USER||process.env.LOGNAME}}var Bm=null,mT=null;function aD(){let r=process.env.DB_POOL_SIZE;if(!r)return 1;let e=parseInt(r,10);return isNaN(e)||e<=0?(console.warn(`[db] Invalid DB_POOL_SIZE="${r}", using default 1`),1):(e>50&&console.warn(`[db] DB_POOL_SIZE=${e} is unusually high, consider reducing`),e)}function bT(){if(!Bm){let r=process.env.DATABASE_URL;if(!r)throw new Error("DATABASE_URL environment variable is required. Set it to your Postgres connection string.");let e=aD();mT=gT(r,{max:e,idle_timeout:20,connect_timeout:10,prepare:process.env.SUPABASE_POOLER!=="true",ssl:r.includes("localhost")||r.includes("127.0.0.1")?!1:"require"}),Bm=KA(mT)}return Bm}var DG=new Proxy({},{get(r,e){return Reflect.get(bT(),e)}});var Uo=2,rq=100*1024*1024,nq={maxEntries:50,maxSize:500*1024*1024,ttl:3600*1e3};var uD=oD("openread-mcp",{suffix:""}),lD=uD.cache,uh=class{cacheDir;initialized=!1;constructor(e){this.cacheDir=e?.cacheDir??lD}async ensureDir(){this.initialized||(await Tt.mkdir(this.cacheDir,{recursive:!0}),this.initialized=!0)}sanitizeId(e){return e.replace(/[\/\\\.]+/g,"_")}keyPath(e,t){return zo.join(this.cacheDir,`${this.sanitizeId(e)}-${this.sanitizeId(t)}.json`)}serializeBook(e){return{metadata:e.metadata,toc:e.toc,chapters:Object.fromEntries(e.chapters),spine:e.spine}}deserializeBook(e){if(!e.metadata||typeof e.metadata!="object"||!e.chapters||typeof e.chapters!="object"||!Array.isArray(e.spine))throw new Error("Corrupt cache entry: missing required fields");return{metadata:e.metadata,toc:e.toc??[],chapters:new Map(Object.entries(e.chapters)),spine:e.spine}}async getByBookId(e){await this.ensureDir();let t=await Tt.readdir(this.cacheDir),n=`${this.sanitizeId(e)}-`,i=t.filter(s=>s.startsWith(n)&&s.endsWith(".json"));for(let s of i){let a=zo.join(this.cacheDir,s);try{let o=await Tt.readFile(a,"utf-8"),u=JSON.parse(o);if(u.parserVersion!==Uo){await Tt.unlink(a).catch(()=>{});continue}return await Tt.utimes(a,new Date,new Date).catch(()=>{}),this.deserializeBook(u.book)}catch(o){o instanceof Error&&"code"in o&&o.code==="ENOENT"||process.stderr.write(`[DiskCache] Error reading cache file ${s}: ${o instanceof Error?o.message:o}
176
+ `);continue}}return null}async get(e,t){await this.ensureDir();let n=this.keyPath(e,t);try{let i=await Tt.readFile(n,"utf-8"),s=JSON.parse(i);return s.parserVersion!==Uo?(await Tt.unlink(n).catch(()=>{}),null):(await Tt.utimes(n,new Date,new Date).catch(()=>{}),this.deserializeBook(s.book))}catch(i){return i instanceof Error&&"code"in i&&i.code==="ENOENT"||process.stderr.write(`[DiskCache] Error reading cache for ${e}: ${i instanceof Error?i.message:i}
177
+ `),null}}async set(e,t,n){await this.ensureDir();let i=this.keyPath(e,t),s=`${i}.tmp`,a={parserVersion:Uo,cachedAt:Date.now(),book:this.serializeBook(n)};await Tt.writeFile(s,JSON.stringify(a),"utf-8"),await Tt.rename(s,i)}async clear(){await this.ensureDir();let e=await Tt.readdir(this.cacheDir);await Promise.all(e.filter(t=>t.endsWith(".json")).map(t=>Tt.unlink(zo.join(this.cacheDir,t)).catch(()=>{})))}async cleanupTempFiles(){await this.ensureDir();let t=(await Tt.readdir(this.cacheDir)).filter(n=>n.endsWith(".tmp"));return await Promise.all(t.map(n=>Tt.unlink(zo.join(this.cacheDir,n)).catch(()=>{}))),t.length}async getStats(){await this.ensureDir();let t=(await Tt.readdir(this.cacheDir)).filter(i=>i.endsWith(".json")),n=0;for(let i of t)try{let s=await Tt.stat(zo.join(this.cacheDir,i));n+=s.size}catch{}return{totalSize:n,entryCount:t.length,cacheDir:this.cacheDir}}};import{createHash as cD}from"node:crypto";import{createWriteStream as hD,promises as Dm}from"node:fs";import yT from"node:path";import dD from"node:os";import{pipeline as fD}from"node:stream/promises";import{Readable as pD}from"node:stream";function In(r){process.stderr.write(`[BookLoader] ${r}
178
+ `)}var lh=3,gD=1e3,vT=500*1024*1024,mD=300*1e3,wT=20,ch=class{constructor(e,t){this.auth=e;this.diskCache=t}memoryCache=new Map;async loadBook(e,t="epub"){let n=this.memoryCache.get(e);if(n)return In(`Memory cache hit: ${e}`),n;let i=await this.diskCache.getByBookId(e);if(i){if(In(`Disk cache hit: ${e}`),this.memoryCache.size>=wT){let s=this.memoryCache.keys().next().value;s!==void 0&&this.memoryCache.delete(s)}return this.memoryCache.set(e,i),i}return In(`Cache miss: ${e}, downloading...`),this.downloadAndParse(e,t)}async downloadAndParse(e,t){let n=null;for(let i=0;i<lh;i++){let s=await Dm.mkdtemp(yT.join(dD.tmpdir(),"openread-")),a=yT.join(s,`book.${t}`);try{let o=await this.requestSignedUrl(e);if(o.sizeBytes>vT)throw new Error(`Book ${e} is too large (${(o.sizeBytes/1024/1024).toFixed(0)}MB, max ${(vT/1024/1024).toFixed(0)}MB)`);await this.downloadToFile(o.url,a,o.sizeBytes);let u=await Dm.readFile(a),l=cD("sha256").update(u).digest("hex").slice(0,12);In(`Parsing ${t}: ${e}`);let c=await this.parseBuffer(u.buffer.slice(u.byteOffset,u.byteOffset+u.byteLength),t);if(this.diskCache.set(e,l,c).catch(h=>{In(`Disk cache write failed for book ${e}: ${h instanceof Error?h.message:h}`)}),this.memoryCache.size>=wT){let h=this.memoryCache.keys().next().value;h!==void 0&&this.memoryCache.delete(h)}return this.memoryCache.set(e,c),c}catch(o){n=o instanceof Error?o:new Error(String(o));let u=n.message;if(!(u==="SIGNED_URL_EXPIRED"||u.includes("fetch failed")))throw n;if(i<lh-1){let c=gD*Math.pow(2,i);In(`Retrying in ${c}ms (attempt ${i+2}/${lh})...`),await new Promise(h=>setTimeout(h,c))}}finally{await Dm.rm(s,{recursive:!0,force:!0}).catch(()=>{})}}throw new Error(`Failed to download book ${e} after ${lh} attempts: ${n?.message}`)}async requestSignedUrl(e){let t=await fetch(`${this.auth.getApiUrl()}/api/mcp/download-url`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.auth.getJwt()}`},body:JSON.stringify({bookId:e})});if(!t.ok){let n=await t.text().catch(()=>"");throw new Error(`Failed to get download URL (${t.status}): ${n}`)}return await t.json()}async downloadToFile(e,t,n){let i=Date.now();In(`Downloading ${(n/1024/1024).toFixed(1)}MB...`);let s=new AbortController,a=setTimeout(()=>s.abort(),mD);try{let o=await fetch(e,{signal:s.signal});if(!o.ok)throw o.status===403?new Error("SIGNED_URL_EXPIRED"):new Error(`Download failed: ${o.status}`);let u=o.body;if(!u)throw new Error("Empty response body");let l=pD.fromWeb(u),c=hD(t);await fD(l,c);let h=((Date.now()-i)/1e3).toFixed(1);In(`Download complete in ${h}s`)}finally{clearTimeout(a)}}async parseBuffer(e,t){switch(t){case"pdf":return Cc(e);case"mobi":case"azw3":return kc(e);case"txt":return Rl(e);default:return Il(e)}}async clearAll(){this.memoryCache.clear(),await this.diskCache.clear()}};var hh=class{constructor(e){this.supabase=e}async getBookById(e,t){let{data:n,error:i}=await this.supabase.from("books").select("*").eq("id",e).eq("user_id",t).maybeSingle();if(i)throw new Error(`Database query failed: ${i.message}`);return n?xT(n):null}async listBooks(e,t,n){let i=this.supabase.from("books").select("*").eq("user_id",e).order("created_at",{ascending:!1});t!==void 0&&n!==void 0?i=i.range(n,n+t-1):t!==void 0&&(i=i.limit(t));let{data:s,error:a}=await i;if(a)throw new Error(`Database query failed: ${a.message}`);return(s??[]).map(xT)}async countBooks(e){let{count:t,error:n}=await this.supabase.from("books").select("*",{count:"exact",head:!0}).eq("user_id",e);if(n)throw new Error(`Database query failed: ${n.message}`);return t??0}};function xT(r){return{id:r.id,hash:r.book_hash,metaHash:r.meta_hash??null,title:r.title,author:r.author??null,format:r.format,sizeBytes:r.size_bytes!=null?Number(r.size_bytes):null,storagePath:r.storage_path??null,userId:r.user_id,createdAt:new Date(r.created_at),updatedAt:new Date(r.updated_at)}}function an(r){process.stderr.write(`[openread-mcp] ${r}
179
+ `)}var bD=5e3,ST=!1;async function yD(r){if(r.transport)try{await Promise.race([r.transport.close(),new Promise(e=>setTimeout(e,bD))])}catch(e){an(`Transport close error (may already be closed): ${e instanceof Error?e.message:e}`)}if(r.diskCache)try{let e=await r.diskCache.cleanupTempFiles();e>0&&an(`Cleaned up ${e} temporary cache files`)}catch(e){an(`Cache cleanup error (non-fatal): ${e instanceof Error?e.message:e}`)}if(r.authManager)try{r.authManager.destroy()}catch(e){an(`Auth cleanup error (non-fatal): ${e instanceof Error?e.message:e}`)}an("Shutdown complete")}function jo(r,e){ST||(ST=!0,an(`Shutting down: ${r}`),setImmediate(()=>{yD(e).catch(t=>{an(`Shutdown error: ${t}`)}).finally(()=>{process.exit(0)})}))}function ET(r){process.on("SIGINT",()=>jo("SIGINT received",r)),process.on("SIGTERM",()=>jo("SIGTERM received",r)),process.stdin.on("end",()=>jo("stdin closed (parent process exited)",r)),process.stdin.on("error",()=>jo("stdin error (parent process crashed)",r)),process.on("uncaughtException",e=>{an(`Uncaught exception: ${e.message}`),jo("uncaught exception",r)}),process.on("unhandledRejection",e=>{an(`Unhandled rejection: ${e}`)})}import{z as AT}from"zod";var CT=50,TT=100,_T=1,vD={limit:AT.number().int().min(_T).max(TT).optional().describe(`Maximum number of books to return (${_T}-${TT}, default ${CT})`),offset:AT.number().int().min(0).optional().describe("Number of books to skip for pagination (min 0, default 0)")};async function wD(r){let e=_e(),{userId:t,bookData:n}=e,i=r.limit??CT,s=r.offset??0,[a,o]=await Promise.all([n.listBooks(t,i,s),n.countBooks(t)]),u=a.map(l=>({id:l.id,title:l.title,author:l.author,format:l.format,addedAt:l.createdAt.toISOString()}));return{totalCount:o,books:u}}function kT(){ke("list_books","List books in the user's library. Returns { totalCount, books[] } where each book has id, title, author, format, and addedAt. Use totalCount to decide if you need to paginate (limit/offset). To search across all books by content, use search_library instead.",vD,wD)}import{z as xD}from"zod";var SD={bookId:xD.string().describe("The unique identifier (UUID) of the book to retrieve")};async function ED(r){let e=_e(),{bookData:t,userId:n}=e,i=await t.getBookById(r.bookId,n);return i||Ie("book",r.bookId),{id:i.id,title:i.title,author:i.author,format:i.format,sizeBytes:i.sizeBytes??null,addedAt:i.createdAt.toISOString(),description:null,publisher:null,publishedDate:null,isbn:null,language:null}}function IT(){ke("get_book_info","Get detailed metadata about a specific book",SD,ED)}import{z as AD}from"zod";var TD={bookId:AD.string().describe("The unique identifier (UUID) of the book")};function _D(r){return{id:r.id,title:r.title,index:r.index,href:r.href,level:r.level}}function CD(r){let e=[];function t(n){for(let i of n)e.push(_D(i)),i.children&&i.children.length>0&&t(i.children)}return t(r),e}async function kD(r){let e=_e(),{bookData:t,userId:n}=e,{bookId:i}=r,s=await t.getBookById(i,n);if(s||Ie("book",i),s.format!=="epub")throw new ge("INVALID_FORMAT",`get_table_of_contents only supports EPUB format. Book ${i} is ${s.format}`);if(!s.storagePath)throw new ge("BOOK_NOT_UPLOADED",`Book ${i} has no storage path`);let a=await e.loadBook(i,s.storagePath,s.format),o=CD(a.toc);return{chapters:o,totalEntries:o.length}}function RT(){ke("get_table_of_contents","Get the table of contents for a book. Returns a list of chapters/sections with their titles, IDs, and nesting levels. Use this to understand book structure before reading specific chapters.",TD,kD)}import{z as PT}from"zod";var OT=100*1024,ID={bookId:PT.string().describe("The unique identifier (UUID) of the book"),chapterId:PT.string().describe("The chapter identifier (from get_table_of_contents)")};async function RD(r){let e=_e(),{bookData:t,userId:n}=e,{bookId:i,chapterId:s}=r,a=await t.getBookById(i,n);if(a||Ie("book",i),a.format!=="epub")throw new ge("INVALID_FORMAT",`get_chapter only supports EPUB format. Book ${i} is ${a.format}`);if(!a.storagePath)throw new ge("BOOK_NOT_UPLOADED",`Book ${i} has no storage path`);let o=await e.loadBook(i,a.storagePath,a.format),u=o.chapters.get(s);u||Ie("chapter",s);let l=o.spine.indexOf(s),c=u.text,h=Buffer.byteLength(c,"utf8"),d=c,f=!1;if(h>OT){d=Buffer.from(c,"utf8").subarray(0,OT).toString("utf8");let b=d.length;d=d.substring(0,b),d+=`
180
+
181
+ [Content truncated. Total length: `+h+" bytes. Use get_page_range for reading in smaller sections.]",f=!0}return{bookId:i,chapterId:s,chapterIndex:l,chapterTitle:u.title,content:d,truncated:f,totalLength:h}}function LT(){ke("get_chapter","Get the full text content of a specific chapter. Returns plain text (not HTML) suitable for reading and analysis. Use get_table_of_contents first to find chapter IDs. Large chapters may be truncated at 100KB.",ID,RD)}import{z as dh}from"zod";var Fm=2e3,PD={bookId:dh.string().describe("The unique identifier (UUID) of the book"),chapterId:dh.string().describe("The chapter ID to read from"),startPage:dh.number().min(1).describe("Starting page number (1-indexed)"),endPage:dh.number().min(1).describe("Ending page number (1-indexed, inclusive)")};async function OD(r){let e=_e(),{bookData:t,userId:n}=e,{bookId:i,chapterId:s,startPage:a,endPage:o}=r;if(a>o)throw new ge("INVALID_FORMAT",`startPage (${a}) must be less than or equal to endPage (${o})`);let u=await t.getBookById(i,n);if(u||Ie("book",i),u.format!=="epub")throw new ge("INVALID_FORMAT",`get_page_range only supports EPUB format. Book ${i} is ${u.format}`);if(!u.storagePath)throw new ge("BOOK_NOT_UPLOADED",`Book ${i} has no storage path`);let c=(await e.loadBook(i,u.storagePath,u.format)).chapters.get(s);c||Ie("chapter",s);let h=c.text,d=Math.max(1,Math.ceil(h.length/Fm)),f=Math.max(1,Math.min(a,d)),p=Math.max(f,Math.min(o,d)),g=(f-1)*Fm,b=p*Fm,m=h.slice(g,b);return{bookId:i,chapterId:s,chapterTitle:c.title,startPage:f,endPage:p,totalPages:d,content:m}}function NT(){ke("get_page_range","Get text for a range of simulated pages within a chapter. Pages are approximately 2000 characters each. Use this to read through chapters in manageable chunks. Page numbers are clamped to valid range if out of bounds.",PD,OD)}import{z as fh}from"zod";var MT=100,$T=20,BT=50,DT=1,FT=2,LD={bookId:fh.string().describe("The unique identifier (UUID) of the book to search"),query:fh.string().min(FT).describe(`Search query (minimum ${FT} characters)`),caseSensitive:fh.boolean().optional().describe("Whether to perform case-sensitive search (default: false)"),limit:fh.number().int().min(DT).max(BT).optional().describe(`Maximum number of results to return (${DT}-${BT}, default ${$T})`)};function ND(r,e,t){let n=Math.max(0,e-MT),i=Math.min(r.length,e+t+MT),s=r.slice(n,i);return n>0&&(s="..."+s),i<r.length&&(s=s+"..."),s=s.replace(/\s+/g," ").trim(),s}function MD(r,e,t,n){let i=[],s=n?r.text:r.text.toLowerCase(),a=n?t:t.toLowerCase(),o=0;for(;o<s.length;){let u=s.indexOf(a,o);if(u===-1)break;let l=ND(r.text,u,t.length);i.push({chapterId:r.id,chapterTitle:r.title,chapterIndex:e,snippet:l,matchPosition:u}),o=u+1}return i}async function BD(r){let e=_e(),{bookData:t,userId:n}=e,{bookId:i,query:s,caseSensitive:a=!1,limit:o=$T}=r,u=await t.getBookById(i,n);if(u||Ie("book",i),!new Set(["epub","txt","md","pdf","mobi","azw3","fb2"]).has(u.format))throw new ge("INVALID_FORMAT",`search_book does not support ${u.format} format`);if(!u.storagePath)throw new ge("INVALID_FORMAT","Book has no stored file to search");let c=await e.loadBook(i,u.storagePath,u.format),h=[],d=0;for(let f=0;f<c.spine.length;f++){let p=c.spine[f],g=c.chapters.get(p);if(!g)continue;let b=MD(g,f,s,a);d+=b.length;for(let m of b)h.length<o&&h.push(m)}return{bookId:i,bookTitle:c.metadata.title,query:s,totalMatches:d,results:h}}function UT(){ke("search_book","Search for text within a specific book. Returns matching snippets with surrounding context. Case-insensitive by default. Use this to find specific passages, quotes, or topics within a book.",LD,BD)}import{z as $m}from"zod";var zT=100,VT=50,jT=100,HT=1,DD=10,WT=2,FD={query:$m.string().min(WT).describe(`Search query (minimum ${WT} characters)`),caseSensitive:$m.boolean().optional().describe("Whether to perform case-sensitive search (default: false)"),limit:$m.number().int().min(HT).max(jT).optional().describe(`Maximum total number of results to return (${HT}-${jT}, default ${VT})`)};function $D(r,e,t){let n=Math.max(0,e-zT),i=Math.min(r.length,e+t+zT),s=r.slice(n,i);return n>0&&(s="..."+s),i<r.length&&(s=s+"..."),s=s.replace(/\s+/g," ").trim(),s}function UD(r,e,t,n){let i=[],s=n?r.text:r.text.toLowerCase(),a=n?t:t.toLowerCase(),o=0;for(;o<s.length;){let u=s.indexOf(a,o);if(u===-1)break;let l=$D(r.text,u,t.length);i.push({chapterId:r.id,chapterTitle:r.title,chapterIndex:e,snippet:l,matchPosition:u}),o=u+1}return i}function zD(r,e,t,n){let i=[],s=0;for(let a=0;a<r.spine.length;a++){let o=r.spine[a],u=r.chapters.get(o);if(!u)continue;let l=UD(u,a,t,n);s+=l.length;for(let c of l)i.length<DD&&i.push(c)}return{bookId:e,bookTitle:r.metadata.title,matchCount:s,results:i}}async function jD(r){let e=_e(),{bookData:t,userId:n}=e,{query:i,caseSensitive:s=!1,limit:a=VT}=r,o=await t.listBooks(n),u=new Set(["epub","txt","md","pdf","mobi","azw3","fb2"]),l=o.filter(g=>u.has(g.format)&&g.storagePath!=null),c=[],h=0,d=0;for(let g of l)try{let b=await e.loadBook(g.id,g.storagePath,g.format);d++;let m=zD(b,g.id,i,s);m.matchCount>0&&(h+=m.matchCount,c.push(m))}catch(b){console.warn("[search-library] Failed to search book:",g.id,b);continue}c.sort((g,b)=>b.matchCount-g.matchCount);let f=0,p=[];for(let g of c){if(f>=a)break;let b=a-f,m=Math.min(g.results.length,b);m>0&&(p.push({...g,results:g.results.slice(0,m)}),f+=m)}return{query:i,totalMatches:h,booksSearched:d,booksWithMatches:c.length,results:p}}function GT(){ke("search_library","Search for text across all books in the user's library. Returns matching snippets grouped by book, sorted by match count. Use this to find which books contain specific topics, quotes, or terms.",FD,jD)}import{z as qT}from"zod";var HD={bookId:qT.string().describe("The unique identifier (UUID) of the book"),chapterId:qT.string().describe("The chapter identifier (from get_table_of_contents)")};async function WD(r){let e=_e(),{bookData:t,userId:n}=e,{bookId:i,chapterId:s}=r,a=await t.getBookById(i,n);if(a||Ie("book",i),a.format!=="epub")throw new ge("INVALID_FORMAT",`get_headings only supports EPUB format. Book ${i} is ${a.format}`);if(!a.storagePath)throw new ge("BOOK_NOT_UPLOADED",`Book ${i} has no storage path`);let u=(await e.loadBook(i,a.storagePath,a.format)).chapters.get(s);u||Ie("chapter",s);let l=u.headings.map(c=>{let d=u.text.slice(c.offset,c.offset+c.length).split(/\s+/).filter(Boolean).length;return{level:c.level,text:c.text,location:String(c.offset),wordCount:d}});return{bookId:i,chapterId:s,chapterTitle:u.title,headings:l}}function KT(){ke("get_headings","Get the heading hierarchy (h1-h6) for a chapter. Returns heading text, level, character offset location, and word count per section. Use this to understand chapter structure before fetching content. Typically ~500 bytes vs 100KB for full chapter.",HD,WD)}import{z as ph}from"zod";var VD={bookId:ph.string().describe("The unique identifier (UUID) of the book"),chapterId:ph.string().describe("The chapter identifier (from get_table_of_contents)"),heading:ph.string().optional().describe("Heading text to find (case-insensitive). Takes precedence over sectionIndex."),sectionIndex:ph.number().int().min(0).optional().describe("Zero-based index of the section within the chapter")};async function GD(r){let e=_e(),{bookData:t,userId:n}=e,{bookId:i,chapterId:s,heading:a,sectionIndex:o}=r,u=await t.getBookById(i,n);if(u||Ie("book",i),u.format!=="epub")throw new ge("INVALID_FORMAT",`get_section only supports EPUB format. Book ${i} is ${u.format}`);if(!u.storagePath)throw new ge("BOOK_NOT_UPLOADED",`Book ${i} has no storage path`);let c=(await e.loadBook(i,u.storagePath,u.format)).chapters.get(s);if(c||Ie("chapter",s),c.headings.length===0){let f=c.text,p=f.split(/\s+/).filter(Boolean).length;return{bookId:i,chapterId:s,heading:c.title,content:f,wordCount:p,nextHeading:null,sectionIndex:0,totalSections:1}}let d;try{a!==void 0?d=Vg(c,a):o!==void 0?d=Ic(c,o):d=Ic(c,0)}catch(f){throw new ge("SECTION_NOT_FOUND",f instanceof Error?f.message:String(f))}return{bookId:i,chapterId:s,heading:d.heading.text,content:d.content,wordCount:d.wordCount,nextHeading:d.nextHeading?.text??null,sectionIndex:d.heading.index,totalSections:c.headings.length}}function XT(){ke("get_section","Get the content of a single section within a chapter, identified by heading text or section index. Returns 1-5KB instead of 50-100KB for the full chapter. Use get_headings first to see available sections. If heading is not found, returns the list of available headings.",VD,GD)}import{z as Um}from"zod";var qD=20,KD=1,XD=50,YD={bookId:Um.string().describe("The unique identifier (UUID) of the book"),chapterId:Um.string().describe("The chapter identifier (from get_table_of_contents)"),limit:Um.number().int().min(KD).max(XD).optional().describe("Maximum number of key terms to return (1-50, default 20)")};async function QD(r){let e=_e(),{bookData:t,userId:n}=e,{bookId:i,chapterId:s,limit:a=qD}=r,o=await t.getBookById(i,n);if(o||Ie("book",i),o.format!=="epub")throw new ge("INVALID_FORMAT",`get_key_terms only supports EPUB format. Book ${i} is ${o.format}`);if(!o.storagePath)throw new ge("BOOK_NOT_UPLOADED",`Book ${i} has no storage path`);let l=(await e.loadBook(i,o.storagePath,o.format)).chapters.get(s);l||Ie("chapter",s);let d=l.keyTerms.slice(0,a).map(f=>({term:f.term,frequency:f.frequency,firstLocation:String(f.firstOffset)}));return{bookId:i,chapterId:s,chapterTitle:l.title,terms:d}}function YT(){ke("get_key_terms","Get the top key terms and concepts for a chapter. Returns term text, frequency, and first occurrence location. Use this to quickly assess chapter relevance before fetching content. Typically ~500 bytes for 20 terms.",YD,QD)}import{z as gh}from"zod";var ZD=500,JD={bookId:gh.string().describe("The unique identifier (UUID) of the book"),chapterId:gh.string().describe("The chapter identifier (from get_table_of_contents)"),offset:gh.number().int().min(0).describe("Character offset within the chapter text (from search results or heading locations)"),contextChars:gh.number().int().min(100).max(5e3).optional().describe("Number of characters of context before and after the offset (100-5000, default 500)")};function eF(r,e){let t=e;for(;t>0&&!/[.!?\n]/.test(r[t-1]);)t--;for(;t<r.length&&/\s/.test(r[t]);)t++;let n=e;for(;n<r.length&&!/[.!?\n]/.test(r[n]);)n++;return n<r.length&&n++,{start:t,end:n}}function tF(r,e,t){if(r.length===0)return t;let n=t;for(let i of r)if(i.offset<=e)n=i.text;else break;return n}async function rF(r){let e=_e(),{bookData:t,userId:n}=e,{bookId:i,chapterId:s,offset:a}=r,o=r.contextChars??ZD,u=await t.getBookById(i,n);if(u||Ie("book",i),u.format!=="epub")throw new ge("INVALID_FORMAT",`get_passage only supports EPUB format. Book ${i} is ${u.format}`);if(!u.storagePath)throw new ge("BOOK_NOT_UPLOADED",`Book ${i} has no storage path`);let c=(await e.loadBook(i,u.storagePath,u.format)).chapters.get(s);c||Ie("chapter",s);let h=c.text;if(a>=h.length)throw new ge("CHAPTER_NOT_FOUND",`Offset ${a} is beyond chapter text length. Valid range: 0-${h.length-1}`);let{start:d,end:f}=eF(h,a),p=h.slice(d,f),g=h.slice(Math.max(0,d-o),d),b=h.slice(f,Math.min(h.length,f+o)),m=tF(c.headings,a,c.title);return{bookId:i,chapterId:s,before:g,match:p,after:b,heading:m,offset:a,contextChars:o}}function QT(){ke("get_passage",'Get text around a specific location in a chapter with configurable context window. The offset comes from search results (matchPosition) or heading locations. Controls how much surrounding text to include (100-5000 chars, default 500). Like "expanding" a search result.',JD,rF)}import{z as nF}from"zod";var iF={bookId:nF.string().uuid().describe("The unique identifier (UUID) of the book")};async function sF(r){let e=_e(),{bookData:t,userId:n}=e,{bookId:i}=r,s=await t.getBookById(i,n);if(s||Ie("book",i),s.format!=="epub")throw new ge("INVALID_FORMAT",`book_overview only supports EPUB format. Book ${i} is ${s.format}`);if(!s.storagePath)throw new ge("BOOK_NOT_UPLOADED",`Book ${i} has no storage path`);let a=await e.loadBook(i,s.storagePath,s.format),o=[],u=0;for(let l=0;l<a.spine.length;l++){let c=a.spine[l],h=a.chapters.get(c);if(!h)continue;let d=h.text.split(/\s+/).filter(Boolean).length;u+=d,o.push({id:c,title:h.title,index:l,wordCount:d,headings:h.headings.map(f=>f.text),topTerms:h.keyTerms.slice(0,5).map(f=>f.term)})}return{bookId:i,title:a.metadata.title,author:a.metadata.author,totalChapters:o.length,totalWords:u,chapters:o}}function ZT(){ke("book_overview","Get complete book structure in one call: TOC with all chapter headings, top key terms, and word counts. Replaces calling get_toc + get_headings + get_key_terms per chapter. Output is ~3-5KB.",iF,sF)}import{z as JT}from"zod";function aF(){try{return gi().server.getClientCapabilities()?.sampling!==void 0}catch{return!1}}async function _s(r){if(!aF())return null;try{let n=(await gi().server.createMessage({messages:[{role:"user",content:{type:"text",text:r.content}}],systemPrompt:r.systemPrompt,includeContext:"none",maxTokens:r.maxTokens??1024,modelPreferences:{intelligencePriority:.8,speedPriority:.3,costPriority:.2}})).content;return Array.isArray(n)?n.find(s=>s.type==="text")?.text??null:n.type==="text"?n.text:null}catch(e){return process.stderr.write(`[openread-mcp] Sampling failed: ${e instanceof Error?e.message:String(e)}
182
+ `),null}}var oF=`You are summarizing a chapter from a book. Provide a concise but thorough summary that includes:
183
+ 1. The main argument or thesis of this chapter
184
+ 2. Key points with supporting evidence or examples
185
+ 3. Notable quotes or memorable examples
186
+ 4. How this chapter connects to broader themes
187
+
188
+ Keep the summary to approximately 500 words. Use clear, direct language.`,uF={bookId:JT.string().uuid().describe("The unique identifier (UUID) of the book"),chapterId:JT.string().describe("The chapter identifier (from get_table_of_contents)")};function e_(r,e=200){let t=r.slice(0,e).replace(/\s+/g," ").trim(),n=Math.max(t.lastIndexOf(". "),t.lastIndexOf("! "),t.lastIndexOf("? "),t.lastIndexOf("."),t.lastIndexOf("!"),t.lastIndexOf("?"));return n>30?t.slice(0,n+1):t+"..."}async function lF(r){let e=_e(),{bookData:t,userId:n}=e,{bookId:i,chapterId:s}=r,a=await t.getBookById(i,n);if(a||Ie("book",i),a.format!=="epub")throw new ge("INVALID_FORMAT",`summarize_chapter only supports EPUB format. Book ${i} is ${a.format}`);if(!a.storagePath)throw new ge("BOOK_NOT_UPLOADED",`Book ${i} has no storage path`);let o=await e.loadBook(i,a.storagePath,a.format),u=o.chapters.get(s);u||Ie("chapter",s);let l=u.text.split(/\s+/).filter(Boolean).length,c=u.keyTerms.slice(0,10).map(p=>p.term),h=`Book: "${o.metadata.title}" by ${o.metadata.author??"Unknown"}
189
+ Chapter: "${u.title}"
190
+
191
+ ${u.text}`,d=await _s({content:h,systemPrompt:oF,maxTokens:1024});if(d)return{bookId:i,chapterId:s,chapterTitle:u.title,wordCount:l,keyTerms:c,samplingUsed:!0,summary:d};let f=[];if(u.headings.length>0)for(let p of u.headings){let g=p.offset+p.text.length,b=u.text.slice(g,g+300);f.push({heading:p.text,openingSentences:e_(b)})}else f.push({heading:u.title,openingSentences:e_(u.text,300)});return{bookId:i,chapterId:s,chapterTitle:u.title,wordCount:l,keyTerms:c,samplingUsed:!1,sections:f}}function t_(){ke("summarize_chapter","Get an AI-powered chapter summary. With sampling support: sends chapter to LLM in isolated context, returns ~500 word digest. Without sampling: returns section opening sentences + key terms (~2KB). Never dumps raw chapter text into your context.",uF,lF)}import{z as bh}from"zod";function mh(r,e,t=300){let n=Math.max(0,e-t),i=Math.min(r.length,e+t),s=r.slice(n,i);if(n>0){let a=s.search(/[.!?]\s/);a>0&&a<80?s=s.slice(a+2):s="..."+s}if(i<r.length){let a=Math.max(s.lastIndexOf(". "),s.lastIndexOf("! "),s.lastIndexOf("? "));a>s.length-100&&a>0?s=s.slice(0,a+1):s=s+"..."}return s.replace(/\s+/g," ").trim()}var r_=new Set(["epub","txt","md","pdf","mobi","azw3","fb2"]),cF=`You are a research assistant synthesizing passages from multiple books about a specific topic.
192
+
193
+ Create a coherent research brief that:
194
+ 1. Groups findings by theme or sub-topic
195
+ 2. Notes agreements and disagreements between authors
196
+ 3. Highlights the strongest insights and most compelling evidence
197
+ 4. Cites which book each insight comes from
198
+
199
+ Keep the synthesis to approximately 500-800 words. Be specific and reference the source books by title.`,hF={query:bh.string().min(2).describe("The research topic or question to investigate across books"),bookIds:bh.array(bh.string().uuid()).optional().describe("Optional list of specific book IDs to search. If omitted, searches all books."),maxResultsPerBook:bh.number().int().min(1).max(10).optional().describe("Maximum passages to collect per book (1-10, default 5)")};function dF(r,e,t){let n=[],i=r.text.toLowerCase(),s=e.toLowerCase(),a=0;for(;a<i.length&&n.length<t;){let o=i.indexOf(s,a);if(o===-1)break;n.push({matchPosition:o,passage:mh(r.text,o),chapterTitle:r.title}),a=o+1}return n}async function fF(r){let e=_e(),{bookData:t,userId:n}=e,{query:i,bookIds:s,maxResultsPerBook:a=5}=r,o=await t.listBooks(n),u;if(s&&s.length>0){let f=new Set(s);u=o.filter(p=>f.has(p.id)&&r_.has(p.format)&&p.storagePath!=null)}else u=o.filter(f=>r_.has(f.format)&&f.storagePath!=null);let l=[],c=[],h=0;for(let f of u){let p;try{p=await e.loadBook(f.id,f.storagePath,f.format),h++}catch{continue}let g=[],b=0;for(let m of p.spine){let y=p.chapters.get(m);if(!y)continue;let v=dF(y,i,a-g.length);b+=v.length;for(let x of v)g.length<a&&(g.push({chapterTitle:x.chapterTitle,passage:x.passage}),l.push({bookTitle:p.metadata.title,bookAuthor:p.metadata.author,chapterTitle:x.chapterTitle,passage:x.passage}))}b>0&&c.push({bookId:f.id,bookTitle:p.metadata.title,bookAuthor:p.metadata.author,matchCount:b,passages:g})}let d=c.length;if(l.length>0){let f=l.map(b=>`[${b.bookTitle} by ${b.bookAuthor??"Unknown"} \u2014 "${b.chapterTitle}"]
200
+ ${b.passage}`).join(`
201
+
202
+ ---
203
+
204
+ `),p=`Research topic: "${i}"
205
+
206
+ Passages found across ${d} book(s):
207
+
208
+ ${f}`,g=await _s({content:p,systemPrompt:cF,maxTokens:1536});if(g)return{query:i,booksSearched:h,booksWithMatches:d,samplingUsed:!0,synthesis:g}}return{query:i,booksSearched:h,booksWithMatches:d,samplingUsed:!1,results:c}}function n_(){ke("research_topic","Research a topic across all (or specified) books. Searches for the query, collects passages, and synthesizes findings via AI sampling into a research brief. Without sampling, returns structured passages grouped by book. Replaces search_library + get_passage x N pattern.",hF,fF)}import{z as yh}from"zod";var i_=new Set(["epub","txt","md","pdf","mobi","azw3","fb2"]),pF=`You are a comparative analysis assistant examining how different books discuss the same topics.
209
+
210
+ For each topic, provide:
211
+ 1. A brief summary of each book's perspective on that topic
212
+ 2. Key differences in how the books approach or frame the topic
213
+ 3. Points of agreement between books
214
+ 4. Which book provides the most compelling treatment and why
215
+
216
+ Structure your response with clear headers for each topic. Be specific and cite the books by title.
217
+ Keep the comparison to approximately 500-1000 words total.`,gF={queries:yh.array(yh.string().min(2)).min(1).max(5).describe("Topics to compare across books (1-5 queries)"),bookIds:yh.array(yh.string().uuid()).optional().describe("Optional list of specific book IDs to compare. If omitted, searches all books.")};function mF(r,e){let t=e.toLowerCase(),n=0,i=null;for(let s of r.spine){let a=r.chapters.get(s);if(!a)continue;let o=a.text.toLowerCase(),u=0;for(;u<o.length;){let l=o.indexOf(t,u);if(l===-1)break;n++,i||(i=mh(a.text,l)),u=l+1}}return{matchCount:n,topPassage:i}}async function bF(r){let e=_e(),{bookData:t,userId:n}=e,{queries:i,bookIds:s}=r,a=await t.listBooks(n),o;if(s&&s.length>0){let f=new Set(s);o=a.filter(p=>f.has(p.id)&&i_.has(p.format)&&p.storagePath!=null)}else o=a.filter(f=>i_.has(f.format)&&f.storagePath!=null);let u=[];for(let f of o)try{let p=await e.loadBook(f.id,f.storagePath,f.format);u.push({book:f,parsed:p})}catch{continue}let l=u.length,c=[],h=[];for(let f of i){let p=[],g=[];for(let{book:b,parsed:m}of u){let{matchCount:y,topPassage:v}=mF(m,f);y>0&&(p.push({bookId:b.id,bookTitle:m.metadata.title,matchCount:y,topPassage:v}),v&&g.push({bookTitle:m.metadata.title,bookAuthor:m.metadata.author,passage:v}))}p.sort((b,m)=>m.matchCount-b.matchCount),c.push({query:f,bookResults:p}),h.push({query:f,bookPassages:g})}if(h.some(f=>f.bookPassages.length>0)){let p=`Compare how these books discuss the following topics:
218
+
219
+ ${h.map(b=>{let m=b.bookPassages.map(y=>` [${y.bookTitle} by ${y.bookAuthor??"Unknown"}]
220
+ ${y.passage}`).join(`
221
+
222
+ `);return`Topic: "${b.query}"
223
+ ${m||" (No matches found)"}`}).join(`
224
+
225
+ ===
226
+
227
+ `)}`,g=await _s({content:p,systemPrompt:pF,maxTokens:2048});if(g)return{queries:i,booksSearched:l,samplingUsed:!0,comparison:g}}return{queries:i,booksSearched:l,samplingUsed:!1,results:c}}function s_(){ke("compare_across_books","Compare how different books discuss the same topics. Provide 1-5 queries and optionally limit to specific books. With sampling: returns AI-synthesized comparison. Without sampling: returns match counts and top passages per query per book.",gF,bF)}var vF=/^orsk-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Me(r){process.stderr.write(`[openread-mcp] ${r}
228
+ `)}function wF(){Me(""),Me("ERROR: OPENREAD_API_KEY environment variable is not set."),Me(""),Me("To get your API key:"),Me(" 1. Open Openread (app.openread.ai)"),Me(" 2. Go to Settings > API Keys"),Me(' 3. Click "Create API Key"'),Me(" 4. Copy the orsk-... key"),Me(""),Me("Then set it in your AI client config:"),Me(" {"),Me(' "mcpServers": {'),Me(' "openread": {'),Me(' "command": "npx",'),Me(' "args": ["-y", "@openread/mcp"],'),Me(' "env": { "OPENREAD_API_KEY": "orsk-..." }'),Me(" }"),Me(" }"),Me(" }"),Me("")}function xF(){let r=process.env.OPENREAD_API_KEY;return r||(wF(),process.exit(1)),vF.test(r)||(Me(`ERROR: Invalid API key format. Expected "orsk-{uuid}", got a ${r.length}-character string starting with "${r.slice(0,5)}..."`),process.exit(1)),r}function SF(){kT(),IT(),RT(),LT(),NT(),UT(),GT(),KT(),XT(),YT(),QT(),ZT(),t_(),n_(),s_()}async function EF(){if(process.argv.includes("--version")||process.argv.includes("-v")){let{createRequire:o}=await import("module"),l=o(import.meta.url)("../../../package.json");process.stdout.write(`${l.version}
229
+ `),process.exit(0)}let r=xF();Me("Starting OpenRead MCP server..."),Me("Authenticating...");let e=new Wo(r);try{await e.initialize(),Me(`Authenticated as ${e.getUserId()}`)}catch(o){o instanceof Error&&Me(`Authentication failed: ${o.message}`),process.exit(1)}let t=new uh,n=new ch(e,t),i=new hh(e.getSupabaseClient());eb({userId:e.getUserId(),bookData:i,loadBook:(o,u,l)=>n.loadBook(o,l??"epub"),requestId:"cli"}),SF();let s=gi(),a=new yF;await s.connect(a),ET({authManager:e,diskCache:t,transport:a}),Me("MCP server ready. Waiting for requests...")}var AF=typeof process<"u"&&!process.env.VITEST;AF&&EF().catch(r=>{Me(`Fatal error: ${r instanceof Error?r.message:String(r)}`),process.exit(1)});export{vF as API_KEY_PATTERN,Me as log,EF as main,wF as printSetupInstructions,SF as registerAllTools,xF as validateApiKey};