UNPKG

ngx-extended-pdf-viewer

Version:

Embedding PDF files in your Angular application. Highly configurable viewer including the toolbar, sidebar, and all the features you're used to.

37 lines 1.13 MB
/**
 * @licstart The following is the entire license notice for the
 * JavaScript code in this page
 *
 * Copyright 2024 Mozilla Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @licend The above is the entire license notice for the
 * JavaScript code in this page
 */
/**
 * pdfjsVersion = 5.4.793
 * pdfjsBuild = 44d055348
 */var e={34:(e,t,i)=>{var a=i(4901);e.exports=function(e){return"object"==typeof e?null!==e:a(e)}},81:(e,t,i)=>{var a=i(9565),s=i(9306),n=i(8551),r=i(6823),o=i(851),l=TypeError;e.exports=function(e,t){var i=arguments.length<2?o(e):t;if(s(i))return n(a(i,e));throw new l(r(e)+" is not iterable")}},116:(e,t,i)=>{var a=i(6518),s=i(9565),n=i(2652),r=i(9306),o=i(8551),l=i(1767),d=i(9539),c=i(4549)("find",TypeError);a({target:"Iterator",proto:!0,real:!0,forced:c},{find:function find(e){o(this);try{r(e)}catch(e){d(this,"throw",e)}if(c)return s(c,this,e);var t=l(this),i=0;return n(t,(function(t,a){if(e(t,i++))return a(t)}),{IS_RECORD:!0,INTERRUPTED:!0}).result}})},283:(e,t,i)=>{var a=i(9504),s=i(9039),n=i(4901),r=i(9297),o=i(3724),l=i(350).CONFIGURABLE,d=i(3706),c=i(1181),h=c.enforce,u=c.get,_=String,p=Object.defineProperty,g=a("".slice),f=a("".replace),v=a([].join),m=o&&!s((function(){return 8!==p((function(){}),"length",{value:8}).length})),w=String(String).split("String"),P=e.exports=function(e,t,i){"Symbol("===g(_(t),0,7)&&(t="["+f(_(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]");i&&i.getter&&(t="get "+t);i&&i.setter&&(t="set "+t);(!r(e,"name")||l&&e.name!==t)&&(o?p(e,"name",{value:t,configurable:!0}):e.name=t);m&&i&&r(i,"arity")&&e.length!==i.arity&&p(e,"length",{value:i.arity});try{i&&r(i,"constructor")&&i.constructor?o&&p(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var a=h(e);r(a,"source")||(a.source=v(w,"string"==typeof t?t:""));return e};Function.prototype.toString=P((function toString(){return n(this)&&u(this).source||d(this)}),"toString")},350:(e,t,i)=>{var a=i(3724),s=i(9297),n=Function.prototype,r=a&&Object.getOwnPropertyDescriptor,o=s(n,"name"),l=o&&"something"===function something(){}.name,d=o&&(!a||a&&r(n,"name").configurable);e.exports={EXISTS:o,PROPER:l,CONFIGURABLE:d}},373:(e,t,i)=>{var a=i(4576),s=i(7476),n=i(9039),r=i(9306),o=i(4488),l=i(4644),d=i(3709),c=i(3763),h=i(9519),u=i(3607),_=l.aTypedArray,p=l.exportTypedArrayMethod,g=a.Uint16Array,f=g&&s(g.prototype.sort),v=!(!f||n((function(){f(new g(2),null)}))&&n((function(){f(new g(2),{})}))),m=!!f&&!n((function(){if(h)return h<74;if(d)return d<67;if(c)return!0;if(u)return u<602;var e,t,i=new g(516),a=Array(516);for(e=0;e<516;e++){t=e%4;i[e]=515-e;a[e]=e-2*t+3}f(i,(function(e,t){return(e/4|0)-(t/4|0)}));for(e=0;e<516;e++)if(i[e]!==a[e])return!0}));p("sort",(function sort(e){void 0!==e&&r(e);return m?f(this,e):o(_(this),function(e){return function(t,i){return void 0!==e?+e(t,i)||0:i!=i?-1:t!=t?1:0===t&&0===i?1/t>0&&1/i<0?1:-1:t>i}}(e))}),!m||v)},397:(e,t,i)=>{var a=i(7751);e.exports=a("document","documentElement")},421:e=>{e.exports={}},507:(e,t,i)=>{var a=i(9565);e.exports=function(e,t,i){for(var s,n,r=i?e:e.iterator,o=e.next;!(s=a(o,r)).done;)if(void 0!==(n=t(s.value)))return n}},531:(e,t,i)=>{var a=i(6518),s=i(9565),n=i(9306),r=i(8551),o=i(1767),l=i(8646),d=i(9462),c=i(9539),h=i(6395),u=i(684),_=i(4549),p=!h&&!u("flatMap",(function(){})),g=!h&&!p&&_("flatMap",TypeError),f=h||p||g,v=d((function(){for(var e,t,i=this.iterator,a=this.mapper;;){if(t=this.inner)try{if(!(e=r(s(t.next,t.iterator))).done)return e.value;this.inner=null}catch(e){c(i,"throw",e)}e=r(s(this.next,i));if(this.done=!!e.done)return;try{this.inner=l(a(e.value,this.counter++),!1)}catch(e){c(i,"throw",e)}}}));a({target:"Iterator",proto:!0,real:!0,forced:f},{flatMap:function flatMap(e){r(this);try{n(e)}catch(e){c(this,"throw",e)}return g?s(g,this,e):new v(o(this),{mapper:e,inner:null})}})},616:(e,t,i)=>{var a=i(9039);e.exports=!a((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},655:(e,t,i)=>{var a=i(6955),s=String;e.exports=function(e){if("Symbol"===a(e))throw new TypeError("Cannot convert a Symbol value to a string");return s(e)}},679:(e,t,i)=>{var a=i(1625),s=TypeError;e.exports=function(e,t){if(a(t,e))return e;throw new s("Incorrect invocation")}},684:e=>{e.exports=function(e,t){var i="function"==typeof Iterator&&Iterator.prototype[e];if(i)try{i.call({next:null},t).next()}catch(e){return!0}}},741:e=>{var t=Math.ceil,i=Math.floor;e.exports=Math.trunc||function trunc(e){var a=+e;return(a>0?i:t)(a)}},747:(e,t,i)=>{var a=i(6699),s=i(6193),n=i(4659),r=Error.captureStackTrace;e.exports=function(e,t,i,o){n&&(r?r(e,t):a(e,"stack",s(i,o)))}},757:(e,t,i)=>{var a=i(7751),s=i(4901),n=i(1625),r=i(7040),o=Object;e.exports=r?function(e){return"symbol"==typeof e}:function(e){var t=a("Symbol");return s(t)&&n(t.prototype,o(e))}},851:(e,t,i)=>{var a=i(6955),s=i(5966),n=i(4117),r=i(6269),o=i(8227)("iterator");e.exports=function(e){if(!n(e))return s(e,o)||s(e,"@@iterator")||r[a(e)]}},944:e=>{var t=TypeError;e.exports=function(e){var i=e&&e.alphabet;if(void 0===i||"base64"===i||"base64url"===i)return i||"base64";throw new t("Incorrect `alphabet` option")}},1056:(e,t,i)=>{var a=i(4913).f;e.exports=function(e,t,i){i in e||a(e,i,{configurable:!0,get:function(){return t[i]},set:function(e){t[i]=e}})}},1072:(e,t,i)=>{var a=i(1828),s=i(8727);e.exports=Object.keys||function keys(e){return a(e,s)}},1103:e=>{e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},1108:(e,t,i)=>{var a=i(6955);e.exports=function(e){var t=a(e);return"BigInt64Array"===t||"BigUint64Array"===t}},1134:(e,t,i)=>{var a=i(4644),s=i(3839).findLastIndex,n=a.aTypedArray;(0,a.exportTypedArrayMethod)("findLastIndex",(function findLastIndex(e){return s(n(this),e,arguments.length>1?arguments[1]:void 0)}))},1148:(e,t,i)=>{var a=i(6518),s=i(9565),n=i(2652),r=i(9306),o=i(8551),l=i(1767),d=i(9539),c=i(4549)("every",TypeError);a({target:"Iterator",proto:!0,real:!0,forced:c},{every:function every(e){o(this);try{r(e)}catch(e){d(this,"throw",e)}if(c)return s(c,this,e);var t=l(this),i=0;return!n(t,(function(t,a){if(!e(t,i++))return a()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},1181:(e,t,i)=>{var a,s,n,r=i(8622),o=i(4576),l=i(34),d=i(6699),c=i(9297),h=i(7629),u=i(6119),_=i(421),p="Object already initialized",g=o.TypeError,f=o.WeakMap;if(r||h.state){var v=h.state||(h.state=new f);v.get=v.get;v.has=v.has;v.set=v.set;a=function(e,t){if(v.has(e))throw new g(p);t.facade=e;v.set(e,t);return t};s=function(e){return v.get(e)||{}};n=function(e){return v.has(e)}}else{var m=u("state");_[m]=!0;a=function(e,t){if(c(e,m))throw new g(p);t.facade=e;d(e,m,t);return t};s=function(e){return c(e,m)?e[m]:{}};n=function(e){return c(e,m)}}e.exports={set:a,get:s,has:n,enforce:function(e){return n(e)?s(e):a(e,{})},getterFor:function(e){return function(t){var i;if(!l(t)||(i=s(t)).type!==e)throw new g("Incompatible receiver, "+e+" required");return i}}}},1291:(e,t,i)=>{var a=i(741);e.exports=function(e){var t=+e;return t!=t||0===t?0:a(t)}},1385:(e,t,i)=>{var a=i(9539);e.exports=function(e,t,i){for(var s=e.length-1;s>=0;s--)if(void 0!==e[s])try{i=a(e[s].iterator,t,i)}catch(e){t="throw";i=e}if("throw"===t)throw i;return i}},1548:(e,t,i)=>{var a=i(4576),s=i(9039),n=i(9519),r=i(4215),o=a.structuredClone;e.exports=!!o&&!s((function(){if("DENO"===r&&n>92||"NODE"===r&&n>94||"BROWSER"===r&&n>97)return!1;var e=new ArrayBuffer(8),t=o(e,{transfer:[e]});return 0!==e.byteLength||8!==t.byteLength}))},1549:(e,t,i)=>{var a=i(6518),s=i(4576),n=i(9143),r=i(4154),o=s.Uint8Array,l=!o||!o.prototype.setFromBase64||!function(){var e=new o([255,255,255,255,255]);try{e.setFromBase64("",null);return}catch(e){}try{e.setFromBase64("MjYyZg===")}catch(t){return 50===e[0]&&54===e[1]&&50===e[2]&&255===e[3]&&255===e[4]}}();o&&a({target:"Uint8Array",proto:!0,forced:l},{setFromBase64:function setFromBase64(e){r(this);var t=n(e,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:t.read,written:t.written}}})},1625:(e,t,i)=>{var a=i(9504);e.exports=a({}.isPrototypeOf)},1689:(e,t,i)=>{var a=i(6518),s=i(4576),n=i(8745),r=i(7680),o=i(6043),l=i(9306),d=i(1103),c=s.Promise,h=!1;a({target:"Promise",stat:!0,forced:!c||!c.try||d((function(){c.try((function(e){h=8===e}),8)})).error||!h},{try:function(e){var t=arguments.length>1?r(arguments,1):[],i=o.f(this),a=d((function(){return n(l(e),void 0,t)}));(a.error?i.reject:i.resolve)(a.value);return i.promise}})},1698:(e,t,i)=>{var a=i(6518),s=i(4204),n=i(9835);a({target:"Set",proto:!0,real:!0,forced:!i(4916)("union")||!n("union")},{union:s})},1701:(e,t,i)=>{var a=i(6518),s=i(9565),n=i(9306),r=i(8551),o=i(1767),l=i(9462),d=i(6319),c=i(9539),h=i(684),u=i(4549),_=i(6395),p=!_&&!h("map",(function(){})),g=!_&&!p&&u("map",TypeError),f=_||p||g,v=l((function(){var e=this.iterator,t=r(s(this.next,e));if(!(this.done=!!t.done))return d(e,this.mapper,[t.value,this.counter++],!0)}));a({target:"Iterator",proto:!0,real:!0,forced:f},{map:function map(e){r(this);try{n(e)}catch(e){c(this,"throw",e)}return g?s(g,this,e):new v(o(this),{mapper:e})}})},1767:e=>{e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},1828:(e,t,i)=>{var a=i(9504),s=i(9297),n=i(5397),r=i(9617).indexOf,o=i(421),l=a([].push);e.exports=function(e,t){var i,a=n(e),d=0,c=[];for(i in a)!s(o,i)&&s(a,i)&&l(c,i);for(;t.length>d;)s(a,i=t[d++])&&(~r(c,i)||l(c,i));return c}},1903:(e,t,i)=>{var a=i(4644),s=i(3839).findLast,n=a.aTypedArray;(0,a.exportTypedArrayMethod)("findLast",(function findLast(e){return s(n(this),e,arguments.length>1?arguments[1]:void 0)}))},2106:(e,t,i)=>{var a=i(283),s=i(4913);e.exports=function(e,t,i){i.get&&a(i.get,t,{getter:!0});i.set&&a(i.set,t,{setter:!0});return s.f(e,t,i)}},2140:(e,t,i)=>{var a={};a[i(8227)("toStringTag")]="z";e.exports="[object z]"===String(a)},2195:(e,t,i)=>{var a=i(9504),s=a({}.toString),n=a("".slice);e.exports=function(e){return n(s(e),8,-1)}},2211:(e,t,i)=>{var a=i(9039);e.exports=!a((function(){function F(){}F.prototype.constructor=null;return Object.getPrototypeOf(new F)!==F.prototype}))},2222:(e,t,i)=>{var a=i(6518),s=i(7751),n=i(9039),r=i(2812),o=i(655),l=i(7416),d=s("URL"),c=l&&n((function(){d.canParse()})),h=n((function(){return 1!==d.canParse.length}));a({target:"URL",stat:!0,forced:!c||h},{canParse:function canParse(e){var t=r(arguments.length,1),i=o(e),a=t<2||void 0===arguments[1]?void 0:o(arguments[1]);try{return!!new d(i,a)}catch(e){return!1}}})},2278:(e,t,i)=>{var a=i(3724),s=i(4913),n=i(6980);e.exports=function(e,t,i){a?s.f(e,t,n(0,i)):e[t]=i}},2303:(e,t,i)=>{var a=i(4576),s=i(9504),n=a.Uint8Array,r=a.SyntaxError,o=a.parseInt,l=Math.min,d=/[^\da-f]/i,c=s(d.exec),h=s("".slice);e.exports=function(e,t){var i=e.length;if(i%2!=0)throw new r("String should be an even number of characters");for(var a=t?l(t.length,i/2):i/2,s=t||new n(a),u=0,_=0;_<a;){var p=h(e,u,u+=2);if(c(d,p))throw new r("String should only contain hex characters");s[_++]=o(p,16)}return{bytes:s,read:u}}},2360:(e,t,i)=>{var a,s=i(8551),n=i(6801),r=i(8727),o=i(421),l=i(397),d=i(4055),c=i(6119),h="prototype",u="script",_=c("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(e){return"<"+u+">"+e+"</"+u+">"},NullProtoObjectViaActiveX=function(e){e.write(scriptTag(""));e.close();var t=e.parentWindow.Object;e=null;return t},NullProtoObject=function(){try{a=new ActiveXObject("htmlfile")}catch(e){}NullProtoObject="undefined"!=typeof document?document.domain&&a?NullProtoObjectViaActiveX(a):function(){var e,t=d("iframe"),i="java"+u+":";t.style.display="none";l.appendChild(t);t.src=String(i);(e=t.contentWindow.document).open();e.write(scriptTag("document.F=Object"));e.close();return e.F}():NullProtoObjectViaActiveX(a);for(var e=r.length;e--;)delete NullProtoObject[h][r[e]];return NullProtoObject()};o[_]=!0;e.exports=Object.create||function create(e,t){var i;if(null!==e){EmptyConstructor[h]=s(e);i=new EmptyConstructor;EmptyConstructor[h]=null;i[_]=e}else i=NullProtoObject();return void 0===t?i:n.f(i,t)}},2475:(e,t,i)=>{var a=i(6518),s=i(8527);a({target:"Set",proto:!0,real:!0,forced:!i(4916)("isSupersetOf",(function(e){return!e}))},{isSupersetOf:s})},2489:(e,t,i)=>{var a=i(6518),s=i(9565),n=i(9306),r=i(8551),o=i(1767),l=i(9462),d=i(6319),c=i(6395),h=i(9539),u=i(684),_=i(4549),p=!c&&!u("filter",(function(){})),g=!c&&!p&&_("filter",TypeError),f=c||p||g,v=l((function(){for(var e,t,i=this.iterator,a=this.predicate,n=this.next;;){e=r(s(n,i));if(this.done=!!e.done)return;t=e.value;if(d(i,a,[t,this.counter++],!0))return t}}));a({target:"Iterator",proto:!0,real:!0,forced:f},{filter:function filter(e){r(this);try{n(e)}catch(e){h(this,"throw",e)}return g?s(g,this,e):new v(o(this),{predicate:e})}})},2529:e=>{e.exports=function(e,t){return{value:e,done:t}}},2603:(e,t,i)=>{var a=i(655);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:a(e)}},2652:(e,t,i)=>{var a=i(6080),s=i(9565),n=i(8551),r=i(6823),o=i(4209),l=i(6198),d=i(1625),c=i(81),h=i(851),u=i(9539),_=TypeError,Result=function(e,t){this.stopped=e;this.result=t},p=Result.prototype;e.exports=function(e,t,i){var g,f,v,m,w,P,y,b=i&&i.that,S=!(!i||!i.AS_ENTRIES),x=!(!i||!i.IS_RECORD),C=!(!i||!i.IS_ITERATOR),A=!(!i||!i.INTERRUPTED),E=a(t,b),stop=function(e){g&&u(g,"normal");return new Result(!0,e)},callFn=function(e){if(S){n(e);return A?E(e[0],e[1],stop):E(e[0],e[1])}return A?E(e,stop):E(e)};if(x)g=e.iterator;else if(C)g=e;else{if(!(f=h(e)))throw new _(r(e)+" is not iterable");if(o(f)){for(v=0,m=l(e);m>v;v++)if((w=callFn(e[v]))&&d(p,w))return w;return new Result(!1)}g=c(e,f)}P=x?e.next:g.next;for(;!(y=s(P,g)).done;){try{w=callFn(y.value)}catch(e){u(g,"throw",e)}if("object"==typeof w&&w&&d(p,w))return w}return new Result(!1)}},2777:(e,t,i)=>{var a=i(9565),s=i(34),n=i(757),r=i(5966),o=i(4270),l=i(8227),d=TypeError,c=l("toPrimitive");e.exports=function(e,t){if(!s(e)||n(e))return e;var i,l=r(e,c);if(l){void 0===t&&(t="default");i=a(l,e,t);if(!s(i)||n(i))return i;throw new d("Can't convert object to primitive value")}void 0===t&&(t="number");return o(e,t)}},2787:(e,t,i)=>{var a=i(9297),s=i(4901),n=i(8981),r=i(6119),o=i(2211),l=r("IE_PROTO"),d=Object,c=d.prototype;e.exports=o?d.getPrototypeOf:function(e){var t=n(e);if(a(t,l))return t[l];var i=t.constructor;return s(i)&&t instanceof i?i.prototype:t instanceof d?c:null}},2796:(e,t,i)=>{var a=i(9039),s=i(4901),n=/#|\.prototype\./,isForced=function(e,t){var i=o[r(e)];return i===d||i!==l&&(s(t)?a(t):!!t)},r=isForced.normalize=function(e){return String(e).replace(n,".").toLowerCase()},o=isForced.data={},l=isForced.NATIVE="N",d=isForced.POLYFILL="P";e.exports=isForced},2804:e=>{var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=t+"+/",a=t+"-_",inverse=function(e){for(var t={},i=0;i<64;i++)t[e.charAt(i)]=i;return t};e.exports={i2c:i,c2i:inverse(i),i2cUrl:a,c2iUrl:inverse(a)}},2812:e=>{var t=TypeError;e.exports=function(e,i){if(e<i)throw new t("Not enough arguments");return e}},2839:(e,t,i)=>{var a=i(4576).navigator,s=a&&a.userAgent;e.exports=s?String(s):""},2967:(e,t,i)=>{var a=i(6706),s=i(34),n=i(7750),r=i(3506);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=a(Object.prototype,"__proto__","set"))(i,[]);t=i instanceof Array}catch(e){}return function setPrototypeOf(i,a){n(i);r(a);if(!s(i))return i;t?e(i,a):i.__proto__=a;return i}}():void 0)},3167:(e,t,i)=>{var a=i(4901),s=i(34),n=i(2967);e.exports=function(e,t,i){var r,o;n&&a(r=t.constructor)&&r!==i&&s(o=r.prototype)&&o!==i.prototype&&n(e,o);return e}},3238:(e,t,i)=>{var a=i(4576),s=i(7811),n=i(7394),r=a.DataView;e.exports=function(e){if(!s||0!==n(e))return!1;try{new r(e);return!1}catch(e){return!0}}},3392:(e,t,i)=>{var a=i(9504),s=0,n=Math.random(),r=a(1.1.toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+r(++s+n,36)}},3440:(e,t,i)=>{var a=i(7080),s=i(4402),n=i(9286),r=i(5170),o=i(3789),l=i(8469),d=i(507),c=s.has,h=s.remove;e.exports=function difference(e){var t=a(this),i=o(e),s=n(t);r(t)<=i.size?l(t,(function(e){i.includes(e)&&h(s,e)})):d(i.getIterator(),(function(e){c(s,e)&&h(s,e)}));return s}},3463:e=>{var t=TypeError;e.exports=function(e){if("string"==typeof e)return e;throw new t("Argument is not a string")}},3506:(e,t,i)=>{var a=i(3925),s=String,n=TypeError;e.exports=function(e){if(a(e))return e;throw new n("Can't set "+s(e)+" as a prototype")}},3579:(e,t,i)=>{var a=i(6518),s=i(9565),n=i(2652),r=i(9306),o=i(8551),l=i(1767),d=i(9539),c=i(4549)("some",TypeError);a({target:"Iterator",proto:!0,real:!0,forced:c},{some:function some(e){o(this);try{r(e)}catch(e){d(this,"throw",e)}if(c)return s(c,this,e);var t=l(this),i=0;return n(t,(function(t,a){if(e(t,i++))return a()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},3607:(e,t,i)=>{var a=i(2839).match(/AppleWebKit\/(\d+)\./);e.exports=!!a&&+a[1]},3611:(e,t,i)=>{var a=i(6518),s=i(4576),n=i(2106),r=i(3724),o=TypeError,l=Object.defineProperty,d=s.self!==s;try{if(r){var c=Object.getOwnPropertyDescriptor(s,"self");!d&&c&&c.get&&c.enumerable||n(s,"self",{get:function self(){return s},set:function self(e){if(this!==s)throw new o("Illegal invocation");l(s,"self",{value:e,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}else a({global:!0,simple:!0,forced:d},{self:s})}catch(e){}},3650:(e,t,i)=>{var a=i(7080),s=i(4402),n=i(9286),r=i(3789),o=i(507),l=s.add,d=s.has,c=s.remove;e.exports=function symmetricDifference(e){var t=a(this),i=r(e).getIterator(),s=n(t);o(i,(function(e){d(t,e)?c(s,e):l(s,e)}));return s}},3706:(e,t,i)=>{var a=i(9504),s=i(4901),n=i(7629),r=a(Function.toString);s(n.inspectSource)||(n.inspectSource=function(e){return r(e)});e.exports=n.inspectSource},3709:(e,t,i)=>{var a=i(2839).match(/firefox\/(\d+)/i);e.exports=!!a&&+a[1]},3717:(e,t)=>{t.f=Object.getOwnPropertySymbols},3724:(e,t,i)=>{var a=i(9039);e.exports=!a((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},3763:(e,t,i)=>{var a=i(2839);e.exports=/MSIE|Trident/.test(a)},3789:(e,t,i)=>{var a=i(9306),s=i(8551),n=i(9565),r=i(1291),o=i(1767),l="Invalid size",d=RangeError,c=TypeError,h=Math.max,SetRecord=function(e,t){this.set=e;this.size=h(t,0);this.has=a(e.has);this.keys=a(e.keys)};SetRecord.prototype={getIterator:function(){return o(s(n(this.keys,this.set)))},includes:function(e){return n(this.has,this.set,e)}};e.exports=function(e){s(e);var t=+e.size;if(t!=t)throw new c(l);var i=r(t);if(i<0)throw new d(l);return new SetRecord(e,i)}},3838:(e,t,i)=>{var a=i(7080),s=i(5170),n=i(8469),r=i(3789);e.exports=function isSubsetOf(e){var t=a(this),i=r(e);return!(s(t)>i.size)&&!1!==n(t,(function(e){if(!i.includes(e))return!1}),!0)}},3839:(e,t,i)=>{var a=i(6080),s=i(7055),n=i(8981),r=i(6198),createMethod=function(e){var t=1===e;return function(i,o,l){for(var d,c=n(i),h=s(c),u=r(h),_=a(o,l);u-- >0;)if(_(d=h[u],u,c))switch(e){case 0:return d;case 1:return u}return t?-1:void 0}};e.exports={findLast:createMethod(0),findLastIndex:createMethod(1)}},3853:(e,t,i)=>{var a=i(6518),s=i(4449);a({target:"Set",proto:!0,real:!0,forced:!i(4916)("isDisjointFrom",(function(e){return!e}))},{isDisjointFrom:s})},3925:(e,t,i)=>{var a=i(34);e.exports=function(e){return a(e)||null===e}},3972:(e,t,i)=>{var a=i(34),s=String,n=TypeError;e.exports=function(e){if(void 0===e||a(e))return e;throw new n(s(e)+" is not an object or undefined")}},4055:(e,t,i)=>{var a=i(4576),s=i(34),n=a.document,r=s(n)&&s(n.createElement);e.exports=function(e){return r?n.createElement(e):{}}},4114:(e,t,i)=>{var a=i(6518),s=i(8981),n=i(6198),r=i(4527),o=i(6837);a({target:"Array",proto:!0,arity:1,forced:i(9039)((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function push(e){var t=s(this),i=n(t),a=arguments.length;o(i+a);for(var l=0;l<a;l++){t[i]=arguments[l];i++}r(t,i);return i}})},4117:e=>{e.exports=function(e){return null==e}},4149:e=>{var t=RangeError;e.exports=function(e){if(e==e)return e;throw new t("NaN is not allowed")}},4154:(e,t,i)=>{var a=i(6955),s=TypeError;e.exports=function(e){if("Uint8Array"===a(e))return e;throw new s("Argument is not an Uint8Array")}},4204:(e,t,i)=>{var a=i(7080),s=i(4402).add,n=i(9286),r=i(3789),o=i(507);e.exports=function union(e){var t=a(this),i=r(e).getIterator(),l=n(t);o(i,(function(e){s(l,e)}));return l}},4209:(e,t,i)=>{var a=i(8227),s=i(6269),n=a("iterator"),r=Array.prototype;e.exports=function(e){return void 0!==e&&(s.Array===e||r[n]===e)}},4215:(e,t,i)=>{var a=i(4576),s=i(2839),n=i(2195),userAgentStartsWith=function(e){return s.slice(0,e.length)===e};e.exports=userAgentStartsWith("Bun/")?"BUN":userAgentStartsWith("Cloudflare-Workers")?"CLOUDFLARE":userAgentStartsWith("Deno/")?"DENO":userAgentStartsWith("Node.js/")?"NODE":a.Bun&&"string"==typeof Bun.version?"BUN":a.Deno&&"object"==typeof Deno.version?"DENO":"process"===n(a.process)?"NODE":a.window&&a.document?"BROWSER":"REST"},4235:(e,t,i)=>{var a=i(6518),s=i(9504),n=i(2652),r=RangeError,o=TypeError,l=1/0,d=Math.abs,c=Math.pow,h=s([].push),u=c(2,1023),_=c(2,53)-1,p=Number.MAX_VALUE,g=c(2,971),f={},v={},m={},w={},P={},twosum=function(e,t){var i=e+t;return{hi:i,lo:t-(i-e)}};a({target:"Math",stat:!0},{sumPrecise:function sumPrecise(e){var t=[],i=0,a=w;n(e,(function(e){if(++i>=_)throw new r("Maximum allowed index exceeded");if("number"!=typeof e)throw new o("Value is not a number");if(a!==f)if(e!=e)a=f;else if(e===l)a=a===v?f:m;else if(e===-1/0)a=a===m?f:v;else if(!(0===e&&1/e!==l||a!==w&&a!==P)){a=P;h(t,e)}}));switch(a){case f:return NaN;case v:return-1/0;case m:return l;case w:return-0}for(var s,c,y,b,S,x,C=[],A=0,E=0;E<t.length;E++){s=t[E];for(var k=0,I=0;I<C.length;I++){c=C[I];if(d(s)<d(c)){x=s;s=c;c=x}b=(y=twosum(s,c)).hi;S=y.lo;if(d(b)===l){var M=b===l?1:-1;A+=M;if(d(s=s-M*u-M*u)<d(c)){x=s;s=c;c=x}b=(y=twosum(s,c)).hi;S=y.lo}0!==S&&(C[k++]=S);s=b}C.length=k;0!==s&&h(C,s)}var B=C.length-1;b=0;S=0;if(0!==A){var G=B>=0?C[B]:0;B--;if(d(A)>1||A>0&&G>0||A<0&&G<0)return A>0?l:-1/0;b=(y=twosum(A*u,G/2)).hi;S=y.lo;S*=2;if(d(2*b)===l)return b>0?b===u&&S===-g/2&&B>=0&&C[B]<0?p:l:b===-u&&S===g/2&&B>=0&&C[B]>0?-p:-1/0;if(0!==S){C[++B]=S;S=0}b*=2}for(;B>=0;){b=(y=twosum(b,C[B--])).hi;if(0!==(S=y.lo))break}B>=0&&(S<0&&C[B]<0||S>0&&C[B]>0)&&(c=2*S)===(s=b+c)-b&&(b=s);return b}})},4270:(e,t,i)=>{var a=i(9565),s=i(4901),n=i(34),r=TypeError;e.exports=function(e,t){var i,o;if("string"===t&&s(i=e.toString)&&!n(o=a(i,e)))return o;if(s(i=e.valueOf)&&!n(o=a(i,e)))return o;if("string"!==t&&s(i=e.toString)&&!n(o=a(i,e)))return o;throw new r("Can't convert object to primitive value")}},4373:(e,t,i)=>{var a=i(8981),s=i(5610),n=i(6198);e.exports=function fill(e){for(var t=a(this),i=n(t),r=arguments.length,o=s(r>1?arguments[1]:void 0,i),l=r>2?arguments[2]:void 0,d=void 0===l?i:s(l,i);d>o;)t[o++]=e;return t}},4376:(e,t,i)=>{var a=i(2195);e.exports=Array.isArray||function isArray(e){return"Array"===a(e)}},4402:(e,t,i)=>{var a=i(9504),s=Set.prototype;e.exports={Set,add:a(s.add),has:a(s.has),remove:a(s.delete),proto:s}},4449:(e,t,i)=>{var a=i(7080),s=i(4402).has,n=i(5170),r=i(3789),o=i(8469),l=i(507),d=i(9539);e.exports=function isDisjointFrom(e){var t=a(this),i=r(e);if(n(t)<=i.size)return!1!==o(t,(function(e){if(i.includes(e))return!1}),!0);var c=i.getIterator();return!1!==l(c,(function(e){if(s(t,e))return d(c,"normal",!1)}))}},4483:(e,t,i)=>{var a,s,n,r,o=i(4576),l=i(9429),d=i(1548),c=o.structuredClone,h=o.ArrayBuffer,u=o.MessageChannel,_=!1;if(d)_=function(e){c(e,{transfer:[e]})};else if(h)try{u||(a=l("worker_threads"))&&(u=a.MessageChannel);if(u){s=new u;n=new h(2);r=function(e){s.port1.postMessage(null,[e])};if(2===n.byteLength){r(n);0===n.byteLength&&(_=r)}}}catch(e){}e.exports=_},4488:(e,t,i)=>{var a=i(7680),s=Math.floor,sort=function(e,t){var i=e.length;if(i<8)for(var n,r,o=1;o<i;){r=o;n=e[o];for(;r&&t(e[r-1],n)>0;)e[r]=e[--r];r!==o++&&(e[r]=n)}else for(var l=s(i/2),d=sort(a(e,0,l),t),c=sort(a(e,l),t),h=d.length,u=c.length,_=0,p=0;_<h||p<u;)e[_+p]=_<h&&p<u?t(d[_],c[p])<=0?d[_++]:c[p++]:_<h?d[_++]:c[p++];return e};e.exports=sort},4495:(e,t,i)=>{var a=i(9519),s=i(9039),n=i(4576).String;e.exports=!!Object.getOwnPropertySymbols&&!s((function(){var e=Symbol("symbol detection");return!n(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&a&&a<41}))},4527:(e,t,i)=>{var a=i(3724),s=i(4376),n=TypeError,r=Object.getOwnPropertyDescriptor,o=a&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();e.exports=o?function(e,t){if(s(e)&&!r(e,"length").writable)throw new n("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t}},4549:(e,t,i)=>{var a=i(4576);e.exports=function(e,t){var i=a.Iterator,s=i&&i.prototype,n=s&&s[e],r=!1;if(n)try{n.call({next:function(){return{done:!0}},return:function(){r=!0}},-1)}catch(e){e instanceof t||(r=!1)}if(!r)return n}},4576:function(e){var check=function(e){return e&&e.Math===Math&&e};e.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof global&&global)||check("object"==typeof this&&this)||function(){return this}()||Function("return this")()},4601:(e,t,i)=>{var a=i(7751),s=i(9297),n=i(6699),r=i(1625),o=i(2967),l=i(7740),d=i(1056),c=i(3167),h=i(2603),u=i(7584),_=i(747),p=i(3724),g=i(6395);e.exports=function(e,t,i,f){var v="stackTraceLimit",m=f?2:1,w=e.split("."),P=w[w.length-1],y=a.apply(null,w);if(y){var b=y.prototype;!g&&s(b,"cause")&&delete b.cause;if(!i)return y;var S=a("Error"),x=t((function(e,t){var i=h(f?t:e,void 0),a=f?new y(e):new y;void 0!==i&&n(a,"message",i);_(a,x,a.stack,2);this&&r(b,this)&&c(a,this,x);arguments.length>m&&u(a,arguments[m]);return a}));x.prototype=b;if("Error"!==P)o?o(x,S):l(x,S,{name:!0});else if(p&&v in y){d(x,y,v);d(x,y,"prepareStackTrace")}l(x,y);if(!g)try{b.name!==P&&n(b,"name",P);b.constructor=x}catch(e){}return x}}},4603:(e,t,i)=>{var a=i(6840),s=i(9504),n=i(655),r=i(2812),o=URLSearchParams,l=o.prototype,d=s(l.append),c=s(l.delete),h=s(l.forEach),u=s([].push),_=new o("a=1&a=2&b=3");_.delete("a",1);_.delete("b",void 0);_+""!="a=2"&&a(l,"delete",(function(e){var t=arguments.length,i=t<2?void 0:arguments[1];if(t&&void 0===i)return c(this,e);var a=[];h(this,(function(e,t){u(a,{key:t,value:e})}));r(t,1);for(var s,o=n(e),l=n(i),_=0,p=0,g=!1,f=a.length;_<f;){s=a[_++];if(g||s.key===o){g=!0;c(this,s.key)}else p++}for(;p<f;)(s=a[p++]).key===o&&s.value===l||d(this,s.key,s.value)}),{enumerable:!0,unsafe:!0})},4628:(e,t,i)=>{var a=i(6518),s=i(6043);a({target:"Promise",stat:!0},{withResolvers:function withResolvers(){var e=s.f(this);return{promise:e.promise,resolve:e.resolve,reject:e.reject}}})},4644:(e,t,i)=>{var a,s,n,r=i(7811),o=i(3724),l=i(4576),d=i(4901),c=i(34),h=i(9297),u=i(6955),_=i(6823),p=i(6699),g=i(6840),f=i(2106),v=i(1625),m=i(2787),w=i(2967),P=i(8227),y=i(3392),b=i(1181),S=b.enforce,x=b.get,C=l.Int8Array,A=C&&C.prototype,E=l.Uint8ClampedArray,k=E&&E.prototype,I=C&&m(C),M=A&&m(A),B=Object.prototype,G=l.TypeError,T=P("toStringTag"),D=y("TYPED_ARRAY_TAG"),L="TypedArrayConstructor",R=r&&!!w&&"Opera"!==u(l.opera),N=!1,O={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},W={BigInt64Array:8,BigUint64Array:8},getTypedArrayConstructor=function(e){var t=m(e);if(c(t)){var i=x(t);return i&&h(i,L)?i[L]:getTypedArrayConstructor(t)}},isTypedArray=function(e){if(!c(e))return!1;var t=u(e);return h(O,t)||h(W,t)};for(a in O)(n=(s=l[a])&&s.prototype)?S(n)[L]=s:R=!1;for(a in W)(n=(s=l[a])&&s.prototype)&&(S(n)[L]=s);if(!R||!d(I)||I===Function.prototype){I=function TypedArray(){throw new G("Incorrect invocation")};if(R)for(a in O)l[a]&&w(l[a],I)}if(!R||!M||M===B){M=I.prototype;if(R)for(a in O)l[a]&&w(l[a].prototype,M)}R&&m(k)!==M&&w(k,M);if(o&&!h(M,T)){N=!0;f(M,T,{configurable:!0,get:function(){return c(this)?this[D]:void 0}});for(a in O)l[a]&&p(l[a],D,a)}e.exports={NATIVE_ARRAY_BUFFER_VIEWS:R,TYPED_ARRAY_TAG:N&&D,aTypedArray:function(e){if(isTypedArray(e))return e;throw new G("Target is not a typed array")},aTypedArrayConstructor:function(e){if(d(e)&&(!w||v(I,e)))return e;throw new G(_(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,i,a){if(o){if(i)for(var s in O){var n=l[s];if(n&&h(n.prototype,e))try{delete n.prototype[e]}catch(i){try{n.prototype[e]=t}catch(e){}}}M[e]&&!i||g(M,e,i?t:R&&A[e]||t,a)}},exportTypedArrayStaticMethod:function(e,t,i){var a,s;if(o){if(w){if(i)for(a in O)if((s=l[a])&&h(s,e))try{delete s[e]}catch(e){}if(I[e]&&!i)return;try{return g(I,e,i?t:R&&I[e]||t)}catch(e){}}for(a in O)!(s=l[a])||s[e]&&!i||g(s,e,t)}},getTypedArrayConstructor,isView:function isView(e){if(!c(e))return!1;var t=u(e);return"DataView"===t||h(O,t)||h(W,t)},isTypedArray,TypedArray:I,TypedArrayPrototype:M}},4659:(e,t,i)=>{var a=i(9039),s=i(6980);e.exports=!a((function(){var e=new Error("a");if(!("stack"in e))return!0;Object.defineProperty(e,"stack",s(1,7));return 7!==e.stack}))},4732:(e,t,i)=>{var a=i(4644),s=i(9504),n=i(9306),r=i(5370),o=a.aTypedArray,l=a.getTypedArrayConstructor,d=a.exportTypedArrayMethod,c=s(a.TypedArrayPrototype.sort);d("toSorted",(function toSorted(e){void 0!==e&&n(e);var t=o(this),i=r(l(t),t);return c(i,e)}))},4901:e=>{var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},4913:(e,t,i)=>{var a=i(3724),s=i(5917),n=i(8686),r=i(8551),o=i(6969),l=TypeError,d=Object.defineProperty,c=Object.getOwnPropertyDescriptor,h="enumerable",u="configurable",_="writable";t.f=a?n?function defineProperty(e,t,i){r(e);t=o(t);r(i);if("function"==typeof e&&"prototype"===t&&"value"in i&&_ in i&&!i[_]){var a=c(e,t);if(a&&a[_]){e[t]=i.value;i={configurable:u in i?i[u]:a[u],enumerable:h in i?i[h]:a[h],writable:!1}}}return d(e,t,i)}:d:function defineProperty(e,t,i){r(e);t=o(t);r(i);if(s)try{return d(e,t,i)}catch(e){}if("get"in i||"set"in i)throw new l("Accessors not supported");"value"in i&&(e[t]=i.value);return e}},4916:(e,t,i)=>{var a=i(7751),createSetLike=function(e){return{size:e,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},createSetLikeWithInfinitySize=function(e){return{size:e,has:function(){return!0},keys:function(){throw new Error("e")}}};e.exports=function(e,t){var i=a("Set");try{(new i)[e](createSetLike(0));try{(new i)[e](createSetLike(-1));return!1}catch(a){if(!t)return!0;try{(new i)[e](createSetLikeWithInfinitySize(-1/0));return!1}catch(a){var s=new i;s.add(1);s.add(2);return t(s[e](createSetLikeWithInfinitySize(1/0)))}}}catch(e){return!1}}},4979:(e,t,i)=>{var a=i(6518),s=i(4576),n=i(7751),r=i(6980),o=i(4913).f,l=i(9297),d=i(679),c=i(3167),h=i(2603),u=i(5002),_=i(6193),p=i(3724),g=i(6395),f="DOMException",v=n("Error"),m=n(f),w=function DOMException(){d(this,P);var e=arguments.length,t=h(e<1?void 0:arguments[0]),i=h(e<2?void 0:arguments[1],"Error"),a=new m(t,i),s=new v(t);s.name=f;o(a,"stack",r(1,_(s.stack,1)));c(a,this,w);return a},P=w.prototype=m.prototype,y="stack"in new v(f),b="stack"in new m(1,2),S=m&&p&&Object.getOwnPropertyDescriptor(s,f),x=!(!S||S.writable&&S.configurable),C=y&&!x&&!b;a({global:!0,constructor:!0,forced:g||C},{DOMException:C?w:m});var A=n(f),E=A.prototype;if(E.constructor!==A){g||o(E,"constructor",r(1,A));for(var k in u)if(l(u,k)){var I=u[k],M=I.s;l(A,M)||o(A,M,r(6,I.c))}}},5002:e=>{e.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},5024:(e,t,i)=>{var a=i(6518),s=i(3650),n=i(9835);a({target:"Set",proto:!0,real:!0,forced:!i(4916)("symmetricDifference")||!n("symmetricDifference")},{symmetricDifference:s})},5031:(e,t,i)=>{var a=i(7751),s=i(9504),n=i(8480),r=i(3717),o=i(8551),l=s([].concat);e.exports=a("Reflect","ownKeys")||function ownKeys(e){var t=n.f(o(e)),i=r.f;return i?l(t,i(e)):t}},5044:(e,t,i)=>{var a=i(4644),s=i(4373),n=i(5854),r=i(6955),o=i(9565),l=i(9504),d=i(9039),c=a.aTypedArray,h=a.exportTypedArrayMethod,u=l("".slice);h("fill",(function fill(e){var t=arguments.length;c(this);var i="Big"===u(r(this),0,3)?n(e):+e;return o(s,this,i,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),d((function(){var e=0;new Int8Array(2).fill({valueOf:function(){return e++}});return 1!==e})))},5169:(e,t,i)=>{var a=i(3238),s=TypeError;e.exports=function(e){if(a(e))throw new s("ArrayBuffer is detached");return e}},5170:(e,t,i)=>{var a=i(6706),s=i(4402);e.exports=a(s.proto,"size","get")||function(e){return e.size}},5370:(e,t,i)=>{var a=i(6198);e.exports=function(e,t,i){for(var s=0,n=arguments.length>2?i:a(t),r=new e(n);n>s;)r[s]=t[s++];return r}},5397:(e,t,i)=>{var a=i(7055),s=i(7750);e.exports=function(e){return a(s(e))}},5610:(e,t,i)=>{var a=i(1291),s=Math.max,n=Math.min;e.exports=function(e,t){var i=a(e);return i<0?s(i+t,0):n(i,t)}},5623:(e,t,i)=>{var a=i(6518),s=i(4576),n=i(9504),r=i(4154),o=i(5169),l=n(1.1.toString),d=s.Uint8Array,c=!d||!d.prototype.toHex||!function(){try{return"ffffffffffffffff"===new d([255,255,255,255,255,255,255,255]).toHex()}catch(e){return!1}}();d&&a({target:"Uint8Array",proto:!0,forced:c},{toHex:function toHex(){r(this);o(this.buffer);for(var e="",t=0,i=this.length;t<i;t++){var a=l(this[t],16);e+=1===a.length?"0"+a:a}return e}})},5636:(e,t,i)=>{var a=i(4576),s=i(9504),n=i(6706),r=i(7696),o=i(5169),l=i(7394),d=i(4483),c=i(1548),h=a.structuredClone,u=a.ArrayBuffer,_=a.DataView,p=Math.min,g=u.prototype,f=_.prototype,v=s(g.slice),m=n(g,"resizable","get"),w=n(g,"maxByteLength","get"),P=s(f.getInt8),y=s(f.setInt8);e.exports=(c||d)&&function(e,t,i){var a,s=l(e),n=void 0===t?s:r(t),g=!m||!m(e);o(e);if(c){e=h(e,{transfer:[e]});if(s===n&&(i||g))return e}if(s>=n&&(!i||g))a=v(e,0,n);else{var f=i&&!g&&w?{maxByteLength:w(e)}:void 0;a=new u(n,f);for(var b=new _(e),S=new _(a),x=p(n,s),C=0;C<x;C++)y(S,C,P(b,C))}c||d(e);return a}},5745:(e,t,i)=>{var a=i(7629);e.exports=function(e,t){return a[e]||(a[e]=t||{})}},5781:(e,t,i)=>{var a=i(6518),s=i(7751),n=i(2812),r=i(655),o=i(7416),l=s("URL");a({target:"URL",stat:!0,forced:!o},{parse:function parse(e){var t=n(arguments.length,1),i=r(e),a=t<2||void 0===arguments[1]?void 0:r(arguments[1]);try{return new l(i,a)}catch(e){return null}}})},5854:(e,t,i)=>{var a=i(2777),s=TypeError;e.exports=function(e){var t=a(e,"number");if("number"==typeof t)throw new s("Can't convert number to bigint");return BigInt(t)}},5876:(e,t,i)=>{var a=i(6518),s=i(3838);a({target:"Set",proto:!0,real:!0,forced:!i(4916)("isSubsetOf",(function(e){return e}))},{isSubsetOf:s})},5917:(e,t,i)=>{var a=i(3724),s=i(9039),n=i(4055);e.exports=!a&&!s((function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a}))},5966:(e,t,i)=>{var a=i(9306),s=i(4117);e.exports=function(e,t){var i=e[t];return s(i)?void 0:a(i)}},6043:(e,t,i)=>{var a=i(9306),s=TypeError,PromiseCapability=function(e){var t,i;this.promise=new e((function(e,a){if(void 0!==t||void 0!==i)throw new s("Bad Promise constructor");t=e;i=a}));this.resolve=a(t);this.reject=a(i)};e.exports.f=function(e){return new PromiseCapability(e)}},6080:(e,t,i)=>{var a=i(7476),s=i(9306),n=i(616),r=a(a.bind);e.exports=function(e,t){s(e);return void 0===t?e:n?r(e,t):function(){return e.apply(t,arguments)}}},6119:(e,t,i)=>{var a=i(5745),s=i(3392),n=a("keys");e.exports=function(e){return n[e]||(n[e]=s(e))}},6193:(e,t,i)=>{var a=i(9504),s=Error,n=a("".replace),r=String(new s("zxcasd").stack),o=/\n\s*at [^:]*:[^\n]*/,l=o.test(r);e.exports=function(e,t){if(l&&"string"==typeof e&&!s.prepareStackTrace)for(;t--;)e=n(e,o,"");return e}},6198:(e,t,i)=>{var a=i(8014);e.exports=function(e){return a(e.length)}},6269:e=>{e.exports={}},6279:(e,t,i)=>{var a=i(6840);e.exports=function(e,t,i){for(var s in t)a(e,s,t[s],i);return e}},6280:(e,t,i)=>{var a=i(6518),s=i(4576),n=i(8745),r=i(4601),o="WebAssembly",l=s[o],d=7!==new Error("e",{cause:7}).cause,exportGlobalErrorCauseWrapper=function(e,t){var i={};i[e]=r(e,t,d);a({global:!0,constructor:!0,arity:1,forced:d},i)},exportWebAssemblyErrorCauseWrapper=function(e,t){if(l&&l[e]){var i={};i[e]=r(o+"."+e,t,d);a({target:o,stat:!0,constructor:!0,arity:1,forced:d},i)}};exportGlobalErrorCauseWrapper("Error",(function(e){return function Error(t){return n(e,this,arguments)}}));exportGlobalErrorCauseWrapper("EvalError",(function(e){return function EvalError(t){return n(e,this,arguments)}}));exportGlobalErrorCauseWrapper("RangeError",(function(e){return function RangeError(t){return n(e,this,arguments)}}));exportGlobalErrorCauseWrapper("ReferenceError",(function(e){return function ReferenceError(t){return n(e,this,arguments)}}));exportGlobalErrorCauseWrapper("SyntaxError",(function(e){return function SyntaxError(t){return n(e,this,arguments)}}));exportGlobalErrorCauseWrapper("TypeError",(function(e){return function TypeError(t){return n(e,this,arguments)}}));exportGlobalErrorCauseWrapper("URIError",(function(e){return function URIError(t){return n(e,this,arguments)}}));exportWebAssemblyErrorCauseWrapper("CompileError",(function(e){return function CompileError(t){return n(e,this,arguments)}}));exportWebAssemblyErrorCauseWrapper("LinkError",(function(e){return function LinkError(t){return n(e,this,arguments)}}));exportWebAssemblyErrorCauseWrapper("RuntimeError",(function(e){return function RuntimeError(t){return n(e,this,arguments)}}))},6319:(e,t,i)=>{var a=i(8551),s=i(9539);e.exports=function(e,t,i,n){try{return n?t(a(i)[0],i[1]):t(i)}catch(t){s(e,"throw",t)}}},6395:e=>{e.exports=!1},6469:(e,t,i)=>{var a=i(8227),s=i(2360),n=i(4913).f,r=a("unscopables"),o=Array.prototype;void 0===o[r]&&n(o,r,{configurable:!0,value:s(null)});e.exports=function(e){o[r][e]=!0}},6518:(e,t,i)=>{var a=i(4576),s=i(7347).f,n=i(6699),r=i(6840),o=i(9433),l=i(7740),d=i(2796);e.exports=function(e,t){var i,c,h,u,_,p=e.target,g=e.global,f=e.stat;if(i=g?a:f?a[p]||o(p,{}):a[p]&&a[p].prototype)for(c in t){u=t[c];h=e.dontCallGetSet?(_=s(i,c))&&_.value:i[c];if(!d(g?c:p+(f?".":"#")+c,e.forced)&&void 0!==h){if(typeof u==typeof h)continue;l(u,h)}(e.sham||h&&h.sham)&&n(u,"sham",!0);r(i,c,u,e)}}},6573:(e,t,i)=>{var a=i(3724),s=i(2106),n=i(3238),r=ArrayBuffer.prototype;a&&!("detached"in r)&&s(r,"detached",{configurable:!0,get:function detached(){return n(this)}})},6699:(e,t,i)=>{var a=i(3724),s=i(4913),n=i(6980);e.exports=a?function(e,t,i){return s.f(e,t,n(1,i))}:function(e,t,i){e[t]=i;return e}},6706:(e,t,i)=>{var a=i(9504),s=i(9306);e.exports=function(e,t,i){try{return a(s(Object.getOwnPropertyDescriptor(e,t)[i]))}catch(e){}}},6801:(e,t,i)=>{var a=i(3724),s=i(8686),n=i(4913),r=i(8551),o=i(5397),l=i(1072);t.f=a&&!s?Object.defineProperties:function defineProperties(e,t){r(e);for(var i,a=o(t),s=l(t),d=s.length,c=0;d>c;)n.f(e,i=s[c++],a[i]);return e}},6823:e=>{var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},6837:e=>{var t=TypeError;e.exports=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}},6840:(e,t,i)=>{var a=i(4901),s=i(4913),n=i(283),r=i(9433);e.exports=function(e,t,i,o){o||(o={});var l=o.enumerable,d=void 0!==o.name?o.name:t;a(i)&&n(i,d,o);if(o.global)l?e[t]=i:r(t,i);else{try{o.unsafe?e[t]&&(l=!0):delete e[t]}catch(e){}l?e[t]=i:s.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e}},6955:(e,t,i)=>{var a=i(2140),s=i(4901),n=i(2195),r=i(8227)("toStringTag"),o=Object,l="Arguments"===n(function(){return arguments}());e.exports=a?n:function(e){var t,i,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(e){}}(t=o(e),r))?i:l?n(t):"Object"===(a=n(t))&&s(t.callee)?"Arguments":a}},6969:(e,t,i)=>{var a=i(2777),s=i(757);e.exports=function(e){var t=a(e,"string");return s(t)?t:t+""}},6980:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},7040:(e,t,i)=>{var a=i(4495);e.exports=a&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},7055:(e,t,i)=>{var a=i(9504),s=i(9039),n=i(2195),r=Object,o=a("".split);e.exports=s((function(){return!r("z").propertyIsEnumerable(0)}))?function(e){return"String"===n(e)?o(e,""):r(e)}:r},7080:(e,t,i)=>{var a=i(4402).has;e.exports=function(e){a(e);return e}},7347:(e,t,i)=>{var a=i(3724),s=i(9565),n=i(8773),r=i(6980),o=i(5397),l=i(6969),d=i(9297),c=i(5917),h=Object.getOwnPropertyDescriptor;t.f=a?h:function getOwnPropertyDescriptor(e,t){e=o(e);t=l(t);if(c)try{return h(e,t)}catch(e){}if(d(e,t))return r(!s(n.f,e,t),e[t])}},7357:(e,t,i)=>{var a=i(6518),s=i(9504),n=i(7750),r=i(1291),o=i(655),l=i(9039),d=s("".charAt);a({target:"String",proto:!0,forced:l((function(){return"\ud842"!=="𠮷".at(-2)}))},{at:function at(e){var t=o(n(this)),i=t.length,a=r(e),s=a>=0?a:i+a;return s<0||s>=i?void 0:d(t,s)}})},7394:(e,t,i)=>{var a=i(4576),s=i(6706),n=i(2195),r=a.ArrayBuffer,o=a.TypeError;e.exports=r&&s(r.prototype,"byteLength","get")||function(e){if("ArrayBuffer"!==n(e))throw new o("ArrayBuffer expected");return e.byteLength}},7416:(e,t,i)=>{var a=i(9039),s=i(8227),n=i(3724),r=i(6395),o=s("iterator");e.exports=!a((function(){var e=new URL("b?a=1&b=2&c=3","https://a"),t=e.searchParams,i=new URLSearchParams("a=1&a=2&b=3"),a="";e.pathname="c%20d";t.forEach((function(e,i){t.delete("b");a+=i+e}));i.delete("a",2);i.delete("b",void 0);return r&&(!e.toJSON||!i.has("a",1)||i.has("a",2)||!i.has("a",void 0)||i.has("b"))||!t.size&&(r||!n)||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[o]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==a||"x"!==new URL("https://x",void 0).host}))},7467:(e,t,i)=>{var a=i(7628),s=i(4644),n=s.aTypedArray,r=s.exportTypedArrayMethod,o=s.getTypedArrayConstructor;r("toReversed",(function toReversed(){return a(n(this),o(this))}))},7476:(e,t,i)=>{var a=i(2195),s=i(9504);e.exports=function(e){if("Function"===a(e))return s(e)}},7566:(e,t,i)=>{var a=i(6840),s=i(9504),n=i(655),r=i(2812),o=URLSearchParams,l=o.prototype,d=s(l.getAll),c=s(l.has),h=new o("a=1");!h.has("a",2)&&h.has("a",void 0)||a(l,"has",(function has(e){var t=arguments.length,i=t<2?void 0:arguments[1];if(t&&void 0===i)return c(this,e);var a=d(this,e);r(t,1);for(var s=n(i),o=0;o<a.length;)if(a[o++]===s)return!0;return!1}),{enumerable:!0,unsafe:!0})},7584:(e,t,i)=>{var a=i(34),s=i(6699);e.exports=function(e,t){a(t)&&"cause"in t&&s(e,"cause",t.cause)}},7588:(e,t,i)=>{var a=i(6518),s=i(9565),n=i(2652),r=i(9306),o=i(8551),l=i(1767),d=i(9539),c=i(4549)("forEach",TypeError);a({target:"Iterator",proto:!0,real:!0,forced:c},{forEach:function forEach(e){o(this);try{r(e)}catch(e){d(this,"throw",e)}if(c)return s(c,this,e);var t=l(this),i=0;n(t,(function(t){e(t,i++)}),{IS_RECORD:!0})}})},7628:(e,t,i)=>{var a=i(6198);e.exports=function(e,t){for(var i=a(e),s=new t(i),n=0;n<i;n++)s[n]=e[i-n-1];return s}},7629:(e,t,i)=>{var a=i(6395),s=i(4576),n=i(9433),r="__core-js_shared__",o=e.exports=s[r]||n(r,{});(o.versions||(o.versions=[])).push({version:"3.44.0",mode:a?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.44.0/LICENSE",source:"https://github.com/zloirock/core-js"})},7642:(e,t,i)=>{var a=i(6518),s=i(3440),n=i(9039);a({target:"Set",proto:!0,real:!0,forced:!i(4916)("difference",(function(e){return 0===e.size}))||n((function(){var e={size:1,has:function(){return!0},keys:function(){var e=0;return{next:function(){var i=e++>1;t.has(1)&&t.clear();return{done:i,value:2}}}}},t=new Set([1,2,3,4]);return 3!==t.difference(e).size}))},{difference:s})},7657:(e,t,i)=>{var a,s,n,r=i(9039),o=i(4901),l=i(34),d=i(2360),c=i(2787),h=i(6840),u=i(8227),_=i(6395),p=u("iterator"),g=!1;[].keys&&("next"in(n=[].keys())?(s=c(c(n)))!==Object.prototype&&(a=s):g=!0);!l(a)||r((function(){var e={};return a[p].call(e)!==e}))?a={}:_&&(a=d(a));o(a[p])||h(a,p,(function(){return this}));e.exports={IteratorPrototype:a,BUGGY_SAFARI_ITERATORS:g}},7680:(e,t,i)=>{var a=i(9504);e.exports=a([].slice)},7696:(e,t,i)=>{var a=i(1291),s=i(8014),n=RangeError;e.exports=function(e){if(void 0===e)return 0;var t=a(e),i=s(t);if(t!==i)throw new n("Wrong length or index");return i}},7740:(e,t,i)=>{var a=i(9297),s=i(5031),n=i(7347),r=i(4913);e.exports=function(e,t,i){for(var o=s(t),l=r.f,d=n.f,c=0;c<o.length;c++){var h=o[c];a(e,h)||i&&a(i,h)||l(e,h,d(t,h))}}},7750:(e,t,i)=>{var a=i(4117),s=TypeError;e.exports=function(e){if(a(e))throw new s("Can't call method on "+e);return e}},7751:(e,t,i)=>{var a=i(4576),s=i(4901);e.exports=function(e,t){return arguments.length<2?(i=a[e],s(i)?i:void 0):a[e]&&a[e][t];var i}},7811:e=>{e.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},7936:(e,t,i)=>{var a=i(6518),s=i(5636);s&&a({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function transferToFixedLength(){return s(this,arguments.length?arguments[0]:void 0,!1)}})},8004:(e,t,i)=>{var a=i(6518),s=i(9039),n=i(8750);a({target:"Set",proto:!0,real:!0,forced:!i(4916)("intersection",(function(e){return 2===e.size&&e.has(1)&&e.has(2)}))||s((function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))}))},{intersection:n})},8014:(e,t,i)=>{var a=i(1291),s=Math.min;e.exports=function(e){var t=a(e);return t>0?s(t,9007199254740991):0}},8100:(e,t,i)=>{var a=i(6518),s=i(5636);s&&a({target:"ArrayBuffer",proto:!0},{transfer:function transfer(){return s(this,arguments.length?arguments[0]:void 0,!0)}})},8107:(e,t,i)=>{var a=i(6518),s=i(8981),n=i(6198),r=i(1291),o=i(6469);a({target:"Array",proto:!0},{at:function at(e){var t=s(this),i=n(t),a=r(e),o=a>=0?a:i+a;return o<0||o>=i?void 0:t[o]}});o("at")},8111:(e,t,i)=>{var a=i(6518),s=i(4576),n=i(679),r=i(8551),o=i(4901),l=i(2787),d=i(2106),c=i(2278),h=i(9039),u=i(9297),_=i(8227),p=i(7657).IteratorPrototype,g=i(3724),f=i(6395),v="constructor",m="Iterator",w=_("toStringTag"),P=TypeError,y=s[m],b=f||!o(y)||y.prototype!==p||!h((function(){y({})})),S=function Iterator(){n(this,p);if(l(this)===p)throw new P("Abstract class Iterator not directly constructable")},defineIteratorPrototypeAccessor=function(e,t){g?d(p,e,{configurable:!0,get:function(){return t},set:function(t){r(this);if(this===p)throw new P("You can't redefine this property");u(this,e)?this[e]=t:c(this,e,t)}}):p[e]=t};u(p,w)||defineIteratorPrototypeAccessor(w,m);!b&&u(p,v)&&p[v]!==Object||defineIteratorPrototypeAccessor(v,S);S.prototype=p;a({global:!0,constructor:!0,forced:b},{Iterator:S})},8140:(e,t,i)=>{var a=i(4644),s=i(6198),n=i(1291),r=a.aTypedArray;(0,a.exportTypedArrayMethod)("at",(function at(e){var t=r(this),i=s(t),a=n(e),o=a>=0?a:i+a;return o<0||o>=i?void 0:t[o]}))},8227:(e,t,i)=>{var a=i(4576),s=i(5745),n=i(9297),r=i(3392),o=i(4495),l=i(7040),d=a.Symbol,c=s("wks"),h=l?d.for||d:d&&d.withoutSetter||r;e.exports=function(e){n(c,e)||(c[e]=o&&n(d,e)?d[e]:h("Symbol."+e));return c[e]}},8229:(e,t,i)=>{var a=i(9590),s=RangeError;e.exports=function(e,t){var i=a(e);if(i%t)throw new s("Wrong offset");return i}},8235:(e,t,i)=>{var a=i(9504),s=i(9297),n=SyntaxError,r=parseInt,o=String.fromCharCode,l=a("".charAt),d=a("".slice),c=a(/./.exec),h={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},u=/^[\da-f]{4}$/i,_=/^[\u0000-\u001F]$/;e.exports=function(e,t){for(var i=!0,a="";t<e.length;){var p=l(e,t);if("\\"===p){var g=d(e,t,t+2);if(s(h,g)){a+=h[g];t+=2}else{if("\\u"!==g)throw new n('Unknown escape sequence: "'+g+'"');var f=d(e,t+=2,t+4);if(!c(u,f))throw new n("Bad Unicode escape at: "+t);a+=o(r(f,16));t+=4}}else{if('"'===p){i=!1;t++;break}if(c(_,p))throw new n("Bad control character in string literal at: "+t);a+=p;t++}}if(i)throw new n("Unterminated string at: "+t);return{value:a,end:t}}},8237:(e,t,i)=>{var a=i(6518),s=i(2652),n=i(9306),r=i(8551),o=i(1767),l=i(9539),d=i(4549),c=i(8745),h=i(9039),u=TypeError,_=h((function(){[].keys().reduce((function(){}),void 0)})),p=!_&&d("reduce",u);a({target:"Iterator",proto:!0,real:!0,forced:_||p},{reduce:function reduce(e){r(this);try{n(e)}catch(e){l(this,"throw",e)}var t=arguments.length<2,i=t?void 0:arguments[1];if(p)return c(p,this,t?[e]:[e,i]);var a=o(this),d=0;s(a,(function(a){if(t){t=!1;i=a}else i=e(i,a,d);d++}),{IS_RECORD:!0});if(t)throw new u("Reduce of empty iterator with no initial value");return i}})},8335:(e,t,i)=>{var a=i(6518),s=i(3724),n=i(4576),r=i(7751),o=i(9504),l=i(9565),d=i(4901),c=i(34),h=i(4376),u=i(9297),_=i(655),p=i(6198),g=i(2278),f=i(9039),v=i(8235),m=i(4495),w=n.JSON,P=n.Number,y=n.SyntaxError,b=w&&w.parse,S=r("Object","keys"),x=Object.getOwnPropertyDescriptor,C=o("".charAt),A=o("".slice),E=o(/./.exec),k=o([].push),I=/^\d$/,M=/^[1-9]$/,B=/^[\d-]$/,G=/^[\t\n\r ]$/,internalize=function(e,t,i,a){var s,n,r,o,d,_=e[t],g=a&&_===a.value,f=g&&"string"==typeof a.source?{source:a.source}:{};if(c(_)){var v=h(_),m=g?a.nodes:v?[]:{};if(v){s=m.length;r=p(_);for(o=0;o<r;o++)internalizeProperty(_,o,internalize(_,""+o,i,o<s?m[o]:void 0))}else{n=S(_);r=p(n);for(o=0;o<r;o++){d=n[o];internalizeProperty(_,d,internalize(_,d,i,u(m,d)?m[d]:void 0))}}}return l(i,e,t,_,f)},internalizeProperty=function(e,t,i){if(s){var a=x(e,t);if(a&&!a.configurable)return}void 0===i?delete e[t]:g(e,t,i)},Node=function(e,t,i,a){this.value=e;this.end=t;this.source=i;this.nodes=a},Context=function(e,t){this.source=e;this.index=t};Context.prototype={fork:function(e){return new Context(this.source,e)},parse:function(){var e=this.source,t=this.skip(G,this.index),i=this.fork(t),a=C(e,t);if(E(B,a))return i.number();switch(a){case"{":return i.object();case"[":return i.array();case'"':return i.string();case"t":return i.keyword(!0);case"f":return i.keyword(!1);case"n":return i.keyword(null)}throw new y('Unexpected character: "'+a+'" at: '+t)},node:function(e,t,i,a,s){return new Node(t,a,e?null:A(this.source,i,a),s)},object:function(){for(var e=this.source,t=this.index+1,i=!1,a={},s={};t<e.length;){t=this.until(['"',"}"],t);if("}"===C(e,t)&&!i){t++;break}var n=this.fork(t).string(),r=n.value;t=n.end;t=this.until([":"],t)+1;t=this.skip(G,t);n=this.fork(t).parse();g(s,r,n);g(a,r,n.value);t=this.until([",","}"],n.end);var o=C(e,t);if(","===o){i=!0;t++}else if("}"===o){t++;break}}return this.node(1,a,this.index,t,s)},array:function(){for(var e=this.source,t=this.index+1,i=!1,a=[],s=[];t<e.length;){t=this.skip(G,t);if("]"===C(e,t)&&!i){t++;break}var n=this.fork(t).parse();k(s,n);k(a,n.value);t=this.until([",","]"],n.end);if(","===C(e,t)){i=!0;t++}else if("]"===C(e,t)){t++;break}}return this.node(1,a,this.index,t,s)},string:function(){var e=this.index,t=v(this.source,this.index+1);return this.node(0,t.value,e,t.end)},number:function(){var e=this.source,t=this.index,i=t;"-"===C(e,i)&&i++;if("0"===C(e,i))i++;else{if(!E(M,C(e,i)))throw new y("Failed to parse number at: "+i);i=this.skip(I,i+1)}"."===C(e,i)&&(i=this.skip(I,i+1));if("e"===C(e,i)||"E"===C(e,i)){i++;"+"!==C(e,i)&&"-"!==C(e,i)||i++;if(i===(i=this.skip(I,i)))throw new y("Failed to parse number's exponent value at: "+i)}return this.node(0,P(A(e,t,i)),t,i)},keyword:function(e){var t=""+e,i=this.index,a=i+t.length;if(A(this.source,i,a)!==t)throw new y("Failed to parse value at: "+i);return this.node(0,e,i,a)},skip:function(e,t){for(var i=this.source;t<i.length&&E(e,C(i,t));t++);return t},until:function(e,t){t=this.skip(G,t);for(var i=C(this.source,t),a=0;a<e.length;a++)if(e[a]===i)return t;throw new y('Unexpected character: "'+i+'" at: '+t)}};var T=f((function(){var e,t="9007199254740993";b(t,(function(t,i,a){e=a.source}));return e!==t})),D=m&&!f((function(){return 1/b("-0 \t")!=-1/0}));a({target:"JSON",stat:!0,forced:T},{parse:function parse(e,t){return D&&!d(t)?b(e):function(e,t){e=_(e);var i=new Context(e,0,""),a=i.parse(),s=a.value,n=i.skip(G,a.end);if(n<e.length)throw new y('Unexpected extra character: "'+C(e,n)+'" after the parsed data at: '+n);return d(t)?internalize({"":s},"",t,a):s}(e,t)}})},8469:(e,t,i)=>{var a=i(9504),s=i(507),n=i(4402),r=n.Set,o=n.proto,l=a(o.forEach),d=a(o.keys),c=d(new r).next;e.exports=function(e,t,i){return i?s({iterator:d(e),next:c},t):l(e,t)}},8480:(e,t,i)=>{var a=i(1828),s=i(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function getOwnPropertyNames(e){return a(e,s)}},8527:(e,t,i)=>{var a=i(7080),s=i(4402).has,n=i(5170),r=i(3789),o=i(507),l=i(9539);e.exports=function isSupersetOf(e){var t=a(this),i=r(e);if(n(t)<i.size)return!1;var d=i.getIterator();return!1!==o(d,(function(e){if(!s(t,e))return l(d,"normal",!1)}))}},8551:(e,t,i)=>{var a=i(34),s=String,n=TypeError;e.exports=function(e){if(a(e))return e;throw new n(s(e)+" is not an object")}},8574:(e,t,i)=>{var a=i(4215);e.exports="NODE"===a},8622:(e,t,i)=>{var a=i(4576),s=i(4901),n=a.WeakMap;e.exports=s(n)&&/native code/.test(String(n))},8646:(e,t,i)=>{var a=i(9565),s=i(8551),n=i(1767),r=i(851);e.exports=function(e,t){t&&"string"==typeof e||s(e);var i=r(e);return n(s(void 0!==i?a(i,e):e))}},8686:(e,t,i)=>{var a=i(3724),s=i(9039);e.exports=a&&s((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8721:(e,t,i)=>{var a=i(3724),s=i(9504),n=i(2106),r=URLSearchParams.prototype,o=s(r.forEach);a&&!("size"in r)&&n(r,"size",{get:function size(){var e=0;o(this,(function(){e++}));return e},configurable:!0,enumerable:!0})},8727:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},8745:(e,t,i)=>{var a=i(616),s=Function.prototype,n=s.apply,r=s.call;e.exports="object"==typeof Reflect&&Reflect.apply||(a?r.bind(n):function(){return r.apply(n,arguments)})},8750:(e,t,i)=>{var a=i(7080),s=i(4402),n=i(5170),r=i(3789),o=i(8469),l=i(507),d=s.Set,c=s.add,h=s.has;e.exports=function intersection(e){var t=a(this),i=r(e),s=new d;n(t)>i.size?l(i.getIterator(),(function(e){h(t,e)&&c(s,e)})):o(t,(function(e){i.includes(e)&&c(s,e)}));return s}},8773:(e,t)=>{var i={}.propertyIsEnumerable,a=Object.getOwnPropertyDescriptor,s=a&&!i.call({1:2},1);t.f=s?function propertyIsEnumerable(e){var t=a(this,e);return!!t&&t.enumerable}:i},8845:(e,t,i)=>{var a=i(4576),s=i(9565),n=i(4644),r=i(6198),o=i(8229),l=i(8981),d=i(9039),c=a.RangeError,h=a.Int8Array,u=h&&h.prototype,_=u&&u.set,p=n.aTypedArray,g=n.exportTypedArrayMethod,f=!d((function(){var e=new Uint8ClampedArray(2);s(_,e,{length:1,0:3},1);return 3!==e[1]})),v=f&&n.NATIVE_ARRAY_BUFFER_VIEWS&&d((function(){var e=new h(2);e.set(1);e.set("2",1);return 0!==e[0]||2!==e[1]}));g("set",(function set(e){p(this);var t=o(arguments.length>1?arguments[1]:void 0,1),i=l(e);if(f)return s(_,this,i,t);var a=this.length,n=r(i),d=0;if(n+t>a)throw new c("Wrong length");for(;d<n;)this[t+d]=i[d++]}),!f||v)},8981:(e,t,i)=>{var a=i(7750),s=Object;e.exports=function(e){return s(a(e))}},9039:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},9143:(e,t,i)=>{var a=i(4576),s=i(9504),n=i(3972),r=i(3463),o=i(9297),l=i(2804),d=i(944),c=i(5169),h=l.c2i,u=l.c2iUrl,_=a.SyntaxError,p=a.TypeError,g=s("".charAt),skipAsciiWhitespace=function(e,t){for(var i=e.length;t<i;t++){var a=g(e,t);if(" "!==a&&"\t"!==a&&"\n"!==a&&"\f"!==a&&"\r"!==a)break}return t},decodeBase64Chunk=function(e,t,i){var a=e.length;a<4&&(e+=2===a?"AA":"A");var s=(t[g(e,0)]<<18)+(t[g(e,1)]<<12)+(t[g(e,2)]<<6)+t[g(e,3)],n=[s>>16&255,s>>8&255,255&s];if(2===a){if(i&&0!==n[1])throw new _("Extra bits");return[n[0]]}if(3===a){if(i&&0!==n[2])throw new _("Extra bits");return[n[0],n[1]]}return n},writeBytes=function(e,t,i){for(var a=t.length,s=0;s<a;s++)e[i+s]=t[s];return i+a};e.exports=function(e,t,i,a){r(e);n(t);var s="base64"===d(t)?h:u,l=t?t.lastChunkHandling:void 0;void 0===l&&(l="loose");if("loose"!==l&&"strict"!==l&&"stop-before-partial"!==l)throw new p("Incorrect `lastChunkHandling` option");i&&c(i.buffer);var f=i||[],v=0,m=0,w="",P=0;if(a)for(;;){if((P=skipAsciiWhitespace(e,P))===e.length){if(w.length>0){if("stop-before-partial"===l)break;if("loose"!==l)throw new _("Missing padding");if(1===w.length)throw new _("Malformed padding: exactly one additional character");v=writeBytes(f,decodeBase64Chunk(w,s,!1),v)}m=e.length;break}var y=g(e,P);++P;if("="===y){if(w.length<2)throw new _("Padding is too early");P=skipAsciiWhitespace(e,P);if(2===w.length){if(P===e.length){if("stop-before-partial"===l)break;throw new _("Malformed padding: only one =")}if("="===g(e,P)){++P;P=skipAsciiWhitespace(e,P)}}if(P<e.length)throw new _("Unexpected character after padding");v=writeBytes(f,decodeBase64Chunk(w,s,"strict"===l),v);m=e.length;break}if(!o(s,y))throw new _("Unexpected character");var b=a-v;if(1===b&&2===w.length||2===b&&3===w.length)break;if(4===(w+=y).length){v=writeBytes(f,decodeBase64Chunk(w,s,!1),v);w="";m=P;if(v===a)break}}return{bytes:f,read:m,written:v}}},9286:(e,t,i)=>{var a=i(4402),s=i(8469),n=a.Set,r=a.add;e.exports=function(e){var t=new n;s(e,(function(e){r(t,e)}));return t}},9297:(e,t,i)=>{var a=i(9504),s=i(8981),n=a({}.hasOwnProperty);e.exports=Object.hasOwn||function hasOwn(e,t){return n(s(e),t)}},9306:(e,t,i)=>{var a=i(4901),s=i(6823),n=TypeError;e.exports=function(e){if(a(e))return e;throw new n(s(e)+" is not a function")}},9314:(e,t,i)=>{var a=i(6518),s=i(9565),n=i(8551),r=i(1767),o=i(4149),l=i(9590),d=i(9539),c=i(9462),h=i(684),u=i(4549),_=i(6395),p=!_&&!h("drop",0),g=!_&&!p&&u("drop",RangeError),f=_||p||g,v=c((function(){for(var e,t=this.iterator,i=this.next;this.remaining;){this.remaining--;e=n(s(i,t));if(this.done=!!e.done)return}e=n(s(i,t));if(!(this.done=!!e.done))return e.value}));a({target:"Iterator",proto:!0,real:!0,forced:f},{drop:function drop(e){n(this);var t;try{t=l(o(+e))}catch(e){d(this,"throw",e)}return g?s(g,this,t):new v(r(this),{remaining:t})}})},9429:(e,t,i)=>{var a=i(4576),s=i(8574);e.exports=function(e){if(s){try{return a.process.getBuiltinModule(e)}catch(e){}try{return Function('return require("'+e+'")')()}catch(e){}}}},9432:(e,t,i)=>{var a=i(6518),s=i(4576),n=i(5370),r=i(9143),o=s.Uint8Array,l=!o||!o.fromBase64||!function(){try{o.fromBase64("",null)}catch(e){return!0}}();o&&a({target:"Uint8Array",stat:!0,forced:l},{fromBase64:function fromBase64(e){var t=r(e,arguments.length>1?arguments[1]:void 0,null,9007199254740991);return n(o,t.bytes)}})},9433:(e,t,i)=>{var a=i(4576),s=Object.defineProperty;e.exports=function(e,t){try{s(a,e,{value:t,configurable:!0,writable:!0})}catch(i){a[e]=t}return t}},9462:(e,t,i)=>{var a=i(9565),s=i(2360),n=i(6699),r=i(6279),o=i(8227),l=i(1181),d=i(5966),c=i(7657).IteratorPrototype,h=i(2529),u=i(9539),_=i(1385),p=o("toStringTag"),g="IteratorHelper",f="WrapForValidIterator",v="normal",m="throw",w=l.set,createIteratorProxyPrototype=function(e){var t=l.getterFor(e?f:g);return r(s(c),{next:function next(){var i=t(this);if(e)return i.nextHandler();if(i.done)return h(void 0,!0);try{var a=i.nextHandler();return i.returnHandlerResult?a:h(a,i.done)}catch(e){i.done=!0;throw e}},return:function(){var i=t(this),s=i.iterator;i.done=!0;if(e){var n=d(s,"return");return n?a(n,s):h(void 0,!0)}if(i.inner)try{u(i.inner.iterator,v)}catch(e){return u(s,m,e)}if(i.openIters)try{_(i.openIters,v)}catch(e){return u(s,m,e)}s&&u(s,v);return h(void 0,!0)}})},P=createIteratorProxyPrototype(!0),y=createIteratorProxyPrototype(!1);n(y,p,"Iterator Helper");e.exports=function(e,t,i){var a=function Iterator(a,s){if(s){s.iterator=a.iterator;s.next=a.next}else s=a;s.type=t?f:g;s.returnHandlerResult=!!i;s.nextHandler=e;s.counter=0;s.done=!1;w(this,s)};a.prototype=t?P:y;return a}},9504:(e,t,i)=>{var a=i(616),s=Function.prototype,n=s.call,r=a&&s.bind.bind(n,n);e.exports=a?r:function(e){return function(){return n.apply(e,arguments)}}},9519:(e,t,i)=>{var a,s,n=i(4576),r=i(2839),o=n.process,l=n.Deno,d=o&&o.versions||l&&l.version,c=d&&d.v8;c&&(s=(a=c.split("."))[0]>0&&a[0]<4?1:+(a[0]+a[1]));!s&&r&&(!(a=r.match(/Edge\/(\d+)/))||a[1]>=74)&&(a=r.match(/Chrome\/(\d+)/))&&(s=+a[1]);e.exports=s},9539:(e,t,i)=>{var a=i(9565),s=i(8551),n=i(5966);e.exports=function(e,t,i){var r,o;s(e);try{if(!(r=n(e,"return"))){if("throw"===t)throw i;return i}r=a(r,e)}catch(e){o=!0;r=e}if("throw"===t)throw i;if(o)throw r;s(r);return i}},9565:(e,t,i)=>{var a=i(616),s=Function.prototype.call;e.exports=a?s.bind(s):function(){return s.apply(s,arguments)}},9577:(e,t,i)=>{var a=i(9928),s=i(4644),n=i(1108),r=i(1291),o=i(5854),l=s.aTypedArray,d=s.getTypedArrayConstructor,c=s.exportTypedArrayMethod,h=function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(e){return 8===e}}(),u=h&&function(){try{new Int8Array(1).with(-.5,1)}catch(e){return!0}}();c("with",{with:function(e,t){var i=l(this),s=r(e),c=n(i)?o(t):+t;return a(i,d(i),s,c)}}.with,!h||u)},9590:(e,t,i)=>{var a=i(1291),s=RangeError;e.exports=function(e){var t=a(e);if(t<0)throw new s("The argument can't be less than 0");return t}},9617:(e,t,i)=>{var a=i(5397),s=i(5610),n=i(6198),createMethod=function(e){return function(t,i,r){var o=a(t),l=n(o);if(0===l)return!e&&-1;var d,c=s(r,l);if(e&&i!=i){for(;l>c;)if((d=o[c++])!=d)return!0}else for(;l>c;c++)if((e||c in o)&&o[c]===i)return e||c||0;return!e&&-1}};e.exports={includes:createMethod(!0),indexOf:createMethod(!1)}},9631:(e,t,i)=>{var a=i(6518),s=i(4576),n=i(9504),r=i(3972),o=i(4154),l=i(5169),d=i(2804),c=i(944),h=d.i2c,u=d.i2cUrl,_=n("".charAt),p=s.Uint8Array,g=!p||!p.prototype.toBase64||!function(){try{(new p).toBase64(null)}catch(e){return!0}}();p&&a({target:"Uint8Array",proto:!0,forced:g},{toBase64:function toBase64(){var e=o(this),t=arguments.length?r(arguments[0]):void 0,i="base64"===c(t)?h:u,a=!!t&&!!t.omitPadding;l(this.buffer);for(var s,n="",d=0,p=e.length,at=function(e){return _(i,s>>6*e&63)};d+2<p;d+=3){s=(e[d]<<16)+(e[d+1]<<8)+e[d+2];n+=at(3)+at(2)+at(1)+at(0)}if(d+2===p){s=(e[d]<<16)+(e[d+1]<<8);n+=at(3)+at(2)+at(1)+(a?"":"=")}else if(d+1===p){s=e[d]<<16;n+=at(3)+at(2)+(a?"":"==")}return n}})},9797:(e,t,i)=>{var a=i(6518),s=i(4576),n=i(3463),r=i(4154),o=i(5169),l=i(2303);s.Uint8Array&&a({target:"Uint8Array",proto:!0},{setFromHex:function setFromHex(e){r(this);n(e);o(this.buffer);var t=l(e,this).read;return{read:t,written:t/2}}})},9835:e=>{e.exports=function(e){try{var t=new Set,i={size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){t.clear();t.add(4);return function(){return{done:!0}}}})}},a=t[e](i);return 1===a.size&&4===a.values().next().value}catch(e){return!1}}},9928:(e,t,i)=>{var a=i(6198),s=i(1291),n=RangeError;e.exports=function(e,t,i,r){var o=a(e),l=s(i),d=l<0?o+l:l;if(d>=o||d<0)throw new n("Incorrect index");for(var c=new t(o),h=0;h<o;h++)c[h]=h===d?r:e[h];return c}}},t={};function __webpack_require__(i){var a=t[i];if(void 0!==a)return a.exports;var s=t[i]={exports:{}};e[i].call(s.exports,s,s.exports,__webpack_require__);return s.exports}var i;__webpack_require__(6280),__webpack_require__(4114),__webpack_require__(6573),__webpack_require__(8100),__webpack_require__(7936),__webpack_require__(8111),__webpack_require__(8237),__webpack_require__(1689),__webpack_require__(8140),__webpack_require__(5044),__webpack_require__(1903),__webpack_require__(1134),__webpack_require__(8845),__webpack_require__(373),__webpack_require__(7467),__webpack_require__(4732),__webpack_require__(9577),__webpack_require__(4235),__webpack_require__(9432),__webpack_require__(1549),__webpack_require__(9797),__webpack_require__(9631),__webpack_require__(5623),__webpack_require__(4979),__webpack_require__(3611),__webpack_require__(5781);class NgxConsole{static log(e,t){NgxConsole.ngxConsoleFilter("log",e)&&(void 0!==t?console.log("%s",e,t):console.log(e))}static error(e,t){NgxConsole.ngxConsoleFilter("error",e)&&(void 0!==t?console.error("%s",e,t):console.error(e))}static warn(e,t){NgxConsole.ngxConsoleFilter("warn",e)&&(void 0!==t?console.warn("%s",e,t):console.warn(e))}static debug(e,t){NgxConsole.ngxConsoleFilter("debug",e)&&(void 0!==t?console.warn("%s",e,t):console.warn(e))}get ngxConsoleFilter(){return NgxConsole.ngxConsoleFilter}set ngxConsoleFilter(e){NgxConsole.ngxConsoleFilter=e}reset(){NgxConsole.ngxConsoleFilter=(e,t)=>!0}}!function _defineProperty(e,t,i){return(t=function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}(NgxConsole,"ngxConsoleFilter",((e,t)=>!0));function _assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const a=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),s=[.001,0,0,.001,0,0],n=1.35,r=1,o=2,l=4,d=16,c=32,h=64,u=128,_=256,p={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},g="pdfjs_internal_editor_",f={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,SIGNATURE:101,COMMENT:102},v={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},m={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},w=0,P=1,y=2,b=3,S=3,x=4,C={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},A={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},E=1,k=2,I=3,M=4,B=5,G={ERRORS:0,WARNINGS:1,INFOS:5},T={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},D=0,L=1,R=2,N=3,O={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let W=G.WARNINGS;function setVerbosityLevel(e){Number.isInteger(e)&&(W=e)}function getVerbosityLevel(){return W}function info(e){W>=G.INFOS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?console.log(`Info: ${e}`):Window&&NgxConsole?NgxConsole.log(`Info: ${e}`):console.log(`Info: ${e}`))}function warn(e){W>=G.WARNINGS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope||Window&&NgxConsole?NgxConsole.log(`Warning: ${e}`):console.log(`Warning: ${e}`))}function unreachable(e){throw new Error(e)}function assert(e,t){e||unreachable(t)}function createValidAbsoluteUrl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e)return null;if(i&&"string"==typeof e){if(i.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t?.length>=2&&(e=`http://${e}`)}if(i.tryConvertEncoding)try{e=function stringToUTF8String(e){return decodeURIComponent(escape(e))}(e)}catch{}}const a=t?URL.parse(e,t):URL.parse(e);return function _isValidProtocol(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":case"capacitor":return!0;default:return!1}}(a)?a:null}function updateUrlHash(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=URL.parse(e);if(a){a.hash=t;return a.href}return i&&createValidAbsoluteUrl(e,"http://example.com")?e.split("#",1)[0]+""+(t?`#${t}`:""):""}function shadow(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Object.defineProperty(e,t,{value:i,enumerable:!a,configurable:!0,writable:!1});return i}const j=function BaseExceptionClosure(){function BaseException(e,t){this.message=e;this.name=t}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();class PasswordException extends j{constructor(e,t){super(e,"PasswordException");this.code=t}}class UnknownErrorException extends j{constructor(e,t){super(e,"UnknownErrorException");this.details=t}}class InvalidPDFException extends j{constructor(e){super(e,"InvalidPDFException")}}class ResponseException extends j{constructor(e,t,i){super(e,"ResponseException");this.status=t;this.missing=i}}class FormatError extends j{constructor(e){super(e,"FormatError")}}class AbortException extends j{constructor(e){super(e,"AbortException")}}function bytesToString(e){"object"==typeof e&&void 0!==e?.length||unreachable("Invalid argument for bytesToString");const t=e.length,i=8192;if(t<i)return String.fromCharCode.apply(null,e);const a=[];for(let s=0;s<t;s+=i){const n=Math.min(s+i,t),r=e.subarray(s,n);a.push(String.fromCharCode.apply(null,r))}return a.join("")}function stringToBytes(e){"string"!=typeof e&&unreachable("Invalid argument for stringToBytes");const t=e.length,i=new Uint8Array(t);for(let a=0;a<t;++a)i[a]=255&e.charCodeAt(a);return i}class util_FeatureTest{static get isLittleEndian(){return shadow(this,"isLittleEndian",function isLittleEndian(){const e=new Uint8Array(4);e[0]=1;return 1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return shadow(this,"isEvalSupported",function isEvalSupported(){try{new Function("");return!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get isImageDecoderSupported(){return shadow(this,"isImageDecoderSupported","undefined"!=typeof ImageDecoder)}static get platform(){const{platform:e,userAgent:t}=navigator;return shadow(this,"platform",{isAndroid:t.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:t.includes("Firefox")})}static get isCSSRoundSupported(){return shadow(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const V=Array.from(Array(256).keys(),(e=>e.toString(16).padStart(2,"0")));class Util{static makeHexColor(e,t,i){return`#${V[e]}${V[t]}${V[i]}`}static scaleMinMax(e,t){let i;if(e[0]){if(e[0]<0){i=t[0];t[0]=t[2];t[2]=i}t[0]*=e[0];t[2]*=e[0];if(e[3]<0){i=t[1];t[1]=t[3];t[3]=i}t[1]*=e[3];t[3]*=e[3]}else{i=t[0];t[0]=t[1];t[1]=i;i=t[2];t[2]=t[3];t[3]=i;if(e[1]<0){i=t[1];t[1]=t[3];t[3]=i}t[1]*=e[1];t[3]*=e[1];if(e[2]<0){i=t[0];t[0]=t[2];t[2]=i}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 applyTransform(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const a=e[i],s=e[i+1];e[i]=a*t[0]+s*t[2]+t[4];e[i+1]=a*t[1]+s*t[3]+t[5]}static applyTransformToBezier(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const a=t[0],s=t[1],n=t[2],r=t[3],o=t[4],l=t[5];for(let t=0;t<6;t+=2){const d=e[i+t],c=e[i+t+1];e[i+t]=d*a+c*n+o;e[i+t+1]=d*s+c*r+l}}static applyInverseTransform(e,t){const i=e[0],a=e[1],s=t[0]*t[3]-t[1]*t[2];e[0]=(i*t[3]-a*t[2]+t[2]*t[5]-t[4]*t[3])/s;e[1]=(-i*t[1]+a*t[0]+t[4]*t[1]-t[5]*t[0])/s}static axialAlignedBoundingBox(e,t,i){const a=t[0],s=t[1],n=t[2],r=t[3],o=t[4],l=t[5],d=e[0],c=e[1],h=e[2],u=e[3];let _=a*d+o,p=_,g=a*h+o,f=g,v=r*c+l,m=v,w=r*u+l,P=w;if(0!==s||0!==n){const e=s*d,t=s*h,i=n*c,a=n*u;_+=i;f+=i;g+=a;p+=a;v+=e;P+=e;w+=t;m+=t}i[0]=Math.min(i[0],_,g,p,f);i[1]=Math.min(i[1],v,w,m,P);i[2]=Math.max(i[2],_,g,p,f);i[3]=Math.max(i[3],v,w,m,P)}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 i=e[0],a=e[1],s=e[2],n=e[3],r=i**2+a**2,o=i*s+a*n,l=s**2+n**2,d=(r+l)/2,c=Math.sqrt(d**2-(r*l-o**2));t[0]=Math.sqrt(d+c||1);t[1]=Math.sqrt(d-c||1)}static normalizeRect(e){const t=e.slice(0);if(e[0]>e[2]){t[0]=e[2];t[2]=e[0]}if(e[1]>e[3]){t[1]=e[3];t[3]=e[1]}return t}static intersect(e,t){const i=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),a=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(i>a)return null;const s=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),n=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return s>n?null:[i,s,a,n]}static pointBoundingBox(e,t,i){i[0]=Math.min(i[0],e);i[1]=Math.min(i[1],t);i[2]=Math.max(i[2],e);i[3]=Math.max(i[3],t)}static rectBoundingBox(e,t,i,a,s){s[0]=Math.min(s[0],e,i);s[1]=Math.min(s[1],t,a);s[2]=Math.max(s[2],e,i);s[3]=Math.max(s[3],t,a)}static bezierBoundingBox(e,t,i,a,s,n,r,o,l){l[0]=Math.min(l[0],e,r);l[1]=Math.min(l[1],t,o);l[2]=Math.max(l[2],e,r);l[3]=Math.max(l[3],t,o);_assertClassBrand(Util,this,_getExtremum).call(this,e,i,s,r,t,a,n,o,3*(3*(i-s)-e+r),6*(e-2*i+s),3*(i-e),l);_assertClassBrand(Util,this,_getExtremum).call(this,e,i,s,r,t,a,n,o,3*(3*(a-n)-t+o),6*(t-2*a+n),3*(a-t),l)}}i=Util;function _getExtremumOnCurve(e,t,i,a,s,n,r,o,l,d){if(l<=0||l>=1)return;const c=1-l,h=l*l,u=h*l,_=c*(c*(c*e+3*l*t)+3*h*i)+u*a,p=c*(c*(c*s+3*l*n)+3*h*r)+u*o;d[0]=Math.min(d[0],_);d[1]=Math.min(d[1],p);d[2]=Math.max(d[2],_);d[3]=Math.max(d[3],p)}function _getExtremum(e,t,a,s,n,r,o,l,d,c,h,u){if(Math.abs(d)<1e-12){Math.abs(c)>=1e-12&&_assertClassBrand(i,this,_getExtremumOnCurve).call(this,e,t,a,s,n,r,o,l,-h/c,u);return}const _=c**2-4*h*d;if(_<0)return;const p=Math.sqrt(_),g=2*d;_assertClassBrand(i,this,_getExtremumOnCurve).call(this,e,t,a,s,n,r,o,l,(-c+p)/g,u);_assertClassBrand(i,this,_getExtremumOnCurve).call(this,e,t,a,s,n,r,o,l,(-c-p)/g,u)}let H=null,z=null;function normalizeUnicode(e){if(!H){H=/([\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;z=new Map([["ſt","ſt"]])}return e.replaceAll(H,((e,t,i)=>t?t.normalize("NFKC"):z.get(i)))}function getUuid(){if("function"==typeof crypto.randomUUID)return crypto.randomUUID();const e=new Uint8Array(32);crypto.getRandomValues(e);return bytesToString(e)}const U="pdfjs_internal_id_";function MathClamp(e,t,i){return Math.min(Math.max(e,t),i)}function toBase64Util(e){return Uint8Array.prototype.toBase64?e.toBase64():btoa(bytesToString(e))}"function"!=typeof Promise.try&&(Promise.try=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),a=1;a<t;a++)i[a-1]=arguments[a];return new Promise((t=>{t(e(...i))}))});"function"!=typeof Math.sumPrecise&&(Math.sumPrecise=function(e){return e.reduce(((e,t)=>e+t),0)});var $;__webpack_require__(1701),__webpack_require__(4628),__webpack_require__(7642),__webpack_require__(8004),__webpack_require__(3853),__webpack_require__(5876),__webpack_require__(2475),__webpack_require__(5024),__webpack_require__(1698),__webpack_require__(4603),__webpack_require__(7566),__webpack_require__(8721),__webpack_require__(8107),__webpack_require__(9314),__webpack_require__(1148),__webpack_require__(7588),__webpack_require__(3579),__webpack_require__(7357),__webpack_require__(8335);function display_utils_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function display_utils_defineProperty(e,t,i){return(t=function display_utils_toPropertyKey(e){var t=function display_utils_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const q="http://www.w3.org/2000/svg";class PixelsPerInch{}$=PixelsPerInch;display_utils_defineProperty(PixelsPerInch,"CSS",96);display_utils_defineProperty(PixelsPerInch,"PDF",72);display_utils_defineProperty(PixelsPerInch,"PDF_TO_CSS_UNITS",$.CSS/$.PDF);async function fetchData(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";if(isValidFetchUrl(e,document.baseURI)){const i=await fetch(e);if(!i.ok)throw new Error(i.statusText);switch(t){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise(((i,a)=>{const s=new XMLHttpRequest;s.open("GET",e,!0);s.responseType=t;s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE)if(200!==s.status&&0!==s.status)a(new Error(s.statusText));else{switch(t){case"arraybuffer":case"blob":case"json":i(s.response);return}i(s.responseText)}};s.send(null)}))}class PageViewport{constructor(e){let{viewBox:t,userUnit:i,scale:a,rotation:s,offsetX:n=0,offsetY:r=0,dontFlip:o=!1}=e;this.viewBox=t;this.userUnit=i;this.scale=a;this.rotation=s;this.offsetX=n;this.offsetY=r;a*=i;const l=(t[2]+t[0])/2,d=(t[3]+t[1])/2;let c,h,u,_,p,g,f,v;s%=360;s<0&&(s+=360);switch(s){case 180:c=-1;h=0;u=0;_=1;break;case 90:c=0;h=1;u=1;_=0;break;case 270:c=0;h=-1;u=-1;_=0;break;case 0:c=1;h=0;u=0;_=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}if(o){u=-u;_=-_}if(0===c){p=Math.abs(d-t[1])*a+n;g=Math.abs(l-t[0])*a+r;f=(t[3]-t[1])*a;v=(t[2]-t[0])*a}else{p=Math.abs(l-t[0])*a+n;g=Math.abs(d-t[1])*a+r;f=(t[2]-t[0])*a;v=(t[3]-t[1])*a}this.transform=[c*a,h*a,u*a,_*a,p-c*a*l-u*a*d,g-h*a*l-_*a*d];this.width=f;this.height=v}get rawDims(){const e=this.viewBox;return shadow(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone(){let{scale:e=this.scale,rotation:t=this.rotation,offsetX:i=this.offsetX,offsetY:a=this.offsetY,dontFlip:s=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new PageViewport({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:t,offsetX:i,offsetY:a,dontFlip:s})}convertToViewportPoint(e,t){const i=[e,t];Util.applyTransform(i,this.transform);return i}convertToViewportRectangle(e){const t=[e[0],e[1]];Util.applyTransform(t,this.transform);const i=[e[2],e[3]];Util.applyTransform(i,this.transform);return[t[0],t[1],i[0],i[1]]}convertToPdfPoint(e,t){const i=[e,t];Util.applyInverseTransform(i,this.transform);return i}}class RenderingCancelledException extends j{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(e,"RenderingCancelledException");this.extraDelay=t}}function isDataScheme(e){const t=e.length;let i=0;for(;i<t&&""===e[i].trim();)i++;return"data:"===e.substring(i,i+5).toLowerCase()}function isPdfFile(e){return"string"==typeof e&&/\.pdf$/i.test(e)}function display_utils_getPdfFilenameFromUrl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if(t&&"document.pdf"!==t)return t;if("string"!=typeof e)return t;if(isDataScheme(e)){warn('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.');return t}const i=(e=>{try{return new URL(e)}catch{try{return new URL(decodeURIComponent(e))}catch{try{return new URL(e,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(e),"https://foo.bar")}catch{return null}}}}})(e);if(!i)return t;const decode=e=>{try{let t=decodeURIComponent(e);if(t.includes("/")){t=t.split("/").at(-1);return t.test(/^\.pdf$/i)?t:e}return t}catch{return e}},a=/\.pdf$/i,s=i.pathname.split("/").at(-1);if(a.test(s))return decode(s);if(i.searchParams.size>0){const e=Array.from(i.searchParams.values()).reverse();for(const t of e)if(a.test(t))return decode(t);const t=Array.from(i.searchParams.keys()).reverse();for(const e of t)if(a.test(e))return decode(e)}if(i.hash){const e=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(i.hash);if(e)return decode(e[0])}return t}class StatTimer{constructor(){display_utils_defineProperty(this,"started",Object.create(null));display_utils_defineProperty(this,"times",[])}time(e){e in this.started&&warn(`Timer is already running for ${e}`);this.started[e]=Date.now()}timeEnd(e){e in this.started||warn(`Timer has not been started for ${e}`);this.times.push({name:e,start:this.started[e],end:Date.now()});delete this.started[e]}toString(){const e=[];let t=0;for(const{name:e}of this.times)t=Math.max(e.length,t);for(const{name:i,start:a,end:s}of this.times)e.push(`${i.padEnd(t)} ${s-a}ms\n`);return e.join("")}}function isValidFetchUrl(e,t){const i=t?URL.parse(e,t):URL.parse(e);return"http:"===i?.protocol||"https:"===i?.protocol||"capacitor:"===i?.protocol}function noContextMenu(e){e.preventDefault()}function stopEvent(e){e.preventDefault();e.stopPropagation()}class PDFDateString{static toDateObject(e){if(e instanceof Date)return e;if(!e||"string"!=typeof e)return null;display_utils_assertClassBrand(PDFDateString,this,X)._||(X._=display_utils_assertClassBrand(PDFDateString,this,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?")));const t=display_utils_assertClassBrand(PDFDateString,this,X)._.exec(e);if(!t)return null;const i=parseInt(t[1],10);let a=parseInt(t[2],10);a=a>=1&&a<=12?a-1:0;let s=parseInt(t[3],10);s=s>=1&&s<=31?s:1;let n=parseInt(t[4],10);n=n>=0&&n<=23?n:0;let r=parseInt(t[5],10);r=r>=0&&r<=59?r:0;let o=parseInt(t[6],10);o=o>=0&&o<=59?o:0;const l=t[7]||"Z";let d=parseInt(t[8],10);d=d>=0&&d<=23?d:0;let c=parseInt(t[9],10)||0;c=c>=0&&c<=59?c:0;if("-"===l){n+=d;r+=c}else if("+"===l){n-=d;r-=c}return new Date(Date.UTC(i,a,s,n,r,o))}}var X={_:void 0};function getXfaPageViewport(e,t){let{scale:i=1,rotation:a=0}=t;const{width:s,height:n}=e.attributes.style,r=[0,0,parseInt(s),parseInt(n)];return new PageViewport({viewBox:r,userUnit:1,scale:i,rotation:a})}function getRGB(e){if(e.startsWith("#")){const t=parseInt(e.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}if(e.startsWith("rgb("))return e.slice(4,-1).split(",").map((e=>parseInt(e)));if(e.startsWith("rgba("))return e.slice(5,-1).split(",").map((e=>parseInt(e))).slice(0,3);warn(`Not a valid color format: "${e}"`);return[0,0,0]}function getCurrentTransform(e){const{a:t,b:i,c:a,d:s,e:n,f:r}=e.getTransform();return[t,i,a,s,n,r]}function getCurrentTransformInverse(e){const{a:t,b:i,c:a,d:s,e:n,f:r}=e.getTransform().invertSelf();return[t,i,a,s,n,r]}function setLayerDimensions(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(t instanceof PageViewport){const{pageWidth:a,pageHeight:s}=t.rawDims,{style:n}=e,r=util_FeatureTest.isCSSRoundSupported,o=`var(--total-scale-factor) * ${a}px`,l=`var(--total-scale-factor) * ${s}px`,d=r?`round(down, ${o}, var(--scale-round-x))`:`calc(${o})`,c=r?`round(down, ${l}, var(--scale-round-y))`:`calc(${l})`;if(i&&t.rotation%180!=0){n.width=c;n.height=d}else{n.width=d;n.height=c}}a&&e.setAttribute("data-main-rotation",t.rotation)}class OutputScale{constructor(){const{pixelRatio:e}=OutputScale;this.sx=e;this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}limitCanvas(e,t,i,a){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,n=1/0,r=1/0,o=1/0;(i=OutputScale.capPixels(i,s))>0&&(n=Math.sqrt(i/(e*t)));if(-1!==a){r=a/e;o=a/t}const l=Math.min(n,r,o);if(this.sx>l||this.sy>l){this.sx=l;this.sy=l;return!0}return!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){const i=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+t/100));return e>0?Math.min(e,i):i}return e}}const K=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];function _classPrivateMethodInitSpec(e,t){_checkPrivateRedeclaration(e,t),t.add(e)}function _classPrivateFieldInitSpec(e,t,i){_checkPrivateRedeclaration(e,t),t.set(e,i)}function _checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateGetter(e,t,i){return i(toolbar_assertClassBrand(e,t))}function _classPrivateFieldGet(e,t){return e.get(toolbar_assertClassBrand(e,t))}function _classPrivateFieldSet(e,t,i){return e.set(toolbar_assertClassBrand(e,t),i),i}function toolbar_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Y=new WeakMap,Z=new WeakMap,Q=new WeakMap,J=new WeakMap,ee=new WeakMap,te=new WeakMap,ie=new WeakMap,ae=new WeakSet;class EditorToolbar{constructor(e){_classPrivateMethodInitSpec(this,ae);_classPrivateFieldInitSpec(this,Y,null);_classPrivateFieldInitSpec(this,Z,null);_classPrivateFieldInitSpec(this,Q,void 0);_classPrivateFieldInitSpec(this,J,null);_classPrivateFieldInitSpec(this,ee,null);_classPrivateFieldInitSpec(this,te,null);_classPrivateFieldInitSpec(this,ie,null);_classPrivateFieldSet(Q,this,e);ne._||(ne._=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))}render(){const e=_classPrivateFieldSet(Y,this,document.createElement("div"));e.classList.add("editToolbar","hidden");e.setAttribute("role","toolbar");const t=_classPrivateFieldGet(Q,this)._uiManager._signal;e.addEventListener("contextmenu",noContextMenu,{signal:t});e.addEventListener("pointerdown",_pointerDown,{signal:t});const i=_classPrivateFieldSet(J,this,document.createElement("div"));i.className="buttons";e.append(i);const a=_classPrivateFieldGet(Q,this).toolbarPosition;if(a){const{style:t}=e,i="ltr"===_classPrivateFieldGet(Q,this)._uiManager.direction?1-a[0]:a[0];t.insetInlineEnd=100*i+"%";t.top=`calc(${100*a[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return _classPrivateFieldGet(Y,this)}hide(){_classPrivateFieldGet(Y,this).classList.add("hidden");_classPrivateFieldGet(Z,this)?.hideDropdown()}show(){_classPrivateFieldGet(Y,this).classList.remove("hidden");_classPrivateFieldGet(ee,this)?.shown();_classPrivateFieldGet(te,this)?.shown()}addDeleteButton(){const{editorType:e,_uiManager:t}=_classPrivateFieldGet(Q,this),i=document.createElement("button");i.className="delete";i.tabIndex=0;i.setAttribute("data-l10n-id",ne._[e]);toolbar_assertClassBrand(ae,this,_addListenersToElement).call(this,i);i.addEventListener("click",(e=>{t.delete()}),{signal:t._signal});_classPrivateFieldGet(J,this).append(i)}async addAltText(e){const t=await e.render();toolbar_assertClassBrand(ae,this,_addListenersToElement).call(this,t);_classPrivateFieldGet(J,this).append(t,_classPrivateGetter(ae,this,_get_divider));_classPrivateFieldSet(ee,this,e)}addComment(e){if(_classPrivateFieldGet(te,this))return;const t=e.render();if(t){toolbar_assertClassBrand(ae,this,_addListenersToElement).call(this,t);_classPrivateFieldGet(J,this).prepend(t,_classPrivateGetter(ae,this,_get_divider));_classPrivateFieldSet(te,this,e);e.toolbar=this}}addColorPicker(e){if(_classPrivateFieldGet(Z,this))return;_classPrivateFieldSet(Z,this,e);const t=e.renderButton();toolbar_assertClassBrand(ae,this,_addListenersToElement).call(this,t);_classPrivateFieldGet(J,this).append(t,_classPrivateGetter(ae,this,_get_divider))}async addEditSignatureButton(e){const t=_classPrivateFieldSet(ie,this,await e.renderEditButton(_classPrivateFieldGet(Q,this)));toolbar_assertClassBrand(ae,this,_addListenersToElement).call(this,t);_classPrivateFieldGet(J,this).append(t,_classPrivateGetter(ae,this,_get_divider))}async addButton(e,t){switch(e){case"colorPicker":this.addColorPicker(t);break;case"altText":await this.addAltText(t);break;case"editSignature":await this.addEditSignatureButton(t);break;case"delete":this.addDeleteButton();break;case"comment":this.addComment(t)}}updateEditSignatureButton(e){_classPrivateFieldGet(ie,this)&&(_classPrivateFieldGet(ie,this).title=e)}remove(){_classPrivateFieldGet(Y,this).remove();_classPrivateFieldGet(Z,this)?.destroy();_classPrivateFieldSet(Z,this,null)}}function _pointerDown(e){e.stopPropagation()}function _focusIn(e){_classPrivateFieldGet(Q,this)._focusEventsAllowed=!1;stopEvent(e)}function _focusOut(e){_classPrivateFieldGet(Q,this)._focusEventsAllowed=!0;stopEvent(e)}function _addListenersToElement(e){const t=_classPrivateFieldGet(Q,this)._uiManager._signal;e.addEventListener("focusin",toolbar_assertClassBrand(ae,this,_focusIn).bind(this),{capture:!0,signal:t});e.addEventListener("focusout",toolbar_assertClassBrand(ae,this,_focusOut).bind(this),{capture:!0,signal:t});e.addEventListener("contextmenu",noContextMenu,{signal:t})}function _get_divider(e){const t=document.createElement("div");t.className="divider";return t}var se,ne={_:null},re=new WeakMap,oe=new WeakMap,le=new WeakMap,de=new WeakSet;class HighlightToolbar{constructor(e){_classPrivateMethodInitSpec(this,de);_classPrivateFieldInitSpec(this,re,null);_classPrivateFieldInitSpec(this,oe,null);_classPrivateFieldInitSpec(this,le,void 0);_classPrivateFieldSet(le,this,e)}show(e,t,i){const[a,s]=toolbar_assertClassBrand(de,this,_getLastPoint).call(this,t,i),{style:n}=_classPrivateFieldGet(oe,this)||_classPrivateFieldSet(oe,this,toolbar_assertClassBrand(de,this,_render).call(this));e.append(_classPrivateFieldGet(oe,this));n.insetInlineEnd=100*a+"%";n.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){_classPrivateFieldGet(oe,this).remove()}}function _render(){const e=_classPrivateFieldSet(oe,this,document.createElement("div"));e.className="editToolbar";e.setAttribute("role","toolbar");e.addEventListener("contextmenu",noContextMenu,{signal:_classPrivateFieldGet(le,this)._signal});const t=_classPrivateFieldSet(re,this,document.createElement("div"));t.className="buttons";e.append(t);toolbar_assertClassBrand(de,this,_addHighlightButton).call(this);return e}function _getLastPoint(e,t){let i=0,a=0;for(const s of e){const e=s.y+s.height;if(e<i)continue;const n=s.x+(t?s.width:0);if(e>i){a=n;i=e}else t?n>a&&(a=n):n<a&&(a=n)}return[t?1-a:a,i]}function _addHighlightButton(){const e=document.createElement("button");e.className="highlightButton";e.tabIndex=0;e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const t=document.createElement("span");e.append(t);t.className="visuallyHidden";t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const i=_classPrivateFieldGet(le,this)._signal;e.addEventListener("contextmenu",noContextMenu,{signal:i});e.addEventListener("click",(()=>{_classPrivateFieldGet(le,this).highlightSelection("floating_button")}),{signal:i});_classPrivateFieldGet(re,this).append(e)}function tools_defineProperty(e,t,i){return(t=function tools_toPropertyKey(e){var t=function tools_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function tools_classPrivateMethodInitSpec(e,t){tools_checkPrivateRedeclaration(e,t),t.add(e)}function tools_classPrivateFieldInitSpec(e,t,i){tools_checkPrivateRedeclaration(e,t),t.set(e,i)}function tools_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function tools_classPrivateFieldGet(e,t){return e.get(tools_assertClassBrand(e,t))}function tools_classPrivateFieldSet(e,t,i){return e.set(tools_assertClassBrand(e,t),i),i}function tools_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function bindEvents(e,t,i){for(const a of i)t.addEventListener(a,e[a].bind(e))}var ce=new WeakMap;class IdManager{constructor(){tools_classPrivateFieldInitSpec(this,ce,0)}get id(){var e,t;return`${g}${tools_classPrivateFieldSet(ce,this,(e=tools_classPrivateFieldGet(ce,this),t=e++,e)),t}`}}var he=new WeakMap,ue=new WeakMap,_e=new WeakMap,pe=new WeakSet;class ImageManager{constructor(){tools_classPrivateMethodInitSpec(this,pe);tools_classPrivateFieldInitSpec(this,he,getUuid());tools_classPrivateFieldInitSpec(this,ue,0);tools_classPrivateFieldInitSpec(this,_e,null)}static get _isSVGFittingCanvas(){const e=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),t=new Image;t.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>';return shadow(this,"_isSVGFittingCanvas",t.decode().then((()=>{e.drawImage(t,0,0,1,1,0,0,1,3);return 0===new Uint32Array(e.getImageData(0,0,1,1).data.buffer)[0]})))}async getFromFile(e){const{lastModified:t,name:i,size:a,type:s}=e;return tools_assertClassBrand(pe,this,_get).call(this,`${t}_${i}_${a}_${s}`,e)}async getFromUrl(e){return tools_assertClassBrand(pe,this,_get).call(this,e,e)}async getFromBlob(e,t){const i=await t;return tools_assertClassBrand(pe,this,_get).call(this,e,i)}async getFromId(e){tools_classPrivateFieldGet(_e,this)||tools_classPrivateFieldSet(_e,this,new Map);const t=tools_classPrivateFieldGet(_e,this).get(e);if(!t)return null;if(t.bitmap){t.refCounter+=1;return t}if(t.file)return this.getFromFile(t.file);if(t.blobPromise){const{blobPromise:e}=t;delete t.blobPromise;return this.getFromBlob(t.id,e)}return this.getFromUrl(t.url)}getFromCanvas(e,t){var i,a;tools_classPrivateFieldGet(_e,this)||tools_classPrivateFieldSet(_e,this,new Map);let s=tools_classPrivateFieldGet(_e,this).get(e);if(s?.bitmap){s.refCounter+=1;return s}const n=new OffscreenCanvas(t.width,t.height);n.getContext("2d").drawImage(t,0,0);s={bitmap:n.transferToImageBitmap(),id:`image_${tools_classPrivateFieldGet(he,this)}_${tools_classPrivateFieldSet(ue,this,(i=tools_classPrivateFieldGet(ue,this),a=i++,i)),a}`,refCounter:1,isSvg:!1};tools_classPrivateFieldGet(_e,this).set(e,s);tools_classPrivateFieldGet(_e,this).set(s.id,s);return s}getSvgUrl(e){const t=tools_classPrivateFieldGet(_e,this).get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){tools_classPrivateFieldGet(_e,this)||tools_classPrivateFieldSet(_e,this,new Map);const t=tools_classPrivateFieldGet(_e,this).get(e);if(!t)return;t.refCounter-=1;if(0!==t.refCounter)return;const{bitmap:i}=t;if(!t.url&&!t.file){const e=new OffscreenCanvas(i.width,i.height);e.getContext("bitmaprenderer").transferFromImageBitmap(i);t.blobPromise=e.convertToBlob()}i.close?.();t.bitmap=null}isValidId(e){return e.startsWith(`image_${tools_classPrivateFieldGet(he,this)}_`)}}se=ImageManager;async function _get(e,t){tools_classPrivateFieldGet(_e,this)||tools_classPrivateFieldSet(_e,this,new Map);let i=tools_classPrivateFieldGet(_e,this).get(e);if(null===i)return null;if(i?.bitmap){i.refCounter+=1;return i}try{var a,s;i||={bitmap:null,id:`image_${tools_classPrivateFieldGet(he,this)}_${tools_classPrivateFieldSet(ue,this,(a=tools_classPrivateFieldGet(ue,this),s=a++,a)),s}`,refCounter:0,isSvg:!1};let e;if("string"==typeof t){i.url=t;e=await fetchData(t,"blob")}else t instanceof File?e=i.file=t:t instanceof Blob&&(e=t);if("image/svg+xml"===e.type){const t=se._isSVGFittingCanvas,a=new FileReader,s=new Image,n=new Promise(((e,n)=>{s.onload=()=>{i.bitmap=s;i.isSvg=!0;e()};a.onload=async()=>{const e=i.svgUrl=a.result;s.src=await t?`${e}#svgView(preserveAspectRatio(none))`:e};s.onerror=a.onerror=n}));a.readAsDataURL(e);await n}else i.bitmap=await createImageBitmap(e);i.refCounter=1}catch(e){warn(e);i=null}tools_classPrivateFieldGet(_e,this).set(e,i);i&&tools_classPrivateFieldGet(_e,this).set(i.id,i);return i}var ge=new WeakMap,fe=new WeakMap,ve=new WeakMap,me=new WeakMap;class CommandManager{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;tools_classPrivateFieldInitSpec(this,ge,[]);tools_classPrivateFieldInitSpec(this,fe,!1);tools_classPrivateFieldInitSpec(this,ve,void 0);tools_classPrivateFieldInitSpec(this,me,-1);tools_classPrivateFieldSet(ve,this,e)}add(e){let{cmd:t,undo:i,post:a,mustExec:s,type:n=NaN,overwriteIfSameType:r=!1,keepUndo:o=!1}=e;s&&t();if(tools_classPrivateFieldGet(fe,this))return;const l={cmd:t,undo:i,post:a,type:n};if(-1===tools_classPrivateFieldGet(me,this)){tools_classPrivateFieldGet(ge,this).length>0&&(tools_classPrivateFieldGet(ge,this).length=0);tools_classPrivateFieldSet(me,this,0);tools_classPrivateFieldGet(ge,this).push(l);return}if(r&&tools_classPrivateFieldGet(ge,this)[tools_classPrivateFieldGet(me,this)].type===n){o&&(l.undo=tools_classPrivateFieldGet(ge,this)[tools_classPrivateFieldGet(me,this)].undo);tools_classPrivateFieldGet(ge,this)[tools_classPrivateFieldGet(me,this)]=l;return}const d=tools_classPrivateFieldGet(me,this)+1;if(d===tools_classPrivateFieldGet(ve,this))tools_classPrivateFieldGet(ge,this).splice(0,1);else{tools_classPrivateFieldSet(me,this,d);d<tools_classPrivateFieldGet(ge,this).length&&tools_classPrivateFieldGet(ge,this).splice(d)}tools_classPrivateFieldGet(ge,this).push(l)}undo(){if(-1===tools_classPrivateFieldGet(me,this))return;tools_classPrivateFieldSet(fe,this,!0);const{undo:e,post:t}=tools_classPrivateFieldGet(ge,this)[tools_classPrivateFieldGet(me,this)];e();t?.();tools_classPrivateFieldSet(fe,this,!1);tools_classPrivateFieldSet(me,this,tools_classPrivateFieldGet(me,this)-1)}redo(){if(tools_classPrivateFieldGet(me,this)<tools_classPrivateFieldGet(ge,this).length-1){tools_classPrivateFieldSet(me,this,tools_classPrivateFieldGet(me,this)+1);tools_classPrivateFieldSet(fe,this,!0);const{cmd:e,post:t}=tools_classPrivateFieldGet(ge,this)[tools_classPrivateFieldGet(me,this)];e();t?.();tools_classPrivateFieldSet(fe,this,!1)}}hasSomethingToUndo(){return-1!==tools_classPrivateFieldGet(me,this)}hasSomethingToRedo(){return tools_classPrivateFieldGet(me,this)<tools_classPrivateFieldGet(ge,this).length-1}cleanType(e){if(-1!==tools_classPrivateFieldGet(me,this)){for(let t=tools_classPrivateFieldGet(me,this);t>=0;t--)if(tools_classPrivateFieldGet(ge,this)[t].type!==e){tools_classPrivateFieldGet(ge,this).splice(t+1,tools_classPrivateFieldGet(me,this)-t);tools_classPrivateFieldSet(me,this,t);return}tools_classPrivateFieldGet(ge,this).length=0;tools_classPrivateFieldSet(me,this,-1)}}destroy(){tools_classPrivateFieldSet(ge,this,null)}reset(){tools_classPrivateFieldSet(ge,this,[]);tools_classPrivateFieldSet(me,this,-1);tools_classPrivateFieldSet(fe,this,!1)}}var we=new WeakSet;class KeyboardManager{constructor(e){tools_classPrivateMethodInitSpec(this,we);this.buffer=[];this.callbacks=new Map;this.allKeys=new Set;const{isMac:t}=util_FeatureTest.platform;for(const[i,a,s={}]of e)for(const e of i){const i=e.startsWith("mac+");if(t&&i){this.callbacks.set(e.slice(4),{callback:a,options:s});this.allKeys.add(e.split("+").at(-1))}else if(!t&&!i){this.callbacks.set(e,{callback:a,options:s});this.allKeys.add(e.split("+").at(-1))}}}exec(e,t){if(!this.allKeys.has(t.key))return;const i=this.callbacks.get(tools_assertClassBrand(we,this,_serialize).call(this,t));if(!i)return;const{callback:a,options:{bubbles:s=!1,args:n=[],checker:r=null}}=i;if(!r||r(e,t)){a.bind(e,...n,t)();s||stopEvent(t)}}}function _serialize(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("+");this.buffer.length=0;return t}class ColorManager{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);!function getColorValues(e){const t=document.createElement("span");t.style.visibility="hidden";t.style.colorScheme="only light";document.body.append(t);for(const i of e.keys()){t.style.color=i;const a=window.getComputedStyle(t).color;e.set(i,getRGB(a))}t.remove()}(e);return shadow(this,"_colors",e)}convert(e){const t=getRGB(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[e,i]of this._colors)if(i.every(((e,i)=>e===t[i])))return ColorManager._colorsMapping.get(e);return t}getHexCode(e){const t=this._colors.get(e);return t?Util.makeHexColor(...t):e}}tools_defineProperty(ColorManager,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));var Pe=new WeakMap,ye=new WeakMap,Fe=new WeakMap,be=new WeakMap,Se=new WeakMap,xe=new WeakMap,Ce=new WeakMap,Ae=new WeakMap,Ee=new WeakMap,ke=new WeakMap,Ie=new WeakMap,Me=new WeakMap,Be=new WeakMap,Ge=new WeakMap,Te=new WeakMap,De=new WeakMap,Le=new WeakMap,Re=new WeakMap,Ne=new WeakMap,Oe=new WeakMap,We=new WeakMap,je=new WeakMap,Ve=new WeakMap,He=new WeakMap,ze=new WeakMap,Ue=new WeakMap,$e=new WeakMap,qe=new WeakMap,Xe=new WeakMap,Ke=new WeakMap,Ye=new WeakMap,Ze=new WeakMap,Qe=new WeakMap,Je=new WeakMap,et=new WeakMap,tt=new WeakMap,it=new WeakMap,st=new WeakMap,nt=new WeakMap,rt=new WeakMap,ot=new WeakMap,lt=new WeakMap,dt=new WeakMap,ct=new WeakMap,ht=new WeakMap,ut=new WeakMap,_t=new WeakSet;class AnnotationEditorUIManager{static get _keyboardManager(){const e=AnnotationEditorUIManager.prototype,arrowChecker=e=>tools_classPrivateFieldGet(dt,e).contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&e.hasSomethingToControl(),textInputChecker=(e,t)=>{let{target:i}=t;if(i instanceof HTMLInputElement){const{type:e}=i;return"text"!==e&&"number"!==e}return!0},t=this.TRANSLATE_SMALL,i=this.TRANSLATE_BIG;return shadow(this,"_keyboardManager",new KeyboardManager([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:textInputChecker}],[["ctrl+z","mac+meta+z"],e.undo,{checker:textInputChecker}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:textInputChecker}],[["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:textInputChecker}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(e,t)=>{let{target:i}=t;return!(i instanceof HTMLButtonElement)&&tools_classPrivateFieldGet(dt,e).contains(i)&&!e.isEnterHandled}}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(e,t)=>{let{target:i}=t;return!(i instanceof HTMLButtonElement)&&tools_classPrivateFieldGet(dt,e).contains(document.activeElement)}}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-t,0],checker:arrowChecker}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:arrowChecker}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[t,0],checker:arrowChecker}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:arrowChecker}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-t],checker:arrowChecker}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:arrowChecker}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,t],checker:arrowChecker}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:arrowChecker}]]))}constructor(e,t,i,a,s,n,r,o,l,d,c,h,u,_,p,g){tools_classPrivateMethodInitSpec(this,_t);tools_classPrivateFieldInitSpec(this,Pe,new AbortController);tools_classPrivateFieldInitSpec(this,ye,null);tools_classPrivateFieldInitSpec(this,Fe,new Map);tools_classPrivateFieldInitSpec(this,be,new Map);tools_classPrivateFieldInitSpec(this,Se,null);tools_classPrivateFieldInitSpec(this,xe,null);tools_classPrivateFieldInitSpec(this,Ce,null);tools_classPrivateFieldInitSpec(this,Ae,new CommandManager);tools_classPrivateFieldInitSpec(this,Ee,null);tools_classPrivateFieldInitSpec(this,ke,null);tools_classPrivateFieldInitSpec(this,Ie,null);tools_classPrivateFieldInitSpec(this,Me,0);tools_classPrivateFieldInitSpec(this,Be,new Set);tools_classPrivateFieldInitSpec(this,Ge,null);tools_classPrivateFieldInitSpec(this,Te,null);tools_classPrivateFieldInitSpec(this,De,new Set);tools_defineProperty(this,"_editorUndoBar",null);tools_classPrivateFieldInitSpec(this,Le,!1);tools_classPrivateFieldInitSpec(this,Re,!1);tools_classPrivateFieldInitSpec(this,Ne,!1);tools_classPrivateFieldInitSpec(this,Oe,null);tools_classPrivateFieldInitSpec(this,We,null);tools_classPrivateFieldInitSpec(this,je,null);tools_classPrivateFieldInitSpec(this,Ve,null);tools_classPrivateFieldInitSpec(this,He,!1);tools_classPrivateFieldInitSpec(this,ze,null);tools_classPrivateFieldInitSpec(this,Ue,new IdManager);tools_classPrivateFieldInitSpec(this,$e,!1);tools_classPrivateFieldInitSpec(this,qe,!1);tools_classPrivateFieldInitSpec(this,Xe,null);tools_classPrivateFieldInitSpec(this,Ke,null);tools_classPrivateFieldInitSpec(this,Ye,null);tools_classPrivateFieldInitSpec(this,Ze,null);tools_classPrivateFieldInitSpec(this,Qe,null);tools_classPrivateFieldInitSpec(this,Je,f.NONE);tools_classPrivateFieldInitSpec(this,et,new Set);tools_classPrivateFieldInitSpec(this,tt,null);tools_classPrivateFieldInitSpec(this,it,null);tools_classPrivateFieldInitSpec(this,st,null);tools_classPrivateFieldInitSpec(this,nt,null);tools_classPrivateFieldInitSpec(this,rt,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});tools_classPrivateFieldInitSpec(this,ot,[0,0]);tools_classPrivateFieldInitSpec(this,lt,null);tools_classPrivateFieldInitSpec(this,dt,null);tools_classPrivateFieldInitSpec(this,ct,null);tools_classPrivateFieldInitSpec(this,ht,null);tools_classPrivateFieldInitSpec(this,ut,null);const v=this._signal=tools_classPrivateFieldGet(Pe,this).signal;tools_classPrivateFieldSet(dt,this,e);tools_classPrivateFieldSet(ct,this,t);tools_classPrivateFieldSet(ht,this,i);tools_classPrivateFieldSet(Se,this,a);tools_classPrivateFieldSet(Ee,this,s);tools_classPrivateFieldSet(it,this,n);this._eventBus=r;r._on("editingaction",this.onEditingAction.bind(this),{signal:v});r._on("pagechanging",this.onPageChanging.bind(this),{signal:v});r._on("scalechanging",this.onScaleChanging.bind(this),{signal:v});r._on("rotationchanging",this.onRotationChanging.bind(this),{signal:v});r._on("setpreference",this.onSetPreference.bind(this),{signal:v});r._on("switchannotationeditorparams",(e=>this.updateParams(e.type,e.value)),{signal:v});tools_assertClassBrand(_t,this,_addSelectionListener).call(this);tools_assertClassBrand(_t,this,_addDragAndDropListeners).call(this);tools_assertClassBrand(_t,this,_addKeyboardManager).call(this);tools_classPrivateFieldSet(xe,this,o.annotationStorage);tools_classPrivateFieldSet(Oe,this,o.filterFactory);tools_classPrivateFieldSet(st,this,l);tools_classPrivateFieldSet(Ve,this,d||null);tools_classPrivateFieldSet(Le,this,c);tools_classPrivateFieldSet(Re,this,h);tools_classPrivateFieldSet(Ne,this,u);tools_classPrivateFieldSet(Qe,this,_||null);this.viewParameters={realScale:PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0};this.isShiftKeyDown=!1;this._editorUndoBar=p||null;this._supportsPinchToZoom=!1!==g}destroy(){tools_classPrivateFieldGet(ut,this)?.resolve();tools_classPrivateFieldSet(ut,this,null);tools_classPrivateFieldGet(Pe,this)?.abort();tools_classPrivateFieldSet(Pe,this,null);this._signal=null;for(const e of tools_classPrivateFieldGet(be,this).values())e.destroy();tools_classPrivateFieldGet(be,this).clear();tools_classPrivateFieldGet(Fe,this).clear();tools_classPrivateFieldGet(De,this).clear();tools_classPrivateFieldGet(Ze,this)?.clear();tools_classPrivateFieldSet(ye,this,null);tools_classPrivateFieldGet(et,this).clear();tools_classPrivateFieldGet(Ae,this).destroy();tools_classPrivateFieldGet(Se,this)?.destroy();tools_classPrivateFieldGet(Ee,this)?.destroy();tools_classPrivateFieldGet(it,this)?.destroy();tools_classPrivateFieldGet(ze,this)?.hide();tools_classPrivateFieldSet(ze,this,null);tools_classPrivateFieldGet(Ye,this)?.destroy();tools_classPrivateFieldSet(Ye,this,null);if(tools_classPrivateFieldGet(We,this)){clearTimeout(tools_classPrivateFieldGet(We,this));tools_classPrivateFieldSet(We,this,null)}if(tools_classPrivateFieldGet(lt,this)){clearTimeout(tools_classPrivateFieldGet(lt,this));tools_classPrivateFieldSet(lt,this,null)}this._editorUndoBar?.destroy()}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return tools_classPrivateFieldGet(Qe,this)}get useNewAltTextFlow(){return tools_classPrivateFieldGet(Re,this)}get useNewAltTextWhenAddingImage(){return tools_classPrivateFieldGet(Ne,this)}get hcmFilter(){return shadow(this,"hcmFilter",tools_classPrivateFieldGet(st,this)?tools_classPrivateFieldGet(Oe,this).addHCMFilter(tools_classPrivateFieldGet(st,this).foreground,tools_classPrivateFieldGet(st,this).background):"none")}get direction(){return shadow(this,"direction",getComputedStyle(tools_classPrivateFieldGet(dt,this)).direction)}get _highlightColors(){return shadow(this,"_highlightColors",tools_classPrivateFieldGet(Ve,this)?new Map(tools_classPrivateFieldGet(Ve,this).split(",").map((e=>{(e=e.split("=").map((e=>e.trim())))[1]=e[1].toUpperCase();return e}))):null)}get highlightColors(){const{_highlightColors:e}=this;if(!e)return shadow(this,"highlightColors",null);const t=new Map,i=!!tools_classPrivateFieldGet(st,this);for(const[a,s]of e){const e=a.endsWith("_HCM");i&&e?t.set(a.replace("_HCM",""),s):i||e||t.set(a,s)}return shadow(this,"highlightColors",t)}get highlightColorNames(){return shadow(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){if(e){this.unselectAll();this.disableUserSelect(!0)}else this.disableUserSelect(!1);tools_classPrivateFieldSet(Ie,this,e)}setMainHighlightColorPicker(e){tools_classPrivateFieldSet(Ye,this,e)}editAltText(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];tools_classPrivateFieldGet(Se,this)?.editAltText(this,e,t)}hasCommentManager(){return!!tools_classPrivateFieldGet(Ee,this)}editComment(e,t){tools_classPrivateFieldGet(Ee,this)?.open(this,e,t)}getSignature(e){tools_classPrivateFieldGet(it,this)?.getSignature({uiManager:this,editor:e})}get signatureManager(){return tools_classPrivateFieldGet(it,this)}switchToMode(e,t){this._eventBus.on("annotationeditormodechanged",t,{once:!0,signal:this._signal});this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch("setpreference",{source:this,name:e,value:t})}onSetPreference(e){let{name:t,value:i}=e;if("enableNewAltTextWhenAddingImage"===t)tools_classPrivateFieldSet(Ne,this,i)}onPageChanging(e){let{pageNumber:t}=e;tools_classPrivateFieldSet(Me,this,t-1)}focusMainContainer(){tools_classPrivateFieldGet(dt,this).focus()}findParent(e,t){for(const i of tools_classPrivateFieldGet(be,this).values()){const{x:a,y:s,width:n,height:r}=i.div.getBoundingClientRect();if(e>=a&&e<=a+n&&t>=s&&t<=s+r)return i}return null}disableUserSelect(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];tools_classPrivateFieldGet(ct,this).classList.toggle("noUserSelect",e)}addShouldRescale(e){tools_classPrivateFieldGet(De,this).add(e)}removeShouldRescale(e){tools_classPrivateFieldGet(De,this).delete(e)}onScaleChanging(e){let{scale:t}=e;this.commitOrRemove();this.viewParameters.realScale=t*PixelsPerInch.PDF_TO_CSS_UNITS;for(const e of tools_classPrivateFieldGet(De,this))e.onScaleChanging();tools_classPrivateFieldGet(Ie,this)?.onScaleChanging()}onRotationChanging(e){let{pagesRotation:t}=e;this.commitOrRemove();this.viewParameters.rotation=t}highlightSelection(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const t=document.getSelection();if(!t||t.isCollapsed)return;const{anchorNode:i,anchorOffset:a,focusNode:s,focusOffset:n}=t,r=t.toString(),o=tools_assertClassBrand(_t,this,_getAnchorElementForSelection).call(this,t).closest(".textLayer"),l=this.getSelectionBoxes(o);if(!l)return;t.empty();const d=tools_assertClassBrand(_t,this,_getLayerForTextLayer).call(this,o),c=tools_classPrivateFieldGet(Je,this)===f.NONE,callback=()=>{d?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:l,anchorNode:i,anchorOffset:a,focusNode:s,focusOffset:n,text:r});c&&this.showAllEditors("highlight",!0,!0)};c?this.switchToMode(f.HIGHLIGHT,callback):callback()}addToAnnotationStorage(e){e.isEmpty()||!tools_classPrivateFieldGet(xe,this)||tools_classPrivateFieldGet(xe,this).has(e.id)||tools_classPrivateFieldGet(xe,this).setValue(e.id,e)}a11yAlert(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=tools_classPrivateFieldGet(ht,this);if(i){i.setAttribute("data-l10n-id",e);t?i.setAttribute("data-l10n-args",JSON.stringify(t)):i.removeAttribute("data-l10n-args")}}blur(){this.isShiftKeyDown=!1;if(tools_classPrivateFieldGet(He,this)){tools_classPrivateFieldSet(He,this,!1);tools_assertClassBrand(_t,this,_onSelectEnd).call(this,"main_toolbar")}if(!this.hasSelection)return;const{activeElement:e}=document;for(const t of tools_classPrivateFieldGet(et,this))if(t.div.contains(e)){tools_classPrivateFieldSet(Ke,this,[t,e]);t._focusEventsAllowed=!1;break}}focus(){if(!tools_classPrivateFieldGet(Ke,this))return;const[e,t]=tools_classPrivateFieldGet(Ke,this);tools_classPrivateFieldSet(Ke,this,null);t.addEventListener("focusin",(()=>{e._focusEventsAllowed=!0}),{once:!0,signal:this._signal});t.focus()}addEditListeners(){tools_assertClassBrand(_t,this,_addKeyboardManager).call(this);tools_assertClassBrand(_t,this,_addCopyPasteListeners).call(this)}removeEditListeners(){tools_assertClassBrand(_t,this,_removeKeyboardManager).call(this);tools_assertClassBrand(_t,this,_removeCopyPasteListeners).call(this)}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const i of tools_classPrivateFieldGet(Te,this))if(i.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect="copy";e.preventDefault();return}}drop(e){for(const t of e.dataTransfer.items)for(const i of tools_classPrivateFieldGet(Te,this))if(i.isHandlingMimeForPasting(t.type)){i.paste(t,this.currentLayer);e.preventDefault();return}}copy(e){e.preventDefault();tools_classPrivateFieldGet(ye,this)?.commitOrRemove();if(!this.hasSelection)return;const t=[];for(const e of tools_classPrivateFieldGet(et,this)){const i=e.serialize(!0);i&&t.push(i)}0!==t.length&&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 e of t.items)for(const t of tools_classPrivateFieldGet(Te,this))if(t.isHandlingMimeForPasting(e.type)){t.paste(e,this.currentLayer);return}const i=t.getData("application/pdfjs");await this.addSerializedEditor(i)}async addSerializedEditor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(!e)return;try{"string"==typeof e&&(e=JSON.parse(e))}catch(e){warn(`paste: "${e.message}".`);return}if(!Array.isArray(e))return;const s=tools_classPrivateFieldGet(Je,this);t&&s===f.NONE&&this.updateMode(f.FREETEXT);this.unselectAll();try{const t=[];for(const s of e){const e=void 0===s.pageIndex,n=a||e?this.currentLayer:this.getLayer(s.pageIndex),r=await n.deserialize(s);if(!r)return;r.doNotMove=i;t.push(r)}const cmd=()=>{for(const e of t)tools_assertClassBrand(_t,this,_addEditorToLayer).call(this,e);tools_assertClassBrand(_t,this,_selectEditors).call(this,t)},undo=()=>{for(const e of t)e.remove()};this.addCommands({cmd,undo,mustExec:!0})}catch(e){warn(`paste: "${e.message}".`)}t&&s!==tools_classPrivateFieldGet(Je,this)&&this.updateMode(s)}keydown(e){this.isShiftKeyDown||"Shift"!==e.key||(this.isShiftKeyDown=!0);tools_classPrivateFieldGet(Je,this)===f.NONE||this.isEditorHandlingKeyboard||AnnotationEditorUIManager._keyboardManager.exec(this,e)}keyup(e){if(this.isShiftKeyDown&&"Shift"===e.key){this.isShiftKeyDown=!1;if(tools_classPrivateFieldGet(He,this)){tools_classPrivateFieldSet(He,this,!1);tools_assertClassBrand(_t,this,_onSelectEnd).call(this,"main_toolbar")}}}onEditingAction(e){let{name:t}=e;switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu")}}setEditingState(e){if(e){tools_assertClassBrand(_t,this,_addFocusManager).call(this);tools_assertClassBrand(_t,this,_addCopyPasteListeners).call(this);tools_assertClassBrand(_t,this,_dispatchUpdateStates).call(this,{isEditing:tools_classPrivateFieldGet(Je,this)!==f.NONE,isEmpty:tools_assertClassBrand(_t,this,_isEmpty).call(this),hasSomethingToUndo:tools_classPrivateFieldGet(Ae,this).hasSomethingToUndo(),hasSomethingToRedo:tools_classPrivateFieldGet(Ae,this).hasSomethingToRedo(),hasSelectedEditor:!1})}else{tools_assertClassBrand(_t,this,_removeFocusManager).call(this);tools_assertClassBrand(_t,this,_removeCopyPasteListeners).call(this);tools_assertClassBrand(_t,this,_dispatchUpdateStates).call(this,{isEditing:!1});this.disableUserSelect(!1)}}registerEditorTypes(e){if(!tools_classPrivateFieldGet(Te,this)){tools_classPrivateFieldSet(Te,this,e);for(const e of tools_classPrivateFieldGet(Te,this))tools_assertClassBrand(_t,this,_dispatchUpdateUI).call(this,e.defaultPropertiesToUpdate)}}getId(){return tools_classPrivateFieldGet(Ue,this).id}get currentLayer(){return tools_classPrivateFieldGet(be,this).get(tools_classPrivateFieldGet(Me,this))}getLayer(e){return tools_classPrivateFieldGet(be,this).get(e)}get currentPageIndex(){return tools_classPrivateFieldGet(Me,this)}addLayer(e){tools_classPrivateFieldGet(be,this).set(e.pageIndex,e);tools_classPrivateFieldGet($e,this)?e.enable():e.disable()}removeLayer(e){tools_classPrivateFieldGet(be,this).delete(e.pageIndex)}async updateMode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(tools_classPrivateFieldGet(Je,this)!==e){if(tools_classPrivateFieldGet(ut,this)){await tools_classPrivateFieldGet(ut,this).promise;if(!tools_classPrivateFieldGet(ut,this))return}tools_classPrivateFieldSet(ut,this,Promise.withResolvers());tools_classPrivateFieldGet(Ie,this)?.commitOrRemove();tools_classPrivateFieldSet(Je,this,e);if(e!==f.NONE){e===f.SIGNATURE&&await(tools_classPrivateFieldGet(it,this)?.loadSignatures());this.setEditingState(!0);await tools_assertClassBrand(_t,this,_enableAll).call(this);this.unselectAll();for(const t of tools_classPrivateFieldGet(be,this).values())t.updateMode(e);if(t){for(const e of tools_classPrivateFieldGet(Fe,this).values())if(e.annotationElementId===t||e.id===t){this.setSelected(e);s?e.editComment():a&&e.enterInEditMode()}else e.unselect();tools_classPrivateFieldGet(ut,this).resolve()}else{i&&this.addNewEditorFromKeyboard();tools_classPrivateFieldGet(ut,this).resolve()}}else{this.setEditingState(!1);tools_assertClassBrand(_t,this,_disableAll).call(this);this._editorUndoBar?.hide();tools_classPrivateFieldGet(ut,this).resolve()}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==tools_classPrivateFieldGet(Je,this)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,t){if(tools_classPrivateFieldGet(Te,this)){switch(e){case v.CREATE:this.currentLayer.addNewEditor(t);return;case v.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}});(tools_classPrivateFieldGet(nt,this)||tools_classPrivateFieldSet(nt,this,new Map)).set(e,t);this.showAllEditors("highlight",t)}if(this.hasSelection)for(const i of tools_classPrivateFieldGet(et,this))i.updateParams(e,t);else for(const i of tools_classPrivateFieldGet(Te,this))i.updateDefaultParams(e,t)}}showAllEditors(e,t){for(const i of tools_classPrivateFieldGet(Fe,this).values())i.editorType===e&&i.show(t);(tools_classPrivateFieldGet(nt,this)?.get(v.HIGHLIGHT_SHOW_ALL)??!0)!==t&&tools_assertClassBrand(_t,this,_dispatchUpdateUI).call(this,[[v.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(tools_classPrivateFieldGet(qe,this)!==e){tools_classPrivateFieldSet(qe,this,e);for(const t of tools_classPrivateFieldGet(be,this).values()){e?t.disableClick():t.enableClick();t.div.classList.toggle("waiting",e)}}}getEditors(e){const t=[];for(const i of tools_classPrivateFieldGet(Fe,this).values())i.pageIndex===e&&t.push(i);return t}getEditor(e){return tools_classPrivateFieldGet(Fe,this).get(e)}addEditor(e){tools_classPrivateFieldGet(Fe,this).set(e.id,e)}removeEditor(e){if(e.div.contains(document.activeElement)){tools_classPrivateFieldGet(We,this)&&clearTimeout(tools_classPrivateFieldGet(We,this));tools_classPrivateFieldSet(We,this,setTimeout((()=>{this.focusMainContainer();tools_classPrivateFieldSet(We,this,null)}),0))}tools_classPrivateFieldGet(Fe,this).delete(e.id);e.annotationElementId&&tools_classPrivateFieldGet(Ze,this)?.delete(e.annotationElementId);this.unselect(e);e.annotationElementId&&tools_classPrivateFieldGet(Be,this).has(e.annotationElementId)||tools_classPrivateFieldGet(xe,this)?.remove(e.id)}addDeletedAnnotationElement(e){tools_classPrivateFieldGet(Be,this).add(e.annotationElementId);this.addChangedExistingAnnotation(e);e.deleted=!0}isDeletedAnnotationElement(e){return tools_classPrivateFieldGet(Be,this).has(e)}removeDeletedAnnotationElement(e){tools_classPrivateFieldGet(Be,this).delete(e.annotationElementId);this.removeChangedExistingAnnotation(e);e.deleted=!1}setActiveEditor(e){if(tools_classPrivateFieldGet(ye,this)!==e){tools_classPrivateFieldSet(ye,this,e);e&&tools_assertClassBrand(_t,this,_dispatchUpdateUI).call(this,e.propertiesToUpdate)}}updateUI(e){(function tools_classPrivateGetter(e,t,i){return i(tools_assertClassBrand(e,t))})(_t,this,_get_lastSelectedEditor)===e&&tools_assertClassBrand(_t,this,_dispatchUpdateUI).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){tools_assertClassBrand(_t,this,_dispatchUpdateUI).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(tools_classPrivateFieldGet(et,this).has(e)){tools_classPrivateFieldGet(et,this).delete(e);e.unselect();tools_assertClassBrand(_t,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:this.hasSelection})}else{tools_classPrivateFieldGet(et,this).add(e);e.select();tools_assertClassBrand(_t,this,_dispatchUpdateUI).call(this,e.propertiesToUpdate);tools_assertClassBrand(_t,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:!0})}}setSelected(e){this.updateToolbar({mode:e.mode,editId:e.id});tools_classPrivateFieldGet(Ie,this)?.commitOrRemove();for(const t of tools_classPrivateFieldGet(et,this))t!==e&&t.unselect();tools_classPrivateFieldGet(et,this).clear();tools_classPrivateFieldGet(et,this).add(e);e.select();tools_assertClassBrand(_t,this,_dispatchUpdateUI).call(this,e.propertiesToUpdate);tools_assertClassBrand(_t,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:!0})}isSelected(e){return tools_classPrivateFieldGet(et,this).has(e)}get firstSelectedEditor(){return tools_classPrivateFieldGet(et,this).values().next().value}unselect(e){e.unselect();tools_classPrivateFieldGet(et,this).delete(e);tools_assertClassBrand(_t,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==tools_classPrivateFieldGet(et,this).size}get isEnterHandled(){return 1===tools_classPrivateFieldGet(et,this).size&&this.firstSelectedEditor.isEnterHandled}undo(){tools_classPrivateFieldGet(Ae,this).undo();tools_assertClassBrand(_t,this,_dispatchUpdateStates).call(this,{hasSomethingToUndo:tools_classPrivateFieldGet(Ae,this).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:tools_assertClassBrand(_t,this,_isEmpty).call(this)});this._editorUndoBar?.hide()}redo(){tools_classPrivateFieldGet(Ae,this).redo();tools_assertClassBrand(_t,this,_dispatchUpdateStates).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:tools_classPrivateFieldGet(Ae,this).hasSomethingToRedo(),isEmpty:tools_assertClassBrand(_t,this,_isEmpty).call(this)})}addCommands(e){tools_classPrivateFieldGet(Ae,this).add(e);tools_assertClassBrand(_t,this,_dispatchUpdateStates).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:tools_assertClassBrand(_t,this,_isEmpty).call(this)})}cleanUndoStack(e){tools_classPrivateFieldGet(Ae,this).cleanType(e)}delete(){this.commitOrRemove();const e=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const t=e?[e]:[...tools_classPrivateFieldGet(et,this)],undo=()=>{for(const e of t)tools_assertClassBrand(_t,this,_addEditorToLayer).call(this,e)};this.addCommands({cmd:()=>{this._editorUndoBar?.show(undo,1===t.length?t[0].editorType:t.length);for(const e of t)e.remove()},undo,mustExec:!0})}commitOrRemove(){tools_classPrivateFieldGet(ye,this)?.commitOrRemove()}hasSomethingToControl(){return tools_classPrivateFieldGet(ye,this)||this.hasSelection}selectAll(){for(const e of tools_classPrivateFieldGet(et,this))e.commit();tools_assertClassBrand(_t,this,_selectEditors).call(this,tools_classPrivateFieldGet(Fe,this).values())}unselectAll(){if(tools_classPrivateFieldGet(ye,this)){tools_classPrivateFieldGet(ye,this).commitOrRemove();if(tools_classPrivateFieldGet(Je,this)!==f.NONE)return}if(!tools_classPrivateFieldGet(Ie,this)?.commitOrRemove()&&this.hasSelection){for(const e of tools_classPrivateFieldGet(et,this))e.unselect();tools_classPrivateFieldGet(et,this).clear();tools_assertClassBrand(_t,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2]||this.commitOrRemove();if(!this.hasSelection)return;tools_classPrivateFieldGet(ot,this)[0]+=e;tools_classPrivateFieldGet(ot,this)[1]+=t;const[i,a]=tools_classPrivateFieldGet(ot,this),s=[...tools_classPrivateFieldGet(et,this)];tools_classPrivateFieldGet(lt,this)&&clearTimeout(tools_classPrivateFieldGet(lt,this));tools_classPrivateFieldSet(lt,this,setTimeout((()=>{tools_classPrivateFieldSet(lt,this,null);tools_classPrivateFieldGet(ot,this)[0]=tools_classPrivateFieldGet(ot,this)[1]=0;this.addCommands({cmd:()=>{for(const e of s)if(tools_classPrivateFieldGet(Fe,this).has(e.id)){e.translateInPage(i,a);e.translationDone()}},undo:()=>{for(const e of s)if(tools_classPrivateFieldGet(Fe,this).has(e.id)){e.translateInPage(-i,-a);e.translationDone()}},mustExec:!1})}),1e3));for(const i of s){i.translateInPage(e,t);i.translationDone()}}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0);tools_classPrivateFieldSet(Ge,this,new Map);for(const e of tools_classPrivateFieldGet(et,this))tools_classPrivateFieldGet(Ge,this).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!tools_classPrivateFieldGet(Ge,this))return!1;this.disableUserSelect(!1);const e=tools_classPrivateFieldGet(Ge,this);tools_classPrivateFieldSet(Ge,this,null);let t=!1;for(const[{x:i,y:a,pageIndex:s},n]of e){n.newX=i;n.newY=a;n.newPageIndex=s;t||=i!==n.savedX||a!==n.savedY||s!==n.savedPageIndex}if(!t)return!1;const move=(e,t,i,a)=>{if(tools_classPrivateFieldGet(Fe,this).has(e.id)){const s=tools_classPrivateFieldGet(be,this).get(a);if(s)e._setParentAndPosition(s,t,i);else{e.pageIndex=a;e.x=t;e.y=i}}};this.addCommands({cmd:()=>{for(const[t,{newX:i,newY:a,newPageIndex:s,savedX:n,savedY:r,savedPageIndex:o}]of e){move(t,i,a,s);this._eventBus?.dispatch("annotation-editor-event",{source:t,type:"moved",page:s+1,editorType:t.constructor.name,previousValue:{x:n,y:r,page:o+1},value:{x:i,y:a,page:s+1}})}},undo:()=>{for(const[t,{savedX:i,savedY:a,savedPageIndex:s}]of e)move(t,i,a,s)},mustExec:!0});return!0}dragSelectedEditors(e,t){if(tools_classPrivateFieldGet(Ge,this))for(const i of tools_classPrivateFieldGet(Ge,this).keys())i.drag(e,t)}rebuild(e){if(null===e.parent){const t=this.getLayer(e.pageIndex);if(t){t.changeParent(e);t.addOrRebuild(e)}else{this.addEditor(e);this.addToAnnotationStorage(e);e.rebuild()}}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||1===tools_classPrivateFieldGet(et,this).size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return tools_classPrivateFieldGet(ye,this)===e}getActive(){return tools_classPrivateFieldGet(ye,this)}getMode(){return tools_classPrivateFieldGet(Je,this)}get imageManager(){return shadow(this,"imageManager",new ImageManager)}removeEditors(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>!0,t=!1;tools_classPrivateFieldGet(Fe,this).forEach((i=>{if(i?.serialize()&&e(i.serialize())){i.remove();t=!0}}));if(t){tools_assertClassBrand(_t,this,_dispatchUpdateStates).call(this,{hasSomethingToUndo:!1,hasSomethingToRedo:!1,isEmpty:tools_assertClassBrand(_t,this,_isEmpty).call(this)});tools_classPrivateFieldGet(Ae,this).reset()}}getSelectionBoxes(e){if(!e)return null;const t=document.getSelection();for(let i=0,a=t.rangeCount;i<a;i++)if(!e.contains(t.getRangeAt(i).commonAncestorContainer))return null;const{x:i,y:a,width:s,height:n}=e.getBoundingClientRect();let r;switch(e.getAttribute("data-main-rotation")){case"90":r=(e,t,r,o)=>({x:(t-a)/n,y:1-(e+r-i)/s,width:o/n,height:r/s});break;case"180":r=(e,t,r,o)=>({x:1-(e+r-i)/s,y:1-(t+o-a)/n,width:r/s,height:o/n});break;case"270":r=(e,t,r,o)=>({x:1-(t+o-a)/n,y:(e-i)/s,width:o/n,height:r/s});break;default:r=(e,t,r,o)=>({x:(e-i)/s,y:(t-a)/n,width:r/s,height:o/n})}const o=[];for(let e=0,i=t.rangeCount;e<i;e++){const i=t.getRangeAt(e);if(!i.collapsed)for(const{x:e,y:t,width:a,height:s}of i.getClientRects())0!==a&&0!==s&&o.push(r(e,t,a,s))}return 0===o.length?null:o}addChangedExistingAnnotation(e){let{annotationElementId:t,id:i}=e;(tools_classPrivateFieldGet(Ce,this)||tools_classPrivateFieldSet(Ce,this,new Map)).set(t,i)}removeChangedExistingAnnotation(e){let{annotationElementId:t}=e;tools_classPrivateFieldGet(Ce,this)?.delete(t)}renderAnnotationElement(e){const t=tools_classPrivateFieldGet(Ce,this)?.get(e.data.id);if(!t)return;const i=tools_classPrivateFieldGet(xe,this).getRawValue(t);i&&(tools_classPrivateFieldGet(Je,this)!==f.NONE||i.hasBeenModified)&&i.renderAnnotationElement(e)}setMissingCanvas(e,t,i){const a=tools_classPrivateFieldGet(Ze,this)?.get(e);if(a){a.setCanvas(t,i);tools_classPrivateFieldGet(Ze,this).delete(e)}}addMissingCanvas(e,t){(tools_classPrivateFieldGet(Ze,this)||tools_classPrivateFieldSet(Ze,this,new Map)).set(e,t)}}function _getAnchorElementForSelection(e){let{anchorNode:t}=e;return t.nodeType===Node.TEXT_NODE?t.parentElement:t}function _getLayerForTextLayer(e){const{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(const t of tools_classPrivateFieldGet(be,this).values())if(t.hasTextLayer(e))return t;return null}function _displayHighlightToolbar(){const e=document.getSelection();if(!e||e.isCollapsed)return;const t=tools_assertClassBrand(_t,this,_getAnchorElementForSelection).call(this,e).closest(".textLayer"),i=this.getSelectionBoxes(t);if(i){tools_classPrivateFieldGet(ze,this)||tools_classPrivateFieldSet(ze,this,new HighlightToolbar(this));tools_classPrivateFieldGet(ze,this).show(t,i,"ltr"===this.direction)}}function _selectionChange(){const e=document.getSelection();if(!e||e.isCollapsed){if(tools_classPrivateFieldGet(tt,this)){tools_classPrivateFieldGet(ze,this)?.hide();tools_classPrivateFieldSet(tt,this,null);tools_assertClassBrand(_t,this,_dispatchUpdateStates).call(this,{hasSelectedText:!1})}return}const{anchorNode:t}=e;if(t===tools_classPrivateFieldGet(tt,this))return;const i=tools_assertClassBrand(_t,this,_getAnchorElementForSelection).call(this,e).closest(".textLayer");if(i){tools_classPrivateFieldGet(ze,this)?.hide();tools_classPrivateFieldSet(tt,this,t);tools_assertClassBrand(_t,this,_dispatchUpdateStates).call(this,{hasSelectedText:!0});if(tools_classPrivateFieldGet(Je,this)===f.HIGHLIGHT||tools_classPrivateFieldGet(Je,this)===f.NONE){tools_classPrivateFieldGet(Je,this)===f.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0);tools_classPrivateFieldSet(He,this,this.isShiftKeyDown);if(!this.isShiftKeyDown){const e=tools_classPrivateFieldGet(Je,this)===f.HIGHLIGHT?tools_assertClassBrand(_t,this,_getLayerForTextLayer).call(this,i):null;e?.toggleDrawing();const t=new AbortController,a=this.combinedSignal(t),pointerup=i=>{if("pointerup"!==i.type||0===i.button){t.abort();e?.toggleDrawing(!0);"pointerup"===i.type&&tools_assertClassBrand(_t,this,_onSelectEnd).call(this,"main_toolbar")}};window.addEventListener("pointerup",pointerup,{signal:a});window.addEventListener("blur",pointerup,{signal:a})}}}else if(tools_classPrivateFieldGet(tt,this)){tools_classPrivateFieldGet(ze,this)?.hide();tools_classPrivateFieldSet(tt,this,null);tools_assertClassBrand(_t,this,_dispatchUpdateStates).call(this,{hasSelectedText:!1})}}function _onSelectEnd(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";tools_classPrivateFieldGet(Je,this)===f.HIGHLIGHT?this.highlightSelection(e):tools_classPrivateFieldGet(Le,this)&&tools_assertClassBrand(_t,this,_displayHighlightToolbar).call(this)}function _addSelectionListener(){document.addEventListener("selectionchange",tools_assertClassBrand(_t,this,_selectionChange).bind(this),{signal:this._signal})}function _addFocusManager(){if(tools_classPrivateFieldGet(je,this))return;tools_classPrivateFieldSet(je,this,new AbortController);const e=this.combinedSignal(tools_classPrivateFieldGet(je,this));window.addEventListener("focus",this.focus.bind(this),{signal:e});window.addEventListener("blur",this.blur.bind(this),{signal:e})}function _removeFocusManager(){tools_classPrivateFieldGet(je,this)?.abort();tools_classPrivateFieldSet(je,this,null)}function _addKeyboardManager(){if(tools_classPrivateFieldGet(Xe,this))return;tools_classPrivateFieldSet(Xe,this,new AbortController);const e=this.combinedSignal(tools_classPrivateFieldGet(Xe,this));window.addEventListener("keydown",this.keydown.bind(this),{signal:e});window.addEventListener("keyup",this.keyup.bind(this),{signal:e})}function _removeKeyboardManager(){tools_classPrivateFieldGet(Xe,this)?.abort();tools_classPrivateFieldSet(Xe,this,null)}function _addCopyPasteListeners(){if(tools_classPrivateFieldGet(ke,this))return;tools_classPrivateFieldSet(ke,this,new AbortController);const e=this.combinedSignal(tools_classPrivateFieldGet(ke,this));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})}function _removeCopyPasteListeners(){tools_classPrivateFieldGet(ke,this)?.abort();tools_classPrivateFieldSet(ke,this,null)}function _addDragAndDropListeners(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e});document.addEventListener("drop",this.drop.bind(this),{signal:e})}function _dispatchUpdateStates(e){if(Object.entries(e).some((e=>{let[t,i]=e;return tools_classPrivateFieldGet(rt,this)[t]!==i}))){this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(tools_classPrivateFieldGet(rt,this),e)});tools_classPrivateFieldGet(Je,this)===f.HIGHLIGHT&&!1===e.hasSelectedEditor&&tools_assertClassBrand(_t,this,_dispatchUpdateUI).call(this,[[v.HIGHLIGHT_FREE,!0]])}}function _dispatchUpdateUI(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}async function _enableAll(){if(!tools_classPrivateFieldGet($e,this)){tools_classPrivateFieldSet($e,this,!0);const e=[];for(const t of tools_classPrivateFieldGet(be,this).values())e.push(t.enable());await Promise.all(e);for(const e of tools_classPrivateFieldGet(Fe,this).values())e.enable()}}function _disableAll(){this.unselectAll();if(tools_classPrivateFieldGet($e,this)){tools_classPrivateFieldSet($e,this,!1);for(const e of tools_classPrivateFieldGet(be,this).values())e.disable();for(const e of tools_classPrivateFieldGet(Fe,this).values())e.disable()}}function _addEditorToLayer(e){const t=tools_classPrivateFieldGet(be,this).get(e.pageIndex);if(t)t.addOrRebuild(e);else{this.addEditor(e);this.addToAnnotationStorage(e)}}function _get_lastSelectedEditor(e){let t=null;for(t of tools_classPrivateFieldGet(et,e));return t}function _isEmpty(){if(0===tools_classPrivateFieldGet(Fe,this).size)return!0;if(1===tools_classPrivateFieldGet(Fe,this).size)for(const e of tools_classPrivateFieldGet(Fe,this).values())return e.isEmpty();return!1}function _selectEditors(e){for(const e of tools_classPrivateFieldGet(et,this))e.unselect();tools_classPrivateFieldGet(et,this).clear();for(const t of e)if(!t.isEmpty()){tools_classPrivateFieldGet(et,this).add(t);t.select()}tools_assertClassBrand(_t,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:this.hasSelection})}tools_defineProperty(AnnotationEditorUIManager,"TRANSLATE_SMALL",1);tools_defineProperty(AnnotationEditorUIManager,"TRANSLATE_BIG",10);function alt_text_classPrivateFieldInitSpec(e,t,i){alt_text_checkPrivateRedeclaration(e,t),t.set(e,i)}function alt_text_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function alt_text_classPrivateGetter(e,t,i){return i(alt_text_assertClassBrand(e,t))}function alt_text_classPrivateFieldGet(e,t){return e.get(alt_text_assertClassBrand(e,t))}function alt_text_classPrivateFieldSet(e,t,i){return e.set(alt_text_assertClassBrand(e,t),i),i}function alt_text_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var pt=new WeakMap,gt=new WeakMap,ft=new WeakMap,vt=new WeakMap,mt=new WeakMap,wt=new WeakMap,Pt=new WeakMap,yt=new WeakMap,Ft=new WeakMap,bt=new WeakMap,St=new WeakMap,xt=new WeakMap,Ct=new WeakSet;class AltText{constructor(e){!function alt_text_classPrivateMethodInitSpec(e,t){alt_text_checkPrivateRedeclaration(e,t),t.add(e)}(this,Ct);alt_text_classPrivateFieldInitSpec(this,pt,null);alt_text_classPrivateFieldInitSpec(this,gt,!1);alt_text_classPrivateFieldInitSpec(this,ft,null);alt_text_classPrivateFieldInitSpec(this,vt,null);alt_text_classPrivateFieldInitSpec(this,mt,null);alt_text_classPrivateFieldInitSpec(this,wt,null);alt_text_classPrivateFieldInitSpec(this,Pt,!1);alt_text_classPrivateFieldInitSpec(this,yt,null);alt_text_classPrivateFieldInitSpec(this,Ft,null);alt_text_classPrivateFieldInitSpec(this,bt,null);alt_text_classPrivateFieldInitSpec(this,St,null);alt_text_classPrivateFieldInitSpec(this,xt,!1);alt_text_classPrivateFieldSet(Ft,this,e);alt_text_classPrivateFieldSet(xt,this,e._uiManager.useNewAltTextFlow);At._||(At._=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){AltText._l10n??=e}async render(){const e=alt_text_classPrivateFieldSet(ft,this,document.createElement("button"));e.className="altText";e.tabIndex="0";const t=alt_text_classPrivateFieldSet(vt,this,document.createElement("span"));e.append(t);if(alt_text_classPrivateFieldGet(xt,this)){e.classList.add("new");e.setAttribute("data-l10n-id",At._.missing);t.setAttribute("data-l10n-id",At._["missing-label"])}else{e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button");t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label")}const i=alt_text_classPrivateFieldGet(Ft,this)._uiManager._signal;e.addEventListener("contextmenu",noContextMenu,{signal:i});e.addEventListener("pointerdown",(e=>e.stopPropagation()),{signal:i});const onClick=e=>{e.preventDefault();alt_text_classPrivateFieldGet(Ft,this)._uiManager.editAltText(alt_text_classPrivateFieldGet(Ft,this));alt_text_classPrivateFieldGet(xt,this)&&alt_text_classPrivateFieldGet(Ft,this)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:alt_text_classPrivateGetter(Ct,this,_get_label)}})};e.addEventListener("click",onClick,{capture:!0,signal:i});e.addEventListener("keydown",(t=>{if(t.target===e&&"Enter"===t.key){alt_text_classPrivateFieldSet(Pt,this,!0);onClick(t)}}),{signal:i});await alt_text_assertClassBrand(Ct,this,_setState).call(this);return e}finish(){if(alt_text_classPrivateFieldGet(ft,this)){alt_text_classPrivateFieldGet(ft,this).focus({focusVisible:alt_text_classPrivateFieldGet(Pt,this)});alt_text_classPrivateFieldSet(Pt,this,!1)}}isEmpty(){return alt_text_classPrivateFieldGet(xt,this)?null===alt_text_classPrivateFieldGet(pt,this):!alt_text_classPrivateFieldGet(pt,this)&&!alt_text_classPrivateFieldGet(gt,this)}hasData(){return alt_text_classPrivateFieldGet(xt,this)?null!==alt_text_classPrivateFieldGet(pt,this)||!!alt_text_classPrivateFieldGet(bt,this):this.isEmpty()}get guessedText(){return alt_text_classPrivateFieldGet(bt,this)}async setGuessedText(e){if(null===alt_text_classPrivateFieldGet(pt,this)){alt_text_classPrivateFieldSet(bt,this,e);alt_text_classPrivateFieldSet(St,this,await AltText._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e}));alt_text_assertClassBrand(Ct,this,_setState).call(this)}}toggleAltTextBadge(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(alt_text_classPrivateFieldGet(xt,this)&&!alt_text_classPrivateFieldGet(pt,this)){if(!alt_text_classPrivateFieldGet(yt,this)){const e=alt_text_classPrivateFieldSet(yt,this,document.createElement("div"));e.className="noAltTextBadge";alt_text_classPrivateFieldGet(Ft,this).div.append(e)}alt_text_classPrivateFieldGet(yt,this).classList.toggle("hidden",!e)}else{alt_text_classPrivateFieldGet(yt,this)?.remove();alt_text_classPrivateFieldSet(yt,this,null)}}serialize(e){let t=alt_text_classPrivateFieldGet(pt,this);e||alt_text_classPrivateFieldGet(bt,this)!==t||(t=alt_text_classPrivateFieldGet(St,this));return{altText:t,decorative:alt_text_classPrivateFieldGet(gt,this),guessedText:alt_text_classPrivateFieldGet(bt,this),textWithDisclaimer:alt_text_classPrivateFieldGet(St,this)}}get data(){return{altText:alt_text_classPrivateFieldGet(pt,this),decorative:alt_text_classPrivateFieldGet(gt,this)}}set data(e){let{altText:t,decorative:i,guessedText:a,textWithDisclaimer:s,cancel:n=!1}=e;if(a){alt_text_classPrivateFieldSet(bt,this,a);alt_text_classPrivateFieldSet(St,this,s)}if(alt_text_classPrivateFieldGet(pt,this)!==t||alt_text_classPrivateFieldGet(gt,this)!==i){if(!n){alt_text_classPrivateFieldSet(pt,this,t);alt_text_classPrivateFieldSet(gt,this,i)}alt_text_assertClassBrand(Ct,this,_setState).call(this)}}toggle(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(alt_text_classPrivateFieldGet(ft,this)){if(!e&&alt_text_classPrivateFieldGet(wt,this)){clearTimeout(alt_text_classPrivateFieldGet(wt,this));alt_text_classPrivateFieldSet(wt,this,null)}alt_text_classPrivateFieldGet(ft,this).disabled=!e}}shown(){alt_text_classPrivateFieldGet(Ft,this)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:alt_text_classPrivateGetter(Ct,this,_get_label)}})}destroy(){alt_text_classPrivateFieldGet(ft,this)?.remove();alt_text_classPrivateFieldSet(ft,this,null);alt_text_classPrivateFieldSet(vt,this,null);alt_text_classPrivateFieldSet(mt,this,null);alt_text_classPrivateFieldGet(yt,this)?.remove();alt_text_classPrivateFieldSet(yt,this,null)}}function _get_label(e){return(alt_text_classPrivateFieldGet(pt,e)?"added":null===alt_text_classPrivateFieldGet(pt,e)&&e.guessedText&&"review")||"missing"}async function _setState(){const e=alt_text_classPrivateFieldGet(ft,this);if(!e)return;if(alt_text_classPrivateFieldGet(xt,this)){e.classList.toggle("done",!!alt_text_classPrivateFieldGet(pt,this));e.setAttribute("data-l10n-id",At._[alt_text_classPrivateGetter(Ct,this,_get_label)]);alt_text_classPrivateFieldGet(vt,this)?.setAttribute("data-l10n-id",At._[`${alt_text_classPrivateGetter(Ct,this,_get_label)}-label`]);if(!alt_text_classPrivateFieldGet(pt,this)){alt_text_classPrivateFieldGet(mt,this)?.remove();return}}else{if(!alt_text_classPrivateFieldGet(pt,this)&&!alt_text_classPrivateFieldGet(gt,this)){e.classList.remove("done");alt_text_classPrivateFieldGet(mt,this)?.remove();return}e.classList.add("done");e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let t=alt_text_classPrivateFieldGet(mt,this);if(!t){alt_text_classPrivateFieldSet(mt,this,t=document.createElement("span"));t.className="tooltip";t.setAttribute("role","tooltip");t.id=`alt-text-tooltip-${alt_text_classPrivateFieldGet(Ft,this).id}`;const i=100,a=alt_text_classPrivateFieldGet(Ft,this)._uiManager._signal;a.addEventListener("abort",(()=>{clearTimeout(alt_text_classPrivateFieldGet(wt,this));alt_text_classPrivateFieldSet(wt,this,null)}),{once:!0});e.addEventListener("mouseenter",(()=>{alt_text_classPrivateFieldSet(wt,this,setTimeout((()=>{alt_text_classPrivateFieldSet(wt,this,null);alt_text_classPrivateFieldGet(mt,this).classList.add("show");alt_text_classPrivateFieldGet(Ft,this)._reportTelemetry({action:"alt_text_tooltip"})}),i))}),{signal:a});e.addEventListener("mouseleave",(()=>{if(alt_text_classPrivateFieldGet(wt,this)){clearTimeout(alt_text_classPrivateFieldGet(wt,this));alt_text_classPrivateFieldSet(wt,this,null)}alt_text_classPrivateFieldGet(mt,this)?.classList.remove("show")}),{signal:a})}if(alt_text_classPrivateFieldGet(gt,this))t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip");else{t.removeAttribute("data-l10n-id");t.textContent=alt_text_classPrivateFieldGet(pt,this)}t.parentNode||e.append(t);const i=alt_text_classPrivateFieldGet(Ft,this).getElementForAltText();i?.setAttribute("aria-describedby",t.id)}var At={_:null};!function alt_text_defineProperty(e,t,i){return(t=function alt_text_toPropertyKey(e){var t=function alt_text_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}(AltText,"_l10n",null);function comment_classPrivateFieldInitSpec(e,t,i){(function comment_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function comment_classPrivateFieldGet(e,t){return e.get(comment_assertClassBrand(e,t))}function comment_classPrivateFieldSet(e,t,i){return e.set(comment_assertClassBrand(e,t),i),i}function comment_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Et,kt=new WeakMap,It=new WeakMap,Mt=new WeakMap,Bt=new WeakMap,Gt=new WeakMap,Tt=new WeakMap,Dt=new WeakMap;class Comment{constructor(e){comment_classPrivateFieldInitSpec(this,kt,null);comment_classPrivateFieldInitSpec(this,It,!1);comment_classPrivateFieldInitSpec(this,Mt,null);comment_classPrivateFieldInitSpec(this,Bt,null);comment_classPrivateFieldInitSpec(this,Gt,null);comment_classPrivateFieldInitSpec(this,Tt,null);comment_classPrivateFieldInitSpec(this,Dt,!1);comment_classPrivateFieldSet(Mt,this,e);this.toolbar=null}render(){if(!comment_classPrivateFieldGet(Mt,this)._uiManager.hasCommentManager())return null;const e=comment_classPrivateFieldSet(kt,this,document.createElement("button"));e.className="comment";e.tabIndex="0";e.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-button");const t=comment_classPrivateFieldGet(Mt,this)._uiManager._signal;e.addEventListener("contextmenu",noContextMenu,{signal:t});e.addEventListener("pointerdown",(e=>e.stopPropagation()),{signal:t});const onClick=e=>{e.preventDefault();this.edit()};e.addEventListener("click",onClick,{capture:!0,signal:t});e.addEventListener("keydown",(t=>{if(t.target===e&&"Enter"===t.key){comment_classPrivateFieldSet(It,this,!0);onClick(t)}}),{signal:t});return e}edit(){const{bottom:e,left:t,right:i}=comment_classPrivateFieldGet(Mt,this).getClientDimensions(),a={top:e};"ltr"===comment_classPrivateFieldGet(Mt,this)._uiManager.direction?a.right=i:a.left=t;comment_classPrivateFieldGet(Mt,this)._uiManager.editComment(comment_classPrivateFieldGet(Mt,this),a)}finish(){if(comment_classPrivateFieldGet(kt,this)){comment_classPrivateFieldGet(kt,this).focus({focusVisible:comment_classPrivateFieldGet(It,this)});comment_classPrivateFieldSet(It,this,!1)}}isDeleted(){return comment_classPrivateFieldGet(Dt,this)||""===comment_classPrivateFieldGet(Gt,this)}hasBeenEdited(){return this.isDeleted()||comment_classPrivateFieldGet(Gt,this)!==comment_classPrivateFieldGet(Bt,this)}serialize(){return this.data}get data(){return{text:comment_classPrivateFieldGet(Gt,this),date:comment_classPrivateFieldGet(Tt,this),deleted:comment_classPrivateFieldGet(Dt,this)}}set data(e){if(null!==e){comment_classPrivateFieldSet(Gt,this,e);comment_classPrivateFieldSet(Tt,this,new Date);comment_classPrivateFieldSet(Dt,this,!1)}else{comment_classPrivateFieldSet(Gt,this,"");comment_classPrivateFieldSet(Dt,this,!0)}}setInitialText(e){comment_classPrivateFieldSet(Bt,this,e);this.data=e}toggle(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];comment_classPrivateFieldGet(kt,this)&&(comment_classPrivateFieldGet(kt,this).disabled=!e)}shown(){}destroy(){comment_classPrivateFieldGet(kt,this)?.remove();comment_classPrivateFieldSet(kt,this,null);comment_classPrivateFieldSet(Gt,this,"");comment_classPrivateFieldSet(Tt,this,null);comment_classPrivateFieldSet(Mt,this,null);comment_classPrivateFieldSet(It,this,!1);comment_classPrivateFieldSet(Dt,this,!1)}}function touch_manager_classPrivateFieldInitSpec(e,t,i){touch_manager_checkPrivateRedeclaration(e,t),t.set(e,i)}function touch_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function touch_manager_classPrivateFieldGet(e,t){return e.get(touch_manager_assertClassBrand(e,t))}function touch_manager_classPrivateFieldSet(e,t,i){return e.set(touch_manager_assertClassBrand(e,t),i),i}function touch_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Lt,Rt=new WeakMap,Nt=new WeakMap,Ot=new WeakMap,Wt=new WeakMap,jt=new WeakMap,Vt=new WeakMap,Ht=new WeakMap,zt=new WeakMap,Ut=new WeakMap,$t=new WeakMap,qt=new WeakMap,Xt=new WeakMap,Kt=new WeakSet;class TouchManager{constructor(e){let{container:t,isPinchingDisabled:i=null,isPinchingStopped:a=null,onPinchStart:s=null,onPinching:n=null,onPinchEnd:r=null,signal:o}=e;!function touch_manager_classPrivateMethodInitSpec(e,t){touch_manager_checkPrivateRedeclaration(e,t),t.add(e)}(this,Kt);touch_manager_classPrivateFieldInitSpec(this,Rt,void 0);touch_manager_classPrivateFieldInitSpec(this,Nt,!1);touch_manager_classPrivateFieldInitSpec(this,Ot,null);touch_manager_classPrivateFieldInitSpec(this,Wt,void 0);touch_manager_classPrivateFieldInitSpec(this,jt,void 0);touch_manager_classPrivateFieldInitSpec(this,Vt,void 0);touch_manager_classPrivateFieldInitSpec(this,Ht,void 0);touch_manager_classPrivateFieldInitSpec(this,zt,null);touch_manager_classPrivateFieldInitSpec(this,Ut,void 0);touch_manager_classPrivateFieldInitSpec(this,$t,null);touch_manager_classPrivateFieldInitSpec(this,qt,void 0);touch_manager_classPrivateFieldInitSpec(this,Xt,null);touch_manager_classPrivateFieldSet(Rt,this,t);touch_manager_classPrivateFieldSet(Ot,this,a);touch_manager_classPrivateFieldSet(Wt,this,i);touch_manager_classPrivateFieldSet(jt,this,s);touch_manager_classPrivateFieldSet(Vt,this,n);touch_manager_classPrivateFieldSet(Ht,this,r);touch_manager_classPrivateFieldSet(qt,this,new AbortController);touch_manager_classPrivateFieldSet(Ut,this,AbortSignal.any([o,touch_manager_classPrivateFieldGet(qt,this).signal]));t.addEventListener("touchstart",touch_manager_assertClassBrand(Kt,this,_onTouchStart).bind(this),{passive:!1,signal:touch_manager_classPrivateFieldGet(Ut,this)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/OutputScale.pixelRatio}destroy(){touch_manager_classPrivateFieldGet(qt,this)?.abort();touch_manager_classPrivateFieldSet(qt,this,null);touch_manager_classPrivateFieldGet(zt,this)?.abort();touch_manager_classPrivateFieldSet(zt,this,null)}}Et=TouchManager;function _onTouchStart(e){if(touch_manager_classPrivateFieldGet(Wt,this)?.call(this))return;if(1===e.touches.length){if(touch_manager_classPrivateFieldGet(zt,this))return;const e=touch_manager_classPrivateFieldSet(zt,this,new AbortController),t=AbortSignal.any([touch_manager_classPrivateFieldGet(Ut,this),e.signal]),i=touch_manager_classPrivateFieldGet(Rt,this),a={capture:!0,signal:t,passive:!1},cancelPointerDown=e=>{if("touch"===e.pointerType){touch_manager_classPrivateFieldGet(zt,this)?.abort();touch_manager_classPrivateFieldSet(zt,this,null)}};i.addEventListener("pointerdown",(e=>{if("touch"===e.pointerType){stopEvent(e);cancelPointerDown(e)}}),a);i.addEventListener("pointerup",cancelPointerDown,a);i.addEventListener("pointercancel",cancelPointerDown,a);return}if(!touch_manager_classPrivateFieldGet(Xt,this)){touch_manager_classPrivateFieldSet(Xt,this,new AbortController);const e=AbortSignal.any([touch_manager_classPrivateFieldGet(Ut,this),touch_manager_classPrivateFieldGet(Xt,this).signal]),t=touch_manager_classPrivateFieldGet(Rt,this),i={signal:e,capture:!1,passive:!1};t.addEventListener("touchmove",touch_manager_assertClassBrand(Kt,this,_onTouchMove).bind(this),i);const a=touch_manager_assertClassBrand(Kt,this,_onTouchEnd).bind(this);t.addEventListener("touchend",a,i);t.addEventListener("touchcancel",a,i);i.capture=!0;t.addEventListener("pointerdown",stopEvent,i);t.addEventListener("pointermove",stopEvent,i);t.addEventListener("pointercancel",stopEvent,i);t.addEventListener("pointerup",stopEvent,i);touch_manager_classPrivateFieldGet(jt,this)?.call(this)}stopEvent(e);if(2!==e.touches.length||touch_manager_classPrivateFieldGet(Ot,this)?.call(this)){touch_manager_classPrivateFieldSet($t,this,null);return}let[t,i]=e.touches;t.identifier>i.identifier&&([t,i]=[i,t]);touch_manager_classPrivateFieldSet($t,this,{touch0X:t.screenX,touch0Y:t.screenY,touch1X:i.screenX,touch1Y:i.screenY})}function _onTouchMove(e){if(!touch_manager_classPrivateFieldGet($t,this)||2!==e.touches.length)return;stopEvent(e);let[t,i]=e.touches;t.identifier>i.identifier&&([t,i]=[i,t]);const{screenX:a,screenY:s}=t,{screenX:n,screenY:r}=i,o=touch_manager_classPrivateFieldGet($t,this),{touch0X:l,touch0Y:d,touch1X:c,touch1Y:h}=o,u=c-l,_=h-d,p=n-a,g=r-s,f=Math.hypot(p,g)||1,v=Math.hypot(u,_)||1;if(!touch_manager_classPrivateFieldGet(Nt,this)&&Math.abs(v-f)<=Et.MIN_TOUCH_DISTANCE_TO_PINCH)return;o.touch0X=a;o.touch0Y=s;o.touch1X=n;o.touch1Y=r;if(!touch_manager_classPrivateFieldGet(Nt,this)){touch_manager_classPrivateFieldSet(Nt,this,!0);return}const m=[(a+n)/2,(s+r)/2];touch_manager_classPrivateFieldGet(Vt,this)?.call(this,m,v,f)}function _onTouchEnd(e){if(!(e.touches.length>=2)){if(touch_manager_classPrivateFieldGet(Xt,this)){touch_manager_classPrivateFieldGet(Xt,this).abort();touch_manager_classPrivateFieldSet(Xt,this,null);touch_manager_classPrivateFieldGet(Ht,this)?.call(this)}if(touch_manager_classPrivateFieldGet($t,this)){stopEvent(e);touch_manager_classPrivateFieldSet($t,this,null);touch_manager_classPrivateFieldSet(Nt,this,!1)}}}function editor_defineProperty(e,t,i){return(t=function editor_toPropertyKey(e){var t=function editor_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function editor_classPrivateFieldInitSpec(e,t,i){editor_checkPrivateRedeclaration(e,t),t.set(e,i)}function editor_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function editor_classPrivateFieldSet(e,t,i){return e.set(editor_assertClassBrand(e,t),i),i}function editor_classPrivateFieldGet(e,t){return e.get(editor_assertClassBrand(e,t))}function editor_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Yt=new WeakMap,Zt=new WeakMap,Qt=new WeakMap,Jt=new WeakMap,ei=new WeakMap,ti=new WeakMap,ii=new WeakMap,ai=new WeakMap,si=new WeakMap,ni=new WeakMap,ri=new WeakMap,oi=new WeakMap,li=new WeakMap,di=new WeakMap,ci=new WeakMap,hi=new WeakMap,ui=new WeakMap,_i=new WeakMap,pi=new WeakMap,gi=new WeakMap,fi=new WeakMap,vi=new WeakMap,mi=new WeakMap,wi=new WeakMap,Pi=new WeakMap,yi=new WeakSet;class AnnotationEditor{static get _resizerKeyboardManager(){const e=AnnotationEditor.prototype._resizeWithKeyboard,t=AnnotationEditorUIManager.TRANSLATE_SMALL,i=AnnotationEditorUIManager.TRANSLATE_BIG;return shadow(this,"_resizerKeyboardManager",new KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,i]}],[["Escape","mac+Escape"],AnnotationEditor.prototype._stopResizingWithKeyboard]]))}constructor(e){!function editor_classPrivateMethodInitSpec(e,t){editor_checkPrivateRedeclaration(e,t),t.add(e)}(this,yi);editor_classPrivateFieldInitSpec(this,Yt,null);editor_classPrivateFieldInitSpec(this,Zt,null);editor_classPrivateFieldInitSpec(this,Qt,null);editor_classPrivateFieldInitSpec(this,Jt,null);editor_classPrivateFieldInitSpec(this,ei,!1);editor_classPrivateFieldInitSpec(this,ti,null);editor_classPrivateFieldInitSpec(this,ii,"");editor_classPrivateFieldInitSpec(this,ai,!1);editor_classPrivateFieldInitSpec(this,si,null);editor_classPrivateFieldInitSpec(this,ni,null);editor_classPrivateFieldInitSpec(this,ri,null);editor_classPrivateFieldInitSpec(this,oi,null);editor_classPrivateFieldInitSpec(this,li,"");editor_classPrivateFieldInitSpec(this,di,!1);editor_classPrivateFieldInitSpec(this,ci,null);editor_classPrivateFieldInitSpec(this,hi,!1);editor_classPrivateFieldInitSpec(this,ui,!1);editor_classPrivateFieldInitSpec(this,_i,!1);editor_classPrivateFieldInitSpec(this,pi,null);editor_classPrivateFieldInitSpec(this,gi,0);editor_classPrivateFieldInitSpec(this,fi,0);editor_classPrivateFieldInitSpec(this,vi,null);editor_classPrivateFieldInitSpec(this,mi,null);editor_defineProperty(this,"isSelected",!1);editor_defineProperty(this,"_isCopy",!1);editor_defineProperty(this,"_editToolbar",null);editor_defineProperty(this,"_initialOptions",Object.create(null));editor_defineProperty(this,"_initialData",null);editor_defineProperty(this,"_isVisible",!0);editor_defineProperty(this,"_uiManager",null);editor_defineProperty(this,"_focusEventsAllowed",!0);editor_classPrivateFieldInitSpec(this,wi,!1);editor_classPrivateFieldInitSpec(this,Pi,AnnotationEditor._zIndex++);editor_defineProperty(this,"doNotMove",!1);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;const{rotation:t,rawDims:{pageWidth:i,pageHeight:a,pageX:s,pageY:n}}=this.parent.viewport;this.rotation=t;this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360;this.pageDimensions=[i,a];this.pageTranslation=[s,n];const[r,o]=this.parentDimensions;this.x=e.x/r;this.y=e.y/o;this.isAttachedToDOM=!1;this.deleted=!1;this.eventBus=e.eventBus}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 shadow(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new FakeEditor({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId;t.deleted=!0;t._uiManager.addToAnnotationStorage(t)}static initialize(e,t){AnnotationEditor._l10n??=e;AnnotationEditor._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"});if(-1!==AnnotationEditor._borderLineWidth)return;const i=getComputedStyle(document.documentElement);AnnotationEditor._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){unreachable("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return editor_classPrivateFieldGet(wi,this)}set _isDraggable(e){editor_classPrivateFieldSet(wi,this,e);this.div?.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(2*e);this.y+=this.width*e/(2*t);break;case 180:this.x+=this.width/2;this.y+=this.height/2;break;case 270:this.x+=this.height*t/(2*e);this.y-=this.width*e/(2*t);break;default:this.x-=this.width/2;this.y-=this.height/2}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=editor_classPrivateFieldGet(Pi,this)}setParent(e){if(null!==e){this.pageIndex=e.pageIndex;this.pageDimensions=e.pageDimensions}else editor_assertClassBrand(yi,this,_stopResizing).call(this);this.parent=e}focusin(e){this._focusEventsAllowed&&(editor_classPrivateFieldGet(di,this)?editor_classPrivateFieldSet(di,this,!1):this.parent.setSelected(this))}focusout(e){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const t=e.relatedTarget;if(!t?.closest(`#${this.id}`)){e.preventDefault();this.parent?.isMultipleSelection||this.commitOrRemove()}}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){if(this.isInEditMode()){this.addToAnnotationStorage();this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"commit",page:this.pageIndex+1,editorType:this.constructor.name,value:this})}}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,i,a){const[s,n]=this.parentDimensions;[i,a]=this.screenToPageTranslation(i,a);this.doNotMove&&([i,a]=[0,0]);this.x=(e+i)/s;this.y=(t+a)/n;this.fixAndSetPosition()}_moveAfterPaste(e,t){const[i,a]=this.parentDimensions;this.setAt(e*i,t*a,this.width*i,this.height*a);this._onTranslated()}translate(e,t){editor_assertClassBrand(yi,this,_translate).call(this,this.parentDimensions,e,t)}translateInPage(e,t){editor_classPrivateFieldGet(ci,this)||editor_classPrivateFieldSet(ci,this,[this.x,this.y,this.width,this.height]);editor_assertClassBrand(yi,this,_translate).call(this,this.pageDimensions,e,t);this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){editor_classPrivateFieldGet(ci,this)||editor_classPrivateFieldSet(ci,this,[this.x,this.y,this.width,this.height]);const{div:i,parentDimensions:[a,s]}=this;this.x+=e/a;this.y+=t/s;if(this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:e,y:t}=this.div.getBoundingClientRect();if(this.parent.findNewParent(this,e,t)){this.x-=Math.floor(this.x);this.y-=Math.floor(this.y)}}let{x:n,y:r}=this;const[o,l]=this.getBaseTranslation();n+=o;r+=l;const{style:d}=i;d.left=`${(100*n).toFixed(2)}%`;d.top=`${(100*r).toFixed(2)}%`;this._onTranslating(n,r);i.scrollIntoView({block:"nearest"})}_onTranslating(e,t){}_onTranslated(e,t){this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"moved",page:this.pageIndex+1,editorType:this.constructor.name,value:{x:e,y:t}})}get _hasBeenMoved(){return!!editor_classPrivateFieldGet(ci,this)&&(editor_classPrivateFieldGet(ci,this)[0]!==this.x||editor_classPrivateFieldGet(ci,this)[1]!==this.y)}get _hasBeenResized(){return!!editor_classPrivateFieldGet(ci,this)&&(editor_classPrivateFieldGet(ci,this)[2]!==this.width||editor_classPrivateFieldGet(ci,this)[3]!==this.height)}getBaseTranslation(){const[e,t]=this.parentDimensions,{_borderLineWidth:i}=AnnotationEditor,a=i/e,s=i/t;switch(this.rotation){case 90:return[-a,s];case 180:return[a,s];case 270:return[a,-s];default:return[-a,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.rotation;const{div:{style:t},pageDimensions:[i,a]}=this;let{x:s,y:n,width:r,height:o}=this;r*=i;o*=a;s*=i;n*=a;if(this._mustFixPosition)switch(e){case 0:s=MathClamp(s,0,i-r);n=MathClamp(n,0,a-o);break;case 90:s=MathClamp(s,0,i-o);n=MathClamp(n,r,a);break;case 180:s=MathClamp(s,r,i);n=MathClamp(n,o,a);break;case 270:s=MathClamp(s,o,i);n=MathClamp(n,0,a-r)}this.x=s/=i;this.y=n/=a;const[l,d]=this.getBaseTranslation();s+=l;n+=d;t.left=`${(100*s).toFixed(2)}%`;t.top=`${(100*n).toFixed(2)}%`;this.moveInDOM()}screenToPageTranslation(e,t){return _rotatePoint.call(AnnotationEditor,e,t,this.parentRotation)}pageTranslationToScreen(e,t){return _rotatePoint.call(AnnotationEditor,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,i]}=this;return[t*e,i*e]}setDims(e,t){const[i,a]=this.parentDimensions,{style:s}=this.div;s.width=`${(100*e/i).toFixed(2)}%`;editor_classPrivateFieldGet(ai,this)||(s.height=`${(100*t/a).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:t,width:i}=e,a=i.endsWith("%"),s=!editor_classPrivateFieldGet(ai,this)&&t.endsWith("%");if(a&&s)return;const[n,r]=this.parentDimensions;a||(e.width=`${(100*parseFloat(i)/n).toFixed(2)}%`);editor_classPrivateFieldGet(ai,this)||s||(e.height=`${(100*parseFloat(t)/r).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}_onResized(){}static _round(e){return Math.round(1e4*e)/1e4}_onResizing(){}altTextFinish(){editor_classPrivateFieldGet(Qt,this)?.finish();this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"altTextChanged",page:this.pageIndex+1,editorType:this.constructor.name,value:editor_classPrivateFieldGet(Qt,this)})}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||editor_classPrivateFieldGet(ui,this))return this._editToolbar;this._editToolbar=new EditorToolbar(this);this.div.append(this._editToolbar.render());this._editToolbar.addButton("comment",this.addCommentButton());const{toolbarButtons:e}=this;if(e)for(const[t,i]of e)await this._editToolbar.addButton(t,i);this._editToolbar.addButton("delete");return this._editToolbar}removeEditToolbar(){if(this._editToolbar){this._editToolbar.remove();this._editToolbar=null;editor_classPrivateFieldGet(Qt,this)?.destroy()}}addContainer(e){const t=this._editToolbar?.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){if(!editor_classPrivateFieldGet(Qt,this)){AltText.initialize(AnnotationEditor._l10n);editor_classPrivateFieldSet(Qt,this,new AltText(this));if(editor_classPrivateFieldGet(Yt,this)){editor_classPrivateFieldGet(Qt,this).data=editor_classPrivateFieldGet(Yt,this);editor_classPrivateFieldSet(Yt,this,null)}}return editor_classPrivateFieldGet(Qt,this)}get altTextData(){return editor_classPrivateFieldGet(Qt,this)?.data}set altTextData(e){editor_classPrivateFieldGet(Qt,this)&&(editor_classPrivateFieldGet(Qt,this).data=e)}get guessedAltText(){return editor_classPrivateFieldGet(Qt,this)?.guessedText}async setGuessedAltText(e){await(editor_classPrivateFieldGet(Qt,this)?.setGuessedText(e))}serializeAltText(e){return editor_classPrivateFieldGet(Qt,this)?.serialize(e)}hasAltText(){return!!editor_classPrivateFieldGet(Qt,this)&&!editor_classPrivateFieldGet(Qt,this).isEmpty()}hasAltTextData(){return editor_classPrivateFieldGet(Qt,this)?.hasData()??!1}addCommentButton(){return editor_classPrivateFieldGet(Jt,this)?editor_classPrivateFieldGet(Jt,this):editor_classPrivateFieldSet(Jt,this,new Comment(this))}get commentColor(){return null}get comment(){const e=editor_classPrivateFieldGet(Jt,this);return{text:e.data.text,date:e.data.date,deleted:e.isDeleted(),color:this.commentColor}}set comment(e){editor_classPrivateFieldGet(Jt,this)||editor_classPrivateFieldSet(Jt,this,new Comment(this));editor_classPrivateFieldGet(Jt,this).data=e}setCommentData(e){editor_classPrivateFieldGet(Jt,this)||editor_classPrivateFieldSet(Jt,this,new Comment(this));editor_classPrivateFieldGet(Jt,this).setInitialText(e)}get hasEditedComment(){return editor_classPrivateFieldGet(Jt,this)?.hasBeenEdited()}async editComment(){editor_classPrivateFieldGet(Jt,this)||editor_classPrivateFieldSet(Jt,this,new Comment(this));editor_classPrivateFieldGet(Jt,this).edit()}addComment(e){this.hasEditedComment&&(e.popup={contents:this.comment.text,deleted:this.comment.deleted})}render(){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=editor_classPrivateFieldGet(ei,this)?-1:0;e.setAttribute("role","application");this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId);this._isVisible||e.classList.add("hidden");this.setInForeground();editor_assertClassBrand(yi,this,_addFocusListeners).call(this);const[t,i]=this.parentDimensions;if(this.parentRotation%180!=0){e.style.maxWidth=`${(100*i/t).toFixed(2)}%`;e.style.maxHeight=`${(100*t/i).toFixed(2)}%`}const[a,s]=this.getInitialTranslation();this.translate(a,s);bindEvents(this,e,["keydown","pointerdown","dblclick"]);this.isResizable&&this._uiManager._supportsPinchToZoom&&(editor_classPrivateFieldGet(mi,this)||editor_classPrivateFieldSet(mi,this,new TouchManager({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:editor_assertClassBrand(yi,this,_touchPinchStartCallback).bind(this),onPinching:editor_assertClassBrand(yi,this,_touchPinchCallback).bind(this),onPinchEnd:editor_assertClassBrand(yi,this,_touchPinchEndCallback).bind(this),signal:this._uiManager._signal})));this._uiManager._editorUndoBar?.hide();return e}pointerdown(e){const{isMac:t}=util_FeatureTest.platform;if(0!==e.button||e.ctrlKey&&t)e.preventDefault();else{editor_classPrivateFieldSet(di,this,!0);this._isDraggable?editor_assertClassBrand(yi,this,_setUpDragSession).call(this,e):editor_assertClassBrand(yi,this,_selectOnPointerEvent).call(this,e)}}_onStartDragging(){}_onStopDragging(){}moveInDOM(){editor_classPrivateFieldGet(pi,this)&&clearTimeout(editor_classPrivateFieldGet(pi,this));editor_classPrivateFieldSet(pi,this,setTimeout((()=>{editor_classPrivateFieldSet(pi,this,null);this.parent?.moveEditorInDOM(this)}),0))}_setParentAndPosition(e,t,i){e.changeParent(this);this.x=t;this.y=i;this.fixAndSetPosition();this._onTranslated()}getRect(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.rotation;const a=this.parentScale,[s,n]=this.pageDimensions,[r,o]=this.pageTranslation,l=e/a,d=t/a,c=this.x*s,h=this.y*n,u=this.width*s,_=this.height*n;switch(i){case 0:return[c+l+r,n-h-d-_+o,c+l+u+r,n-h-d+o];case 90:return[c+d+r,n-h+l+o,c+d+_+r,n-h+l+u+o];case 180:return[c-l-u+r,n-h+d+o,c-l+r,n-h+d+_+o];case 270:return[c-d-_+r,n-h-l-u+o,c-d+r,n-h-l+o];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[i,a,s,n]=e,r=s-i,o=n-a;switch(this.rotation){case 0:return[i,t-n,r,o];case 90:return[i,t-a,o,r];case 180:return[s,t-a,r,o];case 270:return[s,t-n,o,r];default:throw new Error("Invalid rotation")}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){if(this.isInEditMode())return!1;this.parent.setEditingState(!1);editor_classPrivateFieldSet(ui,this,!0);return!0}disableEditMode(){if(!this.isInEditMode())return!1;this.parent.setEditingState(!0);editor_classPrivateFieldSet(ui,this,!1);return!0}isInEditMode(){return editor_classPrivateFieldGet(ui,this)}shouldGetKeyboardEvents(){return editor_classPrivateFieldGet(_i,this)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:t,bottom:i,right:a}=this.getClientDimensions(),{innerHeight:s,innerWidth:n}=window;return t<n&&a>0&&e<s&&i>0}rebuild(){editor_assertClassBrand(yi,this,_addFocusListeners).call(this)}rotate(e){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(){unreachable("An editor must be serializable")}static async deserialize(e,t,i){const a=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:i,annotationElementId:e.annotationElementId,eventBus:t.eventBus});a.rotation=e.rotation;editor_classPrivateFieldSet(Yt,a,e.accessibilityData);a._isCopy=e.isCopy||!1;const[s,n]=a.pageDimensions,[r,o,l,d]=a.getRectInCurrentCoords(e.rect,n);a.x=r/s;a.y=o/n;a.width=l/s;a.height=d/n;return a}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){editor_classPrivateFieldGet(oi,this)?.abort();editor_classPrivateFieldSet(oi,this,null);this.isEmpty()||this.commit();this.parent?this.parent.remove(this):this._uiManager.removeEditor(this);if(editor_classPrivateFieldGet(pi,this)){clearTimeout(editor_classPrivateFieldGet(pi,this));editor_classPrivateFieldSet(pi,this,null)}editor_assertClassBrand(yi,this,_stopResizing).call(this);this.removeEditToolbar();if(editor_classPrivateFieldGet(vi,this)){for(const e of editor_classPrivateFieldGet(vi,this).values())clearTimeout(e);editor_classPrivateFieldSet(vi,this,null)}this.parent=null;this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"removed",page:this.pageIndex+1,editorType:this.constructor.name,value:this});editor_classPrivateFieldGet(mi,this)?.destroy();editor_classPrivateFieldSet(mi,this,null)}get isResizable(){return!1}makeResizable(){if(this.isResizable){editor_assertClassBrand(yi,this,_createResizers).call(this);editor_classPrivateFieldGet(si,this).classList.remove("hidden")}}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||"Enter"!==e.key)return;this._uiManager.setSelected(this);editor_classPrivateFieldSet(ri,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const t=editor_classPrivateFieldGet(si,this).children;if(!editor_classPrivateFieldGet(Zt,this)){editor_classPrivateFieldSet(Zt,this,Array.from(t));const e=editor_assertClassBrand(yi,this,_resizerKeydown).bind(this),i=editor_assertClassBrand(yi,this,_resizerBlur).bind(this),a=this._uiManager._signal;for(const t of editor_classPrivateFieldGet(Zt,this)){const s=t.getAttribute("data-resizer-name");t.setAttribute("role","spinbutton");t.addEventListener("keydown",e,{signal:a});t.addEventListener("blur",i,{signal:a});t.addEventListener("focus",editor_assertClassBrand(yi,this,_resizerFocus).bind(this,s),{signal:a});t.setAttribute("data-l10n-id",AnnotationEditor._l10nResizer[s])}}const i=editor_classPrivateFieldGet(Zt,this)[0];let a=0;for(const e of t){if(e===i)break;a++}const s=(360-this.rotation+this.parentRotation)%360/90*(editor_classPrivateFieldGet(Zt,this).length/4);if(s!==a){if(s<a)for(let e=0;e<a-s;e++)editor_classPrivateFieldGet(si,this).append(editor_classPrivateFieldGet(si,this).firstChild);else if(s>a)for(let e=0;e<s-a;e++)editor_classPrivateFieldGet(si,this).firstChild.before(editor_classPrivateFieldGet(si,this).lastChild);let e=0;for(const i of t){const t=editor_classPrivateFieldGet(Zt,this)[e++].getAttribute("data-resizer-name");i.setAttribute("data-l10n-id",AnnotationEditor._l10nResizer[t])}}editor_assertClassBrand(yi,this,_setResizerTabIndex).call(this,0);editor_classPrivateFieldSet(_i,this,!0);editor_classPrivateFieldGet(si,this).firstChild.focus({focusVisible:!0});e.preventDefault();e.stopImmediatePropagation()}_resizeWithKeyboard(e,t){editor_classPrivateFieldGet(_i,this)&&editor_assertClassBrand(yi,this,_resizerPointermove).call(this,editor_classPrivateFieldGet(li,this),{deltaX:e,deltaY:t,fromKeyboard:!0})}_stopResizingWithKeyboard(){editor_assertClassBrand(yi,this,_stopResizing).call(this);this.div.focus()}select(){if(!this.isSelected||!this._editToolbar){this.isSelected=!0;this.makeResizable();this.div?.classList.add("selectedEditor");if(this._editToolbar){this._editToolbar?.show();editor_classPrivateFieldGet(Qt,this)?.toggleAltTextBadge(!1)}else this.addEditToolbar().then((()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()}))}}unselect(){if(this.isSelected){this.isSelected=!1;editor_classPrivateFieldGet(si,this)?.classList.add("hidden");this.div?.classList.remove("selectedEditor");this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0});this._editToolbar?.hide();editor_classPrivateFieldGet(Qt,this)?.toggleAltTextBadge(!0)}}updateParams(e,t){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){if(this.canChangeContent){this.enableEditMode();this.div.focus()}}dblclick(e){this.enterInEditMode();this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id})}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return editor_classPrivateFieldGet(hi,this)}set isEditing(e){editor_classPrivateFieldSet(hi,this,e);if(this.parent)if(e){this.parent.setSelected(this);this.parent.setActiveEditor(this)}else this.parent.setActiveEditor(null)}setAspectRatio(e,t){editor_classPrivateFieldSet(ai,this,!0);const i=e/t,{style:a}=this.div;a.aspectRatio=i;a.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){editor_classPrivateFieldGet(vi,this)||editor_classPrivateFieldSet(vi,this,new Map);const{action:t}=e;let i=editor_classPrivateFieldGet(vi,this).get(t);i&&clearTimeout(i);i=setTimeout((()=>{this._reportTelemetry(e);editor_classPrivateFieldGet(vi,this).delete(t);0===editor_classPrivateFieldGet(vi,this).size&&editor_classPrivateFieldSet(vi,this,null)}),AnnotationEditor._telemetryTimeout);editor_classPrivateFieldGet(vi,this).set(t,i)}else{e.type||=this.editorType;this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}}show(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;this.div.classList.toggle("hidden",!e);this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0);editor_classPrivateFieldSet(ei,this,!1)}disable(){this.div&&(this.div.tabIndex=-1);editor_classPrivateFieldSet(ei,this,!0)}renderAnnotationElement(e){let t=e.container.querySelector(".annotationContent");if(t){if("CANVAS"===t.nodeName){const e=t;t=document.createElement("div");t.classList.add("annotationContent",this.editorType);e.before(t)}}else{t=document.createElement("div");t.classList.add("annotationContent",this.editorType);e.container.prepend(t)}return t}resetAnnotationElement(e){const{firstChild:t}=e.container;"DIV"===t?.nodeName&&t.classList.contains("annotationContent")&&t.remove()}}Lt=AnnotationEditor;function _translate(e,t,i){let[a,s]=e;[t,i]=this.screenToPageTranslation(t,i);this.x+=t/a;this.y+=i/s;this._onTranslating(this.x,this.y);this.fixAndSetPosition()}function _rotatePoint(e,t,i){switch(i){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}function _getRotationMatrix(e){switch(e){case 90:{const[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,t]=this.pageDimensions;return[0,e/t,-t/e,0]}default:return[1,0,0,1]}}function _createResizers(){if(editor_classPrivateFieldGet(si,this))return;editor_classPrivateFieldSet(si,this,document.createElement("div"));editor_classPrivateFieldGet(si,this).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 i of e){const e=document.createElement("div");editor_classPrivateFieldGet(si,this).append(e);e.classList.add("resizer",i);e.setAttribute("data-resizer-name",i);e.addEventListener("pointerdown",editor_assertClassBrand(yi,this,_resizerPointerdown).bind(this,i),{signal:t});e.addEventListener("contextmenu",noContextMenu,{signal:t});e.tabIndex=-1}this.div.prepend(editor_classPrivateFieldGet(si,this))}function _resizerPointerdown(e,t){t.preventDefault();const{isMac:i}=util_FeatureTest.platform;if(0!==t.button||t.ctrlKey&&i)return;editor_classPrivateFieldGet(Qt,this)?.toggle(!1);const a=this._isDraggable;this._isDraggable=!1;editor_classPrivateFieldSet(ni,this,[t.screenX,t.screenY]);const s=new AbortController,n=this._uiManager.combinedSignal(s);this.parent.togglePointerEvents(!1);window.addEventListener("pointermove",editor_assertClassBrand(yi,this,_resizerPointermove).bind(this,e),{passive:!0,capture:!0,signal:n});window.addEventListener("touchmove",stopEvent,{passive:!1,signal:n});window.addEventListener("contextmenu",noContextMenu,{signal:n});editor_classPrivateFieldSet(ri,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const r=this.parent.div.style.cursor,o=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const pointerUpCallback=()=>{s.abort();this.parent.togglePointerEvents(!0);editor_classPrivateFieldGet(Qt,this)?.toggle(!0);this._isDraggable=a;this.parent.div.style.cursor=r;this.div.style.cursor=o;editor_assertClassBrand(yi,this,_addResizeToUndoStack).call(this)};window.addEventListener("pointerup",pointerUpCallback,{signal:n});window.addEventListener("blur",pointerUpCallback,{signal:n})}function _resize(e,t,i,a){this.width=i;this.height=a;this.x=e;this.y=t;const[s,n]=this.parentDimensions;this.setDims(s*i,n*a);this.fixAndSetPosition();this._onResized()}function _addResizeToUndoStack(){if(!editor_classPrivateFieldGet(ri,this))return;const{savedX:e,savedY:t,savedWidth:i,savedHeight:a}=editor_classPrivateFieldGet(ri,this);editor_classPrivateFieldSet(ri,this,null);const s=this.x,n=this.y,r=this.width,o=this.height;if(s!==e||n!==t||r!==i||o!==a){this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"sizeChanged",editorType:this.constructor.name,page:this.pageIndex+1,value:{x:e,y:t,width:i,height:a}});this.addCommands({cmd:editor_assertClassBrand(yi,this,_resize).bind(this,s,n,r,o),undo:editor_assertClassBrand(yi,this,_resize).bind(this,e,t,i,a),mustExec:!0})}}function _resizerPointermove(e,t){const[i,a]=this.parentDimensions,s=this.x,n=this.y,r=this.width,o=this.height,l=Lt.MIN_SIZE/i,d=Lt.MIN_SIZE/a,c=editor_assertClassBrand(yi,this,_getRotationMatrix).call(this,this.rotation),transf=(e,t)=>[c[0]*e+c[2]*t,c[1]*e+c[3]*t],h=editor_assertClassBrand(yi,this,_getRotationMatrix).call(this,360-this.rotation);let u,_,p=!1,g=!1;switch(e){case"topLeft":p=!0;u=(e,t)=>[0,0];_=(e,t)=>[e,t];break;case"topMiddle":u=(e,t)=>[e/2,0];_=(e,t)=>[e/2,t];break;case"topRight":p=!0;u=(e,t)=>[e,0];_=(e,t)=>[0,t];break;case"middleRight":g=!0;u=(e,t)=>[e,t/2];_=(e,t)=>[0,t/2];break;case"bottomRight":p=!0;u=(e,t)=>[e,t];_=(e,t)=>[0,0];break;case"bottomMiddle":u=(e,t)=>[e/2,t];_=(e,t)=>[e/2,0];break;case"bottomLeft":p=!0;u=(e,t)=>[0,t];_=(e,t)=>[e,0];break;case"middleLeft":g=!0;u=(e,t)=>[0,t/2];_=(e,t)=>[e,t/2]}const f=u(r,o),v=_(r,o);let m=transf(...v);const w=Lt._round(s+m[0]),P=Lt._round(n+m[1]);let y,b,S=1,x=1;if(t.fromKeyboard)({deltaX:y,deltaY:b}=t);else{const{screenX:e,screenY:i}=t,[a,s]=editor_classPrivateFieldGet(ni,this);[y,b]=this.screenToPageTranslation(e-a,i-s);editor_classPrivateFieldGet(ni,this)[0]=e;editor_classPrivateFieldGet(ni,this)[1]=i}[y,b]=(C=y/i,A=b/a,[h[0]*C+h[2]*A,h[1]*C+h[3]*A]);var C,A;if(p){const e=Math.hypot(r,o);S=x=Math.max(Math.min(Math.hypot(v[0]-f[0]-y,v[1]-f[1]-b)/e,1/r,1/o),l/r,d/o)}else g?S=MathClamp(Math.abs(v[0]-f[0]-y),l,1)/r:x=MathClamp(Math.abs(v[1]-f[1]-b),d,1)/o;const E=Lt._round(r*S),k=Lt._round(o*x);m=transf(..._(E,k));const I=w-m[0],M=P-m[1];editor_classPrivateFieldGet(ci,this)||editor_classPrivateFieldSet(ci,this,[this.x,this.y,this.width,this.height]);this.width=E;this.height=k;this.x=I;this.y=M;this.setDims(i*E,a*k);this.fixAndSetPosition();this._onResizing()}function _touchPinchStartCallback(){editor_classPrivateFieldSet(ri,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});editor_classPrivateFieldGet(Qt,this)?.toggle(!1);this.parent.togglePointerEvents(!1)}function _touchPinchCallback(e,t,i){let a=i/t*.7+1-.7;if(1===a)return;const s=editor_assertClassBrand(yi,this,_getRotationMatrix).call(this,this.rotation),transf=(e,t)=>[s[0]*e+s[2]*t,s[1]*e+s[3]*t],[n,r]=this.parentDimensions,o=this.x,l=this.y,d=this.width,c=this.height,h=Lt.MIN_SIZE/n,u=Lt.MIN_SIZE/r;a=Math.max(Math.min(a,1/d,1/c),h/d,u/c);const _=Lt._round(d*a),p=Lt._round(c*a);if(_===d&&p===c)return;editor_classPrivateFieldGet(ci,this)||editor_classPrivateFieldSet(ci,this,[o,l,d,c]);const g=transf(d/2,c/2),f=Lt._round(o+g[0]),v=Lt._round(l+g[1]),m=transf(_/2,p/2);this.x=f-m[0];this.y=v-m[1];this.width=_;this.height=p;this.setDims(n*_,r*p);this.fixAndSetPosition();this._onResizing()}function _touchPinchEndCallback(){editor_classPrivateFieldGet(Qt,this)?.toggle(!0);this.parent.togglePointerEvents(!0);editor_assertClassBrand(yi,this,_addResizeToUndoStack).call(this)}function _selectOnPointerEvent(e){const{isMac:t}=util_FeatureTest.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}function _setUpDragSession(e){const{isSelected:t}=this;this._uiManager.setUpDragSession();let i=!1;const a=new AbortController,s=this._uiManager.combinedSignal(a),n={capture:!0,passive:!1,signal:s},cancelDrag=e=>{a.abort();editor_classPrivateFieldSet(ti,this,null);editor_classPrivateFieldSet(di,this,!1);this._uiManager.endDragSession()||editor_assertClassBrand(yi,this,_selectOnPointerEvent).call(this,e);i&&this._onStopDragging()};if(t){editor_classPrivateFieldSet(gi,this,e.clientX);editor_classPrivateFieldSet(fi,this,e.clientY);editor_classPrivateFieldSet(ti,this,e.pointerId);editor_classPrivateFieldSet(ii,this,e.pointerType);window.addEventListener("pointermove",(e=>{if(!i){i=!0;this._onStartDragging()}const{clientX:t,clientY:a,pointerId:s}=e;if(s!==editor_classPrivateFieldGet(ti,this)){stopEvent(e);return}const[n,r]=this.screenToPageTranslation(t-editor_classPrivateFieldGet(gi,this),a-editor_classPrivateFieldGet(fi,this));editor_classPrivateFieldSet(gi,this,t);editor_classPrivateFieldSet(fi,this,a);this._uiManager.dragSelectedEditors(n,r)}),n);window.addEventListener("touchmove",stopEvent,n);window.addEventListener("pointerdown",(e=>{e.pointerType===editor_classPrivateFieldGet(ii,this)&&(editor_classPrivateFieldGet(mi,this)||e.isPrimary)&&cancelDrag(e);stopEvent(e)}),n)}const pointerUpCallback=e=>{editor_classPrivateFieldGet(ti,this)&&editor_classPrivateFieldGet(ti,this)!==e.pointerId?stopEvent(e):cancelDrag(e)};window.addEventListener("pointerup",pointerUpCallback,{signal:s});window.addEventListener("blur",pointerUpCallback,{signal:s})}function _addFocusListeners(){if(editor_classPrivateFieldGet(oi,this)||!this.div)return;editor_classPrivateFieldSet(oi,this,new AbortController);const e=this._uiManager.combinedSignal(editor_classPrivateFieldGet(oi,this));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e});this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})}function _resizerKeydown(e){Lt._resizerKeyboardManager.exec(this,e)}function _resizerBlur(e){editor_classPrivateFieldGet(_i,this)&&e.relatedTarget?.parentNode!==editor_classPrivateFieldGet(si,this)&&editor_assertClassBrand(yi,this,_stopResizing).call(this)}function _resizerFocus(e){editor_classPrivateFieldSet(li,this,editor_classPrivateFieldGet(_i,this)?e:"")}function _setResizerTabIndex(e){if(editor_classPrivateFieldGet(Zt,this))for(const t of editor_classPrivateFieldGet(Zt,this))t.tabIndex=e}function _stopResizing(){editor_classPrivateFieldSet(_i,this,!1);editor_assertClassBrand(yi,this,_setResizerTabIndex).call(this,-1);editor_assertClassBrand(yi,this,_addResizeToUndoStack).call(this)}editor_defineProperty(AnnotationEditor,"_l10n",null);editor_defineProperty(AnnotationEditor,"_l10nResizer",null);editor_defineProperty(AnnotationEditor,"_borderLineWidth",-1);editor_defineProperty(AnnotationEditor,"_colorManager",new ColorManager);editor_defineProperty(AnnotationEditor,"_zIndex",1);editor_defineProperty(AnnotationEditor,"_telemetryTimeout",1e3);class FakeEditor extends AnnotationEditor{constructor(e){super(e);this.annotationElementId=e.annotationElementId;this.deleted=!0}serialize(){return this.serializeDeleted()}}const Fi=3285377520,bi=4294901760,Si=65535;class MurmurHash3_64{constructor(e){this.h1=e?4294967295&e:Fi;this.h2=e?4294967295&e:Fi}update(e){let t,i;if("string"==typeof e){t=new Uint8Array(2*e.length);i=0;for(let a=0,s=e.length;a<s;a++){const s=e.charCodeAt(a);if(s<=255)t[i++]=s;else{t[i++]=s>>>8;t[i++]=255&s}}}else{if(!ArrayBuffer.isView(e))throw new Error("Invalid data format, must be a string or TypedArray.");t=e.slice();i=t.byteLength}const a=i>>2,s=i-4*a,n=new Uint32Array(t.buffer,0,a);let r=0,o=0,l=this.h1,d=this.h2;const c=3432918353,h=461845907,u=11601,_=13715;for(let e=0;e<a;e++)if(1&e){r=n[e];r=r*c&bi|r*u&Si;r=r<<15|r>>>17;r=r*h&bi|r*_&Si;l^=r;l=l<<13|l>>>19;l=5*l+3864292196}else{o=n[e];o=o*c&bi|o*u&Si;o=o<<15|o>>>17;o=o*h&bi|o*_&Si;d^=o;d=d<<13|d>>>19;d=5*d+3864292196}r=0;switch(s){case 3:r^=t[4*a+2]<<16;case 2:r^=t[4*a+1]<<8;case 1:r^=t[4*a];r=r*c&bi|r*u&Si;r=r<<15|r>>>17;r=r*h&bi|r*_&Si;1&a?l^=r:d^=r}this.h1=l;this.h2=d}hexdigest(){let e=this.h1,t=this.h2;e^=t>>>1;e=3981806797*e&bi|36045*e&Si;t=4283543511*t&bi|(2950163797*(t<<16|e>>>16)&bi)>>>16;e^=t>>>1;e=444984403*e&bi|60499*e&Si;t=3301882366*t&bi|(3120437893*(t<<16|e>>>16)&bi)>>>16;e^=t>>>1;return(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}function annotation_storage_classPrivateFieldInitSpec(e,t,i){annotation_storage_checkPrivateRedeclaration(e,t),t.set(e,i)}function annotation_storage_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function annotation_storage_classPrivateFieldSet(e,t,i){return e.set(annotation_storage_assertClassBrand(e,t),i),i}function annotation_storage_classPrivateFieldGet(e,t){return e.get(annotation_storage_assertClassBrand(e,t))}function annotation_storage_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const xi=Object.freeze({map:null,hash:"",transfer:void 0});var Ci=new WeakMap,Ai=new WeakMap,Ei=new WeakMap,ki=new WeakSet;class AnnotationStorage{constructor(){!function annotation_storage_classPrivateMethodInitSpec(e,t){annotation_storage_checkPrivateRedeclaration(e,t),t.add(e)}(this,ki);annotation_storage_classPrivateFieldInitSpec(this,Ci,!1);annotation_storage_classPrivateFieldInitSpec(this,Ai,null);annotation_storage_classPrivateFieldInitSpec(this,Ei,new Map);this.onSetModified=null;this.onResetModified=null;this.onAnnotationEditor=null}getValue(e,t){const i=annotation_storage_classPrivateFieldGet(Ei,this).get(e);return void 0===i?t:Object.assign(t,i)}getRawValue(e){return annotation_storage_classPrivateFieldGet(Ei,this).get(e)}remove(e){annotation_storage_classPrivateFieldGet(Ei,this).delete(e);0===annotation_storage_classPrivateFieldGet(Ei,this).size&&this.resetModified();if("function"==typeof this.onAnnotationEditor){for(const e of annotation_storage_classPrivateFieldGet(Ei,this).values())if(e instanceof AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(e,t){const i=annotation_storage_classPrivateFieldGet(Ei,this).get(e);let a=!1;if(void 0!==i){for(const[e,s]of Object.entries(t))if(i[e]!==s){a=!0;i[e]=s}}else{a=!0;annotation_storage_classPrivateFieldGet(Ei,this).set(e,t)}a&&annotation_storage_assertClassBrand(ki,this,_setModified).call(this);t instanceof AnnotationEditor&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(t.constructor._type)}has(e){return annotation_storage_classPrivateFieldGet(Ei,this).has(e)}get size(){return annotation_storage_classPrivateFieldGet(Ei,this).size}resetModified(){if(annotation_storage_classPrivateFieldGet(Ci,this)){annotation_storage_classPrivateFieldSet(Ci,this,!1);"function"==typeof this.onResetModified&&this.onResetModified()}}get print(){return new PrintAnnotationStorage(this)}get serializable(){if(0===annotation_storage_classPrivateFieldGet(Ei,this).size)return xi;const e=new Map,t=new MurmurHash3_64,i=[],a=Object.create(null);let s=!1;for(const[i,n]of annotation_storage_classPrivateFieldGet(Ei,this)){const r=n instanceof AnnotationEditor?n.serialize(!1,a):n;if(r){e.set(i,r);t.update(`${i}:${JSON.stringify(r)}`);s||=!!r.bitmap}}if(s)for(const t of e.values())t.bitmap&&i.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:i}:xi}get editorStats(){let e=null;const t=new Map;for(const i of annotation_storage_classPrivateFieldGet(Ei,this).values()){if(!(i instanceof AnnotationEditor))continue;const a=i.telemetryFinalData;if(!a)continue;const{type:s}=a;t.has(s)||t.set(s,Object.getPrototypeOf(i).constructor);e||=Object.create(null);const n=e[s]||=new Map;for(const[e,t]of Object.entries(a)){if("type"===e)continue;let i=n.get(e);if(!i){i=new Map;n.set(e,i)}const a=i.get(t)??0;i.set(t,a+1)}}for(const[i,a]of t)e[i]=a.computeTelemetryFinalData(e[i]);return e}resetModifiedIds(){annotation_storage_classPrivateFieldSet(Ai,this,null)}get modifiedIds(){if(annotation_storage_classPrivateFieldGet(Ai,this))return annotation_storage_classPrivateFieldGet(Ai,this);const e=[];for(const t of annotation_storage_classPrivateFieldGet(Ei,this).values())t instanceof AnnotationEditor&&t.annotationElementId&&t.serialize()&&e.push(t.annotationElementId);return annotation_storage_classPrivateFieldSet(Ai,this,{ids:new Set(e),hash:e.join(",")})}[Symbol.iterator](){return annotation_storage_classPrivateFieldGet(Ei,this).entries()}}function _setModified(){if(!annotation_storage_classPrivateFieldGet(Ci,this)){annotation_storage_classPrivateFieldSet(Ci,this,!0);"function"==typeof this.onSetModified&&this.onSetModified()}}var Ii=new WeakMap;class PrintAnnotationStorage extends AnnotationStorage{constructor(e){super();annotation_storage_classPrivateFieldInitSpec(this,Ii,void 0);const{map:t,hash:i,transfer:a}=e.serializable,s=structuredClone(t,a?{transfer:a}:null);annotation_storage_classPrivateFieldSet(Ii,this,{map:s,hash:i,transfer:a})}get print(){unreachable("Should not call PrintAnnotationStorage.print")}get serializable(){return annotation_storage_classPrivateFieldGet(Ii,this)}get modifiedIds(){return shadow(this,"modifiedIds",{ids:new Set,hash:""})}}function font_loader_classPrivateFieldInitSpec(e,t,i){(function font_loader_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function font_loader_classPrivateFieldGet(e,t){return e.get(function font_loader_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}(e,t))}var Mi=new WeakMap;class FontLoader{constructor(e){let{ownerDocument:t=globalThis.document,styleElement:i=null}=e;font_loader_classPrivateFieldInitSpec(this,Mi,new Set);this._document=t;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){if(!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();font_loader_classPrivateFieldGet(Mi,this).clear();if(this.styleElement){this.styleElement.remove();this.styleElement=null}}async loadSystemFont(e){let{systemFontInfo:t,disableFontFace:i,_inspectFont:a}=e;if(t&&!font_loader_classPrivateFieldGet(Mi,this).has(t.loadedName)){assert(!i,"loadSystemFont shouldn't be called when `disableFontFace` is set.");if(this.isFontLoadingAPISupported){const{loadedName:e,src:i,style:s}=t,n=new FontFace(e,i,s);this.addNativeFontFace(n);try{await n.load();font_loader_classPrivateFieldGet(Mi,this).add(e);a?.(t)}catch{warn(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`);this.removeNativeFontFace(n)}}else unreachable("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;e.attached=!0;if(e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){const t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(i){warn(`Failed to load font '${t.family}': '${i}'.`);e.disableFontFace=!0;throw i}}return}const t=e.createFontFaceRule();if(t){this.insertRule(t);if(this.isSyncFontLoadingSupported)return;await new Promise((t=>{const i=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,i)}))}}get isFontLoadingAPISupported(){return shadow(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){return shadow(this,"isSyncFontLoadingSupported",a||util_FeatureTest.platform.isFirefox)}_queueLoadingCallback(e){const{loadingRequests:t}=this,i={done:!1,complete:function completeRequest(){assert(!i.done,"completeRequest() cannot be called twice.");i.done=!0;for(;t.length>0&&t[0].done;){const e=t.shift();setTimeout(e.callback,0)}},callback:e};t.push(i);return i}get _loadTestFont(){return shadow(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(e,t){function int32(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function spliceString(e,t,i,a){return e.substring(0,t)+a+e.substring(t+i)}let i,a;const s=this._document.createElement("canvas");s.width=1;s.height=1;const n=s.getContext("2d");let r=0;const o=`lt${Date.now()}${this.loadTestFontId++}`;let l=this._loadTestFont;l=spliceString(l,976,o.length,o);const d=1482184792;let c=int32(l,16);for(i=0,a=o.length-3;i<a;i+=4)c=c-d+int32(o,i)|0;i<o.length&&(c=c-d+int32(o+"XXX",i)|0);l=spliceString(l,16,4,function string32(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)}(c));const h=`@font-face {font-family:"${o}";src:${`url(data:font/opentype;base64,${btoa(l)});`}}`;this.insertRule(h);const u=this._document.createElement("div");u.style.visibility="hidden";u.style.width=u.style.height="10px";u.style.position="absolute";u.style.top=u.style.left="0px";for(const t of[e.loadedName,o]){const e=this._document.createElement("span");e.textContent="Hi";e.style.fontFamily=t;u.append(e)}this._document.body.append(u);!function isFontReady(e,t){if(++r>30){warn("Load test font never loaded.");t();return}n.font="30px "+e;n.fillText(".",0,20);n.getImageData(0,0,1,1).data[3]>0?t():setTimeout(isFontReady.bind(null,e,t))}(o,(()=>{u.remove();t.complete()}))}}class FontFaceObject{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.compiledGlyphs=Object.create(null);for(const t in e)this[t]=e[t];this._inspectFont=t}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`);e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});this._inspectFont?.(this);return e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${toBase64Util(this.data)});`;let t;if(this.cssFontInfo){let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`);t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${i}src:${e}}`}else t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;this._inspectFont?.(this,e);return t}getPathGenerator(e,t){if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];const i=this.loadedName+"_path_"+t;let a;try{a=e.get(i)}catch(e){warn(`getPathGenerator - ignoring character: "${e}".`)}const s=new Path2D(a||"");this.fontExtraProperties||e.delete(i);return this.compiledGlyphs[t]=s}}function api_utils_classPrivateFieldInitSpec(e,t,i){(function api_utils_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function api_utils_classPrivateFieldGet(e,t){return e.get(function api_utils_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}(e,t))}function getFactoryUrlProp(e){if("string"!=typeof e)return null;if(e.endsWith("/"))return e;throw new Error(`Invalid factory url: "${e}" must include trailing slash.`)}const isRefProxy=e=>"object"==typeof e&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0,Bi=function _isValidExplicitDest(e,t,i){if(!Array.isArray(i)||i.length<2)return!1;const[a,s,...n]=i;if(!e(a)&&!Number.isInteger(a))return!1;if(!t(s))return!1;const r=n.length;let o=!0;switch(s.name){case"XYZ":if(r<2||r>3)return!1;break;case"Fit":case"FitB":return 0===r;case"FitH":case"FitBH":case"FitV":case"FitBV":if(r>1)return!1;break;case"FitR":if(4!==r)return!1;o=!1;break;default:return!1}for(const e of n)if(!("number"==typeof e||o&&null===e))return!1;return!0}.bind(null,isRefProxy,(e=>"object"==typeof e&&"string"==typeof e?.name));var Gi=new WeakMap,Ti=new WeakMap;class LoopbackPort{constructor(){api_utils_classPrivateFieldInitSpec(this,Gi,new Map);api_utils_classPrivateFieldInitSpec(this,Ti,Promise.resolve())}postMessage(e,t){const i={data:structuredClone(e,t?{transfer:t}:null)};api_utils_classPrivateFieldGet(Ti,this).then((()=>{for(const[e]of api_utils_classPrivateFieldGet(Gi,this))e.call(this,i)}))}addEventListener(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=null;if(i?.signal instanceof AbortSignal){const{signal:s}=i;if(s.aborted){warn("LoopbackPort - cannot use an `aborted` signal.");return}const onAbort=()=>this.removeEventListener(e,t);a=()=>s.removeEventListener("abort",onAbort);s.addEventListener("abort",onAbort)}api_utils_classPrivateFieldGet(Gi,this).set(t,a)}removeEventListener(e,t){const i=api_utils_classPrivateFieldGet(Gi,this).get(t);i?.();api_utils_classPrivateFieldGet(Gi,this).delete(t)}terminate(){for(const[,e]of api_utils_classPrivateFieldGet(Gi,this))e?.();api_utils_classPrivateFieldGet(Gi,this).clear()}}function message_handler_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function message_handler_classPrivateFieldGet(e,t){return e.get(message_handler_assertClassBrand(e,t))}function message_handler_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Di=1,Li=2,Ri=1,Ni=2,Oi=3,Wi=4,ji=5,Vi=6,Hi=7,zi=8;function onFn(){}function wrapReason(e){if(e instanceof AbortException||e instanceof InvalidPDFException||e instanceof PasswordException||e instanceof ResponseException||e instanceof UnknownErrorException)return e;e instanceof Error||"object"==typeof e&&null!==e||unreachable('wrapReason: Expected "reason" to be a (possibly cloned) Error.');switch(e.name){case"AbortException":return new AbortException(e.message);case"InvalidPDFException":return new InvalidPDFException(e.message);case"PasswordException":return new PasswordException(e.message,e.code);case"ResponseException":return new ResponseException(e.message,e.status,e.missing);case"UnknownErrorException":return new UnknownErrorException(e.message,e.details)}return new UnknownErrorException(e.message,e.toString())}var Ui=new WeakMap,$i=new WeakSet;class MessageHandler{constructor(e,t,i){!function message_handler_classPrivateMethodInitSpec(e,t){message_handler_checkPrivateRedeclaration(e,t),t.add(e)}(this,$i);!function message_handler_classPrivateFieldInitSpec(e,t,i){message_handler_checkPrivateRedeclaration(e,t),t.set(e,i)}(this,Ui,new AbortController);this.sourceName=e;this.targetName=t;this.comObj=i;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);i.addEventListener("message",message_handler_assertClassBrand($i,this,_onMessage).bind(this),{signal:message_handler_classPrivateFieldGet(Ui,this).signal})}on(e,t){const i=this.actionHandler;if(i[e])throw new Error(`There is already an actionName called "${e}"`);i[e]=t}send(e,t,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},i)}sendWithPromise(e,t,i){const a=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[a]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:a,data:t},i)}catch(e){s.reject(e)}return s.promise}sendWithStream(e,t,i,a){const s=this.streamId++,n=this.sourceName,r=this.targetName,o=this.comObj;return new ReadableStream({start:i=>{const l=Promise.withResolvers();this.streamControllers[s]={controller:i,startCall:l,pullCall:null,cancelCall:null,isClosed:!1};o.postMessage({sourceName:n,targetName:r,action:e,streamId:s,data:t,desiredSize:i.desiredSize},a);return l.promise},pull:e=>{const t=Promise.withResolvers();this.streamControllers[s].pullCall=t;o.postMessage({sourceName:n,targetName:r,stream:Vi,streamId:s,desiredSize:e.desiredSize});return t.promise},cancel:e=>{assert(e instanceof Error,"cancel must have a valid reason");const t=Promise.withResolvers();this.streamControllers[s].cancelCall=t;this.streamControllers[s].isClosed=!0;o.postMessage({sourceName:n,targetName:r,stream:Ri,streamId:s,reason:wrapReason(e)});return t.promise}},i)}destroy(){message_handler_classPrivateFieldGet(Ui,this)?.abort();!function message_handler_classPrivateFieldSet(e,t,i){return e.set(message_handler_assertClassBrand(e,t),i),i}(Ui,this,null)}}function _onMessage(e){let{data:t}=e;if(t.targetName!==this.sourceName)return;if(t.stream){message_handler_assertClassBrand($i,this,_processStreamMessage).call(this,t);return}if(t.callback){const e=t.callbackId,i=this.callbackCapabilities[e];if(!i)throw new Error(`Cannot resolve callback ${e}`);delete this.callbackCapabilities[e];if(t.callback===Di)i.resolve(t.data);else{if(t.callback!==Li)throw new Error("Unexpected callback case");i.reject(wrapReason(t.reason))}return}const i=this.actionHandler[t.action];if(!i)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const e=this.sourceName,a=t.sourceName,s=this.comObj;Promise.try(i,t.data).then((function(i){s.postMessage({sourceName:e,targetName:a,callback:Di,callbackId:t.callbackId,data:i})}),(function(i){s.postMessage({sourceName:e,targetName:a,callback:Li,callbackId:t.callbackId,reason:wrapReason(i)})}))}else t.streamId?message_handler_assertClassBrand($i,this,_createStreamSink).call(this,t):i(t.data)}function _createStreamSink(e){const t=e.streamId,i=this.sourceName,a=e.sourceName,s=this.comObj,n=this,r=this.actionHandler[e.action],o={enqueue(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;const o=this.desiredSize;this.desiredSize-=n;if(o>0&&this.desiredSize<=0){this.sinkCapability=Promise.withResolvers();this.ready=this.sinkCapability.promise}s.postMessage({sourceName:i,targetName:a,stream:Wi,streamId:t,chunk:e},r)},close(){if(!this.isCancelled){this.isCancelled=!0;s.postMessage({sourceName:i,targetName:a,stream:Oi,streamId:t});delete n.streamSinks[t]}},error(e){assert(e instanceof Error,"error must have a valid reason");if(!this.isCancelled){this.isCancelled=!0;s.postMessage({sourceName:i,targetName:a,stream:ji,streamId:t,reason:wrapReason(e)})}},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};o.sinkCapability.resolve();o.ready=o.sinkCapability.promise;this.streamSinks[t]=o;Promise.try(r,e.data,o).then((function(){s.postMessage({sourceName:i,targetName:a,stream:zi,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:i,targetName:a,stream:zi,streamId:t,reason:wrapReason(e)})}))}function _processStreamMessage(e){const t=e.streamId,i=this.sourceName,a=e.sourceName,s=this.comObj,n=this.streamControllers[t],r=this.streamSinks[t];switch(e.stream){case zi:e.success?n.startCall.resolve():n.startCall.reject(wrapReason(e.reason));break;case Hi:e.success?n.pullCall.resolve():n.pullCall.reject(wrapReason(e.reason));break;case Vi:if(!r){s.postMessage({sourceName:i,targetName:a,stream:Hi,streamId:t,success:!0});break}r.desiredSize<=0&&e.desiredSize>0&&r.sinkCapability.resolve();r.desiredSize=e.desiredSize;Promise.try(r.onPull||onFn).then((function(){s.postMessage({sourceName:i,targetName:a,stream:Hi,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:i,targetName:a,stream:Hi,streamId:t,reason:wrapReason(e)})}));break;case Wi:assert(n,"enqueue should have stream controller");if(n.isClosed)break;n.controller.enqueue(e.chunk);break;case Oi:assert(n,"close should have stream controller");if(n.isClosed)break;n.isClosed=!0;n.controller.close();message_handler_assertClassBrand($i,this,_deleteStreamController).call(this,n,t);break;case ji:assert(n,"error should have stream controller");n.controller.error(wrapReason(e.reason));message_handler_assertClassBrand($i,this,_deleteStreamController).call(this,n,t);break;case Ni:e.success?n.cancelCall.resolve():n.cancelCall.reject(wrapReason(e.reason));message_handler_assertClassBrand($i,this,_deleteStreamController).call(this,n,t);break;case Ri:if(!r)break;const o=wrapReason(e.reason);Promise.try(r.onCancel||onFn,o).then((function(){s.postMessage({sourceName:i,targetName:a,stream:Ni,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:i,targetName:a,stream:Ni,streamId:t,reason:wrapReason(e)})}));r.sinkCapability.reject(o);r.isCancelled=!0;delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async function _deleteStreamController(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]);delete this.streamControllers[t]}function canvas_factory_classPrivateFieldInitSpec(e,t,i){(function canvas_factory_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function canvas_factory_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var qi=new WeakMap;class BaseCanvasFactory{constructor(e){let{enableHWA:t=!1}=e;canvas_factory_classPrivateFieldInitSpec(this,qi,!1);!function canvas_factory_classPrivateFieldSet(e,t,i){return e.set(canvas_factory_assertClassBrand(e,t),i),i}(qi,this,t)}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(e,t);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!(a=qi,s=this,a.get(canvas_factory_assertClassBrand(a,s)))})};var a,s}reset(e,t,i){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||i<=0)throw new Error("Invalid canvas size");e.canvas.width=t;e.canvas.height=i}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0;e.canvas.height=0;e.canvas=null;e.context=null}_createCanvas(e,t){unreachable("Abstract method `_createCanvas` called.")}}class DOMCanvasFactory extends BaseCanvasFactory{constructor(e){let{ownerDocument:t=globalThis.document,enableHWA:i=!1}=e;super({enableHWA:i});this._document=t}_createCanvas(e,t){const i=this._document.createElement("canvas");i.width=e;i.height=t;return i}}class BaseCMapReaderFactory{constructor(e){let{baseUrl:t=null,isCompressed:i=!0}=e;this.baseUrl=t;this.isCompressed=i}async fetch(e){let{name:t}=e;if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!t)throw new Error("CMap name must be specified.");const i=this.baseUrl+t+(this.isCompressed?".bcmap":"");return this._fetch(i).then((e=>({cMapData:e,isCompressed:this.isCompressed}))).catch((e=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${i}`)}))}async _fetch(e){unreachable("Abstract method `_fetch` called.")}}class DOMCMapReaderFactory extends BaseCMapReaderFactory{async _fetch(e){const t=await fetchData(e,this.isCompressed?"arraybuffer":"text");return t instanceof ArrayBuffer?new Uint8Array(t):stringToBytes(t)}}__webpack_require__(2489);function filter_factory_classPrivateFieldInitSpec(e,t,i){filter_factory_checkPrivateRedeclaration(e,t),t.set(e,i)}function filter_factory_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function filter_factory_classPrivateGetter(e,t,i){return i(filter_factory_assertClassBrand(e,t))}function filter_factory_classPrivateFieldGet(e,t){return e.get(filter_factory_assertClassBrand(e,t))}function filter_factory_classPrivateFieldSet(e,t,i){return e.set(filter_factory_assertClassBrand(e,t),i),i}function filter_factory_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}class BaseFilterFactory{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,i,a,s){return"none"}destroy(){}}var Xi=new WeakMap,Ki=new WeakMap,Yi=new WeakMap,Zi=new WeakMap,Qi=new WeakMap,Ji=new WeakMap,ea=new WeakMap,ta=new WeakSet;class DOMFilterFactory extends BaseFilterFactory{constructor(e){let{docId:t,ownerDocument:i=globalThis.document}=e;super();!function filter_factory_classPrivateMethodInitSpec(e,t){filter_factory_checkPrivateRedeclaration(e,t),t.add(e)}(this,ta);filter_factory_classPrivateFieldInitSpec(this,Xi,void 0);filter_factory_classPrivateFieldInitSpec(this,Ki,void 0);filter_factory_classPrivateFieldInitSpec(this,Yi,void 0);filter_factory_classPrivateFieldInitSpec(this,Zi,void 0);filter_factory_classPrivateFieldInitSpec(this,Qi,void 0);filter_factory_classPrivateFieldInitSpec(this,Ji,void 0);filter_factory_classPrivateFieldInitSpec(this,ea,0);filter_factory_classPrivateFieldSet(Zi,this,t);filter_factory_classPrivateFieldSet(Qi,this,i)}addFilter(e){var t,i;if(!e)return"none";let a=filter_factory_classPrivateGetter(ta,this,_get_cache).get(e);if(a)return a;const[s,n,r]=filter_factory_assertClassBrand(ta,this,_createTables).call(this,e),o=1===e.length?s:`${s}${n}${r}`;a=filter_factory_classPrivateGetter(ta,this,_get_cache).get(o);if(a){filter_factory_classPrivateGetter(ta,this,_get_cache).set(e,a);return a}const l=`g_${filter_factory_classPrivateFieldGet(Zi,this)}_transfer_map_${filter_factory_classPrivateFieldSet(ea,this,(t=filter_factory_classPrivateFieldGet(ea,this),i=t++,t)),i}`,d=filter_factory_assertClassBrand(ta,this,_createUrl).call(this,l);filter_factory_classPrivateGetter(ta,this,_get_cache).set(e,d);filter_factory_classPrivateGetter(ta,this,_get_cache).set(o,d);const c=filter_factory_assertClassBrand(ta,this,_createFilter).call(this,l);filter_factory_assertClassBrand(ta,this,_addTransferMapConversion).call(this,s,n,r,c);return d}addHCMFilter(e,t){const i=`${e}-${t}`,a="base";let s=filter_factory_classPrivateGetter(ta,this,_get_hcmCache).get(a);if(s?.key===i)return s.url;if(s){s.filter?.remove();s.key=i;s.url="none";s.filter=null}else{s={key:i,url:"none",filter:null};filter_factory_classPrivateGetter(ta,this,_get_hcmCache).set(a,s)}if(!e||!t)return s.url;const n=filter_factory_assertClassBrand(ta,this,_getRGB).call(this,e);e=Util.makeHexColor(...n);const r=filter_factory_assertClassBrand(ta,this,_getRGB).call(this,t);t=Util.makeHexColor(...r);filter_factory_classPrivateGetter(ta,this,_get_defs).style.color="";if("#000000"===e&&"#ffffff"===t||e===t)return s.url;const o=new Array(256);for(let e=0;e<=255;e++){const t=e/255;o[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const l=o.join(","),d=`g_${filter_factory_classPrivateFieldGet(Zi,this)}_hcm_filter`,c=s.filter=filter_factory_assertClassBrand(ta,this,_createFilter).call(this,d);filter_factory_assertClassBrand(ta,this,_addTransferMapConversion).call(this,l,l,l,c);filter_factory_assertClassBrand(ta,this,_addGrayConversion).call(this,c);const getSteps=(e,t)=>{const i=n[e]/255,a=r[e]/255,s=new Array(t+1);for(let e=0;e<=t;e++)s[e]=i+e/t*(a-i);return s.join(",")};filter_factory_assertClassBrand(ta,this,_addTransferMapConversion).call(this,getSteps(0,5),getSteps(1,5),getSteps(2,5),c);s.url=filter_factory_assertClassBrand(ta,this,_createUrl).call(this,d);return s.url}addAlphaFilter(e){var t,i;let a=filter_factory_classPrivateGetter(ta,this,_get_cache).get(e);if(a)return a;const[s]=filter_factory_assertClassBrand(ta,this,_createTables).call(this,[e]),n=`alpha_${s}`;a=filter_factory_classPrivateGetter(ta,this,_get_cache).get(n);if(a){filter_factory_classPrivateGetter(ta,this,_get_cache).set(e,a);return a}const r=`g_${filter_factory_classPrivateFieldGet(Zi,this)}_alpha_map_${filter_factory_classPrivateFieldSet(ea,this,(t=filter_factory_classPrivateFieldGet(ea,this),i=t++,t)),i}`,o=filter_factory_assertClassBrand(ta,this,_createUrl).call(this,r);filter_factory_classPrivateGetter(ta,this,_get_cache).set(e,o);filter_factory_classPrivateGetter(ta,this,_get_cache).set(n,o);const l=filter_factory_assertClassBrand(ta,this,_createFilter).call(this,r);filter_factory_assertClassBrand(ta,this,_addTransferMapAlphaConversion).call(this,s,l);return o}addLuminosityFilter(e){var t,i;let a,s,n=filter_factory_classPrivateGetter(ta,this,_get_cache).get(e||"luminosity");if(n)return n;if(e){[a]=filter_factory_assertClassBrand(ta,this,_createTables).call(this,[e]);s=`luminosity_${a}`}else s="luminosity";n=filter_factory_classPrivateGetter(ta,this,_get_cache).get(s);if(n){filter_factory_classPrivateGetter(ta,this,_get_cache).set(e,n);return n}const r=`g_${filter_factory_classPrivateFieldGet(Zi,this)}_luminosity_map_${filter_factory_classPrivateFieldSet(ea,this,(t=filter_factory_classPrivateFieldGet(ea,this),i=t++,t)),i}`,o=filter_factory_assertClassBrand(ta,this,_createUrl).call(this,r);filter_factory_classPrivateGetter(ta,this,_get_cache).set(e,o);filter_factory_classPrivateGetter(ta,this,_get_cache).set(s,o);const l=filter_factory_assertClassBrand(ta,this,_createFilter).call(this,r);filter_factory_assertClassBrand(ta,this,_addLuminosityConversion).call(this,l);e&&filter_factory_assertClassBrand(ta,this,_addTransferMapAlphaConversion).call(this,a,l);return o}addHighlightHCMFilter(e,t,i,a,s){const n=`${t}-${i}-${a}-${s}`;let r=filter_factory_classPrivateGetter(ta,this,_get_hcmCache).get(e);if(r?.key===n)return r.url;if(r){r.filter?.remove();r.key=n;r.url="none";r.filter=null}else{r={key:n,url:"none",filter:null};filter_factory_classPrivateGetter(ta,this,_get_hcmCache).set(e,r)}if(!t||!i)return r.url;const[o,l]=[t,i].map(filter_factory_assertClassBrand(ta,this,_getRGB).bind(this));let d=Math.round(.2126*o[0]+.7152*o[1]+.0722*o[2]),c=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),[h,u]=[a,s].map(filter_factory_assertClassBrand(ta,this,_getRGB).bind(this));c<d&&([d,c,h,u]=[c,d,u,h]);filter_factory_classPrivateGetter(ta,this,_get_defs).style.color="";const getSteps=(e,t,i)=>{const a=new Array(256),s=(c-d)/i,n=e/255,r=(t-e)/(255*i);let o=0;for(let e=0;e<=i;e++){const t=Math.round(d+e*s),i=n+e*r;for(let e=o;e<=t;e++)a[e]=i;o=t+1}for(let e=o;e<256;e++)a[e]=a[o-1];return a.join(",")},_=`g_${filter_factory_classPrivateFieldGet(Zi,this)}_hcm_${e}_filter`,p=r.filter=filter_factory_assertClassBrand(ta,this,_createFilter).call(this,_);filter_factory_assertClassBrand(ta,this,_addGrayConversion).call(this,p);filter_factory_assertClassBrand(ta,this,_addTransferMapConversion).call(this,getSteps(h[0],u[0],5),getSteps(h[1],u[1],5),getSteps(h[2],u[2],5),p);r.url=filter_factory_assertClassBrand(ta,this,_createUrl).call(this,_);return r.url}destroy(){if(!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])||!filter_factory_classPrivateFieldGet(Ji,this)?.size){filter_factory_classPrivateFieldGet(Yi,this)?.parentNode.parentNode.remove();filter_factory_classPrivateFieldSet(Yi,this,null);filter_factory_classPrivateFieldGet(Ki,this)?.clear();filter_factory_classPrivateFieldSet(Ki,this,null);filter_factory_classPrivateFieldGet(Ji,this)?.clear();filter_factory_classPrivateFieldSet(Ji,this,null);filter_factory_classPrivateFieldSet(ea,this,0)}}}function _get_cache(e){return filter_factory_classPrivateFieldGet(Ki,e)||filter_factory_classPrivateFieldSet(Ki,e,new Map)}function _get_hcmCache(e){return filter_factory_classPrivateFieldGet(Ji,e)||filter_factory_classPrivateFieldSet(Ji,e,new Map)}function _get_defs(e){if(!filter_factory_classPrivateFieldGet(Yi,e)){const t=filter_factory_classPrivateFieldGet(Qi,e).createElement("div"),{style:i}=t;i.visibility="hidden";i.contain="strict";i.width=i.height=0;i.position="absolute";i.top=i.left=0;i.zIndex=-1;const a=filter_factory_classPrivateFieldGet(Qi,e).createElementNS(q,"svg");a.setAttribute("width",0);a.setAttribute("height",0);filter_factory_classPrivateFieldSet(Yi,e,filter_factory_classPrivateFieldGet(Qi,e).createElementNS(q,"defs"));t.append(a);a.append(filter_factory_classPrivateFieldGet(Yi,e));filter_factory_classPrivateFieldGet(Qi,e).body.append(t)}return filter_factory_classPrivateFieldGet(Yi,e)}function _createTables(e){if(1===e.length){const t=e[0],i=new Array(256);for(let e=0;e<256;e++)i[e]=t[e]/255;const a=i.join(",");return[a,a,a]}const[t,i,a]=e,s=new Array(256),n=new Array(256),r=new Array(256);for(let e=0;e<256;e++){s[e]=t[e]/255;n[e]=i[e]/255;r[e]=a[e]/255}return[s.join(","),n.join(","),r.join(",")]}function _createUrl(e){if(void 0===filter_factory_classPrivateFieldGet(Xi,this)){filter_factory_classPrivateFieldSet(Xi,this,"");const e=filter_factory_classPrivateFieldGet(Qi,this).URL;e!==filter_factory_classPrivateFieldGet(Qi,this).baseURI&&(isDataScheme(e)?warn('#createUrl: ignore "data:"-URL for performance reasons.'):filter_factory_classPrivateFieldSet(Xi,this,updateUrlHash(e,"")))}return`url(${filter_factory_classPrivateFieldGet(Xi,this)}#${e})`}function _addLuminosityConversion(e){const t=filter_factory_classPrivateFieldGet(Qi,this).createElementNS(q,"feColorMatrix");t.setAttribute("type","matrix");t.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0");e.append(t)}function _addGrayConversion(e){const t=filter_factory_classPrivateFieldGet(Qi,this).createElementNS(q,"feColorMatrix");t.setAttribute("type","matrix");t.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0");e.append(t)}function _createFilter(e){const t=filter_factory_classPrivateFieldGet(Qi,this).createElementNS(q,"filter");t.setAttribute("color-interpolation-filters","sRGB");t.setAttribute("id",e);filter_factory_classPrivateGetter(ta,this,_get_defs).append(t);return t}function _appendFeFunc(e,t,i){const a=filter_factory_classPrivateFieldGet(Qi,this).createElementNS(q,t);a.setAttribute("type","discrete");a.setAttribute("tableValues",i);e.append(a)}function _addTransferMapConversion(e,t,i,a){const s=filter_factory_classPrivateFieldGet(Qi,this).createElementNS(q,"feComponentTransfer");a.append(s);filter_factory_assertClassBrand(ta,this,_appendFeFunc).call(this,s,"feFuncR",e);filter_factory_assertClassBrand(ta,this,_appendFeFunc).call(this,s,"feFuncG",t);filter_factory_assertClassBrand(ta,this,_appendFeFunc).call(this,s,"feFuncB",i)}function _addTransferMapAlphaConversion(e,t){const i=filter_factory_classPrivateFieldGet(Qi,this).createElementNS(q,"feComponentTransfer");t.append(i);filter_factory_assertClassBrand(ta,this,_appendFeFunc).call(this,i,"feFuncA",e)}function _getRGB(e){filter_factory_classPrivateGetter(ta,this,_get_defs).style.color=e;return getRGB(getComputedStyle(filter_factory_classPrivateGetter(ta,this,_get_defs)).getPropertyValue("color"))}class BaseStandardFontDataFactory{constructor(e){let{baseUrl:t=null}=e;this.baseUrl=t}async fetch(e){let{filename:t}=e;if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!t)throw new Error("Font filename must be specified.");const i=`${this.baseUrl}${t}`;return this._fetch(i).catch((e=>{throw new Error(`Unable to load font data at: ${i}`)}))}async _fetch(e){unreachable("Abstract method `_fetch` called.")}}class DOMStandardFontDataFactory extends BaseStandardFontDataFactory{async _fetch(e){const t=await fetchData(e,"arraybuffer");return new Uint8Array(t)}}class BaseWasmFactory{constructor(e){let{baseUrl:t=null}=e;this.baseUrl=t}async fetch(e){let{filename:t}=e;if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!t)throw new Error("Wasm filename must be specified.");const i=`${this.baseUrl}${t}`;return this._fetch(i).catch((e=>{throw new Error(`Unable to load wasm data at: ${i}`)}))}async _fetch(e){unreachable("Abstract method `_fetch` called.")}}class DOMWasmFactory extends BaseWasmFactory{async _fetch(e){const t=await fetchData(e,"arraybuffer");return new Uint8Array(t)}}async function node_utils_fetchData(e){const t=process.getBuiltinModule("fs"),i=await t.promises.readFile(e);return new Uint8Array(i)}class NodeFilterFactory extends BaseFilterFactory{}class NodeCanvasFactory extends BaseCanvasFactory{_createCanvas(e,t){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,t)}}class NodeCMapReaderFactory extends BaseCMapReaderFactory{async _fetch(e){return node_utils_fetchData(e)}}class NodeStandardFontDataFactory extends BaseStandardFontDataFactory{async _fetch(e){return node_utils_fetchData(e)}}class NodeWasmFactory extends BaseWasmFactory{async _fetch(e){return node_utils_fetchData(e)}}const ia="Fill",aa="Stroke",sa="Shading";function applyBoundingBox(e,t){if(!t)return;const i=t[2]-t[0],a=t[3]-t[1],s=new Path2D;s.rect(t[0],t[1],i,a);e.clip(s)}class BaseShadingPattern{isModifyingCurrentTransform(){return!1}getPattern(){unreachable("Abstract method `getPattern` called.")}}class RadialAxialShadingPattern extends BaseShadingPattern{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}_createGradient(e){let t;"axial"===this._type?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const e of this._colorStops)t.addColorStop(e[0],e[1]);return t}getPattern(e,t,i,a){let s;if(a===aa||a===ia){const n=t.current.getClippedPathBoundingBox(a,getCurrentTransform(e))||[0,0,0,0],r=Math.ceil(n[2]-n[0])||1,o=Math.ceil(n[3]-n[1])||1,l=t.cachedCanvases.getCanvas("pattern",r,o),d=l.context;d.clearRect(0,0,d.canvas.width,d.canvas.height);d.beginPath();d.rect(0,0,d.canvas.width,d.canvas.height);d.translate(-n[0],-n[1]);i=Util.transform(i,[1,0,0,1,n[0],n[1]]);d.transform(...t.baseTransform);this.matrix&&d.transform(...this.matrix);applyBoundingBox(d,this._bbox);d.fillStyle=this._createGradient(d);d.fill();s=e.createPattern(l.canvas,"no-repeat");const c=new DOMMatrix(i);s.setTransform(c)}else{applyBoundingBox(e,this._bbox);s=this._createGradient(e)}return s}}function drawTriangle(e,t,i,a,s,n,r,o){const l=t.coords,d=t.colors,c=e.data,h=4*e.width;let u;if(l[i+1]>l[a+1]){u=i;i=a;a=u;u=n;n=r;r=u}if(l[a+1]>l[s+1]){u=a;a=s;s=u;u=r;r=o;o=u}if(l[i+1]>l[a+1]){u=i;i=a;a=u;u=n;n=r;r=u}const _=(l[i]+t.offsetX)*t.scaleX,p=(l[i+1]+t.offsetY)*t.scaleY,g=(l[a]+t.offsetX)*t.scaleX,f=(l[a+1]+t.offsetY)*t.scaleY,v=(l[s]+t.offsetX)*t.scaleX,m=(l[s+1]+t.offsetY)*t.scaleY;if(p>=m)return;const w=d[n],P=d[n+1],y=d[n+2],b=d[r],S=d[r+1],x=d[r+2],C=d[o],A=d[o+1],E=d[o+2],k=Math.round(p),I=Math.round(m);let M,B,G,T,D,L,R,N;for(let e=k;e<=I;e++){if(e<f){const t=e<p?0:(p-e)/(p-f);M=_-(_-g)*t;B=w-(w-b)*t;G=P-(P-S)*t;T=y-(y-x)*t}else{let t;t=e>m?1:f===m?0:(f-e)/(f-m);M=g-(g-v)*t;B=b-(b-C)*t;G=S-(S-A)*t;T=x-(x-E)*t}let t;t=e<p?0:e>m?1:(p-e)/(p-m);D=_-(_-v)*t;L=w-(w-C)*t;R=P-(P-A)*t;N=y-(y-E)*t;const i=Math.round(Math.min(M,D)),a=Math.round(Math.max(M,D));let s=h*e+4*i;for(let e=i;e<=a;e++){t=(M-e)/(M-D);t<0?t=0:t>1&&(t=1);c[s++]=B-(B-L)*t|0;c[s++]=G-(G-R)*t|0;c[s++]=T-(T-N)*t|0;c[s++]=255}}}function drawFigure(e,t,i){const a=t.coords,s=t.colors;let n,r;switch(t.type){case"lattice":const o=t.verticesPerRow,l=Math.floor(a.length/o)-1,d=o-1;for(n=0;n<l;n++){let t=n*o;for(let n=0;n<d;n++,t++){drawTriangle(e,i,a[t],a[t+1],a[t+o],s[t],s[t+1],s[t+o]);drawTriangle(e,i,a[t+o+1],a[t+1],a[t+o],s[t+o+1],s[t+1],s[t+o])}}break;case"triangles":for(n=0,r=a.length;n<r;n+=3)drawTriangle(e,i,a[n],a[n+1],a[n+2],s[n],s[n+1],s[n+2]);break;default:throw new Error("illegal figure")}}class MeshShadingPattern extends BaseShadingPattern{constructor(e){super();this._coords=e[2];this._colors=e[3];this._figures=e[4];this._bounds=e[5];this._bbox=e[6];this._background=e[7];this.matrix=null}_createMeshCanvas(e,t,i){const a=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),n=Math.ceil(this._bounds[2])-a,r=Math.ceil(this._bounds[3])-s,o=Math.min(Math.ceil(Math.abs(n*e[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(r*e[1]*1.1)),3e3),d=n/o,c=r/l,h={coords:this._coords,colors:this._colors,offsetX:-a,offsetY:-s,scaleX:1/d,scaleY:1/c},u=o+4,_=l+4,p=i.getCanvas("mesh",u,_),g=p.context,f=g.createImageData(o,l);if(t){const e=f.data;for(let i=0,a=e.length;i<a;i+=4){e[i]=t[0];e[i+1]=t[1];e[i+2]=t[2];e[i+3]=255}}for(const e of this._figures)drawFigure(f,e,h);g.putImageData(f,2,2);return{canvas:p.canvas,offsetX:a-2*d,offsetY:s-2*c,scaleX:d,scaleY:c}}isModifyingCurrentTransform(){return!0}getPattern(e,t,i,a){applyBoundingBox(e,this._bbox);const s=new Float32Array(2);if(a===sa)Util.singularValueDecompose2dScale(getCurrentTransform(e),s);else if(this.matrix){Util.singularValueDecompose2dScale(this.matrix,s);const[e,i]=s;Util.singularValueDecompose2dScale(t.baseTransform,s);s[0]*=e;s[1]*=i}else Util.singularValueDecompose2dScale(t.baseTransform,s);const n=this._createMeshCanvas(s,a===sa?null:this._background,t.cachedCanvases);if(a!==sa){e.setTransform(...t.baseTransform);this.matrix&&e.transform(...this.matrix)}e.translate(n.offsetX,n.offsetY);e.scale(n.scaleX,n.scaleY);return e.createPattern(n.canvas,"no-repeat")}}class DummyShadingPattern extends BaseShadingPattern{getPattern(){return"hotpink"}}const na=1,ra=2;class TilingPattern{constructor(e,t,i,a){this.color=e[1];this.operatorList=e[2];this.matrix=e[3];this.bbox=e[4];this.xstep=e[5];this.ystep=e[6];this.paintType=e[7];this.tilingType=e[8];this.ctx=t;this.canvasGraphicsFactory=i;this.baseTransform=a}createPatternCanvas(e){const{bbox:t,operatorList:i,paintType:a,tilingType:s,color:n,canvasGraphicsFactory:r}=this;let{xstep:o,ystep:l}=this;o=Math.abs(o);l=Math.abs(l);info("TilingType: "+s);const d=t[0],c=t[1],h=t[2],u=t[3],_=h-d,p=u-c,g=new Float32Array(2);Util.singularValueDecompose2dScale(this.matrix,g);const[f,v]=g;Util.singularValueDecompose2dScale(this.baseTransform,g);const m=f*g[0],w=v*g[1];let P=_,y=p,b=!1,S=!1;const x=Math.ceil(o*m),C=Math.ceil(l*w);x>=Math.ceil(_*m)?P=o:b=!0;C>=Math.ceil(p*w)?y=l:S=!0;const A=this.getSizeAndScale(P,this.ctx.canvas.width,m),E=this.getSizeAndScale(y,this.ctx.canvas.height,w),k=e.cachedCanvases.getCanvas("pattern",A.size,E.size),I=k.context,M=r.createCanvasGraphics(I);M.groupLevel=e.groupLevel;this.setFillAndStrokeStyleToContext(M,a,n);I.translate(-A.scale*d,-E.scale*c);M.transform(A.scale,0,0,E.scale,0,0);I.save();this.clipBbox(M,d,c,h,u);M.baseTransform=getCurrentTransform(M.ctx);M.executeOperatorList(i);M.endDrawing();I.restore();if(b||S){const t=k.canvas;b&&(P=o);S&&(y=l);const i=this.getSizeAndScale(P,this.ctx.canvas.width,m),a=this.getSizeAndScale(y,this.ctx.canvas.height,w),s=i.size,n=a.size,r=e.cachedCanvases.getCanvas("pattern-workaround",s,n),h=r.context,u=b?Math.floor(_/o):0,g=S?Math.floor(p/l):0;for(let e=0;e<=u;e++)for(let i=0;i<=g;i++)h.drawImage(t,s*e,n*i,s,n,0,0,s,n);return{canvas:r.canvas,scaleX:i.scale,scaleY:a.scale,offsetX:d,offsetY:c}}return{canvas:k.canvas,scaleX:A.scale,scaleY:E.scale,offsetX:d,offsetY:c}}getSizeAndScale(e,t,i){const a=Math.max(TilingPattern.MAX_PATTERN_SIZE,t);let s=Math.ceil(e*i);s>=a?s=a:i=s/e;return{scale:i,size:s}}clipBbox(e,t,i,a,s){const n=a-t,r=s-i;e.ctx.rect(t,i,n,r);Util.axialAlignedBoundingBox([t,i,a,s],getCurrentTransform(e.ctx),e.current.minMax);e.clip();e.endPath()}setFillAndStrokeStyleToContext(e,t,i){const a=e.ctx,s=e.current;switch(t){case na:const{fillStyle:e,strokeStyle:n}=this.ctx;a.fillStyle=s.fillColor=e;a.strokeStyle=s.strokeColor=n;break;case ra:a.fillStyle=a.strokeStyle=i;s.fillColor=s.strokeColor=i;break;default:throw new FormatError(`Unsupported paint type: ${t}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,t,i,a){let s=i;if(a!==sa){s=Util.transform(s,t.baseTransform);this.matrix&&(s=Util.transform(s,this.matrix))}const n=this.createPatternCanvas(t);let r=new DOMMatrix(s);r=r.translate(n.offsetX,n.offsetY);r=r.scale(1/n.scaleX,1/n.scaleY);const o=e.createPattern(n.canvas,"repeat");o.setTransform(r);return o}}!function pattern_helper_defineProperty(e,t,i){return(t=function pattern_helper_toPropertyKey(e){var t=function pattern_helper_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}(TilingPattern,"MAX_PATTERN_SIZE",3e3);function convertBlackAndWhiteToRGBA(e){let{src:t,srcPos:i=0,dest:a,width:s,height:n,nonBlackColor:r=4294967295,inverseDecode:o=!1}=e;const l=util_FeatureTest.isLittleEndian?4278190080:255,[d,c]=o?[r,l]:[l,r],h=s>>3,u=7&s,_=t.length;a=new Uint32Array(a.buffer);let p=0;for(let e=0;e<n;e++){for(const e=i+h;i<e;i++){const e=i<_?t[i]:255;a[p++]=128&e?c:d;a[p++]=64&e?c:d;a[p++]=32&e?c:d;a[p++]=16&e?c:d;a[p++]=8&e?c:d;a[p++]=4&e?c:d;a[p++]=2&e?c:d;a[p++]=1&e?c:d}if(0===u)continue;const e=i<_?t[i++]:255;for(let t=0;t<u;t++)a[p++]=e&1<<7-t?c:d}return{srcPos:i,destPos:p}}function canvas_classPrivateMethodInitSpec(e,t){(function canvas_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function canvas_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function canvas_defineProperty(e,t,i){return(t=function canvas_toPropertyKey(e){var t=function canvas_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const oa=16,la=new DOMMatrix,da=new Float32Array(2),ca=new Float32Array([1/0,1/0,-1/0,-1/0]);class CachedCanvases{constructor(e){this.canvasFactory=e;this.cache=Object.create(null)}getCanvas(e,t,i){let a;if(void 0!==this.cache[e]){a=this.cache[e];this.canvasFactory.reset(a,t,i)}else{a=this.canvasFactory.create(t,i);this.cache[e]=a}return a}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t);delete this.cache[e]}}}function drawImageAtIntegerCoords(e,t,i,a,s,n,r,o,l,d){const[c,h,u,_,p,g]=getCurrentTransform(e);if(0===h&&0===u){const f=r*c+p,v=Math.round(f),m=o*_+g,w=Math.round(m),P=(r+l)*c+p,y=Math.abs(Math.round(P)-v)||1,b=(o+d)*_+g,S=Math.abs(Math.round(b)-w)||1;e.setTransform(Math.sign(c),0,0,Math.sign(_),v,w);e.drawImage(t,i,a,s,n,0,0,y,S);e.setTransform(c,h,u,_,p,g);return[y,S]}if(0===c&&0===_){const f=o*u+p,v=Math.round(f),m=r*h+g,w=Math.round(m),P=(o+d)*u+p,y=Math.abs(Math.round(P)-v)||1,b=(r+l)*h+g,S=Math.abs(Math.round(b)-w)||1;e.setTransform(0,Math.sign(h),Math.sign(u),0,v,w);e.drawImage(t,i,a,s,n,0,0,S,y);e.setTransform(c,h,u,_,p,g);return[S,y]}e.drawImage(t,i,a,s,n,r,o,l,d);return[Math.hypot(c,h)*l,Math.hypot(u,_)*d]}class CanvasExtraState{constructor(e,t){canvas_defineProperty(this,"alphaIsShape",!1);canvas_defineProperty(this,"fontSize",0);canvas_defineProperty(this,"fontSizeScale",1);canvas_defineProperty(this,"textMatrix",null);canvas_defineProperty(this,"textMatrixScale",1);canvas_defineProperty(this,"fontMatrix",s);canvas_defineProperty(this,"leading",0);canvas_defineProperty(this,"x",0);canvas_defineProperty(this,"y",0);canvas_defineProperty(this,"lineX",0);canvas_defineProperty(this,"lineY",0);canvas_defineProperty(this,"charSpacing",0);canvas_defineProperty(this,"wordSpacing",0);canvas_defineProperty(this,"textHScale",1);canvas_defineProperty(this,"textRenderingMode",w);canvas_defineProperty(this,"textRise",0);canvas_defineProperty(this,"fillColor","#000000");canvas_defineProperty(this,"strokeColor","#000000");canvas_defineProperty(this,"patternFill",!1);canvas_defineProperty(this,"patternStroke",!1);canvas_defineProperty(this,"fillAlpha",1);canvas_defineProperty(this,"strokeAlpha",1);canvas_defineProperty(this,"lineWidth",1);canvas_defineProperty(this,"activeSMask",null);canvas_defineProperty(this,"transferMaps","none");this.clipBox=new Float32Array([0,0,e,t]);this.minMax=ca.slice()}clone(){const e=Object.create(this);e.clipBox=this.clipBox.slice();e.minMax=this.minMax.slice();return e}getPathBoundingBox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ia,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=this.minMax.slice();if(e===aa){t||unreachable("Stroke bounding box must include transform.");Util.singularValueDecompose2dScale(t,da);const e=da[0]*this.lineWidth/2,a=da[1]*this.lineWidth/2;i[0]-=e;i[1]-=a;i[2]+=e;i[3]+=a}return i}updateClipFromPath(){const e=Util.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(ca,0)}getClippedPathBoundingBox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ia,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Util.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function putBinaryImageData(e,t){if(t instanceof ImageData){e.putImageData(t,0,0);return}const i=t.height,a=t.width,s=i%oa,n=(i-s)/oa,r=0===s?n:n+1,o=e.createImageData(a,oa);let l,d=0;const c=t.data,h=o.data;let u,_,p,g;if(t.kind===C.GRAYSCALE_1BPP){const t=c.byteLength,i=new Uint32Array(h.buffer,0,h.byteLength>>2),g=i.length,f=a+7>>3,v=4294967295,m=util_FeatureTest.isLittleEndian?4278190080:255;for(u=0;u<r;u++){p=u<n?oa:s;l=0;for(_=0;_<p;_++){const e=t-d;let s=0;const n=e>f?a:8*e-7,r=-8&n;let o=0,h=0;for(;s<r;s+=8){h=c[d++];i[l++]=128&h?v:m;i[l++]=64&h?v:m;i[l++]=32&h?v:m;i[l++]=16&h?v:m;i[l++]=8&h?v:m;i[l++]=4&h?v:m;i[l++]=2&h?v:m;i[l++]=1&h?v:m}for(;s<n;s++){if(0===o){h=c[d++];o=128}i[l++]=h&o?v:m;o>>=1}}for(;l<g;)i[l++]=0;e.putImageData(o,0,u*oa)}}else if(t.kind===C.RGBA_32BPP){_=0;g=a*oa*4;for(u=0;u<n;u++){h.set(c.subarray(d,d+g));d+=g;e.putImageData(o,0,_);_+=oa}if(u<r){g=a*s*4;h.set(c.subarray(d,d+g));e.putImageData(o,0,_)}}else{if(t.kind!==C.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);p=oa;g=a*p;for(u=0;u<r;u++){if(u>=n){p=s;g=a*p}l=0;for(_=g;_--;){h[l++]=c[d++];h[l++]=c[d++];h[l++]=c[d++];h[l++]=255}e.putImageData(o,0,u*oa)}}}function putBinaryImageMask(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}const i=t.height,a=t.width,s=i%oa,n=(i-s)/oa,r=0===s?n:n+1,o=e.createImageData(a,oa);let l=0;const d=t.data,c=o.data;for(let t=0;t<r;t++){const i=t<n?oa:s;({srcPos:l}=convertBlackAndWhiteToRGBA({src:d,srcPos:l,dest:c,width:a,height:i,nonBlackColor:0}));e.putImageData(o,0,t*oa)}}function copyCtxState(e,t){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const a of i)void 0!==e[a]&&(t[a]=e[a]);if(void 0!==e.setLineDash){t.setLineDash(e.getLineDash());t.lineDashOffset=e.lineDashOffset}}function resetCtxToDefault(e){e.strokeStyle=e.fillStyle="#000000";e.fillRule="nonzero";e.globalAlpha=1;e.lineWidth=1;e.lineCap="butt";e.lineJoin="miter";e.miterLimit=10;e.globalCompositeOperation="source-over";e.font="10px sans-serif";if(void 0!==e.setLineDash){e.setLineDash([]);e.lineDashOffset=0}const{filter:t}=e;"none"!==t&&""!==t&&(e.filter="none")}function getImageSmoothingEnabled(e,t){if(t)return!0;Util.singularValueDecompose2dScale(e,da);const i=Math.fround(OutputScale.pixelRatio*PixelsPerInch.PDF_TO_CSS_UNITS);return da[0]<=i&&da[1]<=i}const ha=["butt","round","square"],ua=["miter","round","bevel"],_a={},pa={};var ga=new WeakSet;class CanvasGraphics{constructor(e,t,i,a,s,n,r,o){let{optionalContentConfig:l,markedContentStack:d=null}=n;canvas_classPrivateMethodInitSpec(this,ga);this.ctx=e;this.current=new CanvasExtraState(this.ctx.canvas.width,this.ctx.canvas.height);this.stateStack=[];this.pendingClip=null;this.pendingEOFill=!1;this.res=null;this.xobjs=null;this.commonObjs=t;this.objs=i;this.canvasFactory=a;this.filterFactory=s;this.groupStack=[];this.baseTransform=null;this.baseTransformStack=[];this.groupLevel=0;this.smaskStack=[];this.smaskCounter=0;this.tempSMask=null;this.suspendedCtx=null;this.contentVisible=!0;this.markedContentStack=d||[];this.optionalContentConfig=l;this.cachedCanvases=new CachedCanvases(this.canvasFactory);this.cachedPatterns=new Map;this.annotationCanvasMap=r;this.viewportScale=1;this.outputScaleX=1;this.outputScaleY=1;this.pageColors=o;this._cachedScaleForStroking=[-1,0];this._cachedGetSinglePixelWidth=null;this._cachedBitmapsMap=new Map}getObject(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing(e){let{transform:t,viewport:i,transparency:a=!1,background:s=null}=e;const n=this.ctx.canvas.width,r=this.ctx.canvas.height,o=this.ctx.fillStyle;this.ctx.fillStyle=s||"#ffffff";this.ctx.fillRect(0,0,n,r);this.ctx.fillStyle=o;if(a){const e=this.cachedCanvases.getCanvas("transparent",n,r);this.compositeCtx=this.ctx;this.transparentCanvas=e.canvas;this.ctx=e.context;this.ctx.save();this.ctx.transform(...getCurrentTransform(this.compositeCtx))}this.ctx.save();resetCtxToDefault(this.ctx);if(t){this.ctx.transform(...t);this.outputScaleX=t[0];this.outputScaleY=t[0]}this.ctx.transform(...i.transform);this.viewportScale=i.scale;this.baseTransform=getCurrentTransform(this.ctx)}executeOperatorList(e,t,i,a){const s=e.argsArray,n=e.fnArray;let r=t||0;const o=s.length;if(o===r)return r;const l=o-r>10&&"function"==typeof i,d=l?Date.now()+15:0;let c=0;const h=this.commonObjs,u=this.objs;let _;for(;;){if(void 0!==a&&r===a.nextBreakPoint){a.breakIt(r,i);return r}_=n[r];if(_!==T.dependency)this[_].apply(this,s[r]);else for(const e of s[r]){const t=e.startsWith("g_")?h:u;if(!t.has(e)){t.get(e,i);return r}}r++;if(r===o)return r;if(l&&++c>10){if(Date.now()>d){i();return r}c=0}}}endDrawing(){canvas_assertClassBrand(ga,this,_restoreInitialState).call(this);this.cachedCanvases.clear();this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear();canvas_assertClassBrand(ga,this,_drawFilter).call(this)}_scaleImage(e,t){const i=e.width??e.displayWidth,a=e.height??e.displayHeight;let s,n,r=Math.max(Math.hypot(t[0],t[1]),1),o=Math.max(Math.hypot(t[2],t[3]),1),l=i,d=a,c="prescale1";for(;r>2&&l>1||o>2&&d>1;){let t=l,i=d;if(r>2&&l>1){t=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2);r/=l/t}if(o>2&&d>1){i=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d)/2;o/=d/i}s=this.cachedCanvases.getCanvas(c,t,i);n=s.context;n.clearRect(0,0,t,i);n.drawImage(e,0,0,l,d,0,0,t,i);e=s.canvas;l=t;d=i;c="prescale1"===c?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:d}}_createMaskCanvas(e){const t=this.ctx,{width:i,height:a}=e,s=this.current.fillColor,n=this.current.patternFill,r=getCurrentTransform(t);let o,l,d,c;if((e.bitmap||e.data)&&e.count>1){const t=e.bitmap||e.data.buffer;l=JSON.stringify(n?r:[r.slice(0,4),s]);o=this._cachedBitmapsMap.get(t);if(!o){o=new Map;this._cachedBitmapsMap.set(t,o)}const i=o.get(l);if(i&&!n){return{canvas:i,offsetX:Math.round(Math.min(r[0],r[2])+r[4]),offsetY:Math.round(Math.min(r[1],r[3])+r[5])}}d=i}if(!d){c=this.cachedCanvases.getCanvas("maskCanvas",i,a);putBinaryImageMask(c.context,e)}let h=Util.transform(r,[1/i,0,0,-1/a,0,0]);h=Util.transform(h,[1,0,0,1,0,-a]);const u=ca.slice();Util.axialAlignedBoundingBox([0,0,i,a],h,u);const[_,p,g,f]=u,v=Math.round(g-_)||1,m=Math.round(f-p)||1,w=this.cachedCanvases.getCanvas("fillCanvas",v,m),P=w.context,y=_,b=p;P.translate(-y,-b);P.transform(...h);if(!d){d=this._scaleImage(c.canvas,getCurrentTransformInverse(P));d=d.img;o&&n&&o.set(l,d)}P.imageSmoothingEnabled=getImageSmoothingEnabled(getCurrentTransform(P),e.interpolate);drawImageAtIntegerCoords(P,d,0,0,d.width,d.height,0,0,i,a);P.globalCompositeOperation="source-in";const S=Util.transform(getCurrentTransformInverse(P),[1,0,0,1,-y,-b]);P.fillStyle=n?s.getPattern(t,this,S,ia):s;P.fillRect(0,0,i,a);if(o&&!n){this.cachedCanvases.delete("fillCanvas");o.set(l,w.canvas)}return{canvas:w.canvas,offsetX:Math.round(y),offsetY:Math.round(b)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1);this.current.lineWidth=e;this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=ha[e]}setLineJoin(e){this.ctx.lineJoin=ua[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const i=this.ctx;if(void 0!==i.setLineDash){i.setLineDash(e);i.lineDashOffset=t}}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,i]of e)switch(t){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.ctx.globalAlpha=this.current.fillAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null;this.tempSMask=null;this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,t=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,a=this.cachedCanvases.getCanvas(i,e,t);this.suspendedCtx=this.ctx;const s=this.ctx=a.context;s.setTransform(this.suspendedCtx.getTransform());copyCtxState(this.suspendedCtx,s);!function mirrorContextOperations(e,t){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save;e.__originalRestore=e.restore;e.__originalRotate=e.rotate;e.__originalScale=e.scale;e.__originalTranslate=e.translate;e.__originalTransform=e.transform;e.__originalSetTransform=e.setTransform;e.__originalResetTransform=e.resetTransform;e.__originalClip=e.clip;e.__originalMoveTo=e.moveTo;e.__originalLineTo=e.lineTo;e.__originalBezierCurveTo=e.bezierCurveTo;e.__originalRect=e.rect;e.__originalClosePath=e.closePath;e.__originalBeginPath=e.beginPath;e._removeMirroring=()=>{e.save=e.__originalSave;e.restore=e.__originalRestore;e.rotate=e.__originalRotate;e.scale=e.__originalScale;e.translate=e.__originalTranslate;e.transform=e.__originalTransform;e.setTransform=e.__originalSetTransform;e.resetTransform=e.__originalResetTransform;e.clip=e.__originalClip;e.moveTo=e.__originalMoveTo;e.lineTo=e.__originalLineTo;e.bezierCurveTo=e.__originalBezierCurveTo;e.rect=e.__originalRect;e.closePath=e.__originalClosePath;e.beginPath=e.__originalBeginPath;delete e._removeMirroring};e.save=function(){t.save();this.__originalSave()};e.restore=function(){t.restore();this.__originalRestore()};e.translate=function(e,i){t.translate(e,i);this.__originalTranslate(e,i)};e.scale=function(e,i){t.scale(e,i);this.__originalScale(e,i)};e.transform=function(e,i,a,s,n,r){t.transform(e,i,a,s,n,r);this.__originalTransform(e,i,a,s,n,r)};e.setTransform=function(e,i,a,s,n,r){t.setTransform(e,i,a,s,n,r);this.__originalSetTransform(e,i,a,s,n,r)};e.resetTransform=function(){t.resetTransform();this.__originalResetTransform()};e.rotate=function(e){t.rotate(e);this.__originalRotate(e)};e.clip=function(e){t.clip(e);this.__originalClip(e)};e.moveTo=function(e,i){t.moveTo(e,i);this.__originalMoveTo(e,i)};e.lineTo=function(e,i){t.lineTo(e,i);this.__originalLineTo(e,i)};e.bezierCurveTo=function(e,i,a,s,n,r){t.bezierCurveTo(e,i,a,s,n,r);this.__originalBezierCurveTo(e,i,a,s,n,r)};e.rect=function(e,i,a,s){t.rect(e,i,a,s);this.__originalRect(e,i,a,s)};e.closePath=function(){t.closePath();this.__originalClosePath()};e.beginPath=function(){t.beginPath();this.__originalBeginPath()}}(s,this.suspendedCtx);this.setGState([["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring();copyCtxState(this.ctx,this.suspendedCtx);this.ctx=this.suspendedCtx;this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;if(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])}else e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,t,this.ctx,e);this.ctx.save();this.ctx.setTransform(1,0,0,1,0,0);this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height);this.ctx.restore()}composeSMask(e,t,i,a){const s=a[0],n=a[1],r=a[2]-s,o=a[3]-n;if(0!==r&&0!==o){this.genericComposeSMask(t.context,i,r,o,t.subtype,t.backdrop,t.transferMap,s,n,t.offsetX,t.offsetY);e.save();e.globalAlpha=1;e.globalCompositeOperation="source-over";e.setTransform(1,0,0,1,0,0);e.drawImage(i.canvas,0,0);e.restore()}}genericComposeSMask(e,t,i,a,s,n,r,o,l,d,c){let h=e.canvas,u=o-d,_=l-c;if(n)if(u<0||_<0||u+i>h.width||_+a>h.height){const e=this.cachedCanvases.getCanvas("maskExtension",i,a),t=e.context;t.drawImage(h,-u,-_);t.globalCompositeOperation="destination-atop";t.fillStyle=n;t.fillRect(0,0,i,a);t.globalCompositeOperation="source-over";h=e.canvas;u=_=0}else{e.save();e.globalAlpha=1;e.setTransform(1,0,0,1,0,0);const t=new Path2D;t.rect(u,_,i,a);e.clip(t);e.globalCompositeOperation="destination-atop";e.fillStyle=n;e.fillRect(u,_,i,a);e.restore()}t.save();t.globalAlpha=1;t.setTransform(1,0,0,1,0,0);"Alpha"===s&&r?t.filter=this.filterFactory.addAlphaFilter(r):"Luminosity"===s&&(t.filter=this.filterFactory.addLuminosityFilter(r));const p=new Path2D;p.rect(o,l,i,a);t.clip(p);t.globalCompositeOperation="destination-in";t.drawImage(h,u,_,i,a,o,l,i,a);t.restore()}save(){this.inSMaskMode&&copyCtxState(this.ctx,this.suspendedCtx);this.ctx.save();const e=this.current;this.stateStack.push(e);this.current=e.clone()}restore(){if(0!==this.stateStack.length){this.current=this.stateStack.pop();this.ctx.restore();this.inSMaskMode&&copyCtxState(this.suspendedCtx,this.ctx);this.checkSMaskState();this.pendingClip=null;this._cachedScaleForStroking[0]=-1;this._cachedGetSinglePixelWidth=null}else this.inSMaskMode&&this.endSMaskMode()}transform(e,t,i,a,s,n){this.ctx.transform(e,t,i,a,s,n);this._cachedScaleForStroking[0]=-1;this._cachedGetSinglePixelWidth=null}constructPath(e,t,i){let[a]=t;if(i){if(!(a instanceof Path2D)){const e=t[0]=new Path2D;for(let t=0,i=a.length;t<i;)switch(a[t++]){case D:e.moveTo(a[t++],a[t++]);break;case L:e.lineTo(a[t++],a[t++]);break;case R:e.bezierCurveTo(a[t++],a[t++],a[t++],a[t++],a[t++],a[t++]);break;case N:e.closePath();break;default:warn(`Unrecognized drawing path operator: ${a[t-1]}`)}a=e}Util.axialAlignedBoundingBox(i,getCurrentTransform(this.ctx),this.current.minMax);this[e](a)}else{a||=t[0]=new Path2D;this[e](a)}}closePath(){this.ctx.closePath()}stroke(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=this.ctx,a=this.current.strokeColor;i.globalAlpha=this.current.strokeAlpha;if(this.contentVisible)if("object"==typeof a&&a?.getPattern){const t=a.isModifyingCurrentTransform()?i.getTransform():null;i.save();i.strokeStyle=a.getPattern(i,this,getCurrentTransformInverse(i),aa);if(t){const a=new Path2D;a.addPath(e,i.getTransform().invertSelf().multiplySelf(t));e=a}this.rescaleAndStroke(e,!1);i.restore()}else this.rescaleAndStroke(e,!0);t&&this.consumePath(e,this.current.getClippedPathBoundingBox(aa,getCurrentTransform(this.ctx)));i.globalAlpha=this.current.fillAlpha}closeStroke(e){this.stroke(e)}fill(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=this.ctx,a=this.current.fillColor;let s=!1;if(this.current.patternFill){const t=a.isModifyingCurrentTransform()?i.getTransform():null;i.save();i.fillStyle=a.getPattern(i,this,getCurrentTransformInverse(i),ia);if(t){const a=new Path2D;a.addPath(e,i.getTransform().invertSelf().multiplySelf(t));e=a}s=!0}const n=this.current.getClippedPathBoundingBox();if(this.contentVisible&&null!==n)if(this.pendingEOFill){i.fill(e,"evenodd");this.pendingEOFill=!1}else i.fill(e);s&&i.restore();t&&this.consumePath(e,n)}eoFill(e){this.pendingEOFill=!0;this.fill(e)}fillStroke(e){this.fill(e,!1);this.stroke(e,!1);this.consumePath(e)}eoFillStroke(e){this.pendingEOFill=!0;this.fillStroke(e)}closeFillStroke(e){this.fillStroke(e)}closeEOFillStroke(e){this.pendingEOFill=!0;this.fillStroke(e)}endPath(e){this.consumePath(e)}rawFillPath(e){this.ctx.fill(e)}clip(){this.pendingClip=_a}eoClip(){this.pendingClip=pa}beginText(){this.current.textMatrix=null;this.current.textMatrixScale=1;this.current.x=this.current.lineX=0;this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,t=this.ctx;if(void 0===e)return;const i=new Path2D,a=t.getTransform().invertSelf();for(const{transform:t,x:s,y:n,fontSize:r,path:o}of e)o&&i.addPath(o,new DOMMatrix(t).preMultiplySelf(a).translate(s,n).scale(r,-r));t.clip(i);delete this.pendingTextPaths}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){const i=this.commonObjs.get(e),a=this.current;if(!i)throw new Error(`Can't find font for ${e}`);a.fontMatrix=i.fontMatrix||s;0!==a.fontMatrix[0]&&0!==a.fontMatrix[3]||warn("Invalid font matrix for font "+e);if(t<0){t=-t;a.fontDirection=-1}else a.fontDirection=1;this.current.font=i;this.current.fontSize=t;if(i.isType3Font)return;const n=i.loadedName||"sans-serif",r=i.systemFontInfo?.css||`"${n}", ${i.fallbackName}`;let o="normal";i.black?o="900":i.bold&&(o="bold");const l=i.italic?"italic":"normal";let d=t;t<16?d=16:t>100&&(d=100);this.current.fontSizeScale=t/d;this.ctx.font=`${l} ${o} ${d}px ${r}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e;this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t);this.moveText(e,t)}setTextMatrix(e){const{current:t}=this;t.textMatrix=e;t.textMatrixScale=Math.hypot(e[0],e[1]);t.x=t.lineX=0;t.y=t.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,i,a,s){const n=this.ctx,r=this.current,o=r.font,l=r.textRenderingMode,d=r.fontSize/r.fontSizeScale,c=l&S,h=!!(l&x),u=r.patternFill&&!o.missingFile,_=r.patternStroke&&!o.missingFile;let p;(o.disableFontFace||h||u||_)&&!o.missingFile&&(p=o.getPathGenerator(this.commonObjs,e));if(p&&(o.disableFontFace||u||_)){n.save();n.translate(t,i);n.scale(d,-d);let e;if(c===w||c===y)if(a){e=n.getTransform();n.setTransform(...a);n.fill(canvas_assertClassBrand(ga,this,_getScaledPath).call(this,p,e,a))}else n.fill(p);if(c===P||c===y)if(s){e||=n.getTransform();n.setTransform(...s);const{a:t,b:i,c:a,d:r}=e,o=Util.inverseTransform(s),l=Util.transform([t,i,a,r,0,0],o);Util.singularValueDecompose2dScale(l,da);n.lineWidth*=Math.max(da[0],da[1])/d;n.stroke(canvas_assertClassBrand(ga,this,_getScaledPath).call(this,p,e,s))}else{n.lineWidth/=d;n.stroke(p)}n.restore()}else{c!==w&&c!==y||n.fillText(e,t,i);c!==P&&c!==y||n.strokeText(e,t,i)}if(h){(this.pendingTextPaths||=[]).push({transform:getCurrentTransform(n),x:t,y:i,fontSize:d,path:p})}}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1);e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let i=!1;for(let e=3;e<t.length;e+=4)if(t[e]>0&&t[e]<255){i=!0;break}return shadow(this,"isFontSubpixelAAEnabled",i)}showText(e){const t=this.current,i=t.font;if(i.isType3Font)return this.showType3Text(e);const a=t.fontSize;if(0===a)return;const s=this.ctx,n=t.fontSizeScale,r=t.charSpacing,o=t.wordSpacing,l=t.fontDirection,d=t.textHScale*l,c=e.length,h=i.vertical,u=h?1:-1,_=i.defaultVMetrics,p=a*t.fontMatrix[0],g=t.textRenderingMode===w&&!i.disableFontFace&&!t.patternFill;s.save();t.textMatrix&&s.transform(...t.textMatrix);s.translate(t.x,t.y+t.textRise);l>0?s.scale(d,-1):s.scale(d,1);let f,v;if(t.patternFill){s.save();const e=t.fillColor.getPattern(s,this,getCurrentTransformInverse(s),ia);f=getCurrentTransform(s);s.restore();s.fillStyle=e}if(t.patternStroke){s.save();const e=t.strokeColor.getPattern(s,this,getCurrentTransformInverse(s),aa);v=getCurrentTransform(s);s.restore();s.strokeStyle=e}let m=t.lineWidth;const b=t.textMatrixScale;if(0===b||0===m){const e=t.textRenderingMode&S;e!==P&&e!==y||(m=this.getSinglePixelWidth())}else m/=b;if(1!==n){s.scale(n,n);m/=n}s.lineWidth=m;if(i.isInvalidPDFjsFont){const i=[];let a=0;for(const t of e){i.push(t.unicode);a+=t.width}s.fillText(i.join(""),0,0);t.x+=a*p*d;s.restore();this.compose();return}let x,C=0;for(x=0;x<c;++x){const t=e[x];if("number"==typeof t){C+=u*t*a/1e3;continue}let d=!1;const c=(t.isSpace?o:0)+r,m=t.fontChar,w=t.accent;let P,y,b=t.width;if(h){const e=t.vmetric||_,i=-(t.vmetric?e[1]:.5*b)*p,a=e[2]*p;b=e?-e[0]:b;P=i/n;y=(C+a)/n}else{P=C/n;y=0}if(i.remeasure&&b>0){const e=1e3*s.measureText(m).width/a*n;if(b<e&&this.isFontSubpixelAAEnabled){const t=b/e;d=!0;s.save();s.scale(t,1);P/=t}else b!==e&&(P+=(b-e)/2e3*a/n)}if(this.contentVisible&&(t.isInFont||i.missingFile))if(g&&!w)s.fillText(m,P,y);else{this.paintChar(m,P,y,f,v);if(w){const e=P+a*w.offset.x/n,t=y-a*w.offset.y/n;this.paintChar(w.fontChar,e,t,f,v)}}C+=h?b*p-c*l:b*p+c*l;d&&s.restore()}h?t.y-=C:t.x+=C*d;s.restore();this.compose()}showType3Text(e){const t=this.ctx,i=this.current,a=i.font,n=i.fontSize,r=i.fontDirection,o=a.vertical?1:-1,l=i.charSpacing,d=i.wordSpacing,c=i.textHScale*r,h=i.fontMatrix||s,u=e.length;let _,p,g,f;if(!(i.textRenderingMode===b)&&0!==n){this._cachedScaleForStroking[0]=-1;this._cachedGetSinglePixelWidth=null;t.save();i.textMatrix&&t.transform(...i.textMatrix);t.translate(i.x,i.y+i.textRise);t.scale(c,r);for(_=0;_<u;++_){p=e[_];if("number"==typeof p){f=o*p*n/1e3;this.ctx.translate(f,0);i.x+=f*c;continue}const s=(p.isSpace?d:0)+l,r=a.charProcOperatorList[p.operatorListId];if(r){if(this.contentVisible){this.save();t.scale(n,n);t.transform(...h);this.executeOperatorList(r);this.restore()}}else warn(`Type3 character "${p.operatorListId}" is not available.`);const u=[p.width,0];Util.applyTransform(u,h);g=u[0]*n+s;t.translate(g,0);i.x+=g*c}t.restore()}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,i,a,s,n){const r=new Path2D;r.rect(i,a,s-i,n-a);this.ctx.clip(r);this.endPath()}getColorN_Pattern(e){let t;if("TilingPattern"===e[0]){const i=this.baseTransform||getCurrentTransform(this.ctx),a={createCanvasGraphics:e=>new CanvasGraphics(e,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new TilingPattern(e,this.ctx,a,i)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments);this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments);this.current.patternFill=!0}setStrokeRGBColor(e){this.ctx.strokeStyle=this.current.strokeColor=e;this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent";this.current.patternStroke=!1}setFillRGBColor(e){this.ctx.fillStyle=this.current.fillColor=e;this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent";this.current.patternFill=!1}_getPattern(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.cachedPatterns.has(e))t=this.cachedPatterns.get(e);else{t=function getShadingPattern(e){switch(e[0]){case"RadialAxial":return new RadialAxialShadingPattern(e);case"Mesh":return new MeshShadingPattern(e);case"Dummy":return new DummyShadingPattern}throw new Error(`Unknown IR type: ${e[0]}`)}(this.getObject(e));this.cachedPatterns.set(e,t)}i&&(t.matrix=i);return t}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const i=this._getPattern(e);t.fillStyle=i.getPattern(t,this,getCurrentTransformInverse(t),sa);const a=getCurrentTransformInverse(t);if(a){const{width:e,height:i}=t.canvas,s=ca.slice();Util.axialAlignedBoundingBox([0,0,e,i],a,s);const[n,r,o,l]=s;this.ctx.fillRect(n,r,o-n,l-r)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox());this.restore()}beginInlineImage(){unreachable("Should not call beginInlineImage")}beginImageData(){unreachable("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible){this.save();this.baseTransformStack.push(this.baseTransform);e&&this.transform(...e);this.baseTransform=getCurrentTransform(this.ctx);if(t){Util.axialAlignedBoundingBox(t,this.baseTransform,this.current.minMax);const[e,i,a,s]=t,n=new Path2D;n.rect(e,i,a-e,s-i);this.ctx.clip(n);this.endPath()}}}paintFormXObjectEnd(){if(this.contentVisible){this.restore();this.baseTransform=this.baseTransformStack.pop()}}beginGroup(e){if(!this.contentVisible)return;this.save();if(this.inSMaskMode){this.endSMaskMode();this.current.activeSMask=null}const t=this.ctx;e.isolated||info("TODO: Support non-isolated groups.");e.knockout&&warn("Knockout groups not supported.");const i=getCurrentTransform(t);e.matrix&&t.transform(...e.matrix);if(!e.bbox)throw new Error("Bounding box is required.");let a=ca.slice();Util.axialAlignedBoundingBox(e.bbox,getCurrentTransform(t),a);const s=[0,0,t.canvas.width,t.canvas.height];a=Util.intersect(a,s)||[0,0,0,0];const n=Math.floor(a[0]),r=Math.floor(a[1]),o=Math.max(Math.ceil(a[2])-n,1),l=Math.max(Math.ceil(a[3])-r,1);this.current.startNewPathAndClipBox([0,0,o,l]);let d="groupAt"+this.groupLevel;e.smask&&(d+="_smask_"+this.smaskCounter++%2);const c=this.cachedCanvases.getCanvas(d,o,l),h=c.context;h.translate(-n,-r);h.transform(...i);let u=new Path2D;const[_,p,g,f]=e.bbox;u.rect(_,p,g-_,f-p);if(e.matrix){const t=new Path2D;t.addPath(u,new DOMMatrix(e.matrix));u=t}h.clip(u);if(e.smask)this.smaskStack.push({canvas:c.canvas,context:h,offsetX:n,offsetY:r,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null});else{t.setTransform(1,0,0,1,0,0);t.translate(n,r);t.save()}copyCtxState(t,h);this.ctx=h;this.setGState([["BM","source-over"],["ca",1],["CA",1]]);this.groupStack.push(t);this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,i=this.groupStack.pop();this.ctx=i;this.ctx.imageSmoothingEnabled=!1;if(e.smask){this.tempSMask=this.smaskStack.pop();this.restore()}else{this.ctx.restore();const e=getCurrentTransform(this.ctx);this.restore();this.ctx.save();this.ctx.setTransform(...e);const i=ca.slice();Util.axialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],e,i);this.ctx.drawImage(t.canvas,0,0);this.ctx.restore();this.compose(i)}}beginAnnotation(e,t,i,a,s){canvas_assertClassBrand(ga,this,_restoreInitialState).call(this);resetCtxToDefault(this.ctx);this.ctx.save();this.save();this.baseTransform&&this.ctx.setTransform(...this.baseTransform);if(t){const a=t[2]-t[0],n=t[3]-t[1];if(s&&this.annotationCanvasMap){(i=i.slice())[4]-=t[0];i[5]-=t[1];(t=t.slice())[0]=t[1]=0;t[2]=a;t[3]=n;Util.singularValueDecompose2dScale(getCurrentTransform(this.ctx),da);const{viewportScale:s}=this,r=Math.ceil(a*this.outputScaleX*s),o=Math.ceil(n*this.outputScaleY*s);this.annotationCanvas=this.canvasFactory.create(r,o);const{canvas:l,context:d}=this.annotationCanvas;this.annotationCanvasMap.set(e,l);this.annotationCanvas.savedCtx=this.ctx;this.ctx=d;this.ctx.save();this.ctx.setTransform(da[0],0,0,-da[1],0,n*da[1]);resetCtxToDefault(this.ctx)}else{resetCtxToDefault(this.ctx);this.endPath();const e=new Path2D;e.rect(t[0],t[1],a,n);this.ctx.clip(e)}}this.current=new CanvasExtraState(this.ctx.canvas.width,this.ctx.canvas.height);this.transform(...i);this.transform(...a)}endAnnotation(){if(this.annotationCanvas){this.ctx.restore();canvas_assertClassBrand(ga,this,_drawFilter).call(this);this.ctx=this.annotationCanvas.savedCtx;delete this.annotationCanvas.savedCtx;delete this.annotationCanvas}}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=e.count;(e=this.getObject(e.data,e)).count=t;const i=this.ctx,a=this._createMaskCanvas(e),s=a.canvas;i.save();i.setTransform(1,0,0,1,0,0);i.drawImage(s,a.offsetX,a.offsetY);i.restore();this.compose()}paintImageMaskXObjectRepeat(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0,n=arguments.length>5?arguments[5]:void 0;if(!this.contentVisible)return;e=this.getObject(e.data,e);const r=this.ctx;r.save();const o=getCurrentTransform(r);r.transform(t,i,a,s,0,0);const l=this._createMaskCanvas(e);r.setTransform(1,0,0,1,l.offsetX-o[4],l.offsetY-o[5]);for(let e=0,d=n.length;e<d;e+=2){const d=Util.transform(o,[t,i,a,s,n[e],n[e+1]]);r.drawImage(l.canvas,d[4],d[5])}r.restore();this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,i=this.current.fillColor,a=this.current.patternFill;for(const s of e){const{data:e,width:n,height:r,transform:o}=s,l=this.cachedCanvases.getCanvas("maskCanvas",n,r),d=l.context;d.save();putBinaryImageMask(d,this.getObject(e,s));d.globalCompositeOperation="source-in";d.fillStyle=a?i.getPattern(d,this,getCurrentTransformInverse(t),ia):i;d.fillRect(0,0,n,r);d.restore();t.save();t.transform(...o);t.scale(1,-1);drawImageAtIntegerCoords(t,l.canvas,0,0,n,r,0,-1,1,1);t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(e);t?this.paintInlineImageXObject(t):warn("Dependent image isn't ready yet")}paintImageXObjectRepeat(e,t,i,a){if(!this.contentVisible)return;const s=this.getObject(e);if(!s){warn("Dependent image isn't ready yet");return}const n=s.width,r=s.height,o=[];for(let e=0,s=a.length;e<s;e+=2)o.push({transform:[t,0,0,i,a[e],a[e+1]],x:0,y:0,w:n,h:r});this.paintInlineImageXObjectGroup(s,o)}applyTransferMapsToCanvas(e){if("none"!==this.current.transferMaps){e.filter=this.current.transferMaps;e.drawImage(e.canvas,0,0);e.filter="none"}return e.canvas}applyTransferMapsToBitmap(e){if("none"===this.current.transferMaps)return e.bitmap;const{bitmap:t,width:i,height:a}=e,s=this.cachedCanvases.getCanvas("inlineImage",i,a),n=s.context;n.filter=this.current.transferMaps;n.drawImage(t,0,0);n.filter="none";return s.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,i=e.height,a=this.ctx;this.save();const{filter:s}=a;"none"!==s&&""!==s&&(a.filter="none");a.scale(1/t,-1/i);let n;if(e.bitmap)n=this.applyTransferMapsToBitmap(e);else if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)n=e;else{const a=this.cachedCanvases.getCanvas("inlineImage",t,i).context;putBinaryImageData(a,e);n=this.applyTransferMapsToCanvas(a)}const r=this._scaleImage(n,getCurrentTransformInverse(a));a.imageSmoothingEnabled=getImageSmoothingEnabled(getCurrentTransform(a),e.interpolate);drawImageAtIntegerCoords(a,r.img,0,0,r.paintWidth,r.paintHeight,0,-i,t,i);this.compose();this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;const i=this.ctx;let a;if(e.bitmap)a=e.bitmap;else{const t=e.width,i=e.height,s=this.cachedCanvases.getCanvas("inlineImage",t,i).context;putBinaryImageData(s,e);a=this.applyTransferMapsToCanvas(s)}for(const e of t){i.save();i.transform(...e.transform);i.scale(1,-1);drawImageAtIntegerCoords(i,a,e.x,e.y,e.w,e.h,0,-1,1,1);i.restore()}this.compose()}paintSolidColorImageMask(){if(this.contentVisible){this.ctx.fillRect(0,0,1,1);this.compose()}}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){"OC"===e?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0});this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop();this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e,t){const i=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath();this.pendingClip||this.compose(t);const a=this.ctx;if(this.pendingClip){i||(this.pendingClip===pa?a.clip(e,"evenodd"):a.clip(e));this.pendingClip=null}this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=getCurrentTransform(this.ctx);if(0===e[1]&&0===e[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),i=Math.hypot(e[0],e[2]),a=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(i,a)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:e}=this.current,{a:t,b:i,c:a,d:s}=this.ctx.getTransform();let n,r;if(0===i&&0===a){const i=Math.abs(t),a=Math.abs(s);if(i===a)if(0===e)n=r=1/i;else{const t=i*e;n=r=t<1?1/t:1}else if(0===e){n=1/i;r=1/a}else{const t=i*e,s=a*e;n=t<1?1/t:1;r=s<1?1/s:1}}else{const o=Math.abs(t*s-i*a),l=Math.hypot(t,i),d=Math.hypot(a,s);if(0===e){n=d/o;r=l/o}else{const t=e*o;n=d>t?d/t:1;r=l>t?l/t:1}}this._cachedScaleForStroking[0]=n;this._cachedScaleForStroking[1]=r}return this._cachedScaleForStroking}rescaleAndStroke(e,t){const{ctx:i,current:{lineWidth:a}}=this,[s,n]=this.getScaleForStroking();if(s===n){i.lineWidth=(a||1)*s;i.stroke(e);return}const r=i.getLineDash();t&&i.save();i.scale(s,n);la.a=1/s;la.d=1/n;const o=new Path2D;o.addPath(e,la);if(r.length>0){const e=Math.max(s,n);i.setLineDash(r.map((t=>t/e)));i.lineDashOffset/=e}i.lineWidth=a||1;i.stroke(o);t&&i.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}function _restoreInitialState(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null;this.ctx.restore();if(this.transparentCanvas){this.ctx=this.compositeCtx;this.ctx.save();this.ctx.setTransform(1,0,0,1,0,0);this.ctx.drawImage(this.transparentCanvas,0,0);this.ctx.restore();this.transparentCanvas=null}}function _drawFilter(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==e){const t=this.ctx.filter;this.ctx.filter=e;this.ctx.drawImage(this.ctx.canvas,0,0);this.ctx.filter=t}}}function _getScaledPath(e,t,i){const a=new Path2D;a.addPath(e,new DOMMatrix(i).invertSelf().multiplySelf(t));return a}for(const e in T)void 0!==CanvasGraphics.prototype[e]&&(CanvasGraphics.prototype[T[e]]=CanvasGraphics.prototype[e]);function worker_options_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}class GlobalWorkerOptions{static get workerPort(){return worker_options_assertClassBrand(GlobalWorkerOptions,this,fa)._}static set workerPort(e){if(!("undefined"!=typeof Worker&&e instanceof Worker)&&null!==e)throw new Error("Invalid `workerPort` type.");fa._=worker_options_assertClassBrand(GlobalWorkerOptions,this,e)}static get workerSrc(){return worker_options_assertClassBrand(GlobalWorkerOptions,this,va)._}static set workerSrc(e){if("string"!=typeof e)throw new Error("Invalid `workerSrc` type.");va._=worker_options_assertClassBrand(GlobalWorkerOptions,this,e)}}var fa={_:null},va={_:""};function metadata_classPrivateFieldInitSpec(e,t,i){(function metadata_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function metadata_classPrivateFieldGet(e,t){return e.get(metadata_assertClassBrand(e,t))}function metadata_classPrivateFieldSet(e,t,i){return e.set(metadata_assertClassBrand(e,t),i),i}function metadata_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var ma=new WeakMap,wa=new WeakMap;class Metadata{constructor(e){let{parsedData:t,rawData:i}=e;metadata_classPrivateFieldInitSpec(this,ma,void 0);metadata_classPrivateFieldInitSpec(this,wa,void 0);metadata_classPrivateFieldSet(ma,this,t);metadata_classPrivateFieldSet(wa,this,i)}getRaw(){return metadata_classPrivateFieldGet(wa,this)}get(e){return metadata_classPrivateFieldGet(ma,this).get(e)??null}[Symbol.iterator](){return metadata_classPrivateFieldGet(ma,this).entries()}}function optional_content_config_classPrivateFieldInitSpec(e,t,i){optional_content_config_checkPrivateRedeclaration(e,t),t.set(e,i)}function optional_content_config_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function optional_content_config_classPrivateFieldGet(e,t){return e.get(optional_content_config_assertClassBrand(e,t))}function optional_content_config_classPrivateFieldSet(e,t,i){return e.set(optional_content_config_assertClassBrand(e,t),i),i}function optional_content_config_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Pa=Symbol("INTERNAL");var ya=new WeakMap,Fa=new WeakMap,ba=new WeakMap,Sa=new WeakMap;class OptionalContentGroup{constructor(e,t){let{name:i,intent:a,usage:s,rbGroups:n}=t;optional_content_config_classPrivateFieldInitSpec(this,ya,!1);optional_content_config_classPrivateFieldInitSpec(this,Fa,!1);optional_content_config_classPrivateFieldInitSpec(this,ba,!1);optional_content_config_classPrivateFieldInitSpec(this,Sa,!0);optional_content_config_classPrivateFieldSet(ya,this,!!(e&o));optional_content_config_classPrivateFieldSet(Fa,this,!!(e&l));this.name=i;this.intent=a;this.usage=s;this.rbGroups=n}get visible(){if(optional_content_config_classPrivateFieldGet(ba,this))return optional_content_config_classPrivateFieldGet(Sa,this);if(!optional_content_config_classPrivateFieldGet(Sa,this))return!1;const{print:e,view:t}=this.usage;return optional_content_config_classPrivateFieldGet(ya,this)?"OFF"!==t?.viewState:!optional_content_config_classPrivateFieldGet(Fa,this)||"OFF"!==e?.printState}_setVisible(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e!==Pa&&unreachable("Internal method `_setVisible` called.");optional_content_config_classPrivateFieldSet(ba,this,i);optional_content_config_classPrivateFieldSet(Sa,this,t)}}var xa=new WeakMap,Ca=new WeakMap,Aa=new WeakMap,Ea=new WeakMap,ka=new WeakSet;class OptionalContentConfig{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;!function optional_content_config_classPrivateMethodInitSpec(e,t){optional_content_config_checkPrivateRedeclaration(e,t),t.add(e)}(this,ka);optional_content_config_classPrivateFieldInitSpec(this,xa,null);optional_content_config_classPrivateFieldInitSpec(this,Ca,new Map);optional_content_config_classPrivateFieldInitSpec(this,Aa,null);optional_content_config_classPrivateFieldInitSpec(this,Ea,null);this.renderingIntent=t;this.name=null;this.creator=null;if(null!==e){this.name=e.name;this.creator=e.creator;optional_content_config_classPrivateFieldSet(Ea,this,e.order);for(const i of e.groups)optional_content_config_classPrivateFieldGet(Ca,this).set(i.id,new OptionalContentGroup(t,i));if("OFF"===e.baseState)for(const e of optional_content_config_classPrivateFieldGet(Ca,this).values())e._setVisible(Pa,!1);for(const t of e.on)optional_content_config_classPrivateFieldGet(Ca,this).get(t)._setVisible(Pa,!0);for(const t of e.off)optional_content_config_classPrivateFieldGet(Ca,this).get(t)._setVisible(Pa,!1);optional_content_config_classPrivateFieldSet(Aa,this,this.getHash())}}isVisible(e){if(0===optional_content_config_classPrivateFieldGet(Ca,this).size)return!0;if(!e){info("Optional content group not defined.");return!0}if("OCG"===e.type){if(!optional_content_config_classPrivateFieldGet(Ca,this).has(e.id)){warn(`Optional content group not found: ${e.id}`);return!0}return optional_content_config_classPrivateFieldGet(Ca,this).get(e.id).visible}if("OCMD"===e.type){if(e.expression)return optional_content_config_assertClassBrand(ka,this,_evaluateVisibilityExpression).call(this,e.expression);if(!e.policy||"AnyOn"===e.policy){for(const t of e.ids){if(!optional_content_config_classPrivateFieldGet(Ca,this).has(t)){warn(`Optional content group not found: ${t}`);return!0}if(optional_content_config_classPrivateFieldGet(Ca,this).get(t).visible)return!0}return!1}if("AllOn"===e.policy){for(const t of e.ids){if(!optional_content_config_classPrivateFieldGet(Ca,this).has(t)){warn(`Optional content group not found: ${t}`);return!0}if(!optional_content_config_classPrivateFieldGet(Ca,this).get(t).visible)return!1}return!0}if("AnyOff"===e.policy){for(const t of e.ids){if(!optional_content_config_classPrivateFieldGet(Ca,this).has(t)){warn(`Optional content group not found: ${t}`);return!0}if(!optional_content_config_classPrivateFieldGet(Ca,this).get(t).visible)return!0}return!1}if("AllOff"===e.policy){for(const t of e.ids){if(!optional_content_config_classPrivateFieldGet(Ca,this).has(t)){warn(`Optional content group not found: ${t}`);return!0}if(optional_content_config_classPrivateFieldGet(Ca,this).get(t).visible)return!1}return!0}warn(`Unknown optional content policy ${e.policy}.`);return!0}warn(`Unknown group type ${e.type}.`);return!0}setVisibility(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const a=optional_content_config_classPrivateFieldGet(Ca,this).get(e);if(a){if(i&&t&&a.rbGroups.length)for(const t of a.rbGroups)for(const i of t)i!==e&&optional_content_config_classPrivateFieldGet(Ca,this).get(i)?._setVisible(Pa,!1,!0);a._setVisible(Pa,!!t,!0);optional_content_config_classPrivateFieldSet(xa,this,null)}else warn(`Optional content group not found: ${e}`)}setOCGState(e){let t,{state:i,preserveRB:a}=e;for(const e of i){switch(e){case"ON":case"OFF":case"Toggle":t=e;continue}const i=optional_content_config_classPrivateFieldGet(Ca,this).get(e);if(i)switch(t){case"ON":this.setVisibility(e,!0,a);break;case"OFF":this.setVisibility(e,!1,a);break;case"Toggle":this.setVisibility(e,!i.visible,a)}}optional_content_config_classPrivateFieldSet(xa,this,null)}get hasInitialVisibility(){return null===optional_content_config_classPrivateFieldGet(Aa,this)||this.getHash()===optional_content_config_classPrivateFieldGet(Aa,this)}getOrder(){return optional_content_config_classPrivateFieldGet(Ca,this).size?optional_content_config_classPrivateFieldGet(Ea,this)?optional_content_config_classPrivateFieldGet(Ea,this).slice():[...optional_content_config_classPrivateFieldGet(Ca,this).keys()]:null}getGroup(e){return optional_content_config_classPrivateFieldGet(Ca,this).get(e)||null}getHash(){if(null!==optional_content_config_classPrivateFieldGet(xa,this))return optional_content_config_classPrivateFieldGet(xa,this);const e=new MurmurHash3_64;for(const[t,i]of optional_content_config_classPrivateFieldGet(Ca,this))e.update(`${t}:${i.visible}`);return optional_content_config_classPrivateFieldSet(xa,this,e.hexdigest())}[Symbol.iterator](){return optional_content_config_classPrivateFieldGet(Ca,this).entries()}}function _evaluateVisibilityExpression(e){const t=e.length;if(t<2)return!0;const i=e[0];for(let a=1;a<t;a++){const t=e[a];let s;if(Array.isArray(t))s=optional_content_config_assertClassBrand(ka,this,_evaluateVisibilityExpression).call(this,t);else{if(!optional_content_config_classPrivateFieldGet(Ca,this).has(t)){warn(`Optional content group not found: ${t}`);return!0}s=optional_content_config_classPrivateFieldGet(Ca,this).get(t).visible}switch(i){case"And":if(!s)return!1;break;case"Or":if(s)return!0;break;case"Not":return!s;default:return!0}}return"And"===i}class PDFDataTransportStream{constructor(e,t){let{disableRange:i=!1,disableStream:a=!1}=t;assert(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:s,initialData:n,progressiveDone:r,contentDispositionFilename:o}=e;this._queuedChunks=[];this._progressiveDone=r;this._contentDispositionFilename=o;if(n?.length>0){const e=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=e;this._isStreamingSupported=!a;this._isRangeSupported=!i;this._contentLength=s;this._fullRequestReader=null;this._rangeReaders=[];e.addRangeListener(((e,t)=>{this._onReceiveData({begin:e,chunk:t})}));e.addProgressListener(((e,t)=>{this._onProgress({loaded:e,total:t})}));e.addProgressiveReadListener((e=>{this._onReceiveData({chunk:e})}));e.addProgressiveDoneListener((()=>{this._onProgressiveDone()}));e.transportReady()}_onReceiveData(e){let{begin:t,chunk:i}=e;const a=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;if(void 0===t)this._fullRequestReader?this._fullRequestReader._enqueue(a):this._queuedChunks.push(a);else{assert(this._rangeReaders.some((function(e){if(e._begin!==t)return!1;e._enqueue(a);return!0})),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){void 0===e.total?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone();this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){assert(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;this._queuedChunks=null;return new PDFDataTransportStreamReader(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=new PDFDataTransportStreamRangeReader(this,e,t);this._pdfDataRangeTransport.requestDataRange(e,t);this._rangeReaders.push(i);return i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}}class PDFDataTransportStreamReader{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this._stream=e;this._done=i||!1;this._filename=isPdfFile(a)?a:null;this._queuedChunks=t||[];this._loaded=0;for(const e of this._queuedChunks)this._loaded+=e.byteLength;this._requests=[];this._headersReady=Promise.resolve();e._fullRequestReader=this;this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._queuedChunks.push(e);this._loaded+=e.byteLength}}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0){return{value:this._queuedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();this._requests.push(e);return e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class PDFDataTransportStreamRangeReader{constructor(e,t,i){this._stream=e;this._begin=t;this._end=i;this._queuedChunk=null;this._requests=[];this._done=!1;this.onProgress=null}_enqueue(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0;this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const e=this._queuedChunk;this._queuedChunk=null;return{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();this._requests.push(e);return e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0;this._stream._removeRangeReader(this)}}function createHeaders(e,t){const i=new Headers;if(!e||!t||"object"!=typeof t)return i;for(const e in t){const a=t[e];void 0!==a&&i.append(e,a)}return i}function getResponseOrigin(e){return URL.parse(e)?.origin??null}function validateRangeRequestCapabilities(e){let{responseHeaders:t,isHttp:i,rangeChunkSize:a,disableRange:s}=e;const n={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(t.get("Content-Length"),10);if(!Number.isInteger(r))return n;n.suggestedLength=r;if(r<=2*a)return n;if(s||!i)return n;if("bytes"!==t.get("Accept-Ranges"))return n;if("identity"!==(t.get("Content-Encoding")||"identity"))return n;n.allowRangeRequests=!0;return n}function extractFilenameFromHeader(e){const t=e.get("Content-Disposition");if(t){let e=function getFilenameFromContentDispositionHeader(e){let t=!0,i=toParamRegExp("filename\\*","i").exec(e);if(i){i=i[1];let e=rfc2616unquote(i);e=unescape(e);e=rfc5987decode(e);e=rfc2047decode(e);return fixupEncoding(e)}i=function rfc2231getparam(e){const t=[];let i;const a=toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=a.exec(e));){let[,e,a,s]=i;e=parseInt(e,10);if(e in t){if(0===e)break}else t[e]=[a,s]}const s=[];for(let e=0;e<t.length&&e in t;++e){let[i,a]=t[e];a=rfc2616unquote(a);if(i){a=unescape(a);0===e&&(a=rfc5987decode(a))}s.push(a)}return s.join("")}(e);if(i)return fixupEncoding(rfc2047decode(i));i=toParamRegExp("filename","i").exec(e);if(i){i=i[1];let e=rfc2616unquote(i);e=rfc2047decode(e);return fixupEncoding(e)}function toParamRegExp(e,t){return new RegExp("(?:^|;)\\s*"+e+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',t)}function textdecode(e,i){if(e){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const a=new TextDecoder(e,{fatal:!0}),s=stringToBytes(i);i=a.decode(s);t=!1}catch{}}return i}function fixupEncoding(e){if(t&&/[\x80-\xff]/.test(e)){e=textdecode("utf-8",e);t&&(e=textdecode("iso-8859-1",e))}return e}function rfc2616unquote(e){if(e.startsWith('"')){const t=e.slice(1).split('\\"');for(let e=0;e<t.length;++e){const i=t[e].indexOf('"');if(-1!==i){t[e]=t[e].slice(0,i);t.length=e+1}t[e]=t[e].replaceAll(/\\(.)/g,"$1")}e=t.join('"')}return e}function rfc5987decode(e){const t=e.indexOf("'");return-1===t?e:textdecode(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,""))}function rfc2047decode(e){return!e.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(e,t,i,a){if("q"===i||"Q"===i)return textdecode(t,a=(a=a.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))})));try{a=atob(a)}catch{}return textdecode(t,a)}))}return""}(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(isPdfFile(e))return e}return null}function createResponseError(e,t){return new ResponseException(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e,404===e||0===e&&t.startsWith("file:"))}function validateResponseStatus(e){return 200===e||206===e}function fetch_stream_defineProperty(e,t,i){return(t=function fetch_stream_toPropertyKey(e){var t=function fetch_stream_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function createFetchOptions(e,t,i){return{method:"GET",headers:e,signal:i.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function getArrayBuffer(e){if(e instanceof Uint8Array)return e.buffer;if(e instanceof ArrayBuffer)return e;warn(`getArrayBuffer - unexpected data format: ${e}`);return new Uint8Array(e).buffer}class PDFFetchStream{constructor(e){fetch_stream_defineProperty(this,"_responseOrigin",null);this.source=e;this.isHttp=/^https?:/i.test(e.url);this.headers=createHeaders(this.isHttp,e.httpHeaders);this._fullRequestReader=null;this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){assert(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once.");this._fullRequestReader=new PDFFetchStreamReader(this);return this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=new PDFFetchStreamRangeReader(this,e,t);this._rangeRequestReaders.push(i);return i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class PDFFetchStreamReader{constructor(e){this._stream=e;this._reader=null;this._loaded=0;this._filename=null;const t=e.source;this._withCredentials=t.withCredentials||!1;this._contentLength=t.length;this._headersCapability=Promise.withResolvers();this._disableRange=t.disableRange||!1;this._rangeChunkSize=t.rangeChunkSize;this._rangeChunkSize||this._disableRange||(this._disableRange=!0);this._abortController=new AbortController;this._isStreamingSupported=!t.disableStream;this._isRangeSupported=!t.disableRange;const i=new Headers(e.headers),a=t.url;fetch(a,createFetchOptions(i,this._withCredentials,this._abortController)).then((t=>{e._responseOrigin=getResponseOrigin(t.url);if(!validateResponseStatus(t.status))throw createResponseError(t.status,a);this._reader=t.body.getReader();this._headersCapability.resolve();const i=t.headers,{allowRangeRequests:s,suggestedLength:n}=validateRangeRequestCapabilities({responseHeaders:i,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s;this._contentLength=n||this._contentLength;this._filename=extractFilenameFromHeader(i);!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new AbortException("Streaming is disabled."))})).catch(this._headersCapability.reject);this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();if(t)return{value:e,done:t};this._loaded+=e.byteLength;this.onProgress?.({loaded:this._loaded,total:this._contentLength});return{value:getArrayBuffer(e),done:!1}}cancel(e){this._reader?.cancel(e);this._abortController.abort()}}class PDFFetchStreamRangeReader{constructor(e,t,i){this._stream=e;this._reader=null;this._loaded=0;const a=e.source;this._withCredentials=a.withCredentials||!1;this._readCapability=Promise.withResolvers();this._isStreamingSupported=!a.disableStream;this._abortController=new AbortController;const s=new Headers(e.headers);s.append("Range",`bytes=${t}-${i-1}`);const n=a.url;fetch(n,createFetchOptions(s,this._withCredentials,this._abortController)).then((t=>{const i=getResponseOrigin(t.url);if(i!==e._responseOrigin)throw new Error(`Expected range response-origin "${i}" to match "${e._responseOrigin}".`);if(!validateResponseStatus(t.status))throw createResponseError(t.status,n);this._readCapability.resolve();this._reader=t.body.getReader()})).catch(this._readCapability.reject);this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();if(t)return{value:e,done:t};this._loaded+=e.byteLength;this.onProgress?.({loaded:this._loaded});return{value:getArrayBuffer(e),done:!1}}cancel(e){this._reader?.cancel(e);this._abortController.abort()}}function network_defineProperty(e,t,i){return(t=function network_toPropertyKey(e){var t=function network_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class NetworkManager{constructor(e){let{url:t,httpHeaders:i,withCredentials:a}=e;network_defineProperty(this,"_responseOrigin",null);this.url=t;this.isHttp=/^https?:/i.test(t);this.headers=createHeaders(this.isHttp,i);this.withCredentials=a||!1;this.currXhrId=0;this.pendingRequests=Object.create(null)}request(e){const t=new XMLHttpRequest,i=this.currXhrId++,a=this.pendingRequests[i]={xhr:t};t.open("GET",this.url);t.withCredentials=this.withCredentials;for(const[e,i]of this.headers)t.setRequestHeader(e,i);if(this.isHttp&&"begin"in e&&"end"in e){t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`);a.expectedStatus=206}else a.expectedStatus=200;t.responseType="arraybuffer";assert(e.onError,"Expected `onError` callback to be provided.");t.onerror=()=>{e.onError(t.status)};t.onreadystatechange=this.onStateChange.bind(this,i);t.onprogress=this.onProgress.bind(this,i);a.onHeadersReceived=e.onHeadersReceived;a.onDone=e.onDone;a.onError=e.onError;a.onProgress=e.onProgress;t.send(null);return i}onProgress(e,t){const i=this.pendingRequests[e];i&&i.onProgress?.(t)}onStateChange(e,t){const i=this.pendingRequests[e];if(!i)return;const a=i.xhr;if(a.readyState>=2&&i.onHeadersReceived){i.onHeadersReceived();delete i.onHeadersReceived}if(4!==a.readyState)return;if(!(e in this.pendingRequests))return;delete this.pendingRequests[e];if(0===a.status&&this.isHttp){i.onError(a.status);return}const s=a.status||200;if(!(200===s&&206===i.expectedStatus)&&s!==i.expectedStatus){i.onError(a.status);return}const n=function network_getArrayBuffer(e){const t=e.response;return"string"!=typeof t?t:stringToBytes(t).buffer}(a);if(206===s){const e=a.getResponseHeader("Content-Range"),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);if(t)i.onDone({begin:parseInt(t[1],10),chunk:n});else{warn('Missing or invalid "Content-Range" header.');i.onError(0)}}else n?i.onDone({begin:0,chunk:n}):i.onError(a.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e];t.abort()}}class PDFNetworkStream{constructor(e){this._source=e;this._manager=new NetworkManager(e);this._rangeChunkSize=e.rangeChunkSize;this._fullRequestReader=null;this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){assert(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once.");this._fullRequestReader=new PDFNetworkStreamFullRequestReader(this._manager,this._source);return this._fullRequestReader}getRangeReader(e,t){const i=new PDFNetworkStreamRangeRequestReader(this._manager,e,t);i.onClosed=this._onRangeRequestReaderClosed.bind(this);this._rangeRequestReaders.push(i);return i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class PDFNetworkStreamFullRequestReader{constructor(e,t){this._manager=e;this._url=t.url;this._fullRequestId=e.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)});this._headersCapability=Promise.withResolvers();this._disableRange=t.disableRange||!1;this._contentLength=t.length;this._rangeChunkSize=t.rangeChunkSize;this._rangeChunkSize||this._disableRange||(this._disableRange=!0);this._isStreamingSupported=!1;this._isRangeSupported=!1;this._cachedChunks=[];this._requests=[];this._done=!1;this._storedError=void 0;this._filename=null;this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,t=this._manager.getRequestXhr(e);this._manager._responseOrigin=getResponseOrigin(t.responseURL);const i=t.getAllResponseHeaders(),a=new Headers(i?i.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map((e=>{const[t,...i]=e.split(": ");return[t,i.join(": ")]})):[]),{allowRangeRequests:s,suggestedLength:n}=validateRangeRequestCapabilities({responseHeaders:a,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0);this._contentLength=n||this._contentLength;this._filename=extractFilenameFromHeader(a);this._isRangeSupported&&this._manager.abortRequest(e);this._headersCapability.resolve()}_onDone(e){if(e)if(this._requests.length>0){this._requests.shift().resolve({value:e.chunk,done:!1})}else this._cachedChunks.push(e.chunk);this._done=!0;if(!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=createResponseError(e,this._url);this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0;this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){await this._headersCapability.promise;if(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 e=Promise.withResolvers();this._requests.push(e);return e.promise}cancel(e){this._done=!0;this._headersCapability.reject(e);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0;this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId);this._fullRequestReader=null}}class PDFNetworkStreamRangeRequestReader{constructor(e,t,i){this._manager=e;this._url=e.url;this._requestId=e.request({begin:t,end:i,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)});this._requests=[];this._queuedChunk=null;this._done=!1;this._storedError=void 0;this.onProgress=null;this.onClosed=null}_onHeadersReceived(){const e=getResponseOrigin(this._manager.getRequestXhr(this._requestId)?.responseURL);if(e!==this._manager._responseOrigin){this._storedError=new Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`);this._onError(0)}}_close(){this.onClosed?.(this)}_onDone(e){const t=e.chunk;if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._queuedChunk=t;this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0;this._close()}_onError(e){this._storedError??=createResponseError(e,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0;this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const e=this._queuedChunk;this._queuedChunk=null;return{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();this._requests.push(e);return e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0;this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId);this._close()}}const Ia=/^[a-z][a-z0-9\-+.]+:/i;class PDFNodeStream{constructor(e){this.source=e;this.url=function parseUrlOrPath(e){if(Ia.test(e))return new URL(e);const t=process.getBuiltinModule("url");return new URL(t.pathToFileURL(e))}(e.url);assert("file:"===this.url.protocol,"PDFNodeStream only supports file:// URLs.");this._fullRequestReader=null;this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){assert(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once.");this._fullRequestReader=new PDFNodeStreamFsFullReader(this);return this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=new PDFNodeStreamFsRangeReader(this,e,t);this._rangeRequestReaders.push(i);return i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class PDFNodeStreamFsFullReader{constructor(e){this._url=e.url;this._done=!1;this._storedError=null;this.onProgress=null;const t=e.source;this._contentLength=t.length;this._loaded=0;this._filename=null;this._disableRange=t.disableRange||!1;this._rangeChunkSize=t.rangeChunkSize;this._rangeChunkSize||this._disableRange||(this._disableRange=!0);this._isStreamingSupported=!t.disableStream;this._isRangeSupported=!t.disableRange;this._readableStream=null;this._readCapability=Promise.withResolvers();this._headersCapability=Promise.withResolvers();const i=process.getBuiltinModule("fs");i.promises.lstat(this._url).then((e=>{this._contentLength=e.size;this._setReadableStream(i.createReadStream(this._url));this._headersCapability.resolve()}),(e=>{"ENOENT"===e.code&&(e=createResponseError(0,this._url.href));this._storedError=e;this._headersCapability.reject(e)}))}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;if(this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e){this._readCapability=Promise.withResolvers();return this.read()}this._loaded+=e.length;this.onProgress?.({loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(e).buffer,done:!1}}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e;this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e;e.on("readable",(()=>{this._readCapability.resolve()}));e.on("end",(()=>{e.destroy();this._done=!0;this._readCapability.resolve()}));e.on("error",(e=>{this._error(e)}));!this._isStreamingSupported&&this._isRangeSupported&&this._error(new AbortException("streaming is disabled"));this._storedError&&this._readableStream.destroy(this._storedError)}}class PDFNodeStreamFsRangeReader{constructor(e,t,i){this._url=e.url;this._done=!1;this._storedError=null;this.onProgress=null;this._loaded=0;this._readableStream=null;this._readCapability=Promise.withResolvers();const a=e.source;this._isStreamingSupported=!a.disableStream;const s=process.getBuiltinModule("fs");this._setReadableStream(s.createReadStream(this._url,{start:t,end:i-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;if(this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e){this._readCapability=Promise.withResolvers();return this.read()}this._loaded+=e.length;this.onProgress?.({loaded:this._loaded});return{value:new Uint8Array(e).buffer,done:!1}}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e;this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e;e.on("readable",(()=>{this._readCapability.resolve()}));e.on("end",(()=>{e.destroy();this._done=!0;this._readCapability.resolve()}));e.on("error",(e=>{this._error(e)}));this._storedError&&this._readableStream.destroy(this._storedError)}}function pdf_objects_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_objects_classPrivateFieldGet(e,t){return e.get(pdf_objects_assertClassBrand(e,t))}function pdf_objects_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Ma=Symbol("INITIAL_DATA");var Ba,Ga=new WeakMap,Ta=new WeakSet;class PDFObjects{constructor(){!function pdf_objects_classPrivateMethodInitSpec(e,t){pdf_objects_checkPrivateRedeclaration(e,t),t.add(e)}(this,Ta);!function pdf_objects_classPrivateFieldInitSpec(e,t,i){pdf_objects_checkPrivateRedeclaration(e,t),t.set(e,i)}(this,Ga,Object.create(null))}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t){const i=pdf_objects_assertClassBrand(Ta,this,_ensureObj).call(this,e);i.promise.then((()=>t(i.data)));return null}const i=pdf_objects_classPrivateFieldGet(Ga,this)[e];if(!i||i.data===Ma)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return i.data}has(e){const t=pdf_objects_classPrivateFieldGet(Ga,this)[e];return!!t&&t.data!==Ma}delete(e){const t=pdf_objects_classPrivateFieldGet(Ga,this)[e];if(!t||t.data===Ma)return!1;delete pdf_objects_classPrivateFieldGet(Ga,this)[e];return!0}resolve(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=pdf_objects_assertClassBrand(Ta,this,_ensureObj).call(this,e);i.data=t;i.resolve()}clear(){for(const e in pdf_objects_classPrivateFieldGet(Ga,this)){const{data:t}=pdf_objects_classPrivateFieldGet(Ga,this)[e];t?.bitmap?.close()}!function pdf_objects_classPrivateFieldSet(e,t,i){return e.set(pdf_objects_assertClassBrand(e,t),i),i}(Ga,this,Object.create(null))}*[Symbol.iterator](){for(const e in pdf_objects_classPrivateFieldGet(Ga,this)){const{data:t}=pdf_objects_classPrivateFieldGet(Ga,this)[e];t!==Ma&&(yield[e,t])}}}function _ensureObj(e){return pdf_objects_classPrivateFieldGet(Ga,this)[e]||={...Promise.withResolvers(),data:Ma}}function text_layer_classPrivateFieldInitSpec(e,t,i){text_layer_checkPrivateRedeclaration(e,t),t.set(e,i)}function text_layer_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function text_layer_classPrivateFieldGet(e,t){return e.get(text_layer_assertClassBrand(e,t))}function text_layer_classPrivateFieldSet(e,t,i){return e.set(text_layer_assertClassBrand(e,t),i),i}function text_layer_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Da=new WeakMap,La=new WeakMap,Ra=new WeakMap,Na=new WeakMap,Oa=new WeakMap,Wa=new WeakMap,ja=new WeakMap,Va=new WeakMap,Ha=new WeakMap,za=new WeakMap,Ua=new WeakMap,$a=new WeakMap,qa=new WeakMap,Xa=new WeakMap,Ka=new WeakMap,Ya=new WeakMap,Za=new WeakMap,Qa=new WeakMap,Ja=new WeakSet;class TextLayer{constructor(e){let{textContentSource:t,container:i,viewport:a}=e;!function text_layer_classPrivateMethodInitSpec(e,t){text_layer_checkPrivateRedeclaration(e,t),t.add(e)}(this,Ja);text_layer_classPrivateFieldInitSpec(this,Da,Promise.withResolvers());text_layer_classPrivateFieldInitSpec(this,La,null);text_layer_classPrivateFieldInitSpec(this,Ra,!1);text_layer_classPrivateFieldInitSpec(this,Na,!!globalThis.FontInspector?.enabled);text_layer_classPrivateFieldInitSpec(this,Oa,null);text_layer_classPrivateFieldInitSpec(this,Wa,null);text_layer_classPrivateFieldInitSpec(this,ja,0);text_layer_classPrivateFieldInitSpec(this,Va,0);text_layer_classPrivateFieldInitSpec(this,Ha,null);text_layer_classPrivateFieldInitSpec(this,za,null);text_layer_classPrivateFieldInitSpec(this,Ua,0);text_layer_classPrivateFieldInitSpec(this,$a,0);text_layer_classPrivateFieldInitSpec(this,qa,Object.create(null));text_layer_classPrivateFieldInitSpec(this,Xa,[]);text_layer_classPrivateFieldInitSpec(this,Ka,null);text_layer_classPrivateFieldInitSpec(this,Ya,[]);text_layer_classPrivateFieldInitSpec(this,Za,new WeakMap);text_layer_classPrivateFieldInitSpec(this,Qa,null);if(t instanceof ReadableStream)text_layer_classPrivateFieldSet(Ka,this,t);else{if("object"!=typeof t)throw new Error('No "textContentSource" parameter specified.');text_layer_classPrivateFieldSet(Ka,this,new ReadableStream({start(e){e.enqueue(t);e.close()}}))}text_layer_classPrivateFieldSet(La,this,text_layer_classPrivateFieldSet(za,this,i));text_layer_classPrivateFieldSet($a,this,a.scale*OutputScale.pixelRatio);text_layer_classPrivateFieldSet(Ua,this,a.rotation);text_layer_classPrivateFieldSet(Wa,this,{div:null,properties:null,ctx:null});const{pageWidth:s,pageHeight:n,pageX:r,pageY:o}=a.rawDims;text_layer_classPrivateFieldSet(Qa,this,[1,0,0,-1,-r,o+n]);text_layer_classPrivateFieldSet(Va,this,s);text_layer_classPrivateFieldSet(ja,this,n);_ensureMinFontSizeComputed.call(TextLayer);setLayerDimensions(i,a);text_layer_classPrivateFieldGet(Da,this).promise.finally((()=>{ns._.delete(this);text_layer_classPrivateFieldSet(Wa,this,null);text_layer_classPrivateFieldSet(qa,this,null)})).catch((()=>{}))}static get fontFamilyMap(){const{isWindows:e,isFirefox:t}=util_FeatureTest.platform;return shadow(this,"fontFamilyMap",new Map([["sans-serif",(e&&t?"Calibri, ":"")+"sans-serif"],["monospace",(e&&t?"Lucida Console, ":"")+"monospace"]]))}render(){const pump=()=>{text_layer_classPrivateFieldGet(Ha,this).read().then((e=>{let{value:t,done:i}=e;if(i)text_layer_classPrivateFieldGet(Da,this).resolve();else{text_layer_classPrivateFieldGet(Oa,this)??text_layer_classPrivateFieldSet(Oa,this,t.lang);Object.assign(text_layer_classPrivateFieldGet(qa,this),t.styles);text_layer_assertClassBrand(Ja,this,_processItems).call(this,t.items);pump()}}),text_layer_classPrivateFieldGet(Da,this).reject)};text_layer_classPrivateFieldSet(Ha,this,text_layer_classPrivateFieldGet(Ka,this).getReader());ns._.add(this);pump();return text_layer_classPrivateFieldGet(Da,this).promise}update(e){let{viewport:t,onBefore:i=null}=e;const a=t.scale*OutputScale.pixelRatio,s=t.rotation;if(s!==text_layer_classPrivateFieldGet(Ua,this)){i?.();text_layer_classPrivateFieldSet(Ua,this,s);setLayerDimensions(text_layer_classPrivateFieldGet(za,this),{rotation:s})}if(a!==text_layer_classPrivateFieldGet($a,this)){i?.();text_layer_classPrivateFieldSet($a,this,a);const e={div:null,properties:null,ctx:_getCtx.call(TextLayer,text_layer_classPrivateFieldGet(Oa,this))};for(const t of text_layer_classPrivateFieldGet(Ya,this)){e.properties=text_layer_classPrivateFieldGet(Za,this).get(t);e.div=t;text_layer_assertClassBrand(Ja,this,_layout).call(this,e)}}}cancel(){const e=new AbortException("TextLayer task cancelled.");text_layer_classPrivateFieldGet(Ha,this)?.cancel(e).catch((()=>{}));text_layer_classPrivateFieldSet(Ha,this,null);text_layer_classPrivateFieldGet(Da,this).reject(e)}get textDivs(){return text_layer_classPrivateFieldGet(Ya,this)}get textContentItemsStr(){return text_layer_classPrivateFieldGet(Xa,this)}static cleanup(){if(!(text_layer_assertClassBrand(TextLayer,this,ns)._.size>0)){text_layer_assertClassBrand(TextLayer,this,ts)._.clear();for(const{canvas:e}of text_layer_assertClassBrand(TextLayer,this,is)._.values())e.remove();text_layer_assertClassBrand(TextLayer,this,is)._.clear()}}}Ba=TextLayer;function _processItems(e){if(text_layer_classPrivateFieldGet(Ra,this))return;text_layer_classPrivateFieldGet(Wa,this).ctx??=_getCtx.call(Ba,text_layer_classPrivateFieldGet(Oa,this));const t=text_layer_classPrivateFieldGet(Ya,this),i=text_layer_classPrivateFieldGet(Xa,this);for(const a of e){if(t.length>1e5){warn("Ignoring additional textDivs for performance reasons.");text_layer_classPrivateFieldSet(Ra,this,!0);return}if(void 0!==a.str){i.push(a.str);text_layer_assertClassBrand(Ja,this,_appendText).call(this,a)}else if("beginMarkedContentProps"===a.type||"beginMarkedContent"===a.type){const e=text_layer_classPrivateFieldGet(La,this);text_layer_classPrivateFieldSet(La,this,document.createElement("span"));text_layer_classPrivateFieldGet(La,this).classList.add("markedContent");a.id&&text_layer_classPrivateFieldGet(La,this).setAttribute("id",`${a.id}`);e.append(text_layer_classPrivateFieldGet(La,this))}else"endMarkedContent"===a.type&&text_layer_classPrivateFieldSet(La,this,text_layer_classPrivateFieldGet(La,this).parentNode)}}function _appendText(e){const t=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:""!==e.str,hasEOL:e.hasEOL,fontSize:0};text_layer_classPrivateFieldGet(Ya,this).push(t);const a=Util.transform(text_layer_classPrivateFieldGet(Qa,this),e.transform);let s=Math.atan2(a[1],a[0]);const n=text_layer_classPrivateFieldGet(qa,this)[e.fontName];n.vertical&&(s+=Math.PI/2);let r=text_layer_classPrivateFieldGet(Na,this)&&n.fontSubstitution||n.fontFamily;r=Ba.fontFamilyMap.get(r)||r;const o=Math.hypot(a[2],a[3]),l=o*_getAscent.call(Ba,r,n,text_layer_classPrivateFieldGet(Oa,this));let d,c;if(0===s){d=a[4];c=a[5]-l}else{d=a[4]+l*Math.sin(s);c=a[5]-l*Math.cos(s)}const h="calc(var(--total-scale-factor) *",u=t.style;if(text_layer_classPrivateFieldGet(La,this)===text_layer_classPrivateFieldGet(za,this)){u.left=`${(100*d/text_layer_classPrivateFieldGet(Va,this)).toFixed(2)}%`;u.top=`${(100*c/text_layer_classPrivateFieldGet(ja,this)).toFixed(2)}%`}else{u.left=`${h}${d.toFixed(2)}px)`;u.top=`${h}${c.toFixed(2)}px)`}u.fontSize=`${h}${(ss._*o).toFixed(2)}px)`;u.fontFamily=r;i.fontSize=o;t.setAttribute("role","presentation");t.textContent=e.str;t.dir=e.dir;text_layer_classPrivateFieldGet(Na,this)&&(t.dataset.fontName=n.fontSubstitutionLoadedName||e.fontName);0!==s&&(i.angle=s*(180/Math.PI));let _=!1;if(e.str.length>1)_=!0;else if(" "!==e.str&&e.transform[0]!==e.transform[3]){const t=Math.abs(e.transform[0]),i=Math.abs(e.transform[3]);t!==i&&Math.max(t,i)/Math.min(t,i)>1.5&&(_=!0)}_&&(i.canvasWidth=n.vertical?e.height:e.width);text_layer_classPrivateFieldGet(Za,this).set(t,i);text_layer_classPrivateFieldGet(Wa,this).div=t;text_layer_classPrivateFieldGet(Wa,this).properties=i;text_layer_assertClassBrand(Ja,this,_layout).call(this,text_layer_classPrivateFieldGet(Wa,this));i.hasText&&text_layer_classPrivateFieldGet(La,this).append(t);if(i.hasEOL){const e=document.createElement("br");e.setAttribute("role","presentation");text_layer_classPrivateFieldGet(La,this).append(e)}}function _layout(e){const{div:t,properties:i,ctx:a}=e,{style:s}=t;let n="";ss._>1&&(n=`scale(${1/ss._})`);if(0!==i.canvasWidth&&i.hasText){const{fontFamily:e}=s,{canvasWidth:r,fontSize:o}=i;_ensureCtxFont.call(Ba,a,o*text_layer_classPrivateFieldGet($a,this),e);try{const{width:e}=a.measureText(t.textContent);e>0&&(n=`scaleX(${r*text_layer_classPrivateFieldGet($a,this)/e}) ${n}`)}catch(e){}}0!==i.angle&&(n=`rotate(${i.angle}deg) ${n}`);n.length>0&&(s.transform=n)}function _getCtx(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=text_layer_assertClassBrand(Ba,this,is)._.get(e||="");if(!t){const i=document.createElement("canvas");i.className="hiddenCanvasElement";i.lang=e;i.width=i.height=0;document.body.append(i);t=i.getContext("2d",{alpha:!1,willReadFrequently:!0});text_layer_assertClassBrand(Ba,this,is)._.set(e,t);text_layer_assertClassBrand(Ba,this,as)._.set(t,{size:0,family:""})}return t}function _ensureCtxFont(e,t,i){const a=text_layer_assertClassBrand(Ba,this,as)._.get(e);if(t!==a.size||i!==a.family){e.font=`${t}px ${i}`;a.size=t;a.family=i}}function _ensureMinFontSizeComputed(){if(null!==text_layer_assertClassBrand(Ba,this,ss)._)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);ss._=text_layer_assertClassBrand(Ba,this,e.getBoundingClientRect().height);e.remove()}function _getAscent(e,t,i){const a=text_layer_assertClassBrand(Ba,this,ts)._.get(e);if(a)return a;const s=text_layer_assertClassBrand(Ba,this,_getCtx).call(this,i);s.canvas.width=s.canvas.height=30;text_layer_assertClassBrand(Ba,this,_ensureCtxFont).call(this,s,30,e);const n=s.measureText(""),r=n?.fontBoundingBoxAscent,o=Math.abs(n?.fontBoundingBoxDescent);s.canvas.width=s.canvas.height=0;let l=.8;if(r)l=r/(r+o);else{util_FeatureTest.platform.isFirefox&&warn("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering.");t.ascent?l=t.ascent:t.descent&&(l=1+t.descent)}text_layer_assertClassBrand(Ba,this,ts)._.set(e,l);return l}var es,ts={_:new Map},is={_:new Map},as={_:new WeakMap},ss={_:null},ns={_:new Set};class XfaText{static textContent(e){const t=[],i={items:t,styles:Object.create(null)};!function walk(e){if(!e)return;let i=null;const a=e.name;if("#text"===a)i=e.value;else{if(!XfaText.shouldBuildText(a))return;e?.attributes?.textContent?i=e.attributes.textContent:e.value&&(i=e.value)}null!==i&&t.push({str:i});if(e.children)for(const t of e.children)walk(t)}(e);return i}static shouldBuildText(e){return!("textarea"===e||"input"===e||"option"===e||"select"===e)}}function app_options_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}{var rs=new Map;const{maxTouchPoints:e,platform:t,userAgent:i}=navigator,a=/Android/.test(i);(/\b(iPad|iPhone|iPod)(?=;)/.test(i)||"MacIntel"===t&&e>1||a)&&rs.set("maxCanvasPixels",5242880);a&&rs.set("useSystemFonts",!1)}const os=1,ls=2,ds=4,cs=8,hs=16,us=128,_s={BOOLEAN:1,NUMBER:2,OBJECT:4,STRING:8,UNDEFINED:16},ps={defaultCacheSize:{value:50,kind:ls},passwordPrompt:{value:null,kind:ls},enableDragAndDrop:{value:!0,kind:ls},pageViewMode:{value:"multiple",kind:ls},findController:{value:null,kind:ls},secondaryFindController:{value:null,kind:ls},enableOpenActionJavaScript:{value:!1,kind:cs},enableCatalogAAJavaScript:{value:!1,kind:cs},allowedGlobalEvents:{value:null,kind:os},canvasMaxAreaInBytes:{value:-1,kind:os+ds},isInAutomation:{value:!1,kind:os},localeProperties:{value:{lang:navigator.language||"en-US"},kind:os},maxCanvasDim:{value:32767,kind:os+ls},nimbusDataStr:{value:"",kind:os},supportsCaretBrowsingMode:{value:!1,kind:os},supportsDocumentFonts:{value:!0,kind:os},supportsIntegratedFind:{value:!1,kind:os},supportsMouseWheelZoomCtrlKey:{value:!0,kind:os},supportsMouseWheelZoomMetaKey:{value:!0,kind:os},supportsPinchToZoom:{value:!0,kind:os},supportsPrinting:{value:!0,kind:os},toolbarDensity:{value:0,kind:os+hs},altTextLearnMoreUrl:{value:"",kind:ls+us},annotationEditorMode:{value:0,kind:ls+us},annotationMode:{value:2,kind:ls+us},capCanvasAreaFactor:{value:200,kind:ls+us},cursorToolOnLoad:{value:0,kind:ls+us},debuggerSrc:{value:"./debugger.mjs",kind:ls},defaultZoomDelay:{value:400,kind:ls+us},defaultZoomValue:{value:"auto",kind:ls+us},disableHistory:{value:!1,kind:ls},disablePageLabels:{value:!1,kind:ls+us},enableAltText:{value:!1,kind:ls+us},enableAltTextModelDownload:{value:!0,kind:ls+us+hs},enableAutoLinking:{value:!0,kind:ls+us},enableComment:{value:!1,kind:ls+us},enableDetailCanvas:{value:!0,kind:ls},enableGuessAltText:{value:!0,kind:ls+us+hs},enableHighlightFloatingButton:{value:!1,kind:ls+us},enableNewAltTextWhenAddingImage:{value:!0,kind:ls+us},enablePermissions:{value:!1,kind:ls+us},enablePrintAutoRotate:{value:!0,kind:ls+us},enableScripting:{value:!1,kind:ls+us},enableSignatureEditor:{value:!1,kind:ls+us},enablePageReordering:{value:!0,kind:ls+us},pdfBackgroundColor:{value:"",kind:ls+us},enableUpdatedAddImage:{value:!1,kind:ls+us},externalLinkRel:{value:"noopener noreferrer nofollow",kind:ls},externalLinkTarget:{value:0,kind:ls+us},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:ls+us},historyUpdateUrl:{value:!1,kind:ls+us},ignoreDestinationZoom:{value:!1,kind:ls+us},imageResourcesPath:{value:"./images/",kind:ls},maxCanvasPixels:{value:2**25,kind:ls},minDurationToUpdateCanvas:{value:500,kind:ls},forcePageColors:{value:!1,kind:ls+us},pageColorsBackground:{value:"Canvas",kind:ls+us},pageColorsForeground:{value:"CanvasText",kind:ls+us},pdfBugEnabled:{value:!1,kind:ls+us},printResolution:{value:150,kind:ls},removePageBorders:{value:!1,kind:ls+us},sidebarViewOnLoad:{value:-1,kind:ls+us},scrollModeOnLoad:{value:-1,kind:ls+us},spreadModeOnLoad:{value:-1,kind:ls+us},textLayerMode:{value:1,kind:ls+us},viewerCssTheme:{value:0,kind:ls+us},viewOnLoad:{value:0,kind:ls+us},cMapPacked:{value:!0,kind:ds},cMapUrl:{value:"../web/cmaps/",kind:ds},disableAutoFetch:{value:!1,kind:ds+us},disableFontFace:{value:!1,kind:ds+us},disableRange:{value:!1,kind:ds+us},disableStream:{value:!1,kind:ds+us},docBaseUrl:{value:"",kind:ds},enableHWA:{value:!0,kind:ds+ls+us},enableXfa:{value:!0,kind:ds+us},fontExtraProperties:{value:!1,kind:ds},iccUrl:{value:"../web/iccs/",kind:ds},isEvalSupported:{value:!0,kind:ds},isOffscreenCanvasSupported:{value:!0,kind:ds},maxZoom:{value:10,kind:ls},minZoom:{value:.1,kind:ls},maxImageSize:{value:-1,kind:ds},pdfBug:{value:!1,kind:ds},standardFontDataUrl:{value:"../web/standard_fonts/",kind:ds},useSystemFonts:{value:void 0,kind:ds,type:_s.BOOLEAN+_s.UNDEFINED},verbosity:{value:1,kind:ds},wasmUrl:{value:"../web/wasm/",kind:ds},workerPort:{value:null,kind:cs},workerSrc:{value:"./assets/pdf.worker.mjs",kind:cs}};ps.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:ls};ps.sandboxBundleSrc={value:"../build/pdf.sandbox.mjs",kind:ls};ps.enableFakeMLManager={value:!0,kind:ls};ps.disablePreferences={value:!1,kind:ls};class AppOptions{static get(e){return app_options_assertClassBrand(AppOptions,this,ms)._.get(e)}static getAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=Object.create(null);for(const a in ps){const s=ps[a];(!e||e&s.kind)&&(i[a]=t?s.value:app_options_assertClassBrand(AppOptions,this,ms)._.get(a))}return i}static set(e,t){this.setAll({[e]:t})}static setAll(e){let t,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._hasInvokedSet||=!0;for(const a in e){if("positionPopupDialogsWithJavaScript"===a)continue;const s=ps[a];let n=e[a];if(!s||!(typeof n==typeof s.value||_s[(typeof n).toUpperCase()]&s.type)){"number"==typeof s?.value&&"string"==typeof n&&(Number.isNaN(Number(n))||(n=Number(n)));if(!(typeof n==typeof s.value||_s[(typeof n).toUpperCase()]&s.type||["maxZoom","minZoom","passwordPrompt","defaultZoomValue","findController","pdfBackgroundColor"].includes(a))){console.error("Invalid AppOptions value: "+a+" = "+n);continue}}const{kind:r}=s;if(!i||r&os||r&us){this.eventBus&&r&hs&&(t||=new Map).set(a,n);app_options_assertClassBrand(AppOptions,this,ms)._.set(a,n)}else console.error("Invalid AppOptions parameter: "+a+" = "+n)}if(t)for(const[e,i]of t)this.eventBus.dispatch(e.toLowerCase(),{source:this,value:i})}}es=AppOptions;!function app_options_defineProperty(e,t,i){return(t=function app_options_toPropertyKey(e){var t=function app_options_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}(AppOptions,"eventBus",void 0);var gs,fs,vs,ms={_:new Map};(()=>{for(const e in ps)app_options_assertClassBrand(es,es,ms)._.set(e,ps[e].value);for(const[e,t]of rs)app_options_assertClassBrand(es,es,ms)._.set(e,t);es._hasInvokedSet=!1;es._checkDisablePreferences=()=>{if(es.get("disablePreferences"))return!0;es._hasInvokedSet&&console.warn('The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.');return!1}})();function api_classPrivateGetter(e,t,i){return i(api_assertClassBrand(e,t))}function api_classPrivateMethodInitSpec(e,t){api_checkPrivateRedeclaration(e,t),t.add(e)}function api_classPrivateFieldSet(e,t,i){return e.set(api_assertClassBrand(e,t),i),i}function api_classPrivateFieldInitSpec(e,t,i){api_checkPrivateRedeclaration(e,t),t.set(e,i)}function api_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function api_classPrivateFieldGet(e,t){return e.get(api_assertClassBrand(e,t))}function api_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function api_defineProperty(e,t,i){return(t=function api_toPropertyKey(e){var t=function api_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function getDocument(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"string"==typeof e||e instanceof URL?e={url:e}:(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const t=new PDFDocumentLoadingTask,{docId:i}=t,s=e.url?function getUrlProp(e,t){if(e instanceof URL)return e.href;if("string"==typeof e){if(a)return e;if(t)return new URL(e,window.location.origin+t).href;const i=URL.parse(e,window.location);if(i)return i.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(e.url,e.baseHref):null,n=e.data?function getDataProp(e){if(a&&"undefined"!=typeof Buffer&&e instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if("string"==typeof e)return stringToBytes(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||"object"==typeof e&&!isNaN(e?.length))return new Uint8Array(e);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(e.data):null,r=e.httpHeaders||null,o=!0===e.withCredentials,l=e.password??null,d=e.range instanceof PDFDataRangeTransport?e.range:null,c=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:65536;let h=e.worker instanceof PDFWorker?e.worker:null;const u=e.verbosity,_="string"!=typeof e.docBaseUrl||isDataScheme(e.docBaseUrl)?null:e.docBaseUrl,p=getFactoryUrlProp("function"==typeof e.cMapUrl?e.cMapUrl():"string"==typeof e.cMapUrl?e.cMapUrl:null),g=!1!==e.cMapPacked,f=e.CMapReaderFactory||(a?NodeCMapReaderFactory:DOMCMapReaderFactory),v=getFactoryUrlProp(e.iccUrl),m=getFactoryUrlProp("function"==typeof e.standardFontDataUrl?e.standardFontDataUrl():"string"==typeof e.standardFontDataUrl?e.standardFontDataUrl:null),w=e.StandardFontDataFactory||(a?NodeStandardFontDataFactory:DOMStandardFontDataFactory),P=getFactoryUrlProp(e.wasmUrl),y=e.WasmFactory||(a?NodeWasmFactory:DOMWasmFactory),b=!0!==e.stopAtErrors,S=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,x=!1!==e.isEvalSupported,C="boolean"==typeof e.isOffscreenCanvasSupported?e.isOffscreenCanvasSupported:!a,A="boolean"==typeof e.isImageDecoderSupported?e.isImageDecoderSupported:!a&&(util_FeatureTest.platform.isFirefox||!globalThis.chrome),E=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,k="boolean"==typeof e.disableFontFace?e.disableFontFace:a,I=!0===e.fontExtraProperties,M=!0===e.enableXfa,B=e.ownerDocument||globalThis.document,G=!0===e.disableRange,T=!0===e.disableStream,D=!0===e.disableAutoFetch,L=!0===e.pdfBug,R=e.CanvasFactory||(a?NodeCanvasFactory:DOMCanvasFactory),N=e.FilterFactory||(a?NodeFilterFactory:DOMFilterFactory),O=!0===e.enableHWA,W=!1!==e.useWasm,j=d?d.length:e.length??NaN,V="boolean"==typeof e.useSystemFonts?e.useSystemFonts:!a&&!k,H="boolean"==typeof e.useWorkerFetch?e.useWorkerFetch:!!(f===DOMCMapReaderFactory&&w===DOMStandardFontDataFactory&&y===DOMWasmFactory&&p&&m&&P&&isValidFetchUrl(p,document.baseURI)&&isValidFetchUrl(m,document.baseURI)&&isValidFetchUrl(P,document.baseURI));setVerbosityLevel(u);const z={canvasFactory:new R({ownerDocument:B,enableHWA:O}),filterFactory:new N({docId:i,ownerDocument:B}),cMapReaderFactory:H?null:new f({baseUrl:p,isCompressed:g}),standardFontDataFactory:H?null:new w({baseUrl:m}),wasmFactory:H?null:new y({baseUrl:P})};if(!h){const i={verbosity:u,port:GlobalWorkerOptions.workerPort,cspPolicyService:e.cspPolicyService};h=PDFWorker.create(i);t._worker=h}const U={docId:i,apiVersion:"5.4.793",data:n,password:l,disableAutoFetch:D,rangeChunkSize:c,length:j,docBaseUrl:_,enableXfa:M,enableOpenActionJavaScript:AppOptions.get("enableOpenActionJavaScript"),enableCatalogAAJavaScript:AppOptions.get("enableCatalogAAJavaScript"),evaluatorOptions:{maxImageSize:S,disableFontFace:k,ignoreErrors:b,isEvalSupported:x,isOffscreenCanvasSupported:C,isImageDecoderSupported:A,canvasMaxAreaInBytes:E,fontExtraProperties:I,useSystemFonts:V,useWasm:W,useWorkerFetch:H,cMapUrl:p,iccUrl:v,standardFontDataUrl:m,wasmUrl:P}},$={ownerDocument:B,pdfBug:L,styleElement:null,loadingParams:{disableAutoFetch:D,enableXfa:M}};h.promise.then((function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const e=h.messageHandler.sendWithPromise("GetDocRequest",U,n?[n.buffer]:null);let l;if(d)l=new PDFDataTransportStream(d,{disableRange:G,disableStream:T});else if(!n){if(!s)throw new Error("getDocument - no `url` parameter provided.");const e=isValidFetchUrl(s)?PDFFetchStream:a?PDFNodeStream:PDFNetworkStream;l=new e({url:s,length:j,httpHeaders:r,withCredentials:o,rangeChunkSize:c,disableRange:G,disableStream:T})}return e.then((e=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const a=new MessageHandler(i,e,h.port),s=new WorkerTransport(a,t,l,$,z,O);t._transport=s;a.send("Ready",null)}))})).catch(t._capability.reject);return t}class PDFDocumentLoadingTask{constructor(){api_defineProperty(this,"_capability",Promise.withResolvers());api_defineProperty(this,"_transport",null);api_defineProperty(this,"_worker",null);api_defineProperty(this,"docId",`d${ws._=(gs=ws._,fs=gs++,gs),fs}`);api_defineProperty(this,"destroyed",!1);api_defineProperty(this,"onPassword",null);api_defineProperty(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0);await(this._transport?.destroy())}catch(e){this._worker?.port&&delete this._worker._pendingDestroy;throw e}this._transport=null;this._worker?.destroy();this._worker=null}async getData(){return this._transport.getData()}}var ws={_:0},Ps=new WeakMap,ys=new WeakMap,Fs=new WeakMap,bs=new WeakMap,Ss=new WeakMap;class PDFDataRangeTransport{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;api_classPrivateFieldInitSpec(this,Ps,Promise.withResolvers());api_classPrivateFieldInitSpec(this,ys,[]);api_classPrivateFieldInitSpec(this,Fs,[]);api_classPrivateFieldInitSpec(this,bs,[]);api_classPrivateFieldInitSpec(this,Ss,[]);this.length=e;this.initialData=t;this.progressiveDone=i;this.contentDispositionFilename=a}addRangeListener(e){api_classPrivateFieldGet(Ss,this).push(e)}addProgressListener(e){api_classPrivateFieldGet(bs,this).push(e)}addProgressiveReadListener(e){api_classPrivateFieldGet(Fs,this).push(e)}addProgressiveDoneListener(e){api_classPrivateFieldGet(ys,this).push(e)}onDataRange(e,t){for(const i of api_classPrivateFieldGet(Ss,this))i(e,t)}onDataProgress(e,t){api_classPrivateFieldGet(Ps,this).promise.then((()=>{for(const i of api_classPrivateFieldGet(bs,this))i(e,t)}))}onDataProgressiveRead(e){api_classPrivateFieldGet(Ps,this).promise.then((()=>{for(const t of api_classPrivateFieldGet(Fs,this))t(e)}))}onDataProgressiveDone(){api_classPrivateFieldGet(Ps,this).promise.then((()=>{for(const e of api_classPrivateFieldGet(ys,this))e()}))}transportReady(){api_classPrivateFieldGet(Ps,this).resolve()}requestDataRange(e,t){unreachable("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class PDFDocumentProxy{constructor(e,t){this._pdfInfo=e;this._transport=t}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return shadow(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()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){let{intent:e="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this._transport.saveDocument(e)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];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 xs=new WeakMap,Cs=new WeakSet;class PDFPageProxy{constructor(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];api_classPrivateMethodInitSpec(this,Cs);api_classPrivateFieldInitSpec(this,xs,!1);this._pageIndex=e;this._pageInfo=t;this._transport=i;this._stats=a?new StatTimer:null;this._pdfBug=a;this.commonObjs=i.commonObjs;this.objs=new PDFObjects;this._intentStates=new Map;this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport(){let{scale:e,rotation:t=this.rotate,offsetX:i=0,offsetY:a=0,dontFlip:s=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new PageViewport({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:i,offsetY:a,dontFlip:s})}getAnnotations(){let{intent:e="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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 shadow(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render(e){let{canvasContext:t,canvas:i=t.canvas,viewport:a,intent:s="display",annotationMode:n=p.ENABLE,transform:r=null,background:o=null,optionalContentConfigPromise:d=null,annotationCanvasMap:c=null,pageColors:h=null,printAnnotationStorage:u=null,isEditing:_=!1}=e;this._stats?.time("Overall");const g=this._transport.getRenderingIntent(s,n,u,_),{renderingIntent:f,cacheKey:v}=g;api_classPrivateFieldSet(xs,this,!1);d||=this._transport.getOptionalContentConfig(f);let m=this._intentStates.get(v);if(!m){m=Object.create(null);this._intentStates.set(v,m)}if(m.streamReaderCancelTimeout){clearTimeout(m.streamReaderCancelTimeout);m.streamReaderCancelTimeout=null}const w=!!(f&l);if(!m.displayReadyCapability){m.displayReadyCapability=Promise.withResolvers();m.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null};this._stats?.time("Page Request");this._pumpOperatorList(g)}const complete=e=>{m.renderTasks.delete(P);w&&api_classPrivateFieldSet(xs,this,!0);api_assertClassBrand(Cs,this,_tryCleanup).call(this);if(e){P.capability.reject(e);this._abortOperatorList({intentState:m,reason:e instanceof Error?e:new Error(e)})}else P.capability.resolve();if(this._stats){this._stats.timeEnd("Rendering");this._stats.timeEnd("Overall");globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats)}},P=new InternalRenderTask({callback:complete,params:{canvas:i,canvasContext:t,viewport:a,transform:r,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:m.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!w,pdfBug:this._pdfBug,pageColors:h,enableHWA:this._transport.enableHWA});(m.renderTasks||=new Set).add(P);const y=P.task;Promise.all([m.displayReadyCapability.promise,d]).then((e=>{let[t,i]=e;if(this.destroyed)complete();else{this._stats?.time("Rendering");if(!(i.renderingIntent&f))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");P.initializeGraphics({transparency:t,optionalContentConfig:i});P.operatorListChanged()}})).catch(complete);return y}getOperatorList(){let{intent:e="display",annotationMode:t=p.ENABLE,printAnnotationStorage:i=null,isEditing:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=this._transport.getRenderingIntent(e,t,i,a,!0);let n,r=this._intentStates.get(s.cacheKey);if(!r){r=Object.create(null);this._intentStates.set(s.cacheKey,r)}if(!r.opListReadCapability){n=Object.create(null);n.operatorListChanged=function operatorListChanged(){if(r.operatorList.lastChunk){r.opListReadCapability.resolve(r.operatorList);r.renderTasks.delete(n)}};r.opListReadCapability=Promise.withResolvers();(r.renderTasks||=new Set).add(n);r.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null};this._stats?.time("Page Request");this._pumpOperatorList(s)}return r.opListReadCapability.promise}streamTextContent(){let{includeMarkedContent:e=!1,disableNormalization:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===e,disableNormalization:!0===t},{highWaterMark:100,size:e=>e.items.length})}getTextContent(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then((e=>XfaText.textContent(e)));const t=this.streamTextContent(e);return new Promise((function(e,i){const a=t.getReader(),s={items:[],styles:Object.create(null),lang:null};!function pump(){a.read().then((function(t){let{value:i,done:a}=t;if(a)e(s);else{s.lang??=i.lang;Object.assign(s.styles,i.styles);s.items.push(...i.items);pump()}}),i)}()}))}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values()){this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0});if(!t.opListReadCapability)for(const i of t.renderTasks){e.push(i.completed);i.cancel()}}this.objs.clear();api_classPrivateFieldSet(xs,this,!1);return Promise.all(e)}cleanup(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];api_classPrivateFieldSet(xs,this,!0);const t=api_assertClassBrand(Cs,this,_tryCleanup).call(this);e&&t&&(this._stats&&=new StatTimer);return t}_startRenderPage(e,t){const i=this._intentStates.get(t);if(i){this._stats?.timeEnd("Page Request");i.displayReadyCapability?.resolve(e)}}_renderPageChunk(e,t){for(let i=0,a=e.length;i<a;i++){t.operatorList.fnArray.push(e.fnArray[i]);t.operatorList.argsArray.push(e.argsArray[i])}t.operatorList.lastChunk=e.lastChunk;t.operatorList.separateAnnots=e.separateAnnots;for(const e of t.renderTasks)e.operatorListChanged();e.lastChunk&&api_assertClassBrand(Cs,this,_tryCleanup).call(this)}_pumpOperatorList(e){let{renderingIntent:t,cacheKey:i,annotationStorageSerializable:a,modifiedIds:s}=e;const{map:n,transfer:r}=a,o=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:i,annotationStorage:n,modifiedIds:s},r).getReader(),l=this._intentStates.get(i);l.streamReader=o;const pump=()=>{o.read().then((e=>{let{value:t,done:i}=e;if(i)l.streamReader=null;else if(!this._transport.destroyed){this._renderPageChunk(t,l);pump()}}),(e=>{l.streamReader=null;if(!this._transport.destroyed){if(l.operatorList){l.operatorList.lastChunk=!0;for(const e of l.renderTasks)e.operatorListChanged();api_assertClassBrand(Cs,this,_tryCleanup).call(this)}if(l.displayReadyCapability)l.displayReadyCapability.reject(e);else{if(!l.opListReadCapability)throw e;l.opListReadCapability.reject(e)}}}))};pump()}_abortOperatorList(e){let{intentState:t,reason:i,force:a=!1}=e;if(t.streamReader){if(t.streamReaderCancelTimeout){clearTimeout(t.streamReaderCancelTimeout);t.streamReaderCancelTimeout=null}if(!a){if(t.renderTasks.size>0)return;if(i instanceof RenderingCancelledException){let e=100;i.extraDelay>0&&i.extraDelay<1e3&&(e+=i.extraDelay);t.streamReaderCancelTimeout=setTimeout((()=>{t.streamReaderCancelTimeout=null;this._abortOperatorList({intentState:t,reason:i,force:!0})}),e);return}}t.streamReader.cancel(new AbortException(i.message)).catch((()=>{}));t.streamReader=null;if(!this._transport.destroyed){for(const[e,i]of this._intentStates)if(i===t){this._intentStates.delete(e);break}this.cleanup()}}}get stats(){return this._stats}}function _tryCleanup(){if(!api_classPrivateFieldGet(xs,this)||this.destroyed)return!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;this._intentStates.clear();this.objs.clear();api_classPrivateFieldSet(xs,this,!1);return!0}var As=new WeakMap,Es=new WeakMap,ks=new WeakMap,Is=new WeakMap,Ms=new WeakSet;class PDFWorker{constructor(){let{name:e=null,port:t=null,verbosity:i=getVerbosityLevel(),cspPolicyService:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};api_classPrivateMethodInitSpec(this,Ms);api_classPrivateFieldInitSpec(this,As,Promise.withResolvers());api_classPrivateFieldInitSpec(this,Es,null);api_classPrivateFieldInitSpec(this,ks,null);api_classPrivateFieldInitSpec(this,Is,null);this.name=e;this.destroyed=!1;this.verbosity=i;if(t){if(Ts._.has(t))throw new Error("Cannot use more than one PDFWorker per port.");Ts._.set(t,this);api_assertClassBrand(Ms,this,_initializeFromPort).call(this,t)}else this._initialize(a)}get promise(){return api_classPrivateFieldGet(As,this).promise}get port(){return api_classPrivateFieldGet(ks,this)}get messageHandler(){return api_classPrivateFieldGet(Es,this)}_initialize(e){if(Gs._||_get_mainThreadWorkerMessageHandler(PDFWorker)){api_assertClassBrand(Ms,this,_setupFakeWorker).call(this);return}let{workerSrc:t}=PDFWorker;try{PDFWorker._isSameOrigin(window.location,t)||(t=PDFWorker._createCDNWrapper(new URL(t,window.location).href));const i=new Worker(e.generateTrustedURL(t),{type:"module"}),a=new MessageHandler("main","worker",i),terminateEarly=()=>{s.abort();a.destroy();i.terminate();this.destroyed?api_classPrivateFieldGet(As,this).reject(new Error("Worker was destroyed")):api_assertClassBrand(Ms,this,_setupFakeWorker).call(this)},s=new AbortController;i.addEventListener("error",(()=>{api_classPrivateFieldGet(Is,this)||terminateEarly()}),{signal:s.signal});a.on("test",(e=>{s.abort();if(!this.destroyed&&e){api_classPrivateFieldSet(Es,this,a);api_classPrivateFieldSet(ks,this,i);api_classPrivateFieldSet(Is,this,i);api_assertClassBrand(Ms,this,_resolve).call(this)}else terminateEarly()}));a.on("ready",(e=>{s.abort();if(this.destroyed)terminateEarly();else try{sendTest()}catch{api_assertClassBrand(Ms,this,_setupFakeWorker).call(this)}}));const sendTest=()=>{const e=new Uint8Array;a.send("test",e,[e.buffer])};sendTest();return}catch{info("The worker has been disabled.")}api_assertClassBrand(Ms,this,_setupFakeWorker).call(this)}destroy(){this.destroyed=!0;api_classPrivateFieldGet(Is,this)?.terminate();api_classPrivateFieldSet(Is,this,null);Ts._.delete(api_classPrivateFieldGet(ks,this));api_classPrivateFieldSet(ks,this,null);api_classPrivateFieldGet(Es,this)?.destroy();api_classPrivateFieldSet(Es,this,null)}static create(e){const t=api_assertClassBrand(PDFWorker,this,Ts)._.get(e?.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new PDFWorker(e)}static get workerSrc(){if(GlobalWorkerOptions.workerSrc)return GlobalWorkerOptions.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return shadow(this,"_setupFakeWorkerGlobal",(async()=>{if(api_classPrivateGetter(PDFWorker,this,_get_mainThreadWorkerMessageHandler))return api_classPrivateGetter(PDFWorker,this,_get_mainThreadWorkerMessageHandler);return(await import(
/*webpackIgnore: true*/
/*@vite-ignore*/
this.workerSrc)).WorkerMessageHandler})())}}vs=PDFWorker;function _resolve(){api_classPrivateFieldGet(As,this).resolve();api_classPrivateFieldGet(Es,this).send("configure",{verbosity:this.verbosity})}function _initializeFromPort(e){api_classPrivateFieldSet(ks,this,e);api_classPrivateFieldSet(Es,this,new MessageHandler("main","worker",e));api_classPrivateFieldGet(Es,this).on("ready",(()=>{}));api_assertClassBrand(Ms,this,_resolve).call(this)}function _setupFakeWorker(){if(!Gs._){warn("Setting up fake worker.");Gs._=!0}vs._setupFakeWorkerGlobal.then((e=>{var t,i;if(this.destroyed){api_classPrivateFieldGet(As,this).reject(new Error("Worker was destroyed"));return}const a=new LoopbackPort;api_classPrivateFieldSet(ks,this,a);const s=`fake${Bs._=(t=Bs._,i=t++,t),i}`,n=new MessageHandler(s+"_worker",s,a);e.setup(n,a);api_classPrivateFieldSet(Es,this,new MessageHandler(s,s+"_worker",a));api_assertClassBrand(Ms,this,_resolve).call(this)})).catch((e=>{api_classPrivateFieldGet(As,this).reject(new Error(`Setting up fake worker failed: "${e.message}".`))}))}function _get_mainThreadWorkerMessageHandler(e){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}var Bs={_:0},Gs={_:!1},Ts={_:new WeakMap};(()=>{if(a){Gs._=api_assertClassBrand(vs,vs,!0);GlobalWorkerOptions.workerSrc||="./pdf.worker.mjs"}vs._isSameOrigin=(e,t)=>{const i=URL.parse(e);if(!i?.origin||"null"===i.origin)return!1;const a=new URL(t,i);return i.origin===a.origin};vs._createCDNWrapper=e=>{const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};vs.fromPort=e=>{!function deprecated(e){NgxConsole.log("Deprecated API usage: "+e)}("`PDFWorker.fromPort` - please use `PDFWorker.create` instead.");if(!e?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return vs.create(e)}})();var Ds=new WeakMap,Ls=new WeakMap,Rs=new WeakMap,Ns=new WeakMap,Os=new WeakMap,Ws=new WeakSet;class WorkerTransport{constructor(e,t,i,a,s,n){api_classPrivateMethodInitSpec(this,Ws);api_classPrivateFieldInitSpec(this,Ds,new Map);api_classPrivateFieldInitSpec(this,Ls,new Map);api_classPrivateFieldInitSpec(this,Rs,new Map);api_classPrivateFieldInitSpec(this,Ns,new Map);api_classPrivateFieldInitSpec(this,Os,null);this.messageHandler=e;this.loadingTask=t;this.commonObjs=new PDFObjects;this.fontLoader=new FontLoader({ownerDocument:a.ownerDocument,styleElement:a.styleElement});this.loadingParams=a.loadingParams;this._params=a;this.canvasFactory=s.canvasFactory;this.filterFactory=s.filterFactory;this.cMapReaderFactory=s.cMapReaderFactory;this.standardFontDataFactory=s.standardFontDataFactory;this.wasmFactory=s.wasmFactory;this.destroyed=!1;this.destroyCapability=null;this._networkStream=i;this._fullReader=null;this._lastProgress=null;this.downloadInfoCapability=Promise.withResolvers();this.enableHWA=n;this.setupMessageHandler()}get annotationStorage(){return shadow(this,"annotationStorage",new AnnotationStorage)}getRenderingIntent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p.ENABLE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],n=o,g=xi;switch(e){case"any":n=r;break;case"display":break;case"print":n=l;break;default:warn(`getRenderingIntent - invalid intent: ${e}`)}const f=n&l&&i instanceof PrintAnnotationStorage?i:this.annotationStorage;switch(t){case p.DISABLE:n+=h;break;case p.ENABLE:break;case p.ENABLE_FORMS:n+=d;break;case p.ENABLE_STORAGE:n+=c;g=f.serializable;break;default:warn(`getRenderingIntent - invalid annotationMode: ${t}`)}a&&(n+=u);s&&(n+=_);const{ids:v,hash:m}=f.modifiedIds;return{renderingIntent:n,cacheKey:[n,g.hash,m].join("_"),annotationStorageSerializable:g,modifiedIds:v}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0;this.destroyCapability=Promise.withResolvers();api_classPrivateFieldGet(Os,this)?.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const t of api_classPrivateFieldGet(Ls,this).values())e.push(t._destroy());api_classPrivateFieldGet(Ls,this).clear();api_classPrivateFieldGet(Rs,this).clear();api_classPrivateFieldGet(Ns,this).clear();this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);e.push(t);Promise.all(e).then((()=>{this.commonObjs.clear();this.fontLoader.clear();api_classPrivateFieldGet(Ds,this).clear();this.filterFactory.destroy();TextLayer.cleanup();this._networkStream?.cancelAllRequests(new AbortException("Worker was terminated."));this.messageHandler?.destroy();this.messageHandler=null;this.destroyCapability.resolve()}),this.destroyCapability.reject);return this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",((e,t)=>{assert(this._networkStream,"GetReader - no `IPDFStream` instance available.");this._fullReader=this._networkStream.getFullReader();this._fullReader.onProgress=e=>{this._lastProgress={loaded:e.loaded,total:e.total}};t.onPull=()=>{this._fullReader.read().then((function(e){let{value:i,done:a}=e;if(a)t.close();else{assert(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer.");t.enqueue(new Uint8Array(i),1,[i])}})).catch((e=>{t.error(e)}))};t.onCancel=e=>{this._fullReader.cancel(e);t.ready.catch((e=>{if(!this.destroyed)throw e}))}}));e.on("ReaderHeadersReady",(async e=>{await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:a,contentLength:s}=this._fullReader;if(!i||!a){this._lastProgress&&t.onProgress?.(this._lastProgress);this._fullReader.onProgress=e=>{t.onProgress?.({loaded:e.loaded,total:e.total})}}return{isStreamingSupported:i,isRangeSupported:a,contentLength:s}}));e.on("GetRangeReader",((e,t)=>{assert(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(e.begin,e.end);if(i){t.onPull=()=>{i.read().then((function(e){let{value:i,done:a}=e;if(a)t.close();else{assert(i instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer.");t.enqueue(new Uint8Array(i),1,[i])}})).catch((e=>{t.error(e)}))};t.onCancel=e=>{i.cancel(e);t.ready.catch((e=>{if(!this.destroyed)throw e}))}}else t.close()}));e.on("GetDoc",(e=>{let{pdfInfo:i}=e;this._numPages=i.numPages;this._htmlForXfa=i.htmlForXfa;delete i.htmlForXfa;t._capability.resolve(new PDFDocumentProxy(i,this))}));e.on("DocException",(e=>{t._capability.reject(wrapReason(e))}));e.on("PasswordRequest",(e=>{api_classPrivateFieldSet(Os,this,Promise.withResolvers());try{if(!t.onPassword)throw wrapReason(e);const updatePassword=e=>{e instanceof Error?api_classPrivateFieldGet(Os,this).reject(e):api_classPrivateFieldGet(Os,this).resolve({password:e})};t.onPassword(updatePassword,e.code)}catch(e){api_classPrivateFieldGet(Os,this).reject(e)}return api_classPrivateFieldGet(Os,this).promise}));e.on("DataLoaded",(e=>{t.onProgress?.({loaded:e.length,total:e.length});this.downloadInfoCapability.resolve(e)}));e.on("StartRenderPage",(e=>{if(this.destroyed)return;api_classPrivateFieldGet(Ls,this).get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)}));e.on("commonobj",(t=>{let[i,a,s]=t;if(this.destroyed)return null;if(this.commonObjs.has(i))return null;switch(a){case"Font":if("error"in s){const e=s.error;warn(`Error during font loading: ${e}`);this.commonObjs.resolve(i,e);break}const t=this._params.pdfBug&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,n=new FontFaceObject(s,t);this.fontLoader.bind(n).catch((()=>e.sendWithPromise("FontFallback",{id:i}))).finally((()=>{!n.fontExtraProperties&&n.data&&(n.data=null);this.commonObjs.resolve(i,n)}));break;case"CopyLocalImage":const{imageRef:r}=s;assert(r,"The imageRef must be defined.");for(const e of api_classPrivateFieldGet(Ls,this).values())for(const[,t]of e.objs)if(t?.ref===r){if(!t.dataLen)return null;this.commonObjs.resolve(i,structuredClone(t));return t.dataLen}break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(i,s);break;default:throw new Error(`Got unknown common object type ${a}`)}return null}));e.on("obj",(e=>{let[t,i,a,s]=e;if(this.destroyed)return;const n=api_classPrivateFieldGet(Ls,this).get(i);if(!n.objs.has(t))if(0!==n._intentStates.size)switch(a){case"Image":case"Pattern":n.objs.resolve(t,s);break;default:throw new Error(`Got unknown object type ${a}`)}else s?.bitmap?.close()}));e.on("DocProgress",(e=>{this.destroyed||t.onProgress?.({loaded:e.loaded,total:e.total})}));e.on("FetchBinaryData",(async e=>{if(this.destroyed)throw new Error("Worker was destroyed.");const t=this[e.type];if(!t)throw new Error(`${e.type} not initialized, see the \`useWorkerFetch\` parameter.`);return t.fetch(e)}))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.annotationStorage.size<=0&&warn("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:i}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null,pageOrder:e},i).finally((()=>{this.annotationStorage.resetModified()}))}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=e-1,i=api_classPrivateFieldGet(Rs,this).get(t);if(i)return i;const a=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then((i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&api_classPrivateFieldGet(Ns,this).set(i.refStr,e);const a=new PDFPageProxy(t,i,this,this._params.pdfBug);api_classPrivateFieldGet(Ls,this).set(t,a);return a}));api_classPrivateFieldGet(Rs,this).set(t,a);return a}getPageIndex(e){return isRefProxy(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getFieldObjects(){return api_assertClassBrand(Ws,this,_cacheSimpleMethod).call(this,"GetFieldObjects")}hasJSActions(){return api_assertClassBrand(Ws,this,_cacheSimpleMethod).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return"string"!=typeof e?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)}getDocJSActions(){return api_assertClassBrand(Ws,this,_cacheSimpleMethod).call(this,"GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return api_assertClassBrand(Ws,this,_cacheSimpleMethod).call(this,"GetOptionalContentConfig").then((t=>new OptionalContentConfig(t,e)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",t=api_classPrivateFieldGet(Ds,this).get(e);if(t)return t;const i=this.messageHandler.sendWithPromise(e,null).then((e=>({info:e[0],metadata:e[1]?new Metadata(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})));api_classPrivateFieldGet(Ds,this).set(e,i);return i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of api_classPrivateFieldGet(Ls,this).values()){if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`)}this.commonObjs.clear();e||this.fontLoader.clear();api_classPrivateFieldGet(Ds,this).clear();this.filterFactory.destroy(!0);TextLayer.cleanup()}}cachedPageNumber(e){if(!isRefProxy(e))return null;const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return api_classPrivateFieldGet(Ns,this).get(t)??null}}function _cacheSimpleMethod(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=api_classPrivateFieldGet(Ds,this).get(e);if(i)return i;const a=this.messageHandler.sendWithPromise(e,t);api_classPrivateFieldGet(Ds,this).set(e,a);return a}var js=new WeakMap;class RenderTask{constructor(e){api_classPrivateFieldInitSpec(this,js,null);api_defineProperty(this,"onContinue",null);api_defineProperty(this,"onError",null);api_classPrivateFieldSet(js,this,e)}get promise(){return api_classPrivateFieldGet(js,this).capability.promise}cancel(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;api_classPrivateFieldGet(js,this).cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=api_classPrivateFieldGet(js,this).operatorList;if(!e)return!1;const{annotationCanvasMap:t}=api_classPrivateFieldGet(js,this);return e.form||e.canvas&&t?.size>0}}var Vs=new WeakMap;class InternalRenderTask{constructor(e){let{callback:t,params:i,objs:a,commonObjs:s,annotationCanvasMap:n,operatorList:r,pageIndex:o,canvasFactory:l,filterFactory:d,useRequestAnimationFrame:c=!1,pdfBug:h=!1,pageColors:u=null,enableHWA:_=!1}=e;api_classPrivateFieldInitSpec(this,Vs,null);this.callback=t;this.params=i;this.objs=a;this.commonObjs=s;this.annotationCanvasMap=n;this.operatorListIdx=null;this.operatorList=r;this._pageIndex=o;this.canvasFactory=l;this.filterFactory=d;this._pdfBug=h;this.pageColors=u;this.running=!1;this.graphicsReadyCallback=null;this.graphicsReady=!1;this._useRequestAnimationFrame=!0===c&&"undefined"!=typeof window;this.cancelled=!1;this.capability=Promise.withResolvers();this.task=new RenderTask(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=i.canvas;this._canvasContext=i.canvas?null:i.canvasContext;this._enableHWA=_}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics(e){let{transparency:t=!1,optionalContentConfig:i}=e;if(this.cancelled)return;if(this._canvas){if(Hs._.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.");Hs._.add(this._canvas)}if(this._pdfBug&&globalThis.StepperManager?.enabled){this.stepper=globalThis.StepperManager.create(this._pageIndex);this.stepper.init(this.operatorList);this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint()}const{viewport:a,transform:s,background:n}=this.params,r=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new CanvasGraphics(r,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:i},this.annotationCanvasMap,this.pageColors);this.gfx.beginDrawing({transform:s,viewport:a,transparency:t,background:n});this.operatorListIdx=0;this.graphicsReady=!0;this.graphicsReadyCallback?.()}cancel(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.running=!1;this.cancelled=!0;this.gfx?.endDrawing();if(api_classPrivateFieldGet(Vs,this)){window.cancelAnimationFrame(api_classPrivateFieldGet(Vs,this));api_classPrivateFieldSet(Vs,this,null)}Hs._.delete(this._canvas);e||=new RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,t);this.callback(e);this.task.onError?.(e)}operatorListChanged(){if(this.graphicsReady){this.stepper?.updateOperatorList(this.operatorList);this.running||this._continue()}else this.graphicsReadyCallback||=this._continueBound}_continue(){this.running=!0;this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?api_classPrivateFieldSet(Vs,this,window.requestAnimationFrame((()=>{api_classPrivateFieldSet(Vs,this,null);this._nextBound().catch(this._cancelBound)}))):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){if(!this.cancelled){this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper);if(this.operatorListIdx===this.operatorList.argsArray.length){this.running=!1;if(this.operatorList.lastChunk){this.gfx.endDrawing();Hs._.delete(this._canvas);this.callback()}}}}}var Hs={_:new WeakSet};const zs="5.4.793",Us="44d055348";var $s;function color_picker_classPrivateFieldInitSpec(e,t,i){color_picker_checkPrivateRedeclaration(e,t),t.set(e,i)}function color_picker_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function color_picker_classPrivateGetter(e,t,i){return i(color_picker_assertClassBrand(e,t))}function color_picker_classPrivateFieldGet(e,t){return e.get(color_picker_assertClassBrand(e,t))}function color_picker_classPrivateFieldSet(e,t,i){return e.set(color_picker_assertClassBrand(e,t),i),i}function color_picker_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var qs=new WeakMap,Xs=new WeakMap,Ks=new WeakMap,Ys=new WeakMap,Zs=new WeakMap,Qs=new WeakMap,Js=new WeakMap,en=new WeakMap,tn=new WeakMap,an=new WeakMap,sn=new WeakSet;class ColorPicker{static get _keyboardManager(){return shadow(this,"_keyboardManager",new KeyboardManager([[["Escape","mac+Escape"],ColorPicker.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],ColorPicker.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],ColorPicker.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],ColorPicker.prototype._moveToPrevious],[["Home","mac+Home"],ColorPicker.prototype._moveToBeginning],[["End","mac+End"],ColorPicker.prototype._moveToEnd]]))}constructor(e){let{editor:t=null,uiManager:i=null}=e;!function color_picker_classPrivateMethodInitSpec(e,t){color_picker_checkPrivateRedeclaration(e,t),t.add(e)}(this,sn);color_picker_classPrivateFieldInitSpec(this,qs,null);color_picker_classPrivateFieldInitSpec(this,Xs,null);color_picker_classPrivateFieldInitSpec(this,Ks,void 0);color_picker_classPrivateFieldInitSpec(this,Ys,null);color_picker_classPrivateFieldInitSpec(this,Zs,!1);color_picker_classPrivateFieldInitSpec(this,Qs,!1);color_picker_classPrivateFieldInitSpec(this,Js,null);color_picker_classPrivateFieldInitSpec(this,en,void 0);color_picker_classPrivateFieldInitSpec(this,tn,null);color_picker_classPrivateFieldInitSpec(this,an,null);if(t){color_picker_classPrivateFieldSet(Qs,this,!1);color_picker_classPrivateFieldSet(Js,this,t)}else color_picker_classPrivateFieldSet(Qs,this,!0);color_picker_classPrivateFieldSet(an,this,t?._uiManager||i);color_picker_classPrivateFieldSet(en,this,color_picker_classPrivateFieldGet(an,this)._eventBus);color_picker_classPrivateFieldSet(Ks,this,t?.color?.toUpperCase()||color_picker_classPrivateFieldGet(an,this)?.highlightColors.values().next().value||"#FFFF98");nn._||(nn._=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}renderButton(){const e=color_picker_classPrivateFieldSet(qs,this,document.createElement("button"));e.className="colorPicker";e.tabIndex="0";e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button");e.ariaHasPopup="true";color_picker_classPrivateFieldGet(Js,this)&&(e.ariaControls=`${color_picker_classPrivateFieldGet(Js,this).id}_colorpicker_dropdown`);const t=color_picker_classPrivateFieldGet(an,this)._signal;e.addEventListener("click",color_picker_assertClassBrand(sn,this,_openDropdown).bind(this),{signal:t});e.addEventListener("keydown",color_picker_assertClassBrand(sn,this,_keyDown).bind(this),{signal:t});const i=color_picker_classPrivateFieldSet(Xs,this,document.createElement("span"));i.className="swatch";i.ariaHidden="true";i.style.backgroundColor=color_picker_classPrivateFieldGet(Ks,this);e.append(i);return e}renderMainDropdown(){const e=color_picker_classPrivateFieldSet(Ys,this,color_picker_assertClassBrand(sn,this,_getDropdownRoot).call(this));e.ariaOrientation="horizontal";e.ariaLabelledBy="highlightColorPickerLabel";return e}_colorSelectFromKeyboard(e){if(e.target===color_picker_classPrivateFieldGet(qs,this)){color_picker_assertClassBrand(sn,this,_openDropdown).call(this,e);return}const t=e.target.getAttribute("data-color");t&&color_picker_assertClassBrand(sn,this,_colorSelect).call(this,t,e)}_moveToNext(e){color_picker_classPrivateGetter(sn,this,_get_isDropdownVisible)?e.target!==color_picker_classPrivateFieldGet(qs,this)?e.target.nextSibling?.focus():color_picker_classPrivateFieldGet(Ys,this).firstChild?.focus():color_picker_assertClassBrand(sn,this,_openDropdown).call(this,e)}_moveToPrevious(e){if(e.target!==color_picker_classPrivateFieldGet(Ys,this)?.firstChild&&e.target!==color_picker_classPrivateFieldGet(qs,this)){color_picker_classPrivateGetter(sn,this,_get_isDropdownVisible)||color_picker_assertClassBrand(sn,this,_openDropdown).call(this,e);e.target.previousSibling?.focus()}else color_picker_classPrivateGetter(sn,this,_get_isDropdownVisible)&&this._hideDropdownFromKeyboard()}_moveToBeginning(e){color_picker_classPrivateGetter(sn,this,_get_isDropdownVisible)?color_picker_classPrivateFieldGet(Ys,this).firstChild?.focus():color_picker_assertClassBrand(sn,this,_openDropdown).call(this,e)}_moveToEnd(e){color_picker_classPrivateGetter(sn,this,_get_isDropdownVisible)?color_picker_classPrivateFieldGet(Ys,this).lastChild?.focus():color_picker_assertClassBrand(sn,this,_openDropdown).call(this,e)}hideDropdown(){color_picker_classPrivateFieldGet(Ys,this)?.classList.add("hidden");color_picker_classPrivateFieldGet(qs,this).ariaExpanded="false";color_picker_classPrivateFieldGet(tn,this)?.abort();color_picker_classPrivateFieldSet(tn,this,null)}_hideDropdownFromKeyboard(){if(!color_picker_classPrivateFieldGet(Qs,this))if(color_picker_classPrivateGetter(sn,this,_get_isDropdownVisible)){this.hideDropdown();color_picker_classPrivateFieldGet(qs,this).focus({preventScroll:!0,focusVisible:color_picker_classPrivateFieldGet(Zs,this)})}else color_picker_classPrivateFieldGet(Js,this)?.unselect()}updateColor(e){color_picker_classPrivateFieldGet(Xs,this)&&(color_picker_classPrivateFieldGet(Xs,this).style.backgroundColor=e);if(!color_picker_classPrivateFieldGet(Ys,this))return;const t=color_picker_classPrivateFieldGet(an,this).highlightColors.values();for(const i of color_picker_classPrivateFieldGet(Ys,this).children)i.ariaSelected=t.next().value===e.toUpperCase()}destroy(){color_picker_classPrivateFieldGet(qs,this)?.remove();color_picker_classPrivateFieldSet(qs,this,null);color_picker_classPrivateFieldSet(Xs,this,null);color_picker_classPrivateFieldGet(Ys,this)?.remove();color_picker_classPrivateFieldSet(Ys,this,null)}}$s=ColorPicker;function _getDropdownRoot(){const e=document.createElement("div"),t=color_picker_classPrivateFieldGet(an,this)._signal;e.addEventListener("contextmenu",noContextMenu,{signal:t});e.className="dropdown";e.role="listbox";e.ariaMultiSelectable="false";e.ariaOrientation="vertical";e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");color_picker_classPrivateFieldGet(Js,this)&&(e.id=`${color_picker_classPrivateFieldGet(Js,this).id}_colorpicker_dropdown`);for(const[i,a]of color_picker_classPrivateFieldGet(an,this).highlightColors){const s=document.createElement("button");s.tabIndex="0";s.role="option";s.setAttribute("data-color",a);s.title=i;s.setAttribute("data-l10n-id",nn._[i]);const n=document.createElement("span");s.append(n);n.className="swatch";n.style.backgroundColor=a;s.ariaSelected=a===color_picker_classPrivateFieldGet(Ks,this);s.addEventListener("click",color_picker_assertClassBrand(sn,this,_colorSelect).bind(this,a),{signal:t});e.append(s)}e.addEventListener("keydown",color_picker_assertClassBrand(sn,this,_keyDown).bind(this),{signal:t});return e}function _colorSelect(e,t){t.stopPropagation();color_picker_classPrivateFieldGet(en,this).dispatch("switchannotationeditorparams",{source:this,type:v.HIGHLIGHT_COLOR,value:e});this.updateColor(e)}function _keyDown(e){$s._keyboardManager.exec(this,e)}function _openDropdown(e){if(color_picker_classPrivateGetter(sn,this,_get_isDropdownVisible)){this.hideDropdown();return}color_picker_classPrivateFieldSet(Zs,this,0===e.detail);if(!color_picker_classPrivateFieldGet(tn,this)){color_picker_classPrivateFieldSet(tn,this,new AbortController);window.addEventListener("pointerdown",color_picker_assertClassBrand(sn,this,color_picker_pointerDown).bind(this),{signal:color_picker_classPrivateFieldGet(an,this).combinedSignal(color_picker_classPrivateFieldGet(tn,this))})}color_picker_classPrivateFieldGet(qs,this).ariaExpanded="true";if(color_picker_classPrivateFieldGet(Ys,this)){color_picker_classPrivateFieldGet(Ys,this).classList.remove("hidden");return}const t=color_picker_classPrivateFieldSet(Ys,this,color_picker_assertClassBrand(sn,this,_getDropdownRoot).call(this));color_picker_classPrivateFieldGet(qs,this).append(t)}function color_picker_pointerDown(e){color_picker_classPrivateFieldGet(Ys,this)?.contains(e.target)||this.hideDropdown()}function _get_isDropdownVisible(e){return color_picker_classPrivateFieldGet(Ys,e)&&!color_picker_classPrivateFieldGet(Ys,e).classList.contains("hidden")}var nn={_:null},rn=new WeakMap,on=new WeakMap,ln=new WeakMap;class BasicColorPicker{constructor(e){color_picker_classPrivateFieldInitSpec(this,rn,null);color_picker_classPrivateFieldInitSpec(this,on,null);color_picker_classPrivateFieldInitSpec(this,ln,null);color_picker_classPrivateFieldSet(on,this,e);color_picker_classPrivateFieldSet(ln,this,e._uiManager);dn._||(dn._=Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(color_picker_classPrivateFieldGet(rn,this))return color_picker_classPrivateFieldGet(rn,this);const{editorType:e,colorType:t,colorValue:i}=color_picker_classPrivateFieldGet(on,this),a=color_picker_classPrivateFieldSet(rn,this,document.createElement("input"));a.type="color";a.value=i||"#000000";a.className="basicColorPicker";a.tabIndex=0;a.setAttribute("data-l10n-id",dn._[e]);a.addEventListener("input",(()=>{color_picker_classPrivateFieldGet(ln,this).updateParams(t,a.value)}),{signal:color_picker_classPrivateFieldGet(ln,this)._signal});return a}update(e){color_picker_classPrivateFieldGet(rn,this)&&(color_picker_classPrivateFieldGet(rn,this).value=e)}destroy(){color_picker_classPrivateFieldGet(rn,this)?.remove();color_picker_classPrivateFieldSet(rn,this,null)}hideDropdown(){}}var dn={_:null};__webpack_require__(531);function makeColorComp(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}function scaleAndClamp(e){return Math.max(0,Math.min(255,255*e))}class ColorConverters{static CMYK_G(e){let[t,i,a,s]=e;return["G",1-Math.min(1,.3*t+.59*a+.11*i+s)]}static G_CMYK(e){let[t]=e;return["CMYK",0,0,0,1-t]}static G_RGB(e){let[t]=e;return["RGB",t,t,t]}static G_rgb(e){let[t]=e;t=scaleAndClamp(t);return[t,t,t]}static G_HTML(e){let[t]=e;const i=makeColorComp(t);return`#${i}${i}${i}`}static RGB_G(e){let[t,i,a]=e;return["G",.3*t+.59*i+.11*a]}static RGB_rgb(e){return e.map(scaleAndClamp)}static RGB_HTML(e){return`#${e.map(makeColorComp).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB(e){let[t,i,a,s]=e;return["RGB",1-Math.min(1,t+s),1-Math.min(1,a+s),1-Math.min(1,i+s)]}static CMYK_rgb(e){let[t,i,a,s]=e;return[scaleAndClamp(1-Math.min(1,t+s)),scaleAndClamp(1-Math.min(1,a+s)),scaleAndClamp(1-Math.min(1,i+s))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK(e){let[t,i,a]=e;const s=1-t,n=1-i,r=1-a;return["CMYK",s,n,r,Math.min(s,n,r)]}}class BaseSVGFactory{create(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const a=this._createSVG("svg:svg");a.setAttribute("version","1.1");if(!i){a.setAttribute("width",`${e}px`);a.setAttribute("height",`${t}px`)}a.setAttribute("preserveAspectRatio","none");a.setAttribute("viewBox",`0 0 ${e} ${t}`);return a}createElement(e){if("string"!=typeof e)throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){unreachable("Abstract method `_createSVG` called.")}}class DOMSVGFactory extends BaseSVGFactory{_createSVG(e){return document.createElementNS(q,e)}}class XfaLayer{static setupStorage(e,t,i,a,s){const n=window.getFormValueFromAngular(e);n.value&&a.setValue(t,n);const r=a.getValue(t,{value:null}),o=n.value?n:r;window.registerXFAField(e,o,r);e.addEventListener("updateFromAngular",(e=>a.setValue(t,{value:e.detail})));switch(i.name){case"textarea":null!==o.value&&(e.textContent=o.value);if("print"===s)break;e.addEventListener("input",(i=>{window.updateAngularFormValue(e,{value:i.target.value});a.setValue(t,{value:i.target.value})}));break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){o.value===i.attributes.xfaOn?e.setAttribute("checked",!0):e.removeAttribute("checked");if("print"===s)break;e.addEventListener("change",(i=>{window.updateAngularFormValue(e,{value:i.target.checked?i.target.getAttribute("xfaOn"):i.target.getAttribute("xfaOff")});a.setValue(t,{value:i.target.checked?i.target.getAttribute("xfaOn"):i.target.getAttribute("xfaOff")})}))}else{null!==o.value&&e.setAttribute("value",o.value);if("print"===s)break;e.addEventListener("input",(i=>{window.updateAngularFormValue(e,{value:i.target.value});a.setValue(t,{value:i.target.value})}))}break;case"select":if(null!==o.value){e.setAttribute("value",o.value);for(const e of i.children)e.attributes.value===o.value?e.attributes.selected=!0:e.attributes.hasOwnProperty("selected")&&delete e.attributes.selected}e.addEventListener("input",(i=>{const s=i.target.options,n=-1===s.selectedIndex?"":s[s.selectedIndex].value;window.updateAngularFormValue(e,{value:n});a.setValue(t,{value:n})}))}}static setAttributes(e){let{html:t,element:i,storage:a=null,intent:s,linkService:n}=e;const{attributes:r}=i,o=t instanceof HTMLAnchorElement;"radio"===r.type&&(r.name=`${r.name}-${s}`);for(const[e,i]of Object.entries(r))if(null!=i)switch(e){case"class":i.length&&t.setAttribute(e,i.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",i);break;case"style":Object.assign(t.style,i);break;case"textContent":t.textContent=i;break;default:(!o||"href"!==e&&"newWindow"!==e)&&t.setAttribute(e,i)}o&&n.addLinkAttributes(t,r.href,r.newWindow);a&&r.dataId&&this.setupStorage(t,r.dataId,i,a)}static render(e){const t=e.annotationStorage,i=e.linkService,a=e.xfaHtml,s=e.intent||"display",n=document.createElement(a.name);a.attributes&&this.setAttributes({html:n,element:a,intent:s,linkService:i});const r="richText"!==s,o=e.div;o.append(n);if(e.viewport){const t=`matrix(${e.viewport.transform.join(",")})`;o.style.transform=t}r&&o.setAttribute("class","xfaLayer xfaFont");const l=[];if(0===a.children.length){if(a.value){const e=document.createTextNode(a.value);n.append(e);r&&XfaText.shouldBuildText(a.name)&&l.push(e)}return{textDivs:l}}const d=[[a,-1,n]];for(;d.length>0;){const[e,a,n]=d.at(-1);if(a+1===e.children.length){d.pop();continue}const o=e.children[++d.at(-1)[1]];if(null===o)continue;const{name:c}=o;if("#text"===c){const e=document.createTextNode(o.value);l.push(e);n.append(e);continue}const h=o?.attributes?.xmlns?document.createElementNS(o.attributes.xmlns,c):document.createElement(c);n.append(h);o.attributes&&this.setAttributes({html:h,element:o,storage:t,intent:s,linkService:i});if(o.children?.length>0)d.push([o,-1,h]);else if(o.value){const e=document.createTextNode(o.value);r&&XfaText.shouldBuildText(c)&&l.push(e);h.append(e)}}for(const e of o.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:l}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t;e.div.hidden=!1}}function _toSetter(e,t,i){t||(t=[]);var a=t.length++;return Object.defineProperty({},"_",{set:function(s){t[a]=s,e.apply(i,t)}})}function annotation_layer_classPrivateGetter(e,t,i){return i(annotation_layer_assertClassBrand(e,t))}function annotation_layer_classPrivateMethodInitSpec(e,t){annotation_layer_checkPrivateRedeclaration(e,t),t.add(e)}function annotation_layer_classPrivateFieldInitSpec(e,t,i){annotation_layer_checkPrivateRedeclaration(e,t),t.set(e,i)}function annotation_layer_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function annotation_layer_classPrivateFieldSet(e,t,i){return e.set(annotation_layer_assertClassBrand(e,t),i),i}function annotation_layer_classPrivateFieldGet(e,t){return e.get(annotation_layer_assertClassBrand(e,t))}function annotation_layer_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const cn=new WeakSet,hn=60*(new Date).getTimezoneOffset()*1e3;class AnnotationElementFactory{static create(e){switch(e.data.annotationType){case A.LINK:return new LinkAnnotationElement(e);case A.TEXT:return new TextAnnotationElement(e);case A.WIDGET:switch(e.data.fieldType){case"Tx":return new TextWidgetAnnotationElement(e);case"Btn":return e.data.radioButton?new RadioButtonWidgetAnnotationElement(e):e.data.checkBox?new CheckboxWidgetAnnotationElement(e):new PushButtonWidgetAnnotationElement(e);case"Ch":return new ChoiceWidgetAnnotationElement(e);case"Sig":return new SignatureWidgetAnnotationElement(e)}return new WidgetAnnotationElement(e);case A.POPUP:return new PopupAnnotationElement(e);case A.FREETEXT:return new FreeTextAnnotationElement(e);case A.LINE:return new LineAnnotationElement(e);case A.SQUARE:return new SquareAnnotationElement(e);case A.CIRCLE:return new CircleAnnotationElement(e);case A.POLYLINE:return new PolylineAnnotationElement(e);case A.CARET:return new CaretAnnotationElement(e);case A.INK:return new InkAnnotationElement(e);case A.POLYGON:return new PolygonAnnotationElement(e);case A.HIGHLIGHT:return new HighlightAnnotationElement(e);case A.UNDERLINE:return new UnderlineAnnotationElement(e);case A.SQUIGGLY:return new SquigglyAnnotationElement(e);case A.STRIKEOUT:return new StrikeOutAnnotationElement(e);case A.STAMP:return new StampAnnotationElement(e);case A.FILEATTACHMENT:return new FileAttachmentAnnotationElement(e);default:return new AnnotationElement(e)}}}var un=new WeakMap,_n=new WeakMap,pn=new WeakMap,gn=new WeakSet;class AnnotationElement{constructor(e){let{isRenderable:t=!1,ignoreBorder:i=!1,createQuadrilaterals:a=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};annotation_layer_classPrivateMethodInitSpec(this,gn);annotation_layer_classPrivateFieldInitSpec(this,un,null);annotation_layer_classPrivateFieldInitSpec(this,_n,!1);annotation_layer_classPrivateFieldInitSpec(this,pn,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.enableScripting=e.enableScripting;this.hasJSActions=e.hasJSActions;this._fieldObjects=e.fieldObjects;this.parent=e.parent;t&&(this.container=this._createContainer(i));a&&this._createQuadrilaterals()}static _hasPopupData(e){let{contentsObj:t,richText:i}=e;return!(!t?.str&&!i?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return AnnotationElement._hasPopupData(this.data)}updateEdited(e){if(!this.container)return;e.rect&&(annotation_layer_classPrivateFieldGet(un,this)||annotation_layer_classPrivateFieldSet(un,this,{rect:this.data.rect.slice(0)}));const{rect:t,popup:i}=e;t&&annotation_layer_assertClassBrand(gn,this,_setRectEdited).call(this,t);let a=annotation_layer_classPrivateFieldGet(pn,this)?.popup||this.popup;if(!a&&i?.text){this._createPopup(i);a=annotation_layer_classPrivateFieldGet(pn,this).popup}if(a){a.updateEdited(e);if(i?.deleted){a.remove();annotation_layer_classPrivateFieldSet(pn,this,null);this.popup=null}}}resetEdited(){if(annotation_layer_classPrivateFieldGet(un,this)){annotation_layer_assertClassBrand(gn,this,_setRectEdited).call(this,annotation_layer_classPrivateFieldGet(un,this).rect);annotation_layer_classPrivateFieldGet(pn,this)?.popup.resetEdited();annotation_layer_classPrivateFieldSet(un,this,null)}}_createContainer(e){const{data:t,parent:{page:i,viewport:a}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",t.id);this instanceof WidgetAnnotationElement||this instanceof LinkAnnotationElement||(s.tabIndex=0);const{style:n}=s;n.zIndex=this.parent.zIndex++;t.alternativeText&&(s.title=t.alternativeText);t.noRotate&&s.classList.add("norotate");if(!t.rect||this instanceof PopupAnnotationElement){const{rotation:e}=t;t.hasOwnCanvas||0===e||this.setRotation(e,s);return s}const{width:r,height:o}=this;if(!e&&t.borderStyle.width>0){n.borderWidth=`${t.borderStyle.width}px`;const e=t.borderStyle.horizontalCornerRadius,i=t.borderStyle.verticalCornerRadius;if(e>0||i>0){const t=`calc(${e}px * var(--total-scale-factor)) / calc(${i}px * var(--total-scale-factor))`;n.borderRadius=t}else if(this instanceof RadioButtonWidgetAnnotationElement){const e=`calc(${r}px * var(--total-scale-factor)) / calc(${o}px * var(--total-scale-factor))`;n.borderRadius=e}switch(t.borderStyle.style){case E:n.borderStyle="solid";break;case k:n.borderStyle="dashed";break;case I:warn("Unimplemented border style: beveled");break;case M:warn("Unimplemented border style: inset");break;case B:n.borderBottomStyle="solid"}const a=t.borderColor||null;if(a){annotation_layer_classPrivateFieldSet(_n,this,!0);n.borderColor=Util.makeHexColor(0|a[0],0|a[1],0|a[2])}else n.borderWidth=0}const l=Util.normalizeRect([t.rect[0],i.view[3]-t.rect[1]+i.view[1],t.rect[2],i.view[3]-t.rect[3]+i.view[1]]),{pageWidth:d,pageHeight:c,pageX:h,pageY:u}=a.rawDims;n.left=100*(l[0]-h)/d+"%";n.top=100*(l[1]-u)/c+"%";const{rotation:_}=t;if(t.hasOwnCanvas||0===_){n.width=100*r/d+"%";n.height=100*o/c+"%"}else this.setRotation(_,s);return s}setRotation(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;if(!this.data.rect)return;const{pageWidth:i,pageHeight:a}=this.parent.viewport.rawDims;let{width:s,height:n}=this;e%180!=0&&([s,n]=[n,s]);t.style.width=100*s/i+"%";t.style.height=100*n/a+"%";t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const setColor=(e,t,i)=>{const a=i.detail[e],s=a[0],n=a.slice(1);i.target.style[t]=ColorConverters[`${s}_HTML`](n);this.annotationStorage.setValue(this.data.id,{[t]:ColorConverters[`${s}_rgb`](n)})};return shadow(this,"_commonActions",{display:e=>{const{display:t}=e.detail,i=t%2==1;this.container.style.visibility=i?"hidden":"visible";this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===t||2===t})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:t}=e.detail;this.container.style.visibility=t?"hidden":"visible";this.annotationStorage.setValue(this.data.id,{noPrint:t,noView:t})},focus:e=>{setTimeout((()=>e.target.focus({preventScroll:!1})),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{setColor("bgColor","backgroundColor",e)},fillColor:e=>{setColor("fillColor","backgroundColor",e)},fgColor:e=>{setColor("fgColor","color",e)},textColor:e=>{setColor("textColor","color",e)},borderColor:e=>{setColor("borderColor","borderColor",e)},strokeColor:e=>{setColor("strokeColor","borderColor",e)},rotation:e=>{const t=e.detail.rotation;this.setRotation(t);this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){const i=this._commonActions;for(const a of Object.keys(t.detail)){const s=e[a]||i[a];s?.(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const i=this._commonActions;for(const[a,s]of Object.entries(t)){const n=i[a];if(n){n({detail:{[a]:s},target:e});delete t[a]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,i,a,s]=this.data.rect.map((e=>Math.fround(e)));if(8===e.length){const[n,r,o,l]=e.subarray(2,6);if(a===n&&s===r&&t===o&&i===l)return}const{style:n}=this.container;let r;if(annotation_layer_classPrivateFieldGet(_n,this)){const{borderColor:e,borderWidth:t}=n;n.borderWidth=0;r=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${e}" stroke-width="${t}">`];this.container.classList.add("hasBorder")}const o=a-t,l=s-i,{svgFactory:d}=this,c=d.createElement("svg");c.classList.add("quadrilateralsContainer");c.setAttribute("width",0);c.setAttribute("height",0);c.role="none";const h=d.createElement("defs");c.append(h);const u=d.createElement("clipPath"),_=`clippath_${this.data.id}`;u.setAttribute("id",_);u.setAttribute("clipPathUnits","objectBoundingBox");h.append(u);for(let i=2,a=e.length;i<a;i+=8){const a=e[i],n=e[i+1],c=e[i+2],h=e[i+3],_=d.createElement("rect"),p=(c-t)/o,g=(s-n)/l,f=(a-c)/o,v=(n-h)/l;_.setAttribute("x",p);_.setAttribute("y",g);_.setAttribute("width",f);_.setAttribute("height",v);u.append(_);r?.push(`<rect vector-effect="non-scaling-stroke" x="${p}" y="${g}" width="${f}" height="${v}"/>`)}if(annotation_layer_classPrivateFieldGet(_n,this)){r.push("</g></svg>')");n.backgroundImage=r.join("")}this.container.append(c);this.container.style.clipPath=`url(#${_})`}_createPopup(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const{data:t}=this;let i,a;if(e){i={str:e.text};a=e.date}else{i=t.contentsObj;a=t.modificationDate}const s=annotation_layer_classPrivateFieldSet(pn,this,new PopupAnnotationElement({data:{color:t.color,titleObj:t.titleObj,modificationDate:a,contentsObj:i,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]}));this.parent.div.append(s.render())}get hasPopupElement(){return!!(annotation_layer_classPrivateFieldGet(pn,this)||this.popup||this.data.popupRef)}render(){unreachable("Abstract method `AnnotationElement.render` called")}_getElementsByName(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[];if(this._fieldObjects){const a=this._fieldObjects[e];if(a)for(const{page:e,id:s,exportValues:n}of a){if(-1===e)continue;if(s===t)continue;const a="string"==typeof n?n:null,r=document.querySelector(`[data-element-id="${s}"]`);!r||cn.has(r)?i.push({id:s,exportValue:a,domElement:r}):warn(`_getElementsByName - element not allowed: ${s}`)}return i}for(const a of document.getElementsByName(e)){const{exportValue:e}=a,s=a.getAttribute("data-element-id");s!==t&&(cn.has(a)&&i.push({id:s,exportValue:e,domElement:a}))}return i}show(){this.container&&(this.container.hidden=!1);this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0);this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){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",(()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t,mustEnterInEditMode:!0})}))}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}}function _setRectEdited(e){const{container:{style:t},data:{rect:i,rotation:a},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:n,pageX:r,pageY:o}}}}=this;i?.splice(0,4,...e);t.left=100*(e[0]-r)/s+"%";t.top=100*(n-e[3]+o)/n+"%";if(0===a){t.width=100*(e[2]-e[0])/s+"%";t.height=100*(e[3]-e[1])/n+"%"}else this.setRotation(a)}var fn=new WeakSet;class LinkAnnotationElement extends AnnotationElement{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0});annotation_layer_classPrivateMethodInitSpec(this,fn);this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:t}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let a=!1;if(e.url){t.addLinkAttributes(i,e.url,e.newWindow);a=!0}else if(e.action){this._bindNamedAction(i,e.action,e.overlaidText);a=!0}else if(e.attachment){annotation_layer_assertClassBrand(fn,this,_bindAttachment).call(this,i,e.attachment,e.overlaidText,e.attachmentDest);a=!0}else if(e.setOCGState){annotation_layer_assertClassBrand(fn,this,_bindSetOCGState).call(this,i,e.setOCGState,e.overlaidText);a=!0}else if(e.dest){this._bindLink(i,e.dest,e.overlaidText);a=!0}else{if(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions){this._bindJSAction(i,e);a=!0}if(e.resetForm){this._bindResetFormAction(i,e.resetForm);a=!0}else if(this.isTooltipOnly&&!a){this._bindLink(i,"");a=!0}}this.container.classList.add("linkAnnotation");a&&this.container.append(i);return this.container}_bindLink(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";e.href=this.linkService.getDestinationHash(t);e.onclick=()=>{t&&this.linkService.goToDestination(t);return!1};(t||""===t)&&annotation_layer_assertClassBrand(fn,this,_setInternalLink).call(this);i&&(e.title=i)}_bindNamedAction(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";e.href=this.linkService.getAnchorUrl("");e.onclick=()=>{this.linkService.executeNamedAction(t);return!1};i&&(e.title=i);annotation_layer_assertClassBrand(fn,this,_setInternalLink).call(this)}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const a of Object.keys(t.actions)){const s=i.get(a);s&&(e[s]=()=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:a}});return!1})}t.overlaidText&&(e.title=t.overlaidText);e.onclick||(e.onclick=()=>!1);annotation_layer_assertClassBrand(fn,this,_setInternalLink).call(this)}_bindResetFormAction(e,t){const i=e.onclick;i||(e.href=this.linkService.getAnchorUrl(""));annotation_layer_assertClassBrand(fn,this,_setInternalLink).call(this);if(this._fieldObjects)e.onclick=()=>{i?.();const{fields:e,refs:a,include:s}=t,n=[];if(0!==e.length||0!==a.length){const t=new Set(a);for(const i of e){const e=this._fieldObjects[i]||[];for(const{id:i}of e)t.add(i)}for(const e of Object.values(this._fieldObjects))for(const i of e)t.has(i.id)===s&&n.push(i)}else for(const e of Object.values(this._fieldObjects))n.push(...e);const r=this.annotationStorage,o=[];for(const e of n){const{id:t}=e;o.push(t);switch(e.type){case"text":{const i=e.defaultValue||"";r.setValue(t,{value:i});window.updateAngularFormValue(t,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;r.setValue(t,{value:i});window.updateAngularFormValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";r.setValue(t,{value:i});window.updateAngularFormValue(t,{value:i});break}default:continue}const i=document.querySelector(`[data-element-id="${t}"]`);i&&(cn.has(i)?i.dispatchEvent(new Event("resetform")):warn(`_bindResetFormAction - element not allowed: ${t}`))}this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}});return!1};else{warn('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.');i||(e.onclick=()=>!1)}}}function _setInternalLink(){this.container.setAttribute("data-internal-link","")}function _bindAttachment(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;e.href=this.linkService.getAnchorUrl("");t.description?e.title=t.description:i&&(e.title=i);e.onclick=()=>{this.downloadManager?.openOrDownloadData(t.content,t.filename,a);return!1};annotation_layer_assertClassBrand(fn,this,_setInternalLink).call(this)}function _bindSetOCGState(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";e.href=this.linkService.getAnchorUrl("");e.onclick=()=>{this.linkService.executeSetOCGState(t);return!1};i&&(e.title=i);annotation_layer_assertClassBrand(fn,this,_setInternalLink).call(this)}class TextAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");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._createPopup();this.container.append(e);return this.container}}class WidgetAnnotationElement extends AnnotationElement{render(){return this.container}showElementAndHideCanvas(e){if(this.data.hasOwnCanvas){"CANVAS"===e.previousSibling?.nodeName&&(e.previousSibling.hidden=!0);e.hidden=!1}}_getKeyModifier(e){return util_FeatureTest.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,i,a,s){i.includes("mouse")?e.addEventListener(i,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:s(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})})):e.addEventListener(i,(e=>{if("blur"===i){if(!t.focused)return;t.focused=!1}else if("focus"===i){if(t.focused)return;t.focused=!0}s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:s(e)}})}))}_setEventListeners(e,t,i,a){for(const[s,n]of i)if("Action"===n||this.data.actions?.[n]){"Focus"!==n&&"Blur"!==n||(t||={focused:!1});this._setEventListener(e,t,s,n,a);"Focus"!==n||this.data.actions?.Blur?"Blur"!==n||this.data.actions?.Focus||this._setEventListener(e,t,"focus","Focus",null):this._setEventListener(e,t,"blur","Blur",null)}}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=null===t?"transparent":Util.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const t=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,a=this.data.defaultAppearanceData.fontSize||9,s=e.style;let r;const roundToOneDecimal=e=>Math.round(10*e)/10;if(this.data.multiLine){const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(n*a))||1);r=Math.min(a,roundToOneDecimal(t/n))}else{const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);r=Math.min(a,roundToOneDecimal(e/n))}s.fontSize=`calc(${r}px * var(--total-scale-factor))`;s.color=Util.makeHexColor(i[0],i[1],i[2]);null!==this.data.textAlignment&&(s.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required");e.setAttribute("aria-required",t)}}class TextWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue})}setPropertyOnSiblings(e,t,i,a){const s=this.annotationStorage;for(const n of this._getElementsByName(e.name,e.id)){n.domElement&&(n.domElement[t]=i);s.setValue(n.id,{[a]:i})}}render(){const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){const a=window.getFormValueFromAngular(this.data.fieldName),s=e.getValue(t,{value:this.data.fieldValue}),n=a.value?a:s;if(a!==s){e.setValue(t,{value:a.value});n.formattedValue=a.value}let r=n.value||"";const o=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;o&&r.length>o&&(r=r.slice(0,o));let l=n.formattedValue||this.data.textContent?.join("\n")||null;l&&this.data.comb&&(l=l.replaceAll(/\s+/g,""));const d={userValue:r,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};if(this.data.multiLine){i=document.createElement("textarea");i.textContent=l??r;this.data.doNotScroll&&(i.style.overflowY="hidden")}else{i=document.createElement("input");i.type=this.data.password?"password":"text";i.setAttribute("value",l??r);this.data.doNotScroll&&(i.style.overflowX="hidden")}this.data.hasOwnCanvas&&(i.hidden=!0);cn.add(i);i.setAttribute("data-element-id",t);i.disabled=this.data.readOnly;i.name=this.data.fieldName;i.tabIndex=0;const{datetimeFormat:c,datetimeType:h,timeStep:u}=this.data,_=!!h&&this.enableScripting;c&&(i.title=c);this._setRequired(i,this.data.required);o&&(i.maxLength=o);i.addEventListener("input",(a=>{e.setValue(t,{value:a.target.value});window.updateAngularFormValue(t,{value:a.target.value});this.setPropertyOnSiblings(i,"value",a.target.value,"value");d.formattedValue=null}));i.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue??"";i.value=d.userValue=t;d.formattedValue=null}));let blurListener=e=>{const{formattedValue:t}=d;null!=t&&(e.target.value=t);e.target.scrollLeft=0};window.registerAcroformField(t,i,n.value,void 0,this.data.fieldValue);i.addEventListener("updateFromAngular",(i=>{d.formattedValue=null;e.setValue(t,{value:i.detail})}));if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",(e=>{if(d.focused)return;const{target:t}=e;if(_){t.type=h;u&&(t.step=u)}if(d.userValue){const e=d.userValue;if(_)if("time"===h){const i=new Date(e),a=[i.getHours(),i.getMinutes(),i.getSeconds()];t.value=a.map((e=>e.toString().padStart(2,"0"))).join(":")}else t.value=new Date(e-hn).toISOString().split("date"===h?"T":".",1)[0];else t.value=e}d.lastCommittedValue=t.value;d.commitKey=1;this.data.actions?.Focus||(d.focused=!0)}));i.addEventListener("updatefromsandbox",(i=>{this.showElementAndHideCanvas(i.target);const a={value(i){d.userValue=i.detail.value??"";if(!_){e.setValue(t,{value:d.userValue.toString()});window.updateAngularFormValue(t,{value:d.userValue.toString()})}i.target.value=d.userValue},formattedValue(i){const{formattedValue:a}=i.detail;d.formattedValue=a;null!=a&&i.target!==document.activeElement&&(i.target.value=a);const s={formattedValue:a};_&&(s.value=a);e.setValue(t,s);window.updateAngularFormValue(t,{formattedValue:a})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:i=>{const{charLimit:a}=i.detail,{target:s}=i;if(0===a){s.removeAttribute("maxLength");return}s.setAttribute("maxLength",a);let n=d.userValue;if(n&&!(n.length<=a)){n=n.slice(0,a);s.value=d.userValue=n;e.setValue(t,{value:n});window.updateAngularFormValue(t,{value:n});this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:n,willCommit:!0,commitKey:1,selStart:s.selectionStart,selEnd:s.selectionEnd}})}}};this._dispatchEventFromSandbox(a,i)}));i.addEventListener("keydown",(e=>{d.commitKey=1;let i=-1;"Escape"===e.key?i=0:"Enter"!==e.key||this.data.multiLine?"Tab"===e.key&&(d.commitKey=3):i=2;if(-1===i)return;const{value:a}=e.target;if(d.lastCommittedValue!==a){d.lastCommittedValue=a;d.userValue=a;this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:a,willCommit:!0,commitKey:i,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}})}}));const a=blurListener;blurListener=null;i.addEventListener("blur",(e=>{if(!d.focused)return;this.data.actions?.Blur||(d.focused=!1);const{target:i}=e;let{value:s}=i;if(_){if(s&&"time"===h){const e=s.split(":").map((e=>parseInt(e,10)));s=new Date(2e3,0,1,e[0],e[1],e[2]||0).valueOf();i.step=""}else s=new Date(s).valueOf();i.type="text"}d.userValue=s;d.lastCommittedValue!==s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:s,willCommit:!0,commitKey:d.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}});a(e)}));this.data.actions?.Keystroke&&i.addEventListener("beforeinput",(e=>{d.lastCommittedValue=null;const{data:i,target:a}=e,{value:s,selectionStart:n,selectionEnd:r}=a;let o=n,l=r;switch(e.inputType){case"deleteWordBackward":{const e=s.substring(0,n).match(/\w*[^\w]*$/);e&&(o-=e[0].length);break}case"deleteWordForward":{const e=s.substring(n).match(/^[^\w]*\w*/);e&&(l+=e[0].length);break}case"deleteContentBackward":n===r&&(o-=1);break;case"deleteContentForward":n===r&&(l+=1)}e.preventDefault();this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:s,change:i||"",willCommit:!1,selStart:o,selEnd:l}})}));this._setEventListeners(i,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.value))}blurListener&&i.addEventListener("blur",blurListener);if(this.data.comb){const e=(this.data.rect[2]-this.data.rect[0])/o;i.classList.add("comb");i.style.letterSpacing=`calc(${e}px * var(--total-scale-factor) - 1ch)`}}else{i=document.createElement("div");i.textContent=this.data.fieldValue;i.style.verticalAlign="middle";i.style.display="table-cell";this.data.hasOwnCanvas&&(i.hidden=!0)}this._setTextStyle(i);this._setBackgroundColor(i);this._setDefaultPropertiesFromJS(i);this.container.append(i);return this.container}}class SignatureWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,i=t.id,a=window.getFormValueFromAngular(this.data.fieldName),s=e.getValue(i,{value:t.exportValue===t.fieldValue}).value;let n;a.value&&(n=!0===a.value||a.value===t.exportValue);let r=void 0!==n?n:s,o=!1;if("string"==typeof r){r=r===t.exportValue;e.setValue(i,{value:r});o=!0}else if(void 0!==a?.value&&a.value!==s){r=!0===a.value||a.value===t.exportValue?t.exportValue:void 0;e.setValue(i,{value:r})}this.container.classList.add("buttonWidgetAnnotation","checkBox");const l=document.createElement("input");cn.add(l);l.setAttribute("data-element-id",i);l.disabled=t.readOnly;this._setRequired(l,this.data.required);l.type="checkbox";l.name=t.fieldName;r&&l.setAttribute("checked",!0);l.setAttribute("exportValue",t.exportValue);l.tabIndex=0;l.addEventListener("change",(a=>{const{name:s,checked:n}=a.target;for(const a of this._getElementsByName(s,i)){const s=n&&a.exportValue===t.exportValue;a.domElement&&(a.domElement.checked=s);e.setValue(a.id,{value:s});window.updateAngularFormValue(i,{value:s})}e.setValue(i,{value:n});window.updateAngularFormValue(i,{value:n})}));l.addEventListener("resetform",(e=>{const i=t.defaultFieldValue||"Off";e.target.checked=i===t.exportValue}));window.registerAcroformField(i,l,r?t.exportValue:void 0,void 0,this.data.fieldValue);l.addEventListener("updateFromAngular",(t=>e.setValue(i,{value:t.detail})));o&&window.updateAngularFormValue(i,{value:r});if(this.enableScripting&&this.hasJSActions){l.addEventListener("updatefromsandbox",(t=>{const a={value(t){t.target.checked="Off"!==t.detail.value;e.setValue(i,{value:t.target.checked});window.updateAngularFormValue(i,{value:t.target.value})}};this._dispatchEventFromSandbox(a,t)}));this._setEventListeners(l,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))}this._setBackgroundColor(l);this._setDefaultPropertiesFromJS(l);this.container.append(l);return this.container}}class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,i=t.id,a=window.getFormValueFromAngular(this.data.fieldName),s=t.fieldValue===t.buttonValue?t.buttonValue:void 0,n=e.getValue(i,{value:s}).value;let r=a.value??n;if("string"==typeof r||a!==n){r=r===t.buttonValue;e.setValue(i,{value:r})}else r&&window.updateAngularFormValue(i,{value:t.buttonValue});if(r)for(const a of this._getElementsByName(t.fieldName,i))e.setValue(a.id,{value:!1});const o=document.createElement("input");cn.add(o);o.setAttribute("data-element-id",i);o.disabled=t.readOnly;this._setRequired(o,this.data.required);o.type="radio";o.name=t.fieldName;r&&o.setAttribute("checked",!0);o.tabIndex=0;o.addEventListener("change",(t=>{const{name:a,checked:s}=t.target;for(const t of this._getElementsByName(a,i)){e.setValue(t.id,{value:!1});window.updateAngularFormValue(t.id,{value:!1})}e.setValue(i,{value:s});window.updateAngularFormValue(i,{value:s})}));o.addEventListener("resetform",(e=>{const i=t.defaultFieldValue;e.target.checked=null!=i&&i===t.buttonValue}));window.registerAcroformField(i,o,r?t.buttonValue:void 0,t.buttonValue,this.data.fieldValue);o.addEventListener("updateFromAngular",(t=>e.setValue(i,{value:t.detail})));if(this.enableScripting&&this.hasJSActions){const a=t.buttonValue;o.addEventListener("updatefromsandbox",(t=>{const s={value:t=>{const s=a===t.detail.value;for(const a of this._getElementsByName(t.target.name)){const t=s&&a.id===i;a.domElement&&(a.domElement.checked=t);e.setValue(a.id,{value:t});window.updateAngularFormValue(i,{value:t})}}};this._dispatchEventFromSandbox(s,t)}));this._setEventListeners(o,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))}this._setBackgroundColor(o);this._setDefaultPropertiesFromJS(o);this.container.append(o);return this.container}}class PushButtonWidgetAnnotationElement extends LinkAnnotationElement{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const t=e.lastChild;if(this.enableScripting&&this.hasJSActions&&t){this._setDefaultPropertiesFromJS(t);t.addEventListener("updatefromsandbox",(e=>{this._dispatchEventFromSandbox({},e)}))}return e}}class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,i=window.getFormValueFromAngular(this.data.fieldName),a=e.getValue(t,{value:this.data.fieldValue}),s=i.value?i:a;i!==a&&e.setValue(t,{value:i.value});const n=document.createElement("select");cn.add(n);n.setAttribute("data-element-id",t);n.disabled=this.data.readOnly;this._setRequired(n,this.data.required);n.name=this.data.fieldName;n.tabIndex=0;let r=this.data.combo&&this.data.options.length>0;if(!this.data.combo){n.size=this.data.options.length;this.data.multiSelect&&(n.multiple=!0)}n.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue;for(const e of n.options)e.selected=e.value===t}));for(const e of this.data.options){const t=document.createElement("option");t.textContent=e.displayValue;t.value=e.exportValue;if(s.value.includes(e.exportValue)){t.setAttribute("selected",!0);r=!1}n.append(t)}let o=null;if(r){const e=document.createElement("option");e.value=" ";e.setAttribute("hidden",!0);e.setAttribute("selected",!0);n.prepend(e);o=()=>{e.remove();n.removeEventListener("input",o);o=null};n.addEventListener("input",o)}const getValue=e=>{const t=e?"value":"textContent",{options:i,multiple:a}=n;return a?Array.prototype.filter.call(i,(e=>e.selected)).map((e=>e[t])):-1===i.selectedIndex?null:i[i.selectedIndex][t]};let l=getValue(!1);const getItems=e=>{const t=e.target.options;return Array.prototype.map.call(t,(e=>({displayValue:e.textContent,exportValue:e.value})))};window.registerAcroformField(t,n,l,void 0,this.data.fieldValue);n.addEventListener("updateFromAngular",(i=>e.setValue(t,{value:i.detail})));if(this.enableScripting&&this.hasJSActions){n.addEventListener("updatefromsandbox",(i=>{const a={value(i){o?.();const a=i.detail.value,s=new Set(Array.isArray(a)?a:[a]);for(const e of n.options)e.selected=s.has(e.value);e.setValue(t,{value:getValue(!0)});l=getValue(!1);window.updateAngularFormValue(t,{value:l})},multipleSelection(e){n.multiple=!0},remove(i){const a=n.options,s=i.detail.remove;a[s].selected=!1;n.remove(s);if(a.length>0){-1===Array.prototype.findIndex.call(a,(e=>e.selected))&&(a[0].selected=!0)}e.setValue(t,{value:getValue(!0),items:getItems(i)});l=getValue(!1)},clear(i){for(;0!==n.length;)n.remove(0);e.setValue(t,{value:null,items:[]});l=getValue(!1);window.updateAngularFormValue(t,{value:l})},insert(i){const{index:a,displayValue:s,exportValue:r}=i.detail.insert,o=n.children[a],d=document.createElement("option");d.textContent=s;d.value=r;o?o.before(d):n.append(d);e.setValue(t,{value:getValue(!0),items:getItems(i)});l=getValue(!1);window.updateAngularFormValue(t,{value:l})},items(i){const{items:a}=i.detail;for(;0!==n.length;)n.remove(0);for(const e of a){const{displayValue:t,exportValue:i}=e,a=document.createElement("option");a.textContent=t;a.value=i;n.append(a)}n.options.length>0&&(n.options[0].selected=!0);e.setValue(t,{value:getValue(!0),items:getItems(i)});l=getValue(!1);window.updateAngularFormValue(t,{value:l})},indices(i){const a=new Set(i.detail.indices);for(const e of i.target.options)e.selected=a.has(e.index);e.setValue(t,{value:getValue(!0)});l=getValue(!1);window.updateAngularFormValue(t,{value:l})},editable(e){e.target.disabled=!e.detail.editable}};this._dispatchEventFromSandbox(a,i)}));n.addEventListener("input",(i=>{const a=getValue(!0),s=getValue(!1);e.setValue(t,{value:a});window.updateAngularFormValue(t,{value:a});i.preventDefault();this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:l,change:s,changeEx:a,willCommit:!1,commitKey:1,keyDown:!1}})}));this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(e=>e.target.value))}else n.addEventListener("input",(function(i){e.setValue(t,{value:getValue(!0)});window.updateAngularFormValue(t,{value:getValue(!0)})}));this.data.combo&&this._setTextStyle(n);this._setBackgroundColor(n);this._setDefaultPropertiesFromJS(n);this.container.append(n);return this.container}}class PopupAnnotationElement extends AnnotationElement{constructor(e){const{data:t,elements:i}=e;super(e,{isRenderable:AnnotationElement._hasPopupData(t)});this.elements=i;this.popup=null}render(){const{container:e}=this;e.classList.add("popupAnnotation");e.role="comment";const t=this.popup=new PopupElement({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}),i=[];for(const e of this.elements){e.popup=t;e.container.ariaHasPopup="dialog";i.push(e.data.id);e.addHighlightArea()}this.container.setAttribute("aria-controls",i.map((e=>`${U}${e}`)).join(","));return this.container}}var vn=new WeakMap,mn=new WeakMap,wn=new WeakMap,Pn=new WeakMap,yn=new WeakMap,Fn=new WeakMap,bn=new WeakMap,Sn=new WeakMap,xn=new WeakMap,Cn=new WeakMap,An=new WeakMap,En=new WeakMap,kn=new WeakMap,In=new WeakMap,Mn=new WeakMap,Bn=new WeakMap,Gn=new WeakMap,Tn=new WeakMap,Dn=new WeakMap,Ln=new WeakMap,Rn=new WeakSet;class PopupElement{constructor(e){let{container:t,color:i,elements:a,titleObj:s,modificationDate:n,contentsObj:r,richText:o,parent:l,rect:d,parentRect:c,open:h}=e;annotation_layer_classPrivateMethodInitSpec(this,Rn);annotation_layer_classPrivateFieldInitSpec(this,vn,annotation_layer_assertClassBrand(Rn,this,annotation_layer_keyDown).bind(this));annotation_layer_classPrivateFieldInitSpec(this,mn,annotation_layer_assertClassBrand(Rn,this,_hide).bind(this));annotation_layer_classPrivateFieldInitSpec(this,wn,annotation_layer_assertClassBrand(Rn,this,_show).bind(this));annotation_layer_classPrivateFieldInitSpec(this,Pn,annotation_layer_assertClassBrand(Rn,this,_toggle).bind(this));annotation_layer_classPrivateFieldInitSpec(this,yn,null);annotation_layer_classPrivateFieldInitSpec(this,Fn,null);annotation_layer_classPrivateFieldInitSpec(this,bn,null);annotation_layer_classPrivateFieldInitSpec(this,Sn,null);annotation_layer_classPrivateFieldInitSpec(this,xn,null);annotation_layer_classPrivateFieldInitSpec(this,Cn,null);annotation_layer_classPrivateFieldInitSpec(this,An,null);annotation_layer_classPrivateFieldInitSpec(this,En,!1);annotation_layer_classPrivateFieldInitSpec(this,kn,null);annotation_layer_classPrivateFieldInitSpec(this,In,null);annotation_layer_classPrivateFieldInitSpec(this,Mn,null);annotation_layer_classPrivateFieldInitSpec(this,Bn,null);annotation_layer_classPrivateFieldInitSpec(this,Gn,null);annotation_layer_classPrivateFieldInitSpec(this,Tn,null);annotation_layer_classPrivateFieldInitSpec(this,Dn,null);annotation_layer_classPrivateFieldInitSpec(this,Ln,!1);annotation_layer_classPrivateFieldSet(Fn,this,t);annotation_layer_classPrivateFieldSet(Tn,this,s);annotation_layer_classPrivateFieldSet(bn,this,r);annotation_layer_classPrivateFieldSet(Gn,this,o);annotation_layer_classPrivateFieldSet(Cn,this,l);annotation_layer_classPrivateFieldSet(yn,this,i);annotation_layer_classPrivateFieldSet(Bn,this,d);annotation_layer_classPrivateFieldSet(An,this,c);annotation_layer_classPrivateFieldSet(xn,this,a);annotation_layer_classPrivateFieldSet(Sn,this,PDFDateString.toDateObject(n));this.trigger=a.flatMap((e=>e.getElementsToTriggerPopup()));annotation_layer_assertClassBrand(Rn,this,_addEventListeners).call(this);annotation_layer_classPrivateFieldGet(Fn,this).hidden=!0;h&&annotation_layer_assertClassBrand(Rn,this,_toggle).call(this)}render(){if(annotation_layer_classPrivateFieldGet(kn,this))return;const e=annotation_layer_classPrivateFieldSet(kn,this,document.createElement("div"));e.className="popup";if(annotation_layer_classPrivateFieldGet(yn,this)){const t=e.style.outlineColor=Util.makeHexColor(...annotation_layer_classPrivateFieldGet(yn,this));e.style.backgroundColor=`color-mix(in srgb, ${t} 30%, white)`}const t=document.createElement("span");t.className="header";if(annotation_layer_classPrivateFieldGet(Tn,this)?.str){const e=document.createElement("span");e.className="title";t.append(e);({dir:e.dir,str:e.textContent}=annotation_layer_classPrivateFieldGet(Tn,this))}e.append(t);if(annotation_layer_classPrivateFieldGet(Sn,this)){const e=document.createElement("time");e.className="popupDate";e.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string");e.setAttribute("data-l10n-args",JSON.stringify({dateObj:annotation_layer_classPrivateFieldGet(Sn,this).valueOf()}));e.dateTime=annotation_layer_classPrivateFieldGet(Sn,this).toISOString();t.append(e)}const i=annotation_layer_classPrivateGetter(Rn,this,_get_html);if(i){XfaLayer.render({xfaHtml:i,intent:"richText",div:e});e.lastChild.classList.add("richText","popupContent")}else{const t=this._formatContents(annotation_layer_classPrivateFieldGet(bn,this));e.append(t)}annotation_layer_classPrivateFieldGet(Fn,this).append(e)}_formatContents(e){let{str:t,dir:i}=e;const a=document.createElement("p");a.classList.add("popupContent");a.dir=i;const s=t.split(/(?:\r\n?|\n)/);for(let e=0,t=s.length;e<t;++e){const i=s[e];a.append(document.createTextNode(i));e<t-1&&a.append(document.createElement("br"))}return a}updateEdited(e){let{rect:t,popup:i,deleted:a}=e;if(a||i?.deleted)this.remove();else{annotation_layer_assertClassBrand(Rn,this,_addEventListeners).call(this);annotation_layer_classPrivateFieldGet(Dn,this)||annotation_layer_classPrivateFieldSet(Dn,this,{contentsObj:annotation_layer_classPrivateFieldGet(bn,this),richText:annotation_layer_classPrivateFieldGet(Gn,this)});t&&annotation_layer_classPrivateFieldSet(Mn,this,null);if(i){annotation_layer_classPrivateFieldSet(Gn,this,annotation_layer_assertClassBrand(Rn,this,_makePopupContent).call(this,i.text));annotation_layer_classPrivateFieldSet(Sn,this,PDFDateString.toDateObject(i.date));annotation_layer_classPrivateFieldSet(bn,this,null)}annotation_layer_classPrivateFieldGet(kn,this)?.remove();annotation_layer_classPrivateFieldSet(kn,this,null)}}resetEdited(){if(annotation_layer_classPrivateFieldGet(Dn,this)){({contentsObj:_toSetter(annotation_layer_classPrivateFieldSet,[bn,this])._,richText:_toSetter(annotation_layer_classPrivateFieldSet,[Gn,this])._}=annotation_layer_classPrivateFieldGet(Dn,this));annotation_layer_classPrivateFieldSet(Dn,this,null);annotation_layer_classPrivateFieldGet(kn,this)?.remove();annotation_layer_classPrivateFieldSet(kn,this,null);annotation_layer_classPrivateFieldSet(Mn,this,null)}}remove(){annotation_layer_classPrivateFieldGet(In,this)?.abort();annotation_layer_classPrivateFieldSet(In,this,null);annotation_layer_classPrivateFieldGet(kn,this)?.remove();annotation_layer_classPrivateFieldSet(kn,this,null);annotation_layer_classPrivateFieldSet(Ln,this,!1);annotation_layer_classPrivateFieldSet(En,this,!1);for(const e of this.trigger)e.classList.remove("popupTriggerArea")}forceHide(){annotation_layer_classPrivateFieldSet(Ln,this,this.isVisible);annotation_layer_classPrivateFieldGet(Ln,this)&&(annotation_layer_classPrivateFieldGet(Fn,this).hidden=!0)}maybeShow(){annotation_layer_assertClassBrand(Rn,this,_addEventListeners).call(this);if(annotation_layer_classPrivateFieldGet(Ln,this)){annotation_layer_classPrivateFieldGet(kn,this)||annotation_layer_assertClassBrand(Rn,this,_show).call(this);annotation_layer_classPrivateFieldSet(Ln,this,!1);annotation_layer_classPrivateFieldGet(Fn,this).hidden=!1}}get isVisible(){return!1===annotation_layer_classPrivateFieldGet(Fn,this).hidden}}function _addEventListeners(){if(annotation_layer_classPrivateFieldGet(In,this))return;annotation_layer_classPrivateFieldSet(In,this,new AbortController);const{signal:e}=annotation_layer_classPrivateFieldGet(In,this);for(const t of this.trigger){t.addEventListener("click",annotation_layer_classPrivateFieldGet(Pn,this),{signal:e});t.addEventListener("mouseenter",annotation_layer_classPrivateFieldGet(wn,this),{signal:e});t.addEventListener("mouseleave",annotation_layer_classPrivateFieldGet(mn,this),{signal:e});t.classList.add("popupTriggerArea")}for(const t of annotation_layer_classPrivateFieldGet(xn,this))t.container?.addEventListener("keydown",annotation_layer_classPrivateFieldGet(vn,this),{signal:e})}function _get_html(e){const t=annotation_layer_classPrivateFieldGet(Gn,e),i=annotation_layer_classPrivateFieldGet(bn,e);return!t?.str||i?.str&&i.str!==t.str?null:annotation_layer_classPrivateFieldGet(Gn,e).html||null}function _get_fontSize(e){return annotation_layer_classPrivateGetter(Rn,e,_get_html)?.attributes?.style?.fontSize||0}function _get_fontColor(e){return annotation_layer_classPrivateGetter(Rn,e,_get_html)?.attributes?.style?.color||null}function _makePopupContent(e){const t=[],i={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},a={style:{color:annotation_layer_classPrivateGetter(Rn,this,_get_fontColor),fontSize:annotation_layer_classPrivateGetter(Rn,this,_get_fontSize)?`calc(${annotation_layer_classPrivateGetter(Rn,this,_get_fontSize)}px * var(--total-scale-factor))`:""}};for(const i of e.split("\n"))t.push({name:"span",value:i,attributes:a});return i}function annotation_layer_keyDown(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||("Enter"===e.key||"Escape"===e.key&&annotation_layer_classPrivateFieldGet(En,this))&&annotation_layer_assertClassBrand(Rn,this,_toggle).call(this)}function _setPosition(){if(null!==annotation_layer_classPrivateFieldGet(Mn,this))return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:i,pageX:a,pageY:s}}}=annotation_layer_classPrivateFieldGet(Cn,this);let n=!!annotation_layer_classPrivateFieldGet(An,this),r=annotation_layer_classPrivateFieldGet(n?An:Bn,this);for(const e of annotation_layer_classPrivateFieldGet(xn,this))if(!r||null!==Util.intersect(e.data.rect,r)){r=e.data.rect;n=!0;break}const o=Util.normalizeRect([r[0],e[3]-r[1]+e[1],r[2],e[3]-r[3]+e[1]]),l=n?r[2]-r[0]+5:0,d=o[0]+l,c=o[1];annotation_layer_classPrivateFieldSet(Mn,this,[100*(d-a)/t,100*(c-s)/i]);const{style:h}=annotation_layer_classPrivateFieldGet(Fn,this);h.left=`${annotation_layer_classPrivateFieldGet(Mn,this)[0]}%`;h.top=`${annotation_layer_classPrivateFieldGet(Mn,this)[1]}%`}function _toggle(){annotation_layer_classPrivateFieldSet(En,this,!annotation_layer_classPrivateFieldGet(En,this));if(annotation_layer_classPrivateFieldGet(En,this)){annotation_layer_assertClassBrand(Rn,this,_show).call(this);annotation_layer_classPrivateFieldGet(Fn,this).addEventListener("click",annotation_layer_classPrivateFieldGet(Pn,this));annotation_layer_classPrivateFieldGet(Fn,this).addEventListener("keydown",annotation_layer_classPrivateFieldGet(vn,this))}else{annotation_layer_assertClassBrand(Rn,this,_hide).call(this);annotation_layer_classPrivateFieldGet(Fn,this).removeEventListener("click",annotation_layer_classPrivateFieldGet(Pn,this));annotation_layer_classPrivateFieldGet(Fn,this).removeEventListener("keydown",annotation_layer_classPrivateFieldGet(vn,this))}}function _show(){annotation_layer_classPrivateFieldGet(kn,this)||this.render();if(this.isVisible)annotation_layer_classPrivateFieldGet(En,this)&&annotation_layer_classPrivateFieldGet(Fn,this).classList.add("focused");else{annotation_layer_assertClassBrand(Rn,this,_setPosition).call(this);annotation_layer_classPrivateFieldGet(Fn,this).hidden=!1;annotation_layer_classPrivateFieldGet(Fn,this).style.zIndex=parseInt(annotation_layer_classPrivateFieldGet(Fn,this).style.zIndex)+1e3;const e=annotation_layer_classPrivateFieldGet(Fn,this).closest(".page");e&&(e.style.overflow="visible")}}function _hide(){annotation_layer_classPrivateFieldGet(Fn,this).classList.remove("focused");if(annotation_layer_classPrivateFieldGet(En,this)||!this.isVisible)return;annotation_layer_classPrivateFieldGet(Fn,this).hidden=!0;annotation_layer_classPrivateFieldGet(Fn,this).style.zIndex=parseInt(annotation_layer_classPrivateFieldGet(Fn,this).style.zIndex)-1e3;const e=annotation_layer_classPrivateFieldGet(Fn,this).closest(".page");e&&(e.style.overflow="")}class FreeTextAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});this.textContent=e.data.textContent;this.textPosition=e.data.textPosition;this.annotationEditorType=f.FREETEXT}render(){this.container.classList.add("freeTextAnnotation");if(this.textContent){const e=document.createElement("div");e.classList.add("annotationTextContent");e.setAttribute("role","comment");for(const t of this.textContent){const i=document.createElement("span");i.textContent=t;e.append(i)}this.container.append(e)}!this.data.popupRef&&this.hasPopupData&&this._createPopup();this._editOnDoubleClick();return this.container}}var Nn=new WeakMap;class LineAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});annotation_layer_classPrivateFieldInitSpec(this,Nn,null)}render(){this.container.classList.add("lineAnnotation");const{data:e,width:t,height:i}=this,a=this.svgFactory.create(t,i,!0),s=annotation_layer_classPrivateFieldSet(Nn,this,this.svgFactory.createElement("svg:line"));s.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]);s.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]);s.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]);s.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]);s.setAttribute("stroke-width",e.borderStyle.width||1);s.setAttribute("stroke","transparent");s.setAttribute("fill","transparent");a.append(s);this.container.append(a);!e.popupRef&&this.hasPopupData&&this._createPopup();return this.container}getElementsToTriggerPopup(){return annotation_layer_classPrivateFieldGet(Nn,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var On=new WeakMap;class SquareAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});annotation_layer_classPrivateFieldInitSpec(this,On,null)}render(){this.container.classList.add("squareAnnotation");const{data:e,width:t,height:i}=this,a=this.svgFactory.create(t,i,!0),s=e.borderStyle.width,n=annotation_layer_classPrivateFieldSet(On,this,this.svgFactory.createElement("svg:rect"));n.setAttribute("x",s/2);n.setAttribute("y",s/2);n.setAttribute("width",t-s);n.setAttribute("height",i-s);n.setAttribute("stroke-width",s||1);n.setAttribute("stroke","transparent");n.setAttribute("fill","transparent");a.append(n);this.container.append(a);!e.popupRef&&this.hasPopupData&&this._createPopup();return this.container}getElementsToTriggerPopup(){return annotation_layer_classPrivateFieldGet(On,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Wn=new WeakMap;class CircleAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});annotation_layer_classPrivateFieldInitSpec(this,Wn,null)}render(){this.container.classList.add("circleAnnotation");const{data:e,width:t,height:i}=this,a=this.svgFactory.create(t,i,!0),s=e.borderStyle.width,n=annotation_layer_classPrivateFieldSet(Wn,this,this.svgFactory.createElement("svg:ellipse"));n.setAttribute("cx",t/2);n.setAttribute("cy",i/2);n.setAttribute("rx",t/2-s/2);n.setAttribute("ry",i/2-s/2);n.setAttribute("stroke-width",s||1);n.setAttribute("stroke","transparent");n.setAttribute("fill","transparent");a.append(n);this.container.append(a);!e.popupRef&&this.hasPopupData&&this._createPopup();return this.container}getElementsToTriggerPopup(){return annotation_layer_classPrivateFieldGet(Wn,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var jn=new WeakMap;class PolylineAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});annotation_layer_classPrivateFieldInitSpec(this,jn,null);this.containerClassName="polylineAnnotation";this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:t,borderStyle:i,popupRef:a},width:s,height:n}=this;if(!t)return this.container;const r=this.svgFactory.create(s,n,!0);let o=[];for(let i=0,a=t.length;i<a;i+=2){const a=t[i]-e[0],s=e[3]-t[i+1];o.push(`${a},${s}`)}o=o.join(" ");const l=annotation_layer_classPrivateFieldSet(jn,this,this.svgFactory.createElement(this.svgElementName));l.setAttribute("points",o);l.setAttribute("stroke-width",i.width||1);l.setAttribute("stroke","transparent");l.setAttribute("fill","transparent");r.append(l);this.container.append(r);!a&&this.hasPopupData&&this._createPopup();return this.container}getElementsToTriggerPopup(){return annotation_layer_classPrivateFieldGet(jn,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}class PolygonAnnotationElement extends PolylineAnnotationElement{constructor(e){super(e);this.containerClassName="polygonAnnotation";this.svgElementName="svg:polygon"}}class CaretAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("caretAnnotation");!this.data.popupRef&&this.hasPopupData&&this._createPopup();return this.container}}var Vn=new WeakMap,Hn=new WeakMap,zn=new WeakSet;class InkAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});annotation_layer_classPrivateMethodInitSpec(this,zn);annotation_layer_classPrivateFieldInitSpec(this,Vn,null);annotation_layer_classPrivateFieldInitSpec(this,Hn,[]);this.containerClassName="inkAnnotation";this.svgElementName="svg:polyline";this.annotationEditorType="InkHighlight"===this.data.it?f.HIGHLIGHT:f.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,rotation:t,inkLists:i,borderStyle:a,popupRef:s}}=this,{transform:n,width:r,height:o}=annotation_layer_assertClassBrand(zn,this,_getTransform).call(this,t,e),l=this.svgFactory.create(r,o,!0),d=annotation_layer_classPrivateFieldSet(Vn,this,this.svgFactory.createElement("svg:g"));l.append(d);d.setAttribute("stroke-width",a.width||1);d.setAttribute("stroke-linecap","round");d.setAttribute("stroke-linejoin","round");d.setAttribute("stroke-miterlimit",10);d.setAttribute("stroke","transparent");d.setAttribute("fill","transparent");d.setAttribute("transform",n);for(let e=0,t=i.length;e<t;e++){const t=this.svgFactory.createElement(this.svgElementName);annotation_layer_classPrivateFieldGet(Hn,this).push(t);t.setAttribute("points",i[e].join(","));d.append(t)}!s&&this.hasPopupData&&this._createPopup();this.container.append(l);this._editOnDoubleClick();return this.container}updateEdited(e){super.updateEdited(e);const{thickness:t,points:i,rect:a}=e,s=annotation_layer_classPrivateFieldGet(Vn,this);t>=0&&s.setAttribute("stroke-width",t||1);if(i)for(let e=0,t=annotation_layer_classPrivateFieldGet(Hn,this).length;e<t;e++)annotation_layer_classPrivateFieldGet(Hn,this)[e].setAttribute("points",i[e].join(","));if(a){const{transform:e,width:t,height:i}=annotation_layer_assertClassBrand(zn,this,_getTransform).call(this,this.data.rotation,a);s.parentElement.setAttribute("viewBox",`0 0 ${t} ${i}`);s.setAttribute("transform",e)}}getElementsToTriggerPopup(){return annotation_layer_classPrivateFieldGet(Hn,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}function _getTransform(e,t){switch(e){case 90:return{transform:`rotate(90) translate(${-t[0]},${t[1]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};case 180:return{transform:`rotate(180) translate(${-t[2]},${t[1]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]};case 270:return{transform:`rotate(270) translate(${-t[2]},${t[3]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};default:return{transform:`translate(${-t[0]},${t[3]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]}}}class HighlightAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0});this.annotationEditorType=f.HIGHLIGHT}render(){const{data:{overlaidText:e,popupRef:t}}=this;!t&&this.hasPopupData&&this._createPopup();this.container.classList.add("highlightAnnotation");this._editOnDoubleClick();if(e){const t=document.createElement("mark");t.classList.add("overlaidText");t.textContent=e;this.container.append(t)}return this.container}}class UnderlineAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;!t&&this.hasPopupData&&this._createPopup();this.container.classList.add("underlineAnnotation");if(e){const t=document.createElement("u");t.classList.add("overlaidText");t.textContent=e;this.container.append(t)}return this.container}}class SquigglyAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;!t&&this.hasPopupData&&this._createPopup();this.container.classList.add("squigglyAnnotation");if(e){const t=document.createElement("u");t.classList.add("overlaidText");t.textContent=e;this.container.append(t)}return this.container}}class StrikeOutAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;!t&&this.hasPopupData&&this._createPopup();this.container.classList.add("strikeoutAnnotation");if(e){const t=document.createElement("s");t.classList.add("overlaidText");t.textContent=e;this.container.append(t)}return this.container}}class StampAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});this.annotationEditorType=f.STAMP}render(){this.container.classList.add("stampAnnotation");this.container.setAttribute("role","img");!this.data.popupRef&&this.hasPopupData&&this._createPopup();this._editOnDoubleClick();return this.container}}var Un=new WeakMap,$n=new WeakSet;class FileAttachmentAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0});annotation_layer_classPrivateMethodInitSpec(this,$n);annotation_layer_classPrivateFieldInitSpec(this,Un,null);const{file:t}=this.data;this.filename=t.filename;this.content=t.content;this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...t})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:t}=this;let i;if(t.hasAppearance||0===t.fillAlpha)i=document.createElement("div");else{i=document.createElement("img");i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?"paperclip":"pushpin"}.svg`;t.fillAlpha&&t.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(100*t.fillAlpha)}%);`)}i.addEventListener("dblclick",annotation_layer_assertClassBrand($n,this,_download).bind(this));annotation_layer_classPrivateFieldSet(Un,this,i);const{isMac:a}=util_FeatureTest.platform;e.addEventListener("keydown",(e=>{"Enter"===e.key&&(a?e.metaKey:e.ctrlKey)&&annotation_layer_assertClassBrand($n,this,_download).call(this)}));!t.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea");e.append(i);return e}getElementsToTriggerPopup(){return annotation_layer_classPrivateFieldGet(Un,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}function _download(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}var qn,Xn=new WeakMap,Kn=new WeakMap,Yn=new WeakMap,Zn=new WeakMap,Qn=new WeakSet;class AnnotationLayer{constructor(e){let{div:t,accessibilityManager:i,annotationCanvasMap:a,annotationEditorUIManager:s,page:n,viewport:r,structTreeLayer:o}=e;annotation_layer_classPrivateMethodInitSpec(this,Qn);annotation_layer_classPrivateFieldInitSpec(this,Xn,null);annotation_layer_classPrivateFieldInitSpec(this,Kn,null);annotation_layer_classPrivateFieldInitSpec(this,Yn,new Map);annotation_layer_classPrivateFieldInitSpec(this,Zn,null);this.div=t;annotation_layer_classPrivateFieldSet(Xn,this,i);annotation_layer_classPrivateFieldSet(Kn,this,a);annotation_layer_classPrivateFieldSet(Zn,this,o||null);this.page=n;this.viewport=r;this.zIndex=0;this._annotationEditorUIManager=s}hasEditableAnnotations(){return annotation_layer_classPrivateFieldGet(Yn,this).size>0}async render(e){const{annotations:t}=e,i=this.div;setLayerDimensions(i,this.viewport);const a=new Map,s={data:null,layer:i,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:!1!==e.renderForms,svgFactory:new DOMSVGFactory,annotationStorage:e.annotationStorage||new AnnotationStorage,enableScripting:!0===e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const e of t){if(e.noHTML)continue;const t=e.annotationType===A.POPUP;if(t){const t=a.get(e.id);if(!t)continue;s.elements=t}else if(e.rect[2]===e.rect[0]||e.rect[3]===e.rect[1])continue;s.data=e;const i=AnnotationElementFactory.create(s);if(!i.isRenderable)continue;if(!t&&e.popupRef){const t=a.get(e.popupRef);t?t.push(i):a.set(e.popupRef,[i])}const n=i.render();e.hidden&&(n.style.visibility="hidden");await annotation_layer_assertClassBrand(Qn,this,_appendElement).call(this,n,e.id,s.elements);if(i._isEditable){annotation_layer_classPrivateFieldGet(Yn,this).set(i.data.id,i);this._annotationEditorUIManager?.renderAnnotationElement(i)}}annotation_layer_assertClassBrand(Qn,this,_setAnnotationCanvasMap).call(this)}async addLinkAnnotations(e,t){const i={data:null,layer:this.div,linkService:t,svgFactory:new DOMSVGFactory,parent:this};for(const t of e){t.borderStyle||=AnnotationLayer._defaultBorderStyle;i.data=t;const e=AnnotationElementFactory.create(i);if(!e.isRenderable)continue;const a=e.render();await annotation_layer_assertClassBrand(Qn,this,_appendElement).call(this,a,t.id,null)}}update(e){let{viewport:t}=e;const i=this.div;this.viewport=t;setLayerDimensions(i,{rotation:t.rotation});annotation_layer_assertClassBrand(Qn,this,_setAnnotationCanvasMap).call(this);i.hidden=!1}getEditableAnnotations(){return Array.from(annotation_layer_classPrivateFieldGet(Yn,this).values())}getEditableAnnotation(e){return annotation_layer_classPrivateFieldGet(Yn,this).get(e)}static get _defaultBorderStyle(){return shadow(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:E,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}}async function _appendElement(e,t,i){const a=e.firstChild||e,s=a.id=`${U}${t}`,n=await(annotation_layer_classPrivateFieldGet(Zn,this)?.getAriaAttributes(s));if(n)for(const[e,t]of n)a.setAttribute(e,t);if(i)i.at(-1).container.after(e);else{this.div.append(e);annotation_layer_classPrivateFieldGet(Xn,this)?.moveElementInDOM(this.div,e,a,!1)}}function _setAnnotationCanvasMap(){if(!annotation_layer_classPrivateFieldGet(Kn,this))return;const e=this.div;for(const[t,i]of annotation_layer_classPrivateFieldGet(Kn,this)){const a=e.querySelector(`[data-annotation-id="${t}"]`);if(!a)continue;i.className="annotationContent";const{firstChild:s}=a;s?"CANVAS"===s.nodeName?s.replaceWith(i):s.classList.contains("annotationContent")?s.after(i):s.before(i):a.append(i);const n=annotation_layer_classPrivateFieldGet(Yn,this).get(t);if(n)if(n._hasNoCanvas){this._annotationEditorUIManager?.setMissingCanvas(t,a.id,i);n._hasNoCanvas=!1}else n.canvas=i}annotation_layer_classPrivateFieldGet(Kn,this).clear()}function freetext_defineProperty(e,t,i){return(t=function freetext_toPropertyKey(e){var t=function freetext_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function freetext_classPrivateFieldInitSpec(e,t,i){freetext_checkPrivateRedeclaration(e,t),t.set(e,i)}function freetext_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function freetext_classPrivateFieldGet(e,t){return e.get(freetext_assertClassBrand(e,t))}function freetext_classPrivateFieldSet(e,t,i){return e.set(freetext_assertClassBrand(e,t),i),i}function freetext_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Jn=/\r\n?|\n/g;var er=new WeakMap,tr=new WeakMap,ir=new WeakMap,ar=new WeakMap,sr=new WeakMap,nr=new WeakSet;class FreeTextEditor extends AnnotationEditor{static get _keyboardManager(){const e=FreeTextEditor.prototype,arrowChecker=e=>e.isEmpty(),t=AnnotationEditorUIManager.TRANSLATE_SMALL,i=AnnotationEditorUIManager.TRANSLATE_BIG;return shadow(this,"_keyboardManager",new KeyboardManager([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-t,0],checker:arrowChecker}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-i,0],checker:arrowChecker}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[t,0],checker:arrowChecker}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[i,0],checker:arrowChecker}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-t],checker:arrowChecker}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:arrowChecker}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,t],checker:arrowChecker}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,i],checker:arrowChecker}]]))}constructor(e){super({...e,name:"freeTextEditor"});!function freetext_classPrivateMethodInitSpec(e,t){freetext_checkPrivateRedeclaration(e,t),t.add(e)}(this,nr);freetext_classPrivateFieldInitSpec(this,er,void 0);freetext_classPrivateFieldInitSpec(this,tr,"");freetext_classPrivateFieldInitSpec(this,ir,`${this.id}-editor`);freetext_classPrivateFieldInitSpec(this,ar,null);freetext_classPrivateFieldInitSpec(this,sr,void 0);freetext_defineProperty(this,"_colorPicker",null);freetext_classPrivateFieldSet(er,this,e.color||FreeTextEditor._defaultColor||AnnotationEditor._defaultLineColor);freetext_classPrivateFieldSet(sr,this,e.fontSize||FreeTextEditor._defaultFontSize);this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static initialize(e,t){AnnotationEditor.initialize(e,t);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,t){switch(e){case v.FREETEXT_SIZE:FreeTextEditor._defaultFontSize=t;break;case v.FREETEXT_COLOR:FreeTextEditor._defaultColor=t}}updateParams(e,t){switch(e){case v.FREETEXT_SIZE:freetext_assertClassBrand(nr,this,_updateFontSize).call(this,t);break;case v.FREETEXT_COLOR:freetext_assertClassBrand(nr,this,_updateColor).call(this,t)}}static get defaultPropertiesToUpdate(){return[[v.FREETEXT_SIZE,FreeTextEditor._defaultFontSize],[v.FREETEXT_COLOR,FreeTextEditor._defaultColor||AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[v.FREETEXT_SIZE,freetext_classPrivateFieldGet(sr,this)],[v.FREETEXT_COLOR,freetext_classPrivateFieldGet(er,this)]]}get toolbarButtons(){this._colorPicker||=new BasicColorPicker(this);return[["colorPicker",this._colorPicker]]}get colorType(){return v.FREETEXT_COLOR}get colorValue(){return freetext_classPrivateFieldGet(er,this)}_translateEmpty(e,t){this._uiManager.translateSelectedEditors(e,t,!0)}getInitialTranslation(){const e=this.parentScale;return[-FreeTextEditor._internalPadding*e,-(FreeTextEditor._internalPadding+freetext_classPrivateFieldGet(sr,this))*e]}rebuild(){if(this.parent){super.rebuild();null!==this.div&&(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");freetext_classPrivateFieldSet(ar,this,new AbortController);const e=this._uiManager.combinedSignal(freetext_classPrivateFieldGet(ar,this));this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e});this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e});this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e});this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e});this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e});return!0}disableEditMode(){if(!super.disableEditMode())return!1;this.overlayDiv.classList.add("enabled");this.editorDiv.contentEditable=!1;this.div.setAttribute("aria-activedescendant",freetext_classPrivateFieldGet(ir,this));this._isDraggable=!0;freetext_classPrivateFieldGet(ar,this)?.abort();freetext_classPrivateFieldSet(ar,this,null);this.div.focus({preventScroll:!0});this.isEditing=!1;this.parent.div.classList.add("freetextEditing");return!0}focusin(e){if(this._focusEventsAllowed){super.focusin(e);e.target!==this.editorDiv&&this.editorDiv.focus()}}onceAdded(e){if(!this.width){this.enableEditMode();e&&this.editorDiv.focus();this._initialOptions?.isCentered&&this.center();this._initialOptions=null}}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1;if(this.parent){this.parent.setEditingState(!0);this.parent.div.classList.add("freetextEditing")}super.remove()}commit(){if(!this.isInEditMode())return;super.commit();this.disableEditMode();const e=freetext_classPrivateFieldGet(tr,this),t=freetext_classPrivateFieldSet(tr,this,freetext_assertClassBrand(nr,this,_extractText).call(this).trimEnd());if(e===t)return;const setText=e=>{freetext_classPrivateFieldSet(tr,this,e);if(e){freetext_assertClassBrand(nr,this,_setContent).call(this);this._uiManager.rebuild(this);freetext_assertClassBrand(nr,this,_setEditorDimensions).call(this)}else this.remove()};this.addCommands({cmd:()=>{setText(t)},undo:()=>{setText(e)},mustExec:!1});freetext_assertClassBrand(nr,this,_setEditorDimensions).call(this);this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"commit",page:this.pageIndex+1,value:t,previousValue:e})}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode();this.editorDiv.focus()}keydown(e){if(e.target===this.div&&"Enter"===e.key){this.enterInEditMode();e.preventDefault()}}editorDivKeydown(e){FreeTextEditor._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment");this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox");this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,t;if(this._isCopy||this.annotationElementId){e=this.x;t=this.y}super.render();this.editorDiv=document.createElement("div");this.editorDiv.className="internal";this.editorDiv.setAttribute("id",freetext_classPrivateFieldGet(ir,this));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:i}=this.editorDiv;i.fontSize=`calc(${freetext_classPrivateFieldGet(sr,this)}px * var(--total-scale-factor))`;i.color=freetext_classPrivateFieldGet(er,this);this.div.append(this.editorDiv);this.overlayDiv=document.createElement("div");this.overlayDiv.classList.add("overlay","enabled");this.div.append(this.overlayDiv);if(this._isCopy||this.annotationElementId){const[i,a]=this.parentDimensions;if(this.annotationElementId){const{position:s}=this._initialData;let[n,r]=this.getInitialTranslation();[n,r]=this.pageTranslationToScreen(n,r);const[o,l]=this.pageDimensions,[d,c]=this.pageTranslation;let h,u;switch(this.rotation){case 0:h=e+(s[0]-d)/o;u=t+this.height-(s[1]-c)/l;break;case 90:h=e+(s[0]-d)/o;u=t-(s[1]-c)/l;[n,r]=[r,-n];break;case 180:h=e-this.width+(s[0]-d)/o;u=t-(s[1]-c)/l;[n,r]=[-n,-r];break;case 270:h=e+(s[0]-d-this.height*l)/o;u=t+(s[1]-c-this.width*o)/l;[n,r]=[-r,n]}this.setAt(h*i,u*a,n,r)}else this._moveAfterPaste(e,t);freetext_assertClassBrand(nr,this,_setContent).call(this);this._isDraggable=!0;this.editorDiv.contentEditable=!1}else{this._isDraggable=!1;this.editorDiv.contentEditable=!0}return this.div}editorDivPaste(e){const t=e.clipboardData||window.clipboardData,{types:i}=t;if(1===i.length&&"text/plain"===i[0])return;e.preventDefault();const a=_deserializeContent.call(FreeTextEditor,t.getData("text")||"").replaceAll(Jn,"\n");if(!a)return;const s=window.getSelection();if(!s.rangeCount)return;this.editorDiv.normalize();s.deleteFromDocument();const n=s.getRangeAt(0);if(!a.includes("\n")){n.insertNode(document.createTextNode(a));this.editorDiv.normalize();s.collapseToStart();return}const{startContainer:r,startOffset:o}=n,l=[],d=[];if(r.nodeType===Node.TEXT_NODE){const e=r.parentElement;d.push(r.nodeValue.slice(o).replaceAll(Jn,""));if(e!==this.editorDiv){let t=l;for(const i of this.editorDiv.childNodes)i!==e?t.push(_getNodeContent.call(FreeTextEditor,i)):t=d}l.push(r.nodeValue.slice(0,o).replaceAll(Jn,""))}else if(r===this.editorDiv){let e=l,t=0;for(const i of this.editorDiv.childNodes){t++===o&&(e=d);e.push(_getNodeContent.call(FreeTextEditor,i))}}freetext_classPrivateFieldSet(tr,this,`${l.join("\n")}${a}${d.join("\n")}`);freetext_assertClassBrand(nr,this,_setContent).call(this);const c=new Range;let h=Math.sumPrecise(l.map((e=>e.length)));for(const{firstChild:e}of this.editorDiv.childNodes)if(e.nodeType===Node.TEXT_NODE){const t=e.nodeValue.length;if(h<=t){c.setStart(e,h);c.setEnd(e,h);break}h-=t}s.removeAllRanges();s.addRange(c)}get contentDiv(){return this.editorDiv}static async deserialize(e,t,i){let a=null;if(e instanceof FreeTextAnnotationElement){const{data:{defaultAppearanceData:{fontSize:t,fontColor:i},rect:s,rotation:n,id:r,popupRef:o,contentsObj:l},textContent:d,textPosition:c,parent:{page:{pageNumber:h}}}=e;if(!d||0===d.length)return null;a=e={annotationType:f.FREETEXT,color:Array.from(i),fontSize:t,value:d.join("\n"),position:c,pageIndex:h-1,rect:s.slice(0),rotation:n,annotationElementId:r,id:r,deleted:!1,popupRef:o,comment:l?.str||null}}const s=await super.deserialize(e,t,i);freetext_classPrivateFieldSet(sr,s,e.fontSize);freetext_classPrivateFieldSet(er,s,Util.makeHexColor(...e.color));freetext_classPrivateFieldSet(tr,s,_deserializeContent.call(FreeTextEditor,e.value));s._initialData=a;e.comment&&s.setCommentData(e.comment);return s}serialize(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const t=FreeTextEditor._internalPadding*this.parentScale,i=this.getRect(t,t),a=AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:freetext_classPrivateFieldGet(er,this)),s={annotationType:f.FREETEXT,color:a,fontSize:freetext_classPrivateFieldGet(sr,this),value:freetext_assertClassBrand(nr,this,_serializeContent).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};this.addComment(s);if(e){s.isCopy=!0;return s}if(this.annotationElementId&&!freetext_assertClassBrand(nr,this,_hasElementChanged).call(this,s))return null;s.id=this.annotationElementId;return s}renderAnnotationElement(e){const t=super.renderAnnotationElement(e),{style:i}=t;i.fontSize=`calc(${freetext_classPrivateFieldGet(sr,this)}px * var(--total-scale-factor))`;i.color=freetext_classPrivateFieldGet(er,this);t.replaceChildren();for(const e of freetext_classPrivateFieldGet(tr,this).split("\n")){const i=document.createElement("div");i.append(e?document.createTextNode(e):document.createElement("br"));t.append(i)}const a=FreeTextEditor._internalPadding*this.parentScale,s={rect:this.getRect(a,a)};s.popup=this.hasEditedComment?this.comment:{text:freetext_classPrivateFieldGet(tr,this)};e.updateEdited(s);return t}resetAnnotationElement(e){super.resetAnnotationElement(e);e.resetEdited()}}qn=FreeTextEditor;function _updateFontSize(e){const setFontsize=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--total-scale-factor))`;this.translate(0,-(e-freetext_classPrivateFieldGet(sr,this))*this.parentScale);freetext_classPrivateFieldSet(sr,this,e);freetext_assertClassBrand(nr,this,_setEditorDimensions).call(this)},t=freetext_classPrivateFieldGet(sr,this);this.addCommands({cmd:setFontsize.bind(this,e),undo:setFontsize.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:v.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0});this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"fontSizeChanged",page:this.pageIndex+1,editorType:this.constructor.name,value:e,previousValue:freetext_classPrivateFieldGet(sr,this)})}function _updateColor(e){const setColor=e=>{freetext_classPrivateFieldSet(er,this,this.editorDiv.style.color=e);this._colorPicker?.update(e)},t=freetext_classPrivateFieldGet(er,this);this.addCommands({cmd:setColor.bind(this,e),undo:setColor.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:v.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0});this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"colorChanged",page:this.pageIndex+1,editorType:this.constructor.name,value:e,previousValue:freetext_classPrivateFieldGet(er,this)})}function _extractText(){const e=[];this.editorDiv.normalize();let t=null;for(const i of this.editorDiv.childNodes)if(t?.nodeType!==Node.TEXT_NODE||"BR"!==i.nodeName){e.push(_getNodeContent.call(qn,i));t=i}return e.join("\n")}function _setEditorDimensions(){const[e,t]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:e,div:t}=this,a=t.style.display,s=t.classList.contains("hidden");t.classList.remove("hidden");t.style.display="hidden";e.div.append(this.div);i=t.getBoundingClientRect();t.remove();t.style.display=a;t.classList.toggle("hidden",s)}if(this.rotation%180==this.parentRotation%180){this.width=i.width/e;this.height=i.height/t}else{this.width=i.height/e;this.height=i.width/t}this.fixAndSetPosition()}function _getNodeContent(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Jn,"")}function _setContent(){this.editorDiv.replaceChildren();if(freetext_classPrivateFieldGet(tr,this))for(const e of freetext_classPrivateFieldGet(tr,this).split("\n")){const t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br"));this.editorDiv.append(t)}}function _serializeContent(){return freetext_classPrivateFieldGet(tr,this).replaceAll(" "," ")}function _deserializeContent(e){return e.replaceAll(" "," ")}function _hasElementChanged(e){const{value:t,fontSize:i,color:a,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==t||e.fontSize!==i||e.color.some(((e,t)=>e!==a[t]))||e.pageIndex!==s}freetext_defineProperty(FreeTextEditor,"_freeTextDefaultContent","");freetext_defineProperty(FreeTextEditor,"_internalPadding",0);freetext_defineProperty(FreeTextEditor,"_defaultColor",null);freetext_defineProperty(FreeTextEditor,"_defaultFontSize",10);freetext_defineProperty(FreeTextEditor,"_type","freetext");freetext_defineProperty(FreeTextEditor,"_editorType",f.FREETEXT);class Outline{toSVGPath(){unreachable("Abstract method `toSVGPath` must be implemented.")}get box(){unreachable("Abstract getter `box` must be implemented.")}serialize(e,t){unreachable("Abstract method `serialize` must be implemented.")}static _rescale(e,t,i,a,s,n){n||=new Float32Array(e.length);for(let r=0,o=e.length;r<o;r+=2){n[r]=t+e[r]*a;n[r+1]=i+e[r+1]*s}return n}static _rescaleAndSwap(e,t,i,a,s,n){n||=new Float32Array(e.length);for(let r=0,o=e.length;r<o;r+=2){n[r]=t+e[r+1]*a;n[r+1]=i+e[r]*s}return n}static _translate(e,t,i,a){a||=new Float32Array(e.length);for(let s=0,n=e.length;s<n;s+=2){a[s]=t+e[s];a[s+1]=i+e[s+1]}return a}static svgRound(e){return Math.round(1e4*e)}static _normalizePoint(e,t,i,a,s){switch(s){case 90:return[1-t/i,e/a];case 180:return[1-e/i,1-t/a];case 270:return[t/i,1-e/a];default:return[e/i,t/a]}}static _normalizePagePoint(e,t,i){switch(i){case 90:return[1-t,e];case 180:return[1-e,1-t];case 270:return[t,1-e];default:return[e,t]}}static createBezierPoints(e,t,i,a,s,n){return[(e+5*i)/6,(t+5*a)/6,(5*i+s)/6,(5*a+n)/6,(i+s)/2,(a+n)/2]}}!function outline_defineProperty(e,t,i){return(t=function outline_toPropertyKey(e){var t=function outline_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}(Outline,"PRECISION",1e-4);function freedraw_classPrivateMethodInitSpec(e,t){freedraw_checkPrivateRedeclaration(e,t),t.add(e)}function freedraw_classPrivateFieldInitSpec(e,t,i){freedraw_checkPrivateRedeclaration(e,t),t.set(e,i)}function freedraw_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function freedraw_classPrivateFieldGet(e,t){return e.get(freedraw_assertClassBrand(e,t))}function freedraw_classPrivateFieldSet(e,t,i){return e.set(freedraw_assertClassBrand(e,t),i),i}function freedraw_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var rr=new WeakMap,or=new WeakMap,lr=new WeakMap,dr=new WeakMap,cr=new WeakMap,hr=new WeakMap,ur=new WeakMap,_r=new WeakMap,pr=new WeakMap,gr=new WeakMap,fr=new WeakMap,vr=new WeakMap,mr=new WeakMap,wr=new WeakSet;class FreeDrawOutliner{constructor(e,t,i,a,s){let{x:n,y:r}=e,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;freedraw_classPrivateMethodInitSpec(this,wr);freedraw_classPrivateFieldInitSpec(this,rr,void 0);freedraw_classPrivateFieldInitSpec(this,or,[]);freedraw_classPrivateFieldInitSpec(this,lr,void 0);freedraw_classPrivateFieldInitSpec(this,dr,void 0);freedraw_classPrivateFieldInitSpec(this,cr,[]);freedraw_classPrivateFieldInitSpec(this,hr,new Float32Array(18));freedraw_classPrivateFieldInitSpec(this,ur,void 0);freedraw_classPrivateFieldInitSpec(this,_r,void 0);freedraw_classPrivateFieldInitSpec(this,pr,void 0);freedraw_classPrivateFieldInitSpec(this,gr,void 0);freedraw_classPrivateFieldInitSpec(this,fr,void 0);freedraw_classPrivateFieldInitSpec(this,vr,void 0);freedraw_classPrivateFieldInitSpec(this,mr,[]);freedraw_classPrivateFieldSet(rr,this,t);freedraw_classPrivateFieldSet(vr,this,a*i);freedraw_classPrivateFieldSet(dr,this,s);freedraw_classPrivateFieldGet(hr,this).set([NaN,NaN,NaN,NaN,n,r],6);freedraw_classPrivateFieldSet(lr,this,o);freedraw_classPrivateFieldSet(gr,this,Pr._*i);freedraw_classPrivateFieldSet(pr,this,yr._*i);freedraw_classPrivateFieldSet(fr,this,i);freedraw_classPrivateFieldGet(mr,this).push(n,r)}isEmpty(){return isNaN(freedraw_classPrivateFieldGet(hr,this)[8])}add(e){let{x:t,y:i}=e;freedraw_classPrivateFieldSet(ur,this,t);freedraw_classPrivateFieldSet(_r,this,i);const[a,s,n,r]=freedraw_classPrivateFieldGet(rr,this);let[o,l,d,c]=freedraw_classPrivateFieldGet(hr,this).subarray(8,12);const h=t-d,u=i-c,_=Math.hypot(h,u);if(_<freedraw_classPrivateFieldGet(pr,this))return!1;const p=_-freedraw_classPrivateFieldGet(gr,this),g=p/_,f=g*h,v=g*u;let m=o,w=l;o=d;l=c;d+=f;c+=v;freedraw_classPrivateFieldGet(mr,this)?.push(t,i);const P=f/p,y=-v/p*freedraw_classPrivateFieldGet(vr,this),b=P*freedraw_classPrivateFieldGet(vr,this);freedraw_classPrivateFieldGet(hr,this).set(freedraw_classPrivateFieldGet(hr,this).subarray(2,8),0);freedraw_classPrivateFieldGet(hr,this).set([d+y,c+b],4);freedraw_classPrivateFieldGet(hr,this).set(freedraw_classPrivateFieldGet(hr,this).subarray(14,18),12);freedraw_classPrivateFieldGet(hr,this).set([d-y,c-b],16);if(isNaN(freedraw_classPrivateFieldGet(hr,this)[6])){if(0===freedraw_classPrivateFieldGet(cr,this).length){freedraw_classPrivateFieldGet(hr,this).set([o+y,l+b],2);freedraw_classPrivateFieldGet(cr,this).push(NaN,NaN,NaN,NaN,(o+y-a)/n,(l+b-s)/r);freedraw_classPrivateFieldGet(hr,this).set([o-y,l-b],14);freedraw_classPrivateFieldGet(or,this).push(NaN,NaN,NaN,NaN,(o-y-a)/n,(l-b-s)/r)}freedraw_classPrivateFieldGet(hr,this).set([m,w,o,l,d,c],6);return!this.isEmpty()}freedraw_classPrivateFieldGet(hr,this).set([m,w,o,l,d,c],6);if(Math.abs(Math.atan2(w-l,m-o)-Math.atan2(v,f))<Math.PI/2){[o,l,d,c]=freedraw_classPrivateFieldGet(hr,this).subarray(2,6);freedraw_classPrivateFieldGet(cr,this).push(NaN,NaN,NaN,NaN,((o+d)/2-a)/n,((l+c)/2-s)/r);[o,l,m,w]=freedraw_classPrivateFieldGet(hr,this).subarray(14,18);freedraw_classPrivateFieldGet(or,this).push(NaN,NaN,NaN,NaN,((m+o)/2-a)/n,((w+l)/2-s)/r);return!0}[m,w,o,l,d,c]=freedraw_classPrivateFieldGet(hr,this).subarray(0,6);freedraw_classPrivateFieldGet(cr,this).push(((m+5*o)/6-a)/n,((w+5*l)/6-s)/r,((5*o+d)/6-a)/n,((5*l+c)/6-s)/r,((o+d)/2-a)/n,((l+c)/2-s)/r);[d,c,o,l,m,w]=freedraw_classPrivateFieldGet(hr,this).subarray(12,18);freedraw_classPrivateFieldGet(or,this).push(((m+5*o)/6-a)/n,((w+5*l)/6-s)/r,((5*o+d)/6-a)/n,((5*l+c)/6-s)/r,((o+d)/2-a)/n,((l+c)/2-s)/r);return!0}toSVGPath(){if(this.isEmpty())return"";const e=freedraw_classPrivateFieldGet(cr,this),t=freedraw_classPrivateFieldGet(or,this);if(isNaN(freedraw_classPrivateFieldGet(hr,this)[6])&&!this.isEmpty())return freedraw_assertClassBrand(wr,this,_toSVGPathTwoPoints).call(this);const i=[];i.push(`M${e[4]} ${e[5]}`);for(let t=6;t<e.length;t+=6)isNaN(e[t])?i.push(`L${e[t+4]} ${e[t+5]}`):i.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);freedraw_assertClassBrand(wr,this,_toSVGPathEnd).call(this,i);for(let e=t.length-6;e>=6;e-=6)isNaN(t[e])?i.push(`L${t[e+4]} ${t[e+5]}`):i.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);freedraw_assertClassBrand(wr,this,_toSVGPathStart).call(this,i);return i.join(" ")}newFreeDrawOutline(e,t,i,a,s,n){return new FreeDrawOutline(e,t,i,a,s,n)}getOutlines(){const e=freedraw_classPrivateFieldGet(cr,this),t=freedraw_classPrivateFieldGet(or,this),i=freedraw_classPrivateFieldGet(hr,this),[a,s,n,r]=freedraw_classPrivateFieldGet(rr,this),o=new Float32Array((freedraw_classPrivateFieldGet(mr,this)?.length??0)+2);for(let e=0,t=o.length-2;e<t;e+=2){o[e]=(freedraw_classPrivateFieldGet(mr,this)[e]-a)/n;o[e+1]=(freedraw_classPrivateFieldGet(mr,this)[e+1]-s)/r}o[o.length-2]=(freedraw_classPrivateFieldGet(ur,this)-a)/n;o[o.length-1]=(freedraw_classPrivateFieldGet(_r,this)-s)/r;if(isNaN(i[6])&&!this.isEmpty())return freedraw_assertClassBrand(wr,this,_getOutlineTwoPoints).call(this,o);const l=new Float32Array(freedraw_classPrivateFieldGet(cr,this).length+24+freedraw_classPrivateFieldGet(or,this).length);let d=e.length;for(let t=0;t<d;t+=2)if(isNaN(e[t]))l[t]=l[t+1]=NaN;else{l[t]=e[t];l[t+1]=e[t+1]}d=freedraw_assertClassBrand(wr,this,_getOutlineEnd).call(this,l,d);for(let e=t.length-6;e>=6;e-=6)for(let i=0;i<6;i+=2)if(isNaN(t[e+i])){l[d]=l[d+1]=NaN;d+=2}else{l[d]=t[e+i];l[d+1]=t[e+i+1];d+=2}freedraw_assertClassBrand(wr,this,_getOutlineStart).call(this,l,d);return this.newFreeDrawOutline(l,o,freedraw_classPrivateFieldGet(rr,this),freedraw_classPrivateFieldGet(fr,this),freedraw_classPrivateFieldGet(lr,this),freedraw_classPrivateFieldGet(dr,this))}}function _getLastCoords(){const e=freedraw_classPrivateFieldGet(hr,this).subarray(4,6),t=freedraw_classPrivateFieldGet(hr,this).subarray(16,18),[i,a,s,n]=freedraw_classPrivateFieldGet(rr,this);return[(freedraw_classPrivateFieldGet(ur,this)+(e[0]-t[0])/2-i)/s,(freedraw_classPrivateFieldGet(_r,this)+(e[1]-t[1])/2-a)/n,(freedraw_classPrivateFieldGet(ur,this)+(t[0]-e[0])/2-i)/s,(freedraw_classPrivateFieldGet(_r,this)+(t[1]-e[1])/2-a)/n]}function _toSVGPathTwoPoints(){const[e,t,i,a]=freedraw_classPrivateFieldGet(rr,this),[s,n,r,o]=freedraw_assertClassBrand(wr,this,_getLastCoords).call(this);return`M${(freedraw_classPrivateFieldGet(hr,this)[2]-e)/i} ${(freedraw_classPrivateFieldGet(hr,this)[3]-t)/a} L${(freedraw_classPrivateFieldGet(hr,this)[4]-e)/i} ${(freedraw_classPrivateFieldGet(hr,this)[5]-t)/a} L${s} ${n} L${r} ${o} L${(freedraw_classPrivateFieldGet(hr,this)[16]-e)/i} ${(freedraw_classPrivateFieldGet(hr,this)[17]-t)/a} L${(freedraw_classPrivateFieldGet(hr,this)[14]-e)/i} ${(freedraw_classPrivateFieldGet(hr,this)[15]-t)/a} Z`}function _toSVGPathStart(e){const t=freedraw_classPrivateFieldGet(or,this);e.push(`L${t[4]} ${t[5]} Z`)}function _toSVGPathEnd(e){const[t,i,a,s]=freedraw_classPrivateFieldGet(rr,this),n=freedraw_classPrivateFieldGet(hr,this).subarray(4,6),r=freedraw_classPrivateFieldGet(hr,this).subarray(16,18),[o,l,d,c]=freedraw_assertClassBrand(wr,this,_getLastCoords).call(this);e.push(`L${(n[0]-t)/a} ${(n[1]-i)/s} L${o} ${l} L${d} ${c} L${(r[0]-t)/a} ${(r[1]-i)/s}`)}function _getOutlineTwoPoints(e){const t=freedraw_classPrivateFieldGet(hr,this),[i,a,s,n]=freedraw_classPrivateFieldGet(rr,this),[r,o,l,d]=freedraw_assertClassBrand(wr,this,_getLastCoords).call(this),c=new Float32Array(36);c.set([NaN,NaN,NaN,NaN,(t[2]-i)/s,(t[3]-a)/n,NaN,NaN,NaN,NaN,(t[4]-i)/s,(t[5]-a)/n,NaN,NaN,NaN,NaN,r,o,NaN,NaN,NaN,NaN,l,d,NaN,NaN,NaN,NaN,(t[16]-i)/s,(t[17]-a)/n,NaN,NaN,NaN,NaN,(t[14]-i)/s,(t[15]-a)/n],0);return this.newFreeDrawOutline(c,e,freedraw_classPrivateFieldGet(rr,this),freedraw_classPrivateFieldGet(fr,this),freedraw_classPrivateFieldGet(lr,this),freedraw_classPrivateFieldGet(dr,this))}function _getOutlineStart(e,t){const i=freedraw_classPrivateFieldGet(or,this);e.set([NaN,NaN,NaN,NaN,i[4],i[5]],t);return t+6}function _getOutlineEnd(e,t){const i=freedraw_classPrivateFieldGet(hr,this).subarray(4,6),a=freedraw_classPrivateFieldGet(hr,this).subarray(16,18),[s,n,r,o]=freedraw_classPrivateFieldGet(rr,this),[l,d,c,h]=freedraw_assertClassBrand(wr,this,_getLastCoords).call(this);e.set([NaN,NaN,NaN,NaN,(i[0]-s)/r,(i[1]-n)/o,NaN,NaN,NaN,NaN,l,d,NaN,NaN,NaN,NaN,c,h,NaN,NaN,NaN,NaN,(a[0]-s)/r,(a[1]-n)/o],t);return t+24}var Pr={_:8},yr={_:Pr._+2},Fr=new WeakMap,br=new WeakMap,Sr=new WeakMap,xr=new WeakMap,Cr=new WeakMap,Ar=new WeakMap,Er=new WeakMap,kr=new WeakSet;class FreeDrawOutline extends Outline{constructor(e,t,i,a,s,n){super();freedraw_classPrivateMethodInitSpec(this,kr);freedraw_classPrivateFieldInitSpec(this,Fr,void 0);freedraw_classPrivateFieldInitSpec(this,br,new Float32Array(4));freedraw_classPrivateFieldInitSpec(this,Sr,void 0);freedraw_classPrivateFieldInitSpec(this,xr,void 0);freedraw_classPrivateFieldInitSpec(this,Cr,void 0);freedraw_classPrivateFieldInitSpec(this,Ar,void 0);freedraw_classPrivateFieldInitSpec(this,Er,void 0);freedraw_classPrivateFieldSet(Er,this,e);freedraw_classPrivateFieldSet(Cr,this,t);freedraw_classPrivateFieldSet(Fr,this,i);freedraw_classPrivateFieldSet(Ar,this,a);freedraw_classPrivateFieldSet(Sr,this,s);freedraw_classPrivateFieldSet(xr,this,n);this.lastPoint=[NaN,NaN];freedraw_assertClassBrand(kr,this,_computeMinMax).call(this,n);const[r,o,l,d]=freedraw_classPrivateFieldGet(br,this);for(let t=0,i=e.length;t<i;t+=2){e[t]=(e[t]-r)/l;e[t+1]=(e[t+1]-o)/d}for(let e=0,i=t.length;e<i;e+=2){t[e]=(t[e]-r)/l;t[e+1]=(t[e+1]-o)/d}}toSVGPath(){const e=[`M${freedraw_classPrivateFieldGet(Er,this)[4]} ${freedraw_classPrivateFieldGet(Er,this)[5]}`];for(let t=6,i=freedraw_classPrivateFieldGet(Er,this).length;t<i;t+=6)isNaN(freedraw_classPrivateFieldGet(Er,this)[t])?e.push(`L${freedraw_classPrivateFieldGet(Er,this)[t+4]} ${freedraw_classPrivateFieldGet(Er,this)[t+5]}`):e.push(`C${freedraw_classPrivateFieldGet(Er,this)[t]} ${freedraw_classPrivateFieldGet(Er,this)[t+1]} ${freedraw_classPrivateFieldGet(Er,this)[t+2]} ${freedraw_classPrivateFieldGet(Er,this)[t+3]} ${freedraw_classPrivateFieldGet(Er,this)[t+4]} ${freedraw_classPrivateFieldGet(Er,this)[t+5]}`);e.push("Z");return e.join(" ")}serialize(e,t){let[i,a,s,n]=e;const r=s-i,o=n-a;let l,d;switch(t){case 0:l=Outline._rescale(freedraw_classPrivateFieldGet(Er,this),i,n,r,-o);d=Outline._rescale(freedraw_classPrivateFieldGet(Cr,this),i,n,r,-o);break;case 90:l=Outline._rescaleAndSwap(freedraw_classPrivateFieldGet(Er,this),i,a,r,o);d=Outline._rescaleAndSwap(freedraw_classPrivateFieldGet(Cr,this),i,a,r,o);break;case 180:l=Outline._rescale(freedraw_classPrivateFieldGet(Er,this),s,a,-r,o);d=Outline._rescale(freedraw_classPrivateFieldGet(Cr,this),s,a,-r,o);break;case 270:l=Outline._rescaleAndSwap(freedraw_classPrivateFieldGet(Er,this),s,n,-r,-o);d=Outline._rescaleAndSwap(freedraw_classPrivateFieldGet(Cr,this),s,n,-r,-o)}return{outline:Array.from(l),points:[Array.from(d)]}}get box(){return freedraw_classPrivateFieldGet(br,this)}newOutliner(e,t,i,a,s){return new FreeDrawOutliner(e,t,i,a,s,arguments.length>5&&void 0!==arguments[5]?arguments[5]:0)}getNewOutline(e,t){const[i,a,s,n]=freedraw_classPrivateFieldGet(br,this),[r,o,l,d]=freedraw_classPrivateFieldGet(Fr,this),c=s*l,h=n*d,u=i*l+r,_=a*d+o,p=this.newOutliner({x:freedraw_classPrivateFieldGet(Cr,this)[0]*c+u,y:freedraw_classPrivateFieldGet(Cr,this)[1]*h+_},freedraw_classPrivateFieldGet(Fr,this),freedraw_classPrivateFieldGet(Ar,this),e,freedraw_classPrivateFieldGet(xr,this),t??freedraw_classPrivateFieldGet(Sr,this));for(let e=2;e<freedraw_classPrivateFieldGet(Cr,this).length;e+=2)p.add({x:freedraw_classPrivateFieldGet(Cr,this)[e]*c+u,y:freedraw_classPrivateFieldGet(Cr,this)[e+1]*h+_});return p.getOutlines()}}function _computeMinMax(e){const t=freedraw_classPrivateFieldGet(Er,this);let i=t[4],a=t[5];const s=[i,a,i,a];let n=i,r=a;const o=e?Math.max:Math.min;for(let e=6,l=t.length;e<l;e+=6){const l=t[e+4],d=t[e+5];if(isNaN(t[e])){Util.pointBoundingBox(l,d,s);if(r<d){n=l;r=d}else r===d&&(n=o(n,l))}else{const l=[1/0,1/0,-1/0,-1/0];Util.bezierBoundingBox(i,a,...t.slice(e,e+6),l);Util.rectBoundingBox(...l,s);if(r<l[3]){n=l[2];r=l[3]}else r===l[3]&&(n=o(n,l[2]))}i=l;a=d}const l=freedraw_classPrivateFieldGet(br,this);l[0]=s[0]-freedraw_classPrivateFieldGet(Sr,this);l[1]=s[1]-freedraw_classPrivateFieldGet(Sr,this);l[2]=s[2]-s[0]+2*freedraw_classPrivateFieldGet(Sr,this);l[3]=s[3]-s[1]+2*freedraw_classPrivateFieldGet(Sr,this);this.lastPoint=[n,r]}function highlight_classPrivateFieldInitSpec(e,t,i){highlight_checkPrivateRedeclaration(e,t),t.set(e,i)}function highlight_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function highlight_classPrivateFieldSet(e,t,i){return e.set(highlight_assertClassBrand(e,t),i),i}function highlight_classPrivateFieldGet(e,t){return e.get(highlight_assertClassBrand(e,t))}function highlight_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Ir=new WeakMap,Mr=new WeakMap,Br=new WeakMap,Gr=new WeakMap,Tr=new WeakSet;class HighlightOutliner{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];!function highlight_classPrivateMethodInitSpec(e,t){highlight_checkPrivateRedeclaration(e,t),t.add(e)}(this,Tr);highlight_classPrivateFieldInitSpec(this,Ir,void 0);highlight_classPrivateFieldInitSpec(this,Mr,void 0);highlight_classPrivateFieldInitSpec(this,Br,[]);highlight_classPrivateFieldInitSpec(this,Gr,[]);const s=[1/0,1/0,-1/0,-1/0],n=10**-4;for(const{x:i,y:a,width:r,height:o}of e){const e=Math.floor((i-t)/n)*n,l=Math.ceil((i+r+t)/n)*n,d=Math.floor((a-t)/n)*n,c=Math.ceil((a+o+t)/n)*n,h=[e,d,c,!0],u=[l,d,c,!1];highlight_classPrivateFieldGet(Br,this).push(h,u);Util.rectBoundingBox(e,d,l,c,s)}const r=s[2]-s[0]+2*i,o=s[3]-s[1]+2*i,l=s[0]-i,d=s[1]-i,c=highlight_classPrivateFieldGet(Br,this).at(a?-1:-2),h=[c[0],c[2]];for(const e of highlight_classPrivateFieldGet(Br,this)){const[t,i,a]=e;e[0]=(t-l)/r;e[1]=(i-d)/o;e[2]=(a-d)/o}highlight_classPrivateFieldSet(Ir,this,new Float32Array([l,d,r,o]));highlight_classPrivateFieldSet(Mr,this,h)}getOutlines(){highlight_classPrivateFieldGet(Br,this).sort(((e,t)=>e[0]-t[0]||e[1]-t[1]||e[2]-t[2]));const e=[];for(const t of highlight_classPrivateFieldGet(Br,this))if(t[3]){e.push(...highlight_assertClassBrand(Tr,this,_breakEdge).call(this,t));highlight_assertClassBrand(Tr,this,_insert).call(this,t)}else{highlight_assertClassBrand(Tr,this,_remove).call(this,t);e.push(...highlight_assertClassBrand(Tr,this,_breakEdge).call(this,t))}return highlight_assertClassBrand(Tr,this,_getOutlines).call(this,e)}}function _getOutlines(e){const t=[],i=new Set;for(const i of e){const[e,a,s]=i;t.push([e,a,i],[e,s,i])}t.sort(((e,t)=>e[1]-t[1]||e[0]-t[0]));for(let e=0,a=t.length;e<a;e+=2){const a=t[e][2],s=t[e+1][2];a.push(s);s.push(a);i.add(a);i.add(s)}const a=[];let s;for(;i.size>0;){const e=i.values().next().value;let[t,n,r,o,l]=e;i.delete(e);let d=t,c=n;s=[t,r];a.push(s);for(;;){let e;if(i.has(o))e=o;else{if(!i.has(l))break;e=l}i.delete(e);[t,n,r,o,l]=e;if(d!==t){s.push(d,c,t,c===n?n:r);d=t}c=c===n?r:n}s.push(d,c)}return new HighlightOutline(a,highlight_classPrivateFieldGet(Ir,this),highlight_classPrivateFieldGet(Mr,this))}function _binarySearch(e){const t=highlight_classPrivateFieldGet(Gr,this);let i=0,a=t.length-1;for(;i<=a;){const s=i+a>>1,n=t[s][0];if(n===e)return s;n<e?i=s+1:a=s-1}return a+1}function _insert(e){let[,t,i]=e;const a=highlight_assertClassBrand(Tr,this,_binarySearch).call(this,t);highlight_classPrivateFieldGet(Gr,this).splice(a,0,[t,i])}function _remove(e){let[,t,i]=e;const a=highlight_assertClassBrand(Tr,this,_binarySearch).call(this,t);for(let e=a;e<highlight_classPrivateFieldGet(Gr,this).length;e++){const[a,s]=highlight_classPrivateFieldGet(Gr,this)[e];if(a!==t)break;if(a===t&&s===i){highlight_classPrivateFieldGet(Gr,this).splice(e,1);return}}for(let e=a-1;e>=0;e--){const[a,s]=highlight_classPrivateFieldGet(Gr,this)[e];if(a!==t)break;if(a===t&&s===i){highlight_classPrivateFieldGet(Gr,this).splice(e,1);return}}}function _breakEdge(e){const[t,i,a]=e,s=[[t,i,a]],n=highlight_assertClassBrand(Tr,this,_binarySearch).call(this,a);for(let e=0;e<n;e++){const[i,a]=highlight_classPrivateFieldGet(Gr,this)[e];for(let e=0,n=s.length;e<n;e++){const[,r,o]=s[e];if(!(a<=r||o<=i))if(r>=i)if(o>a)s[e][1]=a;else{if(1===n)return[];s.splice(e,1);e--;n--}else{s[e][2]=i;o>a&&s.push([t,a,o])}}}return s}var Dr,Lr=new WeakMap,Rr=new WeakMap;class HighlightOutline extends Outline{constructor(e,t,i){super();highlight_classPrivateFieldInitSpec(this,Lr,void 0);highlight_classPrivateFieldInitSpec(this,Rr,void 0);highlight_classPrivateFieldSet(Rr,this,e);highlight_classPrivateFieldSet(Lr,this,t);this.lastPoint=i}toSVGPath(){const e=[];for(const t of highlight_classPrivateFieldGet(Rr,this)){let[i,a]=t;e.push(`M${i} ${a}`);for(let s=2;s<t.length;s+=2){const n=t[s],r=t[s+1];if(n===i){e.push(`V${r}`);a=r}else if(r===a){e.push(`H${n}`);i=n}}e.push("Z")}return e.join(" ")}serialize(e,t){let[i,a,s,n]=e;const r=[],o=s-i,l=n-a;for(const e of highlight_classPrivateFieldGet(Rr,this)){const t=new Array(e.length);for(let a=0;a<e.length;a+=2){t[a]=i+e[a]*o;t[a+1]=n-e[a+1]*l}r.push(t)}return r}get box(){return highlight_classPrivateFieldGet(Lr,this)}get classNamesForOutlining(){return["highlightOutline"]}}class FreeHighlightOutliner extends FreeDrawOutliner{newFreeDrawOutline(e,t,i,a,s,n){return new FreeHighlightOutline(e,t,i,a,s,n)}}class FreeHighlightOutline extends FreeDrawOutline{newOutliner(e,t,i,a,s){return new FreeHighlightOutliner(e,t,i,a,s,arguments.length>5&&void 0!==arguments[5]?arguments[5]:0)}}function highlight_defineProperty(e,t,i){return(t=function highlight_toPropertyKey(e){var t=function highlight_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function editor_highlight_classPrivateFieldInitSpec(e,t,i){editor_highlight_checkPrivateRedeclaration(e,t),t.set(e,i)}function editor_highlight_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function highlight_toSetter(e,t,i){t||(t=[]);var a=t.length++;return Object.defineProperty({},"_",{set:function(s){t[a]=s,e.apply(i,t)}})}function editor_highlight_classPrivateFieldGet(e,t){return e.get(editor_highlight_assertClassBrand(e,t))}function editor_highlight_classPrivateFieldSet(e,t,i){return e.set(editor_highlight_assertClassBrand(e,t),i),i}function editor_highlight_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Nr,Or=new WeakMap,Wr=new WeakMap,jr=new WeakMap,Vr=new WeakMap,Hr=new WeakMap,zr=new WeakMap,Ur=new WeakMap,$r=new WeakMap,qr=new WeakMap,Xr=new WeakMap,Kr=new WeakMap,Yr=new WeakMap,Zr=new WeakMap,Qr=new WeakMap,Jr=new WeakMap,eo=new WeakMap,to=new WeakMap,io=new WeakMap,ao=new WeakSet;class HighlightEditor extends AnnotationEditor{static get _keyboardManager(){const e=HighlightEditor.prototype;return shadow(this,"_keyboardManager",new KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:"highlightEditor"});!function editor_highlight_classPrivateMethodInitSpec(e,t){editor_highlight_checkPrivateRedeclaration(e,t),t.add(e)}(this,ao);editor_highlight_classPrivateFieldInitSpec(this,Or,null);editor_highlight_classPrivateFieldInitSpec(this,Wr,0);editor_highlight_classPrivateFieldInitSpec(this,jr,void 0);editor_highlight_classPrivateFieldInitSpec(this,Vr,null);editor_highlight_classPrivateFieldInitSpec(this,Hr,null);editor_highlight_classPrivateFieldInitSpec(this,zr,null);editor_highlight_classPrivateFieldInitSpec(this,Ur,null);editor_highlight_classPrivateFieldInitSpec(this,$r,0);editor_highlight_classPrivateFieldInitSpec(this,qr,null);editor_highlight_classPrivateFieldInitSpec(this,Xr,null);editor_highlight_classPrivateFieldInitSpec(this,Kr,null);editor_highlight_classPrivateFieldInitSpec(this,Yr,!1);editor_highlight_classPrivateFieldInitSpec(this,Zr,null);editor_highlight_classPrivateFieldInitSpec(this,Qr,void 0);editor_highlight_classPrivateFieldInitSpec(this,Jr,null);editor_highlight_classPrivateFieldInitSpec(this,eo,"");editor_highlight_classPrivateFieldInitSpec(this,to,void 0);editor_highlight_classPrivateFieldInitSpec(this,io,"");this.color=e.color||HighlightEditor._defaultColor;editor_highlight_classPrivateFieldSet(to,this,e.thickness||HighlightEditor._defaultThickness);editor_highlight_classPrivateFieldSet(Qr,this,e.opacity||HighlightEditor._defaultOpacity);editor_highlight_classPrivateFieldSet(jr,this,e.boxes||null);editor_highlight_classPrivateFieldSet(io,this,e.methodOfCreation||"");editor_highlight_classPrivateFieldSet(eo,this,e.text||"");this._isDraggable=!1;this.defaultL10nId="pdfjs-editor-highlight-editor";if(e.highlightId>-1){editor_highlight_classPrivateFieldSet(Yr,this,!0);editor_highlight_assertClassBrand(ao,this,_createFreeOutlines).call(this,e);editor_highlight_assertClassBrand(ao,this,_addToDrawLayer).call(this)}else if(editor_highlight_classPrivateFieldGet(jr,this)){editor_highlight_classPrivateFieldSet(Or,this,e.anchorNode);editor_highlight_classPrivateFieldSet(Wr,this,e.anchorOffset);editor_highlight_classPrivateFieldSet(Ur,this,e.focusNode);editor_highlight_classPrivateFieldSet($r,this,e.focusOffset);editor_highlight_assertClassBrand(ao,this,_createOutlines).call(this);editor_highlight_assertClassBrand(ao,this,_addToDrawLayer).call(this);this.rotate(this.rotation)}this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"added",page:this.pageIndex+1,editorType:this.constructor.name,value:{color:this.color,thickness:editor_highlight_classPrivateFieldGet(to,this),isFreeHighlight:editor_highlight_classPrivateFieldGet(Yr,this),text:editor_highlight_classPrivateFieldGet(eo,this)}});this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}get telemetryInitialData(){return{action:"added",type:editor_highlight_classPrivateFieldGet(Yr,this)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:editor_highlight_classPrivateFieldGet(to,this),methodOfCreation:editor_highlight_classPrivateFieldGet(io,this)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}get commentColor(){return this.color}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,t){AnnotationEditor.initialize(e,t);HighlightEditor._defaultColor||=t.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(e,t){switch(e){case v.HIGHLIGHT_COLOR:HighlightEditor._defaultColor=t;break;case v.HIGHLIGHT_THICKNESS:HighlightEditor._defaultThickness=t}}translateInPage(e,t){}get toolbarPosition(){return editor_highlight_classPrivateFieldGet(Zr,this)}updateParams(e,t){switch(e){case v.HIGHLIGHT_COLOR:editor_highlight_assertClassBrand(ao,this,highlight_updateColor).call(this,t);break;case v.HIGHLIGHT_THICKNESS:editor_highlight_assertClassBrand(ao,this,_updateThickness).call(this,t)}}static get defaultPropertiesToUpdate(){return[[v.HIGHLIGHT_COLOR,HighlightEditor._defaultColor],[v.HIGHLIGHT_THICKNESS,HighlightEditor._defaultThickness]]}get propertiesToUpdate(){return[[v.HIGHLIGHT_COLOR,this.color||HighlightEditor._defaultColor],[v.HIGHLIGHT_THICKNESS,editor_highlight_classPrivateFieldGet(to,this)||HighlightEditor._defaultThickness],[v.HIGHLIGHT_FREE,editor_highlight_classPrivateFieldGet(Yr,this)]]}get toolbarButtons(){if(this._uiManager.highlightColors){return[["colorPicker",editor_highlight_classPrivateFieldSet(Hr,this,new ColorPicker({editor:this}))]]}return super.toolbarButtons}disableEditing(){super.disableEditing();this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing();this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(editor_highlight_assertClassBrand(ao,this,_getRotation).call(this))}getBaseTranslation(){return[0,0]}getRect(e,t){return super.getRect(e,t,editor_highlight_assertClassBrand(ao,this,_getRotation).call(this))}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this);e&&this.div.focus()}remove(){editor_highlight_assertClassBrand(ao,this,_cleanDrawLayer).call(this);this._reportTelemetry({action:"deleted"});super.remove()}rebuild(){if(this.parent){super.rebuild();if(null!==this.div){editor_highlight_assertClassBrand(ao,this,_addToDrawLayer).call(this);this.isAttachedToDOM||this.parent.add(this)}}}setParent(e){let t=!1;if(this.parent&&!e)editor_highlight_assertClassBrand(ao,this,_cleanDrawLayer).call(this);else if(e){editor_highlight_assertClassBrand(ao,this,_addToDrawLayer).call(this,e);t=!this.parent&&this.div?.classList.contains("selectedEditor")}super.setParent(e);this.show(this._isVisible);t&&this.select()}rotate(e){const{drawLayer:t}=this.parent;let i;if(editor_highlight_classPrivateFieldGet(Yr,this)){e=(e-this.rotation+360)%360;i=_rotateBbox.call(HighlightEditor,editor_highlight_classPrivateFieldGet(Xr,this).box,e)}else i=_rotateBbox.call(HighlightEditor,[this.x,this.y,this.width,this.height],e);t.updateProperties(editor_highlight_classPrivateFieldGet(Kr,this),{bbox:i,root:{"data-main-rotation":e}});t.updateProperties(editor_highlight_classPrivateFieldGet(Jr,this),{bbox:_rotateBbox.call(HighlightEditor,editor_highlight_classPrivateFieldGet(zr,this).box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;const e=super.render();if(editor_highlight_classPrivateFieldGet(eo,this)){e.setAttribute("aria-label",editor_highlight_classPrivateFieldGet(eo,this));e.setAttribute("role","mark")}editor_highlight_classPrivateFieldGet(Yr,this)?e.classList.add("free"):this.div.addEventListener("keydown",editor_highlight_assertClassBrand(ao,this,_keydown).bind(this),{signal:this._uiManager._signal});const t=editor_highlight_classPrivateFieldSet(qr,this,document.createElement("div"));e.append(t);t.setAttribute("aria-hidden","true");t.className="internal";t.style.clipPath=editor_highlight_classPrivateFieldGet(Vr,this);const[i,a]=this.parentDimensions;this.setDims(this.width*i,this.height*a);bindEvents(this,editor_highlight_classPrivateFieldGet(qr,this),["pointerover","pointerleave"]);this.enableEditing();return e}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(Jr,this),{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(Jr,this),{rootClass:{hovered:!1}})}_moveCaret(e){this.parent.unselect(this);switch(e){case 0:case 2:editor_highlight_assertClassBrand(ao,this,_setCaret).call(this,!0);break;case 1:case 3:editor_highlight_assertClassBrand(ao,this,_setCaret).call(this,!1)}}select(){super.select();editor_highlight_classPrivateFieldGet(Jr,this)&&this.parent?.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(Jr,this),{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect();if(editor_highlight_classPrivateFieldGet(Jr,this)){this.parent?.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(Jr,this),{rootClass:{selected:!1}});editor_highlight_classPrivateFieldGet(Yr,this)||editor_highlight_assertClassBrand(ao,this,_setCaret).call(this,!1)}}get _mustFixPosition(){return!editor_highlight_classPrivateFieldGet(Yr,this)}show(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;super.show(e);if(this.parent){this.parent.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(Kr,this),{rootClass:{hidden:!e}});this.parent.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(Jr,this),{rootClass:{hidden:!e}})}}static startHighlighting(e,t,i){let{target:a,x:s,y:n}=i;const{x:r,y:o,width:l,height:d}=a.getBoundingClientRect(),c=new AbortController,h=e.combinedSignal(c),pointerUpCallback=t=>{c.abort();editor_highlight_assertClassBrand(HighlightEditor,this,_endHighlight).call(this,e,t)};window.addEventListener("blur",pointerUpCallback,{signal:h});window.addEventListener("pointerup",pointerUpCallback,{signal:h});window.addEventListener("pointerdown",stopEvent,{capture:!0,passive:!1,signal:h});window.addEventListener("contextmenu",noContextMenu,{signal:h});a.addEventListener("pointermove",editor_highlight_assertClassBrand(HighlightEditor,this,_highlightMove).bind(this,e),{signal:h});this._freeHighlight=new FreeHighlightOutliner({x:s,y:n},[r,o,l,d],e.scale,this._defaultThickness/2,t,.001);({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0))}static async deserialize(e,t,i){let a=null;if(e instanceof HighlightAnnotationElement){const{data:{quadPoints:t,rect:i,rotation:s,id:n,color:r,opacity:o,popupRef:l,contentsObj:d},parent:{page:{pageNumber:c}}}=e;a=e={annotationType:f.HIGHLIGHT,color:Array.from(r),opacity:o,quadPoints:t,boxes:null,pageIndex:c-1,rect:i.slice(0),rotation:s,annotationElementId:n,id:n,deleted:!1,popupRef:l,comment:d?.str||null}}else if(e.annotationType&&e.annotationType===f.HIGHLIGHT){let t,{quadPoints:i,outlines:s,rect:n,rotation:r,id:o,color:l,opacity:d,popupRef:c,pageIndex:h,thickness:u}=e;i&&(Array.isArray(i)||(i=Object.values(i)));if(!i&&s){if(Array.isArray(s))t=s.map((e=>e));else{if("object"!=typeof s||!s.points){console.error("Unexpected outlines format");return null}t=[s.points.flat()]}u=u||e.thickness||1}a=e={annotationType:f.HIGHLIGHT,color:Array.from(l),opacity:d,quadPoints:i,inkLists:t,thickness:u,boxes:null,pageIndex:h,rect:n.slice(0),rotation:r,id:o,deleted:!1,popupRef:c||null}}else if(e instanceof InkAnnotationElement){const{data:{inkLists:t,rect:i,rotation:s,id:n,color:r,borderStyle:{rawWidth:o},popupRef:l,contentsObj:d},parent:{page:{pageNumber:c}}}=e;a=e={annotationType:f.HIGHLIGHT,color:Array.from(r),thickness:o,inkLists:t,boxes:null,pageIndex:c-1,rect:i.slice(0),rotation:s,annotationElementId:n,id:n,deleted:!1,popupRef:l,comment:d?.str||null}}const{color:s,quadPoints:n,inkLists:r,opacity:o}=e,l=await super.deserialize(e,t,i);l.color=Util.makeHexColor(...s);editor_highlight_classPrivateFieldSet(Qr,l,o||1);r&&editor_highlight_classPrivateFieldSet(to,l,e.thickness);l._initialData=a;e.comment&&l.setCommentData(e.comment);const[d,c]=l.pageDimensions,[h,u]=l.pageTranslation;if(n){const e=editor_highlight_classPrivateFieldSet(jr,l,[]);for(let t=0;t<n.length;t+=8)e.push({x:(n[t]-h)/d,y:1-(n[t+1]-u)/c,width:(n[t+2]-n[t])/d,height:(n[t+1]-n[t+5])/c});editor_highlight_assertClassBrand(ao,l,_createOutlines).call(l);editor_highlight_assertClassBrand(ao,l,_addToDrawLayer).call(l);l.rotate(l.rotation)}else if(r){editor_highlight_classPrivateFieldSet(Yr,l,!0);const e=r[0],i={x:e[0]-h,y:c-(e[1]-u)},a=new FreeHighlightOutliner(i,[0,0,d,c],1,editor_highlight_classPrivateFieldGet(to,l)/2,!0,.001);for(let t=0,s=e.length;t<s;t+=2){i.x=e[t]-h;i.y=c-(e[t+1]-u);a.add(i)}const{id:s,clipPathId:n}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:l.color,"fill-opacity":l._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:a.toSVGPath()}},!0,!0);editor_highlight_assertClassBrand(ao,l,_createFreeOutlines).call(l,{highlightOutlines:a.getOutlines(),highlightId:s,clipPathId:n});editor_highlight_assertClassBrand(ao,l,_addToDrawLayer).call(l);l.rotate(l.parentRotation)}return l}serialize(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const t=this.getRect(0,0),i=AnnotationEditor._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),a={annotationType:f.HIGHLIGHT,color:i,opacity:editor_highlight_classPrivateFieldGet(Qr,this),thickness:editor_highlight_classPrivateFieldGet(to,this),quadPoints:editor_highlight_assertClassBrand(ao,this,_serializeBoxes).call(this),outlines:editor_highlight_assertClassBrand(ao,this,_serializeOutlines).call(this,t),pageIndex:this.pageIndex,rect:t,rotation:editor_highlight_assertClassBrand(ao,this,_getRotation).call(this),structTreeParentId:this._structTreeParentId};this.addComment(a);if(this.annotationElementId&&!editor_highlight_assertClassBrand(ao,this,highlight_hasElementChanged).call(this,a))return null;a.id=this.annotationElementId;return a}renderAnnotationElement(e){const t={rect:this.getRect(0,0)};this.hasEditedComment&&(t.popup=this.comment);e.updateEdited(t);return null}static canCreateNewEmptyEditor(){return!1}}Dr=HighlightEditor;function _createOutlines(){const e=new HighlightOutliner(editor_highlight_classPrivateFieldGet(jr,this),.001);editor_highlight_classPrivateFieldSet(Xr,this,e.getOutlines());[this.x,this.y,this.width,this.height]=editor_highlight_classPrivateFieldGet(Xr,this).box;const t=new HighlightOutliner(editor_highlight_classPrivateFieldGet(jr,this),.0025,.001,"ltr"===this._uiManager.direction);editor_highlight_classPrivateFieldSet(zr,this,t.getOutlines());const{lastPoint:i}=editor_highlight_classPrivateFieldGet(zr,this);editor_highlight_classPrivateFieldSet(Zr,this,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])}function _createFreeOutlines(e){let{highlightOutlines:t,highlightId:i,clipPathId:a}=e;editor_highlight_classPrivateFieldSet(Xr,this,t);editor_highlight_classPrivateFieldSet(zr,this,t.getNewOutline(editor_highlight_classPrivateFieldGet(to,this)/2+1.5,.0025));if(i>=0){editor_highlight_classPrivateFieldSet(Kr,this,i);editor_highlight_classPrivateFieldSet(Vr,this,a);this.parent.drawLayer.finalizeDraw(i,{bbox:t.box,path:{d:t.toSVGPath()}});editor_highlight_classPrivateFieldSet(Jr,this,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:editor_highlight_classPrivateFieldGet(zr,this).box,path:{d:editor_highlight_classPrivateFieldGet(zr,this).toSVGPath()}},!0))}else if(this.parent){const e=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(Kr,this),{bbox:_rotateBbox.call(Dr,editor_highlight_classPrivateFieldGet(Xr,this).box,(e-this.rotation+360)%360),path:{d:t.toSVGPath()}});this.parent.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(Jr,this),{bbox:_rotateBbox.call(Dr,editor_highlight_classPrivateFieldGet(zr,this).box,e),path:{d:editor_highlight_classPrivateFieldGet(zr,this).toSVGPath()}})}const[s,n,r,o]=t.box;switch(this.rotation){case 0:this.x=s;this.y=n;this.width=r;this.height=o;break;case 90:{const[e,t]=this.parentDimensions;this.x=n;this.y=1-s;this.width=r*t/e;this.height=o*e/t;break}case 180:this.x=1-s;this.y=1-n;this.width=r;this.height=o;break;case 270:{const[e,t]=this.parentDimensions;this.x=1-n;this.y=s;this.width=r*t/e;this.height=o*e/t;break}}const{lastPoint:l}=editor_highlight_classPrivateFieldGet(zr,this);editor_highlight_classPrivateFieldSet(Zr,this,[(l[0]-s)/r,(l[1]-n)/o])}function highlight_updateColor(e){const setColorAndOpacity=(e,t)=>{this.color=e;editor_highlight_classPrivateFieldSet(Qr,this,t);this.parent?.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(Kr,this),{root:{fill:e,"fill-opacity":t}});editor_highlight_classPrivateFieldGet(Hr,this)?.updateColor(e)},t=this.color,i=editor_highlight_classPrivateFieldGet(Qr,this);this.addCommands({cmd:setColorAndOpacity.bind(this,e,Dr._defaultOpacity),undo:setColorAndOpacity.bind(this,t,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:v.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0});this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(e)},!0);this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"colorChanged",page:this.pageIndex+1,editorType:this.constructor.name,value:e,previousValue:t})}function _updateThickness(e){const t=editor_highlight_classPrivateFieldGet(to,this),setThickness=e=>{editor_highlight_classPrivateFieldSet(to,this,e);editor_highlight_assertClassBrand(ao,this,_changeThickness).call(this,e)};this.addCommands({cmd:setThickness.bind(this,e),undo:setThickness.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:v.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0});this._reportTelemetry({action:"thickness_changed",thickness:e},!0);this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"thicknessChanged",page:this.pageIndex+1,editorType:this.constructor.name,value:e,previousValue:t})}function _changeThickness(e){if(!editor_highlight_classPrivateFieldGet(Yr,this))return;editor_highlight_assertClassBrand(ao,this,_createFreeOutlines).call(this,{highlightOutlines:editor_highlight_classPrivateFieldGet(Xr,this).getNewOutline(e/2)});this.fixAndSetPosition();const[t,i]=this.parentDimensions;this.setDims(this.width*t,this.height*i)}function _cleanDrawLayer(){if(null!==editor_highlight_classPrivateFieldGet(Kr,this)&&this.parent){this.parent.drawLayer.remove(editor_highlight_classPrivateFieldGet(Kr,this));editor_highlight_classPrivateFieldSet(Kr,this,null);this.parent.drawLayer.remove(editor_highlight_classPrivateFieldGet(Jr,this));editor_highlight_classPrivateFieldSet(Jr,this,null)}}function _addToDrawLayer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;if(null===editor_highlight_classPrivateFieldGet(Kr,this)){({id:highlight_toSetter(editor_highlight_classPrivateFieldSet,[Kr,this])._,clipPathId:highlight_toSetter(editor_highlight_classPrivateFieldSet,[Vr,this])._}=e.drawLayer.draw({bbox:editor_highlight_classPrivateFieldGet(Xr,this).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":editor_highlight_classPrivateFieldGet(Qr,this)},rootClass:{highlight:!0,free:editor_highlight_classPrivateFieldGet(Yr,this)},path:{d:editor_highlight_classPrivateFieldGet(Xr,this).toSVGPath()}},!1,!0));editor_highlight_classPrivateFieldSet(Jr,this,e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:editor_highlight_classPrivateFieldGet(Yr,this)},bbox:editor_highlight_classPrivateFieldGet(zr,this).box,path:{d:editor_highlight_classPrivateFieldGet(zr,this).toSVGPath()}},editor_highlight_classPrivateFieldGet(Yr,this)));editor_highlight_classPrivateFieldGet(qr,this)&&(editor_highlight_classPrivateFieldGet(qr,this).style.clipPath=editor_highlight_classPrivateFieldGet(Vr,this))}}function _rotateBbox(e,t){let[i,a,s,n]=e;switch(t){case 90:return[1-a-n,i,n,s];case 180:return[1-i-s,1-a-n,s,n];case 270:return[a,1-i-s,n,s]}return[i,a,s,n]}function _keydown(e){Dr._keyboardManager.exec(this,e)}function _setCaret(e){if(!editor_highlight_classPrivateFieldGet(Or,this))return;const t=window.getSelection();e?t.setPosition(editor_highlight_classPrivateFieldGet(Or,this),editor_highlight_classPrivateFieldGet(Wr,this)):t.setPosition(editor_highlight_classPrivateFieldGet(Ur,this),editor_highlight_classPrivateFieldGet($r,this))}function _getRotation(){return editor_highlight_classPrivateFieldGet(Yr,this)?this.rotation:0}function _serializeBoxes(){if(editor_highlight_classPrivateFieldGet(Yr,this))return null;const[e,t]=this.pageDimensions,[i,a]=this.pageTranslation,s=editor_highlight_classPrivateFieldGet(jr,this),n=new Float32Array(8*s.length);let r=0;for(const{x:o,y:l,width:d,height:c}of s){const s=o*e+i,h=(1-l)*t+a;n[r]=n[r+4]=s;n[r+1]=n[r+3]=h;n[r+2]=n[r+6]=s+d*e;n[r+5]=n[r+7]=h-c*t;r+=8}return n}function _serializeOutlines(e){return editor_highlight_classPrivateFieldGet(Xr,this).serialize(e,editor_highlight_assertClassBrand(ao,this,_getRotation).call(this))}function _highlightMove(e,t){this._freeHighlight.add(t)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}function _endHighlight(e,t){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(t,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"});this._freeHighlightId=-1;this._freeHighlight=null;this._freeHighlightClipId=""}function highlight_hasElementChanged(e){const{color:t}=this._initialData;return this.hasEditedComment||e.color.some(((e,i)=>e!==t[i]))}highlight_defineProperty(HighlightEditor,"_defaultColor",null);highlight_defineProperty(HighlightEditor,"_defaultOpacity",1);highlight_defineProperty(HighlightEditor,"_defaultThickness",12);highlight_defineProperty(HighlightEditor,"_type","highlight");highlight_defineProperty(HighlightEditor,"_editorType",f.HIGHLIGHT);highlight_defineProperty(HighlightEditor,"_freeHighlightId",-1);highlight_defineProperty(HighlightEditor,"_freeHighlight",null);highlight_defineProperty(HighlightEditor,"_freeHighlightClipId","");function draw_defineProperty(e,t,i){return(t=function draw_toPropertyKey(e){var t=function draw_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function draw_classPrivateFieldInitSpec(e,t,i){draw_checkPrivateRedeclaration(e,t),t.set(e,i)}function draw_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function draw_classPrivateFieldSet(e,t,i){return e.set(draw_assertClassBrand(e,t),i),i}function draw_classPrivateFieldGet(e,t){return e.get(draw_assertClassBrand(e,t))}function draw_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var so=new WeakMap;class DrawingOptions{constructor(){draw_classPrivateFieldInitSpec(this,so,Object.create(null))}updateProperty(e,t){this[e]=t;this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(const[t,i]of Object.entries(e))t.startsWith("_")||this.updateProperty(t,i)}updateSVGProperty(e,t){draw_classPrivateFieldGet(so,this)[e]=t}toSVGProperties(){const e=draw_classPrivateFieldGet(so,this);draw_classPrivateFieldSet(so,this,Object.create(null));return{root:e}}reset(){draw_classPrivateFieldSet(so,this,Object.create(null))}updateAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;this.updateProperties(e)}clone(){unreachable("Not implemented")}}var no=new WeakMap,ro=new WeakMap,oo=new WeakSet;class DrawingEditor extends AnnotationEditor{constructor(e){super(e);!function draw_classPrivateMethodInitSpec(e,t){draw_checkPrivateRedeclaration(e,t),t.add(e)}(this,oo);draw_classPrivateFieldInitSpec(this,no,null);draw_classPrivateFieldInitSpec(this,ro,void 0);draw_defineProperty(this,"_colorPicker",null);draw_defineProperty(this,"_drawId",null);draw_classPrivateFieldSet(ro,this,e.mustBeCommitted||!1);this._addOutlines(e)}_addOutlines(e){if(e.drawOutlines){draw_assertClassBrand(oo,this,_createDrawOutlines).call(this,e);draw_assertClassBrand(oo,this,draw_addToDrawLayer).call(this)}}static _mergeSVGProperties(e,t){const i=new Set(Object.keys(e));for(const[a,s]of Object.entries(t))i.has(a)?Object.assign(e[a],s):e[a]=s;return e}static getDefaultDrawingOptions(e){unreachable("Not implemented")}static get typesMap(){unreachable("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,t){const i=this.typesMap.get(e);i&&this._defaultDrawingOptions.updateProperty(i,t);if(this._currentParent){lo._.updateProperty(i,t);this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties())}}updateParams(e,t){const i=this.constructor.typesMap.get(e);i&&this._updateProperty(e,i,t)}static get defaultPropertiesToUpdate(){const e=[],t=this._defaultDrawingOptions;for(const[i,a]of this.typesMap)e.push([i,t[a]]);return e}get propertiesToUpdate(){const e=[],{_drawingOptions:t}=this;for(const[i,a]of this.constructor.typesMap)e.push([i,t[a]]);return e}_updateProperty(e,t,i){const a=this._drawingOptions,s=a[t],setter=s=>{a.updateProperty(t,s);const n=draw_classPrivateFieldGet(no,this).updateProperty(t,s);n&&draw_assertClassBrand(oo,this,_updateBbox).call(this,n);this.parent?.drawLayer.updateProperties(this._drawId,a.toSVGProperties());"stroke"===t?this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"colorChanged",page:this.pageIndex+1,editorType:this.constructor.name,value:i}):"stroke-width"===t?this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"thicknessChanged",page:this.pageIndex+1,editorType:this.constructor.name,value:i}):"stroke-opacity"===t&&this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"opacityChanged",page:this.pageIndex+1,editorType:this.constructor.name,value:i});e===this.colorType&&this._colorPicker?.update(s)};this.addCommands({cmd:setter.bind(this,i),undo:setter.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,DrawingEditor._mergeSVGProperties(draw_classPrivateFieldGet(no,this).getPathResizingSVGProperties(draw_assertClassBrand(oo,this,_convertToDrawSpace).call(this)),{bbox:draw_assertClassBrand(oo,this,_rotateBox).call(this)}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,DrawingEditor._mergeSVGProperties(draw_classPrivateFieldGet(no,this).getPathResizedSVGProperties(draw_assertClassBrand(oo,this,_convertToDrawSpace).call(this)),{bbox:draw_assertClassBrand(oo,this,_rotateBox).call(this)}))}_onTranslating(e,t){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:draw_assertClassBrand(oo,this,_rotateBox).call(this)})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,DrawingEditor._mergeSVGProperties(draw_classPrivateFieldGet(no,this).getPathTranslatedSVGProperties(draw_assertClassBrand(oo,this,_convertToDrawSpace).call(this),this.parentDimensions),{bbox:draw_assertClassBrand(oo,this,_rotateBox).call(this)}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit();this.disableEditMode();this.disableEditing()}disableEditing(){super.disableEditing();this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing();this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this);this._isDraggable=!0;if(draw_classPrivateFieldGet(ro,this)){draw_classPrivateFieldSet(ro,this,!1);this.commit();this.parent.setSelected(this);e&&this.isOnScreen&&this.div.focus()}}remove(){draw_assertClassBrand(oo,this,draw_cleanDrawLayer).call(this);super.remove()}rebuild(){if(this.parent){super.rebuild();if(null!==this.div){draw_assertClassBrand(oo,this,draw_addToDrawLayer).call(this);draw_assertClassBrand(oo,this,_updateBbox).call(this,draw_classPrivateFieldGet(no,this).box);this.isAttachedToDOM||this.parent.add(this)}}}setParent(e){let t=!1;if(this.parent&&!e){this._uiManager.removeShouldRescale(this);draw_assertClassBrand(oo,this,draw_cleanDrawLayer).call(this)}else if(e){this._uiManager.addShouldRescale(this);draw_assertClassBrand(oo,this,draw_addToDrawLayer).call(this,e);t=!this.parent&&this.div?.classList.contains("selectedEditor")}super.setParent(e);t&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,DrawingEditor._mergeSVGProperties({bbox:draw_assertClassBrand(oo,this,_rotateBox).call(this)},draw_classPrivateFieldGet(no,this).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&draw_assertClassBrand(oo,this,_updateBbox).call(this,draw_classPrivateFieldGet(no,this).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,t;if(this._isCopy){e=this.x;t=this.y}const i=super.render();i.classList.add("draw");const a=document.createElement("div");i.append(a);a.setAttribute("aria-hidden","true");a.className="internal";const[s,n]=this.parentDimensions;this.setDims(this.width*s,this.height*n);this._uiManager.addShouldRescale(this);this.disableEditing();this._isCopy&&this._moveAfterPaste(e,t);return i}static createDrawerInstance(e,t,i,a,s){unreachable("Not implemented")}static startDrawing(e,t,i,a){const{target:s,offsetX:n,offsetY:r,pointerId:o,pointerType:l}=a;if(_o._&&_o._!==l)return;const{viewport:{rotation:d}}=e,{width:c,height:h}=s.getBoundingClientRect(),u=co._=new AbortController,_=e.combinedSignal(u);uo._||(uo._=o);_o._??(_o._=l);window.addEventListener("pointerup",(e=>{uo._===e.pointerId?this._endDraw(e):po._?.delete(e.pointerId)}),{signal:_});window.addEventListener("pointercancel",(e=>{uo._===e.pointerId?this._currentParent.endDrawingSession():po._?.delete(e.pointerId)}),{signal:_});window.addEventListener("pointerdown",(e=>{if(_o._===e.pointerType){(po._||(po._=new Set)).add(e.pointerId);if(lo._.isCancellable()){lo._.removeLastElement();lo._.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)}}}),{capture:!0,passive:!1,signal:_});window.addEventListener("contextmenu",noContextMenu,{signal:_});s.addEventListener("pointermove",this._drawMove.bind(this),{signal:_});s.addEventListener("touchmove",(e=>{e.timeStamp===go._&&stopEvent(e)}),{signal:_});e.toggleDrawing();t._editorUndoBar?.hide();if(lo._)e.drawLayer.updateProperties(this._currentDrawId,lo._.startNew(n,r,c,h,d));else{t.updateUIForDefaultProperties(this);lo._=this.createDrawerInstance(n,r,c,h,d);ho._=this.getDefaultDrawingOptions();this._currentParent=e;({id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(ho._.toSVGProperties(),lo._.defaultSVGProperties),!0,!1))}}static _drawMove(e){go._=-1;if(!lo._)return;const{offsetX:t,offsetY:i,pointerId:a}=e;if(uo._===a)if(po._?.size>=1)this._endDraw(e);else{this._currentParent.drawLayer.updateProperties(this._currentDrawId,lo._.add(t,i));go._=e.timeStamp;stopEvent(e)}}static _cleanup(e){if(e){this._currentDrawId=-1;this._currentParent=null;lo._=null;ho._=null;_o._=null;go._=NaN}if(co._){co._.abort();co._=null;uo._=NaN;po._=null}}static _endDraw(e){const t=this._currentParent;if(t){t.toggleDrawing(!0);this._cleanup(!1);e?.target===t.div&&t.drawLayer.updateProperties(this._currentDrawId,lo._.end(e.offsetX,e.offsetY));this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"bezierPathChanged",page:this._currentParent?this._currentParent.pageIndex+1:NaN,editorType:this.name});if(this.supportMultipleDrawings){const e=lo._,i=this._currentDrawId,a=e.getLastElement();t.addCommands({cmd:()=>{t.drawLayer.updateProperties(i,e.setLastElement(a))},undo:()=>{t.drawLayer.updateProperties(i,e.removeLastElement())},mustExec:!1,type:v.DRAW_STEP})}else this.endDrawing(!1)}}static endDrawing(e){const t=this._currentParent;if(!t)return null;t.toggleDrawing(!0);t.cleanUndoStack(v.DRAW_STEP);if(!lo._.isEmpty()){const{pageDimensions:[i,a],scale:s}=t,n=t.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:lo._.getOutlines(i*s,a*s,s,this._INNER_MARGIN),drawingOptions:ho._,mustBeCommitted:!e});this._cleanup(!0);return n}t.drawLayer.remove(this._currentDrawId);this._cleanup(!0);return null}createDrawingOptions(e){}static deserializeDraw(e,t,i,a,s,n){unreachable("Not implemented")}static async deserialize(e,t,i){const{rawDims:{pageWidth:a,pageHeight:s,pageX:n,pageY:r}}=t.viewport,o=this.deserializeDraw(n,r,a,s,this._INNER_MARGIN,e),l=await super.deserialize(e,t,i);l.createDrawingOptions(e);draw_assertClassBrand(oo,l,_createDrawOutlines).call(l,{drawOutlines:o});draw_assertClassBrand(oo,l,draw_addToDrawLayer).call(l);l.onScaleChanging();l.rotate();return l}serializeDraw(e){const[t,i]=this.pageTranslation,[a,s]=this.pageDimensions;return draw_classPrivateFieldGet(no,this).serialize([t,i,a,s],e)}renderAnnotationElement(e){e.updateEdited({rect:this.getRect(0,0)});return null}static canCreateNewEmptyEditor(){return!1}}Nr=DrawingEditor;function _createDrawOutlines(e){let{drawOutlines:t,drawId:i,drawingOptions:a}=e;draw_classPrivateFieldSet(no,this,t);this._drawingOptions||=a;this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`);if(i>=0){this._drawId=i;this.parent.drawLayer.finalizeDraw(i,t.defaultProperties)}else this._drawId=draw_assertClassBrand(oo,this,_createDrawing).call(this,t,this.parent);draw_assertClassBrand(oo,this,_updateBbox).call(this,t.box)}function _createDrawing(e,t){const{id:i}=t.drawLayer.draw(Nr._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return i}function draw_cleanDrawLayer(){if(null!==this._drawId&&this.parent){this.parent.drawLayer.remove(this._drawId);this._drawId=null;this._drawingOptions.reset()}}function draw_addToDrawLayer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;if(null===this._drawId||this.parent!==e)if(null===this._drawId){this._drawingOptions.updateAll();this._drawId=draw_assertClassBrand(oo,this,_createDrawing).call(this,draw_classPrivateFieldGet(no,this),e)}else this.parent.drawLayer.updateParent(this._drawId,e.drawLayer)}function _convertToParentSpace(e){let[t,i,a,s]=e;const{parentDimensions:[n,r],rotation:o}=this;switch(o){case 90:return[i,1-t,a*(r/n),s*(n/r)];case 180:return[1-t,1-i,a,s];case 270:return[1-i,t,a*(r/n),s*(n/r)];default:return[t,i,a,s]}}function _convertToDrawSpace(){const{x:e,y:t,width:i,height:a,parentDimensions:[s,n],rotation:r}=this;switch(r){case 90:return[1-t,e,i*(s/n),a*(n/s)];case 180:return[1-e,1-t,i,a];case 270:return[t,1-e,i*(s/n),a*(n/s)];default:return[e,t,i,a]}}function _updateBbox(e){[this.x,this.y,this.width,this.height]=draw_assertClassBrand(oo,this,_convertToParentSpace).call(this,e);if(this.div){this.fixAndSetPosition();const[e,t]=this.parentDimensions;this.setDims(this.width*e,this.height*t)}this._onResized()}function _rotateBox(){const{x:e,y:t,width:i,height:a,rotation:s,parentRotation:n,parentDimensions:[r,o]}=this;switch((4*s+n)/90){case 1:return[1-t-a,e,a,i];case 2:return[1-e-i,1-t-a,i,a];case 3:return[t,1-e-i,a,i];case 4:return[e,t-i*(r/o),a*(o/r),i*(r/o)];case 5:return[1-t,e,i*(r/o),a*(o/r)];case 6:return[1-e-a*(o/r),1-t,a*(o/r),i*(r/o)];case 7:return[t-i*(r/o),1-e-a*(o/r),i*(r/o),a*(o/r)];case 8:return[e-i,t-a,i,a];case 9:return[1-t,e-i,a,i];case 10:return[1-e,1-t,i,a];case 11:return[t-a,1-e,a,i];case 12:return[e-a*(o/r),t,a*(o/r),i*(r/o)];case 13:return[1-t-i*(r/o),e-a*(o/r),i*(r/o),a*(o/r)];case 14:return[1-e,1-t-i*(r/o),a*(o/r),i*(r/o)];case 15:return[t,1-e,i*(r/o),a*(o/r)];default:return[e,t,i,a]}}draw_defineProperty(DrawingEditor,"_currentDrawId",-1);draw_defineProperty(DrawingEditor,"_currentParent",null);var lo={_:null},co={_:null},ho={_:null},uo={_:NaN},_o={_:null},po={_:null},go={_:NaN};draw_defineProperty(DrawingEditor,"_INNER_MARGIN",3);function inkdraw_classPrivateMethodInitSpec(e,t){inkdraw_checkPrivateRedeclaration(e,t),t.add(e)}function inkdraw_classPrivateFieldInitSpec(e,t,i){inkdraw_checkPrivateRedeclaration(e,t),t.set(e,i)}function inkdraw_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function inkdraw_classPrivateFieldGet(e,t){return e.get(inkdraw_assertClassBrand(e,t))}function inkdraw_classPrivateFieldSet(e,t,i){return e.set(inkdraw_assertClassBrand(e,t),i),i}function inkdraw_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var fo=new WeakMap,vo=new WeakMap,mo=new WeakMap,wo=new WeakMap,Po=new WeakMap,yo=new WeakMap,Fo=new WeakMap,bo=new WeakMap,So=new WeakMap,xo=new WeakMap,Co=new WeakMap,Ao=new WeakSet;class InkDrawOutliner{constructor(e,t,i,a,s,n){inkdraw_classPrivateMethodInitSpec(this,Ao);inkdraw_classPrivateFieldInitSpec(this,fo,new Float64Array(6));inkdraw_classPrivateFieldInitSpec(this,vo,void 0);inkdraw_classPrivateFieldInitSpec(this,mo,void 0);inkdraw_classPrivateFieldInitSpec(this,wo,void 0);inkdraw_classPrivateFieldInitSpec(this,Po,void 0);inkdraw_classPrivateFieldInitSpec(this,yo,void 0);inkdraw_classPrivateFieldInitSpec(this,Fo,"");inkdraw_classPrivateFieldInitSpec(this,bo,0);inkdraw_classPrivateFieldInitSpec(this,So,new InkDrawOutline);inkdraw_classPrivateFieldInitSpec(this,xo,void 0);inkdraw_classPrivateFieldInitSpec(this,Co,void 0);inkdraw_classPrivateFieldSet(xo,this,i);inkdraw_classPrivateFieldSet(Co,this,a);inkdraw_classPrivateFieldSet(wo,this,s);inkdraw_classPrivateFieldSet(Po,this,n);[e,t]=inkdraw_assertClassBrand(Ao,this,_normalizePoint).call(this,e,t);const r=inkdraw_classPrivateFieldSet(vo,this,[NaN,NaN,NaN,NaN,e,t]);inkdraw_classPrivateFieldSet(yo,this,[e,t]);inkdraw_classPrivateFieldSet(mo,this,[{line:r,points:inkdraw_classPrivateFieldGet(yo,this)}]);inkdraw_classPrivateFieldGet(fo,this).set(r,0)}updateProperty(e,t){"stroke-width"===e&&inkdraw_classPrivateFieldSet(Po,this,t)}isEmpty(){return!inkdraw_classPrivateFieldGet(mo,this)||0===inkdraw_classPrivateFieldGet(mo,this).length}isCancellable(){return inkdraw_classPrivateFieldGet(yo,this).length<=10}add(e,t){[e,t]=inkdraw_assertClassBrand(Ao,this,_normalizePoint).call(this,e,t);const[i,a,s,n]=inkdraw_classPrivateFieldGet(fo,this).subarray(2,6),r=e-s,o=t-n;if(Math.hypot(inkdraw_classPrivateFieldGet(xo,this)*r,inkdraw_classPrivateFieldGet(Co,this)*o)<=2)return null;inkdraw_classPrivateFieldGet(yo,this).push(e,t);if(isNaN(i)){inkdraw_classPrivateFieldGet(fo,this).set([s,n,e,t],2);inkdraw_classPrivateFieldGet(vo,this).push(NaN,NaN,NaN,NaN,e,t);return{path:{d:this.toSVGPath()}}}isNaN(inkdraw_classPrivateFieldGet(fo,this)[0])&&inkdraw_classPrivateFieldGet(vo,this).splice(6,6);inkdraw_classPrivateFieldGet(fo,this).set([i,a,s,n,e,t],0);inkdraw_classPrivateFieldGet(vo,this).push(...Outline.createBezierPoints(i,a,s,n,e,t));return{path:{d:this.toSVGPath()}}}end(e,t){const i=this.add(e,t);return i||(2===inkdraw_classPrivateFieldGet(yo,this).length?{path:{d:this.toSVGPath()}}:null)}startNew(e,t,i,a,s){inkdraw_classPrivateFieldSet(xo,this,i);inkdraw_classPrivateFieldSet(Co,this,a);inkdraw_classPrivateFieldSet(wo,this,s);[e,t]=inkdraw_assertClassBrand(Ao,this,_normalizePoint).call(this,e,t);const n=inkdraw_classPrivateFieldSet(vo,this,[NaN,NaN,NaN,NaN,e,t]);inkdraw_classPrivateFieldSet(yo,this,[e,t]);const r=inkdraw_classPrivateFieldGet(mo,this).at(-1);if(r){r.line=new Float32Array(r.line);r.points=new Float32Array(r.points)}inkdraw_classPrivateFieldGet(mo,this).push({line:n,points:inkdraw_classPrivateFieldGet(yo,this)});inkdraw_classPrivateFieldGet(fo,this).set(n,0);inkdraw_classPrivateFieldSet(bo,this,0);this.toSVGPath();return null}getLastElement(){return inkdraw_classPrivateFieldGet(mo,this).at(-1)}setLastElement(e){if(!inkdraw_classPrivateFieldGet(mo,this))return inkdraw_classPrivateFieldGet(So,this).setLastElement(e);inkdraw_classPrivateFieldGet(mo,this).push(e);inkdraw_classPrivateFieldSet(vo,this,e.line);inkdraw_classPrivateFieldSet(yo,this,e.points);inkdraw_classPrivateFieldSet(bo,this,0);return{path:{d:this.toSVGPath()}}}removeLastElement(){if(!inkdraw_classPrivateFieldGet(mo,this))return inkdraw_classPrivateFieldGet(So,this).removeLastElement();inkdraw_classPrivateFieldGet(mo,this).pop();inkdraw_classPrivateFieldSet(Fo,this,"");for(let e=0,t=inkdraw_classPrivateFieldGet(mo,this).length;e<t;e++){const{line:t,points:i}=inkdraw_classPrivateFieldGet(mo,this)[e];inkdraw_classPrivateFieldSet(vo,this,t);inkdraw_classPrivateFieldSet(yo,this,i);inkdraw_classPrivateFieldSet(bo,this,0);this.toSVGPath()}return{path:{d:inkdraw_classPrivateFieldGet(Fo,this)}}}toSVGPath(){const e=Outline.svgRound(inkdraw_classPrivateFieldGet(vo,this)[4]),t=Outline.svgRound(inkdraw_classPrivateFieldGet(vo,this)[5]);if(2===inkdraw_classPrivateFieldGet(yo,this).length){inkdraw_classPrivateFieldSet(Fo,this,`${inkdraw_classPrivateFieldGet(Fo,this)} M ${e} ${t} Z`);return inkdraw_classPrivateFieldGet(Fo,this)}if(inkdraw_classPrivateFieldGet(yo,this).length<=6){const i=inkdraw_classPrivateFieldGet(Fo,this).lastIndexOf("M");inkdraw_classPrivateFieldSet(Fo,this,`${inkdraw_classPrivateFieldGet(Fo,this).slice(0,i)} M ${e} ${t}`);inkdraw_classPrivateFieldSet(bo,this,6)}if(4===inkdraw_classPrivateFieldGet(yo,this).length){const e=Outline.svgRound(inkdraw_classPrivateFieldGet(vo,this)[10]),t=Outline.svgRound(inkdraw_classPrivateFieldGet(vo,this)[11]);inkdraw_classPrivateFieldSet(Fo,this,`${inkdraw_classPrivateFieldGet(Fo,this)} L ${e} ${t}`);inkdraw_classPrivateFieldSet(bo,this,12);return inkdraw_classPrivateFieldGet(Fo,this)}const i=[];if(0===inkdraw_classPrivateFieldGet(bo,this)){i.push(`M ${e} ${t}`);inkdraw_classPrivateFieldSet(bo,this,6)}for(let e=inkdraw_classPrivateFieldGet(bo,this),t=inkdraw_classPrivateFieldGet(vo,this).length;e<t;e+=6){const[t,a,s,n,r,o]=inkdraw_classPrivateFieldGet(vo,this).slice(e,e+6).map(Outline.svgRound);i.push(`C${t} ${a} ${s} ${n} ${r} ${o}`)}inkdraw_classPrivateFieldSet(Fo,this,inkdraw_classPrivateFieldGet(Fo,this)+i.join(" "));inkdraw_classPrivateFieldSet(bo,this,inkdraw_classPrivateFieldGet(vo,this).length);return inkdraw_classPrivateFieldGet(Fo,this)}getOutlines(e,t,i,a){const s=inkdraw_classPrivateFieldGet(mo,this).at(-1);s.line=new Float32Array(s.line);s.points=new Float32Array(s.points);inkdraw_classPrivateFieldGet(So,this).build(inkdraw_classPrivateFieldGet(mo,this),e,t,i,inkdraw_classPrivateFieldGet(wo,this),inkdraw_classPrivateFieldGet(Po,this),a);inkdraw_classPrivateFieldSet(fo,this,null);inkdraw_classPrivateFieldSet(vo,this,null);inkdraw_classPrivateFieldSet(mo,this,null);inkdraw_classPrivateFieldSet(Fo,this,null);return inkdraw_classPrivateFieldGet(So,this)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}function _normalizePoint(e,t){return Outline._normalizePoint(e,t,inkdraw_classPrivateFieldGet(xo,this),inkdraw_classPrivateFieldGet(Co,this),inkdraw_classPrivateFieldGet(wo,this))}var Eo=new WeakMap,ko=new WeakMap,Io=new WeakMap,Mo=new WeakMap,Bo=new WeakMap,Go=new WeakMap,To=new WeakMap,Do=new WeakMap,Lo=new WeakMap,Ro=new WeakSet;class InkDrawOutline extends Outline{constructor(){super(...arguments);inkdraw_classPrivateMethodInitSpec(this,Ro);inkdraw_classPrivateFieldInitSpec(this,Eo,void 0);inkdraw_classPrivateFieldInitSpec(this,ko,0);inkdraw_classPrivateFieldInitSpec(this,Io,void 0);inkdraw_classPrivateFieldInitSpec(this,Mo,void 0);inkdraw_classPrivateFieldInitSpec(this,Bo,void 0);inkdraw_classPrivateFieldInitSpec(this,Go,void 0);inkdraw_classPrivateFieldInitSpec(this,To,void 0);inkdraw_classPrivateFieldInitSpec(this,Do,void 0);inkdraw_classPrivateFieldInitSpec(this,Lo,void 0)}build(e,t,i,a,s,n,r){inkdraw_classPrivateFieldSet(Bo,this,t);inkdraw_classPrivateFieldSet(Go,this,i);inkdraw_classPrivateFieldSet(To,this,a);inkdraw_classPrivateFieldSet(Do,this,s);inkdraw_classPrivateFieldSet(Lo,this,n);inkdraw_classPrivateFieldSet(Io,this,r??0);inkdraw_classPrivateFieldSet(Mo,this,e);inkdraw_assertClassBrand(Ro,this,_computeBbox).call(this)}get thickness(){return inkdraw_classPrivateFieldGet(Lo,this)}setLastElement(e){inkdraw_classPrivateFieldGet(Mo,this).push(e);return{path:{d:this.toSVGPath()}}}removeLastElement(){inkdraw_classPrivateFieldGet(Mo,this).pop();return{path:{d:this.toSVGPath()}}}toSVGPath(){const e=[];for(const{line:t}of inkdraw_classPrivateFieldGet(Mo,this)){e.push(`M${Outline.svgRound(t[4])} ${Outline.svgRound(t[5])}`);if(6!==t.length)if(12===t.length&&isNaN(t[6]))e.push(`L${Outline.svgRound(t[10])} ${Outline.svgRound(t[11])}`);else for(let i=6,a=t.length;i<a;i+=6){const[a,s,n,r,o,l]=t.subarray(i,i+6).map(Outline.svgRound);e.push(`C${a} ${s} ${n} ${r} ${o} ${l}`)}else e.push("Z")}return e.join("")}serialize(e,t){let[i,a,s,n]=e;const r=[],o=[],[l,d,c,h]=inkdraw_assertClassBrand(Ro,this,_getBBoxWithNoMargin).call(this);let u,_,p,g,f,v,m,w,P;switch(inkdraw_classPrivateFieldGet(Do,this)){case 0:P=Outline._rescale;u=i;_=a+n;p=s;g=-n;f=i+l*s;v=a+(1-d-h)*n;m=i+(l+c)*s;w=a+(1-d)*n;break;case 90:P=Outline._rescaleAndSwap;u=i;_=a;p=s;g=n;f=i+d*s;v=a+l*n;m=i+(d+h)*s;w=a+(l+c)*n;break;case 180:P=Outline._rescale;u=i+s;_=a;p=-s;g=n;f=i+(1-l-c)*s;v=a+d*n;m=i+(1-l)*s;w=a+(d+h)*n;break;case 270:P=Outline._rescaleAndSwap;u=i+s;_=a+n;p=-s;g=-n;f=i+(1-d-h)*s;v=a+(1-l-c)*n;m=i+(1-d)*s;w=a+(1-l)*n}for(const{line:e,points:i}of inkdraw_classPrivateFieldGet(Mo,this)){r.push(P(e,u,_,p,g,t?new Array(e.length):null));o.push(P(i,u,_,p,g,t?new Array(i.length):null))}return{lines:r,points:o,rect:[f,v,m,w]}}static deserialize(e,t,i,a,s,n){let{paths:{lines:r,points:o},rotation:l,thickness:d}=n;const c=[];let h,u,_,p,g;switch(l){case 0:g=Outline._rescale;h=-e/i;u=t/a+1;_=1/i;p=-1/a;break;case 90:g=Outline._rescaleAndSwap;h=-t/a;u=-e/i;_=1/a;p=1/i;break;case 180:g=Outline._rescale;h=e/i+1;u=-t/a;_=-1/i;p=1/a;break;case 270:g=Outline._rescaleAndSwap;h=t/a+1;u=e/i+1;_=-1/a;p=-1/i}if(!r){r=[];for(const e of o){const t=e.length;if(2===t){r.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1]]));continue}if(4===t){r.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1],NaN,NaN,NaN,NaN,e[2],e[3]]));continue}const i=new Float32Array(3*(t-2));r.push(i);let[a,s,n,o]=e.subarray(0,4);i.set([NaN,NaN,NaN,NaN,a,s],0);for(let r=4;r<t;r+=2){const t=e[r],l=e[r+1];i.set(Outline.createBezierPoints(a,s,n,o,t,l),3*(r-2));[a,s,n,o]=[n,o,t,l]}}}for(let e=0,t=r.length;e<t;e++)c.push({line:g(r[e].map((e=>e??NaN)),h,u,_,p),points:g(o[e].map((e=>e??NaN)),h,u,_,p)});const f=new this.prototype.constructor;f.build(c,i,a,1,l,d,s);return f}get box(){return inkdraw_classPrivateFieldGet(Eo,this)}updateProperty(e,t){return"stroke-width"===e?inkdraw_assertClassBrand(Ro,this,inkdraw_updateThickness).call(this,t):null}updateParentDimensions(e,t){let[i,a]=e;const[s,n]=inkdraw_assertClassBrand(Ro,this,_getMarginComponents).call(this);inkdraw_classPrivateFieldSet(Bo,this,i);inkdraw_classPrivateFieldSet(Go,this,a);inkdraw_classPrivateFieldSet(To,this,t);const[r,o]=inkdraw_assertClassBrand(Ro,this,_getMarginComponents).call(this),l=r-s,d=o-n,c=inkdraw_classPrivateFieldGet(Eo,this);c[0]-=l;c[1]-=d;c[2]+=2*l;c[3]+=2*d;return c}updateRotation(e){inkdraw_classPrivateFieldSet(ko,this,e);return{path:{transform:this.rotationTransform}}}get viewBox(){return inkdraw_classPrivateFieldGet(Eo,this).map(Outline.svgRound).join(" ")}get defaultProperties(){const[e,t]=inkdraw_classPrivateFieldGet(Eo,this);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Outline.svgRound(e)} ${Outline.svgRound(t)}`}}}get rotationTransform(){const[,,e,t]=inkdraw_classPrivateFieldGet(Eo,this);let i=0,a=0,s=0,n=0,r=0,o=0;switch(inkdraw_classPrivateFieldGet(ko,this)){case 90:a=t/e;s=-e/t;r=e;break;case 180:i=-1;n=-1;r=e;o=t;break;case 270:a=-t/e;s=e/t;o=t;break;default:return""}return`matrix(${i} ${a} ${s} ${n} ${Outline.svgRound(r)} ${Outline.svgRound(o)})`}getPathResizingSVGProperties(e){let[t,i,a,s]=e;const[n,r]=inkdraw_assertClassBrand(Ro,this,_getMarginComponents).call(this),[o,l,d,c]=inkdraw_classPrivateFieldGet(Eo,this);if(Math.abs(d-n)<=Outline.PRECISION||Math.abs(c-r)<=Outline.PRECISION){const e=t+a/2-(o+d/2),n=i+s/2-(l+c/2);return{path:{"transform-origin":`${Outline.svgRound(t)} ${Outline.svgRound(i)}`,transform:`${this.rotationTransform} translate(${e} ${n})`}}}const h=(a-2*n)/(d-2*n),u=(s-2*r)/(c-2*r),_=d/a,p=c/s;return{path:{"transform-origin":`${Outline.svgRound(o)} ${Outline.svgRound(l)}`,transform:`${this.rotationTransform} scale(${_} ${p}) translate(${Outline.svgRound(n)} ${Outline.svgRound(r)}) scale(${h} ${u}) translate(${Outline.svgRound(-n)} ${Outline.svgRound(-r)})`}}}getPathResizedSVGProperties(e){let[t,i,a,s]=e;const[n,r]=inkdraw_assertClassBrand(Ro,this,_getMarginComponents).call(this),o=inkdraw_classPrivateFieldGet(Eo,this),[l,d,c,h]=o;o[0]=t;o[1]=i;o[2]=a;o[3]=s;if(Math.abs(c-n)<=Outline.PRECISION||Math.abs(h-r)<=Outline.PRECISION){const e=t+a/2-(l+c/2),n=i+s/2-(d+h/2);for(const{line:t,points:i}of inkdraw_classPrivateFieldGet(Mo,this)){Outline._translate(t,e,n,t);Outline._translate(i,e,n,i)}return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Outline.svgRound(t)} ${Outline.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const u=(a-2*n)/(c-2*n),_=(s-2*r)/(h-2*r),p=-u*(l+n)+t+n,g=-_*(d+r)+i+r;if(1!==u||1!==_||0!==p||0!==g)for(const{line:e,points:t}of inkdraw_classPrivateFieldGet(Mo,this)){Outline._rescale(e,p,g,u,_,e);Outline._rescale(t,p,g,u,_,t)}return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Outline.svgRound(t)} ${Outline.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties(e,t){let[i,a]=e;const[s,n]=t,r=inkdraw_classPrivateFieldGet(Eo,this),o=i-r[0],l=a-r[1];if(inkdraw_classPrivateFieldGet(Bo,this)===s&&inkdraw_classPrivateFieldGet(Go,this)===n)for(const{line:e,points:t}of inkdraw_classPrivateFieldGet(Mo,this)){Outline._translate(e,o,l,e);Outline._translate(t,o,l,t)}else{const e=inkdraw_classPrivateFieldGet(Bo,this)/s,t=inkdraw_classPrivateFieldGet(Go,this)/n;inkdraw_classPrivateFieldSet(Bo,this,s);inkdraw_classPrivateFieldSet(Go,this,n);for(const{line:i,points:a}of inkdraw_classPrivateFieldGet(Mo,this)){Outline._rescale(i,o,l,e,t,i);Outline._rescale(a,o,l,e,t,a)}r[2]*=e;r[3]*=t}r[0]=i;r[1]=a;return{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Outline.svgRound(i)} ${Outline.svgRound(a)}`}}}get defaultSVGProperties(){const e=inkdraw_classPrivateFieldGet(Eo,this);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Outline.svgRound(e[0])} ${Outline.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}}function _getMarginComponents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:inkdraw_classPrivateFieldGet(Lo,this);const t=inkdraw_classPrivateFieldGet(Io,this)+e/2*inkdraw_classPrivateFieldGet(To,this);return inkdraw_classPrivateFieldGet(Do,this)%180==0?[t/inkdraw_classPrivateFieldGet(Bo,this),t/inkdraw_classPrivateFieldGet(Go,this)]:[t/inkdraw_classPrivateFieldGet(Go,this),t/inkdraw_classPrivateFieldGet(Bo,this)]}function _getBBoxWithNoMargin(){const[e,t,i,a]=inkdraw_classPrivateFieldGet(Eo,this),[s,n]=inkdraw_assertClassBrand(Ro,this,_getMarginComponents).call(this,0);return[e+s,t+n,i-2*s,a-2*n]}function _computeBbox(){const e=inkdraw_classPrivateFieldSet(Eo,this,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:t}of inkdraw_classPrivateFieldGet(Mo,this)){if(t.length<=12){for(let i=4,a=t.length;i<a;i+=6)Util.pointBoundingBox(t[i],t[i+1],e);continue}let i=t[4],a=t[5];for(let s=6,n=t.length;s<n;s+=6){const[n,r,o,l,d,c]=t.subarray(s,s+6);Util.bezierBoundingBox(i,a,n,r,o,l,d,c,e);i=d;a=c}}const[t,i]=inkdraw_assertClassBrand(Ro,this,_getMarginComponents).call(this);e[0]=MathClamp(e[0]-t,0,1);e[1]=MathClamp(e[1]-i,0,1);e[2]=MathClamp(e[2]+t,0,1);e[3]=MathClamp(e[3]+i,0,1);e[2]-=e[0];e[3]-=e[1]}function inkdraw_updateThickness(e){const[t,i]=inkdraw_assertClassBrand(Ro,this,_getMarginComponents).call(this);inkdraw_classPrivateFieldSet(Lo,this,e);const[a,s]=inkdraw_assertClassBrand(Ro,this,_getMarginComponents).call(this),[n,r]=[a-t,s-i],o=inkdraw_classPrivateFieldGet(Eo,this);o[0]-=n;o[1]-=r;o[2]+=2*n;o[3]+=2*r;return o}function ink_classPrivateMethodInitSpec(e,t){(function ink_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function ink_defineProperty(e,t,i){return(t=function ink_toPropertyKey(e){var t=function ink_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class InkDrawingOptions extends DrawingOptions{constructor(e){super();this._viewParameters=e;super.updateProperties({fill:"none",stroke:AnnotationEditor._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,t){if("stroke-width"===e){t??=this["stroke-width"];t*=this._viewParameters.realScale}super.updateSVGProperty(e,t)}clone(){const e=new InkDrawingOptions(this._viewParameters);e.updateAll(this);return e}}var No,Oo=new WeakSet;class InkEditor extends DrawingEditor{constructor(e){super({...e,name:"inkEditor"});ink_classPrivateMethodInitSpec(this,Oo);this._willKeepAspectRatio=!0;this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,t){AnnotationEditor.initialize(e,t);this._defaultDrawingOptions=new InkDrawingOptions(t.viewParameters)}static getDefaultDrawingOptions(e){const t=this._defaultDrawingOptions.clone();t.updateProperties(e);return t}static get supportMultipleDrawings(){return!0}static get typesMap(){return shadow(this,"typesMap",new Map([[v.INK_THICKNESS,"stroke-width"],[v.INK_COLOR,"stroke"],[v.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,t,i,a,s){return new InkDrawOutliner(e,t,i,a,s,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,t,i,a,s,n){return InkDrawOutline.deserialize(e,t,i,a,s,n)}static async deserialize(e,t,i){let a=null;if(e instanceof InkAnnotationElement){const{data:{inkLists:t,rect:i,rotation:s,id:n,color:r,opacity:o,borderStyle:{rawWidth:l},popupRef:d,contentsObj:c},parent:{page:{pageNumber:h}}}=e;a=e={annotationType:f.INK,color:Array.from(r),thickness:l,opacity:o,paths:{points:t},boxes:null,pageIndex:h-1,rect:i.slice(0),rotation:s,annotationElementId:n,id:n,deleted:!1,popupRef:d,comment:c?.str||null}}const s=await super.deserialize(e,t,i);s._initialData=a;e.comment&&s.setCommentData(e.comment);return s}get toolbarButtons(){this._colorPicker||=new BasicColorPicker(this);return[["colorPicker",this._colorPicker]]}get colorType(){return v.INK_COLOR}get colorValue(){return this._drawingOptions.stroke}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:e,_drawingOptions:t,parent:i}=this;t.updateSVGProperty("stroke-width");i.drawLayer.updateProperties(e,t.toSVGProperties())}static onScaleChangingWhenDrawing(){const e=this._currentParent;if(e){super.onScaleChangingWhenDrawing();this._defaultDrawingOptions.updateSVGProperty("stroke-width");e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties())}}createDrawingOptions(e){let{color:t,thickness:i,opacity:a}=e;this._drawingOptions=InkEditor.getDefaultDrawingOptions({stroke:Util.makeHexColor(...t),"stroke-width":i,"stroke-opacity":a})}serialize(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:t,points:i,rect:a}=this.serializeDraw(e),{_drawingOptions:{stroke:s,"stroke-opacity":n,"stroke-width":r}}=this,o={annotationType:f.INK,color:AnnotationEditor._colorManager.convert(s),opacity:n,thickness:r,paths:{lines:t,points:i},pageIndex:this.pageIndex,rect:a,rotation:this.rotation,structTreeParentId:this._structTreeParentId};this.addComment(o);if(e){o.isCopy=!0;return o}if(this.annotationElementId&&!function ink_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}(Oo,this,ink_hasElementChanged).call(this,o))return null;o.id=this.annotationElementId;return o}renderAnnotationElement(e){const{points:t,rect:i}=this.serializeDraw(!1),a={rect:i,thickness:this._drawingOptions["stroke-width"],points:t};this.hasEditedComment&&(a.popup=this.comment);e.updateEdited(a);return null}}function ink_hasElementChanged(e){const{color:t,thickness:i,opacity:a,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some(((e,i)=>e!==t[i]))||e.thickness!==i||e.opacity!==a||e.pageIndex!==s}ink_defineProperty(InkEditor,"_type","ink");ink_defineProperty(InkEditor,"_editorType",f.INK);ink_defineProperty(InkEditor,"_defaultDrawingOptions",null);class ContourDrawOutline extends InkDrawOutline{toSVGPath(){let e=super.toSVGPath();e.endsWith("Z")||(e+="Z");return e}}function signaturedraw_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}class SignatureExtractor{static extractContoursFromText(e,t,i,a,s,n){let{fontFamily:r,fontStyle:o,fontWeight:l}=t,d=new OffscreenCanvas(1,1),c=d.getContext("2d",{alpha:!1});const h=c.font=`${o} ${l} 200px ${r}`,{actualBoundingBoxLeft:u,actualBoundingBoxRight:_,actualBoundingBoxAscent:p,actualBoundingBoxDescent:g,fontBoundingBoxAscent:f,fontBoundingBoxDescent:v,width:m}=c.measureText(e),w=1.5,P=Math.ceil(Math.max(Math.abs(u)+Math.abs(_)||0,m)*w),y=Math.ceil(Math.max(Math.abs(p)+Math.abs(g)||200,Math.abs(f)+Math.abs(v)||200)*w);d=new OffscreenCanvas(P,y);c=d.getContext("2d",{alpha:!0,willReadFrequently:!0});c.font=h;c.filter="grayscale(1)";c.fillStyle="white";c.fillRect(0,0,P,y);c.fillStyle="black";c.fillText(e,.5*P/2,1.5*y/2);const b=signaturedraw_assertClassBrand(SignatureExtractor,this,_toUint).call(this,c.getImageData(0,0,P,y).data),S=signaturedraw_assertClassBrand(SignatureExtractor,this,_getHistogram).call(this,b),x=signaturedraw_assertClassBrand(SignatureExtractor,this,_guessThreshold).call(this,S),C=signaturedraw_assertClassBrand(SignatureExtractor,this,_findContours).call(this,b,P,y,x);return this.processDrawnLines({lines:{curves:C,width:P,height:y},pageWidth:i,pageHeight:a,rotation:s,innerMargin:n,mustSmooth:!0,areContours:!0})}static process(e,t,i,a,s){const[n,r,o]=signaturedraw_assertClassBrand(SignatureExtractor,this,_getGrayPixels).call(this,e),[l,d]=signaturedraw_assertClassBrand(SignatureExtractor,this,_bilateralFilter).call(this,n,r,o,Math.hypot(r,o)*signaturedraw_assertClassBrand(SignatureExtractor,this,Wo)._.sigmaSFactor,signaturedraw_assertClassBrand(SignatureExtractor,this,Wo)._.sigmaR,signaturedraw_assertClassBrand(SignatureExtractor,this,Wo)._.kernelSize),c=signaturedraw_assertClassBrand(SignatureExtractor,this,_guessThreshold).call(this,d),h=signaturedraw_assertClassBrand(SignatureExtractor,this,_findContours).call(this,l,r,o,c);return this.processDrawnLines({lines:{curves:h,width:r,height:o},pageWidth:t,pageHeight:i,rotation:a,innerMargin:s,mustSmooth:!0,areContours:!0})}static processDrawnLines(e){let{lines:t,pageWidth:i,pageHeight:a,rotation:s,innerMargin:n,mustSmooth:r,areContours:o}=e;s%180!=0&&([i,a]=[a,i]);const{curves:l,width:d,height:c}=t,h=t.thickness??0,u=[],_=Math.min(i/d,a/c),p=_/i,g=_/a,f=[];for(const{points:e}of l){const t=r?signaturedraw_assertClassBrand(SignatureExtractor,this,_douglasPeucker).call(this,e):e;if(!t)continue;f.push(t);const i=t.length,a=new Float32Array(i),s=new Float32Array(3*(2===i?2:i-2));u.push({line:s,points:a});if(2===i){a[0]=t[0]*p;a[1]=t[1]*g;s.set([NaN,NaN,NaN,NaN,a[0],a[1]],0);continue}let[n,o,l,d]=t;n*=p;o*=g;l*=p;d*=g;a.set([n,o,l,d],0);s.set([NaN,NaN,NaN,NaN,n,o],0);for(let e=4;e<i;e+=2){const i=a[e]=t[e]*p,r=a[e+1]=t[e+1]*g;s.set(Outline.createBezierPoints(n,o,l,d,i,r),3*(e-2));[n,o,l,d]=[l,d,i,r]}}if(0===u.length)return null;const v=o?new ContourDrawOutline:new InkDrawOutline;v.build(u,i,a,1,s,o?0:h,n);return{outline:v,newCurves:f,areContours:o,thickness:h,width:d,height:c}}static async compressSignature(e){let t,{outlines:i,areContours:a,thickness:s,width:n,height:r}=e,o=1/0,l=-1/0,d=0;for(const e of i){d+=e.length;for(let t=2,i=e.length;t<i;t++){const i=e[t]-e[t-2];o=Math.min(o,i);l=Math.max(l,i)}}t=o>=-128&&l<=127?Int8Array:o>=-32768&&l<=32767?Int16Array:Int32Array;const c=i.length,h=8+3*c,u=new Uint32Array(h);let _=0;u[_++]=h*Uint32Array.BYTES_PER_ELEMENT+(d-2*c)*t.BYTES_PER_ELEMENT;u[_++]=0;u[_++]=n;u[_++]=r;u[_++]=a?0:1;u[_++]=Math.max(0,Math.floor(s??0));u[_++]=c;u[_++]=t.BYTES_PER_ELEMENT;for(const e of i){u[_++]=e.length-2;u[_++]=e[0];u[_++]=e[1]}const p=new CompressionStream("deflate-raw"),g=p.writable.getWriter();await g.ready;g.write(u);const f=t.prototype.constructor;for(const e of i){const t=new f(e.length-2);for(let i=2,a=e.length;i<a;i++)t[i-2]=e[i]-e[i-2];g.write(t)}g.close();const v=await new Response(p.readable).arrayBuffer();return toBase64Util(new Uint8Array(v))}static async decompressSignature(e){try{const t=function fromBase64Util(e){return Uint8Array.fromBase64?Uint8Array.fromBase64(e):stringToBytes(atob(e))}(e),{readable:i,writable:a}=new DecompressionStream("deflate-raw"),s=a.getWriter();await s.ready;s.write(t).then((async()=>{await s.ready;await s.close()})).catch((()=>{}));let n=null,r=0;for await(const e of i){n||=new Uint8Array(new Uint32Array(e.buffer,0,4)[0]);n.set(e,r);r+=e.length}const o=new Uint32Array(n.buffer,0,n.length>>2),l=o[1];if(0!==l)throw new Error(`Invalid version: ${l}`);const d=o[2],c=o[3],h=0===o[4],u=o[5],_=o[6],p=o[7],g=[],f=(8+3*_)*Uint32Array.BYTES_PER_ELEMENT;let v;switch(p){case Int8Array.BYTES_PER_ELEMENT:v=new Int8Array(n.buffer,f);break;case Int16Array.BYTES_PER_ELEMENT:v=new Int16Array(n.buffer,f);break;case Int32Array.BYTES_PER_ELEMENT:v=new Int32Array(n.buffer,f)}r=0;for(let e=0;e<_;e++){const t=o[3*e+8],i=new Float32Array(t+2);g.push(i);for(let t=0;t<2;t++)i[t]=o[3*e+8+t+1];for(let e=0;e<t;e++)i[e+2]=i[e]+v[r++]}return{areContours:h,thickness:u,outlines:g,width:d,height:c}}catch(e){warn(`decompressSignature: ${e}`);return null}}}No=SignatureExtractor;function _neighborIndexToId(e,t,i,a){a-=t;return 0===(i-=e)?a>0?0:4:1===i?a+6:2-a}function _clockwiseNonZero(e,t,i,a,s,n,r){const o=signaturedraw_assertClassBrand(No,this,_neighborIndexToId).call(this,i,a,s,n);for(let s=0;s<8;s++){const n=(-s+o-r+16)%8;if(0!==e[(i+signaturedraw_assertClassBrand(No,this,jo)._[2*n])*t+(a+signaturedraw_assertClassBrand(No,this,jo)._[2*n+1])])return n}return-1}function _counterClockwiseNonZero(e,t,i,a,s,n,r){const o=signaturedraw_assertClassBrand(No,this,_neighborIndexToId).call(this,i,a,s,n);for(let s=0;s<8;s++){const n=(s+o+r+16)%8;if(0!==e[(i+signaturedraw_assertClassBrand(No,this,jo)._[2*n])*t+(a+signaturedraw_assertClassBrand(No,this,jo)._[2*n+1])])return n}return-1}function _findContours(e,t,i,a){const s=e.length,n=new Int32Array(s);for(let t=0;t<s;t++)n[t]=e[t]<=a?1:0;for(let e=1;e<i-1;e++)n[e*t]=n[e*t+t-1]=0;for(let e=0;e<t;e++)n[e]=n[t*i-1-e]=0;let r,o=1;const l=[];for(let e=1;e<i-1;e++){r=1;for(let i=1;i<t-1;i++){const a=e*t+i,s=n[a];if(0===s)continue;let d=e,c=i;if(1===s&&0===n[a-1]){o+=1;c-=1}else{if(!(s>=1&&0===n[a+1])){1!==s&&(r=Math.abs(s));continue}o+=1;c+=1;s>1&&(r=s)}const h=[i,e],u=c===i+1,_={isHole:u,points:h,id:o,parent:0};l.push(_);let p;for(const e of l)if(e.id===r){p=e;break}p?p.isHole?_.parent=u?p.parent:r:_.parent=u?r:p.parent:_.parent=u?r:0;const g=signaturedraw_assertClassBrand(No,this,_clockwiseNonZero).call(this,n,t,e,i,d,c,0);if(-1===g){n[a]=-o;1!==n[a]&&(r=Math.abs(n[a]));continue}let f=signaturedraw_assertClassBrand(No,this,jo)._[2*g],v=signaturedraw_assertClassBrand(No,this,jo)._[2*g+1];const m=e+f,w=i+v;d=m;c=w;let P=e,y=i;for(;;){const s=signaturedraw_assertClassBrand(No,this,_counterClockwiseNonZero).call(this,n,t,P,y,d,c,1);f=signaturedraw_assertClassBrand(No,this,jo)._[2*s];v=signaturedraw_assertClassBrand(No,this,jo)._[2*s+1];const l=P+f,u=y+v;h.push(u,l);const _=P*t+y;0===n[_+1]?n[_]=-o:1===n[_]&&(n[_]=o);if(l===e&&u===i&&P===m&&y===w){1!==n[a]&&(r=Math.abs(n[a]));break}d=P;c=y;P=l;y=u}}}return l}function _douglasPeuckerHelper(e,t,i,a){if(i-t<=4){for(let s=t;s<i-2;s+=2)a.push(e[s],e[s+1]);return}const s=e[t],n=e[t+1],r=e[i-4]-s,o=e[i-3]-n,l=Math.hypot(r,o),d=r/l,c=o/l,h=d*n-c*s,u=o/r,_=1/l,p=Math.atan(u),g=Math.cos(p),f=Math.sin(p),v=_*(Math.abs(g)+Math.abs(f)),m=_*(1-v+v**2),w=Math.max(Math.atan(Math.abs(f+g)*m),Math.atan(Math.abs(f-g)*m));let P=0,y=t;for(let a=t+2;a<i-2;a+=2){const t=Math.abs(h-d*e[a+1]+c*e[a]);if(t>P){y=a;P=t}}if(P>(l*w)**2){signaturedraw_assertClassBrand(No,this,_douglasPeuckerHelper).call(this,e,t,y+2,a);signaturedraw_assertClassBrand(No,this,_douglasPeuckerHelper).call(this,e,y,i,a)}else a.push(s,n)}function _douglasPeucker(e){const t=[],i=e.length;signaturedraw_assertClassBrand(No,this,_douglasPeuckerHelper).call(this,e,0,i,t);t.push(e[i-2],e[i-1]);return t.length<=4?null:t}function _bilateralFilter(e,t,i,a,s,n){const r=new Float32Array(n**2),o=-2*a**2,l=n>>1;for(let e=0;e<n;e++){const t=(e-l)**2;for(let i=0;i<n;i++)r[e*n+i]=Math.exp((t+(i-l)**2)/o)}const d=new Float32Array(256),c=-2*s**2;for(let e=0;e<256;e++)d[e]=Math.exp(e**2/c);const h=e.length,u=new Uint8Array(h),_=new Uint32Array(256);for(let a=0;a<i;a++)for(let s=0;s<t;s++){const o=a*t+s,c=e[o];let h=0,p=0;for(let o=0;o<n;o++){const u=a+o-l;if(!(u<0||u>=i))for(let i=0;i<n;i++){const a=s+i-l;if(a<0||a>=t)continue;const _=e[u*t+a],g=r[o*n+i]*d[Math.abs(_-c)];h+=_*g;p+=g}}_[u[o]=Math.round(h/p)]++}return[u,_]}function _getHistogram(e){const t=new Uint32Array(256);for(const i of e)t[i]++;return t}function _toUint(e){const t=e.length,i=new Uint8ClampedArray(t>>2);let a=-1/0,s=1/0;for(let t=0,n=i.length;t<n;t++){const n=i[t]=e[t<<2];a=Math.max(a,n);s=Math.min(s,n)}const n=255/(a-s);for(let e=0,t=i.length;e<t;e++)i[e]=(i[e]-s)*n;return i}function _guessThreshold(e){let t,i=-1/0,a=-1/0;const s=e.findIndex((e=>0!==e));let n=s,r=s;for(t=s;t<256;t++){const s=e[t];if(s>i){if(t-n>a){a=t-n;r=t-1}i=s;n=t}}for(t=r-1;t>=0&&!(e[t]>e[t+1]);t--);return t}function _getGrayPixels(e){const t=e,{width:i,height:a}=e,{maxDim:s}=signaturedraw_assertClassBrand(No,this,Wo)._;let n=i,r=a;if(i>s||a>s){let o=i,l=a,d=Math.log2(Math.max(i,a)/s);const c=Math.floor(d);d=d===c?c-1:c;for(let i=0;i<d;i++){n=Math.ceil(o/2);r=Math.ceil(l/2);const i=new OffscreenCanvas(n,r);i.getContext("2d").drawImage(e,0,0,o,l,0,0,n,r);o=n;l=r;e!==t&&e.close();e=i.transferToImageBitmap()}const h=Math.min(s/n,s/r);n=Math.round(n*h);r=Math.round(r*h)}const o=new OffscreenCanvas(n,r).getContext("2d",{willReadFrequently:!0});o.fillStyle="white";o.fillRect(0,0,n,r);o.filter="grayscale(1)";o.drawImage(e,0,0,e.width,e.height,0,0,n,r);const l=o.getImageData(0,0,n,r).data;return[signaturedraw_assertClassBrand(No,this,_toUint).call(this,l),n,r]}var Wo={_:{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}},jo={_:new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1])};function signature_defineProperty(e,t,i){return(t=function signature_toPropertyKey(e){var t=function signature_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function signature_classPrivateFieldInitSpec(e,t,i){(function signature_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function signature_classPrivateFieldGet(e,t){return e.get(signature_assertClassBrand(e,t))}function signature_classPrivateFieldSet(e,t,i){return e.set(signature_assertClassBrand(e,t),i),i}function signature_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}class SignatureOptions extends DrawingOptions{constructor(){super();super.updateProperties({fill:AnnotationEditor._defaultLineColor,"stroke-width":0})}clone(){const e=new SignatureOptions;e.updateAll(this);return e}}class DrawnSignatureOptions extends InkDrawingOptions{constructor(e){super(e);super.updateProperties({stroke:AnnotationEditor._defaultLineColor,"stroke-width":1})}clone(){const e=new DrawnSignatureOptions(this._viewParameters);e.updateAll(this);return e}}var Vo=new WeakMap,Ho=new WeakMap,zo=new WeakMap,Uo=new WeakMap;class SignatureEditor extends DrawingEditor{constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"});signature_classPrivateFieldInitSpec(this,Vo,!1);signature_classPrivateFieldInitSpec(this,Ho,null);signature_classPrivateFieldInitSpec(this,zo,null);signature_classPrivateFieldInitSpec(this,Uo,null);this._willKeepAspectRatio=!0;signature_classPrivateFieldSet(zo,this,e.signatureData||null);signature_classPrivateFieldSet(Ho,this,null);this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,t){AnnotationEditor.initialize(e,t);this._defaultDrawingOptions=new SignatureOptions;this._defaultDrawnSignatureOptions=new DrawnSignatureOptions(t.viewParameters)}static getDefaultDrawingOptions(e){const t=this._defaultDrawingOptions.clone();t.updateProperties(e);return t}static get supportMultipleDrawings(){return!1}static get typesMap(){return shadow(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!signature_classPrivateFieldGet(Ho,this)}}static computeTelemetryFinalData(e){const t=e.get("hasDescription");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){null!==this._drawId&&super.onScaleChanging()}render(){if(this.div)return this.div;let e,t;const{_isCopy:i}=this;if(i){this._isCopy=!1;e=this.x;t=this.y}super.render();if(null===this._drawId)if(signature_classPrivateFieldGet(zo,this)){const{lines:e,mustSmooth:t,areContours:i,description:a,uuid:s,heightInPage:n}=signature_classPrivateFieldGet(zo,this),{rawDims:{pageWidth:r,pageHeight:o},rotation:l}=this.parent.viewport,d=SignatureExtractor.processDrawnLines({lines:e,pageWidth:r,pageHeight:o,rotation:l,innerMargin:SignatureEditor._INNER_MARGIN,mustSmooth:t,areContours:i});this.addSignature(d,n,a,s)}else{this.div.setAttribute("data-l10n-args",JSON.stringify({description:""}));this.div.hidden=!0;this._uiManager.getSignature(this)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:signature_classPrivateFieldGet(Ho,this)||""}));if(i){this._isCopy=!0;this._moveAfterPaste(e,t)}return this.div}setUuid(e){signature_classPrivateFieldSet(Uo,this,e);this.addEditToolbar()}getUuid(){return signature_classPrivateFieldGet(Uo,this)}get description(){return signature_classPrivateFieldGet(Ho,this)}set description(e){signature_classPrivateFieldSet(Ho,this,e);if(this.div){this.div.setAttribute("data-l10n-args",JSON.stringify({description:e}));super.addEditToolbar().then((t=>{t?.updateEditSignatureButton(e)}))}}getSignaturePreview(){const{newCurves:e,areContours:t,thickness:i,width:a,height:s}=signature_classPrivateFieldGet(zo,this),n=Math.max(a,s);return{areContours:t,outline:SignatureExtractor.processDrawnLines({lines:{curves:e.map((e=>({points:e}))),thickness:i,width:a,height:s},pageWidth:n,pageHeight:n,rotation:0,innerMargin:0,mustSmooth:!1,areContours:t}).outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,t,i,a){const{x:s,y:n}=this,{outline:r}=signature_classPrivateFieldSet(zo,this,e);signature_classPrivateFieldSet(Vo,this,r instanceof ContourDrawOutline);this.description=i;let o;if(signature_classPrivateFieldGet(Vo,this))o=SignatureEditor.getDefaultDrawingOptions();else{o=SignatureEditor._defaultDrawnSignatureOptions.clone();o.updateProperties({"stroke-width":r.thickness})}this._addOutlines({drawOutlines:r,drawingOptions:o});const[l,d]=this.parentDimensions,[,c]=this.pageDimensions;let h=t/c;h=h>=1?.5:h;this.width*=h/this.height;if(this.width>=1){h*=.9/this.width;this.width=.9}this.height=h;this.setDims(l*this.width,d*this.height);this.x=s;this.y=n;this.center();this._onResized();this.onScaleChanging();this.rotate();this._uiManager.addToAnnotationStorage(this);this.setUuid(a);this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!a,hasDescription:!!i}});this.div.hidden=!1}getFromImage(e){const{rawDims:{pageWidth:t,pageHeight:i},rotation:a}=this.parent.viewport;return SignatureExtractor.process(e,t,i,a,SignatureEditor._INNER_MARGIN)}getFromText(e,t){const{rawDims:{pageWidth:i,pageHeight:a},rotation:s}=this.parent.viewport;return SignatureExtractor.extractContoursFromText(e,t,i,a,s,SignatureEditor._INNER_MARGIN)}getDrawnSignature(e){const{rawDims:{pageWidth:t,pageHeight:i},rotation:a}=this.parent.viewport;return SignatureExtractor.processDrawnLines({lines:e,pageWidth:t,pageHeight:i,rotation:a,innerMargin:SignatureEditor._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions(e){let{areContours:t,thickness:i}=e;if(t)this._drawingOptions=SignatureEditor.getDefaultDrawingOptions();else{this._drawingOptions=SignatureEditor._defaultDrawnSignatureOptions.clone();this._drawingOptions.updateProperties({"stroke-width":i})}}serialize(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;const{lines:t,points:i,rect:a}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":s}}=this,n={annotationType:f.SIGNATURE,isSignature:!0,areContours:signature_classPrivateFieldGet(Vo,this),color:[0,0,0],thickness:signature_classPrivateFieldGet(Vo,this)?0:s,pageIndex:this.pageIndex,rect:a,rotation:this.rotation,structTreeParentId:this._structTreeParentId};this.addComment(n);if(e){n.paths={lines:t,points:i};n.uuid=signature_classPrivateFieldGet(Uo,this);n.isCopy=!0}else n.lines=t;signature_classPrivateFieldGet(Ho,this)&&(n.accessibilityData={type:"Figure",alt:signature_classPrivateFieldGet(Ho,this)});return n}static deserializeDraw(e,t,i,a,s,n){return n.areContours?ContourDrawOutline.deserialize(e,t,i,a,s,n):InkDrawOutline.deserialize(e,t,i,a,s,n)}static async deserialize(e,t,i){const a=await super.deserialize(e,t,i);signature_classPrivateFieldSet(Vo,a,e.areContours);a.description=e.accessibilityData?.alt||"";signature_classPrivateFieldSet(Uo,a,e.uuid);return a}}signature_defineProperty(SignatureEditor,"_type","signature");signature_defineProperty(SignatureEditor,"_editorType",f.SIGNATURE);signature_defineProperty(SignatureEditor,"_defaultDrawingOptions",null);function stamp_defineProperty(e,t,i){return(t=function stamp_toPropertyKey(e){var t=function stamp_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function stamp_classPrivateFieldInitSpec(e,t,i){stamp_checkPrivateRedeclaration(e,t),t.set(e,i)}function stamp_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function stamp_classPrivateFieldGet(e,t){return e.get(stamp_assertClassBrand(e,t))}function stamp_classPrivateFieldSet(e,t,i){return e.set(stamp_assertClassBrand(e,t),i),i}function stamp_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var $o=new WeakMap,qo=new WeakMap,Xo=new WeakMap,Ko=new WeakMap,Yo=new WeakMap,Zo=new WeakMap,Qo=new WeakMap,Jo=new WeakMap,el=new WeakMap,tl=new WeakMap,il=new WeakMap,al=new WeakSet;class StampEditor extends AnnotationEditor{constructor(e){super({...e,name:"stampEditor"});!function stamp_classPrivateMethodInitSpec(e,t){stamp_checkPrivateRedeclaration(e,t),t.add(e)}(this,al);stamp_classPrivateFieldInitSpec(this,$o,null);stamp_classPrivateFieldInitSpec(this,qo,null);stamp_classPrivateFieldInitSpec(this,Xo,null);stamp_classPrivateFieldInitSpec(this,Ko,null);stamp_classPrivateFieldInitSpec(this,Yo,null);stamp_classPrivateFieldInitSpec(this,Zo,"");stamp_classPrivateFieldInitSpec(this,Qo,null);stamp_classPrivateFieldInitSpec(this,Jo,!1);stamp_classPrivateFieldInitSpec(this,el,null);stamp_classPrivateFieldInitSpec(this,tl,!1);stamp_classPrivateFieldInitSpec(this,il,!1);stamp_classPrivateFieldSet(Ko,this,e.bitmapUrl);stamp_classPrivateFieldSet(Yo,this,e.bitmapFile);this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,t){AnnotationEditor.initialize(e,t)}static isHandlingMimeForPasting(e){return K.includes(e)}static paste(e,t){t.pasteEditor({mode:f.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1);super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){const t=e.get("hasAltText");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}async mlGuessAltText(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:a,width:s,height:n}=e||this.copyCanvas(null,null,!0).imageData,r=await i.guess({name:"altText",request:{data:a,width:s,height:n,channels:a.length/(s*n)}});if(!r)throw new Error("No response from the AI service.");if(r.error)throw new Error("Error from the AI service.");if(r.cancel)return null;if(!r.output)throw new Error("No valid response from the AI service.");const o=r.output;await this.setGuessedAltText(o);t&&!this.hasAltTextData()&&(this.altTextData={alt:o,decorative:!1});return o}remove(){if(stamp_classPrivateFieldGet(qo,this)){stamp_classPrivateFieldSet($o,this,null);this._uiManager.imageManager.deleteId(stamp_classPrivateFieldGet(qo,this));stamp_classPrivateFieldGet(Qo,this)?.remove();stamp_classPrivateFieldSet(Qo,this,null);if(stamp_classPrivateFieldGet(el,this)){clearTimeout(stamp_classPrivateFieldGet(el,this));stamp_classPrivateFieldSet(el,this,null)}}super.remove()}rebuild(){if(this.parent){super.rebuild();if(null!==this.div){stamp_classPrivateFieldGet(qo,this)&&null===stamp_classPrivateFieldGet(Qo,this)&&stamp_assertClassBrand(al,this,_getBitmap).call(this);this.isAttachedToDOM||this.parent.add(this)}}else stamp_classPrivateFieldGet(qo,this)&&stamp_assertClassBrand(al,this,_getBitmap).call(this)}onceAdded(e){this._isDraggable=!0;e&&this.div.focus()}isEmpty(){return!(stamp_classPrivateFieldGet(Xo,this)||stamp_classPrivateFieldGet($o,this)||stamp_classPrivateFieldGet(Ko,this)||stamp_classPrivateFieldGet(Yo,this)||stamp_classPrivateFieldGet(qo,this)||stamp_classPrivateFieldGet(Jo,this))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;if(this._isCopy){e=this.x;t=this.y}super.render();this.div.hidden=!0;this.createAltText();stamp_classPrivateFieldGet(Jo,this)||(stamp_classPrivateFieldGet($o,this)?stamp_assertClassBrand(al,this,_createCanvas).call(this):stamp_assertClassBrand(al,this,_getBitmap).call(this));this._isCopy&&this._moveAfterPaste(e,t);this._uiManager.addShouldRescale(this);return this.div}setCanvas(e,t){const{id:i,bitmap:a}=this._uiManager.imageManager.getFromCanvas(e,t);t.remove();if(i&&this._uiManager.imageManager.isValidId(i)){stamp_classPrivateFieldSet(qo,this,i);a&&stamp_classPrivateFieldSet($o,this,a);stamp_classPrivateFieldSet(Jo,this,!1);stamp_assertClassBrand(al,this,_createCanvas).call(this)}}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;null!==stamp_classPrivateFieldGet(el,this)&&clearTimeout(stamp_classPrivateFieldGet(el,this));stamp_classPrivateFieldSet(el,this,setTimeout((()=>{stamp_classPrivateFieldSet(el,this,null);stamp_assertClassBrand(al,this,_drawBitmap).call(this)}),200))}copyCanvas(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e||(e=224);const{width:a,height:s}=stamp_classPrivateFieldGet($o,this),n=new OutputScale;let r=stamp_classPrivateFieldGet($o,this),o=a,l=s,d=null;if(t){if(a>t||s>t){const e=Math.min(t/a,t/s);o=Math.floor(a*e);l=Math.floor(s*e)}d=document.createElement("canvas");const e=d.width=Math.ceil(o*n.sx),i=d.height=Math.ceil(l*n.sy);stamp_classPrivateFieldGet(tl,this)||(r=stamp_assertClassBrand(al,this,_scaleBitmap).call(this,e,i));const c=d.getContext("2d");c.filter=this._uiManager.hcmFilter;let h="white",u="#cfcfd8";if("none"!==this._uiManager.hcmFilter)u="black";else if(window.matchMedia?.("(prefers-color-scheme: dark)").matches){h="#8f8f9d";u="#42414d"}const _=15,p=_*n.sx,g=_*n.sy,f=new OffscreenCanvas(2*p,2*g),v=f.getContext("2d");v.fillStyle=h;v.fillRect(0,0,2*p,2*g);v.fillStyle=u;v.fillRect(0,0,p,g);v.fillRect(p,g,p,g);c.fillStyle=c.createPattern(f,"repeat");c.fillRect(0,0,e,i);c.drawImage(r,0,0,r.width,r.height,0,0,e,i)}let c=null;if(i){let t,i;if(n.symmetric&&r.width<e&&r.height<e){t=r.width;i=r.height}else{r=stamp_classPrivateFieldGet($o,this);if(a>e||s>e){const n=Math.min(e/a,e/s);t=Math.floor(a*n);i=Math.floor(s*n);stamp_classPrivateFieldGet(tl,this)||(r=stamp_assertClassBrand(al,this,_scaleBitmap).call(this,t,i))}}const o=new OffscreenCanvas(t,i).getContext("2d",{willReadFrequently:!0});o.drawImage(r,0,0,r.width,r.height,0,0,t,i);c={width:t,height:i,data:o.getImageData(0,0,t,i).data}}return{canvas:d,width:o,height:l,imageData:c}}static async deserialize(e,t,i){let a=null,s=!1;if(e instanceof StampAnnotationElement){const{data:{rect:n,rotation:r,id:o,structParent:l,popupRef:d,contentsObj:c},container:h,parent:{page:{pageNumber:u}},canvas:_}=e;let p,g;if(_){delete e.canvas;({id:p,bitmap:g}=i.imageManager.getFromCanvas(h.id,_));_.remove()}else{s=!0;e._hasNoCanvas=!0}const v=(await t._structTree.getAriaAttributes(`${U}${o}`))?.get("aria-label")||"";a=e={annotationType:f.STAMP,bitmapId:p,bitmap:g,pageIndex:u-1,rect:n.slice(0),rotation:r,annotationElementId:o,id:o,deleted:!1,accessibilityData:{decorative:!1,altText:v},isSvg:!1,structParent:l,popupRef:d,comment:c?.str||null}}const n=await super.deserialize(e,t,i),{rect:r,bitmap:o,bitmapUrl:l,bitmapId:d,isSvg:c,accessibilityData:h}=e;if(s){i.addMissingCanvas(e.id,n);stamp_classPrivateFieldSet(Jo,n,!0)}else if(d&&i.imageManager.isValidId(d)){stamp_classPrivateFieldSet(qo,n,d);o&&stamp_classPrivateFieldSet($o,n,o)}else stamp_classPrivateFieldSet(Ko,n,l);stamp_classPrivateFieldSet(tl,n,c);const[u,_]=n.pageDimensions;n.width=(r[2]-r[0])/u;n.height=(r[3]-r[1])/_;h&&(n.altTextData=h);n._initialData=a;e.comment&&n.setCommentData(e.comment);stamp_classPrivateFieldSet(il,n,!!a);return n}serialize(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i={annotationType:f.STAMP,bitmapId:stamp_classPrivateFieldGet(qo,this),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:stamp_classPrivateFieldGet(tl,this),structTreeParentId:this._structTreeParentId};this.addComment(i);if(e){i.bitmapUrl=stamp_assertClassBrand(al,this,_serializeBitmap).call(this,!0);i.accessibilityData=this.serializeAltText(!0);i.isCopy=!0;return i}const{decorative:a,altText:s}=this.serializeAltText(!1);!a&&s&&(i.accessibilityData={type:"Figure",alt:s});if(this.annotationElementId){const e=stamp_assertClassBrand(al,this,stamp_hasElementChanged).call(this,i);if(e.isSame)return null;e.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1}i.id=this.annotationElementId;if(null===t)return i;t.stamps||=new Map;const n=stamp_classPrivateFieldGet(tl,this)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(t.stamps.has(stamp_classPrivateFieldGet(qo,this))){if(stamp_classPrivateFieldGet(tl,this)){const e=t.stamps.get(stamp_classPrivateFieldGet(qo,this));if(n>e.area){e.area=n;e.serialized.bitmap.close();e.serialized.bitmap=stamp_assertClassBrand(al,this,_serializeBitmap).call(this,!1)}}}else{t.stamps.set(stamp_classPrivateFieldGet(qo,this),{area:n,serialized:i});i.bitmap=stamp_assertClassBrand(al,this,_serializeBitmap).call(this,!1)}return i}renderAnnotationElement(e){const t={rect:this.getRect(0,0)};this.hasEditedComment&&(t.popup=this.comment);e.updateEdited(t);return null}}function _getBitmapFetched(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e){stamp_classPrivateFieldSet($o,this,e.bitmap);if(!t){stamp_classPrivateFieldSet(qo,this,e.id);stamp_classPrivateFieldSet(tl,this,e.isSvg)}e.file&&stamp_classPrivateFieldSet(Zo,this,e.file.name);stamp_assertClassBrand(al,this,_createCanvas).call(this)}else this.remove()}function _getBitmapDone(){stamp_classPrivateFieldSet(Xo,this,null);this._uiManager.enableWaiting(!1);if(stamp_classPrivateFieldGet(Qo,this))if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&stamp_classPrivateFieldGet($o,this))this.addEditToolbar().then((()=>{this._editToolbar.hide();this._uiManager.editAltText(this,!0)}));else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&stamp_classPrivateFieldGet($o,this)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}function _getBitmap(){if(stamp_classPrivateFieldGet(qo,this)){this._uiManager.enableWaiting(!0);this._uiManager.imageManager.getFromId(stamp_classPrivateFieldGet(qo,this)).then((e=>stamp_assertClassBrand(al,this,_getBitmapFetched).call(this,e,!0))).finally((()=>stamp_assertClassBrand(al,this,_getBitmapDone).call(this)));return}if(stamp_classPrivateFieldGet(Ko,this)){const e=stamp_classPrivateFieldGet(Ko,this);stamp_classPrivateFieldSet(Ko,this,null);this._uiManager.enableWaiting(!0);stamp_classPrivateFieldSet(Xo,this,this._uiManager.imageManager.getFromUrl(e).then((e=>stamp_assertClassBrand(al,this,_getBitmapFetched).call(this,e))).finally((()=>stamp_assertClassBrand(al,this,_getBitmapDone).call(this))));return}if(stamp_classPrivateFieldGet(Yo,this)){const e=stamp_classPrivateFieldGet(Yo,this);stamp_classPrivateFieldSet(Yo,this,null);this._uiManager.enableWaiting(!0);stamp_classPrivateFieldSet(Xo,this,this._uiManager.imageManager.getFromFile(e).then((e=>stamp_assertClassBrand(al,this,_getBitmapFetched).call(this,e))).finally((()=>stamp_assertClassBrand(al,this,_getBitmapDone).call(this))));return}const e=document.createElement("input");e.type="file";e.accept=K.join(",");const t=this._uiManager._signal;stamp_classPrivateFieldSet(Xo,this,new Promise((i=>{e.addEventListener("change",(async()=>{if(e.files&&0!==e.files.length){this._uiManager.enableWaiting(!0);const t=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}});stamp_assertClassBrand(al,this,_getBitmapFetched).call(this,t)}else this.remove();i()}),{signal:t});e.addEventListener("cancel",(()=>{this.remove();i()}),{signal:t})})).finally((()=>stamp_assertClassBrand(al,this,_getBitmapDone).call(this))));e.click()}function _createCanvas(){const{div:e}=this;let{width:t,height:i}=stamp_classPrivateFieldGet($o,this);const[a,s]=this.pageDimensions,n=.75;if(this.width){t=this.width*a;i=this.height*s}else if(t>n*a||i>n*s){const e=Math.min(n*a/t,n*s/i);t*=e;i*=e}const[r,o]=this.parentDimensions;this.setDims(t*r/a,i*o/s);this._uiManager.enableWaiting(!1);const l=stamp_classPrivateFieldSet(Qo,this,document.createElement("canvas"));l.setAttribute("role","img");this.addContainer(l);this.width=t/a;this.height=i/s;this._initialOptions?.isCentered?this.center():this.fixAndSetPosition();this._initialOptions=null;this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(e.hidden=!1);stamp_assertClassBrand(al,this,_drawBitmap).call(this);if(!stamp_classPrivateFieldGet(il,this)){this.parent.addUndoableEditor(this);stamp_classPrivateFieldSet(il,this,!0)}this._reportTelemetry({action:"inserted_image"});this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"imageAdded",page:this.pageIndex+1,editorType:this.constructor.name,value:l,width:t,height:i,fileName:stamp_classPrivateFieldGet(Zo,this)});stamp_classPrivateFieldGet(Zo,this)&&this.div.setAttribute("aria-description",stamp_classPrivateFieldGet(Zo,this));this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")}function _scaleBitmap(e,t){const{width:i,height:a}=stamp_classPrivateFieldGet($o,this);let s=i,n=a,r=stamp_classPrivateFieldGet($o,this);for(;s>2*e||n>2*t;){const i=s,a=n;s>2*e&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2));n>2*t&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2));const o=new OffscreenCanvas(s,n);o.getContext("2d").drawImage(r,0,0,i,a,0,0,s,n);r=o.transferToImageBitmap()}return r}function _drawBitmap(){const[e,t]=this.parentDimensions,{width:i,height:a}=this,s=new OutputScale,n=Math.ceil(i*e*s.sx),r=Math.ceil(a*t*s.sy),o=stamp_classPrivateFieldGet(Qo,this);if(!o||o.width===n&&o.height===r)return;o.width=n;o.height=r;const l=stamp_classPrivateFieldGet(tl,this)?stamp_classPrivateFieldGet($o,this):stamp_assertClassBrand(al,this,_scaleBitmap).call(this,n,r),d=o.getContext("2d");d.filter=this._uiManager.hcmFilter;d.drawImage(l,0,0,l.width,l.height,0,0,n,r)}function _serializeBitmap(e){if(e){if(stamp_classPrivateFieldGet(tl,this)){const e=this._uiManager.imageManager.getSvgUrl(stamp_classPrivateFieldGet(qo,this));if(e)return e}const e=document.createElement("canvas");({width:e.width,height:e.height}=stamp_classPrivateFieldGet($o,this));e.getContext("2d").drawImage(stamp_classPrivateFieldGet($o,this),0,0);return e.toDataURL()}if(stamp_classPrivateFieldGet(tl,this)){const[e,t]=this.pageDimensions,i=Math.round(this.width*e*PixelsPerInch.PDF_TO_CSS_UNITS),a=Math.round(this.height*t*PixelsPerInch.PDF_TO_CSS_UNITS),s=new OffscreenCanvas(i,a);s.getContext("2d").drawImage(stamp_classPrivateFieldGet($o,this),0,0,stamp_classPrivateFieldGet($o,this).width,stamp_classPrivateFieldGet($o,this).height,0,0,i,a);return s.transferToImageBitmap()}return structuredClone(stamp_classPrivateFieldGet($o,this))}function stamp_hasElementChanged(e){const{pageIndex:t,accessibilityData:{altText:i}}=this._initialData,a=e.pageIndex===t,s=(e.accessibilityData?.alt||"")===i;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&a&&s,isSameAltText:s}}stamp_defineProperty(StampEditor,"_type","stamp");stamp_defineProperty(StampEditor,"_editorType",f.STAMP);function annotation_editor_layer_classPrivateFieldInitSpec(e,t,i){annotation_editor_layer_checkPrivateRedeclaration(e,t),t.set(e,i)}function annotation_editor_layer_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function annotation_editor_layer_classPrivateGetter(e,t,i){return i(annotation_editor_layer_assertClassBrand(e,t))}function annotation_editor_layer_classPrivateFieldGet(e,t){return e.get(annotation_editor_layer_assertClassBrand(e,t))}function annotation_editor_layer_classPrivateFieldSet(e,t,i){return e.set(annotation_editor_layer_assertClassBrand(e,t),i),i}function annotation_editor_layer_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function annotation_editor_layer_defineProperty(e,t,i){return(t=function annotation_editor_layer_toPropertyKey(e){var t=function annotation_editor_layer_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class PointerType{constructor(e){if(null===PointerType.current){PointerType.current="";window.addEventListener("pointerdown",this.windowPointerDown,!0)}}destroy(){if(null!==PointerType.current){window.removeEventListener("pointerdown",this.windowPointerDown,!0);PointerType.current=null}}windowPointerDown(e){PointerType.current=e.pointerType;return!0}static initializeEditor(){setTimeout((()=>PointerType.editor=PointerType.current))}static sameAsEditor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return e?PointerType.editor==e:PointerType.editor==PointerType.current}}annotation_editor_layer_defineProperty(PointerType,"current",null);annotation_editor_layer_defineProperty(PointerType,"editor",null);new PointerType;var sl=new WeakMap,nl=new WeakMap,rl=new WeakMap,ol=new WeakMap,ll=new WeakMap,dl=new WeakMap,cl=new WeakMap,hl=new WeakMap,ul=new WeakMap,_l=new WeakMap,pl=new WeakMap,gl=new WeakMap,fl=new WeakMap,vl=new WeakMap,ml=new WeakMap,wl=new WeakMap,Pl=new WeakSet;class AnnotationEditorLayer{constructor(e){let{uiManager:t,pageIndex:i,div:a,structTreeLayer:s,accessibilityManager:n,annotationLayer:r,drawLayer:o,textLayer:l,viewport:d,l10n:c,eventBus:h}=e;!function annotation_editor_layer_classPrivateMethodInitSpec(e,t){annotation_editor_layer_checkPrivateRedeclaration(e,t),t.add(e)}(this,Pl);annotation_editor_layer_classPrivateFieldInitSpec(this,sl,void 0);annotation_editor_layer_classPrivateFieldInitSpec(this,nl,!1);annotation_editor_layer_classPrivateFieldInitSpec(this,rl,null);annotation_editor_layer_classPrivateFieldInitSpec(this,ol,null);annotation_editor_layer_classPrivateFieldInitSpec(this,ll,null);annotation_editor_layer_classPrivateFieldInitSpec(this,dl,new Map);annotation_editor_layer_classPrivateFieldInitSpec(this,cl,!1);annotation_editor_layer_classPrivateFieldInitSpec(this,hl,!1);annotation_editor_layer_classPrivateFieldInitSpec(this,ul,!1);annotation_editor_layer_classPrivateFieldInitSpec(this,_l,null);annotation_editor_layer_classPrivateFieldInitSpec(this,pl,null);annotation_editor_layer_classPrivateFieldInitSpec(this,gl,null);annotation_editor_layer_classPrivateFieldInitSpec(this,fl,null);annotation_editor_layer_classPrivateFieldInitSpec(this,vl,null);annotation_editor_layer_classPrivateFieldInitSpec(this,ml,-1);annotation_editor_layer_classPrivateFieldInitSpec(this,wl,void 0);const u=[...Fl._.values()];if(!AnnotationEditorLayer._initialized){AnnotationEditorLayer._initialized=!0;for(const e of u){e.eventBus=h;e.initialize(c,t)}}t.registerEditorTypes(u);annotation_editor_layer_classPrivateFieldSet(wl,this,t);this.pageIndex=i;this.div=a;annotation_editor_layer_classPrivateFieldSet(sl,this,n);annotation_editor_layer_classPrivateFieldSet(rl,this,r);this.viewport=d;annotation_editor_layer_classPrivateFieldSet(gl,this,l);this.drawLayer=o;this._structTree=s;annotation_editor_layer_classPrivateFieldGet(wl,this).addLayer(this);this.eventBus=h}get isEmpty(){return 0===annotation_editor_layer_classPrivateFieldGet(dl,this).size}get isInvisible(){return this.isEmpty&&annotation_editor_layer_classPrivateFieldGet(wl,this).getMode()===f.NONE}updateToolbar(e){annotation_editor_layer_classPrivateFieldGet(wl,this).updateToolbar(e)}updateMode(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:annotation_editor_layer_classPrivateFieldGet(wl,this).getMode();annotation_editor_layer_assertClassBrand(Pl,this,_cleanup).call(this);switch(e){case f.NONE:this.disableTextSelection();this.togglePointerEvents(!1);this.toggleAnnotationLayerPointerEvents(!0);this.disableClick();return;case f.INK:this.disableTextSelection();this.togglePointerEvents(!0);this.enableClick();break;case f.HIGHLIGHT:this.enableTextSelection();this.togglePointerEvents(!1);this.disableClick();break;default:this.disableTextSelection();this.togglePointerEvents(!0);this.enableClick()}PointerType.initializeEditor();this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;for(const i of Fl._.values())t.toggle(`${i._type}Editing`,e===i._editorType);this.div.hidden=!1}hasTextLayer(e){return e===annotation_editor_layer_classPrivateFieldGet(gl,this)?.div}setEditingState(e){annotation_editor_layer_classPrivateFieldGet(wl,this).setEditingState(e)}addCommands(e){annotation_editor_layer_classPrivateFieldGet(wl,this).addCommands(e)}cleanUndoStack(e){annotation_editor_layer_classPrivateFieldGet(wl,this).cleanUndoStack(e)}toggleDrawing(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("drawing",!e)}togglePointerEvents(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];annotation_editor_layer_classPrivateFieldGet(rl,this)?.div.classList.toggle("disabled",!e)}async enable(){annotation_editor_layer_classPrivateFieldSet(ul,this,!0);this.div.tabIndex=0;this.togglePointerEvents(!0);annotation_editor_layer_classPrivateFieldGet(vl,this)?.abort();annotation_editor_layer_classPrivateFieldSet(vl,this,null);const e=new Set;for(const t of annotation_editor_layer_classPrivateFieldGet(dl,this).values()){t.enableEditing();t.show(!0);if(t.annotationElementId){annotation_editor_layer_classPrivateFieldGet(wl,this).removeChangedExistingAnnotation(t);e.add(t.annotationElementId)}}if(!annotation_editor_layer_classPrivateFieldGet(rl,this)){annotation_editor_layer_classPrivateFieldSet(ul,this,!1);return}const t=annotation_editor_layer_classPrivateFieldGet(rl,this).getEditableAnnotations();for(const i of t){i.hide();if(annotation_editor_layer_classPrivateFieldGet(wl,this).isDeletedAnnotationElement(i.data.id))continue;if(e.has(i.data.id))continue;const t=await this.deserialize(i);if(t){this.addOrRebuild(t);t.enableEditing()}}annotation_editor_layer_classPrivateFieldSet(ul,this,!1)}disable(){annotation_editor_layer_classPrivateFieldSet(hl,this,!0);this.div.tabIndex=-1;this.togglePointerEvents(!1);if(annotation_editor_layer_classPrivateFieldGet(gl,this)&&!annotation_editor_layer_classPrivateFieldGet(vl,this)){annotation_editor_layer_classPrivateFieldSet(vl,this,new AbortController);const e=annotation_editor_layer_classPrivateFieldGet(wl,this).combinedSignal(annotation_editor_layer_classPrivateFieldGet(vl,this));annotation_editor_layer_classPrivateFieldGet(gl,this).div.addEventListener("pointerdown",(e=>{const{clientX:t,clientY:i,timeStamp:a}=e;if(a-annotation_editor_layer_classPrivateFieldGet(ml,this)>500){annotation_editor_layer_classPrivateFieldSet(ml,this,a);return}annotation_editor_layer_classPrivateFieldSet(ml,this,-1);const{classList:s}=this.div;s.toggle("getElements",!0);const n=document.elementsFromPoint(t,i);s.toggle("getElements",!1);if(!this.div.contains(n[0]))return;let r;const o=new RegExp(`^${g}[0-9]+$`);for(const e of n)if(o.test(e.id)){r=e.id;break}if(!r)return;const l=annotation_editor_layer_classPrivateFieldGet(dl,this).get(r);if(null===l?.annotationElementId){e.stopPropagation();e.preventDefault();l.dblclick()}}),{signal:e,capture:!0})}const e=new Map,t=new Map;for(const i of annotation_editor_layer_classPrivateFieldGet(dl,this).values()){i.disableEditing();if(i.annotationElementId)if(null===i.serialize()){t.set(i.annotationElementId,i);this.getEditableAnnotation(i.annotationElementId)?.show();i.remove()}else e.set(i.annotationElementId,i)}if(annotation_editor_layer_classPrivateFieldGet(rl,this)){const i=annotation_editor_layer_classPrivateFieldGet(rl,this).getEditableAnnotations();for(const a of i){const{id:i}=a.data;if(annotation_editor_layer_classPrivateFieldGet(wl,this).isDeletedAnnotationElement(i)){a.updateEdited({deleted:!0});continue}let s=t.get(i);if(s){s.resetAnnotationElement(a);s.show(!1);a.show()}else{s=e.get(i);if(s){annotation_editor_layer_classPrivateFieldGet(wl,this).addChangedExistingAnnotation(s);s.renderAnnotationElement(a)&&s.show(!1)}a.show()}}}annotation_editor_layer_assertClassBrand(Pl,this,_cleanup).call(this);this.isEmpty&&(this.div.hidden=!0);const{classList:i}=this.div;for(const e of Fl._.values())i.remove(`${e._type}Editing`);this.disableTextSelection();this.toggleAnnotationLayerPointerEvents(!0);annotation_editor_layer_classPrivateFieldSet(hl,this,!1)}getEditableAnnotation(e){return annotation_editor_layer_classPrivateFieldGet(rl,this)?.getEditableAnnotation(e)||null}setActiveEditor(e){annotation_editor_layer_classPrivateFieldGet(wl,this).getActive()!==e&&annotation_editor_layer_classPrivateFieldGet(wl,this).setActiveEditor(e)}enableTextSelection(){this.div.tabIndex=-1;if(annotation_editor_layer_classPrivateFieldGet(gl,this)?.div&&!annotation_editor_layer_classPrivateFieldGet(fl,this)){annotation_editor_layer_classPrivateFieldSet(fl,this,new AbortController);const e=annotation_editor_layer_classPrivateFieldGet(wl,this).combinedSignal(annotation_editor_layer_classPrivateFieldGet(fl,this));annotation_editor_layer_classPrivateFieldGet(gl,this).div.addEventListener("pointerdown",annotation_editor_layer_assertClassBrand(Pl,this,_textLayerPointerDown).bind(this),{signal:e});annotation_editor_layer_classPrivateFieldGet(gl,this).div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0;if(annotation_editor_layer_classPrivateFieldGet(gl,this)?.div&&annotation_editor_layer_classPrivateFieldGet(fl,this)){annotation_editor_layer_classPrivateFieldGet(fl,this).abort();annotation_editor_layer_classPrivateFieldSet(fl,this,null);annotation_editor_layer_classPrivateFieldGet(gl,this).div.classList.remove("highlighting")}}enableClick(){if(annotation_editor_layer_classPrivateFieldGet(ol,this))return;annotation_editor_layer_classPrivateFieldSet(ol,this,new AbortController);const e=annotation_editor_layer_classPrivateFieldGet(wl,this).combinedSignal(annotation_editor_layer_classPrivateFieldGet(ol,this));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(){annotation_editor_layer_classPrivateFieldGet(ol,this)?.abort();annotation_editor_layer_classPrivateFieldSet(ol,this,null)}attach(e){annotation_editor_layer_classPrivateFieldGet(dl,this).set(e.id,e);const{annotationElementId:t}=e;t&&annotation_editor_layer_classPrivateFieldGet(wl,this).isDeletedAnnotationElement(t)&&annotation_editor_layer_classPrivateFieldGet(wl,this).removeDeletedAnnotationElement(e)}detach(e){annotation_editor_layer_classPrivateFieldGet(dl,this).delete(e.id);annotation_editor_layer_classPrivateFieldGet(sl,this)?.removePointerInTextLayer(e.contentDiv);!annotation_editor_layer_classPrivateFieldGet(hl,this)&&e.annotationElementId&&annotation_editor_layer_classPrivateFieldGet(wl,this).addDeletedAnnotationElement(e)}remove(e){this.detach(e);annotation_editor_layer_classPrivateFieldGet(wl,this).removeEditor(e);e.div.remove();e.isAttachedToDOM=!1}changeParent(e){if(e.parent!==this){if(e.parent&&e.annotationElementId){annotation_editor_layer_classPrivateFieldGet(wl,this).addDeletedAnnotationElement(e.annotationElementId);AnnotationEditor.deleteAnnotationElement(e);e.annotationElementId=null}this.attach(e);e.parent?.detach(e);e.setParent(this);if(e.div&&e.isAttachedToDOM){e.div.remove();this.div.append(e.div)}}}add(e){if(e.parent!==this||!e.isAttachedToDOM){this.changeParent(e);annotation_editor_layer_classPrivateFieldGet(wl,this).addEditor(e);this.attach(e);if(!e.isAttachedToDOM){const t=e.render();this.div.append(t);e.isAttachedToDOM=!0}e.fixAndSetPosition();e.onceAdded(!annotation_editor_layer_classPrivateFieldGet(ul,this));annotation_editor_layer_classPrivateFieldGet(wl,this).addToAnnotationStorage(e);e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;const{activeElement:t}=document;if(e.div.contains(t)&&!annotation_editor_layer_classPrivateFieldGet(ll,this)){e._focusEventsAllowed=!1;annotation_editor_layer_classPrivateFieldSet(ll,this,setTimeout((()=>{annotation_editor_layer_classPrivateFieldSet(ll,this,null);if(e.div.contains(document.activeElement))e._focusEventsAllowed=!0;else{e.div.addEventListener("focusin",(()=>{e._focusEventsAllowed=!0}),{once:!0,signal:annotation_editor_layer_classPrivateFieldGet(wl,this)._signal});t.focus()}}),0))}e._structTreeParentId=annotation_editor_layer_classPrivateFieldGet(sl,this)?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){if(e.needsToBeRebuilt()){e.parent||=this;e.rebuild();e.show()}else this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getNextId(){return annotation_editor_layer_classPrivateFieldGet(wl,this).getId()}combinedSignal(e){return annotation_editor_layer_classPrivateFieldGet(wl,this).combinedSignal(e)}canCreateNewEmptyEditor(){return annotation_editor_layer_classPrivateGetter(Pl,this,_get_currentEditorType)?.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e);await annotation_editor_layer_classPrivateFieldGet(wl,this).updateMode(e.mode);const{offsetX:i,offsetY:a}=annotation_editor_layer_assertClassBrand(Pl,this,_getCenterPoint).call(this),s=this.getNextId(),n=annotation_editor_layer_assertClassBrand(Pl,this,_createNewEditor).call(this,{parent:this,id:s,x:i,y:a,uiManager:annotation_editor_layer_classPrivateFieldGet(wl,this),isCentered:!0,...t});n&&this.add(n)}async deserialize(e){return await(Fl._.get(e.annotationType??e.annotationEditorType)?.deserialize(e,this,annotation_editor_layer_classPrivateFieldGet(wl,this)))||null}createAndAddNewEditor(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=this.getNextId(),s=annotation_editor_layer_assertClassBrand(Pl,this,_createNewEditor).call(this,{parent:this,id:a,x:e.offsetX,y:e.offsetY,uiManager:annotation_editor_layer_classPrivateFieldGet(wl,this),isCentered:t,eventBus:this.eventBus,...i});s&&this.add(s);return s}addNewEditor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.createAndAddNewEditor(annotation_editor_layer_assertClassBrand(Pl,this,_getCenterPoint).call(this),!0,e)}setSelected(e){annotation_editor_layer_classPrivateFieldGet(wl,this).setSelected(e)}toggleSelected(e){annotation_editor_layer_classPrivateFieldGet(wl,this).toggleSelected(e)}unselect(e){annotation_editor_layer_classPrivateFieldGet(wl,this).unselect(e)}pointerup(e){const{isMac:t}=util_FeatureTest.platform;if(0!==e.button||e.ctrlKey&&t)return;if(e.target!==this.div)return;if(!annotation_editor_layer_classPrivateFieldGet(cl,this))return;annotation_editor_layer_classPrivateFieldSet(cl,this,!1);if(annotation_editor_layer_classPrivateGetter(Pl,this,_get_currentEditorType)?.isDrawer&&annotation_editor_layer_classPrivateGetter(Pl,this,_get_currentEditorType).supportMultipleDrawings)return;if(!annotation_editor_layer_classPrivateFieldGet(nl,this)){annotation_editor_layer_classPrivateFieldSet(nl,this,!0);return}const i=annotation_editor_layer_classPrivateFieldGet(wl,this).getMode();i!==f.STAMP&&i!==f.SIGNATURE?this.createAndAddNewEditor(e,!1):annotation_editor_layer_classPrivateFieldGet(wl,this).unselectAll()}pointerdown(e){if(annotation_editor_layer_classPrivateFieldGet(wl,this).getMode()===f.HIGHLIGHT){if(!PointerType.sameAsEditor(e.pointerType))return;this.enableTextSelection()}else if(annotation_editor_layer_classPrivateFieldGet(wl,this).getMode()===f.INK&&!PointerType.sameAsEditor(e.pointerType))return;if(annotation_editor_layer_classPrivateFieldGet(cl,this)){annotation_editor_layer_classPrivateFieldSet(cl,this,!1);return}const{isMac:t}=util_FeatureTest.platform;if(0!==e.button||e.ctrlKey&&t)return;if(e.target!==this.div)return;annotation_editor_layer_classPrivateFieldSet(cl,this,!0);if(annotation_editor_layer_classPrivateGetter(Pl,this,_get_currentEditorType)?.isDrawer){this.startDrawingSession(e);return}const i=annotation_editor_layer_classPrivateFieldGet(wl,this).getActive();annotation_editor_layer_classPrivateFieldSet(nl,this,!i||i.isEmpty())}startDrawingSession(e){this.div.focus({preventScroll:!0});if(annotation_editor_layer_classPrivateFieldGet(_l,this)){annotation_editor_layer_classPrivateGetter(Pl,this,_get_currentEditorType).startDrawing(this,annotation_editor_layer_classPrivateFieldGet(wl,this),!1,e);return}annotation_editor_layer_classPrivateFieldGet(wl,this).setCurrentDrawingSession(this);annotation_editor_layer_classPrivateFieldSet(_l,this,new AbortController);const t=annotation_editor_layer_classPrivateFieldGet(wl,this).combinedSignal(annotation_editor_layer_classPrivateFieldGet(_l,this));this.div.addEventListener("blur",(e=>{let{relatedTarget:t}=e;if(t&&!this.div.contains(t)){annotation_editor_layer_classPrivateFieldSet(pl,this,null);this.commitOrRemove()}}),{signal:t});annotation_editor_layer_classPrivateGetter(Pl,this,_get_currentEditorType).startDrawing(this,annotation_editor_layer_classPrivateFieldGet(wl,this),!1,e)}pause(e){if(e){const{activeElement:e}=document;this.div.contains(e)&&annotation_editor_layer_classPrivateFieldSet(pl,this,e)}else annotation_editor_layer_classPrivateFieldGet(pl,this)&&setTimeout((()=>{annotation_editor_layer_classPrivateFieldGet(pl,this)?.focus();annotation_editor_layer_classPrivateFieldSet(pl,this,null)}),0)}endDrawingSession(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!annotation_editor_layer_classPrivateFieldGet(_l,this))return null;annotation_editor_layer_classPrivateFieldGet(wl,this).setCurrentDrawingSession(null);annotation_editor_layer_classPrivateFieldGet(_l,this).abort();annotation_editor_layer_classPrivateFieldSet(_l,this,null);annotation_editor_layer_classPrivateFieldSet(pl,this,null);return annotation_editor_layer_classPrivateGetter(Pl,this,_get_currentEditorType).endDrawing(e)}findNewParent(e,t,i){const a=annotation_editor_layer_classPrivateFieldGet(wl,this).findParent(t,i);if(null===a||a===this)return!1;a.changeParent(e);return!0}commitOrRemove(){if(annotation_editor_layer_classPrivateFieldGet(_l,this)){this.endDrawingSession();return!0}return!1}onScaleChanging(){annotation_editor_layer_classPrivateFieldGet(_l,this)&&annotation_editor_layer_classPrivateGetter(Pl,this,_get_currentEditorType).onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove();if(annotation_editor_layer_classPrivateFieldGet(wl,this).getActive()?.parent===this){annotation_editor_layer_classPrivateFieldGet(wl,this).commitOrRemove();annotation_editor_layer_classPrivateFieldGet(wl,this).setActiveEditor(null)}if(annotation_editor_layer_classPrivateFieldGet(ll,this)){clearTimeout(annotation_editor_layer_classPrivateFieldGet(ll,this));annotation_editor_layer_classPrivateFieldSet(ll,this,null)}for(const e of annotation_editor_layer_classPrivateFieldGet(dl,this).values()){annotation_editor_layer_classPrivateFieldGet(sl,this)?.removePointerInTextLayer(e.contentDiv);e.setParent(null);e.isAttachedToDOM=!1;e.div.remove()}this.div=null;annotation_editor_layer_classPrivateFieldGet(dl,this).clear();annotation_editor_layer_classPrivateFieldGet(wl,this).removeLayer(this)}render(e){let{viewport:t}=e;this.viewport=t;setLayerDimensions(this.div,t);for(const e of annotation_editor_layer_classPrivateFieldGet(wl,this).getEditors(this.pageIndex)){this.add(e);e.rebuild()}this.updateMode()}update(e){let{viewport:t}=e;annotation_editor_layer_classPrivateFieldGet(wl,this).commitOrRemove();annotation_editor_layer_assertClassBrand(Pl,this,_cleanup).call(this);const i=this.viewport.rotation,a=t.rotation;this.viewport=t;setLayerDimensions(this.div,{rotation:a});if(i!==a)for(const e of annotation_editor_layer_classPrivateFieldGet(dl,this).values())e.rotate(a)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return annotation_editor_layer_classPrivateFieldGet(wl,this).viewParameters.realScale}}function _textLayerPointerDown(e){annotation_editor_layer_classPrivateFieldGet(wl,this).unselectAll();const{target:t}=e;if(t===annotation_editor_layer_classPrivateFieldGet(gl,this).div||("img"===t.getAttribute("role")||t.classList.contains("endOfContent"))&&annotation_editor_layer_classPrivateFieldGet(gl,this).div.contains(t)){const{isMac:t}=util_FeatureTest.platform;if(0!==e.button||e.ctrlKey&&t)return;annotation_editor_layer_classPrivateFieldGet(wl,this).showAllEditors("highlight",!0,!0);annotation_editor_layer_classPrivateFieldGet(gl,this).div.classList.add("free");this.toggleDrawing();HighlightEditor.startHighlighting(this,"ltr"===annotation_editor_layer_classPrivateFieldGet(wl,this).direction,{target:annotation_editor_layer_classPrivateFieldGet(gl,this).div,x:e.x,y:e.y});annotation_editor_layer_classPrivateFieldGet(gl,this).div.addEventListener("pointerup",(()=>{annotation_editor_layer_classPrivateFieldGet(gl,this).div.classList.remove("free");this.toggleDrawing(!0)}),{once:!0,signal:annotation_editor_layer_classPrivateFieldGet(wl,this)._signal});e.preventDefault()}}function _get_currentEditorType(e){return Fl._.get(annotation_editor_layer_classPrivateFieldGet(wl,e).getMode())}function _createNewEditor(e){const t=annotation_editor_layer_classPrivateGetter(Pl,this,_get_currentEditorType);return t?new t.prototype.constructor(e):null}function _getCenterPoint(){const{x:e,y:t,width:i,height:a}=this.div.getBoundingClientRect(),s=Math.max(0,e),n=Math.max(0,t),r=(s+Math.min(window.innerWidth,e+i))/2-e,o=(n+Math.min(window.innerHeight,t+a))/2-t,[l,d]=this.viewport.rotation%180==0?[r,o]:[o,r];return{offsetX:l,offsetY:d}}function _cleanup(){for(const e of annotation_editor_layer_classPrivateFieldGet(dl,this).values())e.isEmpty()&&e.remove()}annotation_editor_layer_defineProperty(AnnotationEditorLayer,"_initialized",!1);var yl,Fl={_:new Map([FreeTextEditor,InkEditor,StampEditor,HighlightEditor,SignatureEditor].map((e=>[e._editorType,e])))};function draw_layer_classPrivateFieldInitSpec(e,t,i){draw_layer_checkPrivateRedeclaration(e,t),t.set(e,i)}function draw_layer_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function draw_layer_classPrivateFieldSet(e,t,i){return e.set(draw_layer_assertClassBrand(e,t),i),i}function draw_layer_classPrivateFieldGet(e,t){return e.get(draw_layer_assertClassBrand(e,t))}function draw_layer_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var bl=new WeakMap,Sl=new WeakMap,xl=new WeakMap,Cl=new WeakSet;class DrawLayer{constructor(e){let{pageIndex:t}=e;!function draw_layer_classPrivateMethodInitSpec(e,t){draw_layer_checkPrivateRedeclaration(e,t),t.add(e)}(this,Cl);draw_layer_classPrivateFieldInitSpec(this,bl,null);draw_layer_classPrivateFieldInitSpec(this,Sl,new Map);draw_layer_classPrivateFieldInitSpec(this,xl,new Map);this.pageIndex=t}setParent(e){if(draw_layer_classPrivateFieldGet(bl,this)){if(draw_layer_classPrivateFieldGet(bl,this)!==e){if(draw_layer_classPrivateFieldGet(Sl,this).size>0)for(const t of draw_layer_classPrivateFieldGet(Sl,this).values()){t.remove();e.append(t)}draw_layer_classPrivateFieldSet(bl,this,e)}}else draw_layer_classPrivateFieldSet(bl,this,e)}static get _svgFactory(){return shadow(this,"_svgFactory",new DOMSVGFactory)}draw(e){var t,i;let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=(Al._=(t=Al._,i=t++,t),i),r=draw_layer_assertClassBrand(Cl,this,_createSVG).call(this),o=DrawLayer._svgFactory.createElement("defs");r.append(o);const l=DrawLayer._svgFactory.createElement("path");o.append(l);const d=`path_p${this.pageIndex}_${n}`;l.setAttribute("id",d);l.setAttribute("vector-effect","non-scaling-stroke");a&&draw_layer_classPrivateFieldGet(xl,this).set(n,l);const c=s?draw_layer_assertClassBrand(Cl,this,_createClipPath).call(this,o,d):null,h=DrawLayer._svgFactory.createElement("use");r.append(h);h.setAttribute("href",`#${d}`);this.updateProperties(r,e);draw_layer_classPrivateFieldGet(Sl,this).set(n,r);return{id:n,clipPathId:`url(#${c})`}}drawOutline(e,t){var i,a;const s=(Al._=(i=Al._,a=i++,i),a),n=draw_layer_assertClassBrand(Cl,this,_createSVG).call(this),r=DrawLayer._svgFactory.createElement("defs");n.append(r);const o=DrawLayer._svgFactory.createElement("path");r.append(o);const l=`path_p${this.pageIndex}_${s}`;o.setAttribute("id",l);o.setAttribute("vector-effect","non-scaling-stroke");let d;if(t){const e=DrawLayer._svgFactory.createElement("mask");r.append(e);d=`mask_p${this.pageIndex}_${s}`;e.setAttribute("id",d);e.setAttribute("maskUnits","objectBoundingBox");const t=DrawLayer._svgFactory.createElement("rect");e.append(t);t.setAttribute("width","1");t.setAttribute("height","1");t.setAttribute("fill","white");const i=DrawLayer._svgFactory.createElement("use");e.append(i);i.setAttribute("href",`#${l}`);i.setAttribute("stroke","none");i.setAttribute("fill","black");i.setAttribute("fill-rule","nonzero");i.classList.add("mask")}const c=DrawLayer._svgFactory.createElement("use");n.append(c);c.setAttribute("href",`#${l}`);d&&c.setAttribute("mask",`url(#${d})`);const h=c.cloneNode();n.append(h);c.classList.add("mainOutline");h.classList.add("secondaryOutline");this.updateProperties(n,e);draw_layer_classPrivateFieldGet(Sl,this).set(s,n);return s}finalizeDraw(e,t){draw_layer_classPrivateFieldGet(xl,this).delete(e);this.updateProperties(e,t)}updateProperties(e,t){if(!t)return;const{root:i,bbox:a,rootClass:s,path:n}=t,r="number"==typeof e?draw_layer_classPrivateFieldGet(Sl,this).get(e):e;if(r){i&&draw_layer_assertClassBrand(Cl,this,_updateProperties).call(this,r,i);a&&_setBox.call(DrawLayer,r,a);if(s){const{classList:e}=r;for(const[t,i]of Object.entries(s))e.toggle(t,i)}if(n){const e=r.firstChild.firstChild;draw_layer_assertClassBrand(Cl,this,_updateProperties).call(this,e,n)}}}updateParent(e,t){if(t===this)return;const i=draw_layer_classPrivateFieldGet(Sl,this).get(e);if(i){draw_layer_classPrivateFieldGet(bl,t).append(i);draw_layer_classPrivateFieldGet(Sl,this).delete(e);draw_layer_classPrivateFieldGet(Sl,t).set(e,i)}}remove(e){draw_layer_classPrivateFieldGet(xl,this).delete(e);if(null!==draw_layer_classPrivateFieldGet(bl,this)){draw_layer_classPrivateFieldGet(Sl,this).get(e).remove();draw_layer_classPrivateFieldGet(Sl,this).delete(e)}}destroy(){draw_layer_classPrivateFieldSet(bl,this,null);for(const e of draw_layer_classPrivateFieldGet(Sl,this).values())e.remove();draw_layer_classPrivateFieldGet(Sl,this).clear();draw_layer_classPrivateFieldGet(xl,this).clear()}}yl=DrawLayer;function _setBox(e,t){let[i,a,s,n]=t;const{style:r}=e;r.top=100*a+"%";r.left=100*i+"%";r.width=100*s+"%";r.height=100*n+"%"}function _createSVG(){const e=yl._svgFactory.create(1,1,!0);draw_layer_classPrivateFieldGet(bl,this).append(e);e.setAttribute("aria-hidden",!0);return e}function _createClipPath(e,t){const i=yl._svgFactory.createElement("clipPath");e.append(i);const a=`clip_${t}`;i.setAttribute("id",a);i.setAttribute("clipPathUnits","objectBoundingBox");const s=yl._svgFactory.createElement("use");i.append(s);s.setAttribute("href",`#${t}`);s.classList.add("clip");return a}function _updateProperties(e,t){for(const[i,a]of Object.entries(t))null===a?e.removeAttribute(i):e.setAttribute(i,a)}var Al={_:0};globalThis._pdfjsTestingUtils={HighlightOutliner};globalThis.pdfjsLib={AbortException,AnnotationEditorLayer,AnnotationEditorParamsType:v,AnnotationEditorType:f,AnnotationEditorUIManager,AnnotationLayer,AnnotationMode:p,AnnotationType:A,build:Us,ColorPicker,createValidAbsoluteUrl,DOMSVGFactory,DrawLayer,FeatureTest:util_FeatureTest,fetchData,getDocument,getFilenameFromUrl:function getFilenameFromUrl(e){[e]=e.split(/[#?]/,1);return e.substring(e.lastIndexOf("/")+1)},getPdfFilenameFromUrl:display_utils_getPdfFilenameFromUrl,getRGB,getUuid,getXfaPageViewport,GlobalWorkerOptions,ImageKind:C,InvalidPDFException,isDataScheme,isPdfFile,isValidExplicitDest:Bi,MathClamp,noContextMenu,normalizeUnicode,OPS:T,OutputScale,PasswordResponses:O,PDFDataRangeTransport,PDFDateString,PDFWorker,PermissionFlag:m,PixelsPerInch,RenderingCancelledException,ResponseException,setLayerDimensions,shadow,SignatureExtractor,stopEvent,SupportedImageMimeTypes:K,TextLayer,TouchManager,updateUrlHash,Util,VerbosityLevel:G,version:zs,XfaLayer};function ui_utils_classPrivateFieldInitSpec(e,t,i){(function ui_utils_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function ui_utils_classPrivateFieldGet(e,t){return e.get(ui_utils_assertClassBrand(e,t))}function ui_utils_classPrivateFieldSet(e,t,i){return e.set(ui_utils_assertClassBrand(e,t),i),i}function ui_utils_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const El="auto",kl=.1,Il={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},Ml=0,Bl=1,Gl=2,Tl=3,Dl=-1,Ll=0,Rl=1,Nl=2,Ol=3,Wl=4,jl=0,Vl=1,Hl=2,zl={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},Ul={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2},$l={SELECT:0,HAND:1,ZOOM:2},ql=/\bprint\s*\(/;function scrollIntoView(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.classList.contains("stf__item")||e.parentElement?.classList.contains("stf__item")||e.parentElement?.parentElement?.classList.contains("stf__item"))return;let s=e.offsetParent;if(!s){NgxConsole.error("offsetParent is not set -- cannot scroll");return}let n=e.offsetTop+e.clientTop,r=e.offsetLeft+e.clientLeft;for(;s.clientHeight===s.scrollHeight&&s.clientWidth===s.scrollWidth||i&&(s.classList.contains("markedContent")||"hidden"===getComputedStyle(s).overflow);){n+=s.offsetTop;r+=s.offsetLeft;s=s.offsetParent;if(!s){if(a&&document.body.clientHeight>n){n-=32;window.scrollTo(window.scrollX,n)}return}}if(t){void 0!==t.top&&(n+=t.top);if(void 0!==t.left){r+=t.left;s.scrollLeft=r}}else if(function isDivInViewport(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}(e))return;s.scrollTop=n}function watchScroll(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;const debounceScroll=function(i){s||(s=window.requestAnimationFrame((function viewAreaElementScrolled(){s=null;const i=e.scrollLeft,n=a.lastX;i!==n&&(a.right=i>n);a.lastX=i;const r=e.scrollTop,o=a.lastY;r!==o&&(a.down=r>o);a.lastY=r;t(a)})))},a={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:debounceScroll};let s=null;e.addEventListener("scroll",debounceScroll,{useCapture:!0,signal:i});i?.addEventListener("abort",(()=>window.cancelAnimationFrame(s)),{once:!0});return a}function parseQueryString(e){const t=new Map;for(const[i,a]of new URLSearchParams(e))t.set(i.toLowerCase(),a);return t}const Xl=/[\x00-\x1F]/g;function removeNullCharacters(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Xl.test(e)?t?e.replaceAll(Xl,(e=>"\0"===e?"":" ")):e.replaceAll("\0",""):e}function binarySearchFirstItem(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=e.length-1;if(a<0||!t(e[a]))return e.length;if(t(e[i]))return i;for(;i<a;){const s=i+a>>1;t(e[s])?a=s:i=s+1}return i}function approximateFraction(e){if(Math.floor(e)===e)return[e,1];const t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];const i=e>1?t:e;let a,s=0,n=1,r=1,o=1;for(;;){const e=s+r,t=n+o;if(t>8)break;if(i<=e/t){r=e;o=t}else{s=e;n=t}}a=i-s/n<r/o-i?i===e?[s,n]:[n,s]:i===e?[r,o]:[o,r];return a}function floorToDivide(e,t){return e-e%t}function getPageSizeInches(e){let{view:t,userUnit:i,rotate:a}=e;const[s,n,r,o]=t,l=a%180!=0,d=(r-s)/72*i,c=(o-n)/72*i;return{width:l?c:d,height:l?d:c}}function getVisibleElements(e){let{scrollEl:t,views:i,sortByVisibility:a=!1,horizontal:s=!1,rtl:n=!1}=e;const r=t.scrollTop,o=r+t.clientHeight,l=t.scrollLeft,d=l+t.clientWidth;const c=[],h=new Set,u=i.length;let _=binarySearchFirstItem(i,s?function isElementNextAfterViewHorizontally(e){const t=e.div,i=t.offsetLeft+t.clientLeft,a=i+t.clientWidth;return n?i<d:a>l}:function isElementBottomAfterViewTop(e){const t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>r});_>0&&_<u&&!s&&(_=function backtrackBeforeAllVisibleElements(e,t,i){if(e<2)return e;let a=t[e].div,s=a.offsetTop+a.clientTop;if(s>=i){a=t[e-1].div;s=a.offsetTop+a.clientTop}for(let i=e-2;i>=0;--i){a=t[i].div;if(a.offsetTop+a.clientTop+a.clientHeight<=s)break;e=i}return e}(_,i,r));let p=s?d:-1;for(let e=_;e<u;e++){const t=i[e],a=t.div,n=a.offsetLeft+a.clientLeft,u=a.offsetTop+a.clientTop,_=a.clientWidth,g=a.clientHeight,f=n+_,v=u+g;if(-1===p)v>=o&&(p=v);else if((s?n:u)>p)break;if(v<=r||u>=o||f<=l||n>=d)continue;const m=Math.max(0,r-u),w=Math.max(0,l-n),P=m+Math.max(0,v-o),y=(_-(w+Math.max(0,f-d)))/_,b=(g-P)/g*y*100|0;c.push({id:t.id,x:n,y:u,visibleArea:100===b?null:{minX:w,minY:m,maxX:Math.min(f,d)-n,maxY:Math.min(v,o)-u},view:t,percent:b,widthPercent:100*y|0});h.add(t.id)}const g=c[0],f=c.at(-1);a&&c.sort((function(e,t){const i=e.percent-t.percent;return Math.abs(i)>.001?-i:e.id-t.id}));return{first:g,last:f,views:c,ids:h}}function normalizeWheelEventDirection(e){let t=Math.hypot(e.deltaX,e.deltaY);const i=Math.atan2(e.deltaY,e.deltaX);-.25*Math.PI<i&&i<.75*Math.PI&&(t=-t);return t}function isValidRotation(e){return Number.isInteger(e)&&e%90==0}function isValidScrollMode(e){return Number.isInteger(e)&&Object.values(zl).includes(e)&&e!==zl.UNKNOWN}function isValidSpreadMode(e){return Number.isInteger(e)&&Object.values(Ul).includes(e)&&e!==Ul.UNKNOWN}function isPortraitOrientation(e){return e.width<=e.height}const Kl=new Promise((function(e){window.requestAnimationFrame(e)})),Yl=document.documentElement.style;var Zl=new WeakMap,Ql=new WeakMap,Jl=new WeakMap,ed=new WeakMap,td=new WeakMap;class ProgressBar{constructor(e){ui_utils_classPrivateFieldInitSpec(this,Zl,null);ui_utils_classPrivateFieldInitSpec(this,Ql,null);ui_utils_classPrivateFieldInitSpec(this,Jl,0);ui_utils_classPrivateFieldInitSpec(this,ed,null);ui_utils_classPrivateFieldInitSpec(this,td,!0);ui_utils_classPrivateFieldSet(Zl,this,e.classList);ui_utils_classPrivateFieldSet(ed,this,e.style)}get percent(){return ui_utils_classPrivateFieldGet(Jl,this)}set percent(e){ui_utils_classPrivateFieldSet(Jl,this,MathClamp(e,0,100));if(isNaN(e))ui_utils_classPrivateFieldGet(Zl,this).add("indeterminate");else{ui_utils_classPrivateFieldGet(Zl,this).remove("indeterminate");ui_utils_classPrivateFieldGet(ed,this).setProperty("--progressBar-percent",`${ui_utils_classPrivateFieldGet(Jl,this)}%`)}}setWidth(e){if(!e)return;const t=e.parentNode.offsetWidth-e.offsetWidth;t>0&&ui_utils_classPrivateFieldGet(ed,this).setProperty("--progressBar-end-offset",`${t}px`)}setDisableAutoFetch(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5e3;if(100!==ui_utils_classPrivateFieldGet(Jl,this)&&!isNaN(ui_utils_classPrivateFieldGet(Jl,this))){ui_utils_classPrivateFieldGet(Ql,this)&&clearTimeout(ui_utils_classPrivateFieldGet(Ql,this));this.show();ui_utils_classPrivateFieldSet(Ql,this,setTimeout((()=>{ui_utils_classPrivateFieldSet(Ql,this,null);this.hide()}),e))}}hide(){if(ui_utils_classPrivateFieldGet(td,this)){ui_utils_classPrivateFieldSet(td,this,!1);ui_utils_classPrivateFieldGet(Zl,this).add("hidden")}}show(){if(!ui_utils_classPrivateFieldGet(td,this)){ui_utils_classPrivateFieldSet(td,this,!0);ui_utils_classPrivateFieldGet(Zl,this).remove("hidden")}}}function getActiveOrFocusedElement(){let e=document,t=e.activeElement||e.querySelector(":focus");for(;t?.shadowRoot;){e=t.shadowRoot;t=e.activeElement||e.querySelector(":focus")}return t}function apiPageLayoutToViewerModes(e){let t=zl.VERTICAL,i=Ul.NONE;switch(e){case"SinglePage":t=zl.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=zl.PAGE;case"TwoColumnLeft":i=Ul.ODD;break;case"TwoPageRight":t=zl.PAGE;case"TwoColumnRight":i=Ul.EVEN}return{scrollMode:t,spreadMode:i}}function toggleCheckedBtn(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.classList.toggle("toggled",t);e.setAttribute("aria-checked",t);i?.classList.toggle("hidden",!t)}function toggleExpandedBtn(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e?.classList.toggle("toggled",t);e?.setAttribute("aria-expanded",t);i?.classList.toggle("hidden",!t);if(i&&!i.classList.contains("hidden")){const t=e.getBoundingClientRect(),a=e.closest("#toolbarViewer");if(a){const e=a.getBoundingClientRect().right-t.right;i.style.removeProperty("inset-inline-end");i.style.setProperty("inset-inline-end",e+"px")}}}const id=function(){const e=document.createElement("div");e.style.width="round(down, calc(1.6666666666666665 * 792px), 1px)";return"calc(1320px)"===e.style.width?Math.fround:e=>e}();function isInsideNgxExtendedPdfViewer(e){let t=e;for(;t;){if("ngx-extended-pdf-viewer"===t.tagName.toLowerCase())return!0;t=t.parentElement}return!1}function pdf_link_service_defineProperty(e,t,i){return(t=function pdf_link_service_toPropertyKey(e){var t=function pdf_link_service_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const ad={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};class PDFLinkService{constructor(){let{eventBus:e,externalLinkTarget:t=null,externalLinkRel:i=null,ignoreDestinationZoom:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};pdf_link_service_defineProperty(this,"externalLinkEnabled",!0);this.eventBus=e;this.externalLinkTarget=t;this.externalLinkRel=i;this._ignoreDestinationZoom=a;this.baseUrl=null;this.pdfDocument=null;this.pdfViewer=null;this.pdfHistory=null}setDocument(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.baseUrl=t;this.pdfDocument=e}setViewer(e){this.pdfViewer=e}setHistory(e){this.pdfHistory=e}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages: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}async goToDestination(e){if(!this.pdfDocument)return;let t,i,a;if("string"==typeof e){t=e;i=await this.pdfDocument.getDestination(e)}else{t=null;i=await e}if(!Array.isArray(i)){console.error(`goToDestination: "${i}" is not a valid destination array, for dest="${e}".`);return}const[s]=i;if(s&&"object"==typeof s){a=this.pdfDocument.cachedPageNumber(s);if(!a)try{a=await this.pdfDocument.getPageIndex(s)+1}catch{NgxConsole.error(`goToDestination: "${s}" is not a valid page reference, for dest="${e}".`);return}}else Number.isInteger(s)&&(a=s+1);if(!a||a<1||a>this.pagesCount){NgxConsole.error(`goToDestination: "${a}" is not a valid page number, for dest="${e}".`);return}if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.push({namedDest:t,explicitDest:i,pageNumber:a})}this.pdfViewer.scrollPageIntoView({pageNumber:a,destArray:i,ignoreDestinationZoom:this._ignoreDestinationZoom});const n=new AbortController;this.eventBus._on("textlayerrendered",(e=>{if(e.pageNumber===a){e.source.textLayer.div.focus();n.abort()}}),{signal:n.signal})}goToPage(e){if(!this.pdfDocument)return;const t="string"==typeof e&&this.pdfViewer.pageLabelToPageNumber(e)||0|e;if(Number.isInteger(t)&&t>0&&t<=this.pagesCount){if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.pushPage(t)}if("book"===this.pdfViewer.pageViewMode){if(this.pdfViewer.pageFlip){this.pdfViewer.ensureAdjacentPagesAreLoaded();const e=this.pdfViewer.currentPageNumber-this.pdfViewer.currentPageNumber%2,i=t-t%2;e===i-2?this.pdfViewer.pageFlip.flipNext():e===i+2?this.pdfViewer.pageFlip.flipPrev():this.pdfViewer.pageFlip.turnToPage(t-1)}}else this.pdfViewer.scrollPageIntoView({pageNumber:t})}else NgxConsole.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`)}addLinkAttributes(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!t||"string"!=typeof t)throw new Error('A valid "url" parameter must provided.');const a=i?ad.BLANK:this.externalLinkTarget,s=this.externalLinkRel;if(this.externalLinkEnabled)e.href=e.title=t;else{e.href="";e.title=`Disabled: ${t}`;e.onclick=()=>!1}let n="";switch(a){case ad.NONE:break;case ad.SELF:n="_self";break;case ad.BLANK:n="_blank";break;case ad.PARENT:n="_parent";break;case ad.TOP:n="_top"}e.target=n;e.rel="string"==typeof s?s:"noopener noreferrer nofollow"}getDestinationHash(e){if("string"==typeof e){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,i;if(e.includes("=")){const a=parseQueryString(e);if(a.has("search")){const e=a.get("search").replaceAll('"',""),t="true"===a.get("phrase");this.eventBus.dispatch("findfromurlhash",{source:this,query:t?e:e.match(/\S+/g)})}a.has("page")&&(t=0|a.get("page")||1);if(a.has("zoom")){const e=a.get("zoom").split(","),t=e[0],s=parseFloat(t);t.includes("Fit")?"Fit"===t||"FitB"===t?i=[null,{name:t}]:"FitH"===t||"FitBH"===t||"FitV"===t||"FitBV"===t?i=[null,{name:t},e.length>1?0|e[1]:null]:"FitR"===t?5!==e.length?NgxConsole.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):i=[null,{name:t},0|e[1],0|e[2],0|e[3],0|e[4]]:NgxConsole.error(`PDFLinkService.setHash: "${t}" is not a valid zoom value.`):i=[null,{name:"XYZ"},e.length>1?0|e[1]:null,e.length>2?0|e[2]:null,s?s/100:t]}i?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:i,allowNegativeOffset:!0}):t&&(this.page=t);a.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:a.get("pagemode")});a.has("nameddest")&&this.goToDestination(a.get("nameddest"))}else{i=unescape(e);try{i=JSON.parse(i);Array.isArray(i)||(i=i.toString())}catch{}"string"==typeof i||Bi(i)?this.goToDestination(i):console.error(`PDFLinkService.setHash: "${unescape(e)}" is not a valid destination.`)}}executeNamedAction(e){if(this.pdfDocument){switch(e){case"GoBack":this.pdfHistory?.back();break;case"GoForward":this.pdfHistory?.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}this.eventBus.dispatch("namedaction",{source:this,action:e})}}async executeSetOCGState(e){if(!this.pdfDocument)return;const t=this.pdfDocument,i=await this.pdfViewer.optionalContentConfigPromise;if(t===this.pdfDocument){i.setOCGState(e);this.pdfViewer.optionalContentConfigPromise=Promise.resolve(i)}}}class SimpleLinkService extends PDFLinkService{setDocument(e){}}function event_utils_classPrivateFieldInitSpec(e,t,i){(function event_utils_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function event_utils_classPrivateFieldGet(e,t){return e.get(event_utils_assertClassBrand(e,t))}function event_utils_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const sd="event",nd="timeout";async function waitOnEventOrTimeout(e){let{target:t,name:i,delay:a=0}=e;if("object"!=typeof t||!i||"string"!=typeof i||!(Number.isInteger(a)&&a>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");const{promise:s,resolve:n}=Promise.withResolvers(),r=new AbortController;function handler(e){r.abort();clearTimeout(o);n(e)}t[t instanceof EventBus?"_on":"addEventListener"](i,handler.bind(null,sd),{signal:r.signal});const o=setTimeout(handler.bind(null,nd),a);return s}var rd=new WeakMap;class EventBus{constructor(){event_utils_classPrivateFieldInitSpec(this,rd,Object.create(null))}on(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this._on(e,t,{external:!0,once:i?.once,signal:i?.signal})}off(e,t){this._off(e,t)}dispatch(e,t){const i=event_utils_classPrivateFieldGet(rd,this)[e];if(!i||0===i.length)return;let a;for(const{listener:s,external:n,once:r}of i.slice(0)){r&&this._off(e,s);n?(a||=[]).push(s):s(t)}if(a){for(const e of a)e(t);a=null}}_on(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=null;if(i?.signal instanceof AbortSignal){const{signal:s}=i;if(s.aborted){console.error("Cannot use an `aborted` signal.");return}const onAbort=()=>this._off(e,t);a=()=>s.removeEventListener("abort",onAbort);s.addEventListener("abort",onAbort)}(event_utils_classPrivateFieldGet(rd,this)[e]||=[]).push({listener:t,external:!0===i?.external,once:!0===i?.once,rmAbort:a})}_off(e,t){const i=event_utils_classPrivateFieldGet(rd,this)[e];if(i)for(let e=0,a=i.length;e<a;e++){const a=i[e];if(a.listener===t){a.rmAbort?.();i.splice(e,1);return}}}destroy(){let e;for(e in event_utils_classPrivateFieldGet(rd,this))event_utils_classPrivateFieldGet(rd,this)[e].length=0}}class BaseExternalServices{updateFindControlState(e){}updateFindMatchesCount(e){}initPassiveLoading(){}reportTelemetry(e){}async createL10n(){throw new Error("Not implemented: createL10n")}createScripting(){throw new Error("Not implemented: createScripting")}createSignatureStorage(){throw new Error("Not implemented: createSignatureStorage")}updateEditorStates(e){throw new Error("Not implemented: updateEditorStates")}dispatchGlobalEvent(e){}}function preferences_classPrivateFieldInitSpec(e,t,i){(function preferences_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function preferences_classPrivateFieldGet(e,t){return e.get(preferences_assertClassBrand(e,t))}function preferences_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var od=new WeakMap,ld=new WeakMap;class BasePreferences{constructor(){preferences_classPrivateFieldInitSpec(this,od,Object.freeze({altTextLearnMoreUrl:"",annotationEditorMode:0,annotationMode:2,capCanvasAreaFactor:200,cursorToolOnLoad:0,defaultZoomDelay:400,defaultZoomValue:"auto",disablePageLabels:!1,enableAltText:!1,enableAltTextModelDownload:!0,enableAutoLinking:!0,enableComment:!1,enableGuessAltText:!0,enableHighlightFloatingButton:!1,enableNewAltTextWhenAddingImage:!0,enablePermissions:!1,enablePrintAutoRotate:!0,enableScripting:!1,enableSignatureEditor:!1,enablePageReordering:!0,pdfBackgroundColor:"",enableUpdatedAddImage:!1,externalLinkTarget:0,highlightEditorColors:"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",historyUpdateUrl:!1,ignoreDestinationZoom:!1,forcePageColors:!1,pageColorsBackground:"Canvas",pageColorsForeground:"CanvasText",pdfBugEnabled:!1,removePageBorders:!1,sidebarViewOnLoad:-1,scrollModeOnLoad:-1,spreadModeOnLoad:-1,textLayerMode:1,viewerCssTheme:0,viewOnLoad:0,disableAutoFetch:!1,disableFontFace:!1,disableRange:!1,disableStream:!1,enableHWA:!0,enableXfa:!0}));preferences_classPrivateFieldInitSpec(this,ld,null);!function preferences_classPrivateFieldSet(e,t,i){return e.set(preferences_assertClassBrand(e,t),i),i}(ld,this,this._readFromStorage(preferences_classPrivateFieldGet(od,this)).then((e=>{let{browserPrefs:t,prefs:i}=e;AppOptions._checkDisablePreferences()||AppOptions.setAll({...t,...i},!0)})))}async _writeToStorage(e){throw new Error("Not implemented: _writeToStorage")}async _readFromStorage(e){throw new Error("Not implemented: _readFromStorage")}async reset(){await preferences_classPrivateFieldGet(ld,this);AppOptions.setAll(preferences_classPrivateFieldGet(od,this),!0);await this._writeToStorage(preferences_classPrivateFieldGet(od,this))}async set(e,t){await preferences_classPrivateFieldGet(ld,this);AppOptions.setAll({[e]:t},!0);await this._writeToStorage(AppOptions.getAll(us))}async get(e){await preferences_classPrivateFieldGet(ld,this);return AppOptions.get(e)}get initializedPromise(){return preferences_classPrivateFieldGet(ld,this)}}class FluentType{constructor(e){this.value=e}valueOf(){return this.value}}class FluentNone extends FluentType{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"???")}toString(e){return`{${this.value}}`}}class FluentNumber extends FluentType{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e);this.opts=t}toString(e){if(e)try{return e.memoizeIntlObject(Intl.NumberFormat,this.opts).format(this.value)}catch(t){e.reportError(t)}return this.value.toString(10)}}class FluentDateTime extends FluentType{static supportsValue(e){if("number"==typeof e)return!0;if(e instanceof Date)return!0;if(e instanceof FluentType)return FluentDateTime.supportsValue(e.valueOf());if("Temporal"in globalThis){const t=globalThis.Temporal;if(e instanceof t.Instant||e instanceof t.PlainDateTime||e instanceof t.PlainDate||e instanceof t.PlainMonthDay||e instanceof t.PlainTime||e instanceof t.PlainYearMonth)return!0}return!1}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e instanceof FluentDateTime){t={...e.opts,...t};e=e.value}else e instanceof FluentType&&(e=e.valueOf());"object"==typeof e&&"calendarId"in e&&void 0===t.calendar&&(t={...t,calendar:e.calendarId});super(e);this.opts=t}[Symbol.toPrimitive](e){return"string"===e?this.toString():this.toNumber()}toNumber(){const e=this.value;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("epochMilliseconds"in e)return e.epochMilliseconds;if("toZonedDateTime"in e)return e.toZonedDateTime("UTC").epochMilliseconds;throw new TypeError("Unwrapping a non-number value as a number")}toString(e){if(e)try{return e.memoizeIntlObject(Intl.DateTimeFormat,this.opts).format(this.value)}catch(t){e.reportError(t)}return"number"==typeof this.value||this.value instanceof Date?new Date(this.value).toISOString():this.value.toString()}}function match(e,t,i){if(i===t)return!0;if(i instanceof FluentNumber&&t instanceof FluentNumber&&i.value===t.value)return!0;if(t instanceof FluentNumber&&"string"==typeof i){if(i===e.memoizeIntlObject(Intl.PluralRules,t.opts).select(t.value))return!0}return!1}function getDefault(e,t,i){if(t[i])return resolvePattern(e,t[i].value);e.reportError(new RangeError("No default"));return new FluentNone}function getArguments(e,t){const i=[],a=Object.create(null);for(const s of t)"narg"===s.type?a[s.name]=resolveExpression(e,s.value):i.push(resolveExpression(e,s));return{positional:i,named:a}}function resolveExpression(e,t){switch(t.type){case"str":return t.value;case"num":return new FluentNumber(t.value,{minimumFractionDigits:t.precision});case"var":return function resolveVariableReference(e,t){let i,{name:a}=t;if(e.params){if(!Object.prototype.hasOwnProperty.call(e.params,a))return new FluentNone(`$${a}`);i=e.params[a]}else{if(!e.args||!Object.prototype.hasOwnProperty.call(e.args,a)){e.reportError(new ReferenceError(`Unknown variable: $${a}`));return new FluentNone(`$${a}`)}i=e.args[a]}if(i instanceof FluentType)return i;switch(typeof i){case"string":return i;case"number":return new FluentNumber(i);case"object":if(FluentDateTime.supportsValue(i))return new FluentDateTime(i);default:e.reportError(new TypeError(`Variable type not supported: $${a}, ${typeof i}`));return new FluentNone(`$${a}`)}}(e,t);case"mesg":return function resolveMessageReference(e,t){let{name:i,attr:a}=t;const s=e.bundle._messages.get(i);if(!s){e.reportError(new ReferenceError(`Unknown message: ${i}`));return new FluentNone(i)}if(a){const t=s.attributes[a];if(t)return resolvePattern(e,t);e.reportError(new ReferenceError(`Unknown attribute: ${a}`));return new FluentNone(`${i}.${a}`)}if(s.value)return resolvePattern(e,s.value);e.reportError(new ReferenceError(`No value: ${i}`));return new FluentNone(i)}(e,t);case"term":return function resolveTermReference(e,t){let{name:i,attr:a,args:s}=t;const n=`-${i}`,r=e.bundle._terms.get(n);if(!r){e.reportError(new ReferenceError(`Unknown term: ${n}`));return new FluentNone(n)}if(a){const t=r.attributes[a];if(t){e.params=getArguments(e,s).named;const i=resolvePattern(e,t);e.params=null;return i}e.reportError(new ReferenceError(`Unknown attribute: ${a}`));return new FluentNone(`${n}.${a}`)}e.params=getArguments(e,s).named;const o=resolvePattern(e,r.value);e.params=null;return o}(e,t);case"func":return function resolveFunctionReference(e,t){let{name:i,args:a}=t,s=e.bundle._functions[i];if(!s){e.reportError(new ReferenceError(`Unknown function: ${i}()`));return new FluentNone(`${i}()`)}if("function"!=typeof s){e.reportError(new TypeError(`Function ${i}() is not callable`));return new FluentNone(`${i}()`)}try{let t=getArguments(e,a);return s(t.positional,t.named)}catch(t){e.reportError(t);return new FluentNone(`${i}()`)}}(e,t);case"select":return function resolveSelectExpression(e,t){let{selector:i,variants:a,star:s}=t,n=resolveExpression(e,i);if(n instanceof FluentNone)return getDefault(e,a,s);for(const t of a){if(match(e,n,resolveExpression(e,t.key)))return resolvePattern(e,t.value)}return getDefault(e,a,s)}(e,t);default:return new FluentNone}}function resolveComplexPattern(e,t){if(e.dirty.has(t)){e.reportError(new RangeError("Cyclic reference"));return new FluentNone}e.dirty.add(t);const i=[],a=e.bundle._useIsolating&&t.length>1;for(const s of t)if("string"!=typeof s){e.placeables++;if(e.placeables>100){e.dirty.delete(t);throw new RangeError(`Too many placeables expanded: ${e.placeables}, max allowed is 100`)}a&&i.push("⁨");i.push(resolveExpression(e,s).toString(e));a&&i.push("⁩")}else i.push(e.bundle._transform(s));e.dirty.delete(t);return i.join("")}function resolvePattern(e,t){return"string"==typeof t?e.bundle._transform(t):resolveComplexPattern(e,t)}class Scope{constructor(e,t,i){this.dirty=new WeakSet;this.params=null;this.placeables=0;this.bundle=e;this.errors=t;this.args=i}reportError(e){if(!(this.errors&&e instanceof Error))throw e;this.errors.push(e)}memoizeIntlObject(e,t){let i=this.bundle._intls.get(e);if(!i){i={};this.bundle._intls.set(e,i)}let a=JSON.stringify(t);i[a]||(i[a]=new e(this.bundle.locales,t));return i[a]}}function values(e,t){const i=Object.create(null);for(const[a,s]of Object.entries(e))t.includes(a)&&(i[a]=s.valueOf());return i}const dd=["unitDisplay","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits"];function NUMBER(e,t){let i=e[0];if(i instanceof FluentNone)return new FluentNone(`NUMBER(${i.valueOf()})`);if(i instanceof FluentNumber)return new FluentNumber(i.valueOf(),{...i.opts,...values(t,dd)});if(i instanceof FluentDateTime)return new FluentNumber(i.toNumber(),{...values(t,dd)});throw new TypeError("Invalid argument to NUMBER")}const cd=["dateStyle","timeStyle","fractionalSecondDigits","dayPeriod","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"];function DATETIME(e,t){let i=e[0];if(i instanceof FluentNone)return new FluentNone(`DATETIME(${i.valueOf()})`);if(i instanceof FluentDateTime||i instanceof FluentNumber)return new FluentDateTime(i,values(t,cd));throw new TypeError("Invalid argument to DATETIME")}const hd=new Map;class FluentBundle{constructor(e){let{functions:t,useIsolating:i=!0,transform:a=e=>e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._terms=new Map;this._messages=new Map;this.locales=Array.isArray(e)?e:[e];this._functions={NUMBER,DATETIME,...t};this._useIsolating=i;this._transform=a;this._intls=function getMemoizerForLocale(e){const t=Array.isArray(e)?e.join(" "):e;let i=hd.get(t);if(void 0===i){i=new Map;hd.set(t,i)}return i}(e)}hasMessage(e){return this._messages.has(e)}getMessage(e){return this._messages.get(e)}addResource(e){let{allowOverrides:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=[];for(let a=0;a<e.body.length;a++){let s=e.body[a];if(s.id.startsWith("-")){if(!1===t&&this._terms.has(s.id)){i.push(new Error(`Attempt to override an existing term: "${s.id}"`));continue}this._terms.set(s.id,s)}else{if(!1===t&&this._messages.has(s.id)){i.push(new Error(`Attempt to override an existing message: "${s.id}"`));continue}this._messages.set(s.id,s)}}return i}formatPattern(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("string"==typeof e)return this._transform(e);let a=new Scope(this,i,t);try{return resolveComplexPattern(a,e).toString(a)}catch(e){if(a.errors&&e instanceof Error){a.errors.push(e);return(new FluentNone).toString(a)}throw e}}}const ud=/^(-?[a-zA-Z][\w-]*) *= */gm,_d=/\.([a-zA-Z][\w-]*) *= */y,pd=/\*?\[/y,gd=/(-?[0-9]+(?:\.([0-9]+))?)/y,fd=/([a-zA-Z][\w-]*)/y,vd=/([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y,md=/^[A-Z][A-Z0-9_-]*$/,wd=/([^{}\n\r]+)/y,Pd=/([^\\"\n\r]*)/y,yd=/\\([\\"])/y,Fd=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y,bd=/^\n+/,Sd=/ +$/,xd=/ *\r?\n/g,Cd=/( *)$/,Ad=/{\s*/y,Ed=/\s*}/y,kd=/\[\s*/y,Id=/\s*] */y,Md=/\s*\(\s*/y,Bd=/\s*->\s*/y,Gd=/\s*:\s*/y,Td=/\s*,?\s*/y,Dd=/\s+/y;class FluentResource{constructor(e){this.body=[];ud.lastIndex=0;let t=0;for(;;){let i=ud.exec(e);if(null===i)break;t=ud.lastIndex;try{this.body.push(parseMessage(i[1]))}catch(e){if(e instanceof SyntaxError)continue;throw e}}function test(i){i.lastIndex=t;return i.test(e)}function consumeChar(i,a){if(e[t]===i){t++;return!0}if(a)throw new a(`Expected ${i}`);return!1}function consumeToken(e,i){if(test(e)){t=e.lastIndex;return!0}if(i)throw new i(`Expected ${e.toString()}`);return!1}function match(i){i.lastIndex=t;let a=i.exec(e);if(null===a)throw new SyntaxError(`Expected ${i.toString()}`);t=i.lastIndex;return a}function match1(e){return match(e)[1]}function parseMessage(e){let t=parsePattern(),i=function parseAttributes(){let e=Object.create(null);for(;test(_d);){let t=match1(_d),i=parsePattern();if(null===i)throw new SyntaxError("Expected attribute value");e[t]=i}return e}();if(null===t&&0===Object.keys(i).length)throw new SyntaxError("Expected message value or attributes");return{id:e,value:t,attributes:i}}function parsePattern(){let i;test(wd)&&(i=match1(wd));if("{"===e[t]||"}"===e[t])return parsePatternElements(i?[i]:[],1/0);let a=parseIndent();if(a){if(i)return parsePatternElements([i,a],a.length);a.value=trim(a.value,bd);return parsePatternElements([a],a.length)}return i?trim(i,Sd):null}function parsePatternElements(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],a=arguments.length>1?arguments[1]:void 0;for(;;){if(test(wd)){i.push(match1(wd));continue}if("{"===e[t]){i.push(parsePlaceable());continue}if("}"===e[t])throw new SyntaxError("Unbalanced closing brace");let s=parseIndent();if(!s)break;i.push(s);a=Math.min(a,s.length)}let s=i.length-1,n=i[s];"string"==typeof n&&(i[s]=trim(n,Sd));let r=[];for(let e of i){e instanceof Indent&&(e=e.value.slice(0,e.value.length-a));e&&r.push(e)}return r}function parsePlaceable(){consumeToken(Ad,SyntaxError);let e=parseInlineExpression();if(consumeToken(Ed))return e;if(consumeToken(Bd)){let t=function parseVariants(){let e,t=[],i=0;for(;test(pd);){consumeChar("*")&&(e=i);let a=parseVariantKey(),s=parsePattern();if(null===s)throw new SyntaxError("Expected variant value");t[i++]={key:a,value:s}}if(0===i)return null;if(void 0===e)throw new SyntaxError("Expected default variant");return{variants:t,star:e}}();consumeToken(Ed,SyntaxError);return{type:"select",selector:e,...t}}throw new SyntaxError("Unclosed placeable")}function parseInlineExpression(){if("{"===e[t])return parsePlaceable();if(test(vd)){let[,i,a,s=null]=match(vd);if("$"===i)return{type:"var",name:a};if(consumeToken(Md)){let n=function parseArguments(){let i=[];for(;;){switch(e[t]){case")":t++;return i;case void 0:throw new SyntaxError("Unclosed argument list")}i.push(parseArgument());consumeToken(Td)}}();if("-"===i)return{type:"term",name:a,attr:s,args:n};if(md.test(a))return{type:"func",name:a,args:n};throw new SyntaxError("Function names must be all upper-case")}return"-"===i?{type:"term",name:a,attr:s,args:[]}:{type:"mesg",name:a,attr:s}}return parseLiteral()}function parseArgument(){let e=parseInlineExpression();return"mesg"!==e.type?e:consumeToken(Gd)?{type:"narg",name:e.name,value:parseLiteral()}:e}function parseVariantKey(){consumeToken(kd,SyntaxError);let e;e=test(gd)?parseNumberLiteral():{type:"str",value:match1(fd)};consumeToken(Id,SyntaxError);return e}function parseLiteral(){if(test(gd))return parseNumberLiteral();if('"'===e[t])return function parseStringLiteral(){consumeChar('"',SyntaxError);let i="";for(;;){i+=match1(Pd);if("\\"!==e[t]){if(consumeChar('"'))return{type:"str",value:i};throw new SyntaxError("Unclosed string literal")}i+=parseEscapeSequence()}}();throw new SyntaxError("Invalid expression")}function parseNumberLiteral(){let[,e,t=""]=match(gd),i=t.length;return{type:"num",value:parseFloat(e),precision:i}}function parseEscapeSequence(){if(test(yd))return match1(yd);if(test(Fd)){let[,e,t]=match(Fd),i=parseInt(e||t,16);return i<=55295||57344<=i?String.fromCodePoint(i):"�"}throw new SyntaxError("Unknown escape sequence")}function parseIndent(){let i=t;consumeToken(Dd);switch(e[t]){case".":case"[":case"*":case"}":case void 0:return!1;case"{":return makeIndent(e.slice(i,t))}return" "===e[t-1]&&makeIndent(e.slice(i,t))}function trim(e,t){return e.replace(t,"")}function makeIndent(e){let t=e.replace(xd,"\n"),i=Cd.exec(e)[1].length;return new Indent(t,i)}}}class Indent{constructor(e,t){this.value=e;this.length=t}}const Ld=/<|&#?\w+;/,Rd={"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"]},Nd={"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 translateElement(e,t){const{value:i}=t;if("string"==typeof i)if("title"===e.localName&&"http://www.w3.org/1999/xhtml"===e.namespaceURI)e.textContent=i;else if(Ld.test(i)){const t=e.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml","template");t.innerHTML=i;!function overlayChildNodes(e,t){for(const i of e.childNodes)if(i.nodeType!==i.TEXT_NODE)if(i.hasAttribute("data-l10n-name")){const a=getNodeForNamedElement(t,i);e.replaceChild(a,i)}else if(isElementAllowed(i)){const t=createSanitizedElement(i);e.replaceChild(t,i)}else{console.warn(`An element of forbidden type "${i.localName}" was found in the translation. Only safe text-level elements and elements with data-l10n-name are allowed.`);e.replaceChild(createTextNodeFromTextContent(i),i)}t.textContent="";t.appendChild(e)}(t.content,e)}else e.textContent=i;overlayAttributes(t,e)}function hasAttribute(e,t){if(!e)return!1;for(let i of e)if(i.name===t)return!0;return!1}function overlayAttributes(e,t){const i=t.hasAttribute("data-l10n-attrs")?t.getAttribute("data-l10n-attrs").split(",").map((e=>e.trim())):null;for(const a of Array.from(t.attributes))isAttrNameLocalizable(a.name,t,i)&&!hasAttribute(e.attributes,a.name)&&t.removeAttribute(a.name);if(e.attributes)for(const a of Array.from(e.attributes))isAttrNameLocalizable(a.name,t,i)&&t.getAttribute(a.name)!==a.value&&t.setAttribute(a.name,a.value)}function getNodeForNamedElement(e,t){const i=t.getAttribute("data-l10n-name"),a=e.querySelector(`[data-l10n-name="${i}"]`);if(!a){console.warn(`An element named "${i}" wasn't found in the source.`);return createTextNodeFromTextContent(t)}if(a.localName!==t.localName){console.warn(`An element named "${i}" was found in the translation but its type ${t.localName} didn't match the element found in the source (${a.localName}).`);return createTextNodeFromTextContent(t)}e.removeChild(a);return shallowPopulateUsing(t,a.cloneNode(!1))}function createSanitizedElement(e){const t=e.ownerDocument.createElement(e.localName);return shallowPopulateUsing(e,t)}function createTextNodeFromTextContent(e){return e.ownerDocument.createTextNode(e.textContent)}function isElementAllowed(e){const t=Rd[e.namespaceURI];return t&&t.includes(e.localName)}function isAttrNameLocalizable(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(i&&i.includes(e))return!0;const a=Nd[t.namespaceURI];if(!a)return!1;const s=e.toLowerCase(),n=t.localName;if(a.global.includes(s))return!0;if(!a[n])return!1;if(a[n].includes(s))return!0;if("http://www.w3.org/1999/xhtml"===t.namespaceURI&&"input"===n&&"value"===s){const e=t.type.toLowerCase();if("submit"===e||"button"===e||"reset"===e)return!0}return!1}function shallowPopulateUsing(e,t){t.textContent=e.textContent;overlayAttributes(e,t);return t}class CachedIterable extends Array{static from(e){return e instanceof this?e:new this(e)}}Symbol.iterator;class CachedAsyncIterable extends CachedIterable{constructor(e){super();if(Symbol.asyncIterator in Object(e))this.iterator=e[Symbol.asyncIterator]();else{if(!(Symbol.iterator in Object(e)))throw new TypeError("Argument must implement the iteration protocol.");this.iterator=e[Symbol.iterator]()}}[Symbol.asyncIterator](){const e=this;let t=0;return{async next(){e.length<=t&&e.push(e.iterator.next());return e[t++]}}}async touchNext(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=0;for(;t++<e;){const e=this[this.length-1];if(e&&(await e).done)break;this.push(this.iterator.next())}return this[this.length-1]}}class Localization{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;this.resourceIds=e;this.generateBundles=t;this.onChange(!0)}addResourceIds(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.resourceIds.push(...e);this.onChange(t);return this.resourceIds.length}removeResourceIds(e){this.resourceIds=this.resourceIds.filter((t=>!e.includes(t)));this.onChange();return this.resourceIds.length}async formatWithFallback(e,t){const i=[];let a=!1;for await(const s of this.bundles){a=!0;const n=keysFromBundle(t,s,e,i);if(0===n.size)break;if("undefined"!=typeof console){const e=s.locales[0],t=Array.from(n).join(", ");console.warn(`[fluent] Missing translations in ${e}: ${t}`)}}a||"undefined"==typeof console||console.warn(`[fluent] Request for keys failed because no resource bundles got generated.\n  keys: ${JSON.stringify(e)}.\n  resourceIds: ${JSON.stringify(this.resourceIds)}.`);return i}formatMessages(e){return this.formatWithFallback(e,messageFromBundle)}formatValues(e){return this.formatWithFallback(e,valueFromBundle)}async formatValue(e,t){const[i]=await this.formatValues([{id:e,args:t}]);return i}handleEvent(){this.onChange()}onChange(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.bundles=CachedAsyncIterable.from(this.generateBundles(this.resourceIds));e&&this.bundles.touchNext(2)}}function valueFromBundle(e,t,i,a){return i.value?e.formatPattern(i.value,a,t):null}function messageFromBundle(e,t,i,a){const s={value:null,attributes:null};i.value&&(s.value=e.formatPattern(i.value,a,t));let n=Object.keys(i.attributes);if(n.length>0){s.attributes=new Array(n.length);for(let[r,o]of n.entries()){let n=e.formatPattern(i.attributes[o],a,t);s.attributes[r]={name:o,value:n}}}return s}function keysFromBundle(e,t,i,a){const s=[],n=new Set;i.forEach(((i,r)=>{let{id:o,args:l}=i;if(void 0!==a[r])return;let d=t.getMessage(o);if(d){s.length=0;a[r]=e(t,s,d,l);if(s.length>0&&"undefined"!=typeof console){const e=t.locales[0],i=s.join(", ");console.warn(`[fluent][resolver] errors in ${e}/${o}: ${i}.`)}}else n.add(o)}));return n}const Od="data-l10n-id",Wd="data-l10n-args",jd=`[${Od}]`;class DOMLocalization extends Localization{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:[Od,Wd]}}onChange(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super.onChange(e);this.roots&&this.translateRoots()}setAttributes(e,t,i){e.setAttribute(Od,t);i?e.setAttribute(Wd,JSON.stringify(i)):e.removeAttribute(Wd);return e}getAttributes(e){return{id:e.getAttribute(Od),args:JSON.parse(e.getAttribute(Wd)||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:\n          DOMLocalization already has a root from a different window.")}else{this.windowElement=e.ownerDocument.defaultView;this.mutationObserver=new this.windowElement.MutationObserver((e=>this.translateMutations(e)))}this.roots.add(e);this.mutationObserver.observe(e,this.observerConfig)}disconnectRoot(e){this.roots.delete(e);this.pauseObserving();if(0===this.roots.size){this.mutationObserver=null;this.windowElement&&this.pendingrAF&&this.windowElement.cancelAnimationFrame(this.pendingrAF);this.windowElement=null;this.pendingrAF=null;this.pendingElements.clear();return!0}this.resumeObserving();return!1}translateRoots(){const e=Array.from(this.roots);return Promise.all(e.map((e=>this.translateFragment(e))))}pauseObserving(){if(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 e of t.addedNodes)if(e.nodeType===e.ELEMENT_NODE)if(e.childElementCount)for(const t of this.getTranslatables(e))this.pendingElements.add(t);else e.hasAttribute(Od)&&this.pendingElements.add(e)}this.pendingElements.size>0&&null===this.pendingrAF&&(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),i=await this.formatMessages(t);return this.applyTranslations(e,i)}applyTranslations(e,t){this.pauseObserving();for(let i=0;i<e.length;i++)void 0!==t[i]&&translateElement(e[i],t[i]);this.resumeObserving()}getTranslatables(e){const t=Array.from(e.querySelectorAll(jd));"function"==typeof e.hasAttribute&&e.hasAttribute(Od)&&t.push(e);return t}getKeysForElement(e){return{id:e.getAttribute(Od),args:JSON.parse(e.getAttribute(Wd)||null)}}}function l10n_classPrivateFieldInitSpec(e,t,i){(function l10n_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function l10n_classPrivateFieldGet(e,t){return e.get(l10n_assertClassBrand(e,t))}function l10n_classPrivateFieldSet(e,t,i){return e.set(l10n_assertClassBrand(e,t),i),i}function l10n_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Vd=new WeakMap,Hd=new WeakMap,zd=new WeakMap,Ud=new WeakMap;class L10n{constructor(e){let{lang:t,isRTL:i}=e,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;l10n_classPrivateFieldInitSpec(this,Vd,void 0);l10n_classPrivateFieldInitSpec(this,Hd,void 0);l10n_classPrivateFieldInitSpec(this,zd,void 0);l10n_classPrivateFieldInitSpec(this,Ud,void 0);l10n_classPrivateFieldSet(zd,this,_fixupLangCode.call(L10n,t));l10n_classPrivateFieldSet(Ud,this,a);l10n_classPrivateFieldSet(Vd,this,i??_isRTL.call(L10n,l10n_classPrivateFieldGet(zd,this))?"rtl":"ltr")}_setL10n(e){l10n_classPrivateFieldSet(Ud,this,e)}getLanguage(){return l10n_classPrivateFieldGet(zd,this)}getDirection(){return l10n_classPrivateFieldGet(Vd,this)}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2?arguments[2]:void 0;if(Array.isArray(e)){e=e.map((e=>({id:e})));return(await l10n_classPrivateFieldGet(Ud,this).formatMessages(e)).map((e=>e.value))}const a=await l10n_classPrivateFieldGet(Ud,this).formatMessages([{id:e,args:t}]);return a[0]?.value||i}async translate(e){(l10n_classPrivateFieldGet(Hd,this)||l10n_classPrivateFieldSet(Hd,this,new Set)).add(e);try{l10n_classPrivateFieldGet(Ud,this).connectRoot(e)}catch{}await l10n_classPrivateFieldGet(Ud,this).translateRoots()}async translateOnce(e){try{await l10n_classPrivateFieldGet(Ud,this).translateElements([e])}catch(e){console.error("translateOnce:",e)}}async destroy(){if(l10n_classPrivateFieldGet(Hd,this)){for(const e of l10n_classPrivateFieldGet(Hd,this))l10n_classPrivateFieldGet(Ud,this).disconnectRoot(e);l10n_classPrivateFieldGet(Hd,this).clear();l10n_classPrivateFieldSet(Hd,this,null)}l10n_classPrivateFieldGet(Ud,this).pauseObserving()}pause(){l10n_classPrivateFieldGet(Ud,this).pauseObserving()}resume(){l10n_classPrivateFieldGet(Ud,this).resumeObserving()}}function _fixupLangCode(e){return{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?.toLowerCase()||"en-us"]||e}function _isRTL(e){const t=e.split("-",1)[0];return["ar","he","fa","ps","ur"].includes(t)}var $d;function genericl10n_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function PLATFORM(){const{isAndroid:e,isLinux:t,isMac:i,isWindows:a}=util_FeatureTest.platform;return t?"linux":a?"windows":i?"macos":e?"android":"other"}function createBundle(e,t){const i=new FluentResource(t),a=new FluentBundle(e,{functions:{PLATFORM}}),s=a.addResource(i);s.length&&console.error("L10n errors",s);return a}class genericl10n_GenericL10n extends L10n{constructor(e){super({lang:e});const t=e?_generateBundles.bind(genericl10n_GenericL10n,"en-us",this.getLanguage()):_generateBundlesFallback.bind(genericl10n_GenericL10n,this.getLanguage());this._setL10n(new DOMLocalization([],t))}}$d=genericl10n_GenericL10n;async function*_generateBundles(e,t){const{baseURL:i,paths:a}=await genericl10n_assertClassBrand($d,this,_getPaths).call(this),s=[t];if(e!==t){const i=t.split("-",1)[0];i!==t&&s.push(i);s.push(e)}const n=s.map((e=>[e,genericl10n_assertClassBrand($d,this,_createBundle).call(this,e,i,a)]));for(const[e,t]of n){const i=await t;i?yield i:"en-us"===e&&(yield genericl10n_assertClassBrand($d,this,_createBundleFallback).call(this,e))}}async function _createBundle(e,t,i){const a=i[e];if(!a)return null;const s=new URL(a,t);return createBundle(e,await fetchData(s,"text"))}async function _getPaths(){try{const{href:e}=document.querySelector('link[type="application/l10n"]'),t=await fetchData(e,"json");return{baseURL:e.substring(0,e.lastIndexOf("/")+1)||"./",paths:t}}catch{}return{baseURL:"./",paths:Object.create(null)}}async function*_generateBundlesFallback(e){yield genericl10n_assertClassBrand($d,this,_createBundleFallback).call(this,e)}async function _createBundleFallback(e){return createBundle(e,'pdfjs-previous-button =\n    .title = Previous Page\npdfjs-previous-button-label = Previous\npdfjs-next-button =\n    .title = Next Page\npdfjs-next-button-label = Next\npdfjs-page-input =\n    .title = Page\npdfjs-of-pages = of { $pagesCount }\npdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount })\npdfjs-zoom-out-button =\n    .title = Zoom Out\npdfjs-zoom-out-button-label = Zoom Out\npdfjs-zoom-in-button =\n    .title = Zoom In\npdfjs-zoom-in-button-label = Zoom In\npdfjs-zoom-select =\n    .title = Zoom\npdfjs-presentation-mode-button =\n    .title = Switch to Presentation Mode\npdfjs-presentation-mode-button-label = Presentation Mode\npdfjs-open-file-button =\n    .title = Open File\npdfjs-open-file-button-label = Open\npdfjs-print-button =\n    .title = Print\npdfjs-print-button-label = Print\npdfjs-save-button =\n    .title = Save\npdfjs-save-button-label = Save\npdfjs-download-button =\n    .title = Download\npdfjs-download-button-label = Download\npdfjs-bookmark-button =\n    .title = Current Page (View URL from Current Page)\npdfjs-bookmark-button-label = Current Page\npdfjs-tools-button =\n    .title = Tools\npdfjs-tools-button-label = Tools\npdfjs-first-page-button =\n    .title = Go to First Page\npdfjs-first-page-button-label = Go to First Page\npdfjs-last-page-button =\n    .title = Go to Last Page\npdfjs-last-page-button-label = Go to Last Page\npdfjs-page-rotate-cw-button =\n    .title = Rotate Clockwise\npdfjs-page-rotate-cw-button-label = Rotate Clockwise\npdfjs-page-rotate-ccw-button =\n    .title = Rotate Counterclockwise\npdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise\npdfjs-cursor-text-select-tool-button =\n    .title = Enable Text Selection Tool\npdfjs-cursor-text-select-tool-button-label = Text Selection Tool\npdfjs-cursor-hand-tool-button =\n    .title = Enable Hand Tool\npdfjs-cursor-hand-tool-button-label = Hand Tool\npdfjs-scroll-page-button =\n    .title = Use Page Scrolling\npdfjs-scroll-page-button-label = Page Scrolling\npdfjs-scroll-vertical-button =\n    .title = Use Vertical Scrolling\npdfjs-scroll-vertical-button-label = Vertical Scrolling\npdfjs-scroll-horizontal-button =\n    .title = Use Horizontal Scrolling\npdfjs-scroll-horizontal-button-label = Horizontal Scrolling\npdfjs-scroll-wrapped-button =\n    .title = Use Wrapped Scrolling\npdfjs-scroll-wrapped-button-label = Wrapped Scrolling\npdfjs-spread-none-button =\n    .title = Do not join page spreads\npdfjs-spread-none-button-label = No Spreads\npdfjs-spread-odd-button =\n    .title = Join page spreads starting with odd-numbered pages\npdfjs-spread-odd-button-label = Odd Spreads\npdfjs-spread-even-button =\n    .title = Join page spreads starting with even-numbered pages\npdfjs-spread-even-button-label = Even Spreads\npdfjs-document-properties-button =\n    .title = Document Properties…\npdfjs-document-properties-button-label = Document Properties…\npdfjs-document-properties-file-name = File name:\npdfjs-document-properties-file-size = File size:\npdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes)\npdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes)\npdfjs-document-properties-title = Title:\npdfjs-document-properties-author = Author:\npdfjs-document-properties-subject = Subject:\npdfjs-document-properties-keywords = Keywords:\npdfjs-document-properties-creation-date = Creation Date:\npdfjs-document-properties-modification-date = Modification Date:\npdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }\npdfjs-document-properties-creator = Creator:\npdfjs-document-properties-producer = PDF Producer:\npdfjs-document-properties-version = PDF Version:\npdfjs-document-properties-page-count = Page Count:\npdfjs-document-properties-page-size = Page Size:\npdfjs-document-properties-page-size-unit-inches = in\npdfjs-document-properties-page-size-unit-millimeters = mm\npdfjs-document-properties-page-size-orientation-portrait = portrait\npdfjs-document-properties-page-size-orientation-landscape = landscape\npdfjs-document-properties-page-size-name-a-three = A3\npdfjs-document-properties-page-size-name-a-four = A4\npdfjs-document-properties-page-size-name-letter = Letter\npdfjs-document-properties-page-size-name-legal = Legal\npdfjs-document-properties-page-size-dimension-string = { $width } × { $height } { $unit } ({ $orientation })\npdfjs-document-properties-page-size-dimension-name-string = { $width } × { $height } { $unit } ({ $name }, { $orientation })\npdfjs-document-properties-linearized = Fast Web View:\npdfjs-document-properties-linearized-yes = Yes\npdfjs-document-properties-linearized-no = No\npdfjs-document-properties-close-button = Close\npdfjs-print-progress-message = Preparing document for printing…\npdfjs-print-progress-percent = { $progress }%\npdfjs-print-progress-close-button = Cancel\npdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser.\npdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing.\npdfjs-toggle-sidebar-button =\n    .title = Toggle Sidebar\npdfjs-toggle-sidebar-notification-button =\n    .title = Toggle Sidebar (document contains outline/attachments/layers)\npdfjs-toggle-sidebar-button-label = Toggle Sidebar\npdfjs-document-outline-button =\n    .title = Show Document Outline (double-click to expand/collapse all items)\npdfjs-document-outline-button-label = Document Outline\npdfjs-attachments-button =\n    .title = Show Attachments\npdfjs-attachments-button-label = Attachments\npdfjs-layers-button =\n    .title = Show Layers (double-click to reset all layers to the default state)\npdfjs-layers-button-label = Layers\npdfjs-thumbs-button =\n    .title = Show Thumbnails\npdfjs-thumbs-button-label = Thumbnails\npdfjs-current-outline-item-button =\n    .title = Find Current Outline Item\npdfjs-current-outline-item-button-label = Current Outline Item\npdfjs-findbar-button =\n    .title = Find in Document\npdfjs-findbar-button-label = Find\npdfjs-additional-layers = Additional Layers\npdfjs-thumb-page-title =\n    .title = Page { $page }\npdfjs-thumb-page-canvas =\n    .aria-label = Thumbnail of Page { $page }\npdfjs-find-input =\n    .title = Find\n    .placeholder = Find in document…\npdfjs-find-previous-button =\n    .title = Find the previous occurrence of the phrase\npdfjs-find-previous-button-label = Previous\npdfjs-find-next-button =\n    .title = Find the next occurrence of the phrase\npdfjs-find-next-button-label = Next\npdfjs-find-highlight-checkbox = Highlight All\npdfjs-find-match-case-checkbox-label = Match Case\npdfjs-find-match-diacritics-checkbox-label = Match Diacritics\npdfjs-find-entire-word-checkbox-label = Whole Words\npdfjs-find-reached-top = Reached top of document, continued from bottom\npdfjs-find-reached-bottom = Reached end of document, continued from top\npdfjs-find-match-count =\n    { $total ->\n        [one] { $current } of { $total } match\n       *[other] { $current } of { $total } matches\n    }\npdfjs-find-match-count-limit =\n    { $limit ->\n        [one] More than { $limit } match\n       *[other] More than { $limit } matches\n    }\npdfjs-find-not-found = Phrase not found\npdfjs-page-scale-width = Page Width\npdfjs-page-scale-fit = Page Fit\npdfjs-page-scale-auto = Automatic Zoom\npdfjs-page-scale-actual = Actual Size\npdfjs-page-scale-percent = { $scale }%\npdfjs-page-landmark =\n    .aria-label = Page { $page }\npdfjs-loading-error = An error occurred while loading the PDF.\npdfjs-invalid-file-error = Invalid or corrupted PDF file.\npdfjs-missing-file-error = Missing PDF file.\npdfjs-unexpected-response-error = Unexpected server response.\npdfjs-rendering-error = An error occurred while rendering the page.\npdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }\npdfjs-text-annotation-type =\n    .alt = [{ $type } Annotation]\npdfjs-password-label = Enter the password to open this PDF file.\npdfjs-password-invalid = Invalid password. Please try again.\npdfjs-password-ok-button = OK\npdfjs-password-cancel-button = Cancel\npdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts.\npdfjs-editor-free-text-button =\n    .title = Text\npdfjs-editor-color-picker-free-text-input =\n    .title = Change text color\npdfjs-editor-free-text-button-label = Text\npdfjs-editor-ink-button =\n    .title = Draw\npdfjs-editor-color-picker-ink-input =\n    .title = Change drawing color\npdfjs-editor-ink-button-label = Draw\npdfjs-editor-stamp-button =\n    .title = Add or edit images\npdfjs-editor-stamp-button-label = Add or edit images\npdfjs-editor-highlight-button =\n    .title = Highlight\npdfjs-editor-highlight-button-label = Highlight\npdfjs-highlight-floating-button1 =\n    .title = Highlight\n    .aria-label = Highlight\npdfjs-highlight-floating-button-label = Highlight\npdfjs-editor-signature-button =\n    .title = Add signature\npdfjs-editor-signature-button-label = Add signature\npdfjs-editor-highlight-editor =\n    .aria-label = Highlight editor\npdfjs-editor-ink-editor =\n    .aria-label = Drawing editor\npdfjs-editor-signature-editor1 =\n    .aria-description = Signature editor: { $description }\npdfjs-editor-stamp-editor =\n    .aria-label = Image editor\npdfjs-editor-remove-ink-button =\n    .title = Remove drawing\npdfjs-editor-remove-freetext-button =\n    .title = Remove text\npdfjs-editor-remove-stamp-button =\n    .title = Remove image\npdfjs-editor-remove-highlight-button =\n    .title = Remove highlight\npdfjs-editor-remove-signature-button =\n    .title = Remove signature\npdfjs-editor-free-text-color-input = Color\npdfjs-editor-free-text-size-input = Size\npdfjs-editor-ink-color-input = Color\npdfjs-editor-ink-thickness-input = Thickness\npdfjs-editor-ink-opacity-input = Opacity\npdfjs-editor-stamp-add-image-button =\n    .title = Add image\npdfjs-editor-stamp-add-image-button-label = Add image\npdfjs-editor-free-highlight-thickness-input = Thickness\npdfjs-editor-free-highlight-thickness-title =\n    .title = Change thickness when highlighting items other than text\npdfjs-editor-add-signature-container =\n    .aria-label = Signature controls and saved signatures\npdfjs-editor-signature-add-signature-button =\n    .title = Add new signature\npdfjs-editor-signature-add-signature-button-label = Add new signature\npdfjs-editor-add-saved-signature-button =\n    .title = Saved signature: { $description }\npdfjs-free-text2 =\n    .aria-label = Text Editor\n    .default-content = Start typing…\npdfjs-editor-alt-text-button =\n    .aria-label = Alt text\npdfjs-editor-alt-text-button-label = Alt text\npdfjs-editor-alt-text-edit-button =\n    .aria-label = Edit alt text\npdfjs-editor-alt-text-dialog-label = Choose an option\npdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people can’t see the image or when it doesn’t load.\npdfjs-editor-alt-text-add-description-label = Add a description\npdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions.\npdfjs-editor-alt-text-mark-decorative-label = Mark as decorative\npdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks.\npdfjs-editor-alt-text-cancel-button = Cancel\npdfjs-editor-alt-text-save-button = Save\npdfjs-editor-alt-text-decorative-tooltip = Marked as decorative\npdfjs-editor-alt-text-textarea =\n    .placeholder = For example, “A young man sits down at a table to eat a meal”\npdfjs-editor-resizer-top-left =\n    .aria-label = Top left corner — resize\npdfjs-editor-resizer-top-middle =\n    .aria-label = Top middle — resize\npdfjs-editor-resizer-top-right =\n    .aria-label = Top right corner — resize\npdfjs-editor-resizer-middle-right =\n    .aria-label = Middle right — resize\npdfjs-editor-resizer-bottom-right =\n    .aria-label = Bottom right corner — resize\npdfjs-editor-resizer-bottom-middle =\n    .aria-label = Bottom middle — resize\npdfjs-editor-resizer-bottom-left =\n    .aria-label = Bottom left corner — resize\npdfjs-editor-resizer-middle-left =\n    .aria-label = Middle left — resize\npdfjs-editor-highlight-colorpicker-label = Highlight color\npdfjs-editor-colorpicker-button =\n    .title = Change color\npdfjs-editor-colorpicker-dropdown =\n    .aria-label = Color choices\npdfjs-editor-colorpicker-yellow =\n    .title = Yellow\npdfjs-editor-colorpicker-green =\n    .title = Green\npdfjs-editor-colorpicker-blue =\n    .title = Blue\npdfjs-editor-colorpicker-pink =\n    .title = Pink\npdfjs-editor-colorpicker-red =\n    .title = Red\npdfjs-editor-highlight-show-all-button-label = Show all\npdfjs-editor-highlight-show-all-button =\n    .title = Show all\npdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description)\npdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description)\npdfjs-editor-new-alt-text-textarea =\n    .placeholder = Write your description here…\npdfjs-editor-new-alt-text-description = Short description for people who can’t see the image or when the image doesn’t load.\npdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate.\npdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more\npdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically\npdfjs-editor-new-alt-text-not-now-button = Not now\npdfjs-editor-new-alt-text-error-title = Couldn’t create alt text automatically\npdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later.\npdfjs-editor-new-alt-text-error-close-button = Close\npdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\n    .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\npdfjs-editor-new-alt-text-added-button =\n    .aria-label = Alt text added\npdfjs-editor-new-alt-text-added-button-label = Alt text added\npdfjs-editor-new-alt-text-missing-button =\n    .aria-label = Missing alt text\npdfjs-editor-new-alt-text-missing-button-label = Missing alt text\npdfjs-editor-new-alt-text-to-review-button =\n    .aria-label = Review alt text\npdfjs-editor-new-alt-text-to-review-button-label = Review alt text\npdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText }\npdfjs-image-alt-text-settings-button =\n    .title = Image alt text settings\npdfjs-image-alt-text-settings-button-label = Image alt text settings\npdfjs-editor-alt-text-settings-dialog-label = Image alt text settings\npdfjs-editor-alt-text-settings-automatic-title = Automatic alt text\npdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically\npdfjs-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.\npdfjs-editor-alt-text-settings-download-model-label = Alt text AI model ({ $totalSize } MB)\npdfjs-editor-alt-text-settings-ai-model-description = Runs locally on your device so your data stays private. Required for automatic alt text.\npdfjs-editor-alt-text-settings-delete-model-button = Delete\npdfjs-editor-alt-text-settings-download-model-button = Download\npdfjs-editor-alt-text-settings-downloading-model-button = Downloading…\npdfjs-editor-alt-text-settings-editor-title = Alt text editor\npdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image\npdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text.\npdfjs-editor-alt-text-settings-close-button = Close\npdfjs-editor-highlight-added-alert = Highlight added\npdfjs-editor-freetext-added-alert = Text added\npdfjs-editor-ink-added-alert = Drawing added\npdfjs-editor-stamp-added-alert = Image added\npdfjs-editor-signature-added-alert = Signature added\npdfjs-editor-undo-bar-message-highlight = Highlight removed\npdfjs-editor-undo-bar-message-freetext = Text removed\npdfjs-editor-undo-bar-message-ink = Drawing removed\npdfjs-editor-undo-bar-message-stamp = Image removed\npdfjs-editor-undo-bar-message-signature = Signature removed\npdfjs-editor-undo-bar-message-multiple =\n    { $count ->\n        [one] { $count } annotation removed\n       *[other] { $count } annotations removed\n    }\npdfjs-editor-undo-bar-undo-button =\n    .title = Undo\npdfjs-editor-undo-bar-undo-button-label = Undo\npdfjs-editor-undo-bar-close-button =\n    .title = Close\npdfjs-editor-undo-bar-close-button-label = Close\npdfjs-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.\npdfjs-editor-add-signature-dialog-title = Add a signature\npdfjs-editor-add-signature-type-button = Type\n    .title = Type\npdfjs-editor-add-signature-draw-button = Draw\n    .title = Draw\npdfjs-editor-add-signature-image-button = Image\n    .title = Image\npdfjs-editor-add-signature-type-input =\n    .aria-label = Type your signature\n    .placeholder = Type your signature\npdfjs-editor-add-signature-draw-placeholder = Draw your signature\npdfjs-editor-add-signature-draw-thickness-range-label = Thickness\npdfjs-editor-add-signature-draw-thickness-range =\n    .title = Drawing thickness: { $thickness }\npdfjs-editor-add-signature-image-placeholder = Drag a file here to upload\npdfjs-editor-add-signature-image-browse-link =\n    { PLATFORM() ->\n        [macos] Or choose image files\n       *[other] Or browse image files\n    }\npdfjs-editor-add-signature-description-label = Description (alt text)\npdfjs-editor-add-signature-description-input =\n    .title = Description (alt text)\npdfjs-editor-add-signature-description-default-when-drawing = Signature\npdfjs-editor-add-signature-clear-button-label = Clear signature\npdfjs-editor-add-signature-clear-button =\n    .title = Clear signature\npdfjs-editor-add-signature-save-checkbox = Save signature\npdfjs-editor-add-signature-save-warning-message = You’ve reached the limit of 5 saved signatures. Remove one to save more.\npdfjs-editor-add-signature-image-upload-error-title = Couldn’t upload image\npdfjs-editor-add-signature-image-upload-error-description = Check your network connection or try another image.\npdfjs-editor-add-signature-image-no-data-error-title = Can’t convert this image into a signature\npdfjs-editor-add-signature-image-no-data-error-description = Please try uploading a different image.\npdfjs-editor-add-signature-error-close-button = Close\npdfjs-editor-add-signature-cancel-button = Cancel\npdfjs-editor-add-signature-add-button = Add\npdfjs-editor-delete-signature-button1 =\n    .title = Remove saved signature\npdfjs-editor-delete-signature-button-label1 = Remove saved signature\npdfjs-editor-add-signature-edit-button-label = Edit description\npdfjs-editor-edit-signature-dialog-title = Edit description\npdfjs-editor-edit-signature-update-button = Update\npdfjs-editor-edit-comment-actions-button-label = Actions\npdfjs-editor-edit-comment-actions-button =\n    .title = Actions\npdfjs-editor-edit-comment-close-button-label = Close\npdfjs-editor-edit-comment-close-button =\n    .title = Close\npdfjs-editor-edit-comment-actions-edit-button-label = Edit\npdfjs-editor-edit-comment-actions-delete-button-label = Delete\npdfjs-editor-edit-comment-manager-text-input =\n    .placeholder = Enter your comment\npdfjs-editor-edit-comment-manager-cancel-button = Cancel\npdfjs-editor-edit-comment-manager-save-button = Save\npdfjs-editor-edit-comment-button =\n    .title = Edit comment')}class GenericScripting{constructor(e){"Function"===e?.constructor?.name&&(e=e());this._ready=new Promise(((t,i)=>{import(
/*webpackIgnore: true*/
/*@vite-ignore*/
e).then((e=>{t(e.QuickJSSandbox())})).catch(i)}))}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()}}function generic_signature_storage_classPrivateFieldInitSpec(e,t,i){generic_signature_storage_checkPrivateRedeclaration(e,t),t.set(e,i)}function generic_signature_storage_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function generic_signature_storage_classPrivateFieldGet(e,t){return e.get(generic_signature_storage_assertClassBrand(e,t))}function generic_signature_storage_classPrivateFieldSet(e,t,i){return e.set(generic_signature_storage_assertClassBrand(e,t),i),i}function generic_signature_storage_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const qd="pdfjs.signature";var Xd=new WeakMap,Kd=new WeakMap,Yd=new WeakMap,Zd=new WeakSet;class SignatureStorage{constructor(e,t){!function generic_signature_storage_classPrivateMethodInitSpec(e,t){generic_signature_storage_checkPrivateRedeclaration(e,t),t.add(e)}(this,Zd);generic_signature_storage_classPrivateFieldInitSpec(this,Xd,void 0);generic_signature_storage_classPrivateFieldInitSpec(this,Kd,null);generic_signature_storage_classPrivateFieldInitSpec(this,Yd,null);generic_signature_storage_classPrivateFieldSet(Xd,this,e);generic_signature_storage_classPrivateFieldSet(Yd,this,t)}async getAll(){if(generic_signature_storage_classPrivateFieldGet(Yd,this)){window.addEventListener("storage",(e=>{let{key:t}=e;if(t===qd){generic_signature_storage_classPrivateFieldSet(Kd,this,null);generic_signature_storage_classPrivateFieldGet(Xd,this)?.dispatch("storedsignatureschanged",{source:this})}}),{signal:generic_signature_storage_classPrivateFieldGet(Yd,this)});generic_signature_storage_classPrivateFieldSet(Yd,this,null)}if(!generic_signature_storage_classPrivateFieldGet(Kd,this)){generic_signature_storage_classPrivateFieldSet(Kd,this,new Map);const e=localStorage.getItem(qd);if(e)for(const[t,i]of Object.entries(JSON.parse(e)))generic_signature_storage_classPrivateFieldGet(Kd,this).set(t,i)}return generic_signature_storage_classPrivateFieldGet(Kd,this)}async isFull(){return 5===await this.size()}async size(){return(await this.getAll()).size}async create(e){if(await this.isFull())return null;const t=getUuid();generic_signature_storage_classPrivateFieldGet(Kd,this).set(t,e);generic_signature_storage_assertClassBrand(Zd,this,_save).call(this);return t}async delete(e){const t=await this.getAll();if(!t.has(e))return!1;t.delete(e);generic_signature_storage_assertClassBrand(Zd,this,_save).call(this);return!0}}function _save(){localStorage.setItem(qd,JSON.stringify(Object.fromEntries(generic_signature_storage_classPrivateFieldGet(Kd,this))))}class ExternalServices extends BaseExternalServices{async createL10n(){return new genericl10n_GenericL10n(AppOptions.get("localeProperties")?.lang)}createScripting(){return new GenericScripting(AppOptions.get("sandboxBundleSrc"))}createSignatureStorage(e,t){return new SignatureStorage(e,t)}}0;function new_alt_text_manager_classPrivateMethodInitSpec(e,t){new_alt_text_manager_checkPrivateRedeclaration(e,t),t.add(e)}function new_alt_text_manager_classPrivateFieldInitSpec(e,t,i){new_alt_text_manager_checkPrivateRedeclaration(e,t),t.set(e,i)}function new_alt_text_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function new_alt_text_manager_toSetter(e,t,i){t||(t=[]);var a=t.length++;return Object.defineProperty({},"_",{set:function(s){t[a]=s,e.apply(i,t)}})}function new_alt_text_manager_classPrivateFieldGet(e,t){return e.get(new_alt_text_manager_assertClassBrand(e,t))}function new_alt_text_manager_classPrivateFieldSet(e,t,i){return e.set(new_alt_text_manager_assertClassBrand(e,t),i),i}function new_alt_text_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Qd=new WeakMap,Jd=new WeakMap,ec=new WeakMap,tc=new WeakMap,ic=new WeakMap,ac=new WeakMap,sc=new WeakMap,nc=new WeakMap,rc=new WeakMap,oc=new WeakMap,lc=new WeakMap,dc=new WeakMap,cc=new WeakMap,hc=new WeakMap,uc=new WeakMap,_c=new WeakMap,pc=new WeakMap,gc=new WeakMap,fc=new WeakMap,vc=new WeakMap,mc=new WeakMap,wc=new WeakMap,Pc=new WeakMap,yc=new WeakMap,Fc=new WeakMap,bc=new WeakSet;class NewAltTextManager{constructor(e,t,i){let{descriptionContainer:a,dialog:s,imagePreview:n,cancelButton:r,disclaimer:o,notNowButton:l,saveButton:d,textarea:c,learnMore:h,errorCloseButton:u,createAutomaticallyButton:_,downloadModel:p,downloadModelDescription:g,title:f}=e;new_alt_text_manager_classPrivateMethodInitSpec(this,bc);new_alt_text_manager_classPrivateFieldInitSpec(this,Qd,new_alt_text_manager_assertClassBrand(bc,this,_cancel).bind(this));new_alt_text_manager_classPrivateFieldInitSpec(this,Jd,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,ec,null);new_alt_text_manager_classPrivateFieldInitSpec(this,tc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,ic,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,ac,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,sc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,nc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,rc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,oc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,lc,!1);new_alt_text_manager_classPrivateFieldInitSpec(this,dc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,cc,null);new_alt_text_manager_classPrivateFieldInitSpec(this,hc,null);new_alt_text_manager_classPrivateFieldInitSpec(this,uc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,_c,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,pc,!1);new_alt_text_manager_classPrivateFieldInitSpec(this,gc,!1);new_alt_text_manager_classPrivateFieldInitSpec(this,fc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,vc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,mc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,wc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,Pc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,yc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,Fc,null);new_alt_text_manager_classPrivateFieldSet(tc,this,r);new_alt_text_manager_classPrivateFieldSet(Jd,this,_);new_alt_text_manager_classPrivateFieldSet(ic,this,a);new_alt_text_manager_classPrivateFieldSet(ac,this,s);new_alt_text_manager_classPrivateFieldSet(sc,this,o);new_alt_text_manager_classPrivateFieldSet(vc,this,l);new_alt_text_manager_classPrivateFieldSet(uc,this,n);new_alt_text_manager_classPrivateFieldSet(wc,this,c);new_alt_text_manager_classPrivateFieldSet(fc,this,h);new_alt_text_manager_classPrivateFieldSet(Pc,this,f);new_alt_text_manager_classPrivateFieldSet(nc,this,p);new_alt_text_manager_classPrivateFieldSet(rc,this,g);new_alt_text_manager_classPrivateFieldSet(mc,this,t);new_alt_text_manager_classPrivateFieldSet(oc,this,i);s.addEventListener("close",new_alt_text_manager_assertClassBrand(bc,this,_close).bind(this));s.addEventListener("contextmenu",(e=>{e.target!==new_alt_text_manager_classPrivateFieldGet(wc,this)&&e.preventDefault()}));r.addEventListener("click",new_alt_text_manager_classPrivateFieldGet(Qd,this));l.addEventListener("click",new_alt_text_manager_classPrivateFieldGet(Qd,this));d.addEventListener("click",new_alt_text_manager_assertClassBrand(bc,this,new_alt_text_manager_save).bind(this));u.addEventListener("click",(()=>{new_alt_text_manager_assertClassBrand(bc,this,_toggleError).call(this,!1)}));_.addEventListener("click",(async()=>{const e="true"!==_.getAttribute("aria-pressed");new_alt_text_manager_classPrivateFieldGet(ec,this)._reportTelemetry({action:"pdfjs.image.alt_text.ai_generation_check",data:{status:e}});if(new_alt_text_manager_classPrivateFieldGet(yc,this)){new_alt_text_manager_classPrivateFieldGet(yc,this).setPreference("enableGuessAltText",e);await new_alt_text_manager_classPrivateFieldGet(yc,this).mlManager.toggleService("altText",e)}new_alt_text_manager_assertClassBrand(bc,this,_toggleGuessAltText).call(this,e,!1)}));c.addEventListener("focus",(()=>{new_alt_text_manager_classPrivateFieldSet(gc,this,new_alt_text_manager_classPrivateFieldGet(pc,this));new_alt_text_manager_assertClassBrand(bc,this,_toggleLoading).call(this,!1);new_alt_text_manager_assertClassBrand(bc,this,_toggleTitleAndDisclaimer).call(this)}));c.addEventListener("blur",(()=>{c.value||new_alt_text_manager_assertClassBrand(bc,this,_toggleLoading).call(this,new_alt_text_manager_classPrivateFieldGet(gc,this));new_alt_text_manager_assertClassBrand(bc,this,_toggleTitleAndDisclaimer).call(this)}));c.addEventListener("input",(()=>{new_alt_text_manager_assertClassBrand(bc,this,_toggleTitleAndDisclaimer).call(this)}));i._on("enableguessalttext",(e=>{let{value:t}=e;new_alt_text_manager_assertClassBrand(bc,this,_toggleGuessAltText).call(this,t,!1)}));new_alt_text_manager_classPrivateFieldGet(mc,this).register(s);new_alt_text_manager_classPrivateFieldGet(fc,this).addEventListener("click",(()=>{new_alt_text_manager_classPrivateFieldGet(ec,this)._reportTelemetry({action:"pdfjs.image.alt_text.info",data:{topic:"alt_text"}})}))}async editAltText(e,t,i){if(new_alt_text_manager_classPrivateFieldGet(ec,this)||!t)return;if(i&&t.hasAltTextData()){t.altTextFinish();return}new_alt_text_manager_classPrivateFieldSet(lc,this,i);let{mlManager:a}=e,s=!!a;new_alt_text_manager_assertClassBrand(bc,this,_toggleTitleAndDisclaimer).call(this);if(a&&!a.isReady("altText")){s=!1;a.hasProgress?new_alt_text_manager_assertClassBrand(bc,this,_setProgress).call(this):a=null}else new_alt_text_manager_classPrivateFieldGet(nc,this).classList.toggle("hidden",!0);const n=a?.isEnabledFor("altText");new_alt_text_manager_classPrivateFieldSet(ec,this,t);new_alt_text_manager_classPrivateFieldSet(yc,this,e);new_alt_text_manager_classPrivateFieldGet(yc,this).removeEditListeners();({altText:new_alt_text_manager_toSetter(new_alt_text_manager_classPrivateFieldSet,[Fc,this])._}=t.altTextData);new_alt_text_manager_classPrivateFieldGet(wc,this).value=new_alt_text_manager_classPrivateFieldGet(Fc,this)??"";let r,o,l;if(a){({canvas:r,width:o,height:l,imageData:new_alt_text_manager_toSetter(new_alt_text_manager_classPrivateFieldSet,[_c,this])._}=t.copyCanvas(224,180,!0));s&&new_alt_text_manager_assertClassBrand(bc,this,_toggleGuessAltText).call(this,await n,!0)}else({canvas:r,width:o,height:l}=t.copyCanvas(224,180,!1));r.setAttribute("role","presentation");const{style:d}=r;d.width=`${o}px`;d.height=`${l}px`;new_alt_text_manager_classPrivateFieldGet(uc,this).append(r);new_alt_text_manager_assertClassBrand(bc,this,_toggleNotNow).call(this);new_alt_text_manager_assertClassBrand(bc,this,_toggleAI).call(this,s);new_alt_text_manager_assertClassBrand(bc,this,_toggleError).call(this,!1);try{await new_alt_text_manager_classPrivateFieldGet(mc,this).open(new_alt_text_manager_classPrivateFieldGet(ac,this))}catch(e){new_alt_text_manager_assertClassBrand(bc,this,_close).call(this);throw e}}destroy(){new_alt_text_manager_classPrivateFieldSet(yc,this,null);new_alt_text_manager_assertClassBrand(bc,this,_finish).call(this)}}function _toggleLoading(e){if(new_alt_text_manager_classPrivateFieldGet(yc,this)&&new_alt_text_manager_classPrivateFieldGet(pc,this)!==e){new_alt_text_manager_classPrivateFieldSet(pc,this,e);new_alt_text_manager_classPrivateFieldGet(ic,this).classList.toggle("loading",e)}}function _toggleError(e){new_alt_text_manager_classPrivateFieldGet(yc,this)&&new_alt_text_manager_classPrivateFieldGet(ac,this).classList.toggle("error",e)}async function _toggleGuessAltText(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(new_alt_text_manager_classPrivateFieldGet(yc,this)){new_alt_text_manager_classPrivateFieldGet(ac,this).classList.toggle("aiDisabled",!e);new_alt_text_manager_classPrivateFieldGet(Jd,this).setAttribute("aria-pressed",e);if(e){const{altTextLearnMoreUrl:e}=new_alt_text_manager_classPrivateFieldGet(yc,this).mlManager;e&&(new_alt_text_manager_classPrivateFieldGet(fc,this).href=e);new_alt_text_manager_assertClassBrand(bc,this,_mlGuessAltText).call(this,t)}else{new_alt_text_manager_assertClassBrand(bc,this,_toggleLoading).call(this,!1);new_alt_text_manager_classPrivateFieldSet(pc,this,!1);new_alt_text_manager_assertClassBrand(bc,this,_toggleTitleAndDisclaimer).call(this)}}}function _toggleNotNow(){new_alt_text_manager_classPrivateFieldGet(vc,this).classList.toggle("hidden",!new_alt_text_manager_classPrivateFieldGet(lc,this));new_alt_text_manager_classPrivateFieldGet(tc,this).classList.toggle("hidden",new_alt_text_manager_classPrivateFieldGet(lc,this))}function _toggleAI(e){if(new_alt_text_manager_classPrivateFieldGet(yc,this)&&new_alt_text_manager_classPrivateFieldGet(cc,this)!==e){new_alt_text_manager_classPrivateFieldSet(cc,this,e);new_alt_text_manager_classPrivateFieldGet(ac,this).classList.toggle("noAi",!e);new_alt_text_manager_assertClassBrand(bc,this,_toggleTitleAndDisclaimer).call(this)}}function _toggleTitleAndDisclaimer(){const e=new_alt_text_manager_classPrivateFieldGet(pc,this)||new_alt_text_manager_classPrivateFieldGet(dc,this)&&new_alt_text_manager_classPrivateFieldGet(dc,this)===new_alt_text_manager_classPrivateFieldGet(wc,this).value;new_alt_text_manager_classPrivateFieldGet(sc,this).hidden=!e;const t=new_alt_text_manager_classPrivateFieldGet(pc,this)||!!new_alt_text_manager_classPrivateFieldGet(wc,this).value;if(new_alt_text_manager_classPrivateFieldGet(hc,this)!==t){new_alt_text_manager_classPrivateFieldSet(hc,this,t);new_alt_text_manager_classPrivateFieldGet(Pc,this).setAttribute("data-l10n-id",t?"pdfjs-editor-new-alt-text-dialog-edit-label":"pdfjs-editor-new-alt-text-dialog-add-label")}}async function _mlGuessAltText(e){if(new_alt_text_manager_classPrivateFieldGet(pc,this))return;if(new_alt_text_manager_classPrivateFieldGet(wc,this).value)return;if(e&&null!==new_alt_text_manager_classPrivateFieldGet(Fc,this))return;new_alt_text_manager_classPrivateFieldSet(dc,this,new_alt_text_manager_classPrivateFieldGet(ec,this).guessedAltText);if(null===new_alt_text_manager_classPrivateFieldGet(Fc,this)&&new_alt_text_manager_classPrivateFieldGet(dc,this)){new_alt_text_manager_assertClassBrand(bc,this,_addAltText).call(this,new_alt_text_manager_classPrivateFieldGet(dc,this));return}new_alt_text_manager_assertClassBrand(bc,this,_toggleLoading).call(this,!0);new_alt_text_manager_assertClassBrand(bc,this,_toggleTitleAndDisclaimer).call(this);let t=!1;try{const e=await new_alt_text_manager_classPrivateFieldGet(ec,this).mlGuessAltText(new_alt_text_manager_classPrivateFieldGet(_c,this),!1);if(e){new_alt_text_manager_classPrivateFieldSet(dc,this,e);new_alt_text_manager_classPrivateFieldSet(gc,this,new_alt_text_manager_classPrivateFieldGet(pc,this));new_alt_text_manager_classPrivateFieldGet(pc,this)&&new_alt_text_manager_assertClassBrand(bc,this,_addAltText).call(this,e)}}catch(e){console.error(e);t=!0}new_alt_text_manager_assertClassBrand(bc,this,_toggleLoading).call(this,!1);new_alt_text_manager_assertClassBrand(bc,this,_toggleTitleAndDisclaimer).call(this);t&&new_alt_text_manager_classPrivateFieldGet(yc,this)&&new_alt_text_manager_assertClassBrand(bc,this,_toggleError).call(this,!0)}function _addAltText(e){if(new_alt_text_manager_classPrivateFieldGet(yc,this)&&!new_alt_text_manager_classPrivateFieldGet(wc,this).value){new_alt_text_manager_classPrivateFieldGet(wc,this).value=e;new_alt_text_manager_assertClassBrand(bc,this,_toggleTitleAndDisclaimer).call(this)}}function _setProgress(){new_alt_text_manager_classPrivateFieldGet(nc,this).classList.toggle("hidden",!1);const callback=async e=>{let{detail:{finished:t,total:i,totalLoaded:a}}=e;const s=1e6;a=Math.min(.99*i,a);const n=new_alt_text_manager_classPrivateFieldGet(rc,this).ariaValueMax=Math.round(i/s),r=new_alt_text_manager_classPrivateFieldGet(rc,this).ariaValueNow=Math.round(a/s);new_alt_text_manager_classPrivateFieldGet(rc,this).setAttribute("data-l10n-args",JSON.stringify({totalSize:n,downloadedSize:r}));if(!t)return;new_alt_text_manager_classPrivateFieldGet(oc,this)._off("loadaiengineprogress",callback);new_alt_text_manager_classPrivateFieldGet(nc,this).classList.toggle("hidden",!0);new_alt_text_manager_assertClassBrand(bc,this,_toggleAI).call(this,!0);if(!new_alt_text_manager_classPrivateFieldGet(yc,this))return;const{mlManager:o}=new_alt_text_manager_classPrivateFieldGet(yc,this);o.toggleService("altText",!0);new_alt_text_manager_assertClassBrand(bc,this,_toggleGuessAltText).call(this,await o.isEnabledFor("altText"),!0)};new_alt_text_manager_classPrivateFieldGet(oc,this)._on("loadaiengineprogress",callback)}function _cancel(){new_alt_text_manager_classPrivateFieldGet(ec,this).altTextData={cancel:!0};const e=new_alt_text_manager_classPrivateFieldGet(wc,this).value.trim();new_alt_text_manager_classPrivateFieldGet(ec,this)._reportTelemetry({action:"pdfjs.image.alt_text.dismiss",data:{alt_text_type:e?"present":"empty",flow:new_alt_text_manager_classPrivateFieldGet(lc,this)?"image_add":"alt_text_edit"}});new_alt_text_manager_classPrivateFieldGet(ec,this)._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!0,alt_text_type:"skipped"}});new_alt_text_manager_assertClassBrand(bc,this,_finish).call(this)}function _finish(){new_alt_text_manager_classPrivateFieldGet(mc,this).closeIfActive(new_alt_text_manager_classPrivateFieldGet(ac,this))}function _close(){const e=new_alt_text_manager_classPrivateFieldGet(uc,this).firstChild;e.remove();e.width=e.height=0;new_alt_text_manager_classPrivateFieldSet(_c,this,null);new_alt_text_manager_assertClassBrand(bc,this,_toggleLoading).call(this,!1);new_alt_text_manager_classPrivateFieldGet(yc,this)?.addEditListeners();new_alt_text_manager_classPrivateFieldGet(ec,this).altTextFinish();new_alt_text_manager_classPrivateFieldGet(yc,this)?.setSelected(new_alt_text_manager_classPrivateFieldGet(ec,this));new_alt_text_manager_classPrivateFieldSet(ec,this,null);new_alt_text_manager_classPrivateFieldSet(yc,this,null)}function _extractWords(e){return new Set(e.toLowerCase().split(/[^\p{L}\p{N}]+/gu).filter((e=>!!e)))}function new_alt_text_manager_save(){const e=new_alt_text_manager_classPrivateFieldGet(wc,this).value.trim();new_alt_text_manager_classPrivateFieldGet(ec,this).altTextData={altText:e,decorative:!1};new_alt_text_manager_classPrivateFieldGet(ec,this).altTextData.guessedAltText=new_alt_text_manager_classPrivateFieldGet(dc,this);if(new_alt_text_manager_classPrivateFieldGet(dc,this)&&new_alt_text_manager_classPrivateFieldGet(dc,this)!==e){const t=new_alt_text_manager_assertClassBrand(bc,this,_extractWords).call(this,new_alt_text_manager_classPrivateFieldGet(dc,this)),i=new_alt_text_manager_assertClassBrand(bc,this,_extractWords).call(this,e);new_alt_text_manager_classPrivateFieldGet(ec,this)._reportTelemetry({action:"pdfjs.image.alt_text.user_edit",data:{total_words:t.size,words_removed:t.difference(i).size,words_added:i.difference(t).size}})}new_alt_text_manager_classPrivateFieldGet(ec,this)._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!0,alt_text_type:e?"present":"empty"}});new_alt_text_manager_classPrivateFieldGet(ec,this)._reportTelemetry({action:"pdfjs.image.alt_text.save",data:{alt_text_type:e?"present":"empty",flow:new_alt_text_manager_classPrivateFieldGet(lc,this)?"image_add":"alt_text_edit"}});new_alt_text_manager_assertClassBrand(bc,this,_finish).call(this)}var Sc=new WeakMap,xc=new WeakMap,Cc=new WeakMap,Ac=new WeakMap,Ec=new WeakMap,kc=new WeakMap,Ic=new WeakMap,Mc=new WeakMap,Bc=new WeakSet;class ImageAltTextSettings{constructor(e,t,i,a){let{dialog:s,createModelButton:n,aiModelSettings:r,learnMore:o,closeButton:l,deleteModelButton:d,downloadModelButton:c,showAltTextDialogButton:h}=e;new_alt_text_manager_classPrivateMethodInitSpec(this,Bc);new_alt_text_manager_classPrivateFieldInitSpec(this,Sc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,xc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,Cc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,Ac,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,Ec,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,kc,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,Ic,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,Mc,void 0);new_alt_text_manager_classPrivateFieldSet(Ac,this,s);new_alt_text_manager_classPrivateFieldSet(Sc,this,r);new_alt_text_manager_classPrivateFieldSet(xc,this,n);new_alt_text_manager_classPrivateFieldSet(Cc,this,c);new_alt_text_manager_classPrivateFieldSet(Mc,this,h);new_alt_text_manager_classPrivateFieldSet(Ic,this,t);new_alt_text_manager_classPrivateFieldSet(Ec,this,i);new_alt_text_manager_classPrivateFieldSet(kc,this,a);const{altTextLearnMoreUrl:u}=a;u&&(o.href=u);s.addEventListener("contextmenu",noContextMenu);n.addEventListener("click",(async e=>{const t=new_alt_text_manager_assertClassBrand(Bc,this,_togglePref).call(this,"enableGuessAltText",e);await a.toggleService("altText",t);new_alt_text_manager_assertClassBrand(Bc,this,_reportTelemetry).call(this,{type:"stamp",action:"pdfjs.image.alt_text.settings_ai_generation_check",data:{status:t}})}));h.addEventListener("click",(e=>{const t=new_alt_text_manager_assertClassBrand(Bc,this,_togglePref).call(this,"enableNewAltTextWhenAddingImage",e);new_alt_text_manager_assertClassBrand(Bc,this,_reportTelemetry).call(this,{type:"stamp",action:"pdfjs.image.alt_text.settings_edit_alt_text_check",data:{status:t}})}));d.addEventListener("click",new_alt_text_manager_assertClassBrand(Bc,this,_delete).bind(this,!0));c.addEventListener("click",new_alt_text_manager_assertClassBrand(Bc,this,new_alt_text_manager_download).bind(this,!0));l.addEventListener("click",new_alt_text_manager_assertClassBrand(Bc,this,_finish2).bind(this));o.addEventListener("click",(()=>{new_alt_text_manager_assertClassBrand(Bc,this,_reportTelemetry).call(this,{type:"stamp",action:"pdfjs.image.alt_text.info",data:{topic:"ai_generation"}})}));i._on("enablealttextmodeldownload",(e=>{let{value:t}=e;t?new_alt_text_manager_assertClassBrand(Bc,this,new_alt_text_manager_download).call(this,!1):new_alt_text_manager_assertClassBrand(Bc,this,_delete).call(this,!1)}));new_alt_text_manager_classPrivateFieldGet(Ic,this).register(s)}async open(e){let{enableGuessAltText:t,enableNewAltTextWhenAddingImage:i}=e;const{enableAltTextModelDownload:a}=new_alt_text_manager_classPrivateFieldGet(kc,this);new_alt_text_manager_classPrivateFieldGet(xc,this).disabled=!a;new_alt_text_manager_classPrivateFieldGet(xc,this).setAttribute("aria-pressed",a&&t);new_alt_text_manager_classPrivateFieldGet(Mc,this).setAttribute("aria-pressed",i);new_alt_text_manager_classPrivateFieldGet(Sc,this).classList.toggle("download",!a);await new_alt_text_manager_classPrivateFieldGet(Ic,this).open(new_alt_text_manager_classPrivateFieldGet(Ac,this));new_alt_text_manager_assertClassBrand(Bc,this,_reportTelemetry).call(this,{type:"stamp",action:"pdfjs.image.alt_text.settings_displayed"})}}function _reportTelemetry(e){new_alt_text_manager_classPrivateFieldGet(Ec,this).dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}async function new_alt_text_manager_download(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0]){new_alt_text_manager_classPrivateFieldGet(Cc,this).disabled=!0;const e=new_alt_text_manager_classPrivateFieldGet(Cc,this).firstChild;e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-settings-downloading-model-button");await new_alt_text_manager_classPrivateFieldGet(kc,this).downloadModel("altText");e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-settings-download-model-button");new_alt_text_manager_classPrivateFieldGet(xc,this).disabled=!1;new_alt_text_manager_assertClassBrand(Bc,this,_setPref).call(this,"enableGuessAltText",!0);new_alt_text_manager_classPrivateFieldGet(kc,this).toggleService("altText",!0);new_alt_text_manager_assertClassBrand(Bc,this,_setPref).call(this,"enableAltTextModelDownload",!0);new_alt_text_manager_classPrivateFieldGet(Cc,this).disabled=!1}new_alt_text_manager_classPrivateFieldGet(Sc,this).classList.toggle("download",!1);new_alt_text_manager_classPrivateFieldGet(xc,this).setAttribute("aria-pressed",!0)}async function _delete(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0]){await new_alt_text_manager_classPrivateFieldGet(kc,this).deleteModel("altText");new_alt_text_manager_assertClassBrand(Bc,this,_setPref).call(this,"enableGuessAltText",!1);new_alt_text_manager_assertClassBrand(Bc,this,_setPref).call(this,"enableAltTextModelDownload",!1)}new_alt_text_manager_classPrivateFieldGet(Sc,this).classList.toggle("download",!0);new_alt_text_manager_classPrivateFieldGet(xc,this).disabled=!0;new_alt_text_manager_classPrivateFieldGet(xc,this).setAttribute("aria-pressed",!1)}function _togglePref(e,t){let{target:i}=t;const a="true"!==i.getAttribute("aria-pressed");new_alt_text_manager_assertClassBrand(Bc,this,_setPref).call(this,e,a);i.setAttribute("aria-pressed",a);return a}function _setPref(e,t){new_alt_text_manager_classPrivateFieldGet(Ec,this).dispatch("setpreference",{source:this,name:e,value:t})}function _finish2(){new_alt_text_manager_classPrivateFieldGet(Ic,this).closeIfActive(new_alt_text_manager_classPrivateFieldGet(Ac,this))}function alt_text_manager_classPrivateFieldInitSpec(e,t,i){alt_text_manager_checkPrivateRedeclaration(e,t),t.set(e,i)}function alt_text_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function alt_text_manager_classPrivateFieldGet(e,t){return e.get(alt_text_manager_assertClassBrand(e,t))}function alt_text_manager_classPrivateFieldSet(e,t,i){return e.set(alt_text_manager_assertClassBrand(e,t),i),i}function alt_text_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Gc=new WeakMap,Tc=new WeakMap,Dc=new WeakMap,Lc=new WeakMap,Rc=new WeakMap,Nc=new WeakMap,Oc=new WeakMap,Wc=new WeakMap,jc=new WeakMap,Vc=new WeakMap,Hc=new WeakMap,zc=new WeakMap,Uc=new WeakMap,$c=new WeakMap,qc=new WeakMap,Xc=new WeakMap,Kc=new WeakMap,Yc=new WeakMap,Zc=new WeakSet;class AltTextManager{constructor(e,t,i,a){let{dialog:s,optionDescription:n,optionDecorative:r,textarea:o,cancelButton:l,saveButton:d}=e;!function alt_text_manager_classPrivateMethodInitSpec(e,t){alt_text_manager_checkPrivateRedeclaration(e,t),t.add(e)}(this,Zc);alt_text_manager_classPrivateFieldInitSpec(this,Gc,null);alt_text_manager_classPrivateFieldInitSpec(this,Tc,null);alt_text_manager_classPrivateFieldInitSpec(this,Dc,void 0);alt_text_manager_classPrivateFieldInitSpec(this,Lc,void 0);alt_text_manager_classPrivateFieldInitSpec(this,Rc,void 0);alt_text_manager_classPrivateFieldInitSpec(this,Nc,!1);alt_text_manager_classPrivateFieldInitSpec(this,Oc,void 0);alt_text_manager_classPrivateFieldInitSpec(this,Wc,void 0);alt_text_manager_classPrivateFieldInitSpec(this,jc,void 0);alt_text_manager_classPrivateFieldInitSpec(this,Vc,void 0);alt_text_manager_classPrivateFieldInitSpec(this,Hc,void 0);alt_text_manager_classPrivateFieldInitSpec(this,zc,void 0);alt_text_manager_classPrivateFieldInitSpec(this,Uc,null);alt_text_manager_classPrivateFieldInitSpec(this,$c,null);alt_text_manager_classPrivateFieldInitSpec(this,qc,null);alt_text_manager_classPrivateFieldInitSpec(this,Xc,null);alt_text_manager_classPrivateFieldInitSpec(this,Kc,void 0);alt_text_manager_classPrivateFieldInitSpec(this,Yc,null);alt_text_manager_classPrivateFieldSet(Lc,this,s);alt_text_manager_classPrivateFieldSet(Oc,this,n);alt_text_manager_classPrivateFieldSet(Wc,this,r);alt_text_manager_classPrivateFieldSet(Hc,this,o);alt_text_manager_classPrivateFieldSet(Dc,this,l);alt_text_manager_classPrivateFieldSet(Vc,this,d);alt_text_manager_classPrivateFieldSet(jc,this,i);alt_text_manager_classPrivateFieldSet(Rc,this,a);alt_text_manager_classPrivateFieldSet(Kc,this,t);const c=alt_text_manager_assertClassBrand(Zc,this,_updateUIState).bind(this);s.addEventListener("close",alt_text_manager_assertClassBrand(Zc,this,alt_text_manager_close).bind(this));s.addEventListener("contextmenu",(e=>{e.target!==alt_text_manager_classPrivateFieldGet(Hc,this)&&e.preventDefault()}));l.addEventListener("click",alt_text_manager_assertClassBrand(Zc,this,alt_text_manager_finish).bind(this));d.addEventListener("click",alt_text_manager_assertClassBrand(Zc,this,alt_text_manager_save).bind(this));n.addEventListener("change",c);r.addEventListener("change",c);alt_text_manager_classPrivateFieldGet(jc,this).register(s)}async editAltText(e,t){if(alt_text_manager_classPrivateFieldGet(Tc,this)||!t)return;alt_text_manager_assertClassBrand(Zc,this,_createSVGElement).call(this);alt_text_manager_classPrivateFieldSet(Nc,this,!1);alt_text_manager_classPrivateFieldSet(Gc,this,new AbortController);const i={signal:alt_text_manager_classPrivateFieldGet(Gc,this).signal},a=alt_text_manager_assertClassBrand(Zc,this,_onClick).bind(this);for(const e of[alt_text_manager_classPrivateFieldGet(Oc,this),alt_text_manager_classPrivateFieldGet(Wc,this),alt_text_manager_classPrivateFieldGet(Hc,this),alt_text_manager_classPrivateFieldGet(Vc,this),alt_text_manager_classPrivateFieldGet(Dc,this)])e.addEventListener("click",a,i);const{altText:s,decorative:n}=t.altTextData;if(!0===n){alt_text_manager_classPrivateFieldGet(Wc,this).checked=!0;alt_text_manager_classPrivateFieldGet(Oc,this).checked=!1}else{alt_text_manager_classPrivateFieldGet(Wc,this).checked=!1;alt_text_manager_classPrivateFieldGet(Oc,this).checked=!0}alt_text_manager_classPrivateFieldSet(Uc,this,alt_text_manager_classPrivateFieldGet(Hc,this).value=s?.trim()||"");alt_text_manager_assertClassBrand(Zc,this,_updateUIState).call(this);alt_text_manager_classPrivateFieldSet(Tc,this,t);alt_text_manager_classPrivateFieldSet(zc,this,e);alt_text_manager_classPrivateFieldGet(zc,this).removeEditListeners();alt_text_manager_classPrivateFieldSet($c,this,new AbortController);alt_text_manager_classPrivateFieldGet(Rc,this)._on("resize",alt_text_manager_assertClassBrand(Zc,this,alt_text_manager_setPosition).bind(this),{signal:alt_text_manager_classPrivateFieldGet($c,this).signal});try{await alt_text_manager_classPrivateFieldGet(jc,this).open(alt_text_manager_classPrivateFieldGet(Lc,this));alt_text_manager_assertClassBrand(Zc,this,alt_text_manager_setPosition).call(this)}catch(e){alt_text_manager_assertClassBrand(Zc,this,alt_text_manager_close).call(this);throw e}}destroy(){alt_text_manager_classPrivateFieldSet(zc,this,null);alt_text_manager_assertClassBrand(Zc,this,alt_text_manager_finish).call(this);alt_text_manager_classPrivateFieldGet(qc,this)?.remove();alt_text_manager_classPrivateFieldSet(qc,this,alt_text_manager_classPrivateFieldSet(Xc,this,null))}}function _createSVGElement(){if(alt_text_manager_classPrivateFieldGet(qc,this))return;const e=new DOMSVGFactory,t=alt_text_manager_classPrivateFieldSet(qc,this,e.createElement("svg"));t.setAttribute("width","0");t.setAttribute("height","0");const i=e.createElement("defs");t.append(i);const a=e.createElement("mask");i.append(a);a.setAttribute("id","alttext-manager-mask");a.setAttribute("maskContentUnits","objectBoundingBox");let s=e.createElement("rect");a.append(s);s.setAttribute("fill","white");s.setAttribute("width","1");s.setAttribute("height","1");s.setAttribute("x","0");s.setAttribute("y","0");s=alt_text_manager_classPrivateFieldSet(Xc,this,e.createElement("rect"));a.append(s);s.setAttribute("fill","black");alt_text_manager_classPrivateFieldGet(Lc,this).append(t)}function alt_text_manager_setPosition(){if(!alt_text_manager_classPrivateFieldGet(Tc,this))return;const e=alt_text_manager_classPrivateFieldGet(Lc,this),{style:t}=e,{x:i,y:a,width:s,height:n}=alt_text_manager_classPrivateFieldGet(Kc,this).getBoundingClientRect(),{innerWidth:r,innerHeight:o}=window,{width:l,height:d}=e.getBoundingClientRect(),{x:c,y:h,width:u,height:_}=alt_text_manager_classPrivateFieldGet(Tc,this).getClientDimensions(),p=10,g="ltr"===alt_text_manager_classPrivateFieldGet(zc,this).direction,f=Math.max(c,i),v=Math.min(c+u,i+s),m=Math.max(h,a),w=Math.min(h+_,a+n);alt_text_manager_classPrivateFieldGet(Xc,this).setAttribute("width",""+(v-f)/r);alt_text_manager_classPrivateFieldGet(Xc,this).setAttribute("height",""+(w-m)/o);alt_text_manager_classPrivateFieldGet(Xc,this).setAttribute("x",""+f/r);alt_text_manager_classPrivateFieldGet(Xc,this).setAttribute("y",""+m/o);let P=null,y=Math.max(h,0);y+=Math.min(o-(y+d),0);g?c+u+p+l<r?P=c+u+p:c>l+p&&(P=c-l-p):c>l+p?P=c-l-p:c+u+p+l<r&&(P=c+u+p);if(null===P){y=null;P=Math.max(c,0);P+=Math.min(r-(P+l),0);h>d+p?y=h-d-p:h+_+p+d<o&&(y=h+_+p)}if(null!==y){e.classList.add("positioned");g?t.left=`${P}px`:t.right=r-P-l+"px";t.top=`${y}px`}else{e.classList.remove("positioned");t.left="";t.top=""}}function alt_text_manager_finish(){alt_text_manager_classPrivateFieldGet(jc,this).closeIfActive(alt_text_manager_classPrivateFieldGet(Lc,this))}function alt_text_manager_close(){alt_text_manager_classPrivateFieldGet(Tc,this)._reportTelemetry(alt_text_manager_classPrivateFieldGet(Yc,this)||{action:"alt_text_cancel",alt_text_keyboard:!alt_text_manager_classPrivateFieldGet(Nc,this)});alt_text_manager_classPrivateFieldSet(Yc,this,null);alt_text_manager_assertClassBrand(Zc,this,_removeOnClickListeners).call(this);alt_text_manager_classPrivateFieldGet(zc,this)?.addEditListeners();alt_text_manager_classPrivateFieldGet($c,this)?.abort();alt_text_manager_classPrivateFieldSet($c,this,null);alt_text_manager_classPrivateFieldGet(Tc,this).altTextFinish();alt_text_manager_classPrivateFieldSet(Tc,this,null);alt_text_manager_classPrivateFieldSet(zc,this,null)}function _updateUIState(){alt_text_manager_classPrivateFieldGet(Hc,this).disabled=alt_text_manager_classPrivateFieldGet(Wc,this).checked}function alt_text_manager_save(){const e=alt_text_manager_classPrivateFieldGet(Hc,this).value.trim(),t=alt_text_manager_classPrivateFieldGet(Wc,this).checked;alt_text_manager_classPrivateFieldGet(Tc,this).altTextData={altText:e,decorative:t};alt_text_manager_classPrivateFieldSet(Yc,this,{action:"alt_text_save",alt_text_description:!!e,alt_text_edit:!!alt_text_manager_classPrivateFieldGet(Uc,this)&&alt_text_manager_classPrivateFieldGet(Uc,this)!==e,alt_text_decorative:t,alt_text_keyboard:!alt_text_manager_classPrivateFieldGet(Nc,this)});alt_text_manager_assertClassBrand(Zc,this,alt_text_manager_finish).call(this)}function _onClick(e){if(0!==e.detail){alt_text_manager_classPrivateFieldSet(Nc,this,!0);alt_text_manager_assertClassBrand(Zc,this,_removeOnClickListeners).call(this)}}function _removeOnClickListeners(){alt_text_manager_classPrivateFieldGet(Gc,this)?.abort();alt_text_manager_classPrivateFieldSet(Gc,this,null)}function annotation_editor_params_classPrivateMethodInitSpec(e,t){(function annotation_editor_params_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}var Qc,Jc=new WeakSet;class AnnotationEditorParams{constructor(e,t){annotation_editor_params_classPrivateMethodInitSpec(this,Jc);this.eventBus=t;(function annotation_editor_params_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")})(Jc,this,_bindListeners).call(this,e)}}function _bindListeners(e){let{editorFreeTextFontSize:t,editorFreeTextColor:i,editorInkColor:a,editorInkThickness:s,editorInkOpacity:n,editorStampAddImage:r,editorFreeHighlightThickness:o,editorHighlightShowAll:l,editorSignatureAddSignature:d}=e;const{eventBus:c}=this,dispatchEvent=(e,t)=>{c.dispatch("switchannotationeditorparams",{source:this,type:v[e],value:t})};t.addEventListener("input",(function(){dispatchEvent("FREETEXT_SIZE",this.valueAsNumber)}));i.addEventListener("input",(function(){dispatchEvent("FREETEXT_COLOR",this.value)}));a.addEventListener("input",(function(){dispatchEvent("INK_COLOR",this.value)}));s.addEventListener("input",(function(){dispatchEvent("INK_THICKNESS",this.valueAsNumber)}));n.addEventListener("input",(function(){dispatchEvent("INK_OPACITY",this.valueAsNumber)}));r.addEventListener("click",(()=>{c.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{action:"pdfjs.image.add_image_click"}}});dispatchEvent("CREATE")}));o.addEventListener("input",(function(){dispatchEvent("HIGHLIGHT_THICKNESS",this.valueAsNumber)}));l.addEventListener("click",(function(){const e="true"===this.getAttribute("aria-pressed");this.setAttribute("aria-pressed",!e);dispatchEvent("HIGHLIGHT_SHOW_ALL",!e)}));d?.addEventListener("click",(()=>{dispatchEvent("CREATE")}));c._on("annotationeditorparamschanged",(e=>{for(const[r,d]of e.details)switch(r){case v.FREETEXT_SIZE:t.value=d;break;case v.FREETEXT_COLOR:i.value=d;break;case v.INK_COLOR:a.value=d;break;case v.INK_THICKNESS:s.value=d;break;case v.INK_OPACITY:n.value=d;break;case v.HIGHLIGHT_COLOR:c.dispatch("mainhighlightcolorpickerupdatecolor",{source:this,value:d});break;case v.HIGHLIGHT_THICKNESS:o.value=d;break;case v.HIGHLIGHT_FREE:o.disabled=!d;break;case v.HIGHLIGHT_SHOW_ALL:l.setAttribute("aria-pressed",d)}}))}function caret_browsing_classPrivateFieldInitSpec(e,t,i){caret_browsing_checkPrivateRedeclaration(e,t),t.set(e,i)}function caret_browsing_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function caret_browsing_classPrivateFieldGet(e,t){return e.get(caret_browsing_assertClassBrand(e,t))}function caret_browsing_classPrivateFieldSet(e,t,i){return e.set(caret_browsing_assertClassBrand(e,t),i),i}function caret_browsing_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const eh=.1;var th=new WeakMap,ih=new WeakMap,ah=new WeakMap,sh=new WeakSet;class CaretBrowsingMode{constructor(e,t,i,a){!function caret_browsing_classPrivateMethodInitSpec(e,t){caret_browsing_checkPrivateRedeclaration(e,t),t.add(e)}(this,sh);caret_browsing_classPrivateFieldInitSpec(this,th,void 0);caret_browsing_classPrivateFieldInitSpec(this,ih,0);caret_browsing_classPrivateFieldInitSpec(this,ah,void 0);caret_browsing_classPrivateFieldSet(th,this,t);caret_browsing_classPrivateFieldSet(ah,this,i);if(!a)return;caret_browsing_classPrivateFieldSet(ih,this,a.getBoundingClientRect().height);const s=new ResizeObserver((e=>{for(const t of e)if(t.target===a){caret_browsing_classPrivateFieldSet(ih,this,Math.floor(t.borderBoxSize[0].blockSize));break}}));s.observe(a);e.addEventListener("abort",(()=>s.disconnect()),{once:!0})}moveCaret(e,t){const i=document.getSelection();if(0===i.rangeCount)return;const{focusNode:a}=i,s=a.nodeType!==Node.ELEMENT_NODE?a.parentElement:a,n=s.closest(".textLayer");if(!n)return;const r=document.createTreeWalker(n,NodeFilter.SHOW_TEXT);r.currentNode=a;const o=s.getBoundingClientRect();let l=null;const d=(e?r.previousSibling:r.nextSibling).bind(r);for(;d();){const e=r.currentNode.parentElement;if(!caret_browsing_assertClassBrand(sh,this,_isOnSameLine).call(this,o,e.getBoundingClientRect())){l=e;break}}if(!l){const s=caret_browsing_assertClassBrand(sh,this,_getNodeOnNextPage).call(this,n,e);if(!s)return;if(t){const t=(e?r.firstChild():r.lastChild())||a;i.extend(t,e?0:t.length);const n=document.createRange();n.setStart(s,e?s.length:0);n.setEnd(s,e?s.length:0);i.addRange(n);return}const[o]=caret_browsing_assertClassBrand(sh,this,_getCaretPosition).call(this,i,e),{parentElement:l}=s;caret_browsing_assertClassBrand(sh,this,_setCaretPosition).call(this,t,i,l,l.getBoundingClientRect(),o);return}const[c,h]=caret_browsing_assertClassBrand(sh,this,_getCaretPosition).call(this,i,e),u=l.getBoundingClientRect();if(caret_browsing_assertClassBrand(sh,this,_isUnderOver).call(this,u,c,h,e))caret_browsing_assertClassBrand(sh,this,_setCaretPosition).call(this,t,i,l,u,c);else{for(;d();){const a=r.currentNode.parentElement,s=a.getBoundingClientRect();if(!caret_browsing_assertClassBrand(sh,this,_isOnSameLine).call(this,u,s))break;if(caret_browsing_assertClassBrand(sh,this,_isUnderOver).call(this,s,c,h,e)){caret_browsing_assertClassBrand(sh,this,_setCaretPosition).call(this,t,i,a,s,c);return}}caret_browsing_assertClassBrand(sh,this,_setCaretPosition).call(this,t,i,l,u,c)}}}Qc=CaretBrowsingMode;function _isOnSameLine(e,t){const i=e.y,a=e.bottom,s=e.y+e.height/2,n=t.y,r=t.bottom,o=t.y+t.height/2;return i<=o&&o<=a||n<=s&&s<=r}function _isUnderOver(e,t,i,a){const s=e.y+e.height/2;return(a?i>=s:i<=s)&&e.x-eh<=t&&t<=e.right+eh}function _isVisible(e){return e.top>=caret_browsing_classPrivateFieldGet(ih,this)&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}function _getCaretPosition(e,t){const{focusNode:i,focusOffset:a}=e,s=document.createRange();s.setStart(i,a);s.setEnd(i,a);const n=s.getBoundingClientRect();return[n.x,t?n.top:n.bottom]}function _caretPositionFromPoint(e,t){if(!document.caretPositionFromPoint){const{startContainer:i,startOffset:a}=document.caretRangeFromPoint(e,t);return{offsetNode:i,offset:a}}return document.caretPositionFromPoint(e,t)}function _setCaretPositionHelper(e,t,i,a,s){s||=a.getBoundingClientRect();if(t<=s.x+eh){i?e.extend(a.firstChild,0):e.setPosition(a.firstChild,0);return}if(s.right-eh<=t){const{lastChild:t}=a;i?e.extend(t,t.length):e.setPosition(t,t.length);return}const n=s.y+s.height/2;let r=_caretPositionFromPoint.call(Qc,t,n),o=r.offsetNode?.parentElement;if(o&&o!==a){const e=document.elementsFromPoint(t,n),i=[];for(const t of e){if(t===a)break;const{style:e}=t;i.push([t,e.visibility]);e.visibility="hidden"}r=_caretPositionFromPoint.call(Qc,t,n);o=r.offsetNode?.parentElement;for(const[e,t]of i)e.style.visibility=t}o===a?i?e.extend(r.offsetNode,r.offset):e.setPosition(r.offsetNode,r.offset):i?e.extend(a.firstChild,0):e.setPosition(a.firstChild,0)}function _setCaretPosition(e,t,i,a,s){if(caret_browsing_assertClassBrand(sh,this,_isVisible).call(this,a))caret_browsing_assertClassBrand(sh,this,_setCaretPositionHelper).call(this,t,s,e,i,a);else{caret_browsing_classPrivateFieldGet(th,this).addEventListener("scrollend",caret_browsing_assertClassBrand(sh,this,_setCaretPositionHelper).bind(this,t,s,e,i,null),{once:!0});i.scrollIntoView()}}function _getNodeOnNextPage(e,t){for(;;){const i=e.closest(".page"),a=parseInt(i.getAttribute("data-page-number")),s=t?a-1:a+1;if(!(e=caret_browsing_classPrivateFieldGet(ah,this).querySelector(`.page[data-page-number="${s}"] .textLayer`)))return null;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),r=t?n.lastChild():n.firstChild();if(r)return r}}function comment_manager_classPrivateFieldInitSpec(e,t,i){comment_manager_checkPrivateRedeclaration(e,t),t.set(e,i)}function comment_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function comment_manager_classPrivateFieldGet(e,t){return e.get(comment_manager_assertClassBrand(e,t))}function comment_manager_classPrivateFieldSet(e,t,i){return e.set(comment_manager_assertClassBrand(e,t),i),i}function comment_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var nh=new WeakMap,rh=new WeakMap,oh=new WeakMap,lh=new WeakMap,dh=new WeakMap,ch=new WeakMap,hh=new WeakMap,uh=new WeakMap,_h=new WeakMap,ph=new WeakMap,gh=new WeakMap,fh=new WeakMap,vh=new WeakMap,mh=new WeakMap,wh=new WeakMap,Ph=new WeakMap,yh=new WeakMap,Fh=new WeakMap,bh=new WeakSet;class CommentManager{constructor(e,t){let{dialog:i,toolbar:a,actions:s,menu:n,editMenuItem:r,deleteMenuItem:o,closeButton:l,textInput:d,textView:c,cancelButton:h,saveButton:u}=e;!function comment_manager_classPrivateMethodInitSpec(e,t){comment_manager_checkPrivateRedeclaration(e,t),t.add(e)}(this,bh);comment_manager_classPrivateFieldInitSpec(this,nh,void 0);comment_manager_classPrivateFieldInitSpec(this,rh,void 0);comment_manager_classPrivateFieldInitSpec(this,oh,void 0);comment_manager_classPrivateFieldInitSpec(this,lh,void 0);comment_manager_classPrivateFieldInitSpec(this,dh,void 0);comment_manager_classPrivateFieldInitSpec(this,ch,void 0);comment_manager_classPrivateFieldInitSpec(this,hh,"");comment_manager_classPrivateFieldInitSpec(this,uh,"");comment_manager_classPrivateFieldInitSpec(this,_h,void 0);comment_manager_classPrivateFieldInitSpec(this,ph,void 0);comment_manager_classPrivateFieldInitSpec(this,gh,void 0);comment_manager_classPrivateFieldInitSpec(this,fh,void 0);comment_manager_classPrivateFieldInitSpec(this,vh,void 0);comment_manager_classPrivateFieldInitSpec(this,mh,1/0);comment_manager_classPrivateFieldInitSpec(this,wh,1/0);comment_manager_classPrivateFieldInitSpec(this,Ph,0);comment_manager_classPrivateFieldInitSpec(this,yh,0);comment_manager_classPrivateFieldInitSpec(this,Fh,null);comment_manager_classPrivateFieldSet(nh,this,s);comment_manager_classPrivateFieldSet(oh,this,i);comment_manager_classPrivateFieldSet(dh,this,r);comment_manager_classPrivateFieldSet(lh,this,o);comment_manager_classPrivateFieldSet(_h,this,n);comment_manager_classPrivateFieldSet(ph,this,d);comment_manager_classPrivateFieldSet(gh,this,c);comment_manager_classPrivateFieldSet(ch,this,t);comment_manager_classPrivateFieldSet(fh,this,u);const _=comment_manager_assertClassBrand(bh,this,comment_manager_finish).bind(this);i.addEventListener("close",_);i.addEventListener("contextmenu",(e=>{e.target!==comment_manager_classPrivateFieldGet(ph,this)&&e.preventDefault()}));h.addEventListener("click",_);l.addEventListener("click",_);u.addEventListener("click",comment_manager_assertClassBrand(bh,this,comment_manager_save).bind(this));comment_manager_assertClassBrand(bh,this,_makeMenu).call(this);r.addEventListener("click",(()=>{comment_manager_assertClassBrand(bh,this,_closeMenu).call(this);comment_manager_assertClassBrand(bh,this,_edit).call(this)}));o.addEventListener("click",(()=>{comment_manager_assertClassBrand(bh,this,_closeMenu).call(this);comment_manager_classPrivateFieldGet(ph,this).value="";comment_manager_classPrivateFieldGet(rh,this).comment=null;comment_manager_assertClassBrand(bh,this,comment_manager_save).call(this)}));d.addEventListener("input",(()=>{u.disabled=d.value===comment_manager_classPrivateFieldGet(hh,this);comment_manager_classPrivateFieldGet(lh,this).disabled=""===d.value}));c.addEventListener("dblclick",(()=>{comment_manager_assertClassBrand(bh,this,_edit).call(this)}));let p;const cancelDrag=()=>{comment_manager_classPrivateFieldSet(mh,this,comment_manager_classPrivateFieldSet(wh,this,1/0));comment_manager_classPrivateFieldGet(oh,this).classList.remove("dragging");p?.abort();p=null};a.addEventListener("pointerdown",(e=>{const{target:t,clientX:s,clientY:n}=e;if(t!==a)return;comment_manager_assertClassBrand(bh,this,_closeMenu).call(this);comment_manager_classPrivateFieldSet(mh,this,s);comment_manager_classPrivateFieldSet(wh,this,n);p=new AbortController;const{signal:r}=p;i.classList.add("dragging");window.addEventListener("pointermove",(e=>{if(comment_manager_classPrivateFieldGet(mh,this)!==1/0){const{clientX:t,clientY:i}=e;comment_manager_assertClassBrand(bh,this,comment_manager_setPosition).call(this,comment_manager_classPrivateFieldGet(Ph,this)+t-comment_manager_classPrivateFieldGet(mh,this),comment_manager_classPrivateFieldGet(yh,this)+i-comment_manager_classPrivateFieldGet(wh,this));comment_manager_classPrivateFieldSet(mh,this,t);comment_manager_classPrivateFieldSet(wh,this,i);stopEvent(e)}}),{signal:r});window.addEventListener("blur",cancelDrag,{signal:r});stopEvent(e)}));i.addEventListener("pointerup",(e=>{if(comment_manager_classPrivateFieldGet(mh,this)!==1/0){cancelDrag();stopEvent(e)}}));t.register(i)}async open(e,t,i){if(t){comment_manager_classPrivateFieldSet(vh,this,e);comment_manager_classPrivateFieldSet(rh,this,t)}const{comment:{text:a,color:s}}=t;comment_manager_classPrivateFieldGet(oh,this).style.setProperty("--dialog-base-color",comment_manager_assertClassBrand(bh,this,_lightenColor).call(this,s)||"var(--default-dialog-bg-color)");comment_manager_classPrivateFieldSet(uh,this,a||"");if(a){comment_manager_assertClassBrand(bh,this,_renderActionsButton).call(this,!0);comment_manager_assertClassBrand(bh,this,_setText).call(this,a);comment_manager_classPrivateFieldGet(ph,this).classList.toggle("hidden",!0);comment_manager_classPrivateFieldGet(gh,this).classList.toggle("hidden",!1);comment_manager_classPrivateFieldGet(dh,this).disabled=comment_manager_classPrivateFieldGet(lh,this).disabled=!1}else{comment_manager_assertClassBrand(bh,this,_renderActionsButton).call(this,!1);comment_manager_assertClassBrand(bh,this,_edit).call(this)}comment_manager_classPrivateFieldGet(vh,this).removeEditListeners();comment_manager_classPrivateFieldGet(fh,this).disabled=!0;const n=void 0!==i.right?i.right-this._dialogWidth:i.left,r=i.top;comment_manager_assertClassBrand(bh,this,comment_manager_setPosition).call(this,n,r,!0);await comment_manager_classPrivateFieldGet(ch,this).open(comment_manager_classPrivateFieldGet(oh,this))}get _dialogWidth(){const e=comment_manager_classPrivateFieldGet(oh,this),{style:t}=e;t.opacity="0";t.display="block";const i=e.getBoundingClientRect().width;t.opacity=t.display="";return shadow(this,"_dialogWidth",i)}destroy(){comment_manager_classPrivateFieldSet(vh,this,null);comment_manager_assertClassBrand(bh,this,comment_manager_finish).call(this)}}function _closeMenu(){if(!comment_manager_classPrivateFieldGet(Fh,this))return;const e=comment_manager_classPrivateFieldGet(_h,this);e.classList.toggle("hidden",!0);comment_manager_classPrivateFieldGet(nh,this).ariaExpanded="false";comment_manager_classPrivateFieldGet(Fh,this).abort();comment_manager_classPrivateFieldSet(Fh,this,null);e.contains(document.activeElement)&&setTimeout((()=>{comment_manager_classPrivateFieldGet(oh,this).contains(document.activeElement)||comment_manager_classPrivateFieldGet(nh,this).focus()}),0)}function _renderActionsButton(e){comment_manager_classPrivateFieldGet(nh,this).classList.toggle("hidden",!e)}function _makeMenu(){comment_manager_classPrivateFieldGet(nh,this).addEventListener("click",(e=>{const t=comment_manager_assertClassBrand(bh,this,_closeMenu).bind(this);if(comment_manager_classPrivateFieldGet(Fh,this)){t();return}const i=comment_manager_classPrivateFieldGet(_h,this);i.classList.toggle("hidden",!1);comment_manager_classPrivateFieldGet(nh,this).ariaExpanded="true";comment_manager_classPrivateFieldSet(Fh,this,new AbortController);const{signal:a}=comment_manager_classPrivateFieldGet(Fh,this);window.addEventListener("pointerdown",(e=>{let{target:a}=e;a===comment_manager_classPrivateFieldGet(nh,this)||i.contains(a)||t()}),{signal:a});window.addEventListener("blur",t,{signal:a});comment_manager_classPrivateFieldGet(nh,this).addEventListener("keydown",(a=>{let{key:s}=a;switch(s){case"ArrowDown":case"Home":i.firstElementChild.focus();stopEvent(e);break;case"ArrowUp":case"End":i.lastElementChild.focus();stopEvent(e);break;case"Escape":t();stopEvent(e)}}),{signal:a})}));const keyboardListener=e=>{const{key:t,target:i}=e,a=comment_manager_classPrivateFieldGet(_h,this);switch(t){case"Escape":comment_manager_assertClassBrand(bh,this,_closeMenu).call(this);stopEvent(e);break;case"ArrowDown":case"Tab":(i.nextElementSibling||a.firstElementChild).focus();stopEvent(e);break;case"ArrowUp":case"ShiftTab":(i.previousElementSibling||a.lastElementChild).focus();stopEvent(e);break;case"Home":a.firstElementChild.focus();stopEvent(e);break;case"End":a.lastElementChild.focus();stopEvent(e)}};for(const e of comment_manager_classPrivateFieldGet(_h,this).children)if(!e.classList.contains("hidden")){e.addEventListener("keydown",keyboardListener);e.addEventListener("contextmenu",noContextMenu)}comment_manager_classPrivateFieldGet(_h,this).addEventListener("contextmenu",noContextMenu)}async function comment_manager_save(){comment_manager_classPrivateFieldGet(rh,this).comment=comment_manager_classPrivateFieldGet(ph,this).value;comment_manager_assertClassBrand(bh,this,comment_manager_finish).call(this)}function _lightenColor(e){if(!e)return null;const[t,i,a]=getRGB(e),s=(.2126*t+.7152*i+.0722*a)/255;return`color-mix(in srgb, ${s<.9?Math.round(100*(.9-s)):0}% white, ${e})`}function _setText(e){const t=comment_manager_classPrivateFieldGet(gh,this);for(const i of e.split("\n")){const e=document.createElement("span");e.textContent=i;t.append(e,document.createElement("br"))}}function comment_manager_setPosition(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];comment_manager_classPrivateFieldSet(Ph,this,e);comment_manager_classPrivateFieldSet(yh,this,t);const{style:a}=comment_manager_classPrivateFieldGet(oh,this);a.left=`${e}px`;a.top=i?`calc(${t}px + var(--editor-toolbar-vert-offset))`:`${t}px`}function _edit(){const e=comment_manager_classPrivateFieldGet(ph,this),t=comment_manager_classPrivateFieldGet(gh,this);if(t.childElementCount>0){const i=parseFloat(getComputedStyle(t).height);e.value=comment_manager_classPrivateFieldSet(hh,this,comment_manager_classPrivateFieldGet(uh,this));e.style.height=`${i+20}px`}else e.value=comment_manager_classPrivateFieldSet(hh,this,comment_manager_classPrivateFieldGet(uh,this));e.classList.toggle("hidden",!1);t.classList.toggle("hidden",!0);comment_manager_classPrivateFieldGet(dh,this).disabled=!0;setTimeout((()=>e.focus()),0)}function comment_manager_finish(){comment_manager_classPrivateFieldGet(gh,this).replaceChildren();comment_manager_classPrivateFieldGet(ph,this).value=comment_manager_classPrivateFieldSet(hh,this,comment_manager_classPrivateFieldSet(uh,this,""));comment_manager_classPrivateFieldGet(ch,this).closeIfActive(comment_manager_classPrivateFieldGet(oh,this));comment_manager_classPrivateFieldGet(ph,this).style.height="";comment_manager_classPrivateFieldGet(vh,this)?.addEditListeners();comment_manager_classPrivateFieldSet(vh,this,null);comment_manager_classPrivateFieldSet(rh,this,null)}function download_manager_classPrivateFieldInitSpec(e,t,i){(function download_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function download_manager_classPrivateFieldGet(e,t){return e.get(function download_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}(e,t))}function download(e,t){const i=document.createElement("a");if(!i.click)throw new Error('DownloadManager: "a.click()" is not supported.');i.href=e;i.target="_parent";"download"in i&&(i.download=t);(document.body||document.documentElement).append(i);i.click();i.remove()}var Sh=new WeakMap;class DownloadManager{constructor(){download_manager_classPrivateFieldInitSpec(this,Sh,new WeakMap)}downloadData(e,t,i){download(URL.createObjectURL(new Blob([e],{type:i})),t)}openOrDownloadData(e,t){const i=isPdfFile(t),a=i?"application/pdf":"";if(i){let t=download_manager_classPrivateFieldGet(Sh,this).get(e);if(!t){t=URL.createObjectURL(new Blob([e],{type:a}));download_manager_classPrivateFieldGet(Sh,this).set(e,t)}try{window.open(t);return!0}catch(i){NgxConsole.error("openOrDownloadData:",i);URL.revokeObjectURL(t);download_manager_classPrivateFieldGet(Sh,this).delete(e)}}this.downloadData(e,t,a);return!1}download(e,t,i){let a;if(e)a=URL.createObjectURL(new Blob([e],{type:"application/pdf"}));else{if(!createValidAbsoluteUrl(t,"http://example.com")){console.error(`download - not a valid URL: ${t}`);return}a=t+"#pdfjs.action=download"}download(a,i)}}function editor_undo_bar_defineProperty(e,t,i){return(t=function editor_undo_bar_toPropertyKey(e){var t=function editor_undo_bar_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function editor_undo_bar_classPrivateFieldInitSpec(e,t,i){(function editor_undo_bar_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function editor_undo_bar_classPrivateFieldGet(e,t){return e.get(editor_undo_bar_assertClassBrand(e,t))}function editor_undo_bar_classPrivateFieldSet(e,t,i){return e.set(editor_undo_bar_assertClassBrand(e,t),i),i}function editor_undo_bar_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var xh=new WeakMap,Ch=new WeakMap,Ah=new WeakMap,Eh=new WeakMap,kh=new WeakMap,Ih=new WeakMap,Mh=new WeakMap,Bh=new WeakMap;class EditorUndoBar{constructor(e,t){let{container:i,message:a,undoButton:s,closeButton:n}=e;editor_undo_bar_classPrivateFieldInitSpec(this,xh,null);editor_undo_bar_classPrivateFieldInitSpec(this,Ch,void 0);editor_undo_bar_classPrivateFieldInitSpec(this,Ah,null);editor_undo_bar_classPrivateFieldInitSpec(this,Eh,null);editor_undo_bar_classPrivateFieldInitSpec(this,kh,null);editor_undo_bar_defineProperty(this,"isOpen",!1);editor_undo_bar_classPrivateFieldInitSpec(this,Ih,void 0);editor_undo_bar_classPrivateFieldInitSpec(this,Mh,null);editor_undo_bar_classPrivateFieldInitSpec(this,Bh,void 0);editor_undo_bar_classPrivateFieldSet(Ch,this,i);editor_undo_bar_classPrivateFieldSet(Ih,this,a);editor_undo_bar_classPrivateFieldSet(Bh,this,s);editor_undo_bar_classPrivateFieldSet(xh,this,n);editor_undo_bar_classPrivateFieldSet(Ah,this,t)}destroy(){editor_undo_bar_classPrivateFieldGet(kh,this)?.abort();editor_undo_bar_classPrivateFieldSet(kh,this,null);this.hide()}show(e,t){if(!editor_undo_bar_classPrivateFieldGet(kh,this)){editor_undo_bar_classPrivateFieldSet(kh,this,new AbortController);const e={signal:editor_undo_bar_classPrivateFieldGet(kh,this).signal},t=this.hide.bind(this);editor_undo_bar_classPrivateFieldGet(Ch,this).addEventListener("contextmenu",noContextMenu,e);editor_undo_bar_classPrivateFieldGet(xh,this).addEventListener("click",t,e);editor_undo_bar_classPrivateFieldGet(Ah,this)._on("beforeprint",t,e);editor_undo_bar_classPrivateFieldGet(Ah,this)._on("download",t,e)}this.hide();if("string"==typeof t)editor_undo_bar_classPrivateFieldGet(Ih,this).setAttribute("data-l10n-id",Gh._[t]);else{editor_undo_bar_classPrivateFieldGet(Ih,this).setAttribute("data-l10n-id",Gh._._multiple);editor_undo_bar_classPrivateFieldGet(Ih,this).setAttribute("data-l10n-args",JSON.stringify({count:t}))}this.isOpen=!0;editor_undo_bar_classPrivateFieldGet(Ch,this).hidden=!1;editor_undo_bar_classPrivateFieldSet(Mh,this,new AbortController);editor_undo_bar_classPrivateFieldGet(Bh,this).addEventListener("click",(()=>{e();this.hide()}),{signal:editor_undo_bar_classPrivateFieldGet(Mh,this).signal});editor_undo_bar_classPrivateFieldSet(Eh,this,setTimeout((()=>{editor_undo_bar_classPrivateFieldGet(Ch,this).focus();editor_undo_bar_classPrivateFieldSet(Eh,this,null)}),100))}hide(){if(this.isOpen){this.isOpen=!1;editor_undo_bar_classPrivateFieldGet(Ch,this).hidden=!0;editor_undo_bar_classPrivateFieldGet(Mh,this)?.abort();editor_undo_bar_classPrivateFieldSet(Mh,this,null);if(editor_undo_bar_classPrivateFieldGet(Eh,this)){clearTimeout(editor_undo_bar_classPrivateFieldGet(Eh,this));editor_undo_bar_classPrivateFieldSet(Eh,this,null)}}}}var Gh={_:Object.freeze({highlight:"pdfjs-editor-undo-bar-message-highlight",freetext:"pdfjs-editor-undo-bar-message-freetext",stamp:"pdfjs-editor-undo-bar-message-stamp",ink:"pdfjs-editor-undo-bar-message-ink",signature:"pdfjs-editor-undo-bar-message-signature",_multiple:"pdfjs-editor-undo-bar-message-multiple"})};function overlay_manager_classPrivateFieldInitSpec(e,t,i){(function overlay_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function overlay_manager_classPrivateFieldSet(e,t,i){return e.set(overlay_manager_assertClassBrand(e,t),i),i}function overlay_manager_classPrivateFieldGet(e,t){return e.get(overlay_manager_assertClassBrand(e,t))}function overlay_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Th=new WeakMap,Dh=new WeakMap;class OverlayManager{constructor(){overlay_manager_classPrivateFieldInitSpec(this,Th,new WeakMap);overlay_manager_classPrivateFieldInitSpec(this,Dh,null)}get active(){return overlay_manager_classPrivateFieldGet(Dh,this)}async register(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("object"!=typeof e)throw new Error("Not enough parameters.");if(overlay_manager_classPrivateFieldGet(Th,this).has(e))throw new Error("The overlay is already registered.");overlay_manager_classPrivateFieldGet(Th,this).set(e,{canForceClose:t});e.addEventListener("cancel",(e=>{let{target:t}=e;overlay_manager_classPrivateFieldGet(Dh,this)===t&&overlay_manager_classPrivateFieldSet(Dh,this,null)}))}unregister(e){if(!overlay_manager_classPrivateFieldGet(Th,this).has(e))throw new Error("The overlay does not exist.");overlay_manager_classPrivateFieldGet(Th,this).delete(e)}async open(e){if(!overlay_manager_classPrivateFieldGet(Th,this).has(e))throw new Error("The overlay does not exist.");if(overlay_manager_classPrivateFieldGet(Dh,this)){if(overlay_manager_classPrivateFieldGet(Dh,this)===e)throw new Error("The overlay is already active.");if(!overlay_manager_classPrivateFieldGet(Th,this).get(e).canForceClose)throw new Error("Another overlay is currently active.");await this.close()}overlay_manager_classPrivateFieldSet(Dh,this,e);e.showModal();e.classList.remove("hidden")}async close(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:overlay_manager_classPrivateFieldGet(Dh,this),t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!overlay_manager_classPrivateFieldGet(Th,this).has(e)){if(t)return;throw new Error("The overlay does not exist.")}if(!overlay_manager_classPrivateFieldGet(Dh,this)){if(t)return;throw new Error("The overlay is currently not active.")}if(overlay_manager_classPrivateFieldGet(Dh,this)!==e){if(t)return;throw new Error("Another overlay is currently active.")}e.close();overlay_manager_classPrivateFieldSet(Dh,this,null)}async closeIfActive(e){overlay_manager_classPrivateFieldGet(Dh,this)===e&&await this.close(e)}}function password_prompt_classPrivateFieldInitSpec(e,t,i){password_prompt_checkPrivateRedeclaration(e,t),t.set(e,i)}function password_prompt_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function password_prompt_classPrivateFieldSet(e,t,i){return e.set(password_prompt_assertClassBrand(e,t),i),i}function password_prompt_classPrivateFieldGet(e,t){return e.get(password_prompt_assertClassBrand(e,t))}function password_prompt_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Lh=new WeakMap,Rh=new WeakMap,Nh=new WeakMap,Oh=new WeakSet;class PasswordPrompt{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];!function password_prompt_classPrivateMethodInitSpec(e,t){password_prompt_checkPrivateRedeclaration(e,t),t.add(e)}(this,Oh);password_prompt_classPrivateFieldInitSpec(this,Lh,null);password_prompt_classPrivateFieldInitSpec(this,Rh,null);password_prompt_classPrivateFieldInitSpec(this,Nh,null);this.dialog=e.dialog;this.label=e.label;this.input=e.input;this.submitButton=e.submitButton;this.cancelButton=e.cancelButton;this.overlayManager=t;this._isViewerEmbedded=i;this.submitButton.addEventListener("click",password_prompt_assertClassBrand(Oh,this,_verify).bind(this));this.cancelButton.addEventListener("click",this.close.bind(this));this.input.addEventListener("keydown",(e=>{13===e.keyCode&&password_prompt_assertClassBrand(Oh,this,_verify).call(this)}));this.overlayManager.register(this.dialog,!0);this.dialog.addEventListener("close",password_prompt_assertClassBrand(Oh,this,password_prompt_cancel).bind(this))}async open(){await(password_prompt_classPrivateFieldGet(Lh,this)?.promise);password_prompt_classPrivateFieldSet(Lh,this,Promise.withResolvers());try{await this.overlayManager.open(this.dialog);this.input.type="password";this.input.focus()}catch(e){password_prompt_classPrivateFieldGet(Lh,this).resolve();throw e}const e=password_prompt_classPrivateFieldGet(Nh,this)===O.INCORRECT_PASSWORD;this._isViewerEmbedded&&!e||this.input.focus();this.label.setAttribute("data-l10n-id",e?"pdfjs-password-invalid":"pdfjs-password-label")}async close(){this.overlayManager.closeIfActive(this.dialog);this.input.value="";this.input.type="text"}async setUpdateCallback(e,t){password_prompt_classPrivateFieldGet(Lh,this)&&await password_prompt_classPrivateFieldGet(Lh,this).promise;password_prompt_classPrivateFieldSet(Rh,this,e);password_prompt_classPrivateFieldSet(Nh,this,t)}}function _verify(){const e=this.input.value;e?.length>0&&password_prompt_assertClassBrand(Oh,this,_invokeCallback).call(this,e)}function password_prompt_cancel(){password_prompt_assertClassBrand(Oh,this,_invokeCallback).call(this,new Error("PasswordPrompt cancelled."));password_prompt_classPrivateFieldGet(Lh,this).resolve()}function _invokeCallback(e){if(password_prompt_classPrivateFieldGet(Rh,this)){this.close();this.input.value="";password_prompt_classPrivateFieldGet(Rh,this).call(this,e);password_prompt_classPrivateFieldSet(Rh,this,null)}}const Wh="selected";class BaseTreeViewer{constructor(e){this.container=e.container;this.eventBus=e.eventBus;this._l10n=e.l10n;this.reset()}reset(){this._pdfDocument=null;this._lastToggleIsShow=!0;this._currentTreeItem=null;this.container.textContent="";this.container.classList.remove("treeWithDeepNesting")}_dispatchEvent(e){throw new Error("Not implemented: _dispatchEvent")}_bindLink(e,t){throw new Error("Not implemented: _bindLink")}_normalizeTextContent(e){return removeNullCharacters(e,!0)||"–"}_addToggleButton(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("div");i.className="treeItemToggler";t&&i.classList.add("treeItemsHidden");i.onclick=t=>{t.stopPropagation();i.classList.toggle("treeItemsHidden");if(t.shiftKey){const t=!i.classList.contains("treeItemsHidden");this._toggleTreeItem(e,t)}};e.prepend(i)}_toggleTreeItem(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._l10n.pause();this._lastToggleIsShow=t;for(const i of e.querySelectorAll(".treeItemToggler"))i.classList.toggle("treeItemsHidden",!t);this._l10n.resume()}_toggleAllTreeItems(){this._toggleTreeItem(this.container,!this._lastToggleIsShow)}_finishRendering(e,t){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){this.container.classList.add("treeWithDeepNesting");this._lastToggleIsShow=!e.querySelector(".treeItemsHidden")}this._l10n.pause();this.container.append(e);this._l10n.resume();this._dispatchEvent(t)}render(e){throw new Error("Not implemented: render")}_updateCurrentTreeItem(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this._currentTreeItem){this._currentTreeItem.classList.remove(Wh);this._currentTreeItem=null}if(e){e.classList.add(Wh);this._currentTreeItem=e}}_scrollToCurrentTreeItem(e){if(!e)return;this._l10n.pause();let t=e.parentNode;for(;t&&t!==this.container;){if(t.classList.contains("treeItem")){const e=t.firstElementChild;e?.classList.remove("treeItemsHidden")}t=t.parentNode}this._l10n.resume();this._updateCurrentTreeItem(e);this.container.scrollTo(e.offsetLeft,e.offsetTop+-100)}}function pdf_attachment_viewer_classPrivateMethodInitSpec(e,t){(function pdf_attachment_viewer_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}var jh=new WeakSet;class PDFAttachmentViewer extends BaseTreeViewer{constructor(e){super(e);pdf_attachment_viewer_classPrivateMethodInitSpec(this,jh);this.downloadManager=e.downloadManager;this.eventBus._on("fileattachmentannotation",function pdf_attachment_viewer_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}(jh,this,_appendAttachment).bind(this))}reset(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super.reset();this._attachments=null;e||(this._renderedCapability=Promise.withResolvers());this._pendingDispatchEvent=!1}async _dispatchEvent(e){this._renderedCapability.resolve();if(0===e&&!this._pendingDispatchEvent){this._pendingDispatchEvent=!0;await waitOnEventOrTimeout({target:this.eventBus,name:"annotationlayerrendered",delay:1e3});if(!this._pendingDispatchEvent)return}this._pendingDispatchEvent=!1;this.eventBus.dispatch("attachmentsloaded",{source:this,attachmentsCount:e})}_bindLink(e,t){let{content:i,description:a,filename:s}=t;a&&(e.title=a);e.onclick=()=>{this.downloadManager.openOrDownloadData(i,s);return!1}}render(e){let{attachments:t,keepRenderedCapability:i=!1}=e;this._attachments&&this.reset(i);this._attachments=t||null;if(!t){this._dispatchEvent(0);return}const a=document.createDocumentFragment();let s=0;for(const e in t){const i=t[e],n=document.createElement("div");n.className="treeItem";const r=document.createElement("a");this._bindLink(r,i);r.textContent=this._normalizeTextContent(i.filename);n.append(r);a.append(n);s++}this._finishRendering(a,s)}}function _appendAttachment(e){const t=this._renderedCapability.promise;t.then((()=>{if(t!==this._renderedCapability.promise)return;const i=this._attachments||Object.create(null);for(const t in i)if(e.filename===t)return;i[e.filename]=e;this.render({attachments:i,keepRenderedCapability:!0})}))}function grab_to_pan_classPrivateFieldInitSpec(e,t,i){grab_to_pan_checkPrivateRedeclaration(e,t),t.set(e,i)}function grab_to_pan_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function grab_to_pan_classPrivateFieldSet(e,t,i){return e.set(grab_to_pan_assertClassBrand(e,t),i),i}function grab_to_pan_classPrivateFieldGet(e,t){return e.get(grab_to_pan_assertClassBrand(e,t))}function grab_to_pan_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Vh="grab-to-pan-grab";var Hh=new WeakMap,zh=new WeakMap,Uh=new WeakMap,$h=new WeakSet;class GrabToPan{constructor(e){let{element:t}=e;!function grab_to_pan_classPrivateMethodInitSpec(e,t){grab_to_pan_checkPrivateRedeclaration(e,t),t.add(e)}(this,$h);grab_to_pan_classPrivateFieldInitSpec(this,Hh,null);grab_to_pan_classPrivateFieldInitSpec(this,zh,null);grab_to_pan_classPrivateFieldInitSpec(this,Uh,null);this.element=t;this.document=t.ownerDocument;(this.overlay=document.createElement("div")).className="grab-to-pan-grabbing"}activate(){if(!grab_to_pan_classPrivateFieldGet(Hh,this)){grab_to_pan_classPrivateFieldSet(Hh,this,new AbortController);this.element.addEventListener("mousedown",grab_to_pan_assertClassBrand($h,this,_onMouseDown).bind(this),{capture:!0,signal:grab_to_pan_classPrivateFieldGet(Hh,this).signal});this.element.classList.add(Vh)}}deactivate(){if(grab_to_pan_classPrivateFieldGet(Hh,this)){grab_to_pan_classPrivateFieldGet(Hh,this).abort();grab_to_pan_classPrivateFieldSet(Hh,this,null);grab_to_pan_assertClassBrand($h,this,_endPan).call(this);this.element.classList.remove(Vh)}}toggle(){grab_to_pan_classPrivateFieldGet(Hh,this)?this.deactivate():this.activate()}ignoreTarget(e){return!!document.querySelector(".stf__item")||e.matches("a[href], a[href] *, input, textarea, button, button *, select, option")}}function _onMouseDown(e){if(0!==e.button||this.ignoreTarget(e.target))return;if(e.originalTarget)try{e.originalTarget.tagName}catch{return}this.scrollLeftStart=this.element.scrollLeft;this.scrollTopStart=this.element.scrollTop;this.clientXStart=e.clientX;this.clientYStart=e.clientY;if(isOverPerfectScrollbar(this.clientXStart,this.clientYStart,"ps__rail-x"))return;if(isOverPerfectScrollbar(this.clientXStart,this.clientYStart,"ps__rail-y"))return;grab_to_pan_classPrivateFieldSet(zh,this,new AbortController);const t=grab_to_pan_assertClassBrand($h,this,_endPan).bind(this),i={capture:!0,signal:grab_to_pan_classPrivateFieldGet(zh,this).signal};this.document.addEventListener("mousemove",grab_to_pan_assertClassBrand($h,this,_onMouseMove).bind(this),i);this.document.addEventListener("mouseup",t,i);grab_to_pan_classPrivateFieldSet(Uh,this,new AbortController);this.element.addEventListener("scroll",t,{capture:!0,signal:grab_to_pan_classPrivateFieldGet(Uh,this).signal});stopEvent(e);const a=document.activeElement;a&&!a.contains(e.target)&&a.blur()}function _onMouseMove(e){grab_to_pan_classPrivateFieldGet(Uh,this)?.abort();grab_to_pan_classPrivateFieldSet(Uh,this,null);if(!(1&e.buttons)){grab_to_pan_assertClassBrand($h,this,_endPan).call(this);return}const t=e.clientX-this.clientXStart,i=e.clientY-this.clientYStart;this.element.scrollTo({top:this.scrollTopStart-i,left:this.scrollLeftStart-t,behavior:"instant"});this.overlay.parentNode||document.body.append(this.overlay)}function _endPan(){grab_to_pan_classPrivateFieldGet(zh,this)?.abort();grab_to_pan_classPrivateFieldSet(zh,this,null);grab_to_pan_classPrivateFieldGet(Uh,this)?.abort();grab_to_pan_classPrivateFieldSet(Uh,this,null);this.overlay.remove()}function isOverPerfectScrollbar(e,t,i){const a=document.getElementsByClassName(i);if(a&&1===a.length){var{top:s,right:n,bottom:r,left:o}=a[0].getBoundingClientRect();if(t>=s&&t<=r&&e<=n&&e>=o)return!0}return!1}function pdf_cursor_tools_classPrivateFieldInitSpec(e,t,i){pdf_cursor_tools_checkPrivateRedeclaration(e,t),t.set(e,i)}function pdf_cursor_tools_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_cursor_tools_classPrivateFieldSet(e,t,i){return e.set(pdf_cursor_tools_assertClassBrand(e,t),i),i}function pdf_cursor_tools_classPrivateFieldGet(e,t){return e.get(pdf_cursor_tools_assertClassBrand(e,t))}function pdf_cursor_tools_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var qh=new WeakMap,Xh=new WeakMap,Kh=new WeakSet;class PDFCursorTools{constructor(e){let{container:t,eventBus:i,cursorToolOnLoad:a=$l.SELECT}=e;!function pdf_cursor_tools_classPrivateMethodInitSpec(e,t){pdf_cursor_tools_checkPrivateRedeclaration(e,t),t.add(e)}(this,Kh);pdf_cursor_tools_classPrivateFieldInitSpec(this,qh,$l.SELECT);pdf_cursor_tools_classPrivateFieldInitSpec(this,Xh,null);this.container=t;this.eventBus=i;pdf_cursor_tools_assertClassBrand(Kh,this,pdf_cursor_tools_addEventListeners).call(this);Promise.resolve().then((()=>{this.switchTool(a)}))}get activeTool(){return pdf_cursor_tools_classPrivateFieldGet(qh,this)}switchTool(e){null===pdf_cursor_tools_classPrivateFieldGet(Xh,this)&&pdf_cursor_tools_assertClassBrand(Kh,this,_switchTool).call(this,e)}get _handTool(){return shadow(this,"_handTool",new GrabToPan({element:this.container}))}}function _switchTool(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e===pdf_cursor_tools_classPrivateFieldGet(qh,this)){null!==pdf_cursor_tools_classPrivateFieldGet(Xh,this)&&this.eventBus.dispatch("cursortoolchanged",{source:this,tool:e,disabled:t});return}const disableActiveTool=()=>{switch(pdf_cursor_tools_classPrivateFieldGet(qh,this)){case $l.SELECT:break;case $l.HAND:this._handTool.deactivate();case $l.ZOOM:}};switch(e){case $l.SELECT:disableActiveTool();break;case $l.HAND:disableActiveTool();this._handTool.activate();break;case $l.ZOOM:default:NgxConsole.error(`switchTool: "${e}" is an unsupported value.`);return}pdf_cursor_tools_classPrivateFieldSet(qh,this,e);this.eventBus.dispatch("cursortoolchanged",{source:this,tool:e,disabled:t})}function pdf_cursor_tools_addEventListeners(){this.eventBus._on("switchcursortool",(i=>{if(i.reset){if(null!==pdf_cursor_tools_classPrivateFieldGet(Xh,this)){e=f.NONE;t=Bl;enableActive()}}else this.switchTool(i.tool)}));let e=f.NONE,t=Bl;const disableActive=()=>{pdf_cursor_tools_classPrivateFieldGet(Xh,this)??pdf_cursor_tools_classPrivateFieldSet(Xh,this,pdf_cursor_tools_classPrivateFieldGet(qh,this));pdf_cursor_tools_assertClassBrand(Kh,this,_switchTool).call(this,$l.SELECT,!0)},enableActive=()=>{if(null!==pdf_cursor_tools_classPrivateFieldGet(Xh,this)&&e===f.NONE&&t===Bl){pdf_cursor_tools_assertClassBrand(Kh,this,_switchTool).call(this,pdf_cursor_tools_classPrivateFieldGet(Xh,this));pdf_cursor_tools_classPrivateFieldSet(Xh,this,null)}};this.eventBus._on("annotationeditormodechanged",(t=>{let{mode:i}=t;e=i;i===f.NONE?enableActive():disableActive()}));this.eventBus._on("presentationmodechanged",(e=>{let{state:i}=e;t=i;i===Bl?enableActive():i===Tl&&disableActive()}))}function pdf_document_properties_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_document_properties_classPrivateFieldSet(e,t,i){return e.set(pdf_document_properties_assertClassBrand(e,t),i),i}function pdf_document_properties_classPrivateFieldGet(e,t){return e.get(pdf_document_properties_assertClassBrand(e,t))}function pdf_document_properties_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Yh=["en-us","en-lr","my"],Zh={"8.5x11":"pdfjs-document-properties-page-size-name-letter","8.5x14":"pdfjs-document-properties-page-size-name-legal"},Qh={"297x420":"pdfjs-document-properties-page-size-name-a-three","210x297":"pdfjs-document-properties-page-size-name-a-four"};function getPageName(e,t,i){return i[`${t?e.width:e.height}x${t?e.height:e.width}`]}var Jh=new WeakMap,eu=new WeakSet;class PDFDocumentProperties{constructor(e,t,i,a,s,n){let{dialog:r,fields:o,closeButton:l}=e;!function pdf_document_properties_classPrivateMethodInitSpec(e,t){pdf_document_properties_checkPrivateRedeclaration(e,t),t.add(e)}(this,eu);!function pdf_document_properties_classPrivateFieldInitSpec(e,t,i){pdf_document_properties_checkPrivateRedeclaration(e,t),t.set(e,i)}(this,Jh,null);this.dialog=r;this.fields=o;this.overlayManager=t;this.l10n=a;this._fileNameLookup=s;this.eventBus=i;this._titleLookup=n;pdf_document_properties_assertClassBrand(eu,this,_reset).call(this);l.addEventListener("click",this.close.bind(this));this.overlayManager.register(this.dialog);i._on("pagechanging",(e=>{this._currentPageNumber=e.pageNumber}));i._on("rotationchanging",(e=>{this._pagesRotation=e.pagesRotation}))}async open(){await Promise.all([this.overlayManager.open(this.dialog),this._dataAvailableCapability.promise]);this.eventBus.dispatch("propertiesdialogopen",this);const e=this._currentPageNumber,t=this._pagesRotation;if(pdf_document_properties_classPrivateFieldGet(Jh,this)&&e===pdf_document_properties_classPrivateFieldGet(Jh,this)._currentPageNumber&&t===pdf_document_properties_classPrivateFieldGet(Jh,this)._pagesRotation){pdf_document_properties_assertClassBrand(eu,this,_updateUI).call(this);return}const[{info:i,metadata:a,contentLength:s},n]=await Promise.all([this.pdfDocument.getMetadata(),this.pdfDocument.getPage(e)]),[r,o,l,d,c,h,u]=await Promise.all([this._fileNameLookup(),pdf_document_properties_assertClassBrand(eu,this,_parseFileSize).call(this,s),this._titleLookup(),pdf_document_properties_assertClassBrand(eu,this,_parseDate).call(this,a?.get("xmp:createdate"),i.CreationDate),pdf_document_properties_assertClassBrand(eu,this,_parseDate).call(this,a?.get("xmp:modifydate"),i.ModDate),pdf_document_properties_assertClassBrand(eu,this,_parsePageSize).call(this,getPageSizeInches(n),t),pdf_document_properties_assertClassBrand(eu,this,_parseLinearization).call(this,i.IsLinearized)]);pdf_document_properties_classPrivateFieldSet(Jh,this,Object.freeze({fileName:r,fileSize:o,title:l,author:a?.get("dc:creator")?.join("\n")||i.Author,subject:a?.get("dc:subject")?.join("\n")||i.Subject,keywords:a?.get("pdf:keywords")||i.Keywords,creationDate:d,modificationDate:c,creator:a?.get("xmp:creatortool")||i.Creator,producer:a?.get("pdf:producer")||i.Producer,version:i.PDFFormatVersion,pageCount:this.pdfDocument.numPages,pageSize:h,linearized:u,_currentPageNumber:e,_pagesRotation:t}));pdf_document_properties_assertClassBrand(eu,this,_updateUI).call(this);const{length:_}=await this.pdfDocument.getDownloadInfo();if(s===_)return;const p=Object.assign(Object.create(null),pdf_document_properties_classPrivateFieldGet(Jh,this));p.fileSize=await pdf_document_properties_assertClassBrand(eu,this,_parseFileSize).call(this,_);pdf_document_properties_classPrivateFieldSet(Jh,this,Object.freeze(p));pdf_document_properties_assertClassBrand(eu,this,_updateUI).call(this)}async close(){this.overlayManager.close(this.dialog,!0);this.eventBus.dispatch("propertiesdialogclose",this)}setDocument(e){if(this.pdfDocument){pdf_document_properties_assertClassBrand(eu,this,_reset).call(this);pdf_document_properties_assertClassBrand(eu,this,_updateUI).call(this)}if(e){this.pdfDocument=e;this._dataAvailableCapability.resolve()}}}function _reset(){this.pdfDocument=null;pdf_document_properties_classPrivateFieldSet(Jh,this,null);this._dataAvailableCapability=Promise.withResolvers();this._currentPageNumber=1;this._pagesRotation=0}function _updateUI(){if(!pdf_document_properties_classPrivateFieldGet(Jh,this)||this.overlayManager.active===this.dialog)for(const e in this.fields){const t=pdf_document_properties_classPrivateFieldGet(Jh,this)?.[e];this.fields[e].textContent=t||0===t?t:"-"}}async function _parseFileSize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=e/1024,i=t/1024;return t?this.l10n.get(i>=1?"pdfjs-document-properties-size-mb":"pdfjs-document-properties-size-kb",{mb:i,kb:t,b:e}):void 0}async function _parsePageSize(e,t){if(!e)return;t%180!=0&&(e={width:e.height,height:e.width});const i=isPortraitOrientation(e),a=Yh.includes(this.l10n.getLanguage());let s={width:Math.round(100*e.width)/100,height:Math.round(100*e.height)/100},n={width:Math.round(25.4*e.width*10)/10,height:Math.round(25.4*e.height*10)/10},r=getPageName(s,i,Zh)||getPageName(n,i,Qh);if(!(r||Number.isInteger(n.width)&&Number.isInteger(n.height))){const t={width:25.4*e.width,height:25.4*e.height},a={width:Math.round(n.width),height:Math.round(n.height)};if(Math.abs(t.width-a.width)<.1&&Math.abs(t.height-a.height)<.1){r=getPageName(a,i,Qh);if(r){s={width:Math.round(a.width/25.4*100)/100,height:Math.round(a.height/25.4*100)/100};n=a}}}const[{width:o,height:l},d,c,h]=await Promise.all([a?s:n,this.l10n.get(a?"pdfjs-document-properties-page-size-unit-inches":"pdfjs-document-properties-page-size-unit-millimeters"),r&&this.l10n.get(r),this.l10n.get(i?"pdfjs-document-properties-page-size-orientation-portrait":"pdfjs-document-properties-page-size-orientation-landscape")]);return this.l10n.get(c?"pdfjs-document-properties-page-size-dimension-name-string":"pdfjs-document-properties-page-size-dimension-string",{width:o,height:l,unit:d,name:c,orientation:h})}async function _parseDate(e,t){const i=Date.parse(e)||PDFDateString.toDateObject(t);return i?this.l10n.get("pdfjs-document-properties-date-time-string",{dateObj:i.valueOf()}):void 0}function _parseLinearization(e){return this.l10n.get(e?"pdfjs-document-properties-linearized-yes":"pdfjs-document-properties-linearized-no")}const tu=0,iu=1,au=2,su=3,nu=4,ru=5,ou=6,lu=7;function getCharacterType(e){return function isAlphabeticalScript(e){return e<11904}(e)?function isAscii(e){return!(65408&e)}(e)?function isAsciiSpace(e){return 32===e||9===e||13===e||10===e}(e)?tu:function isAsciiAlpha(e){return e>=97&&e<=122||e>=65&&e<=90}(e)||function isAsciiDigit(e){return e>=48&&e<=57}(e)||95===e?iu:au:function isThai(e){return 3584==(65408&e)}(e)?lu:160===e?tu:iu:function isHan(e){return e>=13312&&e<=40959||e>=63744&&e<=64255}(e)?su:function isKatakana(e){return e>=12448&&e<=12543}(e)?nu:function isHiragana(e){return e>=12352&&e<=12447}(e)?ru:function isHalfwidthKatakana(e){return e>=65376&&e<=65439}(e)?ou:iu}let du;function pdf_find_controller_classPrivateFieldInitSpec(e,t,i){pdf_find_controller_checkPrivateRedeclaration(e,t),t.set(e,i)}function pdf_find_controller_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_find_controller_classPrivateGetter(e,t,i){return i(pdf_find_controller_assertClassBrand(e,t))}function pdf_find_controller_classPrivateFieldGet(e,t){return e.get(pdf_find_controller_assertClassBrand(e,t))}function pdf_find_controller_classPrivateFieldSet(e,t,i){return e.set(pdf_find_controller_assertClassBrand(e,t),i),i}function pdf_find_controller_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const cu=0,hu=1,uu=2,_u=3,pu={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"},gu=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 fu;const vu=/\p{M}+/gu,mu=/([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu,wu=/([^\p{M}])\p{M}*$/u,Pu=/^\p{M}*([^\p{M}])/u,yu=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,Fu=new Map,bu=new Map;let Su=null,xu=null;function normalize(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=[];let a;for(;null!==(a=yu.exec(e));){let{index:e}=a;for(const t of a[0]){let a=Fu.get(t);if(!a){a=t.normalize("NFD").length;Fu.set(t,a)}i.push([a,e++])}}const s=i.length>0,n=t.ignoreDashEOL??!1;let r;if(!s&&Su)r=Su;else if(s&&xu)r=xu;else{const e=Object.keys(pu).join(""),t=function getNormalizeWithNFKC(){du||=" ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩";return du}();r=new RegExp([`[${e}]`,`[${t}]`,`${"(?:゙|゚)"}\\n`,"\\p{M}+(?:-\\n)?",`${"\\p{Ll}-\\n(?=\\p{Ll})|\\p{Lu}-\\n(?=\\p{L})"}`,"\\S-\\n",`${"(?:\\p{Ideographic}|[぀-ヿ])"}\\n`,"\\n",s?"[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]":"\\u0000"].map((e=>`(${e})`)).join("|"),"gum");s?xu=r:Su=r}const o=[];for(;null!==(a=vu.exec(e));)o.push([a[0].length,a.index]);let l=e.normalize("NFD");const d=[0,0];let c=0,h=0,u=0,_=0,p=0,g=!1;l=l.replace(r,((e,t,a,s,r,l,f,v,m,w,P)=>{P-=_;if(t){const e=pu[t],i=e.length;for(let e=1;e<i;e++)d.push(P-u+e,u-e);u-=i-1;return e}if(a){let e=bu.get(a);if(!e){e=a.normalize("NFKC");bu.set(a,e)}const t=e.length;for(let e=1;e<t;e++)d.push(P-u+e,u-e);u-=t-1;return e}if(s){g=!0;if(P+p===o[c]?.[1])++c;else{d.push(P-1-u+1,u-1);u-=1;_+=1}d.push(P-u+1,u);_+=1;p+=1;return s.charAt(0)}if(r){const e=r.endsWith("\n"),t=e?r.length-2:r.length;g=!0;let i=t;if(P+p===o[c]?.[1]){i-=o[c][0];++c}for(let e=1;e<=i;e++)d.push(P-1-u+e,u-e);u-=i;_+=i;if(e){P+=t-1;d.push(P-u+1,1+u);u+=1;_+=1;p+=1;return r.slice(0,t)}return r}if(l){if(n){_+=1;p+=1;return l.slice(0,-1)}const e=l.length-2;d.push(P-u+e,1+u);u+=1;_+=1;p+=1;return l.slice(0,-2)}if(f){_+=1;p+=1;return f.slice(0,-1)}if(v){const e=v.length-1;d.push(P-u+e,u);_+=1;p+=1;return v.slice(0,-1)}if(m){d.push(P-u+1,u-1);u-=1;_+=1;p+=1;return" "}if(P+p===i[h]?.[1]){const e=i[h][0]-1;++h;for(let t=1;t<=e;t++)d.push(P-(u-t),u-t);u-=e;_+=e}return w}));d.push(l.length,u);const f=new Uint32Array(d.length>>1),v=new Int32Array(d.length>>1);for(let e=0,t=d.length;e<t;e+=2){f[e>>1]=d[e];v[e>>1]=d[e+1]}return[l,[f,v],g]}function getOriginalIndex(e,t,i){if(!e)return[t,i];const[a,s]=e,n=t,r=t+i-1;let o=binarySearchFirstItem(a,(e=>e>=n));a[o]>n&&--o;let l=binarySearchFirstItem(a,(e=>e>=r),o);a[l]>r&&--l;const d=n+s[o];return[d,r+s[l]+1-d]}var Cu=new WeakMap,Au=new WeakMap,Eu=new WeakMap,ku=new WeakSet;class PDFFindController{constructor(e){let{linkService:t,eventBus:i,updateMatchesCountOnProgress:a=!0,pageViewMode:s,listenToEventBus:n}=e;!function pdf_find_controller_classPrivateMethodInitSpec(e,t){pdf_find_controller_checkPrivateRedeclaration(e,t),t.add(e)}(this,ku);pdf_find_controller_classPrivateFieldInitSpec(this,Cu,null);pdf_find_controller_classPrivateFieldInitSpec(this,Au,!0);pdf_find_controller_classPrivateFieldInitSpec(this,Eu,0);this._linkService=t;this._eventBus=i;pdf_find_controller_classPrivateFieldSet(Au,this,a);this._pageViewMode=s;this.onIsPageVisible=null;pdf_find_controller_assertClassBrand(ku,this,pdf_find_controller_reset).call(this);this._eventBus.on("pageviewmodechanged",(e=>{let{pageViewMode:t}=e;this._pageViewMode=t}));if(n){i._on("find",pdf_find_controller_assertClassBrand(ku,this,_onFind).bind(this));i._on("findbarclose",pdf_find_controller_assertClassBrand(ku,this,_onFindBarClose).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 pdf_find_controller_classPrivateFieldGet(Cu,this)}setDocument(e){this._pdfDocument&&pdf_find_controller_assertClassBrand(ku,this,pdf_find_controller_reset).call(this);if(e){this._pdfDocument=e;this._firstPageCapability.resolve()}}ngxFind(e){const t=[];this._findResultResolvers=[];for(let e=0,i=this._linkService.pagesCount;e<i;e++){const{promise:i,resolve:a}=Promise.withResolvers();t[e]=i;this._findResultResolvers[e]=a}pdf_find_controller_assertClassBrand(ku,this,_onFind).call(this,e);return t}ngxFindNext(){const e={...pdf_find_controller_classPrivateFieldGet(Cu,this),type:"again",findPrevious:!1};pdf_find_controller_assertClassBrand(ku,this,_onFind).call(this,e)}ngxFindPrevious(){const e={...pdf_find_controller_classPrivateFieldGet(Cu,this),type:"again",findPrevious:!0};pdf_find_controller_assertClassBrand(ku,this,_onFind).call(this,e)}scrollMatchIntoView(e){let{element:t=null,selectedLeft:i=0,pageIndex:a=-1,matchIndex:s=-1}=e;if(pdf_find_controller_classPrivateFieldGet(Cu,this)?.dontScrollIntoView)return;if(!this._scrollMatches||!t)return;this._scrollMatches=!1;scrollIntoView(t,{top:-50,left:i+-400},!0,"infinite-scroll"===this._pageViewMode)}_convertToRegExpString(e,t){const{matchDiacritics:i}=pdf_find_controller_classPrivateFieldGet(Cu,this);let a=!1;const s="[ ]*";(e=e.replaceAll(mu,((e,s,n,r,o,l)=>{if(s)return`[ ]*\\${s}[ ]*`;if(n)return`[ ]*${n}[ ]*`;if(r)return"[ ]+";if(i)return o||l;if(o)return gu.has(o.charCodeAt(0))?o:"";if(t){a=!0;return`${l}\\p{M}*`}return l}))).endsWith(s)&&(e=e.slice(0,e.length-4));if(i&&t){fu||=String.fromCharCode(...gu);a=!0;e=`${e}(?=[${fu}]|[^\\p{M}]|$)`}return[a,e]}_calculateMatch(e){var t;if(!pdf_find_controller_classPrivateFieldGet(Cu,this))return;const i=pdf_find_controller_classPrivateGetter(ku,this,_get_query);if(0===i.length)return;const a=this._pageContents[e],s=this.match(i,a,e),n=this._pageMatches[e]=[],r=this._pageMatchesLength[e]=[],o=this._pageDiffs[e];s?.forEach((e=>{let{index:t,length:i}=e;const[a,s]=getOriginalIndex(o,t,i);if(s){n.push(a);r.push(s)}}));pdf_find_controller_classPrivateFieldGet(Cu,this).highlightAll&&pdf_find_controller_assertClassBrand(ku,this,_updatePage).call(this,e);if(this._resumePageIdx===e){this._resumePageIdx=null;pdf_find_controller_assertClassBrand(ku,this,_nextPageMatch).call(this)}const l=n.length;this._matchesCountTotal+=l;pdf_find_controller_classPrivateFieldGet(Au,this)?l>0&&pdf_find_controller_assertClassBrand(ku,this,_updateUIResultsCount).call(this,e):pdf_find_controller_classPrivateFieldSet(Eu,this,(t=pdf_find_controller_classPrivateFieldGet(Eu,this),++t))===this._linkService.pagesCount&&pdf_find_controller_assertClassBrand(ku,this,_updateUIResultsCount).call(this,e)}match(e,t,i){const a=this._hasDiacritics[i];let s=!1;const{caseSensitive:n,findMultiple:r,matchRegExp:o}=pdf_find_controller_classPrivateFieldGet(Cu,this);r&&"string"==typeof e&&(e=e.trim().split(/\s+/));if(o&&"string"==typeof e){e=new RegExp(e,n?"g":"gi");s=a}else"string"==typeof e?[s,e]=this._convertToRegExpString(e,a):e=e.sort().reverse().map((e=>{const[t,i]=this._convertToRegExpString(e,a);s||=t;return`(${i})`})).join("|");if(!e)return;const{entireWord:l}=pdf_find_controller_classPrivateFieldGet(Cu,this);e=new RegExp(e,`g${s?"u":""}${n?"":"i"}`);const d=[];let c;for(;null!==(c=e.exec(t));)l&&!pdf_find_controller_assertClassBrand(ku,this,_isEntireWord).call(this,t,c.index,c[0].length)||d.push({index:c.index,length:c[0].length});return d}}function _onFind(e){if(!e)return;const t=this._pdfDocument,{type:i}=e;(null===pdf_find_controller_classPrivateFieldGet(Cu,this)||pdf_find_controller_assertClassBrand(ku,this,_shouldDirtyMatch).call(this,e))&&(this._dirtyMatch=!0);pdf_find_controller_classPrivateFieldSet(Cu,this,e);if("highlightallchange"!==i)pdf_find_controller_assertClassBrand(ku,this,pdf_find_controller_updateUIState).call(this,_u);else{const e=this._pageMatches.some((e=>e.length>0)),t=!this.state?.query||e;pdf_find_controller_assertClassBrand(ku,this,pdf_find_controller_updateUIState).call(this,t?cu:hu)}this._firstPageCapability.promise.then((()=>{if(!this._pdfDocument||t&&this._pdfDocument!==t)return;pdf_find_controller_assertClassBrand(ku,this,pdf_find_controller_extractText).call(this);const e=!this._highlightMatches,a=!!this._findTimeout;if(this._findTimeout){clearTimeout(this._findTimeout);this._findTimeout=null}if(i)if(this._dirtyMatch)pdf_find_controller_assertClassBrand(ku,this,_nextMatch).call(this);else if("again"===i){pdf_find_controller_assertClassBrand(ku,this,_nextMatch).call(this);e&&pdf_find_controller_classPrivateFieldGet(Cu,this).highlightAll&&pdf_find_controller_assertClassBrand(ku,this,_updateAllPages).call(this)}else if("highlightallchange"===i){a?pdf_find_controller_assertClassBrand(ku,this,_nextMatch).call(this):this._highlightMatches=!0;pdf_find_controller_assertClassBrand(ku,this,_updateAllPages).call(this)}else pdf_find_controller_assertClassBrand(ku,this,_nextMatch).call(this);else this._findTimeout=setTimeout((()=>{pdf_find_controller_assertClassBrand(ku,this,_nextMatch).call(this);this._findTimeout=null}),250)}))}function pdf_find_controller_reset(){this._highlightMatches=!1;this._scrollMatches=!1;this._pdfDocument=null;this._pageMatches=[];this._pageMatchesLength=[];pdf_find_controller_classPrivateFieldSet(Eu,this,0);pdf_find_controller_classPrivateFieldSet(Cu,this,null);this._selected={pageIdx:-1,matchIdx:-1};this._offset={pageIdx:null,matchIdx:null,wrapped:!1};this._extractTextPromises=[];this._findResultResolvers=[];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;this._firstPageCapability=Promise.withResolvers()}function _get_query(e){const{query:t}=pdf_find_controller_classPrivateFieldGet(Cu,e);if("string"==typeof t){if(t!==e._rawQuery){e._rawQuery=t;[e._normalizedQuery]=normalize(t)}return e._normalizedQuery}return(t||[]).filter((e=>!!e)).map((e=>normalize(e)[0]))}function _shouldDirtyMatch(e){const t=e.query,i=pdf_find_controller_classPrivateFieldGet(Cu,this).query,a=typeof t;if(a!==typeof i)return!0;if("string"===a){if(t!==i)return!0}else if(JSON.stringify(t)!==JSON.stringify(i))return!0;switch(e.type){case"again":const e=this._selected.pageIdx+1,t=this._linkService;return e>=1&&e<=t.pagesCount&&e!==t.page&&!(this.onIsPageVisible?.(e)??1);case"highlightallchange":return!1}return!0}function _isEntireWord(e,t,i){let a=e.slice(0,t).match(wu);if(a){const i=e.charCodeAt(t),s=a[1].charCodeAt(0);if(getCharacterType(i)===getCharacterType(s))return!1}a=e.slice(t+i).match(Pu);if(a){const s=e.charCodeAt(t+i-1),n=a[1].charCodeAt(0);if(getCharacterType(s)===getCharacterType(n))return!1}return!0}function pdf_find_controller_extractText(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve();const t={disableNormalization:!0},i=this._pdfDocument;for(let a=0,s=this._linkService.pagesCount;a<s;a++){const{promise:s,resolve:n}=Promise.withResolvers();this._extractTextPromises[a]=s;e=e.then((async()=>{i===this._pdfDocument?await i.getPage(a+1).then((e=>e.getTextContent(t))).then((e=>{const t=[];for(const i of e.items){t.push(i.str);i.hasEOL&&t.push("\n")}[this._pageContents[a],this._pageDiffs[a],this._hasDiacritics[a]]=normalize(t.join(""));n()}),(e=>{NgxConsole.error(`Unable to get text content for page ${a+1}`,e);this._pageContents[a]="";this._pageDiffs[a]=null;this._hasDiacritics[a]=!1;n()})):n()}))}}function _updatePage(e){this._scrollMatches&&this._selected.pageIdx===e&&(this.state.dontScrollIntoView||(this._linkService.page=e+1));this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:e})}function _updateAllPages(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}function _nextMatch(){const e=pdf_find_controller_classPrivateFieldGet(Cu,this).findPrevious,t=this._linkService.page-1,i=this._linkService.pagesCount;this._highlightMatches=!0;if(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;pdf_find_controller_classPrivateFieldSet(Eu,this,0);this._matchesCountTotal=0;pdf_find_controller_assertClassBrand(ku,this,_updateAllPages).call(this);for(let e=0;e<i;e++)if(!this._pendingFindMatches.has(e)){this._pendingFindMatches.add(e);this._extractTextPromises[e].then((()=>{this._pendingFindMatches.delete(e);this._calculateMatch(e)}))}}if(0===pdf_find_controller_classPrivateGetter(ku,this,_get_query).length){pdf_find_controller_assertClassBrand(ku,this,pdf_find_controller_updateUIState).call(this,cu);return}if(this._resumePageIdx)return;const a=this._offset;this._pagesToSearch=i;if(null!==a.matchIdx){const t=this._pageMatches[a.pageIdx].length;if(!e&&a.matchIdx+1<t||e&&a.matchIdx>0){a.matchIdx=e?a.matchIdx-1:a.matchIdx+1;pdf_find_controller_assertClassBrand(ku,this,_updateMatch).call(this,!0);return}pdf_find_controller_assertClassBrand(ku,this,_advanceOffsetPage).call(this,e)}pdf_find_controller_assertClassBrand(ku,this,_nextPageMatch).call(this)}function _matchesReady(e){const t=this._offset,i=e.length,a=pdf_find_controller_classPrivateFieldGet(Cu,this).findPrevious;if(i){t.matchIdx=a?i-1:0;pdf_find_controller_assertClassBrand(ku,this,_updateMatch).call(this,!0);return!0}pdf_find_controller_assertClassBrand(ku,this,_advanceOffsetPage).call(this,a);if(t.wrapped){t.matchIdx=null;if(this._pagesToSearch<0){pdf_find_controller_assertClassBrand(ku,this,_updateMatch).call(this,!1);return!0}}return!1}function _nextPageMatch(){null!==this._resumePageIdx&&NgxConsole.error("There can only be one pending page.");let e=null;do{const t=this._offset.pageIdx;e=this._pageMatches[t];if(!e){this._resumePageIdx=t;break}}while(!pdf_find_controller_assertClassBrand(ku,this,_matchesReady).call(this,e))}function _advanceOffsetPage(e){const t=this._offset,i=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1;t.matchIdx=null;this._pagesToSearch--;if(t.pageIdx>=i||t.pageIdx<0){t.pageIdx=e?i-1:0;t.wrapped=!0}}function _updateMatch(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=hu;const i=this._offset.wrapped;this._offset.wrapped=!1;if(e){const e=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx;this._selected.matchIdx=this._offset.matchIdx;t=i?uu:cu;-1!==e&&e!==this._selected.pageIdx&&pdf_find_controller_assertClassBrand(ku,this,_updatePage).call(this,e)}pdf_find_controller_assertClassBrand(ku,this,pdf_find_controller_updateUIState).call(this,t,pdf_find_controller_classPrivateFieldGet(Cu,this).findPrevious);if(-1!==this._selected.pageIdx){this._scrollMatches=!0;pdf_find_controller_assertClassBrand(ku,this,_updatePage).call(this,this._selected.pageIdx)}}function _onFindBarClose(e){const t=this._pdfDocument;this._firstPageCapability.promise.then((()=>{if(this._pdfDocument&&(!t||this._pdfDocument===t)){if(this._findTimeout){clearTimeout(this._findTimeout);this._findTimeout=null}if(this._resumePageIdx){this._resumePageIdx=null;this._dirtyMatch=!0}pdf_find_controller_assertClassBrand(ku,this,pdf_find_controller_updateUIState).call(this,cu);this._highlightMatches=!1;pdf_find_controller_assertClassBrand(ku,this,_updateAllPages).call(this)}}))}function _requestMatchesCount(){const{pageIdx:e,matchIdx:t}=this._selected;let i=0,a=this._matchesCountTotal;if(-1!==t){for(let t=0;t<e;t++)i+=this._pageMatches[t]?.length||0;i+=t+1}(i<1||i>a)&&(i=a=0);return{current:i,total:a}}function _updateUIResultsCount(e){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:pdf_find_controller_assertClassBrand(ku,this,_requestMatchesCount).call(this)});const t=this._pageMatches[e].length;if(this._findResultResolvers&&this._findResultResolvers[e]){this._findResultResolvers[e](t);this._findResultResolvers[e]=null}}function pdf_find_controller_updateUIState(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(pdf_find_controller_classPrivateFieldGet(Au,this)||pdf_find_controller_classPrivateFieldGet(Eu,this)===this._linkService.pagesCount&&e!==_u)&&this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:t,entireWord:pdf_find_controller_classPrivateFieldGet(Cu,this)?.entireWord??null,matchesCount:pdf_find_controller_assertClassBrand(ku,this,_requestMatchesCount).call(this),rawQuery:pdf_find_controller_classPrivateFieldGet(Cu,this)?.query??null})}function pdf_find_bar_classPrivateFieldInitSpec(e,t,i){pdf_find_bar_checkPrivateRedeclaration(e,t),t.set(e,i)}function pdf_find_bar_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_find_bar_classPrivateFieldGet(e,t){return e.get(pdf_find_bar_assertClassBrand(e,t))}function pdf_find_bar_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Iu=new WeakMap,Mu=new WeakMap,Bu=new WeakSet;class PDFFindBar{constructor(e,t,i){!function pdf_find_bar_classPrivateMethodInitSpec(e,t){pdf_find_bar_checkPrivateRedeclaration(e,t),t.add(e)}(this,Bu);pdf_find_bar_classPrivateFieldInitSpec(this,Iu,void 0);pdf_find_bar_classPrivateFieldInitSpec(this,Mu,new ResizeObserver(pdf_find_bar_assertClassBrand(Bu,this,_resizeObserverCallback).bind(this)));this.opened=!1;this.bar=e.bar;this.toggleButton=e.toggleButton;this.findField=e.findField;this.highlightAll=e.highlightAllCheckbox;this.currentPage=e.findCurrentPageCheckbox;this.pageRange=e.findPageRangeField;this.caseSensitive=e.caseSensitiveCheckbox;this.findMultipleCheckbox=e.findMultipleCheckbox;this.matchRegExpCheckbox=e.matchRegExpCheckbox;this.matchDiacritics=e.matchDiacriticsCheckbox;this.entireWord=e.entireWordCheckbox;this.findMsg=e.findMsg;this.findResultsCount=e.findResultsCount;this.findPreviousButton=e.findPreviousButton;this.findNextButton=e.findNextButton;this.eventBus=i;!function pdf_find_bar_classPrivateFieldSet(e,t,i){return e.set(pdf_find_bar_assertClassBrand(e,t),i),i}(Iu,this,t);const a=new Map(Array.from([[this.highlightAll,"highlightallchange"],[this.caseSensitive,"casesensitivitychange"],[this.entireWord,"entirewordchange"],[this.matchDiacritics,"diacriticmatchingchange"],[this.findMultipleCheckbox,"findmultiplechange"]]).filter((e=>{let[t]=e;return t&&t instanceof Element})));this.toggleButton&&(isInsideNgxExtendedPdfViewer(this.toggleButton)||this.toggleButton.addEventListener("click",(()=>{this.toggle()})));this.findField.addEventListener("input",(()=>{this.dispatchEvent("")}));this.findField.parentElement.addEventListener("keydown",(e=>{const{keyCode:t}=e;13!==t&&27!==t&&e.stopPropagation();e.metaKey&&"ArrowDown"===e.key&&e.preventDefault();e.metaKey&&"ArrowUp"===e.key&&e.preventDefault()}));this.bar.addEventListener("keydown",(e=>{const{keyCode:t,shiftKey:i,target:s}=e;switch(t){case 13:if(s===this.findField)this.dispatchEvent("again",i);else if(a.has(s)){s.checked=!s.checked;this.dispatchEvent(a.get(s))}break;case 27:this.close();e.stopPropagation()}}));this.findPreviousButton.addEventListener("click",(()=>{this.dispatchEvent("again",!0)}));this.findNextButton.addEventListener("click",(()=>{this.dispatchEvent("again",!1)}));for(const[e,t]of a)e.addEventListener("click",(()=>{this.dispatchEvent(t)}));this.matchRegExpCheckbox?.addEventListener("click",(()=>{if(this.matchRegExpCheckbox.checked){this.findMultipleCheckbox.checked=!1;this.findMultipleCheckbox.disabled=!0;this.matchDiacritics.checked=!1;this.matchDiacritics.disabled=!0;this.entireWord.checked=!1;this.entireWord.disabled=!0}else{this.findMultipleCheckbox.disabled=!1;this.matchDiacritics.disabled=!1;this.entireWord.disabled=!1}this.dispatchEvent("findregexpchange")}))}reset(){this.updateUIState()}dispatchEvent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.eventBus.dispatch("find",{source:this,type:e,query:this.findField.value,caseSensitive:this.caseSensitive.checked,findMultiple:this.findMultipleCheckbox?.checked,matchRegExp:this.matchRegExpCheckbox?.checked,entireWord:this.entireWord.checked,highlightAll:this.highlightAll.checked,findPrevious:t,matchDiacritics:this.matchDiacritics.checked})}updateUIState(e,t,i){const{findField:a,findMsg:s}=this;let n="",r="";switch(e){case cu:break;case _u:r="pending";break;case hu:n="pdfjs-find-not-found";r="notFound";break;case uu:n=t?"pdfjs-find-reached-top":"pdfjs-find-reached-bottom"}a.setAttribute("data-status",r);a.setAttribute("aria-invalid",e===hu);s.setAttribute("data-status",r);if(n)s.setAttribute("data-l10n-id",n);else{s.removeAttribute("data-l10n-id");s.textContent=""}this.updateResultsCount(i)}updateResultsCount(){let{current:e=0,total:t=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{findResultsCount:i}=this;if(t>0){const a=1e3;i.setAttribute("data-l10n-id",t>a?"pdfjs-find-match-count-limit":"pdfjs-find-match-count");i.setAttribute("data-l10n-args",JSON.stringify({limit:a,current:e,total:t}))}else{i.removeAttribute("data-l10n-id");i.textContent=""}}open(){if(!this.opened){pdf_find_bar_classPrivateFieldGet(Mu,this).observe(pdf_find_bar_classPrivateFieldGet(Iu,this));pdf_find_bar_classPrivateFieldGet(Mu,this).observe(this.bar);this.opened=!0;toggleExpandedBtn(this.toggleButton,!0,this.bar)}this.findField.select();this.findField.focus();this.dispatchEvent("");this.eventBus.dispatch("findbaropen",{source:this})}close(){if(this.opened){pdf_find_bar_classPrivateFieldGet(Mu,this).disconnect();this.opened=!1;toggleExpandedBtn(this.toggleButton,!1,this.bar);this.eventBus.dispatch("findbarclose",{source:this})}}toggle(){this.opened?this.close():this.open()}}function _resizeObserverCallback(){const{bar:e}=this;e.classList.remove("wrapContainers");e.clientHeight>e.firstElementChild.clientHeight&&e.classList.add("wrapContainers")}function pdf_history_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_history_classPrivateFieldSet(e,t,i){return e.set(pdf_history_assertClassBrand(e,t),i),i}function pdf_history_classPrivateFieldGet(e,t){return e.get(pdf_history_assertClassBrand(e,t))}function pdf_history_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function getCurrentHash(){return document.location.hash}var Gu=new WeakMap,Tu=new WeakSet;class PDFHistory{constructor(e){let{linkService:t,eventBus:i}=e;!function pdf_history_classPrivateMethodInitSpec(e,t){pdf_history_checkPrivateRedeclaration(e,t),t.add(e)}(this,Tu);!function pdf_history_classPrivateFieldInitSpec(e,t,i){pdf_history_checkPrivateRedeclaration(e,t),t.set(e,i)}(this,Gu,null);this.linkService=t;this.eventBus=i;this._initialized=!1;this._fingerprint="";this.reset();this.eventBus._on("pagesinit",(()=>{this._isPagesLoaded=!1;this.eventBus._on("pagesloaded",(e=>{this._isPagesLoaded=!!e.pagesCount}),{once:!0})}))}initialize(e){let{fingerprint:t,resetHistory:i=!1,updateUrl:a=!1}=e;if(!t||"string"!=typeof t){NgxConsole.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');return}this._initialized&&this.reset();const s=""!==this._fingerprint&&this._fingerprint!==t;this._fingerprint=t;this._updateUrl=!0===a;this._initialized=!0;pdf_history_assertClassBrand(Tu,this,_bindEvents).call(this);const n=window.history.state;this._popStateInProgress=!1;this._blockHashChange=0;this._currentHash=getCurrentHash();this._numPositionUpdates=0;this._uid=this._maxUid=0;this._destination=null;this._position=null;if(!pdf_history_assertClassBrand(Tu,this,_isValidState).call(this,n,!0)||i){const{hash:e,page:t,rotation:a}=pdf_history_assertClassBrand(Tu,this,_parseCurrentHash).call(this,!0);if(!e||s||i){pdf_history_assertClassBrand(Tu,this,_pushOrReplaceState).call(this,null,!0);return}pdf_history_assertClassBrand(Tu,this,_pushOrReplaceState).call(this,{hash:e,page:t,rotation:a},!0);return}const r=n.destination;pdf_history_assertClassBrand(Tu,this,_updateInternalState).call(this,r,n.uid,!0);void 0!==r.rotation&&(this._initialRotation=r.rotation);if(r.dest){this._initialBookmark=JSON.stringify(r.dest);this._destination.page=null}else r.hash?this._initialBookmark=r.hash:r.page&&(this._initialBookmark=`page=${r.page}`)}reset(){if(this._initialized){pdf_history_assertClassBrand(Tu,this,_pageHide).call(this);this._initialized=!1;pdf_history_assertClassBrand(Tu,this,_unbindEvents).call(this)}if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._initialBookmark=null;this._initialRotation=null}push(e){let{namedDest:t=null,explicitDest:i,pageNumber:a}=e;if(!this._initialized)return;if(t&&"string"!=typeof t){NgxConsole.error(`PDFHistory.push: "${t}" is not a valid namedDest parameter.`);return}if(!Array.isArray(i)){NgxConsole.error(`PDFHistory.push: "${i}" is not a valid explicitDest parameter.`);return}if(!pdf_history_assertClassBrand(Tu,this,_isValidPage).call(this,a)&&(null!==a||this._destination)){NgxConsole.error(`PDFHistory.push: "${a}" is not a valid pageNumber parameter.`);return}const s=t||JSON.stringify(i);if(!s)return;let n=!1;if(this._destination&&(function isDestHashesEqual(e,t){if("string"!=typeof e||"string"!=typeof t)return!1;if(e===t)return!0;if(parseQueryString(e).get("nameddest")===t)return!0;return!1}(this._destination.hash,s)||function isDestArraysEqual(e,t){function isEntryEqual(e,t){if(typeof e!=typeof t)return!1;if(Array.isArray(e)||Array.isArray(t))return!1;if(null!==e&&"object"==typeof e&&null!==t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!isEntryEqual(e[i],t[i]))return!1;return!0}return e===t||Number.isNaN(e)&&Number.isNaN(t)}if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let i=0,a=e.length;i<a;i++)if(!isEntryEqual(e[i],t[i]))return!1;return!0}(this._destination.dest,i))){if(this._destination.page)return;n=!0}if(!this._popStateInProgress||n){pdf_history_assertClassBrand(Tu,this,_pushOrReplaceState).call(this,{dest:i,hash:s,page:a,rotation:this.linkService.rotation},n);if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then((()=>{this._popStateInProgress=!1}))}}}pushPage(e){if(this._initialized)if(pdf_history_assertClassBrand(Tu,this,_isValidPage).call(this,e)){if(this._destination?.page!==e&&!this._popStateInProgress){pdf_history_assertClassBrand(Tu,this,_pushOrReplaceState).call(this,{dest:null,hash:`page=${e}`,page:e,rotation:this.linkService.rotation});if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then((()=>{this._popStateInProgress=!1}))}}}else NgxConsole.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`)}pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&pdf_history_assertClassBrand(Tu,this,_tryPushCurrentPosition).call(this)}back(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;pdf_history_assertClassBrand(Tu,this,_isValidState).call(this,e)&&e.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;pdf_history_assertClassBrand(Tu,this,_isValidState).call(this,e)&&e.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}}function _pushOrReplaceState(e){const t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]||!this._destination,i={fingerprint:this._fingerprint,uid:t?this._uid:this._uid+1,destination:e};pdf_history_assertClassBrand(Tu,this,_updateInternalState).call(this,e,i.uid);let a;if(this._updateUrl&&e?.hash){const{href:t,protocol:i}=document.location;"file:"!==i&&(a=updateUrlHash(t,e.hash))}t?window.history.replaceState(i,"",a):window.history.pushState(i,"",a)}function _tryPushCurrentPosition(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._position)return;let t=this._position;if(e){t=Object.assign(Object.create(null),this._position);t.temporary=!0}if(!this._destination){pdf_history_assertClassBrand(Tu,this,_pushOrReplaceState).call(this,t);return}if(this._destination.temporary){pdf_history_assertClassBrand(Tu,this,_pushOrReplaceState).call(this,t,!0);return}if(this._destination.hash===t.hash)return;if(!this._destination.page&&this._numPositionUpdates<=50)return;let i=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(void 0!==this._destination.dest||!this._destination.first)return;i=!0}pdf_history_assertClassBrand(Tu,this,_pushOrReplaceState).call(this,t,i)}function _isValidPage(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount}function _isValidState(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return!1;if(e.fingerprint!==this._fingerprint){if(!t)return!1;{if("string"!=typeof e.fingerprint||e.fingerprint.length!==this._fingerprint.length)return!1;const[t]=performance.getEntriesByType("navigation");if("reload"!==t?.type)return!1}}return!(!Number.isInteger(e.uid)||e.uid<0)&&(null!==e.destination&&"object"==typeof e.destination)}function _updateInternalState(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}i&&e?.temporary&&delete e.temporary;this._destination=e;this._uid=t;this._maxUid=Math.max(this._maxUid,t);this._numPositionUpdates=0}function _parseCurrentHash(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=unescape(getCurrentHash()).substring(1),i=parseQueryString(t),a=i.get("nameddest")||"";let s=0|i.get("page");(!pdf_history_assertClassBrand(Tu,this,_isValidPage).call(this,s)||e&&a.length>0)&&(s=null);return{hash:t,page:s,rotation:this.linkService.rotation}}function _updateViewarea(e){let{location:t}=e;if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._position={hash:t.pdfOpenParams.substring(1),page:this.linkService.page,first:t.pageNumber,rotation:t.rotation};if(!this._popStateInProgress){this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++;this._updateViewareaTimeout=setTimeout((()=>{this._popStateInProgress||pdf_history_assertClassBrand(Tu,this,_tryPushCurrentPosition).call(this,!0);this._updateViewareaTimeout=null}),1e3)}}function _popState(e){let{state:t}=e;const i=getCurrentHash(),a=this._currentHash!==i;this._currentHash=i;if(!t){this._uid++;const{hash:e,page:t,rotation:i}=pdf_history_assertClassBrand(Tu,this,_parseCurrentHash).call(this);pdf_history_assertClassBrand(Tu,this,_pushOrReplaceState).call(this,{hash:e,page:t,rotation:i},!0);return}if(!pdf_history_assertClassBrand(Tu,this,_isValidState).call(this,t))return;this._popStateInProgress=!0;if(a){this._blockHashChange++;waitOnEventOrTimeout({target:window,name:"hashchange",delay:1e3}).then((()=>{this._blockHashChange--}))}const s=t.destination;pdf_history_assertClassBrand(Tu,this,_updateInternalState).call(this,s,t.uid,!0);isValidRotation(s.rotation)&&(this.linkService.rotation=s.rotation);s.dest?this.linkService.goToDestination(s.dest):s.hash?this.linkService.setHash&&this.linkService.setHash(s.hash):s.page&&(this.linkService.page=s.page);Promise.resolve().then((()=>{this._popStateInProgress=!1}))}function _pageHide(){this._destination&&!this._destination.temporary||pdf_history_assertClassBrand(Tu,this,_tryPushCurrentPosition).call(this)}function _bindEvents(){if(pdf_history_classPrivateFieldGet(Gu,this))return;pdf_history_classPrivateFieldSet(Gu,this,new AbortController);const{signal:e}=pdf_history_classPrivateFieldGet(Gu,this);this.eventBus._on("updateviewarea",pdf_history_assertClassBrand(Tu,this,_updateViewarea).bind(this),{signal:e});window.addEventListener("popstate",pdf_history_assertClassBrand(Tu,this,_popState).bind(this),{signal:e});window.addEventListener("pagehide",pdf_history_assertClassBrand(Tu,this,_pageHide).bind(this),{signal:e})}function _unbindEvents(){pdf_history_classPrivateFieldGet(Gu,this)?.abort();pdf_history_classPrivateFieldSet(Gu,this,null)}function pdf_layer_viewer_classPrivateMethodInitSpec(e,t){(function pdf_layer_viewer_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function pdf_layer_viewer_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Du=new WeakSet;class PDFLayerViewer extends BaseTreeViewer{constructor(e){super(e);pdf_layer_viewer_classPrivateMethodInitSpec(this,Du);this.eventBus._on("optionalcontentconfigchanged",(e=>{pdf_layer_viewer_assertClassBrand(Du,this,_updateLayers).call(this,e.promise)}));this.eventBus._on("resetlayers",(()=>{pdf_layer_viewer_assertClassBrand(Du,this,_updateLayers).call(this)}));this.eventBus._on("togglelayerstree",this._toggleAllTreeItems.bind(this))}reset(){super.reset();this._optionalContentConfig=null;this._optionalContentVisibility?.clear();this._optionalContentVisibility=null}_dispatchEvent(e){this.eventBus.dispatch("layersloaded",{source:this,layersCount:e})}_bindLink(e,t){let{groupId:i,input:a}=t;const setVisibility=()=>{const e=a.checked;this._optionalContentConfig.setVisibility(i,e);const t=this._optionalContentVisibility.get(i);t&&(t.visible=e);this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(this._optionalContentConfig)})};e.onclick=t=>{if(t.target===a){setVisibility();return!0}if(t.target!==e)return!0;a.checked=!a.checked;setVisibility();return!1}}_setNestedName(e,t){let{name:i=null}=t;if("string"!=typeof i){e.setAttribute("data-l10n-id","pdfjs-additional-layers");e.style.fontStyle="italic";this._l10n.translateOnce(e)}else e.textContent=this._normalizeTextContent(i)}_addToggleButton(e,t){let{name:i=null}=t;super._addToggleButton(e,null===i)}_toggleAllTreeItems(){this._optionalContentConfig&&super._toggleAllTreeItems()}render(e){let{optionalContentConfig:t,pdfDocument:i}=e;this._optionalContentConfig&&this.reset();this._optionalContentConfig=t||null;this._pdfDocument=i||null;const a=t?.getOrder();if(!a){this._dispatchEvent(0);return}this._optionalContentVisibility=new Map;const s=document.createDocumentFragment(),n=[{parent:s,groups:a}];let r=0,o=!1;for(;n.length>0;){const e=n.shift();for(const i of e.groups){const a=document.createElement("div");a.className="treeItem";const s=document.createElement("a");a.append(s);if("object"==typeof i){o=!0;this._addToggleButton(a,i);this._setNestedName(s,i);const e=document.createElement("div");e.className="treeItems";a.append(e);n.push({parent:e,groups:i.order})}else{const e=t.getGroup(i),a=document.createElement("input");this._bindLink(s,{groupId:i,input:a});a.type="checkbox";a.checked=e.visible;this._optionalContentVisibility.set(i,{input:a,visible:a.checked});const n=document.createElement("label");n.textContent=this._normalizeTextContent(e.name);n.append(a);s.append(n);r++}e.parent.append(a)}}this._finishRendering(s,r,o)}}async function _updateLayers(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!this._optionalContentConfig)return;const t=this._pdfDocument,i=await(e||t.getOptionalContentConfig({intent:"display"}));if(t===this._pdfDocument)if(e)for(const[e,t]of this._optionalContentVisibility){const a=i.getGroup(e);a&&t.visible!==a.visible&&(t.input.checked=t.visible=!t.visible)}else{this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(i)});this.render({optionalContentConfig:i,pdfDocument:this._pdfDocument})}}class PDFOutlineViewer extends BaseTreeViewer{constructor(e){super(e);this.linkService=e.linkService;this.downloadManager=e.downloadManager;this.eventBus._on("toggleoutlinetree",this._toggleAllTreeItems.bind(this));this.eventBus._on("currentoutlineitem",this._currentOutlineItem.bind(this));this.eventBus._on("pagechanging",(e=>{this._currentPageNumber=e.pageNumber}));this.eventBus._on("pagesloaded",(e=>{this._isPagesLoaded=!!e.pagesCount;this._currentOutlineItemCapability?.resolve(this._isPagesLoaded)}));this.eventBus._on("sidebarviewchanged",(e=>{this._sidebarView=e.view}))}reset(){super.reset();this._outline=null;this._pageNumberToDestHashCapability=null;this._currentPageNumber=1;this._isPagesLoaded=null;this._currentOutlineItemCapability?.resolve(!1);this._currentOutlineItemCapability=null}_dispatchEvent(e){this._currentOutlineItemCapability=Promise.withResolvers();0===e||this._pdfDocument?.loadingParams.disableAutoFetch?this._currentOutlineItemCapability.resolve(!1):null!==this._isPagesLoaded&&this._currentOutlineItemCapability.resolve(this._isPagesLoaded);this.eventBus.dispatch("outlineloaded",{source:this,outlineCount:e,currentOutlineItemPromise:this._currentOutlineItemCapability.promise})}_bindLink(e,t){let{url:i,newWindow:a,action:s,attachment:n,dest:r,setOCGState:o}=t;const{linkService:l}=this;if(i)l.addLinkAttributes(e,i,a);else if(s){e.href=l.getAnchorUrl("");e.onclick=()=>{l.executeNamedAction(s);return!1}}else if(n){e.href=l.getAnchorUrl("");e.onclick=()=>{this.downloadManager.openOrDownloadData(n.content,n.filename);return!1}}else if(o){e.href=l.getAnchorUrl("");e.onclick=()=>{l.executeSetOCGState(o);return!1}}else{e.href=l.getDestinationHash(r);e.onclick=e=>{this._updateCurrentTreeItem(e.target.parentNode);r&&l.goToDestination(r);return!1}}}_setStyles(e,t){let{bold:i,italic:a}=t;i&&(e.style.fontWeight="bold");a&&(e.style.fontStyle="italic")}_addToggleButton(e,t){let{count:i,items:a}=t,s=!1;if(i<0){let e=a.length;if(e>0){const t=[...a];for(;t.length>0;){const{count:i,items:a}=t.shift();if(i>0&&a.length>0){e+=a.length;t.push(...a)}}}Math.abs(i)===e&&(s=!0)}super._addToggleButton(e,s)}_toggleAllTreeItems(){this._outline&&super._toggleAllTreeItems()}render(e){let{outline:t,pdfDocument:i}=e;this._outline&&this.reset();this._outline=t||null;this._pdfDocument=i||null;if(!t){this._dispatchEvent(0);return}const a=document.createDocumentFragment(),s=[{parent:a,items:t}];let n=0,r=!1;for(;s.length>0;){const e=s.shift();for(const t of e.items){const i=document.createElement("div");i.className="treeItem";const a=document.createElement("a");this._bindLink(a,t);this._setStyles(a,t);a.textContent=this._normalizeTextContent(t.title);i.append(a);if(t.items.length>0){r=!0;this._addToggleButton(i,t);const e=document.createElement("div");e.className="treeItems";i.append(e);s.push({parent:e,items:t.items})}e.parent.append(i);n++}}this._finishRendering(a,n,r)}async _currentOutlineItem(){if(!this._isPagesLoaded)throw new Error("_currentOutlineItem: All pages have not been loaded.");if(!this._outline||!this._pdfDocument)return;const e=await this._getPageNumberToDestHash(this._pdfDocument);if(e){this._updateCurrentTreeItem(null);if(this._sidebarView===Nl)for(let t=this._currentPageNumber;t>0;t--){const i=e.get(t);if(!i)continue;const a=this.container.querySelector(`a[href="${i}"]`);if(a){this._scrollToCurrentTreeItem(a.parentNode);break}}}}async _getPageNumberToDestHash(e){if(this._pageNumberToDestHashCapability)return this._pageNumberToDestHashCapability.promise;this._pageNumberToDestHashCapability=Promise.withResolvers();const t=new Map,i=new Map,a=[{nesting:0,items:this._outline}];for(;a.length>0;){const s=a.shift(),n=s.nesting;for(const{dest:r,items:o}of s.items){let s,l;if("string"==typeof r){s=await e.getDestination(r);if(e!==this._pdfDocument)return null}else s=r;if(Array.isArray(s)){const[a]=s;a&&"object"==typeof a?l=e.cachedPageNumber(a):Number.isInteger(a)&&(l=a+1);if(Number.isInteger(l)&&(!t.has(l)||n>i.get(l))){const e=this.linkService.getDestinationHash(r);t.set(l,e);i.set(l,n)}}o.length>0&&a.push({nesting:n+1,items:o})}}this._pageNumberToDestHashCapability.resolve(t.size>0?t:null);return this._pageNumberToDestHashCapability.promise}}function pdf_presentation_mode_classPrivateFieldInitSpec(e,t,i){pdf_presentation_mode_checkPrivateRedeclaration(e,t),t.set(e,i)}function pdf_presentation_mode_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_presentation_mode_classPrivateFieldGet(e,t){return e.get(pdf_presentation_mode_assertClassBrand(e,t))}function pdf_presentation_mode_classPrivateFieldSet(e,t,i){return e.set(pdf_presentation_mode_assertClassBrand(e,t),i),i}function pdf_presentation_mode_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Lu="pdfPresentationMode",Ru="pdfPresentationModeControls",Nu=Math.PI/6;var Ou=new WeakMap,Wu=new WeakMap,ju=new WeakMap,Vu=new WeakMap,Hu=new WeakSet;class PDFPresentationMode{constructor(e){let{container:t,pdfViewer:i,eventBus:a}=e;!function pdf_presentation_mode_classPrivateMethodInitSpec(e,t){pdf_presentation_mode_checkPrivateRedeclaration(e,t),t.add(e)}(this,Hu);pdf_presentation_mode_classPrivateFieldInitSpec(this,Ou,Ml);pdf_presentation_mode_classPrivateFieldInitSpec(this,Wu,null);pdf_presentation_mode_classPrivateFieldInitSpec(this,ju,null);pdf_presentation_mode_classPrivateFieldInitSpec(this,Vu,null);this.container=t;this.pdfViewer=i;this.eventBus=a;this.contextMenuOpen=!1;this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0;this.touchSwipeState=null}async request(){const{container:e,pdfViewer:t}=this;if(this.active||!t.pagesCount||!e.requestFullscreen)return!1;pdf_presentation_mode_assertClassBrand(Hu,this,_addFullscreenChangeListeners).call(this);pdf_presentation_mode_assertClassBrand(Hu,this,_notifyStateChange).call(this,Gl);const i=e.requestFullscreen();pdf_presentation_mode_classPrivateFieldSet(Wu,this,{pageNumber:t.currentPageNumber,scaleValue:t.currentScaleValue,scrollMode:t.scrollMode,spreadMode:null,annotationEditorMode:null});if(!(t.spreadMode===Ul.NONE||t.pageViewsReady&&t.hasEqualPageSizes)){console.warn("Ignoring Spread modes when entering PresentationMode, since the document may contain varying page sizes.");pdf_presentation_mode_classPrivateFieldGet(Wu,this).spreadMode=t.spreadMode}t.annotationEditorMode!==f.DISABLE&&(pdf_presentation_mode_classPrivateFieldGet(Wu,this).annotationEditorMode=t.annotationEditorMode);try{await i;t.focus();return!0}catch{pdf_presentation_mode_assertClassBrand(Hu,this,_removeFullscreenChangeListeners).call(this);pdf_presentation_mode_assertClassBrand(Hu,this,_notifyStateChange).call(this,Bl)}return!1}get active(){return pdf_presentation_mode_classPrivateFieldGet(Ou,this)===Gl||pdf_presentation_mode_classPrivateFieldGet(Ou,this)===Tl}_prepareFullscreenMode(){const e=document.getElementsByClassName("zoom")[0].parentElement,t=e.parentElement;this.ngxContainer=t;for(let i=0;i<t.childElementCount;i++)t.children.item(i)===e&&(this.ngxContainerIndex=i);t.removeChild(e);document.body.append(e);const i=document.body.children;for(let t=0;t<i.length;t++){const a=i.item(t);a!==e&&a instanceof HTMLElement&&a.classList.add("hidden-by-fullscreen")}document.getElementById("sidebarContainer").classList.add("hidden-by-fullscreen");document.getElementsByClassName("toolbar")[0].classList.add("hidden-by-fullscreen")}_tidyUpFullscreenMode(){if(this.ngxContainer){const e=document.getElementsByClassName("zoom")[0].parentElement;document.body.removeChild(e);this.ngxContainerIndex>=this.ngxContainer.childElementCount?this.ngxContainer.append(e):this.ngxContainer.insertBefore(e,this.ngxContainer.children.item(this.ngxContainerIndex));this.ngxContainer=void 0;const t=document.body.children;for(let i=0;i<t.length;i++){const a=t.item(i);a!==e&&a instanceof HTMLElement&&a.classList.contains("hidden-by-fullscreen")&&a.classList.remove("hidden-by-fullscreen")}document.getElementById("sidebarContainer").classList.remove("hidden-by-fullscreen");document.getElementsByClassName("toolbar")[0].classList.remove("hidden-by-fullscreen")}}}function _mouseWheel(e){if(!this.active)return;e.preventDefault();const t=function normalizeWheelEventDelta(e){const t=e.deltaMode;let i=normalizeWheelEventDirection(e);t===WheelEvent.DOM_DELTA_PIXEL?i/=900:t===WheelEvent.DOM_DELTA_LINE&&(i/=30);return i}(e),i=Date.now(),a=this.mouseScrollTimeStamp;if(!(i>a&&i-a<50)){(this.mouseScrollDelta>0&&t<0||this.mouseScrollDelta<0&&t>0)&&pdf_presentation_mode_assertClassBrand(Hu,this,_resetMouseScrollState).call(this);this.mouseScrollDelta+=t;if(Math.abs(this.mouseScrollDelta)>=.1){const e=this.mouseScrollDelta;pdf_presentation_mode_assertClassBrand(Hu,this,_resetMouseScrollState).call(this);(e>0?this.pdfViewer.previousPage():this.pdfViewer.nextPage())&&(this.mouseScrollTimeStamp=i)}}}function _notifyStateChange(e){pdf_presentation_mode_classPrivateFieldSet(Ou,this,e);this.eventBus.dispatch("presentationmodechanged",{source:this,state:e})}function _enter(){pdf_presentation_mode_assertClassBrand(Hu,this,_notifyStateChange).call(this,Tl);this.container.classList.add(Lu);setTimeout((()=>{this.pdfViewer.scrollMode=zl.PAGE;null!==pdf_presentation_mode_classPrivateFieldGet(Wu,this).spreadMode&&(this.pdfViewer.spreadMode=Ul.NONE);this.pdfViewer.currentPageNumber=pdf_presentation_mode_classPrivateFieldGet(Wu,this).pageNumber;this.pdfViewer.currentScaleValue="page-fit";null!==pdf_presentation_mode_classPrivateFieldGet(Wu,this).annotationEditorMode&&(this.pdfViewer.annotationEditorMode={mode:f.NONE})}),0);pdf_presentation_mode_assertClassBrand(Hu,this,_addWindowListeners).call(this);pdf_presentation_mode_assertClassBrand(Hu,this,_showControls).call(this);this.contextMenuOpen=!1;document.getSelection().empty()}function _exit(){const e=this.pdfViewer.currentPageNumber;this.container.classList.remove(Lu);setTimeout((()=>{pdf_presentation_mode_assertClassBrand(Hu,this,_removeFullscreenChangeListeners).call(this);pdf_presentation_mode_assertClassBrand(Hu,this,_notifyStateChange).call(this,Bl);this.pdfViewer.scrollMode=pdf_presentation_mode_classPrivateFieldGet(Wu,this).scrollMode;null!==pdf_presentation_mode_classPrivateFieldGet(Wu,this).spreadMode&&(this.pdfViewer.spreadMode=pdf_presentation_mode_classPrivateFieldGet(Wu,this).spreadMode);this.pdfViewer.currentScaleValue=pdf_presentation_mode_classPrivateFieldGet(Wu,this).scaleValue;this.pdfViewer.currentPageNumber=e;null!==pdf_presentation_mode_classPrivateFieldGet(Wu,this).annotationEditorMode&&(this.pdfViewer.annotationEditorMode={mode:pdf_presentation_mode_classPrivateFieldGet(Wu,this).annotationEditorMode});pdf_presentation_mode_classPrivateFieldSet(Wu,this,null)}),0);pdf_presentation_mode_assertClassBrand(Hu,this,_removeWindowListeners).call(this);pdf_presentation_mode_assertClassBrand(Hu,this,_hideControls).call(this);pdf_presentation_mode_assertClassBrand(Hu,this,_resetMouseScrollState).call(this);this.contextMenuOpen=!1}function _mouseDown(e){if(this.contextMenuOpen){this.contextMenuOpen=!1;e.preventDefault()}else if(!(0!==e.button||e.target.href&&e.target.parentNode?.hasAttribute("data-internal-link"))){e.preventDefault();e.shiftKey?this.pdfViewer.previousPage():this.pdfViewer.nextPage()}}function _contextMenu(){this.contextMenuOpen=!0}function _showControls(){this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add(Ru);this.controlsTimeout=setTimeout((()=>{this.container.classList.remove(Ru);delete this.controlsTimeout}),3e3)}function _hideControls(){if(this.controlsTimeout){clearTimeout(this.controlsTimeout);this.container.classList.remove(Ru);delete this.controlsTimeout}}function _resetMouseScrollState(){this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0}function _touchSwipe(e){if(this.active)if(e.touches.length>1)this.touchSwipeState=null;else switch(e.type){case"touchstart":this.touchSwipeState={startX:e.touches[0].pageX,startY:e.touches[0].pageY,endX:e.touches[0].pageX,endY:e.touches[0].pageY};break;case"touchmove":if(null===this.touchSwipeState)return;this.touchSwipeState.endX=e.touches[0].pageX;this.touchSwipeState.endY=e.touches[0].pageY;e.preventDefault();break;case"touchend":if(null===this.touchSwipeState)return;let t=0;const i=this.touchSwipeState.endX-this.touchSwipeState.startX,a=this.touchSwipeState.endY-this.touchSwipeState.startY,s=Math.abs(Math.atan2(a,i));Math.abs(i)>50&&(s<=Nu||s>=Math.PI-Nu)?t=i:Math.abs(a)>50&&Math.abs(s-Math.PI/2)<=Nu&&(t=a);t>0?this.pdfViewer.previousPage():t<0&&this.pdfViewer.nextPage()}}function _addWindowListeners(){if(pdf_presentation_mode_classPrivateFieldGet(Vu,this))return;pdf_presentation_mode_classPrivateFieldSet(Vu,this,new AbortController);const{signal:e}=pdf_presentation_mode_classPrivateFieldGet(Vu,this),t=pdf_presentation_mode_assertClassBrand(Hu,this,_touchSwipe).bind(this);window.addEventListener("mousemove",pdf_presentation_mode_assertClassBrand(Hu,this,_showControls).bind(this),{signal:e});window.addEventListener("mousedown",pdf_presentation_mode_assertClassBrand(Hu,this,_mouseDown).bind(this),{signal:e});window.addEventListener("wheel",pdf_presentation_mode_assertClassBrand(Hu,this,_mouseWheel).bind(this),{passive:!1,signal:e});window.addEventListener("keydown",pdf_presentation_mode_assertClassBrand(Hu,this,_resetMouseScrollState).bind(this),{signal:e});window.addEventListener("contextmenu",pdf_presentation_mode_assertClassBrand(Hu,this,_contextMenu).bind(this),{signal:e});window.addEventListener("touchstart",t,{signal:e});window.addEventListener("touchmove",t,{signal:e});window.addEventListener("touchend",t,{signal:e})}function _removeWindowListeners(){pdf_presentation_mode_classPrivateFieldGet(Vu,this)?.abort();pdf_presentation_mode_classPrivateFieldSet(Vu,this,null)}function _addFullscreenChangeListeners(){if(!pdf_presentation_mode_classPrivateFieldGet(ju,this)){pdf_presentation_mode_classPrivateFieldSet(ju,this,new AbortController);window.addEventListener("fullscreenchange",(()=>{document.fullscreenElement?pdf_presentation_mode_assertClassBrand(Hu,this,_enter).call(this):pdf_presentation_mode_assertClassBrand(Hu,this,_exit).call(this)}),{signal:pdf_presentation_mode_classPrivateFieldGet(ju,this).signal})}}function _removeFullscreenChangeListeners(){pdf_presentation_mode_classPrivateFieldGet(ju,this)?.abort();pdf_presentation_mode_classPrivateFieldSet(ju,this,null)}class XfaLayerBuilder{constructor(e){let{pdfPage:t,annotationStorage:i=null,linkService:a,xfaHtml:s=null}=e;this.pdfPage=t;this.annotationStorage=i;this.linkService=a;this.xfaHtml=s;this.div=null;this._cancelled=!1}async render(e){let{viewport:t,intent:i="display"}=e;if("print"===i){const e={viewport:t.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:i};this.div=document.createElement("div");e.div=this.div;return XfaLayer.render(e)}const a=await this.pdfPage.getXfa();if(this._cancelled||!a)return{textDivs:[]};const s={viewport:t.clone({dontFlip:!0}),div:this.div,xfaHtml:a,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:i};if(this.div)return XfaLayer.update(s);this.div=document.createElement("div");s.div=this.div;return XfaLayer.render(s)}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}function canvasTest(e){const t=e.sizes.shift(),i=Math.max(Math.ceil(t[0]),1),a=Math.max(Math.ceil(t[1]),1),s=[i-1,a-1,1,1],n=performance.now(),r="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;let o,l;if(r){o=new OffscreenCanvas(1,1);l=new OffscreenCanvas(i,a)}else{o=document.createElement("canvas");o.width=1;o.height=1;l=document.createElement("canvas");l.width=i;l.height=a}const d=o.getContext("2d"),c=l.getContext("2d");if(c){c.fillRect.apply(c,s);d.drawImage(l,i-1,a-1,1,1,0,0,1,1)}const h=d&&0!==d.getImageData(0,0,1,1).data[3],u=parseInt(performance.now()-n);[o,l].forEach((e=>{e.height=0;e.width=0}));if(r){postMessage({width:i,height:a,testTime:u,isTestPass:h});!h&&e.sizes.length&&setTimeout((()=>{canvasTest(e)}),0)}else if(h)e.onSuccess({width:i,height:a,testTime:u});else{e.onError({width:i,height:a,testTime:u});e.sizes.length&&setTimeout((()=>{canvasTest(e)}),0)}return h}const zu={area:[16384,14188,11402,11180,10836,8192,4096,1],height:[8388607,65535,32767,16384,8192,4096,1],width:[4194303,65535,32767,16384,8192,4096,1]},Uu={max:null,min:1,sizes:[],step:1024,useWorker:!1,onError:Function.prototype,onSuccess:Function.prototype},$u={};function createSizesArray(e){const t=e.width===e.height,i=1===e.height,a=1===e.width,s=[];if(e.width&&e.height){const n=e.min||Uu.min,r=e.step||Uu.step;let o=Math.max(e.width,e.height);for(;o>=n;){const e=t||i?o:1,n=t||a?o:1;s.push([e,n]);o-=r}}else e.sizes.forEach((e=>{const n=t||i?e:1,r=t||a?e:1;s.push([n,r])}));return s}function handleMethod(e){const t="undefined"!=typeof window,i=t&&"Promise"in window,a=t&&"HTMLCanvasElement"in window,s=t&&"OffscreenCanvas"in window,n=URL.createObjectURL(new Blob([])).slice(-36),r=performance.now(),{onError:o,onSuccess:l,...d}=e,getTotalTime=()=>parseInt(performance.now()-r);let c=null;if(!a)return!1;if(e.useWorker&&s){const e=`\n            var canvasTest = ${canvasTest.toString()};\n            onmessage = function(e) {\n                canvasTest(e.data);\n            };\n        `,t=new Blob([e],{type:"application/javascript"}),i=URL.createObjectURL(t);c=new Worker(i);URL.revokeObjectURL(i);c.onmessage=function(e){const{width:t,height:i,testTime:a,isTestPass:s}=e.data,r={width:t,height:i,testTime:a,totalTime:getTotalTime()};if(s){$u[n].onSuccess(r);delete $u[n]}else $u[n].onError(r)}}if(i)return new Promise((t=>{const i={...e,onError(i){let{width:a,height:s,testTime:n}=i;const r={width:a,height:s,testTime:n,totalTime:getTotalTime()};let l;if(0===e.sizes.length)l=!0;else{const[[t,i]]=e.sizes.slice(-1);l=a===t&&s===i}o(r);l&&t({...r,success:!1})},onSuccess(e){let{width:i,height:a,testTime:s}=e;const n={width:i,height:a,testTime:s,totalTime:getTotalTime()};l(n);t({...n,success:!0})}};if(c){const{onError:e,onSuccess:t}=i;$u[n]={onError:e,onSuccess:t};c.postMessage(d)}else canvasTest(i)}));if(!c)return canvasTest(e);$u[n]={onError:o,onSuccess:l};c.postMessage(d)}const qu={maxArea(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=createSizesArray({width:e.max,height:e.max,min:e.min,step:e.step,sizes:[...zu.area]});return handleMethod({...Uu,...e,sizes:t})},maxHeight(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=createSizesArray({width:1,height:e.max,min:e.min,step:e.step,sizes:[...zu.height]});return handleMethod({...Uu,...e,sizes:t})},maxWidth(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=createSizesArray({width:e.max,height:1,min:e.min,step:e.step,sizes:[...zu.width]});return handleMethod({...Uu,...e,sizes:t})},test(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t={...Uu,...e};t.sizes=[...t.sizes];t.width&&t.height&&(t.sizes=[[t.width,t.height]]);return handleMethod(t)}};function max_canvas_size_defineProperty(e,t,i){return(t=function max_canvas_size_toPropertyKey(e){var t=function max_canvas_size_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class MaxCanvasSize{static async determineMaxArea(){const{success:e,width:t,height:i}=await qu.maxArea({useWorker:!0});if(!e){MaxCanvasSize.maxWidth=4096;MaxCanvasSize.maxArea=16777216;return 4096}MaxCanvasSize.maxArea=t*i;return MaxCanvasSize.maxArea}static async determineMaxWidth(){const{width:e}=await qu.maxWidth({useWorker:!0});MaxCanvasSize.maxWidth=e;return MaxCanvasSize.maxWidth}static async determineMaxHeight(){const{height:e}=await qu.maxHeight({useWorker:!0});MaxCanvasSize.maxHeight=e;return MaxCanvasSize.maxHeight}static async determineMaxDimensions(){if(MaxCanvasSize.maxWidth)return MaxCanvasSize.maxWidth;await this.determineMaxArea();await this.determineMaxHeight();await this.determineMaxWidth();return MaxCanvasSize.maxWidth}static async reduceToMaxCanvasSize(e,t){let i=1;if(e>=4096||t>=4096){await this.determineMaxDimensions();i=Math.max(e/MaxCanvasSize.maxWidth,t/MaxCanvasSize.maxHeight,Math.sqrt(e*t/MaxCanvasSize.maxArea));i>1&&(i=Math.ceil(1+100*i)/100)}return i}}max_canvas_size_defineProperty(MaxCanvasSize,"maxWidth",null);max_canvas_size_defineProperty(MaxCanvasSize,"maxHeight",null);max_canvas_size_defineProperty(MaxCanvasSize,"maxArea",null);let Xu=null,Ku=null,Yu=null,Zu={initialized:!1};class PDFPrintService{constructor(e,t,i){let{pdfDocument:a,pagesOverview:s,printResolution:n,printAnnotationStoragePromise:r=null,eventBus:o,cspPolicyService:l,pageOrder:d=null}=e;this.pdfDocument=a;this.pagesOverview=s;this._printResolution=n||150;this.pageOrder=d||Array.from({length:a.numPages},((e,t)=>t+1));this._optionalContentConfigPromise=a.getOptionalContentConfig({intent:"print"});this._printAnnotationStoragePromise=r||Promise.resolve();this.currentPage=-1;this.scratchCanvas=document.createElement("canvas");this.eventBus=o;this.filteredPageCount=i;this.isInPDFPrintRange=t;this.cspPolicyService=l}layout(){this.throwIfInactive();const e=document.querySelector("body");e.setAttribute("data-pdfjsprinting",!0);document.querySelector("html").setAttribute("data-pdfjsprinting",!0);const{width:t,height:i}=this.pagesOverview[0];this.pagesOverview.every((e=>e.width===t&&e.height===i))||NgxConsole.warn("Not all pages have the same size. The printed result may be incorrect!");this.pageStyleSheet=document.createElement("style");const a=`@page { size: ${t}pt ${i}pt;}`;this.cspPolicyService?this.cspPolicyService.addTrustedCSS(this.pageStyleSheet,a):this.pageStyleSheet.textContent=a;e.append(this.pageStyleSheet)}destroy(){if(Xu!==this)return;this.printContainer.remove();this.printContainer=null;document.querySelector("body").removeAttribute("data-pdfjsprinting");document.querySelector("html").removeAttribute("data-pdfjsprinting");if(this.pageStyleSheet){this.pageStyleSheet.remove();this.pageStyleSheet=null}this.scratchCanvas.width=this.scratchCanvas.height=0;this.scratchCanvas=null;Xu=null;ensureOverlay().then((function(){Yu.closeIfActive(Ku);Yu.unregister(Ku);Ju=void 0}))}renderPages(){if(this.pdfDocument.isPureXfa){!function getXfaHtmlForPrinting(e,t){const i=t.allXfaHtml,a=new SimpleLinkService,s=Math.round(100*PixelsPerInch.PDF_TO_CSS_UNITS)/100;for(const n of i.children){const i=document.createElement("div");i.className="xfaPrintedPage";e.append(i);const r=new XfaLayerBuilder({pdfPage:null,annotationStorage:t.annotationStorage,linkService:a,xfaHtml:n}),o=getXfaPageViewport(n,{scale:s});r.render({viewport:o,intent:"print"});i.append(r.div)}}(this.printContainer,this.pdfDocument);return Promise.resolve()}const e=this.pagesOverview.length,renderNextPage=(t,i)=>{this.throwIfInactive();for(;;){++this.currentPage;if(this.currentPage>=e)break;if(!this.isInPDFPrintRange||this.isInPDFPrintRange(this.currentPage))break}if(this.currentPage>=e){renderProgress(this.filteredPageCount??e,this.filteredPageCount??e,this.eventBus);t();return}const a=this.currentPage;renderProgress(a,this.filteredPageCount??e,this.eventBus);(async function renderPage(e,t,i,a,s,n,r){const o=Xu.scratchCanvas;let l=s/PixelsPerInch.PDF;const d=Math.floor(a.width*l),c=Math.floor(a.height*l),h=await MaxCanvasSize.reduceToMaxCanvasSize(d,c);if(h>1){const e=Math.round(100*(h-1));l=Math.ceil(.95*l/h);warn(`Page ${i}: Reduced the maximum resolution by ${e}% because the browser can't render larger canvases. The resolution is now ${l*PixelsPerInch.PDF} DPI.`)}o.width=Math.floor(a.width*l);o.height=Math.floor(a.height*l);const u=o.getContext("2d");u.save();u.fillStyle="rgb(255, 255, 255)";u.fillRect(0,0,o.width,o.height);u.restore();return Promise.all([t.getPage(i),r]).then((function(e){let[t,i]=e;const s={canvas:o,transform:[l,0,0,l,0,0],viewport:t.getViewport({scale:1,rotation:a.rotation}),intent:"print",annotationMode:p.ENABLE_STORAGE,optionalContentConfigPromise:n,printAnnotationStorage:i};return t.render(s).promise.catch((e=>{e instanceof RenderingCancelledException||console.error(e);throw e}))}))})(0,this.pdfDocument,this.pageOrder[a],this.pagesOverview[a],this._printResolution,this._optionalContentConfigPromise,this._printAnnotationStoragePromise).then(this.useRenderedPage.bind(this)).then((function(){renderNextPage(t,i)}),i)};return new Promise(renderNextPage)}useRenderedPage(){this.throwIfInactive();const e=document.createElement("img");this.scratchCanvas.toBlob((t=>{e.src=URL.createObjectURL(t)}));const t=document.createElement("div");t.className="printedPage";t.append(e);this.printContainer.append(t);const{promise:i,resolve:a,reject:s}=Promise.withResolvers();e.onload=a;e.onerror=s;i.catch((()=>{})).then((()=>{URL.revokeObjectURL(e.src)}));return i}performPrint(){this.throwIfInactive();return new Promise((e=>{setTimeout((()=>{if(!this.active){e();return}Qu.call(window);const t=navigator.platform&&["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document,i=/Android/i.test(navigator.userAgent);setTimeout(e,t||i?1500:100)}),0)}))}get active(){return this===Xu}throwIfInactive(){if(!this.active)throw new Error("This print request was cancelled or completed.")}}const Qu=window.print;function dispatchEvent(e){const t=new CustomEvent(e,{bubbles:!1,cancelable:!1,detail:"custom"});window.dispatchEvent(t)}function abort(){if(Xu){Xu.destroy();dispatchEvent("afterprint")}}function renderProgress(e,t,i){Ku=document.getElementById("printServiceDialog");const a=Math.round(100*e/t),s=Ku.querySelector("progress"),n=Ku.querySelector(".relative-progress");s.value=a;n.setAttribute("data-l10n-args",JSON.stringify({progress:a}));i.dispatch("progress",{source:this,type:"print",total:t,page:e,percent:100*e/t})}window.addEventListener("keydown",(function(e){if(80===e.keyCode&&(e.ctrlKey||e.metaKey)&&!e.altKey&&(!e.shiftKey||window.chrome||window.opera)){window.print();e.preventDefault();e.stopImmediatePropagation()}}),!0);if("onbeforeprint"in window){const stopPropagationIfNeeded=function(e){"custom"!==e.detail&&e.stopImmediatePropagation()};window.addEventListener("beforeprint",stopPropagationIfNeeded);window.addEventListener("afterprint",stopPropagationIfNeeded)}let Ju;function ensureOverlay(){if(!Ju){Yu=Zu.overlayManager;if(!Yu)throw new Error("The overlay manager has not yet been initialized.");Ku=document.getElementById("printServiceDialog");Ju=Yu.register(Ku,!0);document.getElementById("printCancel").onclick=abort;Ku.addEventListener("close",abort)}return Ju}class PDFPrintServiceFactory{static initGlobals(e){Zu=e}static get supportsPrinting(){return shadow(this,"supportsPrinting",!0)}static createPrintService(e){if(Xu)throw new Error("The print service is created and active.");PDFPrintServiceFactory.enablePrint||console.debug("The print service is disabled.");return Xu=new PDFPrintService(e,PDFPrintServiceFactory.isInPDFPrintRange,PDFPrintServiceFactory.filteredPageCount)}}!function pdf_print_service_defineProperty(e,t,i){return(t=function pdf_print_service_toPropertyKey(e){var t=function pdf_print_service_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}(PDFPrintServiceFactory,"enablePrint",!0);class PDFRenderingQueue{constructor(){this.pdfViewer=null;this.pdfThumbnailViewer=null;this.onIdle=null;this.highestPriorityPage=null;this.idleTimeout=null;this.printing=!1;this.isThumbnailViewEnabled=!1;Object.defineProperty(this,"hasViewer",{value:()=>!!this.pdfViewer})}setViewer(e){this.pdfViewer=e}setThumbnailViewer(e){this.pdfThumbnailViewer=e}isHighestPriority(e){return this.highestPriorityPage===e.renderingId}renderHighestPriority(e){if(this.idleTimeout){clearTimeout(this.idleTimeout);this.idleTimeout=null}this.pdfViewer.forceRendering(e)||this.isThumbnailViewEnabled&&this.pdfThumbnailViewer?.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4))}getHighestPriority(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const n=e.views,r=n.length;if(0===r)return null;for(let e=0;e<r;e++){const t=n[e].view;if(!this.isViewFinished(t))return t}if(!s)for(let e=0;e<r;e++){const{detailView:t}=n[e].view;if(t&&!this.isViewFinished(t))return t}const o=e.first.id,l=e.last.id;if(l-o+1>r){const a=e.ids;for(let e=1,s=l-o;e<s;e++){const s=i?o+e:l-e;if(a.has(s))continue;const n=t[s-1];if(!this.isViewFinished(n))return n}}let d=i?l:o-2,c=t[d];if(c&&!this.isViewFinished(c))return c;if(a){d+=i?1:-1;c=t[d];if(c&&!this.isViewFinished(c))return c}return null}isViewFinished(e){return e.renderingState===Il.FINISHED}renderView(e){switch(e.renderingState){case Il.FINISHED:return!1;case Il.PAUSED:this.highestPriorityPage=e.renderingId;e.resume();break;case Il.RUNNING:this.highestPriorityPage=e.renderingId;break;case Il.INITIAL:this.highestPriorityPage=e.renderingId;e.draw().finally((()=>{this.renderHighestPriority()})).catch((e=>{e instanceof RenderingCancelledException||NgxConsole.error("renderView:",e)}))}return!0}}function pdf_scripting_manager_classPrivateFieldInitSpec(e,t,i){pdf_scripting_manager_checkPrivateRedeclaration(e,t),t.set(e,i)}function pdf_scripting_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_scripting_manager_classPrivateFieldGet(e,t){return e.get(pdf_scripting_manager_assertClassBrand(e,t))}function pdf_scripting_manager_classPrivateFieldSet(e,t,i){return e.set(pdf_scripting_manager_assertClassBrand(e,t),i),i}function pdf_scripting_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var e_=new WeakMap,t_=new WeakMap,i_=new WeakMap,a_=new WeakMap,s_=new WeakMap,n_=new WeakMap,r_=new WeakMap,o_=new WeakMap,l_=new WeakMap,d_=new WeakMap,c_=new WeakMap,h_=new WeakSet;class PDFScriptingManager{constructor(e){let{eventBus:t,externalServices:i=null,docProperties:a=null}=e;!function pdf_scripting_manager_classPrivateMethodInitSpec(e,t){pdf_scripting_manager_checkPrivateRedeclaration(e,t),t.add(e)}(this,h_);pdf_scripting_manager_classPrivateFieldInitSpec(this,e_,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,t_,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,i_,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,a_,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,s_,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,n_,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,r_,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,o_,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,l_,!1);pdf_scripting_manager_classPrivateFieldInitSpec(this,d_,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,c_,null);pdf_scripting_manager_classPrivateFieldSet(s_,this,t);pdf_scripting_manager_classPrivateFieldSet(n_,this,i);pdf_scripting_manager_classPrivateFieldSet(i_,this,a)}setViewer(e){pdf_scripting_manager_classPrivateFieldSet(o_,this,e)}async setDocument(e){pdf_scripting_manager_classPrivateFieldGet(r_,this)&&await pdf_scripting_manager_assertClassBrand(h_,this,_destroyScripting).call(this);pdf_scripting_manager_classPrivateFieldSet(r_,this,e);if(!e)return;const[t,i,a]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(!t&&!a){await pdf_scripting_manager_assertClassBrand(h_,this,_destroyScripting).call(this);return}if(e!==pdf_scripting_manager_classPrivateFieldGet(r_,this))return;try{pdf_scripting_manager_classPrivateFieldSet(d_,this,pdf_scripting_manager_assertClassBrand(h_,this,_initScripting).call(this))}catch(e){NgxConsole.error("setDocument:",e);await pdf_scripting_manager_assertClassBrand(h_,this,_destroyScripting).call(this);return}const s=pdf_scripting_manager_classPrivateFieldGet(s_,this);pdf_scripting_manager_classPrivateFieldSet(a_,this,new AbortController);const{signal:n}=pdf_scripting_manager_classPrivateFieldGet(a_,this);s._on("updatefromsandbox",(e=>{e?.source===window&&pdf_scripting_manager_assertClassBrand(h_,this,_updateFromSandbox).call(this,e.detail)}),{signal:n});s._on("dispatcheventinsandbox",(e=>{pdf_scripting_manager_classPrivateFieldGet(d_,this)?.dispatchEventInSandbox(e.detail)}),{signal:n});s._on("pagechanging",(e=>{let{pageNumber:t,previous:i}=e;if(t!==i){pdf_scripting_manager_assertClassBrand(h_,this,_dispatchPageClose).call(this,i);pdf_scripting_manager_assertClassBrand(h_,this,_dispatchPageOpen).call(this,t)}}),{signal:n});s._on("pagerendered",(e=>{let{pageNumber:t}=e;this._pageOpenPending.has(t)&&t===pdf_scripting_manager_classPrivateFieldGet(o_,this).currentPageNumber&&pdf_scripting_manager_assertClassBrand(h_,this,_dispatchPageOpen).call(this,t)}),{signal:n});s._on("pagesdestroy",(async()=>{await pdf_scripting_manager_assertClassBrand(h_,this,_dispatchPageClose).call(this,pdf_scripting_manager_classPrivateFieldGet(o_,this).currentPageNumber);await(pdf_scripting_manager_classPrivateFieldGet(d_,this)?.dispatchEventInSandbox({id:"doc",name:"WillClose"}));pdf_scripting_manager_classPrivateFieldGet(e_,this)?.resolve()}),{signal:n});try{const n=await pdf_scripting_manager_classPrivateFieldGet(i_,this).call(this,e);if(e!==pdf_scripting_manager_classPrivateFieldGet(r_,this))return;await pdf_scripting_manager_classPrivateFieldGet(d_,this).createSandbox({objects:t,calculationOrder:i,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...n,actions:a}});s.dispatch("sandboxcreated",{source:this})}catch(e){NgxConsole.error("setDocument:",e);await pdf_scripting_manager_assertClassBrand(h_,this,_destroyScripting).call(this);return}await(pdf_scripting_manager_classPrivateFieldGet(d_,this)?.dispatchEventInSandbox({id:"doc",name:"Open"}));await pdf_scripting_manager_assertClassBrand(h_,this,_dispatchPageOpen).call(this,pdf_scripting_manager_classPrivateFieldGet(o_,this).currentPageNumber,!0);Promise.resolve().then((()=>{e===pdf_scripting_manager_classPrivateFieldGet(r_,this)&&pdf_scripting_manager_classPrivateFieldSet(l_,this,!0)}))}async dispatchWillSave(){return pdf_scripting_manager_classPrivateFieldGet(d_,this)?.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(){return pdf_scripting_manager_classPrivateFieldGet(d_,this)?.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(){if(pdf_scripting_manager_classPrivateFieldGet(d_,this)){await(pdf_scripting_manager_classPrivateFieldGet(c_,this)?.promise);pdf_scripting_manager_classPrivateFieldSet(c_,this,Promise.withResolvers());try{await pdf_scripting_manager_classPrivateFieldGet(d_,this).dispatchEventInSandbox({id:"doc",name:"WillPrint"})}catch(e){pdf_scripting_manager_classPrivateFieldGet(c_,this).resolve();pdf_scripting_manager_classPrivateFieldSet(c_,this,null);throw e}await pdf_scripting_manager_classPrivateFieldGet(c_,this).promise}}async dispatchDidPrint(){return pdf_scripting_manager_classPrivateFieldGet(d_,this)?.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get destroyPromise(){return pdf_scripting_manager_classPrivateFieldGet(t_,this)?.promise||null}get ready(){return pdf_scripting_manager_classPrivateFieldGet(l_,this)}get _pageOpenPending(){return shadow(this,"_pageOpenPending",new Set)}get _visitedPages(){return shadow(this,"_visitedPages",new Map)}}async function _updateFromSandbox(e){const t=pdf_scripting_manager_classPrivateFieldGet(o_,this),i=t.isInPresentationMode||t.isChangingPresentationMode,{id:a,siblings:s,command:n,value:r}=e;if(!a){switch(n){case"clear":NgxConsole.clear();break;case"error":NgxConsole.error(r);break;case"layout":if(!i){const e=apiPageLayoutToViewerModes(r);t.spreadMode=e.spreadMode}break;case"page-num":t.currentPageNumber=r+1;break;case"print":await t.pagesPromise;pdf_scripting_manager_classPrivateFieldGet(s_,this).dispatch("print",{source:this});break;case"println":NgxConsole.log(r);break;case"zoom":i||(t.currentScaleValue=r);break;case"SaveAs":pdf_scripting_manager_classPrivateFieldGet(s_,this).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":i||t.increaseScale();break;case"ZoomViewOut":i||t.decreaseScale();break;case"WillPrintFinished":pdf_scripting_manager_classPrivateFieldGet(c_,this)?.resolve();pdf_scripting_manager_classPrivateFieldSet(c_,this,null)}return}if(i&&e.focus)return;delete e.id;delete e.siblings;const o=s?[a,...s]:[a];for(const t of o){const i=document.querySelector(`[data-element-id="${t}"]`);i?i.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:e})):pdf_scripting_manager_classPrivateFieldGet(r_,this)?.annotationStorage.setValue(t,e)}}async function _dispatchPageOpen(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=pdf_scripting_manager_classPrivateFieldGet(r_,this),a=this._visitedPages;t&&pdf_scripting_manager_classPrivateFieldSet(e_,this,Promise.withResolvers());if(!pdf_scripting_manager_classPrivateFieldGet(e_,this))return;const s=pdf_scripting_manager_classPrivateFieldGet(o_,this).getPageView(e-1);if(s?.renderingState!==Il.FINISHED){this._pageOpenPending.add(e);return}this._pageOpenPending.delete(e);const n=(async()=>{const t=await(a.has(e)?null:s.pdfPage?.getJSActions());i===pdf_scripting_manager_classPrivateFieldGet(r_,this)&&await(pdf_scripting_manager_classPrivateFieldGet(d_,this)?.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:e,actions:t}))})();a.set(e,n)}async function _dispatchPageClose(e){const t=pdf_scripting_manager_classPrivateFieldGet(r_,this),i=this._visitedPages;if(!pdf_scripting_manager_classPrivateFieldGet(e_,this))return;if(this._pageOpenPending.has(e))return;const a=i.get(e);if(a){i.set(e,null);await a;t===pdf_scripting_manager_classPrivateFieldGet(r_,this)&&await(pdf_scripting_manager_classPrivateFieldGet(d_,this)?.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:e}))}}function _initScripting(){pdf_scripting_manager_classPrivateFieldSet(t_,this,Promise.withResolvers());if(pdf_scripting_manager_classPrivateFieldGet(d_,this))throw new Error("#initScripting: Scripting already exists.");return pdf_scripting_manager_classPrivateFieldGet(n_,this).createScripting()}async function _destroyScripting(){if(pdf_scripting_manager_classPrivateFieldGet(d_,this)){if(pdf_scripting_manager_classPrivateFieldGet(e_,this)){await Promise.race([pdf_scripting_manager_classPrivateFieldGet(e_,this).promise,new Promise((e=>{setTimeout(e,1e3)}))]).catch((()=>{}));pdf_scripting_manager_classPrivateFieldSet(e_,this,null)}pdf_scripting_manager_classPrivateFieldSet(r_,this,null);try{await pdf_scripting_manager_classPrivateFieldGet(d_,this).destroySandbox()}catch{}pdf_scripting_manager_classPrivateFieldGet(c_,this)?.reject(new Error("Scripting destroyed."));pdf_scripting_manager_classPrivateFieldSet(c_,this,null);pdf_scripting_manager_classPrivateFieldGet(a_,this)?.abort();pdf_scripting_manager_classPrivateFieldSet(a_,this,null);this._pageOpenPending.clear();this._visitedPages.clear();pdf_scripting_manager_classPrivateFieldSet(d_,this,null);pdf_scripting_manager_classPrivateFieldSet(l_,this,!1);pdf_scripting_manager_classPrivateFieldGet(t_,this)?.resolve()}else{pdf_scripting_manager_classPrivateFieldSet(r_,this,null);pdf_scripting_manager_classPrivateFieldGet(t_,this)?.resolve()}}function pdf_sidebar_classPrivateFieldInitSpec(e,t,i){pdf_sidebar_checkPrivateRedeclaration(e,t),t.set(e,i)}function pdf_sidebar_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_sidebar_classPrivateFieldGet(e,t){return e.get(pdf_sidebar_assertClassBrand(e,t))}function pdf_sidebar_classPrivateFieldSet(e,t,i){return e.set(pdf_sidebar_assertClassBrand(e,t),i),i}function pdf_sidebar_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const u_="sidebarResizing",__="pdfSidebarNotification";var p_=new WeakMap,g_=new WeakMap,f_=new WeakMap,v_=new WeakMap,m_=new WeakSet;class PDFSidebar{constructor(e){let{elements:t,eventBus:i,l10n:a}=e;!function pdf_sidebar_classPrivateMethodInitSpec(e,t){pdf_sidebar_checkPrivateRedeclaration(e,t),t.add(e)}(this,m_);pdf_sidebar_classPrivateFieldInitSpec(this,p_,!1);pdf_sidebar_classPrivateFieldInitSpec(this,g_,null);pdf_sidebar_classPrivateFieldInitSpec(this,f_,null);pdf_sidebar_classPrivateFieldInitSpec(this,v_,null);this.isOpen=!1;this.active=Rl;this.isInitialViewSet=!1;this.isInitialEventDispatched=!1;this.onToggled=null;this.onUpdateThumbnails=null;this.outerContainer=t.outerContainer;this.sidebarContainer=t.sidebarContainer;this.toggleButton=t.toggleButton;this.resizer=t.resizer;this.thumbnailButton=t.thumbnailButton;this.outlineButton=t.outlineButton;this.attachmentsButton=t.attachmentsButton;this.layersButton=t.layersButton;this.thumbnailView=t.thumbnailView;this.outlineView=t.outlineView;this.attachmentsView=t.attachmentsView;this.layersView=t.layersView;this._currentOutlineItemButton=t.currentOutlineItemButton;this.eventBus=i;pdf_sidebar_classPrivateFieldSet(p_,this,"rtl"===a.getDirection());pdf_sidebar_assertClassBrand(m_,this,pdf_sidebar_addEventListeners).call(this)}reset(){this.isInitialViewSet=!1;this.isInitialEventDispatched=!1;pdf_sidebar_assertClassBrand(m_,this,_hideUINotification).call(this,!0);this.switchView(Rl);this.outlineButton.disabled=!1;this.attachmentsButton.disabled=!1;this.layersButton.disabled=!1;this.outlineButton.hidden=!1;this.attachmentsButton.hidden=!1;this.layersButton.hidden=!1;this._currentOutlineItemButton.disabled=!0}get visibleView(){return this.isOpen?this.active:Ll}setInitialView(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ll;if(!this.isInitialViewSet){this.isInitialViewSet=!0;if(e!==Ll&&e!==Dl){this.switchView(e,!0);this.isInitialEventDispatched||pdf_sidebar_assertClassBrand(m_,this,_dispatchEvent).call(this)}else pdf_sidebar_assertClassBrand(m_,this,_dispatchEvent).call(this)}}switchView(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=e!==this.active;let a=!1;switch(e){case Ll:this.isOpen&&this.close();return;case Rl:this.isOpen&&i&&(a=!0);break;case Nl:if(this.outlineButton.disabled)return;break;case Ol:if(this.attachmentsButton.disabled)return;break;case Wl:if(this.layersButton.disabled)return;break;default:NgxConsole.error(`PDFSidebar.switchView: "${e}" is not a valid view.`);return}this.active=e;toggleCheckedBtn(this.thumbnailButton,e===Rl,this.thumbnailView);toggleCheckedBtn(this.outlineButton,e===Nl,this.outlineView);toggleCheckedBtn(this.attachmentsButton,e===Ol,this.attachmentsView);toggleCheckedBtn(this.layersButton,e===Wl,this.layersView);if(!t||this.isOpen){if(a){this.onUpdateThumbnails();this.onToggled()}i&&pdf_sidebar_assertClassBrand(m_,this,_dispatchEvent).call(this)}else this.open()}open(){if(!this.isOpen){this.isOpen=!0;toggleExpandedBtn(this.toggleButton,!0);this.outerContainer.classList.add("sidebarMoving","sidebarOpen");this.active===Rl&&this.onUpdateThumbnails();this.onToggled();pdf_sidebar_assertClassBrand(m_,this,_dispatchEvent).call(this);pdf_sidebar_assertClassBrand(m_,this,_hideUINotification).call(this)}}close(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.isOpen){this.isOpen=!1;toggleExpandedBtn(this.toggleButton,!1);this.outerContainer.classList.add("sidebarMoving");this.outerContainer.classList.remove("sidebarOpen");this.onToggled();pdf_sidebar_assertClassBrand(m_,this,_dispatchEvent).call(this);e?.detail>0&&this.toggleButton.blur()}}toggle(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.isOpen?this.close(e):this.open()}get outerContainerWidth(){return pdf_sidebar_classPrivateFieldGet(f_,this)||pdf_sidebar_classPrivateFieldSet(f_,this,this.outerContainer.clientWidth)}}function _dispatchEvent(){this.isInitialViewSet&&(this.isInitialEventDispatched||=!0);this.eventBus.dispatch("sidebarviewchanged",{source:this,view:this.visibleView})}function _showUINotification(){this.toggleButton.setAttribute("data-l10n-id","pdfjs-toggle-sidebar-notification-button");this.isOpen||this.toggleButton.classList.add(__)}function _hideUINotification(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(this.isOpen||e)&&this.toggleButton.classList.remove(__);e&&this.toggleButton.setAttribute("data-l10n-id","pdfjs-toggle-sidebar-button")}function pdf_sidebar_addEventListeners(){const{eventBus:e,outerContainer:t}=this;this.sidebarContainer.addEventListener("transitionend",(i=>{if(i.target===this.sidebarContainer){t.classList.remove("sidebarMoving");e.dispatch("resize",{source:this})}}));isInsideNgxExtendedPdfViewer(this.toggleButton)||this.toggleButton.addEventListener("click",(e=>{this.toggle(e)}));this.thumbnailButton.addEventListener("click",(()=>{this.switchView(Rl)}));this.outlineButton.addEventListener("click",(()=>{this.switchView(Nl)}));this.outlineButton.addEventListener("dblclick",(()=>{e.dispatch("toggleoutlinetree",{source:this})}));this.attachmentsButton.addEventListener("click",(()=>{this.switchView(Ol)}));this.layersButton.addEventListener("click",(()=>{this.switchView(Wl)}));this.layersButton.addEventListener("dblclick",(()=>{e.dispatch("resetlayers",{source:this})}));this._currentOutlineItemButton.addEventListener("click",(()=>{e.dispatch("currentoutlineitem",{source:this})}));const onTreeLoaded=(e,t,i)=>{t.disabled=!e;t.hidden=!e;e?pdf_sidebar_assertClassBrand(m_,this,_showUINotification).call(this):this.active===i&&this.switchView(Rl)};e._on("outlineloaded",(e=>{onTreeLoaded(e.outlineCount,this.outlineButton,Nl);e.enableCurrentOutlineItemButton&&e.currentOutlineItemPromise&&e.currentOutlineItemPromise.then((e=>{this.isInitialViewSet&&(this._currentOutlineItemButton.disabled=!e)}))}));e._on("attachmentsloaded",(e=>{onTreeLoaded(e.attachmentsCount,this.attachmentsButton,Ol)}));e._on("layersloaded",(e=>{onTreeLoaded(e.layersCount,this.layersButton,Wl)}));e._on("presentationmodechanged",(e=>{e.state===Bl&&this.visibleView===Rl&&this.onUpdateThumbnails()}));this.resizer.addEventListener("mousedown",(e=>{if(0!==e.button)return;t.classList.add(u_);pdf_sidebar_classPrivateFieldSet(g_,this,new AbortController);const i={signal:pdf_sidebar_classPrivateFieldGet(g_,this).signal};window.addEventListener("mousemove",pdf_sidebar_assertClassBrand(m_,this,_mouseMove).bind(this),i);window.addEventListener("mouseup",pdf_sidebar_assertClassBrand(m_,this,_mouseUp).bind(this),i);window.addEventListener("blur",pdf_sidebar_assertClassBrand(m_,this,_mouseUp).bind(this),i)}));e._on("resize",(i=>{if(i.source!==window)return;pdf_sidebar_classPrivateFieldSet(f_,this,null);if(!pdf_sidebar_classPrivateFieldGet(v_,this))return;if(!this.isOpen){pdf_sidebar_assertClassBrand(m_,this,_updateWidth).call(this,pdf_sidebar_classPrivateFieldGet(v_,this));return}t.classList.add(u_);const a=pdf_sidebar_assertClassBrand(m_,this,_updateWidth).call(this,pdf_sidebar_classPrivateFieldGet(v_,this));Promise.resolve().then((()=>{t.classList.remove(u_);a&&e.dispatch("resize",{source:this})}))}))}function _updateWidth(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=Math.floor(this.outerContainerWidth/2);e>t&&(e=t);e<200&&(e=200);if(e===pdf_sidebar_classPrivateFieldGet(v_,this))return!1;pdf_sidebar_classPrivateFieldSet(v_,this,e);Yl.setProperty("--sidebar-width",`${e}px`);return!0}function _mouseMove(e){let t=e.clientX;pdf_sidebar_classPrivateFieldGet(p_,this)&&(t=this.outerContainerWidth-t);pdf_sidebar_assertClassBrand(m_,this,_updateWidth).call(this,t)}function _mouseUp(e){this.outerContainer.classList.remove(u_);this.eventBus.dispatch("resize",{source:this});pdf_sidebar_classPrivateFieldGet(g_,this)?.abort();pdf_sidebar_classPrivateFieldSet(g_,this,null)}function pdf_thumbnail_view_classPrivateMethodInitSpec(e,t){(function pdf_thumbnail_view_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function pdf_thumbnail_view_classPrivateGetter(e,t,i){return i(pdf_thumbnail_view_assertClassBrand(e,t))}function pdf_thumbnail_view_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}let w_=0;function zeroCanvas(e){e.width=0;e.height=0}class TempImageFactory{static getCanvas(e,t){const i=pdf_thumbnail_view_assertClassBrand(TempImageFactory,this,P_)._||(P_._=pdf_thumbnail_view_assertClassBrand(TempImageFactory,this,document.createElement("canvas")));i.width=e;i.height=t;const a=i.getContext("2d",{alpha:!1});a.save();a.fillStyle="rgb(255, 255, 255)";a.fillRect(0,0,e,t);a.restore();return[i,i.getContext("2d")]}static destroyCanvas(){pdf_thumbnail_view_assertClassBrand(TempImageFactory,this,P_)._&&zeroCanvas(pdf_thumbnail_view_assertClassBrand(TempImageFactory,this,P_)._);P_._=pdf_thumbnail_view_assertClassBrand(TempImageFactory,this,null)}}var P_={_:null},y_=new WeakSet;class PDFThumbnailView{constructor(e){let{container:t,eventBus:i,id:a,defaultViewport:s,optionalContentConfigPromise:n,linkService:r,renderingQueue:o,maxCanvasPixels:l,maxCanvasDim:d,pageColors:c}=e;pdf_thumbnail_view_classPrivateMethodInitSpec(this,y_);this.id=a;this.renderingId="thumbnail"+a;this.pageLabel=null;this.pdfPage=null;this.rotation=0;this.viewport=s;this.pdfPageRotate=s.rotation;this._optionalContentConfigPromise=n||null;this.maxCanvasPixels=l??AppOptions.get("maxCanvasPixels");this.maxCanvasDim=d||AppOptions.get("maxCanvasDim");this.pageColors=c||null;this.eventBus=i;this.linkService=r;this.renderingQueue=o;this.eventBus=i;this.renderTask=null;this.renderingState=Il.INITIAL;this.resume=null;i.dispatch("rendercustomthumbnail",{pdfThumbnailView:this,linkService:r,id:a,container:t,thumbPageTitlePromiseOrPageL10nArgs:pdf_thumbnail_view_classPrivateGetter(y_,this,_get_pageL10nArgs)});t.querySelector(`.${this.renderingId}`)?this._placeholderImg=t.querySelector(`.${this.renderingId} .thumbnailImage`):this.createThumbnail(this,r,a,t,pdf_thumbnail_view_classPrivateGetter(y_,this,_get_pageL10nArgs));if(AppOptions.get("enablePageReordering")){this.div.addEventListener("dragstart",this._dragStartHandler.bind(this));this.div.addEventListener("dragover",this._dragOverHandler.bind(this));this.div.addEventListener("drop",this._dropHandler.bind(this));this.div.addEventListener("mousedown",this._mouseDownHandler.bind(this))}}_dragStartHandler(e){e.dataTransfer.setData("text/plain",this.id.toString())}_dragOverHandler(e){e.preventDefault();e.dataTransfer.dropEffect="move";const t=e.currentTarget,i=t.getBoundingClientRect();this._removeDottedLine();i.top<w_&&i.bottom>w_||this._showDottedLine(t,i.height,w_>e.clientY)}_dropHandler(e){e.preventDefault();e.stopPropagation();const t=parseInt(e.dataTransfer.getData("text/plain"),10),i=this.id;this._removeDottedLine();t!==i&&this._movePage(t,i)}_mouseDownHandler(e){w_=e.clientY}_showDottedLine(e,t,i){const a=document.createElement("div");a.className="dotted-line";i?a.style.setProperty("--dotted-line-margin-x",-t+"px"):a.style.setProperty("--dotted-line-margin-x","6px");e.appendChild(a)}_removeDottedLine(){const e=document.querySelector(".dotted-line");e&&e.parentNode.removeChild(e)}_movePage(e,t){const i=this.div.parentNode.parentNode,a=i.children[e-1],s=i.children[t-1];a&&s&&Mf.movePage(e,t)}createThumbnail(e,t,i,a,s){const n=document.createElement("a");n.href=t.getAnchorUrl("#page="+i);n.setAttribute("data-l10n-id","pdfjs-thumb-page-title");n.setAttribute("data-l10n-args",pdf_thumbnail_view_classPrivateGetter(y_,this,_get_pageL10nArgs));n.className=this.renderingId;n.onclick=function(){t.goToPage(i);return!1};this.anchor=n;const r=document.createElement("div");r.className="thumbnail";r.setAttribute("data-page-number",this.id);AppOptions.get("enablePageReordering")&&(r.draggable=!0);this.div=r;pdf_thumbnail_view_assertClassBrand(y_,this,_updateDims).call(this);const o=document.createElement("div");o.className="thumbnailImage";this._placeholderImg=o;r.append(o);n.append(r);a.append(n)}setPdfPage(e){this.pdfPage=e;this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:1,rotation:t});this.reset()}reset(){this.cancelRendering();this.renderingState=Il.INITIAL;this.div.removeAttribute("data-loaded");this.image?.replaceWith(this._placeholderImg);pdf_thumbnail_view_assertClassBrand(y_,this,_updateDims).call(this);if(this.image){this.image.removeAttribute("src");delete this.image}}update(e){let{rotation:t=null}=e;"number"==typeof t&&(this.rotation=t);const i=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:1,rotation:i});this.reset()}cancelRendering(){if(this.renderTask){this.renderTask.cancel();this.renderTask=null}this.resume=null}async draw(){if(this.renderingState!==Il.INITIAL){NgxConsole.error("Must be in new state before drawing");return}const{pageColors:e,pdfPage:t}=this;if(!t){this.renderingState=Il.FINISHED;throw new Error("pdfPage is not loaded")}this.renderingState=Il.RUNNING;const{canvas:i,transform:a}=pdf_thumbnail_view_assertClassBrand(y_,this,_getPageDrawContext).call(this,2),s={canvas:i,transform:a,viewport:this.viewport.clone({scale:2*this.scale}),optionalContentConfigPromise:this._optionalContentConfigPromise,pageColors:e},n=this.renderTask=t.render(s);n.onContinue=e=>{if(this.renderingQueue.isHighestPriority(this))e();else{this.renderingState=Il.PAUSED;this.resume=()=>{this.renderingState=Il.RUNNING;e()}}};let r=null;try{await n.promise}catch(e){if(e instanceof RenderingCancelledException){zeroCanvas(i);return}r=e}finally{n===this.renderTask&&(this.renderTask=null)}this.renderingState=Il.FINISHED;pdf_thumbnail_view_assertClassBrand(y_,this,_convertCanvasToImage).call(this,i);zeroCanvas(i);this.eventBus.dispatch("thumbnailrendered",{source:this,pageNumber:this.id,pdfPage:t});if(r)throw r}setImage(e){if(this.renderingState!==Il.INITIAL)return;const{thumbnailCanvas:t,pdfPage:i,scale:a}=e;if(t){this.pdfPage||this.setPdfPage(i);if(!(a<this.scale)){this.renderingState=Il.FINISHED;pdf_thumbnail_view_assertClassBrand(y_,this,_convertCanvasToImage).call(this,t)}}}setPageLabel(e){this.pageLabel="string"==typeof e?e:null;this.anchor.setAttribute("data-l10n-args",pdf_thumbnail_view_classPrivateGetter(y_,this,_get_pageL10nArgs));this.renderingState===Il.FINISHED&&this.image?.setAttribute("data-l10n-args",pdf_thumbnail_view_classPrivateGetter(y_,this,_get_pageL10nArgs))}}function _updateDims(){const{width:e,height:t}=this.viewport,i=e/t;this.canvasWidth=98;this.canvasHeight=this.canvasWidth/i|0;this.scale=this.canvasWidth/e;const{style:a}=this.div;a.setProperty("--thumbnail-width",`${this.canvasWidth}px`);a.setProperty("--thumbnail-height",`${this.canvasHeight}px`)}function _getPageDrawContext(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const t=document.createElement("canvas"),i=new OutputScale,a=e*this.canvasWidth,s=e*this.canvasHeight;i.limitCanvas(a,s,this.maxCanvasPixels,this.maxCanvasDim);t.width=a*i.sx|0;t.height=s*i.sy|0;return{canvas:t,transform:i.scaled?[i.sx,0,0,i.sy,0,0]:null}}function _convertCanvasToImage(e){if(this.renderingState!==Il.FINISHED)throw new Error("#convertCanvasToImage: Rendering has not finished.");const t=pdf_thumbnail_view_assertClassBrand(y_,this,_reduceImage).call(this,e),i=document.createElement("img");i.className="thumbnailImage";i.setAttribute("data-l10n-id","pdfjs-thumb-page-canvas");i.setAttribute("data-l10n-args",pdf_thumbnail_view_classPrivateGetter(y_,this,_get_pageL10nArgs));i.src=t.toDataURL();this.image=i;this.div.setAttribute("data-loaded",!0);this._placeholderImg.replaceWith(i);zeroCanvas(t);this.eventBus.dispatch("thumbnailRendered",this.id)}function _getReducedImageDims(e){const t=e.width<<3,i=e.height<<3,a=new OutputScale;a.sx=a.sy=1;a.limitCanvas(t,i,this.maxCanvasPixels,this.maxCanvasDim);return[t*a.sx|0,i*a.sy|0]}function _reduceImage(e){const{canvas:t}=pdf_thumbnail_view_assertClassBrand(y_,this,_getPageDrawContext).call(this,1),i=t.getContext("2d",{alpha:!1,willReadFrequently:!1});if(e.width<=2*t.width){i.drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height);return t}let[a,s]=pdf_thumbnail_view_assertClassBrand(y_,this,_getReducedImageDims).call(this,t);const[n,r]=TempImageFactory.getCanvas(a,s);for(;a>e.width||s>e.height;){a>>=1;s>>=1}r.drawImage(e,0,0,e.width,e.height,0,0,a,s);for(;a>2*t.width;){r.drawImage(n,0,0,a,s,0,0,a>>1,s>>1);a>>=1;s>>=1}i.drawImage(n,0,0,a,s,0,0,t.width,t.height);return t}function _get_pageL10nArgs(e){return JSON.stringify({page:e.pageLabel??e.id})}function pdf_thumbnail_viewer_classPrivateMethodInitSpec(e,t){(function pdf_thumbnail_viewer_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function pdf_thumbnail_viewer_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const F_="selected";var b_=new WeakSet;class PDFThumbnailViewer{constructor(e){let{container:t,eventBus:i,linkService:a,renderingQueue:s,maxCanvasPixels:n,maxCanvasDim:r,pageColors:o,abortSignal:l,enableHWA:d}=e;pdf_thumbnail_viewer_classPrivateMethodInitSpec(this,b_);this.container=t;this.eventBus=i;this.linkService=a;this.renderingQueue=s;this.maxCanvasPixels=n;this.maxCanvasDim=r;this.pageColors=o||null;this.enableHWA=d||!1;this.scroll=watchScroll(this.container,pdf_thumbnail_viewer_assertClassBrand(b_,this,_scrollUpdated).bind(this),l);pdf_thumbnail_viewer_assertClassBrand(b_,this,_resetView).call(this)}getThumbnail(e){return this._thumbnails[e]}scrollThumbnailIntoView(e){if(!this.pdfDocument)return;const t=this._thumbnails[e-1];if(!t){NgxConsole.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');return}if(e!==this._currentPageNumber){this._thumbnails[this._currentPageNumber-1].div.classList.remove(F_);t.div.classList.add(F_)}const{first:i,last:a,views:s}=pdf_thumbnail_viewer_assertClassBrand(b_,this,_getVisibleThumbs).call(this);if(s.length>0){let n=!1;if(e<=i.id||e>=a.id)n=!0;else for(const{id:t,percent:i}of s)if(t===e){n=i<100;break}n&&scrollIntoView(t.div,{top:-19})}this._currentPageNumber=e}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!isValidRotation(e))throw new Error("Invalid thumbnails rotation angle.");if(!this.pdfDocument)return;if(this._pagesRotation===e)return;this._pagesRotation=e;const t={rotation:e};for(const e of this._thumbnails)e.update(t)}swapThumbnails(e,t){let i=this._thumbnails[e].pdfPage;this._thumbnails[e].setPdfPage(this._thumbnails[t].pdfPage);this._thumbnails[t].setPdfPage(i)}cleanup(){for(const e of this._thumbnails)e.renderingState!==Il.FINISHED&&e.reset();TempImageFactory.destroyCanvas()}setDocument(e){this.initialized=!1;if(this.pdfDocument){pdf_thumbnail_viewer_assertClassBrand(b_,this,_cancelRendering).call(this);pdf_thumbnail_viewer_assertClassBrand(b_,this,_resetView).call(this)}this.pdfDocument=e;if(!e)return;if(this.initialized)return;this.initialized=!0;const t=e.getPage(1),i=e.getOptionalContentConfig({intent:"display"});t.then((t=>{const a=e.numPages,s=t.getViewport({scale:1});for(let e=1;e<=a;++e){const t=new PDFThumbnailView({container:this.container,id:e,defaultViewport:s.clone(),optionalContentConfigPromise:i,linkService:this.linkService,renderingQueue:this.renderingQueue,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,pageColors:this.pageColors,eventBus:this.eventBus,enableHWA:this.enableHWA});this._thumbnails.push(t)}this._thumbnails[0]?.setPdfPage(t);this._thumbnails[this._currentPageNumber-1].div.classList.add(F_)})).catch((e=>{NgxConsole.error("Unable to initialize thumbnail viewer",e)}))}setPageLabels(e){if(this.pdfDocument){if(e)if(Array.isArray(e)&&this.pdfDocument.numPages===e.length)this._pageLabels=e;else{this._pageLabels=null;NgxConsole.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.")}else this._pageLabels=null;for(let e=0,t=this._thumbnails.length;e<t;e++)this._thumbnails[e].setPageLabel(this._pageLabels?.[e]??null)}}forceRendering(){const e=pdf_thumbnail_viewer_assertClassBrand(b_,this,_getVisibleThumbs).call(this),t=pdf_thumbnail_viewer_assertClassBrand(b_,this,_getScrollAhead).call(this,e),i=this.renderingQueue.getHighestPriority(e,this._thumbnails,t,!1,!0);if(i){pdf_thumbnail_viewer_assertClassBrand(b_,this,_ensurePdfPageLoaded).call(this,i).then((()=>{this.renderingQueue.renderView(i)}));return!0}return!1}stopRendering(){pdf_thumbnail_viewer_assertClassBrand(b_,this,_cancelRendering).call(this)}}function _scrollUpdated(){this.renderingQueue.renderHighestPriority()}function _getVisibleThumbs(){return getVisibleElements({scrollEl:this.container,views:this._thumbnails})}function _resetView(){this._thumbnails=[];this._currentPageNumber=1;this._pageLabels=null;this._pagesRotation=0;this.container.textContent=""}function _cancelRendering(){for(const e of this._thumbnails)e.cancelRendering()}async function _ensurePdfPageLoaded(e){if(e.pdfPage)return e.pdfPage;try{const t=await this.pdfDocument.getPage(e.id);e.pdfPage||e.setPdfPage(t);return t}catch(e){NgxConsole.error("Unable to get page for thumb view",e);return null}}function _getScrollAhead(e){return 1===e.first?.id||e.last?.id!==this._thumbnails.length&&this.scroll.down}__webpack_require__(116);class Page{constructor(e,t){this.state={angle:0,area:[],position:{x:0,y:0},hardAngle:0,hardDrawingAngle:0};this.createdDensity=t;this.nowDrawingDensity=this.createdDensity;this.render=e}setDensity(e){this.createdDensity=e;this.nowDrawingDensity=e}setDrawingDensity(e){this.nowDrawingDensity=e}setPosition(e){this.state.position=e}setAngle(e){this.state.angle=e}setArea(e){this.state.area=e}setHardDrawingAngle(e){this.state.hardDrawingAngle=e}setHardAngle(e){this.state.hardAngle=e;this.state.hardDrawingAngle=e}setOrientation(e){this.orientation=e}getDrawingDensity(){return this.nowDrawingDensity}getDensity(){return this.createdDensity}getHardAngle(){return this.state.hardAngle}}class PageCollection{constructor(e,t){this.pages=[];this.currentPageIndex=0;this.currentSpreadIndex=0;this.landscapeSpread=[];this.portraitSpread=[];this.render=t;this.app=e;this.currentPageIndex=0;this.isShowCover=this.app.getSettings().showCover}destroy(){this.pages=[]}createSpread(){this.landscapeSpread=[];this.portraitSpread=[];for(let e=0;e<this.pages.length;e++)this.portraitSpread.push([e]);let e=0;if(this.isShowCover){this.pages[0].setDensity("hard");this.landscapeSpread.push([e]);e++}for(let t=e;t<this.pages.length;t+=2)if(t<this.pages.length-1)this.landscapeSpread.push([t,t+1]);else{this.landscapeSpread.push([t]);this.pages[t].setDensity("hard")}}getSpread(){return"landscape"===this.render.getOrientation()?this.landscapeSpread:this.portraitSpread}getSpreadIndexByPage(e){const t=this.getSpread();for(let i=0;i<t.length;i++)if(e===t[i][0]||e===t[i][1])return i;return null}getPageCount(){return this.pages.length}getPages(){return this.pages}getPage(e){if(e>=0&&e<this.pages.length)return this.pages[e];throw new Error("Invalid page number")}nextBy(e){const t=this.pages.indexOf(e);return t<this.pages.length-1?this.pages[t+1]:null}prevBy(e){const t=this.pages.indexOf(e);return t>0?this.pages[t-1]:null}getFlippingPage(e){const t=this.currentSpreadIndex;if("portrait"===this.render.getOrientation())return 0===e?this.pages[t].newTemporaryCopy():this.pages[t-1];{const i=0===e?this.getSpread()[t+1]:this.getSpread()[t-1];return 1===i.length||0===e?this.pages[i[0]]:this.pages[i[1]]}}getBottomPage(e){const t=this.currentSpreadIndex;if("portrait"===this.render.getOrientation())return 0===e?this.pages[t+1]:this.pages[t-1];{const i=0===e?this.getSpread()[t+1]:this.getSpread()[t-1];return 1===i.length?this.pages[i[0]]:0===e?this.pages[i[1]]:this.pages[i[0]]}}showNext(){if(this.currentSpreadIndex<this.getSpread().length){this.currentSpreadIndex++;this.showSpread()}}showPrev(){if(this.currentSpreadIndex>0){this.currentSpreadIndex--;this.showSpread()}}getCurrentPageIndex(){return this.currentPageIndex}show(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;null===e&&(e=this.currentPageIndex);if(e<0||e>=this.pages.length)return;const t=this.getSpreadIndexByPage(e);if(null!==t){this.currentSpreadIndex=t;this.showSpread()}}getCurrentSpreadIndex(){return this.currentSpreadIndex}setCurrentSpreadIndex(e){if(!(e>=0&&e<this.getSpread().length))throw new Error("Invalid page");this.currentSpreadIndex=e}showSpread(){const e=this.getSpread()[this.currentSpreadIndex];if(2===e.length){this.render.setLeftPage(this.pages[e[0]]);this.render.setRightPage(this.pages[e[1]])}else if("landscape"===this.render.getOrientation())if(e[0]===this.pages.length-1){this.render.setLeftPage(this.pages[e[0]]);this.render.setRightPage(null)}else{this.render.setLeftPage(null);this.render.setRightPage(this.pages[e[0]])}else{this.render.setLeftPage(null);this.render.setRightPage(this.pages[e[0]])}this.currentPageIndex=e[0];this.app.updatePageIndex(this.currentPageIndex)}}class Helper{static GetDistanceBetweenTwoPoint(e,t){return null===e||null===t?1/0:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}static GetSegmentLength(e){return Helper.GetDistanceBetweenTwoPoint(e[0],e[1])}static GetAngleBetweenTwoLine(e,t){const i=e[0].y-e[1].y,a=t[0].y-t[1].y,s=e[1].x-e[0].x,n=t[1].x-t[0].x;return Math.acos((i*a+s*n)/(Math.sqrt(i*i+s*s)*Math.sqrt(a*a+n*n)))}static PointInRect(e,t){return null===t?null:t.x>=e.left&&t.x<=e.width+e.left&&t.y>=e.top&&t.y<=e.top+e.height?t:null}static GetRotatedPoint(e,t,i){return{x:e.x*Math.cos(i)+e.y*Math.sin(i)+t.x,y:e.y*Math.cos(i)-e.x*Math.sin(i)+t.y}}static LimitPointToCircle(e,t,i){if(Helper.GetDistanceBetweenTwoPoint(e,i)<=t)return i;const a=e.x,s=e.y,n=i.x,r=i.y;let o=Math.sqrt(Math.pow(t,2)*Math.pow(a-n,2)/(Math.pow(a-n,2)+Math.pow(s-r,2)))+a;i.x<0&&(o*=-1);let l=(o-a)*(s-r)/(a-n)+s;a-n+s===0&&(l=t);return{x:o,y:l}}static GetIntersectBetweenTwoSegment(e,t,i){return Helper.PointInRect(e,Helper.GetIntersectBeetwenTwoLine(t,i))}static GetIntersectBeetwenTwoLine(e,t){const i=e[0].y-e[1].y,a=t[0].y-t[1].y,s=e[1].x-e[0].x,n=t[1].x-t[0].x,r=e[0].x*e[1].y-e[1].x*e[0].y,o=t[0].x*t[1].y-t[1].x*t[0].y,l=i*o-a*r,d=s*o-n*r,c=-(r*n-o*s)/(i*n-a*s),h=-(i*o-a*r)/(i*n-a*s);if(isFinite(c)&&isFinite(h))return{x:c,y:h};if(Math.abs(l-d)<.1)throw new Error("Segment included");return null}static GetCordsFromTwoPoint(e,t){const i=Math.abs(e.x-t.x),a=Math.abs(e.y-t.y),s=Math.max(i,a),n=[e];function getCord(e,t,i,a,s){return t>e?e+s*(i/a):t<e?e-s*(i/a):e}for(let r=1;r<=s;r+=1)n.push({x:getCord(e.x,t.x,i,s,r),y:getCord(e.y,t.y,a,s,r)});return n}}class HTMLPage extends Page{constructor(e,t,i){super(e,i);this.copiedElement=null;this.temporaryCopy=null;this.isLoad=!1;this.element=t;this.element.classList.add("stf__item");this.element.classList.add("--"+i)}newTemporaryCopy(){if("hard"===this.nowDrawingDensity)return this;if(null===this.temporaryCopy){this.copiedElement=this.element.cloneNode(!0);this.element.parentElement.appendChild(this.copiedElement);this.temporaryCopy=new HTMLPage(this.render,this.copiedElement,this.nowDrawingDensity)}return this.getTemporaryCopy()}getTemporaryCopy(){return this.temporaryCopy}hideTemporaryCopy(){if(null!==this.temporaryCopy){this.copiedElement.remove();this.copiedElement=null;this.temporaryCopy=null}}draw(e){const t=e||this.nowDrawingDensity,i=this.render.convertToGlobal(this.state.position),a=this.render.getRect().pageWidth,s=this.render.getRect().height;this.element.classList.remove("--simple");const n=`\n            position: absolute;\n            display: block;\n            z-index: ${this.element.style.zIndex};\n            left: 0;\n            top: 0;\n            width: ${a}px;\n            height: ${s}px;\n        `;"hard"===t?this.drawHard(n):this.drawSoft(i,n)}drawHard(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const t=this.render.getRect().left+this.render.getRect().width/2,i=this.state.hardDrawingAngle,a=e+"\n                backface-visibility: hidden;\n                -webkit-backface-visibility: hidden;\n                clip-path: none;\n                -webkit-clip-path: none;\n            "+(0===this.orientation?`transform-origin: ${this.render.getRect().pageWidth}px 0;\n                   transform: translate3d(0, 0, 0) rotateY(${i}deg);`:`transform-origin: 0 0;\n                   transform: translate3d(${t}px, 0, 0) rotateY(${i}deg);`);this.element.style.cssText=a}drawSoft(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i="polygon( ";for(const e of this.state.area)if(null!==e){let t=1===this.render.getDirection()?{x:-e.x+this.state.position.x,y:e.y-this.state.position.y}:{x:e.x-this.state.position.x,y:e.y-this.state.position.y};t=Helper.GetRotatedPoint(t,{x:0,y:0},this.state.angle);i+=t.x+"px "+t.y+"px, "}i=i.slice(0,-2);i+=")";const a=t+`transform-origin: 0 0; clip-path: ${i}; -webkit-clip-path: ${i};`+(this.render.isSafari()&&0===this.state.angle?`transform: translate(${e.x}px, ${e.y}px);`:`transform: translate3d(${e.x}px, ${e.y}px, 0) rotate(${this.state.angle}rad);`);this.element.style.cssText=a}simpleDraw(e){const t=this.render.getRect(),i=t.pageWidth,a=t.height,s=1===e?t.left+t.pageWidth:t.left,n=t.top;this.element.classList.add("--simple");this.element.style.cssText=`\n            position: absolute;\n            display: block;\n            height: ${a}px;\n            left: ${s}px;\n            top: ${n}px;\n            width: ${i}px;\n            z-index: ${this.render.getSettings().startZIndex+1};`}getElement(){return this.element}load(){this.isLoad=!0}setOrientation(e){super.setOrientation(e);this.element.classList.remove("--left","--right");this.element.classList.add(1===e?"--right":"--left")}setDrawingDensity(e){this.element.classList.remove("--soft","--hard");this.element.classList.add("--"+e);super.setDrawingDensity(e)}}class HTMLPageCollection extends PageCollection{constructor(e,t,i,a){super(e,t);this.element=i;this.pagesElement=a}load(){for(const e of this.pagesElement){const t=new HTMLPage(this.render,e,"hard"===e.dataset.density?"hard":"soft");t.load();this.pages.push(t)}this.createSpread()}}class FlipCalculation{constructor(e,t,i,a){this.direction=e;this.corner=t;this.topIntersectPoint=null;this.sideIntersectPoint=null;this.bottomIntersectPoint=null;this.pageWidth=parseInt(i,10);this.pageHeight=parseInt(a,10)}calc(e){try{this.position=this.calcAngleAndPosition(e);this.calculateIntersectPoint(this.position);return!0}catch(e){return!1}}getFlippingClipArea(){const e=[];let t=!1;e.push(this.rect.topLeft);e.push(this.topIntersectPoint);if(null===this.sideIntersectPoint)t=!0;else{e.push(this.sideIntersectPoint);null===this.bottomIntersectPoint&&(t=!1)}e.push(this.bottomIntersectPoint);(t||"bottom"===this.corner)&&e.push(this.rect.bottomLeft);return e}getBottomClipArea(){const e=[];e.push(this.topIntersectPoint);if("top"===this.corner)e.push({x:this.pageWidth,y:0});else{null!==this.topIntersectPoint&&e.push({x:this.pageWidth,y:0});e.push({x:this.pageWidth,y:this.pageHeight})}null!==this.sideIntersectPoint?Helper.GetDistanceBetweenTwoPoint(this.sideIntersectPoint,this.topIntersectPoint)>=10&&e.push(this.sideIntersectPoint):"top"===this.corner&&e.push({x:this.pageWidth,y:this.pageHeight});e.push(this.bottomIntersectPoint);e.push(this.topIntersectPoint);return e}getAngle(){return 0===this.direction?-this.angle:this.angle}getRect(){return this.rect}getPosition(){return this.position}getActiveCorner(){return 0===this.direction?this.rect.topLeft:this.rect.topRight}getDirection(){return this.direction}getFlippingProgress(){return Math.abs((this.position.x-this.pageWidth)/(2*this.pageWidth)*100)}getCorner(){return this.corner}getBottomPagePosition(){return 1===this.direction?{x:this.pageWidth,y:0}:{x:0,y:0}}getShadowStartPoint(){return"top"===this.corner?this.topIntersectPoint:null!==this.sideIntersectPoint?this.sideIntersectPoint:this.topIntersectPoint}getShadowAngle(){const e=Helper.GetAngleBetweenTwoLine(this.getSegmentToShadowLine(),[{x:0,y:0},{x:this.pageWidth,y:0}]);return 0===this.direction?e:Math.PI-e}calcAngleAndPosition(e){let t=e;this.updateAngleAndGeometry(t);t="top"===this.corner?this.checkPositionAtCenterLine(t,{x:0,y:0},{x:0,y:this.pageHeight}):this.checkPositionAtCenterLine(t,{x:0,y:this.pageHeight},{x:0,y:0});if(Math.abs(t.x-this.pageWidth)<1&&Math.abs(t.y)<1)throw new Error("Point is too small");return t}updateAngleAndGeometry(e){this.angle=this.calculateAngle(e);this.rect=this.getPageRect(e)}calculateAngle(e){const t=this.pageWidth-e.x+1,i="bottom"===this.corner?this.pageHeight-e.y:e.y;let a=2*Math.acos(t/Math.sqrt(i*i+t*t));i<0&&(a=-a);const s=Math.PI-a;if(!isFinite(a)||s>=0&&s<.003)throw new Error("The G point is too small");"bottom"===this.corner&&(a=-a);return a}getPageRect(e){return"top"===this.corner?this.getRectFromBasePoint([{x:0,y:0},{x:this.pageWidth,y:0},{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}],e):this.getRectFromBasePoint([{x:0,y:-this.pageHeight},{x:this.pageWidth,y:-this.pageHeight},{x:0,y:0},{x:this.pageWidth,y:0}],e)}getRectFromBasePoint(e,t){return{topLeft:this.getRotatedPoint(e[0],t),topRight:this.getRotatedPoint(e[1],t),bottomLeft:this.getRotatedPoint(e[2],t),bottomRight:this.getRotatedPoint(e[3],t)}}getRotatedPoint(e,t){return{x:e.x*Math.cos(this.angle)+e.y*Math.sin(this.angle)+t.x,y:e.y*Math.cos(this.angle)-e.x*Math.sin(this.angle)+t.y}}calculateIntersectPoint(e){const t={left:-1,top:-1,width:this.pageWidth+2,height:this.pageHeight+2};if("top"===this.corner){this.topIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[e,this.rect.topRight],[{x:0,y:0},{x:this.pageWidth,y:0}]);this.sideIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[e,this.rect.bottomLeft],[{x:this.pageWidth,y:0},{x:this.pageWidth,y:this.pageHeight}]);this.bottomIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[this.rect.bottomLeft,this.rect.bottomRight],[{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}])}else{this.topIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[this.rect.topLeft,this.rect.topRight],[{x:0,y:0},{x:this.pageWidth,y:0}]);this.sideIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[e,this.rect.topLeft],[{x:this.pageWidth,y:0},{x:this.pageWidth,y:this.pageHeight}]);this.bottomIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[this.rect.bottomLeft,this.rect.bottomRight],[{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}])}}checkPositionAtCenterLine(e,t,i){let a=e;const s=Helper.LimitPointToCircle(t,this.pageWidth,a);if(a!==s){a=s;this.updateAngleAndGeometry(a)}const n=Math.sqrt(Math.pow(this.pageWidth,2)+Math.pow(this.pageHeight,2));let r=this.rect.bottomRight,o=this.rect.topLeft;if("bottom"===this.corner){r=this.rect.topRight;o=this.rect.bottomLeft}if(r.x<=0){const e=Helper.LimitPointToCircle(i,n,o);if(e!==a){a=e;this.updateAngleAndGeometry(a)}}return a}getSegmentToShadowLine(){const e=this.getShadowStartPoint();return[e,e!==this.sideIntersectPoint&&null!==this.sideIntersectPoint?this.sideIntersectPoint:this.bottomIntersectPoint]}}class Flip{constructor(e,t){this.flippingPage=null;this.bottomPage=null;this.calc=null;this.state="read";this.render=e;this.app=t}fold(e){this.setState("user_fold");null===this.calc&&this.start(e);this.do(this.render.convertToPage(e))}flip(e){if(this.app.getSettings().disableFlipByClick&&!this.isPointOnCorners(e))return;null!==this.calc&&this.render.finishAnimation();if(!this.start(e))return;const t=this.getBoundsRect();this.setState("flipping");const i=t.height/10,a="bottom"===this.calc.getCorner()?t.height-i:i,s="bottom"===this.calc.getCorner()?t.height:0;this.calc.calc({x:t.pageWidth-i,y:a});this.animateFlippingTo({x:t.pageWidth-i,y:a},{x:-t.pageWidth,y:s},!0)}start(e){this.reset();const t=this.render.convertToBook(e),i=this.getBoundsRect(),a=this.getDirectionByPoint(t),s=t.y>=i.height/2?"bottom":"top";if(!this.checkDirection(a))return!1;try{this.flippingPage=this.app.getPageCollection().getFlippingPage(a);this.bottomPage=this.app.getPageCollection().getBottomPage(a);if("landscape"===this.render.getOrientation())if(1===a){const e=this.app.getPageCollection().nextBy(this.flippingPage);if(null!==e&&this.flippingPage.getDensity()!==e.getDensity()){this.flippingPage.setDrawingDensity("hard");e.setDrawingDensity("hard")}}else{const e=this.app.getPageCollection().prevBy(this.flippingPage);if(null!==e&&this.flippingPage.getDensity()!==e.getDensity()){this.flippingPage.setDrawingDensity("hard");e.setDrawingDensity("hard")}}this.render.setDirection(a);this.calc=new FlipCalculation(a,s,i.pageWidth.toString(10),i.height.toString(10));return!0}catch(e){return!1}}do(e){if(null!==this.calc&&this.calc.calc(e)){const e=this.calc.getFlippingProgress();this.bottomPage.setArea(this.calc.getBottomClipArea());this.bottomPage.setPosition(this.calc.getBottomPagePosition());this.bottomPage.setAngle(0);this.bottomPage.setHardAngle(0);this.flippingPage.setArea(this.calc.getFlippingClipArea());this.flippingPage.setPosition(this.calc.getActiveCorner());this.flippingPage.setAngle(this.calc.getAngle());0===this.calc.getDirection()?this.flippingPage.setHardAngle(90*(200-2*e)/100):this.flippingPage.setHardAngle(-90*(200-2*e)/100);this.render.setPageRect(this.calc.getRect());this.render.setBottomPage(this.bottomPage);this.render.setFlippingPage(this.flippingPage);this.render.setShadowData(this.calc.getShadowStartPoint(),this.calc.getShadowAngle(),e,this.calc.getDirection())}}flipToPage(e,t){const i=this.app.getPageCollection().getCurrentSpreadIndex(),a=this.app.getPageCollection().getSpreadIndexByPage(e);try{if(a>i){this.app.getPageCollection().setCurrentSpreadIndex(a-1);this.flipNext(t)}if(a<i){this.app.getPageCollection().setCurrentSpreadIndex(a+1);this.flipPrev(t)}}catch(e){}}flipNext(e){this.flip({x:this.render.getRect().left+2*this.render.getRect().pageWidth-10,y:"top"===e?1:this.render.getRect().height-2})}flipPrev(e){this.flip({x:10,y:"top"===e?1:this.render.getRect().height-2})}stopMove(){if(null===this.calc)return;const e=this.calc.getPosition(),t=this.getBoundsRect(),i="bottom"===this.calc.getCorner()?t.height:0;e.x<=0?this.animateFlippingTo(e,{x:-t.pageWidth,y:i},!0):this.animateFlippingTo(e,{x:t.pageWidth,y:i},!1)}showCorner(e){if(!this.checkState("read","fold_corner"))return;const t=this.getBoundsRect(),i=t.pageWidth;if(this.isPointOnCorners(e))if(null===this.calc){if(!this.start(e))return;this.setState("fold_corner");this.calc.calc({x:i-1,y:1});const a=50,s="bottom"===this.calc.getCorner()?t.height-1:1,n="bottom"===this.calc.getCorner()?t.height-a:a;this.animateFlippingTo({x:i-1,y:s},{x:i-a,y:n},!1,!1)}else this.do(this.render.convertToPage(e));else{this.setState("read");this.render.finishAnimation();this.stopMove()}}animateFlippingTo(e,t,i){let a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s=Helper.GetCordsFromTwoPoint(e,t),n=[];for(const e of s)n.push((()=>this.do(e)));const r=this.getAnimationDuration(s.length);this.render.startAnimation(n,r,(()=>{if(this.calc){i&&(1===this.calc.getDirection()?this.app.turnToPrevPage():this.app.turnToNextPage());if(a){this.render.setBottomPage(null);this.render.setFlippingPage(null);this.render.clearShadow();this.setState("read");this.reset()}}}))}getCalculation(){return this.calc}getState(){return this.state}setState(e){if(this.state!==e){this.app.updateState(e);this.state=e}}getDirectionByPoint(e){const t=this.getBoundsRect();if("portrait"===this.render.getOrientation()){if(e.x-t.pageWidth<=t.width/5)return 1}else if(e.x<t.width/2)return 1;return 0}getAnimationDuration(e){const t=this.app.getSettings().flippingTime;return e>=1e3?t:e/1e3*t}checkDirection(e){return 0===e?this.app.getCurrentPageIndex()<this.app.getPageCount()-1:this.app.getCurrentPageIndex()>=1}reset(){this.calc=null;this.flippingPage=null;this.bottomPage=null}getBoundsRect(){return this.render.getRect()}checkState(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];for(const e of t)if(this.state===e)return!0;return!1}isPointOnCorners(e){const t=this.getBoundsRect(),i=t.pageWidth,a=Math.sqrt(Math.pow(i,2)+Math.pow(t.height,2))/5,s=this.render.convertToBook(e);return s.x>0&&s.y>0&&s.x<t.width&&s.y<t.height&&(s.x<a||s.x>t.width-a)&&(s.y<a||s.y>t.height-a)}}class Render{constructor(e,t){this.leftPage=null;this.rightPage=null;this.flippingPage=null;this.bottomPage=null;this.direction=null;this.orientation=null;this.shadow=null;this.animation=null;this.pageRect=null;this.boundsRect=null;this.timer=0;this.safari=!1;this.setting=t;this.app=e;const i=new RegExp("Version\\/[\\d\\.]+.*Safari/");this.safari=null!==i.exec(window.navigator.userAgent)}render(e){if(null!==this.animation){const t=Math.round((e-this.animation.startedAt)/this.animation.durationFrame);if(t<this.animation.frames.length)this.animation.frames[t]();else{this.animation.onAnimateEnd();this.animation=null}}this.timer=e;this.drawFrame()}start(){this.update();const loop=e=>{this.render(e);requestAnimationFrame(loop)};requestAnimationFrame(loop)}startAnimation(e,t,i){this.finishAnimation();this.animation={frames:e,duration:t,durationFrame:t/e.length,onAnimateEnd:i,startedAt:this.timer}}finishAnimation(){if(null!==this.animation){this.animation.frames[this.animation.frames.length-1]();null!==this.animation.onAnimateEnd&&this.animation.onAnimateEnd()}this.animation=null}update(){this.boundsRect=null;const e=this.calculateBoundsRect();if(this.orientation!==e){this.orientation=e;this.app.updateOrientation(e)}}calculateBoundsRect(){let e="landscape";const t=this.getBlockWidth(),i=t/2,a=this.getBlockHeight()/2,s=this.setting.width/this.setting.height;let n=this.setting.width,r=this.setting.height,o=i-n;if("stretch"===this.setting.size){t<2*this.setting.minWidth&&this.app.getSettings().usePortrait&&(e="portrait");n="portrait"===e?this.getBlockWidth():this.getBlockWidth()/2;n>this.setting.maxWidth&&(n=this.setting.maxWidth);r=n/s;if(r>this.getBlockHeight()){r=this.getBlockHeight();n=r*s}o="portrait"===e?i-n/2-n:i-n}else if(t<2*n&&this.app.getSettings().usePortrait){e="portrait";o=i-n/2-n}this.boundsRect={left:o,top:a-r/2,width:2*n,height:r,pageWidth:n};return e}setShadowData(e,t,i,a){if(!this.app.getSettings().drawShadow)return;const s=100*this.getSettings().maxShadowOpacity;this.shadow={pos:e,angle:t,width:3*this.getRect().pageWidth/4*i/100,opacity:(100-i)*s/100/100,direction:a,progress:2*i}}clearShadow(){this.shadow=null}getBlockWidth(){return this.app.getUI().getDistElement().offsetWidth}getBlockHeight(){return this.app.getUI().getDistElement().offsetHeight}getDirection(){return this.direction}getRect(){null===this.boundsRect&&this.calculateBoundsRect();return this.boundsRect}getSettings(){return this.app.getSettings()}getOrientation(){return this.orientation}setPageRect(e){this.pageRect=e}setDirection(e){this.direction=e}setRightPage(e){null!==e&&e.setOrientation(1);this.rightPage=e}setLeftPage(e){null!==e&&e.setOrientation(0);this.leftPage=e}setBottomPage(e){null!==e&&e.setOrientation(1===this.direction?0:1);this.bottomPage=e}setFlippingPage(e){null!==e&&e.setOrientation(0===this.direction&&"portrait"!==this.orientation?0:1);this.flippingPage=e}convertToBook(e){const t=this.getRect();return{x:e.x-t.left,y:e.y-t.top}}isSafari(){return this.safari}convertToPage(e,t){t||(t=this.direction);const i=this.getRect();return{x:0===t?e.x-i.left-i.width/2:i.width/2-e.x+i.left,y:e.y-i.top}}convertToGlobal(e,t){t||(t=this.direction);if(null==e)return null;const i=this.getRect();return{x:0===t?e.x+i.left+i.width/2:i.width/2-e.x+i.left,y:e.y+i.top}}convertRectToGlobal(e,t){t||(t=this.direction);return{topLeft:this.convertToGlobal(e.topLeft,t),topRight:this.convertToGlobal(e.topRight,t),bottomLeft:this.convertToGlobal(e.bottomLeft,t),bottomRight:this.convertToGlobal(e.bottomRight,t)}}}class UI{constructor(e,t,i){this.cspPolicyService=t.cspPolicyService;this.touchPoint=null;this.swipeTimeout=250;this.onResize=()=>{this.update()};this.onMouseDown=e=>{if(this.checkTarget(e.target)){const t=this.getMousePos(e.clientX,e.clientY);this.app.startUserTouch(t);e.preventDefault()}};this.onTouchStart=e=>{if(this.checkTarget(e.target)&&e.changedTouches.length>0){const t=e.changedTouches[0],i=this.getMousePos(t.clientX,t.clientY);this.touchPoint={point:i,time:Date.now()};setTimeout((()=>{null!==this.touchPoint&&this.app.startUserTouch(i)}),this.swipeTimeout);this.app.getSettings().mobileScrollSupport||e.preventDefault()}};this.onMouseUp=e=>{const t=this.getMousePos(e.clientX,e.clientY);this.app.userStop(t)};this.onMouseMove=e=>{const t=this.getMousePos(e.clientX,e.clientY);this.app.userMove(t,!1)};this.onTouchMove=e=>{if(e.changedTouches.length>0){const t=e.changedTouches[0],i=this.getMousePos(t.clientX,t.clientY);if(this.app.getSettings().mobileScrollSupport){null!==this.touchPoint&&(Math.abs(this.touchPoint.point.x-i.x)>10||"read"!==this.app.getState())&&e.cancelable&&this.app.userMove(i,!0);"read"!==this.app.getState()&&e.preventDefault()}else this.app.userMove(i,!0)}};this.onTouchEnd=e=>{if(e.changedTouches.length>0){const t=e.changedTouches[0],i=this.getMousePos(t.clientX,t.clientY);let a=!1;if(null!==this.touchPoint){const e=i.x-this.touchPoint.point.x,t=Math.abs(i.y-this.touchPoint.point.y);if(Math.abs(e)>this.swipeDistance&&t<2*this.swipeDistance&&Date.now()-this.touchPoint.time<this.swipeTimeout){e>0?this.app.flipPrev(this.touchPoint.point.y<this.app.getRender().getRect().height/2?"top":"bottom"):this.app.flipNext(this.touchPoint.point.y<this.app.getRender().getRect().height/2?"top":"bottom");a=!0}this.touchPoint=null}this.app.userStop(i,a)}};this.parentElement=e;e.classList.add("stf__parent");const a=this.cspPolicyService.createTrustedHTML('<div class="stf__wrapper"></div>');e.insertAdjacentHTML("afterbegin",a);this.wrapper=e.querySelector(".stf__wrapper");this.app=t;const s=this.app.getSettings().usePortrait?1:2;e.style.minWidth=i.minWidth*s+"px";e.style.minHeight=i.minHeight+"px";if("fixed"===i.size){e.style.minWidth=i.width*s+"px";e.style.minHeight=i.height+"px"}if(i.autoSize){e.style.width="100%";e.style.maxWidth=2*i.maxWidth+"px"}e.style.display="block";window.addEventListener("resize",this.onResize,!1);this.swipeDistance=i.swipeDistance}destroy(){this.app.getSettings().useMouseEvents&&this.removeHandlers();this.distElement.remove();this.wrapper.remove()}getDistElement(){return this.distElement}getWrapper(){return this.wrapper}setOrientationStyle(e){this.wrapper.classList.remove("--portrait","--landscape");if("portrait"===e){this.app.getSettings().autoSize&&(this.wrapper.style.paddingBottom=this.app.getSettings().height/this.app.getSettings().width*100+"%");this.wrapper.classList.add("--portrait")}else{this.app.getSettings().autoSize&&(this.wrapper.style.paddingBottom=this.app.getSettings().height/(2*this.app.getSettings().width)*100+"%");this.wrapper.classList.add("--landscape")}this.update()}removeHandlers(){window.removeEventListener("resize",this.onResize);this.distElement.removeEventListener("mousedown",this.onMouseDown);this.distElement.removeEventListener("touchstart",this.onTouchStart);window.removeEventListener("mousemove",this.onMouseMove);window.removeEventListener("touchmove",this.onTouchMove);window.removeEventListener("mouseup",this.onMouseUp);window.removeEventListener("touchend",this.onTouchEnd)}setHandlers(){window.addEventListener("resize",this.onResize,!1);if(this.app.getSettings().useMouseEvents){this.distElement.addEventListener("mousedown",this.onMouseDown);this.distElement.addEventListener("touchstart",this.onTouchStart);window.addEventListener("mousemove",this.onMouseMove);window.addEventListener("touchmove",this.onTouchMove,{passive:!this.app.getSettings().mobileScrollSupport});window.addEventListener("mouseup",this.onMouseUp);window.addEventListener("touchend",this.onTouchEnd)}}getMousePos(e,t){const i=this.distElement.getBoundingClientRect();return{x:e-i.left,y:t-i.top}}checkTarget(e){return!this.app.getSettings().clickEventForward||!["a","button"].includes(e.tagName.toLowerCase())}}class HTMLUI extends UI{constructor(e,t,i,a,s){super(e,t,i);this.cspPolicyService=s;const n=this.cspPolicyService.createTrustedHTML('<div class="stf__block"></div>');this.wrapper.insertAdjacentHTML("afterbegin",n);this.distElement=e.querySelector(".stf__block");this.items=a;for(const e of a)this.distElement.appendChild(e);this.setHandlers()}clear(){for(const e of this.items)this.parentElement.appendChild(e)}updateItems(e){this.removeHandlers();this.distElement.innerHTML="";for(const t of e)this.distElement.appendChild(t);this.items=e;this.setHandlers()}update(){this.app.getRender().update()}}class EventObject{constructor(){this.events=new Map}on(e,t){this.events.has(e)?this.events.get(e).push(t):this.events.set(e,[t]);return this}off(e){this.events.delete(e)}trigger(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(this.events.has(e))for(const a of this.events.get(e))a({data:i,object:t})}}class HTMLRender extends Render{constructor(e,t,i){super(e,t);this.outerShadow=null;this.innerShadow=null;this.hardShadow=null;this.hardInnerShadow=null;this.element=i;this.createShadows()}createShadows(){const e=this.app.cspPolicyService.createTrustedHTML('<div class="stf__outerShadow"></div>\n             <div class="stf__innerShadow"></div>\n             <div class="stf__hardShadow"></div>\n             <div class="stf__hardInnerShadow"></div>');this.element.insertAdjacentHTML("beforeend",e);this.outerShadow=this.element.querySelector(".stf__outerShadow");this.innerShadow=this.element.querySelector(".stf__innerShadow");this.hardShadow=this.element.querySelector(".stf__hardShadow");this.hardInnerShadow=this.element.querySelector(".stf__hardInnerShadow")}clearShadow(){super.clearShadow();this.outerShadow.style.cssText="display: none";this.innerShadow.style.cssText="display: none";this.hardShadow.style.cssText="display: none";this.hardInnerShadow.style.cssText="display: none"}reload(){this.element.querySelector(".stf__outerShadow")||this.createShadows()}drawHardInnerShadow(){const e=this.getRect(),t=this.shadow.progress>100?200-this.shadow.progress:this.shadow.progress;let i=(100-t)*(2.5*e.pageWidth)/100+20;i>e.pageWidth&&(i=e.pageWidth);let a=`\n            display: block;\n            z-index: ${(this.getSettings().startZIndex+5).toString(10)};\n            width: ${i}px;\n            height: ${e.height}px;\n            background: linear-gradient(to right,\n                rgba(0, 0, 0, ${this.shadow.opacity*t/100}) 5%,\n                rgba(0, 0, 0, 0) 100%);\n            left: ${e.left+e.width/2}px;\n            transform-origin: 0 0;\n        `;a+=0===this.getDirection()&&this.shadow.progress>100||1===this.getDirection()&&this.shadow.progress<=100?"transform: translate3d(0, 0, 0);":"transform: translate3d(0, 0, 0) rotateY(180deg);";this.hardInnerShadow.style.cssText=a}drawHardOuterShadow(){const e=this.getRect();let t=(100-(this.shadow.progress>100?200-this.shadow.progress:this.shadow.progress))*(2.5*e.pageWidth)/100+20;t>e.pageWidth&&(t=e.pageWidth);let i=`\n            display: block;\n            z-index: ${(this.getSettings().startZIndex+4).toString(10)};\n            width: ${t}px;\n            height: ${e.height}px;\n            background: linear-gradient(to left, rgba(0, 0, 0, ${this.shadow.opacity}) 5%, rgba(0, 0, 0, 0) 100%);\n            left: ${e.left+e.width/2}px;\n            transform-origin: 0 0;\n        `;i+=0===this.getDirection()&&this.shadow.progress>100||1===this.getDirection()&&this.shadow.progress<=100?"transform: translate3d(0, 0, 0) rotateY(180deg);":"transform: translate3d(0, 0, 0);";this.hardShadow.style.cssText=i}drawInnerShadow(){const e=this.getRect(),t=3*this.shadow.width/4,i=0===this.getDirection()?t:0,a=0===this.getDirection()?"to left":"to right",s=this.convertToGlobal(this.shadow.pos),n=this.shadow.angle+3*Math.PI/2,r=[this.pageRect.topLeft,this.pageRect.topRight,this.pageRect.bottomRight,this.pageRect.bottomLeft];let o="polygon( ";for(const e of r){let t=1===this.getDirection()?{x:-e.x+this.shadow.pos.x,y:e.y-this.shadow.pos.y}:{x:e.x-this.shadow.pos.x,y:e.y-this.shadow.pos.y};t=Helper.GetRotatedPoint(t,{x:i,y:100},n);o+=t.x+"px "+t.y+"px, "}o=o.slice(0,-2);o+=")";const l=`\n            display: block;\n            z-index: ${(this.getSettings().startZIndex+10).toString(10)};\n            width: ${t}px;\n            height: ${2*e.height}px;\n            background: linear-gradient(${a},\n                rgba(0, 0, 0, ${this.shadow.opacity}) 5%,\n                rgba(0, 0, 0, 0.05) 15%,\n                rgba(0, 0, 0, ${this.shadow.opacity}) 35%,\n                rgba(0, 0, 0, 0) 100%);\n            transform-origin: ${i}px 100px;\n            transform: translate3d(${s.x-i}px, ${s.y-100}px, 0) rotate(${n}rad);\n            clip-path: ${o};\n            -webkit-clip-path: ${o};\n        `;this.innerShadow.style.cssText=l}drawOuterShadow(){const e=this.getRect(),t=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y}),i=this.shadow.angle+3*Math.PI/2,a=1===this.getDirection()?this.shadow.width:0,s=0===this.getDirection()?"to right":"to left",n=[{x:0,y:0},{x:e.pageWidth,y:0},{x:e.pageWidth,y:e.height},{x:0,y:e.height}];let r="polygon( ";for(const e of n)if(null!==e){let t=1===this.getDirection()?{x:-e.x+this.shadow.pos.x,y:e.y-this.shadow.pos.y}:{x:e.x-this.shadow.pos.x,y:e.y-this.shadow.pos.y};t=Helper.GetRotatedPoint(t,{x:a,y:100},i);r+=t.x+"px "+t.y+"px, "}r=r.slice(0,-2);r+=")";const o=`\n            display: block;\n            z-index: ${(this.getSettings().startZIndex+10).toString(10)};\n            width: ${this.shadow.width}px;\n            height: ${2*e.height}px;\n            background: linear-gradient(${s}, rgba(0, 0, 0, ${this.shadow.opacity}), rgba(0, 0, 0, 0));\n            transform-origin: ${a}px 100px;\n            transform: translate3d(${t.x-a}px, ${t.y-100}px, 0) rotate(${i}rad);\n            clip-path: ${r};\n            -webkit-clip-path: ${r};\n        `;this.outerShadow.style.cssText=o}drawLeftPage(){if("portrait"!==this.orientation&&null!==this.leftPage)if(1===this.direction&&null!==this.flippingPage&&"hard"===this.flippingPage.getDrawingDensity()){if(this.flippingPage.getHardAngle()<-90){this.leftPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.leftPage.setHardDrawingAngle(180+this.flippingPage.getHardAngle());this.leftPage.draw(this.flippingPage.getDrawingDensity())}else this.leftPage.getElement().style.display="none"}else this.leftPage.simpleDraw(0)}drawRightPage(){if(null!==this.rightPage)if(0===this.direction&&null!==this.flippingPage&&"hard"===this.flippingPage.getDrawingDensity()){if(this.flippingPage.getHardAngle()>90){this.rightPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.rightPage.setHardDrawingAngle(180+this.flippingPage.getHardAngle());this.rightPage.draw(this.flippingPage.getDrawingDensity())}else this.rightPage.getElement().style.display="none"}else this.rightPage.simpleDraw(1)}drawBottomPage(){if(null===this.bottomPage)return;const e=null!=this.flippingPage?this.flippingPage.getDrawingDensity():null;if("portrait"!==this.orientation||1!==this.direction){this.bottomPage.getElement().style.zIndex=(this.getSettings().startZIndex+3).toString(10);this.bottomPage.draw(e)}}drawFrame(){if(null!==this.flippingPage){if(this.flippingPage.getHardAngle()===this.lastAngle)return;this.lastAngle=this.flippingPage.getHardAngle()}else this.lastAngle=-1234;this.clear();this.drawLeftPage();this.drawRightPage();this.drawBottomPage();if(null!=this.flippingPage){if(this.flippingPage.state.hardDrawingAngle<=90){this.flippingPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.flippingPage.draw()}else this.flippingPage.getElement().style.display="none"}if(null!=this.shadow&&null!==this.flippingPage)if("soft"===this.flippingPage.getDrawingDensity()){this.drawOuterShadow();this.drawInnerShadow()}else{this.drawHardOuterShadow();this.drawHardInnerShadow()}}clear(){for(const e of this.app.getPageCollection().getPages()){if(e!==this.leftPage&&e!==this.rightPage&&e!==this.flippingPage&&e!==this.bottomPage){const t=e.getElement().style;"none"!==t.display&&(t.cssText="display: none")}e.getTemporaryCopy()!==this.flippingPage&&e.hideTemporaryCopy()}}update(){super.update();null!==this.rightPage&&this.rightPage.setOrientation(1);null!==this.leftPage&&this.leftPage.setOrientation(0)}}class Settings{constructor(){this._default={startPage:0,size:"fixed",width:0,height:0,minWidth:0,maxWidth:0,minHeight:0,maxHeight:0,drawShadow:!0,flippingTime:1e3,usePortrait:!0,startZIndex:0,autoSize:!0,maxShadowOpacity:1,showCover:!1,mobileScrollSupport:!0,swipeDistance:30,clickEventForward:!0,useMouseEvents:!0,showPageCorners:!0,disableFlipByClick:!1}}getSettings(e){const t=this._default;Object.assign(t,e);if("stretch"!==t.size&&"fixed"!==t.size)throw new Error('Invalid size type. Available only "fixed" and "stretch" value');if(t.width<=0||t.height<=0)throw new Error("Invalid width or height");if(t.flippingTime<=0)throw new Error("Invalid flipping time");if("stretch"===t.size){t.minWidth<=0&&(t.minWidth=100);t.maxWidth<t.minWidth&&(t.maxWidth=2e3);t.minHeight<=0&&(t.minHeight=100);t.maxHeight<t.minHeight&&(t.maxHeight=2e3)}else{t.minWidth=t.width;t.maxWidth=t.width;t.minHeight=t.height;t.maxHeight=t.height}return t}}class PageFlip extends EventObject{constructor(e,t,i){super();this.isUserTouch=!1;this.isUserMove=!1;this.setting=null;this.pages=null;this.setting=(new Settings).getSettings(t);this.block=e;this.cspPolicyService=i}destroy(){this.ui.destroy();this.render=void 0}update(){this.render.update();this.pages.show()}loadFromHTML(e){this.ui=new HTMLUI(this.block,this,this.setting,e,this.cspPolicyService);this.render=new HTMLRender(this,this.setting,this.ui.getDistElement());this.flipController=new Flip(this.render,this);this.pages=new HTMLPageCollection(this,this.render,this.ui.getDistElement(),e);this.pages.load();this.render.start();this.pages.show(this.setting.startPage);setTimeout((()=>{this.ui.update();this.trigger("init",this,{page:this.setting.startPage,mode:this.render.getOrientation()})}),1)}updateFromHtml(e){const t=this.pages.getCurrentPageIndex();this.pages.destroy();this.pages=new HTMLPageCollection(this,this.render,this.ui.getDistElement(),e);this.pages.load();this.ui.updateItems(e);this.render.reload();this.pages.show(t);this.trigger("update",this,{page:t,mode:this.render.getOrientation()})}clear(){this.pages.destroy();this.ui.clear()}turnToPrevPage(){this.pages.showPrev()}turnToNextPage(){this.pages.showNext()}turnToPage(e){this.pages.show(e)}flipNext(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"top";this.flipController.flipNext(e)}flipPrev(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"top";this.flipController.flipPrev(e)}flip(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top";this.flipController.flipToPage(e,t)}updateState(e){this.trigger("changeState",this,e)}updatePageIndex(e){this.trigger("flip",this,e)}updateOrientation(e){this.ui.setOrientationStyle(e);this.update();this.trigger("changeOrientation",this,e)}getPageCount(){return this.pages.getPageCount()}getCurrentPageIndex(){return this.pages.getCurrentPageIndex()}getPage(e){return this.pages.getPage(e)}getRender(){return this.render}getFlipController(){return this.flipController}getOrientation(){return this.render.getOrientation()}getBoundsRect(){return this.render.getRect()}getSettings(){return this.setting}getUI(){return this.ui}getState(){return this.flipController.getState()}getPageCollection(){return this.pages}startUserTouch(e){this.mousePosition=e;this.isUserTouch=!0;this.isUserMove=!1}userMove(e,t){if(this.isUserTouch||t||!this.setting.showPageCorners){if(this.isUserTouch&&Helper.GetDistanceBetweenTwoPoint(this.mousePosition,e)>5){this.isUserMove=!0;this.flipController.fold(e)}}else this.flipController.showCorner(e)}userStop(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.isUserTouch){this.isUserTouch=!1;t||(this.isUserMove?this.flipController.stopMove():this.flipController.flip(e))}}}function annotation_editor_layer_builder_classPrivateFieldInitSpec(e,t,i){(function annotation_editor_layer_builder_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function annotation_editor_layer_builder_classPrivateFieldGet(e,t){return e.get(annotation_editor_layer_builder_assertClassBrand(e,t))}function annotation_editor_layer_builder_classPrivateFieldSet(e,t,i){return e.set(annotation_editor_layer_builder_assertClassBrand(e,t),i),i}function annotation_editor_layer_builder_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var S_=new WeakMap,x_=new WeakMap,C_=new WeakMap,A_=new WeakMap,E_=new WeakMap,k_=new WeakMap;class AnnotationEditorLayerBuilder{constructor(e){annotation_editor_layer_builder_classPrivateFieldInitSpec(this,S_,null);annotation_editor_layer_builder_classPrivateFieldInitSpec(this,x_,null);annotation_editor_layer_builder_classPrivateFieldInitSpec(this,C_,null);annotation_editor_layer_builder_classPrivateFieldInitSpec(this,A_,null);annotation_editor_layer_builder_classPrivateFieldInitSpec(this,E_,null);annotation_editor_layer_builder_classPrivateFieldInitSpec(this,k_,void 0);this.pdfPage=e.pdfPage;this.accessibilityManager=e.accessibilityManager;this.l10n=e.l10n;this.l10n||=new genericl10n_GenericL10n;this.annotationEditorLayer=null;this.div=null;this._cancelled=!1;annotation_editor_layer_builder_classPrivateFieldSet(k_,this,e.uiManager);annotation_editor_layer_builder_classPrivateFieldSet(S_,this,e.annotationLayer||null);annotation_editor_layer_builder_classPrivateFieldSet(E_,this,e.textLayer||null);annotation_editor_layer_builder_classPrivateFieldSet(x_,this,e.drawLayer||null);annotation_editor_layer_builder_classPrivateFieldSet(C_,this,e.onAppend||null);this.eventBus=e.eventBus;annotation_editor_layer_builder_classPrivateFieldSet(A_,this,e.structTreeLayer||null)}async render(e){let{viewport:t,intent:i="display"}=e;if("display"!==i)return;if(this._cancelled)return;const a=t.clone({dontFlip:!0});if(this.div){this.annotationEditorLayer.update({viewport:a});this.show();return}const s=this.div=document.createElement("div");s.className="annotationEditorLayer";s.hidden=!0;s.dir=annotation_editor_layer_builder_classPrivateFieldGet(k_,this).direction;annotation_editor_layer_builder_classPrivateFieldGet(C_,this)?.call(this,s);this.annotationEditorLayer=new AnnotationEditorLayer({uiManager:annotation_editor_layer_builder_classPrivateFieldGet(k_,this),div:s,structTreeLayer:annotation_editor_layer_builder_classPrivateFieldGet(A_,this),accessibilityManager:this.accessibilityManager,pageIndex:this.pdfPage.pageNumber-1,l10n:this.l10n,viewport:a,annotationLayer:annotation_editor_layer_builder_classPrivateFieldGet(S_,this),textLayer:annotation_editor_layer_builder_classPrivateFieldGet(E_,this),drawLayer:annotation_editor_layer_builder_classPrivateFieldGet(x_,this),eventBus:this.eventBus});const n={viewport:a,div:s,annotations:null,intent:i};this.annotationEditorLayer.render(n);this.show()}cancel(){this._cancelled=!0;this.div&&this.annotationEditorLayer.destroy()}hide(){if(this.div){this.annotationEditorLayer.pause(!0);this.div.hidden=!0}}show(){if(this.div&&!this.annotationEditorLayer.isInvisible){this.div.hidden=!1;this.annotationEditorLayer.pause(!1)}}}function annotation_layer_builder_classPrivateFieldInitSpec(e,t,i){annotation_layer_builder_checkPrivateRedeclaration(e,t),t.set(e,i)}function annotation_layer_builder_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function annotation_layer_builder_classPrivateFieldGet(e,t){return e.get(annotation_layer_builder_assertClassBrand(e,t))}function annotation_layer_builder_classPrivateFieldSet(e,t,i){return e.set(annotation_layer_builder_assertClassBrand(e,t),i),i}function annotation_layer_builder_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var I_=new WeakMap,M_=new WeakMap,B_=new WeakMap,G_=new WeakMap,T_=new WeakMap,D_=new WeakSet;class AnnotationLayerBuilder{constructor(e){let{pdfPage:t,linkService:i,downloadManager:a,annotationStorage:s=null,imageResourcesPath:n="",renderForms:r=!0,enableScripting:o=!1,hasJSActionsPromise:l=null,fieldObjectsPromise:d=null,annotationCanvasMap:c=null,accessibilityManager:h=null,annotationEditorUIManager:u=null,onAppend:_=null}=e;!function annotation_layer_builder_classPrivateMethodInitSpec(e,t){annotation_layer_builder_checkPrivateRedeclaration(e,t),t.add(e)}(this,D_);annotation_layer_builder_classPrivateFieldInitSpec(this,I_,null);annotation_layer_builder_classPrivateFieldInitSpec(this,M_,!1);annotation_layer_builder_classPrivateFieldInitSpec(this,B_,null);annotation_layer_builder_classPrivateFieldInitSpec(this,G_,null);annotation_layer_builder_classPrivateFieldInitSpec(this,T_,!1);this.pdfPage=t;this.linkService=i;this.downloadManager=a;this.imageResourcesPath=n;this.renderForms=r;this.annotationStorage=s;this.enableScripting=o;this._hasJSActionsPromise=l||Promise.resolve(!1);this._fieldObjectsPromise=d||Promise.resolve(null);this._annotationCanvasMap=c;this._accessibilityManager=h;this._annotationEditorUIManager=u;annotation_layer_builder_classPrivateFieldSet(B_,this,_);this.annotationLayer=null;this.div=null;this._cancelled=!1;this._eventBus=i.eventBus}async render(e){let{viewport:t,intent:i="display",structTreeLayer:a=null}=e;if(this.div){if(this._cancelled||!this.annotationLayer)return;this.annotationLayer.update({viewport:t.clone({dontFlip:!0})});return}const[s,n,r]=await Promise.all([this.pdfPage.getAnnotations({intent:i}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled)return;const o=this.div=document.createElement("div");o.className="annotationLayer";annotation_layer_builder_classPrivateFieldGet(B_,this)?.call(this,o);if(0!==s.length){annotation_layer_builder_assertClassBrand(D_,this,_initAnnotationLayer).call(this,t,a);await this.annotationLayer.render({annotations:s,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:n,fieldObjects:r});annotation_layer_builder_classPrivateFieldSet(I_,this,s);this.linkService.isInPresentationMode&&annotation_layer_builder_assertClassBrand(D_,this,_updatePresentationModeState).call(this,Tl);if(!annotation_layer_builder_classPrivateFieldGet(G_,this)){annotation_layer_builder_classPrivateFieldSet(G_,this,new AbortController);this._eventBus?._on("presentationmodechanged",(e=>{annotation_layer_builder_assertClassBrand(D_,this,_updatePresentationModeState).call(this,e.state)}),{signal:annotation_layer_builder_classPrivateFieldGet(G_,this).signal})}}else{annotation_layer_builder_classPrivateFieldSet(I_,this,s);this.hide(!0)}}cancel(){this._cancelled=!0;annotation_layer_builder_classPrivateFieldGet(G_,this)?.abort();annotation_layer_builder_classPrivateFieldSet(G_,this,null)}hide(){annotation_layer_builder_classPrivateFieldSet(M_,this,!(arguments.length>0&&void 0!==arguments[0]&&arguments[0]));this.div&&(document.querySelector("[data-pdfjsprinting=true]")||(this.div.hidden=!0))}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}async injectLinkAnnotations(e){let{inferredLinks:t,viewport:i,structTreeLayer:a=null}=e;if(null===annotation_layer_builder_classPrivateFieldGet(I_,this))throw new Error("`render` method must be called before `injectLinkAnnotations`.");if(this._cancelled||annotation_layer_builder_classPrivateFieldGet(T_,this))return;annotation_layer_builder_classPrivateFieldSet(T_,this,!0);const s=annotation_layer_builder_classPrivateFieldGet(I_,this).length?annotation_layer_builder_assertClassBrand(D_,this,_checkInferredLinks).call(this,t):t;if(s.length){if(!this.annotationLayer){annotation_layer_builder_assertClassBrand(D_,this,_initAnnotationLayer).call(this,i,a);setLayerDimensions(this.div,i)}await this.annotationLayer.addLinkAnnotations(s,this.linkService);annotation_layer_builder_classPrivateFieldGet(M_,this)||(this.div.hidden=!1)}}}function _initAnnotationLayer(e,t){this.annotationLayer=new AnnotationLayer({div:this.div,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,annotationEditorUIManager:this._annotationEditorUIManager,page:this.pdfPage,viewport:e.clone({dontFlip:!0}),structTreeLayer:t})}function _updatePresentationModeState(e){if(!this.div)return;let t=!1;switch(e){case Tl:t=!0;break;case Bl:break;default:return}for(const e of this.div.childNodes)e.hasAttribute("data-internal-link")||(e.inert=t)}function _checkInferredLinks(e){function annotationRects(e){if(!e.quadPoints)return[e.rect];const t=[];for(let i=2,a=e.quadPoints.length;i<a;i+=8){const a=e.quadPoints[i],s=e.quadPoints[i+1],n=e.quadPoints[i+2],r=e.quadPoints[i+3];t.push([n,r,a,s])}return t}function intersectAnnotations(e,t){const i=[],a=annotationRects(e),s=annotationRects(t);for(const e of a)for(const t of s){const a=Util.intersect(e,t);a&&i.push(a)}return i}function areaRects(e){let t=0;for(const i of e)t+=Math.abs((i[2]-i[0])*(i[3]-i[1]));return t}return e.filter((e=>{let t;for(const i of annotation_layer_builder_classPrivateFieldGet(I_,this)){if(i.annotationType!==A.LINK||!i.url)continue;const a=intersectAnnotations(i,e);if(0!==a.length){t??=areaRects(annotationRects(e));if(areaRects(a)/t>.5)return!1}}return!0}))}__webpack_require__(2222);function autolinker_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function DOMRectToPDF(e,t){let{width:i,height:a,left:s,top:n}=e;if(0===i||0===a)return null;const r=t.textLayer.div.getBoundingClientRect(),o=t.getPagePoint(s-r.left,n-r.top),l=t.getPagePoint(s-r.left+i,n-r.top+a);return Util.normalizeRect([o[0],o[1],l[0],l[1]])}function calculateLinkPosition(e,t){const i=e.getClientRects();if(1===i.length)return{rect:DOMRectToPDF(i[0],t)};const a=[1/0,1/0,-1/0,-1/0],s=[];let n=0;for(const e of i){const i=DOMRectToPDF(e,t);if(null!==i){s[n]=s[n+4]=i[0];s[n+1]=s[n+3]=i[3];s[n+2]=s[n+6]=i[2];s[n+5]=s[n+7]=i[1];Util.rectBoundingBox(...i,a);n+=8}}return{quadPoints:s,rect:a}}function textPosition(e,t){let i=e;do{if(i.nodeType===Node.TEXT_NODE){const e=i.textContent.length;if(t<=e)return[i,t];t-=e}else if(i.firstChild){i=i.firstChild;continue}for(;!i.nextSibling&&i!==e;)i=i.parentNode;i!==e&&(i=i.nextSibling)}while(i!==e);throw new Error("Offset is bigger than container's contents length.")}class Autolinker{static findLinks(e){autolinker_assertClassBrand(Autolinker,this,R_)._??(R_._=autolinker_assertClassBrand(Autolinker,this,/\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{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{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}])+|\b[\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\$\+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{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\$\+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{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,i]=normalize(e,{ignoreDashEOL:!0}),a=t.matchAll(autolinker_assertClassBrand(Autolinker,this,R_)._),s=[];for(const e of a){const[t,a]=e;let n;if(t.startsWith("www.")||t.startsWith("http://")||t.startsWith("https://"))n=t;else{if(!URL.canParse(`http://${a}`))continue;n=t.startsWith("mailto:")?t:`mailto:${t}`}const r=createValidAbsoluteUrl(n,null,{addDefaultProtocol:!0});if(r){const[a,n]=getOriginalIndex(i,e.index,t.length);s.push({url:r.href,index:a,length:n})}}return s}static processLinks(e){return this.findLinks(e._textHighlighter.textContentItemsStr.join("\n")).map((t=>{var i,a;return function createLinkAnnotation(e,t,i){let{url:a,index:s,length:n}=e;const r=t._textHighlighter,[{begin:o,end:l}]=r._convertMatches([s],[n]),d=new Range;d.setStart(...textPosition(r.textDivs[o.divIdx],o.offset));d.setEnd(...textPosition(r.textDivs[l.divIdx],l.offset));return{id:`inferred_link_${i}`,unsafeUrl:a,url:a,annotationType:A.LINK,rotation:0,...calculateLinkPosition(d,t),borderStyle:null}}(t,e,(L_._=autolinker_assertClassBrand(Autolinker,this,(i=autolinker_assertClassBrand(Autolinker,this,L_)._,a=i++,i)),a))}))}}var L_={_:0},R_={_:void 0};function base_pdf_page_view_defineProperty(e,t,i){return(t=function base_pdf_page_view_toPropertyKey(e){var t=function base_pdf_page_view_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function base_pdf_page_view_classPrivateFieldInitSpec(e,t,i){base_pdf_page_view_checkPrivateRedeclaration(e,t),t.set(e,i)}function base_pdf_page_view_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function base_pdf_page_view_classPrivateFieldGet(e,t){return e.get(base_pdf_page_view_assertClassBrand(e,t))}function base_pdf_page_view_classPrivateFieldSet(e,t,i){return e.set(base_pdf_page_view_assertClassBrand(e,t),i),i}function base_pdf_page_view_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var N_=new WeakMap,O_=new WeakMap,W_=new WeakMap,j_=new WeakMap,V_=new WeakMap,H_=new WeakMap,z_=new WeakMap,U_=new WeakMap,$_=new WeakSet;class BasePDFPageView{constructor(e){!function base_pdf_page_view_classPrivateMethodInitSpec(e,t){base_pdf_page_view_checkPrivateRedeclaration(e,t),t.add(e)}(this,$_);base_pdf_page_view_classPrivateFieldInitSpec(this,N_,null);base_pdf_page_view_classPrivateFieldInitSpec(this,O_,0);base_pdf_page_view_classPrivateFieldInitSpec(this,W_,null);base_pdf_page_view_classPrivateFieldInitSpec(this,j_,Il.INITIAL);base_pdf_page_view_classPrivateFieldInitSpec(this,V_,null);base_pdf_page_view_classPrivateFieldInitSpec(this,H_,0);base_pdf_page_view_classPrivateFieldInitSpec(this,z_,null);base_pdf_page_view_defineProperty(this,"canvas",null);base_pdf_page_view_defineProperty(this,"div",null);base_pdf_page_view_defineProperty(this,"eventBus",null);base_pdf_page_view_defineProperty(this,"id",null);base_pdf_page_view_defineProperty(this,"pageColors",null);base_pdf_page_view_defineProperty(this,"renderingQueue",null);base_pdf_page_view_defineProperty(this,"renderTask",null);base_pdf_page_view_defineProperty(this,"resume",null);base_pdf_page_view_classPrivateFieldInitSpec(this,U_,(e=>{base_pdf_page_view_classPrivateFieldGet(V_,this)?.call(this,!1);if(!this.renderingQueue||this.renderingQueue.isHighestPriority(this))e();else{this.renderingState=Il.PAUSED;this.resume=()=>{this.renderingState=Il.RUNNING;e()}}}));this.eventBus=e.eventBus;this.id=e.id;this.pageColors=e.pageColors||null;this.renderingQueue=e.renderingQueue;base_pdf_page_view_classPrivateFieldSet(O_,this,e.minDurationToUpdateCanvas??500)}get renderingState(){return base_pdf_page_view_classPrivateFieldGet(j_,this)}set renderingState(e){if(e!==base_pdf_page_view_classPrivateFieldGet(j_,this)){base_pdf_page_view_classPrivateFieldSet(j_,this,e);if(base_pdf_page_view_classPrivateFieldGet(N_,this)){clearTimeout(base_pdf_page_view_classPrivateFieldGet(N_,this));base_pdf_page_view_classPrivateFieldSet(N_,this,null)}switch(e){case Il.PAUSED:this.div.classList.remove("loading");base_pdf_page_view_classPrivateFieldSet(H_,this,0);base_pdf_page_view_classPrivateFieldGet(V_,this)?.call(this,!1);break;case Il.RUNNING:this.div.classList.add("loadingIcon");base_pdf_page_view_classPrivateFieldSet(N_,this,setTimeout((()=>{this.div.classList.add("loading");base_pdf_page_view_classPrivateFieldSet(N_,this,null)}),0));base_pdf_page_view_classPrivateFieldSet(H_,this,Date.now());break;case Il.INITIAL:case Il.FINISHED:this.div.classList.remove("loadingIcon","loading");base_pdf_page_view_classPrivateFieldSet(H_,this,0)}}}_createCanvas(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{pageColors:i}=this,a=!(!i?.background||!i?.foreground),s=this.canvas,n=!s&&!a&&!t;let r=this.canvas=document.createElement("canvas");base_pdf_page_view_classPrivateFieldSet(V_,this,(t=>{if(n){let i=base_pdf_page_view_classPrivateFieldGet(z_,this);if(!t&&base_pdf_page_view_classPrivateFieldGet(O_,this)>0){if(Date.now()-base_pdf_page_view_classPrivateFieldGet(H_,this)<base_pdf_page_view_classPrivateFieldGet(O_,this))return;if(!i){i=base_pdf_page_view_classPrivateFieldSet(z_,this,r);r=this.canvas=r.cloneNode(!1);e(r)}}if(i){r.getContext("2d",{alpha:!1}).drawImage(i,0,0);t?base_pdf_page_view_assertClassBrand($_,this,_resetTempCanvas).call(this):base_pdf_page_view_classPrivateFieldSet(H_,this,Date.now());return}e(r);base_pdf_page_view_classPrivateFieldSet(V_,this,null)}else if(t)if(s){s.replaceWith(r);s.width=s.height=0}else e(r)}));return{canvas:r,prevCanvas:s}}_resetCanvas(){const{canvas:e}=this;if(e){e.remove();e.width=e.height=0;this.canvas=null;base_pdf_page_view_assertClassBrand($_,this,_resetTempCanvas).call(this)}}async _drawCanvas(e,t,i){const a=this.renderTask=this.pdfPage.render(e);a.onContinue=base_pdf_page_view_classPrivateFieldGet(U_,this);a.onError=e=>{if(e instanceof RenderingCancelledException){t();base_pdf_page_view_classPrivateFieldSet(W_,this,null)}};let s=null;try{await a.promise;base_pdf_page_view_classPrivateFieldGet(V_,this)?.call(this,!0)}catch(e){if(e instanceof RenderingCancelledException)return;s=e;base_pdf_page_view_classPrivateFieldGet(V_,this)?.call(this,!0)}finally{base_pdf_page_view_classPrivateFieldSet(W_,this,s);a===this.renderTask&&(this.renderTask=null)}this.renderingState=Il.FINISHED;i(a);if(s)throw s}cancelRendering(){let{cancelExtraDelay:e=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.renderTask){this.renderTask.cancel(e);this.renderTask=null}this.resume=null}dispatchPageRender(){this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id})}dispatchPageRendered(e,t){this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:e,isDetailView:t,timestamp:performance.now(),error:base_pdf_page_view_classPrivateFieldGet(W_,this)})}}function _resetTempCanvas(){if(base_pdf_page_view_classPrivateFieldGet(z_,this)){base_pdf_page_view_classPrivateFieldGet(z_,this).width=base_pdf_page_view_classPrivateFieldGet(z_,this).height=0;base_pdf_page_view_classPrivateFieldSet(z_,this,null)}}function draw_layer_builder_classPrivateFieldInitSpec(e,t,i){(function draw_layer_builder_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function draw_layer_builder_classPrivateFieldSet(e,t,i){return e.set(draw_layer_builder_assertClassBrand(e,t),i),i}function draw_layer_builder_classPrivateFieldGet(e,t){return e.get(draw_layer_builder_assertClassBrand(e,t))}function draw_layer_builder_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var q_=new WeakMap;class DrawLayerBuilder{constructor(e){draw_layer_builder_classPrivateFieldInitSpec(this,q_,null);this.pageIndex=e.pageIndex}async render(e){let{intent:t="display"}=e;"display"!==t||draw_layer_builder_classPrivateFieldGet(q_,this)||this._cancelled||draw_layer_builder_classPrivateFieldSet(q_,this,new DrawLayer({pageIndex:this.pageIndex}))}cancel(){this._cancelled=!0;if(draw_layer_builder_classPrivateFieldGet(q_,this)){draw_layer_builder_classPrivateFieldGet(q_,this).destroy();draw_layer_builder_classPrivateFieldSet(q_,this,null)}}setParent(e){draw_layer_builder_classPrivateFieldGet(q_,this)?.setParent(e)}getDrawLayer(){return draw_layer_builder_classPrivateFieldGet(q_,this)}}function pdf_page_detail_view_defineProperty(e,t,i){return(t=function pdf_page_detail_view_toPropertyKey(e){var t=function pdf_page_detail_view_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function pdf_page_detail_view_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_page_detail_view_classPrivateFieldGet(e,t){return e.get(pdf_page_detail_view_assertClassBrand(e,t))}function pdf_page_detail_view_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var X_=new WeakMap,K_=new WeakSet;class PDFPageDetailView extends BasePDFPageView{constructor(e){let{pageView:t}=e;super(t);!function pdf_page_detail_view_classPrivateMethodInitSpec(e,t){pdf_page_detail_view_checkPrivateRedeclaration(e,t),t.add(e)}(this,K_);!function pdf_page_detail_view_classPrivateFieldInitSpec(e,t,i){pdf_page_detail_view_checkPrivateRedeclaration(e,t),t.set(e,i)}(this,X_,null);pdf_page_detail_view_defineProperty(this,"renderingCancelled",!1);this.pageView=t;this.renderingId="detail"+this.id;this.div=t.div}setPdfPage(e){this.pageView.setPdfPage(e)}get pdfPage(){return this.pageView.pdfPage}get renderingState(){return super.renderingState}set renderingState(e){this.renderingCancelled=!1;super.renderingState=e}reset(){let{keepCanvas:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this.renderingCancelled||this.renderingState===Il.RUNNING||this.renderingState===Il.PAUSED;this.cancelRendering();this.renderingState=Il.INITIAL;this.renderingCancelled=t;e||this._resetCanvas()}update(){let{visibleArea:e=null,underlyingViewUpdated:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t){this.cancelRendering();this.renderingState=Il.INITIAL;return}if(!pdf_page_detail_view_assertClassBrand(K_,this,_shouldRenderDifferentArea).call(this,e))return;const{viewport:i,maxCanvasPixels:a,capCanvasAreaFactor:s}=this.pageView,n=e.maxX-e.minX,r=e.maxY-e.minY,o=n*r*OutputScale.pixelRatio**2,l=(Math.sqrt(OutputScale.capPixels(a,s)/o)-1)/2;let d=Math.min(1,l);d<0&&(d=0);const c=n*d,h=r*d,u=Math.max(0,e.minX-c),_=Math.min(i.width,e.maxX+c),p=Math.max(0,e.minY-h),g=Math.min(i.height,e.maxY+h);!function pdf_page_detail_view_classPrivateFieldSet(e,t,i){return e.set(pdf_page_detail_view_assertClassBrand(e,t),i),i}(X_,this,{minX:u,minY:p,width:_-u,height:g-p,scale:i.scale});this.reset({keepCanvas:!0})}async draw(){if(this.pageView.detailView!==this)return;const e=this.pageView.renderingState===Il.FINISHED||this.renderingState===Il.FINISHED;if(this.renderingState!==Il.INITIAL){console.error("Must be in new state before drawing");this.reset()}const{div:t,pdfPage:i,viewport:a}=this.pageView;if(!i){this.renderingState=Il.FINISHED;throw new Error("pdfPage is not loaded")}this.renderingState=Il.RUNNING;const s=this.pageView._ensureCanvasWrapper(),{canvas:n,prevCanvas:r}=this._createCanvas((e=>{"CANVAS"===s.firstElementChild?.tagName?s.firstElementChild.after(e):s.prepend(e)}),e);n.setAttribute("aria-hidden","true");const{width:o,height:l}=a,d=pdf_page_detail_view_classPrivateFieldGet(X_,this),{pixelRatio:c}=OutputScale,h=[c,0,0,c,-d.minX*c,-d.minY*c];n.width=d.width*c;n.height=d.height*c;const{style:u}=n;u.width=100*d.width/o+"%";u.height=100*d.height/l+"%";u.top=100*d.minY/l+"%";u.left=100*d.minX/o+"%";const _=this._drawCanvas(this.pageView._getRenderingContext(n,h),(()=>{this.canvas?.remove();this.canvas=r}),(()=>{this.dispatchPageRendered(!1,!0)}));t.setAttribute("data-loaded",!0);this.dispatchPageRender();return _}}function _shouldRenderDifferentArea(e){if(!pdf_page_detail_view_classPrivateFieldGet(X_,this))return!0;const t=pdf_page_detail_view_classPrivateFieldGet(X_,this).minX,i=pdf_page_detail_view_classPrivateFieldGet(X_,this).minY,a=pdf_page_detail_view_classPrivateFieldGet(X_,this).width+t,s=pdf_page_detail_view_classPrivateFieldGet(X_,this).height+i;if(e.minX<t||e.minY<i||e.maxX>a||e.maxY>s)return!0;const{width:n,height:r,scale:o}=this.pageView.viewport;if(pdf_page_detail_view_classPrivateFieldGet(X_,this).scale!==o)return!0;const l=e.minX-t,d=a-e.maxX,c=e.minY-i,h=s-e.maxY;return t>0&&d/l>3||a<n&&l/d>3||i>0&&h/c>3||s<r&&c/h>3}function struct_tree_layer_builder_classPrivateFieldInitSpec(e,t,i){struct_tree_layer_builder_checkPrivateRedeclaration(e,t),t.set(e,i)}function struct_tree_layer_builder_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function struct_tree_layer_builder_classPrivateFieldGet(e,t){return e.get(struct_tree_layer_builder_assertClassBrand(e,t))}function struct_tree_layer_builder_classPrivateFieldSet(e,t,i){return e.set(struct_tree_layer_builder_assertClassBrand(e,t),i),i}function struct_tree_layer_builder_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Y_={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:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},Z_=/^H(\d+)$/;var Q_=new WeakMap,J_=new WeakMap,ep=new WeakMap,tp=new WeakMap,ip=new WeakMap,ap=new WeakMap,sp=new WeakSet;class StructTreeLayerBuilder{constructor(e,t){!function struct_tree_layer_builder_classPrivateMethodInitSpec(e,t){struct_tree_layer_builder_checkPrivateRedeclaration(e,t),t.add(e)}(this,sp);struct_tree_layer_builder_classPrivateFieldInitSpec(this,Q_,void 0);struct_tree_layer_builder_classPrivateFieldInitSpec(this,J_,null);struct_tree_layer_builder_classPrivateFieldInitSpec(this,ep,void 0);struct_tree_layer_builder_classPrivateFieldInitSpec(this,tp,new Map);struct_tree_layer_builder_classPrivateFieldInitSpec(this,ip,void 0);struct_tree_layer_builder_classPrivateFieldInitSpec(this,ap,null);struct_tree_layer_builder_classPrivateFieldSet(Q_,this,e.getStructTree());struct_tree_layer_builder_classPrivateFieldSet(ip,this,t)}async render(){if(struct_tree_layer_builder_classPrivateFieldGet(ep,this))return struct_tree_layer_builder_classPrivateFieldGet(ep,this);const{promise:e,resolve:t,reject:i}=Promise.withResolvers();struct_tree_layer_builder_classPrivateFieldSet(ep,this,e);try{struct_tree_layer_builder_classPrivateFieldSet(J_,this,struct_tree_layer_builder_assertClassBrand(sp,this,_walk).call(this,await struct_tree_layer_builder_classPrivateFieldGet(Q_,this)))}catch(e){i(e)}struct_tree_layer_builder_classPrivateFieldSet(Q_,this,null);struct_tree_layer_builder_classPrivateFieldGet(J_,this)?.classList.add("structTree");t(struct_tree_layer_builder_classPrivateFieldGet(J_,this));return e}async getAriaAttributes(e){try{await this.render();return struct_tree_layer_builder_classPrivateFieldGet(tp,this).get(e)}catch{}return null}hide(){struct_tree_layer_builder_classPrivateFieldGet(J_,this)&&!struct_tree_layer_builder_classPrivateFieldGet(J_,this).hidden&&(struct_tree_layer_builder_classPrivateFieldGet(J_,this).hidden=!0)}show(){struct_tree_layer_builder_classPrivateFieldGet(J_,this)?.hidden&&(struct_tree_layer_builder_classPrivateFieldGet(J_,this).hidden=!1)}addElementsToTextLayer(){if(struct_tree_layer_builder_classPrivateFieldGet(ap,this)){for(const[e,t]of struct_tree_layer_builder_classPrivateFieldGet(ap,this))document.getElementById(e)?.append(t);struct_tree_layer_builder_classPrivateFieldGet(ap,this).clear();struct_tree_layer_builder_classPrivateFieldSet(ap,this,null)}}}function _setAttributes(e,t){const{alt:i,id:a,lang:s}=e;if(void 0!==i){let a=!1;const s=removeNullCharacters(i);for(const t of e.children)if("annotation"===t.type){let e=struct_tree_layer_builder_classPrivateFieldGet(tp,this).get(t.id);if(!e){e=new Map;struct_tree_layer_builder_classPrivateFieldGet(tp,this).set(t.id,e)}e.set("aria-label",s);a=!0}a||t.setAttribute("aria-label",s)}void 0!==a&&t.setAttribute("aria-owns",a);void 0!==s&&t.setAttribute("lang",removeNullCharacters(s,!0))}function _addImageInTextLayer(e,t){const{alt:i,bbox:a,children:s}=e,n=s?.[0];if(!struct_tree_layer_builder_classPrivateFieldGet(ip,this)||!i||!a||"content"!==n?.type)return!1;const{id:r}=n;if(!r)return!1;t.setAttribute("aria-owns",r);const o=document.createElement("span");(struct_tree_layer_builder_classPrivateFieldGet(ap,this)||struct_tree_layer_builder_classPrivateFieldSet(ap,this,new Map)).set(r,o);o.setAttribute("role","img");o.setAttribute("aria-label",removeNullCharacters(i));const{pageHeight:l,pageX:d,pageY:c}=struct_tree_layer_builder_classPrivateFieldGet(ip,this),h="calc(var(--total-scale-factor) *",{style:u}=o;u.width=`${h}${a[2]-a[0]}px)`;u.height=`${h}${a[3]-a[1]}px)`;u.left=`${h}${a[0]-d}px)`;u.top=`${h}${l-a[3]+c}px)`;return!0}function _walk(e){if(!e)return null;const t=document.createElement("span");if("role"in e){const{role:i}=e,a=i.match(Z_);if(a){t.setAttribute("role","heading");t.setAttribute("aria-level",a[1])}else Y_[i]&&t.setAttribute("role",Y_[i]);if("Figure"===i&&struct_tree_layer_builder_assertClassBrand(sp,this,_addImageInTextLayer).call(this,e,t))return t}struct_tree_layer_builder_assertClassBrand(sp,this,_setAttributes).call(this,e,t);if(e.children)if(1===e.children.length&&"id"in e.children[0])struct_tree_layer_builder_assertClassBrand(sp,this,_setAttributes).call(this,e.children[0],t);else for(const i of e.children)t.append(struct_tree_layer_builder_assertClassBrand(sp,this,_walk).call(this,i));return t}function text_accessibility_classPrivateFieldInitSpec(e,t,i){text_accessibility_checkPrivateRedeclaration(e,t),t.set(e,i)}function text_accessibility_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function text_accessibility_classPrivateFieldGet(e,t){return e.get(text_accessibility_assertClassBrand(e,t))}function text_accessibility_classPrivateFieldSet(e,t,i){return e.set(text_accessibility_assertClassBrand(e,t),i),i}function text_accessibility_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var np=new WeakMap,rp=new WeakMap,op=new WeakMap,lp=new WeakMap,dp=new WeakSet;class TextAccessibilityManager{constructor(){!function text_accessibility_classPrivateMethodInitSpec(e,t){text_accessibility_checkPrivateRedeclaration(e,t),t.add(e)}(this,dp);text_accessibility_classPrivateFieldInitSpec(this,np,!1);text_accessibility_classPrivateFieldInitSpec(this,rp,null);text_accessibility_classPrivateFieldInitSpec(this,op,new Map);text_accessibility_classPrivateFieldInitSpec(this,lp,new Map)}setTextMapping(e){text_accessibility_classPrivateFieldSet(rp,this,e)}enable(){if(text_accessibility_classPrivateFieldGet(np,this))throw new Error("TextAccessibilityManager is already enabled.");if(!text_accessibility_classPrivateFieldGet(rp,this))throw new Error("Text divs and strings have not been set.");text_accessibility_classPrivateFieldSet(np,this,!0);text_accessibility_classPrivateFieldSet(rp,this,text_accessibility_classPrivateFieldGet(rp,this).slice());text_accessibility_classPrivateFieldGet(rp,this).sort(_compareElementPositions);if(text_accessibility_classPrivateFieldGet(op,this).size>0){const e=text_accessibility_classPrivateFieldGet(rp,this);for(const[t,i]of text_accessibility_classPrivateFieldGet(op,this)){document.getElementById(t)?text_accessibility_assertClassBrand(dp,this,_addIdToAriaOwns).call(this,t,e[i]):text_accessibility_classPrivateFieldGet(op,this).delete(t)}}for(const[e,t]of text_accessibility_classPrivateFieldGet(lp,this))this.addPointerInTextLayer(e,t);text_accessibility_classPrivateFieldGet(lp,this).clear()}disable(){if(text_accessibility_classPrivateFieldGet(np,this)){text_accessibility_classPrivateFieldGet(lp,this).clear();text_accessibility_classPrivateFieldSet(rp,this,null);text_accessibility_classPrivateFieldSet(np,this,!1)}}removePointerInTextLayer(e){if(!text_accessibility_classPrivateFieldGet(np,this)){text_accessibility_classPrivateFieldGet(lp,this).delete(e);return}const t=text_accessibility_classPrivateFieldGet(rp,this);if(!t||0===t.length)return;const{id:i}=e,a=text_accessibility_classPrivateFieldGet(op,this).get(i);if(void 0===a)return;const s=t[a];text_accessibility_classPrivateFieldGet(op,this).delete(i);let n=s.getAttribute("aria-owns");if(n?.includes(i)){n=n.split(" ").filter((e=>e!==i)).join(" ");if(n)s.setAttribute("aria-owns",n);else{s.removeAttribute("aria-owns");s.setAttribute("role","presentation")}}}addPointerInTextLayer(e,t){const{id:i}=e;if(!i)return null;if(!text_accessibility_classPrivateFieldGet(np,this)){text_accessibility_classPrivateFieldGet(lp,this).set(e,t);return null}t&&this.removePointerInTextLayer(e);const a=text_accessibility_classPrivateFieldGet(rp,this);if(!a||0===a.length)return null;const s=binarySearchFirstItem(a,(t=>_compareElementPositions.call(TextAccessibilityManager,e,t)<0)),n=Math.max(0,s-1),r=a[n];text_accessibility_assertClassBrand(dp,this,_addIdToAriaOwns).call(this,i,r);text_accessibility_classPrivateFieldGet(op,this).set(i,n);const o=r.parentNode;return o?.classList.contains("markedContent")?o.id:null}moveElementInDOM(e,t,i,a){const s=this.addPointerInTextLayer(i,a);if(!e.hasChildNodes()){e.append(t);return s}const n=Array.from(e.childNodes).filter((e=>e!==t));if(0===n.length)return s;const r=i||t,o=binarySearchFirstItem(n,(e=>_compareElementPositions.call(TextAccessibilityManager,r,e)<0));0===o?n[0].before(t):n[o-1].after(t);return s}}function _compareElementPositions(e,t){const i=e.getBoundingClientRect(),a=t.getBoundingClientRect();if(0===i.width&&0===i.height)return 1;if(0===a.width&&0===a.height)return-1;const s=i.y,n=i.y+i.height,r=i.y+i.height/2,o=a.y,l=a.y+a.height,d=a.y+a.height/2;if(r<=o&&d>=n)return-1;if(d<=s&&r>=l)return 1;return i.x+i.width/2-(a.x+a.width/2)}function _addIdToAriaOwns(e,t){const i=t.getAttribute("aria-owns");i?.includes(e)||t.setAttribute("aria-owns",i?`${i} ${e}`:e);t.removeAttribute("role")}function text_highlighter_classPrivateFieldInitSpec(e,t,i){(function text_highlighter_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function text_highlighter_classPrivateFieldSet(e,t,i){return e.set(text_highlighter_assertClassBrand(e,t),i),i}function text_highlighter_classPrivateFieldGet(e,t){return e.get(text_highlighter_assertClassBrand(e,t))}function text_highlighter_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var cp,hp=new WeakMap;class TextHighlighter{constructor(e){let{findController:t,customFindController:i,eventBus:a,pageIndex:s}=e;text_highlighter_classPrivateFieldInitSpec(this,hp,null);this.findController=t;this.customFindController=i;this.matches=[];this.eventBus=a;this.pageIdx=s;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){this.enabled=!0;if(!text_highlighter_classPrivateFieldGet(hp,this)){text_highlighter_classPrivateFieldSet(hp,this,new AbortController);this.eventBus._on("updatetextlayermatches",(e=>{e.pageIndex!==this.pageIdx&&-1!==e.pageIndex||this._updateMatches()}),{signal:text_highlighter_classPrivateFieldGet(hp,this).signal})}this._updateMatches()}}disable(){if(this.enabled){this.enabled=!1;text_highlighter_classPrivateFieldGet(hp,this)?.abort();text_highlighter_classPrivateFieldSet(hp,this,null);this._updateMatches(!0)}}_convertMatches(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"highlight",a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:-1;if(!e)return[];const{textContentItemsStr:r}=this;let o=0,l=0;const d=r.length-1,c=[];for(let h=0,u=e.length;h<u;h++){let u=e[h];for(;o!==d&&u>=l+r[o].length;){l+=r[o].length;o++}o===r.length&&NgxConsole.error("Could not find a matching mapping");const _={begin:{divIdx:o,offset:u-l},cssClass:i,highlightAll:a,selected:s&&h===n};u+=t[h];for(;o!==d&&u>l+r[o].length;){l+=r[o].length;o++}_.end={divIdx:o,offset:u-l};c.push(_)}return c}_renderMatches(e,t){if(0===e.length)return;const{pageIdx:i}=this,{textContentItemsStr:a,textDivs:s}=this;let n=null;const r={divIdx:-1,offset:void 0};function beginText(e,t){const i=e.divIdx;s[i].textContent="";return appendTextToDiv(i,0,e.offset,t)}function appendTextToDiv(e,t,i,n){let r=s[e];if(r.nodeType===Node.TEXT_NODE){const t=document.createElement("span");r.before(t);t.append(r);s[e]=t;r=t}const o=a[e].substring(t,i),l=document.createTextNode(o);if(n){const e=document.createElement("span");e.className=`${n} appended`;e.append(l);r.append(e);if(n.includes("selected")){const{left:t}=e.getClientRects()[0];return t-r.getBoundingClientRect().left}return 0}r.append(l);return 0}let o=-1,l=-1;for(let a=0;a<e.length;a++){const d=e[a];if(!d.selected&&!d.highlightAll)continue;const c=d.begin;if(c.divIdx===o&&c.offset===l)continue;o=c.divIdx;l=c.offset;const h=d.end,u=d.selected?" selected":"";let _=0;if(n&&c.divIdx===n.divIdx)appendTextToDiv(n.divIdx,n.offset,c.offset);else{null!==n&&appendTextToDiv(n.divIdx,n.offset,r.offset);beginText(c)}if(c.divIdx===h.divIdx)_=appendTextToDiv(c.divIdx,c.offset,h.offset,d.cssClass+u);else{_=appendTextToDiv(c.divIdx,c.offset,r.offset,d.cssClass+" begin"+u);for(let e=c.divIdx+1,t=h.divIdx;e<t;e++)s[e].className=d.cssClass+" middle"+u;beginText(h,d.cssClass+" end"+u)}n=h;d.selected&&t.scrollMatchIntoView({element:s[c.divIdx],selectedLeft:_,pageIndex:i,matchIndex:a});if(this.textDivs.length>0){const e=this.textDivs[0].closest(".textLayer").querySelectorAll(`.${d.cssClass}`);this.eventBus.dispatch("renderedtextlayerhighlights",{pageIndex:i,highlights:e})}}n&&appendTextToDiv(n.divIdx,n.offset,r.offset)}_updateMatches(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.enabled&&!e)return;const{findController:t,customFindController:i,matches:a,pageIdx:s}=this,{textContentItemsStr:n,textDivs:r}=this;let o=-1;for(const e of a){for(let t=Math.max(o,e.begin.divIdx),i=e.end.divIdx;t<=i;t++){const e=r[t];e.textContent=n[t];e.className=""}o=e.end.divIdx+1}if(e)return;const l=i.pageMatches[s]||null,d=i.pageMatchesLength[s]||null,c=t.pageMatches[s]||null,h=this._convertMatches(l,d,"customHighlight",i.state?.highlightAll,s===i.selected.pageIdx,i.selected.matchIdx);this.matches=[...h];t?.highlightMatches&&!e||e||this._renderMatches(this.matches,this.customFindController);const u=t.pageMatchesLength[s]||null,_=this._convertMatches(c,u,"highlight",t.state?.highlightAll,s===t.selected.pageIdx,t.selected.matchIdx);this.matches.push(..._);this.matches.sort(((e,t)=>{const i=e.begin.divIdx-t.begin.divIdx;return 0===i?e.begin.offset-t.begin.offset:i}));this._renderMatches(this.matches,this.findController)}}function text_layer_builder_classPrivateFieldInitSpec(e,t,i){text_layer_builder_checkPrivateRedeclaration(e,t),t.set(e,i)}function text_layer_builder_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function text_layer_builder_classPrivateFieldGet(e,t){return e.get(text_layer_builder_assertClassBrand(e,t))}function text_layer_builder_classPrivateFieldSet(e,t,i){return e.set(text_layer_builder_assertClassBrand(e,t),i),i}function text_layer_builder_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var up=new WeakMap,_p=new WeakMap,pp=new WeakMap,gp=new WeakMap,fp=new WeakSet;class TextLayerBuilder{constructor(e){let{pdfPage:t,highlighter:i=null,accessibilityManager:a=null,enablePermissions:s=!1,onAppend:n=null}=e;!function text_layer_builder_classPrivateMethodInitSpec(e,t){text_layer_builder_checkPrivateRedeclaration(e,t),t.add(e)}(this,fp);text_layer_builder_classPrivateFieldInitSpec(this,up,!1);text_layer_builder_classPrivateFieldInitSpec(this,_p,null);text_layer_builder_classPrivateFieldInitSpec(this,pp,!1);text_layer_builder_classPrivateFieldInitSpec(this,gp,null);this.pdfPage=t;this.highlighter=i;this.accessibilityManager=a;text_layer_builder_classPrivateFieldSet(up,this,!0===s);text_layer_builder_classPrivateFieldSet(_p,this,n);this.div=document.createElement("div");this.div.tabIndex=0;this.div.className="textLayer"}async render(e){let{viewport:t,textContentParams:i=null}=e;if(text_layer_builder_classPrivateFieldGet(pp,this)&&text_layer_builder_classPrivateFieldGet(gp,this)){text_layer_builder_classPrivateFieldGet(gp,this).update({viewport:t,onBefore:this.hide.bind(this)});this.show();return}this.cancel();text_layer_builder_classPrivateFieldSet(gp,this,new TextLayer({textContentSource:this.pdfPage.streamTextContent(i||{includeMarkedContent:!0,disableNormalization:!0}),container:this.div,viewport:t}));const{textDivs:a,textContentItemsStr:s}=text_layer_builder_classPrivateFieldGet(gp,this);this.highlighter?.setTextMapping(a,s);this.accessibilityManager?.setTextMapping(a);await text_layer_builder_classPrivateFieldGet(gp,this).render();text_layer_builder_classPrivateFieldSet(pp,this,!0);const n=document.createElement("div");n.className="endOfContent";this.div.append(n);text_layer_builder_assertClassBrand(fp,this,_bindMouse).call(this,n);text_layer_builder_classPrivateFieldGet(_p,this)?.call(this,this.div);this.highlighter?.enable();this.accessibilityManager?.enable()}hide(){if(!this.div.hidden&&text_layer_builder_classPrivateFieldGet(pp,this)){this.highlighter?.disable();this.div.hidden=!0}}show(){if(this.div.hidden&&text_layer_builder_classPrivateFieldGet(pp,this)){this.div.hidden=!1;this.highlighter?.enable()}}cancel(){text_layer_builder_classPrivateFieldGet(gp,this)?.cancel();text_layer_builder_classPrivateFieldSet(gp,this,null);this.highlighter?.disable();this.accessibilityManager?.disable();_removeGlobalSelectionListener.call(TextLayerBuilder,this.div)}}cp=TextLayerBuilder;function _bindMouse(e){const{div:t}=this;t.addEventListener("mousedown",(()=>{t.classList.add("selecting")}));t.addEventListener("copy",(e=>{if(!text_layer_builder_classPrivateFieldGet(up,this)){const t=document.getSelection();e.clipboardData.setData("text/plain",removeNullCharacters(normalizeUnicode(t.toString())))}stopEvent(e)}));vp._.set(t,e);_enableGlobalSelectionListener.call(cp)}function _removeGlobalSelectionListener(e){text_layer_builder_assertClassBrand(cp,this,vp)._.delete(e);if(0===text_layer_builder_assertClassBrand(cp,this,vp)._.size){text_layer_builder_assertClassBrand(cp,this,mp)._?.abort();mp._=text_layer_builder_assertClassBrand(cp,this,null)}}function _enableGlobalSelectionListener(){if(text_layer_builder_assertClassBrand(cp,this,mp)._)return;mp._=text_layer_builder_assertClassBrand(cp,this,new AbortController);const{signal:e}=text_layer_builder_assertClassBrand(cp,this,mp)._,reset=(e,t)=>{t.append(e);e.style.width="";e.style.height="";t.classList.remove("selecting")};let t=!1;document.addEventListener("pointerdown",(()=>{t=!0}),{signal:e});document.addEventListener("pointerup",(()=>{t=!1;text_layer_builder_assertClassBrand(cp,this,vp)._.forEach(reset)}),{signal:e});window.addEventListener("blur",(()=>{t=!1;text_layer_builder_assertClassBrand(cp,this,vp)._.forEach(reset)}),{signal:e});document.addEventListener("keyup",(()=>{t||text_layer_builder_assertClassBrand(cp,this,vp)._.forEach(reset)}),{signal:e});var i,a;document.addEventListener("selectionchange",(()=>{const e=document.getSelection();if(0===e.rangeCount){text_layer_builder_assertClassBrand(cp,this,vp)._.forEach(reset);return}if(0===text_layer_builder_assertClassBrand(cp,this,vp)._.size)return;const t=new Set;for(let i=0;i<e.rangeCount;i++){const a=e.getRangeAt(i);for(const e of text_layer_builder_assertClassBrand(cp,this,vp)._.keys())!t.has(e)&&a.intersectsNode(e)&&t.add(e)}for(const[e,i]of text_layer_builder_assertClassBrand(cp,this,vp)._)t.has(e)?e.classList.add("selecting"):reset(i,e);i??="none"===getComputedStyle(text_layer_builder_assertClassBrand(cp,this,vp)._.values().next().value).getPropertyValue("-moz-user-select");if(i)return;const s=e.getRangeAt(0),n=a&&(0===s.compareBoundaryPoints(Range.END_TO_END,a)||0===s.compareBoundaryPoints(Range.START_TO_END,a));let r=n?s.startContainer:s.endContainer;r.nodeType===Node.TEXT_NODE&&(r=r.parentNode);if(!n&&0===s.endOffset)do{for(;!r.previousSibling;)r=r.parentNode;r=r.previousSibling}while(!r.childNodes.length);const o=r.parentElement?.closest(".textLayer"),l=text_layer_builder_assertClassBrand(cp,this,vp)._.get(o);if(l){l.style.width=o.style.width;l.style.height=o.style.height;r.parentElement.insertBefore(l,n?r:r.nextSibling)}a=s.cloneRange()}),{signal:e})}var vp={_:new Map},mp={_:null};function pdf_page_view_classPrivateFieldInitSpec(e,t,i){pdf_page_view_checkPrivateRedeclaration(e,t),t.set(e,i)}function pdf_page_view_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_page_view_classPrivateFieldGet(e,t){return e.get(pdf_page_view_assertClassBrand(e,t))}function pdf_page_view_classPrivateFieldSet(e,t,i){return e.set(pdf_page_view_assertClassBrand(e,t),i),i}function pdf_page_view_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const wp=new Map([["canvasWrapper",0],["textLayer",1],["annotationLayer",2],["annotationEditorLayer",3],["xfaLayer",3]]);var Pp=new WeakMap,yp=new WeakMap,Fp=new WeakMap,bp=new WeakMap,Sp=new WeakMap,xp=new WeakMap,Cp=new WeakMap,Ap=new WeakMap,Ep=new WeakMap,kp=new WeakMap,Ip=new WeakMap,Mp=new WeakMap,Bp=new WeakMap,Gp=new WeakMap,Tp=new WeakMap,Dp=new WeakSet;class PDFPageView extends BasePDFPageView{constructor(e){super(e);!function pdf_page_view_classPrivateMethodInitSpec(e,t){pdf_page_view_checkPrivateRedeclaration(e,t),t.add(e)}(this,Dp);pdf_page_view_classPrivateFieldInitSpec(this,Pp,p.ENABLE_FORMS);pdf_page_view_classPrivateFieldInitSpec(this,yp,null);pdf_page_view_classPrivateFieldInitSpec(this,Fp,!0);pdf_page_view_classPrivateFieldInitSpec(this,bp,!1);pdf_page_view_classPrivateFieldInitSpec(this,Sp,!1);pdf_page_view_classPrivateFieldInitSpec(this,xp,null);pdf_page_view_classPrivateFieldInitSpec(this,Cp,!1);pdf_page_view_classPrivateFieldInitSpec(this,Ap,null);pdf_page_view_classPrivateFieldInitSpec(this,Ep,null);pdf_page_view_classPrivateFieldInitSpec(this,kp,1);pdf_page_view_classPrivateFieldInitSpec(this,Ip,1);pdf_page_view_classPrivateFieldInitSpec(this,Mp,Vl);pdf_page_view_classPrivateFieldInitSpec(this,Bp,1);pdf_page_view_classPrivateFieldInitSpec(this,Gp,{directDrawing:!0,initialOptionalContent:!0,regularAnnotations:!0});pdf_page_view_classPrivateFieldInitSpec(this,Tp,[null,null,null,null]);const t=e.container,i=e.defaultViewport;this.renderingId="page"+this.id;pdf_page_view_classPrivateFieldSet(xp,this,e.layerProperties||null);this.pdfPage=null;this.pageLabel=null;this.rotation=0;this.scale=e.scale||1;this.viewport=i;this.pdfPageRotate=i.rotation;this._optionalContentConfigPromise=e.optionalContentConfigPromise||null;pdf_page_view_classPrivateFieldSet(Mp,this,e.textLayerMode??Vl);pdf_page_view_classPrivateFieldSet(Pp,this,e.annotationMode??p.ENABLE_FORMS);this.imageResourcesPath=e.imageResourcesPath||"";this.enableDetailCanvas=e.enableDetailCanvas??!0;this.maxCanvasPixels=e.maxCanvasPixels??AppOptions.get("maxCanvasPixels");this.maxCanvasDim=e.maxCanvasDim||AppOptions.get("maxCanvasDim");this.capCanvasAreaFactor=e.capCanvasAreaFactor??AppOptions.get("capCanvasAreaFactor");pdf_page_view_classPrivateFieldSet(Fp,this,!1!==e.enableAutoLinking);this.l10n=e.l10n;this.l10n||=new genericl10n_GenericL10n;this._isStandalone=!this.renderingQueue?.hasViewer();this._container=t;this._annotationCanvasMap=null;this.annotationLayer=null;this.annotationEditorLayer=null;this.textLayer=null;this.xfaLayer=null;this.structTreeLayer=null;this.drawLayer=null;this.detailView=null;const a=document.createElement("div");a.className="page";a.setAttribute("data-page-number",this.id);a.setAttribute("role","region");a.setAttribute("data-l10n-id","pdfjs-page-landmark");a.setAttribute("data-l10n-args",JSON.stringify({page:this.id}));this.div=a;pdf_page_view_assertClassBrand(Dp,this,_setDimensions).call(this);t?.append(a);if(this._isStandalone){t?.style.setProperty("--scale-factor",this.scale*PixelsPerInch.PDF_TO_CSS_UNITS);this.pageColors?.background&&t?.style.setProperty("--page-bg-color",this.pageColors.background);const{optionalContentConfigPromise:i}=e;i&&i.then((e=>{i===this._optionalContentConfigPromise&&(pdf_page_view_classPrivateFieldGet(Gp,this).initialOptionalContent=e.hasInitialVisibility)}));e.l10n||this.l10n.translate(this.div)}}setPdfPage(e){if(this._isStandalone&&("CanvasText"===this.pageColors?.foreground||"Canvas"===this.pageColors?.background)){this._container?.style.setProperty("--hcm-highlight-filter",e.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight"));this._container?.style.setProperty("--hcm-highlight-selected-filter",e.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","Highlight"))}this.pdfPage=e;this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:this.scale*PixelsPerInch.PDF_TO_CSS_UNITS,rotation:t});pdf_page_view_assertClassBrand(Dp,this,_setDimensions).call(this);this.reset()}destroy(){this.reset();this.pdfPage?.cleanup()}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}get _textHighlighter(){return shadow(this,"_textHighlighter",new TextHighlighter({pageIndex:this.id-1,eventBus:this.eventBus,findController:pdf_page_view_classPrivateFieldGet(xp,this).findController,customFindController:pdf_page_view_classPrivateFieldGet(xp,this).customFindController}))}_resetCanvas(){super._resetCanvas();pdf_page_view_classPrivateFieldSet(Ap,this,null)}reset(){let{keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:i=!1,keepTextLayer:a=!1,keepCanvasWrapper:s=!1,preserveDetailViewState:n=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.cancelRendering({keepAnnotationLayer:e,keepAnnotationEditorLayer:t,keepXfaLayer:i,keepTextLayer:a});this.renderingState=Il.INITIAL;const r=this.div,o=r.childNodes,l=e&&this.annotationLayer?.div||null,d=t&&this.annotationEditorLayer?.div||null,c=i&&this.xfaLayer?.div||null,h=a&&this.textLayer?.div||null,u=s&&pdf_page_view_classPrivateFieldGet(yp,this)||null;for(let e=o.length-1;e>=0;e--){const t=o[e];switch(t){case l:case d:case c:case h:case u:continue}t.remove();const i=pdf_page_view_classPrivateFieldGet(Tp,this).indexOf(t);i>=0&&(pdf_page_view_classPrivateFieldGet(Tp,this)[i]=null)}r.removeAttribute("data-loaded");l&&this.annotationLayer.hide();d&&this.annotationEditorLayer.hide();c&&this.xfaLayer.hide();h&&this.textLayer.hide();this.structTreeLayer?.hide();if(!s&&pdf_page_view_classPrivateFieldGet(yp,this)){pdf_page_view_classPrivateFieldSet(yp,this,null);this._resetCanvas()}if(!n){this.detailView?.reset({keepCanvas:s});s||(this.detailView=null)}}toggleEditingMode(e){pdf_page_view_classPrivateFieldSet(Sp,this,e);this.hasEditableAnnotations()&&this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0})}updateVisibleArea(e){if(this.enableDetailCanvas)if(pdf_page_view_classPrivateFieldGet(Cp,this)&&this.maxCanvasPixels>0&&e){this.detailView??=new PDFPageDetailView({pageView:this});this.detailView.update({visibleArea:e})}else if(this.detailView){this.detailView.reset();this.detailView=null}}update(e){let{scale:t=0,rotation:i=null,optionalContentConfigPromise:a=null,drawingDelay:s=-1}=e;this.scale=t||this.scale;"number"==typeof i&&(this.rotation=i);if(a instanceof Promise){this._optionalContentConfigPromise=a;a.then((e=>{a===this._optionalContentConfigPromise&&(pdf_page_view_classPrivateFieldGet(Gp,this).initialOptionalContent=e.hasInitialVisibility)}))}pdf_page_view_classPrivateFieldGet(Gp,this).directDrawing=!0;const n=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:this.scale*PixelsPerInch.PDF_TO_CSS_UNITS,rotation:n});pdf_page_view_assertClassBrand(Dp,this,_setDimensions).call(this);this._isStandalone&&this._container?.style.setProperty("--scale-factor",this.viewport.scale);pdf_page_view_assertClassBrand(Dp,this,_computeScale).call(this);if(this.canvas){const e=pdf_page_view_classPrivateFieldGet(bp,this)&&pdf_page_view_classPrivateFieldGet(Cp,this),t=s>=0&&s<1e3;if(t||e){if(t&&!e&&this.renderingState!==Il.FINISHED){this.cancelRendering({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:s});this.renderingState=Il.FINISHED;pdf_page_view_classPrivateFieldGet(Gp,this).directDrawing=!1}this.cssTransform({redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!t,hideTextLayer:t});if(!t){this.detailView?.update({underlyingViewUpdated:!0});this.dispatchPageRendered(!0,!1)}return}}this.cssTransform({});this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0,preserveDetailViewState:!0});this.detailView?.update({underlyingViewUpdated:!0})}cancelRendering(){let{keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:i=!1,keepTextLayer:a=!1,cancelExtraDelay:s=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super.cancelRendering({cancelExtraDelay:s});if(this.textLayer&&(!a||!this.textLayer.div)){this.textLayer.cancel();this.textLayer=null}if(this.annotationLayer&&(!e||!this.annotationLayer.div)){this.annotationLayer.cancel();this.annotationLayer=null;this._annotationCanvasMap=null}this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null);if(this.annotationEditorLayer&&(!t||!this.annotationEditorLayer.div)){if(this.drawLayer){this.drawLayer.cancel();this.drawLayer=null}this.annotationEditorLayer.cancel();this.annotationEditorLayer=null}if(this.xfaLayer&&(!i||!this.xfaLayer.div)){this.xfaLayer.cancel();this.xfaLayer=null;this._textHighlighter?.disable()}}cssTransform(e){let{redrawAnnotationLayer:t=!1,redrawAnnotationEditorLayer:i=!1,redrawXfaLayer:a=!1,redrawTextLayer:s=!1,hideTextLayer:n=!1}=e;const{canvas:r}=this;if(!r)return;const o=pdf_page_view_classPrivateFieldGet(Ap,this);if(this.viewport!==o){const e=(360+this.viewport.rotation-o.rotation)%360;if(90===e||270===e){const{width:t,height:i}=this.viewport,a=i/t,s=t/i;r.style.transform=`rotate(${e}deg) scale(${a},${s})`}else r.style.transform=0===e?"":`rotate(${e}deg)`}t&&this.annotationLayer&&pdf_page_view_assertClassBrand(Dp,this,_renderAnnotationLayer).call(this);if(i&&this.annotationEditorLayer){this.drawLayer&&pdf_page_view_assertClassBrand(Dp,this,_renderDrawLayer).call(this);pdf_page_view_assertClassBrand(Dp,this,_renderAnnotationEditorLayer).call(this)}a&&this.xfaLayer&&pdf_page_view_assertClassBrand(Dp,this,_renderXfaLayer).call(this);if(this.textLayer)if(n){this.textLayer.hide();this.structTreeLayer?.hide()}else s&&pdf_page_view_assertClassBrand(Dp,this,_renderTextLayer).call(this)}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}_ensureCanvasWrapper(){let e=pdf_page_view_classPrivateFieldGet(yp,this);if(!e){e=pdf_page_view_classPrivateFieldSet(yp,this,document.createElement("div"));e.classList.add("canvasWrapper");pdf_page_view_assertClassBrand(Dp,this,_addLayer).call(this,e,"canvasWrapper")}return e}_getRenderingContext(e,t){const i=AppOptions.get("pdfBackgroundColor");return{canvas:e,transform:t,viewport:this.viewport,annotationMode:pdf_page_view_classPrivateFieldGet(Pp,this),optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:this.pageColors,isEditing:pdf_page_view_classPrivateFieldGet(Sp,this),background:i||null}}async draw(){if(this.renderingState!==Il.INITIAL){NgxConsole.error("Must be in new state before drawing");this.reset()}const{div:e,l10n:t,pdfPage:i,viewport:a}=this;if(!i){this.renderingState=Il.FINISHED;throw new Error("pdfPage is not loaded")}this.renderingState=Il.RUNNING;const s=this._ensureCanvasWrapper();if(!this.textLayer&&pdf_page_view_classPrivateFieldGet(Mp,this)!==jl&&!i.isPureXfa){this._accessibilityManager||=new TextAccessibilityManager;this.textLayer=new TextLayerBuilder({pdfPage:i,highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,enablePermissions:pdf_page_view_classPrivateFieldGet(Mp,this)===Hl,onAppend:e=>{this.l10n.pause();pdf_page_view_assertClassBrand(Dp,this,_addLayer).call(this,e,"textLayer");this.l10n.resume()}})}if(!this.annotationLayer&&pdf_page_view_classPrivateFieldGet(Pp,this)!==p.DISABLE){const{annotationStorage:e,annotationEditorUIManager:t,downloadManager:a,enableScripting:s,fieldObjectsPromise:n,hasJSActionsPromise:r,linkService:o}=pdf_page_view_classPrivateFieldGet(xp,this);this._annotationCanvasMap||=new Map;this.annotationLayer=new AnnotationLayerBuilder({pdfPage:i,annotationStorage:e,imageResourcesPath:this.imageResourcesPath,renderForms:pdf_page_view_classPrivateFieldGet(Pp,this)===p.ENABLE_FORMS,linkService:o,downloadManager:a,enableScripting:s,hasJSActionsPromise:r,fieldObjectsPromise:n,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager,annotationEditorUIManager:t,onAppend:e=>{pdf_page_view_assertClassBrand(Dp,this,_addLayer).call(this,e,"annotationLayer")}})}const{width:n,height:r}=a;pdf_page_view_classPrivateFieldSet(Ap,this,a);const{canvas:o,prevCanvas:l}=this._createCanvas((e=>{s.prepend(e)}));o.setAttribute("role","presentation");this.outputScale||pdf_page_view_assertClassBrand(Dp,this,_computeScale).call(this);const{outputScale:d}=this;pdf_page_view_classPrivateFieldSet(bp,this,pdf_page_view_classPrivateFieldGet(Cp,this));const c=approximateFraction(d.sx),h=approximateFraction(d.sy);let u=floorToDivide(n*d.sx,c[0]),_=floorToDivide(r*d.sy,h[0]);const g=await MaxCanvasSize.reduceToMaxCanvasSize(u,_);if(g>1){u/=g;u*=.95;_/=g;_*=.95;const e=Math.round(100*(g/.95-1));warn(`Page ${this.id}: Reduced the maximum resolution by ${e}% because the browser can't render larger canvases.`)}o.width=u;o.height=_;const f=floorToDivide(id(n),c[1]),v=floorToDivide(id(r),h[1]);d.sx=u/f;d.sy=_/v;if(pdf_page_view_classPrivateFieldGet(kp,this)!==c[1]){e.style.setProperty("--scale-round-x",`${c[1]}px`);pdf_page_view_classPrivateFieldSet(kp,this,c[1])}if(pdf_page_view_classPrivateFieldGet(Ip,this)!==h[1]){e.style.setProperty("--scale-round-y",`${h[1]}px`);pdf_page_view_classPrivateFieldSet(Ip,this,h[1])}const m=d.scaled?[d.sx,0,0,d.sy,0,0]:null,w=this._drawCanvas(this._getRenderingContext(o,m),(()=>{l?.remove();this._resetCanvas()}),(e=>{pdf_page_view_classPrivateFieldGet(Gp,this).regularAnnotations=!e.separateAnnots;this.dispatchPageRendered(!1,!1)})).then((async()=>{this.structTreeLayer||=new StructTreeLayerBuilder(i,a.rawDims);const e=pdf_page_view_assertClassBrand(Dp,this,_renderTextLayer).call(this);if(this.annotationLayer){await pdf_page_view_assertClassBrand(Dp,this,_renderAnnotationLayer).call(this);pdf_page_view_classPrivateFieldGet(Fp,this)&&this.annotationLayer&&this.textLayer&&await pdf_page_view_assertClassBrand(Dp,this,_injectLinkAnnotations).call(this,e)}const{annotationEditorUIManager:n}=pdf_page_view_classPrivateFieldGet(xp,this);if(n){this.drawLayer||=new DrawLayerBuilder({pageIndex:this.id});await pdf_page_view_assertClassBrand(Dp,this,_renderDrawLayer).call(this);this.drawLayer.setParent(s);this.annotationEditorLayer||=new AnnotationEditorLayerBuilder({uiManager:n,pdfPage:i,l10n:t,structTreeLayer:this.structTreeLayer,accessibilityManager:this._accessibilityManager,annotationLayer:this.annotationLayer?.annotationLayer,textLayer:this.textLayer,drawLayer:this.drawLayer.getDrawLayer(),onAppend:e=>{pdf_page_view_assertClassBrand(Dp,this,_addLayer).call(this,e,"annotationEditorLayer")},eventBus:this.eventBus});pdf_page_view_assertClassBrand(Dp,this,_renderAnnotationEditorLayer).call(this)}}));if(i.isPureXfa){if(!this.xfaLayer){const{annotationStorage:e,linkService:t}=pdf_page_view_classPrivateFieldGet(xp,this);this.xfaLayer=new XfaLayerBuilder({pdfPage:i,annotationStorage:e,linkService:t})}pdf_page_view_assertClassBrand(Dp,this,_renderXfaLayer).call(this)}e.setAttribute("data-loaded",!0);this.dispatchPageRender();return w}setPageLabel(e){this.pageLabel="string"==typeof e?e:null;this.div.setAttribute("data-l10n-args",JSON.stringify({page:this.pageLabel??this.id}));null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){const{directDrawing:e,initialOptionalContent:t,regularAnnotations:i}=pdf_page_view_classPrivateFieldGet(Gp,this);return e&&t&&i?this.canvas:null}}function _addLayer(e,t){const i=wp.get(t),a=pdf_page_view_classPrivateFieldGet(Tp,this)[i];pdf_page_view_classPrivateFieldGet(Tp,this)[i]=e;if(a)a.replaceWith(e);else{for(let t=i-1;t>=0;t--){const i=pdf_page_view_classPrivateFieldGet(Tp,this)[t];if(i){i.after(e);return}}this.div.prepend(e)}}function _setDimensions(){const{div:e,viewport:t}=this;if(t.userUnit!==pdf_page_view_classPrivateFieldGet(Bp,this)){1!==t.userUnit?e.style.setProperty("--user-unit",t.userUnit):e.style.removeProperty("--user-unit");pdf_page_view_classPrivateFieldSet(Bp,this,t.userUnit)}if(this.pdfPage){if(pdf_page_view_classPrivateFieldGet(Ep,this)===t.rotation)return;pdf_page_view_classPrivateFieldSet(Ep,this,t.rotation)}setLayerDimensions(e,t,!0,!1)}function _dispatchLayerRendered(e,t,i){this.eventBus.dispatch(e,{source:this,pageNumber:this.id,error:t,layer:i})}async function _renderAnnotationLayer(){let e=null;try{await this.annotationLayer.render({viewport:this.viewport,intent:"display",structTreeLayer:this.structTreeLayer})}catch(t){console.error("#renderAnnotationLayer:",t);e=t}finally{pdf_page_view_assertClassBrand(Dp,this,_dispatchLayerRendered).call(this,"annotationlayerrendered",e,this.annotationLayer)}}async function _renderAnnotationEditorLayer(){let e=null;try{await this.annotationEditorLayer.render({viewport:this.viewport,intent:"display"})}catch(t){console.error("#renderAnnotationEditorLayer:",t);e=t}finally{pdf_page_view_assertClassBrand(Dp,this,_dispatchLayerRendered).call(this,"annotationeditorlayerrendered",e,this.annotationEditorLayer)}}async function _renderDrawLayer(){try{await this.drawLayer.render({intent:"display"})}catch(e){console.error("#renderDrawLayer:",e)}}async function _renderXfaLayer(){let e=null;try{const e=await this.xfaLayer.render({viewport:this.viewport,intent:"display"});e?.textDivs&&this._textHighlighter&&pdf_page_view_assertClassBrand(Dp,this,_buildXfaTextContentItems).call(this,e.textDivs)}catch(t){console.error("#renderXfaLayer:",t);e=t}finally{if(this.xfaLayer?.div){this.l10n.pause();pdf_page_view_assertClassBrand(Dp,this,_addLayer).call(this,this.xfaLayer.div,"xfaLayer");this.l10n.resume()}pdf_page_view_assertClassBrand(Dp,this,_dispatchLayerRendered).call(this,"xfalayerrendered",e,this.xfaLayer)}}async function _renderTextLayer(){if(!this.textLayer)return;let e=null;try{await this.textLayer.render({viewport:this.viewport})}catch(t){if(t instanceof AbortException)return;console.error("#renderTextLayer:",t);e=t}pdf_page_view_assertClassBrand(Dp,this,_dispatchLayerRendered).call(this,"textlayerrendered",e,this.textLayer);pdf_page_view_assertClassBrand(Dp,this,_renderStructTreeLayer).call(this)}async function _renderStructTreeLayer(){if(!this.textLayer)return;const e=await(this.structTreeLayer?.render());if(e){this.l10n.pause();this.structTreeLayer?.addElementsToTextLayer();this.canvas&&e.parentNode!==this.canvas&&this.canvas.append(e);this.l10n.resume()}this.structTreeLayer?.show()}async function _buildXfaTextContentItems(e){const t=await this.pdfPage.getTextContent(),i=[];for(const e of t.items)i.push(e.str);this._textHighlighter.setTextMapping(e,i);this._textHighlighter.enable()}async function _injectLinkAnnotations(e){let t=null;try{await e;if(!this.annotationLayer)return;await this.annotationLayer.injectLinkAnnotations({inferredLinks:Autolinker.processLinks(this),viewport:this.viewport,structTreeLayer:this.structTreeLayer})}catch(e){console.error("#injectLinkAnnotations:",e);t=e}}function _computeScale(){const{width:e,height:t}=this.viewport,i=this.outputScale=new OutputScale;if(0===this.maxCanvasPixels){const e=1/this.scale;i.sx*=e;i.sy*=e;pdf_page_view_classPrivateFieldSet(Cp,this,!0)}else pdf_page_view_classPrivateFieldSet(Cp,this,i.limitCanvas(e,t,this.maxCanvasPixels,this.maxCanvasDim,this.capCanvasAreaFactor))}function pdf_viewer_classPrivateMethodInitSpec(e,t){pdf_viewer_checkPrivateRedeclaration(e,t),t.add(e)}function pdf_viewer_classPrivateFieldInitSpec(e,t,i){pdf_viewer_checkPrivateRedeclaration(e,t),t.set(e,i)}function pdf_viewer_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_viewer_classPrivateFieldGet(e,t){return e.get(pdf_viewer_assertClassBrand(e,t))}function pdf_viewer_classPrivateFieldSet(e,t,i){return e.set(pdf_viewer_assertClassBrand(e,t),i),i}function pdf_viewer_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Lp=1e4,Rp=5e3,Np=250;function isValidAnnotationEditorMode(e){return Object.values(f).includes(e)&&e!==f.DISABLE}var Op=new WeakMap,Wp=new WeakMap,jp=new WeakSet;class PDFPageViewBuffer{constructor(e){pdf_viewer_classPrivateMethodInitSpec(this,jp);pdf_viewer_classPrivateFieldInitSpec(this,Op,new Set);pdf_viewer_classPrivateFieldInitSpec(this,Wp,0);pdf_viewer_classPrivateFieldSet(Wp,this,e)}push(e){const t=pdf_viewer_classPrivateFieldGet(Op,this);t.has(e)&&t.delete(e);t.add(e);t.size>pdf_viewer_classPrivateFieldGet(Wp,this)&&pdf_viewer_assertClassBrand(jp,this,_destroyFirstView).call(this)}resize(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;pdf_viewer_classPrivateFieldSet(Wp,this,e);const i=pdf_viewer_classPrivateFieldGet(Op,this);if(t){const e=i.size;let a=1;for(const s of i){if(t.has(s.id)){i.delete(s);i.add(s)}if(++a>e)break}}for(;i.size>pdf_viewer_classPrivateFieldGet(Wp,this);)pdf_viewer_assertClassBrand(jp,this,_destroyFirstView).call(this)}has(e){return pdf_viewer_classPrivateFieldGet(Op,this).has(e)}[Symbol.iterator](){return pdf_viewer_classPrivateFieldGet(Op,this).keys()}}function _destroyFirstView(){const e=pdf_viewer_classPrivateFieldGet(Op,this).keys().next().value;e?.destroy();pdf_viewer_classPrivateFieldGet(Op,this).delete(e)}var Vp=new WeakMap,Hp=new WeakMap,zp=new WeakMap,Up=new WeakMap,$p=new WeakMap,qp=new WeakMap,Xp=new WeakMap,Kp=new WeakMap,Yp=new WeakMap,Zp=new WeakMap,Qp=new WeakMap,Jp=new WeakMap,eg=new WeakMap,tg=new WeakMap,ig=new WeakMap,ag=new WeakMap,sg=new WeakMap,ng=new WeakMap,rg=new WeakMap,og=new WeakMap,lg=new WeakMap,dg=new WeakMap,cg=new WeakMap,hg=new WeakMap,ug=new WeakMap,_g=new WeakMap,pg=new WeakMap,gg=new WeakMap,fg=new WeakMap,vg=new WeakMap,mg=new WeakMap,wg=new WeakMap,Pg=new WeakMap,yg=new WeakMap,Fg=new WeakMap,bg=new WeakMap,Sg=new WeakSet;class PDFViewer{constructor(e){pdf_viewer_classPrivateMethodInitSpec(this,Sg);pdf_viewer_classPrivateFieldInitSpec(this,Vp,null);pdf_viewer_classPrivateFieldInitSpec(this,Hp,null);pdf_viewer_classPrivateFieldInitSpec(this,zp,null);pdf_viewer_classPrivateFieldInitSpec(this,Up,f.NONE);pdf_viewer_classPrivateFieldInitSpec(this,$p,null);pdf_viewer_classPrivateFieldInitSpec(this,qp,p.ENABLE_FORMS);pdf_viewer_classPrivateFieldInitSpec(this,Xp,null);pdf_viewer_classPrivateFieldInitSpec(this,Kp,null);pdf_viewer_classPrivateFieldInitSpec(this,Yp,null);pdf_viewer_classPrivateFieldInitSpec(this,Zp,!1);pdf_viewer_classPrivateFieldInitSpec(this,Qp,!1);pdf_viewer_classPrivateFieldInitSpec(this,Jp,!1);pdf_viewer_classPrivateFieldInitSpec(this,eg,!1);pdf_viewer_classPrivateFieldInitSpec(this,tg,!1);pdf_viewer_classPrivateFieldInitSpec(this,ig,!0);pdf_viewer_classPrivateFieldInitSpec(this,ag,null);pdf_viewer_classPrivateFieldInitSpec(this,sg,0);pdf_viewer_classPrivateFieldInitSpec(this,ng,null);pdf_viewer_classPrivateFieldInitSpec(this,rg,null);pdf_viewer_classPrivateFieldInitSpec(this,og,null);pdf_viewer_classPrivateFieldInitSpec(this,lg,null);pdf_viewer_classPrivateFieldInitSpec(this,dg,!1);pdf_viewer_classPrivateFieldInitSpec(this,cg,null);pdf_viewer_classPrivateFieldInitSpec(this,hg,!1);pdf_viewer_classPrivateFieldInitSpec(this,ug,0);pdf_viewer_classPrivateFieldInitSpec(this,_g,new ResizeObserver(pdf_viewer_assertClassBrand(Sg,this,pdf_viewer_resizeObserverCallback).bind(this)));pdf_viewer_classPrivateFieldInitSpec(this,pg,null);pdf_viewer_classPrivateFieldInitSpec(this,gg,null);pdf_viewer_classPrivateFieldInitSpec(this,fg,null);pdf_viewer_classPrivateFieldInitSpec(this,vg,!0);pdf_viewer_classPrivateFieldInitSpec(this,mg,Vl);pdf_viewer_classPrivateFieldInitSpec(this,wg,void 0);pdf_viewer_classPrivateFieldInitSpec(this,Pg,"multiple");pdf_viewer_classPrivateFieldInitSpec(this,yg,10);pdf_viewer_classPrivateFieldInitSpec(this,Fg,kl);pdf_viewer_classPrivateFieldInitSpec(this,bg,null);0;this.container=e.container;this.viewer=e.viewer||e.container.firstElementChild;pdf_viewer_classPrivateFieldSet(bg,this,e.viewerAlert||null);this.eventBus=e.eventBus;this.pageViewMode=e.pageViewMode||"multiple";this.defaultCacheSize=e.defaultCacheSize;pdf_viewer_classPrivateFieldSet(yg,this,e.maxZoom);pdf_viewer_classPrivateFieldSet(Fg,this,e.minZoom);if("DIV"!==this.container?.tagName||"DIV"!==this.viewer?.tagName)throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&"absolute"!==getComputedStyle(this.container).position)throw new Error("The `container` must be absolutely positioned.");pdf_viewer_classPrivateFieldGet(_g,this).observe(this.container);this.linkService=e.linkService||new SimpleLinkService;this.downloadManager=e.downloadManager||null;this.findController=e.findController||null;this.customFindController=e.customFindController||null;pdf_viewer_classPrivateFieldSet(Hp,this,e.altTextManager||null);pdf_viewer_classPrivateFieldSet(Xp,this,e.commentManager||null);pdf_viewer_classPrivateFieldSet(fg,this,e.signatureManager||null);pdf_viewer_classPrivateFieldSet(Yp,this,e.editorUndoBar||null);this.findController&&(this.findController.onIsPageVisible=e=>this._getVisiblePages().ids.has(e));this._scriptingManager=e.scriptingManager||null;pdf_viewer_classPrivateFieldSet(mg,this,e.textLayerMode??Vl);pdf_viewer_classPrivateFieldSet(qp,this,e.annotationMode??p.ENABLE_FORMS);pdf_viewer_classPrivateFieldSet(Up,this,e.annotationEditorMode??f.NONE);pdf_viewer_classPrivateFieldSet(zp,this,e.annotationEditorHighlightColors||null);pdf_viewer_classPrivateFieldSet(Qp,this,!0===e.enableHighlightFloatingButton);pdf_viewer_classPrivateFieldSet(eg,this,!0===e.enableUpdatedAddImage);pdf_viewer_classPrivateFieldSet(tg,this,!0===e.enableNewAltTextWhenAddingImage);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.l10n=e.l10n;this.l10n||=new genericl10n_GenericL10n;pdf_viewer_classPrivateFieldSet(Jp,this,e.enablePermissions||!1);this.pageColors=e.pageColors||null;pdf_viewer_classPrivateFieldSet(ng,this,e.mlManager||null);pdf_viewer_classPrivateFieldSet(Zp,this,e.enableHWA||!1);pdf_viewer_classPrivateFieldSet(vg,this,!1!==e.supportsPinchToZoom);pdf_viewer_classPrivateFieldSet(ig,this,!1!==e.enableAutoLinking);pdf_viewer_classPrivateFieldSet(sg,this,e.minDurationToUpdateCanvas??500);this.defaultRenderingQueue=!e.renderingQueue;if(this.defaultRenderingQueue){this.renderingQueue=new PDFRenderingQueue;this.renderingQueue.setViewer(this)}else this.renderingQueue=e.renderingQueue;const{abortSignal:t}=e;t?.addEventListener("abort",(()=>{pdf_viewer_classPrivateFieldGet(_g,this).disconnect();pdf_viewer_classPrivateFieldSet(_g,this,null)}),{once:!0});this.scroll=watchScroll(this.container,this._scrollUpdate.bind(this),t);this.presentationModeState=Ml;this._resetView();this.removePageBorders&&this.viewer.classList.add("removePageBorders");pdf_viewer_assertClassBrand(Sg,this,_updateContainerHeightCss).call(this);this.eventBus._on("thumbnailrendered",(e=>{let{pageNumber:t,pdfPage:i}=e;const a=this._pages[t-1];pdf_viewer_classPrivateFieldGet(Vp,this).has(a)||i?.cleanup()}));e.l10n||this.l10n.translate(this.container);this.cspPolicyService=e.cspPolicyService}get maxZoom(){return pdf_viewer_classPrivateFieldGet(yg,this)}set maxZoom(e){pdf_viewer_classPrivateFieldSet(yg,this,e)}get minZoom(){return pdf_viewer_classPrivateFieldGet(Fg,this)}set minZoom(e){pdf_viewer_classPrivateFieldSet(Fg,this,e)}setTextLayerMode(e){pdf_viewer_classPrivateFieldSet(mg,this,e)}get pageViewMode(){return pdf_viewer_classPrivateFieldGet(Pg,this)}set pageViewMode(e){if(pdf_viewer_classPrivateFieldGet(Pg,this)!==e){pdf_viewer_classPrivateFieldSet(Pg,this,e);if(!pdf_viewer_classPrivateFieldGet(wg,this)&&"infinite-scroll"===e){pdf_viewer_classPrivateFieldSet(wg,this,pdf_viewer_assertClassBrand(Sg,this,_findParentWithScrollbar).call(this,this.container.offsetParent));pdf_viewer_classPrivateFieldGet(wg,this)&&watchScroll(pdf_viewer_classPrivateFieldGet(wg,this),this._scrollUpdate.bind(this))}this.eventBus.dispatch("pageviewmodechanged",{source:this,pageViewMode:e})}}get pagesCount(){return this._pages.length}getPageView(e){return this._pages[e]}swapPages(e,t){const i=this._pages[e].pdfPage,a=this._pages[t].pdfPage;this._pages[e].setPdfPage(a);this._pages[t].setPdfPage(i);this.refresh()}getCachedPageViews(){return new Set(pdf_viewer_classPrivateFieldGet(Vp,this))}get pageViewsReady(){return this._pages.every((e=>e?.pdfPage))}get renderForms(){return pdf_viewer_classPrivateFieldGet(qp,this)===p.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.");if(!this.pdfDocument)return;const t=Math.abs(this._currentPageNumber-e)<=2;this._setCurrentPageNumber(e,!0)||NgxConsole.error(`currentPageNumber: "${e}" is not a valid page.`);if(this.pageFlip){t?this.pageFlip.flip(e-1):this.pageFlip.turnToPage(e-1);this.ensureAdjacentPagesAreLoaded()}}hidePagesDependingOnpageViewMode(){"book"===this.pageViewMode&&(this.pageFlip||setTimeout((()=>{if(!this.pageFlip){const e=this._pages[0].div,t=e.parentElement,i=t.parentElement;i.style.width=2*e.clientWidth+"px";i.style.overflow="hidden";i.style.marginLeft="auto";i.style.marginRight="auto";this.pageFlip=new PageFlip(t,{width:e.clientWidth,height:e.clientHeight,showCover:!0,size:"fixed"},this.cspPolicyService);this.pageFlip.loadFromHTML(this.container.querySelectorAll(".page"));this.pageFlip.on("flip",(e=>{this._currentPageNumber!==e.data+1&&this._setCurrentPageNumber(e.data+1,!1)}))}}),100))}async _setCurrentPageNumber(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this._currentPageNumber===e){t&&pdf_viewer_assertClassBrand(Sg,this,_resetCurrentPageView).call(this);return!0}if(!(0<e&&e<=this.pagesCount))return!1;const i=this._currentPageNumber;this._currentPageNumber=e;this.hidePagesDependingOnpageViewMode();if("book"===this.pageViewMode||"infinite-scroll"===this.pageViewMode){const e=this._pages[this.currentPageNumber-1];if(e.div.parentElement.classList.contains("spread"))e.div.parentElement.childNodes.forEach((async e=>{const t=Number(e.getAttribute("data-page-number")),i=this._pages[t-1];await pdf_viewer_assertClassBrand(Sg,this,pdf_viewer_ensurePdfPageLoaded).call(this,i);this.renderingQueue.renderView(i);e.style.display="inline-block"}));else{await pdf_viewer_assertClassBrand(Sg,this,pdf_viewer_ensurePdfPageLoaded).call(this,e);this.renderingQueue.renderView(e);"book"===pdf_viewer_classPrivateFieldGet(Pg,this)&&this.ensureAdjacentPagesAreLoaded()}}this.eventBus.dispatch("pagechanging",{source:this,pageNumber:e,pageLabel:this._pageLabels?.[e-1]??null,previous:i});t&&pdf_viewer_assertClassBrand(Sg,this,_resetCurrentPageView).call(this);return!0}addPageToRenderQueue(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(e>=0&&e<=this._pages.length-1){const t=this._pages[e];if(t.renderingState===Il.INITIAL){pdf_viewer_assertClassBrand(Sg,this,pdf_viewer_ensurePdfPageLoaded).call(this,t).then((()=>{this.renderingQueue.renderView(t)}));return!0}}return!1}async ensureAdjacentPagesAreLoaded(){const e=[0,1,-1,2,-2,-3];let t=0;this.currentPageNumber%2==1&&(t=-1);let i=!1;for(const a of e){const e=this.currentPageNumber+a+t;if(e>=0&&e<this._pages.length)try{const t=this._pages[e];await pdf_viewer_assertClassBrand(Sg,this,pdf_viewer_ensurePdfPageLoaded).call(this,t);if(this._pages.some((e=>e.renderingState===Il.RUNNING||e.renderingState===Il.PAUSED))||i){const loader=()=>this.adjacentPagesRenderer(loader,e);this.eventBus._on("pagerendered",loader);this.eventBus._on("thumbnailRendered",loader)}else i=this.adjacentPagesRenderer(null,e)}catch(t){NgxConsole.log("Exception during pre-rendering page %s",e,t)}}}adjacentPagesRenderer(e,t){if(this._pages.find((e=>e.renderingState===Il.RUNNING)))return!0;const i=this._pages.find((e=>e.renderingState===Il.PAUSED));if(i){this.renderingQueue.renderView(i);return!0}if(e){this.eventBus._off("pagerendered",e);this.eventBus._off("thumbnailRendered",e)}if(t>=0&&t<this._pages.length){const e=this._pages[t];if(e.renderingState===Il.INITIAL){this.renderingQueue.renderView(e);return!0}}return!1}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(e){if(!this.pdfDocument)return;let t=0|e;if(this._pageLabels){const i=this._pageLabels.indexOf(e);i>=0&&(t=i+1)}this._setCurrentPageNumber(t,!0)||NgxConsole.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return 0!==this._currentScale?this._currentScale:1}set currentScale(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&pdf_viewer_assertClassBrand(Sg,this,_setScale).call(this,e,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&pdf_viewer_assertClassBrand(Sg,this,_setScale).call(this,e,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!isValidRotation(e))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument)return;(e%=360)<0&&(e+=360);if(this._pagesRotation===e)return;this._pagesRotation=e;const t=this._currentPageNumber;this.refresh(!0,{rotation:e});this._currentScaleValue&&pdf_viewer_assertClassBrand(Sg,this,_setScale).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 shadow(this,"_layerProperties",{get annotationEditorUIManager(){return pdf_viewer_classPrivateFieldGet($p,e)},get annotationStorage(){return e.pdfDocument?.annotationStorage},get downloadManager(){return e.downloadManager},get enableScripting(){return!!e._scriptingManager},get fieldObjectsPromise(){return e.pdfDocument?.getFieldObjects()},get findController(){return e.findController},get customFindController(){return e.customFindController},get hasJSActionsPromise(){return e.pdfDocument?.hasJSActions()},get linkService(){return e.linkService}})}async getAllText(){const e=[],t=[];for(let i=1,a=this.pdfDocument.numPages;i<=a;++i){if(pdf_viewer_classPrivateFieldGet(hg,this))return null;t.length=0;const a=await this.pdfDocument.getPage(i),{items:s}=await a.getTextContent();for(const e of s){e.str&&t.push(e.str);e.hasEOL&&t.push("\n")}e.push(removeNullCharacters(t.join("")))}return e.join("\n")}setDocument(e){if(this.pdfDocument){this.eventBus.dispatch("pagesdestroy",{source:this});this._cancelRendering();this._resetView();this.findController?.setDocument(null);this.customFindController?.setDocument(null);this._scriptingManager?.setDocument(null);pdf_viewer_classPrivateFieldGet($p,this)?.destroy();pdf_viewer_classPrivateFieldSet($p,this,null)}this.pdfDocument=e;if(!e)return;const t=e.numPages,i=e.getPage(1),a=e.getOptionalContentConfig({intent:"display"}),s=pdf_viewer_classPrivateFieldGet(Jp,this)?e.getPermissions():Promise.resolve(),{eventBus:n,pageColors:r,viewer:o}=this;pdf_viewer_classPrivateFieldSet(ag,this,new AbortController);const{signal:l}=pdf_viewer_classPrivateFieldGet(ag,this);if(t>Lp){NgxConsole.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const e=this._scrollMode=zl.PAGE;n.dispatch("scrollmodechanged",{source:this,mode:e})}this._pagesCapability.promise.then((()=>{n.dispatch("pagesloaded",{source:this,pagesCount:t})}),(()=>{}));n._on("pagerender",(e=>{const t=this._pages[e.pageNumber-1];t&&pdf_viewer_classPrivateFieldGet(Vp,this).push(t)}),{signal:l});const onAfterDraw=e=>{if(!e.cssTransform&&!e.isDetailView){this._onePageRenderedCapability.resolve({timestamp:e.timestamp});n._off("pagerendered",onAfterDraw)}};n._on("pagerendered",onAfterDraw,{signal:l});Promise.all([i,s]).then((i=>{let[s,d]=i;if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(s);this._optionalContentConfigPromise=a;const{annotationEditorMode:c,annotationMode:h,textLayerMode:u}=pdf_viewer_assertClassBrand(Sg,this,_initializePermissions).call(this,d);if(u!==jl){const e=pdf_viewer_classPrivateFieldSet(cg,this,document.createElement("div"));e.id="hiddenCopyElement";o.before(e)}if(c!==f.DISABLE){const t=c;if(e.isPureXfa)NgxConsole.warn("Warning: XFA-editing is not implemented.");else if(isValidAnnotationEditorMode(t)){pdf_viewer_classPrivateFieldSet($p,this,new AnnotationEditorUIManager(this.container,o,pdf_viewer_classPrivateFieldGet(bg,this),pdf_viewer_classPrivateFieldGet(Hp,this),pdf_viewer_classPrivateFieldGet(Xp,this),pdf_viewer_classPrivateFieldGet(fg,this),n,e,r,pdf_viewer_classPrivateFieldGet(zp,this),pdf_viewer_classPrivateFieldGet(Qp,this),pdf_viewer_classPrivateFieldGet(eg,this),pdf_viewer_classPrivateFieldGet(tg,this),pdf_viewer_classPrivateFieldGet(ng,this),pdf_viewer_classPrivateFieldGet(Yp,this),pdf_viewer_classPrivateFieldGet(vg,this)));n.dispatch("annotationeditoruimanager",{source:this,uiManager:pdf_viewer_classPrivateFieldGet($p,this)});if(t!==f.NONE){pdf_viewer_assertClassBrand(Sg,this,_preloadEditingData).call(this,t);pdf_viewer_classPrivateFieldGet($p,this).updateMode(t)}}else NgxConsole.error(`Invalid AnnotationEditor mode: ${t}`)}const _=this._scrollMode===zl.PAGE?null:o,p=this.currentScale,g=s.getViewport({scale:p*PixelsPerInch.PDF_TO_CSS_UNITS});o.style.setProperty("--scale-factor",g.scale);r?.background&&o.style.setProperty("--page-bg-color",r.background);if("CanvasText"===r?.foreground||"Canvas"===r?.background){o.style.setProperty("--hcm-highlight-filter",e.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight"));o.style.setProperty("--hcm-highlight-selected-filter",e.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","ButtonText"))}for(let e=1;e<=t;++e){const t=new PDFPageView({container:_,eventBus:n,id:e,scale:p,defaultViewport:g.clone(),optionalContentConfigPromise:a,renderingQueue:this.renderingQueue,textLayerMode:u,annotationMode:h,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableDetailCanvas:this.enableDetailCanvas,pageColors:r,l10n:this.l10n,layerProperties:this._layerProperties,enableHWA:pdf_viewer_classPrivateFieldGet(Zp,this),enableAutoLinking:pdf_viewer_classPrivateFieldGet(ig,this),minDurationToUpdateCanvas:pdf_viewer_classPrivateFieldGet(sg,this)});this._pages.push(t)}this._pages[0]?.setPdfPage(s);this._scrollMode===zl.PAGE?pdf_viewer_assertClassBrand(Sg,this,_ensurePageViewVisible).call(this):this._spreadMode!==Ul.NONE&&this._updateSpreadMode();pdf_viewer_assertClassBrand(Sg,this,_onePageRenderedOrForceFetch).call(this,l).then((async()=>{if(e!==this.pdfDocument)return;this.findController?.setDocument(e);this.customFindController?.setDocument(e);this._scriptingManager?.setDocument(e);pdf_viewer_classPrivateFieldGet(cg,this)&&document.addEventListener("copy",pdf_viewer_assertClassBrand(Sg,this,_copyCallback).bind(this,u),{signal:l});pdf_viewer_classPrivateFieldGet($p,this)&&n.dispatch("annotationeditormodechanged",{source:this,mode:pdf_viewer_classPrivateFieldGet(Up,this)});if(e.loadingParams.disableAutoFetch||t>Rp){this._pagesCapability.resolve();return}let i=t-1;if(i<=0)this._pagesCapability.resolve();else{"book"===pdf_viewer_classPrivateFieldGet(Pg,this)&&await this.ensureAdjacentPagesAreLoaded();for(let a=2;a<=t;++a){const t=e.getPage(a).then((e=>{const t=this._pages[a-1];t.pdfPage||t.setPdfPage(e);0==--i&&this._pagesCapability.resolve()}),(e=>{NgxConsole.error(`Unable to get page ${a} to initialize viewer`,e);0==--i&&this._pagesCapability.resolve()}));a%Np==0&&await t}}}));this.hidePagesDependingOnpageViewMode();n.dispatch("pagesinit",{source:this});e.getMetadata().then((t=>{let{info:i}=t;e===this.pdfDocument&&i.Language&&(o.lang=i.Language)}));this.defaultRenderingQueue&&this.update()})).catch((e=>{NgxConsole.error("Unable to initialize viewer",e);this._pagesCapability.reject(e)}))}setPageLabels(e){if(this.pdfDocument){if(e)if(Array.isArray(e)&&this.pdfDocument.numPages===e.length)this._pageLabels=e;else{this._pageLabels=null;NgxConsole.error("setPageLabels: Invalid page labels.")}else this._pageLabels=null;for(let e=0,t=this._pages.length;e<t;e++)this._pages[e].setPageLabel(this._pageLabels?.[e]??null)}}_resetView(){this._pages=[];this._currentPageNumber=1;this._currentScale=0;this._currentScaleValue=null;this._pageLabels=null;const e=this.defaultCacheSize||10;pdf_viewer_classPrivateFieldSet(Vp,this,new PDFPageViewBuffer(e));this._location=null;this._pagesRotation=0;this._optionalContentConfigPromise=null;this._firstPageCapability=Promise.withResolvers();this._onePageRenderedCapability=Promise.withResolvers();this._pagesCapability=Promise.withResolvers();this._scrollMode=zl.VERTICAL;this._previousScrollMode=zl.UNKNOWN;this._spreadMode=Ul.NONE;pdf_viewer_classPrivateFieldSet(pg,this,{previousPageNumber:1,scrollDown:!0,pages:[]});pdf_viewer_classPrivateFieldGet(ag,this)?.abort();pdf_viewer_classPrivateFieldSet(ag,this,null);this.viewer.textContent="";this._updateScrollMode();this.viewer.removeAttribute("lang");pdf_viewer_classPrivateFieldGet(cg,this)?.remove();pdf_viewer_classPrivateFieldSet(cg,this,null);pdf_viewer_assertClassBrand(Sg,this,_cleanupTimeouts).call(this);pdf_viewer_assertClassBrand(Sg,this,_cleanupSwitchAnnotationEditorMode).call(this)}_scrollUpdate(){if(0!==this.pagesCount){pdf_viewer_classPrivateFieldGet(rg,this)&&clearTimeout(pdf_viewer_classPrivateFieldGet(rg,this));pdf_viewer_classPrivateFieldSet(rg,this,setTimeout((()=>{pdf_viewer_classPrivateFieldSet(rg,this,null);this.update()}),100));this.update()}}scrollPagePosIntoView(e,t){const i=this._pages[e-1].div;if(t){const a={...t};if("string"==typeof a.top&&a.top.endsWith("%")){const e=Number(a.top.replace("%","")),t=this.viewer.querySelector(".page")?.clientHeight;let s=i.clientHeight??t;const n=this.viewer.parentElement.clientHeight;s=Math.max(0,s-n);a.top=e*s/100}if("string"==typeof a.left&&a.left.endsWith("%")){const e=Number(a.left.replace("%","")),t=this.viewer.querySelector(".page")?.clientWidth,s=i.clientWidth??t;a.left=e*s/100}pdf_viewer_assertClassBrand(Sg,this,_scrollIntoView).call(this,{div:i,id:e},a)}else pdf_viewer_assertClassBrand(Sg,this,_scrollIntoView).call(this,{div:i,id:e})}pageLabelToPageNumber(e){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView(e){let{pageNumber:t,destArray:i=null,allowNegativeOffset:a=!1,ignoreDestinationZoom:s=!1}=e;if(!this.pdfDocument)return;const n=Number.isInteger(t)&&this._pages[t-1];if(!n){NgxConsole.error(`scrollPageIntoView: "${t}" is not a valid pageNumber parameter.`);return}if(this.isInPresentationMode||!i){this._setCurrentPageNumber(t,!0);return}let r,o,l=0,d=0,c=0,h=0;const u=n.rotation%180!=0,_=(u?n.height:n.width)/n.scale/PixelsPerInch.PDF_TO_CSS_UNITS,p=(u?n.width:n.height)/n.scale/PixelsPerInch.PDF_TO_CSS_UNITS;let g=0;switch(i[1].name){case"XYZ":l=i[2];d=i[3];g=i[4];l=null!==l?l:0;d=null!==d?d:p;break;case"Fit":case"FitB":g="page-fit";break;case"FitH":case"FitBH":d=i[2];g="page-width";if(null===d&&this._location){l=this._location.left;d=this._location.top}else("number"!=typeof d||d<0)&&(d=p);break;case"FitV":case"FitBV":l=i[2];c=_;h=p;g="page-height";break;case"FitR":l=i[2];d=i[3];c=i[4]-l;h=i[5]-d;let e=40,t=5;this.removePageBorders&&(e=t=0);r=(this.container.clientWidth-e)/c/PixelsPerInch.PDF_TO_CSS_UNITS;o=(this.container.clientHeight-t)/h/PixelsPerInch.PDF_TO_CSS_UNITS;g=Math.min(Math.abs(r),Math.abs(o));break;default:NgxConsole.error(`scrollPageIntoView: "${i[1].name}" is not a valid destination type.`);return}s||(g&&g!==this._currentScale?this.currentScaleValue=g:0===this._currentScale&&(this.currentScaleValue=El));pdf_viewer_assertClassBrand(Sg,this,pdf_viewer_ensurePdfPageLoaded).call(this,n).then((()=>{this.renderingQueue.renderView(n);"single"===this.pageViewMode&&this.currentPageNumber!==t&&(this.currentPageNumber=t)}));if("page-fit"===g&&!i[4]){pdf_viewer_assertClassBrand(Sg,this,_scrollIntoView).call(this,n);return}const f=[n.viewport.convertToViewportPoint(l,d),n.viewport.convertToViewportPoint(l+c,d+h)];let v=Math.min(f[0][0],f[1][0]),m=Math.min(f[0][1],f[1][1]);if(!a){v=Math.max(v,0);m=Math.max(m,0)}pdf_viewer_assertClassBrand(Sg,this,_scrollIntoView).call(this,n,{left:v,top:m})}_updateLocation(e){const t=this._currentScale,i=this._currentScaleValue,a=parseFloat(i)===t?Math.round(1e4*t)/100:i,s=e.id,n=this._pages[s-1],r=this.container,o=n.getPagePoint(r.scrollLeft-e.x,r.scrollTop-e.y),l=Math.round(o[0]),d=Math.round(o[1]);let c=`#page=${s}`;this.isInPresentationMode||(c+=`&zoom=${a},${l},${d}`);this._location={pageNumber:s,scale:a,top:d,left:l,rotation:this._pagesRotation,pdfOpenParams:c}}update(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.scrollMode===zl.PAGE?this.viewer.classList.add("singlePageView"):this.viewer.classList.remove("singlePageView");const t=this._getVisiblePages(),i=t.views,a=i.length;if(0===a)return;const s=this.defaultCacheSize||10,n=Math.max(s,2*a+1);pdf_viewer_classPrivateFieldGet(Vp,this).resize(n,t.ids);for(const{view:e,visibleArea:t}of i)e.updateVisibleArea(t);for(const e of pdf_viewer_classPrivateFieldGet(Vp,this))t.ids.has(e.id)||e.updateVisibleArea(null);this.renderingQueue.renderHighestPriority(t);const r=this._spreadMode===Ul.NONE&&(this._scrollMode===zl.PAGE||this._scrollMode===zl.VERTICAL),o=this._currentPageNumber;let l=!1;for(const e of i){if(e.percent<100)break;if(e.id===o&&r){l=!0;break}}this.scrollMode===zl.PAGE||e||this._setCurrentPageNumber(l?o:i[0].id);this._updateLocation(t.first);this.eventBus.dispatch("updateviewarea",{source:this,location:this._location});this.hidePagesDependingOnpageViewMode()}async updateBookModeScale(e){if("book"===this.pageViewMode&&this.pageFlip&&e.scale&&e.scale!==e.previousScale){const e=this._pages[0];if(e.pdfPage){const t=e.width,i=e.height,a=e.div.parentElement,s=this.removePageBorders?1:40;a.style.width=`${2*t+s}px`;a.style.height=`${i}px`;this.pageFlip.render.setting.width=t;this.pageFlip.render.setting.height=i;this.pageFlip.render.update()}}}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isContainerRtl(){return"rtl"===getComputedStyle(this.container).direction}get isInPresentationMode(){return this.presentationModeState===Tl}get isChangingPresentationMode(){return this.presentationModeState===Gl}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const e=this._scrollMode===zl.PAGE?pdf_viewer_classPrivateFieldGet(pg,this).pages:this._pages,t=this._scrollMode===zl.HORIZONTAL,i=t&&this._isContainerRtl;return getVisibleElements({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:i})}cleanup(){for(const e of this._pages)e.renderingState!==Il.FINISHED&&e.reset()}_cancelRendering(){for(const e of this._pages)e.cancelRendering()}forceRendering(e){const t=e||this._getVisiblePages(),i=pdf_viewer_assertClassBrand(Sg,this,pdf_viewer_getScrollAhead).call(this,t),a=this._spreadMode!==Ul.NONE&&this._scrollMode!==zl.HORIZONTAL,s=null!==pdf_viewer_classPrivateFieldGet(gg,this)||null!==pdf_viewer_classPrivateFieldGet(rg,this)&&t.views.some((e=>e.detailView?.renderingCancelled)),n=this.renderingQueue.getHighestPriority(t,this._pages,i,a,s);if(n){pdf_viewer_assertClassBrand(Sg,this,pdf_viewer_ensurePdfPageLoaded).call(this,n).then((()=>{this.renderingQueue.renderView(n)}));return!0}return!1}get hasEqualPageSizes(){const e=this._pages[0];for(let t=1,i=this._pages.length;t<i;++t){const i=this._pages[t];if(i.width!==e.width||i.height!==e.height)return!1}return!0}getPagesOverview(){let e;return this._pages.map((t=>{const i=t.pdfPage.getViewport({scale:1}),a=isPortraitOrientation(i);if(void 0===e)e=a;else if(this.enablePrintAutoRotate&&a!==e)return{width:i.height,height:i.width,rotation:(i.rotation-90)%360};return{width:i.width,height:i.height,rotation:i.rotation}}))}get optionalContentConfigPromise(){if(!this.pdfDocument)return Promise.resolve(null);if(!this._optionalContentConfigPromise){NgxConsole.error("optionalContentConfigPromise: Not initialized yet.");return this.pdfDocument.getOptionalContentConfig({intent:"display"})}return this._optionalContentConfigPromise}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${e}`);if(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(!isValidScrollMode(e))throw new Error(`Invalid scroll mode: ${e}`);if(!(this.pagesCount>Lp)){this._previousScrollMode=this._scrollMode;this._scrollMode=e;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e});this._updateScrollMode(this._currentPageNumber)}}}_updateScrollMode(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const t=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",t===zl.HORIZONTAL);i.classList.toggle("scrollWrapped",t===zl.WRAPPED);if(this.pdfDocument&&e){t===zl.PAGE?pdf_viewer_assertClassBrand(Sg,this,_ensurePageViewVisible).call(this):this._previousScrollMode===zl.PAGE&&this._updateSpreadMode();this._currentScaleValue&&isNaN(this._currentScaleValue)&&pdf_viewer_assertClassBrand(Sg,this,_setScale).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(!isValidSpreadMode(e))throw new Error(`Invalid spread mode: ${e}`);this._spreadMode=e;this.eventBus.dispatch("spreadmodechanged",{source:this,mode:e});this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!this.pdfDocument)return;const t=this.viewer,i=this._pages;if(this._scrollMode===zl.PAGE)pdf_viewer_assertClassBrand(Sg,this,_ensurePageViewVisible).call(this);else{t.textContent="";if(this._spreadMode===Ul.NONE)for(const e of this._pages)t.append(e.div);else{const e=this._spreadMode-1;let a=null;for(let s=0,n=i.length;s<n;++s){if(null===a){a=document.createElement("div");a.className="spread";t.append(a)}else if(s%2===e){a=a.cloneNode(!1);t.append(a)}a.append(i[s].div)}}}this.hidePagesDependingOnpageViewMode();if(e){this._currentScaleValue&&isNaN(this._currentScaleValue)&&pdf_viewer_assertClassBrand(Sg,this,_setScale).call(this,this._currentScaleValue,{noScroll:!0});this._setCurrentPageNumber(e,!0);this.update()}}_getPageAdvance(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("book"===this.pageViewMode)return 2;switch(this._scrollMode){case zl.WRAPPED:{const{views:i}=this._getVisiblePages(),a=new Map;for(const{id:e,y:t,percent:s,widthPercent:n}of i){if(0===s||n<100)continue;let i=a.get(t);i||a.set(t,i||=[]);i.push(e)}for(const i of a.values()){const a=i.indexOf(e);if(-1===a)continue;const s=i.length;if(1===s)break;if(t)for(let t=a-1,s=0;t>=s;t--){const a=i[t],s=i[t+1]-1;if(a<s)return e-s}else for(let t=a+1,n=s;t<n;t++){const a=i[t],s=i[t-1]+1;if(a>s)return s-e}if(t){const t=i[0];if(t<e)return e-t+1}else{const t=i[s-1];if(t>e)return t-e+1}break}break}case zl.HORIZONTAL:break;case zl.PAGE:case zl.VERTICAL:{if(this._spreadMode===Ul.NONE)break;const i=this._spreadMode-1;if(t&&e%2!==i)break;if(!t&&e%2===i)break;const{views:a}=this._getVisiblePages(),s=t?e-1:e+1;for(const{id:e,percent:t,widthPercent:i}of a)if(e===s){if(t>0&&100===i)return 2;break}break}}return 1}nextPage(){const e=this._currentPageNumber,t=this.pagesCount;if(e>=t)return!1;const i=this._getPageAdvance(e,!1)||1;this.currentPageNumber=Math.min(e+i,t);return!0}previousPage(){const e=this._currentPageNumber;if(e<=1)return!1;const t=this._getPageAdvance(e,!0)||1;this.currentPageNumber=Math.max(e-t,1);return!0}updateScale(e){let{drawingDelay:t,scaleFactor:i=null,steps:a=null,origin:s}=e;if(null===a&&null===i)throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let n=this._currentScale;if(i>0&&1!==i)n=Math.round(n*i*100)/100;else if(a){const e=a>0?1.1:1/1.1,t=a>0?Math.ceil:Math.floor;a=Math.abs(a);do{n=t(10*(n*e).toFixed(2))/10}while(--a>0)}n=MathClamp(n,Number(this.minZoom)??kl,Number(this.maxZoom)??10);pdf_viewer_assertClassBrand(Sg,this,_setScale).call(this,n,{noScroll:!1,drawingDelay:t,origin:s})}increaseScale(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.updateScale({...e,steps:e.steps??1})}decreaseScale(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.updateScale({...e,steps:-(e.steps??1)})}get containerTopLeft(){return pdf_viewer_classPrivateFieldGet(Kp,this)||pdf_viewer_classPrivateFieldSet(Kp,this,[this.container.offsetTop,this.container.offsetLeft])}get annotationEditorMode(){return pdf_viewer_classPrivateFieldGet($p,this)?pdf_viewer_classPrivateFieldGet(Up,this):f.DISABLE}set annotationEditorMode(e){let{mode:t,editId:i=null,isFromKeyboard:a=!1,mustEnterInEditMode:s=!1,editComment:n=!1}=e;if(!pdf_viewer_classPrivateFieldGet($p,this))throw new Error("The AnnotationEditor is not enabled.");if(pdf_viewer_classPrivateFieldGet(Up,this)===t)return;if(!isValidAnnotationEditorMode(t))throw new Error(`Invalid AnnotationEditor mode: ${t}`);if(!this.pdfDocument)return;pdf_viewer_assertClassBrand(Sg,this,_preloadEditingData).call(this,t);const{eventBus:r,pdfDocument:o}=this,updater=async()=>{pdf_viewer_assertClassBrand(Sg,this,_cleanupSwitchAnnotationEditorMode).call(this);pdf_viewer_classPrivateFieldSet(Up,this,t);await pdf_viewer_classPrivateFieldGet($p,this).updateMode(t,i,a,s,n);t===pdf_viewer_classPrivateFieldGet(Up,this)&&o===this.pdfDocument&&r.dispatch("annotationeditormodechanged",{source:this,mode:t})};if(t===f.NONE||pdf_viewer_classPrivateFieldGet(Up,this)===f.NONE){const e=t!==f.NONE;e||this.pdfDocument.annotationStorage.resetModifiedIds();for(const t of this._pages)t.toggleEditingMode(e);const i=pdf_viewer_assertClassBrand(Sg,this,_switchToEditAnnotationMode).call(this);if(e&&i){pdf_viewer_assertClassBrand(Sg,this,_cleanupSwitchAnnotationEditorMode).call(this);pdf_viewer_classPrivateFieldSet(og,this,new AbortController);const e=AbortSignal.any([pdf_viewer_classPrivateFieldGet(ag,this).signal,pdf_viewer_classPrivateFieldGet(og,this).signal]);r._on("pagerendered",(e=>{let{pageNumber:t}=e;i.delete(t);0===i.size&&pdf_viewer_classPrivateFieldSet(lg,this,setTimeout(updater,0))}),{signal:e});return}}updater()}refresh(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.create(null);if(this.pdfDocument){for(const e of this._pages)e.update(t);pdf_viewer_assertClassBrand(Sg,this,_cleanupTimeouts).call(this);e||this.update()}}getSerializedAnnotations(){const e=this.pdfDocument.annotationStorage;if(0===e.size)return null;const t=[];for(const[i,a]of e)if(a&&"function"==typeof a.serialize){const e=a.serialize();e&&void 0!==e.annotationType&&t.push(e)}return t.length>0?t:null}async addEditorAnnotation(e){try{"string"==typeof e&&(e=JSON.parse(e))}catch(e){NgxConsole.error(`Please pass a JSON string or an Array of JSON objects to addEditorAnnotation: "${e.message}".`);return}Array.isArray(e)||(e=[e]);e?.forEach((e=>e.isCopy=!0));await pdf_viewer_classPrivateFieldGet($p,this).addSerializedEditor(e,!0,!0,!1)}removeEditorAnnotations(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>!0;pdf_viewer_classPrivateFieldGet($p,this).removeEditors(e)}destroyBookMode(){if(this.pageFlip){this.pageFlip.destroy();this.pageFlip=null}}stopRendering(){this._cancelRendering()}}function _findParentWithScrollbar(e){for(;e;){if(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)return e;e=e.parentElement}return null}function _initializePermissions(e){const t={annotationEditorMode:pdf_viewer_classPrivateFieldGet(Up,this),annotationMode:pdf_viewer_classPrivateFieldGet(qp,this),textLayerMode:pdf_viewer_classPrivateFieldGet(mg,this)};if(!e)return t;e.includes(m.COPY)||pdf_viewer_classPrivateFieldGet(mg,this)!==Vl||(t.textLayerMode=Hl);e.includes(m.MODIFY_CONTENTS)||(t.annotationEditorMode=f.DISABLE);e.includes(m.MODIFY_ANNOTATIONS)||e.includes(m.FILL_INTERACTIVE_FORMS)||pdf_viewer_classPrivateFieldGet(qp,this)!==p.ENABLE_FORMS||(t.annotationMode=p.ENABLE);return t}async function _onePageRenderedOrForceFetch(e){if("hidden"===document.visibilityState||!this.container.offsetParent||0===this._getVisiblePages().views.length)return;const t=Promise.withResolvers(),i=new AbortController;document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&t.resolve()}),{signal:AbortSignal.any([e,i.signal])});await Promise.race([this._onePageRenderedCapability.promise,t.promise]);i.abort()}function _copyCallback(e,t){const i=document.getSelection(),{focusNode:a,anchorNode:s}=i;if(s&&a&&i.containsNode(pdf_viewer_classPrivateFieldGet(cg,this))){if(pdf_viewer_classPrivateFieldGet(dg,this)||e===Hl){stopEvent(t);return}pdf_viewer_classPrivateFieldSet(dg,this,!0);const{classList:i}=this.viewer;i.add("copyAll");const a=new AbortController;window.addEventListener("keydown",(e=>pdf_viewer_classPrivateFieldSet(hg,this,"Escape"===e.key)),{signal:a.signal});this.getAllText().then((async e=>{null!==e&&await navigator.clipboard.writeText(e)})).catch((e=>{NgxConsole.warn(`Something goes wrong when extracting the text: ${e.message}`)})).finally((()=>{pdf_viewer_classPrivateFieldSet(dg,this,!1);pdf_viewer_classPrivateFieldSet(hg,this,!1);a.abort();i.remove("copyAll")}));stopEvent(t)}}function _ensurePageViewVisible(){if(this._scrollMode!==zl.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const e=this._currentPageNumber,t=pdf_viewer_classPrivateFieldGet(pg,this),i=this.viewer;i.textContent="";t.pages.length=0;if(this._spreadMode!==Ul.NONE||this.isInPresentationMode){const a=new Set,s=this._spreadMode-1;if(-1===s)a.add(e-1);else if(e%2!==s){a.add(e-1);a.add(e)}else{a.add(e-2);a.add(e-1)}const n=document.createElement("div");n.className="spread";if(this.isInPresentationMode){const e=document.createElement("div");e.className="dummyPage";n.append(e)}for(const e of a){const i=this._pages[e];if(i){n.append(i.div);t.pages.push(i)}}i.append(n)}else{const a=this._pages[e-1];i.append(a.div);t.pages.push(a)}t.scrollDown=e>=t.previousPageNumber;t.previousPageNumber=e}function _scrollIntoView(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e)return;const{div:i,id:a}=e;this._currentPageNumber!==a&&this._setCurrentPageNumber(a);if(this._scrollMode===zl.PAGE){pdf_viewer_assertClassBrand(Sg,this,_ensurePageViewVisible).call(this);this.update()}if(!t&&!this.isInPresentationMode){const e=i.offsetLeft+i.clientLeft,a=e+i.clientWidth,{scrollLeft:s,clientWidth:n}=this.container;(this._scrollMode===zl.HORIZONTAL||e<s||a>s+n)&&(t={left:0,top:0})}scrollIntoView(i,t,!1,"infinite-scroll"===this.pageViewMode);!this._currentScaleValue&&this._location&&(this._location=null)}function _isSameScale(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15}function _setScaleUpdatePages(e,t,i){let{noScroll:a=!1,preset:s=!1,drawingDelay:n=-1,origin:r=null}=i;const o=isNaN(Number(this.currentScale))?void 0:Number(this.currentScale),l=this.currentScaleValue;this._currentScaleValue=t.toString();if(pdf_viewer_assertClassBrand(Sg,this,_isSameScale).call(this,e)){s&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t,previousScale:o,previousPresetValue:l,noScroll:a});return}this.viewer.style.setProperty("--scale-factor",e*PixelsPerInch.PDF_TO_CSS_UNITS);const d=n>=0&&n<1e3;this.refresh(!0,{scale:e,drawingDelay:d?n:-1});d&&pdf_viewer_classPrivateFieldSet(gg,this,setTimeout((()=>{pdf_viewer_classPrivateFieldSet(gg,this,null);this.refresh()}),n));this._currentScale=e;if(!a){let t,i=this._currentPageNumber;if(this._location&&!this.isInPresentationMode&&!this.isChangingPresentationMode){i=this._location.pageNumber;t=[null,{name:"XYZ"},this._location.left,this._location.top,null]}this.scrollPageIntoView({pageNumber:i,destArray:t,allowNegativeOffset:!0});if(Array.isArray(r)){const t=e/o-1,[i,a]=this.containerTopLeft;this.container.scrollLeft+=(r[0]-a)*t;this.container.scrollTop+=(r[1]-i)*t}}this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:s?t:void 0,previousScale:o,previousPresetValue:l,noScroll:a});this.defaultRenderingQueue&&this.update()}function _get_pageWidthScaleFactor(e){return e._spreadMode!==Ul.NONE&&e._scrollMode!==zl.HORIZONTAL?2:1}function _setScale(e,t){e||(e="auto");this.maxZoom&&this.maxZoom===this.minZoom&&(e=this.maxZoom);let i=parseFloat(e);if(this._currentScale!==i)if(i>0){t.preset=!1;pdf_viewer_assertClassBrand(Sg,this,_setScaleUpdatePages).call(this,i,e,t)}else{const a=this._pages[this._currentPageNumber-1];if(!a)return;let s=40,n=5;if(this.isInPresentationMode){s=n=4;this._spreadMode!==Ul.NONE&&(s*=2)}else this.removePageBorders?s=n=0:this._scrollMode===zl.HORIZONTAL&&([s,n]=[n,s]);let r=(this.container.clientWidth-s)/a.width*a.scale/function pdf_viewer_classPrivateGetter(e,t,i){return i(pdf_viewer_assertClassBrand(e,t))}(Sg,this,_get_pageWidthScaleFactor);"book"===this.pageViewMode&&(r/=2);const o=(this.container.clientHeight-n)/a.height*a.scale;switch(e){case"page-actual":i=1;break;case"page-width":i=r;break;case"page-height":i=o;break;case"page-fit":i=Math.min(r,o);break;case"auto":const t=isPortraitOrientation(a)?r:Math.min(o,r);i=Math.min(1.25,t);break;default:NgxConsole.error(`#setScale: "${e}" is an unknown zoom value.`);return}t.preset=!0;pdf_viewer_assertClassBrand(Sg,this,_setScaleUpdatePages).call(this,i,e,t)}}function _resetCurrentPageView(){const e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&pdf_viewer_assertClassBrand(Sg,this,_setScale).call(this,this._currentScaleValue,{noScroll:!0});pdf_viewer_assertClassBrand(Sg,this,_scrollIntoView).call(this,e)}function _switchToEditAnnotationMode(){const e=this._getVisiblePages(),t=[],{ids:i,views:a}=e;for(const e of a){const{view:a}=e;a.hasEditableAnnotations()?t.push(e):i.delete(a.id)}if(0===t.length)return null;this.renderingQueue.renderHighestPriority({first:t[0],last:t.at(-1),views:t,ids:i});return i}async function pdf_viewer_ensurePdfPageLoaded(e){if(e.pdfPage)return e.pdfPage;try{const t=await this.pdfDocument.getPage(e.id);e.pdfPage||e.setPdfPage(t);return t}catch(e){NgxConsole.error("Unable to get page for page view",e);return null}}function pdf_viewer_getScrollAhead(e){if(1===e.first?.id)return!0;if(e.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case zl.PAGE:return pdf_viewer_classPrivateFieldGet(pg,this).scrollDown;case zl.HORIZONTAL:return this.scroll.right}return this.scroll.down}function _updateContainerHeightCss(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.container.clientHeight;if(e!==pdf_viewer_classPrivateFieldGet(ug,this)){pdf_viewer_classPrivateFieldSet(ug,this,e);Yl.setProperty("--viewer-container-height",`${e}px`)}}function pdf_viewer_resizeObserverCallback(e){for(const t of e)if(t.target===this.container){pdf_viewer_assertClassBrand(Sg,this,_updateContainerHeightCss).call(this,Math.floor(t.borderBoxSize[0].blockSize));pdf_viewer_classPrivateFieldSet(Kp,this,null);break}}function _cleanupTimeouts(){if(null!==pdf_viewer_classPrivateFieldGet(gg,this)){clearTimeout(pdf_viewer_classPrivateFieldGet(gg,this));pdf_viewer_classPrivateFieldSet(gg,this,null)}if(null!==pdf_viewer_classPrivateFieldGet(rg,this)){clearTimeout(pdf_viewer_classPrivateFieldGet(rg,this));pdf_viewer_classPrivateFieldSet(rg,this,null)}}function _cleanupSwitchAnnotationEditorMode(){pdf_viewer_classPrivateFieldGet(og,this)?.abort();pdf_viewer_classPrivateFieldSet(og,this,null);if(null!==pdf_viewer_classPrivateFieldGet(lg,this)){clearTimeout(pdf_viewer_classPrivateFieldGet(lg,this));pdf_viewer_classPrivateFieldSet(lg,this,null)}}function _preloadEditingData(e){switch(e){case f.STAMP:pdf_viewer_classPrivateFieldGet(ng,this)?.loadModel("altText");break;case f.SIGNATURE:pdf_viewer_classPrivateFieldGet(fg,this)?.loadSignatures()}}function secondary_toolbar_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function secondary_toolbar_classPrivateFieldGet(e,t){return e.get(secondary_toolbar_assertClassBrand(e,t))}function secondary_toolbar_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var xg=new WeakMap,Cg=new WeakSet;class SecondaryToolbar{constructor(e,t){!function secondary_toolbar_classPrivateMethodInitSpec(e,t){secondary_toolbar_checkPrivateRedeclaration(e,t),t.add(e)}(this,Cg);!function secondary_toolbar_classPrivateFieldInitSpec(e,t,i){secondary_toolbar_checkPrivateRedeclaration(e,t),t.set(e,i)}(this,xg,void 0);!function secondary_toolbar_classPrivateFieldSet(e,t,i){return e.set(secondary_toolbar_assertClassBrand(e,t),i),i}(xg,this,e);const i=[{element:e.presentationModeButton,eventName:"presentationmode",close:!0},{element:e.printButton,eventName:"print",close:!0},{element:e.downloadButton,eventName:"download",close:!0},{element:e.viewBookmarkButton,eventName:null,close:!0},{element:e.firstPageButton,eventName:"firstpage",close:!0},{element:e.lastPageButton,eventName:"lastpage",close:!0},{element:e.pageRotateCwButton,eventName:"rotatecw",close:!1},{element:e.pageRotateCcwButton,eventName:"rotateccw",close:!1},{element:e.cursorSelectToolButton,eventName:"switchcursortool",eventDetails:{tool:$l.SELECT},close:!0},{element:e.cursorHandToolButton,eventName:"switchcursortool",eventDetails:{tool:$l.HAND},close:!0},{element:e.scrollPageButton,eventName:"switchscrollmode",eventDetails:{mode:zl.PAGE},close:!0},{element:e.scrollVerticalButton,eventName:"switchscrollmode",eventDetails:{mode:zl.VERTICAL},close:!0},{element:e.scrollHorizontalButton,eventName:"switchscrollmode",eventDetails:{mode:zl.HORIZONTAL},close:!0},{element:e.scrollWrappedButton,eventName:"switchscrollmode",eventDetails:{mode:zl.WRAPPED},close:!0},{element:e.spreadNoneButton,eventName:"switchspreadmode",eventDetails:{mode:Ul.NONE},close:!0},{element:e.spreadOddButton,eventName:"switchspreadmode",eventDetails:{mode:Ul.ODD},close:!0},{element:e.spreadEvenButton,eventName:"switchspreadmode",eventDetails:{mode:Ul.EVEN},close:!0},{element:e.imageAltTextSettingsButton,eventName:"imagealttextsettings",close:!0},{element:e.documentPropertiesButton,eventName:"documentproperties",close:!0}];i.push({element:e.openFileButton,eventName:"openfile",close:!0});this.eventBus=t;this.opened=!1;secondary_toolbar_assertClassBrand(Cg,this,secondary_toolbar_bindListeners).call(this,i);this.reset()}get isOpen(){return this.opened}setPageNumber(e){this.pageNumber=e;secondary_toolbar_assertClassBrand(Cg,this,secondary_toolbar_updateUIState).call(this)}setPagesCount(e){this.pagesCount=e;secondary_toolbar_assertClassBrand(Cg,this,secondary_toolbar_updateUIState).call(this)}reset(){this.pageNumber=0;this.pagesCount=0;secondary_toolbar_assertClassBrand(Cg,this,secondary_toolbar_updateUIState).call(this);this.eventBus.dispatch("switchcursortool",{source:this,reset:!0});secondary_toolbar_assertClassBrand(Cg,this,_scrollModeChanged).call(this,{mode:zl.VERTICAL});secondary_toolbar_assertClassBrand(Cg,this,_spreadModeChanged).call(this,{mode:Ul.NONE})}open(){if(this.opened)return;this.opened=!0;const{toggleButton:e,toolbar:t}=secondary_toolbar_classPrivateFieldGet(xg,this);toggleExpandedBtn(e,!0,t)}close(){if(!this.opened)return;this.opened=!1;const{toggleButton:e,toolbar:t}=secondary_toolbar_classPrivateFieldGet(xg,this);toggleExpandedBtn(e,!1,t)}toggle(){this.opened?this.close():this.open()}}function secondary_toolbar_updateUIState(){const{firstPageButton:e,lastPageButton:t,pageRotateCwButton:i,pageRotateCcwButton:a}=secondary_toolbar_classPrivateFieldGet(xg,this);e.disabled=this.pageNumber<=1;t.disabled=this.pageNumber>=this.pagesCount;i.disabled=0===this.pagesCount;a.disabled=0===this.pagesCount}function secondary_toolbar_bindListeners(e){const{eventBus:t}=this,{toggleButton:i}=secondary_toolbar_classPrivateFieldGet(xg,this);i.addEventListener("click",this.toggle.bind(this));for(const{element:i,eventName:a,close:s,eventDetails:n}of e)i&&i.addEventListener("click",(e=>{null!==a&&t.dispatch(a,{source:this,...n});s&&this.close();t.dispatch("reporttelemetry",{source:this,details:{type:"buttons",data:{id:i.id}}})}));t._on("cursortoolchanged",secondary_toolbar_assertClassBrand(Cg,this,_cursorToolChanged).bind(this));t._on("scrollmodechanged",secondary_toolbar_assertClassBrand(Cg,this,_scrollModeChanged).bind(this));t._on("spreadmodechanged",secondary_toolbar_assertClassBrand(Cg,this,_spreadModeChanged).bind(this))}function _cursorToolChanged(e){let{tool:t,disabled:i}=e;const{cursorSelectToolButton:a,cursorHandToolButton:s}=secondary_toolbar_classPrivateFieldGet(xg,this);toggleCheckedBtn(a,t===$l.SELECT);toggleCheckedBtn(s,t===$l.HAND);a.disabled=i;s.disabled=i}function _scrollModeChanged(e){let{mode:t}=e;const{scrollPageButton:i,scrollVerticalButton:a,scrollHorizontalButton:s,scrollWrappedButton:n,spreadNoneButton:r,spreadOddButton:o,spreadEvenButton:l}=secondary_toolbar_classPrivateFieldGet(xg,this);toggleCheckedBtn(i,t===zl.PAGE);toggleCheckedBtn(a,t===zl.VERTICAL);toggleCheckedBtn(s,t===zl.HORIZONTAL);toggleCheckedBtn(n,t===zl.WRAPPED);const d=this.pagesCount>Lp;i.disabled=d;a.disabled=d;s.disabled=d;n.disabled=d;const c=t===zl.HORIZONTAL;r.disabled=c;o.disabled=c;l.disabled=c}function _spreadModeChanged(e){let{mode:t}=e;const{spreadNoneButton:i,spreadOddButton:a,spreadEvenButton:s}=secondary_toolbar_classPrivateFieldGet(xg,this);toggleCheckedBtn(i,t===Ul.NONE);toggleCheckedBtn(a,t===Ul.ODD);toggleCheckedBtn(s,t===Ul.EVEN)}function signature_manager_classPrivateMethodInitSpec(e,t){signature_manager_checkPrivateRedeclaration(e,t),t.add(e)}function signature_manager_classPrivateFieldInitSpec(e,t,i){signature_manager_checkPrivateRedeclaration(e,t),t.set(e,i)}function signature_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function signature_manager_classPrivateFieldGet(e,t){return e.get(signature_manager_assertClassBrand(e,t))}function signature_manager_classPrivateFieldSet(e,t,i){return e.set(signature_manager_assertClassBrand(e,t),i),i}function signature_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Ag=new WeakMap,Eg=new WeakMap,kg=new WeakMap,Ig=new WeakMap,Mg=new WeakMap,Bg=new WeakMap,Gg=new WeakMap,Tg=new WeakMap,Dg=new WeakMap,Lg=new WeakMap,Rg=new WeakMap,Ng=new WeakMap,Og=new WeakMap,Wg=new WeakMap,jg=new WeakMap,Vg=new WeakMap,Hg=new WeakMap,zg=new WeakMap,Ug=new WeakMap,$g=new WeakMap,qg=new WeakMap,Xg=new WeakMap,Kg=new WeakMap,Yg=new WeakMap,Zg=new WeakMap,Qg=new WeakMap,Jg=new WeakMap,ef=new WeakMap,tf=new WeakMap,af=new WeakMap,sf=new WeakMap,nf=new WeakMap,rf=new WeakMap,of=new WeakMap,lf=new WeakMap,df=new WeakMap,cf=new WeakMap,hf=new WeakMap,uf=new WeakMap,_f=new WeakSet;class SignatureManager{constructor(e,t,i,a,s,n,r){let{dialog:o,panels:l,typeButton:d,typeInput:c,drawButton:h,drawPlaceholder:u,drawSVG:_,drawThickness:p,imageButton:g,imageSVG:f,imagePlaceholder:v,imagePicker:m,imagePickerLink:w,description:P,clearButton:y,cancelButton:b,addButton:S,errorCloseButton:x,errorBar:C,errorTitle:A,errorDescription:E,saveCheckbox:k,saveContainer:I}=e;signature_manager_classPrivateMethodInitSpec(this,_f);signature_manager_classPrivateFieldInitSpec(this,Ag,void 0);signature_manager_classPrivateFieldInitSpec(this,Eg,null);signature_manager_classPrivateFieldInitSpec(this,kg,void 0);signature_manager_classPrivateFieldInitSpec(this,Ig,void 0);signature_manager_classPrivateFieldInitSpec(this,Mg,void 0);signature_manager_classPrivateFieldInitSpec(this,Bg,void 0);signature_manager_classPrivateFieldInitSpec(this,Gg,void 0);signature_manager_classPrivateFieldInitSpec(this,Tg,null);signature_manager_classPrivateFieldInitSpec(this,Dg,void 0);signature_manager_classPrivateFieldInitSpec(this,Lg,null);signature_manager_classPrivateFieldInitSpec(this,Rg,"");signature_manager_classPrivateFieldInitSpec(this,Ng,null);signature_manager_classPrivateFieldInitSpec(this,Og,void 0);signature_manager_classPrivateFieldInitSpec(this,Wg,void 0);signature_manager_classPrivateFieldInitSpec(this,jg,void 0);signature_manager_classPrivateFieldInitSpec(this,Vg,void 0);signature_manager_classPrivateFieldInitSpec(this,Hg,void 0);signature_manager_classPrivateFieldInitSpec(this,zg,null);signature_manager_classPrivateFieldInitSpec(this,Ug,null);signature_manager_classPrivateFieldInitSpec(this,$g,void 0);signature_manager_classPrivateFieldInitSpec(this,qg,void 0);signature_manager_classPrivateFieldInitSpec(this,Xg,void 0);signature_manager_classPrivateFieldInitSpec(this,Kg,void 0);signature_manager_classPrivateFieldInitSpec(this,Yg,void 0);signature_manager_classPrivateFieldInitSpec(this,Zg,void 0);signature_manager_classPrivateFieldInitSpec(this,Qg,void 0);signature_manager_classPrivateFieldInitSpec(this,Jg,void 0);signature_manager_classPrivateFieldInitSpec(this,ef,null);signature_manager_classPrivateFieldInitSpec(this,tf,void 0);signature_manager_classPrivateFieldInitSpec(this,af,null);signature_manager_classPrivateFieldInitSpec(this,sf,null);signature_manager_classPrivateFieldInitSpec(this,nf,!1);signature_manager_classPrivateFieldInitSpec(this,rf,void 0);signature_manager_classPrivateFieldInitSpec(this,of,!1);signature_manager_classPrivateFieldInitSpec(this,lf,void 0);signature_manager_classPrivateFieldInitSpec(this,df,void 0);signature_manager_classPrivateFieldInitSpec(this,cf,void 0);signature_manager_classPrivateFieldInitSpec(this,hf,void 0);signature_manager_classPrivateFieldInitSpec(this,uf,null);signature_manager_classPrivateFieldSet(Ag,this,S);signature_manager_classPrivateFieldSet(kg,this,y);signature_manager_classPrivateFieldSet(Ig,this,P.lastElementChild);signature_manager_classPrivateFieldSet(Bg,this,P.firstElementChild);signature_manager_classPrivateFieldSet(Gg,this,o);signature_manager_classPrivateFieldSet(Og,this,_);signature_manager_classPrivateFieldSet(Dg,this,u);signature_manager_classPrivateFieldSet(Wg,this,p);signature_manager_classPrivateFieldSet(jg,this,C);signature_manager_classPrivateFieldSet(Hg,this,A);signature_manager_classPrivateFieldSet(Vg,this,E);signature_manager_classPrivateFieldSet(Kg,this,f);signature_manager_classPrivateFieldSet(Xg,this,v);signature_manager_classPrivateFieldSet($g,this,m);signature_manager_classPrivateFieldSet(qg,this,w);signature_manager_classPrivateFieldSet(df,this,a);signature_manager_classPrivateFieldSet(Yg,this,k);signature_manager_classPrivateFieldSet(Zg,this,I);signature_manager_classPrivateFieldSet(Jg,this,i);signature_manager_classPrivateFieldSet(tf,this,c);signature_manager_classPrivateFieldSet(lf,this,s);signature_manager_classPrivateFieldSet(hf,this,n);signature_manager_classPrivateFieldSet(rf,this,r);signature_manager_classPrivateFieldSet(cf,this,new EditDescriptionDialog(t,a));pf._||(pf._=Object.freeze({signature:"pdfjs-editor-add-signature-description-default-when-drawing",errorUploadTitle:"pdfjs-editor-add-signature-image-upload-error-title",errorUploadDescription:"pdfjs-editor-add-signature-image-upload-error-description",errorNoDataTitle:"pdfjs-editor-add-signature-image-no-data-error-title",errorNoDataDescription:"pdfjs-editor-add-signature-image-no-data-error-description"}));o.addEventListener("close",signature_manager_assertClassBrand(_f,this,signature_manager_close).bind(this));o.addEventListener("contextmenu",(e=>{const{target:t}=e;t!==signature_manager_classPrivateFieldGet(tf,this)&&t!==signature_manager_classPrivateFieldGet(Bg,this)&&e.preventDefault()}));o.addEventListener("drop",(e=>{stopEvent(e)}));b.addEventListener("click",signature_manager_assertClassBrand(_f,this,signature_manager_cancel).bind(this));S.addEventListener("click",signature_manager_assertClassBrand(_f,this,_add).bind(this));y.addEventListener("click",(()=>{signature_manager_assertClassBrand(_f,this,signature_manager_reportTelemetry).call(this,{type:"signature",action:"pdfjs.signature.clear",data:{type:signature_manager_classPrivateFieldGet(af,this)}});signature_manager_assertClassBrand(_f,this,_initTab).call(this,null)}),{passive:!0});signature_manager_classPrivateFieldGet(Bg,this).addEventListener("input",(()=>{signature_manager_classPrivateFieldGet(Ig,this).disabled=""===signature_manager_classPrivateFieldGet(Bg,this).value}),{passive:!0});signature_manager_classPrivateFieldGet(Ig,this).addEventListener("click",(()=>{signature_manager_classPrivateFieldGet(Bg,this).value="";signature_manager_classPrivateFieldGet(Ig,this).disabled=!0}),{passive:!0});x.addEventListener("click",(()=>{C.hidden=!0}),{passive:!0});signature_manager_assertClassBrand(_f,this,_initTabButtons).call(this,d,h,g,l);m.accept=K.join(",");r._on("storedsignatureschanged",signature_manager_assertClassBrand(_f,this,_signaturesChanged).bind(this));a.register(o)}getSignature(e){return this.open(e)}async loadSignatures(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!signature_manager_classPrivateFieldGet(Jg,this)||!e&&signature_manager_classPrivateFieldGet(Jg,this).previousElementSibling||!signature_manager_classPrivateFieldGet(hf,this))return;if(!signature_manager_classPrivateFieldGet(ef,this)){signature_manager_classPrivateFieldSet(ef,this,signature_manager_classPrivateFieldGet(hf,this).getAll().then((async e=>[e,await Promise.all(Array.from(e.values(),(e=>{let{signatureData:t}=e;return SignatureExtractor.decompressSignature(t)})))])));if(!e)return}const[t,i]=await signature_manager_classPrivateFieldGet(ef,this);signature_manager_classPrivateFieldSet(ef,this,null);let a=0;for(const[e,{description:s}]of t){const t=i[a++];if(t){t.curves=t.outlines.map((e=>({points:e})));delete t.outlines;signature_manager_assertClassBrand(_f,this,_addToolbarButton).call(this,t,e,s)}}}async renderEditButton(e){const t=document.createElement("button");t.classList.add("altText","editDescription");t.tabIndex=0;e.description&&(t.title=e.description);const i=document.createElement("span");t.append(i);i.setAttribute("data-l10n-id","pdfjs-editor-add-signature-edit-button-label");t.addEventListener("click",(()=>{signature_manager_classPrivateFieldGet(cf,this).open(e)}),{passive:!0});return t}async open(e){let{uiManager:t,editor:i}=e;signature_manager_classPrivateFieldGet(Eg,this)||signature_manager_classPrivateFieldSet(Eg,this,new Map(signature_manager_classPrivateFieldGet(Qg,this).keys().map((e=>[e,{value:"",default:""}]))));signature_manager_classPrivateFieldSet(uf,this,t);signature_manager_classPrivateFieldSet(Mg,this,i);signature_manager_classPrivateFieldGet(uf,this).removeEditListeners();const a=signature_manager_classPrivateFieldSet(of,this,await signature_manager_classPrivateFieldGet(hf,this).isFull());signature_manager_classPrivateFieldGet(Zg,this).classList.toggle("fullStorage",a);signature_manager_classPrivateFieldGet(Yg,this).checked=!a;await signature_manager_classPrivateFieldGet(df,this).open(signature_manager_classPrivateFieldGet(Gg,this));const s=signature_manager_classPrivateFieldGet(Qg,this).get("type");s.focus();s.click()}destroy(){signature_manager_classPrivateFieldSet(uf,this,null);signature_manager_assertClassBrand(_f,this,signature_manager_finish).call(this)}}function _initTabButtons(e,t,i,a){const s=signature_manager_classPrivateFieldSet(Qg,this,new Map([["type",e],["draw",t],["image",i]])),tabCallback=e=>{for(const[t,i]of s)if(i===e.target){i.setAttribute("aria-selected",!0);i.setAttribute("tabindex",0);a.setAttribute("data-selected",t);signature_manager_assertClassBrand(_f,this,_initTab).call(this,t)}else{i.setAttribute("aria-selected",!1);i.setAttribute("tabindex",-1)}},n=Array.from(s.values());for(let e=0,t=n.length;e<t;e++){const t=n[e];t.addEventListener("click",tabCallback,{passive:!0});t.addEventListener("keydown",(t=>{let{key:i}=t;"ArrowLeft"!==i&&"ArrowRight"!==i||n[e+("ArrowLeft"===i?-1:1)]?.focus()}),{passive:!0})}}function _resetCommon(){signature_manager_classPrivateFieldSet(nf,this,!1);signature_manager_classPrivateFieldGet(Bg,this).value="";signature_manager_classPrivateFieldGet(af,this)&&(signature_manager_classPrivateFieldGet(Eg,this).get(signature_manager_classPrivateFieldGet(af,this)).value="")}function _resetTab(e){switch(e){case"type":signature_manager_classPrivateFieldGet(tf,this).value="";break;case"draw":signature_manager_classPrivateFieldSet(Tg,this,null);signature_manager_classPrivateFieldSet(Ng,this,null);signature_manager_classPrivateFieldSet(Rg,this,"");signature_manager_classPrivateFieldGet(Lg,this)?.remove();signature_manager_classPrivateFieldSet(Lg,this,null);signature_manager_classPrivateFieldGet(Dg,this).hidden=!1;signature_manager_classPrivateFieldGet(Wg,this).value=1;break;case"image":signature_manager_classPrivateFieldGet(Xg,this).hidden=!1;signature_manager_classPrivateFieldGet(Ug,this)?.remove();signature_manager_classPrivateFieldSet(Ug,this,null)}}function _initTab(e){if(e&&signature_manager_classPrivateFieldGet(af,this)===e)return;signature_manager_classPrivateFieldGet(af,this)&&(signature_manager_classPrivateFieldGet(Eg,this).get(signature_manager_classPrivateFieldGet(af,this)).value=signature_manager_classPrivateFieldGet(Bg,this).value);e&&signature_manager_classPrivateFieldSet(af,this,e);signature_manager_classPrivateFieldGet(jg,this).hidden=!0;const t=!e;t?signature_manager_assertClassBrand(_f,this,_resetCommon).call(this):signature_manager_classPrivateFieldGet(Bg,this).value=signature_manager_classPrivateFieldGet(Eg,this).get(signature_manager_classPrivateFieldGet(af,this)).value;signature_manager_classPrivateFieldGet(Ig,this).disabled=""===signature_manager_classPrivateFieldGet(Bg,this).value;signature_manager_classPrivateFieldGet(sf,this)?.abort();signature_manager_classPrivateFieldSet(sf,this,new AbortController);switch(signature_manager_classPrivateFieldGet(af,this)){case"type":signature_manager_assertClassBrand(_f,this,_initTypeTab).call(this,t);break;case"draw":signature_manager_assertClassBrand(_f,this,_initDrawTab).call(this,t);break;case"image":signature_manager_assertClassBrand(_f,this,_initImageTab).call(this,t)}}function _disableButtons(e){e&&signature_manager_classPrivateFieldGet(of,this)||(signature_manager_classPrivateFieldGet(Yg,this).disabled=!e);signature_manager_classPrivateFieldGet(kg,this).disabled=signature_manager_classPrivateFieldGet(Ag,this).disabled=signature_manager_classPrivateFieldGet(Bg,this).disabled=!e}function _initTypeTab(e){e&&signature_manager_assertClassBrand(_f,this,_resetTab).call(this,"type");signature_manager_assertClassBrand(_f,this,_disableButtons).call(this,signature_manager_classPrivateFieldGet(tf,this).value);const{signal:t}=signature_manager_classPrivateFieldGet(sf,this),i={passive:!0,signal:t};signature_manager_classPrivateFieldGet(tf,this).addEventListener("input",(()=>{const{value:e}=signature_manager_classPrivateFieldGet(tf,this);if(!signature_manager_classPrivateFieldGet(nf,this)){signature_manager_classPrivateFieldGet(Eg,this).get("type").default=signature_manager_classPrivateFieldGet(Bg,this).value=e;signature_manager_classPrivateFieldGet(Ig,this).disabled=""===e}signature_manager_assertClassBrand(_f,this,_disableButtons).call(this,e)}),i);signature_manager_classPrivateFieldGet(Bg,this).addEventListener("input",(()=>{signature_manager_classPrivateFieldSet(nf,this,signature_manager_classPrivateFieldGet(tf,this).value!==signature_manager_classPrivateFieldGet(Bg,this).value)}),i)}function _initDrawTab(e){e&&signature_manager_assertClassBrand(_f,this,_resetTab).call(this,"draw");signature_manager_assertClassBrand(_f,this,_disableButtons).call(this,signature_manager_classPrivateFieldGet(Lg,this));const{signal:t}=signature_manager_classPrivateFieldGet(sf,this),i={signal:t};let a=NaN;const drawCallback=e=>{const{pointerId:s}=e;if(!isNaN(a)&&a!==s)return;a=s;e.preventDefault();signature_manager_classPrivateFieldGet(Og,this).setPointerCapture(s);const{width:n,height:r}=signature_manager_classPrivateFieldGet(Og,this).getBoundingClientRect();let{offsetX:o,offsetY:l}=e;o=Math.round(o);l=Math.round(l);e.target===signature_manager_classPrivateFieldGet(Dg,this)&&(signature_manager_classPrivateFieldGet(Dg,this).hidden=!0);if(!signature_manager_classPrivateFieldGet(Tg,this)){signature_manager_classPrivateFieldSet(Tg,this,{width:n,height:r,thickness:parseInt(signature_manager_classPrivateFieldGet(Wg,this).value),curves:[]});signature_manager_assertClassBrand(_f,this,_disableButtons).call(this,!0);const e=new DOMSVGFactory,t=signature_manager_classPrivateFieldSet(Lg,this,e.createElement("path"));t.setAttribute("stroke-width",signature_manager_classPrivateFieldGet(Wg,this).value);signature_manager_classPrivateFieldGet(Og,this).append(t);signature_manager_classPrivateFieldGet(Og,this).addEventListener("pointerdown",drawCallback,i);signature_manager_classPrivateFieldGet(Dg,this).removeEventListener("pointerdown",drawCallback);""===signature_manager_classPrivateFieldGet(Bg,this).value&&signature_manager_classPrivateFieldGet(lf,this).get(pf._.signature).then((e=>{signature_manager_classPrivateFieldGet(Eg,this).get("draw").default=e;signature_manager_classPrivateFieldGet(Bg,this).value||=e;signature_manager_classPrivateFieldGet(Ig,this).disabled=""===signature_manager_classPrivateFieldGet(Bg,this).value}))}signature_manager_classPrivateFieldSet(Ng,this,[o,l]);signature_manager_classPrivateFieldGet(Tg,this).curves.push({points:signature_manager_classPrivateFieldGet(Ng,this)});signature_manager_classPrivateFieldSet(Rg,this,signature_manager_classPrivateFieldGet(Rg,this)+`M ${o} ${l}`);signature_manager_classPrivateFieldGet(Lg,this).setAttribute("d",signature_manager_classPrivateFieldGet(Rg,this));const d=new AbortController,c={signal:AbortSignal.any([t,d.signal])};signature_manager_classPrivateFieldGet(Og,this).addEventListener("contextmenu",noContextMenu,c);signature_manager_classPrivateFieldGet(Og,this).addEventListener("pointermove",(e=>{e.preventDefault();let{offsetX:t,offsetY:i}=e;t=Math.round(t);i=Math.round(i);const a=signature_manager_classPrivateFieldGet(Ng,this);if(!(t<0||i<0||t>n||i>r||t===a.at(-2)&&i===a.at(-1))){if(a.length>=4){const[e,s,n,r]=a.slice(-4);signature_manager_classPrivateFieldSet(Rg,this,signature_manager_classPrivateFieldGet(Rg,this)+`C${(e+5*n)/6} ${(s+5*r)/6} ${(5*n+t)/6} ${(5*r+i)/6} ${(n+t)/2} ${(r+i)/2}`)}else signature_manager_classPrivateFieldSet(Rg,this,signature_manager_classPrivateFieldGet(Rg,this)+`L${t} ${i}`);a.push(t,i);signature_manager_classPrivateFieldGet(Lg,this).setAttribute("d",signature_manager_classPrivateFieldGet(Rg,this))}}),c);signature_manager_classPrivateFieldGet(Og,this).addEventListener("pointerup",(e=>{const{pointerId:t}=e;if(isNaN(a)||a===t){a=NaN;e.preventDefault();signature_manager_classPrivateFieldGet(Og,this).releasePointerCapture(t);d.abort();if(2===signature_manager_classPrivateFieldGet(Ng,this).length){signature_manager_classPrivateFieldSet(Rg,this,signature_manager_classPrivateFieldGet(Rg,this)+`L${signature_manager_classPrivateFieldGet(Ng,this)[0]} ${signature_manager_classPrivateFieldGet(Ng,this)[1]}`);signature_manager_classPrivateFieldGet(Lg,this).setAttribute("d",signature_manager_classPrivateFieldGet(Rg,this))}}}),c)};signature_manager_classPrivateFieldGet(Tg,this)?signature_manager_classPrivateFieldGet(Og,this).addEventListener("pointerdown",drawCallback,i):signature_manager_classPrivateFieldGet(Dg,this).addEventListener("pointerdown",drawCallback,i);signature_manager_classPrivateFieldGet(Wg,this).addEventListener("input",(()=>{const{value:e}=signature_manager_classPrivateFieldGet(Wg,this);signature_manager_classPrivateFieldGet(Wg,this).setAttribute("data-l10n-args",JSON.stringify({thickness:e}));if(signature_manager_classPrivateFieldGet(Tg,this)){signature_manager_classPrivateFieldGet(Lg,this).setAttribute("stroke-width",e);signature_manager_classPrivateFieldGet(Tg,this).thickness=e}}),i)}function _showError(e){signature_manager_classPrivateFieldGet(Hg,this).setAttribute("data-l10n-id",pf._[`error${e}Title`]);signature_manager_classPrivateFieldGet(Vg,this).setAttribute("data-l10n-id",pf._[`error${e}Description`]);signature_manager_classPrivateFieldGet(jg,this).hidden=!1}function _initImageTab(e){e&&signature_manager_assertClassBrand(_f,this,_resetTab).call(this,"image");signature_manager_assertClassBrand(_f,this,_disableButtons).call(this,signature_manager_classPrivateFieldGet(Ug,this));const{signal:t}=signature_manager_classPrivateFieldGet(sf,this),i={signal:t},a={passive:!0,signal:t};signature_manager_classPrivateFieldGet(qg,this).addEventListener("keydown",(e=>{const{key:t}=e;if("Enter"===t||" "===t){stopEvent(e);signature_manager_classPrivateFieldGet($g,this).click()}}),i);signature_manager_classPrivateFieldGet($g,this).addEventListener("click",(()=>{signature_manager_classPrivateFieldGet(Gg,this).classList.toggle("waiting",!0)}),a);signature_manager_classPrivateFieldGet($g,this).addEventListener("change",(async()=>{const e=signature_manager_classPrivateFieldGet($g,this).files?.[0];if(e&&K.includes(e.type))await signature_manager_assertClassBrand(_f,this,_extractSignature).call(this,e);else{signature_manager_assertClassBrand(_f,this,_showError).call(this,"Upload");signature_manager_classPrivateFieldGet(Gg,this).classList.toggle("waiting",!1)}}),a);signature_manager_classPrivateFieldGet($g,this).addEventListener("cancel",(()=>{signature_manager_classPrivateFieldGet(Gg,this).classList.toggle("waiting",!1)}),a);signature_manager_classPrivateFieldGet(Xg,this).addEventListener("dragover",(e=>{const{dataTransfer:t}=e;for(const{type:i}of t.items)if(K.includes(i)){t.dropEffect="copy"===t.effectAllowed?"copy":"move";stopEvent(e);return}t.dropEffect="none"}),i);signature_manager_classPrivateFieldGet(Xg,this).addEventListener("drop",(e=>{const{dataTransfer:{files:t}}=e;if(t?.length){for(const e of t)if(K.includes(e.type)){signature_manager_assertClassBrand(_f,this,_extractSignature).call(this,e);break}stopEvent(e);signature_manager_classPrivateFieldGet(Gg,this).classList.toggle("waiting",!0)}}),i)}async function _extractSignature(e){let t;try{t=await signature_manager_classPrivateFieldGet(uf,this).imageManager.getFromFile(e)}catch(e){console.error("SignatureManager.#extractSignature.",e)}if(!t){signature_manager_assertClassBrand(_f,this,_showError).call(this,"Upload");signature_manager_classPrivateFieldGet(Gg,this).classList.toggle("waiting",!1);return}const i=signature_manager_classPrivateFieldSet(zg,this,signature_manager_classPrivateFieldGet(Mg,this).getFromImage(t.bitmap));if(!i){signature_manager_assertClassBrand(_f,this,_showError).call(this,"NoData");signature_manager_classPrivateFieldGet(Gg,this).classList.toggle("waiting",!1);return}const{outline:a}=i;signature_manager_classPrivateFieldGet(Xg,this).hidden=!0;signature_manager_assertClassBrand(_f,this,_disableButtons).call(this,!0);const s=new DOMSVGFactory,n=signature_manager_classPrivateFieldSet(Ug,this,s.createElement("path"));signature_manager_classPrivateFieldGet(Kg,this).setAttribute("viewBox",a.viewBox);signature_manager_classPrivateFieldGet(Kg,this).setAttribute("preserveAspectRatio","xMidYMid meet");signature_manager_classPrivateFieldGet(Kg,this).append(n);n.setAttribute("d",a.toSVGPath());signature_manager_classPrivateFieldGet(Eg,this).get("image").default=e.name;if(""===signature_manager_classPrivateFieldGet(Bg,this).value){signature_manager_classPrivateFieldGet(Bg,this).value=e.name||"";signature_manager_classPrivateFieldGet(Ig,this).disabled=""===signature_manager_classPrivateFieldGet(Bg,this).value}signature_manager_classPrivateFieldGet(Gg,this).classList.toggle("waiting",!1)}function _getOutlineForType(){return signature_manager_classPrivateFieldGet(Mg,this).getFromText(signature_manager_classPrivateFieldGet(tf,this).value,window.getComputedStyle(signature_manager_classPrivateFieldGet(tf,this)))}function _getOutlineForDraw(){const{width:e,height:t}=signature_manager_classPrivateFieldGet(Og,this).getBoundingClientRect();return signature_manager_classPrivateFieldGet(Mg,this).getDrawnSignature(signature_manager_classPrivateFieldGet(Tg,this),e,t)}function signature_manager_reportTelemetry(e){signature_manager_classPrivateFieldGet(rf,this).dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}function _addToolbarButton(e,t,i){const{curves:a,areContours:s,thickness:n,width:r,height:o}=e,l=Math.max(r,o),d=SignatureExtractor.processDrawnLines({lines:{curves:a,thickness:n,width:r,height:o},pageWidth:l,pageHeight:l,rotation:0,innerMargin:0,mustSmooth:!1,areContours:s});if(!d)return;const{outline:c}=d,h=new DOMSVGFactory,u=document.createElement("div"),_=document.createElement("button");_.addEventListener("click",(()=>{signature_manager_classPrivateFieldGet(rf,this).dispatch("switchannotationeditorparams",{source:this,type:v.CREATE,value:{signatureData:{lines:{curves:a,thickness:n,width:r,height:o},mustSmooth:!1,areContours:s,description:i,uuid:t,heightInPage:40}}})}));u.append(_);u.classList.add("toolbarAddSignatureButtonContainer");const p=h.create(1,1,!0);_.append(p);const g=document.createElement("span");g.ariaHidden=!0;_.append(g);_.classList.add("toolbarAddSignatureButton");_.type="button";g.textContent=i;_.setAttribute("data-l10n-id","pdfjs-editor-add-saved-signature-button");_.setAttribute("data-l10n-args",JSON.stringify({description:i}));_.tabIndex=0;const f=h.createElement("path");p.append(f);p.setAttribute("viewBox",c.viewBox);p.setAttribute("preserveAspectRatio","xMidYMid meet");s&&f.classList.add("contours");f.setAttribute("d",c.toSVGPath());const m=document.createElement("button");u.append(m);m.classList.add("toolbarButton","deleteButton");m.setAttribute("data-l10n-id","pdfjs-editor-delete-signature-button1");m.type="button";m.tabIndex=0;m.addEventListener("click",(async()=>{if(await signature_manager_classPrivateFieldGet(hf,this).delete(t)){u.remove();signature_manager_assertClassBrand(_f,this,signature_manager_reportTelemetry).call(this,{type:"signature",action:"pdfjs.signature.delete_saved",data:{savedCount:await signature_manager_classPrivateFieldGet(hf,this).size()}})}}));const w=document.createElement("span");m.append(w);w.setAttribute("data-l10n-id","pdfjs-editor-delete-signature-button-label1");signature_manager_classPrivateFieldGet(Jg,this).before(u)}async function _signaturesChanged(){const e=signature_manager_classPrivateFieldGet(Jg,this).parentElement;for(;e.firstElementChild!==signature_manager_classPrivateFieldGet(Jg,this);)e.firstElementChild.remove();signature_manager_classPrivateFieldSet(ef,this,null);await this.loadSignatures(!0)}function signature_manager_cancel(){signature_manager_assertClassBrand(_f,this,signature_manager_finish).call(this)}function signature_manager_finish(){signature_manager_classPrivateFieldGet(df,this).closeIfActive(signature_manager_classPrivateFieldGet(Gg,this))}function signature_manager_close(){null===signature_manager_classPrivateFieldGet(Mg,this)._drawId&&signature_manager_classPrivateFieldGet(Mg,this).remove();signature_manager_classPrivateFieldGet(uf,this)?.addEditListeners();signature_manager_classPrivateFieldGet(sf,this)?.abort();signature_manager_classPrivateFieldSet(sf,this,null);signature_manager_classPrivateFieldSet(uf,this,null);signature_manager_classPrivateFieldSet(Mg,this,null);signature_manager_assertClassBrand(_f,this,_resetCommon).call(this);for(const[e]of signature_manager_classPrivateFieldGet(Qg,this))signature_manager_assertClassBrand(_f,this,_resetTab).call(this,e);signature_manager_assertClassBrand(_f,this,_disableButtons).call(this,!1);signature_manager_classPrivateFieldSet(af,this,null);signature_manager_classPrivateFieldSet(Eg,this,null)}async function _add(){let e;const t=signature_manager_classPrivateFieldGet(af,this);switch(t){case"type":e=signature_manager_assertClassBrand(_f,this,_getOutlineForType).call(this);break;case"draw":e=signature_manager_assertClassBrand(_f,this,_getOutlineForDraw).call(this);break;case"image":e=signature_manager_classPrivateFieldGet(zg,this)}let i=null;const a=signature_manager_classPrivateFieldGet(Bg,this).value;if(signature_manager_classPrivateFieldGet(Yg,this).checked){const{newCurves:t,areContours:s,thickness:n,width:r,height:o}=e,l=await SignatureExtractor.compressSignature({outlines:t,areContours:s,thickness:n,width:r,height:o});i=await signature_manager_classPrivateFieldGet(hf,this).create({description:a,signatureData:l});i?signature_manager_assertClassBrand(_f,this,_addToolbarButton).call(this,{curves:t.map((e=>({points:e}))),areContours:s,thickness:n,width:r,height:o},i,a):console.warn("SignatureManager.add: cannot save the signature.")}const s=signature_manager_classPrivateFieldGet(Eg,this).get(t);signature_manager_assertClassBrand(_f,this,signature_manager_reportTelemetry).call(this,{type:"signature",action:"pdfjs.signature.created",data:{type:t,saved:!!i,savedCount:await signature_manager_classPrivateFieldGet(hf,this).size(),descriptionChanged:a!==s.default}});signature_manager_classPrivateFieldGet(Mg,this).addSignature(e,40,signature_manager_classPrivateFieldGet(Bg,this).value,i);signature_manager_assertClassBrand(_f,this,signature_manager_finish).call(this)}var pf={_:null},gf=new WeakMap,ff=new WeakMap,vf=new WeakMap,mf=new WeakMap,wf=new WeakMap,Pf=new WeakMap,yf=new WeakMap,Ff=new WeakSet;class EditDescriptionDialog{constructor(e,t){let{dialog:i,description:a,cancelButton:s,updateButton:n,editSignatureView:r}=e;signature_manager_classPrivateMethodInitSpec(this,Ff);signature_manager_classPrivateFieldInitSpec(this,gf,void 0);signature_manager_classPrivateFieldInitSpec(this,ff,void 0);signature_manager_classPrivateFieldInitSpec(this,vf,void 0);signature_manager_classPrivateFieldInitSpec(this,mf,void 0);signature_manager_classPrivateFieldInitSpec(this,wf,void 0);signature_manager_classPrivateFieldInitSpec(this,Pf,void 0);signature_manager_classPrivateFieldInitSpec(this,yf,void 0);const o=signature_manager_classPrivateFieldSet(vf,this,a.firstElementChild);signature_manager_classPrivateFieldSet(Pf,this,r);signature_manager_classPrivateFieldSet(mf,this,i);signature_manager_classPrivateFieldSet(wf,this,t);i.addEventListener("close",signature_manager_assertClassBrand(Ff,this,_close2).bind(this));i.addEventListener("contextmenu",(e=>{e.target!==signature_manager_classPrivateFieldGet(vf,this)&&e.preventDefault()}));s.addEventListener("click",signature_manager_assertClassBrand(Ff,this,_cancel2).bind(this));n.addEventListener("click",signature_manager_assertClassBrand(Ff,this,_update).bind(this));const l=a.lastElementChild;l.addEventListener("click",(()=>{o.value="";l.disabled=!0;n.disabled=""===signature_manager_classPrivateFieldGet(ff,this)}));o.addEventListener("input",(()=>{const{value:e}=o;l.disabled=""===e;n.disabled=e===signature_manager_classPrivateFieldGet(ff,this);r.setAttribute("aria-label",e)}),{passive:!0});t.register(i)}async open(e){signature_manager_classPrivateFieldSet(yf,this,e._uiManager);signature_manager_classPrivateFieldSet(gf,this,e);signature_manager_classPrivateFieldSet(ff,this,signature_manager_classPrivateFieldGet(vf,this).value=e.description);signature_manager_classPrivateFieldGet(vf,this).dispatchEvent(new Event("input"));signature_manager_classPrivateFieldGet(yf,this).removeEditListeners();const{areContours:t,outline:i}=e.getSignaturePreview(),a=(new DOMSVGFactory).createElement("path");signature_manager_classPrivateFieldGet(Pf,this).append(a);signature_manager_classPrivateFieldGet(Pf,this).setAttribute("viewBox",i.viewBox);a.setAttribute("d",i.toSVGPath());t&&a.classList.add("contours");await signature_manager_classPrivateFieldGet(wf,this).open(signature_manager_classPrivateFieldGet(mf,this))}}async function _update(){signature_manager_classPrivateFieldGet(gf,this)._reportTelemetry({action:"pdfjs.signature.edit_description",data:{hasBeenChanged:!0}});signature_manager_classPrivateFieldGet(gf,this).description=signature_manager_classPrivateFieldGet(vf,this).value;signature_manager_assertClassBrand(Ff,this,signature_manager_finish2).call(this)}function _cancel2(){signature_manager_classPrivateFieldGet(gf,this)._reportTelemetry({action:"pdfjs.signature.edit_description",data:{hasBeenChanged:!1}});signature_manager_assertClassBrand(Ff,this,signature_manager_finish2).call(this)}function signature_manager_finish2(){signature_manager_classPrivateFieldGet(wf,this).closeIfActive(signature_manager_classPrivateFieldGet(mf,this))}function _close2(){signature_manager_classPrivateFieldGet(yf,this)?.addEditListeners();signature_manager_classPrivateFieldSet(yf,this,null);signature_manager_classPrivateFieldSet(gf,this,null);signature_manager_classPrivateFieldGet(Pf,this).firstElementChild.remove()}function toolbar_classPrivateFieldInitSpec(e,t,i){toolbar_checkPrivateRedeclaration(e,t),t.set(e,i)}function toolbar_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function toolbar_classPrivateFieldGet(e,t){return e.get(web_toolbar_assertClassBrand(e,t))}function toolbar_classPrivateFieldSet(e,t,i){return e.set(web_toolbar_assertClassBrand(e,t),i),i}function web_toolbar_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var bf=new WeakMap,Sf=new WeakMap,xf=new WeakMap,Cf=new WeakMap,Af=new WeakMap,Ef=new WeakSet;class Toolbar{constructor(e,t,i,a,s){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;!function toolbar_classPrivateMethodInitSpec(e,t){toolbar_checkPrivateRedeclaration(e,t),t.add(e)}(this,Ef);toolbar_classPrivateFieldInitSpec(this,bf,null);toolbar_classPrivateFieldInitSpec(this,Sf,void 0);toolbar_classPrivateFieldInitSpec(this,xf,El);toolbar_classPrivateFieldInitSpec(this,Cf,10);toolbar_classPrivateFieldInitSpec(this,Af,kl);toolbar_classPrivateFieldSet(Sf,this,e);toolbar_classPrivateFieldSet(xf,this,i);toolbar_classPrivateFieldSet(Cf,this,s);toolbar_classPrivateFieldSet(Af,this,a);this.eventBus=t;const r=[{element:e.previous,eventName:"previouspage"},{element:e.next,eventName:"nextpage"},{element:e.print,eventName:"print"},{element:e.presentationModeButton,eventName:"presentationmode"},{element:e.download,eventName:"download"},{element:e.movePageUp,eventName:"movePageUp"},{element:e.movePageDown,eventName:"movePageDown"},{element:e.editorSignatureButton,eventName:"switchannotationeditormode",eventDetails:{get mode(){const{classList:t}=e.editorSignatureButton;return t.contains("toggled")?f.NONE:f.SIGNATURE}}}];web_toolbar_assertClassBrand(Ef,this,toolbar_bindListeners).call(this,r);web_toolbar_assertClassBrand(Ef,this,_updateToolbarDensity).call(this,{value:n});this.reset()}get maxZoom(){return toolbar_classPrivateFieldGet(Cf,this)}set maxZoom(e){toolbar_classPrivateFieldSet(Cf,this,e)}get minZoom(){return toolbar_classPrivateFieldGet(Af,this)}set minZoom(e){toolbar_classPrivateFieldSet(Af,this,e)}setPageNumber(e,t){this.pageNumber=e;this.pageLabel=t;web_toolbar_assertClassBrand(Ef,this,toolbar_updateUIState).call(this,!1)}setPagesCount(e,t){this.pagesCount=e;this.hasPageLabels=t;web_toolbar_assertClassBrand(Ef,this,toolbar_updateUIState).call(this,!0)}setPageScale(e,t){this.pageScaleValue=(e||t).toString();this.pageScale=t;web_toolbar_assertClassBrand(Ef,this,toolbar_updateUIState).call(this,!1)}reset(){toolbar_classPrivateFieldSet(bf,this,null);this.pageNumber=0;this.pageLabel=null;this.hasPageLabels=!1;this.pagesCount=0;const e=toolbar_classPrivateFieldGet(xf,this)||El;this.pageScaleValue=e;Number(e)&&(this.pageScale=Number(e));web_toolbar_assertClassBrand(Ef,this,toolbar_updateUIState).call(this,!0);this.updateLoadingIndicatorState();web_toolbar_assertClassBrand(Ef,this,_editorModeChanged).call(this,{mode:f.DISABLE})}updateLoadingIndicatorState(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{pageNumber:t}=toolbar_classPrivateFieldGet(Sf,this);t.classList.toggle("loading",e)}}function _updateToolbarDensity(e){let{value:t}=e,i="normal";switch(t){case 1:i="compact";break;case 2:i="touch"}document.documentElement.setAttribute("data-toolbar-density",i)}function toolbar_bindListeners(e){const{eventBus:t}=this,{editorHighlightColorPicker:i,editorHighlightButton:a,pageNumber:s,scaleSelect:n}=toolbar_classPrivateFieldGet(Sf,this),r=this;for(const{element:i,eventName:a,eventDetails:s,telemetry:n}of e)i&&i.addEventListener("click",(e=>{null!==a&&t.dispatch(a,{source:this,...s,isFromKeyboard:0===e.detail});n&&t.dispatch("reporttelemetry",{source:this,details:n})}));s.addEventListener("click",(function(){this.select()}));s.addEventListener("change",(function(){t.dispatch("pagenumberchanged",{source:r,value:this.value})}));n.addEventListener("change",(function(){"custom"!==this.value&&t.dispatch("scalechanged",{source:r,value:this.value})}));n.addEventListener("click",(function(e){let{target:t}=e;this.value===r.pageScaleValue&&"OPTION"===t.tagName.toUpperCase()&&this.blur()}));n.oncontextmenu=noContextMenu;t._on("annotationeditormodechanged",web_toolbar_assertClassBrand(Ef,this,_editorModeChanged).bind(this));t._on("showannotationeditorui",(e=>{let{mode:t}=e;if(t===f.HIGHLIGHT)a.click()}));t._on("toolbardensity",web_toolbar_assertClassBrand(Ef,this,_updateToolbarDensity).bind(this));if(i){t._on("annotationeditoruimanager",(e=>{let{uiManager:t}=e;const a=toolbar_classPrivateFieldSet(bf,this,new ColorPicker({uiManager:t}));t.setMainHighlightColorPicker(a);i.append(a.renderMainDropdown())}));t._on("mainhighlightcolorpickerupdatecolor",(e=>{let{value:t}=e;toolbar_classPrivateFieldGet(bf,this)?.updateColor(t)}))}}function _editorModeChanged(e){let{mode:t}=e;const{editorFreeTextButton:i,editorFreeTextParamsToolbar:a,editorHighlightButton:s,editorHighlightParamsToolbar:n,editorInkButton:r,editorInkParamsToolbar:o,editorStampButton:l,editorStampParamsToolbar:d,editorSignatureButton:c,editorSignatureParamsToolbar:h}=toolbar_classPrivateFieldGet(Sf,this);toggleExpandedBtn(i,t===f.FREETEXT,a);toggleExpandedBtn(s,t===f.HIGHLIGHT,n);toggleExpandedBtn(r,t===f.INK,o);toggleExpandedBtn(l,t===f.STAMP,d);toggleExpandedBtn(c,t===f.SIGNATURE,h);const u=t===f.DISABLE;i.disabled=u;s.disabled=u;r.disabled=u;l.disabled=u;c.disabled=u}function toolbar_updateUIState(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{pageNumber:t,pagesCount:i,pageScaleValue:a,pageScale:s}=this,n=toolbar_classPrivateFieldGet(Sf,this);if(e){if(this.hasPageLabels){n.pageNumber.type="text";n.numPages.setAttribute("data-l10n-id","pdfjs-page-of-pages")}else{n.pageNumber.type="number";n.numPages.setAttribute("data-l10n-id","pdfjs-of-pages");n.numPages.setAttribute("data-l10n-args",JSON.stringify({pagesCount:i}))}n.pageNumber.max=i}if(this.hasPageLabels){n.pageNumber.value=this.pageLabel;n.numPages.setAttribute("data-l10n-args",JSON.stringify({pageNumber:t,pagesCount:i}))}else n.pageNumber.value=t;n.previous.disabled=t<=1;n.next.disabled=t>=i;const r=Number(this.minZoom)??kl,o=Number(this.maxZoom)??10;n.zoomOut&&(n.zoomOut.disabled=s<=r);n.zoomIn&&(n.zoomIn.disabled=s>=o);let l=!1;if(n.scaleSelect.options)for(const e of n.scaleSelect.options)if(e.value===a){e.selected=!0;l=!0}else e.selected=!1;if(!l){n.customScaleOption.selected=!0;n.customScaleOption.setAttribute("data-l10n-args",JSON.stringify({scale:Math.round(1e4*s)/100}))}this.eventBus.dispatch("updateuistate",{source:this,widget:"Toolbar",pageNumber:t,pagesCount:i,pageScaleValue:a,pageScale:s})}class ViewHistory{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20;this.fingerprint=e;this.cacheSize=t;this._initializedPromise=this._readFromStorage().then((e=>{const t=JSON.parse(e||"{}");let i=-1;if(Array.isArray(t.files)){for(;t.files.length>=this.cacheSize;)t.files.shift();for(let e=0,a=t.files.length;e<a;e++){if(t.files[e].fingerprint===this.fingerprint){i=e;break}}}else t.files=[];-1===i&&(i=t.files.push({fingerprint:this.fingerprint})-1);this.file=t.files[i];this.database=t}))}async _writeToStorage(){if(AppOptions.get("disableHistory"))return;const e=JSON.stringify(this.database);try{localStorage.setItem("pdfjs.history",e)}catch(e){}}async _readFromStorage(){if(!AppOptions.get("disableHistory"))try{return localStorage.getItem("pdfjs.history")}catch(e){return}}async set(e,t){await this._initializedPromise;this.file[e]=t;return this._writeToStorage()}async setMultiple(e){await this._initializedPromise;for(const t in e)this.file[t]=e[t];return this._writeToStorage()}async get(e,t){await this._initializedPromise;const i=this.file[e];return void 0!==i?i:t}async getMultiple(e){await this._initializedPromise;const t=Object.create(null);for(const i in e){const a=this.file[i];t[i]=void 0!==a?a:e[i]}return t}}const kf=-1,If=1,Mf={initialBookmark:document.location.hash.substring(1),_initializedCapability:{...Promise.withResolvers(),settled:!1},appConfig:null,pdfDocument:null,pdfLoadingTask:null,printService:null,pdfViewer:null,pdfThumbnailViewer:null,pdfRenderingQueue:null,pdfPresentationMode:null,pdfDocumentProperties:null,pdfLinkService:null,pdfHistory:null,pdfSidebar:null,pdfOutlineViewer:null,pdfAttachmentViewer:null,pdfLayerViewer:null,pdfCursorTools:null,pdfScriptingManager:null,pdfWorker:null,store:null,downloadManager:null,overlayManager:null,preferences:new class Preferences extends BasePreferences{async _writeToStorage(e){try{localStorage.setItem("pdfjs.preferences",JSON.stringify(e))}catch(e){}}async _readFromStorage(e){try{return{prefs:JSON.parse(localStorage.getItem("pdfjs.preferences"))}}catch(e){return{}}}},toolbar:null,secondaryToolbar:null,eventBus:null,l10n:null,annotationEditorParams:null,imageAltTextSettings:null,isInitialViewSet:!1,isViewerEmbedded:window.parent!==window,url:"",baseUrl:"",mlManager:null,_downloadUrl:"",_eventBusAbortController:null,_windowAbortController:null,_globalAbortController:new AbortController,documentInfo:null,metadata:null,_contentDispositionFilename:null,_contentLength:null,_saveInProgress:!1,_wheelUnusedTicks:0,_wheelUnusedFactor:1,_touchManager:null,_touchUnusedTicks:0,_touchUnusedFactor:1,_PDFBug:null,_hasAnnotationEditors:!1,_title:document.title,_printAnnotationStoragePromise:null,_isCtrlKeyDown:!1,_caretBrowsing:null,_isScrolling:!1,editorUndoBar:null,pageOrder:null,async initialize(e){this.appConfig=e;this.cspPolicyService=e.cspPolicyService;try{await this.preferences.initializedPromise}catch(e){NgxConsole.error("initialize:",e)}AppOptions.get("pdfBugEnabled")&&await this._parseHashParams();let t;switch(AppOptions.get("viewerCssTheme")){case 1:t="light";break;case 2:t="dark"}t&&Yl.setProperty("color-scheme",t);this.l10n=await this.externalServices.createL10n();document.getElementsByTagName("html")[0].dir=this.l10n.getDirection();this.l10n.translate(e.appContainer||document.documentElement);this.isViewerEmbedded&&AppOptions.get("externalLinkTarget")===ad.NONE&&AppOptions.set("externalLinkTarget",ad.TOP);await this._initializeViewerComponents();this.bindEvents();this.bindWindowEvents();this._initializedCapability.settled=!0;this._initializedCapability.resolve();this.initializeLoadingBar()},async _parseHashParams(){const e=document.location.hash.substring(1);if(!e)return;const{mainContainer:t,viewerContainer:i}=this.appConfig,a=parseQueryString(e),loadPDFBug=async()=>{if(this._PDFBug)return;const{PDFBug:e}=await import(
/*webpackIgnore: true*/
/*@vite-ignore*/
AppOptions.get("debuggerSrc"));this._PDFBug=e};if("true"===a.get("disableworker"))try{GlobalWorkerOptions.workerSrc||=AppOptions.get("workerSrc");await import(
/*webpackIgnore: true*/
/*@vite-ignore*/
PDFWorker.workerSrc);AppOptions.set("workerPort",null)}catch(e){NgxConsole.error("_parseHashParams:",e)}if(a.has("textlayer"))switch(a.get("textlayer")){case"off":AppOptions.set("textLayerMode",jl);break;case"visible":case"shadow":case"hover":i.classList.add(`textLayer-${a.get("textlayer")}`);try{await loadPDFBug();this._PDFBug.loadCSS()}catch(e){NgxConsole.error("_parseHashParams:",e)}}if(a.has("pdfbug")){const e=a.get("pdfbug").split(",");try{await loadPDFBug();this._PDFBug.init(t,e)}catch(e){NgxConsole.error("_parseHashParams:",e)}const i={pdfBug:!0,fontExtraProperties:!0};globalThis.StepperManager?.enabled&&(i.minDurationToUpdateCanvas=0);AppOptions.setAll(i)}a.has("locale")&&AppOptions.set("localeProperties",{lang:a.get("locale")});const s={disableAutoFetch:e=>"true"===e,disableFontFace:e=>"true"===e,disableHistory:e=>"true"===e,disableRange:e=>"true"===e,disableStream:e=>"true"===e,verbosity:e=>0|e};for(const e in s){const t=s[e],i=e.toLowerCase();a.has(i)&&AppOptions.set(e,t(a.get(i)))}},async _initializeViewerComponents(){const{appConfig:e,externalServices:t,l10n:i,mlManager:a}=this,s=this._globalAbortController.signal,n=new EventBus;this.eventBus=AppOptions.eventBus=n;a?.setEventBus(n,s);const r=this.overlayManager=new OverlayManager,o=this.pdfRenderingQueue=new PDFRenderingQueue;o.onIdle=this._cleanup.bind(this);const l=this.pdfLinkService=new PDFLinkService({eventBus:n,externalLinkTarget:AppOptions.get("externalLinkTarget"),externalLinkRel:AppOptions.get("externalLinkRel"),ignoreDestinationZoom:AppOptions.get("ignoreDestinationZoom")}),d=this.downloadManager=new DownloadManager;let c=PDFFindController;AppOptions.get("findController")&&(c=AppOptions.get("findController"));const h=new c({linkService:l,eventBus:n,pageViewMode:AppOptions.get("pageViewMode"),updateMatchesCountOnProgress:!0,listenToEventBus:!1});this.customFindController=h;const u=new c({linkService:l,eventBus:n,pageViewMode:AppOptions.get("pageViewMode"),updateMatchesCountOnProgress:!0,listenToEventBus:!0});this.findController=u;const _=this.pdfScriptingManager=new PDFScriptingManager({eventBus:n,externalServices:t,docProperties:this._scriptingDocProperties.bind(this)}),p=e.mainContainer,g=e.viewerContainer,v=AppOptions.get("annotationEditorMode"),m=AppOptions.get("forcePageColors")||window.matchMedia("(forced-colors: active)").matches?{background:AppOptions.get("pageColorsBackground"),foreground:AppOptions.get("pageColorsForeground")}:null;let w;w=AppOptions.get("enableUpdatedAddImage")?e.newAltTextDialog?new NewAltTextManager(e.newAltTextDialog,r,n):null:e.altTextDialog?new AltTextManager(e.altTextDialog,p,r,n):null;e.editorUndoBar&&(this.editorUndoBar=new EditorUndoBar(e.editorUndoBar,n));const P=AppOptions.get("enableSignatureEditor")&&e.addSignatureDialog?new SignatureManager(e.addSignatureDialog,e.editSignatureDialog,e.annotationEditorParams?.editorSignatureAddSignature||null,r,i,t.createSignatureStorage(n,s),n):null,y=AppOptions.get("enableComment")&&e.editCommentDialog?new CommentManager(e.editCommentDialog,r):null,b=AppOptions.get("enableHWA"),S=AppOptions.get("maxCanvasPixels"),x=AppOptions.get("maxCanvasDim"),C=AppOptions.get("capCanvasAreaFactor"),A=this.pdfViewer=new PDFViewer({container:p,viewer:g,viewerAlert:e.viewerAlert,eventBus:n,renderingQueue:o,linkService:l,downloadManager:d,altTextManager:w,commentManager:y,signatureManager:P,editorUndoBar:this.editorUndoBar,findController:u,customFindController:h,scriptingManager:AppOptions.get("enableScripting")&&_,l10n:i,textLayerMode:AppOptions.get("textLayerMode"),annotationMode:AppOptions.get("annotationMode"),annotationEditorMode:v,annotationEditorHighlightColors:AppOptions.get("highlightEditorColors"),enableHighlightFloatingButton:AppOptions.get("enableHighlightFloatingButton"),enableUpdatedAddImage:AppOptions.get("enableUpdatedAddImage"),enableNewAltTextWhenAddingImage:AppOptions.get("enableNewAltTextWhenAddingImage"),imageResourcesPath:AppOptions.get("imageResourcesPath"),removePageBorders:AppOptions.get("removePageBorders"),enablePrintAutoRotate:AppOptions.get("enablePrintAutoRotate"),maxCanvasPixels:S,maxCanvasDim:x,capCanvasAreaFactor:C,enableDetailCanvas:AppOptions.get("enableDetailCanvas"),pageViewMode:AppOptions.get("pageViewMode"),enablePermissions:AppOptions.get("enablePermissions"),pageColors:m,mlManager:a,abortSignal:s,enableHWA:b,defaultCacheSize:AppOptions.get("defaultCacheSize"),minZoom:AppOptions.get("minZoom"),maxZoom:AppOptions.get("maxZoom"),cspPolicyService:this.cspPolicyService,supportsPinchToZoom:this.supportsPinchToZoom,enableAutoLinking:AppOptions.get("enableAutoLinking"),minDurationToUpdateCanvas:AppOptions.get("minDurationToUpdateCanvas")});o.setViewer(A);l.setViewer(A);_.setViewer(A);if(e.sidebar?.thumbnailView){this.pdfThumbnailViewer=new PDFThumbnailViewer({container:e.sidebar.thumbnailView,eventBus:n,renderingQueue:o,linkService:l,maxCanvasPixels:S,maxCanvasDim:x,pageColors:m,abortSignal:s,enableHWA:b});o.setThumbnailViewer(this.pdfThumbnailViewer)}if(!this.isViewerEmbedded&&!AppOptions.get("disableHistory")){this.pdfHistory=new PDFHistory({linkService:l,eventBus:n});l.setHistory(this.pdfHistory)}!this.supportsIntegratedFind&&e.findBar&&(this.findBar=new PDFFindBar(e.findBar,e.principalContainer,n));if(e.annotationEditorParams)if(v!==f.DISABLE){const t=e.toolbar?.editorSignatureButton;t&&AppOptions.get("enableSignatureEditor")&&(t.parentElement.hidden=!1);const i=document.getElementById("movePageUp"),a=document.getElementById("movePageDown");if(i&&a)if(AppOptions.get("enablePageReordering")){i.hidden=!1;a.hidden=!1}else{i.hidden=!0;a.hidden=!0}this.annotationEditorParams=new AnnotationEditorParams(e.annotationEditorParams,n)}else for(const e of["editorModeButtons","editorModeSeparator"])document.getElementById(e)?.classList.add("hidden");a&&e.secondaryToolbar?.imageAltTextSettingsButton&&(this.imageAltTextSettings=new ImageAltTextSettings(e.altTextSettingsDialog,r,n,a));e.documentProperties&&(this.pdfDocumentProperties=new PDFDocumentProperties(e.documentProperties,r,n,i,(()=>this._docFilename),(()=>this._docTitle)));e.secondaryToolbar?.cursorHandToolButton&&(this.pdfCursorTools=new PDFCursorTools({container:p,eventBus:n,cursorToolOnLoad:AppOptions.get("cursorToolOnLoad")}));e.toolbar&&(this.toolbar=new Toolbar(e.toolbar,n,AppOptions.get("defaultZoomValue"),AppOptions.get("minZoom"),AppOptions.get("maxZoom"),AppOptions.get("toolbarDensity")));if(e.secondaryToolbar){if(AppOptions.get("enableAltText")){e.secondaryToolbar.imageAltTextSettingsButton?.classList.remove("hidden");e.secondaryToolbar.imageAltTextSettingsSeparator?.classList.remove("hidden")}this.secondaryToolbar=new SecondaryToolbar(e.secondaryToolbar,n)}this.supportsFullscreen&&(e.toolbar?.presentationModeButton||e.secondaryToolbar?.presentationModeButton)&&(this.pdfPresentationMode=new PDFPresentationMode({container:p,pdfViewer:A,eventBus:n}));const E=AppOptions.get("passwordPrompt");E?this.passwordPrompt=E:e.passwordOverlay&&(this.passwordPrompt=new PasswordPrompt(e.passwordOverlay,r,this.isViewerEmbedded));e.sidebar?.outlineView&&(this.pdfOutlineViewer=new PDFOutlineViewer({container:e.sidebar.outlineView,eventBus:n,l10n:i,linkService:l,downloadManager:d}));e.sidebar?.attachmentsView&&(this.pdfAttachmentViewer=new PDFAttachmentViewer({container:e.sidebar.attachmentsView,eventBus:n,l10n:i,downloadManager:d}));e.sidebar?.layersView&&(this.pdfLayerViewer=new PDFLayerViewer({container:e.sidebar.layersView,eventBus:n,l10n:i}));if(e.sidebar){this.pdfSidebar=new PDFSidebar({elements:e.sidebar,eventBus:n,l10n:i});this.pdfSidebar.onToggled=this.forceRendering.bind(this);this.pdfSidebar.onUpdateThumbnails=()=>{for(const e of A.getCachedPageViews())e.renderingState===Il.FINISHED&&this.pdfThumbnailViewer.getThumbnail(e.id-1)?.setImage(e);this.pdfThumbnailViewer.scrollThumbnailIntoView(A.currentPageNumber)}}},async run(e){await this.initialize(e);const{appConfig:t,eventBus:i}=this;let a;a=parseQueryString(document.location.search.substring(1)).get("file")??AppOptions.get("defaultUrl");try{a=new URL(decodeURIComponent(a)).href}catch{a=encodeURIComponent(a).replaceAll("%2F","/")}validateFileURL(a);const s=this._openFileInput=document.createElement("input");s.id="fileInput";s.className="ngx-extended-pdf-viewer-file-input";s.hidden=!0;s.type="file";s.value=null;s.accept=".pdf,application/pdf";document.body.append(s);s.addEventListener("change",(function(e){const{files:t}=e.target;t&&0!==t.length&&i.dispatch("fileinputchange",{source:this,fileInput:e.target})}));t.mainContainer.addEventListener("dragover",(function(e){if(AppOptions.get("enableDragAndDrop")){if(!e.dataTransfer?.items)return;for(const t of e.dataTransfer.items)if("application/pdf"===t.type){e.dataTransfer.dropEffect="copy"===e.dataTransfer.effectAllowed?"copy":"move";stopEvent(e);return}}}));t.mainContainer.addEventListener("drop",(function(e){if(AppOptions.get("enableDragAndDrop")){const t=e.dataTransfer?.files;if(!t||0===t.length||"application/pdf"!==t[0].type)return;stopEvent(e);i.dispatch("fileinputchange",{source:this,fileInput:e.dataTransfer,dropEvent:e})}}));if(!AppOptions.get("supportsDocumentFonts")){AppOptions.set("disableFontFace",!0);this.l10n.get("pdfjs-web-fonts-disabled").then((e=>{NgxConsole.warn(e)}))}if(!this.supportsPrinting){t.toolbar?.print?.classList.add("hidden");t.secondaryToolbar?.printButton.classList.add("hidden")}if(!this.supportsFullscreen){t.toolbar.presentationModeButton.classList.add("hidden");t.secondaryToolbar?.presentationModeButton?.classList.add("hidden")}this.supportsIntegratedFind&&t.findBar?.toggleButton?.classList.add("hidden");a?this.open({url:a}):this._hideViewBookmark();const n=new CustomEvent("webviewerinitialized",{bubbles:!0,cancelable:!0,detail:{source:window}});try{document.dispatchEvent(n)}catch(e){NgxConsole.error(`webviewerinitialized: ${e}`);parent.document.dispatchEvent(n)}},get externalServices(){return shadow(this,"externalServices",new ExternalServices)},get initialized(){return this._initializedCapability.settled},get initializedPromise(){return this._initializedCapability.promise},updateZoom(e,t,i){this.pdfViewer.isInPresentationMode||this.pdfViewer.updateScale({drawingDelay:AppOptions.get("defaultZoomDelay"),steps:e,scaleFactor:t,origin:i})},zoomIn(){this.updateZoom(1)},zoomOut(){this.updateZoom(-1)},zoomReset(){this.pdfViewer.isInPresentationMode||(this.pdfViewer.currentScaleValue=El)},touchPinchCallback(e,t,i){if(this.supportsPinchToZoom){const a=this._accumulateFactor(this.pdfViewer.currentScale,i/t,"_touchUnusedFactor");this.updateZoom(null,a,e)}else{const a=30,s=this._accumulateTicks((i-t)/a,"_touchUnusedTicks");this.updateZoom(s,null,e)}},touchPinchEndCallback(){this._touchUnusedTicks=0;this._touchUnusedFactor=1},get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0},get page(){return this.pdfViewer.currentPageNumber},set page(e){this.pdfViewer.currentPageNumber=e},get supportsPrinting(){return shadow(this,"supportsPrinting",AppOptions.get("supportsPrinting")&&PDFPrintServiceFactory.supportsPrinting)},get supportsFullscreen(){return shadow(this,"supportsFullscreen",document.fullscreenEnabled)},get supportsPinchToZoom(){return shadow(this,"supportsPinchToZoom",AppOptions.get("supportsPinchToZoom"))},get supportsIntegratedFind(){return shadow(this,"supportsIntegratedFind",AppOptions.get("supportsIntegratedFind"))},initializeLoadingBar(){const e=document.getElementById("loadingBar"),t=e?new ProgressBar(e):null;t?.hide();return shadow(this,"loadingBar",t)},get supportsMouseWheelZoomCtrlKey(){return shadow(this,"supportsMouseWheelZoomCtrlKey",AppOptions.get("supportsMouseWheelZoomCtrlKey"))},get supportsMouseWheelZoomMetaKey(){return shadow(this,"supportsMouseWheelZoomMetaKey",AppOptions.get("supportsMouseWheelZoomMetaKey"))},get supportsCaretBrowsingMode(){return AppOptions.get("supportsCaretBrowsingMode")},moveCaret(e,t){this._caretBrowsing||=new CaretBrowsingMode(this._globalAbortController.signal,this.appConfig.mainContainer,this.appConfig.viewerContainer,this.appConfig.toolbar?.container);this._caretBrowsing.moveCaret(e,t)},setTitleUsingUrl(){},setTitle(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._title;this._title=e;if(this.isViewerEmbedded)return;const t=this._hasAnnotationEditors&&!this.pdfRenderingQueue.printing;document.title=`${t?"* ":""}${e}`},get _docFilename(){return this._contentDispositionFilename||display_utils_getPdfFilenameFromUrl(this.url,Mf.appConfig.filenameForDownload)},get _docTitle(){const{documentInfo:e,metadata:t}=this,i=t?.get("dc:title");return i&&"Untitled"!==i&&!/[\uFFF0-\uFFFF]/g.test(i)?i:e.Title},_hideViewBookmark(){if(!this.appConfig)return;const{secondaryToolbar:e}=this.appConfig;e?.viewBookmarkButton.classList.add("hidden");e?.presentationModeButton?.classList.contains("hidden")&&document.getElementById("viewBookmarkSeparator")?.classList.add("hidden")},async close(){this._unblockDocumentLoadEvent();this._hideViewBookmark();if(!this.pdfLoadingTask)return;if(this.pdfDocument?.annotationStorage.size>0&&this._annotationStorageModified)try{await this.save()}catch{}const e=[];e.push(this.pdfLoadingTask.destroy());this.pdfLoadingTask=null;if(this.pdfDocument){this.pdfDocument=null;this.pdfThumbnailViewer?.setDocument(null);this.pdfViewer.setDocument(null);this.pdfLinkService.setDocument(null);this.pdfDocumentProperties?.setDocument(null)}this.pdfLinkService.externalLinkEnabled=!0;this.store=null;this.isInitialViewSet=!1;this.url="";this.baseUrl="";this._downloadUrl="";this.documentInfo=null;this.metadata=null;this._contentDispositionFilename=null;this._contentLength=null;this._saveInProgress=!1;this._hasAnnotationEditors=!1;e.push(this.pdfScriptingManager.destroyPromise,this.passwordPrompt.close());this.setTitle();this.pdfSidebar?.reset();this.pdfOutlineViewer?.reset();this.pdfAttachmentViewer?.reset();this.pdfLayerViewer?.reset();this.pdfHistory?.reset();this.findBar?.reset();this.toolbar?.reset();this.secondaryToolbar?.reset();this._PDFBug?.cleanup();await Promise.all(e)},async open(e){this.pdfViewer?.destroyBookMode();this.pdfLoadingTask&&await this.close();const t=AppOptions.getAll(cs);t.cspPolicyService=e.cspPolicyService;if(e.workerSrc&&e.workerSrc!==t.workerSrc){t.workerSrc=e.workerSrc;this.pdfWorker=null}Object.assign(GlobalWorkerOptions,t);t.port=t.port??GlobalWorkerOptions.workerPort;t.cspPolicyService=this.cspPolicyService;null===this.pdfWorker&&(this.pdfWorker=t.port?PDFWorker.fromPort(t):new PDFWorker(t));e.url&&this.setTitleUsingUrl(e.originalUrl||e.url,e.url);const i=getDocument({...AppOptions.getAll(ds),...e,worker:this.pdfWorker,cspPolicyService:e.cspPolicyService});this.pdfLoadingTask=i;i.onPassword=(e,t)=>{this.isViewerEmbedded&&this._unblockDocumentLoadEvent();this.pdfLinkService.externalLinkEnabled=!1;this.passwordPrompt.setUpdateCallback(e,t);this.passwordPrompt.open()};i.onProgress=e=>{let{loaded:t,total:i}=e;this.progress(t/i);this.eventBus?.dispatch("progress",{source:this,type:"load",total:i,loaded:t,percent:100*t/i})};const a=this.serviceWorkerOptions.showUnverifiedSignatures;return i.promise.then((e=>{e._transport.messageHandler.send("showUnverifiedSignatures",a);this.load(e)}),(e=>{if(i!==this.pdfLoadingTask)return;let t="pdfjs-loading-error";e instanceof InvalidPDFException?t="pdfjs-invalid-file-error":e instanceof ResponseException&&(t=e.missing?"pdfjs-missing-file-error":"pdfjs-unexpected-response-error");Mf.onError&&Mf.onError(e);return this._documentError(t,{message:e.message}).then((()=>{throw e}))}))},async download(){let e;try{e=await(this.pdfDocument?this.pdfDocument.getData():this.pdfLoadingTask.getData())}catch{}this.downloadManager.download(e,this._downloadUrl,this._docFilename)},async save(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!this._saveInProgress){this._saveInProgress=!0;await this.pdfScriptingManager.dispatchWillSave();try{const t=await this.pdfDocument.saveDocument(e);this.downloadManager.download(t,this._downloadUrl,this._docFilename)}catch(e){NgxConsole.error("Error when saving the document:",e);await this.download()}finally{await this.pdfScriptingManager.dispatchDidSave();this._saveInProgress=!1}this._hasAnnotationEditors&&this.externalServices.reportTelemetry({type:"editing",data:{type:"save",stats:this.pdfDocument?.annotationStorage.editorStats}})}},async downloadOrSave(){const{classList:e}=this.appConfig.appContainer;e.add("wait");const t=this.pdfDocument?.annotationStorage.size>0||!this.pageOrder.every(((e,t,i)=>0===t||e>=i[t-1]));await(t?this.save(this.pageOrder):this.download());e.remove("wait")},movePageUp(e){if(!(e.source.pageNumber<=1)){this.pdfViewer.swapPages(e.source.pageNumber-1,e.source.pageNumber-2);this.pdfThumbnailViewer.swapThumbnails(e.source.pageNumber-1,e.source.pageNumber-2);this.page=e.source.pageNumber-1;[this.pageOrder[e.source.pageNumber-2],this.pageOrder[e.source.pageNumber-1]]=[this.pageOrder[e.source.pageNumber-1],this.pageOrder[e.source.pageNumber-2]]}},movePageDown(e){if(e.source.pageNumber!==this.pdfDocument.numPages){this.pdfViewer.swapPages(e.source.pageNumber-1,e.source.pageNumber);this.pdfThumbnailViewer.swapThumbnails(e.source.pageNumber-1,e.source.pageNumber);this.page=e.source.pageNumber+1;[this.pageOrder[e.source.pageNumber-1],this.pageOrder[e.source.pageNumber]]=[this.pageOrder[e.source.pageNumber],this.pageOrder[e.source.pageNumber-1]]}},movePage(e,t){if(e<1||e>this.pdfDocument.numPages||t<1||t>this.pdfDocument.numPages)return;const i=e-1,a=t-1;if(i<a)for(let e=i;e<a;e++){this.pdfViewer.swapPages(e,e+1);this.pdfThumbnailViewer.swapThumbnails(e,e+1);[this.pageOrder[e],this.pageOrder[e+1]]=[this.pageOrder[e+1],this.pageOrder[e]]}else if(i>a)for(let e=i;e>a;e--){this.pdfViewer.swapPages(e,e-1);this.pdfThumbnailViewer.swapThumbnails(e,e-1);[this.pageOrder[e],this.pageOrder[e-1]]=[this.pageOrder[e-1],this.pageOrder[e]]}this.page=t},async _exportWithAnnotations(){if(this._saveInProgress)throw new Error("Already downloading");this._saveInProgress=!0;await this.pdfScriptingManager.dispatchWillSave();try{this._ensureDownloadComplete();const e=await this.pdfDocument.saveDocument();return new Blob([e],{type:"application/pdf"})}catch(e){throw new Error(`Error when saving the document: ${e.message}`)}finally{await this.pdfScriptingManager.dispatchDidSave();this._saveInProgress=!1}},_ensureDownloadComplete(){if(!this.pdfDocument)throw new Error("PDF document not downloaded.")},async _exportWithoutAnnotations(){try{this._ensureDownloadComplete();const e=await this.pdfDocument.getData();return new Blob([e],{type:"application/pdf"})}catch(e){throw new Error(`Error when saving the document: ${e.message}`)}},async export(){return this.pdfDocument?.annotationStorage.size>0?this._exportWithAnnotations():this._exportWithoutAnnotations()},openInExternalApp(){this.downloadOrSave({openInExternalApp:!0})},async _documentError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this._unblockDocumentLoadEvent();const i=await this._otherError(e||"pdfjs-loading-error",t);this.eventBus.dispatch("documenterror",{source:this,message:i,reason:t?.message??null})},async _otherError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=await this.l10n.get(e),a=[`PDF.js v${zs||"?"} (build: ${Us||"?"})`];if(t){a.push(`Message: ${t.message}`);if(t.stack)a.push(`Stack: ${t.stack}`);else{t.filename&&a.push(`File: ${t.filename}`);t.lineNumber&&a.push(`Line: ${t.lineNumber}`)}}NgxConsole.error(`${i}\n\n${a.join("\n")}`);return i},progress(e){const t=Math.round(100*e);if(this.loadingBar&&!(t<=this.loadingBar.percent)){this.loadingBar.percent=t;(this.pdfDocument?.loadingParams.disableAutoFetch??AppOptions.get("disableAutoFetch"))&&this.loadingBar.setDisableAutoFetch()}},load(e){this.pdfDocument=e;e.getDownloadInfo().then((e=>{let{length:t}=e;this._contentLength=t;this.loadingBar?.hide();n.then((()=>{this.eventBus?.dispatch("documentloaded",{source:this})}))}));const t=e.getPageLayout().catch((()=>{})),i=e.getPageMode().catch((()=>{})),a=e.getOpenAction().catch((()=>{}));this.toolbar?.setPagesCount(e.numPages,!1);this.secondaryToolbar?.setPagesCount(e.numPages);this.pdfLinkService.setDocument(e);this.pdfDocumentProperties?.setDocument(e);const s=this.pdfViewer;s.setDocument(e);const{firstPagePromise:n,onePageRendered:r,pagesPromise:o}=s;this.pdfThumbnailViewer?.setDocument(e);const l=(this.store=new ViewHistory(e.fingerprints[0])).getMultiple({page:null,zoom:El,scrollLeft:"0",scrollTop:"0",rotation:null,sidebarView:Dl,scrollMode:zl.UNKNOWN,spreadMode:Ul.UNKNOWN}).catch((()=>{}));n.then((n=>{this.loadingBar?.setWidth(this.appConfig.viewerContainer);this._initializeAnnotationStorageCallbacks(e);Promise.all([Kl,l,t,i,a]).then((async t=>{let[i,a,n,r,l]=t;const d=AppOptions.get("viewOnLoad");this._initializePdfHistory({fingerprint:e.fingerprints[0],viewOnLoad:d,initialDest:l?.dest});const c=this.initialBookmark;let h=AppOptions.get("defaultZoomValue");if(!h||""===h)try{h=await this.store.get("zoom");"string"==typeof h&&(h=h?.replace("%",""));isNaN(Number(h))||(h=Number(h)/100)}catch(e){}!s.currentScaleValue&&h&&""!==h&&(s.currentScaleValue=h);let u=h?`zoom=${h}`:null,_=null,p=AppOptions.get("sidebarViewOnLoad"),g=AppOptions.get("scrollModeOnLoad"),f=AppOptions.get("spreadModeOnLoad");if(a?.page&&d!==If){u=`page=${a.page}&zoom=${h||a.zoom},${a.scrollLeft},${a.scrollTop}`;_=parseInt(a.rotation,10);p===Dl&&(p=0|a.sidebarView);g===zl.UNKNOWN&&(g=0|a.scrollMode);f===Ul.UNKNOWN&&(f=0|a.spreadMode)}r&&p===Dl&&(p=function apiPageModeToSidebarView(e){switch(e){case"UseNone":return Ll;case"UseThumbs":return Rl;case"UseOutlines":return Nl;case"UseAttachments":return Ol;case"UseOC":return Wl}return Ll}(r));if(n&&g===zl.UNKNOWN&&f===Ul.UNKNOWN){f=apiPageLayoutToViewerModes(n).spreadMode}this.setInitialView(u,{rotation:_,sidebarView:p,scrollMode:g,spreadMode:f});this.eventBus.dispatch("documentinit",{source:this});await Promise.race([o,new Promise((e=>{setTimeout(e,10)}))]);if((c||u)&&!s.hasEqualPageSizes){this.initialBookmark=c;s.currentScaleValue=s.currentScaleValue;this.setInitialView(u)}})).catch((()=>{this.setInitialView()})).then((function(){s.update()}))}));o.then((()=>{this._unblockDocumentLoadEvent();this._initializeAutoPrint(e,a)}),(e=>{Mf.onError&&Mf.onError(e);this._documentError("pdfjs-loading-error",{message:e.message})}));r.then((t=>{this.externalServices.reportTelemetry({type:"pageInfo",timestamp:t.timestamp});this.pdfOutlineViewer&&e.getOutline().then((t=>{e===this.pdfDocument&&this.pdfOutlineViewer.render({outline:t,pdfDocument:e})}));this.pdfAttachmentViewer&&e.getAttachments().then((t=>{e===this.pdfDocument&&this.pdfAttachmentViewer.render({attachments:t})}));this.pdfLayerViewer&&s.optionalContentConfigPromise.then((t=>{e===this.pdfDocument&&this.pdfLayerViewer.render({optionalContentConfig:t,pdfDocument:e})}))}));this._initializePageLabels(e);this._initializeMetadata(e);this._initializePageOrder(e)},async _scriptingDocProperties(e){if(!this.documentInfo){await new Promise((e=>{this.eventBus._on("metadataloaded",e,{once:!0})}));if(e!==this.pdfDocument)return null}if(!this._contentLength){await new Promise((e=>{this.eventBus._on("documentloaded",e,{once:!0})}));if(e!==this.pdfDocument)return null}return{...this.documentInfo,baseURL:this.baseUrl,filesize:this._contentLength,filename:this._docFilename,metadata:this.metadata?.getRaw(),authors:this.metadata?.get("dc:creator"),numPages:this.pagesCount,URL:this.url}},async _initializeAutoPrint(e,t){const[i,a]=await Promise.all([t,this.pdfViewer.enableScripting?null:e.getJSActions()]);if(e!==this.pdfDocument)return;let s="Print"===i?.action;if(a){NgxConsole.warn("Warning: JavaScript support is not enabled");for(const e in a){if(s)break;switch(e){case"WillClose":case"WillSave":case"DidSave":case"WillPrint":case"DidPrint":continue}s=a[e].some((e=>ql.test(e)))}}s&&this.triggerPrinting()},async _initializeMetadata(e){const{info:t,metadata:i,contentDispositionFilename:a,contentLength:s}=await e.getMetadata();if(e!==this.pdfDocument)return;t.collectedSignatureCertificates&&this.externalServices.reportTelemetry({type:"signatureCertificates",data:t.collectedSignatureCertificates});this.documentInfo=t;this.metadata=i;this._contentDispositionFilename??=a;this._contentLength??=s;AppOptions?.get("verbosity")>0&&NgxConsole.log(`PDF ${e.fingerprints[0]} [${t.PDFFormatVersion} ${(i?.get("pdf:producer")||t.Producer||"-").trim()} / ${(i?.get("xmp:creatortool")||t.Creator||"-").trim()}] (PDF.js: ${zs||"?"} [${Us||"?"}])  modified by ngx-extended-pdf-viewer 25.0.0-alpha.2`);const n=this._docTitle;n?this.setTitle(`${n} - ${this._contentDispositionFilename||this._title}`):this._contentDispositionFilename&&this.setTitle(this._contentDispositionFilename);!t.IsXFAPresent||t.IsAcroFormPresent||e.isPureXfa?!t.IsAcroFormPresent&&!t.IsXFAPresent||this.pdfViewer.renderForms||NgxConsole.warn("Warning: Interactive form support is not enabled"):e.loadingParams.enableXfa?NgxConsole.warn("Warning: XFA Foreground documents are not supported"):NgxConsole.warn("Warning: XFA support is not enabled");t.IsSignaturesPresent&&NgxConsole.warn("Warning: Digital signatures validation is not supported");this.eventBus.dispatch("metadataloaded",{source:this})},async _initializePageOrder(e){e===this.pdfDocument&&(this.pageOrder=Array.from({length:this.pdfDocument.numPages},((e,t)=>t+1)))},async _initializePageLabels(e){const t=await e.getPageLabels();if(e!==this.pdfDocument)return;if(!t||AppOptions.get("disablePageLabels"))return;const i=t.length;let a=0,s=0;for(let e=0;e<i;e++){const i=t[e];if(i===(e+1).toString())a++;else{if(""!==i)break;s++}}if(a>=i||s>=i)return;const{pdfViewer:n,pdfThumbnailViewer:r,toolbar:o}=this;n.setPageLabels(t);r?.setPageLabels(t);o?.setPagesCount(i,!0);o?.setPageNumber(n.currentPageNumber,n.currentPageLabel)},_initializePdfHistory(e){let{fingerprint:t,viewOnLoad:i,initialDest:a=null}=e;if(this.pdfHistory){this.pdfHistory.initialize({fingerprint:t,resetHistory:i===If,updateUrl:AppOptions.get("historyUpdateUrl")});if(this.pdfHistory.initialBookmark){this.initialBookmark=this.pdfHistory.initialBookmark;this.initialRotation=this.pdfHistory.initialRotation}if(a&&!this.initialBookmark&&i===kf){this.initialBookmark=JSON.stringify(a);this.pdfHistory.push({explicitDest:a,pageNumber:null})}}},_initializeAnnotationStorageCallbacks(e){if(e!==this.pdfDocument)return;const{annotationStorage:t}=e;t.onSetModified=()=>{window.addEventListener("beforeunload",beforeUnload);this._annotationStorageModified=!0};t.onResetModified=()=>{window.removeEventListener("beforeunload",beforeUnload);delete this._annotationStorageModified};t.onAnnotationEditor=e=>{this._hasAnnotationEditors=!!e;this.setTitle()}},setInitialView(e){let{rotation:t,sidebarView:i,scrollMode:a,spreadMode:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const setRotation=e=>{isValidRotation(e)&&(this.pdfViewer.pagesRotation=e)};this.isInitialViewSet=!0;this.pdfSidebar?.setInitialView(i);((e,t)=>{isValidScrollMode(e)&&(this.pdfViewer.scrollMode=e);isValidSpreadMode(t)&&(this.pdfViewer.spreadMode=t)})(a,s);if(this.initialBookmark){setRotation(this.initialRotation);delete this.initialRotation;this.pdfLinkService.setHash&&this.pdfLinkService.setHash(this.initialBookmark);this.initialBookmark=null}else if(e){setRotation(t);this.pdfLinkService.setHash&&this.pdfLinkService.setHash(e)}this.toolbar?.setPageNumber(this.pdfViewer.currentPageNumber,this.pdfViewer.currentPageLabel);this.secondaryToolbar?.setPageNumber(this.pdfViewer.currentPageNumber);if(!this.pdfViewer.currentScaleValue){const e=AppOptions?.get("defaultZoomValue");e&&(this.pdfViewer.currentScaleValue=e)}},_cleanup(){if(this.resizeObserver){this.resizeObserver.disconnect();this.resizeObserver=null}if(this.pdfDocument){this.pdfViewer.cleanup();this.pdfThumbnailViewer?.cleanup();this.pdfDocument.cleanup(AppOptions.get("fontExtraProperties"))}},forceRendering(){this.pdfRenderingQueue.printing=!!this.printService;this.pdfRenderingQueue.isThumbnailViewEnabled=this.pdfSidebar?.visibleView===Rl;this.pdfRenderingQueue.renderHighestPriority()},beforePrint(){this._printAnnotationStoragePromise=this.pdfScriptingManager.dispatchWillPrint().catch((()=>{})).then((()=>this.pdfDocument?.annotationStorage.print));if(!this.printService)if(this.supportsPrinting)if(this.pdfViewer.pageViewsReady){this.printService=PDFPrintServiceFactory.createPrintService({pdfDocument:this.pdfDocument,pagesOverview:this.pdfViewer.getPagesOverview(),printResolution:AppOptions.get("printResolution"),printAnnotationStoragePromise:this._printAnnotationStoragePromise,pageOrder:this.pageOrder,eventBus:this.pdfViewer.eventBus,cspPolicyService:this.cspPolicyService});this.forceRendering();this.setTitle();this.printService.layout();this._hasAnnotationEditors&&this.externalServices.reportTelemetry({type:"editing",data:{type:"print",stats:this.pdfDocument?.annotationStorage.editorStats}})}else this.l10n.get("pdfjs-printing-not-ready").then((e=>{window.alert(e)}));else this._otherError("pdfjs-printing-not-supported")},afterPrint(){if(this._printAnnotationStoragePromise){this._printAnnotationStoragePromise.then((()=>{this.pdfScriptingManager.dispatchDidPrint()}));this._printAnnotationStoragePromise=null}if(this.printService){this.printService.destroy();this.printService=null;this.pdfDocument?.annotationStorage.resetModified()}this.forceRendering();this.setTitle()},rotatePages(e){this.pdfViewer.pagesRotation+=e},requestPresentationMode(){this.pdfPresentationMode?.request()},triggerPrinting(){this.supportsPrinting&&this.printPdf()},bindEvents(){if(this._eventBusAbortController)return;const e={signal:(this._eventBusAbortController=new AbortController).signal},{eventBus:t,externalServices:i,pdfDocumentProperties:a,pdfViewer:s,preferences:n}=this;t._on("resize",onResize.bind(this),e);t._on("hashchange",onHashchange.bind(this),e);t._on("beforeprint",this.beforePrint.bind(this),e);t._on("afterprint",this.afterPrint.bind(this),e);t._on("pagerender",onPageRender.bind(this),e);t._on("pagerendered",onPageRendered.bind(this),e);t._on("updateviewarea",onUpdateViewarea.bind(this),e);t._on("pagechanging",onPageChanging.bind(this),e);t._on("scalechanging",onScaleChanging.bind(this),e);t._on("rotationchanging",onRotationChanging.bind(this),e);t._on("sidebarviewchanged",onSidebarViewChanged.bind(this),e);t._on("pagemode",onPageMode.bind(this),e);t._on("namedaction",onNamedAction.bind(this),e);t._on("presentationmodechanged",(e=>s.presentationModeState=e.state),e);t._on("presentationmode",this.requestPresentationMode.bind(this),e);t._on("switchannotationeditormode",(e=>s.annotationEditorMode=e),e);t._on("print",this.triggerPrinting.bind(this),e);t._on("download",this.downloadOrSave.bind(this),e);t._on("movePageUp",this.movePageUp.bind(this),e);t._on("movePageDown",this.movePageDown.bind(this),e);t._on("firstpage",(()=>this.page=1),e);t._on("lastpage",(()=>this.page=this.pagesCount),e);t._on("nextpage",(()=>s.nextPage()),e);t._on("previouspage",(()=>s.previousPage()),e);t._on("zoomin",this.zoomIn.bind(this),e);t._on("zoomout",this.zoomOut.bind(this),e);t._on("zoomreset",this.zoomReset.bind(this),e);t._on("pagenumberchanged",onPageNumberChanged.bind(this),e);t._on("scalechanged",(e=>s.currentScaleValue=e.value),e);t._on("rotatecw",this.rotatePages.bind(this,90),e);t._on("rotateccw",this.rotatePages.bind(this,-90),e);t._on("optionalcontentconfig",(e=>s.optionalContentConfigPromise=e.promise),e);t._on("switchscrollmode",(e=>s.scrollMode=e.mode),e);t._on("scrollmodechanged",onViewerModesChanged.bind(this,"scrollMode"),e);t._on("switchspreadmode",(e=>s.spreadMode=e.mode),e);t._on("spreadmodechanged",onViewerModesChanged.bind(this,"spreadMode"),e);t._on("imagealttextsettings",onImageAltTextSettings.bind(this),e);t._on("documentproperties",(()=>a?.open()),e);t._on("findfromurlhash",onFindFromUrlHash.bind(this),e);t._on("updatefindmatchescount",onUpdateFindMatchesCount.bind(this),e);t._on("updatefindcontrolstate",onUpdateFindControlState.bind(this),e);t._on("fileinputchange",onFileInputChange.bind(this),e);t._on("openfile",onOpenFile.bind(this),e)},bindWindowEvents(){if(this._windowAbortController)return;this._windowAbortController=new AbortController;const{eventBus:e,appConfig:{mainContainer:t},pdfViewer:i,_windowAbortController:{signal:a}}=this;this._touchManager=new TouchManager({container:window,isPinchingDisabled:()=>i.isInPresentationMode,isPinchingStopped:()=>this.overlayManager?.active,onPinching:this.touchPinchCallback.bind(this),onPinchEnd:this.touchPinchEndCallback.bind(this),signal:a});!function addWindowResolutionChange(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null)&&i.refresh();window.matchMedia(`(resolution: ${OutputScale.pixelRatio}dppx)`).addEventListener("change",addWindowResolutionChange,{once:!0,signal:a})}();const s=document.getElementById("viewerContainer");s?.addEventListener("wheel",onWheel.bind(this),{passive:!1,signal:a});window.addEventListener("wheel",onWheel.bind(this),{passive:!1,signal:a});window.addEventListener("click",onClick.bind(this),{signal:a});window.addEventListener("keydown",onKeyDown.bind(this),{signal:a});window.addEventListener("keyup",onKeyUp.bind(this),{signal:a});if(s){let i,a=t.clientWidth,s=t.clientHeight;this.resizeObserver=new ResizeObserver((n=>{const r=t.clientWidth,o=t.clientHeight;if(r!==a||o!==s){clearTimeout(i);i=setTimeout((()=>{t.offsetParent&&e.dispatch("resize",{source:t})}),50);a=r;s=o}}));this.resizeObserver.observe(t)}else window.addEventListener("resize",(()=>e.dispatch("resize",{source:window})),{signal:a});window.addEventListener("hashchange",(()=>{e.dispatch("hashchange",{source:window,hash:document.location.hash.substring(1)})}),{signal:a});window.addEventListener("beforeprint",(()=>e.dispatch("beforeprint",{source:window})),{signal:a});window.addEventListener("afterprint",(()=>e.dispatch("afterprint",{source:window})),{signal:a});window.addEventListener("updatefromsandbox",(t=>{e.dispatch("updatefromsandbox",{source:window,detail:t.detail})}),{signal:a});if(!("onscrollend"in document.documentElement))return;({scrollTop:this._lastScrollTop,scrollLeft:this._lastScrollLeft}=t);const scrollend=()=>{({scrollTop:this._lastScrollTop,scrollLeft:this._lastScrollLeft}=t);this._isScrolling=!1;t.addEventListener("scroll",scroll,{passive:!0,signal:a});t.removeEventListener("scrollend",scrollend);t.removeEventListener("blur",scrollend)},scroll=()=>{if(!this._isCtrlKeyDown&&(this._lastScrollTop!==t.scrollTop||this._lastScrollLeft!==t.scrollLeft)){t.removeEventListener("scroll",scroll);this._isScrolling=!0;t.addEventListener("scrollend",scrollend,{signal:a});t.addEventListener("blur",scrollend,{signal:a})}};t.addEventListener("scroll",scroll,{passive:!0,signal:a})},unbindEvents(){this._eventBusAbortController?.abort();this._eventBusAbortController=null},unbindWindowEvents(){this._windowAbortController?.abort();this._windowAbortController=null;this._touchManager=null},async testingClose(){this.unbindEvents();this.unbindWindowEvents();this._globalAbortController?.abort();this._globalAbortController=null;this.findBar?.close();await Promise.all([this.l10n?.destroy(),this.close()])},_accumulateTicks(e,t){(this[t]>0&&e<0||this[t]<0&&e>0)&&(this[t]=0);this[t]+=e;const i=Math.trunc(this[t]);this[t]-=i;return i},_accumulateFactor(e,t,i){if(1===t)return 1;(this[i]>1&&t<1||this[i]<1&&t>1)&&(this[i]=1);const a=Math.floor(e*t*this[i]*100)/(100*e);this[i]=t/a;return a},_unblockDocumentLoadEvent(){document.blockUnblockOnload?.(!1);this._unblockDocumentLoadEvent=()=>{}},get scriptingReady(){return this.pdfScriptingManager.ready}};PDFPrintServiceFactory.initGlobals(Mf);{const e=new Set(["null","http://mozilla.github.io","https://mozilla.github.io"]);var validateFileURL=function(t){if(!t)return;const i=URL.parse(window.location)?.origin||"null";if(e.has(i))return;const a=URL.parse(t,window.location)?.origin;if(a===i)return;const s=new Error("file origin does not match viewer's");Mf._documentError("pdfjs-loading-error",{message:s.message});Mf.onError&&Mf.onError(s);throw s},onFileInputChange=function(e){if(this.pdfViewer?.isInPresentationMode)return;const t=e.fileInput.files[0];this.open({url:URL.createObjectURL(t),originalUrl:encodeURIComponent(t.name)})},onOpenFile=function(e){this._openFileInput?.click()}}function onPageRender(e){let{pageNumber:t}=e;t===this.page&&this.toolbar?.updateLoadingIndicatorState(!0)}function onPageRendered(e){let{pageNumber:t,isDetailView:i,error:a}=e;t===this.page&&this.toolbar?.updateLoadingIndicatorState(!1);if(!i&&this.pdfSidebar?.visibleView===Rl){const e=this.pdfViewer.getPageView(t-1),i=this.pdfThumbnailViewer?.getThumbnail(t-1);e&&i?.setImage(e)}a&&this._otherError("pdfjs-rendering-error",a)}function onPageMode(e){let t,{mode:i}=e;switch(i){case"thumbs":t=Rl;break;case"bookmarks":case"outline":t=Nl;break;case"attachments":t=Ol;break;case"layers":t=Wl;break;case"none":t=Ll;break;default:NgxConsole.error('Invalid "pagemode" hash parameter: '+i);return}this.pdfSidebar?.switchView(t,!0)}function onNamedAction(e){switch(e.action){case"GoToPage":this.appConfig.toolbar?.pageNumber.select();break;case"Find":this.supportsIntegratedFind||this.findBar?.toggle();break;case"Print":this.triggerPrinting();break;case"SaveAs":this.downloadOrSave()}}function onSidebarViewChanged(e){let{view:t}=e;this.pdfRenderingQueue.isThumbnailViewEnabled=t===Rl;this.isInitialViewSet&&this.store?.set("sidebarView",t).catch((()=>{}))}function onUpdateViewarea(e){let{location:t}=e;if(this.isInitialViewSet){const e={};void 0===t.pageNumber&&null===t.pageNumber||(e.page=t.pageNumber);t.scale&&(e.zoom=t.scale);t.left&&(e.scrollLeft=t.left);t.top&&(e.scrollTop=t.top);void 0===t.rotation&&null===t.rotation||(e.rotation=t.rotation);Mf.store?.setMultiple(e).catch((()=>{}))}this.appConfig.secondaryToolbar&&(this.appConfig.secondaryToolbar.viewBookmarkButton.href=this.pdfLinkService.getAnchorUrl(t.pdfOpenParams))}function onViewerModesChanged(e,t){this.isInitialViewSet&&!this.pdfViewer.isInPresentationMode&&this.store?.set(e,t.mode).catch((()=>{}))}function onResize(){const{pdfDocument:e,pdfViewer:t,pdfRenderingQueue:i}=this;if(i.printing&&window.matchMedia("print").matches)return;if(!e)return;const a=t.currentScaleValue;"auto"!==a&&"page-fit"!==a&&"page-width"!==a||(t.currentScaleValue=a);t.update()}function onHashchange(e){const t=e.hash;t&&(this.isInitialViewSet?this.pdfHistory?.popStateInProgress||this.pdfLinkService.setHash&&this.pdfLinkService.setHash(t):this.initialBookmark=t)}function onPageNumberChanged(e){const{pdfViewer:t}=this;""!==e.value&&this.pdfLinkService.goToPage(e.value);e.value!==t.currentPageNumber.toString()&&e.value!==t.currentPageLabel&&this.toolbar?.setPageNumber(t.currentPageNumber,t.currentPageLabel)}function onImageAltTextSettings(){this.imageAltTextSettings?.open({enableGuessAltText:AppOptions.get("enableGuessAltText"),enableNewAltTextWhenAddingImage:AppOptions.get("enableNewAltTextWhenAddingImage")})}function onFindFromUrlHash(e){this.eventBus.dispatch("find",{source:e.source,type:"",query:e.query,caseSensitive:!1,entireWord:!1,highlightAll:!0,findPrevious:!1,matchDiacritics:!0})}function onUpdateFindMatchesCount(e){let{matchesCount:t}=e;this.supportsIntegratedFind?this.externalServices.updateFindMatchesCount(t):this.findBar?.updateResultsCount(t)}function onUpdateFindControlState(e){let{state:t,previous:i,entireWord:a,matchesCount:s,rawQuery:n}=e;this.supportsIntegratedFind?this.externalServices.updateFindControlState({result:t,findPrevious:i,entireWord:a,matchesCount:s,rawQuery:n}):this.findBar?.updateUIState(t,i,s)}function onScaleChanging(e){this.toolbar?.setPageScale(e.presetValue,e.scale);this.pdfViewer.update(e.noScroll);this.pdfViewer.updateBookModeScale(e)}function onRotationChanging(e){this.pdfThumbnailViewer&&(this.pdfThumbnailViewer.pagesRotation=e.pagesRotation);this.forceRendering();this.pdfViewer.currentPageNumber=e.pageNumber}function onPageChanging(e){let{pageNumber:t,pageLabel:i}=e;this.toolbar?.setPageNumber(t,i);this.secondaryToolbar?.setPageNumber(t);this.pdfSidebar?.visibleView===Rl&&this.pdfThumbnailViewer?.scrollThumbnailIntoView(t);const a=this.pdfViewer.getPageView(t-1);this.toolbar?.updateLoadingIndicatorState(a?.renderingState===Il.RUNNING);const s=document.getElementById("pageNumber");if(s){const e=new CustomEvent("page-change");s.dispatchEvent(e)}}function onWheel(e){const t=document.getElementById("viewerContainer");if(t.parentNode.querySelector(":hover")!==t)return;const{pdfViewer:i,supportsMouseWheelZoomCtrlKey:a,supportsMouseWheelZoomMetaKey:s,supportsPinchToZoom:n}=this;if(i.isInPresentationMode)return;const r=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0);if(Mf?.isKeyIgnored&&Mf.isKeyIgnored(r,"WHEEL"))return;const o=e.deltaMode;let l=Math.exp(-e.deltaY/100);const d=e.ctrlKey&&!this._isCtrlKeyDown&&o===WheelEvent.DOM_DELTA_PIXEL&&0===e.deltaX&&(Math.abs(l-1)<.05||!1)&&0===e.deltaZ,c=[e.clientX,e.clientY];if(d||e.ctrlKey&&a||e.metaKey&&s){e.preventDefault();if(this._isScrolling||"hidden"===document.visibilityState||this.overlayManager.active)return;if(d&&n){l=this._accumulateFactor(i.currentScale,l,"_wheelUnusedFactor");this.updateZoom(null,l,c)}else{const t=normalizeWheelEventDirection(e);let i=0;if(o===WheelEvent.DOM_DELTA_LINE||o===WheelEvent.DOM_DELTA_PAGE)i=Math.abs(t)>=1?Math.sign(t):this._accumulateTicks(t,"_wheelUnusedTicks");else{const e=30;i=this._accumulateTicks(t/e,"_wheelUnusedTicks")}this.updateZoom(i,null,c)}}}function closeSecondaryToolbar(e){let{target:t}=e;if(!this.secondaryToolbar?.isOpen)return;const{toolbar:i,secondaryToolbar:a}=this.appConfig;if(this.pdfViewer.containsElement(t)||i?.container.contains(t)&&!a?.toolbar.contains(t)&&!a?.toggleButton.contains(t)){if(evt.target&&evt.target.parentElement===appConfig.secondaryToolbar.toggleButton)return;if(evt.target&&evt.target.parentElement&&evt.target.parentElement.parentElement===appConfig.secondaryToolbar.toggleButton)return;this.secondaryToolbar.close()}}function closeEditorUndoBar(e){this.editorUndoBar?.isOpen&&this.appConfig.secondaryToolbar?.toolbar.contains(e.target)&&this.editorUndoBar.hide()}function onClick(e){closeSecondaryToolbar.call(this,e);closeEditorUndoBar.call(this,e)}function onKeyUp(e){"Control"===e.key&&(this._isCtrlKeyDown=!1)}function onKeyDown(e){this._isCtrlKeyDown="Control"===e.key;this.editorUndoBar?.isOpen&&9!==e.keyCode&&16!==e.keyCode&&(13!==e.keyCode&&32!==e.keyCode||getActiveOrFocusedElement()!==this.appConfig.editorUndoBar.undoButton)&&this.editorUndoBar.hide();if(this.overlayManager.active)return;const{eventBus:t,pdfViewer:i}=this,a=i.isInPresentationMode;let s=!1,n=!1;const r=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0);if(Mf.ngxKeyboardManager&&Mf.ngxKeyboardManager.isKeyIgnored.bind(Mf.ngxKeyboardManager)(r,e.keyCode))return;if(1===r||8===r||5===r||12===r)switch(e.keyCode){case 70:if(!this.supportsIntegratedFind&&!e.shiftKey){if(AppOptions.get("textLayerMode")!==jl){let e=!1;const t=this.pdfViewer.viewer.closest("#outerContainer")?.querySelector("#primaryViewFind");t&&(e||=!t?.classList.contains("dummy-component"));const i=this.pdfViewer.viewer.closest("#outerContainer")?.querySelector("#secondaryToolbarToggle");if(!i.hidden){const t=this.pdfViewer.viewer.closest("#outerContainer")?.querySelector("#secondaryViewFind");t&&(e||=!t?.classList.contains("dummy-component"))}e&&this.findBar?.open()}s=!0}break;case 71:if(!this.supportsIntegratedFind){const{state:e}=this.findController;if(e){const i={source:window,type:"again",findPrevious:5===r||12===r};t.dispatch("find",{...e,...i})}s=!0}break;case 61:case 107:case 187:case 171:this.zoomIn();s=!0;break;case 173:case 109:case 189:this.zoomOut();s=!0;break;case 48:case 96:if(!a){setTimeout((()=>{this.zoomReset()}));s=!1}break;case 38:if(a||this.page>1){this.page=1;s=!0;n=!0}break;case 40:if(a||this.page<this.pagesCount){this.page=this.pagesCount;s=!0;n=!0}}if(1===r||8===r)switch(e.keyCode){case 83:t.dispatch("download",{source:window});s=!0;break;case 79:t.dispatch("openfile",{source:window});s=!0}if(3===r||10===r)switch(e.keyCode){case 80:this.requestPresentationMode();s=!0;this.externalServices.reportTelemetry({type:"buttons",data:{id:"presentationModeKeyboard"}});break;case 71:if(this.appConfig.toolbar){this.appConfig.toolbar.pageNumber.select();s=!0}}if(s){n&&!a&&i.focus();e.preventDefault();return}const o=getActiveOrFocusedElement(),l=o?.tagName.toUpperCase();if(!("INPUT"===l||"TEXTAREA"===l||"SELECT"===l||"BUTTON"===l&&32===e.keyCode||o?.isContentEditable)||27===e.keyCode){if(0===r){let t=0,r=!1;switch(e.keyCode){case 38:if(this.supportsCaretBrowsingMode){this.moveCaret(!0,!1);s=!0;break}case 33:i.isVerticalScrollbarEnabled&&(r=!0);t=-1;break;case 8:a||(r=!0);t=-1;break;case 37:if(this.supportsCaretBrowsingMode)return;i.isHorizontalScrollbarEnabled&&(r=!0);case 75:case 80:t=-1;break;case 27:if(this.secondaryToolbar?.isOpen){this.secondaryToolbar.close();s=!0}if(!this.supportsIntegratedFind&&this.findBar?.opened){this.findBar.close();s=!0}break;case 40:if(this.supportsCaretBrowsingMode){this.moveCaret(!1,!1);s=!0;break}case 34:i.isVerticalScrollbarEnabled&&(r=!0);t=1;break;case 32:a||(r=!0);t=1;break;case 39:if(this.supportsCaretBrowsingMode)return;i.isHorizontalScrollbarEnabled&&(r=!0);case 74:case 78:t=1;break;case 36:if(a||this.page>1){this.page=1;s=!0;n=!0}break;case 35:if(a||this.page<this.pagesCount){this.page=this.pagesCount;s=!0;n=!0}break;case 83:this.pdfCursorTools?.switchTool($l.SELECT);break;case 72:this.pdfCursorTools?.switchTool($l.HAND);break;case 82:this.rotatePages(90);break;case 115:this.pdfSidebar?.toggle()}if(0!==t&&(!r||"page-fit"===i.currentScaleValue)){const{mainContainer:e}=this.appConfig;(function viewerIsAllowedToCaptureKeyEvent(e){let t=document.activeElement;const i=e.closest("ngx-extended-pdf-viewer");for(;t&&t!==document.body;){if(t===i)return!0;if(-1!==t.tabIndex)return!1;t=t.parentElement}return!0})(e)&&(t>0?i.nextPage():i.previousPage());s=!0}}if(4===r)switch(e.keyCode){case 32:if(!a&&"page-fit"!==i.currentScaleValue)break;i.previousPage();s=!0;break;case 38:this.moveCaret(!0,!0);s=!0;break;case 40:this.moveCaret(!1,!0);s=!0;break;case 82:this.rotatePages(-90)}n&&!i.containsElement(o)&&i.focus();s&&e.preventDefault()}}function beforeUnload(e){e.preventDefault();e.returnValue="";return!1}Mf.printPdf=function printPdf(){if(this.enablePrint)if(Xu)NgxConsole.warn("Ignored this.printPDF() because of a pending print job.");else{ensureOverlay().then((function(){Xu&&Yu.open(Ku)}));try{dispatchEvent("beforeprint")}finally{if(Xu){const e=Xu,t=document.createElement("div");t.id="printContainer";document.body.append(t);e.printContainer=t;Xu.renderPages().then((function(){const t=document.getElementById("printServiceDialog");t&&t.classList.add("hidden");return e.performPrint()})).catch((()=>{})).then((()=>{e.active&&abort()}))}else{NgxConsole.error("Expected print service to be initialized.");ensureOverlay().then((function(){Yu.closeIfActive(Ku)}))}}}};Mf.PDFPrintServiceFactory=PDFPrintServiceFactory;Mf.ngxConsole=new NgxConsole;Mf.serviceWorkerOptions={showUnverifiedSignatures:!1};const Bf={LinkTarget:ad,RenderingStates:Il,ScrollMode:zl,SpreadMode:Ul};HTMLCollection.prototype[Symbol.iterator]||(HTMLCollection.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator]);"function"!=typeof window.CustomEvent&&(window.CustomEvent=function CustomEvent(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};const i=document.createEvent("CustomEvent");i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail);return i});function webViewerLoad(e){const t=function getViewerConfiguration(){return{appContainer:document.getElementsByClassName("body")[0]??document.body,principalContainer:document.getElementById("mainContainer"),mainContainer:document.getElementById("viewerContainer"),viewerContainer:document.getElementById("viewer"),viewerAlert:document.getElementById("viewer-alert"),toolbar:{container:document.getElementById("toolbarContainer"),numPages:document.getElementById("numPages"),pageNumber:document.getElementById("pageNumber"),scaleSelect:document.getElementById("scaleSelect"),customScaleOption:document.getElementById("customScaleOption"),previous:document.getElementById("previous"),next:document.getElementById("next"),zoomIn:document.getElementById("primaryZoomIn")??document.getElementById("zoomInButton"),zoomOut:document.getElementById("primaryZoomOut")??document.getElementById("zoomOutButton"),print:document.getElementById("printButton"),editorFreeTextButton:document.getElementById("primaryEditorFreeText")??document.getElementById("editorFreeTextButton"),editorFreeTextParamsToolbar:document.getElementById("editorFreeTextParamsToolbar"),editorHighlightButton:document.getElementById("primaryEditorHighlight")??document.getElementById("editorHighlightButton"),editorHighlightParamsToolbar:document.getElementById("editorHighlightParamsToolbar"),editorHighlightColorPicker:document.getElementById("editorHighlightColorPicker"),editorInkButton:document.getElementById("primaryEditorInk")??document.getElementById("editorInkButton"),editorInkParamsToolbar:document.getElementById("editorInkParamsToolbar"),editorStampButton:document.getElementById("primaryEditorStamp")??document.getElementById("editorStampButton"),presentationModeButton:document.getElementById("presentationMode"),editorStampParamsToolbar:document.getElementById("editorStampParamsToolbar"),editorSignatureButton:document.getElementById("primaryEditorSignatureButton")??document.getElementById("editorSignatureButton"),editorSignatureParamsToolbar:document.getElementById("editorSignatureParamsToolbar"),download:document.getElementById("downloadButton"),movePageUp:document.getElementById("movePageUpButton"),movePageDown:document.getElementById("movePageDownButton")},secondaryToolbar:{toolbar:document.getElementById("secondaryToolbar"),toggleButton:document.getElementById("secondaryToolbarToggle"),presentationModeButton:document.getElementById("secondaryPresentationMode"),openFileButton:document.getElementById("secondaryOpenFile"),printButton:document.getElementById("secondaryPrintButton"),downloadButton:document.getElementById("secondaryDownload"),viewBookmarkButton:document.getElementById("viewBookmark"),firstPageButton:document.getElementById("firstPage"),lastPageButton:document.getElementById("lastPage"),pageRotateCwButton:document.getElementById("pageRotateCw"),pageRotateCcwButton:document.getElementById("pageRotateCcw"),cursorSelectToolButton:document.getElementById("cursorSelectTool"),cursorHandToolButton:document.getElementById("cursorHandTool"),scrollPageButton:document.getElementById("scrollPage"),scrollVerticalButton:document.getElementById("scrollVertical"),scrollHorizontalButton:document.getElementById("scrollHorizontal"),scrollWrappedButton:document.getElementById("scrollWrapped"),spreadNoneButton:document.getElementById("spreadNone"),spreadOddButton:document.getElementById("spreadOdd"),spreadEvenButton:document.getElementById("spreadEven"),imageAltTextSettingsButton:document.getElementById("imageAltTextSettings"),imageAltTextSettingsSeparator:document.getElementById("imageAltTextSettingsSeparator"),documentPropertiesButton:document.getElementById("documentProperties")},sidebar:{outerContainer:document.getElementById("outerContainer"),sidebarContainer:document.getElementById("sidebarContainer"),toggleButton:document.getElementById("primarySidebarToggle")??document.getElementById("sidebarToggleButton"),resizer:document.getElementById("sidebarResizer"),thumbnailButton:document.getElementById("viewThumbnail"),outlineButton:document.getElementById("viewOutline"),attachmentsButton:document.getElementById("viewAttachments"),layersButton:document.getElementById("viewLayers"),thumbnailView:document.getElementById("thumbnailView"),outlineView:document.getElementById("outlineView"),attachmentsView:document.getElementById("attachmentsView"),layersView:document.getElementById("layersView"),currentOutlineItemButton:document.getElementById("currentOutlineItem")},findBar:{bar:document.getElementById("findbar"),toggleButton:document.getElementById("primaryViewFind")??document.getElementById("viewFindButton"),findField:document.getElementById("findInput"),highlightAllCheckbox:document.getElementById("findHighlightAll"),caseSensitiveCheckbox:document.getElementById("findMatchCase"),findMultipleCheckbox:document.getElementById("findMultiple"),matchRegExpCheckbox:document.getElementById("matchRegExp"),matchDiacriticsCheckbox:document.getElementById("findMatchDiacritics"),entireWordCheckbox:document.getElementById("findEntireWord"),findMsg:document.getElementById("findMsg"),findResultsCount:document.getElementById("findResultsCount"),findPreviousButton:document.getElementById("findPreviousButton")??document.getElementById("findPrevious"),findNextButton:document.getElementById("findNextButton")??document.getElementById("findNext")},passwordOverlay:{dialog:document.getElementById("passwordDialog"),label:document.getElementById("passwordText"),input:document.getElementById("password"),submitButton:document.getElementById("passwordSubmit"),cancelButton:document.getElementById("passwordCancel")},documentProperties:{dialog:document.getElementById("documentPropertiesDialog"),closeButton:document.getElementById("documentPropertiesClose"),fields:{fileName:document.getElementById("fileNameField"),fileSize:document.getElementById("fileSizeField"),title:document.getElementById("titleField"),author:document.getElementById("authorField"),subject:document.getElementById("subjectField"),keywords:document.getElementById("keywordsField"),creationDate:document.getElementById("creationDateField"),modificationDate:document.getElementById("modificationDateField"),creator:document.getElementById("creatorField"),producer:document.getElementById("producerField"),version:document.getElementById("versionField"),pageCount:document.getElementById("pageCountField"),pageSize:document.getElementById("pageSizeField"),linearized:document.getElementById("linearizedField")}},altTextDialog:{dialog:document.getElementById("altTextDialog"),optionDescription:document.getElementById("descriptionButton"),optionDecorative:document.getElementById("decorativeButton"),textarea:document.getElementById("descriptionTextarea"),cancelButton:document.getElementById("altTextCancel"),saveButton:document.getElementById("altTextSave")},newAltTextDialog:{dialog:document.getElementById("newAltTextDialog"),title:document.getElementById("newAltTextTitle"),descriptionContainer:document.getElementById("newAltTextDescriptionContainer"),textarea:document.getElementById("newAltTextDescriptionTextarea"),disclaimer:document.getElementById("newAltTextDisclaimer"),learnMore:document.getElementById("newAltTextLearnMore"),imagePreview:document.getElementById("newAltTextImagePreview"),createAutomatically:document.getElementById("newAltTextCreateAutomatically"),createAutomaticallyButton:document.getElementById("newAltTextCreateAutomaticallyButton"),downloadModel:document.getElementById("newAltTextDownloadModel"),downloadModelDescription:document.getElementById("newAltTextDownloadModelDescription"),error:document.getElementById("newAltTextError"),errorCloseButton:document.getElementById("newAltTextCloseButton"),cancelButton:document.getElementById("newAltTextCancel"),notNowButton:document.getElementById("newAltTextNotNow"),saveButton:document.getElementById("newAltTextSave")},altTextSettingsDialog:{dialog:document.getElementById("altTextSettingsDialog"),createModelButton:document.getElementById("createModelButton"),aiModelSettings:document.getElementById("aiModelSettings"),learnMore:document.getElementById("altTextSettingsLearnMore"),deleteModelButton:document.getElementById("deleteModelButton"),downloadModelButton:document.getElementById("downloadModelButton"),showAltTextDialogButton:document.getElementById("showAltTextDialogButton"),altTextSettingsCloseButton:document.getElementById("altTextSettingsCloseButton"),closeButton:document.getElementById("altTextSettingsCloseButton")},addSignatureDialog:{dialog:document.getElementById("addSignatureDialog"),panels:document.getElementById("addSignatureActionContainer"),typeButton:document.getElementById("addSignatureTypeButton"),typeInput:document.getElementById("addSignatureTypeInput"),drawButton:document.getElementById("addSignatureDrawButton"),drawSVG:document.getElementById("addSignatureDraw"),drawPlaceholder:document.getElementById("addSignatureDrawPlaceholder"),drawThickness:document.getElementById("addSignatureDrawThickness"),imageButton:document.getElementById("addSignatureImageButton"),imageSVG:document.getElementById("addSignatureImage"),imagePlaceholder:document.getElementById("addSignatureImagePlaceholder"),imagePicker:document.getElementById("addSignatureFilePicker"),imagePickerLink:document.getElementById("addSignatureImageBrowse"),description:document.getElementById("addSignatureDescription"),clearButton:document.getElementById("clearSignatureButton"),saveContainer:document.getElementById("addSignatureSaveContainer"),saveCheckbox:document.getElementById("addSignatureSaveCheckbox"),errorBar:document.getElementById("addSignatureError"),errorTitle:document.getElementById("addSignatureErrorTitle"),errorDescription:document.getElementById("addSignatureErrorDescription"),errorCloseButton:document.getElementById("addSignatureErrorCloseButton"),cancelButton:document.getElementById("addSignatureCancelButton"),addButton:document.getElementById("addSignatureAddButton")},editSignatureDialog:{dialog:document.getElementById("editSignatureDescriptionDialog"),description:document.getElementById("editSignatureDescription"),editSignatureView:document.getElementById("editSignatureView"),cancelButton:document.getElementById("editSignatureCancelButton"),updateButton:document.getElementById("editSignatureUpdateButton")},annotationEditorParams:{editorFreeTextFontSize:document.getElementById("editorFreeTextFontSize"),editorFreeTextColor:document.getElementById("editorFreeTextColor"),editorInkColor:document.getElementById("editorInkColor"),editorInkThickness:document.getElementById("editorInkThickness"),editorInkOpacity:document.getElementById("editorInkOpacity"),editorStampAddImage:document.getElementById("editorStampAddImage"),editorSignatureAddSignature:document.getElementById("editorSignatureAddSignature"),editorFreeHighlightThickness:document.getElementById("editorFreeHighlightThickness"),editorHighlightShowAll:document.getElementById("editorHighlightShowAll")},editorUndoBar:{container:document.getElementById("editorUndoBar"),message:document.getElementById("editorUndoBarMessage"),undoButton:document.getElementById("editorUndoBarUndoButton"),closeButton:document.getElementById("editorUndoBarCloseButton")},editCommentDialog:{dialog:document.getElementById("commentManagerDialog"),toolbar:document.getElementById("commentManagerToolbar"),actions:document.getElementById("commentActionsButton"),menu:document.getElementById("commentActionsMenu"),editMenuItem:document.getElementById("commentActionsEditButton"),deleteMenuItem:document.getElementById("commentActionsDeleteButton"),closeButton:document.getElementById("commentCloseButton"),textInput:document.getElementById("commentManagerTextInput"),textView:document.getElementById("commentManagerTextView"),cancelButton:document.getElementById("commentManagerCancelButton"),saveButton:document.getElementById("commentManagerSaveButton")}}}(),i=new CustomEvent("webviewerloaded",{bubbles:!0,cancelable:!0,detail:{source:window}});try{parent.document.dispatchEvent(i)}catch(e){NgxConsole.error("webviewerloaded:",e);document.dispatchEvent(i)}t.cspPolicyService=e;Mf.run(t)}document.blockUnblockOnload?.(!0);globalThis.STANDALONE_VIEWER&&("interactive"===document.readyState||"complete"===document.readyState?webViewerLoad():document.addEventListener("DOMContentLoaded",webViewerLoad,!0));const Gf=new CustomEvent("ngxViewerFileHasBeenLoaded",{detail:{PDFViewerApplication:Mf,PDFViewerApplicationConstants:Bf,PDFViewerApplicationOptions:AppOptions,webViewerLoad}});document.dispatchEvent(Gf);export{Mf as PDFViewerApplication,Bf as PDFViewerApplicationConstants,AppOptions as PDFViewerApplicationOptions,webViewerLoad};