var mx=Object.defineProperty;var xb=h=>{throw TypeError(h)};var vx=(h,e,t)=>e in h?mx(h,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[e]=t;var M=(h,e,t)=>vx(h,typeof e!="symbol"?e+"":e,t),Sv=(h,e,t)=>e.has(h)||xb("Cannot "+t);var a=(h,e,t)=>(Sv(h,e,"read from private field"),t?t.call(h):e.get(h)),b=(h,e,t)=>e.has(h)?xb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,t),g=(h,e,t,n)=>(Sv(h,e,"write to private field"),n?n.call(h,t):e.set(h,t),t),A=(h,e,t)=>(Sv(h,e,"access private method"),t);var ie=(h,e,t,n)=>({set _(r){g(h,e,r,t)},get _(){return a(h,e,n)}});import{d as V1,w as $v,a as tb,b as Fs,c as _s,F as yx,r as bx,$ as Sb,e as bm,h as Cb,y as Ax,X as Am,k as Vc,O as Ex,a1 as Tb,N as wx,l as xx,o as Sx,t as Cx,Q as Tx,u as Px}from"./runtime-dom.esm-bundler.js";import{_ as Ix}from"./_plugin-vue_export-helper.js";var Rx={9306(h,e,t){var n=t(4901),r=t(6823),i=TypeError;h.exports=function(s){if(n(s))return s;throw new i(r(s)+" is not a function")}},3506(h,e,t){var n=t(3925),r=String,i=TypeError;h.exports=function(s){if(n(s))return s;throw new i("Can't set "+r(s)+" as a prototype")}},7080(h,e,t){var n=t(4402).has;h.exports=function(r){return n(r),r}},3463(h){var e=TypeError;h.exports=function(t){if(typeof t=="string")return t;throw new e("Argument is not a string")}},4328(h,e,t){var n=t(4995),r=new n.WeakMap,i=n.set,s=n.remove;h.exports=function(o){return i(r,o,1),s(r,o),o}},6557(h,e,t){var n=t(4995).has;h.exports=function(r){return n(r),r}},6469(h,e,t){var n=t(608),r=t(2360),i=t(4913).f,s=n("unscopables"),o=Array.prototype;o[s]===void 0&&i(o,s,{configurable:!0,value:r(null)}),h.exports=function(l){o[s][l]=!0}},679(h,e,t){var n=t(1625),r=TypeError;h.exports=function(i,s){if(n(s,i))return i;throw new r("Incorrect invocation")}},3972(h,e,t){var n=t(34),r=String,i=TypeError;h.exports=function(s){if(s===void 0||n(s))return s;throw new i(r(s)+" is not an object or undefined")}},8551(h,e,t){var n=t(34),r=String,i=TypeError;h.exports=function(s){if(n(s))return s;throw new i(r(s)+" is not an object")}},4154(h,e,t){var n=t(6955),r=TypeError;h.exports=function(i){if(n(i)==="Uint8Array")return i;throw new r("Argument is not an Uint8Array")}},7811(h){h.exports=typeof ArrayBuffer<"u"&&typeof DataView<"u"},7394(h,e,t){var n=t(4576),r=t(6706),i=t(2195),s=n.ArrayBuffer,o=n.TypeError;h.exports=s&&r(s.prototype,"byteLength","get")||function(l){if(i(l)!=="ArrayBuffer")throw new o("ArrayBuffer expected");return l.byteLength}},3238(h,e,t){var n=t(4576),r=t(7811),i=t(7394),s=n.DataView;h.exports=function(o){if(!r||i(o)!==0)return!1;try{return new s(o),!1}catch{return!0}}},5169(h,e,t){var n=t(3238),r=TypeError;h.exports=function(i){if(n(i))throw new r("ArrayBuffer is detached");return i}},5636(h,e,t){var n=t(4576),r=t(9504),i=t(6706),s=t(7696),o=t(5169),l=t(7394),u=t(4483),c=t(1548),d=n.structuredClone,f=n.ArrayBuffer,p=n.DataView,m=Math.max,v=Math.min,y=f.prototype,E=p.prototype,S=r(y.slice),w=i(y,"resizable","get"),C=i(y,"maxByteLength","get"),x=r(E.getInt8),T=r(E.setInt8);h.exports=(c||u)&&function(I,F,P){var R=l(I),D=F===void 0?R:s(F),k=!w||!w(I),N;if(o(I),c&&(I=d(I,{transfer:[I]}),R===D&&(P||k)))return I;if(R>=D&&(!P||k))N=S(I,0,D);else{var H=P&&!k&&C?{maxByteLength:m(D,C(I))}:void 0;N=new f(D,H);for(var X=new p(I),j=new p(N),U=v(D,R),z=0;z2?s:n(i),u=new r(l);l>o;)u[o]=i[o++];return u}},9617(h,e,t){var n=t(5397),r=t(5610),i=t(6198),s=function(o){return function(l,u,c){var d=n(l),f=i(d);if(f===0)return!o&&-1;var p=r(c,f),m;if(o&&u!==u){for(;f>p;)if(m=d[p++],m!==m)return!0}else for(;f>p;p++)if((o||p in d)&&d[p]===u)return o||p||0;return!o&&-1}};h.exports={includes:s(!0),indexOf:s(!1)}},4527(h,e,t){var n=t(3724),r=t(4376),i=TypeError,s=Object.getOwnPropertyDescriptor,o=n&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(l){return l instanceof TypeError}}();h.exports=o?function(l,u){if(r(l)&&!s(l,"length").writable)throw new i("Cannot set read only .length");return l.length=u}:function(l,u){return l.length=u}},7680(h,e,t){var n=t(9504);h.exports=n([].slice)},2804(h){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=e+"+/",n=e+"-_",r=function(i){for(var s={},o=0;o<64;o++)s[i.charAt(o)]=o;return s};h.exports={i2c:t,c2i:r(t),i2cUrl:n,c2iUrl:r(n)}},6319(h,e,t){var n=t(8551),r=t(9539);h.exports=function(i,s,o,l){try{return l?s(n(o)[0],o[1]):s(o)}catch(u){r(i,"throw",u)}}},2195(h,e,t){var n=t(9504),r=n({}.toString),i=n("".slice);h.exports=function(s){return i(r(s),8,-1)}},6955(h,e,t){var n=t(2140),r=t(4901),i=t(2195),s=t(608),o=s("toStringTag"),l=Object,u=i(function(){return arguments}())==="Arguments",c=function(d,f){try{return d[f]}catch{}};h.exports=n?i:function(d){var f,p,m;return d===void 0?"Undefined":d===null?"Null":typeof(p=c(f=l(d),o))=="string"?p:u?i(f):(m=i(f))==="Object"&&r(f.callee)?"Arguments":m}},7740(h,e,t){var n=t(9297),r=t(5031),i=t(7347),s=t(4913);h.exports=function(o,l,u){for(var c=r(l),d=s.f,f=i.f,p=0;pt)throw new e("Maximum allowed index exceeded");return n}},5002(h){h.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}}},8727(h){h.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6193(h,e,t){var n=t(4215);h.exports=n==="NODE"},2839(h,e,t){var n=t(4576),r=n.navigator,i=r&&r.userAgent;h.exports=i?String(i):""},9519(h,e,t){var n=t(4576),r=t(2839),i=n.process,s=n.Deno,o=i&&i.versions||s&&s.version,l=o&&o.v8,u,c;l&&(u=l.split("."),c=u[0]>0&&u[0]<4?1:+(u[0]+u[1])),!c&&r&&(u=r.match(/Edge\/(\d+)/),(!u||u[1]>=74)&&(u=r.match(/Chrome\/(\d+)/),u&&(c=+u[1]))),h.exports=c},4215(h,e,t){var n=t(4576),r=t(2839),i=t(2195),s=function(o){return r.slice(0,o.length)===o};h.exports=function(){return s("Bun/")?"BUN":s("Cloudflare-Workers")?"CLOUDFLARE":s("Deno/")?"DENO":s("Node.js/")?"NODE":n.Bun&&typeof Bun.version=="string"?"BUN":n.Deno&&typeof Deno.version=="object"?"DENO":i(n.process)==="process"?"NODE":n.window&&n.document?"BROWSER":"REST"}()},8574(h,e,t){var n=t(9504),r=Error,i=n("".replace),s=function(u){return String(new r(u).stack)}("zxcasd"),o=/\n\s*at [^:]*:[^\n]*/,l=o.test(s);h.exports=function(u,c){if(l&&typeof u=="string"&&!r.prepareStackTrace)for(;c--;)u=i(u,o,"");return u}},6518(h,e,t){var n=t(4576),r=t(7347).f,i=t(6699),s=t(6840),o=t(9433),l=t(7740),u=t(2796);h.exports=function(c,d){var f=c.target,p=c.global,m=c.stat,v,y,E,S,w,C;if(p?y=n:m?y=n[f]||o(f,{}):y=n[f]&&n[f].prototype,y)for(E in d){if(w=d[E],c.dontCallGetSet?(C=r(y,E),S=C&&C.value):S=y[E],v=u(p?E:f+(m?".":"#")+E,c.forced),!v&&S!==void 0){if(typeof w==typeof S)continue;l(w,S)}(c.sham||S&&S.sham)&&i(w,"sham",!0),s(y,E,w,c)}}},9039(h){h.exports=function(e){try{return!!e()}catch{return!0}}},8745(h,e,t){var n=t(616),r=Function.prototype,i=r.apply,s=r.call;h.exports=typeof Reflect=="object"&&Reflect.apply||(n?s.bind(i):function(){return s.apply(i,arguments)})},6080(h,e,t){var n=t(7476),r=t(9306),i=t(616),s=n(n.bind);h.exports=function(o,l){return r(o),l===void 0?o:i?s(o,l):function(){return o.apply(l,arguments)}}},616(h,e,t){var n=t(9039);h.exports=!n(function(){var r=(function(){}).bind();return typeof r!="function"||r.hasOwnProperty("prototype")})},9565(h,e,t){var n=t(616),r=Function.prototype.call;h.exports=n?r.bind(r):function(){return r.apply(r,arguments)}},350(h,e,t){var n=t(3724),r=t(9297),i=Function.prototype,s=n&&Object.getOwnPropertyDescriptor,o=r(i,"name"),l=o&&(function(){}).name==="something",u=o&&(!n||n&&s(i,"name").configurable);h.exports={EXISTS:o,PROPER:l,CONFIGURABLE:u}},6706(h,e,t){var n=t(9504),r=t(9306);h.exports=function(i,s,o){try{return n(r(Object.getOwnPropertyDescriptor(i,s)[o]))}catch{}}},7476(h,e,t){var n=t(2195),r=t(9504);h.exports=function(i){if(n(i)==="Function")return r(i)}},9504(h,e,t){var n=t(616),r=Function.prototype,i=r.call,s=n&&r.bind.bind(i,i);h.exports=n?s:function(o){return function(){return i.apply(o,arguments)}}},944(h){var e=TypeError;h.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")}},9429(h,e,t){var n=t(4576),r=t(6193);h.exports=function(i){if(r){try{return n.process.getBuiltinModule(i)}catch{}try{return Function('return require("'+i+'")')()}catch{}}}},7751(h,e,t){var n=t(4576),r=t(4901),i=function(s){return r(s)?s:void 0};h.exports=function(s,o){return arguments.length<2?i(n[s]):n[s]&&n[s][o]}},1767(h){h.exports=function(e){return{iterator:e,next:e.next,done:!1}}},8646(h,e,t){var n=t(9565),r=t(8551),i=t(1767),s=t(851);h.exports=function(o,l){(!l||typeof o!="string")&&r(o);var u=s(o);return i(r(u!==void 0?n(u,o):o))}},851(h,e,t){var n=t(6955),r=t(5966),i=t(4117),s=t(6269),o=t(608),l=o("iterator");h.exports=function(u){if(!i(u))return r(u,l)||r(u,"@@iterator")||s[n(u)]}},81(h,e,t){var n=t(9565),r=t(9306),i=t(8551),s=t(6823),o=t(851),l=TypeError;h.exports=function(u,c){var d=arguments.length<2?o(u):c;if(r(d))return i(n(d,u));throw new l(s(u)+" is not iterable")}},5966(h,e,t){var n=t(9306),r=t(4117);h.exports=function(i,s){var o=i[s];return r(o)?void 0:n(o)}},3789(h,e,t){var n=t(9306),r=t(8551),i=t(9565),s=t(1291),o=t(1767),l="Invalid size",u=RangeError,c=TypeError,d=Math.max,f=function(p,m){this.set=p,this.size=d(m,0),this.has=n(p.has),this.keys=n(p.keys)};f.prototype={getIterator:function(){return o(r(i(this.keys,this.set)))},includes:function(p){return i(this.has,this.set,p)}},h.exports=function(p){r(p);var m=+p.size;if(m!==m)throw new c(l);var v=s(m);if(v<0)throw new u(l);return new f(p,v)}},4576(h){var e=function(t){return t&&t.Math===Math&&t};h.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")()},9297(h,e,t){var n=t(9504),r=t(8981),i=n({}.hasOwnProperty);h.exports=Object.hasOwn||function(o,l){return i(r(o),l)}},421(h){h.exports={}},397(h,e,t){var n=t(7751);h.exports=n("document","documentElement")},5917(h,e,t){var n=t(3724),r=t(9039),i=t(4055);h.exports=!n&&!r(function(){return Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a!==7})},7055(h,e,t){var n=t(9504),r=t(9039),i=t(2195),s=Object,o=n("".split);h.exports=r(function(){return!s("z").propertyIsEnumerable(0)})?function(l){return i(l)==="String"?o(l,""):s(l)}:s},3167(h,e,t){var n=t(4901),r=t(34),i=t(2967);h.exports=function(s,o,l){var u,c;return i&&n(u=o.constructor)&&u!==l&&r(c=u.prototype)&&c!==l.prototype&&i(s,c),s}},3706(h,e,t){var n=t(9504),r=t(4901),i=t(7629),s=n(Function.toString);r(i.inspectSource)||(i.inspectSource=function(o){return s(o)}),h.exports=i.inspectSource},1181(h,e,t){var n=t(8622),r=t(4576),i=t(34),s=t(6699),o=t(9297),l=t(7629),u=t(6119),c=t(421),d="Object already initialized",f=r.TypeError,p=r.WeakMap,m,v,y,E=function(x){return y(x)?v(x):m(x,{})},S=function(x){return function(T){var I;if(!i(T)||(I=v(T)).type!==x)throw new f("Incompatible receiver, "+x+" required");return I}};if(n||l.state){var w=l.state||(l.state=new p);w.get=w.get,w.has=w.has,w.set=w.set,m=function(x,T){if(w.has(x))throw new f(d);return T.facade=x,w.set(x,T),T},v=function(x){return w.get(x)||{}},y=function(x){return w.has(x)}}else{var C=u("state");c[C]=!0,m=function(x,T){if(o(x,C))throw new f(d);return T.facade=x,s(x,C,T),T},v=function(x){return o(x,C)?x[C]:{}},y=function(x){return o(x,C)}}h.exports={set:m,get:v,has:y,enforce:E,getterFor:S}},4209(h,e,t){var n=t(608),r=t(6269),i=n("iterator"),s=Array.prototype;h.exports=function(o){return o!==void 0&&(r.Array===o||s[i]===o)}},4376(h,e,t){var n=t(2195);h.exports=Array.isArray||function(i){return n(i)==="Array"}},1108(h,e,t){var n=t(6955);h.exports=function(r){var i=n(r);return i==="BigInt64Array"||i==="BigUint64Array"}},4901(h){var e=typeof document=="object"&&document.all;h.exports=typeof e>"u"&&e!==void 0?function(t){return typeof t=="function"||t===e}:function(t){return typeof t=="function"}},2796(h,e,t){var n=t(9039),r=t(4901),i=/#|\.prototype\./,s=function(d,f){var p=l[o(d)];return p===c?!0:p===u?!1:r(f)?n(f):!!f},o=s.normalize=function(d){return String(d).replace(i,".").toLowerCase()},l=s.data={},u=s.NATIVE="N",c=s.POLYFILL="P";h.exports=s},4117(h){h.exports=function(e){return e==null}},34(h,e,t){var n=t(4901);h.exports=function(r){return typeof r=="object"?r!==null:n(r)}},3925(h,e,t){var n=t(34);h.exports=function(r){return n(r)||r===null}},6395(h){h.exports=!1},5810(h,e,t){var n=t(34),r=t(1181).get;h.exports=function(s){if(!n(s))return!1;var o=r(s);return!!o&&o.type==="RawJSON"}},757(h,e,t){var n=t(7751),r=t(4901),i=t(1625),s=t(7040),o=Object;h.exports=s?function(l){return typeof l=="symbol"}:function(l){var u=n("Symbol");return r(u)&&i(u.prototype,o(l))}},507(h,e,t){var n=t(9565);h.exports=function(r,i,s){for(var o=s?r:r.iterator,l=r.next,u,c;!(u=n(l,o)).done;)if(c=i(u.value),c!==void 0)return c}},2652(h,e,t){var n=t(6080),r=t(9565),i=t(8551),s=t(6823),o=t(4209),l=t(6198),u=t(1625),c=t(81),d=t(851),f=t(9539),p=TypeError,m=function(y,E){this.stopped=y,this.result=E},v=m.prototype;h.exports=function(y,E,S){var w=S&&S.that,C=!!(S&&S.AS_ENTRIES),x=!!(S&&S.IS_RECORD),T=!!(S&&S.IS_ITERATOR),I=!!(S&&S.INTERRUPTED),F=n(E,w),P,R,D,k,N,H,X,j=function(G){var nt=P;return P=void 0,nt&&f(nt,"normal"),new m(!0,G)},U=function(G){return C?(i(G),I?F(G[0],G[1],j):F(G[0],G[1])):I?F(G,j):F(G)};if(x)P=y.iterator;else if(T)P=y;else{if(R=d(y),!R)throw new p(s(y)+" is not iterable");if(o(R)){for(D=0,k=l(y);k>D;D++)if(N=U(y[D]),N&&u(v,N))return N;return new m(!1)}P=c(y,R)}for(H=x?y.next:P.next;!(X=r(H,P)).done;){var z=X.value;try{N=U(z)}catch(G){if(P)f(P,"throw",G);else throw G}if(typeof N=="object"&&N&&u(v,N))return N}return new m(!1)}},1385(h,e,t){var n=t(9539);h.exports=function(r,i,s){for(var o=r.length-1;o>=0;o--)if(r[o]!==void 0)try{s=n(r[o].iterator,i,s)}catch(l){i="throw",s=l}if(i==="throw")throw s;return s}},9539(h,e,t){var n=t(9565),r=t(8551),i=t(5966);h.exports=function(s,o,l){var u,c;r(s);try{if(u=i(s,"return"),!u){if(o==="throw")throw l;return l}u=n(u,s)}catch(d){c=!0,u=d}if(o==="throw")throw l;if(c)throw u;return r(u),l}},9462(h,e,t){var n=t(9565),r=t(2360),i=t(6699),s=t(6279),o=t(608),l=t(1181),u=t(5966),c=t(7657).IteratorPrototype,d=t(2529),f=t(9539),p=t(1385),m=o("toStringTag"),v="IteratorHelper",y="WrapForValidIterator",E="normal",S="throw",w=l.set,C=function(I){var F=l.getterFor(I?y:v);return s(r(c),{next:function(){var R=F(this);if(I)return R.nextHandler();if(R.done)return d(void 0,!0);try{var D=R.nextHandler();return R.returnHandlerResult?D:d(D,R.done)}catch(k){throw R.done=!0,k}},return:function(){var P=F(this),R=P.iterator,D=P.done;if(P.done=!0,I){var k=u(R,"return");return k?n(k,R):d(void 0,!0)}if(D)return d(void 0,!0);if(P.inner)try{f(P.inner.iterator,E)}catch(N){return f(R,S,N)}if(P.openIters)try{p(P.openIters,E)}catch(N){if(R)return f(R,S,N);throw N}return R&&f(R,E),d(void 0,!0)}})},x=C(!0),T=C(!1);i(T,m,"Iterator Helper"),h.exports=function(I,F,P){var R=function(k,N){N?(N.iterator=k.iterator,N.next=k.next):N=k,N.type=F?y:v,N.returnHandlerResult=!!P,N.nextHandler=I,N.counter=0,N.done=!1,w(this,N)};return R.prototype=F?x:T,R}},684(h){h.exports=function(e,t){var n=typeof Iterator=="function"&&Iterator.prototype[e];if(n)try{n.call({next:null},t).next()}catch{return!0}}},4549(h,e,t){var n=t(4576);h.exports=function(r,i){var s=n.Iterator,o=s&&s.prototype,l=o&&o[r],u=!1;if(l)try{l.call({next:function(){return{done:!0}},return:function(){u=!0}},-1)}catch(c){c instanceof i||(u=!1)}if(!u)return l}},7657(h,e,t){var n=t(9039),r=t(4901),i=t(34),s=t(2360),o=t(2787),l=t(6840),u=t(608),c=t(6395),d=u("iterator"),f=!1,p,m,v;[].keys&&(v=[].keys(),"next"in v?(m=o(o(v)),m!==Object.prototype&&(p=m)):f=!0);var y=!i(p)||n(function(){var E={};return p[d].call(E)!==E});y?p={}:c&&(p=s(p)),r(p[d])||l(p,d,function(){return this}),h.exports={IteratorPrototype:p,BUGGY_SAFARI_ITERATORS:f}},6269(h){h.exports={}},6198(h,e,t){var n=t(8014);h.exports=function(r){return n(r.length)}},283(h,e,t){var n=t(9504),r=t(9039),i=t(4901),s=t(9297),o=t(3724),l=t(350).CONFIGURABLE,u=t(3706),c=t(1181),d=c.enforce,f=c.get,p=String,m=Object.defineProperty,v=n("".slice),y=n("".replace),E=n([].join),S=o&&!r(function(){return m(function(){},"length",{value:8}).length!==8}),w=String(String).split("String"),C=h.exports=function(x,T,I){v(p(T),0,7)==="Symbol("&&(T="["+y(p(T),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),I&&I.getter&&(T="get "+T),I&&I.setter&&(T="set "+T),(!s(x,"name")||l&&x.name!==T)&&(o?m(x,"name",{value:T,configurable:!0}):x.name=T),S&&I&&s(I,"arity")&&x.length!==I.arity&&m(x,"length",{value:I.arity});try{I&&s(I,"constructor")&&I.constructor?o&&m(x,"prototype",{writable:!1}):x.prototype&&(x.prototype=void 0)}catch{}var F=d(x);return s(F,"source")||(F.source=E(w,typeof T=="string"?T:"")),x};Function.prototype.toString=C(function(){return i(this)&&f(this).source||u(this)},"toString")},2248(h,e,t){var n=t(9504),r=Map.prototype;h.exports={Map,set:n(r.set),get:n(r.get),has:n(r.has),remove:n(r.delete),proto:r}},741(h){var e=Math.ceil,t=Math.floor;h.exports=Math.trunc||function(r){var i=+r;return(i>0?t:e)(i)}},7819(h,e,t){var n=t(9039);h.exports=!n(function(){var r="9007199254740993",i=JSON.rawJSON(r);return!JSON.isRawJSON(i)||JSON.stringify(i)!==r})},6043(h,e,t){var n=t(9306),r=TypeError,i=function(s){var o,l;this.promise=new s(function(u,c){if(o!==void 0||l!==void 0)throw new r("Bad Promise constructor");o=u,l=c}),this.resolve=n(o),this.reject=n(l)};h.exports.f=function(s){return new i(s)}},2603(h,e,t){var n=t(655);h.exports=function(r,i){return r===void 0?arguments.length<2?"":i:n(r)}},4149(h){var e=RangeError;h.exports=function(t){if(t===t)return t;throw new e("NaN is not allowed")}},2360(h,e,t){var n=t(8551),r=t(6801),i=t(8727),s=t(421),o=t(397),l=t(4055),u=t(6119),c=">",d="<",f="prototype",p="script",m=u("IE_PROTO"),v=function(){},y=function(x){return d+p+c+x+d+"/"+p+c},E=function(x){x.write(y("")),x.close();var T=x.parentWindow.Object;return x=null,T},S=function(){var x=l("iframe"),T="java"+p+":",I;return x.style.display="none",o.appendChild(x),x.src=String(T),I=x.contentWindow.document,I.open(),I.write(y("document.F=Object")),I.close(),I.F},w,C=function(){try{w=new ActiveXObject("htmlfile")}catch{}C=typeof document<"u"?document.domain&&w?E(w):S():E(w);for(var x=i.length;x--;)delete C[f][i[x]];return C()};s[m]=!0,h.exports=Object.create||function(T,I){var F;return T!==null?(v[f]=n(T),F=new v,v[f]=null,F[m]=T):F=C(),I===void 0?F:r.f(F,I)}},6801(h,e,t){var n=t(3724),r=t(8686),i=t(4913),s=t(8551),o=t(5397),l=t(1072);e.f=n&&!r?Object.defineProperties:function(c,d){s(c);for(var f=o(d),p=l(d),m=p.length,v=0,y;m>v;)i.f(c,y=p[v++],f[y]);return c}},4913(h,e,t){var n=t(3724),r=t(5917),i=t(8686),s=t(8551),o=t(6969),l=TypeError,u=Object.defineProperty,c=Object.getOwnPropertyDescriptor,d="enumerable",f="configurable",p="writable";e.f=n?i?function(v,y,E){if(s(v),y=o(y),s(E),typeof v=="function"&&y==="prototype"&&"value"in E&&p in E&&!E[p]){var S=c(v,y);S&&S[p]&&(v[y]=E.value,E={configurable:f in E?E[f]:S[f],enumerable:d in E?E[d]:S[d],writable:!1})}return u(v,y,E)}:u:function(v,y,E){if(s(v),y=o(y),s(E),r)try{return u(v,y,E)}catch{}if("get"in E||"set"in E)throw new l("Accessors not supported");return"value"in E&&(v[y]=E.value),v}},7347(h,e,t){var n=t(3724),r=t(9565),i=t(8773),s=t(6980),o=t(5397),l=t(6969),u=t(9297),c=t(5917),d=Object.getOwnPropertyDescriptor;e.f=n?d:function(p,m){if(p=o(p),m=l(m),c)try{return d(p,m)}catch{}if(u(p,m))return s(!r(i.f,p,m),p[m])}},8480(h,e,t){var n=t(1828),r=t(8727),i=r.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(o){return n(o,i)}},3717(h,e){e.f=Object.getOwnPropertySymbols},2787(h,e,t){var n=t(9297),r=t(4901),i=t(8981),s=t(6119),o=t(2211),l=s("IE_PROTO"),u=Object,c=u.prototype;h.exports=o?u.getPrototypeOf:function(d){var f=i(d);if(n(f,l))return f[l];var p=f.constructor;return r(p)&&f instanceof p?p.prototype:f instanceof u?c:null}},1625(h,e,t){var n=t(9504);h.exports=n({}.isPrototypeOf)},1828(h,e,t){var n=t(9504),r=t(9297),i=t(5397),s=t(9617).indexOf,o=t(421),l=n([].push);h.exports=function(u,c){var d=i(u),f=0,p=[],m;for(m in d)!r(o,m)&&r(d,m)&&l(p,m);for(;c.length>f;)r(d,m=c[f++])&&(~s(p,m)||l(p,m));return p}},1072(h,e,t){var n=t(1828),r=t(8727);h.exports=Object.keys||function(s){return n(s,r)}},8773(h,e){var t={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!t.call({1:2},1);e.f=r?function(s){var o=n(this,s);return!!o&&o.enumerable}:t},2967(h,e,t){var n=t(6706),r=t(34),i=t(7750),s=t(3506);h.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var o=!1,l={},u;try{u=n(Object.prototype,"__proto__","set"),u(l,[]),o=l instanceof Array}catch{}return function(d,f){return i(d),s(f),r(d)&&(o?u(d,f):d.__proto__=f),d}}():void 0)},4270(h,e,t){var n=t(9565),r=t(4901),i=t(34),s=TypeError;h.exports=function(o,l){var u,c;if(l==="string"&&r(u=o.toString)&&!i(c=n(u,o))||r(u=o.valueOf)&&!i(c=n(u,o))||l!=="string"&&r(u=o.toString)&&!i(c=n(u,o)))return c;throw new s("Can't convert object to primitive value")}},5031(h,e,t){var n=t(7751),r=t(9504),i=t(8480),s=t(3717),o=t(8551),l=r([].concat);h.exports=n("Reflect","ownKeys")||function(c){var d=i.f(o(c)),f=s.f;return f?l(d,f(c)):d}},8235(h,e,t){var n=t(9504),r=t(9297),i=SyntaxError,s=parseInt,o=String.fromCharCode,l=n("".charAt),u=n("".slice),c=n(/./.exec),d={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":` `,"\\r":"\r","\\t":" "},f=/^[\da-f]{4}$/i,p=/^[\u0000-\u001F]$/;h.exports=function(m,v){for(var y=!0,E="";vv.size?l(v.getIterator(),function(E){d(m,E)&&c(y,E)}):o(m,function(E){v.includes(E)&&c(y,E)}),y}},4449(h,e,t){var n=t(7080),r=t(4402).has,i=t(5170),s=t(3789),o=t(8469),l=t(507),u=t(9539);h.exports=function(d){var f=n(this),p=s(d);if(i(f)<=p.size)return o(f,function(v){if(p.includes(v))return!1},!0)!==!1;var m=p.getIterator();return l(m,function(v){if(r(f,v))return u(m.iterator,"normal",!1)})!==!1}},3838(h,e,t){var n=t(7080),r=t(5170),i=t(8469),s=t(3789);h.exports=function(l){var u=n(this),c=s(l);return r(u)>c.size?!1:i(u,function(d){if(!c.includes(d))return!1},!0)!==!1}},8527(h,e,t){var n=t(7080),r=t(4402).has,i=t(5170),s=t(3789),o=t(507),l=t(9539);h.exports=function(c){var d=n(this),f=s(c);if(i(d)92||s==="NODE"&&i>94||s==="BROWSER"&&i>97)return!1;var l=new ArrayBuffer(8),u=o(l,{transfer:[l]});return l.byteLength!==0||u.byteLength!==8})},4495(h,e,t){var n=t(9519),r=t(9039),i=t(4576),s=i.String;h.exports=!!Object.getOwnPropertySymbols&&!r(function(){var o=Symbol("symbol detection");return!s(o)||!(Object(o)instanceof Symbol)||!Symbol.sham&&n&&n<41})},5610(h,e,t){var n=t(1291),r=Math.max,i=Math.min;h.exports=function(s,o){var l=n(s);return l<0?r(l+o,0):i(l,o)}},5854(h,e,t){var n=t(2777),r=TypeError;h.exports=function(i){var s=n(i,"number");if(typeof s=="number")throw new r("Can't convert number to bigint");return BigInt(s)}},7696(h,e,t){var n=t(1291),r=t(8014),i=RangeError;h.exports=function(s){if(s===void 0)return 0;var o=n(s),l=r(o);if(o!==l)throw new i("Wrong length or index");return l}},5397(h,e,t){var n=t(7055),r=t(7750);h.exports=function(i){return n(r(i))}},1291(h,e,t){var n=t(741);h.exports=function(r){var i=+r;return i!==i||i===0?0:n(i)}},8014(h,e,t){var n=t(1291),r=Math.min;h.exports=function(i){var s=n(i);return s>0?r(s,9007199254740991):0}},8981(h,e,t){var n=t(7750),r=Object;h.exports=function(i){return r(n(i))}},9590(h,e,t){var n=t(1291),r=RangeError;h.exports=function(i){var s=n(i);if(s<0)throw new r("The argument can't be less than 0");return s}},2777(h,e,t){var n=t(9565),r=t(34),i=t(757),s=t(5966),o=t(4270),l=t(608),u=TypeError,c=l("toPrimitive");h.exports=function(d,f){if(!r(d)||i(d))return d;var p=s(d,c),m;if(p){if(f===void 0&&(f="default"),m=n(p,d,f),!r(m)||i(m))return m;throw new u("Can't convert object to primitive value")}return f===void 0&&(f="number"),o(d,f)}},6969(h,e,t){var n=t(2777),r=t(757);h.exports=function(i){var s=n(i,"string");return r(s)?s:s+""}},2140(h,e,t){var n=t(608),r=n("toStringTag"),i={};i[r]="z",h.exports=String(i)==="[object z]"},655(h,e,t){var n=t(6955),r=String;h.exports=function(i){if(n(i)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return r(i)}},6823(h){var e=String;h.exports=function(t){try{return e(t)}catch{return"Object"}}},3392(h,e,t){var n=t(9504),r=0,i=Math.random(),s=n(1.1.toString);h.exports=function(o){return"Symbol("+(o===void 0?"":o)+")_"+s(++r+i,36)}},9143(h,e,t){var n=t(4576),r=t(9504),i=t(3972),s=t(3463),o=t(9297),l=t(2804),u=t(944),c=t(5169),d=l.c2i,f=l.c2iUrl,p=n.SyntaxError,m=n.TypeError,v=r("".charAt),y=function(w,C){for(var x=w.length;C>16&255,I>>8&255,I&255];if(T===2){if(x&&F[1]!==0)throw new p("Extra bits");return[F[0]]}if(T===3){if(x&&F[2]!==0)throw new p("Extra bits");return[F[0],F[1]]}return F},S=function(w,C,x){for(var T=C.length,I=0;I0){if(F==="stop-before-partial")break;if(F==="loose"){if(N.length===1)throw new p("Malformed padding: exactly one additional character");D=S(R,E(N,I,!1),D)}else throw new p("Missing padding")}k=P;break}var X=v(w,H);if(++H,X==="="){if(N.length<2)throw new p("Padding is too early");if(H=y(w,H),N.length===2){if(H===P){if(F==="stop-before-partial")break;throw new p("Malformed padding: only one =")}v(w,H)==="="&&(++H,H=y(w,H))}if(H>4}return{bytes:p,read:v<<1}}},7416(h,e,t){var n=t(9039),r=t(608),i=t(3724),s=t(6395),o=r("iterator");h.exports=!n(function(){var l=new URL("b?a=1&b=2&c=3","https://a"),u=l.searchParams,c=new URLSearchParams("a=1&a=2&b=3"),d="";return l.pathname="c%20d",u.forEach(function(f,p){u.delete("b"),d+=p+f}),c.delete("a",2),c.delete("b",void 0),s&&(!l.toJSON||!c.has("a",1)||c.has("a",2)||!c.has("a",void 0)||c.has("b"))||!u.size&&(s||!i)||!u.sort||l.href!=="https://a/c%20d?a=1&c=3"||u.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!u[o]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("https://тест").host!=="xn--e1aybc"||new URL("https://a#б").hash!=="#%D0%B1"||d!=="a1c3"||new URL("https://x",void 0).host!=="x"})},7040(h,e,t){var n=t(4495);h.exports=n&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},8686(h,e,t){var n=t(3724),r=t(9039);h.exports=n&&r(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})},2812(h){var e=TypeError;h.exports=function(t,n){if(t1?arguments[1]:void 0)}}),s("includes")},4114(h,e,t){var n=t(6518),r=t(8981),i=t(6198),s=t(4527),o=t(6837),l=t(9039),u=l(function(){return[].push.call({length:4294967296},1)!==4294967297}),c=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(f){return f instanceof TypeError}},d=u||!c();n({target:"Array",proto:!0,arity:1,forced:d},{push:function(p){var m=r(this),v=i(m),y=arguments.length;o(v+y);for(var E=0;Em)throw new s("Maximum allowed index exceeded");if(typeof B!="number")throw new o("Value is not a number");D!==E&&(B!==B?D=E:B===l?D=D===S?E:w:B===-l?D=D===w?E:S:(B!==0||1/B===l)&&(D===C||D===x)&&(D=x,f(P,B)))}),D){case E:return u;case S:return-l;case w:return l;case C:return-0}for(var k=[],N=0,H,X,j,U,z,G,nt=0;nt=0?k[lt]:0;if(lt--,c(N)>1||N>0&&st>0||N<0&&st<0)return N>0?l:-l;if(j=T(N*p,st/2),U=j.hi,z=j.lo,z*=2,c(2*U)===l)return U>0?U===p&&z===-(y/2)&<>=0&&k[lt]<0?v:l:U===-p&&z===y/2&<>=0&&k[lt]>0?-v:-l;z!==0&&(k[++lt]=z,z=0),U*=2}for(;lt>=0&&(j=T(U,k[lt--]),U=j.hi,z=j.lo,z===0););return lt>=0&&(z<0&&k[lt]<0||z>0&&k[lt]>0)&&(X=z*2,H=U+X,X===H-U&&(U=H)),U}})},1689(h,e,t){var n=t(6518),r=t(4576),i=t(8745),s=t(7680),o=t(6043),l=t(9306),u=t(1103),c=r.Promise,d=!1,f=!c||!c.try||u(function(){c.try(function(p){d=p===8},8)}).error||!d;n({target:"Promise",stat:!0,forced:f},{try:function(p){var m=arguments.length>1?s(arguments,1):[],v=o.f(this),y=u(function(){return i(l(p),void 0,m)});return(y.error?v.reject:v.resolve)(y.value),v.promise}})},4628(h,e,t){var n=t(6518),r=t(6043);n({target:"Promise",stat:!0},{withResolvers:function(){var s=r.f(this);return{promise:s.promise,resolve:s.resolve,reject:s.reject}}})},7642(h,e,t){var n=t(6518),r=t(3440),i=t(9039),s=t(4916),o=!s("difference",function(u){return u.size===0}),l=o||i(function(){var u={size:1,has:function(){return!0},keys:function(){var d=0;return{next:function(){var f=d++>1;return c.has(1)&&c.clear(),{done:f,value:2}}}}},c=new Set([1,2,3,4]);return c.difference(u).size!==3});n({target:"Set",proto:!0,real:!0,forced:l},{difference:r})},8004(h,e,t){var n=t(6518),r=t(9039),i=t(8750),s=t(4916),o=!s("intersection",function(l){return l.size===2&&l.has(1)&&l.has(2)})||r(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:i})},3853(h,e,t){var n=t(6518),r=t(4449),i=t(4916),s=!i("isDisjointFrom",function(o){return!o});n({target:"Set",proto:!0,real:!0,forced:s},{isDisjointFrom:r})},5876(h,e,t){var n=t(6518),r=t(3838),i=t(4916),s=!i("isSubsetOf",function(o){return o});n({target:"Set",proto:!0,real:!0,forced:s},{isSubsetOf:r})},2475(h,e,t){var n=t(6518),r=t(8527),i=t(4916),s=!i("isSupersetOf",function(o){return!o});n({target:"Set",proto:!0,real:!0,forced:s},{isSupersetOf:r})},5024(h,e,t){var n=t(6518),r=t(3650),i=t(9835),s=t(4916),o=!s("symmetricDifference")||!i("symmetricDifference");n({target:"Set",proto:!0,real:!0,forced:o},{symmetricDifference:r})},1698(h,e,t){var n=t(6518),r=t(4204),i=t(9835),s=t(4916),o=!s("union")||!i("union");n({target:"Set",proto:!0,real:!0,forced:o},{union:r})},9577(h,e,t){var n=t(4644),r=t(1108),i=t(6198),s=t(1291),o=t(5854),l=n.aTypedArray,u=n.getTypedArrayConstructor,c=n.exportTypedArrayMethod,d=RangeError,f=function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(m){return m===8}}(),p=f&&function(){try{new Int8Array(1).with(-.5,1)}catch{return!0}}();c("with",function(m,v){var y=l(this),E=i(y),S=s(m),w=S<0?E+S:S,C=r(y)?o(v):+v;if(w>=E||w<0)throw new d("Incorrect index");for(var x=new(u(y))(E),T=0;T1?arguments[1]:void 0,null,9007199254740991);return i(o,d.bytes)}})},6632(h,e,t){var n=t(6518),r=t(4576),i=t(9143),s=t(4154),o=r.Uint8Array,l=!o||!o.prototype.setFromBase64||!function(){var u=new o([255,255,255,255,255]);try{u.setFromBase64("",null);return}catch{}try{u.setFromBase64("a");return}catch{}try{u.setFromBase64("MjYyZg===")}catch{return u[0]===50&&u[1]===54&&u[2]===50&&u[3]===255&&u[4]===255}}();o&&n({target:"Uint8Array",proto:!0,forced:l},{setFromBase64:function(c){s(this);var d=i(c,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:d.read,written:d.written}}})},4226(h,e,t){var n=t(6518),r=t(4576),i=t(3463),s=t(4154),o=t(5169),l=t(2303);function u(){try{var c=new ArrayBuffer(16,{maxByteLength:1024});new Uint8Array(c).setFromHex("cafed00d")}catch{return!0}}r.Uint8Array&&n({target:"Uint8Array",proto:!0,forced:u()},{setFromHex:function(d){s(this),i(d),o(this.buffer);var f=l(d,this).read;return{read:f,written:f/2}}})},9486(h,e,t){var n=t(6518),r=t(4576),i=t(9504),s=t(3972),o=t(4154),l=t(5169),u=t(2804),c=t(944),d=u.i2c,f=u.i2cUrl,p=i("".charAt),m=r.Uint8Array,v=!m||!m.prototype.toBase64||!function(){try{var y=new m;y.toBase64(null)}catch{return!0}}();m&&n({target:"Uint8Array",proto:!0,forced:v},{toBase64:function(){var E=o(this),S=arguments.length?s(arguments[0]):void 0,w=c(S)==="base64"?d:f,C=!!S&&!!S.omitPadding;l(this.buffer);for(var x="",T=0,I=E.length,F,P=function(R){return p(w,F>>6*R&63)};T+2{for(var t in e)ut.o(e,t)&&!ut.o(h,t)&&Object.defineProperty(h,t,{enumerable:!0,get:e[t]})};ut.o=(h,e)=>Object.prototype.hasOwnProperty.call(h,e);ut(4423);ut(4114);ut(6573);ut(8100);ut(7936);ut(5367);ut(2731);ut(9577);ut(6632);ut(4226);ut(9486);ut(456);ut(5781);const _n=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),Ls=[1/0,1/0,-1/0,-1/0],So=new Float32Array(Ls),Hv=[.001,0,0,.001,0,0],Cv=1.35,Xn={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Ds={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},xd="pdfjs_internal_editor_",ct={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},gt={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},Fx={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},xe={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},wg={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},ge={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},mh={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},hv={ERRORS:0,WARNINGS:1,INFOS:5},Mi={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},Bc={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},W1={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let uv=hv.WARNINGS;function Dx(h){Number.isInteger(h)&&(uv=h)}function Ox(){return uv}function cv(h){uv>=hv.INFOS&&console.info(`Info: ${h}`)}function ht(h){uv>=hv.WARNINGS&&console.warn(`Warning: ${h}`)}function Ot(h){throw new Error(h)}function ne(h,e){h||Ot(e)}function Mx(h){switch(h==null?void 0:h.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function z1(h,e=null,t=null){if(!h)return null;if(t&&typeof h=="string"){if(t.addDefaultProtocol&&h.startsWith("www.")){const r=h.match(/\./g);(r==null?void 0:r.length)>=2&&(h=`http://${h}`)}if(t.tryConvertEncoding)try{h=kx(h)}catch{}}const n=e?URL.parse(h,e):URL.parse(h);return Mx(n)?n:null}function G1(h,e,t=!1){const n=URL.parse(h);return n?(n.hash=e,n.href):t&&z1(h,"http://example.com")?h.split("#",1)[0]+`${e?`#${e}`:""}`:""}function Vv(h){return h.substring(h.lastIndexOf("/")+1)}function dt(h,e,t,n=!1){return Object.defineProperty(h,e,{value:t,enumerable:!n,configurable:!0,writable:!1}),t}const dh=function(){function e(t,n){this.message=t,this.name=n}return e.prototype=new Error,e.constructor=e,e}();class Ib extends dh{constructor(e,t){super(e,"PasswordException"),this.code=t}}class Tv extends dh{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}let Wv=class extends dh{constructor(e){super(e,"InvalidPDFException")}},Em=class extends dh{constructor(e,t,n){super(e,"ResponseException"),this.status=t,this.missing=n}};class Lx extends dh{constructor(e){super(e,"FormatError")}}let ho=class extends dh{constructor(e){super(e,"AbortException")}};function Nx(h){(typeof h!="object"||(h==null?void 0:h.length)===void 0)&&Ot("Invalid argument for bytesToString");const e=h.length,t=8192;if(e{if(typeof document>"u")return!1;const e=document.createElement("input");return e.type="color",e.setAttribute("alpha",""),e.value="#ff000080",e.value!=="#ff0000"})())}};var Bs,jv,xg,zv;let _=(jv=class{static get hexNums(){return dt(this,"hexNums",Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,"0")))}static makeHexColor(e,t,n){return`#${this.hexNums[e]}${this.hexNums[t]}${this.hexNums[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){const r=e[n],i=e[n+1];e[n]=r*t[0]+i*t[2]+t[4],e[n+1]=r*t[1]+i*t[3]+t[5]}static applyTransformToBezier(e,t,n=0){const r=t[0],i=t[1],s=t[2],o=t[3],l=t[4],u=t[5];for(let c=0;c<6;c+=2){const d=e[n+c],f=e[n+c+1];e[n+c]=d*r+f*s+l,e[n+c+1]=d*i+f*o+u}}static applyInverseTransform(e,t){const n=e[0],r=e[1],i=t[0]*t[3]-t[1]*t[2];e[0]=(n*t[3]-r*t[2]+t[2]*t[5]-t[4]*t[3])/i,e[1]=(-n*t[1]+r*t[0]+t[4]*t[1]-t[5]*t[0])/i}static axialAlignedBoundingBox(e,t,n){const r=t[0],i=t[1],s=t[2],o=t[3],l=t[4],u=t[5],c=e[0],d=e[1],f=e[2],p=e[3];let m=r*c+l,v=m,y=r*f+l,E=y,S=o*d+u,w=S,C=o*p+u,x=C;if(i!==0||s!==0){const T=i*c,I=i*f,F=s*d,P=s*p;m+=F,E+=F,y+=P,v+=P,S+=T,x+=T,C+=I,w+=I}n[0]=Math.min(n[0],m,y,v,E),n[1]=Math.min(n[1],S,C,w,x),n[2]=Math.max(n[2],m,y,v,E),n[3]=Math.max(n[3],S,C,w,x)}static inverseTransform(e){const 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){const n=e[0],r=e[1],i=e[2],s=e[3],o=n**2+r**2,l=n*i+r*s,u=i**2+s**2,c=(o+u)/2,d=Math.sqrt(c**2-(o*u-l**2));t[0]=Math.sqrt(c+d||1),t[1]=Math.sqrt(c-d||1)}static normalizeRect(e){const 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){const n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;const i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),s=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>s?null:[n,i,r,s]}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,r,i){i[0]=Math.min(i[0],e,n),i[1]=Math.min(i[1],t,r),i[2]=Math.max(i[2],e,n),i[3]=Math.max(i[3],t,r)}static bezierBoundingBox(e,t,n,r,i,s,o,l,u){u[0]=Math.min(u[0],e,o),u[1]=Math.min(u[1],t,l),u[2]=Math.max(u[2],e,o),u[3]=Math.max(u[3],t,l),A(this,Bs,zv).call(this,e,n,i,o,t,r,s,l,3*(-e+3*(n-i)+o),6*(e-2*n+i),3*(n-e),u),A(this,Bs,zv).call(this,e,n,i,o,t,r,s,l,3*(-t+3*(r-s)+l),6*(t-2*r+s),3*(r-t),u)}},Bs=new WeakSet,xg=function(e,t,n,r,i,s,o,l,u,c){if(u<=0||u>=1)return;const d=1-u,f=u*u,p=f*u,m=d*(d*(d*e+3*u*t)+3*f*n)+p*r,v=d*(d*(d*i+3*u*s)+3*f*o)+p*l;c[0]=Math.min(c[0],m),c[1]=Math.min(c[1],v),c[2]=Math.max(c[2],m),c[3]=Math.max(c[3],v)},zv=function(e,t,n,r,i,s,o,l,u,c,d,f){if(Math.abs(u)<1e-12){Math.abs(c)>=1e-12&&A(this,Bs,xg).call(this,e,t,n,r,i,s,o,l,-d/c,f);return}const p=c**2-4*d*u;if(p<0)return;const m=Math.sqrt(p),v=2*u;A(this,Bs,xg).call(this,e,t,n,r,i,s,o,l,(-c+m)/v,f),A(this,Bs,xg).call(this,e,t,n,r,i,s,o,l,(-c-m)/v,f)},b(jv,Bs),jv);function kx(h){return decodeURIComponent(escape(h))}let Pv=null,Rb=null;function jx(h){return Pv||(Pv=/([\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,Rb=new Map([["ſt","ſt"]])),h.replaceAll(Pv,(e,t,n)=>t?t.normalize("NFKC"):Rb.get(n))}function X1(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const h=new Uint8Array(32);return crypto.getRandomValues(h),Nx(h)}const Ph="pdfjs_internal_id_";function Ux(h,e,t){if(!Array.isArray(t)||t.length<2)return!1;const[n,r,...i]=t;if(!h(n)&&!Number.isInteger(n)||!e(r))return!1;const s=i.length;let o=!0;switch(r.name){case"XYZ":if(s<2||s>3)return!1;break;case"Fit":case"FitB":return s===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(s>1)return!1;break;case"FitR":if(s!==4)return!1;o=!1;break;default:return!1}for(const l of i)if(!(typeof l=="number"||o&&l===null))return!1;return!0}const eb=()=>[],nb=()=>new Map,Gv=()=>Object.create(null);typeof Blob.prototype.bytes!="function"&&(Blob.prototype.bytes=async function(){return new Uint8Array(await this.arrayBuffer())});typeof Response.prototype.bytes!="function"&&(Response.prototype.bytes=async function(){return new Uint8Array(await this.arrayBuffer())});typeof AbortSignal.any!="function"&&(AbortSignal.any=function(h){const e=new AbortController,{signal:t}=e;for(const n of h)if(n.aborted)return e.abort(n.reason),t;for(const n of h)n.addEventListener("abort",()=>{e.abort(n.reason)},{signal:t});return t});ut(8111);ut(1701);ut(4603);ut(7566);ut(8721);function Qt(h,e,t){return Math.min(Math.max(h,e),t)}class Sd{static textContent(e){const t=[],n={items:t,styles:Object.create(null)};function r(i){var l;if(!i)return;let s=null;const o=i.name;if(o==="#text")s=i.value;else if(Sd.shouldBuildText(o))(l=i==null?void 0:i.attributes)!=null&&l.textContent?s=i.attributes.textContent:i.value&&(s=i.value);else return;if(s!==null&&t.push({str:s}),!!i.children)for(const u of i.children)r(u)}return r(e),n}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}let _1=class{static setupStorage(e,t,n,r,i){const s=r.getValue(t,{value:null});switch(n.name){case"textarea":if(s.value!==null&&(e.textContent=s.value),i==="print")break;e.addEventListener("input",o=>{r.setValue(t,{value:o.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(s.value===n.attributes.xfaOn?e.setAttribute("checked",!0):s.value===n.attributes.xfaOff&&e.removeAttribute("checked"),i==="print")break;e.addEventListener("change",o=>{r.setValue(t,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(s.value!==null&&e.setAttribute("value",s.value),i==="print")break;e.addEventListener("input",o=>{r.setValue(t,{value:o.target.value})})}break;case"select":if(s.value!==null){e.setAttribute("value",s.value);for(const o of n.children)o.attributes.value===s.value?o.attributes.selected=!0:Object.hasOwn(o.attributes,"selected")&&delete o.attributes.selected}e.addEventListener("input",o=>{const l=o.target.options,u=l.selectedIndex===-1?"":l[l.selectedIndex].value;r.setValue(t,{value:u})});break}}static setAttributes({html:e,element:t,storage:n=null,intent:r,linkService:i}){const{attributes:s}=t,o=e instanceof HTMLAnchorElement;s.type==="radio"&&(s.name=`${s.name}-${r}`);for(const[l,u]of Object.entries(s))if(u!=null)switch(l){case"class":u.length&&e.setAttribute(l,u.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",u);break;case"style":Object.assign(e.style,u);break;case"textContent":e.textContent=u;break;default:(!o||l!=="href"&&l!=="newWindow")&&e.setAttribute(l,u)}o&&i.addLinkAttributes(e,s.href,s.newWindow),n&&s.dataId&&this.setupStorage(e,s.dataId,t,n)}static render(e){var d,f;const t=e.annotationStorage,n=e.linkService,r=e.xfaHtml,i=e.intent||"display",s=document.createElement(r.name);r.attributes&&this.setAttributes({html:s,element:r,intent:i,linkService:n});const o=i!=="richText",l=e.div;if(l.append(s),e.viewport){const p=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=p}o&&l.setAttribute("class","xfaLayer xfaFont");const u=[];if(r.children.length===0){if(r.value){const p=document.createTextNode(r.value);s.append(p),o&&Sd.shouldBuildText(r.name)&&u.push(p)}return{textDivs:u}}const c=[[r,-1,s]];for(;c.length>0;){const[p,m,v]=c.at(-1);if(m+1===p.children.length){c.pop();continue}const y=p.children[++c.at(-1)[1]];if(y===null)continue;const{name:E}=y;if(E==="#text"){const w=document.createTextNode(y.value);u.push(w),v.append(w);continue}const S=(d=y==null?void 0:y.attributes)!=null&&d.xmlns?document.createElementNS(y.attributes.xmlns,E):document.createElement(E);if(v.append(S),y.attributes&&this.setAttributes({html:S,element:y,storage:t,intent:i,linkService:n}),((f=y.children)==null?void 0:f.length)>0)c.push([y,-1,S]);else if(y.value){const w=document.createTextNode(y.value);o&&Sd.shouldBuildText(E)&&u.push(w),S.append(w)}}for(const p of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))p.setAttribute("readOnly",!0);return{textDivs:u}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}};const Pi="http://www.w3.org/2000/svg";var wi;let Fc=(wi=class{},M(wi,"CSS",96),M(wi,"PDF",72),M(wi,"PDF_TO_CSS_UNITS",wi.CSS/wi.PDF),wi);async function rb(h,e="text"){if(vd(h,document.baseURI)){const t=await fetch(h);if(!t.ok)throw new Error(t.statusText);switch(e){case"blob":return t.blob();case"bytes":return t.bytes();case"json":return t.json()}return t.text()}return new Promise((t,n)=>{const r=new XMLHttpRequest;r.open("GET",h,!0),r.responseType=e==="bytes"?"arraybuffer":e,r.onreadystatechange=()=>{if(r.readyState===XMLHttpRequest.DONE){if(r.status===200||r.status===0){switch(e){case"bytes":t(new Uint8Array(r.response));return;case"blob":case"json":t(r.response);return}t(r.responseText);return}n(new Error(r.statusText))}},r.send(null)})}class ig{constructor({viewBox:e,userUnit:t,scale:n,rotation:r,offsetX:i=0,offsetY:s=0,dontFlip:o=!1}){this.viewBox=e,this.userUnit=t,this.scale=n,this.rotation=r,this.offsetX=i,this.offsetY=s,n*=t;const l=(e[2]+e[0])/2,u=(e[3]+e[1])/2;let c,d,f,p;switch(r%=360,r<0&&(r+=360),r){case 180:c=-1,d=0,f=0,p=1;break;case 90:c=0,d=1,f=1,p=0;break;case 270:c=0,d=-1,f=-1,p=0;break;case 0:c=1,d=0,f=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(f=-f,p=-p);let m,v,y,E;c===0?(m=Math.abs(u-e[1])*n+i,v=Math.abs(l-e[0])*n+s,y=(e[3]-e[1])*n,E=(e[2]-e[0])*n):(m=Math.abs(l-e[0])*n+i,v=Math.abs(u-e[1])*n+s,y=(e[2]-e[0])*n,E=(e[3]-e[1])*n),this.transform=[c*n,d*n,f*n,p*n,m-c*n*l-f*n*u,v-d*n*l-p*n*u],this.width=y,this.height=E}get rawDims(){const e=this.viewBox;return dt(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:r=this.offsetY,dontFlip:i=!1}={}){return new ig({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:i})}convertToViewportPoint(e,t){const n=[e,t];return _.applyTransform(n,this.transform),n}convertToViewportRectangle(e){const t=[e[0],e[1]];_.applyTransform(t,this.transform);const n=[e[2],e[3]];return _.applyTransform(n,this.transform),[t[0],t[1],n[0],n[1]]}convertToPdfPoint(e,t){const n=[e,t];return _.applyInverseTransform(n,this.transform),n}}let ib=class extends dh{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}};function fv(h){const e=h.length;let t=0;for(;t{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}}}}})(h);if(!n)return e;const r=o=>{try{let l=decodeURIComponent(o);return l.includes("/")&&(l=Vv(l),/^\.pdf$/i.test(l))?o:l}catch{return o}},i=/\.pdf$/i,s=Vv(n.pathname);if(i.test(s))return r(s);if(n.searchParams.size>0){const o=u=>[...u].findLast(c=>i.test(c)),l=o(n.searchParams.values())??o(n.searchParams.keys());if(l)return r(l)}if(n.hash){const l=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(n.hash);if(l)return r(l[0])}return e}var Ks;class Fb{constructor(){b(this,Ks,new Map);M(this,"times",[])}time(e){a(this,Ks).has(e)&&ht(`Timer is already running for ${e}`),a(this,Ks).set(e,Date.now())}timeEnd(e){a(this,Ks).has(e)||ht(`Timer has not been started for ${e}`),this.times.push({name:e,start:a(this,Ks).get(e),end:Date.now()}),a(this,Ks).delete(e)}toString(){const e=Math.max(...this.times.map(t=>t.name.length));return this.times.map(t=>`${t.name.padEnd(e)} ${t.end-t.start}ms `).join("")}}Ks=new WeakMap;function vd(h,e){const t=e?URL.parse(h,e):URL.parse(h);return/https?:/.test((t==null?void 0:t.protocol)??"")}function Er(h){h.preventDefault()}function ee(h){h.preventDefault(),h.stopPropagation()}function Vx(h){console.log("Deprecated API usage: "+h)}var Uv,Dd;let Xv=(Uv=class{static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!="string")return null;a(this,Dd)||g(this,Dd,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const t=a(this,Dd).exec(e);if(!t)return null;const n=parseInt(t[1],10);let r=parseInt(t[2],10);r=r>=1&&r<=12?r-1:0;let i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;let s=parseInt(t[4],10);s=s>=0&&s<=23?s:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(t[6],10);l=l>=0&&l<=59?l:0;const u=t[7]||"Z";let c=parseInt(t[8],10);c=c>=0&&c<=23?c:0;let d=parseInt(t[9],10)||0;return d=d>=0&&d<=59?d:0,u==="-"?(s+=c,o+=d):u==="+"&&(s-=c,o-=d),new Date(Date.UTC(n,r,i,s,o,l))}},Dd=new WeakMap,b(Uv,Dd),Uv);function Wx(h,{scale:e=1,rotation:t=0}){const{width:n,height:r}=h.attributes.style,i=[0,0,parseInt(n,10),parseInt(r,10)];return new ig({viewBox:i,userUnit:1,scale:e,rotation:t})}function ab(h){if(h.startsWith("#")){const t=h.slice(1);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),t.length>=8?parseInt(t.slice(6,8),16)/255:1]}if(h.startsWith("rgb(")){const[t,n,r]=h.slice(4,-1).split(",").map(i=>parseInt(i,10));return[t,n,r,1]}if(h.startsWith("rgba(")){const t=h.slice(5,-1).split(",");return[parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3])]}const e=h.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return e?[Math.round(parseFloat(e[1])*255),Math.round(parseFloat(e[2])*255),Math.round(parseFloat(e[3])*255),e[4]!==void 0&&e[4]!=="none"?parseFloat(e[4]):1]:null}function sg(h){const e=ab(h);return e?e.slice(0,3):(ht(`Not a valid color format: "${h}"`),[0,0,0])}function zx(h){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const t of h.keys()){e.style.color=t;const n=window.getComputedStyle(e).color;h.set(t,sg(n))}e.remove()}function Yt(h){const{a:e,b:t,c:n,d:r,e:i,f:s}=h.getTransform();return[e,t,n,r,i,s]}function zr(h){const{a:e,b:t,c:n,d:r,e:i,f:s}=h.getTransform().invertSelf();return[e,t,n,r,i,s]}function hh(h,e,t=!1,n=!0){if(e instanceof ig){const{pageWidth:r,pageHeight:i}=e.rawDims,{style:s}=h,o=be.isCSSRoundSupported,l=`var(--total-scale-factor) * ${r}px`,u=`var(--total-scale-factor) * ${i}px`,c=o?`round(down, ${l}, var(--scale-round-x))`:`calc(${l})`,d=o?`round(down, ${u}, var(--scale-round-y))`:`calc(${u})`;!t||e.rotation%180===0?(s.width=c,s.height=d):(s.width=d,s.height=c)}n&&h.setAttribute("data-main-rotation",e.rotation)}let uh=class _v{constructor(){const{pixelRatio:e}=_v;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,r,i=-1){let s=1/0,o=1/0,l=1/0;n=_v.capPixels(n,i),n>0&&(s=Math.sqrt(n/(e*t))),r!==-1&&(o=r/e,l=r/t);const u=Math.min(s,o,l);return this.sx>u||this.sy>u?(this.sx=u,this.sy=u,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){const 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}};const Yv=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class Gx{static get isDarkMode(){var e;return dt(this,"isDarkMode",!!((e=window==null?void 0:window.matchMedia)!=null&&e.call(window,"(prefers-color-scheme: dark)").matches))}}let Xx=class{static get commentForegroundColor(){const e=document.createElement("span");e.classList.add("comment","sidebar");const{style:t}=e;t.width=t.height="0",t.display="none",t.color="var(--comment-fg-color)",document.body.append(e);const{color:n}=window.getComputedStyle(e);return e.remove(),dt(this,"commentForegroundColor",sg(n))}};function _x(h,e){e=Qt(e??1,0,1);const t=255*(1-e);return h.map(n=>Math.round(n*e+t))}function Db(h,e){const t=h[0]/255,n=h[1]/255,r=h[2]/255,i=Math.max(t,n,r),s=Math.min(t,n,r),o=(i+s)/2;if(i===s)e[0]=e[1]=0;else{const l=i-s;switch(e[1]=o<.5?l/(i+s):l/(2-i-s),i){case t:e[0]=((n-r)/l+(nr?(n+.05)/(r+.05):(r+.05)/(n+.05)}const Lb=new Map;function Yx(h,e){const t=h[0]+h[1]*256+h[2]*65536+e[0]*16777216+e[1]*4294967296+e[2]*1099511627776;let n=Lb.get(t);if(n)return n;const r=new Float32Array(9),i=r.subarray(0,3),s=r.subarray(3,6);Db(h,s);const o=r.subarray(6,9);Db(e,o);const l=o[2]<.5,u=l?12:4.5;if(s[2]=l?Math.sqrt(s[2]):1-Math.sqrt(1-s[2]),Mb(s,o,i)f;){const p=s[2]=(c+d)/2;l===Mb(s,o,i){t.delete()},{signal:t._signal}),a(this,nr).append(n)}async addAltText(e){const t=await e.render();A(this,Xe,vh).call(this,t),a(this,nr).append(t,a(this,Xe,Wc)),g(this,Od,e)}addComment(e,t=null){if(a(this,Qs))return;const n=e.renderForToolbar();if(!n)return;A(this,Xe,vh).call(this,n);const r=g(this,Mh,a(this,Xe,Wc));t?(a(this,nr).insertBefore(n,t),a(this,nr).insertBefore(r,t)):a(this,nr).append(n,r),g(this,Qs,e),e.toolbar=this}addColorPicker(e){if(a(this,Zs))return;g(this,Zs,e);const t=e.renderButton();A(this,Xe,vh).call(this,t),a(this,nr).append(t,a(this,Xe,Wc))}async addEditSignatureButton(e){const t=g(this,Lh,await e.renderEditButton(a(this,er)));A(this,Xe,vh).call(this,t),a(this,nr).append(t,a(this,Xe,Wc))}removeButton(e){var t,n;switch(e){case"comment":(t=a(this,Qs))==null||t.removeToolbarCommentButton(),g(this,Qs,null),(n=a(this,Mh))==null||n.remove(),g(this,Mh,null);break}}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;const r=a(this,nr).querySelector(n);r&&e==="comment"&&this.addComment(t,r)}updateEditSignatureButton(e){a(this,Lh)&&(a(this,Lh).title=e)}remove(){var e;a(this,Js).remove(),(e=a(this,Zs))==null||e.destroy(),g(this,Zs,null)}};Js=new WeakMap,Zs=new WeakMap,er=new WeakMap,nr=new WeakMap,Od=new WeakMap,Qs=new WeakMap,Mh=new WeakMap,Lh=new WeakMap,Md=new WeakMap,Mm=new WeakSet,J1=function(e){e.stopPropagation()},Xe=new WeakSet,Z1=function(e){a(this,er)._focusEventsAllowed=!1,ee(e)},Q1=function(e){a(this,er)._focusEventsAllowed=!0,ee(e)},vh=function(e){const t=a(this,er)._uiManager._signal;return!(t instanceof AbortSignal)||t.aborted?!1:(e.addEventListener("focusin",A(this,Xe,Z1).bind(this),{capture:!0,signal:t}),e.addEventListener("focusout",A(this,Xe,Q1).bind(this),{capture:!0,signal:t}),e.addEventListener("contextmenu",Er,{signal:t}),!0)},Wc=function(){const e=document.createElement("div");return e.className="divider",e},b(Di,Mm),b(Di,Md,null);let Jv=Di;var Ld,Co,Ni,Us,q1,tA,Zv;class Kx{constructor(e){b(this,Us);b(this,Ld,null);b(this,Co,null);b(this,Ni);g(this,Ni,e)}show(e,t,n){const[r,i]=A(this,Us,tA).call(this,t,n),{style:s}=a(this,Co)||g(this,Co,A(this,Us,q1).call(this));e.append(a(this,Co)),s.insetInlineEnd=`${100*r}%`,s.top=`calc(${100*i}% + var(--editor-toolbar-vert-offset))`}hide(){a(this,Co).remove()}}Ld=new WeakMap,Co=new WeakMap,Ni=new WeakMap,Us=new WeakSet,q1=function(){const e=g(this,Co,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar");const t=a(this,Ni)._signal;t instanceof AbortSignal&&!t.aborted&&e.addEventListener("contextmenu",Er,{signal:t});const n=g(this,Ld,document.createElement("div"));return n.className="buttons",e.append(n),a(this,Ni).hasCommentManager()&&A(this,Us,Zv).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{a(this,Ni).commentSelection("floating_button")}),A(this,Us,Zv).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{a(this,Ni).highlightSelection("floating_button")}),e},tA=function(e,t){let n=0,r=0;for(const i of e){const s=i.y+i.height;if(sn){r=o,n=s;continue}t?o>r&&(r=o):o=1}static clearPointerType(){g(kt,Io,null)}static clearPointerIds(){g(kt,To,NaN),g(kt,Po,null)}static clearTimeStamp(){g(kt,Nh,NaN)}};To=new WeakMap,Po=new WeakMap,Nh=new WeakMap,Io=new WeakMap,b(kt,To,NaN),b(kt,Po,null),b(kt,Nh,NaN),b(kt,Io,null);let Ke=kt;var Lm;class Jx{constructor(){b(this,Lm,0)}get id(){return`${xd}${ie(this,Lm)._++}`}}Lm=new WeakMap;var Bh,Nd,Je,kh,Sg;const vb=class vb{constructor(){b(this,kh);b(this,Bh,X1());b(this,Nd,0);b(this,Je,null)}static get _isSVGFittingCanvas(){const e='data:image/svg+xml;charset=UTF-8,',n=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),r=new Image;r.src=e;const i=r.decode().then(()=>(n.drawImage(r,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return dt(this,"_isSVGFittingCanvas",i)}async getFromFile(e){const{lastModified:t,name:n,size:r,type:i}=e;return A(this,kh,Sg).call(this,`${t}_${n}_${r}_${i}`,e)}async getFromUrl(e){return A(this,kh,Sg).call(this,e,e)}async getFromBlob(e,t){const n=await t;return A(this,kh,Sg).call(this,e,n)}async getFromId(e){a(this,Je)||g(this,Je,new Map);const t=a(this,Je).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){const{blobPromise:n}=t;return delete t.blobPromise,this.getFromBlob(t.id,n)}return this.getFromUrl(t.url)}getFromCanvas(e,t){a(this,Je)||g(this,Je,new Map);let n=a(this,Je).get(e);if(n!=null&&n.bitmap)return n.refCounter+=1,n;const r=new OffscreenCanvas(t.width,t.height);return r.getContext("2d").drawImage(t,0,0),n={bitmap:r.transferToImageBitmap(),id:`image_${a(this,Bh)}_${ie(this,Nd)._++}`,refCounter:1,isSvg:!1},a(this,Je).set(e,n),a(this,Je).set(n.id,n),n}getSvgUrl(e){const t=a(this,Je).get(e);return t!=null&&t.isSvg?t.svgUrl:null}deleteId(e){var r;a(this,Je)||g(this,Je,new Map);const t=a(this,Je).get(e);if(!t||(t.refCounter-=1,t.refCounter!==0))return;const{bitmap:n}=t;if(!t.url&&!t.file){const i=new OffscreenCanvas(n.width,n.height);i.getContext("bitmaprenderer").transferFromImageBitmap(n),t.blobPromise=i.convertToBlob()}(r=n.close)==null||r.call(n),t.bitmap=null}isValidId(e){return e.startsWith(`image_${a(this,Bh)}_`)}};Bh=new WeakMap,Nd=new WeakMap,Je=new WeakMap,kh=new WeakSet,Sg=async function(e,t){a(this,Je)||g(this,Je,new Map);let n=a(this,Je).get(e);if(n===null)return null;if(n!=null&&n.bitmap)return n.refCounter+=1,n;try{n||(n={bitmap:null,id:`image_${a(this,Bh)}_${ie(this,Nd)._++}`,refCounter:0,isSvg:!1});let r;if(typeof t=="string"?(n.url=t,r=await rb(t,"blob")):t instanceof File?r=n.file=t:t instanceof Blob&&(r=t),r.type==="image/svg+xml"){const i=vb._isSVGFittingCanvas,s=new FileReader,o=new Image,l=new Promise((u,c)=>{o.onload=()=>{n.bitmap=o,n.isSvg=!0,u()},s.onload=async()=>{const d=n.svgUrl=s.result;o.src=await i?`${d}#svgView(preserveAspectRatio(none))`:d},o.onerror=s.onerror=c});s.readAsDataURL(r),await l}else n.bitmap=await createImageBitmap(r);n.refCounter=1}catch(r){ht(r),n=null}return a(this,Je).set(e,n),n&&a(this,Je).set(n.id,n),n};let Qv=vb;var ue,qs,Bd,qt;class Zx{constructor(e=128){b(this,ue,[]);b(this,qs,!1);b(this,Bd);b(this,qt,-1);g(this,Bd,e)}add({cmd:e,undo:t,post:n,mustExec:r,type:i=NaN,overwriteIfSameType:s=!1,keepUndo:o=!1}){if(r&&e(),a(this,qs))return;const l={cmd:e,undo:t,post:n,type:i};if(a(this,qt)===-1){a(this,ue).length>0&&(a(this,ue).length=0),g(this,qt,0),a(this,ue).push(l);return}if(s&&a(this,ue)[a(this,qt)].type===i){o&&(l.undo=a(this,ue)[a(this,qt)].undo),a(this,ue)[a(this,qt)]=l;return}const u=a(this,qt)+1;u===a(this,Bd)?a(this,ue).splice(0,1):(g(this,qt,u),u=0;t--)if(a(this,ue)[t].type!==e){a(this,ue).splice(t+1,a(this,qt)-t),g(this,qt,t);return}a(this,ue).length=0,g(this,qt,-1)}}destroy(){g(this,ue,null)}}ue=new WeakMap,qs=new WeakMap,Bd=new WeakMap,qt=new WeakMap;var Nm,nA;class ag{constructor(e){b(this,Nm);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=be.platform;for(const[n,r,i={}]of e)for(const s of n){const o=s.startsWith("mac+");t&&o?(this.callbacks.set(s.slice(4),{callback:r,options:i}),this.allKeys.add(s.split("+").at(-1))):!t&&!o&&(this.callbacks.set(s,{callback:r,options:i}),this.allKeys.add(s.split("+").at(-1)))}}exec(e,t){if(!this.allKeys.has(t.key))return;const n=this.callbacks.get(A(this,Nm,nA).call(this,t));if(!n)return;const{callback:r,options:{bubbles:i=!1,args:s=[],checker:o=null}}=n;o&&!o(e,t)||(r.bind(e,...s,t)(),i||ee(t))}}Nm=new WeakSet,nA=function(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);const t=this.buffer.join("+");return this.buffer.length=0,t};const Bm=class Bm{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return zx(e),dt(this,"_colors",e)}convert(e){const t=sg(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[n,r]of this._colors)if(r.every((i,s)=>i===t[s]))return Bm._colorsMapping.get(n);return t}getHexCode(e){const t=this._colors.get(e);return t?_.makeHexColor(...t):e}};M(Bm,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let qv=Bm;var jh,Rn,Uh,se,te,$h,Hh,an,Vh,rr,Pe,ta,ea,na,ra,Yr,ir,Ro,kd,jd,Wh,Ud,Kr,ia,zh,sa,Jr,km,Bi,Gh,$d,aa,Fo,Xh,oa,Hd,me,Lt,ki,la,ha,Vd,_h,Wd,ua,Zr,ji,zd,Gd,sr,Ms,J,Cg,ty,rA,iA,sA,zc,aA,oA,lA,ey,hA,uA,cA,dA,rn,Ii,fA,pA,ny,gA,Gc,ry;let Cd=(Ms=class{constructor(e,t,n,r,i,s,o,l,u,c,d,f,p,m,v,y){b(this,J);b(this,jh,new AbortController);b(this,Rn,null);b(this,Uh,null);b(this,se,new Map);b(this,te,new Map);b(this,$h,null);b(this,Hh,null);b(this,an,null);b(this,Vh,null);b(this,rr,new Zx);b(this,Pe,null);b(this,ta,null);b(this,ea,null);b(this,na,0);b(this,ra,new Set);b(this,Yr,null);b(this,ir,null);b(this,Ro,new Set);M(this,"_editorUndoBar",null);b(this,kd,!1);b(this,jd,!1);b(this,Wh,!1);b(this,Ud,null);b(this,Kr,null);b(this,ia,null);b(this,zh,null);b(this,sa,!1);b(this,Jr,null);b(this,km,new Jx);b(this,Bi,!1);b(this,Gh,!1);b(this,$d,!1);b(this,aa,null);b(this,Fo,null);b(this,Xh,null);b(this,oa,null);b(this,Hd,null);b(this,me,ct.NONE);b(this,Lt,new Set);b(this,ki,null);b(this,la,null);b(this,ha,null);b(this,Vd,null);b(this,_h,null);b(this,Wd,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});b(this,ua,[0,0]);b(this,Zr,null);b(this,ji,null);b(this,zd,null);b(this,Gd,null);b(this,sr,null);const E=this._signal=a(this,jh).signal;g(this,ji,e),g(this,zd,t),g(this,Gd,n),g(this,Hh,r),g(this,Pe,i),g(this,la,s),g(this,_h,l),this._eventBus=o,o._on("editingaction",this.onEditingAction.bind(this),{signal:E}),o._on("pagechanging",this.onPageChanging.bind(this),{signal:E}),o._on("scalechanging",this.onScaleChanging.bind(this),{signal:E}),o._on("rotationchanging",this.onRotationChanging.bind(this),{signal:E}),o._on("setpreference",this.onSetPreference.bind(this),{signal:E}),o._on("switchannotationeditorparams",S=>this.updateParams(S.type,S.value),{signal:E}),window.addEventListener("pointerdown",()=>{g(this,Gh,!0)},{capture:!0,signal:E}),window.addEventListener("pointerup",()=>{g(this,Gh,!1)},{capture:!0,signal:E}),window.addEventListener("beforeunload",A(this,J,rA).bind(this),{capture:!0,signal:E}),A(this,J,aA).call(this),A(this,J,dA).call(this),A(this,J,ey).call(this),g(this,an,l.annotationStorage),g(this,Ud,l.filterFactory),g(this,ha,u),g(this,zh,c||null),g(this,kd,d),g(this,jd,f),g(this,Wh,p),g(this,Hd,m||null),this.viewParameters={realScale:Fc.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=v||null,this._supportsPinchToZoom=y!==!1,i==null||i.setSidebarUiManager(this)}static get _keyboardManager(){const e=Ms.prototype,t=s=>a(s,ji).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&s.hasSomethingToControl(),n=(s,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},r=this.TRANSLATE_SMALL,i=this.TRANSLATE_BIG;return dt(this,"_keyboardManager",new ag([[["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:(s,{target:o})=>!(o instanceof HTMLButtonElement)&&a(s,ji).contains(o)&&!s.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(s,{target:o})=>!(o instanceof HTMLButtonElement)&&a(s,ji).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-r,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[r,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-r],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:t}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,r],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:t}]]))}destroy(){var e,t,n,r,i,s,o,l,u;(e=a(this,sr))==null||e.resolve(),g(this,sr,null),(t=a(this,jh))==null||t.abort(),g(this,jh,null),this._signal=null;for(const c of a(this,te).values())c.destroy();a(this,te).clear(),a(this,se).clear(),a(this,Ro).clear(),(n=a(this,oa))==null||n.clear(),g(this,Rn,null),a(this,Lt).clear(),a(this,rr).destroy(),(r=a(this,Hh))==null||r.destroy(),(i=a(this,Pe))==null||i.destroy(),(s=a(this,la))==null||s.destroy(),(o=a(this,Jr))==null||o.hide(),g(this,Jr,null),(l=a(this,Xh))==null||l.destroy(),g(this,Xh,null),g(this,Uh,null),a(this,Kr)&&(clearTimeout(a(this,Kr)),g(this,Kr,null)),a(this,Zr)&&(clearTimeout(a(this,Zr)),g(this,Zr,null)),(u=this._editorUndoBar)==null||u.destroy(),g(this,_h,null)}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return a(this,Hd)}get useNewAltTextFlow(){return a(this,jd)}get useNewAltTextWhenAddingImage(){return a(this,Wh)}get hcmFilter(){return dt(this,"hcmFilter",a(this,ha)?a(this,Ud).addHCMFilter(a(this,ha).foreground,a(this,ha).background):"none")}get direction(){return dt(this,"direction",getComputedStyle(a(this,ji)).direction)}get _highlightColors(){return dt(this,"_highlightColors",a(this,zh)?new Map(a(this,zh).split(",").map(e=>(e=e.split("=").map(t=>t.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){const{_highlightColors:e}=this;if(!e)return dt(this,"highlightColors",null);const t=new Map,n=!!a(this,ha);for(const[r,i]of e){const s=r.endsWith("_HCM");if(n&&s){t.set(r.replace("_HCM",""),i);continue}!n&&!s&&t.set(r,i)}return dt(this,"highlightColors",t)}get highlightColorNames(){return dt(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;const 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),g(this,ea,e)}setMainHighlightColorPicker(e){g(this,Xh,e)}editAltText(e,t=!1){var n;(n=a(this,Hh))==null||n.editAltText(this,e,t)}hasCommentManager(){return!!a(this,Pe)}editComment(e,t,n,r){var i;(i=a(this,Pe))==null||i.showDialog(this,e,t,n,r)}selectComment(e,t){const n=a(this,te).get(e),r=n==null?void 0:n.getEditorByUID(t);r==null||r.toggleComment(!0,!0)}updateComment(e){var t;(t=a(this,Pe))==null||t.updateComment(e.getData())}updatePopupColor(e){var t;(t=a(this,Pe))==null||t.updatePopupColor(e)}removeComment(e){var t;(t=a(this,Pe))==null||t.removeComments([e.uid])}deleteComment(e,t){const n=()=>{e.comment=t},r=()=>{var i;(i=this._editorUndoBar)==null||i.show(n,"comment"),this.toggleComment(null),e.comment=null};this.addCommands({cmd:r,undo:n,mustExec:!0})}toggleComment(e,t,n=void 0){var r;(r=a(this,Pe))==null||r.toggleCommentPopup(e,t,n)}makeCommentColor(e,t){var n;return e&&((n=a(this,Pe))==null?void 0:n.makeCommentColor(e,t))||null}getCommentDialogElement(){var e;return((e=a(this,Pe))==null?void 0:e.dialogElement)||null}async waitForEditorsRendered(e){if(a(this,te).has(e-1))return;const{resolve:t,promise:n}=Promise.withResolvers(),r=i=>{i.pageNumber===e&&(this._eventBus._off("editorsrendered",r),t())};this._eventBus.on("editorsrendered",r),await n}getSignature(e){var t;(t=a(this,la))==null||t.getSignature({uiManager:this,editor:e})}get signatureManager(){return a(this,la)}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}){switch(e){case"enableNewAltTextWhenAddingImage":g(this,Wh,t);break}}onPageChanging({pageNumber:e}){g(this,na,e-1)}deletePage(e){for(const t of this.getEditors(e))t.remove();a(this,te).delete(e),a(this,na)===e&&g(this,na,0)}focusMainContainer(){a(this,ji).focus()}findParent(e,t){for(const n of a(this,te).values()){const{x:r,y:i,width:s,height:o}=n.div.getBoundingClientRect();if(e>=r&&e<=r+s&&t>=i&&t<=i+o)return n}return null}disableUserSelect(e=!1){a(this,zd).classList.toggle("noUserSelect",e)}addShouldRescale(e){a(this,Ro).add(e)}removeShouldRescale(e){a(this,Ro).delete(e)}onScaleChanging({scale:e}){var t;this.commitOrRemove(),this.viewParameters.realScale=e*Fc.PDF_TO_CSS_UNITS;for(const n of a(this,Ro))n.onScaleChanging();(t=a(this,ea))==null||t.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e="",t=!1){const n=document.getSelection();if(!n||n.isCollapsed)return;const{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:o}=n,l=n.toString(),c=A(this,J,Cg).call(this,n).closest(".textLayer"),d=this.getSelectionBoxes(c);if(!d)return;n.empty();const f=A(this,J,ty).call(this,c),p=a(this,me)===ct.NONE,m=()=>{const v=f==null?void 0:f.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:d,anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:o,text:l});p&&this.showAllEditors("highlight",!0,!0),t&&(v==null||v.editComment())};if(p){this.switchToMode(ct.HIGHLIGHT,m);return}m()}commentSelection(e=""){this.highlightSelection(e,!0)}getAndRemoveDataFromAnnotationStorage(e){if(!a(this,an))return null;const t=`${xd}${e}`,n=a(this,an).getRawValue(t);return n&&a(this,an).remove(t),n}addToAnnotationStorage(e){!e.isEmpty()&&a(this,an)&&!a(this,an).has(e.id)&&a(this,an).setValue(e.id,e)}a11yAlert(e,t=null){const n=a(this,Gd);n&&(n.setAttribute("data-l10n-id",e),t?n.setAttribute("data-l10n-args",JSON.stringify(t)):n.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,a(this,sa)&&(g(this,sa,!1),A(this,J,zc).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const t of a(this,Lt))if(t.div.contains(e)){g(this,Fo,[t,e]),t._focusEventsAllowed=!1;break}}focus(){if(!a(this,Fo))return;const[e,t]=a(this,Fo);g(this,Fo,null),t.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}addEditListeners(){A(this,J,ey).call(this),this.setEditingState(!0)}removeEditListeners(){A(this,J,hA).call(this),this.setEditingState(!1)}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const n of a(this,ir))if(n.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const t of e.dataTransfer.items)for(const n of a(this,ir))if(n.isHandlingMimeForPasting(t.type)){n.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){var n;if(e.preventDefault(),(n=a(this,Rn))==null||n.commitOrRemove(),!this.hasSelection)return;const t=[];for(const r of a(this,Lt)){const i=r.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();const{clipboardData:t}=e;for(const i of t.items)for(const s of a(this,ir))if(s.isHandlingMimeForPasting(i.type)){s.paste(i,this.currentLayer);return}let n=t.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(i){ht(`paste: "${i.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();const r=this.currentLayer;try{const i=[];for(const l of n){const u=await r.deserialize(l);if(!u)return;i.push(u)}const s=()=>{for(const l of i)A(this,J,ny).call(this,l);A(this,J,ry).call(this,i)},o=()=>{for(const l of i)l.remove()};this.addCommands({cmd:s,undo:o,mustExec:!0})}catch(i){ht(`paste: "${i.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),a(this,me)!==ct.NONE&&!this.isEditorHandlingKeyboard&&Ms._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,a(this,sa)&&(g(this,sa,!1),A(this,J,zc).call(this,"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}}updatePageIndex(e,t){for(const r of this.getEditors(e))r.pageIndex=t;const n=a(this,$h).get(e);n&&(n.pageIndex=t,a(this,te).set(t,n),a(this,Bi)?n.enable():n.disable())}startUpdatePages(){g(this,$h,new Map(a(this,te))),a(this,te).clear()}endUpdatePages(){g(this,$h,null)}clonePage(e,t){for(const n of this.getEditors(e)){const r=n.serialize(n.mode!==ct.HIGHLIGHT);r&&(r.pageIndex=t,r.id=this.getId(),r.isClone=!0,delete r.popupRef,a(this,an).setValue(r.id,r))}}findClonesForPage(e){const t=[],{pageIndex:n}=e;for(const[r,i]of a(this,an))i.pageIndex===n&&i.isClone&&(a(this,an).remove(r),t.push(e.deserialize(i).then(s=>{s&&(s.isClone=!0,e.addOrRebuild(s))})));return Promise.all(t)}setEditingState(e){e?(A(this,J,oA).call(this),A(this,J,uA).call(this),A(this,J,rn).call(this,{isEditing:a(this,me)!==ct.NONE,isEmpty:A(this,J,Gc).call(this),hasSomethingToUndo:a(this,rr).hasSomethingToUndo(),hasSomethingToRedo:a(this,rr).hasSomethingToRedo(),hasSelectedEditor:!1})):(A(this,J,lA).call(this),A(this,J,cA).call(this),A(this,J,rn).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!a(this,ir)){g(this,ir,e);for(const t of a(this,ir))A(this,J,Ii).call(this,t.defaultPropertiesToUpdate)}}getId(){return a(this,km).id}get currentLayer(){return a(this,te).get(a(this,na))}getLayer(e){return a(this,te).get(e)}get currentPageIndex(){return a(this,na)}addLayer(e){a(this,te).set(e.pageIndex,e),a(this,Bi)?e.enable():e.disable()}removeLayer(e){a(this,te).delete(e.pageIndex)}async updateMode(e,t=null,n=!1,r=!1,i=!1,s=!1){var o,l,u,c,d,f;if(a(this,me)!==e&&!(a(this,sr)&&(await a(this,sr).promise,!a(this,sr)))){if(g(this,sr,Promise.withResolvers()),(o=a(this,ea))==null||o.commitOrRemove(),a(this,me)===ct.POPUP&&((l=a(this,Pe))==null||l.hideSidebar()),(u=a(this,Pe))==null||u.destroyPopup(),g(this,me,e),e===ct.NONE){this.setEditingState(!1),A(this,J,pA).call(this);for(const p of a(this,se).values())p.hideStandaloneCommentButton();(c=this._editorUndoBar)==null||c.hide(),this.toggleComment(null),a(this,sr).resolve();return}for(const p of a(this,se).values())p.addStandaloneCommentButton();e===ct.SIGNATURE&&await((d=a(this,la))==null?void 0:d.loadSignatures()),n&&Ke.clearPointerType(),this.setEditingState(!0),await A(this,J,fA).call(this),this.unselectAll();for(const p of a(this,te).values())p.updateMode(e);if(e===ct.POPUP){a(this,Uh)||g(this,Uh,await a(this,_h).getAnnotationsByType(new Set(a(this,ir).map(v=>v._editorType))));const p=new Set,m=[];for(const v of a(this,se).values()){const{annotationElementId:y,hasComment:E,deleted:S}=v;y&&p.add(y),E&&!S&&m.push(v.getData())}for(const v of a(this,Uh)){const{id:y,popupRef:E,contentsObj:S}=v;E&&(S!=null&&S.str)&&!p.has(y)&&!a(this,ra).has(y)&&m.push(v)}(f=a(this,Pe))==null||f.showSidebar(m)}if(!t){r&&this.addNewEditorFromKeyboard(),a(this,sr).resolve();return}for(const p of a(this,se).values())p.uid===t?(this.setSelected(p),s?p.editComment():i?p.enterInEditMode():p.focus()):p.unselect();a(this,sr).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==a(this,me)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,t){if(a(this,ir)){switch(e){case gt.CREATE:this.currentLayer.addNewEditor(t);return;case gt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(a(this,Vd)||g(this,Vd,new Map)).set(e,t),this.showAllEditors("highlight",t);break}if(this.hasSelection)for(const n of a(this,Lt))n.updateParams(e,t);else for(const n of a(this,ir))n.updateDefaultParams(e,t)}}showAllEditors(e,t,n=!1){var i;for(const s of a(this,se).values())s.editorType===e&&s.show(t);(((i=a(this,Vd))==null?void 0:i.get(gt.HIGHLIGHT_SHOW_ALL))??!0)!==t&&A(this,J,Ii).call(this,[[gt.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(a(this,$d)!==e){g(this,$d,e);for(const t of a(this,te).values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}*getEditors(e){for(const t of a(this,se).values())t.pageIndex===e&&(yield t)}getEditor(e){return a(this,se).get(e)}addEditor(e){a(this,se).set(e.id,e)}removeEditor(e){var t,n;e.div.contains(document.activeElement)&&(a(this,Kr)&&clearTimeout(a(this,Kr)),g(this,Kr,setTimeout(()=>{this.focusMainContainer(),g(this,Kr,null)},0))),a(this,se).delete(e.id),e.annotationElementId&&((t=a(this,oa))==null||t.delete(e.annotationElementId)),this.unselect(e),(!e.annotationElementId||!a(this,ra).has(e.annotationElementId))&&((n=a(this,an))==null||n.remove(e.id))}addDeletedAnnotationElement(e){a(this,ra).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return a(this,ra).has(e)}removeDeletedAnnotationElement(e){a(this,ra).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){a(this,Rn)!==e&&(g(this,Rn,e),e&&A(this,J,Ii).call(this,e.propertiesToUpdate))}updateUI(e){a(this,J,gA)===e&&A(this,J,Ii).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){A(this,J,Ii).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(a(this,Lt).has(e)){a(this,Lt).delete(e),e.unselect(),A(this,J,rn).call(this,{hasSelectedEditor:this.hasSelection});return}a(this,Lt).add(e),e.select(),A(this,J,Ii).call(this,e.propertiesToUpdate),A(this,J,rn).call(this,{hasSelectedEditor:!0})}setSelected(e){var t,n;this.updateToolbar({mode:e.mode,editId:e.uid}),(t=a(this,ea))==null||t.commitOrRemove();for(const r of a(this,Lt))r!==e&&r.unselect();(n=a(this,Pe))==null||n.destroyPopup(),a(this,Lt).clear(),a(this,Lt).add(e),e.select(),A(this,J,Ii).call(this,e.propertiesToUpdate),A(this,J,rn).call(this,{hasSelectedEditor:!0})}isSelected(e){return a(this,Lt).has(e)}get firstSelectedEditor(){return a(this,Lt).values().next().value}unselect(e){e.unselect(),a(this,Lt).delete(e),A(this,J,rn).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return a(this,Lt).size!==0}get isEnterHandled(){return a(this,Lt).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var e;a(this,rr).undo(),A(this,J,rn).call(this,{hasSomethingToUndo:a(this,rr).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:A(this,J,Gc).call(this)}),(e=this._editorUndoBar)==null||e.hide()}redo(){a(this,rr).redo(),A(this,J,rn).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:a(this,rr).hasSomethingToRedo(),isEmpty:A(this,J,Gc).call(this)})}addCommands(e){a(this,rr).add(e),A(this,J,rn).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:A(this,J,Gc).call(this)})}cleanUndoStack(e){a(this,rr).cleanType(e)}delete(){var i;this.commitOrRemove();const e=(i=this.currentLayer)==null?void 0:i.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const t=e?[e]:[...a(this,Lt)],n=()=>{var s;(s=this._editorUndoBar)==null||s.show(r,t.length===1?t[0].editorType:t.length);for(const o of t)o.remove()},r=()=>{for(const s of t)A(this,J,ny).call(this,s)};this.addCommands({cmd:n,undo:r,mustExec:!0})}commitOrRemove(){var e;(e=a(this,Rn))==null||e.commitOrRemove()}hasSomethingToControl(){return a(this,Rn)||this.hasSelection}selectAll(){for(const e of a(this,Lt))e.commit();A(this,J,ry).call(this,a(this,se).values())}unselectAll(){var e,t;if(!(a(this,Rn)&&(a(this,Rn).commitOrRemove(),a(this,me)!==ct.NONE))&&!((e=a(this,ea))!=null&&e.commitOrRemove())&&((t=a(this,Pe))==null||t.destroyPopup(),!!this.hasSelection)){for(const n of a(this,Lt))n.unselect();a(this,Lt).clear(),A(this,J,rn).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,t,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;a(this,ua)[0]+=e,a(this,ua)[1]+=t;const[r,i]=a(this,ua),s=[...a(this,Lt)],o=1e3;a(this,Zr)&&clearTimeout(a(this,Zr)),g(this,Zr,setTimeout(()=>{g(this,Zr,null),a(this,ua)[0]=a(this,ua)[1]=0,this.addCommands({cmd:()=>{for(const l of s)a(this,se).has(l.id)&&(l.translateInPage(r,i),l.translationDone())},undo:()=>{for(const l of s)a(this,se).has(l.id)&&(l.translateInPage(-r,-i),l.translationDone())},mustExec:!1})},o));for(const l of s)l.translateInPage(e,t),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),g(this,Yr,new Map);for(const e of a(this,Lt))a(this,Yr).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!a(this,Yr))return!1;this.disableUserSelect(!1);const e=a(this,Yr);g(this,Yr,null);let t=!1;for(const[{x:r,y:i,pageIndex:s},o]of e)o.newX=r,o.newY=i,o.newPageIndex=s,t||(t=r!==o.savedX||i!==o.savedY||s!==o.savedPageIndex);if(!t)return!1;const n=(r,i,s,o)=>{if(a(this,se).has(r.id)){const l=a(this,te).get(o);l?r._setParentAndPosition(l,i,s):(r.pageIndex=o,r.x=i,r.y=s)}};return this.addCommands({cmd:()=>{for(const[r,{newX:i,newY:s,newPageIndex:o}]of e)n(r,i,s,o)},undo:()=>{for(const[r,{savedX:i,savedY:s,savedPageIndex:o}]of e)n(r,i,s,o)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(a(this,Yr))for(const n of a(this,Yr).keys())n.drag(e,t)}rebuild(e){if(e.parent===null){const 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(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||a(this,Lt).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return a(this,Rn)===e}getActive(){return a(this,Rn)}getMode(){return a(this,me)}isEditingMode(){return a(this,me)!==ct.NONE}get imageManager(){return dt(this,"imageManager",new Qv)}getSelectionBoxes(e){if(!e)return null;const t=document.getSelection();for(let u=0,c=t.rangeCount;u({x:(c-r)/s,y:1-(u+d-n)/i,width:f/s,height:d/i});break;case"180":o=(u,c,d,f)=>({x:1-(u+d-n)/i,y:1-(c+f-r)/s,width:d/i,height:f/s});break;case"270":o=(u,c,d,f)=>({x:1-(c+f-r)/s,y:(u-n)/i,width:f/s,height:d/i});break;default:o=(u,c,d,f)=>({x:(u-n)/i,y:(c-r)/s,width:d/i,height:f/s});break}const l=[];for(let u=0,c=t.rangeCount;u{f.type==="pointerup"&&f.button!==0||(u.abort(),l==null||l.toggleDrawing(!0),f.type==="pointerup"&&A(this,J,zc).call(this,"main_toolbar"))};window.addEventListener("pointerup",d,{signal:c}),window.addEventListener("blur",d,{signal:c})}else l==null||l.toggleDrawing(!0),A(this,J,zc).call(this,"main_toolbar")}},zc=function(e=""){a(this,me)===ct.HIGHLIGHT?this.highlightSelection(e):a(this,kd)&&A(this,J,iA).call(this)},aA=function(){document.addEventListener("selectionchange",A(this,J,sA).bind(this),{signal:this._signal})},oA=function(){if(a(this,ia))return;g(this,ia,new AbortController);const e=this.combinedSignal(a(this,ia));window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})},lA=function(){var e;(e=a(this,ia))==null||e.abort(),g(this,ia,null)},ey=function(){if(a(this,aa))return;g(this,aa,new AbortController);const e=this.combinedSignal(a(this,aa));window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})},hA=function(){var e;(e=a(this,aa))==null||e.abort(),g(this,aa,null)},uA=function(){if(a(this,ta))return;g(this,ta,new AbortController);const e=this.combinedSignal(a(this,ta));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})},cA=function(){var e;(e=a(this,ta))==null||e.abort(),g(this,ta,null)},dA=function(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})},rn=function(e){Object.entries(e).some(([n,r])=>a(this,Wd)[n]!==r)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(a(this,Wd),e)}),a(this,me)===ct.HIGHLIGHT&&e.hasSelectedEditor===!1&&A(this,J,Ii).call(this,[[gt.HIGHLIGHT_FREE,!0]]))},Ii=function(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})},fA=async function(){if(!a(this,Bi)){g(this,Bi,!0);const e=[];for(const t of a(this,te).values())e.push(t.enable());await Promise.all(e);for(const t of a(this,se).values())t.enable()}},pA=function(){if(this.unselectAll(),a(this,Bi)){g(this,Bi,!1);for(const e of a(this,te).values())e.disable();for(const e of a(this,se).values())e.disable()}},ny=function(e){const t=a(this,te).get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))},gA=function(){let e=null;for(e of a(this,Lt));return e},Gc=function(){if(a(this,se).size===0)return!0;if(a(this,se).size===1)for(const e of a(this,se).values())return e.isEmpty();return!1},ry=function(e){for(const t of a(this,Lt))t.unselect();a(this,Lt).clear();for(const t of e)t.isEmpty()||(a(this,Lt).add(t),t.select());A(this,J,rn).call(this,{hasSelectedEditor:this.hasSelection})},M(Ms,"TRANSLATE_SMALL",1),M(Ms,"TRANSLATE_BIG",10),Ms);var Ie,Qr,Sr,Yh,qr,Fn,Kh,ti,yn,Ui,Do,ei,ca,Hr,Xc,Tg;const sn=class sn{constructor(e){b(this,Hr);b(this,Ie,null);b(this,Qr,!1);b(this,Sr,null);b(this,Yh,null);b(this,qr,null);b(this,Fn,null);b(this,Kh,!1);b(this,ti,null);b(this,yn,null);b(this,Ui,null);b(this,Do,null);b(this,ei,!1);g(this,yn,e),g(this,ei,e._uiManager.useNewAltTextFlow),a(sn,ca)||g(sn,ca,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){sn._l10n??(sn._l10n=e)}async render(){const e=g(this,Sr,document.createElement("button"));e.className="altText",e.tabIndex="0";const t=g(this,Yh,document.createElement("span"));e.append(t),a(this,ei)?(e.classList.add("new"),e.setAttribute("data-l10n-id",a(sn,ca).missing),t.setAttribute("data-l10n-id",a(sn,ca)["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const n=a(this,yn)._uiManager._signal;e.addEventListener("contextmenu",Er,{signal:n}),e.addEventListener("pointerdown",i=>i.stopPropagation(),{signal:n});const r=i=>{i.preventDefault(),a(this,yn)._uiManager.editAltText(a(this,yn)),a(this,ei)&&a(this,yn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:a(this,Hr,Xc)}})};return e.addEventListener("click",r,{capture:!0,signal:n}),e.addEventListener("keydown",i=>{i.target===e&&i.key==="Enter"&&(g(this,Kh,!0),r(i))},{signal:n}),await A(this,Hr,Tg).call(this),e}finish(){a(this,Sr)&&(a(this,Sr).focus({focusVisible:a(this,Kh)}),g(this,Kh,!1))}isEmpty(){return a(this,ei)?a(this,Ie)===null:!a(this,Ie)&&!a(this,Qr)}hasData(){return a(this,ei)?a(this,Ie)!==null||!!a(this,Ui):this.isEmpty()}get guessedText(){return a(this,Ui)}async setGuessedText(e){a(this,Ie)===null&&(g(this,Ui,e),g(this,Do,await sn._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e})),A(this,Hr,Tg).call(this))}toggleAltTextBadge(e=!1){var t;if(!a(this,ei)||a(this,Ie)){(t=a(this,ti))==null||t.remove(),g(this,ti,null);return}if(!a(this,ti)){const n=g(this,ti,document.createElement("div"));n.className="noAltTextBadge",a(this,yn).div.append(n)}a(this,ti).classList.toggle("hidden",!e)}serialize(e){let t=a(this,Ie);return!e&&a(this,Ui)===t&&(t=a(this,Do)),{altText:t,decorative:a(this,Qr),guessedText:a(this,Ui),textWithDisclaimer:a(this,Do)}}get data(){return{altText:a(this,Ie),decorative:a(this,Qr)}}set data({altText:e,decorative:t,guessedText:n,textWithDisclaimer:r,cancel:i=!1}){n&&(g(this,Ui,n),g(this,Do,r)),!(a(this,Ie)===e&&a(this,Qr)===t)&&(i||(g(this,Ie,e),g(this,Qr,t)),A(this,Hr,Tg).call(this))}toggle(e=!1){a(this,Sr)&&(!e&&a(this,Fn)&&(clearTimeout(a(this,Fn)),g(this,Fn,null)),a(this,Sr).disabled=!e)}shown(){a(this,yn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:a(this,Hr,Xc)}})}destroy(){var e,t;(e=a(this,Sr))==null||e.remove(),g(this,Sr,null),g(this,Yh,null),g(this,qr,null),(t=a(this,ti))==null||t.remove(),g(this,ti,null)}};Ie=new WeakMap,Qr=new WeakMap,Sr=new WeakMap,Yh=new WeakMap,qr=new WeakMap,Fn=new WeakMap,Kh=new WeakMap,ti=new WeakMap,yn=new WeakMap,Ui=new WeakMap,Do=new WeakMap,ei=new WeakMap,ca=new WeakMap,Hr=new WeakSet,Xc=function(){return a(this,Ie)&&"added"||a(this,Ie)===null&&this.guessedText&&"review"||"missing"},Tg=async function(){var r,i,s;const e=a(this,Sr);if(!e)return;if(a(this,ei)){if(e.classList.toggle("done",!!a(this,Ie)),e.setAttribute("data-l10n-id",a(sn,ca)[a(this,Hr,Xc)]),(r=a(this,Yh))==null||r.setAttribute("data-l10n-id",a(sn,ca)[`${a(this,Hr,Xc)}-label`]),!a(this,Ie)){(i=a(this,qr))==null||i.remove();return}}else{if(!a(this,Ie)&&!a(this,Qr)){e.classList.remove("done"),(s=a(this,qr))==null||s.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let t=a(this,qr);if(!t){g(this,qr,t=document.createElement("span")),t.className="tooltip",t.setAttribute("role","tooltip"),t.id=`alt-text-tooltip-${a(this,yn).id}`;const o=100,l=a(this,yn)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(a(this,Fn)),g(this,Fn,null)},{once:!0}),e.addEventListener("mouseenter",()=>{g(this,Fn,setTimeout(()=>{g(this,Fn,null),a(this,qr).classList.add("show"),a(this,yn)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:l}),e.addEventListener("mouseleave",()=>{var u;a(this,Fn)&&(clearTimeout(a(this,Fn)),g(this,Fn,null)),(u=a(this,qr))==null||u.classList.remove("show")},{signal:l})}a(this,Qr)?t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(t.removeAttribute("data-l10n-id"),t.textContent=a(this,Ie)),t.parentNode||e.append(t);const n=a(this,yn).getElementForAltText();n==null||n.setAttribute("aria-describedby",t.id)},b(sn,ca,null),M(sn,"_l10n",null);let wm=sn;var ke,ar,Oo,zt,Xd,da,or,fa,pa,Mo,_d,iy;class lg{constructor(e){b(this,_d);b(this,ke,null);b(this,ar,null);b(this,Oo,!1);b(this,zt,null);b(this,Xd,null);b(this,da,null);b(this,or,null);b(this,fa,null);b(this,pa,!1);b(this,Mo,null);g(this,zt,e)}renderForToolbar(){const e=g(this,ar,document.createElement("button"));return e.className="comment",A(this,_d,iy).call(this,e,!1)}renderForStandalone(){const e=g(this,ke,document.createElement("button"));e.className="annotationCommentButton";const t=a(this,zt).commentButtonPosition;if(t){const{style:n}=e;n.insetInlineEnd=`calc(${100*(a(this,zt)._uiManager.direction==="ltr"?1-t[0]:t[0])}% - var(--comment-button-dim))`,n.top=`calc(${100*t[1]}% - var(--comment-button-dim))`;const r=a(this,zt).commentButtonColor;r&&(n.backgroundColor=r)}return A(this,_d,iy).call(this,e,!0)}focusButton(){setTimeout(()=>{var e;(e=a(this,ke)??a(this,ar))==null||e.focus()},0)}onUpdatedColor(){if(!a(this,ke))return;const e=a(this,zt).commentButtonColor;e&&(a(this,ke).style.backgroundColor=e),a(this,zt)._uiManager.updatePopupColor(a(this,zt))}get commentButtonWidth(){var e;return(((e=a(this,ke))==null?void 0:e.getBoundingClientRect().width)??0)/a(this,zt).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(a(this,Mo))return a(this,Mo);if(!a(this,ke))return null;const{x:e,y:t,height:n}=a(this,ke).getBoundingClientRect(),{x:r,y:i,width:s,height:o}=a(this,zt).parent.boundingClientRect;return[(e-r)/s,(t+n-i)/o]}set commentPopupPositionInLayer(e){g(this,Mo,e)}hasDefaultPopupPosition(){return a(this,Mo)===null}removeStandaloneCommentButton(){var e;(e=a(this,ke))==null||e.remove(),g(this,ke,null)}removeToolbarCommentButton(){var e;(e=a(this,ar))==null||e.remove(),g(this,ar,null)}setCommentButtonStates({selected:e,hasPopup:t}){a(this,ke)&&(a(this,ke).classList.toggle("selected",e),a(this,ke).ariaExpanded=t)}edit(e){const t=this.commentPopupPositionInLayer;let n,r;if(t)[n,r]=t;else{[n,r]=a(this,zt).commentButtonPosition;const{width:c,height:d,x:f,y:p}=a(this,zt);n=f+n*c,r=p+r*d}const i=a(this,zt).parent.boundingClientRect,{x:s,y:o,width:l,height:u}=i;a(this,zt)._uiManager.editComment(a(this,zt),s+n*l,o+r*u,{...e,parentDimensions:i})}finish(){a(this,ar)&&(a(this,ar).focus({focusVisible:a(this,Oo)}),g(this,Oo,!1))}isDeleted(){return a(this,pa)||a(this,or)===""}isEmpty(){return a(this,or)===null}hasBeenEdited(){return this.isDeleted()||a(this,or)!==a(this,Xd)}serialize(){return this.data}get data(){return{text:a(this,or),richText:a(this,da),date:a(this,fa),deleted:this.isDeleted()}}set data(e){if(e!==a(this,or)&&g(this,da,null),e===null){g(this,or,""),g(this,pa,!0);return}g(this,or,e),g(this,fa,new Date),g(this,pa,!1)}restoreData({text:e,richText:t,date:n}){g(this,or,e),g(this,da,t),g(this,fa,n),g(this,pa,!1)}setInitialText(e,t=null){g(this,Xd,e),this.data=e,g(this,fa,null),g(this,da,t)}shown(){}destroy(){var e,t;(e=a(this,ar))==null||e.remove(),g(this,ar,null),(t=a(this,ke))==null||t.remove(),g(this,ke,null),g(this,or,""),g(this,da,null),g(this,fa,null),g(this,zt,null),g(this,Oo,!1),g(this,pa,!1)}}ke=new WeakMap,ar=new WeakMap,Oo=new WeakMap,zt=new WeakMap,Xd=new WeakMap,da=new WeakMap,or=new WeakMap,fa=new WeakMap,pa=new WeakMap,Mo=new WeakMap,_d=new WeakSet,iy=function(e,t){if(!a(this,zt)._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=[a(this,zt)._uiManager.getCommentDialogElement()],e.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));const n=a(this,zt)._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return e;e.addEventListener("contextmenu",Er,{signal:n}),t&&(e.addEventListener("focusin",i=>{a(this,zt)._focusEventsAllowed=!1,ee(i)},{capture:!0,signal:n}),e.addEventListener("focusout",i=>{a(this,zt)._focusEventsAllowed=!0,ee(i)},{capture:!0,signal:n})),e.addEventListener("pointerdown",i=>i.stopPropagation(),{signal:n});const r=i=>{i.preventDefault(),e===a(this,ar)?this.edit():a(this,zt).toggleComment(!0)};return e.addEventListener("click",r,{capture:!0,signal:n}),e.addEventListener("keydown",i=>{i.target===e&&i.key==="Enter"&&(g(this,Oo,!0),r(i))},{signal:n}),e.addEventListener("pointerenter",()=>{a(this,zt).toggleComment(!1,!0)},{signal:n}),e.addEventListener("pointerleave",()=>{a(this,zt).toggleComment(!1,!1)},{signal:n}),e};var Jh,Lo,Yd,Kd,Jd,Zd,Qd,$i,No,Hi,Bo,Vi,co,vA,yA,bA,Zh;let mA=(Zh=class{constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:n=null,onPinchStart:r=null,onPinching:i=null,onPinchEnd:s=null,signal:o}){b(this,co);b(this,Jh);b(this,Lo,!1);b(this,Yd,null);b(this,Kd);b(this,Jd);b(this,Zd);b(this,Qd);b(this,$i,null);b(this,No);b(this,Hi,null);b(this,Bo);b(this,Vi,null);g(this,Jh,e),g(this,Yd,n),g(this,Kd,t),g(this,Jd,r),g(this,Zd,i),g(this,Qd,s),g(this,Bo,new AbortController),g(this,No,AbortSignal.any([o,a(this,Bo).signal])),e.addEventListener("touchstart",A(this,co,vA).bind(this),{passive:!1,signal:a(this,No)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/uh.pixelRatio}destroy(){var e,t;(e=a(this,Bo))==null||e.abort(),g(this,Bo,null),(t=a(this,$i))==null||t.abort(),g(this,$i,null)}},Jh=new WeakMap,Lo=new WeakMap,Yd=new WeakMap,Kd=new WeakMap,Jd=new WeakMap,Zd=new WeakMap,Qd=new WeakMap,$i=new WeakMap,No=new WeakMap,Hi=new WeakMap,Bo=new WeakMap,Vi=new WeakMap,co=new WeakSet,vA=function(e){var r,i,s;if((r=a(this,Kd))!=null&&r.call(this))return;if(e.touches.length===1){if(a(this,$i))return;const o=g(this,$i,new AbortController),l=AbortSignal.any([a(this,No),o.signal]),u=a(this,Jh),c={capture:!0,signal:l,passive:!1},d=f=>{var p;f.pointerType==="touch"&&((p=a(this,$i))==null||p.abort(),g(this,$i,null))};u.addEventListener("pointerdown",f=>{f.pointerType==="touch"&&(ee(f),d(f))},c),u.addEventListener("pointerup",d,c),u.addEventListener("pointercancel",d,c);return}if(!a(this,Vi)){g(this,Vi,new AbortController);const o=AbortSignal.any([a(this,No),a(this,Vi).signal]),l=a(this,Jh),u={signal:o,capture:!1,passive:!1};l.addEventListener("touchmove",A(this,co,yA).bind(this),u);const c=A(this,co,bA).bind(this);l.addEventListener("touchend",c,u),l.addEventListener("touchcancel",c,u),u.capture=!0,l.addEventListener("pointerdown",ee,u),l.addEventListener("pointermove",ee,u),l.addEventListener("pointercancel",ee,u),l.addEventListener("pointerup",ee,u),(i=a(this,Jd))==null||i.call(this)}if(ee(e),e.touches.length!==2||(s=a(this,Yd))!=null&&s.call(this)){g(this,Hi,null);return}let[t,n]=e.touches;t.identifier>n.identifier&&([t,n]=[n,t]),g(this,Hi,{touch0X:t.screenX,touch0Y:t.screenY,touch1X:n.screenX,touch1Y:n.screenY})},yA=function(e){var C;if(!a(this,Hi)||e.touches.length!==2)return;ee(e);let[t,n]=e.touches;t.identifier>n.identifier&&([t,n]=[n,t]);const{screenX:r,screenY:i}=t,{screenX:s,screenY:o}=n,l=a(this,Hi),{touch0X:u,touch0Y:c,touch1X:d,touch1Y:f}=l,p=d-u,m=f-c,v=s-r,y=o-i,E=Math.hypot(v,y)||1,S=Math.hypot(p,m)||1;if(!a(this,Lo)&&Math.abs(S-E)<=Zh.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=r,l.touch0Y=i,l.touch1X=s,l.touch1Y=o,!a(this,Lo)){g(this,Lo,!0);return}const w=[(r+s)/2,(i+o)/2];(C=a(this,Zd))==null||C.call(this,w,S,E)},bA=function(e){var t;e.touches.length>=2||(a(this,Vi)&&(a(this,Vi).abort(),g(this,Vi,null),(t=a(this,Qd))==null||t.call(this)),a(this,Hi)&&(ee(e),g(this,Hi,null),g(this,Lo,!1)))},Zh);var ko,Cr,Jt,Nt,Wi,Qh,ga,qd,je,jo,zi,lr,ma,tf,Uo,Dn,ef,$o,Gi,ni,qh,tu,hr,Ho,nf,jm,ot,sy,rf,ay,Pg,AA,EA,oy,Ig,ly,wA,xA,SA,hy,CA,uy,TA,PA,IA,cy,_c;const ft=class ft{constructor(e){b(this,ot);b(this,ko,null);b(this,Cr,null);b(this,Jt,null);b(this,Nt,null);b(this,Wi,null);b(this,Qh,!1);b(this,ga,null);b(this,qd,"");b(this,je,null);b(this,jo,null);b(this,zi,null);b(this,lr,null);b(this,ma,null);b(this,tf,"");b(this,Uo,!1);b(this,Dn,null);b(this,ef,!1);b(this,$o,!1);b(this,Gi,!1);b(this,ni,null);b(this,qh,0);b(this,tu,0);b(this,hr,null);b(this,Ho,null);M(this,"isSelected",!1);M(this,"_isCopy",!1);M(this,"_editToolbar",null);M(this,"_initialOptions",Object.create(null));M(this,"_initialData",null);M(this,"_isVisible",!0);M(this,"_uiManager",null);M(this,"_focusEventsAllowed",!0);b(this,nf,!1);b(this,jm,ft._zIndex++);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;const{rotation:t,rawDims:{pageWidth:n,pageHeight:r,pageX:i,pageY:s}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,r],this.pageTranslation=[i,s];const[o,l]=this.parentDimensions;this.x=e.x/o,this.y=e.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=ft.prototype._resizeWithKeyboard,t=Cd.TRANSLATE_SMALL,n=Cd.TRANSLATE_BIG;return dt(this,"_resizerKeyboardManager",new ag([[["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"],ft.prototype._stopResizingWithKeyboard]]))}updatePageIndex(e){this.pageIndex=e}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 dt(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new Qx({id:e._uiManager.getId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,t){if(ft._l10n??(ft._l10n=e),ft._l10nResizer||(ft._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"})),ft._borderLineWidth!==-1)return;const n=getComputedStyle(document.documentElement);ft._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){Ot("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return a(this,nf)}set _isDraggable(e){var t;g(this,nf,e),(t=this.div)==null||t.classList.toggle("draggable",e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){const[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=a(this,jm)}setParent(e){var t;e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):(A(this,ot,_c).call(this),(t=a(this,lr))==null||t.remove(),g(this,lr,null)),this.parent=e}focusin(e){this._focusEventsAllowed&&(a(this,Uo)?g(this,Uo,!1):this.parent.setSelected(this))}focusout(e){var n;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const t=e.relatedTarget;t!=null&&t.closest(`#${this.id}`)||(e.preventDefault(),(n=this.parent)!=null&&n.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,n,r){const[i,s]=this.parentDimensions;[n,r]=this.screenToPageTranslation(n,r),this.x=(e+n)/i,this.y=(t+r)/s,this.fixAndSetPosition()}_moveAfterPaste(e,t){if(this.isClone){delete this.isClone;return}const[n,r]=this.parentDimensions;this.setAt(e*n,t*r,this.width*n,this.height*r),this._onTranslated()}translate(e,t){A(this,ot,sy).call(this,this.parentDimensions,e,t)}translateInPage(e,t){a(this,Dn)||g(this,Dn,[this.x,this.y,this.width,this.height]),A(this,ot,sy).call(this,this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){a(this,Dn)||g(this,Dn,[this.x,this.y,this.width,this.height]);const{div:n,parentDimensions:[r,i]}=this;if(this.x+=e/r,this.y+=t/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:d,y:f}=this.div.getBoundingClientRect();this.parent.findNewParent(this,d,f)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:s,y:o}=this;const[l,u]=this.getBaseTranslation();s+=l,o+=u;const{style:c}=n;c.left=`${(100*s).toFixed(2)}%`,c.top=`${(100*o).toFixed(2)}%`,this._onTranslating(s,o),n.scrollIntoView({block:"nearest"})}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!a(this,Dn)&&(a(this,Dn)[0]!==this.x||a(this,Dn)[1]!==this.y)}get _hasBeenResized(){return!!a(this,Dn)&&(a(this,Dn)[2]!==this.width||a(this,Dn)[3]!==this.height)}getBaseTranslation(){const[e,t]=this.parentDimensions,{_borderLineWidth:n}=ft,r=n/e,i=n/t;switch(this.rotation){case 90:return[-r,i];case 180:return[r,i];case 270:return[r,-i];default:return[-r,-i]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:t},pageDimensions:[n,r]}=this;let{x:i,y:s,width:o,height:l}=this;if(o*=n,l*=r,i*=n,s*=r,this._mustFixPosition)switch(e){case 0:i=Qt(i,0,n-o),s=Qt(s,0,r-l);break;case 90:i=Qt(i,0,n-l),s=Qt(s,o,r);break;case 180:i=Qt(i,o,n),s=Qt(s,l,r);break;case 270:i=Qt(i,l,n),s=Qt(s,0,r-o);break}this.x=i/=n,this.y=s/=r;const[u,c]=this.getBaseTranslation();i+=u,s+=c,t.left=`${(100*i).toFixed(2)}%`,t.top=`${(100*s).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,t){var n;return A(n=ft,rf,ay).call(n,e,t,this.parentRotation)}pageTranslationToScreen(e,t){var n;return A(n=ft,rf,ay).call(n,e,t,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[t,n]}=this;return[t*e,n*e]}setDims(){const{div:{style:e},width:t,height:n}=this;e.width=`${(100*t).toFixed(2)}%`,e.height=`${(100*n).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(e){return Math.round(e*1e4)/1e4}_onResizing(){}altTextFinish(){var e;(e=a(this,Jt))==null||e.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||a(this,$o))return this._editToolbar;this._editToolbar=new Jv(this),this.div.append(this._editToolbar.render());const{toolbarButtons:e}=this;if(e)for(const[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(){var e;(e=this._editToolbar)==null||e.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){var e;(e=this._editToolbar)==null||e.removeButton("comment")}removeEditToolbar(){var e,t;(e=this._editToolbar)==null||e.remove(),this._editToolbar=null,(t=a(this,Jt))==null||t.destroy()}addContainer(e){var n;const t=(n=this._editToolbar)==null?void 0:n.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return a(this,Jt)||(wm.initialize(ft._l10n),g(this,Jt,new wm(this)),a(this,ko)&&(a(this,Jt).data=a(this,ko),g(this,ko,null))),a(this,Jt)}get altTextData(){var e;return(e=a(this,Jt))==null?void 0:e.data}set altTextData(e){a(this,Jt)&&(a(this,Jt).data=e)}get guessedAltText(){var e;return(e=a(this,Jt))==null?void 0:e.guessedText}async setGuessedAltText(e){var t;await((t=a(this,Jt))==null?void 0:t.setGuessedText(e))}serializeAltText(e){var t;return(t=a(this,Jt))==null?void 0:t.serialize(e)}hasAltText(){return!!a(this,Jt)&&!a(this,Jt).isEmpty()}hasAltTextData(){var e;return((e=a(this,Jt))==null?void 0:e.hasData())??!1}focusCommentButton(){var e;(e=a(this,Nt))==null||e.focusButton()}addCommentButton(){return this.canAddComment?a(this,Nt)||g(this,Nt,new lg(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(a(this,Wi)){this._uiManager.isEditingMode()&&a(this,Wi).classList.remove("hidden");return}this.hasComment&&(g(this,Wi,a(this,Nt).renderForStandalone()),this.div.append(a(this,Wi)))}}removeStandaloneCommentButton(){a(this,Nt).removeStandaloneCommentButton(),g(this,Wi,null)}hideStandaloneCommentButton(){var e;(e=a(this,Wi))==null||e.classList.add("hidden")}get comment(){if(!a(this,Nt))return null;const{data:{richText:e,text:t,date:n,deleted:r}}=a(this,Nt);return{text:t,richText:e,date:n,deleted:r,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){a(this,Nt)||g(this,Nt,new lg(this)),typeof e=="object"&&e!==null?a(this,Nt).restoreData(e):a(this,Nt).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||(a(this,Nt)||g(this,Nt,new lg(this)),a(this,Nt).setInitialText(e,n),!this.annotationElementId))return;const r=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);r&&this.updateFromAnnotationLayer(r)}get hasEditedComment(){var e;return(e=a(this,Nt))==null?void 0:e.hasBeenEdited()}get hasDeletedComment(){var e;return(e=a(this,Nt))==null?void 0:e.isDeleted()}get hasComment(){return!!a(this,Nt)&&!a(this,Nt).isEmpty()&&!a(this,Nt).isDeleted()}async editComment(e){a(this,Nt)||g(this,Nt,new lg(this)),a(this,Nt).edit(e)}toggleComment(e,t=void 0){this.hasComment&&this._uiManager.toggleComment(this,e,t)}setSelectedCommentButton(e){a(this,Nt).setSelectedButton(e)}addComment(e){if(this.hasEditedComment){const[,,,r]=e.rect,[i]=this.pageDimensions,[s]=this.pageTranslation,o=s+i+1,l=r-100,u=o+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[o,l,u,r]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:t}}){a(this,Nt).data=t?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){var s;const 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=a(this,Qh)?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),A(this,ot,uy).call(this);const[t,n]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth=`${(100*n/t).toFixed(2)}%`,e.style.maxHeight=`${(100*t/n).toFixed(2)}%`);const[r,i]=this.getInitialTranslation();return this.translate(r,i),eA(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(a(this,Ho)||g(this,Ho,new mA({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:A(this,ot,wA).bind(this),onPinching:A(this,ot,xA).bind(this),onPinchEnd:A(this,ot,SA).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),(s=this._uiManager._editorUndoBar)==null||s.hide(),e}pointerdown(e){const{isMac:t}=be.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(g(this,Uo,!0),this._isDraggable){A(this,ot,CA).call(this,e);return}A(this,ot,hy).call(this,e)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){a(this,ni)&&clearTimeout(a(this,ni)),g(this,ni,setTimeout(()=>{var e;g(this,ni,null),(e=this.parent)==null||e.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){const r=this.parentScale,[i,s]=this.pageDimensions,[o,l]=this.pageTranslation,u=e/r,c=t/r,d=this.x*i,f=this.y*s,p=this.width*i,m=this.height*s;switch(n){case 0:return[d+u+o,s-f-c-m+l,d+u+p+o,s-f-c+l];case 90:return[d+c+o,s-f+u+l,d+c+m+o,s-f+u+p+l];case 180:return[d-u-p+o,s-f+c+l,d-u+o,s-f+c+m+l];case 270:return[d-c-m+o,s-f-u-p+l,d-c+o,s-f-u+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[n,r,i,s]=e,o=i-n,l=s-r;switch(this.rotation){case 0:return[n,t-s,o,l];case 90:return[n,t-r,l,o];case 180:return[i,t-r,o,l];case 270:return[i,t-s,l,o];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&ft._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){var e;(e=a(this,Nt))==null||e.onUpdatedColor()}getData(){const{comment:{text:e,color:t,date:n,opacity:r,deleted:i,richText:s},uid:o,pageIndex:l,creationDate:u,modificationDate:c}=this;return{id:o,pageIndex:l,rect:this.getPDFRect(),richText:s,contentsObj:{str:e},creationDate:u,modificationDate:n||c,popupRef:!i,color:t,opacity:r}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),g(this,$o,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),g(this,$o,!1),!0):!1}isInEditMode(){return a(this,$o)}shouldGetKeyboardEvents(){return a(this,Gi)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:t,bottom:n,right:r}=this.getClientDimensions(),{innerHeight:i,innerWidth:s}=window;return t0&&e0}rebuild(){A(this,ot,uy).call(this)}rotate(e){}resize(){}serializeDeleted(){var e;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((e=this._initialData)==null?void 0:e.popupRef)||""}}serialize(e=!1,t=null){var n;return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:((n=this._initialData)==null?void 0:n.popupRef)||""}}static async deserialize(e,t,n){const r=new this.prototype.constructor({parent:t,id:n.getId(),uiManager:n,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});r.rotation=e.rotation,g(r,ko,e.accessibilityData),r._isCopy=e.isCopy||!1;const[i,s]=r.pageDimensions,[o,l,u,c]=r.getRectInCurrentCoords(e.rect,s);return r.x=o/i,r.y=l/s,r.width=u/i,r.height=c/s,r}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e,t,n;if((e=a(this,ma))==null||e.abort(),g(this,ma,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),a(this,ni)&&(clearTimeout(a(this,ni)),g(this,ni,null)),A(this,ot,_c).call(this),this.removeEditToolbar(),a(this,hr)){for(const r of a(this,hr).values())clearTimeout(r);g(this,hr,null)}this.parent=null,(t=a(this,Ho))==null||t.destroy(),g(this,Ho,null),(n=a(this,lr))==null||n.remove(),g(this,lr,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(A(this,ot,AA).call(this),a(this,je).classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[e,t]}=this,[n,r,i,s]=this.getPDFRect();return[ft._round(n+(i-n)*e),ft._round(r+(s-r)*(1-t))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return a(this,Nt).commentPopupPositionInLayer}set commentPopupPosition(e){a(this,Nt).commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return a(this,Nt).hasDefaultPopupPosition()}get commentButtonWidth(){return a(this,Nt).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){var t;(t=a(this,Nt))==null||t.setCommentButtonStates(e)}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),g(this,zi,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const t=a(this,je).children;if(!a(this,Cr)){g(this,Cr,Array.from(t));const s=A(this,ot,TA).bind(this),o=A(this,ot,PA).bind(this),l=this._uiManager._signal;for(const u of a(this,Cr)){const c=u.getAttribute("data-resizer-name");u.setAttribute("role","spinbutton"),u.addEventListener("keydown",s,{signal:l}),u.addEventListener("blur",o,{signal:l}),u.addEventListener("focus",A(this,ot,IA).bind(this,c),{signal:l}),u.setAttribute("data-l10n-id",ft._l10nResizer[c])}}const n=a(this,Cr)[0];let r=0;for(const s of t){if(s===n)break;r++}const i=(360-this.rotation+this.parentRotation)%360/90*(a(this,Cr).length/4);if(i!==r){if(ir)for(let o=0;o{var r,i;(r=this.div)!=null&&r.classList.contains("selectedEditor")&&((i=this._editToolbar)==null||i.show())});return}(t=this._editToolbar)==null||t.show(),(n=a(this,Jt))==null||n.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>{var e;return(e=this.div)==null?void 0:e.focus({preventScroll:!0})},0)}unselect(){var e,t,n,r,i;this.isSelected&&(this.isSelected=!1,(e=a(this,je))==null||e.classList.add("hidden"),(t=this.div)==null||t.classList.remove("selectedEditor"),(n=this.div)!=null&&n.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(r=this._editToolbar)==null||r.hide(),(i=a(this,Jt))==null||i.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 a(this,ef)}set isEditing(e){g(this,ef,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){a(this,hr)||g(this,hr,new Map);const{action:n}=e;let r=a(this,hr).get(n);r&&clearTimeout(r),r=setTimeout(()=>{this._reportTelemetry(e),a(this,hr).delete(n),a(this,hr).size===0&&g(this,hr,null)},ft._telemetryTimeout),a(this,hr).set(n,r);return}e.type||(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),g(this,Qh,!1)}disable(){this.div&&(this.div.tabIndex=-1),g(this,Qh,!0)}updateFakeAnnotationElement(e){if(!a(this,lr)&&!this.deleted){g(this,lr,e.addFakeAnnotation(this));return}if(this.deleted){a(this,lr).remove(),g(this,lr,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&a(this,lr).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"){const n=t;t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),n.before(t)}return t}resetAnnotationElement(e){const{firstElementChild:t}=e.container;(t==null?void 0:t.nodeName)==="DIV"&&t.classList.contains("annotationContent")&&t.remove()}};ko=new WeakMap,Cr=new WeakMap,Jt=new WeakMap,Nt=new WeakMap,Wi=new WeakMap,Qh=new WeakMap,ga=new WeakMap,qd=new WeakMap,je=new WeakMap,jo=new WeakMap,zi=new WeakMap,lr=new WeakMap,ma=new WeakMap,tf=new WeakMap,Uo=new WeakMap,Dn=new WeakMap,ef=new WeakMap,$o=new WeakMap,Gi=new WeakMap,ni=new WeakMap,qh=new WeakMap,tu=new WeakMap,hr=new WeakMap,Ho=new WeakMap,nf=new WeakMap,jm=new WeakMap,ot=new WeakSet,sy=function([e,t],n,r){[n,r]=this.screenToPageTranslation(n,r),this.x+=n/e,this.y+=r/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},rf=new WeakSet,ay=function(e,t,n){switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}},Pg=function(e){switch(e){case 90:{const[t,n]=this.pageDimensions;return[0,-t/n,n/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,n]=this.pageDimensions;return[0,t/n,-n/t,0]}default:return[1,0,0,1]}},AA=function(){if(a(this,je))return;g(this,je,document.createElement("div")),a(this,je).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],t=this._uiManager._signal;for(const n of e){const r=document.createElement("div");a(this,je).append(r),r.classList.add("resizer",n),r.setAttribute("data-resizer-name",n),r.addEventListener("pointerdown",A(this,ot,EA).bind(this,n),{signal:t}),r.addEventListener("contextmenu",Er,{signal:t}),r.tabIndex=-1}this.div.prepend(a(this,je))},EA=function(e,t){var c;t.preventDefault();const{isMac:n}=be.platform;if(t.button!==0||t.ctrlKey&&n)return;(c=a(this,Jt))==null||c.toggle(!1);const r=this._isDraggable;this._isDraggable=!1,g(this,jo,[t.screenX,t.screenY]);const i=new AbortController,s=this._uiManager.combinedSignal(i);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",A(this,ot,ly).bind(this,e),{passive:!0,capture:!0,signal:s}),window.addEventListener("touchmove",ee,{passive:!1,signal:s}),window.addEventListener("contextmenu",Er,{signal:s}),g(this,zi,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const o=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const u=()=>{var d;i.abort(),this.parent.togglePointerEvents(!0),(d=a(this,Jt))==null||d.toggle(!0),this._isDraggable=r,this.parent.div.style.cursor=o,this.div.style.cursor=l,A(this,ot,Ig).call(this)};window.addEventListener("pointerup",u,{signal:s}),window.addEventListener("blur",u,{signal:s})},oy=function(e,t,n,r){this.width=n,this.height=r,this.x=e,this.y=t,this.setDims(),this.fixAndSetPosition(),this._onResized()},Ig=function(){if(!a(this,zi))return;const{savedX:e,savedY:t,savedWidth:n,savedHeight:r}=a(this,zi);g(this,zi,null);const i=this.x,s=this.y,o=this.width,l=this.height;i===e&&s===t&&o===n&&l===r||this.addCommands({cmd:A(this,ot,oy).bind(this,i,s,o,l),undo:A(this,ot,oy).bind(this,e,t,n,r),mustExec:!0})},ly=function(e,t){const[n,r]=this.parentDimensions,i=this.x,s=this.y,o=this.width,l=this.height,u=ft.MIN_SIZE/n,c=ft.MIN_SIZE/r,d=A(this,ot,Pg).call(this,this.rotation),f=(j,U)=>[d[0]*j+d[2]*U,d[1]*j+d[3]*U],p=A(this,ot,Pg).call(this,360-this.rotation),m=(j,U)=>[p[0]*j+p[2]*U,p[1]*j+p[3]*U];let v,y,E=!1,S=!1;switch(e){case"topLeft":E=!0,v=(j,U)=>[0,0],y=(j,U)=>[j,U];break;case"topMiddle":v=(j,U)=>[j/2,0],y=(j,U)=>[j/2,U];break;case"topRight":E=!0,v=(j,U)=>[j,0],y=(j,U)=>[0,U];break;case"middleRight":S=!0,v=(j,U)=>[j,U/2],y=(j,U)=>[0,U/2];break;case"bottomRight":E=!0,v=(j,U)=>[j,U],y=(j,U)=>[0,0];break;case"bottomMiddle":v=(j,U)=>[j/2,U],y=(j,U)=>[j/2,0];break;case"bottomLeft":E=!0,v=(j,U)=>[0,U],y=(j,U)=>[j,0];break;case"middleLeft":S=!0,v=(j,U)=>[0,U/2],y=(j,U)=>[j,U/2];break}const w=v(o,l),C=y(o,l);let x=f(...C);const T=ft._round(i+x[0]),I=ft._round(s+x[1]);let F=1,P=1,R,D;if(t.fromKeyboard)({deltaX:R,deltaY:D}=t);else{const{screenX:j,screenY:U}=t,[z,G]=a(this,jo);[R,D]=this.screenToPageTranslation(j-z,U-G),a(this,jo)[0]=j,a(this,jo)[1]=U}if([R,D]=m(R/n,D/r),E){const j=Math.hypot(o,l);F=P=Math.max(Math.min(Math.hypot(C[0]-w[0]-R,C[1]-w[1]-D)/j,1/o,1/l),u/o,c/l)}else S?F=Qt(Math.abs(C[0]-w[0]-R),u,1)/o:P=Qt(Math.abs(C[1]-w[1]-D),c,1)/l;const k=ft._round(o*F),N=ft._round(l*P);x=f(...y(k,N));const H=T-x[0],X=I-x[1];a(this,Dn)||g(this,Dn,[this.x,this.y,this.width,this.height]),this.width=k,this.height=N,this.x=H,this.y=X,this.setDims(),this.fixAndSetPosition(),this._onResizing()},wA=function(){var e;g(this,zi,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(e=a(this,Jt))==null||e.toggle(!1),this.parent.togglePointerEvents(!1)},xA=function(e,t,n){let i=.7*(n/t)+1-.7;if(i===1)return;const s=A(this,ot,Pg).call(this,this.rotation),o=(T,I)=>[s[0]*T+s[2]*I,s[1]*T+s[3]*I],[l,u]=this.parentDimensions,c=this.x,d=this.y,f=this.width,p=this.height,m=ft.MIN_SIZE/l,v=ft.MIN_SIZE/u;i=Math.max(Math.min(i,1/f,1/p),m/f,v/p);const y=ft._round(f*i),E=ft._round(p*i);if(y===f&&E===p)return;a(this,Dn)||g(this,Dn,[c,d,f,p]);const S=o(f/2,p/2),w=ft._round(c+S[0]),C=ft._round(d+S[1]),x=o(y/2,E/2);this.x=w-x[0],this.y=C-x[1],this.width=y,this.height=E,this.setDims(),this.fixAndSetPosition(),this._onResizing()},SA=function(){var e;(e=a(this,Jt))==null||e.toggle(!0),this.parent.togglePointerEvents(!0),A(this,ot,Ig).call(this)},hy=function(e){const{isMac:t}=be.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)},CA=function(e){const{isSelected:t}=this;this._uiManager.setUpDragSession();let n=!1;const r=new AbortController,i=this._uiManager.combinedSignal(r),s={capture:!0,passive:!1,signal:i},o=u=>{r.abort(),g(this,ga,null),g(this,Uo,!1),this._uiManager.endDragSession()||A(this,ot,hy).call(this,u),n&&this._onStopDragging()};t&&(g(this,qh,e.clientX),g(this,tu,e.clientY),g(this,ga,e.pointerId),g(this,qd,e.pointerType),window.addEventListener("pointermove",u=>{n||(n=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:c,clientY:d,pointerId:f}=u;if(f!==a(this,ga)){ee(u);return}const[p,m]=this.screenToPageTranslation(c-a(this,qh),d-a(this,tu));g(this,qh,c),g(this,tu,d),this._uiManager.dragSelectedEditors(p,m)},s),window.addEventListener("touchmove",ee,s),window.addEventListener("pointerdown",u=>{u.pointerType===a(this,qd)&&(a(this,Ho)||u.isPrimary)&&o(u),ee(u)},s));const l=u=>{if(!a(this,ga)||a(this,ga)===u.pointerId){o(u);return}ee(u)};window.addEventListener("pointerup",l,{signal:i}),window.addEventListener("blur",l,{signal:i})},uy=function(){if(a(this,ma)||!this.div)return;g(this,ma,new AbortController);const e=this._uiManager.combinedSignal(a(this,ma));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})},TA=function(e){ft._resizerKeyboardManager.exec(this,e)},PA=function(e){var t;a(this,Gi)&&((t=e.relatedTarget)==null?void 0:t.parentNode)!==a(this,je)&&A(this,ot,_c).call(this)},IA=function(e){g(this,tf,a(this,Gi)?e:"")},cy=function(e){if(a(this,Cr))for(const t of a(this,Cr))t.tabIndex=e},_c=function(){g(this,Gi,!1),A(this,ot,cy).call(this,-1),A(this,ot,Ig).call(this)},b(ft,rf),M(ft,"_l10n",null),M(ft,"_l10nResizer",null),M(ft,"_borderLineWidth",-1),M(ft,"_colorManager",new qv),M(ft,"_zIndex",1),M(ft,"_telemetryTimeout",1e3);let Gt=ft;class Qx extends Gt{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const Nb=3285377520,qn=4294901760,Gr=65535;class dy{constructor(e){this.h1=e?e&4294967295:Nb,this.h2=e?e&4294967295:Nb}update(e){let t,n;if(typeof e=="string"){t=new Uint8Array(e.length*2),n=0;for(let v=0,y=e.length;v>>8,t[n++]=E&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.");const r=n>>2,i=n-r*4,s=new Uint32Array(t.buffer,0,r);let o=0,l=0,u=this.h1,c=this.h2;const d=3432918353,f=461845907,p=d&Gr,m=f&Gr;for(let v=0;v>>17,o=o*f&qn|o*m&Gr,u^=o,u=u<<13|u>>>19,u=u*5+3864292196):(l=s[v],l=l*d&qn|l*p&Gr,l=l<<15|l>>>17,l=l*f&qn|l*m&Gr,c^=l,c=c<<13|c>>>19,c=c*5+3864292196);switch(o=0,i){case 3:o^=t[r*4+2]<<16;case 2:o^=t[r*4+1]<<8;case 1:o^=t[r*4],o=o*d&qn|o*p&Gr,o=o<<15|o>>>17,o=o*f&qn|o*m&Gr,r&1?u^=o:c^=o}this.h1=u,this.h2=c}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&qn|e*36045&Gr,t=t*4283543511&qn|((t<<16|e>>>16)*2950163797&qn)>>>16,e^=t>>>1,e=e*444984403&qn|e*60499&Gr,t=t*3301882366&qn|((t<<16|e>>>16)*3120437893&qn)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const Td=Object.freeze({map:null,hash:"",transfer:void 0});var Vo,Wo,Xi,Ue,Um,RA;class ob{constructor(){b(this,Um);b(this,Vo,!1);b(this,Wo,null);b(this,Xi,null);b(this,Ue,new Map);M(this,"onSetModified",null);M(this,"onResetModified",null);M(this,"onAnnotationEditor",null)}getValue(e,t){const n=a(this,Ue).get(e);return n===void 0?t:Object.assign(t,n)}getRawValue(e){return a(this,Ue).get(e)}remove(e){var n;const t=a(this,Ue).get(e);t!==void 0&&(t instanceof Gt&&a(this,Xi).delete(t.annotationElementId),a(this,Ue).delete(e),a(this,Ue).size===0&&this.resetModified(),!a(this,Ue).values().some(r=>r instanceof Gt)&&((n=this.onAnnotationEditor)==null||n.call(this,null)))}setValue(e,t){var i;const n=a(this,Ue).get(e);let r=!1;if(n!==void 0)for(const[s,o]of Object.entries(t))n[s]!==o&&(r=!0,n[s]=o);else r=!0,a(this,Ue).set(e,t);r&&A(this,Um,RA).call(this),t instanceof Gt&&((a(this,Xi)||g(this,Xi,new Map)).set(t.annotationElementId,t),(i=this.onAnnotationEditor)==null||i.call(this,t.constructor._type))}has(e){return a(this,Ue).has(e)}get size(){return a(this,Ue).size}resetModified(){var e;a(this,Vo)&&(g(this,Vo,!1),(e=this.onResetModified)==null||e.call(this))}get print(){return new FA(this)}get serializable(){if(a(this,Ue).size===0)return Td;const e=new Map,t=new dy,n=[],r=Object.create(null);let i=!1;for(const[s,o]of a(this,Ue)){const l=o instanceof Gt?o.serialize(!1,r):o;o.page&&(o.pageIndex=o.page._pageIndex,delete o.page),l&&(e.set(s,l),t.update(`${s}:${JSON.stringify(l)}`),i||(i=!!l.bitmap))}if(i)for(const s of e.values())s.bitmap&&n.push(s.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:n}:Td}get editorStats(){let e=null;const t=new Map;let n=0,r=0;for(const i of a(this,Ue).values()){if(!(i instanceof Gt)){i.popup&&(i.popup.deleted?r+=1:n+=1);continue}i.isCommentDeleted?r+=1:i.hasEditedComment&&(n+=1);const s=i.telemetryFinalData;if(!s)continue;const{type:o}=s;t.has(o)||t.set(o,Object.getPrototypeOf(i).constructor),e||(e=Object.create(null));const l=e[o]||(e[o]=new Map);for(const[u,c]of Object.entries(s)){if(u==="type")continue;const d=l.getOrInsertComputed(u,nb);d.set(c,(d.get(c)??0)+1)}}if((r>0||n>0)&&(e||(e=Object.create(null)),e.comments={deleted:r,edited:n}),!e)return null;for(const[i,s]of t)e[i]=s.computeTelemetryFinalData(e[i]);return e}resetModifiedIds(){g(this,Wo,null)}updateEditor(e,t){var r;const n=(r=a(this,Xi))==null?void 0:r.get(e);return n?(n.updateFromAnnotationLayer(t),!0):!1}getEditor(e){var t;return((t=a(this,Xi))==null?void 0:t.get(e))||null}get modifiedIds(){if(a(this,Wo))return a(this,Wo);const e=[];if(a(this,Xi))for(const n of a(this,Xi).values())n.serialize()&&e.push(n.annotationElementId);let t="";if(e.length){const n=new dy;n.update(e.join(",")),t=n.hexdigest()}return g(this,Wo,{ids:new Set(e),hash:t})}[Symbol.iterator](){return a(this,Ue).entries()}}Vo=new WeakMap,Wo=new WeakMap,Xi=new WeakMap,Ue=new WeakMap,Um=new WeakSet,RA=function(){var e;a(this,Vo)||(g(this,Vo,!0),(e=this.onSetModified)==null||e.call(this))};var sf;class FA extends ob{constructor(t){super();b(this,sf,Td);const{serializable:n}=t;if(n===Td)return;const{map:r,hash:i,transfer:s}=n,o=structuredClone(r,s?{transfer:s}:null);g(this,sf,{map:o,hash:i,transfer:[]})}get print(){Ot("Should not call PrintAnnotationStorage.print")}get serializable(){return a(this,sf)}get modifiedIds(){return dt(this,"modifiedIds",{ids:new Set,hash:""})}}sf=new WeakMap;ut(7588);const ph="__forcedDependency",{floor:Bb,ceil:kb}=Math;function jb(h,e,t,n,r,i){h[e*4+0]=Math.min(h[e*4+0],t),h[e*4+1]=Math.min(h[e*4+1],n),h[e*4+2]=Math.max(h[e*4+2],r),h[e*4+3]=Math.max(h[e*4+3],i)}const fy=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];var eu,va;class qx{constructor(e,t){b(this,eu);b(this,va);g(this,eu,e),g(this,va,t)}get length(){return a(this,eu).length}isEmpty(e){return a(this,eu)[e]===fy}minX(e){return a(this,va)[e*4+0]/256}minY(e){return a(this,va)[e*4+1]/256}maxX(e){return(a(this,va)[e*4+2]+1)/256}maxY(e){return(a(this,va)[e*4+3]+1)/256}}eu=new WeakMap,va=new WeakMap;const Ub=(h,e)=>h==null?void 0:h.getOrInsertComputed(e,()=>({dependencies:new Set,isRenderingOperation:!1}));var _i,Dt,_t,zo,Go,Xo,Ze,af,py;class tS{constructor(e,t){b(this,af);b(this,_i,[[1,0,0,1,0,0]]);b(this,Dt,[-1/0,-1/0,1/0,1/0]);b(this,_t,new Float64Array(Ls));M(this,"_pendingBBoxIdx",-1);b(this,zo);b(this,Go);b(this,Xo);b(this,Ze);M(this,"_savesStack",[]);M(this,"_markedContentStack",[]);g(this,zo,e.width),g(this,Go,e.height),A(this,af,py).call(this,t)}growOperationsCount(e){e>=a(this,Ze).length&&A(this,af,py).call(this,e,a(this,Ze))}get clipBox(){return a(this,Dt)}save(e){return g(this,Dt,{__proto__:a(this,Dt)}),this._savesStack.push(e),this}restore(e,t){const n=Object.getPrototypeOf(a(this,Dt));if(n===null)return this;g(this,Dt,n);const r=this._savesStack.pop();return r!==void 0&&(t==null||t(r,e),a(this,Ze)[e]=a(this,Ze)[r]),this}recordOpenMarker(e){return this._savesStack.push(e),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(e,t){const n=this._savesStack.pop();return n!==void 0&&(t==null||t(n,e),a(this,Ze)[e]=a(this,Ze)[n]),this}beginMarkedContent(e){return this._markedContentStack.push(e),this}endMarkedContent(e,t){const n=this._markedContentStack.pop();return n!==void 0&&(t==null||t(n,e),a(this,Ze)[e]=a(this,Ze)[n]),this}pushBaseTransform(e){return a(this,_i).push(_.multiplyByDOMMatrix(a(this,_i).at(-1),e.getTransform())),this}popBaseTransform(){return a(this,_i).length>1&&a(this,_i).pop(),this}resetBBox(e){return this._pendingBBoxIdx!==e&&(this._pendingBBoxIdx=e,a(this,_t).set(Ls,0)),this}recordClipBox(e,t,n,r,i,s){const o=_.multiplyByDOMMatrix(a(this,_i).at(-1),t.getTransform()),l=Ls.slice();_.axialAlignedBoundingBox([n,i,r,s],o,l);const u=_.intersect(a(this,Dt),l);return u?(a(this,Dt)[0]=u[0],a(this,Dt)[1]=u[1],a(this,Dt)[2]=u[2],a(this,Dt)[3]=u[3]):(a(this,Dt)[0]=a(this,Dt)[1]=1/0,a(this,Dt)[2]=a(this,Dt)[3]=-1/0),this}recordBBox(e,t,n,r,i,s){const o=a(this,Dt);if(o[0]===1/0)return this;const l=_.multiplyByDOMMatrix(a(this,_i).at(-1),t.getTransform());if(o[0]===-1/0)return _.axialAlignedBoundingBox([n,i,r,s],l,a(this,_t)),this;const u=Ls.slice();return _.axialAlignedBoundingBox([n,i,r,s],l,u),a(this,_t)[0]=Qt(u[0],o[0],a(this,_t)[0]),a(this,_t)[1]=Qt(u[1],o[1],a(this,_t)[1]),a(this,_t)[2]=Qt(u[2],a(this,_t)[2],o[2]),a(this,_t)[3]=Qt(u[3],a(this,_t)[3],o[3]),this}recordFullPageBBox(e){return a(this,_t)[0]=Math.max(0,a(this,Dt)[0]),a(this,_t)[1]=Math.max(0,a(this,Dt)[1]),a(this,_t)[2]=Math.min(a(this,zo),a(this,Dt)[2]),a(this,_t)[3]=Math.min(a(this,Go),a(this,Dt)[3]),this}recordOperation(e,t=!1,n){if(this._pendingBBoxIdx!==e)return this;const r=Bb(a(this,_t)[0]*256/a(this,zo)),i=Bb(a(this,_t)[1]*256/a(this,Go)),s=kb(a(this,_t)[2]*256/a(this,zo)),o=kb(a(this,_t)[3]*256/a(this,Go));if(jb(a(this,Xo),e,r,i,s,o),n)for(const l of n)for(const u of l)u!==e&&jb(a(this,Xo),u,r,i,s,o);return t||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(e){return this._pendingBBoxIdx===e&&(this._pendingBBoxIdx=-1,a(this,Dt)[0]=Math.max(a(this,Dt)[0],a(this,_t)[0]),a(this,Dt)[1]=Math.max(a(this,Dt)[1],a(this,_t)[1]),a(this,Dt)[2]=Math.min(a(this,Dt)[2],a(this,_t)[2]),a(this,Dt)[3]=Math.min(a(this,Dt)[3],a(this,_t)[3])),this}take(){return new qx(a(this,Ze),a(this,Xo))}takeDebugMetadata(){throw new Error("Unreachable")}recordSimpleData(e,t){return this}recordIncrementalData(e,t){return this}resetIncrementalData(e,t){return this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return this}recordFutureForcedDependency(e,t){return this}inheritSimpleDataAsFutureForcedDependencies(e){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(e,t,n,r=1,i=0,s=0,o){return this}getSimpleIndex(e){}recordDependencies(e,t){return this}recordNamedDependency(e,t){return this}recordShowTextOperation(e,t=!1){return this}}_i=new WeakMap,Dt=new WeakMap,_t=new WeakMap,zo=new WeakMap,Go=new WeakMap,Xo=new WeakMap,Ze=new WeakMap,af=new WeakSet,py=function(e,t){const n=new ArrayBuffer(e*4);g(this,Xo,new Uint8ClampedArray(n)),g(this,Ze,new Uint32Array(n)),t&&t.length>0?(a(this,Ze).set(t),a(this,Ze).fill(fy,t.length)):a(this,Ze).fill(fy)};var bn,An,_o,Tr,nu,ya,ba,jt;class eS{constructor(e,t=!1){b(this,bn,{__proto__:null});b(this,An,{__proto__:null,transform:[],moveText:[],sameLineText:[],[ph]:[]});b(this,_o,new Map);b(this,Tr,new Set);b(this,nu,new Map);b(this,ya);b(this,ba);b(this,jt);g(this,jt,e),t&&(g(this,ya,new Map),g(this,ba,(n,r)=>{Ub(a(this,ya),r).dependencies.add(n)}))}get clipBox(){return a(this,jt).clipBox}growOperationsCount(e){a(this,jt).growOperationsCount(e)}save(e){return g(this,bn,{__proto__:a(this,bn)}),g(this,An,{__proto__:a(this,An),transform:{__proto__:a(this,An).transform},moveText:{__proto__:a(this,An).moveText},sameLineText:{__proto__:a(this,An).sameLineText},[ph]:{__proto__:a(this,An)[ph]}}),a(this,jt).save(e),this}restore(e){a(this,jt).restore(e,a(this,ba));const t=Object.getPrototypeOf(a(this,bn));return t===null?this:(g(this,bn,t),g(this,An,Object.getPrototypeOf(a(this,An))),this)}recordOpenMarker(e){return a(this,jt).recordOpenMarker(e,a(this,ba)),this}getOpenMarker(){return a(this,jt).getOpenMarker()}recordCloseMarker(e){return a(this,jt).recordCloseMarker(e,a(this,ba)),this}beginMarkedContent(e){return a(this,jt).beginMarkedContent(e),this}endMarkedContent(e){return a(this,jt).endMarkedContent(e,a(this,ba)),this}pushBaseTransform(e){return a(this,jt).pushBaseTransform(e),this}popBaseTransform(){return a(this,jt).popBaseTransform(),this}recordSimpleData(e,t){return a(this,bn)[e]=t,this}recordIncrementalData(e,t){return a(this,An)[e].push(t),this}resetIncrementalData(e,t){return a(this,An)[e].length=0,this}recordNamedData(e,t){return a(this,_o).set(e,t),this}recordSimpleDataFromNamed(e,t,n){a(this,bn)[e]=a(this,_o).get(t)??n}recordFutureForcedDependency(e,t){return this.recordIncrementalData(ph,t),this}inheritSimpleDataAsFutureForcedDependencies(e){for(const t of e)t in a(this,bn)&&this.recordFutureForcedDependency(t,a(this,bn)[t]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const e of a(this,Tr))this.recordFutureForcedDependency(ph,e);return this}resetBBox(e){return a(this,jt).resetBBox(e),this}recordClipBox(e,t,n,r,i,s){return a(this,jt).recordClipBox(e,t,n,r,i,s),this}recordBBox(e,t,n,r,i,s){return a(this,jt).recordBBox(e,t,n,r,i,s),this}recordCharacterBBox(e,t,n,r=1,i=0,s=0,o){const l=n.bbox;let u,c;if(l&&(u=l[2]!==l[0]&&l[3]!==l[1]&&a(this,nu).get(n),u!==!1&&(c=[0,0,0,0],_.axialAlignedBoundingBox(l,n.fontMatrix,c),(r!==1||i!==0||s!==0)&&_.scaleMinMax([r,0,0,-r,i,s],c),u)))return this.recordBBox(e,t,c[0],c[2],c[1],c[3]);if(!o)return this.recordFullPageBBox(e);const d=o();return l&&c&&u===void 0&&(u=c[0]<=i-d.actualBoundingBoxLeft&&c[2]>=i+d.actualBoundingBoxRight&&c[1]<=s-d.actualBoundingBoxAscent&&c[3]>=s+d.actualBoundingBoxDescent,a(this,nu).set(n,u),u)?this.recordBBox(e,t,c[0],c[2],c[1],c[3]):this.recordBBox(e,t,i-d.actualBoundingBoxLeft,i+d.actualBoundingBoxRight,s-d.actualBoundingBoxAscent,s+d.actualBoundingBoxDescent)}recordFullPageBBox(e){return a(this,jt).recordFullPageBBox(e),this}getSimpleIndex(e){return a(this,bn)[e]}recordDependencies(e,t){const n=a(this,Tr),r=a(this,bn),i=a(this,An);for(const s of t)s in a(this,bn)?n.add(r[s]):s in i&&i[s].forEach(n.add,n);return this}recordNamedDependency(e,t){return a(this,_o).has(t)&&a(this,Tr).add(a(this,_o).get(t)),this}recordOperation(e,t=!1){if(this.recordDependencies(e,[ph]),a(this,ya)){const r=Ub(a(this,ya),e),{dependencies:i}=r;a(this,Tr).forEach(i.add,i),a(this,jt)._savesStack.forEach(i.add,i),a(this,jt)._markedContentStack.forEach(i.add,i),i.delete(e),r.isRenderingOperation=!0}const n=!t&&e===a(this,jt)._pendingBBoxIdx;return a(this,jt).recordOperation(e,t,[a(this,Tr),a(this,jt)._savesStack,a(this,jt)._markedContentStack]),n&&a(this,Tr).clear(),this}recordShowTextOperation(e,t=!1){const n=Array.from(a(this,Tr));this.recordOperation(e,t),this.recordIncrementalData("sameLineText",e);for(const r of n)this.recordIncrementalData("sameLineText",r);return this}bboxToClipBoxDropOperation(e,t=!1){const n=!t&&e===a(this,jt)._pendingBBoxIdx;return a(this,jt).bboxToClipBoxDropOperation(e),n&&a(this,Tr).clear(),this}take(){return a(this,nu).clear(),a(this,jt).take()}takeDebugMetadata(){return a(this,ya)}}bn=new WeakMap,An=new WeakMap,_o=new WeakMap,Tr=new WeakMap,nu=new WeakMap,ya=new WeakMap,ba=new WeakMap,jt=new WeakMap;var Ut,ae,Pr,ru,iu;const yb=class yb{constructor(e,t,n){b(this,Ut);b(this,ae);b(this,Pr);b(this,ru,0);b(this,iu,0);if(e instanceof yb&&a(e,Pr)===!!n)return e;g(this,Ut,e),g(this,ae,t),g(this,Pr,!!n)}get clipBox(){return a(this,Ut).clipBox}growOperationsCount(){throw new Error("Unreachable")}save(e){return ie(this,iu)._++,a(this,Ut).save(a(this,ae)),this}restore(e){return a(this,iu)>0&&(a(this,Ut).restore(a(this,ae)),ie(this,iu)._--),this}recordOpenMarker(e){return ie(this,ru)._++,this}getOpenMarker(){return a(this,ru)>0?a(this,ae):a(this,Ut).getOpenMarker()}recordCloseMarker(e){return ie(this,ru)._--,this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return a(this,Ut).pushBaseTransform(e),this}popBaseTransform(){return a(this,Ut).popBaseTransform(),this}recordSimpleData(e,t){return a(this,Ut).recordSimpleData(e,a(this,ae)),this}recordIncrementalData(e,t){return a(this,Ut).recordIncrementalData(e,a(this,ae)),this}resetIncrementalData(e,t){return a(this,Ut).resetIncrementalData(e,a(this,ae)),this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return a(this,Ut).recordSimpleDataFromNamed(e,t,a(this,ae)),this}recordFutureForcedDependency(e,t){return a(this,Ut).recordFutureForcedDependency(e,a(this,ae)),this}inheritSimpleDataAsFutureForcedDependencies(e){return a(this,Ut).inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return a(this,Ut).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){return a(this,Pr)||a(this,Ut).resetBBox(a(this,ae)),this}recordClipBox(e,t,n,r,i,s){return a(this,Pr)||a(this,Ut).recordClipBox(a(this,ae),t,n,r,i,s),this}recordBBox(e,t,n,r,i,s){return a(this,Pr)||a(this,Ut).recordBBox(a(this,ae),t,n,r,i,s),this}recordCharacterBBox(e,t,n,r,i,s,o){return a(this,Pr)||a(this,Ut).recordCharacterBBox(a(this,ae),t,n,r,i,s,o),this}recordFullPageBBox(e){return a(this,Pr)||a(this,Ut).recordFullPageBBox(a(this,ae)),this}getSimpleIndex(e){return a(this,Ut).getSimpleIndex(e)}recordDependencies(e,t){return a(this,Ut).recordDependencies(a(this,ae),t),this}recordNamedDependency(e,t){return a(this,Ut).recordNamedDependency(a(this,ae),t),this}recordOperation(e){return a(this,Ut).recordOperation(a(this,ae),!0),this}recordShowTextOperation(e){return a(this,Ut).recordShowTextOperation(a(this,ae),!0),this}bboxToClipBoxDropOperation(e){return a(this,Pr)||a(this,Ut).bboxToClipBoxDropOperation(a(this,ae),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};Ut=new WeakMap,ae=new WeakMap,Pr=new WeakMap,ru=new WeakMap,iu=new WeakMap;let Pd=yb;const tr={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"]};var Yo,Ko,Jo,Zo,Qo,of;const Ed=class Ed{constructor(e){b(this,Yo);b(this,Ko);b(this,Jo,4);b(this,Zo,0);b(this,Qo,new(a(Ed,of))(a(this,Jo)*6));g(this,Yo,e.width),g(this,Ko,e.height)}record(e,t,n,r){if(a(this,Zo)===a(this,Jo)){g(this,Jo,a(this,Jo)*2);const o=new(a(Ed,of))(a(this,Jo)*6);o.set(a(this,Qo)),g(this,Qo,o)}const i=_.domMatrixToTransform(e.getTransform());let s;if(r[0]!==1/0){const o=Ls.slice();_.axialAlignedBoundingBox([0,-n,t,0],i,o);const l=_.intersect(r,o);if(!l)return;const[u,c,d,f]=l;if(u!==o[0]||c!==o[1]||d!==o[2]||f!==o[3]){const p=Math.atan2(i[1],i[0]),m=Math.abs(Math.sin(p)),v=Math.abs(Math.cos(p));if(m<1e-6||v<1e-6||Math.abs(m-v)<1e-6)s=[u,c,u,f,d,c];else{const y=d-u,E=f-c,S=m*m,w=v*v,C=v*m,x=w-S,T=(E*w-y*C)/x,I=(E*C-y*S)/x;s=[u+I,c,u,c+T,d,f-T]}}}s||(s=[0,-n,0,0,t,-n],_.applyTransform(s,i,0),_.applyTransform(s,i,2),_.applyTransform(s,i,4)),s[0]/=a(this,Yo),s[1]/=a(this,Ko),s[2]/=a(this,Yo),s[3]/=a(this,Ko),s[4]/=a(this,Yo),s[5]/=a(this,Ko),a(this,Qo).set(s,a(this,Zo)*6),ie(this,Zo)._++}take(){return a(this,Qo).subarray(0,a(this,Zo)*6)}};Yo=new WeakMap,Ko=new WeakMap,Jo=new WeakMap,Zo=new WeakMap,Qo=new WeakMap,of=new WeakMap,b(Ed,of,be.isFloat16ArraySupported?Float16Array:Float32Array);let gy=Ed;var su;class nS{constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){b(this,su,new Set);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));const t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),a(this,su).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:t,_inspectFont:n}){if(!(!e||a(this,su).has(e.loadedName))){if(ne(!t,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:r,src:i,style:s}=e,o=new FontFace(r,i,s);this.addNativeFontFace(o);try{await o.load(),a(this,su).add(r),n==null||n(e)}catch{ht(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}Ot("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){const n=e.createNativeFontFace();if(n){this.addNativeFontFace(n);try{await n.loaded}catch(r){throw ht(`Failed to load font '${n.family}': '${r}'.`),e.disableFontFace=!0,r}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(n=>{const r=this._queueLoadingCallback(n);this._prepareFontLoadEvent(e,r)})}}get isFontLoadingAPISupported(){var t;const e=!!((t=this._document)!=null&&t.fonts);return dt(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return dt(this,"isSyncFontLoadingSupported",_n||be.platform.isFirefox)}_queueLoadingCallback(e){function t(){for(ne(!r.done,"completeRequest() cannot be called twice."),r.done=!0;n.length>0&&n[0].done;){const i=n.shift();setTimeout(i.callback,0)}}const{loadingRequests:n}=this,r={done:!1,complete:t,callback:e};return n.push(r),r}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return dt(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,t){function n(x,T){return x.charCodeAt(T)<<24|x.charCodeAt(T+1)<<16|x.charCodeAt(T+2)<<8|x.charCodeAt(T+3)&255}function r(x){return String.fromCharCode(x>>24&255,x>>16&255,x>>8&255,x&255)}function i(x,T,I,F){const P=x.substring(0,T),R=x.substring(T+I);return P+F+R}let s,o;const l=this._document.createElement("canvas");l.width=1,l.height=1;const u=l.getContext("2d");let c=0;function d(x,T){if(++c>30){ht("Load test font never loaded."),T();return}if(u.font="30px "+x,u.fillText(".",0,20),u.getImageData(0,0,1,1).data[3]>0){T();return}setTimeout(d.bind(null,x,T))}const f=`lt${Date.now()}${this.loadTestFontId++}`;let p=this._loadTestFont;p=i(p,976,f.length,f);const v=16,y=1482184792;let E=n(p,v);for(s=0,o=f.length-3;s{C.remove(),t.complete()})}}su=new WeakMap;var $t;class rS{constructor(e,t=null,n,r){M(this,"compiledGlyphs",Object.create(null));b(this,$t);g(this,$t,e),this._inspectFont=t,n&&(this.charProcOperatorList=n),r&&Object.assign(this,r)}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const n={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(n.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,n)}return(t=this._inspectFont)==null||t.call(this,this),e}createFontFaceRule(){var n;if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${this.data.toBase64()});`;let t;if(!this.cssFontInfo)t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let r=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(r+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${r}src:${e}}`}return(n=this._inspectFont)==null||n.call(this,this,e),t}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];const n=this.loadedName+"_path_"+t;let r;try{r=e.get(n)}catch(s){ht(`getPathGenerator - ignoring character: "${s}".`)}const i=K1(r==null?void 0:r.path);return this.fontExtraProperties||e.delete(n),this.compiledGlyphs[t]=i}get black(){return a(this,$t).black}get bold(){return a(this,$t).bold}get disableFontFace(){return a(this,$t).disableFontFace}set disableFontFace(e){dt(this,"disableFontFace",!!e)}get fontExtraProperties(){return a(this,$t).fontExtraProperties}get isInvalidPDFjsFont(){return a(this,$t).isInvalidPDFjsFont}get isType3Font(){return a(this,$t).isType3Font}get italic(){return a(this,$t).italic}get missingFile(){return a(this,$t).missingFile}get remeasure(){return a(this,$t).remeasure}get vertical(){return a(this,$t).vertical}get ascent(){return a(this,$t).ascent}get defaultWidth(){return a(this,$t).defaultWidth}get descent(){return a(this,$t).descent}get bbox(){return a(this,$t).bbox}get fontMatrix(){return a(this,$t).fontMatrix}get fallbackName(){return a(this,$t).fallbackName}get loadedName(){return a(this,$t).loadedName}get mimetype(){return a(this,$t).mimetype}get name(){return a(this,$t).name}get data(){return a(this,$t).data}clearData(){a(this,$t).clearData()}get cssFontInfo(){return a(this,$t).cssFontInfo}get systemFontInfo(){return a(this,$t).systemFontInfo}get defaultVMetrics(){return a(this,$t).defaultVMetrics}}$t=new WeakMap;class DA{}M(DA,"strings",["fontFamily","fontWeight","italicAngle"]);class OA{}M(OA,"strings",["css","loadedName","baseFontName","src"]);const Ye=class Ye{};M(Ye,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),M(Ye,"numbers",["ascent","defaultWidth","descent"]),M(Ye,"strings",["fallbackName","loadedName","mimetype","name"]),M(Ye,"OFFSET_NUMBERS",Math.ceil(Ye.bools.length*2/8)),M(Ye,"OFFSET_BBOX",Ye.OFFSET_NUMBERS+Ye.numbers.length*8),M(Ye,"OFFSET_FONT_MATRIX",Ye.OFFSET_BBOX+1+2*4),M(Ye,"OFFSET_DEFAULT_VMETRICS",Ye.OFFSET_FONT_MATRIX+1+8*6),M(Ye,"OFFSET_STRINGS",Ye.OFFSET_DEFAULT_VMETRICS+1+2*3);let Pn=Ye;class fn{}M(fn,"KIND",0),M(fn,"HAS_BBOX",1),M(fn,"HAS_BACKGROUND",2),M(fn,"SHADING_TYPE",3),M(fn,"N_COORD",4),M(fn,"N_COLOR",8),M(fn,"N_STOP",12),M(fn,"N_FIGURES",16);var lf,$m,au,ou,Rg;class iS{constructor(e){b(this,ou);b(this,lf);b(this,$m,new TextDecoder);b(this,au);g(this,lf,e),g(this,au,new DataView(e))}get fontFamily(){return A(this,ou,Rg).call(this,0)}get fontWeight(){return A(this,ou,Rg).call(this,1)}get italicAngle(){return A(this,ou,Rg).call(this,2)}}lf=new WeakMap,$m=new WeakMap,au=new WeakMap,ou=new WeakSet,Rg=function(e){ne(e>n&3;return r===0?void 0:r===2},Fg=function(e){return ne(e0){v=Ls.slice();for(let y=0,E=u.length;ytypeof h=="object"&&Number.isInteger(h==null?void 0:h.num)&&h.num>=0&&Number.isInteger(h==null?void 0:h.gen)&&h.gen>=0,cS=h=>typeof h=="object"&&typeof(h==null?void 0:h.name)=="string",dS=Ux.bind(null,vy,cS);var Yi,Vm;class fS{constructor(){b(this,Yi,new Map);b(this,Vm,Promise.resolve())}postMessage(e,t){const n={data:structuredClone(e,t?{transfer:t}:null)};a(this,Vm).then(()=>{for(const[r]of a(this,Yi))r.call(this,n)})}addEventListener(e,t,n=null){let r=null;if((n==null?void 0:n.signal)instanceof AbortSignal){const{signal:i}=n;if(i.aborted){ht("LoopbackPort - cannot use an `aborted` signal.");return}const s=()=>this.removeEventListener(e,t);r=()=>i.removeEventListener("abort",s),i.addEventListener("abort",s)}a(this,Yi).set(t,r)}removeEventListener(e,t){const n=a(this,Yi).get(t);n==null||n(),a(this,Yi).delete(t)}terminate(){for(const[,e]of a(this,Yi))e==null||e();a(this,Yi).clear()}}Yi=new WeakMap,Vm=new WeakMap;ut(1689);const ug={DATA:1,ERROR:2},pe={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function $b(){}function mn(h){if(h instanceof ho||h instanceof Wv||h instanceof Ib||h instanceof Em||h instanceof Tv)return h;switch(h instanceof Error||typeof h=="object"&&h!==null||Ot('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),h.name){case"AbortException":return new ho(h.message);case"InvalidPDFException":return new Wv(h.message);case"PasswordException":return new Ib(h.message,h.code);case"ResponseException":return new Em(h.message,h.status,h.missing);case"UnknownErrorException":return new Tv(h.message,h.details)}return new Tv(h.message,h.toString())}var uu,Ar,MA,LA,NA,Og;class Jc{constructor(e,t,n){b(this,Ar);b(this,uu,new AbortController);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",A(this,Ar,MA).bind(this),{signal:a(this,uu).signal})}on(e,t){const 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){const r=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[r]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:r,data:t},n)}catch(s){i.reject(s)}return i.promise}sendWithStream(e,t,n,r){const i=this.streamId++,s=this.sourceName,o=this.targetName,l=this.comObj;return new ReadableStream({start:u=>{const c=Promise.withResolvers();return this.streamControllers[i]={controller:u,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:s,targetName:o,action:e,streamId:i,data:t,desiredSize:u.desiredSize},r),c.promise},pull:u=>{const c=Promise.withResolvers();return this.streamControllers[i].pullCall=c,l.postMessage({sourceName:s,targetName:o,stream:pe.PULL,streamId:i,desiredSize:u.desiredSize}),c.promise},cancel:u=>{ne(u instanceof Error,"cancel must have a valid reason");const c=Promise.withResolvers();return this.streamControllers[i].cancelCall=c,this.streamControllers[i].isClosed=!0,l.postMessage({sourceName:s,targetName:o,stream:pe.CANCEL,streamId:i,reason:mn(u)}),c.promise}},n)}destroy(){var e;(e=a(this,uu))==null||e.abort(),g(this,uu,null)}}uu=new WeakMap,Ar=new WeakSet,MA=function({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){A(this,Ar,NA).call(this,e);return}if(e.callback){const n=e.callbackId,r=this.callbackCapabilities[n];if(!r)throw new Error(`Cannot resolve callback ${n}`);if(delete this.callbackCapabilities[n],e.callback===ug.DATA)r.resolve(e.data);else if(e.callback===ug.ERROR)r.reject(mn(e.reason));else throw new Error("Unexpected callback case");return}const t=this.actionHandler[e.action];if(!t)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const n=this.sourceName,r=e.sourceName,i=this.comObj;Promise.try(t,e.data).then(function(s){i.postMessage({sourceName:n,targetName:r,callback:ug.DATA,callbackId:e.callbackId,data:s})},function(s){i.postMessage({sourceName:n,targetName:r,callback:ug.ERROR,callbackId:e.callbackId,reason:mn(s)})});return}if(e.streamId){A(this,Ar,LA).call(this,e);return}t(e.data)},LA=function(e){const t=e.streamId,n=this.sourceName,r=e.sourceName,i=this.comObj,s=this,o=this.actionHandler[e.action],l={enqueue(u,c=1,d){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=c,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:n,targetName:r,stream:pe.ENQUEUE,streamId:t,chunk:u},d)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:pe.CLOSE,streamId:t}),delete s.streamSinks[t])},error(u){ne(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:pe.ERROR,streamId:t,reason:mn(u)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[t]=l,Promise.try(o,e.data,l).then(function(){i.postMessage({sourceName:n,targetName:r,stream:pe.START_COMPLETE,streamId:t,success:!0})},function(u){i.postMessage({sourceName:n,targetName:r,stream:pe.START_COMPLETE,streamId:t,reason:mn(u)})})},NA=function(e){const t=e.streamId,n=this.sourceName,r=e.sourceName,i=this.comObj,s=this.streamControllers[t],o=this.streamSinks[t];switch(e.stream){case pe.START_COMPLETE:e.success?s.startCall.resolve():s.startCall.reject(mn(e.reason));break;case pe.PULL_COMPLETE:e.success?s.pullCall.resolve():s.pullCall.reject(mn(e.reason));break;case pe.PULL:if(!o){i.postMessage({sourceName:n,targetName:r,stream:pe.PULL_COMPLETE,streamId:t,success:!0});break}o.desiredSize<=0&&e.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=e.desiredSize,Promise.try(o.onPull||$b).then(function(){i.postMessage({sourceName:n,targetName:r,stream:pe.PULL_COMPLETE,streamId:t,success:!0})},function(u){i.postMessage({sourceName:n,targetName:r,stream:pe.PULL_COMPLETE,streamId:t,reason:mn(u)})});break;case pe.ENQUEUE:if(ne(s,"enqueue should have stream controller"),s.isClosed)break;s.controller.enqueue(e.chunk);break;case pe.CLOSE:if(ne(s,"close should have stream controller"),s.isClosed)break;s.isClosed=!0,s.controller.close(),A(this,Ar,Og).call(this,s,t);break;case pe.ERROR:ne(s,"error should have stream controller"),s.controller.error(mn(e.reason)),A(this,Ar,Og).call(this,s,t);break;case pe.CANCEL_COMPLETE:e.success?s.cancelCall.resolve():s.cancelCall.reject(mn(e.reason)),A(this,Ar,Og).call(this,s,t);break;case pe.CANCEL:if(!o)break;const l=mn(e.reason);Promise.try(o.onCancel||$b,l).then(function(){i.postMessage({sourceName:n,targetName:r,stream:pe.CANCEL_COMPLETE,streamId:t,success:!0})},function(u){i.postMessage({sourceName:n,targetName:r,stream:pe.CANCEL_COMPLETE,streamId:t,reason:mn(u)})}),o.sinkCapability.reject(l),o.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}},Og=async function(e,t){var n,r,i;await Promise.allSettled([(n=e.startCall)==null?void 0:n.promise,(r=e.pullCall)==null?void 0:r.promise,(i=e.cancelCall)==null?void 0:i.promise]),delete this.streamControllers[t]};var Wm;class BA{constructor({cMapUrl:e=null,standardFontDataUrl:t=null,wasmUrl:n=null}){b(this,Wm,Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"}));this.cMapUrl=e,this.standardFontDataUrl=t,this.wasmUrl=n}async fetch({kind:e,filename:t}){switch(e){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:Ot(`Not implemented: ${e}`)}const n=this[e];if(!n)throw new Error(`Ensure that the \`${e}\` API parameter is provided.`);const r=`${n}${t}`;return this._fetch(r,e).catch(i=>{throw new Error(`Unable to load ${a(this,Wm)[e]} data at: ${r}`)})}async _fetch(e,t){Ot("Abstract method `_fetch` called.")}}Wm=new WeakMap;class Hb extends BA{async _fetch(e,t){const n=t==="cMapUrl"&&!e.endsWith(".bcmap")?"text":"bytes",r=await rb(e,n);return r instanceof Uint8Array?r:dv(r)}}var hf;class kA{constructor({enableHWA:e=!1}){b(this,hf,!1);g(this,hf,e)}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const n=this._createCanvas(e,t);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!a(this,hf)})}}reset({canvas:e},t,n){if(!e)throw new Error("Canvas is not specified");if(t<=0||n<=0)throw new Error("Invalid canvas size");e.width=t,e.height=n}destroy(e){const{canvas:t}=e;if(!t)throw new Error("Canvas is not specified");t.width=t.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){Ot("Abstract method `_createCanvas` called.")}}hf=new WeakMap;class pS extends kA{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){const n=this._document.createElement("canvas");return n.width=e,n.height=t,n}}ut(2489);class jA{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,n,r,i){return"none"}destroy(e=!1){}}var el,cu,Ki,Ji,Qe,nl,rl,Q,_e,Zc,yh,Mg,bh,UA,yy,Ah,Qc,qc,by,td;class gS extends jA{constructor({docId:t,ownerDocument:n=globalThis.document}){super();b(this,Q);b(this,el);b(this,cu);b(this,Ki);b(this,Ji);b(this,Qe);b(this,nl);b(this,rl,0);g(this,Ji,t),g(this,Qe,n)}addFilter(t){if(!t)return"none";let n=a(this,Q,_e).get(t);if(n)return n;const[r,i,s]=A(this,Q,Mg).call(this,t),o=t.length===1?r:`${r}${i}${s}`;if(n=a(this,Q,_e).get(o),n)return a(this,Q,_e).set(t,n),n;const l=`g_${a(this,Ji)}_transfer_map_${ie(this,rl)._++}`,u=A(this,Q,bh).call(this,l);a(this,Q,_e).set(t,u),a(this,Q,_e).set(o,u);const c=A(this,Q,Ah).call(this,l);return A(this,Q,qc).call(this,r,i,s,c),u}addHCMFilter(t,n){var m;const r=`${t}-${n}`,i="base";let s=a(this,Q,Zc).get(i);if((s==null?void 0:s.key)===r||(s?((m=s.filter)==null||m.remove(),s.key=r,s.url="none",s.filter=null):(s={key:r,url:"none",filter:null},a(this,Q,Zc).set(i,s)),!t||!n))return s.url;const o=A(this,Q,td).call(this,t);t=_.makeHexColor(...o);const l=A(this,Q,td).call(this,n);if(n=_.makeHexColor(...l),a(this,Q,yh).style.color="",t==="#000000"&&n==="#ffffff"||t===n)return s.url;const u=new Array(256);for(let v=0;v<=255;v++){const y=v/255;u[v]=y<=.03928?y/12.92:((y+.055)/1.055)**2.4}const c=u.join(","),d=`g_${a(this,Ji)}_hcm_filter`,f=s.filter=A(this,Q,Ah).call(this,d);A(this,Q,qc).call(this,c,c,c,f),A(this,Q,yy).call(this,f);const p=(v,y)=>{const E=o[v]/255,S=l[v]/255,w=new Array(y+1);for(let C=0;C<=y;C++)w[C]=E+C/y*(S-E);return w.join(",")};return A(this,Q,qc).call(this,p(0,5),p(1,5),p(2,5),f),s.url=A(this,Q,bh).call(this,d),s.url}addAlphaFilter(t){let n=a(this,Q,_e).get(t);if(n)return n;const[r]=A(this,Q,Mg).call(this,[t]),i=`alpha_${r}`;if(n=a(this,Q,_e).get(i),n)return a(this,Q,_e).set(t,n),n;const s=`g_${a(this,Ji)}_alpha_map_${ie(this,rl)._++}`,o=A(this,Q,bh).call(this,s);a(this,Q,_e).set(t,o),a(this,Q,_e).set(i,o);const l=A(this,Q,Ah).call(this,s);return A(this,Q,by).call(this,r,l),o}addLuminosityFilter(t){let n=a(this,Q,_e).get(t||"luminosity");if(n)return n;let r,i;if(t?([r]=A(this,Q,Mg).call(this,[t]),i=`luminosity_${r}`):i="luminosity",n=a(this,Q,_e).get(i),n)return a(this,Q,_e).set(t,n),n;const s=`g_${a(this,Ji)}_luminosity_map_${ie(this,rl)._++}`,o=A(this,Q,bh).call(this,s);a(this,Q,_e).set(t,o),a(this,Q,_e).set(i,o);const l=A(this,Q,Ah).call(this,s);return A(this,Q,UA).call(this,l),t&&A(this,Q,by).call(this,r,l),o}addHighlightHCMFilter(t,n,r,i,s){var S;const o=`${n}-${r}-${i}-${s}`;let l=a(this,Q,Zc).get(t);if((l==null?void 0:l.key)===o||(l?((S=l.filter)==null||S.remove(),l.key=o,l.url="none",l.filter=null):(l={key:o,url:"none",filter:null},a(this,Q,Zc).set(t,l)),!n||!r))return l.url;const[u,c]=[n,r].map(A(this,Q,td).bind(this));let d=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),f=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[p,m]=[i,s].map(A(this,Q,td).bind(this));f{const T=new Array(256),I=(f-d)/x,F=w/255,P=(C-w)/(255*x);let R=0;for(let D=0;D<=x;D++){const k=Math.round(d+D*I),N=F+D*P;for(let H=R;H<=k;H++)T[H]=N;R=k+1}for(let D=R;D<256;D++)T[D]=T[R-1];return T.join(",")},y=`g_${a(this,Ji)}_hcm_${t}_filter`,E=l.filter=A(this,Q,Ah).call(this,y);return A(this,Q,yy).call(this,E),A(this,Q,qc).call(this,v(p[0],m[0],5),v(p[1],m[1],5),v(p[2],m[2],5),E),l.url=A(this,Q,bh).call(this,y),l.url}destroy(t=!1){var n,r,i,s;t&&((n=a(this,nl))!=null&&n.size)||((r=a(this,Ki))==null||r.parentNode.parentNode.remove(),g(this,Ki,null),(i=a(this,cu))==null||i.clear(),g(this,cu,null),(s=a(this,nl))==null||s.clear(),g(this,nl,null),g(this,rl,0))}}el=new WeakMap,cu=new WeakMap,Ki=new WeakMap,Ji=new WeakMap,Qe=new WeakMap,nl=new WeakMap,rl=new WeakMap,Q=new WeakSet,_e=function(){return a(this,cu)||g(this,cu,new Map)},Zc=function(){return a(this,nl)||g(this,nl,new Map)},yh=function(){if(!a(this,Ki)){const t=a(this,Qe).createElement("div"),{style:n}=t;n.visibility="hidden",n.contain="strict",n.width=n.height=0,n.position="absolute",n.top=n.left=0,n.zIndex=-1;const r=a(this,Qe).createElementNS(Pi,"svg");r.setAttribute("width",0),r.setAttribute("height",0),g(this,Ki,a(this,Qe).createElementNS(Pi,"defs")),t.append(r),r.append(a(this,Ki)),a(this,Qe).body.append(t)}return a(this,Ki)},Mg=function(t){if(t.length===1){const u=t[0],c=new Array(256);for(let f=0;f<256;f++)c[f]=u[f]/255;const d=c.join(",");return[d,d,d]}const[n,r,i]=t,s=new Array(256),o=new Array(256),l=new Array(256);for(let u=0;u<256;u++)s[u]=n[u]/255,o[u]=r[u]/255,l[u]=i[u]/255;return[s.join(","),o.join(","),l.join(",")]},bh=function(t){if(a(this,el)===void 0){g(this,el,"");const n=a(this,Qe).URL;n!==a(this,Qe).baseURI&&(fv(n)?ht('#createUrl: ignore "data:"-URL for performance reasons.'):g(this,el,G1(n,"")))}return`url(${a(this,el)}#${t})`},UA=function(t){const n=a(this,Qe).createElementNS(Pi,"feColorMatrix");n.setAttribute("type","matrix"),n.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"),t.append(n)},yy=function(t){const n=a(this,Qe).createElementNS(Pi,"feColorMatrix");n.setAttribute("type","matrix"),n.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"),t.append(n)},Ah=function(t){const n=a(this,Qe).createElementNS(Pi,"filter");return n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("id",t),a(this,Q,yh).append(n),n},Qc=function(t,n,r){const i=a(this,Qe).createElementNS(Pi,n);i.setAttribute("type","discrete"),i.setAttribute("tableValues",r),t.append(i)},qc=function(t,n,r,i){const s=a(this,Qe).createElementNS(Pi,"feComponentTransfer");i.append(s),A(this,Q,Qc).call(this,s,"feFuncR",t),A(this,Q,Qc).call(this,s,"feFuncG",n),A(this,Q,Qc).call(this,s,"feFuncB",r)},by=function(t,n){const r=a(this,Qe).createElementNS(Pi,"feComponentTransfer");n.append(r),A(this,Q,Qc).call(this,r,"feFuncA",t)},td=function(t){return a(this,Q,yh).style.color=t,sg(getComputedStyle(a(this,Q,yh)).getPropertyValue("color"))};var U1;if(_n){let h;try{const e=process.getBuiltinModule("module").createRequire(import.meta.url);try{h=e("@napi-rs/canvas")}catch(t){ht(`Cannot load "@napi-rs/canvas" package: "${t}".`)}}catch(e){ht(`Cannot access the \`require\` function: "${e}".`)}globalThis.DOMMatrix||(h!=null&&h.DOMMatrix?globalThis.DOMMatrix=h.DOMMatrix:ht("Cannot polyfill `DOMMatrix`, rendering may be broken.")),globalThis.ImageData||(h!=null&&h.ImageData?globalThis.ImageData=h.ImageData:ht("Cannot polyfill `ImageData`, rendering may be broken.")),globalThis.Path2D||(h!=null&&h.Path2D?globalThis.Path2D=h.Path2D:ht("Cannot polyfill `Path2D`, rendering may be broken.")),(U1=globalThis.navigator)!=null&&U1.language||(globalThis.navigator={language:"en-US",platform:"",userAgent:""})}async function mS(h){const t=await process.getBuiltinModule("fs/promises").readFile(h);return new Uint8Array(t)}class vS extends jA{}class yS extends kA{_createCanvas(e,t){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,t)}}class bS extends BA{async _fetch(e,t){return mS(e)}}const AS=` struct Uniforms { offsetX : f32, offsetY : f32, scaleX : f32, scaleY : f32, paddedWidth : f32, paddedHeight : f32, borderSize : f32, _pad : f32, }; @group(0) @binding(0) var u : Uniforms; struct VertexInput { @location(0) position : vec2, @location(1) color : vec4, }; struct VertexOutput { @builtin(position) position : vec4, @location(0) color : vec3, }; @vertex fn vs_main(in : VertexInput) -> VertexOutput { var out : VertexOutput; let cx = (in.position.x + u.offsetX) * u.scaleX; let cy = (in.position.y + u.offsetY) * u.scaleY; out.position = vec4( ((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0, 1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0, 0.0, 1.0 ); out.color = in.color.rgb; return out; } @fragment fn fs_main(in : VertexOutput) -> @location(0) vec4 { return vec4(in.color, 1.0); } `;var zm,Zi,il,du,Gm,$A;class ES{constructor(){b(this,Gm);b(this,zm,null);b(this,Zi,null);b(this,il,null);b(this,du,null)}init(){return a(this,zm)||g(this,zm,A(this,Gm,$A).call(this))}get isReady(){return a(this,Zi)!==null}loadMeshShader(){if(!a(this,Zi)||a(this,il))return;const e=a(this,Zi).createShaderModule({code:AS});g(this,il,a(this,Zi).createRenderPipeline({layout:"auto",vertex:{module:e,entryPoint:"vs_main",buffers:[{arrayStride:2*4,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:"unorm8x4"}]}]},fragment:{module:e,entryPoint:"fs_main",targets:[{format:a(this,du)}]},primitive:{topology:"triangle-list"}}))}draw(e,t,n,r,i,s,o,l){this.loadMeshShader();const u=a(this,Zi),{offsetX:c,offsetY:d,scaleX:f,scaleY:p}=r,m=u.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});e.byteLength>0&&u.queue.writeBuffer(m,0,e);const v=u.createBuffer({size:Math.max(t.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});t.byteLength>0&&u.queue.writeBuffer(v,0,t);const y=u.createBuffer({size:8*4,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});u.queue.writeBuffer(y,0,new Float32Array([c,d,f,p,s,o,l,0]));const E=u.createBindGroup({layout:a(this,il).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:y}}]}),S=new OffscreenCanvas(s,o),w=S.getContext("webgpu");w.configure({device:u,format:a(this,du),alphaMode:i?"opaque":"premultiplied"});const C=i?{r:i[0]/255,g:i[1]/255,b:i[2]/255,a:1}:{r:0,g:0,b:0,a:0},x=u.createCommandEncoder(),T=x.beginRenderPass({colorAttachments:[{view:w.getCurrentTexture().createView(),clearValue:C,loadOp:"clear",storeOp:"store"}]});return n>0&&(T.setPipeline(a(this,il)),T.setBindGroup(0,E),T.setVertexBuffer(0,m),T.setVertexBuffer(1,v),T.draw(n)),T.end(),u.queue.submit([x.finish()]),m.destroy(),v.destroy(),y.destroy(),S.transferToImageBitmap()}}zm=new WeakMap,Zi=new WeakMap,il=new WeakMap,du=new WeakMap,Gm=new WeakSet,$A=async function(){var e;if(!((e=globalThis.navigator)!=null&&e.gpu))return!1;try{const t=await navigator.gpu.requestAdapter();return t?(g(this,du,navigator.gpu.getPreferredCanvasFormat()),g(this,Zi,await t.requestDevice()),!0):!1}catch{return!1}};const pv=new ES;function wS(){return pv.init()}function xS(){return pv.isReady}function SS(){pv.loadMeshShader()}function CS(h,e,t,n,r,i,s,o){return pv.draw(h,e,t,n,r,i,s,o)}const ze={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function Lg(h,e){if(!e)return;const t=e[2]-e[0],n=e[3]-e[1],r=new Path2D;r.rect(e[0],e[1],t,n),h.clip(r)}class lb{isModifyingCurrentTransform(){return!1}getPattern(){Ot("Abstract method `getPattern` called.")}}class TS extends lb{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"}areConic(){if(!this.isRadial())return!1;const e=Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1]);return e+this._r1>this._r0&&e+this._r0>this._r1}_createGradient(e,t=null){let n,r=this._p0,i=this._p1;if(t&&(r=r.slice(),i=i.slice(),_.applyTransform(r,t),_.applyTransform(i,t)),this._type==="axial")n=e.createLinearGradient(r[0],r[1],i[0],i[1]);else if(this._type==="radial"){let s=this._r0,o=this._r1;if(t){const l=new Float32Array(2);_.singularValueDecompose2dScale(t,l),s*=l[0],o*=l[0]}n=e.createRadialGradient(r[0],r[1],s,i[0],i[1],o)}for(const s of this._colorStops)n.addColorStop(s[0],s[1]);return n}_createReversedGradient(e,t=null){let n=this._p1,r=this._p0;t&&(n=n.slice(),r=r.slice(),_.applyTransform(n,t),_.applyTransform(r,t));let i=this._r1,s=this._r0;if(t){const u=new Float32Array(2);_.singularValueDecompose2dScale(t,u),i*=u[0],s*=u[0]}const o=e.createRadialGradient(n[0],n[1],i,r[0],r[1],s),l=this._colorStops.map(([u,c])=>[1-u,c]).reverse();for(const[u,c]of l)o.addColorStop(u,c);return o}getPattern(e,t,n,r){let i;if(r===ze.STROKE||r===ze.FILL){if(this.isOriginBased()){let f=_.transform(n,t.baseTransform);this.matrix&&(f=_.transform(f,this.matrix));const p=.001,m=Math.hypot(f[0],f[1]),v=Math.hypot(f[2],f[3]),y=(f[0]*f[2]+f[1]*f[3])/(m*v);if(Math.abs(y)l[n*2+1]&&(f=t,t=n,n=f,f=i,i=s,s=f),l[n*2+1]>l[r*2+1]&&(f=n,n=r,r=f,f=s,s=o,o=f),l[t*2+1]>l[n*2+1]&&(f=t,t=n,n=f,f=i,i=s,s=f);const p=(l[t*2]+e.offsetX)*e.scaleX,m=(l[t*2+1]+e.offsetY)*e.scaleY,v=(l[n*2]+e.offsetX)*e.scaleX,y=(l[n*2+1]+e.offsetY)*e.scaleY,E=(l[r*2]+e.offsetX)*e.scaleX,S=(l[r*2+1]+e.offsetY)*e.scaleY;if(m>=S)return;const w=u[i*4],C=u[i*4+1],x=u[i*4+2],T=u[s*4],I=u[s*4+1],F=u[s*4+2],P=u[o*4],R=u[o*4+1],D=u[o*4+2],k=Math.round(m),N=Math.round(S);let H,X,j,U,z,G,nt,pt;for(let it=k;it<=N;it++){if(itS?O=1:y===S?O=0:O=(y-it)/(y-S),H=v-(v-E)*O,X=T-(T-P)*O,j=I-(I-R)*O,U=F-(F-D)*O}let K;itS?K=1:K=(m-it)/(m-S),z=p-(p-E)*K,G=w-(w-P)*K,nt=C-(C-R)*K,pt=x-(x-D)*K;const lt=Math.round(Math.min(H,z)),st=Math.round(Math.max(H,z));let B=d*it+lt*4;for(let O=lt;O<=st;O++)K=(H-O)/(H-z),K<0?K=0:K>1&&(K=1),c[B++]=X-(X-G)*K|0,c[B++]=j-(j-nt)*K|0,c[B++]=U-(U-pt)*K|0,c[B++]=255}}class IS extends lb{constructor(e){super(),this._posData=e[2],this._colData=e[3],this._vertexCount=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],this.matrix=null,SS()}_createMeshCanvas(e,t,n){const o=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-o,c=Math.ceil(this._bounds[3])-l,d=Math.min(Math.ceil(Math.abs(u*e[0]*1.1)),3e3)||1,f=Math.min(Math.ceil(Math.abs(c*e[1]*1.1)),3e3)||1,p=u?u/d:1,m=c?c/f:1,v={coords:this._posData,colors:this._colData,offsetX:-o,offsetY:-l,scaleX:1/p,scaleY:1/m},y=d+2*2,E=f+2*2,S=n.create(y,E);if(xS()&&this._vertexCount>48)S.context.drawImage(CS(this._posData,this._colData,this._vertexCount,v,t,y,E,2),0,0);else{const w=S.context.createImageData(d,f);if(t){const C=w.data;for(let x=0,T=C.length;xu+1e-6||t>c+1e-6)return null;const d=Math.floor((n-o)/u)+1,f=Math.ceil((n+e-i)/u)-1,p=Math.floor((r-l)/c)+1,m=Math.ceil((r+t-s)/c)-1;return f<=d&&m<=p?[d,p]:null}updatePatternDims(e,t){const n=_.inverseTransform(this.patternBaseMatrix),r=[e[0],e[1]],i=[e[2],e[3]];_.applyTransform(r,n),_.applyTransform(i,n),t[0]=Math.abs(i[0]-r[0]),t[1]=Math.abs(i[1]-r[1]),t[2]=Math.min(r[0],i[0]),t[3]=Math.min(r[1],i[1])}_renderTileCanvas(e,t,n,r){var f,p;const[i,s,o,l]=this.bbox,u=e.canvasFactory.create(n.size,r.size),c=u.context,d=this.canvasGraphicsFactory.createCanvasGraphics(c,t);return d.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(d,this.paintType,this.color),c.translate(-n.scale*i,-r.scale*s),d.transform(0,n.scale,0,0,r.scale,0,0),c.save(),(f=d.dependencyTracker)==null||f.save(),this.clipBbox(d,i,s,o,l),d.baseTransform=Yt(d.ctx),d.executeOperatorList(this.operatorList),d.endDrawing(),(p=d.dependencyTracker)==null||p.restore(),c.restore(),u}_getCombinedScales(){const e=new Float32Array(2);_.singularValueDecompose2dScale(this.matrix,e);const[t,n]=e;return _.singularValueDecompose2dScale(this.baseTransform,e),[t*e[0],n*e[1]]}drawPattern(e,t,n=!1,[r,i],s){const[o,l,u,c]=this.bbox,d=e.dependencyTracker;if(d&&(e.dependencyTracker=new Pd(d,s)),e.save(),n?e.ctx.clip(t,"evenodd"):e.ctx.clip(t),e.ctx.setTransform(...this.patternBaseMatrix),e.ctx.translate(r*this.xstep,i*this.ystep),this.needsIsolation||e.ctx.globalAlpha!==1||e.ctx.globalCompositeOperation!=="source-over"||e.inSMaskMode){const f=u-o,p=c-l,[m,v]=this._getCombinedScales(),y=this.getSizeAndScale(f,this.ctx.canvas.width,m),E=this.getSizeAndScale(p,this.ctx.canvas.height,v),S=this._renderTileCanvas(e,s,y,E);e.ctx.drawImage(S.canvas,o,l,f,p),e.canvasFactory.destroy(S)}else this.setFillAndStrokeStyleToContext(e,this.paintType,this.color),this.clipBbox(e,o,l,u,c),e.baseTransformStack.push(e.baseTransform),e.baseTransform=Yt(e.ctx),e.executeOperatorList(this.operatorList),e.baseTransform=e.baseTransformStack.pop();e.restore(),d&&(e.dependencyTracker=d)}createPatternCanvas(e,t){const[n,r,i,s]=this.bbox,o=i-n,l=s-r;let{xstep:u,ystep:c}=this;u=Math.abs(u),c=Math.abs(c),cv("TilingType: "+this.tilingType);const[d,f]=this._getCombinedScales();let p=o,m=l,v=!1,y=!1;Math.ceil(u*d)>=Math.ceil(o*d)?p=u:v=!0,Math.ceil(c*f)>=Math.ceil(l*f)?m=c:y=!0;const E=this.getSizeAndScale(p,this.ctx.canvas.width,d),S=this.getSizeAndScale(m,this.ctx.canvas.height,f),w=this._renderTileCanvas(e,t,E,S);if(v||y){const C=w.canvas;v&&(p=u),y&&(m=c);const x=this.getSizeAndScale(p,this.ctx.canvas.width,d),T=this.getSizeAndScale(m,this.ctx.canvas.height,f),I=x.size,F=T.size,P=e.canvasFactory.create(I,F),R=P.context,D=v?Math.floor(o/u):0,k=y?Math.floor(l/c):0;for(let N=0;N<=D;N++)for(let H=0;H<=k;H++)R.drawImage(C,I*N,F*H,I,F,0,0,I,F);return e.canvasFactory.destroy(w),{canvas:P.canvas,canvasEntry:P,scaleX:x.scale,scaleY:T.scale,offsetX:n,offsetY:r}}return{canvas:w.canvas,canvasEntry:w,scaleX:E.scale,scaleY:S.scale,offsetX:n,offsetY:r}}getSizeAndScale(e,t,n){const r=Math.max(Xm.MAX_PATTERN_SIZE,t);let i=Math.ceil(e*n);return i>=r?i=r:n=i/e,{scale:n,size:i}}clipBbox(e,t,n,r,i){const s=r-t,o=i-n,l=new Path2D;l.rect(t,n,s,o),_.axialAlignedBoundingBox([t,n,r,i],Yt(e.ctx),e.current.minMax),e.ctx.clip(l),e.current.updateClipFromPath()}setFillAndStrokeStyleToContext(e,t,n){const r=e.ctx,i=e.current;switch(i.patternFill=i.patternStroke=!1,t){case Vb.COLORED:const{fillStyle:s,strokeStyle:o}=this.ctx;r.fillStyle=i.fillColor=s,r.strokeStyle=i.strokeColor=o;break;case Vb.UNCOLORED:r.fillStyle=r.strokeStyle=n,i.fillColor=i.strokeColor=n;break;default:throw new Lx(`Unsupported paint type: ${t}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,t,n,r,i){const s=r!==ze.SHADING?_.transform(n,this.patternBaseMatrix):n,o=this.createPatternCanvas(t,i);let l=new DOMMatrix(s);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const u=e.createPattern(o.canvas,"repeat");return t.canvasFactory.destroy(o.canvasEntry),u.setTransform(l),u}};M(Xm,"MAX_PATTERN_SIZE",3e3);let yd=Xm;function DS({src:h,srcPos:e=0,dest:t,width:n,height:r,nonBlackColor:i=4294967295,inverseDecode:s=!1}){const o=be.isLittleEndian?4278190080:255,[l,u]=s?[i,o]:[o,i],c=n>>3,d=n&7,f=l^u,p=h.length;t=new Uint32Array(t.buffer);let m=0;for(let v=0;v>7&1)&f,t[m+1]=l^-(S>>6&1)&f,t[m+2]=l^-(S>>5&1)&f,t[m+3]=l^-(S>>4&1)&f,t[m+4]=l^-(S>>3&1)&f,t[m+5]=l^-(S>>2&1)&f,t[m+6]=l^-(S>>1&1)&f,t[m+7]=l^-(S&1)&f}if(d===0)continue;const y=e>7-E&1)&f}return{srcPos:e,destPos:m}}const Wb=16,zb=100,OS=15,Gb=10,Cn=16,Iv=new DOMMatrix,Yn=new Float32Array(2);function MS(h,e){if(h._removeMirroring)throw new Error("Context is already forwarding operations.");h.__originalSave=h.save,h.__originalRestore=h.restore,h.__originalRotate=h.rotate,h.__originalScale=h.scale,h.__originalTranslate=h.translate,h.__originalTransform=h.transform,h.__originalSetTransform=h.setTransform,h.__originalResetTransform=h.resetTransform,h.__originalClip=h.clip,h.__originalMoveTo=h.moveTo,h.__originalLineTo=h.lineTo,h.__originalBezierCurveTo=h.bezierCurveTo,h.__originalRect=h.rect,h.__originalClosePath=h.closePath,h.__originalBeginPath=h.beginPath,h._removeMirroring=()=>{h.save=h.__originalSave,h.restore=h.__originalRestore,h.rotate=h.__originalRotate,h.scale=h.__originalScale,h.translate=h.__originalTranslate,h.transform=h.__originalTransform,h.setTransform=h.__originalSetTransform,h.resetTransform=h.__originalResetTransform,h.clip=h.__originalClip,h.moveTo=h.__originalMoveTo,h.lineTo=h.__originalLineTo,h.bezierCurveTo=h.__originalBezierCurveTo,h.rect=h.__originalRect,h.closePath=h.__originalClosePath,h.beginPath=h.__originalBeginPath,delete h._removeMirroring},h.save=function(){e.save(),this.__originalSave()},h.restore=function(){e.restore(),this.__originalRestore()},h.translate=function(t,n){e.translate(t,n),this.__originalTranslate(t,n)},h.scale=function(t,n){e.scale(t,n),this.__originalScale(t,n)},h.transform=function(t,n,r,i,s,o){e.transform(t,n,r,i,s,o),this.__originalTransform(t,n,r,i,s,o)},h.setTransform=function(t,n,r,i,s,o){n===void 0?(e.setTransform(t),this.__originalSetTransform(t)):(e.setTransform(t,n,r,i,s,o),this.__originalSetTransform(t,n,r,i,s,o))},h.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},h.rotate=function(t){e.rotate(t),this.__originalRotate(t)},h.clip=function(t){e.clip(t),this.__originalClip(t)},h.moveTo=function(t,n){e.moveTo(t,n),this.__originalMoveTo(t,n)},h.lineTo=function(t,n){e.lineTo(t,n),this.__originalLineTo(t,n)},h.bezierCurveTo=function(t,n,r,i,s,o){e.bezierCurveTo(t,n,r,i,s,o),this.__originalBezierCurveTo(t,n,r,i,s,o)},h.rect=function(t,n,r,i){e.rect(t,n,r,i),this.__originalRect(t,n,r,i)},h.closePath=function(){e.closePath(),this.__originalClosePath()},h.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}function cg(h,e,t,n,r,i,s,o,l,u){const[c,d,f,p,m,v]=Yt(h);if(d===0&&f===0){const S=s*c+m,w=Math.round(S),C=o*p+v,x=Math.round(C),T=(s+l)*c+m,I=Math.abs(Math.round(T)-w)||1,F=(o+u)*p+v,P=Math.abs(Math.round(F)-x)||1;return h.setTransform(Math.sign(c),0,0,Math.sign(p),w,x),h.drawImage(e,t,n,r,i,0,0,I,P),h.setTransform(c,d,f,p,m,v),[I,P]}if(c===0&&p===0){const S=o*f+m,w=Math.round(S),C=s*d+v,x=Math.round(C),T=(o+u)*f+m,I=Math.abs(Math.round(T)-w)||1,F=(s+l)*d+v,P=Math.abs(Math.round(F)-x)||1;return h.setTransform(0,Math.sign(d),Math.sign(f),0,w,x),h.drawImage(e,t,n,r,i,0,0,P,I),h.setTransform(c,d,f,p,m,v),[P,I]}h.drawImage(e,t,n,r,i,s,o,l,u);const y=Math.hypot(c,d),E=Math.hypot(f,p);return[y*l,E*u]}class Xb{constructor(e,t){M(this,"alphaIsShape",!1);M(this,"fontSize",0);M(this,"fontSizeScale",1);M(this,"textMatrix",null);M(this,"textMatrixScale",1);M(this,"fontMatrix",Hv);M(this,"leading",0);M(this,"x",0);M(this,"y",0);M(this,"lineX",0);M(this,"lineY",0);M(this,"charSpacing",0);M(this,"wordSpacing",0);M(this,"textHScale",1);M(this,"textRenderingMode",xe.FILL);M(this,"textRise",0);M(this,"fillColor","#000000");M(this,"strokeColor","#000000");M(this,"tilingPatternDims",null);M(this,"patternFill",!1);M(this,"patternStroke",!1);M(this,"fillAlpha",1);M(this,"strokeAlpha",1);M(this,"lineWidth",1);M(this,"activeSMask",null);M(this,"transferMaps","none");M(this,"minMax",So.slice());this.clipBox=new Float32Array([0,0,e,t])}clone(){var t;const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e.tilingPatternDims=(t=this.tilingPatternDims)==null?void 0:t.slice(),e}getPathBoundingBox(e=ze.FILL,t=null){const n=this.minMax.slice();if(e===ze.STROKE){t||Ot("Stroke bounding box must include transform."),_.singularValueDecompose2dScale(t,Yn);const r=Yn[0]*this.lineWidth/2,i=Yn[1]*this.lineWidth/2;n[0]-=r,n[1]-=i,n[2]+=r,n[3]+=i}return n}updateClipFromPath(){const e=_.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(So,0)}getClippedPathBoundingBox(e=ze.FILL,t=null){return _.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function _b(h,e){if(e instanceof ImageData){h.putImageData(e,0,0);return}const t=e.height,n=e.width,r=t%Cn,i=(t-r)/Cn,s=r===0?i:i+1,o=h.createImageData(n,Cn);let l=0,u;const c=e.data,d=o.data;let f,p,m,v;if(e.kind===wg.GRAYSCALE_1BPP){const y=c.byteLength,E=new Uint32Array(d.buffer,0,d.byteLength>>2),S=E.length,w=n+7>>3,C=4294967295,x=be.isLittleEndian?4278190080:255;for(f=0;fw?n:T*8-7,P=F&-8;let R=0,D=0;for(;I>=1}for(;u=i&&(m=r,v=n*m),u=0,p=v;p--;)d[u++]=c[l++],d[u++]=c[l++],d[u++]=c[l++],d[u++]=255;h.putImageData(o,0,f*Cn)}else throw new Error(`bad image kind: ${e.kind}`)}function Yb(h,e){if(e.bitmap){h.drawImage(e.bitmap,0,0);return}const t=e.height,n=e.width,r=t%Cn,i=(t-r)/Cn,s=r===0?i:i+1,o=h.createImageData(n,Cn);let l=0;const u=e.data,c=o.data;for(let d=0;dGb&&typeof n=="function",d=c?Date.now()+OS:0;let f=0;const p=this.commonObjs,m=this.objs;let v,y;for(;;){if(r!==void 0){if(l===r.nextBreakPoint)return r.breakIt(l,n),l;if(r.shouldSkip(l)){if(++l===u)return l;continue}}if(!i||i(l))if(v=o[l],y=s[l]??null,v!==Mi.dependency)y===null?this[v](l):this[v](l,...y);else for(const S of y){(E=this.dependencyTracker)==null||E.recordNamedData(S,l);const w=S.startsWith("g_")?p:m;if(!w.has(S))return w.get(S,n),l}if(l++,l===u)return l;if(c&&++f>Gb){if(Date.now()>d)return n(),l;f=0}}}endDrawing(){A(this,Wr,Ay).call(this);for(const e of this.smaskGroupCanvases)this.canvasFactory.destroy(e);this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0,this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),A(this,Wr,Ey).call(this)}_scaleImage(e,t){const n=e.width??e.displayWidth,r=e.height??e.displayHeight,i=Math.max(Math.hypot(t[0],t[1]),1),s=Math.max(Math.hypot(t[2],t[3]),1),o=[];let l=i,u=s,c=n,d=r;for(;l>2&&c>1||u>2&&d>1;){let E=c,S=d;l>2&&c>1&&(E=Math.ceil(c/2),l/=c/E),u>2&&d>1&&(S=Math.ceil(d/2),u/=d/S),o.push({newWidth:E,newHeight:S}),c=E,d=S}if(o.length===0)return{img:e,paintWidth:n,paintHeight:r,tmpCanvas:null};if(o.length===1){const{newWidth:E,newHeight:S}=o[0],w=this.canvasFactory.create(E,S);return w.context.drawImage(e,0,0,n,r,0,0,E,S),{img:w.canvas,paintWidth:E,paintHeight:S,tmpCanvas:w}}let f=this.canvasFactory.create(1,1),p=this.canvasFactory.create(1,1),m=n,v=r,y=e;for(const{newWidth:E,newHeight:S}of o)this.canvasFactory.reset(p,E,S),p.context.drawImage(y,0,0,m,v,0,0,E,S),[f,p]=[p,f],y=f.canvas,m=E,v=S;return this.canvasFactory.destroy(p),{img:f.canvas,paintWidth:m,paintHeight:v,tmpCanvas:f}}_createMaskCanvas(e,t){var D,k;const n=this.ctx,{width:r,height:i}=t,s=this.current.fillColor,o=this.current.patternFill,l=Yt(n);let u,c,d,f;if((t.bitmap||t.data)&&t.count>1){const N=t.bitmap||t.data.buffer;c=JSON.stringify(o?l:[l.slice(0,4),s]),u=this._cachedBitmapsMap.getOrInsertComputed(N,nb);const H=u.get(c);if(H&&!o){const X=Math.round(Math.min(l[0],l[2])+l[4]),j=Math.round(Math.min(l[1],l[3])+l[5]);return(D=this.dependencyTracker)==null||D.recordDependencies(e,tr.transformAndFill),{canvas:H,offsetX:X,offsetY:j}}d=H}d||(f=this.canvasFactory.create(r,i),Yb(f.context,t));let p=_.transform(l,[1/r,0,0,-1/i,0,0]);p=_.transform(p,[1,0,0,1,0,-i]);const m=So.slice();_.axialAlignedBoundingBox([0,0,r,i],p,m);const[v,y,E,S]=m,w=Math.round(E-v)||1,C=Math.round(S-y)||1,x=this.canvasFactory.create(w,C),T=x.context,I=v,F=y;T.translate(-I,-F),T.transform(...p);let P=null;if(!d){const N=this._scaleImage(f.canvas,zr(T));d=N.img,P=N.tmpCanvas,d!==f.canvas&&(this.canvasFactory.destroy(f),f=null),u&&o&&(u.set(c,d),P=null,f=null)}T.imageSmoothingEnabled=Kb(Yt(T),t.interpolate),cg(T,d,0,0,d.width,d.height,0,0,r,i),P&&this.canvasFactory.destroy(P),f&&this.canvasFactory.destroy(f),T.globalCompositeOperation="source-in";const R=_.transform(zr(T),[1,0,0,1,-I,-F]);return T.fillStyle=o?s.getPattern(n,this,R,ze.FILL,e):s,T.fillRect(0,0,r,i),u&&!o&&u.set(c,x.canvas),(k=this.dependencyTracker)==null||k.recordDependencies(e,tr.transformAndFill),{canvas:x.canvas,canvasEntry:u&&!o?null:x,offsetX:Math.round(I),offsetY:Math.round(F)}}setLineWidth(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("lineWidth",e),t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("lineCap",e),this.ctx.lineCap=LS[t]}setLineJoin(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("lineJoin",e),this.ctx.lineJoin=NS[t]}setMiterLimit(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("miterLimit",e),this.ctx.miterLimit=t}setDash(e,t,n){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("dash",e);const r=this.ctx;r.setLineDash!==void 0&&(r.setLineDash(t),r.lineDashOffset=n)}setRenderingIntent(e,t){}setFlatness(e,t){}setGState(e,t){var n,r,i,s,o;for(const[l,u]of t)switch(l){case"LW":this.setLineWidth(e,u);break;case"LC":this.setLineCap(e,u);break;case"LJ":this.setLineJoin(e,u);break;case"ML":this.setMiterLimit(e,u);break;case"D":this.setDash(e,u[0],u[1]);break;case"RI":this.setRenderingIntent(e,u);break;case"FL":this.setFlatness(e,u);break;case"Font":this.setFont(e,u[0],u[1]);break;case"CA":(n=this.dependencyTracker)==null||n.recordSimpleData("strokeAlpha",e),this.current.strokeAlpha=u;break;case"ca":(r=this.dependencyTracker)==null||r.recordSimpleData("fillAlpha",e),this.ctx.globalAlpha=this.current.fillAlpha=u;break;case"BM":(i=this.dependencyTracker)==null||i.recordSimpleData("globalCompositeOperation",e),this.ctx.globalCompositeOperation=u;break;case"SMask":(s=this.dependencyTracker)==null||s.recordSimpleData("SMask",e),this.current.activeSMask=u?this.tempSMask:null,this.current.activeSMask&&(this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation),this.tempSMask=null,this.checkSMaskState(e);break;case"TR":(o=this.dependencyTracker)==null||o.recordSimpleData("filter",e),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(u);break}}get inSMaskMode(){return!!this.suspendedCtx}_clearPreparedSMask(){this.smaskPreparedEntry&&(this.canvasFactory.destroy(this.smaskPreparedEntry),this.smaskPreparedEntry=null),this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0}_ensurePreparedSMask(e,t,n){e!==this.smaskPreparedFor&&(this._clearPreparedSMask(),this._prepareSMaskCanvas(e,t,n))}checkSMaskState(e){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode(e):!this.current.activeSMask&&t?this.endSMaskMode():this.current.activeSMask&&t&&this._ensurePreparedSMask(this.current.activeSMask,this.ctx.canvas.width,this.ctx.canvas.height)}_prepareSMaskCanvas(e,t,n){const{canvas:r,subtype:i,backdrop:s,transferMap:o}=e,l=i==="Luminosity"||i==="Alpha"&&o;if(!s&&!l){this.smaskPreparedFor=e;return}let u,c,d;if(s&&l){const f=this.canvasFactory.create(t,n),p=f.context;p.drawImage(r,e.offsetX,e.offsetY),p.globalCompositeOperation="destination-atop",p.fillStyle=s,p.fillRect(0,0,t,n),p.globalCompositeOperation="source-over",u=this.canvasFactory.create(t,n);const m=u.context;m.filter=i==="Alpha"?this.filterFactory.addAlphaFilter(o):this.filterFactory.addLuminosityFilter(o),m.drawImage(f.canvas,0,0),m.filter="none",this.canvasFactory.destroy(f),c=d=0}else if(l){u=this.canvasFactory.create(r.width,r.height);const f=u.context;f.filter=i==="Alpha"?this.filterFactory.addAlphaFilter(o):this.filterFactory.addLuminosityFilter(o),f.drawImage(r,0,0),f.filter="none",{offsetX:c,offsetY:d}=e}else{u=this.canvasFactory.create(t,n);const f=u.context;f.drawImage(r,e.offsetX,e.offsetY),f.globalCompositeOperation="destination-atop",f.fillStyle=s,f.fillRect(0,0,t,n),f.globalCompositeOperation="source-over",c=d=0}this.smaskPreparedEntry=u,this.smaskPreparedFor=e,this.smaskPreparedOffsetX=c,this.smaskPreparedOffsetY=d}beginSMaskMode(e){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const{width:t,height:n}=this.ctx.canvas,r=this.canvasFactory.create(t,n);this.smaskScratchCanvas=r,this.suspendedCtx=this.ctx;const i=this.ctx=r.context;i.setTransform(this.suspendedCtx.getTransform()),kc(this.suspendedCtx,i),MS(i,this.suspendedCtx),this._ensurePreparedSMask(this.current.activeSMask,t,n),this.setGState(e,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),kc(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null,this._clearPreparedSMask()}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];const 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(e[0],e[1],e[2]-e[0],e[3]-e[1]),this.ctx.restore()}composeSMask(e,t,n,r){const i=r[0],s=r[1],o=r[2]-i,l=r[3]-s;if(o===0||l===0)return;const u=this.smaskPreparedEntry;if(u){const c=i-this.smaskPreparedOffsetX,d=s-this.smaskPreparedOffsetY;n.save(),n.globalAlpha=1,n.setTransform(1,0,0,1,0,0);const f=new Path2D;f.rect(i,s,o,l),n.clip(f),n.globalCompositeOperation="destination-in",n.drawImage(u.canvas,c,d,o,l,i,s,o,l),n.restore()}else this.genericComposeSMask(t.context,n,o,l,i,s,t.offsetX,t.offsetY);e.save(),e.globalAlpha=1,e.globalCompositeOperation=t.blendMode||"source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,i,s,o,l,i,s,o,l),e.restore()}genericComposeSMask(e,t,n,r,i,s,o,l){const u=e.canvas,c=i-o,d=s-l;t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const f=new Path2D;f.rect(i,s,n,r),t.clip(f),t.globalCompositeOperation="destination-in",t.drawImage(u,c,d,n,r,i,s,n,r),t.restore()}save(e){var n;this.inSMaskMode&&kc(this.ctx,this.suspendedCtx),this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone(),(n=this.dependencyTracker)==null||n.save(e)}restore(e){var t;if((t=this.dependencyTracker)==null||t.restore(e),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&(kc(this.suspendedCtx,this.ctx),this.ctx.setTransform(this.suspendedCtx.getTransform())),this.checkSMaskState(e),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,t,n,r,i,s,o){var l;(l=this.dependencyTracker)==null||l.recordIncrementalData("transform",e),this.ctx.transform(t,n,r,i,s,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,n,r){let[i]=n;if(!r){i||(i=n[0]=new Path2D),t!==Mi.stroke&&t!==Mi.closeStroke&&(this.current.tilingPatternDims=null),this[t](e,i);return}if(this.dependencyTracker!==null){const o=t===Mi.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(e).recordBBox(e,this.ctx,r[0]-o,r[2]+o,r[1]-o,r[3]+o).recordDependencies(e,["transform"])}i instanceof Path2D||(i=n[0]=K1(i)),_.axialAlignedBoundingBox(r,Yt(this.ctx),this.current.minMax);const s=this.current.tilingPatternDims;if(s&&t!==Mi.stroke&&t!==Mi.closeStroke&&this.current.fillColor instanceof yd){const o=_.intersect(this.current.clipBox,this.current.minMax);o?this.current.fillColor.updatePatternDims(o,s):this.current.tilingPatternDims=null}this[t](e,i),this._pathStartIdx=e}closePath(e){this.ctx.closePath()}stroke(e,t,n=!0){var s;const r=this.ctx,i=this.current.strokeColor;if(r.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof i=="object"&&(i!=null&&i.getPattern)){const o=i.isModifyingCurrentTransform()?r.getTransform():null;if(r.save(),r.strokeStyle=i.getPattern(r,this,zr(r),ze.STROKE,e),o){const l=new Path2D;l.addPath(t,r.getTransform().invertSelf().multiplySelf(o)),t=l}this.rescaleAndStroke(t,!1),r.restore()}else this.rescaleAndStroke(t,!0);(s=this.dependencyTracker)==null||s.recordDependencies(e,tr.stroke),n&&this.consumePath(e,t,this.current.getClippedPathBoundingBox(ze.STROKE,Yt(this.ctx))),r.globalAlpha=this.current.fillAlpha}closeStroke(e,t){this.stroke(e,t)}fill(e,t,n=!0){var u,c,d;const r=this.ctx,i=this.current.fillColor,s=this.current.patternFill;let o=!1;const l=this.current.getClippedPathBoundingBox();if((u=this.dependencyTracker)==null||u.recordDependencies(e,tr.fill),s){const f=this.current.tilingPatternDims,p=f&&i.canSkipPatternCanvas(f);if(p){i.drawPattern(this,t,this.pendingEOFill,p,e),this.pendingEOFill=!1,n&&this.consumePath(e,t,l),this.current.tilingPatternDims=null;return}const m=i.isModifyingCurrentTransform()?r.getTransform():null;if((c=this.dependencyTracker)==null||c.save(e),r.save(),r.fillStyle=i.getPattern(r,this,zr(r),ze.FILL,e),m){const v=new Path2D;v.addPath(t,r.getTransform().invertSelf().multiplySelf(m)),t=v}o=!0}this.contentVisible&&l!==null&&(this.pendingEOFill?(r.fill(t,"evenodd"),this.pendingEOFill=!1):r.fill(t)),o&&(r.restore(),(d=this.dependencyTracker)==null||d.restore(e)),n&&this.consumePath(e,t,l)}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){var n;this.ctx.fill(t),(n=this.dependencyTracker)==null||n.recordDependencies(e,tr.rawFillPath).recordOperation(e)}clip(e){var t;(t=this.dependencyTracker)==null||t.recordFutureForcedDependency("clipMode",e),this.pendingClip=BS}eoClip(e){var t;(t=this.dependencyTracker)==null||t.recordFutureForcedDependency("clipMode",e),this.pendingClip=Jb}beginText(e){var t;this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,(t=this.dependencyTracker)==null||t.recordOpenMarker(e).resetIncrementalData("sameLineText").resetIncrementalData("moveText",e)}endText(e){const t=this.pendingTextPaths,n=this.ctx;if(this.dependencyTracker){const{dependencyTracker:r}=this;t!==void 0&&r.recordFutureForcedDependency("textClip",r.getOpenMarker()).recordFutureForcedDependency("textClip",e),r.recordCloseMarker(e)}if(t!==void 0){const r=new Path2D,i=n.getTransform().invertSelf();for(const{transform:s,x:o,y:l,fontSize:u,path:c}of t)c&&r.addPath(c,new DOMMatrix(s).preMultiplySelf(i).translate(o,l).scale(u,-u));n.clip(r)}delete this.pendingTextPaths}setCharSpacing(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("charSpacing",e),this.current.charSpacing=t}setWordSpacing(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("wordSpacing",e),this.current.wordSpacing=t}setHScale(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("hScale",e),this.current.textHScale=t/100}setLeading(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("leading",e),this.current.leading=-t}setFont(e,t,n){var d,f;(d=this.dependencyTracker)==null||d.recordSimpleData("font",e).recordSimpleDataFromNamed("fontObj",t,e);const r=this.commonObjs.get(t),i=this.current;if(!r)throw new Error(`Can't find font for ${t}`);if(i.fontMatrix=r.fontMatrix||Hv,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&ht("Invalid font matrix for font "+t),n<0?(n=-n,i.fontDirection=-1):i.fontDirection=1,this.current.font=r,this.current.fontSize=n,r.isType3Font)return;const s=r.loadedName||"sans-serif",o=((f=r.systemFontInfo)==null?void 0:f.css)||`"${s}", ${r.fallbackName}`;let l="normal";r.black?l="900":r.bold&&(l="bold");const u=r.italic?"italic":"normal";let c=n;nzb&&(c=zb),this.current.fontSizeScale=n/c,this.ctx.font=`${u} ${l} ${c}px ${o}`}setTextRenderingMode(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("textRenderingMode",e),this.current.textRenderingMode=t}setTextRise(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("textRise",e),this.current.textRise=t}moveText(e,t,n){var r;(r=this.dependencyTracker)==null||r.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){var r;(r=this.dependencyTracker)==null||r.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",e);const{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){var t;this.moveText(e,0,this.current.leading),(t=this.dependencyTracker)==null||t.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??e)}paintChar(e,t,n,r,i,s){var E,S,w,C;const o=this.ctx,l=this.current,u=l.font,c=l.textRenderingMode,d=l.fontSize/l.fontSizeScale,f=c&xe.FILL_STROKE_MASK,p=!!(c&xe.ADD_TO_PATH_FLAG),m=l.patternFill&&!u.missingFile,v=l.patternStroke&&!u.missingFile;let y;if((u.disableFontFace||p||m||v)&&!u.missingFile&&(y=u.getPathGenerator(this.commonObjs,t)),y&&(u.disableFontFace||m||v)){o.save(),o.translate(n,r),o.scale(d,-d),(E=this.dependencyTracker)==null||E.recordCharacterBBox(e,o,u);let x;if(f===xe.FILL||f===xe.FILL_STROKE)if(i){x=o.getTransform(),o.setTransform(...i);const T=A(this,Wr,wy).call(this,y,x,i);o.fill(T)}else o.fill(y);if(f===xe.STROKE||f===xe.FILL_STROKE)if(s){x||(x=o.getTransform()),o.setTransform(...s);const{a:T,b:I,c:F,d:P}=x,R=_.inverseTransform(s),D=_.transform([T,I,F,P,0,0],R);_.singularValueDecompose2dScale(D,Yn),o.lineWidth*=Math.max(Yn[0],Yn[1])/d,o.stroke(A(this,Wr,wy).call(this,y,x,s))}else o.lineWidth/=d,o.stroke(y);o.restore()}else(f===xe.FILL||f===xe.FILL_STROKE)&&(o.fillText(t,n,r),(S=this.dependencyTracker)==null||S.recordCharacterBBox(e,o,u,d,n,r,()=>o.measureText(t))),(f===xe.STROKE||f===xe.FILL_STROKE)&&(this.dependencyTracker&&((w=this.dependencyTracker)==null||w.recordCharacterBBox(e,o,u,d,n,r,()=>o.measureText(t)).recordDependencies(e,tr.stroke)),o.strokeText(t,n,r));p&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Yt(o),x:n,y:r,fontSize:d,path:y}),(C=this.dependencyTracker)==null||C.recordCharacterBBox(e,o,u,d,n,r))}get isFontSubpixelAAEnabled(){const e=this.canvasFactory.create(10,10),t=e.context;t.scale(1.5,1),t.fillText("I",0,10);const n=t.getImageData(0,0,10,10).data;this.canvasFactory.destroy(e);let r=!1;for(let i=3;i0&&n[i]<255){r=!0;break}return dt(this,"isFontSubpixelAAEnabled",r)}showText(e,t){var D,k,N,H;this.dependencyTracker&&(this.dependencyTracker.recordDependencies(e,tr.showText).resetBBox(e),this.current.textRenderingMode&xe.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",e).inheritPendingDependenciesAsFutureForcedDependencies());const n=this.current,r=n.font;if(r.isType3Font){this.showType3Text(e,t),(D=this.dependencyTracker)==null||D.recordShowTextOperation(e);return}const i=n.fontSize;if(i===0){(k=this.dependencyTracker)==null||k.recordOperation(e);return}const s=this.ctx,o=n.fontSizeScale,l=n.charSpacing,u=n.wordSpacing,c=n.fontDirection,d=n.textHScale*c,f=t.length,p=r.vertical,m=p?1:-1,v=r.defaultVMetrics,y=i*n.fontMatrix[0],E=n.textRenderingMode===xe.FILL&&!r.disableFontFace&&!n.patternFill;s.save(),n.textMatrix&&s.transform(...n.textMatrix),s.translate(n.x,n.y+n.textRise),c>0?s.scale(d,-1):s.scale(d,1);let S,w;const C=n.textRenderingMode&xe.FILL_STROKE_MASK,x=C===xe.FILL||C===xe.FILL_STROKE,T=C===xe.STROKE||C===xe.FILL_STROKE;let I=n.lineWidth;const F=n.textMatrixScale;if(F===0||I===0?T&&(I=this.getSinglePixelWidth()):I/=F,o!==1&&(s.scale(o,o),I/=o),s.lineWidth=I,x&&n.patternFill){s.save();const X=n.fillColor.getPattern(s,this,zr(s),ze.FILL,e);S=Yt(s),s.restore(),s.fillStyle=X}if(T&&n.patternStroke){s.save();const X=n.strokeColor.getPattern(s,this,zr(s),ze.STROKE,e);w=Yt(s),s.restore(),s.strokeStyle=X}if(r.isInvalidPDFjsFont){const X=[];let j=0;for(const z of t)X.push(z.unicode),j+=z.width;const U=X.join("");if(s.fillText(U,0,0),this.dependencyTracker!==null){const z=s.measureText(U);this.dependencyTracker.recordBBox(e,this.ctx,-z.actualBoundingBoxLeft,z.actualBoundingBoxRight,-z.actualBoundingBoxAscent,z.actualBoundingBoxDescent).recordShowTextOperation(e)}n.x+=j*y*d,s.restore(),this.compose();return}let P=0,R;for(R=0;R0){K=s.measureText(z);const st=K.width*1e3/i*o;if(itK??s.measureText(z));else if(this.paintChar(e,z,nt,pt,S,w),G){const st=nt+i*G.offset.x/o,B=pt-i*G.offset.y/o;this.paintChar(e,G.fontChar,st,B,S,w)}}const lt=p?it*y-U*c:it*y+U*c;P+=lt,j&&s.restore()}p?n.y-=P:n.x+=P*d,s.restore(),this.compose(),(H=this.dependencyTracker)==null||H.recordShowTextOperation(e)}showType3Text(e,t){const n=this.ctx,r=this.current,i=r.font,s=r.fontSize,o=r.fontDirection,l=i.vertical?1:-1,u=r.charSpacing,c=r.wordSpacing,d=r.textHScale*o,f=r.fontMatrix||Hv,p=t.length,m=r.textRenderingMode===xe.INVISIBLE;let v,y,E,S;if(m||s===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,n.save(),r.textMatrix&&n.transform(...r.textMatrix),n.translate(r.x,r.y+r.textRise),n.scale(d,o);const w=this.dependencyTracker;for(this.dependencyTracker=w?new Pd(w,e):null,v=0;vnew bb(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new Pd(this.dependencyTracker,o,!0):null)};n=new yd(t,this.ctx,i,r)}else n=this._getPattern(e,t[1],t[2]);return n}setStrokeColorN(e,...t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("strokeColor",e),this.current.strokeColor=this.getColorN_Pattern(e,t),this.current.patternStroke=!0}setFillColorN(e,...t){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("fillColor",e);const n=this.current.fillColor=this.getColorN_Pattern(e,t);this.current.patternFill=!0,this.current.tilingPatternDims=n instanceof yd?[0,0,0,0]:null}setStrokeRGBColor(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor=t,this.current.patternStroke=!1}setStrokeTransparent(e){var t;(t=this.dependencyTracker)==null||t.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor=t,this.current.patternFill=!1,this.current.tilingPatternDims=null}setFillTransparent(e){var t;(t=this.dependencyTracker)==null||t.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1,this.current.tilingPatternDims=null}_getPattern(e,t,n=null){let r;return this.cachedPatterns.has(t)?r=this.cachedPatterns.get(t):(r=FS(this.getObject(e,t)),this.cachedPatterns.set(t,r)),n&&(r.matrix=n),r}shadingFill(e,t){var s;if(!this.contentVisible)return;const n=this.ctx;this.save(e);const r=this._getPattern(e,t);n.fillStyle=r.getPattern(n,this,zr(n),ze.SHADING,e);const i=zr(n);if(i){const{width:o,height:l}=n.canvas,u=So.slice();_.axialAlignedBoundingBox([0,0,o,l],i,u);const[c,d,f,p]=u;this.ctx.fillRect(c,d,f-c,p-d)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);(s=this.dependencyTracker)==null||s.resetBBox(e).recordFullPageBBox(e).recordDependencies(e,tr.transform).recordDependencies(e,tr.fill).recordOperation(e),this.compose(this.current.getClippedPathBoundingBox()),this.restore(e)}beginInlineImage(){Ot("Should not call beginInlineImage")}beginImageData(){Ot("Should not call beginImageData")}paintFormXObjectBegin(e,t,n){var r;if(this.contentVisible&&(this.save(e),this.baseTransformStack.push(this.baseTransform),t&&this.transform(e,...t),this.baseTransform=Yt(this.ctx),n)){_.axialAlignedBoundingBox(n,this.baseTransform,this.current.minMax);const[i,s,o,l]=n,u=new Path2D;u.rect(i,s,o-i,l-s),this.ctx.clip(u),(r=this.dependencyTracker)==null||r.recordClipBox(e,this.ctx,i,o,s,l),this.endPath(e)}}paintFormXObjectEnd(e){this.contentVisible&&(this.restore(e),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e,t){var m;if(!this.contentVisible)return;this.save(e);const{inSMaskMode:n}=this;n&&(this.endSMaskMode(),this.current.activeSMask=null);const r=this.ctx;if(t.isolated||cv("TODO: Support non-isolated groups."),t.knockout&&ht("Knockout groups not supported."),!t.needsIsolation&&r.globalAlpha===1&&r.globalCompositeOperation==="source-over"&&!n){if(t.bbox){let v=new Path2D;const[y,E,S,w]=t.bbox;if(v.rect(y,E,S-y,w-E),t.matrix){const C=new Path2D;C.addPath(v,new DOMMatrix(t.matrix)),v=C}r.clip(v)}this.groupStack.push(null),this.groupLevel++;return}const i=Yt(r);t.matrix&&r.transform(...t.matrix);const s=[0,0,r.canvas.width,r.canvas.height];let o;t.bbox?(o=So.slice(),_.axialAlignedBoundingBox(t.bbox,Yt(r),o),o=_.intersect(o,s)||[0,0,0,0]):o=s;const l=Math.floor(o[0]),u=Math.floor(o[1]),c=Math.max(Math.ceil(o[2])-l,1),d=Math.max(Math.ceil(o[3])-u,1);this.current.startNewPathAndClipBox([0,0,c,d]);const f=this.canvasFactory.create(c,d);t.smask&&this.smaskGroupCanvases.push(f);const p=f.context;if(p.translate(-l,-u),p.transform(...i),!t.isolated&&!t.smask&&n&&t.needsIsolation&&(p.save(),p.setTransform(1,0,0,1,0,0),p.drawImage(r.canvas,-l,-u),p.restore()),t.bbox){let v=new Path2D;const[y,E,S,w]=t.bbox;if(v.rect(y,E,S-y,w-E),t.matrix){const C=new Path2D;C.addPath(v,new DOMMatrix(t.matrix)),v=C}p.clip(v)}t.smask&&this.smaskStack.push({canvas:f.canvas,context:p,offsetX:l,offsetY:u,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null}),(!t.smask||this.dependencyTracker)&&(r.setTransform(1,0,0,1,0,0),r.translate(l,u),r.save()),kc(r,p),this.ctx=p,(m=this.dependencyTracker)==null||m.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(r),this.setGState(e,[["BM","source-over"],["ca",1],["CA",1],["TR",null]]),this.groupStack.push(r),this.groupLevel++}endGroup(e,t){var i;if(!this.contentVisible)return;this.groupLevel--;const n=this.ctx,r=this.groupStack.pop();if(r===null){this.restore(e);return}if(this.ctx=r,this.ctx.imageSmoothingEnabled=!1,(i=this.dependencyTracker)==null||i.popBaseTransform(),t.smask)this.tempSMask=this.smaskStack.pop(),this.restore(e),this.dependencyTracker&&(this.ctx.restore(),this.inSMaskMode&&this.ctx.setTransform(this.suspendedCtx.getTransform()));else{this.ctx.restore();const s=Yt(this.ctx);this.restore(e),this.ctx.save(),this.ctx.setTransform(...s);const o=So.slice();_.axialAlignedBoundingBox([0,0,n.canvas.width,n.canvas.height],s,o),this.ctx.drawImage(n.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy({canvas:n.canvas,context:n}),this.compose(o)}}beginAnnotation(e,t,n,r,i,s){if(A(this,Wr,Ay).call(this),dg(this.ctx),this.ctx.save(),this.save(e),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),n){const o=n[2]-n[0],l=n[3]-n[1];if(s&&this.annotationCanvasMap){r=r.slice(),r[4]-=n[0],r[5]-=n[1],n=n.slice(),n[0]=n[1]=0,n[2]=o,n[3]=l,_.singularValueDecompose2dScale(Yt(this.ctx),Yn);const{viewportScale:u}=this,c=Math.ceil(o*this.outputScaleX*u),d=Math.ceil(l*this.outputScaleY*u);this.annotationCanvas=this.canvasFactory.create(c,d);const{canvas:f,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(t,f),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.save(),this.ctx.setTransform(Yn[0],0,0,-Yn[1],0,l*Yn[1]),dg(this.ctx)}else{dg(this.ctx),this.endPath(e);const u=new Path2D;u.rect(n[0],n[1],o,l),this.ctx.clip(u)}}this.current=new Xb(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(e,...r),this.transform(e,...i),this.baseTransform=Yt(this.ctx)}endAnnotation(e){this.annotationCanvas&&(this.ctx.restore(),A(this,Wr,Ey).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas),this.baseTransform=this.baseTransformStack.pop()}paintImageMaskXObject(e,t){var o;if(!this.contentVisible)return;const n=t.count;t=this.getObject(e,t.data,t),t.count=n;const r=this.ctx,i=this._createMaskCanvas(e,t),s=i.canvas;r.save(),r.setTransform(1,0,0,1,0,0),r.drawImage(s,i.offsetX,i.offsetY),(o=this.dependencyTracker)==null||o.resetBBox(e).recordBBox(e,this.ctx,i.offsetX,i.offsetX+s.width,i.offsetY,i.offsetY+s.height).recordOperation(e),r.restore(),i.canvasEntry&&this.canvasFactory.destroy(i.canvasEntry),this.compose()}paintImageMaskXObjectRepeat(e,t,n,r=0,i=0,s,o){var d,f,p;if(!this.contentVisible)return;t=this.getObject(e,t.data,t);const l=this.ctx;l.save();const u=Yt(l);l.transform(n,r,i,s,0,0);const c=this._createMaskCanvas(e,t);l.setTransform(1,0,0,1,c.offsetX-u[4],c.offsetY-u[5]),(d=this.dependencyTracker)==null||d.resetBBox(e);for(let m=0,v=o.length;md?c/d:1,o=u>d?u/d:1}}this._cachedScaleForStroking[0]=s,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(e,t){const{ctx:n,current:{lineWidth:r}}=this,[i,s]=this.getScaleForStroking();if(i===s){n.lineWidth=(r||1)*i,n.stroke(e);return}const o=n.getLineDash();t&&n.save(),n.scale(i,s),Iv.a=1/i,Iv.d=1/s;const l=new Path2D;if(l.addPath(e,Iv),o.length>0){const u=Math.max(i,s);n.setLineDash(o.map(c=>c/u)),n.lineDashOffset/=u}n.lineWidth=r||1,n.stroke(l),t&&n.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};Wr=new WeakSet,Ay=function(){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.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null)},Ey=function(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}},wy=function(e,t,n){const r=new Path2D;return r.addPath(e,new DOMMatrix(n).invertSelf().multiplySelf(t)),r};let Fh=bb;for(const h in Mi)Fh.prototype[h]!==void 0&&(Fh.prototype[Mi[h]]=Fh.prototype[h]);var uf,cf;class gv{constructor(e,t,n){b(this,uf,null);b(this,cf,null);M(this,"_fullReader",null);M(this,"_rangeReaders",new Set);M(this,"_source",null);this._source=e,g(this,uf,t),g(this,cf,n)}get _progressiveDataLength(){var e;return((e=this._fullReader)==null?void 0:e._loaded)??0}getFullReader(){return ne(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new(a(this,uf))(this)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new(a(this,cf))(this,e,t);return this._rangeReaders.add(n),n}cancelAllRequests(e){var t;(t=this._fullReader)==null||t.cancel(e);for(const n of new Set(this._rangeReaders))n.cancel(e)}}uf=new WeakMap,cf=new WeakMap;class mv{constructor(e){M(this,"onProgress",null);M(this,"_contentLength",0);M(this,"_filename",null);M(this,"_headersCapability",Promise.withResolvers());M(this,"_isRangeSupported",!1);M(this,"_isStreamingSupported",!1);M(this,"_loaded",0);M(this,"_stream",null);this._stream=e}_callOnProgress(){var e;(e=this.onProgress)==null||e.call(this,{loaded:this._loaded,total:this._contentLength})}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(){Ot("Abstract method `read` called")}cancel(e){Ot("Abstract method `cancel` called")}}class vv{constructor(e,t,n){M(this,"_stream",null);this._stream=e}async read(){Ot("Abstract method `read` called")}cancel(e){Ot("Abstract method `cancel` called")}}function kS(h){let e=!0,t=n("filename\\*","i").exec(h);if(t){t=t[1];let c=o(t);return c=unescape(c),c=l(c),c=u(c),i(c)}if(t=s(h),t){const c=u(t);return i(c)}if(t=n("filename","i").exec(h),t){t=t[1];let c=o(t);return c=u(c),i(c)}function n(c,d){return new RegExp("(?:^|;)\\s*"+c+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',d)}function r(c,d){if(c){if(!/^[\x00-\xFF]+$/.test(d))return d;try{const f=new TextDecoder(c,{fatal:!0}),p=dv(d);d=f.decode(p),e=!1}catch{}}return d}function i(c){return e&&/[\x80-\xff]/.test(c)&&(c=r("utf-8",c),e&&(c=r("iso-8859-1",c))),c}function s(c){const d=[];let f;const p=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=p.exec(c))!==null;){let[,v,y,E]=f;if(v=parseInt(v,10),v in d){if(v===0)break;continue}d[v]=[y,E]}const m=[];for(let v=0;v{t._responseOrigin=yv(u.url),XA(u.status,s),this._reader=u.body.getReader();const c=u.headers,{contentLength:d,isRangeSupported:f}=VA({responseHeaders:c,isHttp:!0,rangeChunkSize:i,disableRange:n});this._contentLength=d,this._isRangeSupported=f,this._filename=WA(c),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new ho("Streaming is disabled.")),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;const{value:t,done:n}=await this._reader.read();return n?{value:t,done:n}:(this._loaded+=t.byteLength,this._callOnProgress(),{value:Av(t),done:!1})}cancel(t){var n;(n=this._reader)==null||n.cancel(t),this._abortController.abort()}}class $S extends vv{constructor(t,n,r){super(t,n,r);M(this,"_abortController",new AbortController);M(this,"_readCapability",Promise.withResolvers());M(this,"_reader",null);const{url:i,withCredentials:s}=t._source,o=new Headers(t.headers);o.append("Range",`bytes=${n}-${r-1}`),GA(i,o,s,this._abortController).then(l=>{const u=yv(l.url);zA(u,t._responseOrigin),XA(l.status,i),this._reader=l.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;const{value:t,done:n}=await this._reader.read();return n?{value:t,done:n}:{value:Av(t),done:!1}}cancel(t){var n;(n=this._reader)==null||n.cancel(t),this._abortController.abort()}}ut(116);function Zb(h){return h instanceof Uint8Array&&h.byteLength===h.buffer.byteLength?h.buffer:new Uint8Array(h).buffer}function Ev(){for(const h of this._requests)h.resolve({value:void 0,done:!0});this._requests.length=0}var _m,_A;class HS extends gv{constructor(t){super(t,VS,WS);b(this,_m);M(this,"_progressiveDone",!1);M(this,"_queuedChunks",[]);const{pdfDataRangeTransport:n}=t,{initialData:r,progressiveDone:i}=n;if((r==null?void 0:r.length)>0){const o=Zb(r);this._queuedChunks.push(o)}this._progressiveDone=i;const s=o=>{var l;switch(o.type){case"range":case"progressiveRead":A(this,_m,_A).call(this,o.begin,o.chunk);break;case"progressiveDone":(l=this._fullReader)==null||l.progressiveDone(),this._progressiveDone=!0;break}};n.transportReady(s)}getFullReader(){const t=super.getFullReader();return this._queuedChunks=null,t}getRangeReader(t,n){const r=super.getRangeReader(t,n);return r&&(r.onDone=()=>this._rangeReaders.delete(r),this._source.pdfDataRangeTransport.requestDataRange(t,n)),r}cancelAllRequests(t){super.cancelAllRequests(t),this._source.pdfDataRangeTransport.abort()}}_m=new WeakSet,_A=function(t,n){const r=Zb(n);if(t===void 0)this._fullReader?this._fullReader._enqueue(r):this._queuedChunks.push(r);else{const i=this._rangeReaders.keys().find(s=>s._begin===t);ne(i,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),i._enqueue(r)}};var df;class VS extends mv{constructor(t){super(t);b(this,df,Ev.bind(this));M(this,"_done",!1);M(this,"_queuedChunks",null);M(this,"_requests",[]);const{pdfDataRangeTransport:n,disableRange:r,disableStream:i}=t._source,{length:s,contentDispositionFilename:o}=n;this._queuedChunks=t._queuedChunks||[];for(const u of this._queuedChunks)this._loaded+=u.byteLength;this._done=t._progressiveDone,this._contentLength=s,this._isStreamingSupported=!i,this._isRangeSupported=!r,sb(o)&&(this._filename=o),this._headersCapability.resolve();const l=this._loaded;Promise.resolve().then(()=>{l>0&&this._loaded===l&&this._callOnProgress()})}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength,this._callOnProgress())}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,a(this,df).call(this)}progressiveDone(){this._done||(this._done=!0),this._queuedChunks.length===0&&a(this,df).call(this)}}df=new WeakMap;var ff;class WS extends vv{constructor(t,n,r){super(t,n,r);b(this,ff,Ev.bind(this));M(this,"onDone",null);M(this,"_begin",-1);M(this,"_done",!1);M(this,"_queuedChunk",null);M(this,"_requests",[]);this._begin=n}_enqueue(t){var n;this._done||(this._requests.length===0?this._queuedChunk=t:(this._requests.shift().resolve({value:t,done:!1}),a(this,ff).call(this)),this._done=!0,(n=this.onDone)==null||n.call(this))}async read(){if(this._queuedChunk){const n=this._queuedChunk;return this._queuedChunk=null,{value:n,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){var n;this._done=!0,a(this,ff).call(this),(n=this.onDone)==null||n.call(this)}}ff=new WeakMap;const Rv=200,Qb=206;function zS(h){return typeof h!="string"?h:dv(h).buffer}var ii,Mc,YA,KA;class GS extends gv{constructor(t){super(t,XS,_S);b(this,Mc);b(this,ii,new WeakMap);M(this,"_responseOrigin",null);const{httpHeaders:n,url:r}=t;this.url=r,this.isHttp=/https?:/.test(r.protocol),this.headers=HA(this.isHttp,n)}_request(t){const n=new XMLHttpRequest,r={validateStatus:null,onHeadersReceived:t.onHeadersReceived,onDone:t.onDone,onError:t.onError,onProgress:t.onProgress};a(this,ii).set(n,r),n.open("GET",this.url),n.withCredentials=this._source.withCredentials;for(const[i,s]of this.headers)n.setRequestHeader(i,s);return this.isHttp&&"begin"in t&&"end"in t?(n.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),r.validateStatus=i=>i===Qb||i===Rv):r.validateStatus=i=>i===Rv,n.responseType="arraybuffer",ne(t.onError,"Expected `onError` callback to be provided."),n.onerror=()=>t.onError(n.status),n.onreadystatechange=A(this,Mc,KA).bind(this,n),n.onprogress=A(this,Mc,YA).bind(this,n),n.send(null),n}_abortRequest(t){a(this,ii).has(t)&&(a(this,ii).delete(t),t.abort())}getRangeReader(t,n){const r=super.getRangeReader(t,n);return r&&(r.onClosed=()=>this._rangeReaders.delete(r)),r}}ii=new WeakMap,Mc=new WeakSet,YA=function(t,n){var i;const r=a(this,ii).get(t);(i=r==null?void 0:r.onProgress)==null||i.call(r,n)},KA=function(t,n){const r=a(this,ii).get(t);if(!r||(t.readyState>=2&&r.onHeadersReceived&&(r.onHeadersReceived(),delete r.onHeadersReceived),t.readyState!==4)||!a(this,ii).has(t))return;if(a(this,ii).delete(t),t.status===0&&this.isHttp){r.onError(t.status);return}const i=t.status||Rv;if(!r.validateStatus(i)){r.onError(t.status);return}const s=zS(t.response);if(i===Qb){const o=t.getResponseHeader("Content-Range");/bytes (\d+)-(\d+)\/(\d+)/.test(o)?r.onDone(s):(ht('Missing or invalid "Content-Range" header.'),r.onError(0))}else s?r.onDone(s):r.onError(t.status)};var pf,Si,JA,ZA,QA,qA;class XS extends mv{constructor(t){super(t);b(this,Si);b(this,pf,Ev.bind(this));M(this,"_cachedChunks",[]);M(this,"_done",!1);M(this,"_requests",[]);M(this,"_storedError",null);this._fullRequestXhr=t._request({onHeadersReceived:A(this,Si,JA).bind(this),onDone:A(this,Si,ZA).bind(this),onError:A(this,Si,QA).bind(this),onProgress:A(this,Si,qA).bind(this)})}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};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t),a(this,pf).call(this),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}}pf=new WeakMap,Si=new WeakSet,JA=function(){const t=this._stream,{disableRange:n,rangeChunkSize:r}=t._source,i=this._fullRequestXhr;t._responseOrigin=yv(i.responseURL);const s=i.getAllResponseHeaders(),o=new Headers(s?s.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(c=>{const[d,...f]=c.split(": ");return[d,f.join(": ")]}):[]),{contentLength:l,isRangeSupported:u}=VA({responseHeaders:o,isHttp:t.isHttp,rangeChunkSize:r,disableRange:n});this._contentLength=l,this._isRangeSupported=u,this._filename=WA(o),this._isRangeSupported&&t._abortRequest(i),this._headersCapability.resolve()},ZA=function(t){this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._cachedChunks.push(t),this._done=!0,this._cachedChunks.length===0&&a(this,pf).call(this)},QA=function(t){this._storedError=bv(t,this._stream.url),this._headersCapability.reject(this._storedError);for(const n of this._requests)n.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0},qA=function(t){var n;(n=this.onProgress)==null||n.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})};var gf,$s,tE,eE,xy;class _S extends vv{constructor(t,n,r){super(t,n,r);b(this,$s);b(this,gf,Ev.bind(this));M(this,"onClosed",null);M(this,"_done",!1);M(this,"_queuedChunk",null);M(this,"_requests",[]);M(this,"_storedError",null);this._requestXhr=t._request({begin:n,end:r,onHeadersReceived:A(this,$s,tE).bind(this),onDone:A(this,$s,eE).bind(this),onError:A(this,$s,xy).bind(this),onProgress:null})}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const n=this._queuedChunk;return this._queuedChunk=null,{value:n,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){var n;this._done=!0,a(this,gf).call(this),this._stream._abortRequest(this._requestXhr),(n=this.onClosed)==null||n.call(this)}}gf=new WeakMap,$s=new WeakSet,tE=function(){var n;const t=yv((n=this._requestXhr)==null?void 0:n.responseURL);try{zA(t,this._stream._responseOrigin)}catch(r){this._storedError=r,A(this,$s,xy).call(this,0)}},eE=function(t){var n;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0,a(this,gf).call(this),(n=this.onClosed)==null||n.call(this)},xy=function(t){this._storedError??(this._storedError=bv(t,this._stream.url));for(const n of this._requests)n.reject(this._storedError);this._requests.length=0,this._queuedChunk=null};function nE(h,e=null){const t=process.getBuiltinModule("fs"),{Readable:n}=process.getBuiltinModule("stream"),r=t.createReadStream(h,e);return n.toWeb(r)}class YS extends gv{constructor(e){super(e,KS,JS);const{url:t}=e;ne(t.protocol==="file:","PDFNodeStream only supports file:// URLs.")}}class KS extends mv{constructor(t){super(t);M(this,"_reader",null);const{disableRange:n,disableStream:r,rangeChunkSize:i,url:s}=t._source;this._isStreamingSupported=!r,process.getBuiltinModule("fs/promises").lstat(s).then(l=>{const u=nE(s);this._reader=u.getReader();const{size:c}=l;this._contentLength=c,this._isRangeSupported=!n&&c>2*i,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new ho("Streaming is disabled.")),this._headersCapability.resolve()}).catch(l=>{l.code==="ENOENT"&&(l=bv(0,s)),this._headersCapability.reject(l)})}async read(){await this._headersCapability.promise;const{value:t,done:n}=await this._reader.read();return n?{value:t,done:n}:(this._loaded+=t.byteLength,this._callOnProgress(),{value:Av(t),done:!1})}cancel(t){var n;(n=this._reader)==null||n.cancel(t)}}class JS extends vv{constructor(t,n,r){super(t,n,r);M(this,"_readCapability",Promise.withResolvers());M(this,"_reader",null);const{url:i}=t._source;try{const s=nE(i,{start:n,end:r-1});this._reader=s.getReader(),this._readCapability.resolve()}catch(s){this._readCapability.reject(s)}}async read(){await this._readCapability.promise;const{value:t,done:n}=await this._reader.read();return n?{value:t,done:n}:{value:Av(t),done:!1}}cancel(t){var n;(n=this._reader)==null||n.cancel(t)}}function ZS(h){return vd(h)?jS:_n?YS:GS}var Eg,mf,vf;let Ys=(Eg=class{static get workerPort(){return a(this,mf)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");g(this,mf,e)}static get workerSrc(){return a(this,vf)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");g(this,vf,e)}},mf=new WeakMap,vf=new WeakMap,b(Eg,mf,null),b(Eg,vf,""),Eg);var fu,yf;class QS{constructor({parsedData:e,rawData:t}){b(this,fu);b(this,yf);g(this,fu,e),g(this,yf,t)}getRaw(){return a(this,yf)}get(e){return a(this,fu).get(e)??null}[Symbol.iterator](){return a(this,fu).entries()}}fu=new WeakMap,yf=new WeakMap;const Eh=Symbol("INTERNAL");var bf,Af,Ef,pu;class qS{constructor(e,{name:t,intent:n,usage:r,rbGroups:i}){b(this,bf,!1);b(this,Af,!1);b(this,Ef,!1);b(this,pu,!0);g(this,bf,!!(e&Xn.DISPLAY)),g(this,Af,!!(e&Xn.PRINT)),this.name=t,this.intent=n,this.usage=r,this.rbGroups=i}get visible(){if(a(this,Ef))return a(this,pu);if(!a(this,pu))return!1;const{print:e,view:t}=this.usage;return a(this,bf)?(t==null?void 0:t.viewState)!=="OFF":a(this,Af)?(e==null?void 0:e.printState)!=="OFF":!0}_setVisible(e,t,n=!1){e!==Eh&&Ot("Internal method `_setVisible` called."),g(this,Ef,n),g(this,pu,t)}}bf=new WeakMap,Af=new WeakMap,Ef=new WeakMap,pu=new WeakMap;var Aa,Ht,gu,mu,wf,Sy;class tC{constructor(e,t=Xn.DISPLAY){b(this,wf);b(this,Aa,null);b(this,Ht,new Map);b(this,gu,null);b(this,mu,null);if(this.renderingIntent=t,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,g(this,mu,e.order);for(const n of e.groups)a(this,Ht).set(n.id,new qS(t,n));if(e.baseState==="OFF")for(const n of a(this,Ht).values())n._setVisible(Eh,!1);for(const n of e.on)a(this,Ht).get(n)._setVisible(Eh,!0);for(const n of e.off)a(this,Ht).get(n)._setVisible(Eh,!1);g(this,gu,this.getHash())}}isVisible(e){if(a(this,Ht).size===0)return!0;if(!e)return cv("Optional content group not defined."),!0;if(e.type==="OCG")return a(this,Ht).has(e.id)?a(this,Ht).get(e.id).visible:(ht(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return A(this,wf,Sy).call(this,e.expression);if(!e.policy||e.policy==="AnyOn"){for(const t of e.ids){if(!a(this,Ht).has(t))return ht(`Optional content group not found: ${t}`),!0;if(a(this,Ht).get(t).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const t of e.ids){if(!a(this,Ht).has(t))return ht(`Optional content group not found: ${t}`),!0;if(!a(this,Ht).get(t).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const t of e.ids){if(!a(this,Ht).has(t))return ht(`Optional content group not found: ${t}`),!0;if(!a(this,Ht).get(t).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const t of e.ids){if(!a(this,Ht).has(t))return ht(`Optional content group not found: ${t}`),!0;if(a(this,Ht).get(t).visible)return!1}return!0}return ht(`Unknown optional content policy ${e.policy}.`),!0}return ht(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,n=!0){var i;const r=a(this,Ht).get(e);if(!r){ht(`Optional content group not found: ${e}`);return}if(n&&t&&r.rbGroups.length)for(const s of r.rbGroups)for(const o of s)o!==e&&((i=a(this,Ht).get(o))==null||i._setVisible(Eh,!1,!0));r._setVisible(Eh,!!t,!0),g(this,Aa,null)}setOCGState({state:e,preserveRB:t}){let n;for(const r of e){switch(r){case"ON":case"OFF":case"Toggle":n=r;continue}const i=a(this,Ht).get(r);if(i)switch(n){case"ON":this.setVisibility(r,!0,t);break;case"OFF":this.setVisibility(r,!1,t);break;case"Toggle":this.setVisibility(r,!i.visible,t);break}}g(this,Aa,null)}get hasInitialVisibility(){return a(this,gu)===null||this.getHash()===a(this,gu)}getOrder(){return a(this,Ht).size?a(this,mu)?a(this,mu).slice():[...a(this,Ht).keys()]:null}getGroup(e){return a(this,Ht).get(e)||null}getHash(){if(a(this,Aa)!==null)return a(this,Aa);const e=new dy;for(const[t,n]of a(this,Ht))e.update(`${t}:${n.visible}`);return g(this,Aa,e.hexdigest())}[Symbol.iterator](){return a(this,Ht).entries()}}Aa=new WeakMap,Ht=new WeakMap,gu=new WeakMap,mu=new WeakMap,wf=new WeakSet,Sy=function(e){const t=e.length;if(t<2)return!0;const n=e[0];for(let r=1;rf===p+1)&&g(this,de,null)}deletePages(e){A(this,en,ed).call(this);const t=a(this,de),n=A(this,en,nd).call(this);g(this,si,{pageNumberToId:t.slice(),pagesNumber:a(this,$e),prevPageNumbers:a(this,Rr).slice()});const r=a(this,$e)-e.length;g(this,$e,r);const i=g(this,de,new Uint32Array(r));g(this,Rr,new Int32Array(r));let s=0,o=0;for(const l of e){const u=l-1;u!==s&&(i.set(t.subarray(s,u),o),o+=u-s),s=u+1}sa(this,de)[t-1])})}cancelCopy(){g(this,sl,null)}pastePages(e){A(this,en,ed).call(this);const t=a(this,de),n=A(this,en,nd).call(this),{pageNumbers:r,pageIds:i}=a(this,sl),s=a(this,$e)+r.length;g(this,$e,s);const o=g(this,de,new Uint32Array(s));g(this,Rr,new Int32Array(s)),o.set(t.subarray(0,e),0),o.set(i,e),o.set(t.subarray(e),e+r.length),A(this,en,Ng).call(this,n,null,e,r),g(this,sl,null)}hasBeenAltered(){return a(this,de)!==null}getPageMappingForSaving(e=null){e??(e=A(this,en,nd).call(this));let t=0;for(const r of e.values())t=Math.max(t,r.length);const n=new Array(t);for(let r=0;rs[0]-o[0]);for(let s=0,o=r.length;sn-r);const t=new Map;for(let n=0,r=e.length;n=n&&u({...Promise.withResolvers(),data:wh});var ur;class rE{constructor(){b(this,ur,new Map)}get(e,t=null){if(t){const r=a(this,ur).getOrInsertComputed(e,qb);return r.promise.then(()=>t(r.data)),null}const n=a(this,ur).get(e);if(!n||n.data===wh)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){const t=a(this,ur).get(e);return!!t&&t.data!==wh}delete(e){const t=a(this,ur).get(e);return!t||t.data===wh?!1:(a(this,ur).delete(e),!0)}resolve(e,t=null){const n=a(this,ur).getOrInsertComputed(e,qb);if(n.data!==wh)throw new Error(`Object already resolved ${e}.`);n.data=t,n.resolve()}clear(){var e;for(const{data:t}of a(this,ur).values())(e=t==null?void 0:t.bitmap)==null||e.close();a(this,ur).clear()}*[Symbol.iterator](){for(const[e,{data:t}]of a(this,ur))t!==wh&&(yield[e,t])}}ur=new WeakMap;const nC=1e5,t1=30;var $1,Ea,on,xf,Sf,vu,al,Qi,Cf,Tf,ol,Pf,yu,wa,bu,If,Au,ll,Rf,Ff,ye,Eu,hl,Df,wu,xu,Hs,iE,sE,Cy,Jn,Bg,Ty,aE,oE;let xm=(ye=class{constructor({textContentSource:e,images:t,container:n,viewport:r}){b(this,Hs);b(this,Ea,Promise.withResolvers());b(this,on,null);b(this,xf,!1);b(this,Sf,!!(($1=globalThis.FontInspector)!=null&&$1.enabled));b(this,vu,null);b(this,al,null);b(this,Qi,null);b(this,Cf,0);b(this,Tf,0);b(this,ol,null);b(this,Pf,null);b(this,yu,0);b(this,wa,0);b(this,bu,Object.create(null));b(this,If,[]);b(this,Au,null);b(this,ll,[]);b(this,Rf,new WeakMap);b(this,Ff,null);var u;if(e instanceof ReadableStream)g(this,Au,e);else if(typeof e=="object")g(this,Au,new ReadableStream({start(c){c.enqueue(e),c.close()}}));else throw new Error('No "textContentSource" parameter specified.');g(this,on,g(this,Pf,n)),g(this,vu,t),g(this,wa,r.scale*uh.pixelRatio),g(this,yu,r.rotation),g(this,Qi,{div:null,properties:null,ctx:null});const{pageWidth:i,pageHeight:s,pageX:o,pageY:l}=r.rawDims;g(this,Ff,[1,0,0,-1,-o,l+s]),g(this,Tf,i),g(this,Cf,s),A(u=ye,Jn,aE).call(u),n.style.setProperty("--min-font-size",a(ye,wu)),hh(n,r),a(this,Ea).promise.finally(()=>{a(ye,xu).delete(this),g(this,Qi,null),g(this,bu,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:t}=be.platform;return dt(this,"fontFamilyMap",new Map([["sans-serif",`${e&&t?"Calibri, ":""}sans-serif`],["monospace",`${e&&t?"Lucida Console, ":""}monospace`]]))}render(){a(this,vu)&&a(this,on).append(a(this,vu).render());const e=()=>{a(this,ol).read().then(({value:t,done:n})=>{if(n){a(this,Ea).resolve();return}a(this,al)??g(this,al,t.lang),Object.assign(a(this,bu),t.styles),A(this,Hs,iE).call(this,t.items),e()},a(this,Ea).reject)};return g(this,ol,a(this,Au).getReader()),a(ye,xu).add(this),e(),a(this,Ea).promise}update({viewport:e,onBefore:t=null}){var i;const n=e.scale*uh.pixelRatio,r=e.rotation;if(r!==a(this,yu)&&(t==null||t(),g(this,yu,r),hh(a(this,Pf),{rotation:r})),n!==a(this,wa)){t==null||t(),g(this,wa,n);const s={div:null,properties:null,ctx:A(i=ye,Jn,Bg).call(i,a(this,al))};for(const o of a(this,ll))s.properties=a(this,Rf).get(o),s.div=o,A(this,Hs,Cy).call(this,s)}}cancel(){var t;const e=new ho("TextLayer task cancelled.");(t=a(this,ol))==null||t.cancel(e).catch(()=>{}),g(this,ol,null),a(this,Ea).reject(e)}get textDivs(){return a(this,ll)}get textContentItemsStr(){return a(this,If)}static cleanup(){if(!(a(this,xu).size>0)){a(this,Eu).clear();for(const{canvas:e}of a(this,hl).values())e.remove();a(this,hl).clear()}}},Ea=new WeakMap,on=new WeakMap,xf=new WeakMap,Sf=new WeakMap,vu=new WeakMap,al=new WeakMap,Qi=new WeakMap,Cf=new WeakMap,Tf=new WeakMap,ol=new WeakMap,Pf=new WeakMap,yu=new WeakMap,wa=new WeakMap,bu=new WeakMap,If=new WeakMap,Au=new WeakMap,ll=new WeakMap,Rf=new WeakMap,Ff=new WeakMap,Eu=new WeakMap,hl=new WeakMap,Df=new WeakMap,wu=new WeakMap,xu=new WeakMap,Hs=new WeakSet,iE=function(e){var r,i;if(a(this,xf))return;(i=a(this,Qi)).ctx??(i.ctx=A(r=ye,Jn,Bg).call(r,a(this,al)));const t=a(this,ll),n=a(this,If);for(const s of e){if(t.length>nC){ht("Ignoring additional textDivs for performance reasons."),g(this,xf,!0);return}if(s.str===void 0){if(s.type==="beginMarkedContentProps"||s.type==="beginMarkedContent"){const o=a(this,on);g(this,on,document.createElement("span")),a(this,on).classList.add("markedContent"),s.id&&a(this,on).setAttribute("id",`${s.id}`),s.tag==="Artifact"&&(a(this,on).ariaHidden=!0),o.append(a(this,on))}else s.type==="endMarkedContent"&&g(this,on,a(this,on).parentNode);continue}n.push(s.str),A(this,Hs,sE).call(this,s)}},sE=function(e){var m;const t=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};a(this,ll).push(t);const r=_.transform(a(this,Ff),e.transform);let i=Math.atan2(r[1],r[0]);const s=a(this,bu)[e.fontName];s.vertical&&(i+=Math.PI/2);let o=a(this,Sf)&&s.fontSubstitution||s.fontFamily;o=ye.fontFamilyMap.get(o)||o;const l=Math.hypot(r[2],r[3]),u=l*A(m=ye,Jn,oE).call(m,o,s,a(this,al));let c,d;i===0?(c=r[4],d=r[5]-u):(c=r[4]+u*Math.sin(i),d=r[5]-u*Math.cos(i));const f=t.style;f.left=`${(100*c/a(this,Tf)).toFixed(2)}%`,f.top=`${(100*d/a(this,Cf)).toFixed(2)}%`,f.setProperty("--font-height",`${l.toFixed(2)}px`),f.fontFamily=o,n.fontSize=l,t.setAttribute("role","presentation"),t.textContent=e.str,t.dir=e.dir,a(this,Sf)&&(t.dataset.fontName=s.fontSubstitutionLoadedName||e.fontName),i!==0&&(n.angle=i*(180/Math.PI));let p=!1;if(e.str.length>1)p=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const v=Math.abs(e.transform[0]),y=Math.abs(e.transform[3]);v!==y&&Math.max(v,y)/Math.min(v,y)>1.5&&(p=!0)}if(p&&(n.canvasWidth=s.vertical?e.height:e.width),a(this,Rf).set(t,n),a(this,Qi).div=t,a(this,Qi).properties=n,A(this,Hs,Cy).call(this,a(this,Qi)),n.hasText&&a(this,on).append(t),n.hasEOL){const v=document.createElement("br");v.setAttribute("role","presentation"),a(this,on).append(v)}},Cy=function(e){var s;const{div:t,properties:n,ctx:r}=e,{style:i}=t;if(n.canvasWidth!==0&&n.hasText){const{fontFamily:o}=i,{canvasWidth:l,fontSize:u}=n;A(s=ye,Jn,Ty).call(s,r,u*a(this,wa),o);const{width:c}=r.measureText(t.textContent);c>0&&i.setProperty("--scale-x",l*a(this,wa)/c)}n.angle!==0&&i.setProperty("--rotate",`${n.angle}deg`)},Jn=new WeakSet,Bg=function(e=null){let t=a(this,hl).get(e||(e=""));if(!t){const n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=e,document.body.append(n),t=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),a(this,hl).set(e,t),a(this,Df).set(t,{size:0,family:""})}return t},Ty=function(e,t,n){const r=a(this,Df).get(e);t===r.size&&n===r.family||(e.font=`${t}px ${n}`,r.size=t,r.family=n)},aE=function(){if(a(this,wu)!==null)return;const 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),g(this,wu,e.getBoundingClientRect().height),e.remove()},oE=function(e,t,n){const r=a(this,Eu).get(e);if(r)return r;const i=A(this,Jn,Bg).call(this,n);i.canvas.width=i.canvas.height=t1,A(this,Jn,Ty).call(this,i,t1,e);const s=i.measureText(""),o=s.fontBoundingBoxAscent,l=Math.abs(s.fontBoundingBoxDescent);i.canvas.width=i.canvas.height=0;let u=.8;return o?u=o/(o+l):(be.platform.isFirefox&&ht("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),t.ascent?u=t.ascent:t.descent&&(u=1+t.descent)),a(this,Eu).set(e,u),u},b(ye,Jn),b(ye,Eu,new Map),b(ye,hl,new Map),b(ye,Df,new WeakMap),b(ye,wu,null),b(ye,xu,new Set),ye);const rC=100;function lE(h={}){typeof h=="string"||h instanceof URL?h={url:h}:(h instanceof ArrayBuffer||ArrayBuffer.isView(h))&&(h={data:h});const e=new Py,{docId:t}=e,n=h.url?hS(h.url):null,r=h.data?uS(h.data):null,i=h.httpHeaders||null,s=h.withCredentials===!0,o=h.password??null,l=h.range instanceof hE?h.range:null,u=Number.isInteger(h.rangeChunkSize)&&h.rangeChunkSize>0?h.rangeChunkSize:2**16;let c=h.worker instanceof Ry?h.worker:null;const d=h.verbosity,f=typeof h.docBaseUrl=="string"&&!fv(h.docBaseUrl)?h.docBaseUrl:null,p=hg(h.cMapUrl),m=h.cMapPacked!==!1,v=hg(h.iccUrl),y=hg(h.standardFontDataUrl),E=hg(h.wasmUrl),S=h.stopAtErrors!==!0,w=Number.isInteger(h.maxImageSize)&&h.maxImageSize>-1?h.maxImageSize:-1,C=typeof h.isOffscreenCanvasSupported=="boolean"?h.isOffscreenCanvasSupported:!_n,x=typeof h.isImageDecoderSupported=="boolean"?h.isImageDecoderSupported:!_n&&(be.platform.isFirefox||!globalThis.chrome),T=Number.isInteger(h.canvasMaxAreaInBytes)?h.canvasMaxAreaInBytes:-1,I=typeof h.disableFontFace=="boolean"?h.disableFontFace:_n,F=h.fontExtraProperties===!0,P=h.enableXfa===!0,R=h.ownerDocument||globalThis.document,D=h.disableRange===!0,k=h.disableStream===!0,N=h.disableAutoFetch===!0,H=h.pdfBug===!0,X=h.CanvasFactory||(_n?yS:pS),j=h.FilterFactory||(_n?vS:gS),U=h.BinaryDataFactory||(_n?bS:Hb),z=h.enableHWA===!0,nt=h.enableWebGPU===!0?wS():Promise.resolve(!1),pt=h.useWasm!==!1,it=h.pagesMapper||new eC,K=typeof h.useSystemFonts=="boolean"?h.useSystemFonts:!_n&&!I,lt=typeof h.useWorkerFetch=="boolean"?h.useWorkerFetch:!!(U===Hb&&p&&m&&y&&E&&vd(p,document.baseURI)&&vd(y,document.baseURI)&&vd(E,document.baseURI)),st=null;Dx(d);const B={canvasFactory:new X({ownerDocument:R,enableHWA:z}),filterFactory:new j({docId:t,ownerDocument:R}),binaryDataFactory:lt?null:new U({cMapUrl:p,standardFontDataUrl:y,wasmUrl:E})};c||(c=Ry.create({verbosity:d,port:Ys.workerPort}),e._worker=c);const O={docId:t,apiVersion:"5.7.284",data:r,password:o,disableAutoFetch:N,rangeChunkSize:u,docBaseUrl:f,enableXfa:P,evaluatorOptions:{maxImageSize:w,disableFontFace:I,ignoreErrors:S,isOffscreenCanvasSupported:C,isImageDecoderSupported:x,canvasMaxAreaInBytes:T,fontExtraProperties:F,useSystemFonts:K,useWasm:pt,useWorkerFetch:lt,cMapUrl:p,cMapPacked:m,iccUrl:v,standardFontDataUrl:y,wasmUrl:E,hasGPU:!1}},L={ownerDocument:R,pdfBug:H,styleElement:st,enableHWA:z,loadingParams:{disableAutoFetch:N,enableXfa:P}};return Promise.all([c.promise,nt]).then(function([,V]){if(e.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");O.evaluatorOptions.hasGPU=V;const Z=c.messageHandler.sendWithPromise("GetDocRequest",O,r?[r.buffer]:null);let W;if(!r)if(l)W=new HS({pdfDataRangeTransport:l,disableRange:D,disableStream:k});else if(n){const Y=ZS(n);W=new Y({url:n,httpHeaders:i,withCredentials:s,rangeChunkSize:u,disableRange:D,disableStream:k})}else throw new Error("getDocument - expected either `data`, `range`, or `url` parameter.");return Z.then(Y=>{if(e.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");const at=new Jc(t,Y,c.port),Tt=new sC(at,e,W,L,B,it);e._transport=Tt,at.send("Ready",null)})}).catch(e._capability.reject),e}var Ym;const Km=class Km{constructor(){M(this,"_capability",Promise.withResolvers());M(this,"_transport",null);M(this,"_worker",null);M(this,"docId",`d${ie(Km,Ym)._++}`);M(this,"destroyed",!1);M(this,"onPassword",null);M(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var e,t,n,r;this.destroyed=!0;try{(e=this._worker)!=null&&e.port&&(this._worker._pendingDestroy=!0),await((t=this._transport)==null?void 0:t.destroy())}catch(i){throw(n=this._worker)!=null&&n.port&&delete this._worker._pendingDestroy,i}this._transport=null,(r=this._worker)==null||r.destroy(),this._worker=null}async getData(){return this._transport.getData()}};Ym=new WeakMap,b(Km,Ym,0);let Py=Km;var Su,ul,H1;let hE=(H1=class{constructor(e,t,n=!1,r=null){b(this,Su,Promise.withResolvers());b(this,ul,null);this.length=e,this.initialData=t,this.progressiveDone=n,this.contentDispositionFilename=r,Object.defineProperty(this,"onDataProgress",{value:()=>{Vx("`PDFDataRangeTransport.prototype.onDataProgress` - method was removed, since loading progress is now reported automatically through the `PDFDataTransportStream` class (and related code).")}})}onDataRange(e,t){a(this,ul).call(this,{type:"range",begin:e,chunk:t})}onDataProgressiveRead(e){a(this,Su).promise.then(()=>{a(this,ul).call(this,{type:"progressiveRead",chunk:e})})}onDataProgressiveDone(){a(this,Su).promise.then(()=>{a(this,ul).call(this,{type:"progressiveDone"})})}transportReady(e){g(this,ul,e),a(this,Su).resolve()}requestDataRange(e,t){Ot("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},Su=new WeakMap,ul=new WeakMap,H1);class iC{constructor(e,t){this._pdfInfo=e,this._transport=t}get pagesMapper(){return this._transport.pagesMapper}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 dt(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"}={}){const{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}getRawData(e){return this._transport.getRawData(e)}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()}}var qi,cl,dl,rd;const Ab=class Ab{constructor(e,t,n,r,i=!1){b(this,dl);b(this,qi,!1);b(this,cl,null);this._pageIndex=e,this._pageInfo=t,this._transport=n,this._stats=i?new Fb:null,this._pdfBug=i,this.commonObjs=n.commonObjs,this.objs=new rE,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,g(this,cl,r),this.imageCoordinates=null}clone(e){const t=new Ab(e,this._pageInfo,this._transport,a(this,cl),this._pdfBug);return t.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(t),t}get pageNumber(){return this._pageIndex+1}set pageNumber(e){this._pageIndex=e-1,this._transport.updatePage(this)}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:r=0,dontFlip:i=!1}={}){return new ig({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:i})}getAnnotations({intent:e="display"}={}){const{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 dt(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var e;return((e=this._transport._htmlForXfa)==null?void 0:e.children[this._pageIndex])||null}render({canvasContext:e,canvas:t=e.canvas,viewport:n,intent:r="display",annotationMode:i=Ds.ENABLE,transform:s=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:u=null,pageColors:c=null,printAnnotationStorage:d=null,isEditing:f=!1,recordImages:p=!1,recordOperations:m=!1,operationsFilter:v=null}){var N,H,X;(N=this._stats)==null||N.time("Overall");const y=this._transport.getRenderingIntent(r,i,d,f),{renderingIntent:E,cacheKey:S}=y;g(this,qi,!1),l||(l=this._transport.getOptionalContentConfig(E));const w=this._intentStates.getOrInsertComputed(S,Gv);w.streamReaderCancelTimeout&&(clearTimeout(w.streamReaderCancelTimeout),w.streamReaderCancelTimeout=null);const C=!!(E&Xn.PRINT);w.displayReadyCapability||(w.displayReadyCapability=Promise.withResolvers(),w.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(H=this._stats)==null||H.time("Page Request"),this._pumpOperatorList(y));const x=!!(this._pdfBug&&((X=globalThis.StepperManager)!=null&&X.enabled)),T=!!t&&!this.recordedBBoxes&&(m||x),I=!!t&&!this.imageCoordinates&&p,F=j=>{var U,z,G,nt;if(w.renderTasks.delete(D),T){const pt=(U=D.gfx)==null?void 0:U.dependencyTracker.take();pt&&((z=D.stepper)==null||z.setOperatorBBoxes(pt,D.gfx.dependencyTracker.takeDebugMetadata()),m&&(this.recordedBBoxes=pt))}I&&!j&&(this.imageCoordinates=(G=D.gfx)==null?void 0:G.imagesTracker.take()),C&&g(this,qi,!0),A(this,dl,rd).call(this),j?(D.capability.reject(j),this._abortOperatorList({intentState:w,reason:j instanceof Error?j:new Error(j)})):D.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(nt=globalThis.Stats)!=null&&nt.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))};let P=null,R=null;(T||I)&&(R=new tS(t,w.operatorList.length)),T&&(P=new eS(R,x));const D=new Fy({callback:F,params:{canvas:t,canvasContext:e,dependencyTracker:P??R,imagesTracker:I?new gy(t):null,viewport:n,transform:s,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:w.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!C,pdfBug:this._pdfBug,pageColors:c,enableHWA:this._transport.enableHWA,operationsFilter:v});(w.renderTasks||(w.renderTasks=new Set)).add(D);const k=D.task;return Promise.all([w.displayReadyCapability.promise,l]).then(([j,U])=>{var z;if(this.destroyed){F();return}if((z=this._stats)==null||z.time("Rendering"),!(U.renderingIntent&E))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");D.initializeGraphics({transparency:j,optionalContentConfig:U}),D.operatorListChanged()}).catch(F),k}getOperatorList({intent:e="display",annotationMode:t=Ds.ENABLE,printAnnotationStorage:n=null,isEditing:r=!1}={}){var u;function i(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}const s=this._transport.getRenderingIntent(e,t,n,r,!0),o=this._intentStates.getOrInsertComputed(s.cacheKey,Gv);let l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=i,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(l),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(u=this._stats)==null||u.time("Page Request"),this._pumpOperatorList(s)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageId:a(this,cl).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:t===!0},{highWaterMark:100,size(r){return r.items.length}})}async getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(r=>Sd.textContent(r));const t=this.streamTextContent(e),n={items:[],styles:Object.create(null),lang:null};for await(const r of t)n.lang??(n.lang=r.lang),Object.assign(n.styles,r.styles),n.items.push(...r.items);return n}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const n of t.renderTasks)e.push(n.completed),n.cancel();return this.objs.clear(),g(this,qi,!1),Promise.all(e)}cleanup(e=!1){g(this,qi,!0);const t=A(this,dl,rd).call(this);return e&&t&&this._stats&&(this._stats=new Fb),t}_startRenderPage(e,t){var r,i;const n=this._intentStates.get(t);n&&((r=this._stats)==null||r.timeEnd("Page Request"),(i=n.displayReadyCapability)==null||i.resolve(e))}_renderPageChunk(e,t){for(let n=0,r=e.length;n{l.read().then(({value:d,done:f})=>{if(f){u.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(d,u),c())},d=>{if(u.streamReader=null,!this._transport.destroyed){if(u.operatorList){u.operatorList.lastChunk=!0;for(const f of u.renderTasks)f.operatorListChanged();A(this,dl,rd).call(this)}if(u.displayReadyCapability)u.displayReadyCapability.reject(d);else if(u.opListReadCapability)u.opListReadCapability.reject(d);else throw d}})};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 ib){let r=rC;t.extraDelay>0&&t.extraDelay<1e3&&(r+=t.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})},r);return}}if(e.streamReader.cancel(new ho(t.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[r,i]of this._intentStates)if(i===e){this._intentStates.delete(r);break}this.cleanup()}}}get stats(){return this._stats}};qi=new WeakMap,cl=new WeakMap,dl=new WeakSet,rd=function(){if(!a(this,qi)||this.destroyed)return!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),g(this,qi,!1),!0};let Iy=Ab;var xa,Fr,ts,fl,Kt,Jm,pl,gl,pn,kg,uE,cE,id,Cu,jg;let Ry=(Kt=class{constructor({name:e=null,port:t=null,verbosity:n=Ox()}={}){b(this,pn);b(this,xa,Promise.withResolvers());b(this,Fr,null);b(this,ts,null);b(this,fl,null);if(this.name=e,this.destroyed=!1,this.verbosity=n,t){if(a(Kt,gl).has(t))throw new Error("Cannot use more than one PDFWorker per port.");a(Kt,gl).set(t,this),A(this,pn,uE).call(this,t)}else A(this,pn,cE).call(this)}get promise(){return a(this,xa).promise}get port(){return a(this,ts)}get messageHandler(){return a(this,Fr)}destroy(){var e,t;this.destroyed=!0,(e=a(this,fl))==null||e.terminate(),g(this,fl,null),a(Kt,gl).delete(a(this,ts)),g(this,ts,null),(t=a(this,Fr))==null||t.destroy(),g(this,Fr,null)}static create(e){const t=a(this,gl).get(e==null?void 0: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 Kt(e)}static get workerSrc(){if(Ys.workerSrc)return Ys.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return dt(this,"_setupFakeWorkerGlobal",(async()=>a(this,Cu,jg)?a(this,Cu,jg):(await import(this.workerSrc)).WorkerMessageHandler)())}},xa=new WeakMap,Fr=new WeakMap,ts=new WeakMap,fl=new WeakMap,Jm=new WeakMap,pl=new WeakMap,gl=new WeakMap,pn=new WeakSet,kg=function(){a(this,xa).resolve(),a(this,Fr).send("configure",{verbosity:this.verbosity})},uE=function(e){g(this,ts,e),g(this,Fr,new Jc("main","worker",e)),a(this,Fr).on("ready",()=>{}),A(this,pn,kg).call(this)},cE=function(){if(a(Kt,pl)||a(Kt,Cu,jg)){A(this,pn,id).call(this);return}let{workerSrc:e}=Kt;try{Kt._isSameOrigin(window.location,e)||(e=Kt._createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e,{type:"module"}),n=new Jc("main","worker",t),r=()=>{i.abort(),n.destroy(),t.terminate(),this.destroyed?a(this,xa).reject(new Error("Worker was destroyed")):A(this,pn,id).call(this)},i=new AbortController;t.addEventListener("error",()=>{a(this,fl)||r()},{signal:i.signal}),n.on("test",o=>{if(i.abort(),this.destroyed||!o){r();return}g(this,Fr,n),g(this,ts,t),g(this,fl,t),A(this,pn,kg).call(this)}),n.on("ready",o=>{if(i.abort(),this.destroyed){r();return}try{s()}catch{A(this,pn,id).call(this)}});const s=()=>{const o=new Uint8Array;n.send("test",o,[o.buffer])};s();return}catch{cv("The worker has been disabled.")}A(this,pn,id).call(this)},id=function(){a(Kt,pl)||(ht("Setting up fake worker."),g(Kt,pl,!0)),Kt._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){a(this,xa).reject(new Error("Worker was destroyed"));return}const t=new fS;g(this,ts,t);const n=`fake${ie(Kt,Jm)._++}`,r=new Jc(n+"_worker",n,t);e.setup(r,t),g(this,Fr,new Jc(n,n+"_worker",t)),A(this,pn,kg).call(this)}).catch(e=>{a(this,xa).reject(new Error(`Setting up fake worker failed: "${e.message}".`))})},Cu=new WeakSet,jg=function(){var e;try{return((e=globalThis.pdfjsWorker)==null?void 0:e.WorkerMessageHandler)||null}catch{return null}},b(Kt,Cu),b(Kt,Jm,0),b(Kt,pl,!1),b(Kt,gl,new WeakMap),_n&&(g(Kt,pl,!0),Ys.workerSrc||(Ys.workerSrc="./pdf.worker.mjs")),Kt._isSameOrigin=(e,t)=>{const n=URL.parse(e);if(!(n!=null&&n.origin)||n.origin==="null")return!1;const r=new URL(t,n);return n.origin===r.origin},Kt._createCDNWrapper=e=>{const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))},Kt);var On,ml,es,Dr,vl,Tu,ns,Vr,sd,Ug;class sC{constructor(e,t,n,r,i,s){b(this,Vr);M(this,"downloadInfoCapability",Promise.withResolvers());b(this,On,null);b(this,ml,new Map);b(this,es,null);b(this,Dr,new Map);b(this,vl,new Map);b(this,Tu,new Map);b(this,ns,null);this.messageHandler=e,this.loadingTask=t,g(this,es,n),this.commonObjs=new rE,this.fontLoader=new nS({ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this.enableHWA=r.enableHWA,this.loadingParams=r.loadingParams,this._params=r,this.canvasFactory=i.canvasFactory,this.filterFactory=i.filterFactory,this.binaryDataFactory=i.binaryDataFactory,this.pagesMapper=s,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(e){const{_pageIndex:t}=e;a(this,Dr).set(t,e),a(this,vl).set(t,Promise.resolve(e))}get annotationStorage(){return dt(this,"annotationStorage",new ob)}getRenderingIntent(e,t=Ds.ENABLE,n=null,r=!1,i=!1){let s=Xn.DISPLAY,o=Td;switch(e){case"any":s=Xn.ANY;break;case"display":break;case"print":s=Xn.PRINT;break;default:ht(`getRenderingIntent - invalid intent: ${e}`)}const l=s&Xn.PRINT&&n instanceof FA?n:this.annotationStorage;switch(t){case Ds.DISABLE:s+=Xn.ANNOTATIONS_DISABLE;break;case Ds.ENABLE:break;case Ds.ENABLE_FORMS:s+=Xn.ANNOTATIONS_FORMS;break;case Ds.ENABLE_STORAGE:s+=Xn.ANNOTATIONS_STORAGE,o=l.serializable;break;default:ht(`getRenderingIntent - invalid annotationMode: ${t}`)}r&&(s+=Xn.IS_EDITING),i&&(s+=Xn.OPLIST);const{ids:u,hash:c}=l.modifiedIds,d=[s,o.hash,c];return{renderingIntent:s,cacheKey:d.join("_"),annotationStorageSerializable:o,modifiedIds:u}}destroy(){var n;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(n=a(this,ns))==null||n.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const r of a(this,Dr).values())e.push(r._destroy());a(this,Dr).clear(),a(this,vl).clear(),a(this,Tu).clear(),Object.hasOwn(this,"annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then(()=>{var r,i;this.commonObjs.clear(),this.fontLoader.clear(),a(this,ml).clear(),this.filterFactory.destroy(),xm.cleanup(),(r=a(this,es))==null||r.cancelAllRequests(new ho("Worker was terminated.")),(i=this.messageHandler)==null||i.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",(n,r)=>{ne(a(this,es),"GetReader - no `BasePDFStream` instance available."),g(this,On,a(this,es).getFullReader()),a(this,On).onProgress=i=>A(this,Vr,Ug).call(this,i),r.onPull=()=>{a(this,On).read().then(function({value:i,done:s}){if(s){r.close();return}ne(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),r.enqueue(new Uint8Array(i),1,[i])}).catch(i=>{r.error(i)})},r.onCancel=i=>{a(this,On).cancel(i),r.ready.catch(s=>{if(!this.destroyed)throw s})}}),e.on("ReaderHeadersReady",async n=>{await a(this,On).headersReady;const{isStreamingSupported:r,isRangeSupported:i,contentLength:s}=a(this,On);return r&&i&&(a(this,On).onProgress=null),{isStreamingSupported:r,isRangeSupported:i,contentLength:s}}),e.on("GetRangeReader",(n,r)=>{ne(a(this,es),"GetRangeReader - no `BasePDFStream` instance available.");const i=a(this,es).getRangeReader(n.begin,n.end);if(!i){r.close();return}r.onPull=()=>{i.read().then(function({value:s,done:o}){if(o){r.close();return}ne(s instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),r.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{r.error(s)})},r.onCancel=s=>{i.cancel(s),r.ready.catch(o=>{if(!this.destroyed)throw o})}}),e.on("GetDoc",({pdfInfo:n})=>{this.pagesMapper.pagesNumber=n.numPages,this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,t._capability.resolve(new iC(n,this))}),e.on("DocException",n=>{t._capability.reject(mn(n))}),e.on("PasswordRequest",n=>{g(this,ns,Promise.withResolvers());try{if(!t.onPassword)throw mn(n);const r=i=>{i instanceof Error?a(this,ns).reject(i):a(this,ns).resolve({password:i})};t.onPassword(r,n.code)}catch(r){a(this,ns).reject(r)}return a(this,ns).promise}),e.on("DataLoaded",n=>{A(this,Vr,Ug).call(this,{loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),e.on("StartRenderPage",n=>{if(this.destroyed)return;a(this,Dr).get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),e.on("commonobj",([n,r,i])=>{var s;if(this.destroyed||this.commonObjs.has(n))return null;switch(r){case"Font":if("error"in i){const f=i.error;ht(`Error during font loading: ${f}`),this.commonObjs.resolve(n,f);break}const o=new aS(i),l=this._params.pdfBug&&((s=globalThis.FontInspector)!=null&&s.enabled)?(f,p)=>globalThis.FontInspector.fontAdded(f,p):null,u=new rS(o,l,i.charProcOperatorList,i.extra);this.fontLoader.bind(u).catch(()=>e.sendWithPromise("FontFallback",{id:n})).finally(()=>{u.fontExtraProperties||u.clearData(),this.commonObjs.resolve(n,u)});break;case"CopyLocalImage":const{imageRef:c}=i;ne(c,"The imageRef must be defined.");for(const f of a(this,Dr).values())for(const[,p]of f.objs){if((p==null?void 0:p.ref)!==c)continue;if(!p.dataLen)return null;const m=structuredClone(p);return this.commonObjs.resolve(n,m),p.dataLen}break;case"FontPath":this.commonObjs.resolve(n,new lS(i));break;case"Image":this.commonObjs.resolve(n,i);break;case"Pattern":const d=new oS(i);this.commonObjs.resolve(n,d.getIR());break;default:throw new Error(`Got unknown common object type ${r}`)}return null}),e.on("obj",([n,r,i,s])=>{var l;if(this.destroyed)return;const o=a(this,Dr).get(r);if(!o.objs.has(n)){if(o._intentStates.size===0){(l=s==null?void 0:s.bitmap)==null||l.close();return}switch(i){case"Image":case"Pattern":o.objs.resolve(n,s);break;default:throw new Error(`Got unknown object type ${i}`)}}}),e.on("DocProgress",n=>{this.destroyed||A(this,Vr,Ug).call(this,n)}),e.on("FetchBinaryData",async n=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.binaryDataFactory)throw new Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(n)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var n;this.annotationStorage.size<=0&&ht("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:((n=a(this,On))==null?void 0:n.filename)??null},t).finally(()=>{this.annotationStorage.resetModified()})}extractPages(e){const t={pageInfos:e};let n;if(this.annotationStorage.size>0){const{map:r,transfer:i}=this.annotationStorage.serializable;t.annotationStorage=r,n=i}return this.messageHandler.sendWithPromise("ExtractPages",t,n).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this.pagesMapper.pagesNumber)return Promise.reject(new Error("Invalid page request."));const t=e-1,n=this.pagesMapper.getPageId(e)-1,r=a(this,vl).get(t);if(r)return r;const i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:n}).then(s=>{if(this.destroyed)throw new Error("Transport destroyed");s.refStr&&a(this,Tu).set(s.refStr,n);const o=new Iy(t,s,this,this.pagesMapper,this._params.pdfBug);return a(this,Dr).set(t,o),o});return a(this,vl).set(t,i),i}async getPageIndex(e){if(!vy(e))throw new Error("Invalid pageIndex request.");const t=await this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}),n=this.pagesMapper.getPageNumber(t+1);if(n===0)throw new Error("GetPageIndex: page has been removed.");return n-1}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.pagesMapper.getPageId(e+1)-1,intent:t})}getFieldObjects(){return A(this,Vr,sd).call(this,"GetFieldObjects")}hasJSActions(){return A(this,Vr,sd).call(this,"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 A(this,Vr,sd).call(this,"GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return A(this,Vr,sd).call(this,"GetOptionalContentConfig").then(t=>new tC(t,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata";return a(this,ml).getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,null).then(t=>{var n,r;return{info:t[0],metadata:t[1]?new QS(t[1]):null,contentDispositionFilename:((n=a(this,On))==null?void 0:n.filename)??null,contentLength:((r=a(this,On))==null?void 0:r.contentLength)??null,hasStructTree:t[2]}}))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}getRawData(e){return this.messageHandler.sendWithPromise("GetRawData",e)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of a(this,Dr).values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),a(this,ml).clear(),this.filterFactory.destroy(!0),xm.cleanup()}}cachedPageNumber(e){if(!vy(e))return null;const t=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`,n=a(this,Tu).get(t);if(n>=0){const r=this.pagesMapper.getPageNumber(n+1);if(r!==0)return r}return null}}On=new WeakMap,ml=new WeakMap,es=new WeakMap,Dr=new WeakMap,vl=new WeakMap,Tu=new WeakMap,ns=new WeakMap,Vr=new WeakSet,sd=function(e,t=null){return a(this,ml).getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,t))},Ug=function({loaded:e,total:t}){var n,r;(r=(n=this.loadingTask).onProgress)==null||r.call(n,{loaded:e,total:t,percent:t?Qt(Math.round(e/t*100),0,100):NaN})};class aC{constructor(e){M(this,"_internalRenderTask",null);M(this,"onContinue",null);M(this,"onError",null);this._internalRenderTask=e}get promise(){return this._internalRenderTask.capability.promise}cancel(e=0){this._internalRenderTask.cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=this._internalRenderTask.operatorList;if(!e)return!1;const{annotationCanvasMap:t}=this._internalRenderTask;return e.form||e.canvas&&(t==null?void 0:t.size)>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}}var Sa,yl;const Eo=class Eo{constructor({callback:e,params:t,objs:n,commonObjs:r,annotationCanvasMap:i,operatorList:s,pageIndex:o,canvasFactory:l,filterFactory:u,useRequestAnimationFrame:c=!1,pdfBug:d=!1,pageColors:f=null,enableHWA:p=!1,operationsFilter:m=null}){b(this,Sa,null);this.callback=e,this.params=t,this.objs=n,this.commonObjs=r,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=s,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=u,this._pdfBug=d,this.pageColors=f,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 aC(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=p,this._dependencyTracker=t.dependencyTracker,this._imagesTracker=t.imagesTracker,this._operationsFilter=m}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){var u,c;if(this.cancelled)return;if(this._canvas){if(a(Eo,yl).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.");a(Eo,yl).add(this._canvas)}this._pdfBug&&((u=globalThis.StepperManager)!=null&&u.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:n,transform:r,background:i,dependencyTracker:s,imagesTracker:o}=this.params,l=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new Fh(l,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors,s,o),this.gfx.beginDrawing({transform:r,viewport:n,transparency:e,background:i}),this.operatorListIdx=0,this.graphicsReady=!0,(c=this.graphicsReadyCallback)==null||c.call(this)}cancel(e=null,t=0){var n,r,i;this.running=!1,this.cancelled=!0,(n=this.gfx)==null||n.endDrawing(),a(this,Sa)&&(window.cancelAnimationFrame(a(this,Sa)),g(this,Sa,null)),a(Eo,yl).delete(this._canvas),e||(e=new ib(`Rendering cancelled, page ${this._pageIndex+1}`,t)),this.callback(e),(i=(r=this.task).onError)==null||i.call(r,e)}operatorListChanged(){var e,t;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(e=this.gfx.dependencyTracker)==null||e.growOperationsCount(this.operatorList.fnArray.length),(t=this.stepper)==null||t.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?g(this,Sa,window.requestAnimationFrame(()=>{g(this,Sa,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(),a(Eo,yl).delete(this._canvas),this.callback())))}};Sa=new WeakMap,yl=new WeakMap,b(Eo,yl,new WeakSet);let Fy=Eo;const oC="5.7.284",lC="7e5b36c2d";ut(3068);var Mn,bl,Pu,Se,Of,Iu,rs,Mf,Ca,Or,We,Lf,Vt,Dy,Oy,My,go,fE,Ws;let dE=(We=class{constructor({editor:e=null,uiManager:t=null}){b(this,Vt);b(this,Mn,null);b(this,bl,null);b(this,Pu);b(this,Se,null);b(this,Of,!1);b(this,Iu,!1);b(this,rs,null);b(this,Mf);b(this,Ca,null);b(this,Or,null);var n,r;e?(g(this,Iu,!1),g(this,rs,e)):g(this,Iu,!0),g(this,Or,(e==null?void 0:e._uiManager)||t),g(this,Mf,a(this,Or)._eventBus),g(this,Pu,((n=e==null?void 0:e.color)==null?void 0:n.toUpperCase())||((r=a(this,Or))==null?void 0:r.highlightColors.values().next().value)||"#FFFF98"),a(We,Lf)||g(We,Lf,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"}))}static get _keyboardManager(){return dt(this,"_keyboardManager",new ag([[["Escape","mac+Escape"],We.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],We.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],We.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],We.prototype._moveToPrevious],[["Home","mac+Home"],We.prototype._moveToBeginning],[["End","mac+End"],We.prototype._moveToEnd]]))}renderButton(){const e=g(this,Mn,document.createElement("button"));e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",a(this,rs)&&(e.ariaControls=`${a(this,rs).id}_colorpicker_dropdown`);const t=a(this,Or)._signal;e.addEventListener("click",A(this,Vt,go).bind(this),{signal:t}),e.addEventListener("keydown",A(this,Vt,My).bind(this),{signal:t});const n=g(this,bl,document.createElement("span"));return n.className="swatch",n.ariaHidden="true",n.style.backgroundColor=a(this,Pu),e.append(n),e}renderMainDropdown(){const e=g(this,Se,A(this,Vt,Dy).call(this));return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}_colorSelectFromKeyboard(e){if(e.target===a(this,Mn)){A(this,Vt,go).call(this,e);return}const t=e.target.getAttribute("data-color");t&&A(this,Vt,Oy).call(this,t,e)}_moveToNext(e){var t,n;if(!a(this,Vt,Ws)){A(this,Vt,go).call(this,e);return}if(e.target===a(this,Mn)){(t=a(this,Se).firstElementChild)==null||t.focus();return}(n=e.target.nextSibling)==null||n.focus()}_moveToPrevious(e){var t,n;if(e.target===((t=a(this,Se))==null?void 0:t.firstElementChild)||e.target===a(this,Mn)){a(this,Vt,Ws)&&this._hideDropdownFromKeyboard();return}a(this,Vt,Ws)||A(this,Vt,go).call(this,e),(n=e.target.previousSibling)==null||n.focus()}_moveToBeginning(e){var t;if(!a(this,Vt,Ws)){A(this,Vt,go).call(this,e);return}(t=a(this,Se).firstElementChild)==null||t.focus()}_moveToEnd(e){var t;if(!a(this,Vt,Ws)){A(this,Vt,go).call(this,e);return}(t=a(this,Se).lastElementChild)==null||t.focus()}hideDropdown(){var e,t;(e=a(this,Se))==null||e.classList.add("hidden"),a(this,Mn).ariaExpanded="false",(t=a(this,Ca))==null||t.abort(),g(this,Ca,null)}_hideDropdownFromKeyboard(){var e;if(!a(this,Iu)){if(!a(this,Vt,Ws)){(e=a(this,rs))==null||e.unselect();return}this.hideDropdown(),a(this,Mn).focus({preventScroll:!0,focusVisible:a(this,Of)})}}updateColor(e){if(a(this,bl)&&(a(this,bl).style.backgroundColor=e),!a(this,Se))return;const t=a(this,Or).highlightColors.values();for(const n of a(this,Se).children)n.ariaSelected=t.next().value===e.toUpperCase()}destroy(){var e,t;(e=a(this,Mn))==null||e.remove(),g(this,Mn,null),g(this,bl,null),(t=a(this,Se))==null||t.remove(),g(this,Se,null)}},Mn=new WeakMap,bl=new WeakMap,Pu=new WeakMap,Se=new WeakMap,Of=new WeakMap,Iu=new WeakMap,rs=new WeakMap,Mf=new WeakMap,Ca=new WeakMap,Or=new WeakMap,Lf=new WeakMap,Vt=new WeakSet,Dy=function(){const e=document.createElement("div"),t=a(this,Or)._signal;e.addEventListener("contextmenu",Er,{signal:t}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),a(this,rs)&&(e.id=`${a(this,rs).id}_colorpicker_dropdown`);for(const[n,r]of a(this,Or).highlightColors){const i=document.createElement("button");i.tabIndex="0",i.role="option",i.setAttribute("data-color",r),i.title=n,i.setAttribute("data-l10n-id",a(We,Lf)[n]);const s=document.createElement("span");i.append(s),s.className="swatch",s.style.backgroundColor=r,i.ariaSelected=r===a(this,Pu),i.addEventListener("click",A(this,Vt,Oy).bind(this,r),{signal:t}),e.append(i)}return e.addEventListener("keydown",A(this,Vt,My).bind(this),{signal:t}),e},Oy=function(e,t){t.stopPropagation(),a(this,Mf).dispatch("switchannotationeditorparams",{source:this,type:gt.HIGHLIGHT_COLOR,value:e}),this.updateColor(e)},My=function(e){We._keyboardManager.exec(this,e)},go=function(e){if(a(this,Vt,Ws)){this.hideDropdown();return}if(g(this,Of,e.detail===0),a(this,Ca)||(g(this,Ca,new AbortController),window.addEventListener("pointerdown",A(this,Vt,fE).bind(this),{signal:a(this,Or).combinedSignal(a(this,Ca))})),a(this,Mn).ariaExpanded="true",a(this,Se)){a(this,Se).classList.remove("hidden");return}const t=g(this,Se,A(this,Vt,Dy).call(this));a(this,Mn).append(t)},fE=function(e){var t;(t=a(this,Se))!=null&&t.contains(e.target)||this.hideDropdown()},Ws=function(){return a(this,Se)&&!a(this,Se).classList.contains("hidden")},b(We,Lf,null),We);var Ln,Ru,Al,is,Nf;const wo=class wo{constructor(e){b(this,Ln,null);b(this,Ru,!1);b(this,Al,null);b(this,is,null);g(this,Al,e),g(this,is,e._uiManager),a(wo,Nf)||g(wo,Nf,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(a(this,Ln))return a(this,Ln);const{editorType:e,colorType:t,colorAndOpacityType:n,opacityType:r,color:i,opacity:s}=a(this,Al),o=g(this,Ru,be.isAlphaColorInputSupported&&r!==void 0),l=g(this,Ln,document.createElement("input"));if(l.type="color",o){l.setAttribute("alpha","");const u=_.hexNums[Math.round((s??1)*255)];l.value=(i||"#000000")+u}else l.value=i||"#000000";return l.className="basicColorPicker",l.tabIndex=0,l.setAttribute("data-l10n-id",a(wo,Nf)[e]),l.addEventListener("input",()=>{if(o){const u=ab(l.value);if(!u)return;const[c,d,f,p]=u,m=_.makeHexColor(c,d,f);n!==void 0?a(this,is).updateParams(n,{color:m,opacity:p}):(a(this,is).updateParams(t,m),a(this,is).updateParams(r,p))}else a(this,is).updateParams(t,l.value)},{signal:a(this,is)._signal}),l}update(e){if(a(this,Ln))if(a(this,Ru)){const t=_.hexNums[Math.round(a(this,Al).opacity*255)];a(this,Ln).value=e+t}else a(this,Ln).value=e}updateOpacity(e){if(!a(this,Ln)||!a(this,Ru))return;const t=_.hexNums[Math.round(e*255)];a(this,Ln).value=a(this,Al).color+t}destroy(){var e;(e=a(this,Ln))==null||e.remove(),g(this,Ln,null)}hideDropdown(){}};Ln=new WeakMap,Ru=new WeakMap,Al=new WeakMap,is=new WeakMap,Nf=new WeakMap,b(wo,Nf,null);let Sm=wo;ut(531);function e1(h){return Math.floor(Qt(h,0,1)*255).toString(16).padStart(2,"0")}function jc(h){return Qt(h,0,1)*255}class n1{static CMYK_G([e,t,n,r]){return["G",1-Math.min(1,.3*e+.59*n+.11*t+r)]}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=jc(e),[e,e,e]}static G_HTML([e]){const t=e1(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(jc)}static RGB_HTML(e){return`#${e.map(e1).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,n,r]){return["RGB",1-Math.min(1,e+r),1-Math.min(1,n+r),1-Math.min(1,t+r)]}static CMYK_rgb([e,t,n,r]){return[jc(1-Math.min(1,e+r)),jc(1-Math.min(1,n+r)),jc(1-Math.min(1,t+r))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,n]){const r=1-e,i=1-t,s=1-n,o=Math.min(r,i,s);return["CMYK",r,i,s,o]}}class hC{create(e,t,n=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const r=this._createSVG("svg:svg");return r.setAttribute("version","1.1"),n||(r.setAttribute("width",`${e}px`),r.setAttribute("height",`${t}px`)),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox",`0 0 ${e} ${t}`),r}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){Ot("Abstract method `_createSVG` called.")}}let Cm=class extends hC{_createSVG(e){return document.createElementNS(Pi,e)}};const uC=9,ch=new WeakSet,cC=new Date().getTimezoneOffset()*60*1e3;class Fv{static create(e){switch(e.data.annotationType){case ge.LINK:return new hb(e);case ge.TEXT:return new fC(e);case ge.WIDGET:switch(e.data.fieldType){case"Tx":return new pC(e);case"Btn":return e.data.radioButton?new mE(e):e.data.checkBox?new mC(e):new vC(e);case"Ch":return new yC(e);case"Sig":return new gC(e)}return new fh(e);case ge.POPUP:return new Ny(e);case ge.FREETEXT:return new EE(e);case ge.LINE:return new AC(e);case ge.SQUARE:return new EC(e);case ge.CIRCLE:return new wC(e);case ge.POLYLINE:return new wE(e);case ge.CARET:return new SC(e);case ge.INK:return new ub(e);case ge.POLYGON:return new xC(e);case ge.HIGHLIGHT:return new xE(e);case ge.UNDERLINE:return new CC(e);case ge.SQUIGGLY:return new TC(e);case ge.STRIKEOUT:return new PC(e);case ge.STAMP:return new SE(e);case ge.FILEATTACHMENT:return new IC(e);default:return new re(e)}}}var El,Fu,cr,Bf,Ly;const Eb=class Eb{constructor(e,{isRenderable:t=!1,ignoreBorder:n=!1,createQuadrilaterals:r=!1}={}){b(this,Bf);b(this,El,null);b(this,Fu,!1);b(this,cr,null);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)),r&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:t}){return!!(e!=null&&e.str||t!=null&&t.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Eb._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){var n;const{data:e}=this,t=(n=this.annotationStorage)==null?void 0:n.getEditor(e.id);return t?t.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){var o;const e=(o=this.annotationStorage)==null?void 0:o.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;const{quadPoints:t,inkLists:n,rect:r}=this.data;let i=-1/0,s=-1/0;if((t==null?void 0:t.length)>=8){for(let l=0;ls?(s=t[l+1],i=t[l+2]):t[l+1]===s&&(i=Math.max(i,t[l+2]));return[i,s]}if((n==null?void 0:n.length)>=1){for(const l of n)for(let u=0,c=l.length;us?(s=l[u+1],i=l[u]):l[u+1]===s&&(i=Math.max(i,l[u]));if(i!==1/0)return[i,s]}return r?[r[2],r[3]]:null}_normalizePoint(e){const{page:{view:t},viewport:{rawDims:{pageWidth:n,pageHeight:r,pageX:i,pageY:s}}}=this.parent;return e[1]=t[3]-e[1]+t[1],e[0]=100*(e[0]-i)/n,e[1]=100*(e[1]-s)/r,e}get commentText(){var t,n,r;const{data:e}=this;return((n=(t=this.annotationStorage.getRawValue(`${xd}${e.id}`))==null?void 0:t.popup)==null?void 0:n.contents)||((r=e.contentsObj)==null?void 0:r.str)||""}set commentText(e){const{data:t}=this,n={deleted:!e,contents:e||""};this.annotationStorage.updateEditor(t.id,{popup:n})||this.annotationStorage.setValue(`${xd}${t.id}`,{id:t.id,annotationType:t.annotationType,page:this.parent.page,popup:n,popupRef:t.popupRef,modificationDate:new Date}),e||this.removePopup()}removePopup(){var e,t;(t=((e=a(this,cr))==null?void 0:e.popup)||this.popup)==null||t.remove(),g(this,cr,this.popup=null)}updateEdited(e){var i;if(!this.container)return;e.rect&&(a(this,El)||g(this,El,{rect:this.data.rect.slice(0)}));const{rect:t,popup:n}=e;t&&A(this,Bf,Ly).call(this,t);let r=((i=a(this,cr))==null?void 0:i.popup)||this.popup;!r&&(n!=null&&n.text)&&(this._createPopup(n),r=a(this,cr).popup),r&&(r.updateEdited(e),n!=null&&n.deleted&&(r.remove(),g(this,cr,null),this.popup=null))}resetEdited(){var e;a(this,El)&&(A(this,Bf,Ly).call(this,a(this,El).rect),(e=a(this,cr))==null||e.popup.resetEdited(),g(this,El,null))}_createContainer(e){const{data:t,parent:{page:n,viewport:r}}=this,i=document.createElement("section");i.setAttribute("data-annotation-id",t.id),!(this instanceof fh)&&!(this instanceof hb)&&(i.tabIndex=0);const{style:s}=i;if(s.zIndex=this.parent.zIndex,this.parent.zIndex+=2,t.alternativeText&&(i.title=t.alternativeText),t.noRotate&&i.classList.add("norotate"),!t.rect||this instanceof Ny){const{rotation:v}=t;return!t.hasOwnCanvas&&v!==0&&this.setRotation(v,i),i}const{width:o,height:l}=this;if(!e&&t.borderStyle.width>0){s.borderWidth=`${t.borderStyle.width}px`;const v=t.borderStyle.horizontalCornerRadius,y=t.borderStyle.verticalCornerRadius;if(v>0||y>0){const S=`calc(${v}px * var(--total-scale-factor)) / calc(${y}px * var(--total-scale-factor))`;s.borderRadius=S}else if(this instanceof mE){const S=`calc(${o}px * var(--total-scale-factor)) / calc(${l}px * var(--total-scale-factor))`;s.borderRadius=S}switch(t.borderStyle.style){case mh.SOLID:s.borderStyle="solid";break;case mh.DASHED:s.borderStyle="dashed";break;case mh.BEVELED:ht("Unimplemented border style: beveled");break;case mh.INSET:ht("Unimplemented border style: inset");break;case mh.UNDERLINE:s.borderBottomStyle="solid";break}const E=t.borderColor||null;E?(g(this,Fu,!0),s.borderColor=_.makeHexColor(...E)):s.borderWidth=0}const u=_.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:d,pageX:f,pageY:p}=r.rawDims;s.left=`${100*(u[0]-f)/c}%`,s.top=`${100*(u[1]-p)/d}%`;const{rotation:m}=t;return t.hasOwnCanvas||m===0?(s.width=`${100*o/c}%`,s.height=`${100*l/d}%`):this.setRotation(m,i),i}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:n,pageHeight:r}=this.parent.viewport.rawDims;let{width:i,height:s}=this;e%180!==0&&([i,s]=[s,i]),t.style.width=`${100*i/n}%`,t.style.height=`${100*s/r}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(t,n,r)=>{const i=r.detail[t],s=i[0],o=i.slice(1);r.target.style[n]=n1[`${s}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[n]:n1[`${s}_rgb`](o)})};return dt(this,"_commonActions",{display:t=>{const{display:n}=t.detail,r=n%2===1;this.container.style.visibility=r?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:r,noPrint:n===1||n===2})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{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=>{const n=t.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(e,t){const n=this._commonActions;for(const r of Object.keys(t.detail)){const i=e[r]||n[r];i==null||i(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const n=this._commonActions;for(const[r,i]of Object.entries(t)){const s=n[r];if(s){const o={detail:{[r]:i},target:e};s(o),delete t[r]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,n,r,i]=this.data.rect.map(v=>Math.fround(v));if(e.length===8){const[v,y,E,S]=e.subarray(2,6);if(r===v&&i===y&&t===E&&n===S)return}const{style:s}=this.container;let o;if(a(this,Fu)){const{borderColor:v,borderWidth:y}=s;s.borderWidth=0,o=["url('data:image/svg+xml;utf8,",'',``],this.container.classList.add("hasBorder")}const l=r-t,u=i-n,{svgFactory:c}=this,d=c.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0),d.role="none";const f=c.createElement("defs");d.append(f);const p=c.createElement("clipPath"),m=`clippath_${this.data.id}`;p.setAttribute("id",m),p.setAttribute("clipPathUnits","objectBoundingBox"),f.append(p);for(let v=2,y=e.length;v`)}a(this,Fu)&&(o.push("')"),s.backgroundImage=o.join("")),this.container.append(d),this.container.style.clipPath=`url(#${m})`}_createPopup(e=null){const{data:t}=this;let n,r;e?(n={str:e.text},r=e.date):(n=t.contentsObj,r=t.modificationDate),g(this,cr,new Ny({data:{color:t.color,titleObj:t.titleObj,modificationDate:r,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!!(a(this,cr)||this.popup||this.data.popupRef)}get extraPopupElement(){return a(this,cr)}render(){Ot("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const n=[];if(this._fieldObjects){const r=this._fieldObjects[e];if(r)for(const{page:i,id:s,exportValues:o}of r){if(i===-1||s===t)continue;const l=typeof o=="string"?o:null,u=document.querySelector(`[data-element-id="${s}"]`);if(u&&!ch.has(u)){ht(`_getElementsByName - element not allowed: ${s}`);continue}n.push({id:s,exportValue:l,domElement:u})}return n}for(const r of document.getElementsByName(e)){const{exportValue:i}=r,s=r.getAttribute("data-element-id");s!==t&&ch.has(r)&&n.push({id:s,exportValue:i,domElement:r})}return n}show(){var e;this.container&&(this.container.hidden=!1),(e=this.popup)==null||e.maybeShow()}hide(){var e;this.container&&(this.container.hidden=!0),(e=this.popup)==null||e.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",()=>{var n;(n=this.linkService.eventBus)==null||n.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]}};El=new WeakMap,Fu=new WeakMap,cr=new WeakMap,Bf=new WeakSet,Ly=function(e){const{container:{style:t},data:{rect:n,rotation:r},parent:{viewport:{rawDims:{pageWidth:i,pageHeight:s,pageX:o,pageY:l}}}}=this;n==null||n.splice(0,4,...e),t.left=`${100*(e[0]-o)/i}%`,t.top=`${100*(s-e[3]+l)/s}%`,r===0?(t.width=`${100*(e[2]-e[0])/i}%`,t.height=`${100*(e[3]-e[1])/s}%`):this.setRotation(r)};let re=Eb;class dC extends re{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.editor=e.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){const{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()}}var Kn,mo,pE,gE;class hb extends re{constructor(t,n=null){super(t,{isRenderable:!0,ignoreBorder:!!(n!=null&&n.ignoreBorder),createQuadrilaterals:!0});b(this,Kn);this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:n}=this,r=document.createElement("a");r.setAttribute("data-element-id",t.id);let i=!1;return t.url?(n.addLinkAttributes(r,t.url,t.newWindow),i=!0):t.action?(this._bindNamedAction(r,t.action,t.overlaidText),i=!0):t.attachment?(A(this,Kn,pE).call(this,r,t.attachment,t.overlaidText,t.attachmentDest),i=!0):t.setOCGState?(A(this,Kn,gE).call(this,r,t.setOCGState,t.overlaidText),i=!0):t.dest?(this._bindLink(r,t.dest,t.overlaidText),i=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(r,t),i=!0),t.resetForm?(this._bindResetFormAction(r,t.resetForm),i=!0):this.isTooltipOnly&&!i&&(this._bindLink(r,""),i=!0)),this.container.classList.add("linkAnnotation"),i&&(this.contentElement=r,this.container.append(r)),this.container}_bindLink(t,n,r=""){t.href=this.linkService.getDestinationHash(n),t.onclick=()=>(n&&this.linkService.goToDestination(n),!1),(n||n==="")&&A(this,Kn,mo).call(this),r&&(t.title=r)}_bindNamedAction(t,n,r=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(n),!1),r&&(t.title=r),A(this,Kn,mo).call(this)}_bindJSAction(t,n){t.href=this.linkService.getAnchorUrl("");const r=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const i of Object.keys(n.actions)){const s=r.get(i);s&&(t[s]=()=>{var o;return(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n.id,name:i}}),!1})}n.overlaidText&&(t.title=n.overlaidText),t.onclick||(t.onclick=()=>!1),A(this,Kn,mo).call(this)}_bindResetFormAction(t,n){const r=t.onclick;if(r||(t.href=this.linkService.getAnchorUrl("")),A(this,Kn,mo).call(this),!this._fieldObjects){ht('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),r||(t.onclick=()=>!1);return}t.onclick=()=>{var d;r==null||r();const{fields:i,refs:s,include:o}=n,l=[];if(i.length!==0||s.length!==0){const f=new Set(s);for(const p of i){const m=this._fieldObjects[p]||[];for(const{id:v}of m)f.add(v)}for(const p of Object.values(this._fieldObjects))for(const m of p)f.has(m.id)===o&&l.push(m)}else for(const f of Object.values(this._fieldObjects))l.push(...f);const u=this.annotationStorage,c=[];for(const f of l){const{id:p}=f;switch(c.push(p),f.type){case"text":{const v=f.defaultValue||"";u.setValue(p,{value:v});break}case"checkbox":case"radiobutton":{const v=f.defaultValue===f.exportValues;u.setValue(p,{value:v});break}case"combobox":case"listbox":{const v=f.defaultValue||"";u.setValue(p,{value:v});break}default:continue}const m=document.querySelector(`[data-element-id="${p}"]`);if(m){if(!ch.has(m)){ht(`_bindResetFormAction - element not allowed: ${p}`);continue}}else continue;m.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((d=this.linkService.eventBus)==null||d.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:c,name:"ResetForm"}})),!1}}}Kn=new WeakSet,mo=function(){this.container.setAttribute("data-internal-link","")},pE=function(t,n,r="",i=null){t.href=this.linkService.getAnchorUrl(""),n.description?t.title=n.description:r&&(t.title=r),t.onclick=()=>{var s;return(s=this.downloadManager)==null||s.openOrDownloadData(n.content,n.filename,i),!1},A(this,Kn,mo).call(this)},gE=function(t,n,r=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(n),!1),r&&(t.title=r),A(this,Kn,mo).call(this)};class fC extends re{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const 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}}class fh extends re{render(){return this.container}showElementAndHideCanvas(e){var t;this.data.hasOwnCanvas&&(((t=e.previousSibling)==null?void 0:t.nodeName)==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return be.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,n,r,i){n.includes("mouse")?e.addEventListener(n,s=>{var o;(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:r,value:i(s),shift:s.shiftKey,modifier:this._getKeyModifier(s)}})}):e.addEventListener(n,s=>{var o;if(n==="blur"){if(!t.focused||!s.relatedTarget)return;t.focused=!1}else if(n==="focus"){if(t.focused)return;t.focused=!0}i&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:r,value:i(s)}}))})}_setEventListeners(e,t,n,r){var i,s,o;for(const[l,u]of n)(u==="Action"||(i=this.data.actions)!=null&&i[u])&&((u==="Focus"||u==="Blur")&&(t||(t={focused:!1})),this._setEventListener(e,t,l,u,r),u==="Focus"&&!((s=this.data.actions)!=null&&s.Blur)?this._setEventListener(e,t,"blur","Blur",null):u==="Blur"&&!((o=this.data.actions)!=null&&o.Focus)&&this._setEventListener(e,t,"focus","Focus",null))}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?"transparent":_.makeHexColor(...t)}_setTextStyle(e){const t=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,r=this.data.defaultAppearanceData.fontSize||uC,i=e.style;let s;const o=2,l=u=>Math.round(10*u)/10;if(this.data.multiLine){const u=Math.abs(this.data.rect[3]-this.data.rect[1]-o),c=Math.round(u/(Cv*r))||1,d=u/c;s=Math.min(r,l(d/Cv))}else{const u=Math.abs(this.data.rect[3]-this.data.rect[1]-o);s=Math.min(r,l(u/Cv))}i.fontSize=`calc(${s}px * var(--total-scale-factor))`,i.color=_.makeHexColor(...n),this.data.textAlignment!==null&&(i.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class pC extends fh{constructor(e){const t=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:t})}setPropertyOnSiblings(e,t,n,r){const i=this.annotationStorage;for(const s of this._getElementsByName(e.name,e.id))s.domElement&&(s.domElement[t]=n),i.setValue(s.id,{[r]:n})}render(){var r,i;const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const s=e.getValue(t,{value:this.data.fieldValue});let o=s.value||"";const l=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;l&&o.length>l&&(o=o.slice(0,l));let u=s.formattedValue||((r=this.data.textContent)==null?void 0:r.join(` `))||null;u&&this.data.comb&&(u=u.replaceAll(/\s+/g,""));const c={userValue:o,formattedValue:u,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=u??o,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type=this.data.password?"password":"text",n.setAttribute("value",u??o),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),ch.add(n),this.contentElement=n,n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=0;const{datetimeFormat:d,datetimeType:f,timeStep:p}=this.data,m=!!f&&this.enableScripting;d&&(n.title=d),this._setRequired(n,this.data.required),l&&(n.maxLength=l),n.addEventListener("input",y=>{e.setValue(t,{value:y.target.value}),this.setPropertyOnSiblings(n,"value",y.target.value,"value"),c.formattedValue=null}),n.addEventListener("resetform",y=>{const E=this.data.defaultFieldValue??"";n.value=c.userValue=E,c.formattedValue=null});let v=y=>{const{formattedValue:E}=c;E!=null&&(y.target.value=E),y.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",E=>{var w;if(c.focused)return;const{target:S}=E;if(m&&(S.type=f,p&&(S.step=p)),c.userValue){const C=c.userValue;if(m)if(f==="time"){const x=new Date(C),T=[x.getHours(),x.getMinutes(),x.getSeconds()];S.value=T.map(I=>I.toString().padStart(2,"0")).join(":")}else S.value=new Date(C-cC).toISOString().split(f==="date"?"T":".",1)[0];else S.value=C}c.lastCommittedValue=S.value,c.commitKey=1,(w=this.data.actions)!=null&&w.Focus||(c.focused=!0)}),n.addEventListener("updatefromsandbox",E=>{this.showElementAndHideCanvas(E.target);const S={value(w){c.userValue=w.detail.value??"",m||e.setValue(t,{value:c.userValue.toString()}),w.target.value=c.userValue},formattedValue(w){const{formattedValue:C}=w.detail;c.formattedValue=C,C!=null&&w.target!==document.activeElement&&(w.target.value=C);const x={formattedValue:C};m&&(x.value=C),e.setValue(t,x)},selRange(w){w.target.setSelectionRange(...w.detail.selRange)},charLimit:w=>{var I;const{charLimit:C}=w.detail,{target:x}=w;if(C===0){x.removeAttribute("maxLength");return}x.setAttribute("maxLength",C);let T=c.userValue;!T||T.length<=C||(T=T.slice(0,C),x.value=c.userValue=T,e.setValue(t,{value:T}),(I=this.linkService.eventBus)==null||I.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:T,willCommit:!0,commitKey:1,selStart:x.selectionStart,selEnd:x.selectionEnd}}))}};this._dispatchEventFromSandbox(S,E)}),n.addEventListener("keydown",E=>{var C;c.commitKey=1;let S=-1;if(E.key==="Escape"?S=0:E.key==="Enter"&&!this.data.multiLine?S=2:E.key==="Tab"&&(c.commitKey=3),S===-1)return;const{value:w}=E.target;c.lastCommittedValue!==w&&(c.lastCommittedValue=w,c.userValue=w,(C=this.linkService.eventBus)==null||C.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:w,willCommit:!0,commitKey:S,selStart:E.target.selectionStart,selEnd:E.target.selectionEnd}}))});const y=v;v=null,n.addEventListener("blur",E=>{var C,x;if(!c.focused||!E.relatedTarget)return;(C=this.data.actions)!=null&&C.Blur||(c.focused=!1);const{target:S}=E;let{value:w}=S;if(m){if(w&&f==="time"){const T=w.split(":").map(I=>parseInt(I,10));w=new Date(2e3,0,1,T[0],T[1],T[2]||0).valueOf(),S.step=""}else w.includes("T")||(w=`${w}T00:00`),w=new Date(w).valueOf();S.type="text"}c.userValue=w,c.lastCommittedValue!==w&&((x=this.linkService.eventBus)==null||x.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:w,willCommit:!0,commitKey:c.commitKey,selStart:E.target.selectionStart,selEnd:E.target.selectionEnd}})),y(E)}),(i=this.data.actions)!=null&&i.Keystroke&&n.addEventListener("beforeinput",E=>{var P;c.lastCommittedValue=null;const{data:S,target:w}=E,{value:C,selectionStart:x,selectionEnd:T}=w;let I=x,F=T;switch(E.inputType){case"deleteWordBackward":{const R=C.substring(0,x).match(/\w*[^\w]*$/);R&&(I-=R[0].length);break}case"deleteWordForward":{const R=C.substring(x).match(/^[^\w]*\w*/);R&&(F+=R[0].length);break}case"deleteContentBackward":x===T&&(I-=1);break;case"deleteContentForward":x===T&&(F+=1);break}E.preventDefault(),(P=this.linkService.eventBus)==null||P.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:C,change:S||"",willCommit:!1,selStart:I,selEnd:F}})}),this._setEventListeners(n,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],E=>E.target.value)}if(v&&n.addEventListener("blur",v),this.data.comb){const E=(this.data.rect[2]-this.data.rect[0])/l;n.classList.add("comb"),n.style.letterSpacing=`calc(${E}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}}class gC extends fh{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class mC extends fh{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,n=t.id;let r=e.getValue(n,{value:t.exportValue===t.fieldValue}).value;typeof r=="string"&&(r=r!=="Off",e.setValue(n,{value:r})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const i=document.createElement("input");return ch.add(i),i.setAttribute("data-element-id",n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type="checkbox",i.name=t.fieldName,r&&i.setAttribute("checked",!0),i.setAttribute("exportValue",t.exportValue),i.tabIndex=0,i.addEventListener("change",s=>{const{name:o,checked:l}=s.target;for(const u of this._getElementsByName(o,n)){const c=l&&u.exportValue===t.exportValue;u.domElement&&(u.domElement.checked=c),e.setValue(u.id,{value:c})}e.setValue(n,{value:l})}),i.addEventListener("resetform",s=>{const o=t.defaultFieldValue||"Off";s.target.checked=o===t.exportValue}),this.enableScripting&&this.hasJSActions&&(i.addEventListener("updatefromsandbox",s=>{const o={value(l){l.target.checked=l.detail.value!=="Off",e.setValue(n,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,s)}),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],s=>s.target.checked)),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class mE extends fh{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,n=t.id;let r=e.getValue(n,{value:t.fieldValue===t.buttonValue}).value;if(typeof r=="string"&&(r=r!==t.buttonValue,e.setValue(n,{value:r})),r)for(const s of this._getElementsByName(t.fieldName,n))e.setValue(s.id,{value:!1});const i=document.createElement("input");if(ch.add(i),i.setAttribute("data-element-id",n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type="radio",i.name=t.fieldName,r&&i.setAttribute("checked",!0),i.tabIndex=0,i.addEventListener("change",s=>{const{name:o,checked:l}=s.target;for(const u of this._getElementsByName(o,n))e.setValue(u.id,{value:!1});e.setValue(n,{value:l})}),i.addEventListener("resetform",s=>{const o=t.defaultFieldValue;s.target.checked=o!=null&&o===t.buttonValue}),this.enableScripting&&this.hasJSActions){const s=t.buttonValue;i.addEventListener("updatefromsandbox",o=>{const l={value:u=>{const c=s===u.detail.value;for(const d of this._getElementsByName(u.target.name)){const f=c&&d.id===n;d.domElement&&(d.domElement.checked=f),e.setValue(d.id,{value:f})}}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(i,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(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class vC extends hb{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",n=>{this._dispatchEventFromSandbox({},n)})),e}}class yC extends fh{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,n=e.getValue(t,{value:this.data.fieldValue}),r=document.createElement("select");ch.add(r),r.setAttribute("data-element-id",t),r.disabled=this.data.readOnly,this._setRequired(r,this.data.required),r.name=this.data.fieldName,r.tabIndex=0;let i=this.data.combo&&this.data.options.length>0;this.data.combo||(r.size=this.data.options.length,this.data.multiSelect&&(r.multiple=!0)),r.addEventListener("resetform",d=>{const f=this.data.defaultFieldValue;for(const p of r.options)p.selected=p.value===f});const s=(d,f)=>{const p=f.replaceAll(" "," ");d.textContent=p,p!==f&&d.setAttribute("display-value",f)};for(const d of this.data.options){const f=document.createElement("option");s(f,d.displayValue),f.value=d.exportValue,n.value.includes(d.exportValue)&&(f.setAttribute("selected",!0),i=!1),r.append(f)}let o=null;if(i){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),r.prepend(d),o=()=>{d.remove(),r.removeEventListener("input",o),o=null},r.addEventListener("input",o)}const l=d=>{const f=d?"value":"textContent",{options:p,multiple:m}=r;return m?Array.prototype.filter.call(p,v=>v.selected).map(v=>v[f]):p.selectedIndex===-1?null:p[p.selectedIndex][f]};let u=l(!1);const c=d=>{const f=d.target.options;return Array.prototype.map.call(f,p=>({displayValue:p.getAttribute("display-value")||p.textContent,exportValue:p.value}))};return this.enableScripting&&this.hasJSActions?(r.addEventListener("updatefromsandbox",d=>{const f={value(p){o==null||o();const m=p.detail.value,v=new Set(Array.isArray(m)?m:[m]);for(const y of r.options)y.selected=v.has(y.value);e.setValue(t,{value:l(!0)}),u=l(!1)},multipleSelection(p){r.multiple=!0},remove(p){const m=r.options,v=p.detail.remove;m[v].selected=!1,r.remove(v),m.length>0&&Array.prototype.findIndex.call(m,E=>E.selected)===-1&&(m[0].selected=!0),e.setValue(t,{value:l(!0),items:c(p)}),u=l(!1)},clear(p){for(;r.length!==0;)r.remove(0);e.setValue(t,{value:null,items:[]}),u=l(!1)},insert(p){const{index:m,displayValue:v,exportValue:y}=p.detail.insert,E=r.children[m],S=document.createElement("option");s(S,v),S.value=y,E?E.before(S):r.append(S),e.setValue(t,{value:l(!0),items:c(p)}),u=l(!1)},items(p){const{items:m}=p.detail;for(;r.length!==0;)r.remove(0);for(const v of m){const{displayValue:y,exportValue:E}=v,S=document.createElement("option");s(S,y),S.value=E,r.append(S)}r.options.length>0&&(r.options[0].selected=!0),e.setValue(t,{value:l(!0),items:c(p)}),u=l(!1)},indices(p){const m=new Set(p.detail.indices);for(const v of p.target.options)v.selected=m.has(v.index);e.setValue(t,{value:l(!0)}),u=l(!1)},editable(p){p.target.disabled=!p.detail.editable}};this._dispatchEventFromSandbox(f,d)}),r.addEventListener("input",d=>{var m;const f=l(!0),p=l(!1);e.setValue(t,{value:f}),d.preventDefault(),(m=this.linkService.eventBus)==null||m.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:u,change:p,changeEx:f,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(r,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],d=>d.target.value)):r.addEventListener("input",function(d){e.setValue(t,{value:l(!0)})}),this.data.combo&&this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}var kf,By;class Ny extends re{constructor(t){const{data:n,elements:r,parent:i}=t,s=!!i._commentManager;super(t,{isRenderable:!s&&re._hasPopupData(n)});b(this,kf);if(this.elements=r,s&&re._hasPopupData(n)){const o=this.popup=A(this,kf,By).call(this);for(const l of r)l.popup=o}else this.popup=null}render(){const{container:t}=this;t.classList.add("popupAnnotation"),t.role="comment";const n=this.popup=A(this,kf,By).call(this),r=[];for(const i of this.elements)i.popup=n,i.container.ariaHasPopup="dialog",r.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",r.map(i=>`${Ph}${i}`).join(",")),this.container}}kf=new WeakSet,By=function(){return new bC({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})};var Nn,Ta,Zm,Qm,Du,Ou,oe,ai,Pa,wl,Mu,Lu,oi,Bn,ss,as,le,os,Ia,jf,ls,Nu,xl,Ra,Re,Fa,At,$g,ky,jy,Uy,Hg,$y,vE,yE,bE,AE,Vg,Wg,Hy;class bC{constructor({container:e,color:t,elements:n,titleObj:r,modificationDate:i,contentsObj:s,richText:o,parent:l,rect:u,parentRect:c,open:d,commentManager:f=null}){b(this,At);b(this,Nn,null);b(this,Ta,A(this,At,bE).bind(this));b(this,Zm,A(this,At,Hy).bind(this));b(this,Qm,A(this,At,Wg).bind(this));b(this,Du,A(this,At,Vg).bind(this));b(this,Ou,null);b(this,oe,null);b(this,ai,null);b(this,Pa,null);b(this,wl,null);b(this,Mu,null);b(this,Lu,null);b(this,oi,!1);b(this,Bn,null);b(this,ss,null);b(this,as,null);b(this,le,null);b(this,os,null);b(this,Ia,null);b(this,jf,null);b(this,ls,null);b(this,Nu,null);b(this,xl,null);b(this,Ra,!1);b(this,Re,null);b(this,Fa,null);g(this,oe,e),g(this,Nu,r),g(this,ai,s),g(this,ls,o),g(this,Mu,l),g(this,Ou,t),g(this,jf,u),g(this,Lu,c),g(this,wl,n),g(this,Nn,f),g(this,Re,n[0]),g(this,Pa,Xv.toDateObject(i)),this.trigger=n.flatMap(p=>p.getElementsToTriggerPopup()),f||(A(this,At,$g).call(this),a(this,oe).hidden=!0,d&&A(this,At,Vg).call(this))}renderCommentButton(){if(a(this,le)){a(this,le).parentNode||a(this,Re).container.after(a(this,le));return}if(a(this,os)||A(this,At,ky).call(this),!a(this,os))return;const{signal:e}=g(this,ss,new AbortController),t=a(this,Re).hasOwnCommentButton,n=()=>{a(this,Nn).toggleCommentPopup(this,!0,void 0,!t)},r=()=>{a(this,Nn).toggleCommentPopup(this,!1,!0,!t)},i=()=>{a(this,Nn).toggleCommentPopup(this,!1,!1)};if(t){g(this,le,a(this,Re).container);for(const s of this.trigger)s.ariaHasPopup="dialog",s.ariaControls="commentPopup",s.addEventListener("keydown",a(this,Ta),{signal:e}),s.addEventListener("click",n,{signal:e}),s.addEventListener("pointerenter",r,{signal:e}),s.addEventListener("pointerleave",i,{signal:e}),s.classList.add("popupTriggerArea")}else{const s=g(this,le,document.createElement("button"));s.className="annotationCommentButton";const o=a(this,Re).container;s.style.zIndex=parseInt(o.style.zIndex,10)+1,s.tabIndex=0,s.ariaHasPopup="dialog",s.ariaControls="commentPopup",s.setAttribute("data-l10n-id","pdfjs-show-comment-button"),A(this,At,Uy).call(this),A(this,At,jy).call(this),s.addEventListener("keydown",a(this,Ta),{signal:e}),s.addEventListener("click",n,{signal:e}),s.addEventListener("pointerenter",r,{signal:e}),s.addEventListener("pointerleave",i,{signal:e}),o.after(s)}}get commentButtonColor(){const{color:e,opacity:t}=a(this,Re).commentData;return e?a(this,Mu)._commentManager.makeCommentColor(e,t):null}focusCommentButton(){setTimeout(()=>{var e;(e=a(this,le))==null||e.focus()},0)}getData(){const{richText:e,color:t,opacity:n,creationDate:r,modificationDate:i}=a(this,Re).commentData;return{contentsObj:{str:this.comment},richText:e,color:t,opacity:n,creationDate:r,modificationDate:i}}get elementBeforePopup(){return a(this,le)}get comment(){return a(this,Fa)||g(this,Fa,a(this,Re).commentText),a(this,Fa)}set comment(e){e!==this.comment&&(a(this,Re).commentText=g(this,Fa,e))}focus(){var e;(e=a(this,Re).container)==null||e.focus()}get parentBoundingClientRect(){return a(this,Re).layer.getBoundingClientRect()}setCommentButtonStates({selected:e,hasPopup:t}){a(this,le)&&(a(this,le).classList.toggle("selected",e),a(this,le).ariaExpanded=t)}setSelectedCommentButton(e){a(this,le).classList.toggle("selected",e)}get commentPopupPosition(){if(a(this,Ia))return a(this,Ia);const{x:e,y:t,height:n}=a(this,le).getBoundingClientRect(),{x:r,y:i,width:s,height:o}=a(this,Re).layer.getBoundingClientRect();return[(e-r)/s,(t+n-i)/o]}set commentPopupPosition(e){g(this,Ia,e)}hasDefaultPopupPosition(){return a(this,Ia)===null}get commentButtonPosition(){return a(this,os)}get commentButtonWidth(){return a(this,le).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(e){const[t,n]=a(this,Ia)||this.commentButtonPosition.map(u=>u/100),r=this.parentBoundingClientRect,{x:i,y:s,width:o,height:l}=r;a(this,Nn).showDialog(null,this,i+t*o,s+n*l,{...e,parentDimensions:r})}render(){var n,r;if(a(this,Bn))return;const e=g(this,Bn,document.createElement("div"));if(e.className="popup",a(this,Ou)){const i=e.style.outlineColor=_.makeHexColor(...a(this,Ou));e.style.backgroundColor=`color-mix(in srgb, ${i} 30%, white)`}const t=document.createElement("span");if(t.className="header",(n=a(this,Nu))!=null&&n.str){const i=document.createElement("span");i.className="title",t.append(i),{dir:i.dir,str:i.textContent}=a(this,Nu)}if(e.append(t),a(this,Pa)){const i=document.createElement("time");i.className="popupDate",i.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),i.setAttribute("data-l10n-args",JSON.stringify({dateObj:a(this,Pa).valueOf()})),i.dateTime=a(this,Pa).toISOString(),t.append(i)}Y1({html:a(this,At,Hg)||a(this,ai).str,dir:(r=a(this,ai))==null?void 0:r.dir,className:"popupContent"},e),a(this,oe).append(e)}updateEdited({rect:e,popup:t,deleted:n}){var r;if(a(this,Nn)){n?(this.remove(),g(this,Fa,null)):t&&(t.deleted?this.remove():(A(this,At,Uy).call(this),g(this,Fa,t.text))),e&&(g(this,os,null),A(this,At,ky).call(this),A(this,At,jy).call(this));return}if(n||t!=null&&t.deleted){this.remove();return}A(this,At,$g).call(this),a(this,xl)||g(this,xl,{contentsObj:a(this,ai),richText:a(this,ls)}),e&&g(this,as,null),t&&t.text&&(g(this,ls,A(this,At,yE).call(this,t.text)),g(this,Pa,Xv.toDateObject(t.date)),g(this,ai,null)),(r=a(this,Bn))==null||r.remove(),g(this,Bn,null)}resetEdited(){var e;a(this,xl)&&({contentsObj:ie(this,ai)._,richText:ie(this,ls)._}=a(this,xl),g(this,xl,null),(e=a(this,Bn))==null||e.remove(),g(this,Bn,null),g(this,as,null))}remove(){var e,t,n;if((e=a(this,ss))==null||e.abort(),g(this,ss,null),(t=a(this,Bn))==null||t.remove(),g(this,Bn,null),g(this,Ra,!1),g(this,oi,!1),(n=a(this,le))==null||n.remove(),g(this,le,null),this.trigger)for(const r of this.trigger)r.classList.remove("popupTriggerArea")}forceHide(){g(this,Ra,this.isVisible),a(this,Ra)&&(a(this,oe).hidden=!0)}maybeShow(){a(this,Nn)||(A(this,At,$g).call(this),a(this,Ra)&&(a(this,Bn)||A(this,At,Wg).call(this),g(this,Ra,!1),a(this,oe).hidden=!1))}get isVisible(){return a(this,Nn)?!1:a(this,oe).hidden===!1}}Nn=new WeakMap,Ta=new WeakMap,Zm=new WeakMap,Qm=new WeakMap,Du=new WeakMap,Ou=new WeakMap,oe=new WeakMap,ai=new WeakMap,Pa=new WeakMap,wl=new WeakMap,Mu=new WeakMap,Lu=new WeakMap,oi=new WeakMap,Bn=new WeakMap,ss=new WeakMap,as=new WeakMap,le=new WeakMap,os=new WeakMap,Ia=new WeakMap,jf=new WeakMap,ls=new WeakMap,Nu=new WeakMap,xl=new WeakMap,Ra=new WeakMap,Re=new WeakMap,Fa=new WeakMap,At=new WeakSet,$g=function(){var t;if(a(this,ss))return;g(this,ss,new AbortController);const{signal:e}=a(this,ss);for(const n of this.trigger)n.addEventListener("click",a(this,Du),{signal:e}),n.addEventListener("pointerenter",a(this,Qm),{signal:e}),n.addEventListener("pointerleave",a(this,Zm),{signal:e}),n.classList.add("popupTriggerArea");for(const n of a(this,wl))(t=n.container)==null||t.addEventListener("keydown",a(this,Ta),{signal:e})},ky=function(){const e=a(this,wl).find(t=>t.hasCommentButton);e&&g(this,os,e._normalizePoint(e.commentButtonPosition))},jy=function(){if(a(this,Re).extraPopupElement&&!a(this,Re).editor)return;a(this,le)||this.renderCommentButton();const[e,t]=a(this,os),{style:n}=a(this,le);n.left=`calc(${e}%)`,n.top=`calc(${t}% - var(--comment-button-dim))`},Uy=function(){a(this,Re).extraPopupElement||(a(this,le)||this.renderCommentButton(),a(this,le).style.backgroundColor=this.commentButtonColor||"")},Hg=function(){const e=a(this,ls),t=a(this,ai);return e!=null&&e.str&&(!(t!=null&&t.str)||t.str===e.str)&&a(this,ls).html||null},$y=function(){var e,t,n;return((n=(t=(e=a(this,At,Hg))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:n.fontSize)||0},vE=function(){var e,t,n;return((n=(t=(e=a(this,At,Hg))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:n.color)||null},yE=function(e){const t=[],n={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},r={style:{color:a(this,At,vE),fontSize:a(this,At,$y)?`calc(${a(this,At,$y)}px * var(--total-scale-factor))`:""}};for(const i of e.split(` `))t.push({name:"span",value:i,attributes:r});return n},bE=function(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&a(this,oi))&&A(this,At,Vg).call(this)},AE=function(){if(a(this,as)!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:n,pageX:r,pageY:i}}}=a(this,Mu);let s=!!a(this,Lu),o=s?a(this,Lu):a(this,jf);for(const m of a(this,wl))if(!o||_.intersect(m.data.rect,o)!==null){o=m.data.rect,s=!0;break}const l=_.normalizeRect([o[0],e[3]-o[1]+e[1],o[2],e[3]-o[3]+e[1]]),c=s?o[2]-o[0]+5:0,d=l[0]+c,f=l[1];g(this,as,[100*(d-r)/t,100*(f-i)/n]);const{style:p}=a(this,oe);p.left=`${a(this,as)[0]}%`,p.top=`${a(this,as)[1]}%`},Vg=function(){if(a(this,Nn)){a(this,Nn).toggleCommentPopup(this,!1);return}g(this,oi,!a(this,oi)),a(this,oi)?(A(this,At,Wg).call(this),a(this,oe).addEventListener("click",a(this,Du)),a(this,oe).addEventListener("keydown",a(this,Ta))):(A(this,At,Hy).call(this),a(this,oe).removeEventListener("click",a(this,Du)),a(this,oe).removeEventListener("keydown",a(this,Ta)))},Wg=function(){a(this,Bn)||this.render(),this.isVisible?a(this,oi)&&a(this,oe).classList.add("focused"):(A(this,At,AE).call(this),a(this,oe).hidden=!1,a(this,oe).style.zIndex=parseInt(a(this,oe).style.zIndex,10)+1e3)},Hy=function(){a(this,oe).classList.remove("focused"),!(a(this,oi)||!this.isVisible)&&(a(this,oe).hidden=!0,a(this,oe).style.zIndex=parseInt(a(this,oe).style.zIndex,10)-1e3)};class EE extends re{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=ct.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=this.contentElement=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const t of this.textContent){const 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}}var Uf;class AC extends re{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});b(this,Uf,null)}render(){this.container.classList.add("lineAnnotation");const{data:t,width:n,height:r}=this,i=this.svgFactory.create(n,r,!0),s=g(this,Uf,this.svgFactory.createElement("svg:line"));return s.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),s.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),s.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),s.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),s.setAttribute("stroke-width",t.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),i.append(s),this.container.append(i),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return a(this,Uf)}addHighlightArea(){this.container.classList.add("highlightArea")}}Uf=new WeakMap;var $f;class EC extends re{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});b(this,$f,null)}render(){this.container.classList.add("squareAnnotation");const{data:t,width:n,height:r}=this,i=this.svgFactory.create(n,r,!0),s=t.borderStyle.width,o=g(this,$f,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",s/2),o.setAttribute("y",s/2),o.setAttribute("width",n-s),o.setAttribute("height",r-s),o.setAttribute("stroke-width",s||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),i.append(o),this.container.append(i),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return a(this,$f)}addHighlightArea(){this.container.classList.add("highlightArea")}}$f=new WeakMap;var Hf;class wC extends re{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});b(this,Hf,null)}render(){this.container.classList.add("circleAnnotation");const{data:t,width:n,height:r}=this,i=this.svgFactory.create(n,r,!0),s=t.borderStyle.width,o=g(this,Hf,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",n/2),o.setAttribute("cy",r/2),o.setAttribute("rx",n/2-s/2),o.setAttribute("ry",r/2-s/2),o.setAttribute("stroke-width",s||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),i.append(o),this.container.append(i),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return a(this,Hf)}addHighlightArea(){this.container.classList.add("highlightArea")}}Hf=new WeakMap;var Vf;class wE extends re{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});b(this,Vf,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:n,borderStyle:r,popupRef:i},width:s,height:o}=this;if(!n)return this.container;const l=this.svgFactory.create(s,o,!0);let u=[];for(let d=0,f=n.length;d=0&&s.setAttribute("stroke-width",n||1),r)for(let o=0,l=a(this,Sl).length;o{s.key==="Enter"&&(i?s.metaKey:s.ctrlKey)&&A(this,Xf,Wy).call(this)}),!n.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):r.classList.add("popupTriggerArea"),t.append(r),t}getElementsToTriggerPopup(){return a(this,Gf)}addHighlightArea(){this.container.classList.add("highlightArea")}}Gf=new WeakMap,Xf=new WeakSet,Wy=function(){var t;(t=this.downloadManager)==null||t.openOrDownloadData(this.content,this.filename)};var Cl,Tl,Bu,Da,_f,Pl,kn,Yf,ks,zg,zy,ku;let CE=(ku=class{constructor({div:e,accessibilityManager:t,annotationCanvasMap:n,annotationEditorUIManager:r,page:i,viewport:s,structTreeLayer:o,commentManager:l,linkService:u,annotationStorage:c}){b(this,ks);b(this,Cl,null);b(this,Tl,null);b(this,Bu,null);b(this,Da,new Map);b(this,_f,null);b(this,Pl,null);b(this,kn,[]);b(this,Yf,!1);M(this,"zIndex",0);this.div=e,g(this,Cl,t),g(this,Tl,n),g(this,_f,o||null),g(this,Pl,u||null),g(this,Bu,c||new ob),this.page=i,this.viewport=s,this._annotationEditorUIManager=r,this._commentManager=l||null}hasEditableAnnotations(){return a(this,Da).size>0}async render(e){var o;const{annotations:t}=e,n=this.div;hh(n,this.viewport);const r=new Map,i=[],s={data:null,layer:n,linkService:a(this,Pl),downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new Cm,annotationStorage:a(this,Bu),enableComment:e.enableComment===!0,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const l of t){if(l.noHTML)continue;const u=l.annotationType===ge.POPUP;if(u){const f=r.get(l.id);if(!f)continue;if(!this._commentManager){i.push(l);continue}s.elements=f}else if(l.rect[2]===l.rect[0]||l.rect[3]===l.rect[1])continue;s.data=l;const c=Fv.create(s);if(!c.isRenderable)continue;u||(a(this,kn).push(c),l.popupRef&&r.getOrInsertComputed(l.popupRef,eb).push(c));const d=c.render();l.hidden&&(d.style.visibility="hidden"),c._isEditable&&(a(this,Da).set(c.data.id,c),(o=this._annotationEditorUIManager)==null||o.renderAnnotationElement(c))}await A(this,ks,zg).call(this);for(const l of i){const u=s.elements=r.get(l.id);s.data=l;const c=Fv.create(s);if(!c.isRenderable)continue;const d=c.render();c.contentElement.id=`${Ph}${l.id}`,l.hidden&&(d.style.visibility="hidden"),u.at(-1).container.after(d)}A(this,ks,zy).call(this)}async addLinkAnnotations(e){const t={data:null,layer:this.div,linkService:a(this,Pl),svgFactory:new Cm,parent:this};for(const n of e){n.borderStyle||(n.borderStyle=ku._defaultBorderStyle),t.data=n;const r=Fv.create(t);r.isRenderable&&(r.render(),r.contentElement.id=`${Ph}${n.id}`,a(this,kn).push(r))}await A(this,ks,zg).call(this)}update({viewport:e}){const t=this.div;this.viewport=e,hh(t,{rotation:e.rotation}),A(this,ks,zy).call(this),t.hidden=!1}getEditableAnnotations(){return a(this,Da).values()}getEditableAnnotation(e){return a(this,Da).get(e)}addFakeAnnotation(e){const{div:t}=this,{id:n,rotation:r}=e,i=new dC({data:{id:n,rect:e.getPDFRect(),rotation:r},editor:e,layer:t,parent:this,enableComment:!!this._commentManager,linkService:a(this,Pl),annotationStorage:a(this,Bu)});return i.render(),i.contentElement.id=`${Ph}${n}`,i.createOrUpdatePopup(),a(this,kn).push(i),i}removeAnnotation(e){var r;const t=a(this,kn).findIndex(i=>i.data.id===e);if(t<0)return;const[n]=a(this,kn).splice(t,1);(r=a(this,Cl))==null||r.removePointerInTextLayer(n.contentElement)}updateFakeAnnotations(e){if(e.length!==0){for(const t of e)t.updateFakeAnnotationElement(this);A(this,ks,zg).call(this)}}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}static get _defaultBorderStyle(){return dt(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:mh.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},Cl=new WeakMap,Tl=new WeakMap,Bu=new WeakMap,Da=new WeakMap,_f=new WeakMap,Pl=new WeakMap,kn=new WeakMap,Yf=new WeakMap,ks=new WeakSet,zg=async function(){var n,r,i;if(a(this,kn).length===0)return;this.div.replaceChildren();const e=[];if(!a(this,Yf)){g(this,Yf,!0);for(const{contentElement:s,data:{id:o}}of a(this,kn)){const l=s.id=`${Ph}${o}`;e.push((n=a(this,_f))==null?void 0:n.getAriaAttributes(l).then(u=>{if(u)for(const[c,d]of u)s.setAttribute(c,d)}))}}a(this,kn).sort(({data:{rect:[s,o,l,u]}},{data:{rect:[c,d,f,p]}})=>{if(s===l&&o===u)return 1;if(c===f&&d===p)return-1;const m=u,v=o,y=(o+u)/2,E=p,S=d,w=(d+p)/2;if(y>=E&&w<=v)return-1;if(w>=m&&y<=S)return 1;const C=(s+l)/2,x=(c+f)/2;return C-x});const t=document.createDocumentFragment();for(const s of a(this,kn))t.append(s.container),this._commentManager?(i=((r=s.extraPopupElement)==null?void 0:r.popup)||s.popup)==null||i.renderCommentButton():s.extraPopupElement&&t.append(s.extraPopupElement.render());if(this.div.append(t),await Promise.all(e),a(this,Cl))for(const s of a(this,kn))a(this,Cl).addPointerInTextLayer(s.contentElement,!1)},zy=function(){var t;if(!a(this,Tl))return;const e=this.div;for(const[n,r]of a(this,Tl)){const i=e.querySelector(`[data-annotation-id="${n}"]`);if(!i)continue;r.className="annotationContent";const{firstChild:s}=i;s?s.nodeName==="CANVAS"?s.replaceWith(r):s.classList.contains("annotationContent")?s.after(r):s.before(r):i.append(r);const o=a(this,Da).get(n);o&&(o._hasNoCanvas?((t=this._annotationEditorUIManager)==null||t.setMissingCanvas(n,i.id,r),o._hasNoCanvas=!1):o.canvas=r)}a(this,Tl).clear()},ku);const fg=/\r\n?|\n/g;var jn,Kf,Il,Un,Ee,TE,PE,IE,Gg,js,Xg,_g,RE,Xy,FE;const Xt=class Xt extends Gt{constructor(t){super({...t,name:"freeTextEditor"});b(this,Ee);b(this,jn,"");b(this,Kf,`${this.id}-editor`);b(this,Il,null);b(this,Un);M(this,"_colorPicker",null);this.color=t.color||Xt._defaultColor||Gt._defaultLineColor,g(this,Un,t.fontSize||Xt._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert"),this.canAddComment=!1}static get _keyboardManager(){const t=Xt.prototype,n=s=>s.isEmpty(),r=Cd.TRANSLATE_SMALL,i=Cd.TRANSLATE_BIG;return dt(this,"_keyboardManager",new ag([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-r,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:n}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[r,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[i,0],checker:n}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-r],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:n}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,r],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,i],checker:n}]]))}static initialize(t,n){Gt.initialize(t,n);const r=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(r.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,n){switch(t){case gt.FREETEXT_SIZE:Xt._defaultFontSize=n;break;case gt.FREETEXT_COLOR:Xt._defaultColor=n;break}}updateParams(t,n){switch(t){case gt.FREETEXT_SIZE:A(this,Ee,TE).call(this,n);break;case gt.FREETEXT_COLOR:A(this,Ee,PE).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[gt.FREETEXT_SIZE,Xt._defaultFontSize],[gt.FREETEXT_COLOR,Xt._defaultColor||Gt._defaultLineColor]]}get propertiesToUpdate(){return[[gt.FREETEXT_SIZE,a(this,Un)],[gt.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new Sm(this)),[["colorPicker",this._colorPicker]]}get colorType(){return gt.FREETEXT_COLOR}onUpdatedColor(){var t;this.editorDiv.style.color=this.color,(t=this._colorPicker)==null||t.update(this.color),super.onUpdatedColor()}_translateEmpty(t,n){this._uiManager.translateSelectedEditors(t,n,!0)}getInitialTranslation(){const t=this.parentScale;return[-Xt._internalPadding*t,-(Xt._internalPadding+a(this,Un))*t]}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"),g(this,Il,new AbortController);const t=this._uiManager.combinedSignal(a(this,Il));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t}),!0}disableEditMode(){var t;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",a(this,Kf)),this._isDraggable=!0,(t=a(this,Il))==null||t.abort(),g(this,Il,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(t){var n;this.width||(this.enableEditMode(),t&&this.editorDiv.focus(),(n=this._initialOptions)!=null&&n.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()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=a(this,jn),n=g(this,jn,A(this,Ee,IE).call(this).trimEnd());if(t===n)return;const r=i=>{if(g(this,jn,i),!i){this.remove();return}A(this,Ee,_g).call(this),this._uiManager.rebuild(this),A(this,Ee,Gg).call(this)};this.addCommands({cmd:()=>{r(n)},undo:()=>{r(t)},mustExec:!1}),A(this,Ee,Gg).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(t){t.target===this.div&&t.key==="Enter"&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){Xt._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){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 t,n;(this._isCopy||this.annotationElementId)&&(t=this.x,n=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",a(this,Kf)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:r}=this.editorDiv;if(r.fontSize=`calc(${a(this,Un)}px * var(--total-scale-factor))`,r.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){const[i,s]=this.parentDimensions;if(this.annotationElementId){const{position:o}=this._initialData;let[l,u]=this.getInitialTranslation();[l,u]=this.pageTranslationToScreen(l,u);const[c,d]=this.pageDimensions,[f,p]=this.pageTranslation;let m,v;switch(this.rotation){case 0:m=t+(o[0]-f)/c,v=n+this.height-(o[1]-p)/d;break;case 90:m=t+(o[0]-f)/c,v=n-(o[1]-p)/d,[l,u]=[u,-l];break;case 180:m=t-this.width+(o[0]-f)/c,v=n-(o[1]-p)/d,[l,u]=[-l,-u];break;case 270:m=t+(o[0]-f-this.height*d)/c,v=n+(o[1]-p-this.width*c)/d,[l,u]=[-u,l];break}this.setAt(m*i,v*s,l,u)}else this._moveAfterPaste(t,n);A(this,Ee,_g).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){var m,v,y;const n=t.clipboardData||window.clipboardData,{types:r}=n;if(r.length===1&&r[0]==="text/plain")return;t.preventDefault();const i=A(m=Xt,js,Xy).call(m,n.getData("text")||"").replaceAll(fg,` `);if(!i)return;const s=window.getSelection();if(!s.rangeCount)return;this.editorDiv.normalize(),s.deleteFromDocument();const o=s.getRangeAt(0);if(!i.includes(` `)){o.insertNode(document.createTextNode(i)),this.editorDiv.normalize(),s.collapseToStart();return}const{startContainer:l,startOffset:u}=o,c=[],d=[];if(l.nodeType===Node.TEXT_NODE){const E=l.parentElement;if(d.push(l.nodeValue.slice(u).replaceAll(fg,"")),E!==this.editorDiv){let S=c;for(const w of this.editorDiv.childNodes){if(w===E){S=d;continue}S.push(A(v=Xt,js,Xg).call(v,w))}}c.push(l.nodeValue.slice(0,u).replaceAll(fg,""))}else if(l===this.editorDiv){let E=c,S=0;for(const w of this.editorDiv.childNodes)S++===u&&(E=d),E.push(A(y=Xt,js,Xg).call(y,w))}g(this,jn,`${c.join(` `)}${i}${d.join(` `)}`),A(this,Ee,_g).call(this);const f=new Range;let p=Math.sumPrecise(c.map(E=>E.length));for(const{firstChild:E}of this.editorDiv.childNodes)if(E.nodeType===Node.TEXT_NODE){const S=E.nodeValue.length;if(p<=S){f.setStart(E,p),f.setEnd(E,p);break}p-=S}s.removeAllRanges(),s.addRange(f)}get contentDiv(){return this.editorDiv}getPDFRect(){const t=Xt._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,n,r){var o;let i=null;if(t instanceof EE){const{data:{defaultAppearanceData:{fontSize:l,fontColor:u},rect:c,rotation:d,id:f,popupRef:p,richText:m,contentsObj:v,creationDate:y,modificationDate:E},textContent:S,textPosition:w,parent:{page:{pageNumber:C}}}=t;if(!S||S.length===0)return null;i=t={annotationType:ct.FREETEXT,color:Array.from(u),fontSize:l,value:S.join(` `),position:w,pageIndex:C-1,rect:c.slice(0),rotation:d,annotationElementId:f,id:f,deleted:!1,popupRef:p,comment:(v==null?void 0:v.str)||null,richText:m,creationDate:y,modificationDate:E}}const s=await super.deserialize(t,n,r);return g(s,Un,t.fontSize),s.color=_.makeHexColor(...t.color),g(s,jn,A(o=Xt,js,Xy).call(o,t.value)),s._initialData=i,t.comment&&s.setCommentData(t),s}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const n=Gt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),r=Object.assign(super.serialize(t),{color:n,fontSize:a(this,Un),value:A(this,Ee,RE).call(this)});return this.addComment(r),t?(r.isCopy=!0,r):this.annotationElementId&&!A(this,Ee,FE).call(this,r)?null:(r.id=this.annotationElementId,r)}renderAnnotationElement(t){const n=super.renderAnnotationElement(t);if(!n)return null;const{style:r}=n;r.fontSize=`calc(${a(this,Un)}px * var(--total-scale-factor))`,r.color=this.color,n.replaceChildren();for(const i of a(this,jn).split(` `)){const s=document.createElement("div");s.append(i?document.createTextNode(i):document.createElement("br")),n.append(s)}return t.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:a(this,jn)}}),n}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}};jn=new WeakMap,Kf=new WeakMap,Il=new WeakMap,Un=new WeakMap,Ee=new WeakSet,TE=function(t){const n=i=>{this.editorDiv.style.fontSize=`calc(${i}px * var(--total-scale-factor))`,this.translate(0,-(i-a(this,Un))*this.parentScale),g(this,Un,i),A(this,Ee,Gg).call(this)},r=a(this,Un);this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:gt.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},PE=function(t){const n=i=>{this.color=i,this.onUpdatedColor()},r=this.color;this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:gt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},IE=function(){var r;const t=[];this.editorDiv.normalize();let n=null;for(const i of this.editorDiv.childNodes)(n==null?void 0:n.nodeType)===Node.TEXT_NODE&&i.nodeName==="BR"||(t.push(A(r=Xt,js,Xg).call(r,i)),n=i);return t.join(` `)},Gg=function(){const[t,n]=this.parentDimensions;let r;if(this.isAttachedToDOM)r=this.div.getBoundingClientRect();else{const{currentLayer:i,div:s}=this,o=s.style.display,l=s.classList.contains("hidden");s.classList.remove("hidden"),s.style.display="hidden",i.div.append(this.div),r=s.getBoundingClientRect(),s.remove(),s.style.display=o,s.classList.toggle("hidden",l)}this.rotation%180===this.parentRotation%180?(this.width=r.width/t,this.height=r.height/n):(this.width=r.height/t,this.height=r.width/n),this.fixAndSetPosition()},js=new WeakSet,Xg=function(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(fg,"")},_g=function(){if(this.editorDiv.replaceChildren(),!!a(this,jn))for(const t of a(this,jn).split(` `)){const n=document.createElement("div");n.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(n)}},RE=function(){return a(this,jn).replaceAll(" "," ")},Xy=function(t){return t.replaceAll(" "," ")},FE=function(t){const{value:n,fontSize:r,color:i,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||t.value!==n||t.fontSize!==r||t.color.some((o,l)=>o!==i[l])||t.pageIndex!==s},b(Xt,js),M(Xt,"_freeTextDefaultContent",""),M(Xt,"_internalPadding",0),M(Xt,"_defaultColor",null),M(Xt,"_defaultFontSize",10),M(Xt,"_type","freetext"),M(Xt,"_editorType",ct.FREETEXT);let Gy=Xt;class q{toSVGPath(){Ot("Abstract method `toSVGPath` must be implemented.")}get box(){Ot("Abstract getter `box` must be implemented.")}serialize(e,t){Ot("Abstract method `serialize` must be implemented.")}static _rescale(e,t,n,r,i,s){s||(s=new Float32Array(e.length));for(let o=0,l=e.length;o=6;r-=6)isNaN(t[r])?n.push(`L${t[r+4]} ${t[r+5]}`):n.push(`C${t[r]} ${t[r+1]} ${t[r+2]} ${t[r+3]} ${t[r+4]} ${t[r+5]}`);return A(this,Te,OE).call(this,n),n.join(" ")}newFreeDrawOutline(e,t,n,r,i,s){return new kE(e,t,n,r,i,s)}getOutlines(){var d;const e=a(this,li),t=a(this,Mr),n=a(this,wt),[r,i,s,o]=a(this,$n),l=new Float32Array((((d=a(this,Oa))==null?void 0:d.length)??0)+2);for(let f=0,p=l.length-2;f=6;f-=6)for(let p=0;p<6;p+=2){if(isNaN(t[f+p])){u[c]=u[c+1]=NaN,c+=2;continue}u[c]=t[f+p],u[c+1]=t[f+p+1],c+=2}return A(this,Te,NE).call(this,u,c),this.newFreeDrawOutline(u,l,a(this,$n),a(this,$u),a(this,ju),a(this,Uu))}};$n=new WeakMap,Mr=new WeakMap,ju=new WeakMap,Uu=new WeakMap,li=new WeakMap,wt=new WeakMap,Rl=new WeakMap,Fl=new WeakMap,Jf=new WeakMap,Zf=new WeakMap,$u=new WeakMap,Hu=new WeakMap,Oa=new WeakMap,Qf=new WeakMap,qm=new WeakMap,tv=new WeakMap,Te=new WeakSet,ad=function(){const e=a(this,wt).subarray(4,6),t=a(this,wt).subarray(16,18),[n,r,i,s]=a(this,$n);return[(a(this,Rl)+(e[0]-t[0])/2-n)/i,(a(this,Fl)+(e[1]-t[1])/2-r)/s,(a(this,Rl)+(t[0]-e[0])/2-n)/i,(a(this,Fl)+(t[1]-e[1])/2-r)/s]},DE=function(){const[e,t,n,r]=a(this,$n),[i,s,o,l]=A(this,Te,ad).call(this);return`M${(a(this,wt)[2]-e)/n} ${(a(this,wt)[3]-t)/r} L${(a(this,wt)[4]-e)/n} ${(a(this,wt)[5]-t)/r} L${i} ${s} L${o} ${l} L${(a(this,wt)[16]-e)/n} ${(a(this,wt)[17]-t)/r} L${(a(this,wt)[14]-e)/n} ${(a(this,wt)[15]-t)/r} Z`},OE=function(e){const t=a(this,Mr);e.push(`L${t[4]} ${t[5]} Z`)},ME=function(e){const[t,n,r,i]=a(this,$n),s=a(this,wt).subarray(4,6),o=a(this,wt).subarray(16,18),[l,u,c,d]=A(this,Te,ad).call(this);e.push(`L${(s[0]-t)/r} ${(s[1]-n)/i} L${l} ${u} L${c} ${d} L${(o[0]-t)/r} ${(o[1]-n)/i}`)},LE=function(e){const t=a(this,wt),[n,r,i,s]=a(this,$n),[o,l,u,c]=A(this,Te,ad).call(this),d=new Float32Array(36);return d.set([NaN,NaN,NaN,NaN,(t[2]-n)/i,(t[3]-r)/s,NaN,NaN,NaN,NaN,(t[4]-n)/i,(t[5]-r)/s,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,u,c,NaN,NaN,NaN,NaN,(t[16]-n)/i,(t[17]-r)/s,NaN,NaN,NaN,NaN,(t[14]-n)/i,(t[15]-r)/s],0),this.newFreeDrawOutline(d,e,a(this,$n),a(this,$u),a(this,ju),a(this,Uu))},NE=function(e,t){const n=a(this,Mr);return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],t),t+=6},BE=function(e,t){const n=a(this,wt).subarray(4,6),r=a(this,wt).subarray(16,18),[i,s,o,l]=a(this,$n),[u,c,d,f]=A(this,Te,ad).call(this);return e.set([NaN,NaN,NaN,NaN,(n[0]-i)/o,(n[1]-s)/l,NaN,NaN,NaN,NaN,u,c,NaN,NaN,NaN,NaN,d,f,NaN,NaN,NaN,NaN,(r[0]-i)/o,(r[1]-s)/l],t),t+=24},b(Oi,Qf,8),b(Oi,qm,2),b(Oi,tv,a(Oi,Qf)+a(Oi,qm));let Tm=Oi;var Vu,Dl,hs,qf,Hn,tp,fe,ev,jE;class kE extends q{constructor(t,n,r,i,s,o){super();b(this,ev);b(this,Vu);b(this,Dl,new Float32Array(4));b(this,hs);b(this,qf);b(this,Hn);b(this,tp);b(this,fe);g(this,fe,t),g(this,Hn,n),g(this,Vu,r),g(this,tp,i),g(this,hs,s),g(this,qf,o),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],A(this,ev,jE).call(this,o);const[l,u,c,d]=a(this,Dl);for(let f=0,p=t.length;fE?(o=y,l=E):l===E&&(o=d(o,y)),cf[1]?(o=f[0],l=f[1]):l===f[1]&&(o=d(o,f[0])),ct[0]-n[0]||t[1]-n[1]||t[2]-n[2]);const e=[];for(const t of a(this,Ma))t[3]?(e.push(...A(this,gn,Yy).call(this,t)),A(this,gn,$E).call(this,t)):(A(this,gn,HE).call(this,t),e.push(...A(this,gn,Yy).call(this,t)));return A(this,gn,UE).call(this,e)}}ep=new WeakMap,np=new WeakMap,rp=new WeakMap,Ma=new WeakMap,Lr=new WeakMap,gn=new WeakSet,UE=function(e){const t=[],n=new Set;for(const s of e){const[o,l,u]=s;t.push([o,l,s],[o,u,s])}t.sort((s,o)=>s[1]-o[1]||s[0]-o[0]);for(let s=0,o=t.length;s0;){const s=n.values().next().value;let[o,l,u,c,d]=s;n.delete(s);let f=o,p=l;for(i=[o,u],r.push(i);;){let m;if(n.has(c))m=c;else if(n.has(d))m=d;else break;n.delete(m),[o,l,u,c,d]=m,f!==o&&(i.push(f,p,o,p===l?l:u),f=o),p=p===l?u:l}i.push(f,p)}return new RC(r,a(this,ep),a(this,np),a(this,rp))},Yg=function(e){const t=a(this,Lr);let n=0,r=t.length-1;for(;n<=r;){const i=n+r>>1,s=t[i][0];if(s===e)return i;s=0;r--){const[i,s]=a(this,Lr)[r];if(i!==e)break;if(i===e&&s===t){a(this,Lr).splice(r,1);return}}},Yy=function(e){const[t,n,r]=e,i=[[t,n,r]],s=A(this,gn,Yg).call(this,r);for(let o=0;o=l){if(p>u)i[c][1]=u;else{if(d===1)return[];i.splice(c,1),c--,d--}continue}i[c][2]=l,p>u&&i.push([t,u,p])}}}return i};var ip,Wu;class RC extends q{constructor(t,n,r,i){super();b(this,ip);b(this,Wu);g(this,Wu,t),g(this,ip,n),this.firstPoint=r,this.lastPoint=i}toSVGPath(){const t=[];for(const n of a(this,Wu)){let[r,i]=n;t.push(`M${r} ${i}`);for(let s=2;s-1?(g(this,He,!0),A(this,yt,Kg).call(this,t),A(this,yt,vo).call(this)):a(this,us)&&(g(this,zu,t.anchorNode),g(this,sp,t.anchorOffset),g(this,op,t.focusNode),g(this,lp,t.focusOffset),A(this,yt,Jy).call(this),A(this,yt,vo).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){const t=Ft.prototype;return dt(this,"_keyboardManager",new ag([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:a(this,He)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:a(this,dr),methodOfCreation:a(this,hp)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,n){var r;Gt.initialize(t,n),Ft._defaultColor||(Ft._defaultColor=((r=n.highlightColors)==null?void 0:r.values().next().value)||"#fff066")}static updateDefaultParams(t,n){switch(t){case gt.HIGHLIGHT_COLOR:Ft._defaultColor=n;break;case gt.HIGHLIGHT_THICKNESS:Ft._defaultThickness=n;break}}translateInPage(t,n){}get toolbarPosition(){return a(this,Xu)}get commentButtonPosition(){return a(this,Gu)}updateParams(t,n){switch(t){case gt.HIGHLIGHT_COLOR:A(this,yt,VE).call(this,n);break;case gt.HIGHLIGHT_THICKNESS:A(this,yt,WE).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[gt.HIGHLIGHT_COLOR,Ft._defaultColor],[gt.HIGHLIGHT_THICKNESS,Ft._defaultThickness]]}get propertiesToUpdate(){return[[gt.HIGHLIGHT_COLOR,this.color||Ft._defaultColor],[gt.HIGHLIGHT_THICKNESS,a(this,dr)||Ft._defaultThickness],[gt.HIGHLIGHT_FREE,a(this,He)]]}onUpdatedColor(){var t,n;(t=this.parent)==null||t.drawLayer.updateProperties(a(this,Wn),{root:{fill:this.color,"fill-opacity":this.opacity}}),(n=a(this,ap))==null||n.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",g(this,ap,new dE({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(A(this,yt,Zg).call(this))}getBaseTranslation(){return[0,0]}getRect(t,n){return super.getRect(t,n,A(this,yt,Zg).call(this))}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){A(this,yt,Zy).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(A(this,yt,vo).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var r;let n=!1;this.parent&&!t?A(this,yt,Zy).call(this):t&&(A(this,yt,vo).call(this,t),n=!this.parent&&((r=this.div)==null?void 0:r.classList.contains("selectedEditor"))),super.setParent(t),this.show(this._isVisible),n&&this.select()}rotate(t){var i,s,o;const{drawLayer:n}=this.parent;let r;a(this,He)?(t=(t-this.rotation+360)%360,r=A(i=Ft,br,xh).call(i,a(this,Vn).box,t)):r=A(s=Ft,br,xh).call(s,[this.x,this.y,this.width,this.height],t),n.updateProperties(a(this,Wn),{bbox:r,root:{"data-main-rotation":t}}),n.updateProperties(a(this,qe),{bbox:A(o=Ft,br,xh).call(o,a(this,En).box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;const t=super.render();a(this,_u)&&(t.setAttribute("aria-label",a(this,_u)),t.setAttribute("role","mark")),a(this,He)?t.classList.add("free"):this.div.addEventListener("keydown",A(this,yt,GE).bind(this),{signal:this._uiManager._signal});const n=g(this,Ml,document.createElement("div"));return t.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",n.style.clipPath=a(this,Ol),this.setDims(),eA(this,a(this,Ml),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){var t;this.isSelected||(t=this.parent)==null||t.drawLayer.updateProperties(a(this,qe),{rootClass:{hovered:!0}})}pointerleave(){var t;this.isSelected||(t=this.parent)==null||t.drawLayer.updateProperties(a(this,qe),{rootClass:{hovered:!1}})}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:A(this,yt,Jg).call(this,!0);break;case 1:case 3:A(this,yt,Jg).call(this,!1);break}}select(){var t;super.select(),a(this,qe)&&((t=this.parent)==null||t.drawLayer.updateProperties(a(this,qe),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var t;super.unselect(),a(this,qe)&&((t=this.parent)==null||t.drawLayer.updateProperties(a(this,qe),{rootClass:{selected:!1}}),a(this,He)||A(this,yt,Jg).call(this,!1))}get _mustFixPosition(){return!a(this,He)}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.updateProperties(a(this,Wn),{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(a(this,qe),{rootClass:{hidden:!t}}))}static startHighlighting(t,n,{target:r,x:i,y:s}){const{x:o,y:l,width:u,height:c}=r.getBoundingClientRect(),d=new AbortController,f=t.combinedSignal(d),p=m=>{d.abort(),A(this,br,KE).call(this,t,m)};window.addEventListener("blur",p,{signal:f}),window.addEventListener("pointerup",p,{signal:f}),window.addEventListener("pointerdown",ee,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",Er,{signal:f}),r.addEventListener("pointermove",A(this,br,YE).bind(this,t),{signal:f}),this._freeHighlight=new Ky({x:i,y:s},[o,l,u,c],t.scale,this._defaultThickness/2,n,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.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 async deserialize(t,n,r){var y,E,S,w;let i=null;if(t instanceof xE){const{data:{quadPoints:C,rect:x,rotation:T,id:I,color:F,opacity:P,popupRef:R,richText:D,contentsObj:k,creationDate:N,modificationDate:H},parent:{page:{pageNumber:X}}}=t;i=t={annotationType:ct.HIGHLIGHT,color:Array.from(F),opacity:P,quadPoints:C,boxes:null,pageIndex:X-1,rect:x.slice(0),rotation:T,annotationElementId:I,id:I,deleted:!1,popupRef:R,richText:D,comment:(k==null?void 0:k.str)||null,creationDate:N,modificationDate:H}}else if(t instanceof ub){const{data:{inkLists:C,rect:x,rotation:T,id:I,color:F,borderStyle:{rawWidth:P},popupRef:R,richText:D,contentsObj:k,creationDate:N,modificationDate:H},parent:{page:{pageNumber:X}}}=t;i=t={annotationType:ct.HIGHLIGHT,color:Array.from(F),thickness:P,inkLists:C,boxes:null,pageIndex:X-1,rect:x.slice(0),rotation:T,annotationElementId:I,id:I,deleted:!1,popupRef:R,richText:D,comment:(k==null?void 0:k.str)||null,creationDate:N,modificationDate:H}}const{color:s,quadPoints:o,inkLists:l,outlines:u,opacity:c}=t,d=await super.deserialize(t,n,r);d.color=_.makeHexColor(...s),d.opacity=c||1,l&&g(d,dr,t.thickness),d._initialData=i,t.comment&&d.setCommentData(t);const[f,p]=d.pageDimensions,[m,v]=d.pageTranslation;if(o){const C=g(d,us,[]);for(let x=0;x=0)g(this,Wn,n),g(this,Ol,r),this.parent.drawLayer.finalizeDraw(n,{bbox:t.box,path:{d:t.toSVGPath()}}),g(this,qe,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:a(this,En).box,path:{d:a(this,En).toSVGPath()}},!0));else if(this.parent){const m=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(a(this,Wn),{bbox:A(f=Ft,br,xh).call(f,a(this,Vn).box,(m-this.rotation+360)%360),path:{d:t.toSVGPath()}}),this.parent.drawLayer.updateProperties(a(this,qe),{bbox:A(p=Ft,br,xh).call(p,a(this,En).box,m),path:{d:a(this,En).toSVGPath()}})}const[s,o,l,u]=t.box;switch(this.rotation){case 0:this.x=s,this.y=o,this.width=l,this.height=u;break;case 90:{const[m,v]=this.parentDimensions;this.x=o,this.y=1-s,this.width=l*v/m,this.height=u*m/v;break}case 180:this.x=1-s,this.y=1-o,this.width=l,this.height=u;break;case 270:{const[m,v]=this.parentDimensions;this.x=1-o,this.y=s,this.width=l*v/m,this.height=u*m/v;break}}const{firstPoint:c}=t;g(this,Gu,[(c[0]-s)/l,(c[1]-o)/u]);const{lastPoint:d}=a(this,En);g(this,Xu,[(d[0]-s)/l,(d[1]-o)/u])},VE=function(t){const n=(s,o)=>{this.color=s,this.opacity=o,this.onUpdatedColor()},r=this.color,i=this.opacity;this.addCommands({cmd:n.bind(this,t,Ft._defaultOpacity),undo:n.bind(this,r,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:gt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(t)},!0)},WE=function(t){const n=a(this,dr),r=i=>{g(this,dr,i),A(this,yt,zE).call(this,i)};this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:gt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)},zE=function(t){a(this,He)&&(A(this,yt,Kg).call(this,{highlightOutlines:a(this,Vn).getNewOutline(t/2)}),this.fixAndSetPosition(),this.setDims())},Zy=function(){a(this,Wn)===null||!this.parent||(this.parent.drawLayer.remove(a(this,Wn)),g(this,Wn,null),this.parent.drawLayer.remove(a(this,qe)),g(this,qe,null))},vo=function(t=this.parent){a(this,Wn)===null&&({id:ie(this,Wn)._,clipPathId:ie(this,Ol)._}=t.drawLayer.draw({bbox:a(this,Vn).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:a(this,He)},path:{d:a(this,Vn).toSVGPath()}},!1,!0),g(this,qe,t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:a(this,He)},bbox:a(this,En).box,path:{d:a(this,En).toSVGPath()}},a(this,He))),a(this,Ml)&&(a(this,Ml).style.clipPath=a(this,Ol)))},br=new WeakSet,xh=function([t,n,r,i],s){switch(s){case 90:return[1-n-i,t,i,r];case 180:return[1-t-r,1-n-i,r,i];case 270:return[n,1-t-r,i,r]}return[t,n,r,i]},GE=function(t){Ft._keyboardManager.exec(this,t)},Jg=function(t){if(!a(this,zu))return;const n=window.getSelection();t?n.setPosition(a(this,zu),a(this,sp)):n.setPosition(a(this,op),a(this,lp))},Zg=function(){return a(this,He)?this.rotation:0},XE=function(){if(a(this,He))return null;const[t,n]=this.pageDimensions,[r,i]=this.pageTranslation,s=a(this,us),o=new Float32Array(s.length*8);let l=0;for(const{x:u,y:c,width:d,height:f}of s){const p=u*t+r,m=(1-c)*n+i;o[l]=o[l+4]=p,o[l+1]=o[l+3]=m,o[l+2]=o[l+6]=p+d*t,o[l+5]=o[l+7]=m-f*n,l+=8}return o},_E=function(t){return a(this,Vn).serialize(t,A(this,yt,Zg).call(this))},YE=function(t,n){this._freeHighlight.add(n)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},KE=function(t,n){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(n,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},JE=function(t){const{color:n}=this._initialData;return this.hasEditedComment||t.color.some((r,i)=>r!==n[i])},b(Ft,br),M(Ft,"_defaultColor",null),M(Ft,"_defaultOpacity",1),M(Ft,"_defaultThickness",12),M(Ft,"_type","highlight"),M(Ft,"_editorType",ct.HIGHLIGHT),M(Ft,"_freeHighlightId",-1),M(Ft,"_freeHighlight",null),M(Ft,"_freeHighlightClipId","");let Pm=Ft;var Ll;class ZE{constructor(){b(this,Ll,Object.create(null))}updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(const[t,n]of Object.entries(e))t.startsWith("_")||this.updateProperty(t,n)}updateSVGProperty(e,t){a(this,Ll)[e]=t}toSVGProperties(){const e=a(this,Ll);return g(this,Ll,Object.create(null)),{root:e}}reset(){g(this,Ll,Object.create(null))}updateAll(e=this){this.updateProperties(e)}clone(){Ot("Not implemented")}}Ll=new WeakMap;var ln,Yu,Fe,Nl,Bl,Pt,Qy,qy,t0,od,QE,Qg,ld,Sh;const xt=class xt extends Gt{constructor(t){super(t);b(this,Pt);b(this,ln,null);b(this,Yu);M(this,"_colorPicker",null);M(this,"_drawId",null);g(this,Yu,t.mustBeCommitted||!1),this._addOutlines(t)}onUpdatedColor(){var t;(t=this._colorPicker)==null||t.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){var t,n;(n=(t=this._colorPicker)==null?void 0:t.updateOpacity)==null||n.call(t,this.opacity)}_addOutlines(t){t.drawOutlines&&(A(this,Pt,Qy).call(this,t),A(this,Pt,od).call(this))}static _mergeSVGProperties(t,n){const r=new Set(Object.keys(t));for(const[i,s]of Object.entries(n))r.has(i)?Object.assign(t[i],s):t[i]=s;return t}static getDefaultDrawingOptions(t){Ot("Not implemented")}static get typesMap(){Ot("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,n){const r=this.typesMap.get(t);r&&this._defaultDrawingOptions.updateProperty(r,n),this._currentParent&&(a(xt,Fe).updateProperty(r,n),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,n){const r=this.constructor.typesMap.get(t);r&&this._updateProperty(t,r,n)}static get defaultPropertiesToUpdate(){const t=[],n=this._defaultDrawingOptions;for(const[r,i]of this.typesMap)t.push([r,n[i]]);return t}get propertiesToUpdate(){const t=[],{_drawingOptions:n}=this;for(const[r,i]of this.constructor.typesMap)t.push([r,n[i]]);return t}_updateProperty(t,n,r){const i=this._drawingOptions,s=i[n],o=l=>{var c;i.updateProperty(n,l);const u=a(this,ln).updateProperty(n,l);u&&A(this,Pt,ld).call(this,u),(c=this.parent)==null||c.drawLayer.updateProperties(this._drawId,i.toSVGProperties()),t===this.colorType?this.onUpdatedColor():t===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:o.bind(this,r),undo:o.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(t,n){const r=this.constructor.typesMap.get(this.colorType),i=this.constructor.typesMap.get(this.opacityType),s=this._drawingOptions,o=s[r],l=s[i],u=(c,d)=>{var f;s.updateProperty(r,c),s.updateProperty(i,d),a(this,ln).updateProperty(r,c),a(this,ln).updateProperty(i,d),(f=this.parent)==null||f.drawLayer.updateProperties(this._drawId,s.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:u.bind(this,t,n),undo:u.bind(this,o,l),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:gt.INK_COLOR_AND_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,xt._mergeSVGProperties(a(this,ln).getPathResizingSVGProperties(A(this,Pt,Qg).call(this)),{bbox:A(this,Pt,Sh).call(this)}))}_onResized(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,xt._mergeSVGProperties(a(this,ln).getPathResizedSVGProperties(A(this,Pt,Qg).call(this)),{bbox:A(this,Pt,Sh).call(this)}))}_onTranslating(t,n){var r;(r=this.parent)==null||r.drawLayer.updateProperties(this._drawId,{bbox:A(this,Pt,Sh).call(this)})}_onTranslated(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,xt._mergeSVGProperties(a(this,ln).getPathTranslatedSVGProperties(A(this,Pt,Qg).call(this),this.parentDimensions),{bbox:A(this,Pt,Sh).call(this)}))}_onStartDragging(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var t;(t=this.parent)==null||t.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(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,a(this,Yu)&&(g(this,Yu,!1),this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){A(this,Pt,t0).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(A(this,Pt,od).call(this),A(this,Pt,ld).call(this,a(this,ln).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var r;let n=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),A(this,Pt,t0).call(this)):t&&(this._uiManager.addShouldRescale(this),A(this,Pt,od).call(this,t),n=!this.parent&&((r=this.div)==null?void 0:r.classList.contains("selectedEditor"))),super.setParent(t),n&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,xt._mergeSVGProperties({bbox:A(this,Pt,Sh).call(this)},a(this,ln).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&A(this,Pt,ld).call(this,a(this,ln).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let t,n;this._isCopy&&(t=this.x,n=this.y);const r=super.render();r.classList.add("draw");const i=document.createElement("div");return r.append(i),i.setAttribute("aria-hidden","true"),i.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,n),r}static createDrawerInstance(t,n,r,i,s){Ot("Not implemented")}static startDrawing(t,n,r,i){var y;const{target:s,offsetX:o,offsetY:l,pointerId:u,pointerType:c}=i;if(Ke.isInitializedAndDifferentPointerType(c))return;const{viewport:{rotation:d}}=t,{width:f,height:p}=s.getBoundingClientRect(),m=g(xt,Nl,new AbortController),v=t.combinedSignal(m);if(Ke.setPointer(c,u),window.addEventListener("pointerup",E=>{Ke.isSamePointerIdOrRemove(E.pointerId)&&this._endDraw(E)},{signal:v}),window.addEventListener("pointercancel",E=>{Ke.isSamePointerIdOrRemove(E.pointerId)&&this._currentParent.endDrawingSession()},{signal:v}),window.addEventListener("pointerdown",E=>{Ke.isSamePointerType(E.pointerType)&&(Ke.initializeAndAddPointerId(E.pointerId),a(xt,Fe).isCancellable()&&(a(xt,Fe).removeLastElement(),a(xt,Fe).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:v}),window.addEventListener("contextmenu",Er,{signal:v}),s.addEventListener("pointermove",this._drawMove.bind(this),{signal:v}),s.addEventListener("touchmove",E=>{Ke.isSameTimeStamp(E.timeStamp)&&ee(E)},{signal:v}),t.toggleDrawing(),(y=n._editorUndoBar)==null||y.hide(),a(xt,Fe)){t.drawLayer.updateProperties(this._currentDrawId,a(xt,Fe).startNew(o,l,f,p,d));return}n.updateUIForDefaultProperties(this),g(xt,Fe,this.createDrawerInstance(o,l,f,p,d)),g(xt,Bl,this.getDefaultDrawingOptions()),this._currentParent=t,{id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(a(xt,Bl).toSVGProperties(),a(xt,Fe).defaultSVGProperties),!0,!1)}static _drawMove(t){if(Ke.isSameTimeStamp(t.timeStamp),!a(xt,Fe))return;const{offsetX:n,offsetY:r,pointerId:i}=t;if(Ke.isSamePointerId(i)){if(Ke.isUsingMultiplePointers()){this._endDraw(t);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,a(xt,Fe).add(n,r)),Ke.setTimeStamp(t.timeStamp),ee(t)}}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,g(xt,Fe,null),g(xt,Bl,null),Ke.clearTimeStamp()),a(xt,Nl)&&(a(xt,Nl).abort(),g(xt,Nl,null),Ke.clearPointerIds())}static _endDraw(t){const n=this._currentParent;if(n){if(n.toggleDrawing(!0),this._cleanup(!1),(t==null?void 0:t.target)===n.div&&n.drawLayer.updateProperties(this._currentDrawId,a(xt,Fe).end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){const r=a(xt,Fe),i=this._currentDrawId,s=r.getLastElement();n.addCommands({cmd:()=>{n.drawLayer.updateProperties(i,r.setLastElement(s))},undo:()=>{n.drawLayer.updateProperties(i,r.removeLastElement())},mustExec:!1,type:gt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){const n=this._currentParent;if(!n)return null;if(n.toggleDrawing(!0),n.cleanUndoStack(gt.DRAW_STEP),!a(xt,Fe).isEmpty()){const{pageDimensions:[r,i],scale:s}=n,o=n.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:a(xt,Fe).getOutlines(r*s,i*s,s,this._INNER_MARGIN),drawingOptions:a(xt,Bl),mustBeCommitted:!t});return this._cleanup(!0),o}return n.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,n,r,i,s,o){Ot("Not implemented")}static async deserialize(t,n,r){var d,f;const{rawDims:{pageWidth:i,pageHeight:s,pageX:o,pageY:l}}=n.viewport,u=this.deserializeDraw(o,l,i,s,this._INNER_MARGIN,t),c=await super.deserialize(t,n,r);return c.createDrawingOptions(t),A(d=c,Pt,Qy).call(d,{drawOutlines:u}),A(f=c,Pt,od).call(f),c.onScaleChanging(),c.rotate(),c}serializeDraw(t){const[n,r]=this.pageTranslation,[i,s]=this.pageDimensions;return a(this,ln).serialize([n,r,i,s],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};ln=new WeakMap,Yu=new WeakMap,Fe=new WeakMap,Nl=new WeakMap,Bl=new WeakMap,Pt=new WeakSet,Qy=function({drawOutlines:t,drawId:n,drawingOptions:r}){g(this,ln,t),this._drawingOptions||(this._drawingOptions=r),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),n>=0?(this._drawId=n,this.parent.drawLayer.finalizeDraw(n,t.defaultProperties)):this._drawId=A(this,Pt,qy).call(this,t,this.parent),A(this,Pt,ld).call(this,t.box)},qy=function(t,n){const{id:r}=n.drawLayer.draw(xt._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return r},t0=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},od=function(t=this.parent){if(!(this._drawId!==null&&this.parent===t)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,t.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=A(this,Pt,qy).call(this,a(this,ln),t)}},QE=function([t,n,r,i]){const{parentDimensions:[s,o],rotation:l}=this;switch(l){case 90:return[n,1-t,r*(o/s),i*(s/o)];case 180:return[1-t,1-n,r,i];case 270:return[1-n,t,r*(o/s),i*(s/o)];default:return[t,n,r,i]}},Qg=function(){const{x:t,y:n,width:r,height:i,parentDimensions:[s,o],rotation:l}=this;switch(l){case 90:return[1-n,t,r*(s/o),i*(o/s)];case 180:return[1-t,1-n,r,i];case 270:return[n,1-t,r*(s/o),i*(o/s)];default:return[t,n,r,i]}},ld=function(t){[this.x,this.y,this.width,this.height]=A(this,Pt,QE).call(this,t),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},Sh=function(){const{x:t,y:n,width:r,height:i,rotation:s,parentRotation:o,parentDimensions:[l,u]}=this;switch((s*4+o)/90){case 1:return[1-n-i,t,i,r];case 2:return[1-t-r,1-n-i,r,i];case 3:return[n,1-t-r,i,r];case 4:return[t,n-r*(l/u),i*(u/l),r*(l/u)];case 5:return[1-n,t,r*(l/u),i*(u/l)];case 6:return[1-t-i*(u/l),1-n,i*(u/l),r*(l/u)];case 7:return[n-r*(l/u),1-t-i*(u/l),r*(l/u),i*(u/l)];case 8:return[t-r,n-i,r,i];case 9:return[1-n,t-r,i,r];case 10:return[1-t,1-n,r,i];case 11:return[n-i,1-t,i,r];case 12:return[t-i*(u/l),n,i*(u/l),r*(l/u)];case 13:return[1-n-r*(l/u),t-i*(u/l),r*(l/u),i*(u/l)];case 14:return[1-t,1-n-r*(l/u),i*(u/l),r*(l/u)];case 15:return[n,1-t,r*(l/u),i*(u/l)];default:return[t,n,r,i]}},M(xt,"_currentDrawId",-1),M(xt,"_currentParent",null),b(xt,Fe,null),b(xt,Nl,null),b(xt,Bl,null),M(xt,"_INNER_MARGIN",3);let Im=xt;var hi,De,Oe,kl,Ku,hn,Ve,fr,jl,Ul,$l,Ju,qg;class DC{constructor(e,t,n,r,i,s){b(this,Ju);b(this,hi,new Float64Array(6));b(this,De);b(this,Oe);b(this,kl);b(this,Ku);b(this,hn);b(this,Ve,"");b(this,fr,0);b(this,jl,new og);b(this,Ul);b(this,$l);g(this,Ul,n),g(this,$l,r),g(this,kl,i),g(this,Ku,s),[e,t]=A(this,Ju,qg).call(this,e,t);const o=g(this,De,[NaN,NaN,NaN,NaN,e,t]);g(this,hn,[e,t]),g(this,Oe,[{line:o,points:a(this,hn)}]),a(this,hi).set(o,0)}updateProperty(e,t){e==="stroke-width"&&g(this,Ku,t)}isEmpty(){return!a(this,Oe)||a(this,Oe).length===0}isCancellable(){return a(this,hn).length<=10}add(e,t){[e,t]=A(this,Ju,qg).call(this,e,t);const[n,r,i,s]=a(this,hi).subarray(2,6),o=e-i,l=t-s;return Math.hypot(a(this,Ul)*o,a(this,$l)*l)<=2?null:(a(this,hn).push(e,t),isNaN(n)?(a(this,hi).set([i,s,e,t],2),a(this,De).push(NaN,NaN,NaN,NaN,e,t),{path:{d:this.toSVGPath()}}):(isNaN(a(this,hi)[0])&&a(this,De).splice(6,6),a(this,hi).set([n,r,i,s,e,t],0),a(this,De).push(...q.createBezierPoints(n,r,i,s,e,t)),{path:{d:this.toSVGPath()}}))}end(e,t){const n=this.add(e,t);return n||(a(this,hn).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(e,t,n,r,i){g(this,Ul,n),g(this,$l,r),g(this,kl,i),[e,t]=A(this,Ju,qg).call(this,e,t);const s=g(this,De,[NaN,NaN,NaN,NaN,e,t]);g(this,hn,[e,t]);const o=a(this,Oe).at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),a(this,Oe).push({line:s,points:a(this,hn)}),a(this,hi).set(s,0),g(this,fr,0),this.toSVGPath(),null}getLastElement(){return a(this,Oe).at(-1)}setLastElement(e){return a(this,Oe)?(a(this,Oe).push(e),g(this,De,e.line),g(this,hn,e.points),g(this,fr,0),{path:{d:this.toSVGPath()}}):a(this,jl).setLastElement(e)}removeLastElement(){if(!a(this,Oe))return a(this,jl).removeLastElement();a(this,Oe).pop(),g(this,Ve,"");for(let e=0,t=a(this,Oe).length;eC??NaN),f,p,m,v),points:y(l[S].map(C=>C??NaN),f,p,m,v)});const E=new this.prototype.constructor;return E.build(d,r,i,1,u,c,s),E}get box(){return a(this,un)}updateProperty(t,n){return t==="stroke-width"?A(this,Ge,ew).call(this,n):null}updateParentDimensions([t,n],r){const[i,s]=A(this,Ge,Ri).call(this);g(this,ui,t),g(this,ci,n),g(this,Zu,r);const[o,l]=A(this,Ge,Ri).call(this),u=o-i,c=l-s,d=a(this,un);return d[0]-=u,d[1]-=c,d[2]+=2*u,d[3]+=2*c,d}updateRotation(t){return g(this,up,t),{path:{transform:this.rotationTransform}}}get viewBox(){return a(this,un).map(q.svgRound).join(" ")}get defaultProperties(){const[t,n]=a(this,un);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${q.svgRound(t)} ${q.svgRound(n)}`}}}get rotationTransform(){const[,,t,n]=a(this,un);let r=0,i=0,s=0,o=0,l=0,u=0;switch(a(this,up)){case 90:i=n/t,s=-t/n,l=t;break;case 180:r=-1,o=-1,l=t,u=n;break;case 270:i=-n/t,s=t/n,u=n;break;default:return""}return`matrix(${r} ${i} ${s} ${o} ${q.svgRound(l)} ${q.svgRound(u)})`}getPathResizingSVGProperties([t,n,r,i]){const[s,o]=A(this,Ge,Ri).call(this),[l,u,c,d]=a(this,un);if(Math.abs(c-s)<=q.PRECISION||Math.abs(d-o)<=q.PRECISION){const y=t+r/2-(l+c/2),E=n+i/2-(u+d/2);return{path:{"transform-origin":`${q.svgRound(t)} ${q.svgRound(n)}`,transform:`${this.rotationTransform} translate(${y} ${E})`}}}const f=(r-2*s)/(c-2*s),p=(i-2*o)/(d-2*o),m=c/r,v=d/i;return{path:{"transform-origin":`${q.svgRound(l)} ${q.svgRound(u)}`,transform:`${this.rotationTransform} scale(${m} ${v}) translate(${q.svgRound(s)} ${q.svgRound(o)}) scale(${f} ${p}) translate(${q.svgRound(-s)} ${q.svgRound(-o)})`}}}getPathResizedSVGProperties([t,n,r,i]){const[s,o]=A(this,Ge,Ri).call(this),l=a(this,un),[u,c,d,f]=l;if(l[0]=t,l[1]=n,l[2]=r,l[3]=i,Math.abs(d-s)<=q.PRECISION||Math.abs(f-o)<=q.PRECISION){const E=t+r/2-(u+d/2),S=n+i/2-(c+f/2);for(const{line:w,points:C}of a(this,zn))q._translate(w,E,S,w),q._translate(C,E,S,C);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${q.svgRound(t)} ${q.svgRound(n)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const p=(r-2*s)/(d-2*s),m=(i-2*o)/(f-2*o),v=-p*(u+s)+t+s,y=-m*(c+o)+n+o;if(p!==1||m!==1||v!==0||y!==0)for(const{line:E,points:S}of a(this,zn))q._rescale(E,v,y,p,m,E),q._rescale(S,v,y,p,m,S);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${q.svgRound(t)} ${q.svgRound(n)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,n],r){const[i,s]=r,o=a(this,un),l=t-o[0],u=n-o[1];if(a(this,ui)===i&&a(this,ci)===s)for(const{line:c,points:d}of a(this,zn))q._translate(c,l,u,c),q._translate(d,l,u,d);else{const c=a(this,ui)/i,d=a(this,ci)/s;g(this,ui,i),g(this,ci,s);for(const{line:f,points:p}of a(this,zn))q._rescale(f,l,u,c,d,f),q._rescale(p,l,u,c,d,p);o[2]*=c,o[3]*=d}return o[0]=t,o[1]=n,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${q.svgRound(t)} ${q.svgRound(n)}`}}}get defaultSVGProperties(){const t=a(this,un);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${q.svgRound(t[0])} ${q.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}}un=new WeakMap,up=new WeakMap,cp=new WeakMap,zn=new WeakMap,ui=new WeakMap,ci=new WeakMap,Zu=new WeakMap,Qu=new WeakMap,Hl=new WeakMap,Ge=new WeakSet,Ri=function(t=a(this,Hl)){const n=a(this,cp)+t/2*a(this,Zu);return a(this,Qu)%180===0?[n/a(this,ui),n/a(this,ci)]:[n/a(this,ci),n/a(this,ui)]},qE=function(){const[t,n,r,i]=a(this,un),[s,o]=A(this,Ge,Ri).call(this,0);return[t+s,n+o,r-2*s,i-2*o]},tw=function(){const t=g(this,un,So.slice());for(const{line:i}of a(this,zn)){if(i.length<=12){for(let l=4,u=i.length;lo!==n[l])||t.thickness!==r||t.opacity!==i||t.pageIndex!==s},M(Ih,"_type","ink"),M(Ih,"_editorType",ct.INK),M(Ih,"_defaultDrawingOptions",null);let e0=Ih;class n0 extends og{toSVGPath(){let e=super.toSVGPath();return e.endsWith("Z")||(e+="Z"),e}}ut(5213);const pg=8,Uc=3;var Hc,Vl,Mt,r0,Nr,rw,iw,i0,tm,sw,aw,ow,s0,a0,lw;let Ch=(Hc=class{static extractContoursFromText(e,{fontFamily:t,fontStyle:n,fontWeight:r},i,s,o,l){let u=new OffscreenCanvas(1,1),c=u.getContext("2d",{alpha:!1});const d=200,f=c.font=`${n} ${r} ${d}px ${t}`,{actualBoundingBoxLeft:p,actualBoundingBoxRight:m,actualBoundingBoxAscent:v,actualBoundingBoxDescent:y,fontBoundingBoxAscent:E,fontBoundingBoxDescent:S,width:w}=c.measureText(e),C=1.5,x=Math.ceil(Math.max(Math.abs(p)+Math.abs(m)||0,w)*C),T=Math.ceil(Math.max(Math.abs(v)+Math.abs(y)||d,Math.abs(E)+Math.abs(S)||d)*C);u=new OffscreenCanvas(x,T),c=u.getContext("2d",{alpha:!0,willReadFrequently:!0}),c.font=f,c.filter="grayscale(1)",c.fillStyle="white",c.fillRect(0,0,x,T),c.fillStyle="black",c.fillText(e,x*(C-1)/2,T*(3-C)/2);const I=A(this,Mt,s0).call(this,c.getImageData(0,0,x,T).data),F=A(this,Mt,ow).call(this,I),P=A(this,Mt,a0).call(this,F),R=A(this,Mt,i0).call(this,I,x,T,P);return this.processDrawnLines({lines:{curves:R,width:x,height:T},pageWidth:i,pageHeight:s,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(e,t,n,r,i){const[s,o,l]=A(this,Mt,lw).call(this,e),[u,c]=A(this,Mt,aw).call(this,s,o,l,Math.hypot(o,l)*a(this,Vl).sigmaSFactor,a(this,Vl).sigmaR,a(this,Vl).kernelSize),d=A(this,Mt,a0).call(this,c),f=A(this,Mt,i0).call(this,u,o,l,d);return this.processDrawnLines({lines:{curves:f,width:o,height:l},pageWidth:t,pageHeight:n,rotation:r,innerMargin:i,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:n,rotation:r,innerMargin:i,mustSmooth:s,areContours:o}){r%180!==0&&([t,n]=[n,t]);const{curves:l,width:u,height:c}=e,d=e.thickness??0,f=[],p=Math.min(t/u,n/c),m=p/t,v=p/n,y=[];for(const{points:S}of l){const w=s?A(this,Mt,sw).call(this,S):S;if(!w)continue;y.push(w);const C=w.length,x=new Float32Array(C),T=new Float32Array(3*(C===2?2:C-2));if(f.push({line:T,points:x}),C===2){x[0]=w[0]*m,x[1]=w[1]*v,T.set([NaN,NaN,NaN,NaN,x[0],x[1]],0);continue}let[I,F,P,R]=w;I*=m,F*=v,P*=m,R*=v,x.set([I,F,P,R],0),T.set([NaN,NaN,NaN,NaN,I,F],0);for(let D=4;D=-128&&o<=127?u=Int8Array:s>=-32768&&o<=32767?u=Int16Array:u=Int32Array;const c=e.length,d=pg+Uc*c,f=new Uint32Array(d);let p=0;f[p++]=d*Uint32Array.BYTES_PER_ELEMENT+(l-2*c)*u.BYTES_PER_ELEMENT,f[p++]=0,f[p++]=r,f[p++]=i,f[p++]=t?0:1,f[p++]=Math.max(0,Math.floor(n??0)),f[p++]=c,f[p++]=u.BYTES_PER_ELEMENT;for(const S of e)f[p++]=S.length-2,f[p++]=S[0],f[p++]=S[1];const m=new CompressionStream("deflate-raw"),v=m.writable.getWriter();await v.ready,v.write(f);const y=u.prototype.constructor;for(const S of e){const w=new y(S.length-2);for(let C=2,x=S.length;C{await i.ready,await i.close()}).catch(()=>{});let s=null,o=0;for await(const w of n)s||(s=new Uint8Array(new Uint32Array(w.buffer,0,4)[0])),s.set(w,o),o+=w.length;const l=new Uint32Array(s.buffer,0,s.length>>2),u=l[1];if(u!==0)throw new Error(`Invalid version: ${u}`);const c=l[2],d=l[3],f=l[4]===0,p=l[5],m=l[6],v=l[7],y=[],E=(pg+Uc*m)*Uint32Array.BYTES_PER_ELEMENT;let S;switch(v){case Int8Array.BYTES_PER_ELEMENT:S=new Int8Array(s.buffer,E);break;case Int16Array.BYTES_PER_ELEMENT:S=new Int16Array(s.buffer,E);break;case Int32Array.BYTES_PER_ELEMENT:S=new Int32Array(s.buffer,E);break}o=0;for(let w=0;w0?0:4:n===1?r+6:2-r},Nr=new WeakMap,rw=function(e,t,n,r,i,s,o){const l=A(this,Mt,r0).call(this,n,r,i,s);for(let u=0;u<8;u++){const c=(-u+l-o+16)%8,d=a(this,Nr)[2*c],f=a(this,Nr)[2*c+1];if(e[(n+d)*t+(r+f)]!==0)return c}return-1},iw=function(e,t,n,r,i,s,o){const l=A(this,Mt,r0).call(this,n,r,i,s);for(let u=0;u<8;u++){const c=(u+l+o+16)%8,d=a(this,Nr)[2*c],f=a(this,Nr)[2*c+1];if(e[(n+d)*t+(r+f)]!==0)return c}return-1},i0=function(e,t,n,r){const i=e.length,s=new Int32Array(i);for(let c=0;c=1&&s[f+1]===0)o+=1,v+=1,p>1&&(l=p);else{p!==1&&(l=Math.abs(p));continue}const y=[d,c],E=v===d+1,S={isHole:E,points:y,id:o,parent:0};u.push(S);let w;for(const D of u)if(D.id===l){w=D;break}w?w.isHole?S.parent=E?w.parent:l:S.parent=E?l:w.parent:S.parent=E?l:0;const C=A(this,Mt,rw).call(this,s,t,c,d,m,v,0);if(C===-1){s[f]=-o,s[f]!==1&&(l=Math.abs(s[f]));continue}let x=a(this,Nr)[2*C],T=a(this,Nr)[2*C+1];const I=c+x,F=d+T;m=I,v=F;let P=c,R=d;for(;;){const D=A(this,Mt,iw).call(this,s,t,P,R,m,v,1);x=a(this,Nr)[2*D],T=a(this,Nr)[2*D+1];const k=P+x,N=R+T;y.push(N,k);const H=P*t+R;if(s[H+1]===0?s[H]=-o:s[H]===1&&(s[H]=o),k===c&&N===d&&P===I&&R===F){s[f]!==1&&(l=Math.abs(s[f]));break}else m=P,v=R,P=k,R=N}}}return u},tm=function(e,t,n,r){if(n-t<=4){for(let I=t;Ix&&(T=I,x=F)}x>(u*C)**2?(A(this,Mt,tm).call(this,e,t,T+2,r),A(this,Mt,tm).call(this,e,T,n,r)):r.push(i,s)},sw=function(e){const t=[],n=e.length;return A(this,Mt,tm).call(this,e,0,n,t),t.push(e[n-2],e[n-1]),t.length<=4?null:t},aw=function(e,t,n,r,i,s){const o=new Float32Array(s**2),l=-2*r**2,u=s>>1;for(let v=0;v=n))for(let F=0;F=t)continue;const R=e[I*t+P],D=o[T*s+F]*c[Math.abs(R-S)];w+=R*D,C+=D}}const x=p[E]=Math.round(w/C);m[x]++}return[p,m]},ow=function(e){const t=new Uint32Array(256);for(const n of e)t[n]++;return t},s0=function(e){const t=e.length,n=new Uint8ClampedArray(t>>2);let r=-1/0,i=1/0;for(let o=0,l=n.length;ol!==0);let s=i,o=i;for(t=i;t<256;t++){const l=e[t];l>n&&(t-s>r&&(r=t-s,o=t-1),n=l,s=t)}for(t=o-1;t>=0&&!(e[t]>e[t+1]);t--);return t},lw=function(e){const t=e,{width:n,height:r}=e,{maxDim:i}=a(this,Vl);let s=n,o=r;if(n>i||r>i){let f=n,p=r,m=Math.log2(Math.max(n,r)/i);const v=Math.floor(m);m=m===v?v-1:v;for(let E=0;E{n==null||n.updateEditSignatureButton(t)}))}getSignaturePreview(){const{newCurves:t,areContours:n,thickness:r,width:i,height:s}=a(this,Na),o=Math.max(i,s),l=Ch.processDrawnLines({lines:{curves:t.map(u=>({points:u})),thickness:r,width:i,height:s},pageWidth:o,pageHeight:o,rotation:0,innerMargin:0,mustSmooth:!1,areContours:n});return{areContours:n,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,n,r,i){const{x:s,y:o}=this,{outline:l}=g(this,Na,t);g(this,La,l instanceof n0),this.description=r;let u;a(this,La)?u=In.getDefaultDrawingOptions():(u=In._defaultDrawnSignatureOptions.clone(),u.updateProperties({"stroke-width":l.thickness})),this._addOutlines({drawOutlines:l,drawingOptions:u});const[,c]=this.pageDimensions;let d=n/c;d=d>=1?.5:d,this.width*=d/this.height,this.width>=1&&(d*=.9/this.width,this.width=.9),this.height=d,this.setDims(),this.x=s,this.y=o,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:!!r}}),this.div.hidden=!1}getFromImage(t){const{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return Ch.process(t,n,r,i,In._INNER_MARGIN)}getFromText(t,n){const{rawDims:{pageWidth:r,pageHeight:i},rotation:s}=this.parent.viewport;return Ch.extractContoursFromText(t,n,r,i,s,In._INNER_MARGIN)}getDrawnSignature(t){const{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return Ch.processDrawnLines({lines:t,pageWidth:n,pageHeight:r,rotation:i,innerMargin:In._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:n}){t?this._drawingOptions=In.getDefaultDrawingOptions():(this._drawingOptions=In._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":n}))}serialize(t=!1){if(this.isEmpty())return null;const{lines:n,points:r}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":i}}=this,s=Object.assign(super.serialize(t),{isSignature:!0,areContours:a(this,La),color:[0,0,0],thickness:a(this,La)?0:i});return this.addComment(s),t?(s.paths={lines:n,points:r},s.uuid=a(this,Wl),s.isCopy=!0):s.lines=n,a(this,di)&&(s.accessibilityData={type:"Figure",alt:a(this,di)}),s}static deserializeDraw(t,n,r,i,s,o){return o.areContours?n0.deserialize(t,n,r,i,s,o):og.deserialize(t,n,r,i,s,o)}static async deserialize(t,n,r){var s;const i=await super.deserialize(t,n,r);return g(i,La,t.areContours),i.description=((s=t.accessibilityData)==null?void 0:s.alt)||"",g(i,Wl,t.uuid),i}};La=new WeakMap,di=new WeakMap,Na=new WeakMap,Wl=new WeakMap,M(In,"_type","signature"),M(In,"_editorType",ct.SIGNATURE),M(In,"_defaultDrawingOptions",null);let o0=In;var Zt,Me,Ba,cs,ka,qu,ds,zl,fi,Gn,tc,It,hd,ud,em,nm,rm,h0,im,hw;class l0 extends Gt{constructor(t){super({...t,name:"stampEditor"});b(this,It);b(this,Zt,null);b(this,Me,null);b(this,Ba,null);b(this,cs,null);b(this,ka,null);b(this,qu,"");b(this,ds,null);b(this,zl,!1);b(this,fi,null);b(this,Gn,!1);b(this,tc,!1);g(this,cs,t.bitmapUrl),g(this,ka,t.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,n){Gt.initialize(t,n)}static isHandlingMimeForPasting(t){return Yv.includes(t)}static paste(t,n){n.pasteEditor({mode:ct.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!!((t=this.altTextData)!=null&&t.altText)}}static computeTelemetryFinalData(t){const n=t.get("hasAltText");return{hasAltText:n.get(!0)??0,hasNoAltText:n.get(!1)??0}}async mlGuessAltText(t=null,n=!0){if(this.hasAltTextData())return null;const{mlManager:r}=this._uiManager;if(!r)throw new Error("No ML.");if(!await r.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:i,width:s,height:o}=t||this.copyCanvas(null,null,!0).imageData,l=await r.guess({name:"altText",request:{data:i,width:s,height:o,channels:i.length/(s*o)}});if(!l)throw new Error("No response from the AI service.");if(l.error)throw new Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw new Error("No valid response from the AI service.");const u=l.output;return await this.setGuessedAltText(u),n&&!this.hasAltTextData()&&(this.altTextData={alt:u,decorative:!1}),u}remove(){var t;a(this,Me)&&(g(this,Zt,null),this._uiManager.imageManager.deleteId(a(this,Me)),(t=a(this,ds))==null||t.remove(),g(this,ds,null),a(this,fi)&&(clearTimeout(a(this,fi)),g(this,fi,null))),super.remove()}rebuild(){if(!this.parent){a(this,Me)&&A(this,It,em).call(this);return}super.rebuild(),this.div!==null&&(a(this,Me)&&a(this,ds)===null&&A(this,It,em).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!(a(this,Ba)||a(this,Zt)||a(this,cs)||a(this,ka)||a(this,Me)||a(this,zl))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let t,n;return this._isCopy&&(t=this.x,n=this.y),super.render(),this.div.hidden=!0,this.createAltText(),a(this,zl)||(a(this,Zt)?A(this,It,nm).call(this):A(this,It,em).call(this)),this._isCopy&&this._moveAfterPaste(t,n),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,n){const{id:r,bitmap:i}=this._uiManager.imageManager.getFromCanvas(t,n);n.remove(),r&&this._uiManager.imageManager.isValidId(r)&&(g(this,Me,r),i&&g(this,Zt,i),g(this,zl,!1),A(this,It,nm).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;a(this,fi)!==null&&clearTimeout(a(this,fi)),g(this,fi,setTimeout(()=>{g(this,fi,null),A(this,It,h0).call(this)},200))}copyCanvas(t,n,r=!1){t||(t=224);const{width:i,height:s}=a(this,Zt),o=new uh;let l=a(this,Zt),u=i,c=s,d=null;if(n){if(i>n||s>n){const I=Math.min(n/i,n/s);u=Math.floor(i*I),c=Math.floor(s*I)}d=document.createElement("canvas");const p=d.width=Math.ceil(u*o.sx),m=d.height=Math.ceil(c*o.sy);a(this,Gn)||(l=A(this,It,rm).call(this,p,m));const v=d.getContext("2d");v.filter=this._uiManager.hcmFilter;let y="white",E="#cfcfd8";this._uiManager.hcmFilter!=="none"?E="black":Gx.isDarkMode&&(y="#8f8f9d",E="#42414d");const S=15,w=S*o.sx,C=S*o.sy,x=new OffscreenCanvas(w*2,C*2),T=x.getContext("2d");T.fillStyle=y,T.fillRect(0,0,w*2,C*2),T.fillStyle=E,T.fillRect(0,0,w,C),T.fillRect(w,C,w,C),v.fillStyle=v.createPattern(x,"repeat"),v.fillRect(0,0,p,m),v.drawImage(l,0,0,l.width,l.height,0,0,p,m)}let f=null;if(r){let p,m;if(o.symmetric&&l.widtht||s>t){const E=Math.min(t/i,t/s);p=Math.floor(i*E),m=Math.floor(s*E),a(this,Gn)||(l=A(this,It,rm).call(this,p,m))}const y=new OffscreenCanvas(p,m).getContext("2d",{willReadFrequently:!0});y.drawImage(l,0,0,l.width,l.height,0,0,p,m),f={width:p,height:m,data:y.getImageData(0,0,p,m).data}}return{canvas:d,width:u,height:c,imageData:f}}static async deserialize(t,n,r){var y;let i=null,s=!1;if(t instanceof SE){const{data:{rect:E,rotation:S,id:w,structParent:C,popupRef:x,richText:T,contentsObj:I,creationDate:F,modificationDate:P},container:R,parent:{page:{pageNumber:D}},canvas:k}=t;let N,H;k?(delete t.canvas,{id:N,bitmap:H}=r.imageManager.getFromCanvas(R.id,k),k.remove()):(s=!0,t._hasNoCanvas=!0);const X=((y=await n._structTree.getAriaAttributes(`${Ph}${w}`))==null?void 0:y.get("aria-label"))||"";i=t={annotationType:ct.STAMP,bitmapId:N,bitmap:H,pageIndex:D-1,rect:E.slice(0),rotation:S,annotationElementId:w,id:w,deleted:!1,accessibilityData:{decorative:!1,altText:X},isSvg:!1,structParent:C,popupRef:x,richText:T,comment:(I==null?void 0:I.str)||null,creationDate:F,modificationDate:P}}const o=await super.deserialize(t,n,r),{rect:l,bitmap:u,bitmapUrl:c,bitmapId:d,isSvg:f,accessibilityData:p}=t;s?(r.addMissingCanvas(t.id,o),g(o,zl,!0)):d&&r.imageManager.isValidId(d)?(g(o,Me,d),u&&g(o,Zt,u)):g(o,cs,c),g(o,Gn,f);const[m,v]=o.pageDimensions;return o.width=(l[2]-l[0])/m,o.height=(l[3]-l[1])/v,p&&(o.altTextData=p),o._initialData=i,t.comment&&o.setCommentData(t),g(o,tc,!!i),o}serialize(t=!1,n=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const r=Object.assign(super.serialize(t),{bitmapId:a(this,Me),isSvg:a(this,Gn)});if(this.addComment(r),t)return r.bitmapUrl=A(this,It,im).call(this,!0),r.accessibilityData=this.serializeAltText(!0),r.isCopy=!0,r;const{decorative:i,altText:s}=this.serializeAltText(!1);if(!i&&s&&(r.accessibilityData={type:"Figure",alt:s}),this.annotationElementId){const l=A(this,It,hw).call(this,r);return l.isSame?null:(l.isSameAltText?delete r.accessibilityData:r.accessibilityData.structParent=this._initialData.structParent??-1,r.id=this.annotationElementId,delete r.bitmapId,r)}if(n===null)return r;n.stamps||(n.stamps=new Map);const o=a(this,Gn)?(r.rect[2]-r.rect[0])*(r.rect[3]-r.rect[1]):null;if(!n.stamps.has(a(this,Me)))n.stamps.set(a(this,Me),{area:o,serialized:r}),r.bitmap=A(this,It,im).call(this,!1);else if(a(this,Gn)){const l=n.stamps.get(a(this,Me));o>l.area&&(l.area=o,l.serialized.bitmap.close(),l.serialized.bitmap=A(this,It,im).call(this,!1))}return r}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}Zt=new WeakMap,Me=new WeakMap,Ba=new WeakMap,cs=new WeakMap,ka=new WeakMap,qu=new WeakMap,ds=new WeakMap,zl=new WeakMap,fi=new WeakMap,Gn=new WeakMap,tc=new WeakMap,It=new WeakSet,hd=function(t,n=!1){if(!t){this.remove();return}g(this,Zt,t.bitmap),n||(g(this,Me,t.id),g(this,Gn,t.isSvg)),t.file&&g(this,qu,t.file.name),A(this,It,nm).call(this)},ud=function(){if(g(this,Ba,null),this._uiManager.enableWaiting(!1),!!a(this,ds)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(this,Zt)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(this,Zt)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},em=function(){if(a(this,Me)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(a(this,Me)).then(r=>A(this,It,hd).call(this,r,!0)).finally(()=>A(this,It,ud).call(this));return}if(a(this,cs)){const r=a(this,cs);g(this,cs,null),this._uiManager.enableWaiting(!0),g(this,Ba,this._uiManager.imageManager.getFromUrl(r).then(i=>A(this,It,hd).call(this,i)).finally(()=>A(this,It,ud).call(this)));return}if(a(this,ka)){const r=a(this,ka);g(this,ka,null),this._uiManager.enableWaiting(!0),g(this,Ba,this._uiManager.imageManager.getFromFile(r).then(i=>A(this,It,hd).call(this,i)).finally(()=>A(this,It,ud).call(this)));return}const t=document.createElement("input");t.type="file",t.accept=Yv.join(",");const n=this._uiManager._signal;g(this,Ba,new Promise(r=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const i=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),A(this,It,hd).call(this,i)}r()},{signal:n}),t.addEventListener("cancel",()=>{this.remove(),r()},{signal:n})}).finally(()=>A(this,It,ud).call(this))),t.click()},nm=function(){var u;const{div:t}=this;let{width:n,height:r}=a(this,Zt);const[i,s]=this.pageDimensions,o=.75;if(this.width)n=this.width*i,r=this.height*s;else if(n>o*i||r>o*s){const c=Math.min(o*i/n,o*s/r);n*=c,r*=c}this._uiManager.enableWaiting(!1);const l=g(this,ds,document.createElement("canvas"));l.setAttribute("role","img"),this.addContainer(l),this.width=n/i,this.height=r/s,this.setDims(),(u=this._initialOptions)!=null&&u.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),A(this,It,h0).call(this),a(this,tc)||(this.parent.addUndoableEditor(this),g(this,tc,!0)),this._reportTelemetry({action:"inserted_image"}),a(this,qu)&&this.div.setAttribute("aria-description",a(this,qu)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},rm=function(t,n){const{width:r,height:i}=a(this,Zt);let s=r,o=i,l=a(this,Zt);for(;s>2*t||o>2*n;){const u=s,c=o;s>2*t&&(s=Math.ceil(s/2)),o>2*n&&(o=Math.ceil(o/2));const d=new OffscreenCanvas(s,o);d.getContext("2d").drawImage(l,0,0,u,c,0,0,s,o),l=d.transferToImageBitmap()}return l},h0=function(){const[t,n]=this.parentDimensions,{width:r,height:i}=this,s=new uh,o=Math.ceil(r*t*s.sx),l=Math.ceil(i*n*s.sy),u=a(this,ds);if(!u||u.width===o&&u.height===l)return;u.width=o,u.height=l;const c=a(this,Gn)?a(this,Zt):A(this,It,rm).call(this,o,l),d=u.getContext("2d");d.filter=this._uiManager.hcmFilter,d.drawImage(c,0,0,c.width,c.height,0,0,o,l)},im=function(t){if(t){if(a(this,Gn)){const i=this._uiManager.imageManager.getSvgUrl(a(this,Me));if(i)return i}const n=document.createElement("canvas");return{width:n.width,height:n.height}=a(this,Zt),n.getContext("2d").drawImage(a(this,Zt),0,0),n.toDataURL()}if(a(this,Gn)){const[n,r]=this.pageDimensions,i=Math.round(this.width*n*Fc.PDF_TO_CSS_UNITS),s=Math.round(this.height*r*Fc.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(i,s);return o.getContext("2d").drawImage(a(this,Zt),0,0,a(this,Zt).width,a(this,Zt).height,0,0,i,s),o.transferToImageBitmap()}return structuredClone(a(this,Zt))},hw=function(t){var o;const{pageIndex:n,accessibilityData:{altText:r}}=this._initialData,i=t.pageIndex===n,s=(((o=t.accessibilityData)==null?void 0:o.alt)||"")===r;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&i&&s,isSameAltText:s}},M(l0,"_type","stamp"),M(l0,"_editorType",ct.STAMP);var Gl,ec,ja,Ua,fs,wn,$a,nc,rc,Br,ps,Le,gs,Ha,ic,et,Tn,Va,Wt,u0,uw,Xr,c0,d0,sm;let OC=(Tn=class{constructor({uiManager:e,pageIndex:t,div:n,structTreeLayer:r,accessibilityManager:i,annotationLayer:s,drawLayer:o,textLayer:l,viewport:u,l10n:c}){b(this,Wt);b(this,Gl);b(this,ec,!1);b(this,ja,null);b(this,Ua,null);b(this,fs,null);b(this,wn,new Map);b(this,$a,!1);b(this,nc,!1);b(this,rc,!1);b(this,Br,null);b(this,ps,null);b(this,Le,null);b(this,gs,null);b(this,Ha,null);b(this,ic,-1);b(this,et);const d=[...a(Tn,Va).values()];if(!Tn._initialized){Tn._initialized=!0;for(const f of d)f.initialize(c,e)}e.registerEditorTypes(d),g(this,et,e),this.pageIndex=t,this.div=n,g(this,Gl,i),g(this,ja,s),this.viewport=u,g(this,Le,l),this.drawLayer=o,this._structTree=r,a(this,et).addLayer(this)}get isEmpty(){return a(this,wn).size===0}get isInvisible(){return this.isEmpty&&a(this,et).getMode()===ct.NONE}updateToolbar(e){a(this,et).updateToolbar(e)}updateMode(e=a(this,et).getMode()){switch(A(this,Wt,sm).call(this),e){case ct.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case ct.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case ct.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;if(t.toggle("nonEditing",!1),e===ct.POPUP)t.toggle("commentEditing",!0);else{t.toggle("commentEditing",!1);for(const n of a(Tn,Va).values())t.toggle(`${n._type}Editing`,e===n._editorType)}this.div.hidden=!1}hasTextLayer(e){var t;return e===((t=a(this,Le))==null?void 0:t.div)}setEditingState(e){a(this,et).setEditingState(e)}addCommands(e){a(this,et).addCommands(e)}cleanUndoStack(e){a(this,et).cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var t;(t=a(this,ja))==null||t.togglePointerEvents(e)}async enable(){var n;g(this,rc,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),(n=a(this,Ha))==null||n.abort(),g(this,Ha,null);const e=new Set;for(const r of a(this,Wt,u0))r.enableEditing(),r.show(!0),r.annotationElementId&&(a(this,et).removeChangedExistingAnnotation(r),e.add(r.annotationElementId));const t=a(this,ja);if(t)for(const r of t.getEditableAnnotations()){if(r.hide(),a(this,et).isDeletedAnnotationElement(r.data.id)||e.has(r.data.id))continue;const i=await this.deserialize(r);i&&(this.addOrRebuild(i),i.enableEditing())}g(this,rc,!1),a(this,et)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){var r;if(g(this,nc,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),a(this,Le)&&!a(this,Ha)){g(this,Ha,new AbortController);const i=a(this,et).combinedSignal(a(this,Ha));a(this,Le).div.addEventListener("pointerdown",s=>{const{clientX:l,clientY:u,timeStamp:c}=s,d=a(this,ic);if(c-d>500){g(this,ic,c);return}g(this,ic,-1);const{classList:f}=this.div;f.toggle("getElements",!0);const p=document.elementsFromPoint(l,u);if(f.toggle("getElements",!1),!this.div.contains(p[0]))return;let m;const v=new RegExp(`^${xd}[0-9]+$`);for(const E of p)if(v.test(E.id)){m=E.id;break}if(!m)return;const y=a(this,wn).get(m);(y==null?void 0:y.annotationElementId)===null&&(ee(s),y.dblclick(s))},{signal:i,capture:!0})}const e=a(this,ja),t=[];if(e){const i=new Map,s=new Map;for(const o of a(this,Wt,u0)){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);(r=this.getEditableAnnotation(o.annotationElementId))==null||r.show(),o.remove()}for(const o of e.getEditableAnnotations()){const{id:l}=o.data;if(a(this,et).isDeletedAnnotationElement(l)){o.updateEdited({deleted:!0});continue}let u=s.get(l);if(u){u.resetAnnotationElement(o),u.show(!1),o.show();continue}u=i.get(l),u&&(a(this,et).addChangedExistingAnnotation(u),u.renderAnnotationElement(o)&&u.show(!1)),o.show()}}A(this,Wt,sm).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:n}=this.div;for(const i of a(Tn,Va).values())n.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),e==null||e.updateFakeAnnotations(t),g(this,nc,!1)}getEditableAnnotation(e){var t;return((t=a(this,ja))==null?void 0:t.getEditableAnnotation(e))||null}setActiveEditor(e){a(this,et).getActive()!==e&&a(this,et).setActiveEditor(e)}enableTextSelection(){var e;if(this.div.tabIndex=-1,(e=a(this,Le))!=null&&e.div&&!a(this,gs)){g(this,gs,new AbortController);const t=a(this,et).combinedSignal(a(this,gs));a(this,Le).div.addEventListener("pointerdown",A(this,Wt,uw).bind(this),{signal:t}),a(this,Le).div.classList.add("highlighting")}}disableTextSelection(){var e;this.div.tabIndex=0,(e=a(this,Le))!=null&&e.div&&a(this,gs)&&(a(this,gs).abort(),g(this,gs,null),a(this,Le).div.classList.remove("highlighting"))}enableClick(){if(a(this,Ua))return;g(this,Ua,new AbortController);const e=a(this,et).combinedSignal(a(this,Ua));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});const t=this.pointerup.bind(this);this.div.addEventListener("pointerup",t,{signal:e}),this.div.addEventListener("pointercancel",t,{signal:e})}disableClick(){var e;(e=a(this,Ua))==null||e.abort(),g(this,Ua,null)}attach(e){a(this,wn).set(e.id,e);const{annotationElementId:t}=e;t&&a(this,et).isDeletedAnnotationElement(t)&&a(this,et).removeDeletedAnnotationElement(e)}detach(e){var t;a(this,wn).delete(e.id),(t=a(this,Gl))==null||t.removePointerInTextLayer(e.contentDiv),!a(this,nc)&&e.annotationElementId&&a(this,et).addDeletedAnnotationElement(e)}remove(e){this.detach(e),a(this,et).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){var t;e.parent!==this&&(e.parent&&e.annotationElementId&&(a(this,et).addDeletedAnnotationElement(e),Gt.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(t=e.parent)==null||t.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),a(this,et).addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!a(this,rc)),a(this,et).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var n;if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!a(this,fs)&&(e._focusEventsAllowed=!1,g(this,fs,setTimeout(()=>{g(this,fs,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:a(this,et)._signal}),t.focus())},0))),e._structTreeParentId=(n=a(this,Gl))==null?void 0:n.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(e.parent=this),e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){const t=()=>e._uiManager.rebuild(e),n=()=>{e.remove()};this.addCommands({cmd:t,undo:n,mustExec:!1})}getEditorByUID(e){for(const t of a(this,wn).values())if(t.uid===e)return t;return null}combinedSignal(e){return a(this,et).combinedSignal(e)}canCreateNewEmptyEditor(){var e;return(e=a(this,Wt,Xr))==null?void 0:e.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await a(this,et).updateMode(e.mode);const{offsetX:n,offsetY:r}=A(this,Wt,d0).call(this),i=a(this,et).getId(),s=A(this,Wt,c0).call(this,{parent:this,id:i,x:n,y:r,uiManager:a(this,et),isCentered:!0,...t});s&&this.add(s)}async deserialize(e){var t;return await((t=a(Tn,Va).get(e.annotationType??e.annotationEditorType))==null?void 0:t.deserialize(e,this,a(this,et)))||null}createAndAddNewEditor(e,t,n={}){const r=a(this,et).getId(),i=A(this,Wt,c0).call(this,{parent:this,id:r,x:e.offsetX,y:e.offsetY,uiManager:a(this,et),isCentered:t,...n});return i&&this.add(i),i}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(e={}){this.createAndAddNewEditor(A(this,Wt,d0).call(this),!0,e)}setSelected(e){a(this,et).setSelected(e)}toggleSelected(e){a(this,et).toggleSelected(e)}unselect(e){a(this,et).unselect(e)}pointerup(e){var r;const{isMac:t}=be.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!a(this,$a)||(g(this,$a,!1),(r=a(this,Wt,Xr))!=null&&r.isDrawer&&a(this,Wt,Xr).supportMultipleDrawings))return;if(!a(this,ec)){g(this,ec,!0);return}const n=a(this,et).getMode();if(n===ct.STAMP||n===ct.POPUP||n===ct.SIGNATURE){a(this,et).unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){var r;if(a(this,et).getMode()===ct.HIGHLIGHT&&this.enableTextSelection(),a(this,$a)){g(this,$a,!1);return}const{isMac:t}=be.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(g(this,$a,!0),(r=a(this,Wt,Xr))!=null&&r.isDrawer){this.startDrawingSession(e);return}const n=a(this,et).getActive();g(this,ec,!n||n.isEmpty())}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),a(this,Br)){a(this,Wt,Xr).startDrawing(this,a(this,et),!1,e);return}a(this,et).setCurrentDrawingSession(this),g(this,Br,new AbortController);const t=a(this,et).combinedSignal(a(this,Br));this.div.addEventListener("blur",({relatedTarget:n})=>{n&&!this.div.contains(n)&&(g(this,ps,null),this.commitOrRemove())},{signal:t}),a(this,Wt,Xr).startDrawing(this,a(this,et),!1,e)}pause(e){if(e){const{activeElement:t}=document;this.div.contains(t)&&g(this,ps,t);return}a(this,ps)&&setTimeout(()=>{var t;(t=a(this,ps))==null||t.focus(),g(this,ps,null)},0)}endDrawingSession(e=!1){return a(this,Br)?(a(this,et).setCurrentDrawingSession(null),a(this,Br).abort(),g(this,Br,null),g(this,ps,null),a(this,Wt,Xr).endDrawing(e)):null}findNewParent(e,t,n){const r=a(this,et).findParent(t,n);return r===null||r===this?!1:(r.changeParent(e),!0)}commitOrRemove(){return a(this,Br)?(this.endDrawingSession(),!0):!1}onScaleChanging(){a(this,Br)&&a(this,Wt,Xr).onScaleChangingWhenDrawing(this)}destroy(){var e,t;this.commitOrRemove(),((e=a(this,et).getActive())==null?void 0:e.parent)===this&&(a(this,et).commitOrRemove(),a(this,et).setActiveEditor(null)),a(this,fs)&&(clearTimeout(a(this,fs)),g(this,fs,null));for(const n of a(this,wn).values())(t=a(this,Gl))==null||t.removePointerInTextLayer(n.contentDiv),n.setParent(null),n.isAttachedToDOM=!1,n.div.remove();this.div=null,a(this,wn).clear(),a(this,et).removeLayer(this)}async render({viewport:e}){this.viewport=e,hh(this.div,e);for(const t of a(this,et).getEditors(this.pageIndex))this.add(t),t.rebuild();await a(this,et).findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:e}){a(this,et).commitOrRemove(),A(this,Wt,sm).call(this);const t=this.viewport.rotation,n=e.rotation;if(this.viewport=e,hh(this.div,{rotation:n}),t!==n)for(const r of a(this,wn).values())r.rotate(n)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return a(this,et).viewParameters.realScale}},Gl=new WeakMap,ec=new WeakMap,ja=new WeakMap,Ua=new WeakMap,fs=new WeakMap,wn=new WeakMap,$a=new WeakMap,nc=new WeakMap,rc=new WeakMap,Br=new WeakMap,ps=new WeakMap,Le=new WeakMap,gs=new WeakMap,Ha=new WeakMap,ic=new WeakMap,et=new WeakMap,Va=new WeakMap,Wt=new WeakSet,u0=function(){return a(this,wn).size!==0?a(this,wn).values():a(this,et).getEditors(this.pageIndex)},uw=function(e){a(this,et).unselectAll();const{target:t}=e;if(t===a(this,Le).div||(t.getAttribute("role")==="img"||t.classList.contains("endOfContent")||t.classList.contains("textLayerImagePlaceholder"))&&a(this,Le).div.contains(t)){const{isMac:n}=be.platform;if(e.button!==0||e.ctrlKey&&n)return;a(this,et).showAllEditors("highlight",!0,!0),a(this,Le).div.classList.add("free"),this.toggleDrawing(),Pm.startHighlighting(this,a(this,et).direction==="ltr",{target:a(this,Le).div,x:e.x,y:e.y}),a(this,Le).div.addEventListener("pointerup",()=>{a(this,Le).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:a(this,et)._signal}),e.preventDefault()}},Xr=function(){return a(Tn,Va).get(a(this,et).getMode())},c0=function(e){const t=a(this,Wt,Xr);return t?new t.prototype.constructor(e):null},d0=function(){const{x:e,y:t,width:n,height:r}=this.boundingClientRect,i=Math.max(0,e),s=Math.max(0,t),o=Math.min(window.innerWidth,e+n),l=Math.min(window.innerHeight,t+r),u=(i+o)/2-e,c=(s+l)/2-t,[d,f]=this.viewport.rotation%180===0?[u,c]:[c,u];return{offsetX:d,offsetY:f}},sm=function(){for(const e of a(this,wn).values())e.isEmpty()&&e.remove()},M(Tn,"_initialized",!1),b(Tn,Va,new Map([Gy,e0,l0,Pm,o0].map(e=>[e._editorType,e]))),Tn);var kr,cn,Xl,he,dp,rv,cw,Ci,f0,dw,p0;let MC=(he=class{constructor(){b(this,Ci);b(this,kr,null);b(this,cn,new Map);b(this,Xl,new Map)}setParent(e){if(!a(this,kr)){g(this,kr,e);return}if(a(this,kr)!==e){if(a(this,cn).size>0)for(const t of a(this,cn).values())t.remove(),e.append(t);g(this,kr,e)}}static get _svgFactory(){return dt(this,"_svgFactory",new Cm)}draw(e,t=!1,n=!1){const r=ie(he,dp)._++,i=A(this,Ci,f0).call(this),s=he._svgFactory.createElement("defs");i.append(s);const o=he._svgFactory.createElement("path");s.append(o);const l=`path_${r}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),t&&a(this,Xl).set(r,o);const u=n?A(this,Ci,dw).call(this,s,l):null,c=he._svgFactory.createElement("use");return i.append(c),c.setAttribute("href",`#${l}`),this.updateProperties(i,e),a(this,cn).set(r,i),{id:r,clipPathId:`url(#${u})`}}drawOutline(e,t){const n=ie(he,dp)._++,r=A(this,Ci,f0).call(this),i=he._svgFactory.createElement("defs");r.append(i);const s=he._svgFactory.createElement("path");i.append(s);const o=`path_${n}`;s.setAttribute("id",o),s.setAttribute("vector-effect","non-scaling-stroke");let l;if(t){const d=he._svgFactory.createElement("mask");i.append(d),l=`mask_${n}`,d.setAttribute("id",l),d.setAttribute("maskUnits","objectBoundingBox");const f=he._svgFactory.createElement("rect");d.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");const p=he._svgFactory.createElement("use");d.append(p),p.setAttribute("href",`#${o}`),p.setAttribute("stroke","none"),p.setAttribute("fill","black"),p.setAttribute("fill-rule","nonzero"),p.classList.add("mask")}const u=he._svgFactory.createElement("use");r.append(u),u.setAttribute("href",`#${o}`),l&&u.setAttribute("mask",`url(#${l})`);const c=u.cloneNode();return r.append(c),u.classList.add("mainOutline"),c.classList.add("secondaryOutline"),this.updateProperties(r,e),a(this,cn).set(n,r),n}finalizeDraw(e,t){a(this,Xl).delete(e),this.updateProperties(e,t)}updateProperties(e,t){var l;if(!t)return;const{root:n,bbox:r,rootClass:i,path:s}=t,o=typeof e=="number"?a(this,cn).get(e):e;if(o){if(n&&A(this,Ci,p0).call(this,o,n),r&&A(l=he,rv,cw).call(l,o,r),i){const{classList:u}=o;for(const[c,d]of Object.entries(i))u.toggle(c,d)}if(s){const c=o.firstElementChild.firstElementChild;A(this,Ci,p0).call(this,c,s)}}}updateParent(e,t){if(t===this)return;const n=a(this,cn).get(e);n&&(a(t,kr).append(n),a(this,cn).delete(e),a(t,cn).set(e,n))}remove(e){a(this,Xl).delete(e),a(this,kr)!==null&&(a(this,cn).get(e).remove(),a(this,cn).delete(e))}destroy(){g(this,kr,null);for(const e of a(this,cn).values())e.remove();a(this,cn).clear(),a(this,Xl).clear()}},kr=new WeakMap,cn=new WeakMap,Xl=new WeakMap,dp=new WeakMap,rv=new WeakSet,cw=function(e,[t,n,r,i]){const{style:s}=e;s.top=`${100*n}%`,s.left=`${100*t}%`,s.width=`${100*r}%`,s.height=`${100*i}%`},Ci=new WeakSet,f0=function(){const e=he._svgFactory.create(1,1,!0);return a(this,kr).append(e),e.setAttribute("aria-hidden",!0),e},dw=function(e,t){const n=he._svgFactory.createElement("clipPath");e.append(n);const r=`clip_${t}`;n.setAttribute("id",r),n.setAttribute("clipPathUnits","objectBoundingBox");const i=he._svgFactory.createElement("use");return n.append(i),i.setAttribute("href",`#${t}`),i.classList.add("clip"),r},p0=function(e,t){for(const[n,r]of Object.entries(t))r===null?e.removeAttribute(n):e.setAttribute(n,r)},b(he,rv),b(he,dp,0),he);function gg(h){return`${(h*100).toFixed(2)}%`}var sc,fp,pp,ac,pi,gi,lo,gp,iv,fw;let LC=(lo=class{constructor(e,t,n,r){b(this,iv);b(this,sc,[]);b(this,fp,new Map);b(this,pp,null);b(this,ac,0);b(this,pi,0);b(this,gi,0);g(this,ac,e),g(this,sc,t),g(this,pi,n.rawDims.pageWidth),g(this,gi,n.rawDims.pageHeight),g(this,pp,r)}render(){const e=document.createElement("div");e.className="textLayerImages";for(let t=0;t{var E;if(!(t.target instanceof HTMLCanvasElement))return;const n=t.target,r=a(this,fp).get(n);if(!r)return;const i=(E=a(lo,gp))==null?void 0:E.deref();if(i===n)return;i&&(i.width=0,i.height=0),g(lo,gp,new WeakRef(n));const{inverseTransform:s,x1:o,y1:l,width:u,height:c}=r,d=a(this,pp).call(this),f=Math.ceil(o*d.width),p=Math.ceil(l*d.height),m=Math.floor((o+u/a(this,pi))*d.width),v=Math.floor((l+c/a(this,gi))*d.height);n.width=m-f,n.height=v-p;const y=n.getContext("2d");y.setTransform(...s),y.translate(-f,-p),y.drawImage(d,0,0)}),e}},sc=new WeakMap,fp=new WeakMap,pp=new WeakMap,ac=new WeakMap,pi=new WeakMap,gi=new WeakMap,gp=new WeakMap,iv=new WeakSet,fw=function([e,t,n,r,i,s]){const o=Math.hypot((i-e)*a(this,pi),(s-t)*a(this,gi)),l=Math.hypot((n-e)*a(this,pi),(r-t)*a(this,gi));if(o=D&&(!P||k))N=S(I,0,D);else{var H=P&&!k&&C?{maxByteLength:m(D,C(I))}:void 0;N=new f(D,H);for(var X=new p(I),j=new p(N),U=v(D,R),z=0;zp;)if(m=d[p++],m!==m)return!0}else for(;f>p;p++)if((o||p in d)&&d[p]===u)return o||p||0;return!o&&-1}};h.exports={includes:s(!0),indexOf:s(!1)}},4527(h,e,t){var n=t(3724),r=t(4376),i=TypeError,s=Object.getOwnPropertyDescriptor,o=n&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(l){return l instanceof TypeError}}();h.exports=o?function(l,u){if(r(l)&&!s(l,"length").writable)throw new i("Cannot set read only .length");return l.length=u}:function(l,u){return l.length=u}},7680(h,e,t){var n=t(9504);h.exports=n([].slice)},6319(h,e,t){var n=t(8551),r=t(9539);h.exports=function(i,s,o,l){try{return l?s(n(o)[0],o[1]):s(o)}catch(u){r(i,"throw",u)}}},2195(h,e,t){var n=t(9504),r=n({}.toString),i=n("".slice);h.exports=function(s){return i(r(s),8,-1)}},6955(h,e,t){var n=t(2140),r=t(4901),i=t(2195),s=t(8227),o=s("toStringTag"),l=Object,u=i(function(){return arguments}())==="Arguments",c=function(d,f){try{return d[f]}catch{}};h.exports=n?i:function(d){var f,p,m;return d===void 0?"Undefined":d===null?"Null":typeof(p=c(f=l(d),o))=="string"?p:u?i(f):(m=i(f))==="Object"&&r(f.callee)?"Arguments":m}},7740(h,e,t){var n=t(9297),r=t(5031),i=t(7347),s=t(4913);h.exports=function(o,l,u){for(var c=r(l),d=s.f,f=i.f,p=0;pt)throw new e("Maximum allowed index exceeded");return n}},8727(h){h.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6193(h,e,t){var n=t(4215);h.exports=n==="NODE"},2839(h,e,t){var n=t(4576),r=n.navigator,i=r&&r.userAgent;h.exports=i?String(i):""},9519(h,e,t){var n=t(4576),r=t(2839),i=n.process,s=n.Deno,o=i&&i.versions||s&&s.version,l=o&&o.v8,u,c;l&&(u=l.split("."),c=u[0]>0&&u[0]<4?1:+(u[0]+u[1])),!c&&r&&(u=r.match(/Edge\/(\d+)/),(!u||u[1]>=74)&&(u=r.match(/Chrome\/(\d+)/),u&&(c=+u[1]))),h.exports=c},4215(h,e,t){var n=t(4576),r=t(2839),i=t(2195),s=function(o){return r.slice(0,o.length)===o};h.exports=function(){return s("Bun/")?"BUN":s("Cloudflare-Workers")?"CLOUDFLARE":s("Deno/")?"DENO":s("Node.js/")?"NODE":n.Bun&&typeof Bun.version=="string"?"BUN":n.Deno&&typeof Deno.version=="object"?"DENO":i(n.process)==="process"?"NODE":n.window&&n.document?"BROWSER":"REST"}()},6518(h,e,t){var n=t(4576),r=t(7347).f,i=t(6699),s=t(6840),o=t(9433),l=t(7740),u=t(2796);h.exports=function(c,d){var f=c.target,p=c.global,m=c.stat,v,y,E,S,w,C;if(p?y=n:m?y=n[f]||o(f,{}):y=n[f]&&n[f].prototype,y)for(E in d){if(w=d[E],c.dontCallGetSet?(C=r(y,E),S=C&&C.value):S=y[E],v=u(p?E:f+(m?".":"#")+E,c.forced),!v&&S!==void 0){if(typeof w==typeof S)continue;l(w,S)}(c.sham||S&&S.sham)&&i(w,"sham",!0),s(y,E,w,c)}}},9039(h){h.exports=function(e){try{return!!e()}catch{return!0}}},8745(h,e,t){var n=t(616),r=Function.prototype,i=r.apply,s=r.call;h.exports=typeof Reflect=="object"&&Reflect.apply||(n?s.bind(i):function(){return s.apply(i,arguments)})},6080(h,e,t){var n=t(7476),r=t(9306),i=t(616),s=n(n.bind);h.exports=function(o,l){return r(o),l===void 0?o:i?s(o,l):function(){return o.apply(l,arguments)}}},616(h,e,t){var n=t(9039);h.exports=!n(function(){var r=(function(){}).bind();return typeof r!="function"||r.hasOwnProperty("prototype")})},9565(h,e,t){var n=t(616),r=Function.prototype.call;h.exports=n?r.bind(r):function(){return r.apply(r,arguments)}},350(h,e,t){var n=t(3724),r=t(9297),i=Function.prototype,s=n&&Object.getOwnPropertyDescriptor,o=r(i,"name"),l=o&&(function(){}).name==="something",u=o&&(!n||n&&s(i,"name").configurable);h.exports={EXISTS:o,PROPER:l,CONFIGURABLE:u}},6706(h,e,t){var n=t(9504),r=t(9306);h.exports=function(i,s,o){try{return n(r(Object.getOwnPropertyDescriptor(i,s)[o]))}catch{}}},7476(h,e,t){var n=t(2195),r=t(9504);h.exports=function(i){if(n(i)==="Function")return r(i)}},9504(h,e,t){var n=t(616),r=Function.prototype,i=r.call,s=n&&r.bind.bind(i,i);h.exports=n?s:function(o){return function(){return i.apply(o,arguments)}}},9429(h,e,t){var n=t(4576),r=t(6193);h.exports=function(i){if(r){try{return n.process.getBuiltinModule(i)}catch{}try{return Function('return require("'+i+'")')()}catch{}}}},7751(h,e,t){var n=t(4576),r=t(4901),i=function(s){return r(s)?s:void 0};h.exports=function(s,o){return arguments.length<2?i(n[s]):n[s]&&n[s][o]}},1767(h){h.exports=function(e){return{iterator:e,next:e.next,done:!1}}},851(h,e,t){var n=t(6955),r=t(5966),i=t(4117),s=t(6269),o=t(8227),l=o("iterator");h.exports=function(u){if(!i(u))return r(u,l)||r(u,"@@iterator")||s[n(u)]}},81(h,e,t){var n=t(9565),r=t(9306),i=t(8551),s=t(6823),o=t(851),l=TypeError;h.exports=function(u,c){var d=arguments.length<2?o(u):c;if(r(d))return i(n(d,u));throw new l(s(u)+" is not iterable")}},5966(h,e,t){var n=t(9306),r=t(4117);h.exports=function(i,s){var o=i[s];return r(o)?void 0:n(o)}},3789(h,e,t){var n=t(9306),r=t(8551),i=t(9565),s=t(1291),o=t(1767),l="Invalid size",u=RangeError,c=TypeError,d=Math.max,f=function(p,m){this.set=p,this.size=d(m,0),this.has=n(p.has),this.keys=n(p.keys)};f.prototype={getIterator:function(){return o(r(i(this.keys,this.set)))},includes:function(p){return i(this.has,this.set,p)}},h.exports=function(p){r(p);var m=+p.size;if(m!==m)throw new c(l);var v=s(m);if(v<0)throw new u(l);return new f(p,v)}},4576(h){var e=function(t){return t&&t.Math===Math&&t};h.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")()},9297(h,e,t){var n=t(9504),r=t(8981),i=n({}.hasOwnProperty);h.exports=Object.hasOwn||function(o,l){return i(r(o),l)}},421(h){h.exports={}},397(h,e,t){var n=t(7751);h.exports=n("document","documentElement")},5917(h,e,t){var n=t(3724),r=t(9039),i=t(4055);h.exports=!n&&!r(function(){return Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a!==7})},7055(h,e,t){var n=t(9504),r=t(9039),i=t(2195),s=Object,o=n("".split);h.exports=r(function(){return!s("z").propertyIsEnumerable(0)})?function(l){return i(l)==="String"?o(l,""):s(l)}:s},3706(h,e,t){var n=t(9504),r=t(4901),i=t(7629),s=n(Function.toString);r(i.inspectSource)||(i.inspectSource=function(o){return s(o)}),h.exports=i.inspectSource},1181(h,e,t){var n=t(8622),r=t(4576),i=t(34),s=t(6699),o=t(9297),l=t(7629),u=t(6119),c=t(421),d="Object already initialized",f=r.TypeError,p=r.WeakMap,m,v,y,E=function(x){return y(x)?v(x):m(x,{})},S=function(x){return function(T){var I;if(!i(T)||(I=v(T)).type!==x)throw new f("Incompatible receiver, "+x+" required");return I}};if(n||l.state){var w=l.state||(l.state=new p);w.get=w.get,w.has=w.has,w.set=w.set,m=function(x,T){if(w.has(x))throw new f(d);return T.facade=x,w.set(x,T),T},v=function(x){return w.get(x)||{}},y=function(x){return w.has(x)}}else{var C=u("state");c[C]=!0,m=function(x,T){if(o(x,C))throw new f(d);return T.facade=x,s(x,C,T),T},v=function(x){return o(x,C)?x[C]:{}},y=function(x){return o(x,C)}}h.exports={set:m,get:v,has:y,enforce:E,getterFor:S}},4209(h,e,t){var n=t(8227),r=t(6269),i=n("iterator"),s=Array.prototype;h.exports=function(o){return o!==void 0&&(r.Array===o||s[i]===o)}},4376(h,e,t){var n=t(2195);h.exports=Array.isArray||function(i){return n(i)==="Array"}},1108(h,e,t){var n=t(6955);h.exports=function(r){var i=n(r);return i==="BigInt64Array"||i==="BigUint64Array"}},4901(h){var e=typeof document=="object"&&document.all;h.exports=typeof e>"u"&&e!==void 0?function(t){return typeof t=="function"||t===e}:function(t){return typeof t=="function"}},2796(h,e,t){var n=t(9039),r=t(4901),i=/#|\.prototype\./,s=function(d,f){var p=l[o(d)];return p===c?!0:p===u?!1:r(f)?n(f):!!f},o=s.normalize=function(d){return String(d).replace(i,".").toLowerCase()},l=s.data={},u=s.NATIVE="N",c=s.POLYFILL="P";h.exports=s},4117(h){h.exports=function(e){return e==null}},34(h,e,t){var n=t(4901);h.exports=function(r){return typeof r=="object"?r!==null:n(r)}},3925(h,e,t){var n=t(34);h.exports=function(r){return n(r)||r===null}},6395(h){h.exports=!1},5810(h,e,t){var n=t(34),r=t(1181).get;h.exports=function(s){if(!n(s))return!1;var o=r(s);return!!o&&o.type==="RawJSON"}},757(h,e,t){var n=t(7751),r=t(4901),i=t(1625),s=t(7040),o=Object;h.exports=s?function(l){return typeof l=="symbol"}:function(l){var u=n("Symbol");return r(u)&&i(u.prototype,o(l))}},507(h,e,t){var n=t(9565);h.exports=function(r,i,s){for(var o=s?r:r.iterator,l=r.next,u,c;!(u=n(l,o)).done;)if(c=i(u.value),c!==void 0)return c}},2652(h,e,t){var n=t(6080),r=t(9565),i=t(8551),s=t(6823),o=t(4209),l=t(6198),u=t(1625),c=t(81),d=t(851),f=t(9539),p=TypeError,m=function(y,E){this.stopped=y,this.result=E},v=m.prototype;h.exports=function(y,E,S){var w=S&&S.that,C=!!(S&&S.AS_ENTRIES),x=!!(S&&S.IS_RECORD),T=!!(S&&S.IS_ITERATOR),I=!!(S&&S.INTERRUPTED),F=n(E,w),P,R,D,k,N,H,X,j=function(G){var nt=P;return P=void 0,nt&&f(nt,"normal"),new m(!0,G)},U=function(G){return C?(i(G),I?F(G[0],G[1],j):F(G[0],G[1])):I?F(G,j):F(G)};if(x)P=y.iterator;else if(T)P=y;else{if(R=d(y),!R)throw new p(s(y)+" is not iterable");if(o(R)){for(D=0,k=l(y);k>D;D++)if(N=U(y[D]),N&&u(v,N))return N;return new m(!1)}P=c(y,R)}for(H=x?y.next:P.next;!(X=r(H,P)).done;){var z=X.value;try{N=U(z)}catch(G){if(P)f(P,"throw",G);else throw G}if(typeof N=="object"&&N&&u(v,N))return N}return new m(!1)}},1385(h,e,t){var n=t(9539);h.exports=function(r,i,s){for(var o=r.length-1;o>=0;o--)if(r[o]!==void 0)try{s=n(r[o].iterator,i,s)}catch(l){i="throw",s=l}if(i==="throw")throw s;return s}},9539(h,e,t){var n=t(9565),r=t(8551),i=t(5966);h.exports=function(s,o,l){var u,c;r(s);try{if(u=i(s,"return"),!u){if(o==="throw")throw l;return l}u=n(u,s)}catch(d){c=!0,u=d}if(o==="throw")throw l;if(c)throw u;return r(u),l}},9462(h,e,t){var n=t(9565),r=t(2360),i=t(6699),s=t(6279),o=t(8227),l=t(1181),u=t(5966),c=t(7657).IteratorPrototype,d=t(2529),f=t(9539),p=t(1385),m=o("toStringTag"),v="IteratorHelper",y="WrapForValidIterator",E="normal",S="throw",w=l.set,C=function(I){var F=l.getterFor(I?y:v);return s(r(c),{next:function(){var R=F(this);if(I)return R.nextHandler();if(R.done)return d(void 0,!0);try{var D=R.nextHandler();return R.returnHandlerResult?D:d(D,R.done)}catch(k){throw R.done=!0,k}},return:function(){var P=F(this),R=P.iterator,D=P.done;if(P.done=!0,I){var k=u(R,"return");return k?n(k,R):d(void 0,!0)}if(D)return d(void 0,!0);if(P.inner)try{f(P.inner.iterator,E)}catch(N){return f(R,S,N)}if(P.openIters)try{p(P.openIters,E)}catch(N){if(R)return f(R,S,N);throw N}return R&&f(R,E),d(void 0,!0)}})},x=C(!0),T=C(!1);i(T,m,"Iterator Helper"),h.exports=function(I,F,P){var R=function(k,N){N?(N.iterator=k.iterator,N.next=k.next):N=k,N.type=F?y:v,N.returnHandlerResult=!!P,N.nextHandler=I,N.counter=0,N.done=!1,w(this,N)};return R.prototype=F?x:T,R}},684(h){h.exports=function(e,t){var n=typeof Iterator=="function"&&Iterator.prototype[e];if(n)try{n.call({next:null},t).next()}catch{return!0}}},4549(h,e,t){var n=t(4576);h.exports=function(r,i){var s=n.Iterator,o=s&&s.prototype,l=o&&o[r],u=!1;if(l)try{l.call({next:function(){return{done:!0}},return:function(){u=!0}},-1)}catch(c){c instanceof i||(u=!1)}if(!u)return l}},7657(h,e,t){var n=t(9039),r=t(4901),i=t(34),s=t(2360),o=t(2787),l=t(6840),u=t(8227),c=t(6395),d=u("iterator"),f=!1,p,m,v;[].keys&&(v=[].keys(),"next"in v?(m=o(o(v)),m!==Object.prototype&&(p=m)):f=!0);var y=!i(p)||n(function(){var E={};return p[d].call(E)!==E});y?p={}:c&&(p=s(p)),r(p[d])||l(p,d,function(){return this}),h.exports={IteratorPrototype:p,BUGGY_SAFARI_ITERATORS:f}},6269(h){h.exports={}},6198(h,e,t){var n=t(8014);h.exports=function(r){return n(r.length)}},283(h,e,t){var n=t(9504),r=t(9039),i=t(4901),s=t(9297),o=t(3724),l=t(350).CONFIGURABLE,u=t(3706),c=t(1181),d=c.enforce,f=c.get,p=String,m=Object.defineProperty,v=n("".slice),y=n("".replace),E=n([].join),S=o&&!r(function(){return m(function(){},"length",{value:8}).length!==8}),w=String(String).split("String"),C=h.exports=function(x,T,I){v(p(T),0,7)==="Symbol("&&(T="["+y(p(T),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),I&&I.getter&&(T="get "+T),I&&I.setter&&(T="set "+T),(!s(x,"name")||l&&x.name!==T)&&(o?m(x,"name",{value:T,configurable:!0}):x.name=T),S&&I&&s(I,"arity")&&x.length!==I.arity&&m(x,"length",{value:I.arity});try{I&&s(I,"constructor")&&I.constructor?o&&m(x,"prototype",{writable:!1}):x.prototype&&(x.prototype=void 0)}catch{}var F=d(x);return s(F,"source")||(F.source=E(w,typeof T=="string"?T:"")),x};Function.prototype.toString=C(function(){return i(this)&&f(this).source||u(this)},"toString")},2248(h,e,t){var n=t(9504),r=Map.prototype;h.exports={Map,set:n(r.set),get:n(r.get),has:n(r.has),remove:n(r.delete),proto:r}},741(h){var e=Math.ceil,t=Math.floor;h.exports=Math.trunc||function(r){var i=+r;return(i>0?t:e)(i)}},7819(h,e,t){var n=t(9039);h.exports=!n(function(){var r="9007199254740993",i=JSON.rawJSON(r);return!JSON.isRawJSON(i)||JSON.stringify(i)!==r})},6043(h,e,t){var n=t(9306),r=TypeError,i=function(s){var o,l;this.promise=new s(function(u,c){if(o!==void 0||l!==void 0)throw new r("Bad Promise constructor");o=u,l=c}),this.resolve=n(o),this.reject=n(l)};h.exports.f=function(s){return new i(s)}},2360(h,e,t){var n=t(8551),r=t(6801),i=t(8727),s=t(421),o=t(397),l=t(4055),u=t(6119),c=">",d="<",f="prototype",p="script",m=u("IE_PROTO"),v=function(){},y=function(x){return d+p+c+x+d+"/"+p+c},E=function(x){x.write(y("")),x.close();var T=x.parentWindow.Object;return x=null,T},S=function(){var x=l("iframe"),T="java"+p+":",I;return x.style.display="none",o.appendChild(x),x.src=String(T),I=x.contentWindow.document,I.open(),I.write(y("document.F=Object")),I.close(),I.F},w,C=function(){try{w=new ActiveXObject("htmlfile")}catch{}C=typeof document<"u"?document.domain&&w?E(w):S():E(w);for(var x=i.length;x--;)delete C[f][i[x]];return C()};s[m]=!0,h.exports=Object.create||function(T,I){var F;return T!==null?(v[f]=n(T),F=new v,v[f]=null,F[m]=T):F=C(),I===void 0?F:r.f(F,I)}},6801(h,e,t){var n=t(3724),r=t(8686),i=t(4913),s=t(8551),o=t(5397),l=t(1072);e.f=n&&!r?Object.defineProperties:function(c,d){s(c);for(var f=o(d),p=l(d),m=p.length,v=0,y;m>v;)i.f(c,y=p[v++],f[y]);return c}},4913(h,e,t){var n=t(3724),r=t(5917),i=t(8686),s=t(8551),o=t(6969),l=TypeError,u=Object.defineProperty,c=Object.getOwnPropertyDescriptor,d="enumerable",f="configurable",p="writable";e.f=n?i?function(v,y,E){if(s(v),y=o(y),s(E),typeof v=="function"&&y==="prototype"&&"value"in E&&p in E&&!E[p]){var S=c(v,y);S&&S[p]&&(v[y]=E.value,E={configurable:f in E?E[f]:S[f],enumerable:d in E?E[d]:S[d],writable:!1})}return u(v,y,E)}:u:function(v,y,E){if(s(v),y=o(y),s(E),r)try{return u(v,y,E)}catch{}if("get"in E||"set"in E)throw new l("Accessors not supported");return"value"in E&&(v[y]=E.value),v}},7347(h,e,t){var n=t(3724),r=t(9565),i=t(8773),s=t(6980),o=t(5397),l=t(6969),u=t(9297),c=t(5917),d=Object.getOwnPropertyDescriptor;e.f=n?d:function(p,m){if(p=o(p),m=l(m),c)try{return d(p,m)}catch{}if(u(p,m))return s(!r(i.f,p,m),p[m])}},8480(h,e,t){var n=t(1828),r=t(8727),i=r.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(o){return n(o,i)}},3717(h,e){e.f=Object.getOwnPropertySymbols},2787(h,e,t){var n=t(9297),r=t(4901),i=t(8981),s=t(6119),o=t(2211),l=s("IE_PROTO"),u=Object,c=u.prototype;h.exports=o?u.getPrototypeOf:function(d){var f=i(d);if(n(f,l))return f[l];var p=f.constructor;return r(p)&&f instanceof p?p.prototype:f instanceof u?c:null}},1625(h,e,t){var n=t(9504);h.exports=n({}.isPrototypeOf)},1828(h,e,t){var n=t(9504),r=t(9297),i=t(5397),s=t(9617).indexOf,o=t(421),l=n([].push);h.exports=function(u,c){var d=i(u),f=0,p=[],m;for(m in d)!r(o,m)&&r(d,m)&&l(p,m);for(;c.length>f;)r(d,m=c[f++])&&(~s(p,m)||l(p,m));return p}},1072(h,e,t){var n=t(1828),r=t(8727);h.exports=Object.keys||function(s){return n(s,r)}},8773(h,e){var t={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!t.call({1:2},1);e.f=r?function(s){var o=n(this,s);return!!o&&o.enumerable}:t},2967(h,e,t){var n=t(6706),r=t(34),i=t(7750),s=t(3506);h.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var o=!1,l={},u;try{u=n(Object.prototype,"__proto__","set"),u(l,[]),o=l instanceof Array}catch{}return function(d,f){return i(d),s(f),r(d)&&(o?u(d,f):d.__proto__=f),d}}():void 0)},4270(h,e,t){var n=t(9565),r=t(4901),i=t(34),s=TypeError;h.exports=function(o,l){var u,c;if(l==="string"&&r(u=o.toString)&&!i(c=n(u,o))||r(u=o.valueOf)&&!i(c=n(u,o))||l!=="string"&&r(u=o.toString)&&!i(c=n(u,o)))return c;throw new s("Can't convert object to primitive value")}},5031(h,e,t){var n=t(7751),r=t(9504),i=t(8480),s=t(3717),o=t(8551),l=r([].concat);h.exports=n("Reflect","ownKeys")||function(c){var d=i.f(o(c)),f=s.f;return f?l(d,f(c)):d}},8235(h,e,t){var n=t(9504),r=t(9297),i=SyntaxError,s=parseInt,o=String.fromCharCode,l=n("".charAt),u=n("".slice),c=n(/./.exec),d={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":` `,"\\r":"\r","\\t":" "},f=/^[\da-f]{4}$/i,p=/^[\u0000-\u001F]$/;h.exports=function(m,v){for(var y=!0,E="";vv.size?l(v.getIterator(),function(E){d(m,E)&&c(y,E)}):o(m,function(E){v.includes(E)&&c(y,E)}),y}},4449(h,e,t){var n=t(7080),r=t(4402).has,i=t(5170),s=t(3789),o=t(8469),l=t(507),u=t(9539);h.exports=function(d){var f=n(this),p=s(d);if(i(f)<=p.size)return o(f,function(v){if(p.includes(v))return!1},!0)!==!1;var m=p.getIterator();return l(m,function(v){if(r(f,v))return u(m.iterator,"normal",!1)})!==!1}},3838(h,e,t){var n=t(7080),r=t(5170),i=t(8469),s=t(3789);h.exports=function(l){var u=n(this),c=s(l);return r(u)>c.size?!1:i(u,function(d){if(!c.includes(d))return!1},!0)!==!1}},8527(h,e,t){var n=t(7080),r=t(4402).has,i=t(5170),s=t(3789),o=t(507),l=t(9539);h.exports=function(c){var d=n(this),f=s(c);if(i(d)C&&(x=u(x,0,C)),f?y+x:x+y)}};h.exports={start:d(!1),end:d(!0)}},2333(h,e,t){var n=t(1291),r=t(655),i=t(7750),s=RangeError,o=Math.floor;h.exports=function(u){var c=r(i(this)),d="",f=n(u);if(f<0||f===1/0)throw new s("Wrong number of repetitions");for(;f>0;(f=o(f/2))&&(c+=c))f%2&&(d+=c);return d}},1548(h,e,t){var n=t(4576),r=t(9039),i=t(9519),s=t(4215),o=n.structuredClone;h.exports=!!o&&!r(function(){if(s==="DENO"&&i>92||s==="NODE"&&i>94||s==="BROWSER"&&i>97)return!1;var l=new ArrayBuffer(8),u=o(l,{transfer:[l]});return l.byteLength!==0||u.byteLength!==8})},4495(h,e,t){var n=t(9519),r=t(9039),i=t(4576),s=i.String;h.exports=!!Object.getOwnPropertySymbols&&!r(function(){var o=Symbol("symbol detection");return!s(o)||!(Object(o)instanceof Symbol)||!Symbol.sham&&n&&n<41})},5610(h,e,t){var n=t(1291),r=Math.max,i=Math.min;h.exports=function(s,o){var l=n(s);return l<0?r(l+o,0):i(l,o)}},5854(h,e,t){var n=t(2777),r=TypeError;h.exports=function(i){var s=n(i,"number");if(typeof s=="number")throw new r("Can't convert number to bigint");return BigInt(s)}},7696(h,e,t){var n=t(1291),r=t(8014),i=RangeError;h.exports=function(s){if(s===void 0)return 0;var o=n(s),l=r(o);if(o!==l)throw new i("Wrong length or index");return l}},5397(h,e,t){var n=t(7055),r=t(7750);h.exports=function(i){return n(r(i))}},1291(h,e,t){var n=t(741);h.exports=function(r){var i=+r;return i!==i||i===0?0:n(i)}},8014(h,e,t){var n=t(1291),r=Math.min;h.exports=function(i){var s=n(i);return s>0?r(s,9007199254740991):0}},8981(h,e,t){var n=t(7750),r=Object;h.exports=function(i){return r(n(i))}},2777(h,e,t){var n=t(9565),r=t(34),i=t(757),s=t(5966),o=t(4270),l=t(8227),u=TypeError,c=l("toPrimitive");h.exports=function(d,f){if(!r(d)||i(d))return d;var p=s(d,c),m;if(p){if(f===void 0&&(f="default"),m=n(p,d,f),!r(m)||i(m))return m;throw new u("Can't convert object to primitive value")}return f===void 0&&(f="number"),o(d,f)}},6969(h,e,t){var n=t(2777),r=t(757);h.exports=function(i){var s=n(i,"string");return r(s)?s:s+""}},2140(h,e,t){var n=t(8227),r=n("toStringTag"),i={};i[r]="z",h.exports=String(i)==="[object z]"},655(h,e,t){var n=t(6955),r=String;h.exports=function(i){if(n(i)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return r(i)}},6823(h){var e=String;h.exports=function(t){try{return e(t)}catch{return"Object"}}},3392(h,e,t){var n=t(9504),r=0,i=Math.random(),s=n(1.1.toString);h.exports=function(o){return"Symbol("+(o===void 0?"":o)+")_"+s(++r+i,36)}},7416(h,e,t){var n=t(9039),r=t(8227),i=t(3724),s=t(6395),o=r("iterator");h.exports=!n(function(){var l=new URL("b?a=1&b=2&c=3","https://a"),u=l.searchParams,c=new URLSearchParams("a=1&a=2&b=3"),d="";return l.pathname="c%20d",u.forEach(function(f,p){u.delete("b"),d+=p+f}),c.delete("a",2),c.delete("b",void 0),s&&(!l.toJSON||!c.has("a",1)||c.has("a",2)||!c.has("a",void 0)||c.has("b"))||!u.size&&(s||!i)||!u.sort||l.href!=="https://a/c%20d?a=1&c=3"||u.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!u[o]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("https://тест").host!=="xn--e1aybc"||new URL("https://a#б").hash!=="#%D0%B1"||d!=="a1c3"||new URL("https://x",void 0).host!=="x"})},7040(h,e,t){var n=t(4495);h.exports=n&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},8686(h,e,t){var n=t(3724),r=t(9039);h.exports=n&&r(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})},2812(h){var e=TypeError;h.exports=function(t,n){if(t1?arguments[1]:void 0)}}),s("includes")},4114(h,e,t){var n=t(6518),r=t(8981),i=t(6198),s=t(4527),o=t(6837),l=t(9039),u=l(function(){return[].push.call({length:4294967296},1)!==4294967297}),c=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(f){return f instanceof TypeError}},d=u||!c();n({target:"Array",proto:!0,arity:1,forced:d},{push:function(p){var m=r(this),v=i(m),y=arguments.length;o(v+y);for(var E=0;E@`~"+l+"]"),S=r(v.exec),w={" ":"t","\n":"n","\v":"v","\f":"f","\r":"r"},C=function(T){var I=p(f(T,0),16);return I.length<3?"\\x"+o(I,2,"0"):"\\u"+o(I,4,"0")},x=!c||c("ab")!=="\\x61b";n({target:"RegExp",stat:!0,forced:x},{escape:function(I){i(I);for(var F=I.length,P=u(F),R=0;R=56320||R+1>=F||(f(I,R+1)&64512)!==56320?P[R]=C(D):(P[R]=D,P[++R]=d(I,R))}}return m(P,"")}})},7642(h,e,t){var n=t(6518),r=t(3440),i=t(9039),s=t(4916),o=!s("difference",function(u){return u.size===0}),l=o||i(function(){var u={size:1,has:function(){return!0},keys:function(){var d=0;return{next:function(){var f=d++>1;return c.has(1)&&c.clear(),{done:f,value:2}}}}},c=new Set([1,2,3,4]);return c.difference(u).size!==3});n({target:"Set",proto:!0,real:!0,forced:l},{difference:r})},8004(h,e,t){var n=t(6518),r=t(9039),i=t(8750),s=t(4916),o=!s("intersection",function(l){return l.size===2&&l.has(1)&&l.has(2)})||r(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:i})},3853(h,e,t){var n=t(6518),r=t(4449),i=t(4916),s=!i("isDisjointFrom",function(o){return!o});n({target:"Set",proto:!0,real:!0,forced:s},{isDisjointFrom:r})},5876(h,e,t){var n=t(6518),r=t(3838),i=t(4916),s=!i("isSubsetOf",function(o){return o});n({target:"Set",proto:!0,real:!0,forced:s},{isSubsetOf:r})},2475(h,e,t){var n=t(6518),r=t(8527),i=t(4916),s=!i("isSupersetOf",function(o){return!o});n({target:"Set",proto:!0,real:!0,forced:s},{isSupersetOf:r})},5024(h,e,t){var n=t(6518),r=t(3650),i=t(9835),s=t(4916),o=!s("symmetricDifference")||!i("symmetricDifference");n({target:"Set",proto:!0,real:!0,forced:o},{symmetricDifference:r})},1698(h,e,t){var n=t(6518),r=t(4204),i=t(9835),s=t(4916),o=!s("union")||!i("union");n({target:"Set",proto:!0,real:!0,forced:o},{union:r})},9577(h,e,t){var n=t(4644),r=t(1108),i=t(6198),s=t(1291),o=t(5854),l=n.aTypedArray,u=n.getTypedArrayConstructor,c=n.exportTypedArrayMethod,d=RangeError,f=function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(m){return m===8}}(),p=f&&function(){try{new Int8Array(1).with(-.5,1)}catch{return!0}}();c("with",function(m,v){var y=l(this),E=i(y),S=s(m),w=S<0?E+S:S,C=r(y)?o(v):+v;if(w>=E||w<0)throw new d("Incorrect index");for(var x=new(u(y))(E),T=0;T{for(var t in e)Ct.o(e,t)&&!Ct.o(h,t)&&Object.defineProperty(h,t,{enumerable:!0,get:e[t]})};Ct.o=(h,e)=>Object.prototype.hasOwnProperty.call(h,e);Ct(4114);Ct(6573);Ct(8100);Ct(7936);Ct(8111);Ct(2489);Ct(7588);Ct(1701);Ct(3110);Ct(5367);Ct(2731);Ct(4628);Ct(6069);Ct(7642);Ct(8004);Ct(3853);Ct(5876);Ct(2475);Ct(5024);Ct(1698);Ct(9577);const{AbortException:BC,AnnotationEditorLayer:kC,AnnotationEditorParamsType:RI,AnnotationEditorType:vn,AnnotationEditorUIManager:jC,AnnotationLayer:UC,AnnotationMode:xi,AnnotationType:pw,applyOpacity:FI,build:DI,ColorPicker:OI,createValidAbsoluteUrl:gw,CSSConstants:MI,DOMSVGFactory:LI,DrawLayer:$C,FeatureTest:mw,fetchData:i1,findContrastColor:NI,getDocument:BI,getFilenameFromUrl:kI,getPdfFilenameFromUrl:HC,getRGB:jI,getRGBA:UI,getUuid:$I,getXfaPageViewport:HI,GlobalWorkerOptions:VI,ImageKind:WI,InvalidPDFException:zI,isDataScheme:GI,isPdfFile:VC,isValidExplicitDest:WC,makeArr:zC,makeMap:GC,makeObj:XI,MathClamp:XC,noContextMenu:_I,normalizeUnicode:_C,OPS:YI,OutputScale:am,PasswordResponses:KI,PDFDataRangeTransport:JI,PDFDateString:ZI,PDFWorker:QI,PermissionFlag:gh,PixelsPerInch:Li,RenderingCancelledException:g0,renderRichText:qI,ResponseException:tR,setLayerDimensions:vw,shadow:Id,SignatureExtractor:eR,stopEvent:m0,SupportedImageMimeTypes:nR,TextLayer:YC,TextLayerImages:KC,TouchManager:rR,updateUrlHash:JC,Util:fb,VerbosityLevel:iR,version:s1,XfaLayer:Dv}=globalThis.pdfjsLib,wr={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};function ZC(h){return h<11904}function QC(h){return(h&65408)===0}function qC(h){return h>=97&&h<=122||h>=65&&h<=90}function tT(h){return h>=48&&h<=57}function eT(h){return h===32||h===9||h===13||h===10}function nT(h){return h>=13312&&h<=40959||h>=63744&&h<=64255}function rT(h){return h>=12448&&h<=12543}function iT(h){return h>=12352&&h<=12447}function sT(h){return h>=65376&&h<=65439}function aT(h){return(h&65408)===3584}function mg(h){return ZC(h)?QC(h)?eT(h)?wr.SPACE:qC(h)||tT(h)||h===95?wr.ALPHA_LETTER:wr.PUNCT:aT(h)?wr.THAI_LETTER:h===160?wr.SPACE:wr.ALPHA_LETTER:nT(h)?wr.HAN_LETTER:rT(h)?wr.KATAKANA_LETTER:iT(h)?wr.HIRAGANA_LETTER:sT(h)?wr.HALFWIDTH_KATAKANA_LETTER:wr.ALPHA_LETTER}let fo;function oT(){if(!fo){const h=[],e=[],t=new RegExp("^\\p{M}$","u");for(let r=0;r<65536;r++){if(r>=55296&&r<=57343)continue;const i=String.fromCharCode(r);if(i.normalize("NFKC")!==i&&!t.test(i)){if(e.length!==2){e[0]=e[1]=r;continue}e[1]+1!==r?(e[0]===e[1]?h.push(String.fromCharCode(e[0])):h.push(`${String.fromCharCode(e[0])}-${String.fromCharCode(e[1])}`),e[0]=e[1]=r):e[1]=r}}const n=h.join("");if(!fo)fo=n;else if(n!==fo){for(let r=1;ru),r.lastX=l;const c=h.scrollTop,d=r.lastY;c!==d&&(r.down=c>d),r.lastY=c,e(r)}))},r={right:!0,down:!0,lastX:h.scrollLeft,lastY:h.scrollTop,_eventHandler:n};let i=null;return h.addEventListener("scroll",n,{useCapture:!0,signal:t}),t==null||t.addEventListener("abort",()=>window.cancelAnimationFrame(i),{once:!0}),r}function xv(h){const e=new Map;for(const[t,n]of new URLSearchParams(h))e.set(t.toLowerCase(),n);return e}const h1=/[\x00-\x1F]/g;function bd(h,e=!1){return h1.test(h)?e?h.replaceAll(h1,t=>t==="\0"?"":" "):h.replaceAll("\0",""):h}function Rd(h,e,t=0){let n=t,r=h.length-1;if(r<0||!e(h[r]))return h.length;if(e(h[n]))return n;for(;n>1,s=h[i];e(s)?r=i:n=i+1}return n}function u1(h){if(Math.floor(h)===h)return[h,1];const e=1/h,t=8;if(e>t)return[1,t];if(Math.floor(e)===e)return[1,e];const n=h>1?e:h;let r=0,i=1,s=1,o=1;for(;;){const u=r+s,c=i+o;if(c>t)break;n<=u/c?(s=u,o=c):(r=u,i=c)}let l;return n-r/i=t&&(n=e[h-1].div,r=n.offsetTop+n.clientTop);for(let i=h-2;i>=0&&(n=e[i].div,!(n.offsetTop+n.clientTop+n.clientHeight<=r));--i)h=i;return h}function gT({scrollEl:h,views:e,sortByVisibility:t=!1,horizontal:n=!1,rtl:r=!1}){const i=h.scrollTop,s=i+h.clientHeight,o=h.scrollLeft,l=o+h.clientWidth;function u(S){const w=S.div;return w.offsetTop+w.clientTop+w.clientHeight>i}function c(S){const w=S.div,C=w.offsetLeft+w.clientLeft,x=C+w.clientWidth;return r?Co}const d=[],f=new Set,p=e.length;let m=Rd(e,n?c:u);m>0&&m=s&&(v=R);else if((n?x:T)>v)break;if(R<=i||T>=s||P<=o||x>=l)continue;const D=Math.max(0,i-T),k=Math.max(0,o-x),N=D+Math.max(0,R-s),H=k+Math.max(0,P-l),X=(F-N)/F,j=(I-H)/I,U=X*j*100|0;d.push({id:w.id,x,y:T,visibleArea:U===100?null:{minX:k,minY:D,maxX:Math.min(P,l)-x,maxY:Math.min(R,s)-T},view:w,percent:U,widthPercent:j*100|0}),f.add(w.id)}const y=d[0],E=d.at(-1);return t&&d.sort(function(S,w){const C=S.percent-w.percent;return Math.abs(C)>.001?-C:S.id-w.id}),{first:y,last:E,views:d,ids:f}}function bw(h){return Number.isInteger(h)&&h%90===0}function mT(h){return Number.isInteger(h)&&Object.values(St).includes(h)&&h!==St.UNKNOWN}function vT(h){return Number.isInteger(h)&&Object.values(tn).includes(h)&&h!==tn.UNKNOWN}function c1(h){return h.width<=h.height}new Promise(function(h){window.requestAnimationFrame(h)});const yT=document.documentElement.style;var Wa,_l,za,oc,Yl;class bT{constructor(e){b(this,Wa,null);b(this,_l,null);b(this,za,0);b(this,oc,null);b(this,Yl,!0);g(this,Wa,e.classList),g(this,oc,e.style)}get percent(){return a(this,za)}set percent(e){if(g(this,za,e),isNaN(e)){a(this,Wa).add("indeterminate");return}a(this,Wa).remove("indeterminate"),a(this,oc).setProperty("--progressBar-percent",`${a(this,za)}%`)}setWidth(e){if(!e)return;const n=e.parentNode.offsetWidth-e.offsetWidth;n>0&&a(this,oc).setProperty("--progressBar-end-offset",`${n}px`)}setDisableAutoFetch(e=5e3){a(this,za)===100||isNaN(a(this,za))||(a(this,_l)&&clearTimeout(a(this,_l)),this.show(),g(this,_l,setTimeout(()=>{g(this,_l,null),this.hide()},e)))}hide(){a(this,Yl)&&(g(this,Yl,!1),a(this,Wa).add("hidden"))}show(){a(this,Yl)||(g(this,Yl,!0),a(this,Wa).remove("hidden"))}}Wa=new WeakMap,_l=new WeakMap,za=new WeakMap,oc=new WeakMap,Yl=new WeakMap;function AT(h){let e=St.VERTICAL,t=tn.NONE;switch(h){case"SinglePage":e=St.PAGE;break;case"OneColumn":break;case"TwoPageLeft":e=St.PAGE;case"TwoColumnLeft":t=tn.ODD;break;case"TwoPageRight":e=St.PAGE;case"TwoColumnRight":t=tn.EVEN;break}return{scrollMode:e,spreadMode:t}}const yg=function(){const h=document.createElement("div");return h.style.width="round(down, calc(1.6666666666666665 * 792px), 1px)",h.style.width==="calc(1320px)"?Math.fround:e=>e}(),zs={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3},ET=250,d1={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"},f1=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]);let p1;const wT=new RegExp("\\p{M}+","gu"),xT=new RegExp("([+^$|])|(\\p{P}+)|(\\s+)|(\\p{M})|(\\p{L})","gu"),ST=new RegExp("([^\\p{M}])\\p{M}*$","u"),CT=new RegExp("^\\p{M}*([^\\p{M}])","u"),TT=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,g1=new Map,PT="[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]",m1=new Map;let Mv=null,Lv=null;function om(h,e={}){const t=[];let n;for(;(n=TT.exec(h))!==null;){let{index:S}=n;for(const w of n[0]){let C=g1.get(w);C||(C=w.normalize("NFD").length,g1.set(w,C)),t.push([C,S++])}}const r=t.length>0,i=e.ignoreDashEOL??!1;let s;if(!r&&Mv)s=Mv;else if(r&&Lv)s=Lv;else{const S=Object.keys(d1).join(""),w=oT(),I=[`[${S}]`,`[${w}]`,"(?:゙|゚)\\n","\\p{M}+(?:-\\n)?","\\p{Ll}-\\n(?=\\p{Ll})|\\p{Lu}-\\n(?=\\p{L})","\\S-\\n","(?:\\p{Ideographic}|[぀-ヿ])\\n","\\n",r?PT:"\\u0000"];s=new RegExp(I.map(F=>`(${F})`).join("|"),"gum"),r?Lv=s:Mv=s}const o=[];for(;(n=wT.exec(h))!==null;)o.push([n[0].length,n.index]);let l=h.normalize("NFD");const u=[0,0];let c=0,d=0,f=0,p=0,m=0,v=!1;l=l.replace(s,(S,w,C,x,T,I,F,P,R,D,k)=>{var N,H,X;if(k-=p,w){const j=d1[w],U=j.length;for(let z=1;z>1),E=new Int32Array(u.length>>1);for(let S=0,w=u.length;S>1]=u[S],E[S>>1]=u[S+1];return[l,[y,E],v]}function Aw(h,e,t){if(!h)return[e,t];const[n,r]=h,i=e,s=e+t-1;let o=Rd(n,f=>f>=i);n[o]>i&&--o;let l=Rd(n,f=>f>=s,o);n[l]>s&&--l;const u=i+r[o],d=s+r[l]+1-u;return[u,d]}var ve,lc,Kl,mi,ms,tt,Ew,v0,y0,ww,xw,b0,Sw,Cw,lm,cd,yo,Tw,A0,E0,hm,Pw,Iw,w0,x0,dd;class IT{constructor({linkService:e,eventBus:t,updateMatchesCountOnProgress:n=!0}){b(this,tt);b(this,ve,null);b(this,lc,!0);b(this,Kl,0);b(this,mi,null);b(this,ms,null);this._linkService=e,this._eventBus=t,g(this,lc,n),this.onIsPageVisible=null,A(this,tt,v0).call(this),t._on("find",A(this,tt,Ew).bind(this)),t._on("findbarclose",A(this,tt,Iw).bind(this)),t._on("pagesedited",A(this,tt,Pw).bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return a(this,ve)}setDocument(e){this._pdfDocument&&A(this,tt,v0).call(this),e&&(this._pdfDocument=e,this._firstPageCapability.resolve())}scrollMatchIntoView({element:e=null,pageIndex:t=-1,matchIndex:n=-1}){if(!(!this._scrollMatches||!e)){{if(n===-1||n!==this._selected.matchIdx)return;if(t===-1||t!==this._selected.pageIdx)return}this._scrollMatches=!1,e.scrollIntoView({block:"start",inline:"center"})}}match(e,t,n){const r=this._hasDiacritics[n];let i=!1;if(typeof e=="string"?[i,e]=A(this,tt,b0).call(this,e,r):e=e.sort().reverse().map(d=>{const[f,p]=A(this,tt,b0).call(this,d,r);return i||(i=f),`(${p})`}).join("|"),!e)return;const{caseSensitive:s,entireWord:o}=a(this,ve),l=`g${i?"u":""}${s?"":"i"}`;e=new RegExp(e,l);const u=[];let c;for(;(c=e.exec(t))!==null;)o&&!A(this,tt,xw).call(this,t,c.index,c[0].length)||u.push({index:c.index,length:c[0].length});return u}}ve=new WeakMap,lc=new WeakMap,Kl=new WeakMap,mi=new WeakMap,ms=new WeakMap,tt=new WeakSet,Ew=function(e){if(!e)return;const t=this._pdfDocument,{type:n}=e;(a(this,ve)===null||A(this,tt,ww).call(this,e))&&(this._dirtyMatch=!0),g(this,ve,e),n!=="highlightallchange"&&A(this,tt,dd).call(this,zs.PENDING),this._firstPageCapability.promise.then(()=>{if(!this._pdfDocument||t&&this._pdfDocument!==t)return;A(this,tt,Cw).call(this);const r=!this._highlightMatches,i=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),n?this._dirtyMatch?A(this,tt,yo).call(this):n==="again"?(A(this,tt,yo).call(this),r&&a(this,ve).highlightAll&&A(this,tt,cd).call(this)):n==="highlightallchange"?(i?A(this,tt,yo).call(this):this._highlightMatches=!0,A(this,tt,cd).call(this)):A(this,tt,yo).call(this):this._findTimeout=setTimeout(()=>{A(this,tt,yo).call(this),this._findTimeout=null},ET)})},v0=function(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],g(this,Kl,0),g(this,ve,null),this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,g(this,mi,null),this._firstPageCapability=Promise.withResolvers()},y0=function(){const{query:e}=a(this,ve);return typeof e=="string"?(e!==this._rawQuery&&(this._rawQuery=e,[this._normalizedQuery]=om(e)),this._normalizedQuery):(e||[]).filter(t=>!!t).map(t=>om(t)[0])},ww=function(e){var s;const t=e.query,n=a(this,ve).query,r=typeof t;if(r!==typeof n)return!0;if(r==="string"){if(t!==n)return!0}else if(JSON.stringify(t)!==JSON.stringify(n))return!0;switch(e.type){case"again":const o=this._selected.pageIdx+1,l=this._linkService;return o>=1&&o<=l.pagesCount&&o!==l.page&&!(((s=this.onIsPageVisible)==null?void 0:s.call(this,o))??!0);case"highlightallchange":return!1}return!0},xw=function(e,t,n){let r=e.slice(0,t).match(ST);if(r){const i=e.charCodeAt(t),s=r[1].charCodeAt(0);if(mg(i)===mg(s))return!1}if(r=e.slice(t+n).match(CT),r){const i=e.charCodeAt(t+n-1),s=r[1].charCodeAt(0);if(mg(i)===mg(s))return!1}return!0},b0=function(e,t){const{matchDiacritics:n}=a(this,ve);let r=!1;const i=(o,l)=>o===e?l:e.startsWith(o)?`${l}[ ]*`:e.endsWith(o)?`[ ]*${l}`:`[ ]*${l}[ ]*`;e=e.replaceAll(xT,(o,l,u,c,d,f)=>l?i(l,RegExp.escape(l)):u?i(u,RegExp.escape(u)):c?"[ ]+":n?d||f:d?f1.has(d.charCodeAt(0))?d:"":t?(r=!0,`${f}\\p{M}*`):f);const s="[ ]*";return e.endsWith(s)&&(e=e.slice(0,e.length-s.length)),n&&t&&(p1||(p1=String.fromCharCode(...f1)),r=!0,e=`${e}(?=[${p1}]|[^\\p{M}]|$)`),[r,e]},Sw=function(e){if(!a(this,ve))return;const t=a(this,tt,y0);if(t.length===0)return;const n=this._pageContents[e],r=this.match(t,n,e),i=this._pageMatches[e]=[],s=this._pageMatchesLength[e]=[],o=this._pageDiffs[e];r==null||r.forEach(({index:u,length:c})=>{const[d,f]=Aw(o,u,c);f&&(i.push(d),s.push(f))}),a(this,ve).highlightAll&&A(this,tt,lm).call(this,e),this._resumePageIdx===e&&(this._resumePageIdx=null,A(this,tt,A0).call(this));const l=i.length;this._matchesCountTotal+=l,a(this,lc)?l>0&&A(this,tt,x0).call(this):++ie(this,Kl)._===this._linkService.pagesCount&&A(this,tt,x0).call(this)},Cw=function(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve();const t={disableNormalization:!0},n=this._pdfDocument;for(let r=0,i=this._linkService.pagesCount;r{if(n!==this._pdfDocument){o();return}await n.getPage(r+1).then(l=>l.getTextContent(t)).then(l=>{const u=[];for(const c of l.items)u.push(c.str),c.hasEOL&&u.push(` `);[this._pageContents[r],this._pageDiffs[r],this._hasDiacritics[r]]=om(u.join("")),o()},l=>{console.error(`Unable to get text content for page ${r+1}`,l),this._pageContents[r]="",this._pageDiffs[r]=null,this._hasDiacritics[r]=!1,o()})})}},lm=function(e){this._scrollMatches&&this._selected.pageIdx===e&&(this._linkService.page=e+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:e})},cd=function(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})},yo=function(){const e=a(this,ve).findPrevious,t=this._linkService.page-1,n=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=t,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,g(this,Kl,0),this._matchesCountTotal=0,A(this,tt,cd).call(this);for(let s=0;s{this._pendingFindMatches.delete(s),A(this,tt,Sw).call(this,s)}))}if(a(this,tt,y0).length===0){A(this,tt,dd).call(this,zs.FOUND);return}if(this._resumePageIdx)return;const i=this._offset;if(this._pagesToSearch=n,i.matchIdx!==null){const s=this._pageMatches[i.pageIdx].length;if(!e&&i.matchIdx+10){i.matchIdx=e?i.matchIdx-1:i.matchIdx+1,A(this,tt,hm).call(this,!0);return}A(this,tt,E0).call(this,e)}A(this,tt,A0).call(this)},Tw=function(e){const t=this._offset,n=e.length,r=a(this,ve).findPrevious;return n?(t.matchIdx=r?n-1:0,A(this,tt,hm).call(this,!0),!0):(A(this,tt,E0).call(this,r),t.wrapped&&(t.matchIdx=null,this._pagesToSearch<0)?(A(this,tt,hm).call(this,!1),!0):!1)},A0=function(){this._resumePageIdx!==null&&console.error("There can only be one pending page.");let e=null;do{const t=this._offset.pageIdx;if(e=this._pageMatches[t],!e){this._resumePageIdx=t;break}}while(!A(this,tt,Tw).call(this,e))},E0=function(e){const t=this._offset,n=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1,t.matchIdx=null,this._pagesToSearch--,(t.pageIdx>=n||t.pageIdx<0)&&(t.pageIdx=e?n-1:0,t.wrapped=!0)},hm=function(e=!1){let t=zs.NOT_FOUND;const n=this._offset.wrapped;if(this._offset.wrapped=!1,e){const r=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,t=n?zs.WRAPPED:zs.FOUND,r!==-1&&r!==this._selected.pageIdx&&A(this,tt,lm).call(this,r)}A(this,tt,dd).call(this,t,a(this,ve).findPrevious),this._selected.pageIdx!==-1&&(this._scrollMatches=!0,A(this,tt,lm).call(this,this._selected.pageIdx))},Pw=function({pagesMapper:e,type:t,pageNumbers:n}){var f,p,m,v;if(this._extractTextPromises.length===0)return;if(t==="copy"){const y=new Map,E=new Map,S=new Map,w=new Map;for(const C of n)y.set(C,this._extractTextPromises[C-1]),E.set(C,this._pageContents[C-1]),S.set(C,this._pageDiffs[C-1]),w.set(C,this._hasDiacritics[C-1]);g(this,mi,{promises:y,contents:E,diffs:S,diacritics:w});return}if(t==="cancelCopy"){g(this,mi,null);return}if(t==="delete"&&g(this,ms,{promises:this._extractTextPromises,contents:this._pageContents,diffs:this._pageDiffs,diacritics:this._hasDiacritics}),t==="cancelDelete"){this._extractTextPromises=a(this,ms).promises,this._pageContents=a(this,ms).contents,this._pageDiffs=a(this,ms).diffs,this._hasDiacritics=a(this,ms).diacritics;return}if(t==="cleanSavedData"){g(this,ms,null);return}this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx=null,this._dirtyMatch=!0;const r=this._extractTextPromises,i=this._pageContents,s=this._pageDiffs,o=this._hasDiacritics,l=this._extractTextPromises=[],u=this._pageContents=[],c=this._pageDiffs=[],d=this._hasDiacritics=[];for(let y=1,E=e.pagesNumber;y<=E;y++){const S=e.getPrevPageNumber(y);if(S<0){const w=-S;l.push(((f=a(this,mi))==null?void 0:f.promises.get(w))||Promise.resolve()),u.push(((p=a(this,mi))==null?void 0:p.contents.get(w))??""),c.push(((m=a(this,mi))==null?void 0:m.diffs.get(w))??null),d.push(((v=a(this,mi))==null?void 0:v.diacritics.get(w))??!1);continue}l.push(r[S-1]||Promise.resolve()),u.push(i[S-1]??""),c.push(s[S-1]??null),d.push(o[S-1]??!1)}a(this,ve)&&A(this,tt,yo).call(this)},Iw=function(e){const t=this._pdfDocument;this._firstPageCapability.promise.then(()=>{!this._pdfDocument||t&&this._pdfDocument!==t||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),A(this,tt,dd).call(this,zs.FOUND),this._highlightMatches=!1,A(this,tt,cd).call(this))})},w0=function(){var i;const{pageIdx:e,matchIdx:t}=this._selected;let n=0,r=this._matchesCountTotal;if(t!==-1){for(let s=0;sr)&&(n=r=0),{current:n,total:r}},x0=function(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:A(this,tt,w0).call(this)})},dd=function(e,t=!1){var n,r;!a(this,lc)&&(a(this,Kl)!==this._linkService.pagesCount||e===zs.PENDING)||this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:t,entireWord:((n=a(this,ve))==null?void 0:n.entireWord)??null,matchesCount:A(this,tt,w0).call(this),rawQuery:((r=a(this,ve))==null?void 0:r.query)??null})};Ct(9112);Ct(5781);const RT="noopener noreferrer nofollow",bo={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};class pb{constructor({eventBus:e,externalLinkTarget:t=null,externalLinkRel:n=null,ignoreDestinationZoom:r=!1}={}){M(this,"externalLinkEnabled",!0);this.eventBus=e,this.externalLinkTarget=t,this.externalLinkRel=n,this._ignoreDestinationZoom=r,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(e,t=null){this.baseUrl=t,this.pdfDocument=e}setViewer(e){this.pdfViewer=e}setHistory(e){this.pdfHistory=e}get pagesCount(){var e;return((e=this.pdfDocument)==null?void 0:e.pagesMapper.pagesNumber)||0}get page(){return this.pdfDocument?this.pdfViewer.currentPageNumber:1}set page(e){this.pdfDocument&&(this.pdfViewer.currentPageNumber=e)}get rotation(){return this.pdfDocument?this.pdfViewer.pagesRotation:0}set rotation(e){this.pdfDocument&&(this.pdfViewer.pagesRotation=e)}get isInPresentationMode(){return this.pdfDocument?this.pdfViewer.isInPresentationMode:!1}async goToDestination(e){if(!this.pdfDocument)return;let t,n,r;if(typeof e=="string"?(t=e,n=await this.pdfDocument.getDestination(e)):(t=null,n=await e),!Array.isArray(n)){console.error(`goToDestination: "${n}" is not a valid destination array, for dest="${e}".`);return}const[i]=n;if(i&&typeof i=="object"){if(r=this.pdfDocument.cachedPageNumber(i),!r)try{r=await this.pdfDocument.getPageIndex(i)+1}catch{console.error(`goToDestination: "${i}" is not a valid page reference, for dest="${e}".`);return}}else Number.isInteger(i)&&(r=i+1);if(!r||r<1||r>this.pagesCount){console.error(`goToDestination: "${r}" is not a valid page number, for dest="${e}".`);return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:t,explicitDest:n,pageNumber:r})),this.pdfViewer.scrollPageIntoView({pageNumber:r,destArray:n,ignoreDestinationZoom:this._ignoreDestinationZoom});const s=new AbortController;this.eventBus._on("textlayerrendered",o=>{o.pageNumber===r&&(o.source.textLayer.div.focus(),s.abort())},{signal:s.signal})}goToPage(e){if(!this.pdfDocument)return;const t=typeof e=="string"&&this.pdfViewer.pageLabelToPageNumber(e)||e|0;if(!(Number.isInteger(t)&&t>0&&t<=this.pagesCount)){console.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`);return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(t)),this.pdfViewer.scrollPageIntoView({pageNumber:t})}goToXY(e,t,n,r={}){this.pdfViewer.scrollPageIntoView({pageNumber:e,destArray:[null,{name:"XYZ"},t,n],ignoreDestinationZoom:!0,...r})}addLinkAttributes(e,t,n=!1){if(!t||typeof t!="string")throw new Error('A valid "url" parameter must provided.');const r=n?bo.BLANK:this.externalLinkTarget,i=this.externalLinkRel;let s=t;const o=URL.parse(t);(o!=null&&o.username||o!=null&&o.password)&&(o.username=o.password="",s=o.href),this.externalLinkEnabled?(e.href=t,e.title=s):(e.href="",e.title=`Disabled: ${s}`,e.onclick=()=>!1);let l="";switch(r){case bo.NONE:break;case bo.SELF:l="_self";break;case bo.BLANK:l="_blank";break;case bo.PARENT:l="_parent";break;case bo.TOP:l="_top";break}e.target=l,e.rel=typeof i=="string"?i:RT}getDestinationHash(e){if(typeof e=="string"){if(e.length>0)return this.getAnchorUrl("#"+escape(e))}else if(Array.isArray(e)){const t=JSON.stringify(e);if(t.length>0)return this.getAnchorUrl("#"+escape(t))}return this.getAnchorUrl("")}getAnchorUrl(e){return this.baseUrl?this.baseUrl+e:e}setHash(e){if(!this.pdfDocument)return;let t,n;if(e.includes("=")){const r=xv(e);if(r.has("search")){const i=r.get("search").replaceAll('"',""),s=r.get("phrase")==="true";this.eventBus.dispatch("findfromurlhash",{source:this,query:s?i:i.match(/\S+/g)})}if(r.has("page")&&(t=r.get("page")|0||1),r.has("zoom")){const i=r.get("zoom").split(","),s=i[0],o=parseFloat(s);s.includes("Fit")?s==="Fit"||s==="FitB"?n=[null,{name:s}]:s==="FitH"||s==="FitBH"||s==="FitV"||s==="FitBV"?n=[null,{name:s},i.length>1?i[1]|0:null]:s==="FitR"?i.length!==5?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):n=[null,{name:s},i[1]|0,i[2]|0,i[3]|0,i[4]|0]:console.error(`PDFLinkService.setHash: "${s}" is not a valid zoom value.`):n=[null,{name:"XYZ"},i.length>1?i[1]|0:null,i.length>2?i[2]|0:null,o?o/100:s]}n?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:n,allowNegativeOffset:!0}):t&&(this.page=t),r.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:r.get("pagemode")}),r.has("nameddest")&&this.goToDestination(r.get("nameddest"));return}n=unescape(e);try{n=JSON.parse(n),Array.isArray(n)||(n=n.toString())}catch{}if(typeof n=="string"||WC(n)){this.goToDestination(n);return}console.error(`PDFLinkService.setHash: "${unescape(e)}" is not a valid destination.`)}executeNamedAction(e){var t,n;if(this.pdfDocument){switch(e){case"GoBack":(t=this.pdfHistory)==null||t.back();break;case"GoForward":(n=this.pdfHistory)==null||n.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1;break}this.eventBus.dispatch("namedaction",{source:this,action:e})}}async executeSetOCGState(e){if(!this.pdfDocument)return;const t=this.pdfDocument,n=await this.pdfViewer.optionalContentConfigPromise;t===this.pdfDocument&&(n.setOCGState(e),this.pdfViewer.optionalContentConfigPromise=Promise.resolve(n))}}class gb extends pb{setDocument(e,t=null){}}var Ga,mp,vp,yp,Xa,bp,Vs,Fw,S0,Dw;class Rw{constructor({pdfPage:e,linkService:t,downloadManager:n,annotationStorage:r=null,imageResourcesPath:i="",renderForms:s=!0,enableComment:o=!1,commentManager:l=null,enableScripting:u=!1,hasJSActionsPromise:c=null,fieldObjectsPromise:d=null,annotationCanvasMap:f=null,accessibilityManager:p=null,annotationEditorUIManager:m=null,onAppend:v=null}){b(this,Vs);b(this,Ga,null);b(this,mp,null);b(this,vp,!1);b(this,yp,null);b(this,Xa,null);b(this,bp,!1);this.pdfPage=e,this.linkService=t,this.downloadManager=n,this.imageResourcesPath=i,this.renderForms=s,this.annotationStorage=r,this.enableComment=o,g(this,mp,l),this.enableScripting=u,this._hasJSActionsPromise=c||Promise.resolve(!1),this._fieldObjectsPromise=d||Promise.resolve(null),this._annotationCanvasMap=f,this._accessibilityManager=p,this._annotationEditorUIManager=m,g(this,yp,v),this.annotationLayer=null,this.div=null,this._cancelled=!1,this._eventBus=t.eventBus}async render({viewport:e,intent:t="display",structTreeLayer:n=null}){var l,u;if(this.div){if(this._cancelled||!this.annotationLayer)return;this.annotationLayer.update({viewport:e.clone({dontFlip:!0})});return}const[r,i,s]=await Promise.all([this.pdfPage.getAnnotations({intent:t}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled)return;const o=this.div=document.createElement("div");if(o.className="annotationLayer",(l=a(this,yp))==null||l.call(this,o),A(this,Vs,Fw).call(this,e,n),r.length===0){g(this,Ga,r),vw(this.div,e);return}await this.annotationLayer.render({annotations:r,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,downloadManager:this.downloadManager,enableComment:this.enableComment,enableScripting:this.enableScripting,hasJSActions:i,fieldObjects:s}),g(this,Ga,r),this.linkService.isInPresentationMode&&A(this,Vs,S0).call(this,Dh.FULLSCREEN),a(this,Xa)||(g(this,Xa,new AbortController),(u=this._eventBus)==null||u._on("presentationmodechanged",c=>{A(this,Vs,S0).call(this,c.state)},{signal:a(this,Xa).signal}))}cancel(){var e;this._cancelled=!0,(e=a(this,Xa))==null||e.abort(),g(this,Xa,null)}hide(e=!1){g(this,vp,!e),this.div&&(this.div.hidden=!0)}hasEditableAnnotations(){var e;return!!((e=this.annotationLayer)!=null&&e.hasEditableAnnotations())}async injectLinkAnnotations(e){if(a(this,Ga)===null)throw new Error("`render` method must be called before `injectLinkAnnotations`.");if(this._cancelled||a(this,bp))return;g(this,bp,!0);const t=a(this,Ga).length?A(this,Vs,Dw).call(this,e):e;t.length&&(await this.annotationLayer.addLinkAnnotations(t),a(this,vp)||(this.div.hidden=!1))}}Ga=new WeakMap,mp=new WeakMap,vp=new WeakMap,yp=new WeakMap,Xa=new WeakMap,bp=new WeakMap,Vs=new WeakSet,Fw=function(e,t){this.annotationLayer=new UC({div:this.div,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,annotationEditorUIManager:this._annotationEditorUIManager,annotationStorage:this.annotationStorage,page:this.pdfPage,viewport:e.clone({dontFlip:!0}),structTreeLayer:t,commentManager:a(this,mp),linkService:this.linkService})},S0=function(e){if(!this.div)return;let t=!1;switch(e){case Dh.FULLSCREEN:t=!0;break;case Dh.NORMAL:break;default:return}for(const n of this.div.childNodes)n.hasAttribute("data-internal-link")||(n.inert=t)},Dw=function(e){function t(i){if(!i.quadPoints)return[i.rect];const s=[];for(let o=2,l=i.quadPoints.length;o{let s;for(const o of a(this,Ga)){if(o.annotationType!==pw.LINK||!o.url)continue;const l=n(o,i);if(l.length!==0&&(s??(s=r(t(i))),r(l)/s>.5))return!1}return!0})};Ct(8454);Ct(9452);var Ap;class FT{constructor(){b(this,Ap,new WeakMap)}_triggerDownload(e,t,n,r=!1){throw new Error("Not implemented: _triggerDownload")}_getOpenDataUrl(e,t,n=null){throw new Error("Not implemented: _getOpenDataUrl")}downloadData(e,t,n){const r=URL.createObjectURL(new Blob([e],{type:n}));this._triggerDownload(r,r,t,!0)}openOrDownloadData(e,t,n=null){const r=VC(t),i=r?"application/pdf":"";if(r){const s=a(this,Ap).getOrInsertComputed(e,()=>URL.createObjectURL(new Blob([e],{type:i})));try{const o=this._getOpenDataUrl(s,t,n);return window.open(o),!0}catch(o){console.error("openOrDownloadData:",o),URL.revokeObjectURL(s),a(this,Ap).delete(e)}}return this.downloadData(e,t,i),!1}download(e,t,n){const r=e?URL.createObjectURL(new Blob([e],{type:"application/pdf"})):null;this._triggerDownload(r,t,n)}}Ap=new WeakMap;class DT extends FT{_triggerDownload(e,t,n,r=!1){if(!e&&!r){if(!gw(t,"http://example.com"))throw new Error(`_triggerDownload - not a valid URL: ${t}`);e=t+"#pdfjs.action=download"}const i=document.createElement("a");i.href=e,i.target="_parent","download"in i&&(i.download=n),(document.body||document.documentElement).append(i),i.click(),i.remove()}_getOpenDataUrl(e,t,n=null){throw new Error("Opening data is not supported in `COMPONENTS` builds.")}}const v1={EVENT:"event",TIMEOUT:"timeout"};async function OT({target:h,name:e,delay:t=0}){if(typeof h!="object"||!(Number.isInteger(t)&&t>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");const{promise:n,resolve:r}=Promise.withResolvers(),i=new AbortController;function s(u){i.abort(),clearTimeout(l),r(u)}const o=h instanceof mb?"_on":"addEventListener";h[o](e,s.bind(null,v1.EVENT),{signal:i.signal});const l=setTimeout(s.bind(null,v1.TIMEOUT),t);return n}var hc;class mb{constructor(){b(this,hc,Object.create(null))}on(e,t,n=null){this._on(e,t,{external:!0,once:n==null?void 0:n.once,signal:n==null?void 0:n.signal})}off(e,t,n=null){this._off(e,t)}dispatch(e,t){const n=a(this,hc)[e];if(!n||n.length===0)return;let r;for(const{listener:i,external:s,once:o}of n.slice(0)){if(o&&this._off(e,i),s){(r||(r=[])).push(i);continue}i(t)}if(r){for(const i of r)i(t);r=null}}_on(e,t,n=null){var s;let r=null;if((n==null?void 0:n.signal)instanceof AbortSignal){const{signal:o}=n;if(o.aborted){console.error("Cannot use an `aborted` signal.");return}const l=()=>this._off(e,t);r=()=>o.removeEventListener("abort",l),o.addEventListener("abort",l)}((s=a(this,hc))[e]||(s[e]=[])).push({listener:t,external:(n==null?void 0:n.external)===!0,once:(n==null?void 0:n.once)===!0,rmAbort:r})}_off(e,t,n=null){var i;const r=a(this,hc)[e];if(r)for(let s=0,o=r.length;s1;for(const r of e){if(typeof r=="string"){t.push(h.bundle._transform(r));continue}if(h.placeables++,h.placeables>y1)throw h.dirty.delete(e),new RangeError(`Too many placeables expanded: ${h.placeables}, max allowed is ${y1}`);n&&t.push(MT),t.push(Fd(h,r).toString(h)),n&&t.push(LT)}return h.dirty.delete(e),t.join("")}function Dc(h,e){return typeof e=="string"?h.bundle._transform(e):Ow(h,e)}class HT{constructor(e,t,n){this.dirty=new WeakSet,this.params=null,this.placeables=0,this.bundle=e,this.errors=t,this.args=n}reportError(e){if(!this.errors||!(e instanceof Error))throw e;this.errors.push(e)}memoizeIntlObject(e,t){let n=this.bundle._intls.get(e);n||(n={},this.bundle._intls.set(e,n));let r=JSON.stringify(t);return n[r]||(n[r]=new e(this.bundle.locales,t)),n[r]}}function T0(h,e){const t=Object.create(null);for(const[n,r]of Object.entries(h))e.includes(n)&&(t[n]=r.valueOf());return t}const A1=["unitDisplay","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits"];function VT(h,e){let t=h[0];if(t instanceof Ae)return new Ae(`NUMBER(${t.valueOf()})`);if(t instanceof Ns)return new Ns(t.valueOf(),{...t.opts,...T0(e,A1)});if(t instanceof uo)return new Ns(t.toNumber(),{...T0(e,A1)});throw new TypeError("Invalid argument to NUMBER")}const WT=["dateStyle","timeStyle","fractionalSecondDigits","dayPeriod","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"];function zT(h,e){let t=h[0];if(t instanceof Ae)return new Ae(`DATETIME(${t.valueOf()})`);if(t instanceof uo||t instanceof Ns)return new uo(t,T0(e,WT));throw new TypeError("Invalid argument to DATETIME")}const E1=new Map;function GT(h){const e=Array.isArray(h)?h.join(" "):h;let t=E1.get(e);return t===void 0&&(t=new Map,E1.set(e,t)),t}class XT{constructor(e,{functions:t,useIsolating:n=!0,transform:r=i=>i}={}){this._terms=new Map,this._messages=new Map,this.locales=Array.isArray(e)?e:[e],this._functions={NUMBER:VT,DATETIME:zT,...t},this._useIsolating=n,this._transform=r,this._intls=GT(e)}hasMessage(e){return this._messages.has(e)}getMessage(e){return this._messages.get(e)}addResource(e,{allowOverrides:t=!1}={}){const n=[];for(let r=0;r\s*/y,sP=/\s*:\s*/y,aP=/\s*,?\s*/y,oP=/\s+/y;class lP{constructor(e){this.body=[],Nv.lastIndex=0;let t=0;for(;;){let P=Nv.exec(e);if(P===null)break;t=Nv.lastIndex;try{this.body.push(l(P[1]))}catch(R){if(R instanceof SyntaxError)continue;throw R}}function n(P){return P.lastIndex=t,P.test(e)}function r(P,R){if(e[t]===P)return t++,!0;if(R)throw new R(`Expected ${P}`);return!1}function i(P,R){if(n(P))return t=P.lastIndex,!0;if(R)throw new R(`Expected ${P.toString()}`);return!1}function s(P){P.lastIndex=t;let R=P.exec(e);if(R===null)throw new SyntaxError(`Expected ${P.toString()}`);return t=P.lastIndex,R}function o(P){return s(P)[1]}function l(P){let R=c(),D=u();if(R===null&&Object.keys(D).length===0)throw new SyntaxError("Expected message value or attributes");return{id:P,value:R,attributes:D}}function u(){let P=Object.create(null);for(;n(w1);){let R=o(w1),D=c();if(D===null)throw new SyntaxError("Expected attribute value");P[R]=D}return P}function c(){let P;if(n(bg)&&(P=o(bg)),e[t]==="{"||e[t]==="}")return d(P?[P]:[],1/0);let R=T();return R?P?d([P,R],R.length):(R.value=I(R.value,ZT),d([R],R.length)):P?I(P,T1):null}function d(P=[],R){for(;;){if(n(bg)){P.push(o(bg));continue}if(e[t]==="{"){P.push(f());continue}if(e[t]==="}")throw new SyntaxError("Unbalanced closing brace");let H=T();if(H){P.push(H),R=Math.min(R,H.length);continue}break}let D=P.length-1,k=P[D];typeof k=="string"&&(P[D]=I(k,T1));let N=[];for(let H of P)H instanceof I1&&(H=H.value.slice(0,H.value.length-R)),H&&N.push(H);return N}function f(){i(tP,SyntaxError);let P=p();if(i(P1))return P;if(i(iP)){let R=y();return i(P1,SyntaxError),{type:"select",selector:P,...R}}throw new SyntaxError("Unclosed placeable")}function p(){if(e[t]==="{")return f();if(n(x1)){let[,P,R,D=null]=s(x1);if(P==="$")return{type:"var",name:R};if(i(rP)){let k=m();if(P==="-")return{type:"term",name:R,attr:D,args:k};if(KT.test(R))return{type:"func",name:R,args:k};throw new SyntaxError("Function names must be all upper-case")}return P==="-"?{type:"term",name:R,attr:D,args:[]}:{type:"mesg",name:R,attr:D}}return S()}function m(){let P=[];for(;;){switch(e[t]){case")":return t++,P;case void 0:throw new SyntaxError("Unclosed argument list")}P.push(v()),i(aP)}}function v(){let P=p();return P.type!=="mesg"?P:i(sP)?{type:"narg",name:P.name,value:S()}:P}function y(){let P=[],R=0,D;for(;n(_T);){r("*")&&(D=R);let k=E(),N=c();if(N===null)throw new SyntaxError("Expected variant value");P[R++]={key:k,value:N}}if(R===0)return null;if(D===void 0)throw new SyntaxError("Expected default variant");return{variants:P,star:D}}function E(){i(eP,SyntaxError);let P;return n(Bv)?P=w():P={type:"str",value:o(YT)},i(nP,SyntaxError),P}function S(){if(n(Bv))return w();if(e[t]==='"')return C();throw new SyntaxError("Invalid expression")}function w(){let[,P,R=""]=s(Bv),D=R.length;return{type:"num",value:parseFloat(P),precision:D}}function C(){r('"',SyntaxError);let P="";for(;;){if(P+=o(JT),e[t]==="\\"){P+=x();continue}if(r('"'))return{type:"str",value:P};throw new SyntaxError("Unclosed string literal")}}function x(){if(n(S1))return o(S1);if(n(C1)){let[,P,R]=s(C1),D=parseInt(P||R,16);return D<=55295||57344<=D?String.fromCodePoint(D):"�"}throw new SyntaxError("Unknown escape sequence")}function T(){let P=t;switch(i(oP),e[t]){case".":case"[":case"*":case"}":case void 0:return!1;case"{":return F(e.slice(P,t))}return e[t-1]===" "?F(e.slice(P,t)):!1}function I(P,R){return P.replace(R,"")}function F(P){let R=P.replace(QT,` `),D=qT.exec(P)[1].length;return new I1(R,D)}}}class I1{constructor(e,t){this.value=e,this.length=t}}const hP=/<|&#?\w+;/,uP={"http://www.w3.org/1999/xhtml":["em","strong","small","s","cite","q","dfn","abbr","data","time","code","var","samp","kbd","sub","sup","i","b","u","mark","bdi","bdo","span","br","wbr"]},cP={"http://www.w3.org/1999/xhtml":{global:["title","aria-description","aria-label","aria-valuetext"],a:["download"],area:["download","alt"],input:["alt","placeholder"],menuitem:["label"],menu:["label"],optgroup:["label"],option:["label"],track:["label"],img:["alt"],textarea:["placeholder"],th:["abbr"]},"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul":{global:["accesskey","aria-label","aria-valuetext","label","title","tooltiptext"],description:["value"],key:["key","keycode"],label:["value"],textbox:["placeholder","value"]}};function dP(h,e){const{value:t}=e;if(typeof t=="string")if(h.localName==="title"&&h.namespaceURI==="http://www.w3.org/1999/xhtml")h.textContent=t;else if(!hP.test(t))h.textContent=t;else{const n=h.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml","template");n.innerHTML=t,fP(n.content,h)}Mw(e,h)}function fP(h,e){for(const t of h.childNodes)if(t.nodeType!==t.TEXT_NODE){if(t.hasAttribute("data-l10n-name")){const n=gP(e,t);h.replaceChild(n,t);continue}if(vP(t)){const n=mP(t);h.replaceChild(n,t);continue}console.warn(`An element of forbidden type "${t.localName}" was found in the translation. Only safe text-level elements and elements with data-l10n-name are allowed.`),h.replaceChild(P0(t),t)}e.textContent="",e.appendChild(h)}function pP(h,e){if(!h)return!1;for(let t of h)if(t.name===e)return!0;return!1}function Mw(h,e){const t=e.hasAttribute("data-l10n-attrs")?e.getAttribute("data-l10n-attrs").split(",").map(n=>n.trim()):null;for(const n of Array.from(e.attributes))R1(n.name,e,t)&&!pP(h.attributes,n.name)&&e.removeAttribute(n.name);if(h.attributes)for(const n of Array.from(h.attributes))R1(n.name,e,t)&&e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}function gP(h,e){const t=e.getAttribute("data-l10n-name"),n=h.querySelector(`[data-l10n-name="${t}"]`);if(!n)return console.warn(`An element named "${t}" wasn't found in the source.`),P0(e);if(n.localName!==e.localName)return console.warn(`An element named "${t}" was found in the translation but its type ${e.localName} didn't match the element found in the source (${n.localName}).`),P0(e);h.removeChild(n);const r=n.cloneNode(!1);return Lw(e,r)}function mP(h){const e=h.ownerDocument.createElement(h.localName);return Lw(h,e)}function P0(h){return h.ownerDocument.createTextNode(h.textContent)}function vP(h){const e=uP[h.namespaceURI];return e&&e.includes(h.localName)}function R1(h,e,t=null){if(t&&t.includes(h))return!0;const n=cP[e.namespaceURI];if(!n)return!1;const r=h.toLowerCase(),i=e.localName;if(n.global.includes(r))return!0;if(!n[i])return!1;if(n[i].includes(r))return!0;if(e.namespaceURI==="http://www.w3.org/1999/xhtml"&&i==="input"&&r==="value"){const s=e.type.toLowerCase();if(s==="submit"||s==="button"||s==="reset")return!0}return!1}function Lw(h,e){return e.textContent=h.textContent,Mw(h,e),e}class yP extends Array{static from(e){return e instanceof this?e:new this(e)}}class bP extends yP{constructor(e){if(super(),Symbol.asyncIterator in Object(e))this.iterator=e[Symbol.asyncIterator]();else if(Symbol.iterator in Object(e))this.iterator=e[Symbol.iterator]();else throw new TypeError("Argument must implement the iteration protocol.")}[Symbol.asyncIterator](){const e=this;let t=0;return{async next(){return e.length<=t&&e.push(e.iterator.next()),e[t++]}}}async touchNext(e=1){let t=0;for(;t++!e.includes(t)),this.onChange(),this.resourceIds.length}async formatWithFallback(e,t){const n=[];let r=!1;for await(const i of this.bundles){r=!0;const s=xP(t,i,e,n);if(s.size===0)break;if(typeof console<"u"){const o=i.locales[0],l=Array.from(s).join(", ");console.warn(`[fluent] Missing translations in ${o}: ${l}`)}}return!r&&typeof console<"u"&&console.warn(`[fluent] Request for keys failed because no resource bundles got generated. keys: ${JSON.stringify(e)}. resourceIds: ${JSON.stringify(this.resourceIds)}.`),n}formatMessages(e){return this.formatWithFallback(e,wP)}formatValues(e){return this.formatWithFallback(e,EP)}async formatValue(e,t){const[n]=await this.formatValues([{id:e,args:t}]);return n}handleEvent(){this.onChange()}onChange(e=!1){this.bundles=bP.from(this.generateBundles(this.resourceIds)),e&&this.bundles.touchNext(2)}}function EP(h,e,t,n){return t.value?h.formatPattern(t.value,n,e):null}function wP(h,e,t,n){const r={value:null,attributes:null};t.value&&(r.value=h.formatPattern(t.value,n,e));let i=Object.keys(t.attributes);if(i.length>0){r.attributes=new Array(i.length);for(let[s,o]of i.entries()){let l=h.formatPattern(t.attributes[o],n,e);r.attributes[s]={name:o,value:l}}}return r}function xP(h,e,t,n){const r=[],i=new Set;return t.forEach(({id:s,args:o},l)=>{if(n[l]!==void 0)return;let u=e.getMessage(s);if(u){if(r.length=0,n[l]=h(e,r,u,o),r.length>0&&typeof console<"u"){const c=e.locales[0],d=r.join(", ");console.warn(`[fluent][resolver] errors in ${c}/${s}: ${d}.`)}}else i.add(s)}),i}const Ao="data-l10n-id",$c="data-l10n-args",SP=`[${Ao}]`;class CP extends AP{constructor(e,t){super(e,t),this.roots=new Set,this.pendingrAF=null,this.pendingElements=new Set,this.windowElement=null,this.mutationObserver=null,this.observerConfig={attributes:!0,characterData:!1,childList:!0,subtree:!0,attributeFilter:[Ao,$c]}}onChange(e=!1){super.onChange(e),this.roots&&this.translateRoots()}setAttributes(e,t,n){return e.setAttribute(Ao,t),n?e.setAttribute($c,JSON.stringify(n)):e.removeAttribute($c),e}getAttributes(e){return{id:e.getAttribute(Ao),args:JSON.parse(e.getAttribute($c)||null)}}connectRoot(e){for(const t of this.roots)if(t===e||t.contains(e)||e.contains(t))throw new Error("Cannot add a root that overlaps with existing root.");if(this.windowElement){if(this.windowElement!==e.ownerDocument.defaultView)throw new Error(`Cannot connect a root: DOMLocalization already has a root from a different window.`)}else this.windowElement=e.ownerDocument.defaultView,this.mutationObserver=new this.windowElement.MutationObserver(t=>this.translateMutations(t));this.roots.add(e),this.mutationObserver.observe(e,this.observerConfig)}disconnectRoot(e){return this.roots.delete(e),this.pauseObserving(),this.roots.size===0?(this.mutationObserver=null,this.windowElement&&this.pendingrAF&&this.windowElement.cancelAnimationFrame(this.pendingrAF),this.windowElement=null,this.pendingrAF=null,this.pendingElements.clear(),!0):(this.resumeObserving(),!1)}translateRoots(){const e=Array.from(this.roots);return Promise.all(e.map(t=>this.translateFragment(t)))}pauseObserving(){this.mutationObserver&&(this.translateMutations(this.mutationObserver.takeRecords()),this.mutationObserver.disconnect())}resumeObserving(){if(this.mutationObserver)for(const e of this.roots)this.mutationObserver.observe(e,this.observerConfig)}translateMutations(e){for(const t of e)switch(t.type){case"attributes":t.target.hasAttribute("data-l10n-id")&&this.pendingElements.add(t.target);break;case"childList":for(const n of t.addedNodes)if(n.nodeType===n.ELEMENT_NODE)if(n.childElementCount)for(const r of this.getTranslatables(n))this.pendingElements.add(r);else n.hasAttribute(Ao)&&this.pendingElements.add(n);break}this.pendingElements.size>0&&this.pendingrAF===null&&(this.pendingrAF=this.windowElement.requestAnimationFrame(()=>{this.translateElements(Array.from(this.pendingElements)),this.pendingElements.clear(),this.pendingrAF=null}))}translateFragment(e){return this.translateElements(this.getTranslatables(e))}async translateElements(e){if(!e.length)return;const t=e.map(this.getKeysForElement),n=await this.formatMessages(t);return this.applyTranslations(e,n)}applyTranslations(e,t){this.pauseObserving();for(let n=0;n({id:o})),(await a(this,xn).formatMessages(e)).map(o=>o.value)):((i=(await a(this,xn).formatMessages([{id:e,args:t}]))[0])==null?void 0:i.value)||n}async translate(e){(a(this,_a)||g(this,_a,new Set)).add(e);try{a(this,xn).connectRoot(e),await a(this,xn).translateRoots()}catch{}}async translateOnce(e){try{await a(this,xn).translateElements([e])}catch(t){console.error("translateOnce:",t)}}async destroy(){if(a(this,_a)){for(const e of a(this,_a))a(this,xn).disconnectRoot(e);a(this,_a).clear(),g(this,_a,null)}a(this,xn).pauseObserving()}pause(){a(this,xn).pauseObserving()}resume(){a(this,xn).resumeObserving()}};Ep=new WeakMap,_a=new WeakMap,uc=new WeakMap,xn=new WeakMap,Lc=new WeakSet,Nw=function(e){return e=(e==null?void 0:e.toLowerCase())||"en-us",{en:"en-us",es:"es-es",fy:"fy-nl",ga:"ga-ie",gu:"gu-in",hi:"hi-in",hy:"hy-am",nb:"nb-no",ne:"ne-np",nn:"nn-no",pa:"pa-in",pt:"pt-pt",sv:"sv-se",zh:"zh-cn"}[e]||e},Bw=function(e){const t=e.split("-",1)[0];return["ar","he","fa","ps","ur"].includes(t)},b(wd,Lc);let I0=wd;function TP(){const{isAndroid:h,isLinux:e,isMac:t,isWindows:n}=mw.platform;return e?"linux":n?"windows":t?"macos":h?"android":"other"}function F1(h,e){const t=new lP(e),n=new XT(h,{functions:{PLATFORM:TP}}),r=n.addResource(t);return r.length&&console.error("L10n errors",r),n}var Zn,kw,jw,Uw,$w,R0;const xo=class xo extends I0{constructor(e){super({lang:e});const t=e?A(xo,Zn,kw).bind(xo,"en-us",this.getLanguage()):A(xo,Zn,$w).bind(xo,this.getLanguage());this._setL10n(new CP([],t))}};Zn=new WeakSet,kw=async function*(e,t){const{baseURL:n,paths:r}=await A(this,Zn,Uw).call(this),i=[t];if(e!==t){const o=t.split("-",1)[0];o!==t&&i.push(o),i.push(e)}const s=i.map(o=>[o,A(this,Zn,jw).call(this,o,n,r)]);for(const[o,l]of s){const u=await l;u?yield u:o==="en-us"&&(yield A(this,Zn,R0).call(this,o))}},jw=async function(e,t,n){const r=n[e];if(!r)return null;const i=new URL(r,t),s=await i1(i,"text");return F1(e,s)},Uw=async function(){try{const{href:e}=document.querySelector('link[type="application/l10n"]'),t=await i1(e,"json");return{baseURL:e.substring(0,e.lastIndexOf("/")+1)||"./",paths:t}}catch{}return{baseURL:"./",paths:Object.create(null)}},$w=async function*(e){yield A(this,Zn,R0).call(this,e)},R0=async function(e){return F1(e,`pdfjs-previous-button = .title = Previous Page pdfjs-previous-button-label = Previous pdfjs-next-button = .title = Next Page pdfjs-next-button-label = Next pdfjs-page-input = .title = Page pdfjs-of-pages = of { $pagesCount } pdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount }) pdfjs-zoom-out-button = .title = Zoom Out pdfjs-zoom-out-button-label = Zoom Out pdfjs-zoom-in-button = .title = Zoom In pdfjs-zoom-in-button-label = Zoom In pdfjs-zoom-select = .title = Zoom pdfjs-presentation-mode-button = .title = Switch to Presentation Mode pdfjs-presentation-mode-button-label = Presentation Mode pdfjs-open-file-button = .title = Open File pdfjs-open-file-button-label = Open pdfjs-print-button = .title = Print pdfjs-print-button-label = Print pdfjs-save-button = .title = Save pdfjs-save-button-label = Save pdfjs-download-button = .title = Download pdfjs-download-button-label = Download pdfjs-bookmark-button = .title = Current Page (View URL from Current Page) pdfjs-bookmark-button-label = Current Page pdfjs-tools-button = .title = Tools pdfjs-tools-button-label = Tools pdfjs-first-page-button = .title = Go to First Page pdfjs-first-page-button-label = Go to First Page pdfjs-last-page-button = .title = Go to Last Page pdfjs-last-page-button-label = Go to Last Page pdfjs-page-rotate-cw-button = .title = Rotate Clockwise pdfjs-page-rotate-cw-button-label = Rotate Clockwise pdfjs-page-rotate-ccw-button = .title = Rotate Counterclockwise pdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise pdfjs-cursor-text-select-tool-button = .title = Enable Text Selection Tool pdfjs-cursor-text-select-tool-button-label = Text Selection Tool pdfjs-cursor-hand-tool-button = .title = Enable Hand Tool pdfjs-cursor-hand-tool-button-label = Hand Tool pdfjs-scroll-page-button = .title = Use Page Scrolling pdfjs-scroll-page-button-label = Page Scrolling pdfjs-scroll-vertical-button = .title = Use Vertical Scrolling pdfjs-scroll-vertical-button-label = Vertical Scrolling pdfjs-scroll-horizontal-button = .title = Use Horizontal Scrolling pdfjs-scroll-horizontal-button-label = Horizontal Scrolling pdfjs-scroll-wrapped-button = .title = Use Wrapped Scrolling pdfjs-scroll-wrapped-button-label = Wrapped Scrolling pdfjs-spread-none-button = .title = Do not join page spreads pdfjs-spread-none-button-label = No Spreads pdfjs-spread-odd-button = .title = Join page spreads starting with odd-numbered pages pdfjs-spread-odd-button-label = Odd Spreads pdfjs-spread-even-button = .title = Join page spreads starting with even-numbered pages pdfjs-spread-even-button-label = Even Spreads pdfjs-document-properties-button = .title = Document Properties… pdfjs-document-properties-button-label = Document Properties… pdfjs-document-properties-file-name = File name: pdfjs-document-properties-file-size = File size: pdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes) pdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes) pdfjs-document-properties-title = Title: pdfjs-document-properties-author = Author: pdfjs-document-properties-subject = Subject: pdfjs-document-properties-keywords = Keywords: pdfjs-document-properties-creation-date = Creation Date: pdfjs-document-properties-modification-date = Modification Date: pdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") } pdfjs-document-properties-creator = Creator: pdfjs-document-properties-producer = PDF Producer: pdfjs-document-properties-version = PDF Version: pdfjs-document-properties-page-count = Page Count: pdfjs-document-properties-page-size = Page Size: pdfjs-document-properties-page-size-unit-inches = in pdfjs-document-properties-page-size-unit-millimeters = mm pdfjs-document-properties-page-size-orientation-portrait = portrait pdfjs-document-properties-page-size-orientation-landscape = landscape pdfjs-document-properties-page-size-name-a-three = A3 pdfjs-document-properties-page-size-name-a-four = A4 pdfjs-document-properties-page-size-name-letter = Letter pdfjs-document-properties-page-size-name-legal = Legal pdfjs-document-properties-page-size-dimension-string = { $width } × { $height } { $unit } ({ $orientation }) pdfjs-document-properties-page-size-dimension-name-string = { $width } × { $height } { $unit } ({ $name }, { $orientation }) pdfjs-document-properties-linearized = Fast Web View: pdfjs-document-properties-linearized-yes = Yes pdfjs-document-properties-linearized-no = No pdfjs-document-properties-close-button = Close pdfjs-print-progress-message = Preparing document for printing… pdfjs-print-progress-percent = { $progress }% pdfjs-print-progress-close-button = Cancel pdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser. pdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing. pdfjs-current-outline-item-button = .title = Find Current Outline Item pdfjs-current-outline-item-button-label = Current Outline Item pdfjs-findbar-button = .title = Find in Document pdfjs-findbar-button-label = Find pdfjs-additional-layers = Additional Layers pdfjs-thumb-page-title1 = .title = Page { $page } of { $total } pdfjs-thumb-page-canvas = .aria-label = Thumbnail of Page { $page } pdfjs-thumb-page-checkbox1 = .title = Select page { $page } pdfjs-find-input = .title = Find .placeholder = Find in document… pdfjs-find-previous-button = .title = Find the previous occurrence of the phrase pdfjs-find-previous-button-label = Previous pdfjs-find-next-button = .title = Find the next occurrence of the phrase pdfjs-find-next-button-label = Next pdfjs-find-highlight-checkbox = Highlight All pdfjs-find-match-case-checkbox-label = Match Case pdfjs-find-match-diacritics-checkbox-label = Match Diacritics pdfjs-find-entire-word-checkbox-label = Whole Words pdfjs-find-reached-top = Reached top of document, continued from bottom pdfjs-find-reached-bottom = Reached end of document, continued from top pdfjs-find-match-count = { $total -> [one] { $current } of { $total } match *[other] { $current } of { $total } matches } pdfjs-find-match-count-limit = { $limit -> [one] More than { $limit } match *[other] More than { $limit } matches } pdfjs-find-not-found = Phrase not found pdfjs-page-scale-width = Page Width pdfjs-page-scale-fit = Page Fit pdfjs-page-scale-auto = Automatic Zoom pdfjs-page-scale-actual = Actual Size pdfjs-page-scale-percent = { $scale }% pdfjs-page-landmark = .aria-label = Page { $page } pdfjs-loading-error = An error occurred while loading the PDF. pdfjs-invalid-file-error = Invalid or corrupted PDF file. pdfjs-missing-file-error = Missing PDF file. pdfjs-unexpected-response-error = Unexpected server response. pdfjs-rendering-error = An error occurred while rendering the page. pdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") } pdfjs-text-annotation-type = .alt = [{ $type } Annotation] pdfjs-password-label = Enter the password to open this PDF file. pdfjs-password-invalid = Invalid password. Please try again. pdfjs-password-ok-button = OK pdfjs-password-cancel-button = Cancel pdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts. pdfjs-editor-free-text-button = .title = Text pdfjs-editor-color-picker-free-text-input = .title = Change text color pdfjs-editor-free-text-button-label = Text pdfjs-editor-ink-button = .title = Draw pdfjs-editor-color-picker-ink-input = .title = Change drawing color pdfjs-editor-ink-button-label = Draw pdfjs-editor-stamp-button = .title = Add or edit images pdfjs-editor-stamp-button-label = Add or edit images pdfjs-editor-highlight-button = .title = Highlight pdfjs-editor-highlight-button-label = Highlight pdfjs-highlight-floating-button1 = .title = Highlight .aria-label = Highlight pdfjs-highlight-floating-button-label = Highlight pdfjs-comment-floating-button = .title = Comment .aria-label = Comment pdfjs-comment-floating-button-label = Comment pdfjs-editor-comment-button = .title = Comment .aria-label = Comment pdfjs-editor-comment-button-label = Comment pdfjs-editor-signature-button = .title = Add signature pdfjs-editor-signature-button-label = Add signature pdfjs-editor-highlight-editor = .aria-label = Highlight editor pdfjs-editor-ink-editor = .aria-label = Drawing editor pdfjs-editor-signature-editor1 = .aria-description = Signature editor: { $description } pdfjs-editor-stamp-editor = .aria-label = Image editor pdfjs-editor-remove-ink-button = .title = Remove drawing pdfjs-editor-remove-freetext-button = .title = Remove text pdfjs-editor-remove-stamp-button = .title = Remove image pdfjs-editor-remove-highlight-button = .title = Remove highlight pdfjs-editor-remove-signature-button = .title = Remove signature pdfjs-editor-free-text-color-input = Color pdfjs-editor-free-text-size-input = Size pdfjs-editor-ink-color-input = Color pdfjs-editor-ink-thickness-input = Thickness pdfjs-editor-ink-opacity-input = Opacity pdfjs-editor-stamp-add-image-button = .title = Add image pdfjs-editor-stamp-add-image-button-label = Add image pdfjs-editor-free-highlight-thickness-input = Thickness pdfjs-editor-free-highlight-thickness-title = .title = Change thickness when highlighting items other than text pdfjs-editor-add-signature-container = .aria-label = Signature controls and saved signatures pdfjs-editor-signature-add-signature-button = .title = Add new signature pdfjs-editor-signature-add-signature-button-label = Add new signature pdfjs-editor-add-saved-signature-button = .title = Saved signature: { $description } pdfjs-free-text2 = .aria-label = Text Editor .default-content = Start typing… pdfjs-editor-comments-sidebar-title = { $count -> [one] Comment *[other] Comments } pdfjs-editor-comments-sidebar-close-button = .title = Close the sidebar .aria-label = Close the sidebar pdfjs-editor-comments-sidebar-close-button-label = Close the sidebar pdfjs-editor-comments-sidebar-no-comments1 = See something noteworthy? Highlight it and leave a comment. pdfjs-editor-comments-sidebar-no-comments-link = Learn more pdfjs-editor-alt-text-button = .aria-label = Alt text pdfjs-editor-alt-text-button-label = Alt text pdfjs-editor-alt-text-edit-button = .aria-label = Edit alt text pdfjs-editor-alt-text-dialog-label = Choose an option pdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people can’t see the image or when it doesn’t load. pdfjs-editor-alt-text-add-description-label = Add a description pdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions. pdfjs-editor-alt-text-mark-decorative-label = Mark as decorative pdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks. pdfjs-editor-alt-text-cancel-button = Cancel pdfjs-editor-alt-text-save-button = Save pdfjs-editor-alt-text-decorative-tooltip = Marked as decorative pdfjs-editor-alt-text-textarea = .placeholder = For example, “A young man sits down at a table to eat a meal” pdfjs-editor-resizer-top-left = .aria-label = Top left corner — resize pdfjs-editor-resizer-top-middle = .aria-label = Top middle — resize pdfjs-editor-resizer-top-right = .aria-label = Top right corner — resize pdfjs-editor-resizer-middle-right = .aria-label = Middle right — resize pdfjs-editor-resizer-bottom-right = .aria-label = Bottom right corner — resize pdfjs-editor-resizer-bottom-middle = .aria-label = Bottom middle — resize pdfjs-editor-resizer-bottom-left = .aria-label = Bottom left corner — resize pdfjs-editor-resizer-middle-left = .aria-label = Middle left — resize pdfjs-editor-highlight-colorpicker-label = Highlight color pdfjs-editor-colorpicker-button = .title = Change color pdfjs-editor-colorpicker-dropdown = .aria-label = Color choices pdfjs-editor-colorpicker-yellow = .title = Yellow pdfjs-editor-colorpicker-green = .title = Green pdfjs-editor-colorpicker-blue = .title = Blue pdfjs-editor-colorpicker-pink = .title = Pink pdfjs-editor-colorpicker-red = .title = Red pdfjs-editor-highlight-show-all-button-label = Show all pdfjs-editor-highlight-show-all-button = .title = Show all pdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description) pdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description) pdfjs-editor-new-alt-text-textarea = .placeholder = Write your description here… pdfjs-editor-new-alt-text-description = Short description for people who can’t see the image or when the image doesn’t load. pdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate. pdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more pdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically pdfjs-editor-new-alt-text-not-now-button = Not now pdfjs-editor-new-alt-text-error-title = Couldn’t create alt text automatically pdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later. pdfjs-editor-new-alt-text-error-close-button = Close pdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB) .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB) pdfjs-editor-new-alt-text-added-button = .aria-label = Alt text added pdfjs-editor-new-alt-text-added-button-label = Alt text added pdfjs-editor-new-alt-text-missing-button = .aria-label = Missing alt text pdfjs-editor-new-alt-text-missing-button-label = Missing alt text pdfjs-editor-new-alt-text-to-review-button = .aria-label = Review alt text pdfjs-editor-new-alt-text-to-review-button-label = Review alt text pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText } pdfjs-image-alt-text-settings-button = .title = Image alt text settings pdfjs-image-alt-text-settings-button-label = Image alt text settings pdfjs-editor-alt-text-settings-dialog-label = Image alt text settings pdfjs-editor-alt-text-settings-automatic-title = Automatic alt text pdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically pdfjs-editor-alt-text-settings-create-model-description = Suggests descriptions to help people who can’t see the image or when the image doesn’t load. pdfjs-editor-alt-text-settings-editor-title = Alt text editor pdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image pdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text. pdfjs-editor-alt-text-settings-close-button = Close pdfjs-editor-highlight-added-alert = Highlight added pdfjs-editor-freetext-added-alert = Text added pdfjs-editor-ink-added-alert = Drawing added pdfjs-editor-stamp-added-alert = Image added pdfjs-editor-signature-added-alert = Signature added pdfjs-editor-undo-bar-message-highlight = Highlight removed pdfjs-editor-undo-bar-message-freetext = Text removed pdfjs-editor-undo-bar-message-ink = Drawing removed pdfjs-editor-undo-bar-message-stamp = Image removed pdfjs-editor-undo-bar-message-signature = Signature removed pdfjs-editor-undo-bar-message-comment = Comment removed pdfjs-editor-undo-bar-message-multiple = { $count -> [one] { $count } annotation removed *[other] { $count } annotations removed } pdfjs-editor-undo-bar-undo-button = .title = Undo pdfjs-editor-undo-bar-undo-button-label = Undo pdfjs-editor-undo-bar-close-button = .title = Close pdfjs-editor-undo-bar-close-button-label = Close pdfjs-editor-add-signature-dialog-label = This modal allows the user to create a signature to add to a PDF document. The user can edit the name (which also serves as the alt text), and optionally save the signature for repeated use. pdfjs-editor-add-signature-dialog-title = Add a signature pdfjs-editor-add-signature-type-button = Type .title = Type pdfjs-editor-add-signature-draw-button = Draw .title = Draw pdfjs-editor-add-signature-image-button = Image .title = Image pdfjs-editor-add-signature-type-input = .aria-label = Type your signature .placeholder = Type your signature pdfjs-editor-add-signature-draw-placeholder = Draw your signature pdfjs-editor-add-signature-draw-thickness-range-label = Thickness pdfjs-editor-add-signature-draw-thickness-range = .title = Drawing thickness: { $thickness } pdfjs-editor-add-signature-image-placeholder = Drag a file here to upload pdfjs-editor-add-signature-image-browse-link = { PLATFORM() -> [macos] Or choose image files *[other] Or browse image files } pdfjs-editor-add-signature-description-label = Description (alt text) pdfjs-editor-add-signature-description-input = .title = Description (alt text) pdfjs-editor-add-signature-description-default-when-drawing = Signature pdfjs-editor-add-signature-clear-button-label = Clear signature pdfjs-editor-add-signature-clear-button = .title = Clear signature pdfjs-editor-add-signature-save-checkbox = Save signature pdfjs-editor-add-signature-save-warning-message = You’ve reached the limit of 5 saved signatures. Remove one to save more. pdfjs-editor-add-signature-image-upload-error-title = Couldn’t upload image pdfjs-editor-add-signature-image-upload-error-description = Check your network connection or try another image. pdfjs-editor-add-signature-image-no-data-error-title = Can’t convert this image into a signature pdfjs-editor-add-signature-image-no-data-error-description = Please try uploading a different image. pdfjs-editor-add-signature-error-close-button = Close pdfjs-editor-add-signature-cancel-button = Cancel pdfjs-editor-add-signature-add-button = Add pdfjs-editor-delete-signature-button1 = .title = Remove saved signature pdfjs-editor-delete-signature-button-label1 = Remove saved signature pdfjs-editor-add-signature-edit-button-label = Edit description pdfjs-editor-edit-signature-dialog-title = Edit description pdfjs-editor-edit-signature-update-button = Update pdfjs-show-comment-button = .title = Show comment pdfjs-editor-edit-comment-popup-button-label = Edit comment pdfjs-editor-edit-comment-popup-button = .title = Edit comment pdfjs-editor-delete-comment-popup-button-label = Remove comment pdfjs-editor-delete-comment-popup-button = .title = Remove comment pdfjs-editor-edit-comment-dialog-title-when-editing = Edit comment pdfjs-editor-edit-comment-dialog-save-button-when-editing = Update pdfjs-editor-edit-comment-dialog-title-when-adding = Add comment pdfjs-editor-edit-comment-dialog-save-button-when-adding = Add pdfjs-editor-edit-comment-dialog-text-input = .placeholder = Start typing… pdfjs-editor-edit-comment-dialog-cancel-button = Cancel pdfjs-editor-add-comment-button = .title = Add comment pdfjs-toggle-views-manager-button1 = .title = Manage pages pdfjs-toggle-views-manager-notification-button = .title = Toggle Sidebar (document contains thumbnails/outline/attachments/layers) pdfjs-toggle-views-manager-button1-label = Manage pages pdfjs-views-manager-sidebar = .aria-label = Sidebar pdfjs-views-manager-sidebar-resizer = .aria-label = Sidebar resizer pdfjs-views-manager-view-selector-button = .title = Views pdfjs-views-manager-view-selector-button-label = Views pdfjs-views-manager-pages-title = Pages pdfjs-views-manager-outlines-title1 = Document outline .title = Document outline (double-click to expand/collapse all items) pdfjs-views-manager-attachments-title = Attachments pdfjs-views-manager-layers-title1 = Layers .title = Layers (double-click to reset all layers to the default state) pdfjs-views-manager-pages-option-label = Pages pdfjs-views-manager-outlines-option-label = Document outline pdfjs-views-manager-attachments-option-label = Attachments pdfjs-views-manager-layers-option-label = Layers pdfjs-views-manager-add-file-button = .title = Add file pdfjs-views-manager-add-file-button-label = Add file pdfjs-views-manager-pages-status-action-label = { $count -> [one] { $count } selected *[other] { $count } selected } pdfjs-views-manager-pages-status-none-action-label = Select pages pdfjs-views-manager-pages-status-action-button-label = Manage pdfjs-views-manager-pages-status-copy-button-label = Copy pdfjs-views-manager-pages-status-cut-button-label = Cut pdfjs-views-manager-pages-status-delete-button-label = Delete pdfjs-views-manager-pages-status-export-selected-button-label = Export selected… pdfjs-views-manager-status-undo-cut-label = { $count -> [one] 1 page cut *[other] { $count } pages cut } pdfjs-views-manager-pages-status-undo-copy-label = { $count -> [one] 1 page copied *[other] { $count } pages copied } pdfjs-views-manager-pages-status-undo-delete-label = { $count -> [one] 1 page deleted *[other] { $count } pages deleted } pdfjs-views-manager-pages-status-waiting-ready-label = Getting your file ready… pdfjs-views-manager-pages-status-waiting-uploading-label = Uploading file… pdfjs-views-manager-status-warning-cut-label = Couldn’t cut. Refresh page and try again. pdfjs-views-manager-status-warning-copy-label = Couldn’t copy. Refresh page and try again. pdfjs-views-manager-status-warning-delete-label = Couldn’t delete. Refresh page and try again. pdfjs-views-manager-status-warning-save-label = Couldn’t save. Refresh page and try again. pdfjs-views-manager-status-undo-button-label = Undo pdfjs-views-manager-status-done-button-label = Done pdfjs-views-manager-status-close-button = .title = Close pdfjs-views-manager-status-close-button-label = Close pdfjs-views-manager-paste-button-label = Paste pdfjs-views-manager-paste-button-before = .title = Paste before the first page pdfjs-views-manager-paste-button-after = .title = Paste after page { $page } pdfjs-new-badge-content = NEW pdfjs-views-manager-waiting-for-file = Uploading file…`)},b(xo,Zn);let Oc=xo;const PP=1e3,IP=50,RP=1e3;function kv(){return document.location.hash}var Ya,mt,Fi,um,cm,fd,dm,F0,Hw,Vw,D0,Ww,zw;class FP{constructor({linkService:e,eventBus:t}){b(this,mt);b(this,Ya,null);this.linkService=e,this.eventBus=t,this._initialized=!1,this._fingerprint="",this.reset(),this.eventBus._on("pagesinit",()=>{this._isPagesLoaded=!1,this.eventBus._on("pagesloaded",n=>{this._isPagesLoaded=!!n.pagesCount},{once:!0})})}initialize({fingerprint:e,resetHistory:t=!1,updateUrl:n=!1}){if(!e||typeof e!="string"){console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');return}this._initialized&&this.reset();const r=this._fingerprint!==""&&this._fingerprint!==e;this._fingerprint=e,this._updateUrl=n===!0,this._initialized=!0,A(this,mt,Ww).call(this);const i=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=kv(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!A(this,mt,fd).call(this,i,!0)||t){const{hash:o,page:l,rotation:u}=A(this,mt,F0).call(this,!0);if(!o||r||t){A(this,mt,Fi).call(this,null,!0);return}A(this,mt,Fi).call(this,{hash:o,page:l,rotation:u},!0);return}const s=i.destination;A(this,mt,dm).call(this,s,i.uid,!0),s.rotation!==void 0&&(this._initialRotation=s.rotation),s.dest?(this._initialBookmark=JSON.stringify(s.dest),this._destination.page=null):s.hash?this._initialBookmark=s.hash:s.page&&(this._initialBookmark=`page=${s.page}`)}reset(){this._initialized&&(A(this,mt,D0).call(this),this._initialized=!1,A(this,mt,zw).call(this)),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:e=null,explicitDest:t,pageNumber:n}){if(!this._initialized)return;if(e&&typeof e!="string"){console.error(`PDFHistory.push: "${e}" is not a valid namedDest parameter.`);return}else if(Array.isArray(t)){if(!A(this,mt,cm).call(this,n)&&(n!==null||this._destination)){console.error(`PDFHistory.push: "${n}" is not a valid pageNumber parameter.`);return}}else{console.error(`PDFHistory.push: "${t}" is not a valid explicitDest parameter.`);return}const r=e||JSON.stringify(t);if(!r)return;let i=!1;if(this._destination&&(DP(this._destination.hash,r)||OP(this._destination.dest,t))){if(this._destination.page)return;i=!0}this._popStateInProgress&&!i||(A(this,mt,Fi).call(this,{dest:t,hash:r,page:n,rotation:this.linkService.rotation},i),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))}pushPage(e){var t;if(this._initialized){if(!A(this,mt,cm).call(this,e)){console.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`);return}((t=this._destination)==null?void 0:t.page)!==e&&(this._popStateInProgress||(A(this,mt,Fi).call(this,{dest:null,hash:`page=${e}`,page:e,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1}))))}}pushCurrentPosition(){!this._initialized||this._popStateInProgress||A(this,mt,um).call(this)}back(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;A(this,mt,fd).call(this,e)&&e.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;A(this,mt,fd).call(this,e)&&e.uid0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}}Ya=new WeakMap,mt=new WeakSet,Fi=function(e,t=!1){const n=t||!this._destination,r={fingerprint:this._fingerprint,uid:n?this._uid:this._uid+1,destination:e};A(this,mt,dm).call(this,e,r.uid);let i;if(this._updateUrl&&(e!=null&&e.hash)){const{href:s,protocol:o}=document.location;o!=="file:"&&(i=JC(s,e.hash))}n?window.history.replaceState(r,"",i):window.history.pushState(r,"",i)},um=function(e=!1){if(!this._position)return;let t=this._position;if(e&&(t=Object.assign(Object.create(null),this._position),t.temporary=!0),!this._destination){A(this,mt,Fi).call(this,t);return}if(this._destination.temporary){A(this,mt,Fi).call(this,t,!0);return}if(this._destination.hash===t.hash||!this._destination.page&&this._numPositionUpdates<=IP)return;let n=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(this._destination.dest!==void 0||!this._destination.first)return;n=!0}A(this,mt,Fi).call(this,t,n)},cm=function(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount},fd=function(e,t=!1){if(!e)return!1;if(e.fingerprint!==this._fingerprint)if(t){if(typeof e.fingerprint!="string"||e.fingerprint.length!==this._fingerprint.length)return!1;const[n]=performance.getEntriesByType("navigation");if((n==null?void 0:n.type)!=="reload")return!1}else return!1;return!(!Number.isInteger(e.uid)||e.uid<0||e.destination===null||typeof e.destination!="object")},dm=function(e,t,n=!1){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),n&&(e!=null&&e.temporary)&&delete e.temporary,this._destination=e,this._uid=t,this._maxUid=Math.max(this._maxUid,t),this._numPositionUpdates=0},F0=function(e=!1){const t=unescape(kv()).substring(1),n=xv(t),r=n.get("nameddest")||"";let i=n.get("page")|0;return(!A(this,mt,cm).call(this,i)||e&&r.length>0)&&(i=null),{hash:t,page:i,rotation:this.linkService.rotation}},Hw=function({location:e}){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:e.pdfOpenParams.substring(1),page:this.linkService.page,first:e.pageNumber,rotation:e.rotation},!this._popStateInProgress&&(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout(()=>{this._popStateInProgress||A(this,mt,um).call(this,!0),this._updateViewareaTimeout=null},RP))},Vw=function({state:e}){const t=kv(),n=this._currentHash!==t;if(this._currentHash=t,!e){this._uid++;const{hash:i,page:s,rotation:o}=A(this,mt,F0).call(this);A(this,mt,Fi).call(this,{hash:i,page:s,rotation:o},!0);return}if(!A(this,mt,fd).call(this,e))return;this._popStateInProgress=!0,n&&(this._blockHashChange++,OT({target:window,name:"hashchange",delay:PP}).then(()=>{this._blockHashChange--}));const r=e.destination;A(this,mt,dm).call(this,r,e.uid,!0),bw(r.rotation)&&(this.linkService.rotation=r.rotation),r.dest?this.linkService.goToDestination(r.dest):r.hash?this.linkService.setHash(r.hash):r.page&&(this.linkService.page=r.page),Promise.resolve().then(()=>{this._popStateInProgress=!1})},D0=function(){(!this._destination||this._destination.temporary)&&A(this,mt,um).call(this)},Ww=function(){if(a(this,Ya))return;g(this,Ya,new AbortController);const{signal:e}=a(this,Ya);this.eventBus._on("updateviewarea",A(this,mt,Hw).bind(this),{signal:e}),window.addEventListener("popstate",A(this,mt,Vw).bind(this),{signal:e}),window.addEventListener("pagehide",A(this,mt,D0).bind(this),{signal:e})},zw=function(){var e;(e=a(this,Ya))==null||e.abort(),g(this,Ya,null)};function DP(h,e){return typeof h!="string"||typeof e!="string"?!1:h===e||xv(h).get("nameddest")===e}function OP(h,e){function t(n,r){if(typeof n!=typeof r||Array.isArray(n)||Array.isArray(r))return!1;if(n!==null&&typeof n=="object"&&r!==null){if(Object.keys(n).length!==Object.keys(r).length)return!1;for(const i in n)if(!t(n[i],r[i]))return!1;return!0}return n===r||Number.isNaN(n)&&Number.isNaN(r)}if(!(Array.isArray(h)&&Array.isArray(e))||h.length!==e.length)return!1;for(let n=0,r=h.length;n1||n)&&O0.set("maxCanvasPixels",5242880),n&&O0.set("useSystemFonts",!1)}const $={BROWSER:1,VIEWER:2,API:4,WORKER:8,EVENT_DISPATCH:16,PREFERENCE:128},M0={BOOLEAN:1,NUMBER:2,OBJECT:4,STRING:8,UNDEFINED:16},Os={allowedGlobalEvents:{value:null,kind:$.BROWSER},canvasMaxAreaInBytes:{value:-1,kind:$.BROWSER+$.API},isInAutomation:{value:!1,kind:$.BROWSER},localeProperties:{value:{lang:navigator.language||"en-US"},kind:$.BROWSER},maxCanvasDim:{value:32767,kind:$.BROWSER+$.VIEWER},nimbusDataStr:{value:"",kind:$.BROWSER},supportsCaretBrowsingMode:{value:!1,kind:$.BROWSER},supportsDocumentFonts:{value:!0,kind:$.BROWSER},supportsIntegratedFind:{value:!1,kind:$.BROWSER},supportsMouseWheelZoomCtrlKey:{value:!0,kind:$.BROWSER},supportsMouseWheelZoomMetaKey:{value:!0,kind:$.BROWSER},supportsPinchToZoom:{value:!0,kind:$.BROWSER},supportsPrinting:{value:!0,kind:$.BROWSER},toolbarDensity:{value:0,kind:$.BROWSER+$.EVENT_DISPATCH},altTextLearnMoreUrl:{value:"",kind:$.VIEWER+$.PREFERENCE},annotationEditorMode:{value:0,kind:$.VIEWER+$.PREFERENCE},annotationMode:{value:2,kind:$.VIEWER+$.PREFERENCE},capCanvasAreaFactor:{value:200,kind:$.VIEWER+$.PREFERENCE},commentLearnMoreUrl:{value:"",kind:$.VIEWER+$.PREFERENCE},cursorToolOnLoad:{value:0,kind:$.VIEWER+$.PREFERENCE},debuggerSrc:{value:"./debugger.mjs",kind:$.VIEWER},defaultZoomDelay:{value:400,kind:$.VIEWER+$.PREFERENCE},defaultZoomValue:{value:"",kind:$.VIEWER+$.PREFERENCE},disableHistory:{value:!1,kind:$.VIEWER},disablePageLabels:{value:!1,kind:$.VIEWER+$.PREFERENCE},enableAltText:{value:!1,kind:$.VIEWER+$.PREFERENCE},enableAltTextModelDownload:{value:!0,kind:$.VIEWER+$.PREFERENCE+$.EVENT_DISPATCH},enableAutoLinking:{value:!0,kind:$.VIEWER+$.PREFERENCE},enableComment:{value:!1,kind:$.VIEWER+$.PREFERENCE},enableDetailCanvas:{value:!0,kind:$.VIEWER},enableGuessAltText:{value:!0,kind:$.VIEWER+$.PREFERENCE+$.EVENT_DISPATCH},enableHighlightFloatingButton:{value:!1,kind:$.VIEWER+$.PREFERENCE},enableMerge:{value:!1,kind:$.VIEWER+$.PREFERENCE},enableNewAltTextWhenAddingImage:{value:!0,kind:$.VIEWER+$.PREFERENCE},enableNewBadge:{value:!1,kind:$.VIEWER+$.PREFERENCE},enableOptimizedPartialRendering:{value:!1,kind:$.VIEWER+$.PREFERENCE},enablePermissions:{value:!1,kind:$.VIEWER+$.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:$.VIEWER+$.PREFERENCE},enableScripting:{value:!0,kind:$.VIEWER+$.PREFERENCE},enableSignatureEditor:{value:!1,kind:$.VIEWER+$.PREFERENCE},enableSplitMerge:{value:!1,kind:$.VIEWER+$.PREFERENCE},enableUpdatedAddImage:{value:!1,kind:$.VIEWER+$.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:$.VIEWER},externalLinkTarget:{value:0,kind:$.VIEWER+$.PREFERENCE},highlightEditorColors:{value:"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F,yellow_HCM=#FFFFCC,green_HCM=#53FFBC,blue_HCM=#80EBFF,pink_HCM=#F6B8FF,red_HCM=#C50043",kind:$.VIEWER+$.PREFERENCE},historyUpdateUrl:{value:!1,kind:$.VIEWER+$.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:$.VIEWER+$.PREFERENCE},imageResourcesPath:{value:"./images/",kind:$.VIEWER},imagesRightClickMinSize:{value:-1,kind:$.VIEWER+$.PREFERENCE},maxCanvasPixels:{value:2**25,kind:$.VIEWER},minDurationToUpdateCanvas:{value:500,kind:$.VIEWER},forcePageColors:{value:!1,kind:$.VIEWER+$.PREFERENCE},pageColorsBackground:{value:"Canvas",kind:$.VIEWER+$.PREFERENCE},pageColorsForeground:{value:"CanvasText",kind:$.VIEWER+$.PREFERENCE},pdfBugEnabled:{value:!1,kind:$.VIEWER+$.PREFERENCE},printResolution:{value:150,kind:$.VIEWER},sidebarViewOnLoad:{value:-1,kind:$.VIEWER+$.PREFERENCE},scrollModeOnLoad:{value:-1,kind:$.VIEWER+$.PREFERENCE},spreadModeOnLoad:{value:-1,kind:$.VIEWER+$.PREFERENCE},textLayerMode:{value:1,kind:$.VIEWER+$.PREFERENCE},viewerCssTheme:{value:0,kind:$.VIEWER+$.PREFERENCE},viewOnLoad:{value:0,kind:$.VIEWER+$.PREFERENCE},cMapPacked:{value:!0,kind:$.API},cMapUrl:{value:"../web/cmaps/",kind:$.API},disableAutoFetch:{value:!1,kind:$.API+$.PREFERENCE},disableFontFace:{value:!1,kind:$.API+$.PREFERENCE},disableRange:{value:!1,kind:$.API+$.PREFERENCE},disableStream:{value:!1,kind:$.API+$.PREFERENCE},docBaseUrl:{value:"",kind:$.API},enableHWA:{value:!0,kind:$.API+$.PREFERENCE},enableWebGPU:{value:!0,kind:$.API+$.PREFERENCE},enableXfa:{value:!0,kind:$.API+$.PREFERENCE},fontExtraProperties:{value:!1,kind:$.API},iccUrl:{value:"../web/iccs/",kind:$.API},isOffscreenCanvasSupported:{value:!0,kind:$.API},maxImageSize:{value:-1,kind:$.API},pdfBug:{value:!1,kind:$.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:$.API},useSystemFonts:{value:void 0,kind:$.API,type:M0.BOOLEAN+M0.UNDEFINED},verbosity:{value:1,kind:$.API},wasmUrl:{value:"../web/wasm/",kind:$.API},workerPort:{value:null,kind:$.WORKER},workerSrc:{value:"../build/pdf.worker.mjs",kind:$.WORKER}};Os.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:$.VIEWER},Os.sandboxBundleSrc={value:"../build/pdf.sandbox.mjs",kind:$.VIEWER},Os.enableFakeMLManager={value:!0,kind:$.VIEWER};Os.disablePreferences={value:!1,kind:$.VIEWER};var Ka;const _r=class _r{static get(e){return a(this,Ka).get(e)}static getAll(e=null,t=!1){const n=Object.create(null);for(const r in Os){const i=Os[r];e&&!(e&i.kind)||(n[r]=t?i.value:a(this,Ka).get(r))}return n}static set(e,t){this.setAll({[e]:t})}static setAll(e,t=!1){this._hasInvokedSet||(this._hasInvokedSet=!0);let n;for(const r in e){const i=Os[r],s=e[r];if(!i||!(typeof s==typeof i.value||M0[(typeof s).toUpperCase()]&i.type))continue;const{kind:o}=i;t&&!(o&$.BROWSER||o&$.PREFERENCE)||(this.eventBus&&o&$.EVENT_DISPATCH&&(n||(n=new Map)).set(r,s),a(this,Ka).set(r,s))}if(n)for(const[r,i]of n)this.eventBus.dispatch(r.toLowerCase(),{source:this,value:i})}};Ka=new WeakMap,M(_r,"eventBus"),b(_r,Ka,new Map),(()=>{for(const e in Os)a(_r,Ka).set(e,Os[e].value);for(const[e,t]of O0)a(_r,Ka).set(e,t);_r._hasInvokedSet=!1,_r._checkDisablePreferences=()=>_r.get("disablePreferences")?!0:(_r._hasInvokedSet&&console.warn('The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.'),!1)})();let Ad=_r;function D1({width:h,height:e,left:t,top:n},r){if(h===0||e===0)return null;const i=r.textLayer.div.getBoundingClientRect(),s=r.getPagePoint(t-i.left,n-i.top),o=r.getPagePoint(t-i.left+h,n-i.top+e);return fb.normalizeRect([s[0],s[1],o[0],o[1]])}function LP(h,e){const t=h.getClientRects();if(t.length===1)return{rect:D1(t[0],e)};const n=[1/0,1/0,-1/0,-1/0],r=[];let i=0;for(const s of t){const o=D1(s,e);o!==null&&(r[i]=r[i+4]=o[0],r[i+1]=r[i+3]=o[3],r[i+2]=r[i+6]=o[2],r[i+5]=r[i+7]=o[1],fb.rectBoundingBox(...o,n),i+=8)}return{quadPoints:r,rect:n}}function O1(h,e){let t=h;do{if(t.nodeType===Node.TEXT_NODE){const n=t.textContent.length;if(e<=n)return[t,e];e-=n}else if(t.firstChild){t=t.firstChild;continue}for(;!t.nextSibling&&t!==h;)t=t.parentNode;t!==h&&(t=t.nextSibling)}while(t!==h);throw new Error("Offset is bigger than container's contents length.")}function NP({url:h,index:e,length:t},n,r){const i=n._textHighlighter,[{begin:s,end:o}]=i._convertMatches([e],[t]),l=new Range;return l.setStart(...O1(i.textDivs[s.divIdx],s.offset)),l.setEnd(...O1(i.textDivs[o.divIdx],o.offset)),{id:`inferred_link_${r}`,unsafeUrl:h,url:h,annotationType:pw.LINK,rotation:0,...LP(l,n),borderStyle:null}}var sv,Pp,Ip;class fm{static findLinks(e){var s;a(this,Pp)??g(this,Pp,new RegExp("\\b(?:https?:\\/\\/|mailto:|www\\.)(?:[\\0-\\x08\\x0E-\\x1F\\$\\+0-9=A-Z\\^`-z\\|~-\\x9F\\xA2-\\xA6\\xA8-\\xAA\\xAC-\\xB5\\xB8-\\xBA\\xBC-\\xBE\\xC0-\\u037D\\u037F-\\u0386\\u0388-\\u0559\\u0560-\\u0588\\u058B-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7-\\u05F2\\u05F5-\\u0608\\u060B\\u060E-\\u061A\\u061C\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06FF\\u070E-\\u07F6\\u07FA-\\u082F\\u083F-\\u085D\\u085F-\\u0963\\u0966-\\u096F\\u0971-\\u09FC\\u09FE-\\u0A75\\u0A77-\\u0AEF\\u0AF1-\\u0C76\\u0C78-\\u0C83\\u0C85-\\u0DF3\\u0DF5-\\u0E4E\\u0E50-\\u0E59\\u0E5C-\\u0F03\\u0F13\\u0F15-\\u0F39\\u0F3E-\\u0F84\\u0F86-\\u0FCF\\u0FD5-\\u0FD8\\u0FDB-\\u1049\\u1050-\\u10FA\\u10FC-\\u135F\\u1369-\\u13FF\\u1401-\\u166D\\u166F-\\u167F\\u1681-\\u169A\\u169D-\\u16EA\\u16EE-\\u1734\\u1737-\\u17D3\\u17D7\\u17DB-\\u17FF\\u180B-\\u1943\\u1946-\\u1A1D\\u1A20-\\u1A9F\\u1AA7\\u1AAE-\\u1B4D\\u1B50-\\u1B59\\u1B61-\\u1B7C\\u1B80-\\u1BFB\\u1C00-\\u1C3A\\u1C40-\\u1C7D\\u1C80-\\u1CBF\\u1CC8-\\u1CD2\\u1CD4-\\u1FFF\\u200B-\\u200F\\u202A-\\u202E\\u2044\\u2052\\u2060-\\u207C\\u207F-\\u208C\\u208F-\\u2307\\u230C-\\u2328\\u232B-\\u2767\\u2776-\\u27C4\\u27C7-\\u27E5\\u27F0-\\u2982\\u2999-\\u29D7\\u29DC-\\u29FB\\u29FE-\\u2CF8\\u2CFD\\u2D00-\\u2D6F\\u2D71-\\u2DFF\\u2E2F\\u2E50\\u2E51\\u2E5E-\\u2FFF\\u3004-\\u3007\\u3012\\u3013\\u3020-\\u302F\\u3031-\\u303C\\u303E-\\u309F\\u30A1-\\u30FA\\u30FC-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA672\\uA674-\\uA67D\\uA67F-\\uA6F1\\uA6F8-\\uA873\\uA878-\\uA8CD\\uA8D0-\\uA8F7\\uA8FB\\uA8FD-\\uA92D\\uA930-\\uA95E\\uA960-\\uA9C0\\uA9CE-\\uA9DD\\uA9E0-\\uAA5B\\uAA60-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uABEA\\uABEC-\\uFD3D\\uFD40-\\uFE0F\\uFE1A-\\uFE2F\\uFE53\\uFE62\\uFE64-\\uFE67\\uFE69\\uFE6C-\\uFEFE\\uFF00\\uFF04\\uFF0B\\uFF10-\\uFF19\\uFF1C-\\uFF1E\\uFF21-\\uFF3A\\uFF3E\\uFF40-\\uFF5A\\uFF5C\\uFF5E\\uFF66-\\u{100FF}\\u{10103}-\\u{1039E}\\u{103A0}-\\u{103CF}\\u{103D1}-\\u{1056E}\\u{10570}-\\u{10856}\\u{10858}-\\u{1091E}\\u{10920}-\\u{1093E}\\u{10940}-\\u{10A4F}\\u{10A59}-\\u{10A7E}\\u{10A80}-\\u{10AEF}\\u{10AF7}-\\u{10B38}\\u{10B40}-\\u{10B98}\\u{10B9D}-\\u{10D6D}\\u{10D6F}-\\u{10EAC}\\u{10EAE}-\\u{10ECF}\\u{10ED1}-\\u{10F54}\\u{10F5A}-\\u{10F85}\\u{10F8A}-\\u{11046}\\u{1104E}-\\u{110BA}\\u{110BD}\\u{110C2}-\\u{1113F}\\u{11144}-\\u{11173}\\u{11176}-\\u{111C4}\\u{111C9}-\\u{111CC}\\u{111CE}-\\u{111DA}\\u{111DC}\\u{111E0}-\\u{11237}\\u{1123E}-\\u{112A8}\\u{112AA}-\\u{113D3}\\u{113D6}\\u{113D9}-\\u{1144A}\\u{11450}-\\u{11459}\\u{1145C}\\u{1145E}-\\u{114C5}\\u{114C7}-\\u{115C0}\\u{115D8}-\\u{11640}\\u{11644}-\\u{1165F}\\u{1166D}-\\u{116B8}\\u{116BA}-\\u{1173B}\\u{1173F}-\\u{1183A}\\u{1183C}-\\u{11943}\\u{11947}-\\u{119E1}\\u{119E3}-\\u{11A3E}\\u{11A47}-\\u{11A99}\\u{11A9D}\\u{11AA3}-\\u{11AFF}\\u{11B0A}-\\u{11BE0}\\u{11BE2}-\\u{11C40}\\u{11C46}-\\u{11C6F}\\u{11C72}-\\u{11EF6}\\u{11EF9}-\\u{11F42}\\u{11F50}-\\u{11FFE}\\u{12000}-\\u{1246F}\\u{12475}-\\u{12FF0}\\u{12FF3}-\\u{16A6D}\\u{16A70}-\\u{16AF4}\\u{16AF6}-\\u{16B36}\\u{16B3C}-\\u{16B43}\\u{16B45}-\\u{16D6C}\\u{16D70}-\\u{16E96}\\u{16E9B}-\\u{16FE1}\\u{16FE3}-\\u{1BC9E}\\u{1BCA0}-\\u{1DA86}\\u{1DA8C}-\\u{1E5FE}\\u{1E600}-\\u{1E95D}\\u{1E960}-\\u{10FFFF}]|\\/|[\\0-\\x08\\x0E-\\x1F!-Z\\\\\\^-\\x9F\\xA1-\\u167F\\u1681-\\u1FFF\\u200B-\\u2027\\u202A-\\u202E\\u2030-\\u205E\\u2060-\\u2FFF\\u3001-\\uFEFE\\uFF00-\\u{10FFFF}]+[\\0-\\x08\\x0E-\\x1F\\$\\+0-9=A-Z\\^`-z\\|~-\\x9F\\xA2-\\xA6\\xA8-\\xAA\\xAC-\\xB5\\xB8-\\xBA\\xBC-\\xBE\\xC0-\\u037D\\u037F-\\u0386\\u0388-\\u0559\\u0560-\\u0588\\u058B-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7-\\u05F2\\u05F5-\\u0608\\u060B\\u060E-\\u061A\\u061C\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06FF\\u070E-\\u07F6\\u07FA-\\u082F\\u083F-\\u085D\\u085F-\\u0963\\u0966-\\u096F\\u0971-\\u09FC\\u09FE-\\u0A75\\u0A77-\\u0AEF\\u0AF1-\\u0C76\\u0C78-\\u0C83\\u0C85-\\u0DF3\\u0DF5-\\u0E4E\\u0E50-\\u0E59\\u0E5C-\\u0F03\\u0F13\\u0F15-\\u0F39\\u0F3E-\\u0F84\\u0F86-\\u0FCF\\u0FD5-\\u0FD8\\u0FDB-\\u1049\\u1050-\\u10FA\\u10FC-\\u135F\\u1369-\\u13FF\\u1401-\\u166D\\u166F-\\u167F\\u1681-\\u169A\\u169D-\\u16EA\\u16EE-\\u1734\\u1737-\\u17D3\\u17D7\\u17DB-\\u17FF\\u180B-\\u1943\\u1946-\\u1A1D\\u1A20-\\u1A9F\\u1AA7\\u1AAE-\\u1B4D\\u1B50-\\u1B59\\u1B61-\\u1B7C\\u1B80-\\u1BFB\\u1C00-\\u1C3A\\u1C40-\\u1C7D\\u1C80-\\u1CBF\\u1CC8-\\u1CD2\\u1CD4-\\u1FFF\\u200B-\\u200F\\u202A-\\u202E\\u2044\\u2052\\u2060-\\u207C\\u207F-\\u208C\\u208F-\\u2307\\u230C-\\u2328\\u232B-\\u2767\\u2776-\\u27C4\\u27C7-\\u27E5\\u27F0-\\u2982\\u2999-\\u29D7\\u29DC-\\u29FB\\u29FE-\\u2CF8\\u2CFD\\u2D00-\\u2D6F\\u2D71-\\u2DFF\\u2E2F\\u2E50\\u2E51\\u2E5E-\\u2FFF\\u3004-\\u3007\\u3012\\u3013\\u3020-\\u302F\\u3031-\\u303C\\u303E-\\u309F\\u30A1-\\u30FA\\u30FC-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA672\\uA674-\\uA67D\\uA67F-\\uA6F1\\uA6F8-\\uA873\\uA878-\\uA8CD\\uA8D0-\\uA8F7\\uA8FB\\uA8FD-\\uA92D\\uA930-\\uA95E\\uA960-\\uA9C0\\uA9CE-\\uA9DD\\uA9E0-\\uAA5B\\uAA60-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uABEA\\uABEC-\\uFD3D\\uFD40-\\uFE0F\\uFE1A-\\uFE2F\\uFE53\\uFE62\\uFE64-\\uFE67\\uFE69\\uFE6C-\\uFEFE\\uFF00\\uFF04\\uFF0B\\uFF10-\\uFF19\\uFF1C-\\uFF1E\\uFF21-\\uFF3A\\uFF3E\\uFF40-\\uFF5A\\uFF5C\\uFF5E\\uFF66-\\u{100FF}\\u{10103}-\\u{1039E}\\u{103A0}-\\u{103CF}\\u{103D1}-\\u{1056E}\\u{10570}-\\u{10856}\\u{10858}-\\u{1091E}\\u{10920}-\\u{1093E}\\u{10940}-\\u{10A4F}\\u{10A59}-\\u{10A7E}\\u{10A80}-\\u{10AEF}\\u{10AF7}-\\u{10B38}\\u{10B40}-\\u{10B98}\\u{10B9D}-\\u{10D6D}\\u{10D6F}-\\u{10EAC}\\u{10EAE}-\\u{10ECF}\\u{10ED1}-\\u{10F54}\\u{10F5A}-\\u{10F85}\\u{10F8A}-\\u{11046}\\u{1104E}-\\u{110BA}\\u{110BD}\\u{110C2}-\\u{1113F}\\u{11144}-\\u{11173}\\u{11176}-\\u{111C4}\\u{111C9}-\\u{111CC}\\u{111CE}-\\u{111DA}\\u{111DC}\\u{111E0}-\\u{11237}\\u{1123E}-\\u{112A8}\\u{112AA}-\\u{113D3}\\u{113D6}\\u{113D9}-\\u{1144A}\\u{11450}-\\u{11459}\\u{1145C}\\u{1145E}-\\u{114C5}\\u{114C7}-\\u{115C0}\\u{115D8}-\\u{11640}\\u{11644}-\\u{1165F}\\u{1166D}-\\u{116B8}\\u{116BA}-\\u{1173B}\\u{1173F}-\\u{1183A}\\u{1183C}-\\u{11943}\\u{11947}-\\u{119E1}\\u{119E3}-\\u{11A3E}\\u{11A47}-\\u{11A99}\\u{11A9D}\\u{11AA3}-\\u{11AFF}\\u{11B0A}-\\u{11BE0}\\u{11BE2}-\\u{11C40}\\u{11C46}-\\u{11C6F}\\u{11C72}-\\u{11EF6}\\u{11EF9}-\\u{11F42}\\u{11F50}-\\u{11FFE}\\u{12000}-\\u{1246F}\\u{12475}-\\u{12FF0}\\u{12FF3}-\\u{16A6D}\\u{16A70}-\\u{16AF4}\\u{16AF6}-\\u{16B36}\\u{16B3C}-\\u{16B43}\\u{16B45}-\\u{16D6C}\\u{16D70}-\\u{16E96}\\u{16E9B}-\\u{16FE1}\\u{16FE3}-\\u{1BC9E}\\u{1BCA0}-\\u{1DA86}\\u{1DA8C}-\\u{1E5FE}\\u{1E600}-\\u{1E95D}\\u{1E960}-\\u{10FFFF}])+|(?=\\p{L})[\\0-\\x08\\x0E-\\x1F!-'\\*-;=\\?A-Z\\\\\\^-z\\|~-\\x9F\\xA1-\\u0F39\\u0F3E-\\u167F\\u1681-\\u169A\\u169D-\\u1FFF\\u200B-\\u2019\\u201B-\\u201D\\u201F-\\u2027\\u202A-\\u202E\\u2030-\\u2044\\u2047-\\u205E\\u2060-\\u207C\\u207F-\\u208C\\u208F-\\u2307\\u230C-\\u2328\\u232B-\\u2767\\u2776-\\u27C4\\u27C7-\\u27E5\\u27F0-\\u2982\\u2999-\\u29D7\\u29DC-\\u29FB\\u29FE-\\u2E21\\u2E2A-\\u2E41\\u2E43-\\u2E54\\u2E5D-\\u2FFF\\u3001-\\u3007\\u3012\\u3013\\u301C\\u3020-\\uFD3D\\uFD40-\\uFE16\\uFE19-\\uFE34\\uFE45\\uFE46\\uFE49-\\uFE58\\uFE5F-\\uFEFE\\uFF00-\\uFF07\\uFF0A-\\uFF3A\\uFF3C\\uFF3E-\\uFF5A\\uFF5C\\uFF5E\\uFF61\\uFF64-\\u{10FFFF}]+@([\\0-\\x08\\x0E-\\x1F\\$\\+\\x2D0-9=A-Z\\^`-z\\|~-\\x9F\\xA2-\\xA6\\xA8-\\xAA\\xAC-\\xB5\\xB8-\\xBA\\xBC-\\xBE\\xC0-\\u037D\\u037F-\\u0386\\u0388-\\u0559\\u0560-\\u0588\\u058B-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7-\\u05F2\\u05F5-\\u0608\\u060B\\u060E-\\u061A\\u061C\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06FF\\u070E-\\u07F6\\u07FA-\\u082F\\u083F-\\u085D\\u085F-\\u0963\\u0966-\\u096F\\u0971-\\u09FC\\u09FE-\\u0A75\\u0A77-\\u0AEF\\u0AF1-\\u0C76\\u0C78-\\u0C83\\u0C85-\\u0DF3\\u0DF5-\\u0E4E\\u0E50-\\u0E59\\u0E5C-\\u0F03\\u0F13\\u0F15-\\u0F39\\u0F3E-\\u0F84\\u0F86-\\u0FCF\\u0FD5-\\u0FD8\\u0FDB-\\u1049\\u1050-\\u10FA\\u10FC-\\u135F\\u1369-\\u13FF\\u1401-\\u166D\\u166F-\\u167F\\u1681-\\u169A\\u169D-\\u16EA\\u16EE-\\u1734\\u1737-\\u17D3\\u17D7\\u17DB-\\u17FF\\u180B-\\u1943\\u1946-\\u1A1D\\u1A20-\\u1A9F\\u1AA7\\u1AAE-\\u1B4D\\u1B50-\\u1B59\\u1B61-\\u1B7C\\u1B80-\\u1BFB\\u1C00-\\u1C3A\\u1C40-\\u1C7D\\u1C80-\\u1CBF\\u1CC8-\\u1CD2\\u1CD4-\\u1FFF\\u200B-\\u200F\\u202A-\\u202E\\u2044\\u2052\\u2060-\\u207C\\u207F-\\u208C\\u208F-\\u2307\\u230C-\\u2328\\u232B-\\u2767\\u2776-\\u27C4\\u27C7-\\u27E5\\u27F0-\\u2982\\u2999-\\u29D7\\u29DC-\\u29FB\\u29FE-\\u2CF8\\u2CFD\\u2D00-\\u2D6F\\u2D71-\\u2DFF\\u2E2F\\u2E50\\u2E51\\u2E5E-\\u2FFF\\u3004-\\u3007\\u3012\\u3013\\u3020-\\u302F\\u3031-\\u303C\\u303E-\\u309F\\u30A1-\\u30FA\\u30FC-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA672\\uA674-\\uA67D\\uA67F-\\uA6F1\\uA6F8-\\uA873\\uA878-\\uA8CD\\uA8D0-\\uA8F7\\uA8FB\\uA8FD-\\uA92D\\uA930-\\uA95E\\uA960-\\uA9C0\\uA9CE-\\uA9DD\\uA9E0-\\uAA5B\\uAA60-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uABEA\\uABEC-\\uFD3D\\uFD40-\\uFE0F\\uFE1A-\\uFE2F\\uFE53\\uFE62\\uFE64-\\uFE67\\uFE69\\uFE6C-\\uFEFE\\uFF00\\uFF04\\uFF0B\\uFF10-\\uFF19\\uFF1C-\\uFF1E\\uFF21-\\uFF3A\\uFF3E\\uFF40-\\uFF5A\\uFF5C\\uFF5E\\uFF66-\\u{100FF}\\u{10103}-\\u{1039E}\\u{103A0}-\\u{103CF}\\u{103D1}-\\u{1056E}\\u{10570}-\\u{10856}\\u{10858}-\\u{1091E}\\u{10920}-\\u{1093E}\\u{10940}-\\u{10A4F}\\u{10A59}-\\u{10A7E}\\u{10A80}-\\u{10AEF}\\u{10AF7}-\\u{10B38}\\u{10B40}-\\u{10B98}\\u{10B9D}-\\u{10D6D}\\u{10D6F}-\\u{10EAC}\\u{10EAE}-\\u{10ECF}\\u{10ED1}-\\u{10F54}\\u{10F5A}-\\u{10F85}\\u{10F8A}-\\u{11046}\\u{1104E}-\\u{110BA}\\u{110BD}\\u{110C2}-\\u{1113F}\\u{11144}-\\u{11173}\\u{11176}-\\u{111C4}\\u{111C9}-\\u{111CC}\\u{111CE}-\\u{111DA}\\u{111DC}\\u{111E0}-\\u{11237}\\u{1123E}-\\u{112A8}\\u{112AA}-\\u{113D3}\\u{113D6}\\u{113D9}-\\u{1144A}\\u{11450}-\\u{11459}\\u{1145C}\\u{1145E}-\\u{114C5}\\u{114C7}-\\u{115C0}\\u{115D8}-\\u{11640}\\u{11644}-\\u{1165F}\\u{1166D}-\\u{116B8}\\u{116BA}-\\u{1173B}\\u{1173F}-\\u{1183A}\\u{1183C}-\\u{11943}\\u{11947}-\\u{119E1}\\u{119E3}-\\u{11A3E}\\u{11A47}-\\u{11A99}\\u{11A9D}\\u{11AA3}-\\u{11AFF}\\u{11B0A}-\\u{11BE0}\\u{11BE2}-\\u{11C40}\\u{11C46}-\\u{11C6F}\\u{11C72}-\\u{11EF6}\\u{11EF9}-\\u{11F42}\\u{11F50}-\\u{11FFE}\\u{12000}-\\u{1246F}\\u{12475}-\\u{12FF0}\\u{12FF3}-\\u{16A6D}\\u{16A70}-\\u{16AF4}\\u{16AF6}-\\u{16B36}\\u{16B3C}-\\u{16B43}\\u{16B45}-\\u{16D6C}\\u{16D70}-\\u{16E96}\\u{16E9B}-\\u{16FE1}\\u{16FE3}-\\u{1BC9E}\\u{1BCA0}-\\u{1DA86}\\u{1DA8C}-\\u{1E5FE}\\u{1E600}-\\u{1E95D}\\u{1E960}-\\u{10FFFF}]+(?:\\.[\\0-\\x08\\x0E-\\x1F\\$\\+\\x2D0-9=A-Z\\^`-z\\|~-\\x9F\\xA2-\\xA6\\xA8-\\xAA\\xAC-\\xB5\\xB8-\\xBA\\xBC-\\xBE\\xC0-\\u037D\\u037F-\\u0386\\u0388-\\u0559\\u0560-\\u0588\\u058B-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7-\\u05F2\\u05F5-\\u0608\\u060B\\u060E-\\u061A\\u061C\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06FF\\u070E-\\u07F6\\u07FA-\\u082F\\u083F-\\u085D\\u085F-\\u0963\\u0966-\\u096F\\u0971-\\u09FC\\u09FE-\\u0A75\\u0A77-\\u0AEF\\u0AF1-\\u0C76\\u0C78-\\u0C83\\u0C85-\\u0DF3\\u0DF5-\\u0E4E\\u0E50-\\u0E59\\u0E5C-\\u0F03\\u0F13\\u0F15-\\u0F39\\u0F3E-\\u0F84\\u0F86-\\u0FCF\\u0FD5-\\u0FD8\\u0FDB-\\u1049\\u1050-\\u10FA\\u10FC-\\u135F\\u1369-\\u13FF\\u1401-\\u166D\\u166F-\\u167F\\u1681-\\u169A\\u169D-\\u16EA\\u16EE-\\u1734\\u1737-\\u17D3\\u17D7\\u17DB-\\u17FF\\u180B-\\u1943\\u1946-\\u1A1D\\u1A20-\\u1A9F\\u1AA7\\u1AAE-\\u1B4D\\u1B50-\\u1B59\\u1B61-\\u1B7C\\u1B80-\\u1BFB\\u1C00-\\u1C3A\\u1C40-\\u1C7D\\u1C80-\\u1CBF\\u1CC8-\\u1CD2\\u1CD4-\\u1FFF\\u200B-\\u200F\\u202A-\\u202E\\u2044\\u2052\\u2060-\\u207C\\u207F-\\u208C\\u208F-\\u2307\\u230C-\\u2328\\u232B-\\u2767\\u2776-\\u27C4\\u27C7-\\u27E5\\u27F0-\\u2982\\u2999-\\u29D7\\u29DC-\\u29FB\\u29FE-\\u2CF8\\u2CFD\\u2D00-\\u2D6F\\u2D71-\\u2DFF\\u2E2F\\u2E50\\u2E51\\u2E5E-\\u2FFF\\u3004-\\u3007\\u3012\\u3013\\u3020-\\u302F\\u3031-\\u303C\\u303E-\\u309F\\u30A1-\\u30FA\\u30FC-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA672\\uA674-\\uA67D\\uA67F-\\uA6F1\\uA6F8-\\uA873\\uA878-\\uA8CD\\uA8D0-\\uA8F7\\uA8FB\\uA8FD-\\uA92D\\uA930-\\uA95E\\uA960-\\uA9C0\\uA9CE-\\uA9DD\\uA9E0-\\uAA5B\\uAA60-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uABEA\\uABEC-\\uFD3D\\uFD40-\\uFE0F\\uFE1A-\\uFE2F\\uFE53\\uFE62\\uFE64-\\uFE67\\uFE69\\uFE6C-\\uFEFE\\uFF00\\uFF04\\uFF0B\\uFF10-\\uFF19\\uFF1C-\\uFF1E\\uFF21-\\uFF3A\\uFF3E\\uFF40-\\uFF5A\\uFF5C\\uFF5E\\uFF66-\\u{100FF}\\u{10103}-\\u{1039E}\\u{103A0}-\\u{103CF}\\u{103D1}-\\u{1056E}\\u{10570}-\\u{10856}\\u{10858}-\\u{1091E}\\u{10920}-\\u{1093E}\\u{10940}-\\u{10A4F}\\u{10A59}-\\u{10A7E}\\u{10A80}-\\u{10AEF}\\u{10AF7}-\\u{10B38}\\u{10B40}-\\u{10B98}\\u{10B9D}-\\u{10D6D}\\u{10D6F}-\\u{10EAC}\\u{10EAE}-\\u{10ECF}\\u{10ED1}-\\u{10F54}\\u{10F5A}-\\u{10F85}\\u{10F8A}-\\u{11046}\\u{1104E}-\\u{110BA}\\u{110BD}\\u{110C2}-\\u{1113F}\\u{11144}-\\u{11173}\\u{11176}-\\u{111C4}\\u{111C9}-\\u{111CC}\\u{111CE}-\\u{111DA}\\u{111DC}\\u{111E0}-\\u{11237}\\u{1123E}-\\u{112A8}\\u{112AA}-\\u{113D3}\\u{113D6}\\u{113D9}-\\u{1144A}\\u{11450}-\\u{11459}\\u{1145C}\\u{1145E}-\\u{114C5}\\u{114C7}-\\u{115C0}\\u{115D8}-\\u{11640}\\u{11644}-\\u{1165F}\\u{1166D}-\\u{116B8}\\u{116BA}-\\u{1173B}\\u{1173F}-\\u{1183A}\\u{1183C}-\\u{11943}\\u{11947}-\\u{119E1}\\u{119E3}-\\u{11A3E}\\u{11A47}-\\u{11A99}\\u{11A9D}\\u{11AA3}-\\u{11AFF}\\u{11B0A}-\\u{11BE0}\\u{11BE2}-\\u{11C40}\\u{11C46}-\\u{11C6F}\\u{11C72}-\\u{11EF6}\\u{11EF9}-\\u{11F42}\\u{11F50}-\\u{11FFE}\\u{12000}-\\u{1246F}\\u{12475}-\\u{12FF0}\\u{12FF3}-\\u{16A6D}\\u{16A70}-\\u{16AF4}\\u{16AF6}-\\u{16B36}\\u{16B3C}-\\u{16B43}\\u{16B45}-\\u{16D6C}\\u{16D70}-\\u{16E96}\\u{16E9B}-\\u{16FE1}\\u{16FE3}-\\u{1BC9E}\\u{1BCA0}-\\u{1DA86}\\u{1DA8C}-\\u{1E5FE}\\u{1E600}-\\u{1E95D}\\u{1E960}-\\u{10FFFF}]+)+)","gmu"));const[t,n]=om(e,{ignoreDashEOL:!0}),r=t.matchAll(a(this,Pp)),i=[];for(const o of r){const[l,u]=o;let c;if(l.startsWith("www.")||l.startsWith("http://")||l.startsWith("https://"))c=l;else if(u){const f=(s=URL.parse(`http://${u}`))==null?void 0:s.hostname;if(!f||(a(this,Ip)??g(this,Ip,/\.\d+$/),a(this,Ip).test(f)))continue}c??(c=l.startsWith("mailto:")?l:`mailto:${l}`);const d=gw(c,null,{addDefaultProtocol:!0});if(d){const[f,p]=Aw(n,o.index,l.length);i.push({url:d.href,index:f,length:p})}}return i}static processLinks(e){return this.findLinks(e._textHighlighter.textContentItemsStr.join(` `)).map(t=>NP(t,e,ie(this,sv)._++))}}sv=new WeakMap,Pp=new WeakMap,Ip=new WeakMap,b(fm,sv,0),b(fm,Pp),b(fm,Ip);const Rt={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3};class BP{constructor(){M(this,"renderingId","");M(this,"renderTask",null);M(this,"resume",null)}get renderingState(){throw new Error("Abstract getter `renderingState` accessed")}set renderingState(e){throw new Error("Abstract setter `renderingState` accessed")}async draw(){throw new Error("Not implemented: draw")}}var Ja,dc,fc,vs,Za,ys,av,Rp,L0;class Gw extends BP{constructor(t){super();b(this,Rp);b(this,Ja,null);b(this,dc,null);b(this,fc,Rt.INITIAL);b(this,vs,null);b(this,Za,0);b(this,ys,null);M(this,"canvas",null);M(this,"div",null);M(this,"enableOptimizedPartialRendering",!1);M(this,"imagesRightClickMinSize",-1);M(this,"eventBus",null);M(this,"id",null);M(this,"imageCoordinates",null);M(this,"pageColors",null);M(this,"recordedBBoxes",null);M(this,"renderingQueue",null);b(this,av,t=>{var n;if((n=a(this,vs))==null||n.call(this,!1),this.renderingQueue&&!this.renderingQueue.isHighestPriority(this)){this.renderingState=Rt.PAUSED,this.resume=()=>{this.renderingState=Rt.RUNNING,t()};return}t()});this.eventBus=t.eventBus,this.id=t.id,this.pageColors=t.pageColors||null,this.renderingQueue=t.renderingQueue,this.enableOptimizedPartialRendering=t.enableOptimizedPartialRendering??!1,this.imagesRightClickMinSize=t.imagesRightClickMinSize??-1,this.minDurationToUpdateCanvas=t.minDurationToUpdateCanvas??500}get renderingState(){return a(this,fc)}set renderingState(t){var n;if(t!==a(this,fc))switch(g(this,fc,t),a(this,Ja)&&(clearTimeout(a(this,Ja)),g(this,Ja,null)),t){case Rt.PAUSED:this.div.classList.remove("loading"),g(this,Za,0),(n=a(this,vs))==null||n.call(this,!1);break;case Rt.RUNNING:this.div.classList.add("loadingIcon"),g(this,Ja,setTimeout(()=>{this.div.classList.add("loading"),g(this,Ja,null)},0)),g(this,Za,Date.now());break;case Rt.INITIAL:case Rt.FINISHED:this.div.classList.remove("loadingIcon","loading"),g(this,Za,0);break}}_createCanvas(t,n=!1){const{pageColors:r}=this,i=!!(r!=null&&r.background&&(r!=null&&r.foreground)),s=this.canvas,o=!s&&!i&&!n;let l=this.canvas=document.createElement("canvas");return g(this,vs,u=>{if(o){let c=a(this,ys);if(!u&&this.minDurationToUpdateCanvas>0){if(Date.now()-a(this,Za){u instanceof g0&&(n(),g(this,dc,null))};let s=null;try{await i.promise,(o=a(this,vs))==null||o.call(this,!0)}catch(u){if(u instanceof g0)return;s=u,(l=a(this,vs))==null||l.call(this,!0)}finally{g(this,dc,s),i===this.renderTask&&(this.renderTask=null,this.enableOptimizedPartialRendering&&(this.recordedBBoxes??(this.recordedBBoxes=i.recordedBBoxes)),this.imagesRightClickMinSize!==-1&&(this.imageCoordinates??(this.imageCoordinates=this.pdfPage.imageCoordinates)))}if(this.renderingState=Rt.FINISHED,r(i),s)throw s}cancelRendering({cancelExtraDelay:t=0}={}){this.renderTask&&(this.renderTask.cancel(t),this.renderTask=null),this.resume=null}dispatchPageRender(){this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id})}dispatchPageRendered(t,n){this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:t,isDetailView:n,timestamp:performance.now(),error:a(this,dc)})}}Ja=new WeakMap,dc=new WeakMap,fc=new WeakMap,vs=new WeakMap,Za=new WeakMap,ys=new WeakMap,av=new WeakMap,Rp=new WeakSet,L0=function(){a(this,ys)&&(a(this,ys).width=a(this,ys).height=0,g(this,ys,null))};var vi;class kP{constructor(){b(this,vi,null)}async render({intent:e="display"}){e!=="display"||a(this,vi)||this._cancelled||g(this,vi,new $C)}cancel(){this._cancelled=!0,a(this,vi)&&(a(this,vi).destroy(),g(this,vi,null))}setParent(e){var t;(t=a(this,vi))==null||t.setParent(e)}getDrawLayer(){return a(this,vi)}}vi=new WeakMap;var pr,ov,Xw;class jP extends Gw{constructor({pageView:t}){super(t);b(this,ov);b(this,pr,null);M(this,"renderingCancelled",!1);this.pageView=t,this.renderingId="detail"+this.id,this.div=t.div}setPdfPage(t){this.pageView.setPdfPage(t)}get pdfPage(){return this.pageView.pdfPage}get renderingState(){return super.renderingState}set renderingState(t){this.renderingCancelled=!1,super.renderingState=t}reset({keepCanvas:t=!1}={}){const n=this.renderingCancelled||this.renderingState===Rt.RUNNING||this.renderingState===Rt.PAUSED;this.cancelRendering(),this.renderingState=Rt.INITIAL,this.renderingCancelled=n,t||this._resetCanvas()}update({visibleArea:t=null,underlyingViewUpdated:n=!1}={}){if(n){this.cancelRendering(),this.renderingState=Rt.INITIAL;return}if(!A(this,ov,Xw).call(this,t))return;const{viewport:r,maxCanvasPixels:i,capCanvasAreaFactor:s}=this.pageView,o=t.maxX-t.minX,l=t.maxY-t.minY,u=o*l*am.pixelRatio**2,d=(Math.sqrt(am.capPixels(i,s)/u)-1)/2;let f=Math.min(1,d);f<0&&(f=0);const p=o*f,m=l*f,v=Math.max(0,t.minX-p),y=Math.min(r.width,t.maxX+p),E=Math.max(0,t.minY-m),S=Math.min(r.height,t.maxY+m),w=y-v,C=S-E;g(this,pr,{minX:v,minY:E,width:w,height:C,scale:r.scale}),this.reset({keepCanvas:!0})}_getRenderingContext(t,n){const r=this.pageView._getRenderingContext(t,n,!1),i=this.pdfPage.recordedBBoxes;if(!i||!this.enableOptimizedPartialRendering)return r;const{viewport:{width:s,height:o}}=this.pageView,{width:l,height:u,minX:c,minY:d}=a(this,pr),f=c/s,p=d/o,m=(c+l)/s,v=(d+u)/o;return{...r,operationsFilter(y){return i.isEmpty(y)?!1:i.minX(y)<=m&&i.maxX(y)>=f&&i.minY(y)<=v&&i.maxY(y)>=p}}}async draw(){if(this.pageView.detailView!==this)return;const t=this.pageView.renderingState===Rt.FINISHED||this.renderingState===Rt.FINISHED;this.renderingState!==Rt.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:n,pdfPage:r,viewport:i}=this.pageView;if(!r)throw this.renderingState=Rt.FINISHED,new Error("pdfPage is not loaded");this.renderingState=Rt.RUNNING;const s=this.pageView._ensureCanvasWrapper(),{canvas:o,prevCanvas:l}=this._createCanvas(y=>{var E;((E=s.firstElementChild)==null?void 0:E.tagName)==="CANVAS"?s.firstElementChild.after(y):s.prepend(y)},t);o.ariaHidden=!0,this.enableOptimizedPartialRendering&&(o.className="detailView");const{width:u,height:c}=i,d=a(this,pr),{pixelRatio:f}=am,p=[f,0,0,f,-d.minX*f,-d.minY*f];o.width=d.width*f,o.height=d.height*f;const{style:m}=o;m.width=`${d.width*100/u}%`,m.height=`${d.height*100/c}%`,m.top=`${d.minY*100/c}%`,m.left=`${d.minX*100/u}%`;const v=this._drawCanvas(this._getRenderingContext(o,p),()=>{var y;(y=this.canvas)==null||y.remove(),this.canvas=l},()=>{this.dispatchPageRendered(!1,!0)});return n.setAttribute("data-loaded",!0),this.dispatchPageRender(),v}}pr=new WeakMap,ov=new WeakSet,Xw=function(t){if(!a(this,pr))return!0;const n=a(this,pr).minX,r=a(this,pr).minY,i=a(this,pr).width+n,s=a(this,pr).height+r;if(t.minXi||t.maxY>s)return!0;const{width:o,height:l,scale:u}=this.pageView.viewport;if(a(this,pr).scale!==u)return!0;const c=t.minX-n,d=i-t.maxX,f=t.minY-r,p=s-t.maxY,m=.5,v=(1+m)/m;return n>0&&d/c>v||iv||r>0&&p/f>v||sv};const M1={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"rowgroup",TBody:"rowgroup",TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},_w=new Set(["math","merror","mfrac","mi","mmultiscripts","mn","mo","mover","mpadded","mprescripts","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msubsup","msup","mtable","mtd","mtext","mtr","munder","munderover","semantics"]),Rm="http://www.w3.org/1998/Math/MathML";class L1{static get sanitizer(){return Id(this,"sanitizer",mw.isSanitizerSupported?new Sanitizer({elements:[..._w].map(e=>({name:e,namespace:Rm})),replaceWithChildrenElements:[{name:"maction",namespace:Rm}],attributes:["dir","displaystyle","mathbackground","mathcolor","mathsize","scriptlevel","encoding","display","linethickness","intent","arg","form","fence","separator","lspace","rspace","stretchy","symmetric","maxsize","minsize","largeop","movablelimits","width","height","depth","voffset","accent","accentunder","columnspan","rowspan"],comments:!1}):null)}}const UP=/^H(\d+)$/;var pc,jr,gc,Fp,mc,Qa,qa,yi,Qn,N0,Kw,B0,k0;class Yw{constructor(e,t){b(this,Qn);b(this,pc);b(this,jr,null);b(this,gc);b(this,Fp,new Map);b(this,mc);b(this,Qa,null);b(this,qa,null);b(this,yi,null);g(this,pc,e.getStructTree()),g(this,mc,t)}async render(){var r;if(a(this,gc))return a(this,gc);const{promise:e,resolve:t,reject:n}=Promise.withResolvers();g(this,gc,e);try{g(this,jr,A(this,Qn,k0).call(this,await a(this,pc)))}catch(i){n(i)}return g(this,pc,null),(r=a(this,jr))==null||r.classList.add("structTree"),t(a(this,jr)),e}async getAriaAttributes(e){try{return await this.render(),a(this,Fp).get(e)}catch{}return null}hide(){a(this,jr)&&!a(this,jr).hidden&&(a(this,jr).hidden=!0)}show(){var e;(e=a(this,jr))!=null&&e.hidden&&(a(this,jr).hidden=!1)}updateTextLayer(){var e;if(a(this,Qa)){for(const[t,n]of a(this,Qa))(e=document.getElementById(t))==null||e.append(n);a(this,Qa).clear(),g(this,Qa,null)}if(a(this,qa)){for(const t of a(this,qa)){const n=document.getElementById(t);n&&(n.ariaHidden=!0)}a(this,qa).length=0,g(this,qa,null)}if(a(this,yi)){for(let t=0,n=a(this,yi).length;t0){const e=a(this,gr);for(const[t,n]of a(this,As)){if(!document.getElementById(t)){a(this,As).delete(t);continue}A(this,Dp,U0).call(this,t,e[n])}}for(const[e,t]of a(this,to))this.addPointerInTextLayer(e,t);a(this,to).clear()}disable(){a(this,bs)&&(a(this,to).clear(),g(this,gr,null),g(this,bs,!1))}removePointerInTextLayer(e){if(!a(this,bs)){a(this,to).delete(e);return}const t=a(this,gr);if(!t||t.length===0)return;const{id:n}=e,r=a(this,As).get(n);if(r===void 0)return;const i=t[r];a(this,As).delete(n);let s=i.getAttribute("aria-owns");s!=null&&s.includes(n)&&(s=s.split(" ").filter(o=>o!==n).join(" "),s?i.setAttribute("aria-owns",s):(i.removeAttribute("aria-owns"),i.setAttribute("role","presentation")))}addPointerInTextLayer(e,t){const{id:n}=e;if(!n)return null;if(!a(this,bs))return a(this,to).set(e,t),null;t&&this.removePointerInTextLayer(e);const r=a(this,gr);if(!r||r.length===0)return null;const i=Rd(r,u=>{var c;return A(c=Rh,vc,pm).call(c,e,u)<0}),s=Math.max(0,i-1),o=r[s];A(this,Dp,U0).call(this,n,o),a(this,As).set(n,s);const l=o.parentNode;return l!=null&&l.classList.contains("markedContent")?l.id:null}moveElementInDOM(e,t,n,r){const i=this.addPointerInTextLayer(n,r);if(!e.hasChildNodes())return e.append(t),i;const s=Array.from(e.childNodes).filter(l=>l!==t);if(s.length===0)return i;const o=Rd(s,l=>{var u;return A(u=Rh,vc,pm).call(u,t,l)<0});return o===0?s[0].before(t):s[o-1].after(t),i}};bs=new WeakMap,gr=new WeakMap,As=new WeakMap,to=new WeakMap,vc=new WeakSet,pm=function(e,t){const n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(n.width===0&&n.height===0)return 1;if(r.width===0&&r.height===0)return-1;const i=n.y,s=n.y+n.height,o=n.y+n.height/2,l=r.y,u=r.y+r.height,c=r.y+r.height/2;if(o<=l&&c>=s)return-1;if(c<=i&&o>=u)return 1;const d=n.x+n.width/2,f=r.x+r.width/2;return d-f},Dp=new WeakSet,U0=function(e,t){const n=t.getAttribute("aria-owns");n!=null&&n.includes(e)||t.setAttribute("aria-owns",n?`${n} ${e}`:e),t.removeAttribute("role")},b(Rh,vc);let j0=Rh;var eo;class $P{constructor({findController:e,eventBus:t,pageIndex:n}){b(this,eo,null);this.findController=e,this.matches=[],this.eventBus=t,this.pageIdx=n,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(e,t){this.textDivs=e,this.textContentItemsStr=t}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0,a(this,eo)||(g(this,eo,new AbortController),this.eventBus._on("updatetextlayermatches",e=>{(e.pageIndex===this.pageIdx||e.pageIndex===-1)&&this._updateMatches()},{signal:a(this,eo).signal})),this._updateMatches()}disable(){var e;this.enabled&&(this.enabled=!1,(e=a(this,eo))==null||e.abort(),g(this,eo,null),this._updateMatches(!0))}_convertMatches(e,t){if(!e)return[];const{textContentItemsStr:n}=this;let r=0,i=0;const s=n.length-1,o=[];for(let l=0,u=e.length;l=i+n[r].length;)i+=n[r].length,r++;r===n.length&&console.error("Could not find a matching mapping");const d={begin:{divIdx:r,offset:c-i}};for(c+=t[l];r!==s&&c>i+n[r].length;)i+=n[r].length,r++;d.end={divIdx:r,offset:c-i},o.push(d)}return o}_renderMatches(e){if(e.length===0)return;const{findController:t,pageIdx:n}=this,{textContentItemsStr:r,textDivs:i}=this,s=n===t.selected.pageIdx,o=t.selected.matchIdx,l=t.state.highlightAll;let u=null;const c={offset:void 0};function d(E,S){const w=E.divIdx;return i[w].textContent="",f(w,0,E.offset,S)}function f(E,S,w,C){let x=i[E];if(x.nodeType===Node.TEXT_NODE){const F=document.createElement("span");x.before(F),F.append(x),i[E]=F,x=F}const T=r[E].substring(S,w),I=document.createTextNode(T);if(C){const F=document.createElement("span");return F.className=`${C} appended`,F.append(I),x.append(F),C.includes("selected")?F:null}return x.append(I),0}let p=o,m=p+1;if(l)p=0,m=e.length;else if(!s)return;let v=-1,y=-1;for(let E=p;E{t.classList.add("selecting")},r),t.addEventListener("copy",s=>{if(!a(this,Mp)){const o=document.getSelection();s.clipboardData.setData("text/plain",bd(_C(o.toString())))}m0(s)},r),a(Xs,Sn).set(t,e),A(i=Xs,Nc,Qw).call(i,n)},Nc=new WeakSet,Zw=function(e){var t;a(this,Sn).delete(e),a(this,Sn).size===0&&((t=a(this,Es))==null||t.abort(),g(this,Es,null))},Qw=function(e){if(a(this,Es))return;g(this,Es,new AbortController);const t=e?AbortSignal.any([a(this,Es).signal,e]):a(this,Es).signal,n=(o,l)=>{l.append(o),o.style.width="",o.style.height="",l.classList.remove("selecting")};let r=!1;document.addEventListener("pointerdown",()=>{r=!0},{signal:t}),document.addEventListener("pointerup",()=>{r=!1,a(this,Sn).forEach(n)},{signal:t}),window.addEventListener("blur",()=>{r=!1,a(this,Sn).forEach(n)},{signal:t}),document.addEventListener("keyup",()=>{r||a(this,Sn).forEach(n)},{signal:t});var i,s;document.addEventListener("selectionchange",()=>{var m,v;const o=document.getSelection();if(o.rangeCount===0){a(this,Sn).forEach(n);return}const l=new Set;for(let y=0;y{l===this._optionalContentConfigPromise&&(a(this,Ss).initialOptionalContent=u.hasInitialVisibility)}),t.l10n||this.l10n.translate(this.div)}}clone(t){const n=new wb({container:null,eventBus:this.eventBus,pagesColors:this.pageColors,renderingQueue:this.renderingQueue,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,minDurationToUpdateCanvas:this.minDurationToUpdateCanvas,defaultViewport:this.viewport,id:t,layerProperties:a(this,Ur),abortSignal:a(this,yc),scale:this.scale,optionalContentConfigPromise:this._optionalContentConfigPromise,textLayerMode:a(this,Zl),annotationMode:a(this,ws),imageResourcesPath:this.imageResourcesPath,enableDetailCanvas:this.enableDetailCanvas,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableAutoLinking:a(this,Ac),commentManager:a(this,bc),l10n:this.l10n});return n.setPdfPage(this.pdfPage.clone(t-1)),n}updatePageNumber(t){var i;if(this.id===t)return;const n=this.id;this.id=t,this.renderingId=`page${t}`,this.pdfPage&&(this.pdfPage.pageNumber=t),this.setPageLabel(this.pageLabel);const{div:r}=this;r.setAttribute("data-page-number",t),r.setAttribute("data-l10n-args",JSON.stringify({page:t})),this._textHighlighter.pageIdx=t-1,(i=a(this,Ur).annotationEditorUIManager)==null||i.updatePageIndex(n-1,t-1)}setPdfPage(t){var r,i,s,o;this._isStandalone&&(((r=this.pageColors)==null?void 0:r.foreground)==="CanvasText"||((i=this.pageColors)==null?void 0:i.background)==="Canvas")&&((s=this._container)==null||s.style.setProperty("--hcm-highlight-filter",t.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),(o=this._container)==null||o.style.setProperty("--hcm-highlight-selected-filter",t.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","Highlight"))),this.pdfPage=t,this.pdfPageRotate=t.rotate;const n=(this.rotation+this.pdfPageRotate)%360;this.viewport=t.getViewport({scale:this.scale*Li.PDF_TO_CSS_UNITS,rotation:n}),A(this,bt,gm).call(this),this.reset()}destroy(){var t;this.reset(),(t=this.pdfPage)==null||t.cleanup()}deleteMe(t){var n;if(t){this.div.remove();return}this.destroy(),(n=a(this,Ur).annotationEditorUIManager)==null||n.deletePage(this.id)}hasEditableAnnotations(){var t;return!!((t=this.annotationLayer)!=null&&t.hasEditableAnnotations())}get _textHighlighter(){return Id(this,"_textHighlighter",new $P({pageIndex:this.id-1,eventBus:this.eventBus,findController:a(this,Ur).findController}))}_resetCanvas(){super._resetCanvas(),g(this,wc,null)}reset({keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:n=!1,keepXfaLayer:r=!1,keepTextLayer:i=!1,keepCanvasWrapper:s=!1,preserveDetailViewState:o=!1}={}){var y,E,S,w,C,x,T;const l=((y=this.pdfPage)==null?void 0:y._pdfBug)??!1;this.cancelRendering({keepAnnotationLayer:t,keepAnnotationEditorLayer:n,keepXfaLayer:r,keepTextLayer:i}),this.renderingState=Rt.INITIAL;const u=this.div,c=u.childNodes,d=t&&((E=this.annotationLayer)==null?void 0:E.div)||null,f=n&&((S=this.annotationEditorLayer)==null?void 0:S.div)||null,p=r&&((w=this.xfaLayer)==null?void 0:w.div)||null,m=i&&((C=this.textLayer)==null?void 0:C.div)||null,v=s&&a(this,no)||null;for(let I=c.length-1;I>=0;I--){const F=c[I];switch(F){case d:case f:case p:case m:case v:continue}if(l&&F.classList.contains("pdfBugGroupsLayer"))continue;F.remove();const P=a(this,ro).indexOf(F);P>=0&&(a(this,ro)[P]=null)}u.removeAttribute("data-loaded"),d&&this.annotationLayer.hide(),f&&this.annotationEditorLayer.hide(),p&&this.xfaLayer.hide(),m&&this.textLayer.hide(),(x=this.structTreeLayer)==null||x.hide(),!s&&a(this,no)&&(g(this,no,null),this._resetCanvas()),o||((T=this.detailView)==null||T.reset({keepCanvas:s}),s||(this.detailView=null))}toggleEditingMode(t){g(this,Np,t),this.hasEditableAnnotations()&&this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0})}updateVisibleArea(t){this.enableDetailCanvas&&(a(this,xs)&&this.maxCanvasPixels>0&&t?(this.detailView??(this.detailView=new jP({pageView:this,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,imagesRightClickMinSize:-1})),this.detailView.update({visibleArea:t})):this.detailView&&(this.detailView.reset(),this.detailView=null))}update({scale:t=0,rotation:n=null,optionalContentConfigPromise:r=null,drawingDelay:i=-1}){var o,l,u;this.scale=t||this.scale,typeof n=="number"&&(this.rotation=n),r instanceof Promise&&(this._optionalContentConfigPromise=r,r.then(c=>{r===this._optionalContentConfigPromise&&(a(this,Ss).initialOptionalContent=c.hasInitialVisibility)})),a(this,Ss).directDrawing=!0;const s=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*Li.PDF_TO_CSS_UNITS,rotation:s}),A(this,bt,gm).call(this),this._isStandalone&&((o=this._container)==null||o.style.setProperty("--scale-factor",this.viewport.scale)),A(this,bt,G0).call(this),this.canvas){const c=a(this,Ec)&&a(this,xs),d=i>=0&&i<1e3;if(d||c){d&&!c&&this.renderingState!==Rt.FINISHED&&(this.cancelRendering({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:i}),this.renderingState=Rt.FINISHED,a(this,Ss).directDrawing=!1),this.cssTransform({redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!d,hideTextLayer:d}),d||((l=this.detailView)==null||l.update({underlyingViewUpdated:!0}),this.dispatchPageRendered(!0,!1));return}}this.cssTransform({}),this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0,preserveDetailViewState:!0}),(u=this.detailView)==null||u.update({underlyingViewUpdated:!0})}cancelRendering({keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:n=!1,keepXfaLayer:r=!1,keepTextLayer:i=!1,cancelExtraDelay:s=0}={}){var o;super.cancelRendering({cancelExtraDelay:s}),this.textLayer&&(!i||!this.textLayer.div)&&(this.textLayer.cancel(),this.textLayer=null),this.annotationLayer&&(!t||!this.annotationLayer.div)&&(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),this.annotationEditorLayer&&(!n||!this.annotationEditorLayer.div)&&(this.drawLayer&&(this.drawLayer.cancel(),this.drawLayer=null),this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),this.xfaLayer&&(!r||!this.xfaLayer.div)&&(this.xfaLayer.cancel(),this.xfaLayer=null,(o=this._textHighlighter)==null||o.disable())}cssTransform({redrawAnnotationLayer:t=!1,redrawAnnotationEditorLayer:n=!1,redrawXfaLayer:r=!1,redrawTextLayer:i=!1,hideTextLayer:s=!1}){var u;const{canvas:o}=this;if(!o)return;const l=a(this,wc);if(this.viewport!==l){const c=(360+this.viewport.rotation-l.rotation)%360;if(c===90||c===270){const{width:d,height:f}=this.viewport,p=f/d,m=d/f;o.style.transform=`rotate(${c}deg) scale(${p},${m})`}else o.style.transform=c===0?"":`rotate(${c}deg)`}t&&this.annotationLayer&&A(this,bt,$0).call(this),n&&this.annotationEditorLayer&&(this.drawLayer&&A(this,bt,V0).call(this),A(this,bt,H0).call(this)),r&&this.xfaLayer&&A(this,bt,W0).call(this),this.textLayer&&(s?(this.textLayer.hide(),(u=this.structTreeLayer)==null||u.hide()):i&&A(this,bt,z0).call(this))}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(t,n){return this.viewport.convertToPdfPoint(t,n)}_ensureCanvasWrapper(){let t=a(this,no);return t||(t=g(this,no,document.createElement("div")),t.classList.add("canvasWrapper"),A(this,bt,Th).call(this,t,"canvasWrapper")),t}_getRenderingContext(t,n,r,i){return{canvas:t,transform:n,viewport:this.viewport,annotationMode:a(this,ws),optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:this.pageColors,isEditing:a(this,Np),recordOperations:r,recordImages:i}}async draw(){this.renderingState!==Rt.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:t,l10n:n,pdfPage:r,viewport:i}=this;if(!r)throw this.renderingState=Rt.FINISHED,new Error("pdfPage is not loaded");this.renderingState=Rt.RUNNING;const s=this._ensureCanvasWrapper();if(!this.textLayer&&a(this,Zl)!==Ei.DISABLE&&!r.isPureXfa&&(this._accessibilityManager||(this._accessibilityManager=new j0),this.textLayer=new Fm({pdfPage:r,highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,enablePermissions:a(this,Zl)===Ei.ENABLE_PERMISSIONS,onAppend:T=>{this.l10n.pause(),A(this,bt,Th).call(this,T,"textLayer"),this.l10n.resume()},abortSignal:a(this,yc)})),!this.annotationLayer&&a(this,ws)!==xi.DISABLE){const{annotationStorage:T,annotationEditorUIManager:I,downloadManager:F,enableComment:P,enableScripting:R,fieldObjectsPromise:D,hasJSActionsPromise:k,linkService:N}=a(this,Ur);this._annotationCanvasMap||(this._annotationCanvasMap=new Map),this.annotationLayer=new Rw({pdfPage:r,annotationStorage:T,imageResourcesPath:this.imageResourcesPath,renderForms:a(this,ws)===xi.ENABLE_FORMS,linkService:N,downloadManager:F,enableComment:P,enableScripting:R,hasJSActionsPromise:k,fieldObjectsPromise:D,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager,annotationEditorUIManager:I,commentManager:a(this,bc),onAppend:H=>{A(this,bt,Th).call(this,H,"annotationLayer")}})}const{width:o,height:l}=i;g(this,wc,i);const{canvas:u,prevCanvas:c}=this._createCanvas(T=>{s.prepend(T)});u.setAttribute("role","presentation"),this.outputScale||A(this,bt,G0).call(this);const{outputScale:d}=this;g(this,Ec,a(this,xs));const f=u1(d.sx),p=u1(d.sy),m=u.width=vg(yg(o*d.sx),f[0]),v=u.height=vg(yg(l*d.sy),p[0]),y=vg(yg(o),f[1]),E=vg(yg(l),p[1]);d.sx=m/y,d.sy=v/E,a(this,kp)!==f[1]&&(t.style.setProperty("--scale-round-x",`${f[1]}px`),g(this,kp,f[1])),a(this,jp)!==p[1]&&(t.style.setProperty("--scale-round-y",`${p[1]}px`),g(this,jp,p[1]));const S=this.enableOptimizedPartialRendering&&a(this,Ec)&&!this.recordedBBoxes,w=this.imagesRightClickMinSize!==-1&&!this.imageCoordinates,C=d.scaled?[d.sx,0,0,d.sy,0,0]:null,x=this._drawCanvas(this._getRenderingContext(u,C,S,w),()=>{c==null||c.remove(),this._resetCanvas()},T=>{a(this,Ss).regularAnnotations=!T.separateAnnots,this.dispatchPageRendered(!1,!1)}).then(async()=>{var F;if(this.renderingState!==Rt.FINISHED)return;this.structTreeLayer||(this.structTreeLayer=new Yw(r,i.rawDims));const T=A(this,bt,z0).call(this);this.annotationLayer&&(await A(this,bt,$0).call(this),a(this,Ac)&&this.annotationLayer&&this.textLayer&&await A(this,bt,nx).call(this,T));const{annotationEditorUIManager:I}=a(this,Ur);I&&(this.drawLayer||(this.drawLayer=new kP),await A(this,bt,V0).call(this),this.drawLayer.setParent(s),(this.annotationLayer||a(this,ws)===xi.DISABLE)&&(this.annotationEditorLayer||(this.annotationEditorLayer=new MP({uiManager:I,pageIndex:this.id-1,l10n:n,structTreeLayer:this.structTreeLayer,accessibilityManager:this._accessibilityManager,annotationLayer:(F=this.annotationLayer)==null?void 0:F.annotationLayer,textLayer:this.textLayer,drawLayer:this.drawLayer.getDrawLayer(),onAppend:P=>{A(this,bt,Th).call(this,P,"annotationEditorLayer")}})),A(this,bt,H0).call(this)))});if(r.isPureXfa){if(!this.xfaLayer){const{annotationStorage:T,linkService:I}=a(this,Ur);this.xfaLayer=new qw({pdfPage:r,annotationStorage:T,linkService:I})}A(this,bt,W0).call(this)}return t.setAttribute("data-loaded",!0),this.dispatchPageRender(),x}setPageLabel(t){this.pageLabel=typeof t=="string"?t:null,this.div.setAttribute("data-l10n-args",JSON.stringify({page:this.pageLabel??this.id})),this.pageLabel!==null?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){const{directDrawing:t,initialOptionalContent:n,regularAnnotations:r}=a(this,Ss);return t&&n&&r?this.canvas:null}};yc=new WeakMap,ws=new WeakMap,no=new WeakMap,bc=new WeakMap,Ac=new WeakMap,Ec=new WeakMap,Np=new WeakMap,Ur=new WeakMap,xs=new WeakMap,wc=new WeakMap,Bp=new WeakMap,kp=new WeakMap,jp=new WeakMap,Zl=new WeakMap,Up=new WeakMap,Ss=new WeakMap,ro=new WeakMap,bt=new WeakSet,Th=function(t,n){const r=VP.get(n),i=a(this,ro)[r];if(a(this,ro)[r]=t,i){i.replaceWith(t);return}for(let s=r-1;s>=0;s--){const o=a(this,ro)[s];if(o){o.after(t);return}}this.div.prepend(t)},gm=function(){const{div:t,viewport:n}=this;if(n.userUnit!==a(this,Up)&&(n.userUnit!==1?t.style.setProperty("--user-unit",n.userUnit):t.style.removeProperty("--user-unit"),g(this,Up,n.userUnit)),this.pdfPage){if(a(this,Bp)===n.rotation)return;g(this,Bp,n.rotation)}vw(t,n,!0,!1)},pd=function(t,n){this.eventBus.dispatch(t,{source:this,pageNumber:this.id,error:n})},$0=async function(){let t=null;try{await this.annotationLayer.render({viewport:this.viewport,intent:"display",structTreeLayer:this.structTreeLayer})}catch(n){console.error("#renderAnnotationLayer:",n),t=n}finally{A(this,bt,pd).call(this,"annotationlayerrendered",t)}},H0=async function(){let t=null;try{await this.annotationEditorLayer.render({viewport:this.viewport,intent:"display"})}catch(n){console.error("#renderAnnotationEditorLayer:",n),t=n}finally{A(this,bt,pd).call(this,"annotationeditorlayerrendered",t)}},V0=async function(){try{await this.drawLayer.render({intent:"display"})}catch(t){console.error("#renderDrawLayer:",t)}},W0=async function(){var n;let t=null;try{const r=await this.xfaLayer.render({viewport:this.viewport,intent:"display"});r!=null&&r.textDivs&&this._textHighlighter&&A(this,bt,ex).call(this,r.textDivs)}catch(r){console.error("#renderXfaLayer:",r),t=r}finally{(n=this.xfaLayer)!=null&&n.div&&(this.l10n.pause(),A(this,bt,Th).call(this,this.xfaLayer.div,"xfaLayer"),this.l10n.resume()),A(this,bt,pd).call(this,"xfalayerrendered",t)}},z0=async function(){if(!this.textLayer)return;let t=null;try{await this.textLayer.render({viewport:this.viewport,images:this.imageCoordinates?new KC(this.imagesRightClickMinSize,this.imageCoordinates,this.viewport,()=>this.canvas):null})}catch(n){if(n instanceof BC)return;console.error("#renderTextLayer:",n),t=n}A(this,bt,pd).call(this,"textlayerrendered",t),A(this,bt,tx).call(this)},tx=async function(){var n,r,i;if(!this.textLayer)return;const t=await((n=this.structTreeLayer)==null?void 0:n.render());t&&(this.l10n.pause(),(r=this.structTreeLayer)==null||r.updateTextLayer(),this.canvas&&t.parentNode!==this.canvas&&this.canvas.append(t),this.l10n.resume()),(i=this.structTreeLayer)==null||i.show()},ex=async function(t){const n=await this.pdfPage.getTextContent(),r=[];for(const i of n.items)r.push(i.str);this._textHighlighter.setTextMapping(t,r),this._textHighlighter.enable()},nx=async function(t){try{if(await t,!this.annotationLayer)return;await this.annotationLayer.injectLinkAnnotations(fm.processLinks(this))}catch(n){console.error("#injectLinkAnnotations:",n)}},G0=function(){const{width:t,height:n}=this.viewport,r=this.outputScale=new am;if(this.maxCanvasPixels===0){const i=1/this.scale;r.sx*=i,r.sy*=i,g(this,xs,!0)}else if(g(this,xs,r.limitCanvas(t,n,this.maxCanvasPixels,this.maxCanvasDim,this.capCanvasAreaFactor)),a(this,xs)&&this.enableDetailCanvas){const i=this.enableOptimizedPartialRendering?4:2;r.sx/=i,r.sy/=i}};let Dm=wb;async function WP(h){const e="",t="",{info:n,metadata:r,contentDispositionFilename:i,contentLength:s}=await h.getMetadata();return{...n,baseURL:t,filesize:s||(await h.getDownloadInfo()).length,filename:i||HC(e),metadata:r==null?void 0:r.getRaw(),authors:r==null?void 0:r.get("dc:creator"),numPages:h.numPages,URL:e}}class zP{constructor(e,t){this._ready=new Promise((n,r)=>{import(e).then(s=>{n(s.QuickJSSandbox(new URL(t,location.href).href))}).catch(r)})}async createSandbox(e){(await this._ready).create(e)}async dispatchEventInSandbox(e){const t=await this._ready;setTimeout(()=>t.dispatchEvent(e),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}var Ai,Ql,$p,ql,th,Hp,dn,Cs,xc,Ce,mr,Be,rx,mm,X0,ix,gd;class GP{constructor({eventBus:e,externalServices:t=null,docProperties:n=null}){b(this,Be);b(this,Ai,null);b(this,Ql,null);b(this,$p,null);b(this,ql,null);b(this,th,null);b(this,Hp,null);b(this,dn,null);b(this,Cs,null);b(this,xc,!1);b(this,Ce,null);b(this,mr,null);g(this,th,e),g(this,Hp,t),g(this,$p,n)}setViewer(e){g(this,Cs,e)}async setDocument(e){var o;if(a(this,dn)&&await A(this,Be,gd).call(this),g(this,dn,e),!e)return;const[t,n,r]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(!t&&!r){await A(this,Be,gd).call(this);return}if(e!==a(this,dn))return;try{g(this,Ce,A(this,Be,ix).call(this))}catch(l){console.error("setDocument:",l),await A(this,Be,gd).call(this);return}const i=a(this,th);g(this,ql,new AbortController);const{signal:s}=a(this,ql);i._on("updatefromsandbox",l=>{(l==null?void 0:l.source)===window&&A(this,Be,rx).call(this,l.detail)},{signal:s}),i._on("dispatcheventinsandbox",l=>{var u;(u=a(this,Ce))==null||u.dispatchEventInSandbox(l.detail)},{signal:s}),i._on("pagechanging",({pageNumber:l,previous:u})=>{l!==u&&(A(this,Be,X0).call(this,u),A(this,Be,mm).call(this,l))},{signal:s}),i._on("pagerendered",({pageNumber:l})=>{this._pageOpenPending.has(l)&&l===a(this,Cs).currentPageNumber&&A(this,Be,mm).call(this,l)},{signal:s}),i._on("pagesdestroy",async()=>{var l,u;await A(this,Be,X0).call(this,a(this,Cs).currentPageNumber),await((l=a(this,Ce))==null?void 0:l.dispatchEventInSandbox({id:"doc",name:"WillClose"})),(u=a(this,Ai))==null||u.resolve()},{signal:s});try{const l=await a(this,$p).call(this,e);if(e!==a(this,dn))return;await a(this,Ce).createSandbox({objects:t,calculationOrder:n,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...l,actions:r}}),i.dispatch("sandboxcreated",{source:this})}catch(l){console.error("setDocument:",l),await A(this,Be,gd).call(this);return}await((o=a(this,Ce))==null?void 0:o.dispatchEventInSandbox({id:"doc",name:"Open"})),await A(this,Be,mm).call(this,a(this,Cs).currentPageNumber,!0),Promise.resolve().then(()=>{e===a(this,dn)&&g(this,xc,!0)})}async dispatchWillSave(){var e;return(e=a(this,Ce))==null?void 0:e.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(){var e;return(e=a(this,Ce))==null?void 0:e.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(){var e;if(a(this,Ce)){await((e=a(this,mr))==null?void 0:e.promise),g(this,mr,Promise.withResolvers());try{await a(this,Ce).dispatchEventInSandbox({id:"doc",name:"WillPrint"})}catch(t){throw a(this,mr).resolve(),g(this,mr,null),t}await a(this,mr).promise}}async dispatchDidPrint(){var e;return(e=a(this,Ce))==null?void 0:e.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get destroyPromise(){var e;return((e=a(this,Ql))==null?void 0:e.promise)||null}get ready(){return a(this,xc)}get _pageOpenPending(){return Id(this,"_pageOpenPending",new Set)}get _visitedPages(){return Id(this,"_visitedPages",new Map)}}Ai=new WeakMap,Ql=new WeakMap,$p=new WeakMap,ql=new WeakMap,th=new WeakMap,Hp=new WeakMap,dn=new WeakMap,Cs=new WeakMap,xc=new WeakMap,Ce=new WeakMap,mr=new WeakMap,Be=new WeakSet,rx=async function(e){var u,c;const t=a(this,Cs),n=t.isInPresentationMode||t.isChangingPresentationMode,{id:r,siblings:i,command:s,value:o}=e;if(!r){switch(s){case"clear":console.clear();break;case"error":console.error(o);break;case"layout":if(!n){const d=AT(o);t.spreadMode=d.spreadMode}break;case"page-num":t.currentPageNumber=o+1;break;case"print":await t.pagesPromise,a(this,th).dispatch("print",{source:this});break;case"println":console.log(o);break;case"zoom":n||(t.currentScaleValue=o);break;case"SaveAs":a(this,th).dispatch("download",{source:this});break;case"FirstPage":t.currentPageNumber=1;break;case"LastPage":t.currentPageNumber=t.pagesCount;break;case"NextPage":t.nextPage();break;case"PrevPage":t.previousPage();break;case"ZoomViewIn":n||t.increaseScale();break;case"ZoomViewOut":n||t.decreaseScale();break;case"WillPrintFinished":(u=a(this,mr))==null||u.resolve(),g(this,mr,null);break}return}if(n&&e.focus)return;delete e.id,delete e.siblings;const l=i?[r,...i]:[r];for(const d of l){const f=document.querySelector(`[data-element-id="${d}"]`);f?f.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:e})):(c=a(this,dn))==null||c.annotationStorage.setValue(d,e)}},mm=async function(e,t=!1){const n=a(this,dn),r=this._visitedPages;if(t&&g(this,Ai,Promise.withResolvers()),!a(this,Ai))return;const i=a(this,Cs).getPageView(e-1);if((i==null?void 0:i.renderingState)!==Rt.FINISHED){this._pageOpenPending.add(e);return}this._pageOpenPending.delete(e);const s=(async()=>{var l,u;const o=await(r.has(e)?null:(l=i.pdfPage)==null?void 0:l.getJSActions());n===a(this,dn)&&await((u=a(this,Ce))==null?void 0:u.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:e,actions:o}))})();r.set(e,s)},X0=async function(e){var i;const t=a(this,dn),n=this._visitedPages;if(!a(this,Ai)||this._pageOpenPending.has(e))return;const r=n.get(e);r&&(n.set(e,null),await r,t===a(this,dn)&&await((i=a(this,Ce))==null?void 0:i.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:e})))},ix=function(){if(g(this,Ql,Promise.withResolvers()),a(this,Ce))throw new Error("#initScripting: Scripting already exists.");return a(this,Hp).createScripting()},gd=async function(){var e,t,n,r;if(!a(this,Ce)){g(this,dn,null),(e=a(this,Ql))==null||e.resolve();return}a(this,Ai)&&(await Promise.race([a(this,Ai).promise,new Promise(i=>{setTimeout(i,1e3)})]).catch(()=>{}),g(this,Ai,null)),g(this,dn,null);try{await a(this,Ce).destroySandbox()}catch{}(t=a(this,mr))==null||t.reject(new Error("Scripting destroyed.")),g(this,mr,null),(n=a(this,ql))==null||n.abort(),g(this,ql,null),this._pageOpenPending.clear(),this._visitedPages.clear(),g(this,Ce,null),g(this,xc,!1),(r=a(this,Ql))==null||r.resolve()};class XP extends GP{constructor(e){e.externalServices||window.addEventListener("updatefromsandbox",t=>{e.eventBus.dispatch("updatefromsandbox",{source:window,detail:t.detail})}),e.externalServices||(e.externalServices={createScripting:()=>new zP(e.sandboxBundleSrc,e.wasmUrl)}),e.docProperties||(e.docProperties=t=>WP(t)),super(e)}}Ct(1148);Ct(3579);const _P=3e4;var eh,nh,Vp,Sc;class YP{constructor(){b(this,eh,null);b(this,nh,null);b(this,Vp,null);b(this,Sc,null);M(this,"isThumbnailViewEnabled",!1);M(this,"onIdle",null);M(this,"printing",!1);Object.defineProperty(this,"hasViewer",{value:()=>!!a(this,Sc)})}setViewer(e){g(this,Sc,e)}setThumbnailViewer(e){g(this,Vp,e)}isHighestPriority(e){return a(this,eh)===e.renderingId}renderHighestPriority(e){var t;a(this,nh)&&(clearTimeout(a(this,nh)),g(this,nh,null)),!a(this,Sc).forceRendering(e)&&(this.isThumbnailViewEnabled&&((t=a(this,Vp))!=null&&t.forceRendering())||this.printing||this.onIdle&&g(this,nh,setTimeout(this.onIdle.bind(this),_P)))}getHighestPriority(e,t,n,r=!1,i=!1){const s=e.views,o=s.length;if(o===0)return null;for(let f=0;fo){const f=e.ids;for(let p=1,m=u-l;p{this.renderHighestPriority()}).catch(t=>{t instanceof g0||console.error("renderView:",t)});break}return!0}}eh=new WeakMap,nh=new WeakMap,Vp=new WeakMap,Sc=new WeakMap;const N1=10,Ag={FORCE_SCROLL_MODE_PAGE:1e4,FORCE_LAZY_PAGE_INIT:5e3,PAUSE_EAGER_PAGE_INIT:250};function B1(h){return Object.values(vn).includes(h)&&h!==vn.DISABLE}var Ts,rh,Wp,_0;class KP{constructor(e){b(this,Wp);b(this,Ts,new Set);b(this,rh,0);g(this,rh,e)}push(e){const t=a(this,Ts);t.has(e)&&t.delete(e),t.add(e),t.size>a(this,rh)&&A(this,Wp,_0).call(this)}resize(e,t=null){g(this,rh,e);const n=a(this,Ts);if(t){const r=n.size;let i=1;for(const s of n)if(t.has(s.id)&&(n.delete(s),n.add(s)),++i>r)break}for(;n.size>a(this,rh);)A(this,Wp,_0).call(this)}has(e){return a(this,Ts).has(e)}[Symbol.iterator](){return a(this,Ts).keys()}}Ts=new WeakMap,rh=new WeakMap,Wp=new WeakSet,_0=function(){const e=a(this,Ts).keys().next().value;e==null||e.destroy(),a(this,Ts).delete(e)};var Ps,zp,Gp,vr,Ne,ih,sh,Xp,_p,Yp,Kp,Jp,Zp,Qp,qp,io,tg,Cc,Is,$r,ah,oh,Tc,so,eg,Pc,lh,Rs,Ic,ng,Rc,rg,ao,yr,oo,rt,ax,ox,lx,md,vm,hx,Y0,ux,Gs,K0,cx,dx,fx,J0,Z0,px,Q0,ym,q0;class sx{constructor(e){b(this,rt);b(this,Ps,null);b(this,zp,null);b(this,Gp,null);b(this,vr,vn.NONE);b(this,Ne,null);b(this,ih,xi.ENABLE_FORMS);b(this,sh,null);b(this,Xp,null);b(this,_p,null);b(this,Yp,!1);b(this,Kp,!1);b(this,Jp,!1);b(this,Zp,!1);b(this,Qp,!0);b(this,qp,null);b(this,io,null);b(this,tg,0);b(this,Cc,null);b(this,Is,!0);b(this,$r,null);b(this,ah,null);b(this,oh,null);b(this,Tc,!1);b(this,so,null);b(this,eg,0);b(this,Pc,new ResizeObserver(A(this,rt,px).bind(this)));b(this,lh,null);b(this,Rs,null);b(this,Ic,null);b(this,ng,!0);b(this,Rc,Ei.ENABLE);b(this,rg,null);b(this,ao,null);b(this,yr,null);b(this,oo,null);var r,i;const t="5.7.284";if(s1!==t)throw new Error(`The API version "${s1}" does not match the Viewer version "${t}".`);if(this.container=e.container,this.viewer=e.viewer||e.container.firstElementChild,g(this,rg,e.viewerAlert||null),((r=this.container)==null?void 0:r.tagName)!=="DIV"||((i=this.viewer)==null?void 0:i.tagName)!=="DIV")throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&getComputedStyle(this.container).position!=="absolute")throw new Error("The `container` must be absolutely positioned.");a(this,Pc).observe(this.container),this.eventBus=e.eventBus,this.linkService=e.linkService||new gb,this.downloadManager=e.downloadManager||null,this.findController=e.findController||null,g(this,zp,e.altTextManager||null),g(this,sh,e.commentManager||null),g(this,Ic,e.signatureManager||null),g(this,_p,e.editorUndoBar||null),this.findController&&(this.findController.onIsPageVisible=s=>this._getVisiblePages().ids.has(s)),this._scriptingManager=e.scriptingManager||null,g(this,Rc,e.textLayerMode??Ei.ENABLE),g(this,ih,e.annotationMode??xi.ENABLE_FORMS),g(this,vr,e.annotationEditorMode??vn.NONE),g(this,Gp,e.annotationEditorHighlightColors||null),g(this,Yp,e.enableHighlightFloatingButton===!0),g(this,Jp,e.enableUpdatedAddImage===!0),g(this,Zp,e.enableNewAltTextWhenAddingImage===!0),this.imageResourcesPath=e.imageResourcesPath||"",this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1,this.removePageBorders=e.removePageBorders||!1,this.maxCanvasPixels=e.maxCanvasPixels,this.maxCanvasDim=e.maxCanvasDim,this.capCanvasAreaFactor=e.capCanvasAreaFactor,this.enableDetailCanvas=e.enableDetailCanvas??!0,this.enableOptimizedPartialRendering=e.enableOptimizedPartialRendering??!1,this.imagesRightClickMinSize=e.imagesRightClickMinSize??-1,this.l10n=e.l10n,this.l10n||(this.l10n=new Oc),g(this,Kp,e.enablePermissions||!1),this.pageColors=e.pageColors||null,g(this,Cc,e.mlManager||null),g(this,ng,e.supportsPinchToZoom!==!1),g(this,Qp,e.enableAutoLinking!==!1),g(this,tg,e.minDurationToUpdateCanvas??500),this.defaultRenderingQueue=!e.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new YP,this.renderingQueue.setViewer(this)):this.renderingQueue=e.renderingQueue;const{abortSignal:n}=e;g(this,qp,n||null),n==null||n.addEventListener("abort",()=>{a(this,Pc).disconnect(),g(this,Pc,null)},{once:!0}),this.scroll=fT(this.container,this._scrollUpdate.bind(this),n),this.presentationModeState=Dh.UNKNOWN,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),A(this,rt,Z0).call(this),this.eventBus._on("thumbnailrendered",({pageNumber:s,pdfPage:o})=>{const l=this._pages[s-1];a(this,Ps).has(l)||o==null||o.cleanup()}),e.l10n||this.l10n.translate(this.container)}get printingAllowed(){return a(this,Is)}get pagesCount(){return this._pages.length}getPageView(e){return this._pages[e]}getCachedPageViews(){return new Set(a(this,Ps))}get pageViewsReady(){return this._pages.every(e=>e==null?void 0:e.pdfPage)}get renderForms(){return a(this,ih)===xi.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(e){if(!Number.isInteger(e))throw new Error("Invalid page number.");this.pdfDocument&&(this._setCurrentPageNumber(e,!0)||console.error(`currentPageNumber: "${e}" is not a valid page.`))}_setCurrentPageNumber(e,t=!1){var r;if(this._currentPageNumber===e)return t&&A(this,rt,K0).call(this),!0;if(!(0=0&&(t=n+1)}this._setCurrentPageNumber(t,!0)||console.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return this._currentScale!==Ov?this._currentScale:yw}set currentScale(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&A(this,rt,Gs).call(this,e,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&A(this,rt,Gs).call(this,e,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!bw(e))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument||(e%=360,e<0&&(e+=360),this._pagesRotation===e))return;this._pagesRotation=e;const t=this._currentPageNumber;this.refresh(!0,{rotation:e}),this._currentScaleValue&&A(this,rt,Gs).call(this,this._currentScaleValue,{noScroll:!0}),this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:e,pageNumber:t}),this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}get _layerProperties(){const e=this;return Id(this,"_layerProperties",{get annotationEditorUIManager(){return a(e,Ne)},get annotationStorage(){var t;return(t=e.pdfDocument)==null?void 0:t.annotationStorage},get downloadManager(){return e.downloadManager},get enableComment(){return!!a(e,sh)},get enableScripting(){return!!e._scriptingManager},get fieldObjectsPromise(){var t;return(t=e.pdfDocument)==null?void 0:t.getFieldObjects()},get findController(){return e.findController},get hasJSActionsPromise(){var t;return(t=e.pdfDocument)==null?void 0:t.hasJSActions()},get linkService(){return e.linkService}})}async getAllText(e=null){const t=[],n=[];for(let r=1,i=this.pdfDocument.numPages;r<=i;++r){if(e!=null&&e.aborted)return null;n.length=0;const s=await this.pdfDocument.getPage(r),{items:o}=await s.getTextContent();for(const l of o)l.str&&n.push(l.str),l.hasEOL&&n.push(` `);t.push(bd(n.join("")))}return t.join(` `)}setDocument(e){var f,p,m;if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),(f=this.findController)==null||f.setDocument(null),(p=this._scriptingManager)==null||p.setDocument(null),(m=a(this,Ne))==null||m.destroy(),g(this,Ne,null),g(this,vr,vn.NONE),g(this,Is,!0)),this.pdfDocument=e,!e)return;const t=e.numPages,n=e.getPage(1),r=e.getOptionalContentConfig({intent:"display"}),i=a(this,Kp)?e.getPermissions():Promise.resolve(),{eventBus:s,pageColors:o,viewer:l}=this;g(this,io,new AbortController);const{signal:u}=a(this,io);if(t>Ag.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const v=this._scrollMode=St.PAGE;s.dispatch("scrollmodechanged",{source:this,mode:v})}this._pagesCapability.promise.then(()=>{s.dispatch("pagesloaded",{source:this,pagesCount:t})},()=>{});const c=v=>{const y=this._pages[v.pageNumber-1];y&&a(this,Ps).push(y)};s._on("pagerender",c,{signal:u});const d=v=>{v.cssTransform||v.isDetailView||(this._onePageRenderedCapability.resolve({timestamp:v.timestamp}),s._off("pagerendered",d))};s._on("pagerendered",d,{signal:u}),Promise.all([n,i]).then(([v,y])=>{var I;if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(v),this._optionalContentConfigPromise=r;const{annotationEditorMode:E,annotationMode:S,textLayerMode:w}=A(this,rt,ax).call(this,y);if(w!==Ei.DISABLE){const F=g(this,so,document.createElement("div"));F.id="hiddenCopyElement",l.before(F)}if(E!==vn.DISABLE){const F=E;e.isPureXfa?console.warn("Warning: XFA-editing is not implemented."):B1(F)?(g(this,Ne,new jC(this.container,l,a(this,rg),a(this,zp),a(this,sh),a(this,Ic),s,e,o,a(this,Gp),a(this,Yp),a(this,Jp),a(this,Zp),a(this,Cc),a(this,_p),a(this,ng))),s.dispatch("annotationeditoruimanager",{source:this,uiManager:a(this,Ne)}),F!==vn.NONE&&(A(this,rt,q0).call(this,F),a(this,Ne).updateMode(F))):console.error(`Invalid AnnotationEditor mode: ${F}`)}const C=this._scrollMode===St.PAGE?null:l,x=this.currentScale,T=v.getViewport({scale:x*Li.PDF_TO_CSS_UNITS});l.style.setProperty("--scale-factor",T.scale),o!=null&&o.background&&l.style.setProperty("--page-bg-color",o.background),((o==null?void 0:o.foreground)==="CanvasText"||(o==null?void 0:o.background)==="Canvas")&&(l.style.setProperty("--hcm-highlight-filter",e.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),l.style.setProperty("--hcm-highlight-selected-filter",e.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","ButtonText")));for(let F=1;F<=t;++F){const P=new Dm({container:C,eventBus:s,id:F,scale:x,defaultViewport:T.clone(),optionalContentConfigPromise:r,renderingQueue:this.renderingQueue,textLayerMode:w,annotationMode:S,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableDetailCanvas:this.enableDetailCanvas,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,imagesRightClickMinSize:this.imagesRightClickMinSize,pageColors:o,l10n:this.l10n,layerProperties:this._layerProperties,enableAutoLinking:a(this,Qp),minDurationToUpdateCanvas:a(this,tg),commentManager:a(this,sh),abortSignal:a(this,qp)});this._pages.push(P)}(I=this._pages[0])==null||I.setPdfPage(v),this._scrollMode===St.PAGE?A(this,rt,md).call(this):this._spreadMode!==tn.NONE&&this._updateSpreadMode(),s._on("annotationeditorlayerrendered",F=>{a(this,Ne)&&s.dispatch("annotationeditormodechanged",{source:this,mode:a(this,vr)})},{once:!0,signal:u}),A(this,rt,ox).call(this,u).then(async()=>{var P,R;if(e!==this.pdfDocument)return;if((P=this.findController)==null||P.setDocument(e),(R=this._scriptingManager)==null||R.setDocument(e),a(this,so)&&document.addEventListener("copy",A(this,rt,lx).bind(this,w),{signal:u}),e.loadingParams.disableAutoFetch||t>Ag.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let F=t-1;if(F<=0){this._pagesCapability.resolve();return}for(let D=2;D<=t;++D){const k=e.getPage(D).then(N=>{const H=this._pages[D-1];H.pdfPage||H.setPdfPage(N),--F===0&&this._pagesCapability.resolve()},N=>{console.error(`Unable to get page ${D} to initialize viewer`,N),--F===0&&this._pagesCapability.resolve()});D%Ag.PAUSE_EAGER_PAGE_INIT===0&&await k}}),s.dispatch("pagesinit",{source:this}),e.getMetadata().then(({info:F})=>{e===this.pdfDocument&&F.Language&&(l.lang=F.Language)}),this.defaultRenderingQueue&&this.update()}).catch(v=>{console.error("Unable to initialize viewer",v),this._pagesCapability.reject(v)})}onPagesEdited({pagesMapper:e,type:t,hasBeenCut:n,pageNumbers:r}){var u,c,d,f,p;if(t==="copy"){g(this,ao,new Map);for(const m of r)a(this,ao).set(m,this._pages[m-1]);return}if(t==="cancelCopy"){g(this,ao,null);return}if((t==="cut"||t==="delete")&&(g(this,yr,this._pages),g(this,oo,r)),t==="cancelDelete"){if(g(this,oo,null),!a(this,yr))return;const m=this._scrollMode===St.PAGE?null:this.viewer;if(m){(u=a(this,Ne))==null||u.startUpdatePages();const v=document.createDocumentFragment();for(let y=0,E=a(this,yr).length;y{this.forceRendering()})}setPageLabels(e){var t;if(this.pdfDocument){e?Array.isArray(e)&&this.pdfDocument.numPages===e.length?this._pageLabels=e:(this._pageLabels=null,console.error("setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let n=0,r=this._pages.length;n{g(this,$r,null),this.update()},100)),this.update())}pageLabelToPageNumber(e){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView({pageNumber:e,destArray:t=null,allowNegativeOffset:n=!1,ignoreDestinationZoom:r=!1,center:i=null}){if(!this.pdfDocument)return;const s=Number.isInteger(e)&&this._pages[e-1];if(!s){console.error(`scrollPageIntoView: "${e}" is not a valid pageNumber parameter.`);return}if(this.isInPresentationMode||!t){this._setCurrentPageNumber(e,!0);return}let o=0,l=0,u=0,c=0,d,f;const p=s.rotation%180!==0,m=(p?s.height:s.width)/s.scale/Li.PDF_TO_CSS_UNITS,v=(p?s.width:s.height)/s.scale/Li.PDF_TO_CSS_UNITS;let y=0;switch(t[1].name){case"XYZ":o=t[2],l=t[3],y=t[4],o=o!==null?o:0,l=l!==null?l:v;break;case"Fit":case"FitB":y="page-fit";break;case"FitH":case"FitBH":l=t[2],y="page-width",l===null&&this._location?(o=this._location.left,l=this._location.top):(typeof l!="number"||l<0)&&(l=v);break;case"FitV":case"FitBV":o=t[2],u=m,c=v,y="page-height";break;case"FitR":o=t[2],l=t[3],u=t[4]-o,c=t[5]-l;let C=o1,x=l1;this.removePageBorders&&(C=x=0),d=(this.container.clientWidth-C)/u/Li.PDF_TO_CSS_UNITS,f=(this.container.clientHeight-x)/c/Li.PDF_TO_CSS_UNITS,y=Math.min(Math.abs(d),Math.abs(f));break;default:console.error(`scrollPageIntoView: "${t[1].name}" is not a valid destination type.`);return}if(r||(y&&y!==this._currentScale?this.currentScaleValue=y:this._currentScale===Ov&&(this.currentScaleValue=lT)),y==="page-fit"&&!t[4]){A(this,rt,vm).call(this,s);return}const E=[s.viewport.convertToViewportPoint(o,l),s.viewport.convertToViewportPoint(o+u,l+c)];let S=Math.min(E[0][0],E[1][0]),w=Math.min(E[0][1],E[1][1]);i?((i==="both"||i==="vertical")&&(w-=(this.container.clientHeight-Math.abs(E[1][1]-E[0][1]))/2),(i==="both"||i==="horizontal")&&(S-=(this.container.clientWidth-Math.abs(E[1][0]-E[0][0]))/2)):n||(S=Math.max(S,0),w=Math.max(w,0)),A(this,rt,vm).call(this,s,{left:S,top:w})}_updateLocation(e){const t=this._currentScale,n=this._currentScaleValue,r=parseFloat(n)===t?Math.round(t*1e4)/100:n,i=e.id,s=this._pages[i-1],o=this.container,l=s.getPagePoint(o.scrollLeft-e.x,o.scrollTop-e.y),u=Math.round(l[0]),c=Math.round(l[1]);let d=`#page=${i}`;this.isInPresentationMode||(d+=`&zoom=${r},${u},${c}`),this._location={pageNumber:i,scale:r,top:c,left:u,rotation:this._pagesRotation,pdfOpenParams:d}}update(){const e=this._getVisiblePages(),t=e.views,n=t.length;if(n===0)return;const r=Math.max(N1,2*n+1);a(this,Ps).resize(r,e.ids);for(const{view:l,visibleArea:u}of t)l.updateVisibleArea(u);for(const l of a(this,Ps))e.ids.has(l.id)||l.updateVisibleArea(null);this.renderingQueue.renderHighestPriority(e);const i=this._spreadMode===tn.NONE&&(this._scrollMode===St.PAGE||this._scrollMode===St.VERTICAL),s=this._currentPageNumber;let o=!1;for(const l of t){if(l.percent<100)break;if(l.id===s&&i){o=!0;break}}this._setCurrentPageNumber(o?this._currentPageNumber:t[0].id),this._updateLocation(e.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isContainerRtl(){return getComputedStyle(this.container).direction==="rtl"}get isInPresentationMode(){return this.presentationModeState===Dh.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===Dh.CHANGING}get isHorizontalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const e=this._scrollMode===St.PAGE?a(this,lh).pages:this._pages,t=this._scrollMode===St.HORIZONTAL,n=t&&this._isContainerRtl;return gT({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:n})}cleanup(){for(const e of this._pages)e.renderingState!==Rt.FINISHED&&e.reset()}_cancelRendering(){for(const e of this._pages)e.cancelRendering()}forceRendering(e){const t=e||this._getVisiblePages(),n=A(this,rt,fx).call(this,t),r=this._spreadMode!==tn.NONE&&this._scrollMode!==St.HORIZONTAL,i=a(this,Rs)!==null||a(this,$r)!==null&&t.views.some(o=>{var l;return(l=o.detailView)==null?void 0:l.renderingCancelled}),s=this.renderingQueue.getHighestPriority(t,this._pages,n,r,i);return s?(A(this,rt,dx).call(this,s).then(()=>{this.renderingQueue.renderView(s)}),!0):!1}get hasEqualPageSizes(){const e=this._pages[0];for(let t=1,n=this._pages.length;t{const n=t.pdfPage.getViewport({scale:1}),r=c1(n);if(e===void 0)e=r;else if(this.enablePrintAutoRotate&&r!==e)return{width:n.height,height:n.width,rotation:(n.rotation-90)%360};return{width:n.width,height:n.height,rotation:n.rotation}})}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error("optionalContentConfigPromise: Not initialized yet."),this.pdfDocument.getOptionalContentConfig({intent:"display"})):Promise.resolve(null)}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${e}`);this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=e,this.refresh(!1,{optionalContentConfigPromise:e}),this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:e}))}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!mT(e))throw new Error(`Invalid scroll mode: ${e}`);this.pagesCount>Ag.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this._scrollMode=e,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(e=null){const t=this._scrollMode,n=this.viewer;n.classList.toggle("scrollHorizontal",t===St.HORIZONTAL),n.classList.toggle("scrollWrapped",t===St.WRAPPED),!(!this.pdfDocument||!e)&&(t===St.PAGE?A(this,rt,md).call(this):this._previousScrollMode===St.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&A(this,rt,Gs).call(this,this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(e,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!vT(e))throw new Error(`Invalid spread mode: ${e}`);this._spreadMode=e,this.eventBus.dispatch("spreadmodechanged",{source:this,mode:e}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(e=null){if(!this.pdfDocument)return;const t=this.viewer,n=this._pages;if(this._scrollMode===St.PAGE)A(this,rt,md).call(this);else if(t.textContent="",this._spreadMode===tn.NONE)for(const r of this._pages)t.append(r.div);else{const r=this._spreadMode-1;let i=null;for(let s=0,o=n.length;s=t)return!1;const n=A(this,rt,J0).call(this,e,!1)||1;return this.currentPageNumber=Math.min(e+n,t),!0}previousPage(){const e=this._currentPageNumber;if(e<=1)return!1;const t=A(this,rt,J0).call(this,e,!0)||1;return this.currentPageNumber=Math.max(e-t,1),!0}updateScale({drawingDelay:e,scaleFactor:t=null,steps:n=null,origin:r}){if(n===null&&t===null)throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let i=this._currentScale;if(t>0&&t!==1)i=Math.round(i*t*100)/100;else if(n){const s=n>0?a1:1/a1,o=n>0?Math.ceil:Math.floor;n=Math.abs(n);do i=o((i*s).toFixed(2)*10)/10;while(--n>0)}i=XC(i,hT,uT),A(this,rt,Gs).call(this,i,{noScroll:!1,drawingDelay:e,origin:r})}increaseScale(e={}){this.updateScale({...e,steps:e.steps??1})}decreaseScale(e={}){this.updateScale({...e,steps:-(e.steps??1)})}get containerTopLeft(){return a(this,Xp)||g(this,Xp,[this.container.offsetTop,this.container.offsetLeft])}get annotationEditorMode(){return a(this,Ne)?a(this,vr):vn.DISABLE}set annotationEditorMode({mode:e,editId:t=null,isFromKeyboard:n=!1,mustEnterInEditMode:r=!1,editComment:i=!1}){if(!a(this,Ne))throw new Error("The AnnotationEditor is not enabled.");if(a(this,vr)===e)return;if(!B1(e))throw new Error(`Invalid AnnotationEditor mode: ${e}`);if(!this.pdfDocument)return;A(this,rt,q0).call(this,e);const{eventBus:s,pdfDocument:o}=this,l=async()=>{A(this,rt,ym).call(this),g(this,vr,e),await a(this,Ne).updateMode(e,t,!0,n,r,i),!(e!==a(this,vr)||o!==this.pdfDocument)&&s.dispatch("annotationeditormodechanged",{source:this,mode:e})};if(e===vn.NONE||a(this,vr)===vn.NONE){const u=e!==vn.NONE;u||this.pdfDocument.annotationStorage.resetModifiedIds(),this.cleanup();for(const d of this._pages)d.toggleEditingMode(u);const c=A(this,rt,cx).call(this);if(u&&c){A(this,rt,ym).call(this),g(this,ah,new AbortController);const d=AbortSignal.any([a(this,io).signal,a(this,ah).signal]);s._on("pagerendered",({pageNumber:f})=>{c.delete(f),c.size===0&&g(this,oh,setTimeout(l,0))},{signal:d});return}}l()}refresh(e=!1,t=Object.create(null)){if(this.pdfDocument){for(const n of this._pages)n.update(t);A(this,rt,Q0).call(this),e||this.update()}}}Ps=new WeakMap,zp=new WeakMap,Gp=new WeakMap,vr=new WeakMap,Ne=new WeakMap,ih=new WeakMap,sh=new WeakMap,Xp=new WeakMap,_p=new WeakMap,Yp=new WeakMap,Kp=new WeakMap,Jp=new WeakMap,Zp=new WeakMap,Qp=new WeakMap,qp=new WeakMap,io=new WeakMap,tg=new WeakMap,Cc=new WeakMap,Is=new WeakMap,$r=new WeakMap,ah=new WeakMap,oh=new WeakMap,Tc=new WeakMap,so=new WeakMap,eg=new WeakMap,Pc=new WeakMap,lh=new WeakMap,Rs=new WeakMap,Ic=new WeakMap,ng=new WeakMap,Rc=new WeakMap,rg=new WeakMap,ao=new WeakMap,yr=new WeakMap,oo=new WeakMap,rt=new WeakSet,ax=function(e){const t={annotationEditorMode:a(this,vr),annotationMode:a(this,ih),textLayerMode:a(this,Rc)};return e?(g(this,Is,e.includes(gh.PRINT_HIGH_QUALITY)||e.includes(gh.PRINT)),this.eventBus.dispatch("printingallowed",{source:this,isAllowed:a(this,Is)}),!e.includes(gh.COPY)&&a(this,Rc)===Ei.ENABLE&&(t.textLayerMode=Ei.ENABLE_PERMISSIONS),e.includes(gh.MODIFY_CONTENTS)||(t.annotationEditorMode=vn.DISABLE),!e.includes(gh.MODIFY_ANNOTATIONS)&&!e.includes(gh.FILL_INTERACTIVE_FORMS)&&a(this,ih)===xi.ENABLE_FORMS&&(t.annotationMode=xi.ENABLE),t):(g(this,Is,!0),this.eventBus.dispatch("printingallowed",{source:this,isAllowed:a(this,Is)}),t)},ox=async function(e){if(document.visibilityState==="hidden"||!this.container.offsetParent||this._getVisiblePages().views.length===0)return;const t=Promise.withResolvers(),n=new AbortController;document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&t.resolve()},{signal:AbortSignal.any([e,n.signal])}),await Promise.race([this._onePageRenderedCapability.promise,t.promise]),n.abort()},lx=function(e,t){const n=document.getSelection(),{focusNode:r,anchorNode:i}=n;if(i&&r&&n.containsNode(a(this,so))){if(a(this,Tc)||e===Ei.ENABLE_PERMISSIONS){m0(t);return}g(this,Tc,!0);const{classList:s}=this.viewer;s.add("copyAll");const o=new AbortController,l=new AbortController;window.addEventListener("keydown",u=>{u.key==="Escape"&&l.abort()},{signal:o.signal}),this.getAllText(l.signal).then(async u=>{u!==null&&await navigator.clipboard.writeText(u)}).catch(u=>{console.warn(`Something goes wrong when extracting the text: ${u.message}`)}).finally(()=>{g(this,Tc,!1),o.abort(),s.remove("copyAll")}),m0(t)}},md=function(){if(this._scrollMode!==St.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const e=this._currentPageNumber,t=a(this,lh),n=this.viewer;if(n.textContent="",t.pages.length=0,this._spreadMode===tn.NONE&&!this.isInPresentationMode){const r=this._pages[e-1];n.append(r.div),t.pages.push(r)}else{const r=new Set,i=this._spreadMode-1;i===-1?r.add(e-1):e%2!==i?(r.add(e-1),r.add(e)):(r.add(e-2),r.add(e-1));const s=document.createElement("div");if(s.className="spread",this.isInPresentationMode){const o=document.createElement("div");o.className="dummyPage",s.append(o)}for(const o of r){const l=this._pages[o];l&&(s.append(l.div),t.pages.push(l))}n.append(s)}t.scrollDown=e>=t.previousPageNumber,t.previousPageNumber=e},vm=function(e,t=null){const{div:n,id:r}=e;if(this._currentPageNumber!==r&&this._setCurrentPageNumber(r),this._scrollMode===St.PAGE&&(A(this,rt,md).call(this),this.update()),!t&&!this.isInPresentationMode){const i=n.offsetLeft+n.clientLeft,s=i+n.clientWidth,{scrollLeft:o,clientWidth:l}=this.container;(this._scrollMode===St.HORIZONTAL||io+l)&&(t={left:0,top:0})}dT(n,t),!this._currentScaleValue&&this._location&&(this._location=null)},hx=function(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15},Y0=function(e,t,{noScroll:n=!1,preset:r=!1,drawingDelay:i=-1,origin:s=null}){if(this._currentScaleValue=t.toString(),A(this,rt,hx).call(this,e)){r&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t});return}this.viewer.style.setProperty("--scale-factor",e*Li.PDF_TO_CSS_UNITS);const o=i>=0&&i<1e3;this.refresh(!0,{scale:e,drawingDelay:o?i:-1}),o&&g(this,Rs,setTimeout(()=>{g(this,Rs,null),this.refresh()},i));const l=this._currentScale;if(this._currentScale=e,!n){let u=this._currentPageNumber,c;if(this._location&&!(this.isInPresentationMode||this.isChangingPresentationMode)&&(u=this._location.pageNumber,c=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:u,destArray:c,allowNegativeOffset:!0}),Array.isArray(s)){const d=e/l-1,[f,p]=this.containerTopLeft;this.container.scrollLeft+=(s[0]-p)*d,this.container.scrollTop+=(s[1]-f)*d}}this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:r?t:void 0}),this.defaultRenderingQueue&&this.update()},ux=function(){return this._spreadMode!==tn.NONE&&this._scrollMode!==St.HORIZONTAL?2:1},Gs=function(e,t){let n=parseFloat(e);if(n>0)t.preset=!1,A(this,rt,Y0).call(this,n,e,t);else{const r=this._pages[this._currentPageNumber-1];if(!r)return;let i=o1,s=l1;this.isInPresentationMode?(i=s=4,this._spreadMode!==tn.NONE&&(i*=2)):this.removePageBorders?i=s=0:this._scrollMode===St.HORIZONTAL&&([i,s]=[s,i]);const o=(this.container.clientWidth-i)/r.width*r.scale/a(this,rt,ux),l=(this.container.clientHeight-s)/r.height*r.scale;switch(e){case"page-actual":n=1;break;case"page-width":n=o;break;case"page-height":n=l;break;case"page-fit":n=Math.min(o,l);break;case"auto":const u=c1(r)?o:Math.min(l,o);n=Math.min(cT,u);break;default:console.error(`#setScale: "${e}" is an unknown zoom value.`);return}t.preset=!0,A(this,rt,Y0).call(this,n,e,t)}},K0=function(){const e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&A(this,rt,Gs).call(this,this._currentScaleValue,{noScroll:!0}),A(this,rt,vm).call(this,e)},cx=function(){const e=this._getVisiblePages(),t=[],{ids:n,views:r}=e;for(const i of r){const{view:s}=i;if(!s.hasEditableAnnotations()){n.delete(s.id);continue}t.push(i)}return t.length===0?null:(this.renderingQueue.renderHighestPriority({first:t[0],last:t.at(-1),views:t,ids:n}),n)},dx=async function(e){if(e.pdfPage)return e.pdfPage;try{const t=await this.pdfDocument.getPage(e.id);return e.pdfPage||e.setPdfPage(t),t}catch(t){return console.error("Unable to get page for page view",t),null}},fx=function(e){var t,n;if(((t=e.first)==null?void 0:t.id)===1)return!0;if(((n=e.last)==null?void 0:n.id)===this.pagesCount)return!1;switch(this._scrollMode){case St.PAGE:return a(this,lh).scrollDown;case St.HORIZONTAL:return this.scroll.right}return this.scroll.down},J0=function(e,t=!1){switch(this._scrollMode){case St.WRAPPED:{const{views:n}=this._getVisiblePages(),r=new Map;for(const{id:i,y:s,percent:o,widthPercent:l}of n)o===0||l<100||r.getOrInsertComputed(s,zC).push(i);for(const i of r.values()){const s=i.indexOf(e);if(s===-1)continue;const o=i.length;if(o===1)break;if(t)for(let l=s-1,u=0;l>=u;l--){const c=i[l],d=i[l+1]-1;if(cd)return d-e}if(t){const l=i[0];if(le)return l-e+1}break}break}case St.HORIZONTAL:break;case St.PAGE:case St.VERTICAL:{if(this._spreadMode===tn.NONE)break;const n=this._spreadMode-1;if(t&&e%2!==n)break;if(!t&&e%2===n)break;const{views:r}=this._getVisiblePages(),i=t?e-1:e+1;for(const{id:s,percent:o,widthPercent:l}of r)if(s===i){if(o>0&&l===100)return 2;break}break}}return 1},Z0=function(e=this.container.clientHeight){e!==a(this,eg)&&(g(this,eg,e),yT.setProperty("--viewer-container-height",`${e}px`))},px=function(e){for(const t of e)if(t.target===this.container){A(this,rt,Z0).call(this,Math.floor(t.borderBoxSize[0].blockSize)),g(this,Xp,null);break}},Q0=function(){a(this,Rs)!==null&&(clearTimeout(a(this,Rs)),g(this,Rs,null)),a(this,$r)!==null&&(clearTimeout(a(this,$r)),g(this,$r,null))},ym=function(){var e;(e=a(this,ah))==null||e.abort(),g(this,ah,null),a(this,oh)!==null&&(clearTimeout(a(this,oh)),g(this,oh,null))},q0=function(e){var t,n;switch(e){case vn.STAMP:(t=a(this,Cc))==null||t.loadModel("altText");break;case vn.SIGNATURE:(n=a(this,Ic))==null||n.loadSignatures();break}};class JP extends sx{_resetView(){super._resetView(),this._scrollMode=St.PAGE,this._spreadMode=tn.NONE}set scrollMode(e){}_updateScrollMode(){}set spreadMode(e){}_updateSpreadMode(){}}globalThis.pdfjsViewer={AnnotationLayerBuilder:Rw,DownloadManager:DT,EventBus:mb,FindState:zs,GenericL10n:Oc,LinkTarget:bo,parseQueryString:xv,PDFFindController:IT,PDFHistory:FP,PDFLinkService:pb,PDFPageView:Dm,PDFScriptingManager:XP,PDFSinglePageViewer:JP,PDFViewer:sx,ProgressBar:bT,RenderingStates:Rt,ScrollMode:St,SimpleLinkService:gb,SpreadMode:tn,StructTreeLayerBuilder:Yw,TextLayerBuilder:Fm,XfaLayerBuilder:qw};var ZP=Object.defineProperty,QP=(h,e,t)=>e in h?ZP(h,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[e]=t,po=(h,e,t)=>QP(h,typeof e!="symbol"?e+"":e,t);function qP(h,e,t){const n=h.contentWindow.document.createElement("style");n.textContent=` @page { margin: 3mm; size: ${e}pt ${t}pt; } body { margin: 0; } canvas { width: 100%; page-break-before: avoid; break-before: avoid; page-break-inside: avoid; break-inside: avoid; } canvas:not(:last-child) { page-break-after: always; break-after: page; } `,h.contentWindow.document.head.appendChild(n),h.contentWindow.document.body.style.width="100%"}function tI(h){return new Promise(e=>{const t=document.createElement("iframe");t.width="0",t.height="0",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.border="none",t.style.overflow="hidden",t.onload=()=>e(t),h.appendChild(t)})}function eI(h,e){const t=URL.createObjectURL(new Blob([h],{type:"application/pdf"})),n=document.createElement("a");n.href=t,n.download=e,n.style.display="none",document.body.append(n),n.click(),setTimeout(()=>{URL.revokeObjectURL(t),document.body.removeChild(n)},1e3)}function k1(h){for(;h!=null&&h.firstChild;)h.removeChild(h.firstChild)}function j1(h){return h?Object.prototype.hasOwnProperty.call(h,"_pdfInfo"):!1}function gx(h){var e;h.width=1,h.height=1,(e=h.getContext("2d"))==null||e.clearRect(0,0,1,1)}function Om(h){h==null||h.querySelectorAll("canvas").forEach(gx)}function nI({onError:h,onPasswordRequest:e,onProgress:t,source:n}){const r=Am(null),i=Am(null);return Ex(async()=>{const s=Tb(n);if(s){if(j1(s)){r.value=s;return}}else return;try{i.value=lE(s),e&&(i.value.onPassword=(o,l)=>{e({callback:o,isWrongPassword:l===W1.INCORRECT_PASSWORD})}),t&&(i.value.onProgress=t),r.value=await i.value.promise}catch(o){if(r.value=null,h)h(o);else throw o}}),$v(r,(s,o)=>{o==null||o.destroy()}),tb(()=>{var s,o,l,u;(s=i.value)!=null&&s.onPassword&&(i.value.onPassword=null),(o=i.value)!=null&&o.onProgress&&(i.value.onProgress=null),(l=i.value)==null||l.destroy(),j1(Tb(n))||(u=r.value)==null||u.destroy()}),{doc:r,download:async s=>{if(!r.value)return;const o=r.value.annotationStorage.size?await r.value.saveDocument():await r.value.getData(),l=await r.value.getMetadata(),u=s??l.contentDispositionFilename??"";eI(o,u)},print:async(s=300,o="",l)=>{var u,c,d,f;if(!r.value)return;const p=s/72,m=96/72;let v,y,E;try{v=window.document.createElement("div"),v.style.display="none",window.document.body.appendChild(v),y=await tI(v);const S=Math.max(3,Math.floor(10*(300/s))),w=l?Array.isArray(l)?l:[l]:[...Array(r.value.numPages+1).keys()].slice(1);for(let C=0;C{const I=await r.value.getPage(x),F=I.getViewport({scale:1,rotation:0});if(C+T===0){const D=F.width*p/m,k=F.height*p/m;qP(y,D,k)}const P=window.document.createElement("canvas");P.width=F.width*p,P.height=F.height*p,v.appendChild(P);const R=P.cloneNode();y.contentWindow.document.body.appendChild(R),await I.render({annotationMode:Ds.ENABLE_STORAGE,canvas:P,intent:"print",transform:[p,0,0,p,0,0],viewport:F}).promise,R.getContext("2d").drawImage(P,0,0),gx(P)}));o&&(E=window.document.title,window.document.title=o),(u=y.contentWindow)==null||u.focus(),(c=y.contentWindow)==null||c.print()}finally{E&&(window.document.title=E),Om((d=y.contentWindow)==null?void 0:d.document.body),Om(v),(f=v.parentNode)==null||f.removeChild(v)}}}}class rI{constructor({findController:e,pageIndex:t}){po(this,"abortController",null),po(this,"enabled",!1),po(this,"findController"),po(this,"matches",[]),po(this,"pageIndex"),po(this,"textContentItemsStr",[]),po(this,"textDivs",[]),this.findController=e,this.pageIndex=t}setTextMapping(e,t){this.textDivs=e,this.textContentItemsStr=t}enable(){this.enabled||(this.enabled=!0,this.abortController||(this.abortController=new AbortController,this.findController._eventBus.on("updatetextlayermatches",e=>{(e.pageIndex===this.pageIndex||e.pageIndex===-1)&&this.updateMatches()},{signal:this.abortController.signal})),this.updateMatches())}disable(){var e;this.enabled&&(this.enabled=!1,(e=this.abortController)==null||e.abort(),this.abortController=null,this.updateMatches(!0))}convertMatches(e,t){if(!e||!t)return[];const n=this.textContentItemsStr.length-1,r=[];let i=0,s=0;return e.forEach((o,l)=>{let u=o;for(;i!==n&&u>=s+this.textContentItemsStr[i].length;)s+=this.textContentItemsStr[i].length,i++;const c={divIndex:i,offset:u-s};for(u+=t[l];i!==n&&u>s+this.textContentItemsStr[i].length;)s+=this.textContentItemsStr[i].length,i++;const d={divIndex:i,offset:u-s};r.push({begin:c,end:d})}),r}appendTextToDiv(e,t,n,r){let i=this.textDivs[e];if(i.nodeType===Node.TEXT_NODE){const l=document.createElement("span");i.before(l),l.append(i),this.textDivs[e]=l,i=l}const s=this.textContentItemsStr[e].substring(t,n),o=document.createTextNode(s);if(r){const l=document.createElement("span");return l.className=`${r} appended`,l.append(o),i.append(l),r.includes("selected")?l:null}return i.append(o),null}renderMatches(e){var t,n,r;if(e.length===0)return;const i=this.pageIndex===((t=this.findController.selected)==null?void 0:t.pageIdx),s=((n=this.findController.selected)==null?void 0:n.matchIdx)??0,o=(r=this.findController.state)==null?void 0:r.highlightAll;if(!o&&!i)return;const l=o?0:s,u=o?e.length:s+1,c=(m,v)=>(this.textDivs[m.divIndex].textContent="",this.appendTextToDiv(m.divIndex,0,m.offset,v));let d=null,f=-1,p=-1;for(let m=l;m{C.className="highlight middle"+S}),c(y,"highlight end"+S)),d=y,E&&this.findController.scrollMatchIntoView({element:w,pageIndex:this.pageIndex,matchIndex:s})}d&&this.appendTextToDiv(d.divIndex,d.offset,void 0)}updateMatches(e=!1){var t,n;if(!this.enabled&&!e)return;let r=-1;if(this.matches.forEach(o=>{const l=Math.max(r,o.begin.divIndex);this.textDivs.slice(l,o.end.divIndex+1).forEach((u,c)=>{u.textContent=this.textContentItemsStr[l+c],u.className=""}),r=o.end.divIndex+1}),!this.findController.highlightMatches||e)return;const i=((t=this.findController.pageMatches)==null?void 0:t[this.pageIndex])??null,s=((n=this.findController.pageMatchesLength)==null?void 0:n[this.pageIndex])??null;this.matches=this.convertMatches(i,s),this.renderMatches(this.matches)}}const iI=["id"],sI=["id"],aI={key:0,class:"textLayer"},oI={key:1,class:"annotationLayer"},lI=V1({__name:"VuePdfEmbed",props:{annotationLayer:{type:Boolean},findController:{},forms:{type:Boolean},height:{},id:{},imageResourcesPath:{},linkService:{},page:{},rotation:{default:0},scale:{default:1},source:{},textLayer:{type:Boolean},width:{}},emits:["internal-link-clicked","loaded","loading-failed","password-requested","progress","rendered","rendering-failed"],setup(h,{expose:e,emit:t}){const n=h,r=t,i=Am([]),s=Vc([]),o=Am(null);let l=[],u=null;const{doc:c,download:d,print:f}=nI({onError:w=>{i.value=[],r("loading-failed",w)},onPasswordRequest({callback:w,isWrongPassword:C}){r("password-requested",{callback:w,isWrongPassword:C})},onProgress:w=>{r("progress",w)},source:wx(n,"source")}),p=xx(()=>{if(!c.value||!n.annotationLayer)return null;if(n.linkService)return n.linkService;const w=new pb({eventBus:new mb});return w.setDocument(c.value),w.setViewer({scrollPageIntoView:({pageNumber:C})=>{r("internal-link-clicked",C)}}),w}),m=w=>{let C,x;return n.height&&!n.width?(x=n.height,C=x/w):(C=n.width??o.value.clientWidth,x=C*w),[C,x]},v=async()=>{if(!(!c.value||u!=null&&u.isAborted))try{l.forEach(w=>w.disable()),l=[],i.value=n.page?Array.isArray(n.page)?n.page:[n.page]:[...Array(c.value.numPages+1).keys()].slice(1),s.value=Array(i.value.length).fill(1),await Promise.all(i.value.map(async(w,C)=>{const x=await c.value.getPage(w);if(u!=null&&u.isAborted)return;const T=((n.rotation%90===0?n.rotation:0)+x.rotate)%360,[I,F,P]=Array.from(o.value.getElementsByClassName("vue-pdf-embed__page")[C].children),R=!!(T/90%2),D=x.view[2]-x.view[0],k=x.view[3]-x.view[1],[N,H]=m(R?D/k:k/D),X=N/(R?k:D),j=x.getViewport({scale:X,rotation:T});s.value[C]=X,I.style.display="block",I.style.width=`${Math.floor(N)}px`,I.style.height=`${Math.floor(H)}px`;const U=[y(x,j.clone({scale:j.scale*window.devicePixelRatio*n.scale}),I)];return n.textLayer&&U.push(S(x,j.clone({dontFlip:!0}),F)),n.annotationLayer&&U.push(E(x,j.clone({dontFlip:!0}),P||F)),Promise.all(U)})),u!=null&&u.isAborted||r("rendered")}catch(w){i.value=[],s.value=[],u!=null&&u.isAborted||r("rendering-failed",w)}},y=async(w,C,x)=>{x.width=C.width,x.height=C.height,await w.render({canvas:x,viewport:C}).promise},E=async(w,C,x)=>{k1(x),await new CE({accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,annotationStorage:c.value.annotationStorage,commentManager:null,div:x,linkService:p.value,page:w,structTreeLayer:null,viewport:C}).render({annotations:await w.getAnnotations(),div:x,imageResourcesPath:n.imageResourcesPath,linkService:p.value,page:w,renderForms:!!n.forms,viewport:C})},S=async(w,C,x)=>{k1(x);const T=new xm({container:x,textContentSource:await w.getTextContent(),viewport:C});await T.render();const I=document.createElement("div");if(I.className="endOfContent",x.append(I),n.findController){const F=new rI({findController:n.findController,pageIndex:w.pageNumber-1});F.setTextMapping(T.textDivs,T.textContentItemsStr),F.enable(),l.push(F)}};return $v(c,w=>{w&&r("loaded",w)},{immediate:!0}),$v(()=>[c.value,n.annotationLayer,n.findController,n.forms,n.height,n.imageResourcesPath,n.page,n.rotation,n.scale,n.textLayer,n.width],async([w])=>{w&&(u&&(u.isAborted=!0,await u.promise),Om(o.value),u={isAborted:!1,promise:v()},await u.promise,u=null)},{immediate:!0}),tb(()=>{l.forEach(w=>w.disable()),Om(o.value)}),e({doc:c,download:d,print:(w,C,x=!1)=>f(w,C,x?void 0:n.page)}),(w,C)=>(Fs(),_s("div",{id:w.id,ref_key:"root",ref:o,class:"vue-pdf-embed"},[(Fs(!0),_s(yx,null,bx(i.value,(x,T)=>(Fs(),_s("div",{key:x},[Sb(w.$slots,"before-page",{page:x}),bm("div",{id:w.id&&`${w.id}-${x}`,class:"vue-pdf-embed__page",style:Ax({"--scale-round-x":"1px","--scale-round-y":"1px","--total-scale-factor":s.value[T],position:"relative"})},[C[0]||(C[0]=bm("canvas",null,null,-1)),w.textLayer?(Fs(),_s("div",aI)):Cb("",!0),w.annotationLayer?(Fs(),_s("div",oI)):Cb("",!0)],12,sI),Sb(w.$slots,"after-page",{page:x})]))),128))],8,iI))}}),hI="/static/dist/assets/pdf.worker.min.mjs",uI={key:0,class:"pdf-preview-loading"},cI={key:1,class:"pdf-preview-error"},dI=V1({name:"PdfPreview",__name:"PdfPreview",props:{source:{}},setup(h){Ys.workerSrc=hI;const e=h,t=Vc(null),n=Vc(void 0),r=Vc(!0),i=Vc("");let s=null,o=null;function l(){const p=t.value;if(!p)return;const m=p.getBoundingClientRect();n.value=m.width>0?Math.floor(m.width):void 0}Sx(()=>{l(),typeof ResizeObserver<"u"&&t.value?(s=new ResizeObserver(()=>l()),s.observe(t.value)):(o=()=>l(),window.addEventListener("resize",o))}),tb(()=>{s&&(s.disconnect(),s=null),o&&(window.removeEventListener("resize",o),o=null)});function u(){console.log("[PdfPreview] loaded"),r.value=!1}function c(){console.log("[PdfPreview] rendered"),r.value=!1}function d(p){console.error("[PdfPreview] loading-failed",p),r.value=!1,i.value=(p==null?void 0:p.message)||"PDF 加载失败"}function f(p){console.error("[PdfPreview] rendering-failed",p),r.value=!1,i.value=(p==null?void 0:p.message)||"PDF 渲染失败"}return(p,m)=>(Fs(),_s("div",{ref_key:"containerRef",ref:t,class:"pdf-preview"},[r.value?(Fs(),_s("div",uI,[...m[0]||(m[0]=[bm("span",{class:"pdf-preview-spinner"},null,-1),bm("span",null,"PDF 加载中...",-1)])])):i.value?(Fs(),_s("div",cI,Cx(i.value),1)):(Fs(),Tx(Px(lI),{key:2,source:e.source,width:n.value,"text-layer":!1,"annotation-layer":!1,onLoaded:u,onLoadingFailed:d,onRendered:c,onRenderingFailed:f},null,8,["source","width"]))],512))}}),sR=Ix(dI,[["__scopeId","data-v-812b5a52"]]);export{sR as default};