1/*! For license information please see 3639.ed69bc46a80aabc944ba.js.LICENSE.txt */ 2"use strict";(self.webpackChunkswag=self.webpackChunkswag||[]).push([[3639],{10970:t=>{var e=function(){};t.exports=e},94886:(t,e,s)=>{function i(t){var e=!1;return{promise:new Promise((function(s,i){t.then((function(t){return!e&&s(t)})).catch((function(t){return!e&&i(t)}))})),cancel:function(){e=!0}}}s.d(e,{Z:()=>i})},99211:(t,e,s)=>{s.d(e,{ZP:()=>r});var i=function(t,e,s){if(s||2===arguments.length)for(var i,n=0,r=e.length;n<r;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},n=i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i([],["onCopy","onCut","onPaste"],!0),["onCompositionEnd","onCompositionStart","onCompositionUpdate"],!0),["onFocus","onBlur"],!0),["onInput","onInvalid","onReset","onSubmit"],!0),["onLoad","onError"],!0),["onKeyDown","onKeyPress","onKeyUp"],!0),["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],!0),["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],!0),["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],!0),["onSelect"],!0),["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],!0),["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],!0),["onScroll"],!0),["onWheel"],!0),["onAnimationStart","onAnimationEnd","onAnimationIteration"],!0),["onTransitionEnd"],!0),["onChange"],!0),["onToggle"],!0);function r(t,e){var s={};return n.forEach((function(i){var n=t[i];n&&(s[i]=e?function(t){return n(t,e(i))}:n)})),s}},6637:(t,e,s)=>{s.d(e,{AB:()=>bi,Me:()=>yi,PDFDataRangeTransport:()=>vi,Tu:()=>mi,bM:()=>gi,sO:()=>fi});var i={9306:(t,e,s)=>{var i=s(4901),n=s(6823),r=TypeError;t.exports=function(t){if(i(t))return t;throw new r(n(t)+" is not a function")}},3506:(t,e,s)=>{var i=s(3925),n=String,r=TypeError;t.exports=function(t){if(i(t))return t;throw new r("Can't set "+n(t)+" as a prototype")}},7080:(t,e,s)=>{var i=s(4402).has;t.exports=function(t){return i(t),t}},679:(t,e,s)=>{var i=s(1625),n=TypeError;t.exports=function(t,e){if(i(e,t))return t;throw new n("Incorrect invocation")}},8551:(t,e,s)=>{var i=s(34),n=String,r=TypeError;t.exports=function(t){if(i(t))return t;throw new r(n(t)+" is not an object")}},7811:t=>{t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},7394:(t,e,s)=>{var i=s(4576),n=s(6706),r=s(2195),a=i.ArrayBuffer,o=i.TypeError;t.exports=a&&n(a.prototype,"byteLength","get")||function(t){if("ArrayBuffer"!==r(t))throw new o("ArrayBuffer expected");return t.byteLength}},3238:(t,e,s)=>{var i=s(4576),n=s(7476),r=s(7394),a=i.ArrayBuffer,o=a&&a.prototype,h=o&&n(o.slice);t.exports=function(t){if(0!==r(t))return!1;if(!h)return!1;try{return h(t,0,0),!1}catch(t){return!0}}},5169:(t,e,s)=>{var i=s(3238),n=TypeError;t.exports=function(t){if(i(t))throw new n("ArrayBuffer is detached");return t}},5636:(t,e,s)=>{var i=s(4576),n=s(9504),r=s(6706),a=s(7696),o=s(5169),h=s(7394),l=s(4483),c=s(1548),d=i.structuredClone,u=i.ArrayBuffer,p=i.DataView,f=Math.min,g=u.prototype,m=p.prototype,v=n(g.slice),b=r(g,"resizable","get"),y=r(g,"maxByteLength","get"),A=n(m.getInt8),w=n(m.setInt8);t.exports=(c||l)&&function(t,e,s){var i,n=h(t),r=void 0===e?n:a(e),g=!b||!b(t);if(o(t),c&&(t=d(t,{transfer:[t]}),n===r&&(s||g)))return t;if(n>=r&&(!s||g))i=v(t,0,r);else{var m=s&&!g&&y?{maxByteLength:y(t)}:void 0;i=new u(r,m);for(var _=new p(t),x=new p(i),E=f(r,n),S=0;S<E;S++)w(x,S,A(_,S))}return c||l(t),i}},4644:(t,e,s)=>{var i,n,r,a=s(7811),o=s(3724),h=s(4576),l=s(4901),c=s(34),d=s(9297),u=s(6955),p=s(6823),f=s(6699),g=s(6840),m=s(2106),v=s(1625),b=s(2787),y=s(2967),A=s(8227),w=s(3392),_=s(1181),x=_.enforce,E=_.get,S=h.Int8Array,C=S&&S.prototype,R=h.Uint8ClampedArray,T=R&&R.prototype,k=S&&b(S),M=C&&b(C),P=Object.prototype,I=h.TypeError,L=A("toStringTag"),D=w("TYPED_ARRAY_TAG"),F="TypedArrayConstructor",O=a&&!!y&&"Opera"!==u(h.opera),N=!1,j={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},B={BigInt64Array:8,BigUint64Array:8},H=function(t){var e=b(t);if(c(e)){var s=E(e);return s&&d(s,F)?s[F]:H(e)}},$=function(t){if(!c(t))return!1;var e=u(t);return d(j,e)||d(B,e)};for(i in j)(r=(n=h[i])&&n.prototype)?x(r)[F]=n:O=!1;for(i in B)(r=(n=h[i])&&n.prototype)&&(x(r)[F]=n);if((!O||!l(k)||k===Function.prototype)&&(k=function(){throw new I("Incorrect invocation")},O))for(i in j)h[i]&&y(h[i],k);if((!O||!M||M===P)&&(M=k.prototype,O))for(i in j)h[i]&&y(h[i].prototype,M);if(O&&b(T)!==M&&y(T,M),o&&!d(M,L))for(i in N=!0,m(M,L,{configurable:!0,get:function(){return c(this)?this[D]:void 0}}),j)h[i]&&f(h[i],D,i);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:O,TYPED_ARRAY_TAG:N&&D,aTypedArray:function(t){if($(t))return t;throw new I("Target is not a typed array")},aTypedArrayConstructor:function(t){if(l(t)&&(!y||v(k,t)))return t;throw new I(p(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,e,s,i){if(o){if(s)for(var n in j){var r=h[n];if(r&&d(r.prototype,t))try{delete r.prototype[t]}catch(s){try{r.prototype[t]=e}catch(t){}}}M[t]&&!s||g(M,t,s?e:O&&C[t]||e,i)}},exportTypedArrayStaticMethod:function(t,e,s){var i,n;if(o){if(y){if(s)for(i in j)if((n=h[i])&&d(n,t))try{delete n[t]}catch(t){}if(k[t]&&!s)return;try{return g(k,t,s?e:O&&k[t]||e)}catch(t){}}for(i in j)!(n=h[i])||n[t]&&!s||g(n,t,e)}},getTypedArrayConstructor:H,isView:function(t){if(!c(t))return!1;var e=u(t);return"DataView"===e||d(j,e)||d(B,e)},isTypedArray:$,TypedArray:k,TypedArrayPrototype:M}},5370:(t,e,s)=>{var i=s(6198);t.exports=function(t,e,s){for(var n=0,r=arguments.length>2?s:i(e),a=new t(r);r>n;)a[n]=e[n++];return a}},9617:(t,e,s)=>{var i=s(5397),n=s(5610),r=s(6198),a=function(t){return function(e,s,a){var o=i(e),h=r(o);if(0===h)return!t&&-1;var l,c=n(a,h);if(t&&s!=s){for(;h>c;
vendor: 16,997 bytes, line 2
2)if((l=o[c++])!=l)return!0}else for(;h>c;c++)if((t||c in o)&&o[c]===s)return t||c||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},4527:(t,e,s)=>{var i=s(3724),n=s(4376),r=TypeError,a=Object.getOwnPropertyDescriptor,o=i&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=o?function(t,e){if(n(t)&&!a(t,"length").writable)throw new r("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},7628:(t,e,s)=>{var i=s(6198);t.exports=function(t,e){for(var s=i(t),n=new e(s),r=0;r<s;r++)n[r]=t[s-r-1];return n}},9928:(t,e,s)=>{var i=s(6198),n=s(1291),r=RangeError;t.exports=function(t,e,s,a){var o=i(t),h=n(s),l=h<0?o+h:h;if(l>=o||l<0)throw new r("Incorrect index");for(var c=new e(o),d=0;d<o;d++)c[d]=d===l?a:t[d];return c}},6319:(t,e,s)=>{var i=s(8551),n=s(9539);t.exports=function(t,e,s,r){try{return r?e(i(s)[0],s[1]):e(s)}catch(e){n(t,"throw",e)}}},2195:(t,e,s)=>{var i=s(9504),n=i({}.toString),r=i("".slice);t.exports=function(t){return r(n(t),8,-1)}},6955:(t,e,s)=>{var i=s(2140),n=s(4901),r=s(2195),a=s(8227)("toStringTag"),o=Object,h="Arguments"===r(function(){return arguments}());t.exports=i?r:function(t){var e,s,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(s=function(t,e){try{return t[e]}catch(t){}}(e=o(t),a))?s:h?r(e):"Object"===(i=r(e))&&n(e.callee)?"Arguments":i}},7740:(t,e,s)=>{var i=s(9297),n=s(5031),r=s(7347),a=s(4913);t.exports=function(t,e,s){for(var o=n(e),h=a.f,l=r.f,c=0;c<o.length;c++){var d=o[c];i(t,d)||s&&i(s,d)||h(t,d,l(e,d))}}},2211:(t,e,s)=>{var i=s(9039);t.exports=!i((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},2529:t=>{t.exports=function(t,e){return{value:t,done:e}}},6699:(t,e,s)=>{var i=s(3724),n=s(4913),r=s(6980);t.exports=i?function(t,e,s){return n.f(t,e,r(1,s))}:function(t,e,s){return t[e]=s,t}},6980:t=>{t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},4659:(t,e,s)=>{var i=s(3724),n=s(4913),r=s(6980);t.exports=function(t,e,s){i?n.f(t,e,r(0,s)):t[e]=s}},2106:(t,e,s)=>{var i=s(283),n=s(4913);t.exports=function(t,e,s){return s.get&&i(s.get,e,{getter:!0}),s.set&&i(s.set,e,{setter:!0}),n.f(t,e,s)}},6840:(t,e,s)=>{var i=s(4901),n=s(4913),r=s(283),a=s(9433);t.exports=function(t,e,s,o){o||(o={});var h=o.enumerable,l=void 0!==o.name?o.name:e;if(i(s)&&r(s,l,o),o.global)h?t[e]=s:a(e,s);else{try{o.unsafe?t[e]&&(h=!0):delete t[e]}catch(t){}h?t[e]=s:n.f(t,e,{value:s,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return t}},6279:(t,e,s)=>{var i=s(6840);t.exports=function(t,e,s){for(var n in e)i(t,n,e[n],s);return t}},9433:(t,e,s)=>{var i=s(4576),n=Object.defineProperty;t.exports=function(t,e){try{n(i,t,{value:e,configurable:!0,writable:!0})}catch(s){i[t]=e}return e}},3724:(t,e,s)=>{var i=s(9039);t.exports=!i((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4483:(t,e,s)=>{var i,n,r,a,o=s(4576),h=s(9429),l=s(1548),c=o.structuredClone,d=o.ArrayBuffer,u=o.MessageChannel,p=!1;if(l)p=function(t){c(t,{transfer:[t]})};else if(d)try{u||(i=h("worker_threads"))&&(u=i.MessageChannel),u&&(n=new u,r=new d(2),a=function(t){n.port1.postMessage(null,[t])},2===r.byteLength&&(a(r),0===r.byteLength&&(p=a)))}catch(t){}t.exports=p},4055:(t,e,s)=>{var i=s(4576),n=s(34),r=i.document,a=n(r)&&n(r.createElement);t.exports=function(t){return a?r.createElement(t):{}}},6837:t=>{var e=TypeError;t.exports=function(t){if(t>9007199254740991)throw e("Maximum allowed index exceeded");return t}},5002:t=>{t.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},8727:t=>{t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6193:(t,e,s)=>{var i=s(4215);t.exports="NODE"===i},2839:(t,e,s)=>{var i=s(4576).navigator,n=i&&i.userAgent;t.exports=n?String(n):""},9519:(t,e,s)=>{var i,n,r=s(4576),a=s(2839),o=r.process,h=r.Deno,l=o&&o.versions||h&&h.version,c=l&&l.v8;c&&(n=(i=c.split("."))[0]>0&&i[0]<4?1:+(i[0]+i[1])),!n&&a&&(!(i=a.match(/Edge\/(\d+)/))||i[1]>=74)&&(i=a.match(/Chrome\/(\d+)/))&&(n=+i[1]),t.exports=n},4215:(t,e,s)=>{var i=s(4576),n=s(2839),r=s(2195),a=function(t){return n.slice(0,t.length)===t};t.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":i.Bun&&"string"==typeof Bun.version?"BUN":i.Deno&&"object"==typeof Deno.version?"DENO":"process"===r(i.process)?"NODE":i.window&&i.document?"BROWSER":"REST"},8574:(t,e,s)=>{var i=s(9504),n=Error,r=i("".replace),a=String(new n("zxcasd").stack),o=/\n\s*at [^:]*:[^\n]*/,h=o.test(a);t.exports=function(t,e){if(h&&"string"==typeof t&&!n.prepareStackTrace)for(;e--;)t=r(t,o,"");return t}},6518:(t,e,s)=>{var i=s(4576),n=s(7347).f,r=s(6699),a=s(6840),o=s(9433),h=s(7740),l=s(2796);t.exports=function(t,e){var s,c,d,u,p,f=t.target,g=t.global,m=t.stat;if(s=g?i:m?i[f]||o(f,{}):i[f]&&i[f].prototype)for(c in e){if(u=e[c],d=t.dontCallGetSet?(p=n(s,c))&&p.value:s[c],!l(g?c:f+(m?".":"#")+c,t.forced)&&void 0!==d){if(typeof u==typeof d)continue;h(u,d)}(t.sham||d&&d.sham)&&r(u,"sham",!0),a(s,c,u,t)}}},9039:t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},6080:(t,e,s)=>{var i=s(7476),n=s(9306),r=s(616),a=i(i.bind);t.exports=function(t,e){return n(t),void 0===e?t:r?a(t,e):function(){return t.apply(e,arguments)}}},616:(t,e,s)=>{var i=s(9039);t.exports=!i((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},9565:(t,e,s)=>{var i=s(616),n=Function.prototype.call;t.exports=i?n.bind(n):function(){return n.apply(n,arguments)}},350:(t,e,s)=>{var i=s(3724),n=s(9297),r=Function.prototype,a=i&&Object.getOwnPropertyDescriptor,o=n(r,"name"),h=o&&"something"===function(){}.name,l=o&&(!i||i&&a(r,"name").configurable);t.exports={EXISTS:o,PROPER:h,CONFIGURABLE:l}},6706:(t,e,s)=>{var i=s(9504),n=s(9306);t.exports=function(t,e,s){try{return i(n(Object.getOwnPropertyDescriptor(t,e)[s]))}catch(t){}}},7476:(t,e,s)=>{var i=s(2195),n=s(9504);t.exports=function(t){if("Function"===i(t))return n(t)}},9504:(t,e,s)=>{var i=s(616),n=Function.prototype,r=n.call,a=i&&n.bind.bind(r,r);t.exports=i?a:function(t){return function(){return r.apply(t,arguments)}}},9429:(t,e,s)=>{var i=s(4576),n=s(6193);t.exports=function(t){if(n){try{return i.process.getBuiltinModule(t)}catch(t){}try{return Function('return require("'+t+'")')()}catch(t){}}}},7751:(t,e,s)=>{var i=s(4576),n=s(4901);t.exports=function(t,e){return arguments.length<2?(s=i[t],n(s)?s:void 0):i[t]&&i[t][e];var s}},1767:t=>{t.exports=function(t){return{iterator:t,next:t.next,done:!1}}},8646:(t,e,s)=>{var i=s(9565),n=s(8551),r=s(1767),a=s(851);t.exports=function(t,e){e&&"string"==typeof t||n(t);var s=a(t);return r(n(void 0!==s?i(s,t):t))}},851:(t,e,s)=>{var i=s(6955),n=s(5966),r=s(4117),a=s(6269),o=s(8227)("iterator");t.exports=function(t){if(!r(t))return n(t,o)||n(t,"@@iterator")||a[i(t)]}},81:(t,e,s)=>{var i=s(9565),n=s(9306),r=s(8551),a=s(6823),o=s(851),h=TypeError;t.exports=function(t,e){var s=arguments.length<2?o(t):e;if(n(s))return r(i(s,t));throw new h(a(t)+" is not iterable")}},5966:(t,e,s)=>{var i=s(9306),n=s(4117);t.exports=function(t,e){var s=t[e];return n(s)?void 0:i(s)}},3789:(t,e,s)=>{var i=s(9306),n=s(8551),r=s(9565),a=s(1291),o=s(1767),h="Invalid size",l=RangeError,c=TypeError,d=Math.max,u=function(t,e){this.set=t,this.size=d(e,0),this.has=i(t.has),this.keys=i(t.keys)};u.prototype={getIterator:function(){return o(n(r(this.keys,this.set)))},includes:function(t){return r(this.has,this.set,t)}},t.exports=function(t){n(t);var e=+t.size;if(e!=e)throw new c(h);var s=a(e);if(s<0)throw new l(h);return new u(t,s)}},4576:function(t){var e=function(t){return t&&t.Math===Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof global&&global)||e("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297:(t,e,s)=>{var i=s(9504),n=s(8981),r=i({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return r(n(t),e)}},421:t=>{t.exports={}},397:(t,e,s)=>{var i=s(7751);t.exports=i("document","documentElement")},5917:(t,e,s)=>{var i=s(3724),n=s(9039),r=s(4055);t.exports=!i&&!n((function(){return 7!==Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a}))},7055:(t,e,s)=>{var i=s(9504),n=s(9039),r=s(2195),a=Object,o=i("".split);t.exports=n((function(){return!a("z").propertyIsEnumerable(0)}))?function(t){return"String"===r(t)?o(t,""):a(t)}:a},3167:(t,e,s)=>{var i=s(4901),n=s(34),r=s(2967);t.exports=function(t,e,s){var a,o;return r&&i(a=e.constructor)&&a!==s&&n(o=a.prototype)&&o!==s.prototype&&r(t,o),t}},3706:(t,e,s)=>{var i=s(9504),n=s(4901),r=s(7629),a=i(Function.toString);n(r.inspectSource)||(r.inspectSource=function(t){return a(t)}),t.exports=r.inspectSource},1181:(t,e,s)=>{var i,n,r,a=s(8622),o=s(4576),h=s(34),l=s(6699),c=s(9297),d=s(7629),u=s(6119),p=s(421),f="Object already initialized",g=o.TypeError,m=o.WeakMap;if(a||d.state){var v=d.state||(d.state=new m);v.get=v.get,v.has=v.has,v.set=v.set,i=function(t,e){if(v.has(t))throw new g(f);return e.facade=t,v.set(t,e),e},n=function(t){return v.get(t)||{}},r=function(t){return v.has(t)}}else{var b=u("state");p[b]=!0,i=function(t,e){if(c(t,b))throw new g(f);return e.facade=t,l(t,b,e),e},n=function(t){return c(t,b)?t[b]:{}},r=function(t){return c(t,b)}}t.exports={set:i,get:n,has:r,enforce:function(t){return r(t)?n(t):i(t,{})},getterFor:function(t){return function(e){var s;if(!h(e)||(s=n(e)).type!==t)throw new g("Incompatible receiver, "+t+" required");return s}}}},4209:(t,e,s)=>{var i=s(8227),n=s(6269),r=i("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(n.Array===t||a[r]===t)}},4376:(t,e,s)=>{var i=s(2195);t.exports=Array.isArray||function(t){return"Array"===i(t)}},1108:(t,e,s)=>{var i=s(6955);t.exports=function(t){var e=i(t);return"BigInt64Array"===e||"BigUint64Array"===e}},4901:t=>{var e="object"==typeof document&&document.all;t.exports=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(t){return"function"==typeof t}},2796:(t,e,s)=>{var i=s(9039),n=s(4901),r=/#|\.prototype\./,a=function(t,e){var s=h[o(t)];return s===c||s!==l&&(n(e)?i(e):!!e)},o=a.normalize=function(t){return String(t).replace(r,".").toLowerCase()},h=a.data={},l=a.NATIVE="N",c=a.POLYFILL="P";t.exports=a},4117:t=>{t.exports=function(t){return null==t}},34:(t,e,s)=>{var i=s(4901);t.exports=function(t){return"object"==typeof t?null!==t:i(t)}},3925:(t,e,s)=>{var i=s(34);t.exports=function(t){return i(t)||null===t}},6395:t=>{t.exports=!1},757:(t,e,s)=>{var i=s(7751),n=s(4901),r=s(1625),a=s(7040),o=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=i("Symbol");return n(e)&&r(e.prototype,o(t))}},507:(t,e,s)=>{var i=s(9565);t.exports=function(t,e,s){for(var n,r,a=s?t:t.iterator,o=t.next;!(n=i(o,a)).done;)if(void 0!==(r=e(n.value)))return r}},2652:(t,e,s)=>{var i=s(6080),n=s(9565),r=s(8551),a=s(6823),o=s(4209),h=s(6198),l=s(1625),c=s(81),d=s(851),u=s(9539),p=TypeError,f=function(t,e){this.stopped=t,this.result=e},g=f.prototype;t.exports=function(t,e,s){var m,v,b,y,A,w,_,x=s&&s.that,E=!(!s||!s.AS_ENTRIES),S=!(!s||!s.IS_RECORD),C=!(!s||!s.IS_ITERATOR),R=!(!s||!s.INTERRUPTED),T=i(e,x),k=function(t){return m&&u(m,"normal",t),new f(!0,t)},M=function(t){return E?(r(t),R?T(t[0],t[1],k):T(t[0],t[1])):R?T(t,k):T(t)};if(S)m=t.iterator;else if(C)m=t;else{if(!(v=d(t)))throw new p(a(t)+" is not iterable");if(o(v)){for(b=0,y=h(t);y>b;b++)if((A=M(t[b]))&&l(g,A))return A;return new f(!1)}m=c(t,v)}for(w=S?t.next:m.next;!(_=n(w,m)).done;){try{A=M(_.value)}catch(t){u(m,"throw",t)}if("object"==typeof A&&A&&l(g,A))return A}return new f(!1)}},9539:(t,e,s)=>{var i=s(9565),n=s(8551),r=s(5966);t.exports=function(t,e,s){var a,o;n(t);try{if(!(a=r(t,"return"))){if("throw"===e)throw s;return s}a=i(a,t)}catch(t){o=!0,a=t}if("throw"===e)throw s;if(o)throw a;return n(a),s}},9462:(t,e,s)=>{var i=s(9565),n=s(2360),r=s(6699),a=s(6279),o=s(8227),h=s(1181),l=s(5966),c=s(7657).IteratorPrototype,d=s(2529),u=s(9539),p=o("toStringTag"),f="IteratorHelper",g="WrapForValidIterator",m=h.set,v=function(t){var e=h.getterFor(t?g:f);return a(n(c),{next:function(){var s=e(this);if(t)return s.nextHandler();try{var i=s.done?void 0:s.nextHandler();return d(i,s.done)}catch(t){throw s.done=!0,t}},return:function(){var s=e(this),n=s.iterator;if(s.done=!0,t){var r=l(n,"return");return r?i(r,n):d(void 0,!0)}if(s.inner)try{u(s.inner.iterator,"normal")}catch(t){return u(n,"throw",t)}return u(n,"normal"),d(void 0,!0)}})},b=v(!0),y=v(!1);r(y,p,"Iterator Helper"),t.exports=function(t,e){var s=function(s,i){i?(i.iterator=s.iterator,i.next=s.next):i=s,i.type=e?g:f,i.nextHandler=t,i.counter=0,i.done=!1,m(this,i)};return s.prototype=e?b:y,s}},713:(t,e,s)=>{var i=s(9565),n=s(9306),r=s(8551),a=s(1767),o=s(9462),h=s(6319),l=o((function(){var t=this.iterator,e=r(i(this.next,t));if(!(this.done=!!e.done))return h(t,this.mapper,[e.value,this.counter++],!0)}));t.exports=function(t){return r(this),n(t),new l(a(this),{mapper:t})}},7657:(t,e,s)=>{var i,n,r,a=s(9039),o=s(4901),h=s(34),l=s(2360),c=s(2787),d=s(6840),u=s(8227),p=s(6395),f=u("iterator"),g=!1;[].keys&&("next"in(r=[].keys())?(n=c(c(r)))!==Object.prototype&&(i=n):g=!0),!h(i)||a((function(){var t={};return i[f].call(t)!==t}))?i={}:p&&(i=l(i)),o(i[f])||d(i,f,(function(){return this})),t.exports={IteratorPrototype:i,BUGGY_SAFARI_ITERATORS:g}},6269:t=>{t.exports={}},6198:(t,e,s)=>{var i=s(8014);t.exports=function(t){return i(t.length)}},283:(t,e,s)=>{var i=s(9504),n=s(9039),r=s(4901),a=s(9297),o=s(3724),h=s(350).CONFIGURABLE,l=s(3706),c=s(1181),d=c.enforce,u=c.get,p=String,f=Object.defineProperty,g=i("".slice),m=i("".replace),v=i([].join),b=o&&!n((function(){return 8!==f((function(){}),"length",{value:8}).length})),y=String(String).split("String"),A=t.exports=function(t,e,s){"Symbol("===g(p(e),0,7)&&(e="["+m(p(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),s&&s.getter&&(e="get "+e),s&&s.setter&&(e="set "+e),(!a(t,"name")||h&&t.name!==e)&&(o?f(t,"name",{value:e,configurable:!0}):t.name=e),b&&s&&a(s,"arity")&&t.length!==s.arity&&f(t,"length",{value:s.arity});try{s&&a(s,"constructor")&&s.constructor?o&&f(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var i=d(t);return a(i,"source")||(i.source=v(y,"string"==typeof e?e:"")),t};Function.prototype.toString=A((function(){return r(this)&&u(this).source||l(this)}),"toString")},741:t=>{var e=Math.ceil,s=Math.floor;t.exports=Math.trunc||function(t){var i=+t;return(i>0?s:e)(i)}},6043:(t,e,s)=>{var i=s(9306),n=TypeError,r=function(t){var e,s;this.promise=new t((function(t,i){if(void 0!==e||void 0!==s)throw new n("Bad Promise constructor");e=t,s=i})),this.resolve=i(e),this.reject=i(s)};t.exports.f=function(t){return new r(t)}},2603:(t,e,s)=>{var i=s(655);t.exports=function(t,e){return void 0===t?arguments.length<2?"":e:i(t)}},4149:t=>{var e=RangeError;t.exports=function(t){if(t==t)return t;throw new e("NaN is not allowed")}},2360:(t,e,s)=>{var i,n=s(8551),r=s(6801),a=s(8727),o=s(421),h=s(397),l=s(4055),c=s(6119),d="prototype",u="script",p=c("IE_PROTO"),f=function(){},g=function(t){return"<"+u+">"+t+"</"+u+">"},m=function(t){t.write(g("")),t.close();var e=t.parentWindow.Object;return t=null,e},v=function(){try{i=new ActiveXObject("htmlfile")}catch(t){}v="undefined"!=typeof document?document.domain&&i?m(i):function(){var t,e=l("iframe"),s="java"+u+":";return e.style.display="none",h.appendChild(e),e.src=String(s),(t=e.contentWindow.document).open(),t.write(g("document.F=Object")),t.close(),t.F}():m(i);for(var t=a.length;t--;)delete v[d][a[t]];return v()};
vendor: 2,219 bytes, line 2
2o[p]=!0,t.exports=Object.create||function(t,e){var s;return null!==t?(f[d]=n(t),s=new f,f[d]=null,s[p]=t):s=v(),void 0===e?s:r.f(s,e)}},6801:(t,e,s)=>{var i=s(3724),n=s(8686),r=s(4913),a=s(8551),o=s(5397),h=s(1072);e.f=i&&!n?Object.defineProperties:function(t,e){a(t);for(var s,i=o(e),n=h(e),l=n.length,c=0;l>c;)r.f(t,s=n[c++],i[s]);return t}},4913:(t,e,s)=>{var i=s(3724),n=s(5917),r=s(8686),a=s(8551),o=s(6969),h=TypeError,l=Object.defineProperty,c=Object.getOwnPropertyDescriptor,d="enumerable",u="configurable",p="writable";e.f=i?r?function(t,e,s){if(a(t),e=o(e),a(s),"function"==typeof t&&"prototype"===e&&"value"in s&&p in s&&!s[p]){var i=c(t,e);i&&i[p]&&(t[e]=s.value,s={configurable:u in s?s[u]:i[u],enumerable:d in s?s[d]:i[d],writable:!1})}return l(t,e,s)}:l:function(t,e,s){if(a(t),e=o(e),a(s),n)try{return l(t,e,s)}catch(t){}if("get"in s||"set"in s)throw new h("Accessors not supported");return"value"in s&&(t[e]=s.value),t}},7347:(t,e,s)=>{var i=s(3724),n=s(9565),r=s(8773),a=s(6980),o=s(5397),h=s(6969),l=s(9297),c=s(5917),d=Object.getOwnPropertyDescriptor;e.f=i?d:function(t,e){if(t=o(t),e=h(e),c)try{return d(t,e)}catch(t){}if(l(t,e))return a(!n(r.f,t,e),t[e])}},8480:(t,e,s)=>{var i=s(1828),n=s(8727).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return i(t,n)}},3717:(t,e)=>{e.f=Object.getOwnPropertySymbols},2787:(t,e,s)=>{var i=s(9297),n=s(4901),r=s(8981),a=s(6119),o=s(2211),h=a("IE_PROTO"),l=Object,c=l.prototype;t.exports=o?l.getPrototypeOf:function(t){var e=r(t);if(i(e,h))return e[h];var s=e.constructor;return n(s)&&e instanceof s?s.prototype:e instanceof l?c:null}},1625:(t,e,s)=>{var i=s(9504);t.exports=i({}.isPrototypeOf)},1828:(t,e,s)=>{var i=s(9504),n=s(9297),r=s(5397),a=s(9617).indexOf,o=s(421),h=i([].push);t.exports=function(t,e){var s,i=r(t),l=0,c=[];for(s in i)!n(o,s)&&n(i,s)&&h(c,s);for(;e.length>l;)n(i,s=e[l++])&&(~a(c,s)||h(c,s));return c}},1072:(t,e,s)=>{var i=s(1828),n=s(8727);t.exports=Object.keys||function(t){return i(t,n)}},8773:(t,e)=>{var s={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,n=i&&!s.call({1:2},1);e.f=n?function(t){var e=i(this,t);return!!e&&e.enumerable}:s},2967:(t,e,s)=>{var i=s(6706),n=s(34),r=s(7750),a=s(3506);
2t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,s={};try{(t=i(Object.prototype,"__proto__","set"))(s,[]),e=s instanceof Array}catch(t){}return function(s,i){return r(s),a(i),n(s)?(e?t(s,i):s.__proto__=i,s):s}}():void 0)},4270:(t,e,s)=>{var i=s(9565),n=s(4901),r=s(34),a=TypeError;t.exports=function(t,e){var s,o;if("string"===e&&n(s=t.toString)&&!r(o=i(s,t)))return o;if(n(s=t.valueOf)&&!r(o=i(s,t)))return o;if("string"!==e&&n(s=t.toString)&&!r(o=i(s,t)))return o;throw new a("Can't convert object to primitive value")}},5031:(t,e,s)=>{var i=s(7751),n=s(9504),r=s(8480),a=s(3717),o=s(8551),h=n([].concat);t.exports=i("Reflect","ownKeys")||function(t){var e=r.f(o(t)),s=a.f;return s?h(e,s(t)):e}},8235:(t,e,s)=>{var i=s(9504),n=s(9297),r=SyntaxError,a=parseInt,o=String.fromCharCode,h=i("".charAt),l=i("".slice),c=i(/./.exec),d={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},u=/^[\da-f]{4}$/i,p=/^[\u0000-\u001F]$/;t.exports=function(t,e){for(var s=!0,i="";e<t.length;){var f=h(t,e);if("\\"===f){var g=l(t,e,e+2);if(n(d,g))i+=d[g],e+=2;else{if("\\u"!==g)throw new r('Unknown escape sequence: "'+g+'"');var m=l(t,e+=2,e+4);if(!c(u,m))throw new r("Bad Unicode escape at: "+e);i+=o(a(m,16)),e+=4}}else{if('"'===f){s=!1,e++;break}if(c(p,f))throw new r("Bad control character in string literal at: "+e);i+=f,e++}}if(s)throw new r("Unterminated string at: "+e);return{value:i,end:e}}},7750:(t,e,s)=>{var i=s(4117),n=TypeError;t.exports=function(t){if(i(t))throw new n("Can't call method on "+t);return t}},9286:(t,e,s)=>{var i=s(4402),n=s(8469),r=i.Set,a=i.add;t.exports=function(t){var e=new r;return n(t,(function(t){a(e,t)})),e}},3440:(t,e,s)=>{var i=s(7080),n=s(4402),r=s(9286),a=s(5170),o=s(3789),h=s(8469),l=s(507),c=n.has,d=n.remove;t.exports=function(t){var e=i(this),s=o(t),n=r(e);return a(e)<=s.size?h(e,(function(t){s.includes(t)&&d(n,t)})):l(s.getIterator(),(function(t){c(e,t)&&d(n,t)})),n}},4402:(t,e,s)=>{var i=s(9504),n=Set.prototype;t.exports={Set,add:i(n.add),has:i(n.has),remove:i(n.delete),proto:n}},8750:(t,e,s)=>{var i=s(7080),n=s(4402),r=s(5170),a=s(3789),o=s(8469),h=s(507),l=n.Set,c=n.add,d=n.has;t.exports=function(t){var e=i(this),s=a(t),n=new l;return r(e)>s.size?h(s.getIterator(),(function(t){d(e,t)&&c(n,t)})):o(e,(function(t){s.includes(t)&&c(n,t)})),n}},4449:(t,e,s)=>{var i=s(7080),n=s(4402).has,r=s(5170),a=s(3789),o=s(8469),h=s(507),l=s(9539);t.exports=function(t){var e=i(this),s=a(t);if(r(e)<=s.size)return!1!==o(e,(function(t){if(s.includes(t))return!1}),!0);var c=s.getIterator();return!1!==h(c,(function(t){if(n(e,t))return l(c,"normal",!1)}))}},3838:(t,e,s)=>{var i=s(7080),n=s(5170),r=s(8469),a=s(3789);t.exports=function(t){var e=i(this),s=a(t);return!(n(e)>s.size)&&!1!==r(e,(function(t){if(!s.includes(t))return!1}),!0)}},8527:(t,e,s)=>{var i=s(7080),n=s(4402).has,r=s(5170),a=s(3789),o=s(507),h=s(9539);t.exports=function(t){var e=i(this),s=a(t);if(r(e)<s.size)return!1;var l=s.getIterator();return!1!==o(l,(function(t){if(!n(e,t))return h(l,"normal",!1)}))}},8469:(t,e,s)=>{var i=s(9504),n=s(507),r=s(4402),a=r.Set,o=r.proto,h=i(o.forEach),l=i(o.keys),c=l(new a).next;t.exports=function(t,e,s){return s?n({iterator:l(t),next:c},e):h(t,e)}},4916:(t,e,s)=>{var i=s(7751),n=function(t){return{size:t,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}};t.exports=function(t){var e=i("Set");try{(new e)[t](n(0));try{return(new e)[t](n(-1)),!1}catch(t){return!0}}catch(t){return!1}}},5170:(t,e,s)=>{var i=s(6706),n=s(4402);t.exports=i(n.proto,"size","get")||function(t){return t.size}},3650:(t,e,s)=>{var i=s(7080),n=s(4402),r=s(9286),a=s(3789),o=s(507),h=n.add,l=n.has,c=n.remove;t.exports=function(t){var e=i(this),s=a(t).getIterator(),n=r(e);return o(s,(function(t){l(e,t)?c(n,t):h(n,t)})),n}},4204:(t,e,s)=>{var i=s(7080),n=s(4402).add,r=s(9286),a=s(3789),o=s(507);t.exports=function(t){var e=i(this),s=a(t).getIterator(),h=r(e);return o(s,(function(t){n(h,t)})),h}},6119:(t,e,s)=>{var i=s(5745),n=s(3392),r=i("keys");t.exports=function(t){return r[t]||(r[t]=n(t))}},7629:(t,e,s)=>{var i=s(6395),n=s(4576),r=s(9433),a="__core-js_shared__",o=t.exports=n[a]||r(a,{});(o.versions||(o.versions=[])).push({version:"3.38.1",mode:i?"pure":"global",copyright:"\xa9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:(t,e,s)=>{var i=s(7629);t.exports=function(t,e){return i[t]||(i[t]=e||{})}},1548:(t,e,s)=>{var i=s(4576),n=s(9039),r=s(9519),a=s(4215),o=i.structuredClone;t.exports=!!o&&!n((function(){if("DENO"===a&&r>92||"NODE"===a&&r>94||"BROWSER"===a&&r>97)return!1;var t=new ArrayBuffer(8),e=o(t,{transfer:[t]});return 0!==t.byteLength||8!==e.byteLength}))},4495:(t,e,s)=>{var i=s(9519),n=s(9039),r=s(4576).String;t.exports=!!Object.getOwnPropertySymbols&&!n((function(){var t=Symbol("symbol detection");return!r(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&i&&i<41}))},5610:(t,e,s)=>{var i=s(1291),n=Math.max,r=Math.min;t.exports=function(t,e){var s=i(t);return s<0?n(s+e,0):r(s,e)}},5854:(t,e,s)=>{var i=s(2777),n=TypeError;t.exports=function(t){var e=i(t,"number");if("number"==typeof e)throw new n("Can't convert number to bigint");return BigInt(e)}},7696:(t,e,s)=>{var i=s(1291),n=s(8014),r=RangeError;t.exports=function(t){if(void 0===t)return 0;var e=i(t),s=n(e);if(e!==s)throw new r("Wrong length or index");return s}},5397:(t,e,s)=>{var i=s(7055),n=s(7750);t.exports=function(t){return i(n(t))}},1291:(t,e,s)=>{var i=s(741);t.exports=function(t){var e=+t;return e!=e||0===e?0:i(e)}},8014:(t,e,s)=>{var i=s(1291),n=Math.min;t.exports=function(t){var e=i(t);return e>0?n(e,9007199254740991):0}},8981:(t,e,s)=>{var i=s(7750),n=Object;t.exports=function(t){return n(i(t))}},9590:(t,e,s)=>{var i=s(1291),n=RangeError;t.exports=function(t){var e=i(t);if(e<0)throw new n("The argument can't be less than 0");return e}},2777:(t,e,s)=>{var i=s(9565),n=s(34),r=s(757),a=s(5966),o=s(4270),h=s(8227),l=TypeError,c=h("toPrimitive");t.exports=function(t,e){if(!n(t)||r(t))return t;var s,h=a(t,c);if(h){if(void 0===e&&(e="default"),s=i(h,t,e),!n(s)||r(s))return s;throw new l("Can't convert object to primitive value")}return void 0===e&&(e="number"),o(t,e)}},6969:(t,e,s)=>{var i=s(2777),n=s(757);t.exports=function(t){var e=i(t,"string");return n(e)?e:e+""}},2140:(t,e,s)=>{var i={};i[s(8227)("toStringTag")]="z",t.exports="[object z]"===String(i)},655:(t,e,s)=>{var i=s(6955),n=String;t.exports=function(t){if("Symbol"===i(t))throw new TypeError("Cannot convert a Symbol value to a string");return n(t)}},6823:t=>{var e=String;t.exports=function(t){try{return e(t)}catch(t){return"Object"}}},3392:(t,e,s)=>{var i=s(9504),n=0,r=Math.random(),a=i(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++n+r,3
vendor: 6,796 bytes, line 2
26)}},7040:(t,e,s)=>{var i=s(4495);t.exports=i&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686:(t,e,s)=>{var i=s(3724),n=s(9039);t.exports=i&&n((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},2812:t=>{var e=TypeError;t.exports=function(t,s){if(t<s)throw new e("Not enough arguments");return t}},8622:(t,e,s)=>{var i=s(4576),n=s(4901),r=i.WeakMap;t.exports=n(r)&&/native code/.test(String(r))},8227:(t,e,s)=>{var i=s(4576),n=s(5745),r=s(9297),a=s(3392),o=s(4495),h=s(7040),l=i.Symbol,c=n("wks"),d=h?l.for||l:l&&l.withoutSetter||a;t.exports=function(t){return r(c,t)||(c[t]=o&&r(l,t)?l[t]:d("Symbol."+t)),c[t]}},6573:(t,e,s)=>{var i=s(3724),n=s(2106),r=s(3238),a=ArrayBuffer.prototype;i&&!("detached"in a)&&n(a,"detached",{configurable:!0,get:function(){return r(this)}})},7936:(t,e,s)=>{var i=s(6518),n=s(5636);n&&i({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return n(this,arguments.length?arguments[0]:void 0,!1)}})},8100:(t,e,s)=>{var i=s(6518),n=s(5636);n&&i({target:"ArrayBuffer",proto:!0},{transfer:function(){return n(this,arguments.length?arguments[0]:void 0,!0)}})},4114:(t,e,s)=>{var i=s(6518),n=s(8981),r=s(6198),a=s(4527),o=s(6837);i({target:"Array",proto:!0,arity:1,forced:s(9039)((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}}()},{push:function(t){var e=n(this),s=r(e),i=arguments.length;o(s+i);for(var h=0;h<i;h++)e[s]=arguments[h],s++;return a(e,s),s}})},4628:(t,e,s)=>{var i=s(6518),n=s(6043);i({target:"Promise",stat:!0},{withResolvers:function(){var t=n.f(this);return{promise:t.promise,resolve:t.resolve,reject:t.reject}}})},7642:(t,e,s)=>{var i=s(6518),n=s(3440);i({target:"Set",proto:!0,real:!0,forced:!s(4916)("difference")},{difference:n})},8004:(t,e,s)=>{var i=s(6518),n=s(9039),r=s(8750);i({target:"Set",proto:!0,real:!0,forced:!s(4916)("intersection")||n((function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))}))},{intersection:r})},3853:(t,e,s)=>{var i=s(6518),n=s(4449);i({target:"Set",proto:!0,real:!0,forced:!s(4916)("isDisjointFrom")},{isDisjointFrom:n})},5876:(t,e,s)=>{var i=s(6518),n=s(3838);i({target:"Set",proto:!0,real:!0,forced:!s(4916)("isSubsetOf")},{isSubsetOf:n})},2475:(t,e,s)=>{var i=s(6518),n=s(8527);i({target:"Set",proto:!0,real:!0,forced:!s(4916)("isSupersetOf")},{isSupersetOf:n})},5024:(t,e,s)=>{var i=s(6518),n=s(3650);i({target:"Set",proto:!0,real:!0,forced:!s(4916)("symmetricDifference")},{symmetricDifference:n})},1698:(t,e,s)=>{var i=s(6518),n=s(4204);i({target:"Set",proto:!0,real:!0,forced:!s(4916)("union")},{union:n})},7467:(t,e,s)=>{var i=s(7628),n=s(4644),r=n.aTypedArray,a=n.exportTypedArrayMethod,o=n.getTypedArrayConstructor;a("toReversed",(function(){return i(r(this),o(this))}))},4732:(t,e,s)=>{var i=s(4644),n=s(9504),r=s(9306),a=s(5370),o=i.aTypedArray,h=i.getTypedArrayConstructor,l=i.exportTypedArrayMethod,c=n(i.TypedArrayPrototype.sort);l("toSorted",(function(t){void 0!==t&&r(t);var e=o(this),s=a(h(e),e);return c(s,t)}))},9577:(t,e,s)=>{var i=s(9928),n=s(4644),r=s(1108),a=s(1291),o=s(5854),h=n.aTypedArray,l=n.getTypedArrayConstructor,c=n.exportTypedArrayMethod,d=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(t){return 8===t}}();c("with",{with:function(t,e){var s=h(this),n=a(t),c=r(s)?o(e):+e;return i(s,l(s),n,c)}}.with,!d)},8992:(t,e,s)=>{var i=s(6518),n=s(4576),r=s(679),a=s(8551),o=s(4901),h=s(2787),l=s(2106),c=s(4659),d=s(9039),u=s(9297),p=s(8227),f=s(7657).IteratorPrototype,g=s(3724),m=s(6395),v="constructor",b="Iterator",y=p("toStringTag"),A=TypeError,w=n[b],_=m||!o(w)||w.prototype!==f||!d((function(){w({})})),x=function(){if(r(this,f),h(this)===f)throw new A("Abstract class Iterator not directly constructable")},E=function(t,e){g?l(f,t,{configurable:!0,get:function(){return e},set:function(e){if(a(this),this===f)throw new A("You can't redefine this property");u(this,t)?this[t]=e:c(this,t,e)}}):f[t]=e};u(f,y)||E(y,b),!_&&u(f,v)&&f[v]!==Object||E(v,x),x.prototype=f,i({global:!0,constructor:!0,forced:_},{Iterator:x})},4743:(t,e,s)=>{var i=s(6518),n=s(9565),r=s(8551),a=s(1767),o=s(4149),h=s(9590),l=s(9462),c=s(6395),d=l((function(){for(var t,e=this.iterator,s=this.next;this.remaining;)if(this.remaining--,t=r(n(s,e)),this.done=!!t.done)return;if(t=r(n(s,e)),!(this.done=!!t.done))return t.value}));i({target:"Iterator",proto:!0,real:!0,forced:c},{drop:function(t){r(this);var e=h(o(+t));return new d(a(this),{remaining:e})}})},3215:(t,e,s)=>{var i=s(6518),n=s(2652),r=s(9306),a=s(8551),o=s(1767);i({target:"Iterator",proto:!0,real:!0},{every:function(t){a(this),r(t);var e=o(this),s=0;return!n(e,(function(e,i){if(!t(e,s++))return i()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},4520:(t,e,s)=>{var i=s(6518),n=s(9565),r=s(9306),a=s(8551),o=s(1767),h=s(9462),l=s(6319),c=s(6395),d=h((function(){for(var t,e,s=this.iterator,i=this.predicate,r=this.next;;){if(t=a(n(r,s)),this.done=!!t.done)return;if(e=t.value,l(s,i,[e,this.counter++],!0))return e}}));i({target:"Iterator",proto:!0,real:!0,forced:c},{filter:function(t){return a(this),r(t),new d(o(this),{predicate:t})}})},670:(t,e,s)=>{var i=s(6518),n=s(9565),r=s(9306),a=s(8551),o=s(1767),h=s(8646),l=s(9462),c=s(9539),d=s(6395),u=l((function(){for(var t,e,s=this.iterator,i=this.mapper;;){if(e=this.inner)try{if(!(t=a(n(e.next,e.iterator))).done)return t.value;this.inner=null}catch(t){c(s,"throw",t)}if(t=a(n(this.next,s)),this.done=!!t.done)return;try{this.inner=h(i(t.value,this.counter++),!1)}catch(t){c(s,"throw",t)}}}));i({target:"Iterator",proto:!0,real:!0,forced:d},{flatMap:function(t){return a(this),r(t),new u(o(this),{mapper:t,inner:null})}})},1454:(t,e,s)=>{var i=s(6518),n=s(713);i({target:"Iterator",proto:!0,real:!0,forced:s(6395)},{map:n})},7550:(t,e,s)=>{var i=s(6518),n=s(2652),r=s(9306),a=s(8551),o=s(1767);i({target:"Iterator",proto:!0,real:!0},{some:function(t){a(this),r(t);var e=o(this),s=0;return n(e,(function(e,i){if(t(e,s++))return i()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},8335:(t,e,s)=>{var i=s(6518),n=s(3724),r=s(4576),a=s(7751),o=s(9504),h=s(9565),l=s(4901),c=s(34),d=s(4376),u=s(9297),p=s(655),f=s(6198),g=s(4659),m=s(9039),v=s(8235),b=s(4495),y=r.JSON,A=r.Number,w=r.SyntaxError,_=y&&y.parse,x=a("Object","keys"),E=Object.getOwnPropertyDescriptor,S=o("".charAt),C=o("".slice),R=o(/./.exec),T=o([].push),k=/^\d$/,M=/^[1-9]$/,P=/^[\d-]$/,I=/^[\t\n\r ]$/,L=function(t,e,s,i){var n,r,a,o,l,p=t[e],g=i&&p===i.value,m=g&&"string"==typeof i.source?{source:i.source}:{};if(c(p)){var v=d(p),b=g?i.nodes:v?[]:{};if(v)for(n=b.length,a=f(p),o=0;o<a;o++)D(p,o,L(p,""+o,s,o<n?b[o]:void 0));else for(r=x(p),a=f(r),o=0;o<a;
vendor: 4,619 bytes, line 2
2o++)l=r[o],D(p,l,L(p,l,s,u(b,l)?b[l]:void 0))}return h(s,t,e,p,m)},D=function(t,e,s){if(n){var i=E(t,e);if(i&&!i.configurable)return}void 0===s?delete t[e]:g(t,e,s)},F=function(t,e,s,i){this.value=t,this.end=e,this.source=s,this.nodes=i},O=function(t,e){this.source=t,this.index=e};O.prototype={fork:function(t){return new O(this.source,t)},parse:function(){var t=this.source,e=this.skip(I,this.index),s=this.fork(e),i=S(t,e);if(R(P,i))return s.number();switch(i){case"{":return s.object();case"[":return s.array();case'"':return s.string();case"t":return s.keyword(!0);case"f":return s.keyword(!1);case"n":return s.keyword(null)}throw new w('Unexpected character: "'+i+'" at: '+e)},node:function(t,e,s,i,n){return new F(e,i,t?null:C(this.source,s,i),n)},object:function(){for(var t=this.source,e=this.index+1,s=!1,i={},n={};e<t.length;){if(e=this.until(['"',"}"],e),"}"===S(t,e)&&!s){e++;break}var r=this.fork(e).string(),a=r.value;e=r.end,e=this.until([":"],e)+1,e=this.skip(I,e),r=this.fork(e).parse(),g(n,a,r),g(i,a,r.value),e=this.until([",","}"],r.end);var o=S(t,e);if(","===o)s=!0,e++;else if("}"===o){e++;break}}return this.node(1,i,this.index,e,n)},array:function(){for(var t=this.source,e=this.index+1,s=!1,i=[],n=[];e<t.length;){if(e=this.skip(I,e),"]"===S(t,e)&&!s){e++;break}var r=this.fork(e).parse();if(T(n,r),T(i,r.value),e=this.until([",","]"],r.end),","===S(t,e))s=!0,e++;else if("]"===S(t,e)){e++;break}}return this.node(1,i,this.index,e,n)},string:function(){var t=this.index,e=v(this.source,this.index+1);return this.node(0,e.value,t,e.end)},number:function(){var t=this.source,e=this.index,s=e;if("-"===S(t,s)&&s++,"0"===S(t,s))s++;else{if(!R(M,S(t,s)))throw new w("Failed to parse number at: "+s);s=this.skip(k,s+1)}if("."===S(t,s)&&(s=this.skip(k,s+1)),("e"===S(t,s)||"E"===S(t,s))&&(s++,"+"!==S(t,s)&&"-"!==S(t,s)||s++,s===(s=this.skip(k,s))))throw new w("Failed to parse number's exponent value at: "+s);return this.node(0,A(C(t,e,s)),e,s)},keyword:function(t){var e=""+t,s=this.index,i=s+e.length;if(C(this.source,s,i)!==e)throw new w("Failed to parse value at: "+s);return this.node(0,t,s,i)},skip:function(t,e){for(var s=this.source;e<s.length&&R(t,S(s,e));e++);return e},until:function(t,e){e=this.skip(I,e);for(var s=S(this.source,e),i=0;i<t.length;i++)if(t[i]===s)return e;throw new w('Unexpected character: "'+s+'" at: '+e)}};var N=m((function(){var t,e="9007199254740993";return _(e,(function(e,s,i){t=i.source})),t!==e})),j=b&&!m((function(){return 1/_("-0 \t")!=-1/0}));i({target:"JSON",stat:!0,forced:N},{parse:function(t,e){return j&&!l(e)?_(t):function(t,e){t=p(t);var s=new O(t,0,""),i=s.parse(),n=i.value,r=s.skip(I,i.end);if(r<t.length)throw new w('Unexpected extra character: "'+S(t,r)+'" after the parsed data at: '+r);return l(e)?L({"":n},"",e,i):n}(t,e)}})},4979:(t,e,s)=>{var i=s(6518),n=s(4576),r=s(7751),a=s(6980),o=s(4913).f,h=s(9297),l=s(679),c=s(3167),d=s(2603),u=s(5002),p=s(8574),f=s(3724),g=s(6395),m="DOMException",v=r("Error"),b=r(m),y=function(){l(this,A);var t=arguments.length,e=d(t<1?void 0:arguments[0]),s=d(t<2?void 0:arguments[1],"Error"),i=new b(e,s),n=new v(e);return n.name=m,o(i,"stack",a(1,p(n.stack,1))),c(i,this,y),i},A=y.prototype=b.prototype,w="stack"in new v(m),_="stack"in new b(1,2),x=b&&f&&Object.getOwnPropertyDescriptor(n,m),E=!(!x||x.writable&&x.configurable),S=w&&!E&&!_;i({global:!0,constructor:!0,forced:g||S},{DOMException:S?y:b});var C=r(m),R=C.prototype;if(R.constructor!==C)for(var T in g||o(R,"constructor",a(1,C)),u)if(h(u,T)){var k=u[T],M=k.s;h(C,M)||o(C,M,a(6,k.c))}},4603:(t,e,s)=>{var i=s(6840),n=s(9504),r=s(655),a=s(2812),o=URLSearchParams,h=o.prototype,l=n(h.append),c=n(h.delete),d=n(h.forEach),u=n([].push),p=new o("a=1&a=2&b=3");p.delete("a",1),p.delete("b",void 0),p+""!="a=2"&&i(h,"delete",(function(t){var e=arguments.length,s=e<2?void 0:arguments[1];if(e&&void 0===s)return c(this,t);var i=[];d(this,(function(t,e){u(i,{key:e,value:t})})),a(e,1);for(var n,o=r(t),h=r(s),p=0,f=0,g=!1,m=i.length;p<m;)n=i[p++],g||n.key===o?(g=!0,c(this,n.key)):f++;for(;f<m;)(n=i[f++]).key===o&&n.value===h||l(this,n.key,n.value)}),{enumerable:!0,unsafe:!0})},7566:(t,e,s)=>{var i=s(6840),n=s(9504),r=s(655),a=s(2812),o=URLSearchParams,h=o.prototype,l=n(h.getAll),c=n(h.has),d=new o("a=1");!d.has("a",2)&&d.has("a",void 0)||i(h,"has",(function(t){var e=arguments.length,s=e<2?void 0:arguments[1];if(e&&void 0===s)return c(this,t);var i=l(this,t);a(e,1);for(var n=r(s),o=0;o<i.length;)if(i[o++]===n)return!0;return!1}),{enumerable:!0,unsafe:!0})},8721:(t,e,s)=>{var i=s(3724),n=s(9504),r=s(2106),a=URLSearchParams.prototype,o=n(a.forEac
2h);i&&!("size"in a)&&r(a,"size",{get:function(){var t=0;return o(this,(function(){t++})),t},configurable:!0,enumerable:!0})}},n={};function r(t){var e=n[t];if(void 0!==e)return e.exports;var s=n[t]={exports:{}};return i[t].call(s.exports,s,s.exports,r),s.exports}r.d=(t,e)=>{for(var s in e)r.o(e,s)&&!r.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var a=globalThis.pdfjsLib={};r.d(a,{AbortException:()=>D,AnnotationEditorLayer:()=>ui,AnnotationEditorParamsType:()=>p,AnnotationEditorType:()=>u,AnnotationEditorUIManager:()=>yt,AnnotationLayer:()=>Zs,AnnotationMode:()=>d,ColorPicker:()=>hi,DOMSVGFactory:()=>As,DrawLayer:()=>pi,FeatureTest:()=>j,GlobalWorkerOptions:()=>fe,ImageKind:()=>g,InvalidPDFException:()=>M,MissingPDFException:()=>P,OPS:()=>v,OutputScale:()=>ct,PDFDataRangeTransport:()=>ns,PDFDateString:()=>nt,PDFWorker:()=>hs,PasswordResponses:()=>b,PermissionFlag:()=>f,PixelsPerInch:()=>W,RenderingCancelledException:()=>Y,TextLayer:()=>Xe,UnexpectedResponseException:()=>I,Util:()=>H,VerbosityLevel:()=>m,XfaLayer:()=>ws,build:()=>gs,createValidAbsoluteUrl:()=>S,fetchData:()=>q,getDocument:()=>es,getFilenameFromUrl:()=>Z,getPdfFilenameFromUrl:()=>Q,getXfaPageViewport:()=>rt,isDataScheme:()=>K,isPdfFile:()=>J,noContextMenu:()=>st,normalizeUnicode:()=>U,setLayerDimensions:()=>lt,shadow:()=>C,version:()=>fs}),r(4114),r(6573),r(8100),r(7936),r(7467),r(4732),r(9577),r(4979),r(4603),r(7566),r(8721);const o=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),h=[1,0,0,1,0,0],l=[.001,0,0,.001,0,0],c=1.35,d={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},u={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},p={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_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},f={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},g={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},m={ERRORS:0,WARNINGS:1,INFOS:5},v={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},b={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let y=m.WARNINGS;function A(){return y}function w(t){y>=m.INFOS&&console.log(`Info: ${t}`)}function _(t){y>=m.WARNINGS&&console.log(`Warning: ${t}`)}function x(t){throw new Error(t)}function E(t,e){t||x(e)}function S(t,e=null,s=null){if(!t)return null;try{if(s&&"string"==typeof t){if(s.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);e?.length>=2&&(t=`http://${t}`)}if(s.tryConvertEncoding)try{t=function(t){return decodeURIComponent(escape(t))}(t)}catch{}}const i=e?new URL(t,e):new URL(t);if(function(t){switch(t?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(i))return i}catch{}return null}function C(t,e,s,i=!1){return Object.defineProperty(t,e,{value:s,enumerable:!i,configurable:!0,writable:!1}),s}const R=function(){function t(t,e){this.message=t,this.name=e}return t.prototype=new Error,t.constructor=t,t}();class T extends R{constructor(t,e){super(t,"PasswordException"),this.code=e}}class k extends R{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class M extends R{constructor(t){super(t,"InvalidPDFException")}}class P extends R{constructor(t){super(t,"MissingPDFException")}}class I extends R{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class L extends R{constructor(t){super(t,"FormatError")}}class D extends R{constructor(t){super(t,"AbortException")}}function F(t){"object"==typeof t&&void 0!==t?.length||x("Invalid argument for bytesToString");const e=t.length,s=8192;if(e<s)return String.fromCharCode.apply(null,t);const i=[];for(let n=0;n<e;n+=s){const r=Math.min(n+s,e),a=t.subarray(n,r);i.push(String.fromCharCode.apply(null,a))}return i.join("")}function O(t){"string"!=typeof t&&x("Invalid argument for stringToBytes");const e=t.length,s=new Uint8Array(e);for(let i=0;i<e;++i)s[i]=255&t.charCodeAt(i);return s}function N(t){const e=Object.create(null);for(const[s,i]of t)e[s]=i;return e}class j{static get isLittleEndian(){return C(this,"isLittleEndian",function(){const t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return C(this,"isEvalSupported",function(){try{return new Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return C(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"!=typeof navigator&&"string"==typeof navigator?.platform?C(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:"string"==typeof navigator?.userAgent&&navigator.userAgent.includes("Firefox")}):C(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){return C(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const B=Array.from(Array(256).keys(),(t=>t.toString(16).padStart(2,"0")));class H{static makeHexColor(t,e,s){return`#${B[t]}${B[e]}${B[s]}`}static scaleMinMax(t,e){let s;t[0]?(t[0]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[3],e[3]*=t[3]):(s=e[0],e[0]=e[1],e[1]=s,s=e[2],e[2]=e[3],e[3]=s,t[1]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){return[t[0]*e[0]+t[1]*e[2]+e[4],t[0]*e[1]+t[1]*e[3]+e[5]]}static applyInverseTransform(t,e){const s=e[0]*e[3]-e[1]*e[2];return[(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/s,(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/s]}static getAxialAlignedBoundingBox(t,e){const s=this.applyTransform(t,e),i=this.applyTransform(t.slice(2,4),e),n=this.applyTransform([t[0],t[3]],e),r=this.applyTransform([t[2],t[1]],e);return[Math.min(s[0],i[0],n[0],r[0]),Math.min(s[1],i[1],n[1],r[1]),Math.max(s[0],i[0],n[0],r[0]),Math.max(s[1],i[1],n[1],r[1])]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){const e=[t[0],t[2],t[1],t[3]],s=t[0]*e[0]+t[1]*e[2],i=t[0]*e[1]+t[1]*e[3],n=t[2]*e[0]+t[3]*e[2],r=t[2]*e[1]+t[3]*e[3],a=(s+r)/2,o=Math.sqrt((s+r)**2-4*(s*r-n*i))/2,h=a+o||1,l=a-o||1;return[Math.sqrt(h),Math.sqrt(l)]}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const s=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(s>i)return null;const n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),r=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>r?null:[s,n,i,r]}static#t(t,e,s,i,n,r,a,o,h,l){if(h<=0||h>=1)return;const c=1-h,d=h*h,u=d*h,p=c*(c*(c*t+3*h*e)+3*d*s)+u*i,f=c*(c*(c*n+3*h*r)+3*d*a)+u*o;l[0]=Math.min(l[0],p),l[1]=Math.min(l[1],f),l[2]=Math.max(l[2],p),l[3]=Math.max(l[3],f)}static#e(t,e,s,i,n,r,a,o,h,l,c,d){if(Math.abs(h)<1e-12)return void(Math.abs(l)>=1e-12&&this.#t(t,e,s,i,n,r,a,o,-c/l,d));const u=l**2-4*c*h;if(u<0)return;const p=Math.sqrt(u),f=2*h;this.#t(t,e,s,i,n,r,a,o,(-l+p)/f,d),this.#t(t,e,s,i,n,r,a,o,(-l-p)/f,d)}static bezierBoundingBox(t,e,s,i,n,r,a,o,h){return h?(h[0]=Math.min(h[0],t,a),h[1]=Math.min(h[1],e,o),h[2]=Math.max(h[2],t,a),h[3]=Math.max(h[3],e,o)):h=[Math.min(t,a),Math.min(e,o),Math.max(t,a),Math.max(e,o)],this.#e(t,s,n,a,e,i,r,o,3*(3*(s-n)-t+a),6*(t-2*s+n),3*(s-t),h),this.#e(t,s,n,a,e,i,r,o,3*(3*(i-r)-e+o),6*(e-2*i+r),3*(i-e),h),h}}let $=null,z=null;function U(t){return $||($=/([\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
2=new Map([["\ufb05","\u017ft"]])),t.replaceAll($,((t,e,s)=>e?e.normalize("NFKC"):z.get(s)))}const G="pdfjs_internal_id_";r(4628),r(7642),r(8004),r(3853),r(5876),r(2475),r(5024),r(1698),r(1454),r(8992),r(4743),r(3215),r(7550),r(8335);const V="http://www.w3.org/2000/svg";class W{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function q(t,e="text"){if(et(t,document.baseURI)){const s=await fetch(t);if(!s.ok)throw new Error(s.statusText);switch(e){case"arraybuffer":return s.arrayBuffer();case"blob":return s.blob();case"json":return s.json()}return s.text()}return new Promise(((s,i)=>{const n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType=e,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE)if(200!==n.status&&0!==n.status)i(new Error(n.statusText));else{switch(e){case"arraybuffer":case"blob":case"json":return void s(n.response)}s(n.responseText)}},n.send(null)}))}class X{constructor({viewBox:t,scale:e,rotation:s,offsetX:i=0,offsetY:n=0,dontFlip:r=!1}){this.viewBox=t,this.scale=e,this.rotation=s,this.offsetX=i,this.offsetY=n;const a=(t[2]+t[0])/2,o=(t[3]+t[1])/2;let h,l,c,d,u,p,f,g;switch((s%=360)<0&&(s+=360),s){case 180:h=-1,l=0,c=0,d=1;break;case 90:h=0,l=1,c=1,d=0;break;case 270:h=0,l=-1,c=-1,d=0;break;case 0:h=1,l=0,c=0,d=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(c=-c,d=-d),0===h?(u=Math.abs(o-t[1])*e+i,p=Math.abs(a-t[0])*e+n,f=(t[3]-t[1])*e,g=(t[2]-t[0])*e):(u=Math.abs(a-t[0])*e+i,p=Math.abs(o-t[1])*e+n,f=(t[2]-t[0])*e,g=(t[3]-t[1])*e),this.transform=[h*e,l*e,c*e,d*e,u-h*e*a-c*e*o,p-l*e*a-d*e*o],this.width=f,this.height=g}get rawDims(){const{viewBox:t}=this;return C(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:n=!1}={}){return new X({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}convertToViewportPoint(t,e){return H.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=H.applyTransform([t[0],t[1]],this.transform),s=H.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],s[0],s[1]]}convertToPdfPoint(t,e){return H.applyInverseTransform([t,e],this.transform)}}class Y extends R{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function K(t){const e=t.length;let s=0;for(;s<e&&""===t[s].trim();)s++;return"data:"===t.substring(s,s+5).toLowerCase()}function J(t){return"string"==typeof t&&/\.pdf$/i.test(t)}function Z(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function Q(t,e="document.pdf"){if("string"!=typeof t)return e;if(K(t))return _('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const s=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,i=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(t);let n=s.exec(i[1])||s.exec(i[2])||s.exec(i[3]);if(n&&(n=n[0],n.includes("%")))try{n=s.exec(decodeURIComponent(n))[0]}catch{}return n||e}class tt{started=Object.create(null);times=[];time(t){t in this.started&&_(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||_(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const{name:s}of this.times)e=Math.max(s.length,e);for(const{name:s,start:i,end:n}of this.times)t.push(`${s.padEnd(e)} ${n-i}ms\n`);return t.join("")}}function et(t,e){try{const{protocol:s}=e?new URL(t,e):new URL(t);return"http:"===s||"https:"===s}catch{return!1}}function st(t){t.preventDefault()}function it(t){console.log("Deprecated API usage: "+t)}class nt{static#s;static toDateObject(t){if(!t||"string"!=typeof t)return null;this.#s||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const e=this.#s.exec(t);if(!e)return null;const s=parseInt(e[1],10);let i=parseInt(e[2],10);i=i>=1&&i<=12?i-1:0;let n=parseInt(e[3],10);n=n>=1&&n<=31?n:1;let r=parseInt(e[4],10);r=r>=0&&r<=23?r:0;let a=parseInt(e[5],10);a=a>=0&&a<=59?a:0;let o=parseInt(e[6],10);o=o>=0&&o<=59?o:0;const h=e[7]||"Z";let l=parseInt(e[8],10);l=l>=0&&l<=23?l:0;let c=parseInt(e[9],10)||0;return c=c>=0&&c<=59?c:0,"-"===h?(r+=l,a+=c):"+"===h&&(r-=l,a-=c),new Date(Date.UTC(s,i,n,r,a,o))}}function rt(t,{scale:e=1,rotation:s=0}){const{width:i,height:n}=t.attributes.style,r=[0,0,parseInt(i),parseInt(n)];return new X({viewBox:r,scale:e,rotation:s})}function at(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(16711680&e)>>16,(65280&e)>>8,255&e]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map((t=>parseInt(t))):t.startsWith("rgba(")?t.slice(5,-1).split(",").map((t=>parseInt(t))).slice(0,3):(_(`Not a valid color format: "${t}"`),[0,0,0])}function ot(t){const{a:e,b:s,c:i,d:n,e:r,f:a}=t.getTransform();return[e,s,i,n,r,a]}function ht(t){const{a:e,b:s,c:i,d:n,e:r,f:a}=t.getTransform().invertSelf();return[e,s,i,n,r,a]}function lt(t,e,s=!1,i=!0){if(e instanceof X){const{pageWidth:i,pageHeight:n}=e.rawDims,{style:r}=t,a=j.isCSSRoundSupported,o=`var(--scale-factor) * ${i}px`,h=`var(--scale-factor) * ${n}px`,l=a?`round(down, ${o}, var(--scale-round-x, 1px))`:`calc(${o})`,c=a?`round(down, ${h}, var(--scale-round-y, 1px))`:`calc(${h})`;s&&e.rotation%180!=0?(r.width=c,r.height=l):(r.width=l,r.height=c)}i&&t.setAttribute("data-main-rotation",e.rotation)}class ct{constructor(){const t=window.devicePixelRatio||1;this.sx=t,this.sy=t}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}}class dt{#i=null;#n=null;#r;#a=null;#o=null;static#h=null;constructor(t){this.#r=t,dt.#h||=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"})}render(){const t=this.#i=document.createElement("div");t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=this.#r._uiManager._signal;t.addEventListener("contextmenu",st,{signal:e}),t.addEventListener("pointerdown",dt.#l,{signal:e});const s=this.#a=document.createElement("div");s.className="buttons",t.append(s);const i=this.#r.toolbarPosition;if(i){const{style:e}=t,s="ltr"===this.#r._uiManager.direction?1-i[0]:i[0];e.insetInlineEnd=100*s+"%",e.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return this.#c(),t}get div(){return this.#i}static#l(t){t.stopPropagation()}#d(t){this.#r._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}#u(t){this.#r._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}#p(t){const e=this.#r._uiManager._signal;t.addEventListener("focusin",this.#d.bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",this.#u.bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",st,{signal:e})}hide(){this.#i.classList.add("hidden"),this.#n?.hideDropdown()}show(){this.#i.classList.remove("hidden"),this.#o?.shown()}#c(){const{editorType:t,_uiManager:e}=this.#r,s=document.createElement("button");s.className="delete",s.tabIndex=0,s.setAttribute("data-l10n-id",dt.#h[t]),this.#p(s),s.addEventListener("click",(t=>{e.delete()}),{signal:e._signal}),this.#a.append(s)}get#f(){const t=document.createElement("div");return t.className="divider",t}async addAltText(t){const e=await t.render();this.#p(e),this.#a.prepend(e,this.#f),this.#o=t}addColorPicker(t){this.#n=t;const e=t.renderButton();this.#p(e),this.#a.prepend(e,this.#f)}remove(){this.#i.remove(),this.#n?.destroy(),this.#n=null}}class ut{#a=null;#i=null;#g;constructor(t){this.#g=t}#m(){const t=this.#i=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",st,{signal:this.#g._signal});const e=this.#a=document.createElement("div");return e.className="buttons",t.append(e),this.#v(),t}#b(t,e){let s=0,i=0;for(const n of t){const t=n.y+n.height;if(t<s)continue;const r=n.x+(e?n.width:0);t>s?(i=r,s=t):e?r>i&&(i=r):r<i&&(i=r)}return[e?1-i:i,s]}show(t,e,s){const[i,n]=this.#b(e,s),{style:r}=this.#i||=this.#m();t.append(this.#i),r.insetInlineEnd=100*i+"%",r.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){this.#i.remove()}#v(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const s=this.#g._signal;t.addEventListener("contextmenu",st,{signal:s}),t.addEventListener("click",(()=>{this.#g.highlightSelection("floating_button")}),{signal:s}),this.#a.append(t)}}function pt(t,e,s){for(const i of s)e.addEventListener(i,t[i].bind(t))}class ft{#y=0;get id(){return"pdfjs_internal_editor_"+this.#y++}}class gt{#A=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto?.randomUUID)return crypto.randomUUID();const t=new Uint8Array(32);if("undefined"!=typeof crypto&&"function"==typeof crypto?.getRandomValues)crypto.getRandomValues(t);else for(let e=0;e<32;e++)t[e]=Math.floor(255*Math.random());return F(t)}();#y=0;#w=null;static get _isSVGFittingCanvas(){const t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),e=new Image;return e.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>',C(this,"_isSVGFittingCanvas",e.decode().then((()=>(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0]))))}async#_(t,e){this.#w||=new Map;let s=this.#w.get(t);if(null===s)return null;if(s?.bitmap)return s.refCounter+=1,s;try{let t;if(s||={bitmap:null,id:`image_${this.#A}_${this.#y++}`,refCounter:0,isSvg:!1},"string"==typeof e?(s.url=e,t=await q(e,"blob")):e instanceof File?t=s.file=e:e instanceof Blob&&(t=e),"image/svg+xml"===t.type){const e=gt._isSVGFittingCanvas,i=new FileReader,n=new Image,r=new Promise(((t,r)=>{n.onload=()=>
vendor: 9,045 bytes, line 2
2{s.bitmap=n,s.isSvg=!0,t()},i.onload=async()=>{const t=s.svgUrl=i.result;n.src=await e?`${t}#svgView(preserveAspectRatio(none))`:t},n.onerror=i.onerror=r}));i.readAsDataURL(t),await r}else s.bitmap=await createImageBitmap(t);s.refCounter=1}catch(t){console.error(t),s=null}return this.#w.set(t,s),s&&this.#w.set(s.id,s),s}async getFromFile(t){const{lastModified:e,name:s,size:i,type:n}=t;return this.#_(`${e}_${s}_${i}_${n}`,t)}async getFromUrl(t){return this.#_(t,t)}async getFromBlob(t,e){const s=await e;return this.#_(t,s)}async getFromId(t){this.#w||=new Map;const e=this.#w.get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){const{blobPromise:t}=e;return delete e.blobPromise,this.getFromBlob(e.id,t)}return this.getFromUrl(e.url)}getFromCanvas(t,e){this.#w||=new Map;let s=this.#w.get(t);if(s?.bitmap)return s.refCounter+=1,s;const i=new OffscreenCanvas(e.width,e.height);return i.getContext("2d").drawImage(e,0,0),s={bitmap:i.transferToImageBitmap(),id:`image_${this.#A}_${this.#y++}`,refCounter:1,isSvg:!1},this.#w.set(t,s),this.#w.set(s.id,s),s}getSvgUrl(t){const e=this.#w.get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){this.#w||=new Map;const e=this.#w.get(t);if(!e)return;if(e.refCounter-=1,0!==e.refCounter)return;const{bitmap:s}=e;if(!e.url&&!e.file){const t=new OffscreenCanvas(s.width,s.height);t.getContext("bitmaprenderer").transferFromImageBitmap(s),e.blobPromise=t.convertToBlob()}s.close?.(),e.bitmap=null}isValidId(t){return t.startsWith(`image_${this.#A}_`)}}class mt{#x=[];#E=!1;#S;#C=-1;constructor(t=128){this.#S=t}add({cmd:t,undo:e,post:s,mustExec:i,type:n=NaN,overwriteIfSameType:r=!1,keepUndo:a=!1}){if(i&&t(),this.#E)return;const o={cmd:t,undo:e,post:s,type:n};if(-1===this.#C)return this.#x.length>0&&(this.#x.length=0),this.#C=0,void this.#x.push(o);if(r&&this.#x[this.#C].type===n)return a&&(o.undo=this.#x[this.#C].undo),void(this.#x[this.#C]=o);const h=this.#C+1;h===this.#S?this.#x.splice(0,1):(this.#C=h,h<this.#x.length&&this.#x.splice(h)),this.#x.push(o)}undo(){if(-1===this.#C)return;this.#E=!0;const{undo:t,post:e}=this.#x[this.#C];t(),e?.(),this.#E=!1,this.#C-=1}redo(){if(this.#C<this.#x.length-1){this.#C+=1,this.#E=!0;const{cmd:t,post:e}=this.#x[this.#C];t(),e?.(),this.#E=!1}}hasSomethingToUndo(){return-1!==this.#C}hasSomethingToRedo(){return this.#C<this.#x.length-1}destroy(){this.#x=null}}class vt{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=j.platform;for(const[s,i,n={}]of t)for(const t of s){const s=t.startsWith("mac+");e&&s?(this.callbacks.set(t.slice(4),{callback:i,options:n}),this.allKeys.add(t.split("+").at(-1))):e||s||(this.callbacks.set(t,{callback:i,options:n}),this.allKeys.add(t.split("+").at(-1)))}}#R(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e}exec(t,e){if(!this.allKeys.has(e.key))return;const s=this.callbacks.get(this.#R(e));if(!s)return;const{callback:i,options:{bubbles:n=!1,args:r=[],checker:a=null}}=s;a&&!a(t,e)||(i.bind(t,...r,e)(),n||(e.stopPropagation(),e.preventDefault()))}}class bt{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return function(t){const e=document.createElement("span");e.style.visibility="hidden",document.body.append(e);for(const s of t.keys()){e.style.color=s;const i=window.getComputedStyle(e).color;t.set(s,at(i))}e.remove()}(t),C(this,"_colors",t)}convert(t){const e=at(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[s,i]of this._colors)if(i.every(((t,s)=>t===e[s])))return bt._colorsMapping.get(s);return e}getHexCode(t){const e=this._colors.get(t);return e?H.makeHexColor(...e):t}}class yt{#T=new AbortController;#k=null;#M=new Map;#P=new Map;#I=null;#L=null;#D=null;#F=new mt;#O=null;#N=0;#j=new Set;#B=null;#H=null;#$=new Set;#z=!1;#U=!1;#G=!1;#V=null;#W=null;#q=null;#X=null;#Y=!1;#K=null;#J=new ft;#Z=!1;#Q=!1;#tt=null;#et=null;#st=null;#it=null;#nt=u.NONE;#rt=new Set;#at=null;#ot=null;#ht=null;#lt={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#ct=[0,0];#dt=null;#ut=null;#pt=null;#ft=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const t=yt.prototype,e=t=>t.#ut.contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),s=(t,{target:e})=>{if(e instanceof HTMLInputElement){const{type:t}=e;return"text"!==t&&"number"!==t}return!0},i=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return C(this,"_keyboardManager",new vt([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:s}],[["ctrl+z","mac+meta+z"],t.undo,{checker:s}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:s}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:s}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(t,{target:e})=>!(e instanceof HTMLButtonElement)&&t.#ut.contains(e)&&!t.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,{target:e})=>!(e instanceof HTMLButtonElement)&&t.#ut.contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}constructor(t,e,s,i,n,r,a,o,h,l,c){const d=this._signal=this.#T.signal;this.#ut=t,this.#pt=e,this.#I=s,this._eventBus=i,i._on("editingaction",this.onEditingAction.bind(this),{signal:d}),i._on("pagechanging",this.onPageChanging.bind(this),{signal:d}),i._on("scalechanging",this.onScaleChanging.bind(this),{signal:d}),i._on("rotationchanging",this.onRotationChanging.bind(this),{signal:d}),i._on("setpreference",this.onSetPreference.bind(this),{signal:d}),i._on("switchannotationeditorparams",(t=>this.updateParams(t.type,t.value)),{signal:d}),this.#gt(),this.#mt(),this.#vt(),this.#L=n.annotationStorage,this.#V=n.filterFactory,this.#ot=r,this.#X=a||null,this.#z=o,this.#U=h,this.#G=l,this.#it=c||null,this.viewParameters={realScale:W.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){this.#ft?.resolve(),this.#ft=null,this.#T?.abort(),this.#T=null,this._signal=null;for(const t of this.#P.values())t.destroy();this.#P.clear(),this.#M.clear(),this.#$.clear(),this.#k=null,this.#rt.clear(),this.#F.destroy(),this.#I?.destroy(),this.#K?.hide(),this.#K=null,this.#W&&(clearTimeout(this.#W),this.#W=null),this.#dt&&(clearTimeout(this.#dt),this.#dt=null)}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return this.#it}get useNewAltTextFlow(){return this.#U}get useNewAltTextWhenAddingImage(){return this.#G}get hcmFilter(){return C(this,"hcmFilter",this.#ot?this.#V.addHCMFilter(this.#ot.foreground,this.#ot.background):"none")}get direction(){return C(this,"direction",getComputedStyle(this.#ut).direction)}get highlightColors(){return C(this,"highlightColors",this.#X?new Map(this.#X.split(",").map((t=>t.split("=").map((t=>t.trim()))))):null)}get highlightColorNames(){return C(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,(t=>t.reverse()))):null)}setMainHighlightColorPicker(t){this.#st=t}editAltText(t,e=!1){this.#I?.editAltText(this,t,e)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference({name:t,value:e}){"enableNewAltTextWhenAddingImage"===t&&(this.#G=e)}onPageChanging({pageNumber:t}){this.#N=t-1}focusMainContainer(){this.#ut.focus()}findParent(t,e){for(const s of this.#P.values()){const{x:i,y:n,width:r,height:a}=s.div.getBoundingClientRect();if(t>=i&&t<=i+r&&e>=n&&e<=n+a)return s}return null}disableUserSelect(t=!1){this.#pt.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#$.add(t)}removeShouldRescale(t){this.#$.delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*W.PDF_TO_CSS_UNITS;for(const e of this.#$)e.onScaleChanging()}
2onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}#bt({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t}#yt(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const s of this.#P.values())if(s.hasTextLayer(t))return s;return null}highlightSelection(t=""){const e=document.getSelection();if(!e||e.isCollapsed)return;const{anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:r}=e,a=e.toString(),o=this.#bt(e).closest(".textLayer"),h=this.getSelectionBoxes(o);if(!h)return;e.empty();const l=this.#yt(o),c=this.#nt===u.NONE,d=()=>{l?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:r,text:a}),c&&this.showAllEditors("highlight",!0,!0)};c?this.switchToMode(u.HIGHLIGHT,d):d()}#At(){const t=document.getSelection();if(!t||t.isCollapsed)return;const e=this.#bt(t).closest(".textLayer"),s=this.getSelectionBoxes(e);s&&(this.#K||=new ut(this),this.#K.show(e,s,"ltr"===this.direction))}addToAnnotationStorage(t){t.isEmpty()||!this.#L||this.#L.has(t.id)||this.#L.setValue(t.id,t)}#wt(){const t=document.getSelection();if(!t||t.isCollapsed)return void(this.#at&&(this.#K?.hide(),this.#at=null,this.#_t({hasSelectedText:!1})));const{anchorNode:e}=t;if(e===this.#at)return;const s=this.#bt(t).closest(".textLayer");if(s){if(this.#K?.hide(),this.#at=e,this.#_t({hasSelectedText:!0}),(this.#nt===u.HIGHLIGHT||this.#nt===u.NONE)&&(this.#nt===u.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#Y=this.isShiftKeyDown,!this.isShiftKeyDown)){const t=this.#nt===u.HIGHLIGHT?this.#yt(s):null;t?.toggleDrawing();const e=new AbortController,i=this.combinedSignal(e),n=s=>{"pointerup"===s.type&&0!==s.button||(e.abort(),t?.toggleDrawing(!0),"pointerup"===s.type&&this.#xt("main_toolbar"))};window.addEventListener("pointerup",n,{signal:i}),window.addEventListener("blur",n,{signal:i})}}else this.#at&&(this.#K?.hide(),this.#at=null,this.#_t({hasSelectedText:!1}))}#xt(t=""){this.#nt===u.HIGHLIGHT?this.highlightSelection(t):this.#z&&this.#At()}#gt(){document.addEventListener("selectionchange",this.#wt.bind(this),{signal:this._signal})}#Et(){if(this.#q)return;this.#q=new AbortController;const t=this.combinedSignal(this.#q);window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}#St(){this.#q?.abort(),this.#q=null}blur(){if(this.isShiftKeyDown=!1,this.#Y&&(this.#Y=!1,this.#xt("main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of this.#rt)if(e.div.contains(t)){this.#et=[e,t],e._focusEventsAllowed=!1;break}}focus(){if(!this.#et)return;const[t,e]=this.#et;this.#et=null,e.addEventListener("focusin",(()=>{t._focusEventsAllowed=!0}),{once:!0,signal:this._signal}),e.focus()}#vt(){if(this.#tt)return;this.#tt=new AbortController;const t=this.combinedSignal(this.#tt);window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})}#Ct(){this.#tt?.abort(),this.#tt=null}#Rt(){if(this.#O)return;this.#O=new AbortController;const t=this.combinedSignal(this.#O);document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})}#Tt(){this.#O?.abort(),this.#O=null}#mt(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}addEditListeners(){this.#vt(),this.#Rt()}removeEditListeners(){this.#Ct(),this.#Tt()}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const s of this.#H)if(s.isHandlingMimeForPasting(e))return t.dataTransfer.dropEffect="copy",void t.preventDefault()}drop(t){for(const e of t.dataTransfer.items)for(const s of this.#H)if(s.isHandlingMimeForPasting(e.type))return s.paste(e,this.currentLayer),void t.preventDefault()}copy(t){if(t.preventDefault(),this.#k?.commitOrRemove(),!this.hasSelection)return;const e=[];
2for(const s of this.#rt){const t=s.serialize(!0);t&&e.push(t)}0!==e.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();const{clipboardData:e}=t;for(const n of e.items)for(const t of this.#H)if(t.isHandlingMimeForPasting(n.type))return void t.paste(n,this.currentLayer);let s=e.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(t){return void _(`paste: "${t.message}".`)}if(!Array.isArray(s))return;this.unselectAll();const i=this.currentLayer;try{const t=[];for(const r of s){const e=await i.deserialize(r);if(!e)return;t.push(e)}const e=()=>{for(const e of t)this.#kt(e);this.#Mt(t)},n=()=>{for(const e of t)e.remove()};this.addCommands({cmd:e,undo:n,mustExec:!0})}catch(t){_(`paste: "${t.message}".`)}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),this.#nt===u.NONE||this.isEditorHandlingKeyboard||yt._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,this.#Y&&(this.#Y=!1,this.#xt("main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu")}}#_t(t){Object.entries(t).some((([t,e])=>this.#lt[t]!==e))&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#lt,t)}),this.#nt===u.HIGHLIGHT&&!1===t.hasSelectedEditor&&this.#Pt([[p.HIGHLIGHT_FREE,!0]]))}#Pt(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#Et(),this.#Rt(),this.#_t({isEditing:this.#nt!==u.NONE,isEmpty:this.#It(),hasSomethingToUndo:this.#F.hasSomethingToUndo(),hasSomethingToRedo:this.#F.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#St(),this.#Tt(),this.#_t({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!this.#H){this.#H=t;for(const t of this.#H)this.#Pt(t.defaultPropertiesToUpdate)}}getId(){return this.#J.id}get currentLayer(){return this.#P.get(this.#N)}getLayer(t){return this.#P.get(t)}get currentPageIndex(){return this.#N}addLayer(t){this.#P.set(t.pageIndex,t),this.#Z?t.enable():t.disable()}removeLayer(t){this.#P.delete(t.pageIndex)}async updateMode(t,e=null,s=!1){if(this.#nt!==t){if(this.#ft&&(await this.#ft.promise,!this.#ft))return;if(this.#ft=Promise.withResolvers(),this.#nt=t,t!==u.NONE){this.setEditingState(!0),await this.#Lt(),this.unselectAll();for(const e of this.#P.values())e.updateMode(t);if(e){for(const t of this.#M.values())t.annotationElementId===e?(this.setSelected(t),t.enterInEditMode()):t.unselect();this.#ft.resolve()}else s&&this.addNewEditorFromKeyboard(),this.#ft.resolve()}else this.setEditingState(!1),this.#Dt(),this.#ft.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==this.#nt&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){if(this.#H){switch(t){case p.CREATE:return void this.currentLayer.addNewEditor();case p.HIGHLIGHT_DEFAULT_COLOR:this.#st?.updateColor(e);break;case p.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#ht||=new Map).set(t,e),this.showAllEditors("highlight",e)}for(const s of this.#rt)s.updateParams(t,e);for(const s of this.#H)s.updateDefaultParams(t,e)}}showAllEditors(t,e,s=!1){for(const i of this.#M.values())i.editorType===t&&i.show(e);(this.#ht?.get(p.HIGHLIGHT_SHOW_ALL)??!0)!==e&&this.#Pt([[p.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(this.#Q!==t){this.#Q=t;for(const e of this.#P.values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}async#Lt(){if(!this.#Z){this.#Z=!0;const t=[];for(const e of this.#P.values())t.push(e.enable());await Promise.all(t);for(const e of this.#M.values())e.enable()}}#Dt(){if(this.unselectAll(),this.#Z){this.#Z=!1;for(const t of this.#P.values())t.disable();for(const t of this.#M.values())t.disable()}}getEditors(t){const e=[];for(const s of this.#M.values())s.pageIndex===t&&e.push(s);return e}getEditor(t){return this.#M.get(t)}addEditor(t){this.#M.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#W&&clearTimeout(this.#W),this.#W=setTimeout((()=>{this.focusMainContainer(),this.#W=null}),0)),this.#M.delete(t.id),this.unselect(t),t.annotationElementId&&this.#j.has(t.annotationElementId)||this.#L?.remove(t.id)}addDeletedAnnotationElement(t){this.#j.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}
vendor: 13,044 bytes, line 2
2isDeletedAnnotationElement(t){return this.#j.has(t)}removeDeletedAnnotationElement(t){this.#j.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#kt(t){const e=this.#P.get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){this.#k!==t&&(this.#k=t,t&&this.#Pt(t.propertiesToUpdate))}get#Ft(){let t=null;for(t of this.#rt);return t}updateUI(t){this.#Ft===t&&this.#Pt(t.propertiesToUpdate)}toggleSelected(t){this.#rt.has(t)?(this.#rt.delete(t),t.unselect(),this.#_t({hasSelectedEditor:this.hasSelection})):(this.#rt.add(t),t.select(),this.#Pt(t.propertiesToUpdate),this.#_t({hasSelectedEditor:!0}))}setSelected(t){for(const e of this.#rt)e!==t&&e.unselect();this.#rt.clear(),this.#rt.add(t),t.select(),this.#Pt(t.propertiesToUpdate),this.#_t({hasSelectedEditor:!0})}isSelected(t){return this.#rt.has(t)}get firstSelectedEditor(){return this.#rt.values().next().value}unselect(t){t.unselect(),this.#rt.delete(t),this.#_t({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#rt.size}get isEnterHandled(){return 1===this.#rt.size&&this.firstSelectedEditor.isEnterHandled}undo(){this.#F.undo(),this.#_t({hasSomethingToUndo:this.#F.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#It()})}redo(){this.#F.redo(),this.#_t({hasSomethingToUndo:!0,hasSomethingToRedo:this.#F.hasSomethingToRedo(),isEmpty:this.#It()})}addCommands(t){this.#F.add(t),this.#_t({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#It()})}#It(){if(0===this.#M.size)return!0;if(1===this.#M.size)for(const t of this.#M.values())return t.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...this.#rt];this.addCommands({cmd:()=>{for(const e of t)e.remove()},undo:()=>{for(const e of t)this.#kt(e)},mustExec:!0})}commitOrRemove(){this.#k?.commitOrRemove()}hasSomethingToControl(){return this.#k||this.hasSelection}#Mt(t){for(const e of this.#rt)e.unselect();this.#rt.clear();for(const e of t)e.isEmpty()||(this.#rt.add(e),e.select());this.#_t({hasSelectedEditor:this.hasSelection})}selectAll(){for(const t of this.#rt)t.commit();this.#Mt(this.#M.values())}unselectAll(){if((!this.#k||(this.#k.commitOrRemove(),this.#nt===u.NONE))&&this.hasSelection){for(const t of this.#rt)t.unselect();this.#rt.clear(),this.#_t({hasSelectedEditor:!1})}}translateSelectedEditors(t,e,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;this.#ct[0]+=t,this.#ct[1]+=e;const[i,n]=this.#ct,r=[...this.#rt];this.#dt&&clearTimeout(this.#dt),this.#dt=setTimeout((()=>{this.#dt=null,this.#ct[0]=this.#ct[1]=0,this.addCommands({cmd:()=>{for(const t of r)this.#M.has(t.id)&&t.translateInPage(i,n)},undo:()=>{for(const t of r)this.#M.has(t.id)&&t.translateInPage(-i,-n)},mustExec:!1})}),1e3);for(const a of r)a.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#B=new Map;for(const t of this.#rt)this.#B.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#B)return!1;this.disableUserSelect(!1);const t=this.#B;this.#B=null;let e=!1;for(const[{x:i,y:n,pageIndex:r},a]of t)a.newX=i,a.newY=n,a.newPageIndex=r,e||=i!==a.savedX||n!==a.savedY||r!==a.savedPageIndex;if(!e)return!1;const s=(t,e,s,i)=>{if(this.#M.has(t.id)){const n=this.#P.get(i);n?t._setParentAndPosition(n,e,s):(t.pageIndex=i,t.x=e,t.y=s)}};return this.addCommands({cmd:()=>{for(const[e,{newX:i,newY:n,newPageIndex:r}]of t)s(e,i,n,r)},undo:()=>{for(const[e,{savedX:i,savedY:n,savedPageIndex:r}]of t)s(e,i,n,r)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(this.#B)for(const s of this.#B.keys())s.drag(t,e)}rebuild(t){if(null===t.parent){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||1===this.#rt.size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#k===t}getActive(){return this.#k}getMode(){return this.#nt}get imageManager(){return C(this,"imageManager",new gt)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let h=0,l=e.rangeCount;h<l;h++)if(!t.contains(e.getRangeAt(h).commonAncestorContainer))return null;const{x:s,y:i,width:n,height:r}=t.getBoundingClientRect();let a;switch(t.getAttribute("data-main-rotation")){case"90":a=(t,e,a,o)=>({x:(e-i)/r,y:1-(t+a-s)/n,width:o/r,height:a/n});break;case"180":a=(t,e,a,o)=>({x:1-(t+a-s)/n,y:1-(e+o-i)/r,width:a/n,height:o/r});break;case"270":a=(t,e,a,o)=>({x:1-(e+o-i)/r,y:(t-s)/n,width:o/r,height:a/n});break;default:a=(t,e,a,o)=>({x:(t-s)/n,y:(e-i)/r,width:a/n,height:o/r})}const o=[];for(let h=0,l=e.rangeCount;h<l;h++){const t=e.getRangeAt(h);if(!t.collapsed)for(const{x:e,y:s,width:i,height:n}of t.getClientRects())0!==i&&0!==n&&o.push(a(e,s,i,n))}return 0===o.length?null:o}addChangedExistingAnnotation({annotationElementId:t,id:e}){(this.#D||=new Map).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){this.#D?.delete(t)}renderAnnotationElement(t){const e=this.#D?.get(t.data.id);if(!e)return;const s=this.#L.getRawValue(e);s&&(this.#nt!==u.NONE||s.hasBeenModified)&&s.renderAnnotationElement(t)}}class At{#o=null;#Ot=!1;#Nt=null;#jt=null;#Bt=null;#Ht=null;#$t=!1;#zt=null;#r=null;#Ut=null;#Gt=null;#Vt=!1;static#Wt=null;static _l10n=null;constructor(t){this.#r=t,this.#Vt=t._uiManager.useNewAltTextFlow,At.#Wt||=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(t){At._l10n??=t}async render(){const t=this.#Nt=document.createElement("button");t.className="altText",t.tabIndex="0";const e=this.#jt=document.createElement("span");t.append(e),this.#Vt?(t.classList.add("new"),t.setAttribute("data-l10n-id",At.#Wt.missing),e.setAttribute("data-l10n-id",At.#Wt["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const s=this.#r._uiManager._signal;t.addEventListener("contextmenu",st,{signal:s}),t.addEventListener("pointerdown",(t=>t.stopPropagation()),{signal:s});const i=t=>{t.preventDefault(),this.#r._uiManager.editAltText(this.#r),this.#Vt&&this.#r._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#qt}})};return t.addEventListener("click",i,{capture:!0,signal:s}),t.addEventListener("keydown",(e=>{e.target===t&&"Enter"===e.key&&(this.#$t=!0,i(e))}),{signal:s}),await this.#Xt(),t}get#qt(){return(this.#o?"added":null===this.#o&&this.guessedText&&"review")||"missing"}finish(){this.#Nt&&(this.#Nt.focus({focusVisible:this.#$t}),this.#$t=!1)}isEmpty(){return this.#Vt?null===this.#o:!this.#o&&!this.#Ot}hasData(){return this.#Vt?null!==this.#o||!!this.#Ut:this.isEmpty()}get guessedText(){return this.#Ut}async setGuessedText(t){null===this.#o&&(this.#Ut=t,this.#Gt=await At._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t}),this.#Xt())}toggleAltTextBadge(t=!1){if(this.#Vt&&!this.#o){if(!this.#zt){const t=this.#zt=document.createElement("div");t.className="noAltTextBadge",this.#r.div.append(t)}this.#zt.classList.toggle("hidden",!t)}else this.#zt?.remove(),this.#zt=null}serialize(t){let e=this.#o;return t||this.#Ut!==e||(e=this.#Gt),{altText:e,decorative:this.#Ot,guessedText:this.#Ut,textWithDisclaimer:this.#Gt}}get data(){return{altText:this.#o,decorative:this.#Ot}}set data({altText:t,decorative:e,guessedText:s,textWithDisclaimer:i,cancel:n=!1}){s&&(this.#Ut=s,this.#Gt=i),this.#o===t&&this.#Ot===e||(n||(this.#o=t,this.#Ot=e),this.#Xt())}toggle(t=!1){this.#Nt&&(!t&&this.#Ht&&(clearTimeout(this.#Ht),this.#Ht=null),this.#Nt.disabled=!t)}shown(){this.#r._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#qt}})}destroy(){this.#Nt?.remove(),this.#Nt=null,this.#jt=null,this.#Bt=null,this.#zt?.remove(),this.#zt=null}async#Xt(){const t=this.#Nt;if(!t)return;if(this.#Vt){if(t.classList.toggle("done",!!this.#o),t.setAttribute("data-l10n-id",At.#Wt[this.#qt]),this.#jt?.setAttribute("data-l10n-id",At.#Wt[`${this.#qt}-label`]),!this.#o)return void this.#Bt?.remove()}else{if(!this.#o&&!this.#Ot)return t.classList.remove("done"),void this.#Bt?.remove();t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=this.#Bt;if(!e){this.#Bt=e=document.createElement("span"),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${this.#r.id}`;const s=100,i=this.#r._uiManager._signal;i.addEventListener("abort",(()=>{clearTimeout(this.#Ht),this.#Ht=null}),{once:!0}),t.addEventListener("mouseenter",(()=>{this.#Ht=setTimeout((()=>{this.#Ht=null,this.#Bt.classList.add("show"),this.#r._reportTelemetry({action:"alt_text_tooltip"})}),s)}),{signal:i}),t.addEventListener("mouseleave",(()=>{this.#Ht&&(clearTimeout(this.#Ht),this.#Ht=null),this.#Bt?.classList.remove("show")}),{signal:i})}this.#Ot?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=this.#o),e.parentNode||t.append(e);const s=this.#r.getImageForAltText();s?.setAttribute("aria-describedby",e.id)}}class wt{#Yt=null;#Kt=null;#o=null;#Jt=!1;#Zt=!1;#Qt=null;#te=null;#ee=null;#se="";#ie=!1;#ne=null;#re=!1;#ae=!1;#oe=!1;#he=null;#le=0;#ce=0;#de=null;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nResizer=null;#ue=!1;#pe=wt._zIndex++;static _borderLineWidth=-1;static _colorManager=new bt;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const t=wt.prototype._resizeWithKeyboard,e=yt.TRANSLATE_SMALL,s=yt.TRANSLATE_BIG;return C(this,"_resizerKeyboardManager",new vt([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-s,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[s,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-s]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,s]}],[["Escape","mac+Escape"],wt.prototype._stopResizingWithKeyboard]]))}constructor(t){this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const{rotation:e,rawDims:{pageWidth:s,pageHeight:i,pageX:n,pageY:r}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,i],this.pageTranslation=[n,r];const[a,o]=this.parentDimensions;this.x=t.x/a,this.y=t.y/o,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return C(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new _t({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(wt._l10n??=t,wt._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"}),-1!==wt._borderLineWidth)return;const s=getComputedStyle(document.documentElement);wt._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){x("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#ue}set _isDraggable(t){this.#ue=t,this.div?.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}
2setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#pe}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):this.#fe(),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#ie?this.#ie=!1:this.parent.setSelected(this))}focusout(t){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const e=t.relatedTarget;e?.closest(`#${this.id}`)||(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,s,i){const[n,r]=this.parentDimensions;[s,i]=this.screenToPageTranslation(s,i),this.x=(t+s)/n,this.y=(e+i)/r,this.fixAndSetPosition()}#ge([t,e],s,i){[s,i]=this.screenToPageTranslation(s,i),this.x+=s/t,this.y+=i/e,this.fixAndSetPosition()}translate(t,e){this.#ge(this.parentDimensions,t,e)}translateInPage(t,e){this.#ne||=[this.x,this.y],this.#ge(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){this.#ne||=[this.x,this.y];const[s,i]=this.parentDimensions;if(this.x+=t/s,this.y+=e/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:t,y:e}=this.div.getBoundingClientRect();this.parent.findNewParent(this,t,e)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:n,y:r}=this;const[a,o]=this.getBaseTranslation();n+=a,r+=o,this.div.style.left=`${(100*n).toFixed(2)}%`,this.div.style.top=`${(100*r).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!this.#ne&&(this.#ne[0]!==this.x||this.#ne[1]!==this.y)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:s}=wt,i=s/t,n=s/e;switch(this.rotation){case 90:return[-i,n];case 180:return[i,n];case 270:return[i,-n];default:return[-i,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const[e,s]=this.pageDimensions;let{x:i,y:n,width:r,height:a}=this;if(r*=e,a*=s,i*=e,n*=s,this._mustFixPosition)switch(t){case 0:i=Math.max(0,Math.min(e-r,i)),n=Math.max(0,Math.min(s-a,n));break;case 90:i=Math.max(0,Math.min(e-a,i)),n=Math.min(s,Math.max(r,n));break;case 180:i=Math.min(e,Math.max(r,i)),n=Math.min(s,Math.max(a,n));break;case 270:i=Math.min(e,Math.max(a,i)),n=Math.max(0,Math.min(s-r,n))}this.x=i/=e,this.y=n/=s;const[o,h]=this.getBaseTranslation();i+=o,n+=h;const{style:l}=this.div;l.left=`${(100*i).toFixed(2)}%`,l.top=`${(100*n).toFixed(2)}%`,this.moveInDOM()}static#me(t,e,s){switch(s){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}screenToPageTranslation(t,e){return wt.#me(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return wt.#me(t,e,360-this.parentRotation)}#ve(t){switch(t){case 90:{const[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,s]}=this;return[e*t,s*t]}setDims(t,e){const[s,i]=this.parentDimensions;this.div.style.width=`${(100*t/s).toFixed(2)}%`,this.#Zt||(this.div.style.height=`${(100*e/i).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:e,width:s}=t,i=s.endsWith("%"),n=!this.#Zt&&e.endsWith("%");if(i&&n)return;const[r,a]=this.parentDimensions;i||(t.width=`${(100*parseFloat(s)/r).toFixed(2)}%`),this.#Zt||n||(t.height=`${(100*parseFloat(e)/a).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#be(){if(this.#Qt)return;this.#Qt=document.createElement("div"),this.#Qt.classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const s of t){const t=document.createElement("div");this.#Qt.append(t),t.classList.add("resizer",s),t.setAttribute("data-resizer-name",s),t.addEventListener("pointerdown",this.#ye.bind(this,s),{signal:e}),t.addEventListener("contextmenu",st,{signal:e}),t.tabIndex=-1}this.div.prepend(this.#Qt)}#ye(t,e){e.preventDefault();const{isMac:s}=j.platform;if(0!==e.button||e.ctrlKey&&s)return;this.#o?.toggle(!1);const i=this._isDraggable;this._isDraggable=!1;const n=new AbortController,r=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#Ae.bind(this,t),{passive:!0,capture:!0,signal:r}),window.addEventListener("contextmenu",st,{signal:r});const a=this.x,o=this.y,h=this.width,l=this.height,c=this.parent.div.style.cursor,d=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const u=()=>{n.abort(),this.parent.togglePointerEvents(!0),this.#o?.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=c,this.div.style.cursor=d,this.#we(a,o,h,l)};window.addEventListener("pointerup",u,{signal:r}),window.addEventListener("blur",u,{signal:r})}#we(t,e,s,i){const n=this.x,r=this.y,a=this.width,o=this.height;n===t&&r===e&&a===s&&o===i||this.addCommands({cmd:()=>{this.width=a,this.height=o,this.x=n,this.y=r;const[t,e]=this.parentDimensions;this.setDims(t*a,e*o),this.fixAndSetPosition()},undo:()=>{this.width=s,this.height=i,this.x=t,this.y=e;const[n,r]=this.parentDimensions;this.setDims(n*s,r*i),this.fixAndSetPosition()},mustExec:!0})}#Ae(t,e){const[s,i]=this.parentDimensions,n=this.x,r=this.y,a=this.width,o=this.height,h=wt.MIN_SIZE/s,l=wt.MIN_SIZE/i,c=t=>Math.round(1e4*t)/1e4,d=this.#ve(this.rotation),u=(t,e)=>[d[0]*t+d[2]*e,d[1]*t+d[3]*e],p=this.#ve(360-this.rotation);let f,g,m=!1,v=!1;switch(t){case"topLeft":m=!0,f=(t,e)=>
2[0,0],g=(t,e)=>[t,e];break;case"topMiddle":f=(t,e)=>[t/2,0],g=(t,e)=>[t/2,e];break;case"topRight":m=!0,f=(t,e)=>[t,0],g=(t,e)=>[0,e];break;case"middleRight":v=!0,f=(t,e)=>[t,e/2],g=(t,e)=>[0,e/2];break;case"bottomRight":m=!0,f=(t,e)=>[t,e],g=(t,e)=>[0,0];break;case"bottomMiddle":f=(t,e)=>[t/2,e],g=(t,e)=>[t/2,0];break;case"bottomLeft":m=!0,f=(t,e)=>[0,e],g=(t,e)=>[t,0];break;case"middleLeft":v=!0,f=(t,e)=>[0,e/2],g=(t,e)=>[t,e/2]}const b=f(a,o),y=g(a,o);let A=u(...y);const w=c(n+A[0]),_=c(r+A[1]);let x=1,E=1,[S,C]=this.screenToPageTranslation(e.movementX,e.movementY);var R,T;if([S,C]=(R=S/s,T=C/i,[p[0]*R+p[2]*T,p[1]*R+p[3]*T]),m){const t=Math.hypot(a,o);x=E=Math.max(Math.min(Math.hypot(y[0]-b[0]-S,y[1]-b[1]-C)/t,1/a,1/o),h/a,l/o)}else v?x=Math.max(h,Math.min(1,Math.abs(y[0]-b[0]-S)))/a:E=Math.max(l,Math.min(1,Math.abs(y[1]-b[1]-C)))/o;const k=c(a*x),M=c(o*E);A=u(...g(k,M));const P=w-A[0],I=_-A[1];this.width=k,this.height=M,this.x=P,this.y=I,this.setDims(s*k,i*M),this.fixAndSetPosition()}altTextFinish(){this.#o?.finish()}async addEditToolbar(){return this._editToolbar||this.#ae||(this._editToolbar=new dt(this),this.div.append(this._editToolbar.render()),this.#o&&await this._editToolbar.addAltText(this.#o)),this._editToolbar}removeEditToolbar(){this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,this.#o?.destroy())}addContainer(t){const e=this._editToolbar?.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#o||(At.initialize(wt._l10n),this.#o=new At(this),this.#Yt&&(this.#o.data=this.#Yt,this.#Yt=null),await this.addEditToolbar())}get altTextData(){return this.#o?.data}set altTextData(t){this.#o&&(this.#o.data=t)}get guessedAltText(){return this.#o?.guessedText}async setGuessedAltText(t){await(this.#o?.setGuessedText(t))}serializeAltText(t){return this.#o?.serialize(t)}hasAltText(){return!!this.#o&&!this.#o.isEmpty()}hasAltTextData(){return this.#o?.hasData()??!1}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=this.#Jt?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),this.#_e();const[t,e]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*e/t).toFixed(2)}%`,this.div.style.maxHeight=`${(100*t/e).toFixed(2)}%`);const[s,i]=this.getInitialTranslation();return this.translate(s,i),pt(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:e}=j.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():(this.#ie=!0,this._isDraggable?this.#xe(t):this.#Ee(t))}get isSelected(){return this._uiManager.isSelected(this)}#Ee(t){const{isMac:e}=j.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#xe(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();const s=new AbortController,i=this._uiManager.combinedSignal(s);if(e){this.div.classList.add("moving"),this.#le=t.clientX,this.#ce=t.clientY;const e=t=>{const{clientX:e,clientY:s}=t,[i,n]=this.screenToPageTranslation(e-this.#le,s-this.#ce);this.#le=e,this.#ce=s,this._uiManager.dragSelectedEditors(i,n)};window.addEventListener("pointermove",e,{passive:!0,capture:!0,signal:i})}const n=()=>{s.abort(),e&&this.div.classList.remove("moving"),this.#ie=!1,this._uiManager.endDragSession()||this.#Ee(t)};window.addEventListener("pointerup",n,{signal:i}),window.addEventListener("blur",n,{signal:i})}moveInDOM(){this.#he&&clearTimeout(this.#he),this.#he=setTimeout((()=>{this.#he=null,this.parent?.moveEditorInDOM(this)}),0)}_setParentAndPosition(t,e,s){t.changeParent(this),this.x=e,this.y=s,this.fixAndSetPosition()}getRect(t,e,s=this.rotation){const i=this.parentScale,[n,r]=this.pageDimensions,[a,o]=this.pageTranslation,h=t/i,l=e/i,c=this.x*n,d=this.y*r,u=this.width*n,p=this.height*r;switch(s){case 0:return[c+h+a,r-d-l-p+o,c+h+u+a,r-d-l+o];case 90:return[c+l+a,r-d+h+o,c+l+p+a,r-d+h+u+o];case 180:return[c-h-u+a,r-d+l+o,c-h+a,r-d+l+p+o];case 270:return[c-l-p+a,r-d-h-u+o,c-l+a,r-d-h+o];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[s,i,n,r]=t,a=n-s,o=r-i;switch(this.rotation){case 0:return[s,e-r,a,o];case 90:return[s,e-i,o,a];case 180:return[n,e-i,a,o];case 270:return[n,e-r,o,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#ae=!0}
2disableEditMode(){this.#ae=!1}isInEditMode(){return this.#ae}shouldGetKeyboardEvents(){return this.#oe}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}#_e(){if(this.#ee||!this.div)return;this.#ee=new AbortController;const t=this._uiManager.combinedSignal(this.#ee);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}rebuild(){this.#_e()}rotate(t){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(t=!1,e=null){x("An editor must be serializable")}static async deserialize(t,e,s){const i=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:s});i.rotation=t.rotation,i.#Yt=t.accessibilityData;const[n,r]=i.pageDimensions,[a,o,h,l]=i.getRectInCurrentCoords(t.rect,r);return i.x=a/n,i.y=o/r,i.width=h/n,i.height=l/r,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){if(this.#ee?.abort(),this.#ee=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#he&&(clearTimeout(this.#he),this.#he=null),this.#fe(),this.removeEditToolbar(),this.#de){for(const t of this.#de.values())clearTimeout(t);this.#de=null}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#be(),this.#Qt.classList.remove("hidden"),pt(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),this.#te={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const e=this.#Qt.children;if(!this.#Kt){this.#Kt=Array.from(e);const t=this.#Se.bind(this),s=this.#Ce.bind(this),i=this._uiManager._signal;for(const e of this.#Kt){const n=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t,{signal:i}),e.addEventListener("blur",s,{signal:i}),e.addEventListener("focus",this.#Re.bind(this,n),{signal:i}),e.setAttribute("data-l10n-id",wt._l10nResizer[n])}}const s=this.#Kt[0];let i=0;for(const r of e){if(r===s)break;i++}const n=(360-this.rotation+this.parentRotation)%360/90*(this.#Kt.length/4);if(n!==i){if(n<i)for(let e=0;e<i-n;e++)this.#Qt.append(this.#Qt.firstChild);else if(n>i)for(let e=0;e<n-i;e++)this.#Qt.firstChild.before(this.#Qt.lastChild);let t=0;for(const s of e){const e=this.#Kt[t++].getAttribute("data-resizer-name");s.setAttribute("data-l10n-id",wt._l10nResizer[e])}}this.#Te(0),this.#oe=!0,this.#Qt.firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#Se(t){wt._resizerKeyboardManager.exec(this,t)}#Ce(t){this.#oe&&t.relatedTarget?.parentNode!==this.#Qt&&this.#fe()}#Re(t){this.#se=this.#oe?t:""}#Te(t){if(this.#Kt)for(const e of this.#Kt)e.tabIndex=t}_resizeWithKeyboard(t,e){this.#oe&&this.#Ae(this.#se,{movementX:t,movementY:e})}#fe(){if(this.#oe=!1,this.#Te(-1),this.#te){const{savedX:t,savedY:e,savedWidth:s,savedHeight:i}=this.#te;this.#we(t,e,s,i),this.#te=null}}_stopResizingWithKeyboard(){this.#fe(),this.div.focus()}select(){this.makeResizable(),this.div?.classList.add("selectedEditor"),this._editToolbar?(this._editToolbar?.show(),this.#o?.toggleAltTextBadge(!1)):this.addEditToolbar().then((()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()}))}unselect(){this.#Qt?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#o?.toggleAltTextBadge(!0)}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#re}set isEditing(t){this.#re=t,this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){this.#Zt=!0;const s=t/e,{style:i}=this.div;i.aspectRatio=s,i.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){this.#de||=new Map;const{action:e}=t;let s=this.#de.get(e);s&&clearTimeout(s),s=setTimeout((()=>{this._reportTelemetry(t),this.#de.delete(e),0===this.#de.size&&(this.#de=null)}),wt._telemetryTimeout),this.#de.set(e,s)}else t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}
2show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),this.#Jt=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#Jt=!0}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){const t=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.before(e)}}else e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){const{firstChild:e}=t.container;"DIV"===e?.nodeName&&e.classList.contains("annotationContent")&&e.remove()}}class _t extends wt{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const xt=3285377520,Et=4294901760,St=65535;class Ct{constructor(t){this.h1=t?4294967295&t:xt,this.h2=t?4294967295&t:xt}update(t){let e,s;if("string"==typeof t){e=new Uint8Array(2*t.length),s=0;for(let i=0,n=t.length;i<n;i++){const n=t.charCodeAt(i);n<=255?e[s++]=n:(e[s++]=n>>>8,e[s++]=255&n)}}else{if(!ArrayBuffer.isView(t))throw new Error("Invalid data format, must be a string or TypedArray.");e=t.slice(),s=e.byteLength}const i=s>>2,n=s-4*i,r=new Uint32Array(e.buffer,0,i);let a=0,o=0,h=this.h1,l=this.h2;const c=3432918353,d=461845907,u=11601,p=13715;for(let f=0;f<i;f++)1&f?(a=r[f],a=a*c&Et|a*u&St,a=a<<15|a>>>17,a=a*d&Et|a*p&St,h^=a,h=h<<13|h>>>19,h=5*h+3864292196):(o=r[f],o=o*c&Et|o*u&St,o=o<<15|o>>>17,o=o*d&Et|o*p&St,l^=o,l=l<<13|l>>>19,l=5*l+3864292196);switch(a=0,n){case 3:a^=e[4*i+2]<<16;case 2:a^=e[4*i+1]<<8;case 1:a^=e[4*i],a=a*c&Et|a*u&St,a=a<<15|a>>>17,a=a*d&Et|a*p&St,1&i?h^=a:l^=a}this.h1=h,this.h2=l}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=3981806797*t&Et|36045*t&St,e=4283543511*e&Et|(2950163797*(e<<16|t>>>16)&Et)>>>16,t^=e>>>1,t=444984403*t&Et|60499*t&St,e=3301882366*e&Et|(3120437893*(e<<16|t>>>16)&Et)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Rt=Object.freeze({map:null,hash:"",transfer:void 0});class Tt{#ke=!1;#Me=null;#Pe=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const s=this.#Pe.get(t);return void 0===s?e:Object.assign(e,s)}getRawValue(t){return this.#Pe.get(t)}remove(t){if(this.#Pe.delete(t),0===this.#Pe.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(const t of this.#Pe.values())if(t instanceof wt)return;this.onAnnotationEditor(null)}}setValue(t,e){const s=this.#Pe.get(t);let i=!1;if(void 0!==s)for(const[n,r]of Object.entries(e))s[n]!==r&&(i=!0,s[n]=r);else i=!0,this.#Pe.set(t,e);i&&this.#Ie(),e instanceof wt&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type)}has(t){return this.#Pe.has(t)}getAll(){return this.#Pe.size>0?N(this.#Pe):null}setAll(t){for(const[e,s]of Object.entries(t))this.setValue(e,s)}get size(){return this.#Pe.size}#Ie(){this.#ke||(this.#ke=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#ke&&(this.#ke=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new kt(this)}get serializable(){if(0===this.#Pe.size)return Rt;const t=new Map,e=new Ct,s=[],i=Object.create(null);let n=!1;for(const[r,a]of this.#Pe){const s=a instanceof wt?a.serialize(!1,i):a;s&&(t.set(r,s),e.update(`${r}:${JSON.stringify(s)}`),n||=!!s.bitmap)}if(n)for(const r of t.values())r.bitmap&&s.push(r.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:s}:Rt}get editorStats(){let t=null;const e=new Map;for(const s of this.#Pe.values()){if(!(s instanceof wt))continue;const i=s.telemetryFinalData;if(!i)continue;const{type:n}=i;e.has(n)||e.set(n,Object.getPrototypeOf(s).constructor),t||=Object.create(null);const r=t[n]||=new Map;for(const[t,e]of Object.entries(i)){if("type"===t)continue;let s=r.get(t);s||(s=new Map,r.set(t,s));const i=s.get(e)??0;s.set(e,i+1)}}for(const[s,i]of e)t[s]=i.computeTelemetryFinalData(t[s]);return t}resetModifiedIds(){this.#Me=null}get modifiedIds(){if(this.#Me)return this.#Me;const t=[];for(const e of this.#Pe.values())e instanceof wt&&e.annotationElementId&&e.serialize()&&t.pu
2sh(e.annotationElementId);return this.#Me={ids:new Set(t),hash:t.join(",")}}}class kt extends Tt{#Le;constructor(t){super();const{map:e,hash:s,transfer:i}=t.serializable,n=structuredClone(e,i?{transfer:i}:null);this.#Le={map:n,hash:s,transfer:i}}get print(){x("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#Le}get modifiedIds(){return C(this,"modifiedIds",{ids:new Set,hash:""})}}class Mt{#De=new Set;constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),this.#De.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:e}){if(t&&!this.#De.has(t.loadedName))if(E(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:s,src:i,style:n}=t,r=new FontFace(s,i,n);this.addNativeFontFace(r);try{await r.load(),this.#De.add(s),e?.(t)}catch{_(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(r)}}else x("Not implemented: loadSystemFont without the Font Loading API.")}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo)return void await this.loadSystemFont(t);if(this.isFontLoadingAPISupported){const e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(o){throw _(`Failed to load font '${e.family}': '${o}'.`),t.disableFontFace=!0,o}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise((e=>{const s=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,s)}))}}get isFontLoadingAPISupported(){return C(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){let t=!1;return(o||"undefined"!=typeof navigator&&"string"==typeof navigator?.userAgent&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),C(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){const{loadingRequests:e}=this,s={done:!1,complete:function(){for(E(!s.done,"completeRequest() cannot be called twice."),s.done=!0;e.length>0&&e[0].done;){const t=e.shift();setTimeout(t.callback,0)}},callback:t};return e.push(s),s}get _loadTestFont(){return C(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){function s(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function i(t,e,s,i){return t.substring(0,e)+i+t.substring(e+s)}let n,r;const a=this._document.createElement("canvas");a.width=1,a.height=1;const o=a.getContext("2d");let h=0;const l=`lt${Date.now()}${this.loadTestFontId++}`;let c=this._loadTestFont;c=i(c,976,l.length,l);const d=1482184792;let u=s(c,16);for(n=0,r=l.length-3;n<r;n+=4)u=u-d+s(l,n)|0;n<l.length&&(u=u-d+s(l+"XXX",n)|0),c=i(c,16,4,function(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,255&t)}(u));const p=`@font-face {font-family:"${l}";src:url(data:font/opentype;base64,${btoa(c)});}`;this.insertRule(p);const f=this._document.createElement("div");f.style.visibility="hidden",f.style.width=f.style.height="10px",f.style.position="absolute",f.style.top=f.style.left="0px";for(const g of[t.loadedName,l]){const t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=g,f.append(t)}this._document.body.append(f),function t(e,s){if(++h>30)return _("Load test font never loaded."),void s();o.font="30px "+e,o.fillText(".",0,20),o.getImageData(0,0,1,1).data[3]>0?s():setTimeout(t.bind(null,e,s))}(l,(()=>{f.remove(),e.complete()}
2))}}class Pt{constructor(t,{disableFontFace:e=!1,inspectFont:s=null}){this.compiledGlyphs=Object.create(null);for(const i in t)this[i]=t[i];this.disableFontFace=!0===e,this._inspectFont=s}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(this.cssFontInfo){const e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}else t=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const t=`url(data:${this.mimetype};base64,${function(t){return Uint8Array.prototype.toBase64?t.toBase64():btoa(F(t))}(this.data)});`;let e;if(this.cssFontInfo){let s=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(s+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${s}src:${t}}`}else e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;return this._inspectFont?.(this,t),e}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];let s;try{s=t.get(this.loadedName+"_path_"+e)}catch(t){_(`getPathGenerator - ignoring character: "${t}".`)}if(!Array.isArray(s)||0===s.length)return this.compiledGlyphs[e]=function(t,e){};const i=[];for(let n=0,r=s.length;n<r;)switch(s[n++]){case 0:{const[t,e,r,a,o,h]=s.slice(n,n+6);i.push((s=>s.bezierCurveTo(t,e,r,a,o,h))),n+=6}break;case 1:{const[t,e]=s.slice(n,n+2);i.push((s=>s.moveTo(t,e))),n+=2}break;case 2:{const[t,e]=s.slice(n,n+2);i.push((s=>s.lineTo(t,e))),n+=2}break;case 3:{const[t,e,r,a]=s.slice(n,n+4);i.push((s=>s.quadraticCurveTo(t,e,r,a))),n+=4}break;case 4:i.push((t=>t.restore()));break;case 5:i.push((t=>t.save()));break;case 6:E(2===i.length,"Scale command is only valid at the third position.");break;case 7:{const[t,e,r,a,o,h]=s.slice(n,n+6);i.push((s=>s.transform(t,e,r,a,o,h))),n+=6}break;case 8:{const[t,e]=s.slice(n,n+2);i.push((s=>s.translate(t,e))),n+=2}}return this.compiledGlyphs[e]=function(t,e){i[0](t),i[1](t),t.scale(e,-e);for(let s=2,n=i.length;s<n;s++)i[s](t)}}}class It{#Fe=!1;constructor({enableHWA:t=!1}){this.#Fe=t}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const s=this._createCanvas(t,e);return{canvas:s,context:s.getContext("2d",{willReadFrequently:!this.#Fe})}}reset(t,e,s){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||s<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=s}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){x("Abstract method `_createCanvas` called.")}}class Lt{constructor({baseUrl:t=null,isCompressed:e=!0}){this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){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 e=this.baseUrl+t+(this.isCompressed?".bcmap":"");return this._fetch(e).then((t=>({cMapData:t,isCompressed:this.isCompressed}))).catch((t=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)}))}async _fetch(t){x("Abstract method `_fetch` called.")}}class Dt extends Lt{async _fetch(t){const e=await q(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):O(e)}}r(4520);class Ft{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,s,i,n){return"none"}destroy(t=!1){}}class Ot{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){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 e=`${this.baseUrl}${t}`;return this._fetch(e).catch((t=>{throw new Error(`Unable to load font data at: ${e}`)}))}async _fetch(t){x("Abstract method `_fetch` called.")}}class Nt extends Ot{async _fetch(t){const e=await q(t,"arraybuffer");return new Uint8Array(e)}}if(o){var jt=Promise.withResolvers(),Bt=null;(async()=>{const t=await s.e(2767).then(s.t.bind(s,32767,19)),e=await s.e(8251).then(s.t.bind(s,28251,19)),i=await s.e(7677).then(s.t.bind(s,57677,19)),n=await s.e(1543).then(s.t.bind(s,1543,19));let r,a;try{r=await s.e(4601).then(s.t.bind(s,14601,19))}catch{}try{a=await s.e(8529).then(s.bind(s,48529))}catch{}return new Map(Object.entries({fs:t,http:e,https:i,url:n,canvas:r,path2d:a}))})().then((t=>{if(Bt=t,jt.resolve(),!globalThis.DOMMatrix){const e=t.get("canvas")?.DOMMatrix;e?globalThis.DOMMatrix=e:_("Cannot polyfill `DOMMatrix`, rendering may be broken.")}if(!globalThis.Path2D){const e=t.get("canvas")?.CanvasRenderingContext2D,s=t.get("path2d")?.applyPath2DToCanvasRenderingContext,i=t.get("path2d")?.Path2D;if(e&&s&&i){try{s(e)}catch(t){_(`applyPath2DToCanvasRenderingContext: "${t}".`)}globalThis.Path2D=i}else _("Cannot polyfill `Path2D`, rendering may be broken.")}}),(t=>{_(`loadPackages: ${t}`),Bt=new Map,jt.resolve()}))}class Ht{static get promise(){return jt.promise}static get(t){return Bt?.get(t)}}async function $t(t){const e=Ht.get("fs"),s=await e.promises.readFile(t);return new Uint8Array(s)}const zt="Fill",Ut="Stroke",Gt="Shading";function Vt(t,e){if(!e)return;const s=e[2]-e[0],i=e[3]-e[1],n=new Path2D;n.rect(e[0],e[1],s,i),t.clip(n)}class Wt{getPattern(){x("Abstract method `getPattern` called.")}}class qt extends Wt{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;"axial"===this._type?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const s of this._colorStops)e.addColorStop(s[0],s[1]);return e}getPattern(t,e,s,i){let n;if(i===Ut||i===zt){const r=e.current.getClippedPathBoundingBox(i,ot(t))||[0,0,0,0],a=Math.ceil(r[2]-r[0])||1,o=Math.ceil(r[3]-r[1])||1,h=e.cachedCanvases.getCanvas("pattern",a,o),l=h.context;l.clearRect(0,0,l.canvas.width,l.canvas.height),l.beginPath(),l.rect(0,0,l.canvas.width,l.canvas.height),l.translate(-r[0],-r[1]),s=H.transform(s,[1,0,0,1,r[0],r[1]]),l.transform(...e.baseTransform),this.matrix&&l.transform(...this.matrix
2),Vt(l,this._bbox),l.fillStyle=this._createGradient(l),l.fill(),n=t.createPattern(h.canvas,"no-repeat");const c=new DOMMatrix(s);n.setTransform(c)}else Vt(t,this._bbox),n=this._createGradient(t);return n}}function Xt(t,e,s,i,n,r,a,o){const h=e.coords,l=e.colors,c=t.data,d=4*t.width;let u;h[s+1]>h[i+1]&&(u=s,s=i,i=u,u=r,r=a,a=u),h[i+1]>h[n+1]&&(u=i,i=n,n=u,u=a,a=o,o=u),h[s+1]>h[i+1]&&(u=s,s=i,i=u,u=r,r=a,a=u);const p=(h[s]+e.offsetX)*e.scaleX,f=(h[s+1]+e.offsetY)*e.scaleY,g=(h[i]+e.offsetX)*e.scaleX,m=(h[i+1]+e.offsetY)*e.scaleY,v=(h[n]+e.offsetX)*e.scaleX,b=(h[n+1]+e.offsetY)*e.scaleY;if(f>=b)return;const y=l[r],A=l[r+1],w=l[r+2],_=l[a],x=l[a+1],E=l[a+2],S=l[o],C=l[o+1],R=l[o+2],T=Math.round(f),k=Math.round(b);let M,P,I,L,D,F,O,N;for(let j=T;j<=k;j++){if(j<m){const t=j<f?0:(f-j)/(f-m);M=p-(p-g)*t,P=y-(y-_)*t,I=A-(A-x)*t,L=w-(w-E)*t}else{let t;t=j>b?1:m===b?0:(m-j)/(m-b),M=g-(g-v)*t,P=_-(_-S)*t,I=x-(x-C)*t,L=E-(E-R)*t}let t;t=j<f?0:j>b?1:(f-j)/(f-b),D=p-(p-v)*t,F=y-(y-S)*t,O=A-(A-C)*t,N=w-(w-R)*t;const e=Math.round(Math.min(M,D)),s=Math.round(Math.max(M,D));let i=d*j+4*e;for(let n=e;n<=s;n++)t=(M-n)/(M-D),t<0?t=0:t>1&&(t=1),c[i++]=P-(P-F)*t|0,c[i++]=I-(I-O)*t|0,c[i++]=L-(L-N)*t|0,c[i++]=255}}function Yt(t,e,s){const i=e.coords,n=e.colors;let r,a;switch(e.type){case"lattice":const o=e.verticesPerRow,h=Math.floor(i.length/o)-1,l=o-1;for(r=0;r<h;r++){let e=r*o;for(let r=0;r<l;r++,e++)Xt(t,s,i[e],i[e+1],i[e+o],n[e],n[e+1],n[e+o]),Xt(t,s,i[e+o+1],i[e+1],i[e+o],n[e+o+1],n[e+1],n[e+o])}break;case"triangles":for(r=0,a=i.length;r<a;r+=3)Xt(t,s,i[r],i[r+1],i[r+2],n[r],n[r+1],n[r+2]);break;default:throw new Error("illegal figure")}}class Kt extends Wt{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,e,s){const i=Math.floor(this._bounds[0]),n=Math.floor(this._bounds[1]),r=Math.ceil(this._bounds[2])-i,a=Math.ceil(this._bounds[3])-n,o=Math.min(Math.ceil(Math.abs(r*t[0]*1.1)),3e3),h=Math.min(Math.ceil(Math.abs(a*t[1]*1.1)),3e3),l=r/o,c=a/h,d={coords:this._coords,colors:this._colors,offsetX:-i,offsetY:-n,scaleX:1/l,scaleY:1/c},u=o+4,p=h+4,f=s.getCanvas("mesh",u,p),g=f.context,m=g.createImageData(o,h);if(e){const t=m.data;for(let s=0,i=t.length;s<i;s+=4)t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=255}for(const v of this._figures)Yt(m,v,d);return g.putImageData(m,2,2),{canvas:f.canvas,offsetX:i-2*l,offsetY:n-2*c,scaleX:l,scaleY:c}}getPattern(t,e,s,i){let n;if(Vt(t,this._bbox),i===Gt)n=H.singularValueDecompose2dScale(ot(t));else if(n=H.singularValueDecompose2dScale(e.baseTransform),this.matrix){const t=H.singularValueDecompose2dScale(this.matrix);n=[n[0]*t[0],n[1]*t[1]]}const r=this._createMeshCanvas(n,i===Gt?null:this._background,e.cachedCanvases);return i!==Gt&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(r.offsetX,r.offsetY),t.scale(r.scaleX,r.scaleY),t.createPattern(r.canvas,"no-repeat")}}class Jt extends Wt{getPattern(){return"hotpink"}}class Zt{static MAX_PATTERN_SIZE=3e3;constructor(t,e,s,i,n){this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=e,this.ctx=s,this.canvasGraphicsFactory=i,this.baseTransform=n}createPatternCanvas(t){const{bbox:e,operatorList:s,paintType:i,tilingType:n,color:r,canvasGraphicsFactory:a}=this;let{xstep:o,ystep:h}=this;o=Math.abs(o),h=Math.abs(h),w("TilingType: "+n);const l=e[0],c=e[1],d=e[2],u=e[3],p=d-l,f=u-c,g=H.singularValueDecompose2dScale(this.matrix),m=H.singularValueDecompose2dScale(this.baseTransform),v=g[0]*m[0],b=g[1]*m[1];let y=p,A=f,_=!1,x=!1;const E=Math.ceil(o*v),S=Math.ceil(h*b);E>=Math.ceil(p*v)?y=o:_=!0,S>=Math.ceil(f*b)?A=h:x=!0;const C=this.getSizeAndScale(y,this.ctx.canvas.width,v),R=this.getSizeAndScale(A,this.ctx.canvas.height,b),T=t.cachedCanvases.getCanvas("pattern",C.size,R.size),k=T.context,M=a.createCanvasGraphics(k);if(M.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(M,i,r),k.translate(-C.scale*l,-R.scale*c),M.transform(C.scale,0,0,R.scale,0,0),k.save(),this.clipBbox(M,l,c,d,u),M.baseTransform=ot(M.ctx),M.executeOperatorList(s),M.endDrawing(),k.restore(
2),_||x){const e=T.canvas;_&&(y=o),x&&(A=h);const s=this.getSizeAndScale(y,this.ctx.canvas.width,v),i=this.getSizeAndScale(A,this.ctx.canvas.height,b),n=s.size,r=i.size,a=t.cachedCanvases.getCanvas("pattern-workaround",n,r),d=a.context,u=_?Math.floor(p/o):0,g=x?Math.floor(f/h):0;for(let t=0;t<=u;t++)for(let s=0;s<=g;s++)d.drawImage(e,n*t,r*s,n,r,0,0,n,r);return{canvas:a.canvas,scaleX:s.scale,scaleY:i.scale,offsetX:l,offsetY:c}}return{canvas:T.canvas,scaleX:C.scale,scaleY:R.scale,offsetX:l,offsetY:c}}getSizeAndScale(t,e,s){const i=Math.max(Zt.MAX_PATTERN_SIZE,e);let n=Math.ceil(t*s);return n>=i?n=i:s=n/t,{scale:s,size:n}}clipBbox(t,e,s,i,n){const r=i-e,a=n-s;t.ctx.rect(e,s,r,a),t.current.updateRectMinMax(ot(t.ctx),[e,s,i,n]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,s){const i=t.ctx,n=t.current;switch(e){case 1:const t=this.ctx;i.fillStyle=t.fillStyle,i.strokeStyle=t.strokeStyle,n.fillColor=t.fillStyle,n.strokeColor=t.strokeStyle;break;case 2:const r=H.makeHexColor(s[0],s[1],s[2]);i.fillStyle=r,i.strokeStyle=r,n.fillColor=r,n.strokeColor=r;break;default:throw new L(`Unsupported paint type: ${e}`)}}getPattern(t,e,s,i){let n=s;i!==Gt&&(n=H.transform(n,e.baseTransform),this.matrix&&(n=H.transform(n,this.matrix)));const r=this.createPatternCanvas(e);let a=new DOMMatrix(n);a=a.translate(r.offsetX,r.offsetY),a=a.scale(1/r.scaleX,1/r.scaleY);const o=t.createPattern(r.canvas,"repeat");return o.setTransform(a),o}}function Qt({src:t,srcPos:e=0,dest:s,width:i,height:n,nonBlackColor:r=4294967295,inverseDecode:a=!1}){const o=j.isLittleEndian?4278190080:255,[h,l]=a?[r,o]:[o,r],c=i>>3,d=7&i,u=t.length;s=new Uint32Array(s.buffer);let p=0;for(let f=0;f<n;f++){for(const n=e+c;e<n;e++){const i=e<u?t[e]:255;s[p++]=128&i?l:h,s[p++]=64&i?l:h,s[p++]=32&i?l:h,s[p++]=16&i?l:h,s[p++]=8&i?l:h,s[p++]=4&i?l:h,s[p++]=2&i?l:h,s[p++]=1&i?l:h}if(0===d)continue;const i=e<u?t[e++]:255;for(let t=0;t<d;t++)s[p++]=i&1<<7-t?l:h}return{srcPos:e,destPos:p}}const te=16;class ee{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,s){let i;return void 0!==this.cache[t]?(i=this.cache[t],this.canvasFactory.reset(i,e,s)):(i=this.canvasFactory.create(e,s),this.cache[t]=i),i}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function se(t,e,s,i,n,r,a,o,h,l){const[c,d,u,p,f,g]=ot(t);if(0===d&&0===u){const m=a*c+f,v=Math.round(m),b=o*p+g,y=Math.round(b),A=(a+h)*c+f,w=Math.abs(Math.round(A)-v)||1,_=(o+l)*p+g,x=Math.abs(Math.round(_)-y)||1;return t.setTransform(Math.sign(c),0,0,Math.sign(p),v,y),t.drawImage(e,s,i,n,r,0,0,w,x),t.setTransform(c,d,u,p,f,g),[w,x]}if(0===c&&0===p){const m=o*u+f,v=Math.round(m),b=a*d+g,y=Math.round(b),A=(o+l)*u+f,w=Math.abs(Math.round(A)-v)||1,_=(a+h)*d+g,x=Math.abs(Math.round(_)-y)||1;return t.setTransform(0,Math.sign(d),Math.sign(u),0,v,y),t.drawImage(e,s,i,n,r,0,0,x,w),t.setTransform(c,d,u,p,f,g),[x,w]}return t.drawImage(e,s,i,n,r,a,o,h,l),[Math.hypot(c,d)*h,Math.hypot(u,p)*l]}class ie{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=h,this.textMatrixScale=1,this.fontMatrix=l,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=0,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,e])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,e){this.x=t,this.y=e}updatePathMinMax(t,e,s){[e,s]=H.applyTransform([e,s],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,s),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,s)}updateRectMinMax(t,e){const s=H.applyTransform(e,t),i=H.applyTransform(e.slice(2),t),n=H.applyTransform([e[0],e[3]],t),r=H.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,s[0],i[0],n[0],r[0]),this.minY=Math.min(this.minY,s[1],i[1],n[1],r[1]),this.maxX=Math.max(this.maxX,s[0],i[0],n[0],r[0]),this.maxY=Math.max(this.maxY,s[1],i[1],n[1],r[1])}updateScalingPathMinMax(t,e){H.scaleMinMax(t,e),this.minX=Math.min(this.minX,e[0]),this.minY=Math.min(this.minY,e[1]),this.maxX=Math.max(this.maxX,e[2]),this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,s,i,n,r,a,o,h,l){const c=H.bezierBoundingBox(e,s,i,n,r,a,o,h,l);l||this.updateRectMinMax(t,c)}getPathBoundingBox(t=zt,e=null){const s=[this.minX,this.minY,this.maxX,this.maxY];if(t===Ut){e||x("Stroke bounding box must include transform.");const t=H.singularValueDecompose2dScale(e),i=t[0]*this.lineWidth/2,n=t[1]*this.lineWidth/2;s[0]-=i,s[1]-=n,s[2]+=i,s[3]+=n}return s}updateClipFromPath(){const t=H.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(t=zt,e=null){return H.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function ne(t,e){if("undefined"!=typeof ImageData&&e instanceof ImageData)return void t.putImageData(e,0,0);const s=e.height,i=e.width,n=s%te,r=(s-n)/te,a=0===n?r:r+1,o=t.createImageData(i,te);let h,l=0;const c=e.data,d=o.data;let u,p,f,m;if(e.kind===g.GRAYSCALE_1BPP){const e=c.byteLength,s=new Uint32Array(d.buffer,0,d.byteLength>>2),g=s.length,m=i+7>>3,v=4294967295,b=j.isLittleEndian?4278190080:255;for(u=0;
2u<a;u++){for(f=u<r?te:n,h=0,p=0;p<f;p++){const t=e-l;let n=0;const r=t>m?i:8*t-7,a=-8&r;let o=0,d=0;for(;n<a;n+=8)d=c[l++],s[h++]=128&d?v:b,s[h++]=64&d?v:b,s[h++]=32&d?v:b,s[h++]=16&d?v:b,s[h++]=8&d?v:b,s[h++]=4&d?v:b,s[h++]=2&d?v:b,s[h++]=1&d?v:b;for(;n<r;n++)0===o&&(d=c[l++],o=128),s[h++]=d&o?v:b,o>>=1}for(;h<g;)s[h++]=0;t.putImageData(o,0,u*te)}}else if(e.kind===g.RGBA_32BPP){for(p=0,m=i*te*4,u=0;u<r;u++)d.set(c.subarray(l,l+m)),l+=m,t.putImageData(o,0,p),p+=te;u<a&&(m=i*n*4,d.set(c.subarray(l,l+m)),t.putImageData(o,0,p))}else{if(e.kind!==g.RGB_24BPP)throw new Error(`bad image kind: ${e.kind}`);for(f=te,m=i*f,u=0;u<a;u++){for(u>=r&&(f=n,m=i*f),h=0,p=m;p--;)d[h++]=c[l++],d[h++]=c[l++],d[h++]=c[l++],d[h++]=255;t.putImageData(o,0,u*te)}}}function re(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);const s=e.height,i=e.width,n=s%te,r=(s-n)/te,a=0===n?r:r+1,o=t.createImageData(i,te);let h=0;const l=e.data,c=o.data;for(let d=0;d<a;d++){const e=d<r?te:n;({srcPos:h}=Qt({src:l,srcPos:h,dest:c,width:i,height:e,nonBlackColor:0})),t.putImageData(o,0,d*te)}}function ae(t,e){const s=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const i of s)void 0!==t[i]&&(e[i]=t[i]);void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function oe(t){if(t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",void 0!==t.setLineDash&&(t.setLineDash([]),t.lineDashOffset=0),!o){const{filter:e}=t;"none"!==e&&""!==e&&(t.filter="none")}}function he(t,e){if(e)return!0;const s=H.singularValueDecompose2dScale(t);s[0]=Math.fround(s[0]),s[1]=Math.fround(s[1]);const i=Math.fround((globalThis.devicePixelRatio||1)*W.PDF_TO_CSS_UNITS);return s[0]<=i&&s[1]<=i}const le=["butt","round","square"],ce=["miter","round","bevel"],de={},ue={};class pe{constructor(t,e,s,i,n,{optionalContentConfig:r,markedContentStack:a=null},o,h){this.ctx=t,this.current=new ie(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=s,this.canvasFactory=i,this.filterFactory=n,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=a||[],this.optionalContentConfig=r,this.cachedCanvases=new ee(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=o,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=h,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,e=null){return"string"==typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing({transform:t,viewport:e,transparency:s=!1,background:i=null}){const n=this.ctx.canvas.width,r=this.ctx.canvas.height,a=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,n,r),this.ctx.fillStyle=a,s){const t=this.cachedCanvases.getCanvas("transparent",n,r);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...ot(this.compositeCtx))}this.ctx.save(),oe(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=ot(this.ctx)}executeOperatorList(t,e,s,i){const n=t.argsArray,r=t.fnArray;let a=e||0;const o=n.length;if(o===a)return a;const h=o-a>10&&"function"==typeof s,l=h?Date.now()+15:0;let c=0;const d=this.commonObjs,u=this.objs;let p;for(;;){if(void 0!==i&&a===i.nextBreakPoint)return i.breakIt(a,s),a;if(p=r[a],p!==v.dependency)this[p].apply(this,n[a]);else for(const t of n[a]){const e=t.startsWith("g_")?d:u;if(!e.has(t))return e.get(t,s),a}if(a++,a===o)return a;if(h&&++c>10){if(Date.now()>l)return s(),a;c=0}}}#Oe(){for(;this.stateStack.length||this.inSMaskMode;
2)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){this.#Oe(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.#Ne()}#Ne(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}_scaleImage(t,e){const s=t.width??t.displayWidth,i=t.height??t.displayHeight;let n,r,a=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),h=s,l=i,c="prescale1";for(;a>2&&h>1||o>2&&l>1;){let e=h,s=l;a>2&&h>1&&(e=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h/2),a/=h/e),o>2&&l>1&&(s=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,o/=l/s),n=this.cachedCanvases.getCanvas(c,e,s),r=n.context,r.clearRect(0,0,e,s),r.drawImage(t,0,0,h,l,0,0,e,s),t=n.canvas,h=e,l=s,c="prescale1"===c?"prescale2":"prescale1"}return{img:t,paintWidth:h,paintHeight:l}}_createMaskCanvas(t){const e=this.ctx,{width:s,height:i}=t,n=this.current.fillColor,r=this.current.patternFill,a=ot(e);let o,h,l,c;if((t.bitmap||t.data)&&t.count>1){const e=t.bitmap||t.data.buffer;h=JSON.stringify(r?a:[a.slice(0,4),n]),o=this._cachedBitmapsMap.get(e),o||(o=new Map,this._cachedBitmapsMap.set(e,o));const s=o.get(h);if(s&&!r)return{canvas:s,offsetX:Math.round(Math.min(a[0],a[2])+a[4]),offsetY:Math.round(Math.min(a[1],a[3])+a[5])};l=s}l||(c=this.cachedCanvases.getCanvas("maskCanvas",s,i),re(c.context,t));let d=H.transform(a,[1/s,0,0,-1/i,0,0]);d=H.transform(d,[1,0,0,1,0,-i]);const[u,p,f,g]=H.getAxialAlignedBoundingBox([0,0,s,i],d),m=Math.round(f-u)||1,v=Math.round(g-p)||1,b=this.cachedCanvases.getCanvas("fillCanvas",m,v),y=b.context,A=u,w=p;y.translate(-A,-w),y.transform(...d),l||(l=this._scaleImage(c.canvas,ht(y)),l=l.img,o&&r&&o.set(h,l)),y.imageSmoothingEnabled=he(ot(y),t.interpolate),se(y,l,0,0,l.width,l.height,0,0,s,i),y.globalCompositeOperation="source-in";const _=H.transform(ht(y),[1,0,0,1,-A,-w]);return y.fillStyle=r?n.getPattern(e,this,_,zt):n,y.fillRect(0,0,s,i),o&&!r&&(this.cachedCanvases.delete("fillCanvas"),o.set(h,b.canvas)),{canvas:b.canvas,offsetX:Math.round(A),offsetY:Math.round(w)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=le[t]}setLineJoin(t){this.ctx.lineJoin=ce[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const s=this.ctx;void 0!==s.setLineDash&&(s.setLineDash(t),s.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,s]of t)switch(e){case"LW":this.setLineWidth(s);break;case"LC":this.setLineCap(s);break;case"LJ":this.setLineJoin(s);break;case"ML":this.setMiterLimit(s);break;case"D":this.setDash(s[0],s[1]);break;case"RI":this.setRenderingIntent(s);break;case"FL":this.setFlatness(s);break;case"Font":this.setFont(s[0],s[1]);break;case"CA":this.current.strokeAlpha=s;break;case"ca":this.current.fillAlpha=s,this.ctx.globalAlpha=s;break;case"BM":this.ctx.globalCompositeOperation=s;break;case"SMask":this.current.activeSMask=s?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(s)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,e=this.ctx.canvas.height,s="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(s,t,e);this.suspendedCtx=this.ctx,this.ctx=i.context;const n=this.ctx;n.setTransform(...ot(this.suspendedCtx)),ae(this.suspendedCtx,n),function(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()}
2,t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(t,s){e.translate(t,s),this.__originalTranslate(t,s)},t.scale=function(t,s){e.scale(t,s),this.__originalScale(t,s)},t.transform=function(t,s,i,n,r,a){e.transform(t,s,i,n,r,a),this.__originalTransform(t,s,i,n,r,a)},t.setTransform=function(t,s,i,n,r,a){e.setTransform(t,s,i,n,r,a),this.__originalSetTransform(t,s,i,n,r,a)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(t){e.rotate(t),this.__originalRotate(t)},t.clip=function(t){e.clip(t),this.__originalClip(t)},t.moveTo=function(t,s){e.moveTo(t,s),this.__originalMoveTo(t,s)},t.lineTo=function(t,s){e.lineTo(t,s),this.__originalLineTo(t,s)},t.bezierCurveTo=function(t,s,i,n,r,a){e.bezierCurveTo(t,s,i,n,r,a),this.__originalBezierCurveTo(t,s,i,n,r,a)},t.rect=function(t,s,i,n){e.rect(t,s,i,n),this.__originalRect(t,s,i,n)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}(n,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),ae(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,s=this.suspendedCtx;this.composeSMask(s,e,this.ctx,t),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(t,e,s,i){const n=i[0],r=i[1],a=i[2]-n,o=i[3]-r;0!==a&&0!==o&&(this.genericComposeSMask(e.context,s,a,o,e.subtype,e.backdrop,e.transferMap,n,r,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(s.canvas,0,0),t.restore())}genericComposeSMask(t,e,s,i,n,r,a,o,h,l,c){let d=t.canvas,u=o-l,p=h-c;if(r){const e=H.makeHexColor(...r);if(u<0||p<0||u+s>d.width||p+i>d.height){const t=this.cachedCanvases.getCanvas("maskExtension",s,i),n=t.context;n.drawImage(d,-u,-p),n.globalCompositeOperation="destination-atop",n.fillStyle=e,n.fillRect(0,0,s,i),n.globalCompositeOperation="source-over",d=t.canvas,u=p=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const n=new Path2D;n.rect(u,p,s,i),t.clip(n),t.globalCompositeOperation="destination-atop",t.fillStyle=e,t.fillRect(u,p,s,i),t.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),"Alpha"===n&&a?e.filter=this.filterFactory.addAlphaFilter(a):"Luminosity"===n&&(e.filter=this.filterFactory.addLuminosityFilter(a));const f=new Path2D;f.rect(o,h,s,i),e.clip(f),e.globalCompositeOperation="destination-in",e.drawImage(d,u,p,s,i,o,h,s,i),e.restore()}save(){this.inSMaskMode?(ae(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),ae(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,s,i,n,r){this.ctx.transform(t,e,s,i,n,r),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,s){const i=this.ctx,n=this.current;let r,a,o=n.x,h=n.y;const l=ot(i),c=0===l[0]&&0===l[3]||0===l[1]&&0===l[2],d=c?s.slice(0):null;for(let u=0,p=0,f=t.length;u<f;u++)switch(0|t[u]){case v.rectangle:o=e[p++],h=e[p++];const t=e[p++],s=e[p++],u=o+t,f=h+s;i.moveTo(o,h),0===t||0===s?i.lineTo(u,f):(i.lineTo(u,h),i.lineTo(u,f),i.lineTo(o,f)),c||n.updateRectMinMax(l,[o,h,u,f]),i.closePath();break;case v.moveTo:o=e[p++],h=e[p++],i.moveTo(o,h),c||n.updatePathMinMax(l,o,h);break;case v.lineTo:o=e[p++],h=e[p++],i.lineTo(o,h),c||n.updatePathMinMax(l,o,h);break;case v.curveTo:r=o,a=h,o=e[p+4],h=e[p+5],i.bezierCurveTo(e[p],e[p+1],e[p+2],e[p+3],o,h),n.updateCurvePathMinMax(l,r,a,e[p],e[p+1],e[p+2],e[p+3],o,h,d),p+=6;break;case v.curveTo2:r=o,a=h,i.bezierCurveTo(o,h,e[p],e[p+1],e[p+2],e[p+3]),n.updateCurvePathMinMax(l,r,a,o,h,e[p],e[p+1],e[p+2],e[p+3],d),o=e[p+2],h=e[p+3],p+=4;break;case v.curveTo3:r=o,a=h,o=e[p+2],h=e[p+3],i.bezierCurveTo(e[p],e[p+1],o,h,o,h),n.updateCurvePathMinMax(l,r,a,e[p],e[p+1],o,h,o,h,d),p+=4;break;case v.closePath:i.closePath()}c&&n.updateScalingPathMinMax(l,d),n.setCurrentPoint(o,h)}closePath(){this.ctx.closePath()}stroke(t=!0){const e=this.ctx,s=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof s&&s?.getPattern?(e.save(),e.strokeStyle=s.getPattern(e,this,ht(e),Ut),this.rescaleAndStroke(!1),e.restore(
2)):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t=!0){const e=this.ctx,s=this.current.fillColor;let i=!1;this.current.patternFill&&(e.save(),e.fillStyle=s.getPattern(e,this,ht(e),zt),i=!0);const n=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==n&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),i&&e.restore(),t&&this.consumePath(n)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=de}eoClip(){this.pendingClip=ue}beginText(){this.current.textMatrix=h,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,e=this.ctx;if(void 0!==t){e.save(),e.beginPath();for(const s of t)e.setTransform(...s.transform),e.translate(s.x,s.y),s.addToPath(e,s.fontSize);e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths}else e.beginPath()}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){const s=this.commonObjs.get(t),i=this.current;if(!s)throw new Error(`Can't find font for ${t}`);if(i.fontMatrix=s.fontMatrix||l,0!==i.fontMatrix[0]&&0!==i.fontMatrix[3]||_("Invalid font matrix for font "+t),e<0?(e=-e,i.fontDirection=-1):i.fontDirection=1,this.current.font=s,this.current.fontSize=e,s.isType3Font)return;const n=s.loadedName||"sans-serif",r=s.systemFontInfo?.css||`"${n}", ${s.fallbackName}`;let a="normal";s.black?a="900":s.bold&&(a="bold");const o=s.italic?"italic":"normal";let h=e;e<16?h=16:e>100&&(h=100),this.current.fontSizeScale=e/h,this.ctx.font=`${o} ${a} ${h}px ${r}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,s,i,n,r){this.current.textMatrix=[t,e,s,i,n,r],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,s,i){const n=this.ctx,r=this.current,a=r.font,o=r.textRenderingMode,h=r.fontSize/r.fontSizeScale,l=3&o,c=!!(4&o),d=r.patternFill&&!a.missingFile;let u;(a.disableFontFace||c||d)&&(u=a.getPathGenerator(this.commonObjs,t)),a.disableFontFace||d?(n.save(),n.translate(e,s),n.beginPath(),u(n,h),i&&n.setTransform(...i),0!==l&&2!==l||n.fill(),1!==l&&2!==l||n.stroke(),n.restore()):(0!==l&&2!==l||n.fillText(t,e,s),1!==l&&2!==l||n.strokeText(t,e,s)),c&&(this.pendingTextPaths||=[]).push({transform:ot(n),x:e,y:s,fontSize:h,addToPath:u})}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let s=!1;for(let i=3;i<e.length;i+=4)if(e[i]>0&&e[i]<255){s=!0;break}return C(this,"isFontSubpixelAAEnabled",s)}showText(t){const e=this.current,s=e.font;if(s.isType3Font)return this.showType3Text(t);const i=e.fontSize;if(0===i)return;const n=this.ctx,r=e.fontSizeScale,a=e.charSpacing,o=e.wordSpacing,h=e.fontDirection,l=e.textHScale*h,c=t.length,d=s.vertical,u=d?1:-1,p=s.defaultVMetrics,f=i*e.fontMatrix[0],g=0===e.textRenderingMode&&!s.disableFontFace&&!e.patternFill;let m;if(n.save(),n.transform(...e.textMatrix),n.translate(e.x,e.y+e.textRise),h>0?n.scale(l,-1):n.scale(l,1),e.patternFill){n.save();const t=e.fillColor.getPattern(n,this,ht(n),zt);m=ot(n),n.restore(),n.fillStyle=t}let v=e.lineWidth;const b=e.textMatrixScale;if(0===b||0===v){const t=3&e.textRenderingMode;1!==t&&2!==t||(v=this.getSinglePixelWidth())}else v/=b;if(1!==r&&(n.scale(r,r),v/=r),n.lineWidth=v,s.isInvalidPDFjsFont){const s=[];let i=0;for(const e of t)s.push(e.unicode),i+=e.width;
2return n.fillText(s.join(""),0,0),e.x+=i*f*l,n.restore(),void this.compose()}let y,A=0;for(y=0;y<c;++y){const e=t[y];if("number"==typeof e){A+=u*e*i/1e3;continue}let l=!1;const c=(e.isSpace?o:0)+a,v=e.fontChar,b=e.accent;let w,_,x=e.width;if(d){const t=e.vmetric||p,s=-(e.vmetric?t[1]:.5*x)*f,i=t[2]*f;x=t?-t[0]:x,w=s/r,_=(A+i)/r}else w=A/r,_=0;if(s.remeasure&&x>0){const t=1e3*n.measureText(v).width/i*r;if(x<t&&this.isFontSubpixelAAEnabled){const e=x/t;l=!0,n.save(),n.scale(e,1),w/=e}else x!==t&&(w+=(x-t)/2e3*i/r)}if(this.contentVisible&&(e.isInFont||s.missingFile))if(g&&!b)n.fillText(v,w,_);else if(this.paintChar(v,w,_,m),b){const t=w+i*b.offset.x/r,e=_-i*b.offset.y/r;this.paintChar(b.fontChar,t,e,m)}A+=d?x*f-c*h:x*f+c*h,l&&n.restore()}d?e.y-=A:e.x+=A*l,n.restore(),this.compose()}showType3Text(t){const e=this.ctx,s=this.current,i=s.font,n=s.fontSize,r=s.fontDirection,a=i.vertical?1:-1,o=s.charSpacing,h=s.wordSpacing,c=s.textHScale*r,d=s.fontMatrix||l,u=t.length;let p,f,g,m;if(3!==s.textRenderingMode&&0!==n){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...s.textMatrix),e.translate(s.x,s.y),e.scale(c,r),p=0;p<u;++p){if(f=t[p],"number"==typeof f){m=a*f*n/1e3,this.ctx.translate(m,0),s.x+=m*c;continue}const r=(f.isSpace?h:0)+o,l=i.charProcOperatorList[f.operatorListId];l?(this.contentVisible&&(this.processingType3=f,this.save(),e.scale(n,n),e.transform(...d),this.executeOperatorList(l),this.restore()),g=H.applyTransform([f.width,0],d)[0]*n+r,e.translate(g,0),s.x+=g*c):_(`Type3 character "${f.operatorListId}" is not available.`)}e.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,s,i,n,r){this.ctx.rect(s,i,n-s,r-i),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if("TilingPattern"===t[0]){const s=t[1],i=this.baseTransform||ot(this.ctx),n={createCanvasGraphics:t=>new pe(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new Zt(t,s,this.ctx,n,i)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,s){this.ctx.strokeStyle=this.current.strokeColor=H.makeHexColor(t,e,s)}
2setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(t,e,s){this.ctx.fillStyle=this.current.fillColor=H.makeHexColor(t,e,s),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e=null){let s;return this.cachedPatterns.has(t)?s=this.cachedPatterns.get(t):(s=function(t){switch(t[0]){case"RadialAxial":return new qt(t);case"Mesh":return new Kt(t);case"Dummy":return new Jt}throw new Error(`Unknown IR type: ${t[0]}`)}(this.getObject(t)),this.cachedPatterns.set(t,s)),e&&(s.matrix=e),s}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const s=this._getPattern(t);e.fillStyle=s.getPattern(e,this,ht(e),Gt);const i=ht(e);if(i){const{width:t,height:s}=e.canvas,[n,r,a,o]=H.getAxialAlignedBoundingBox([0,0,t,s],i);this.ctx.fillRect(n,r,a-n,o-r)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){x("Should not call beginInlineImage")}beginImageData(){x("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=ot(this.ctx),e)){const t=e[2]-e[0],s=e[3]-e[1];this.ctx.rect(e[0],e[1],t,s),this.current.updateRectMinMax(ot(this.ctx),e),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const e=this.ctx;t.isolated||w("TODO: Support non-isolated groups."),t.knockout&&_("Knockout groups not supported.");const s=ot(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let i=H.getAxialAlignedBoundingBox(t.bbox,ot(e));const n=[0,0,e.canvas.width,e.canvas.height];i=H.intersect(i,n)||[0,0,0,0];const r=Math.floor(i[0]),a=Math.floor(i[1]),o=Math.max(Math.ceil(i[2])-r,1),h=Math.max(Math.ceil(i[3])-a,1);this.current.startNewPathAndClipBox([0,0,o,h]);let l="groupAt"+this.groupLevel;t.smask&&(l+="_smask_"+this.smaskCounter++%2);const c=this.cachedCanvases.getCanvas(l,o,h),d=c.context;d.translate(-r,-a),d.transform(...s),t.smask?this.smaskStack.push({canvas:c.canvas,context:d,offsetX:r,offsetY:a,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(r,a),e.save()),ae(e,d),this.ctx=d,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const e=this.ctx,s=this.groupStack.pop();if(this.ctx=s,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const t=ot(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...t);const s=H.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],t);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(s)}}beginAnnotation(t,e,s,i,n){if(this.#Oe(),oe(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const i=e[2]-e[0],r=e[3]-e[1];if(n&&this.annotationCanvasMap){(s=s.slice())[4]-=e[0],s[5]-=e[1],(e=e.slice())[0]=e[1]=0,e[2]=i,e[3]=r;const[n,a]=H.singularValueDecompose2dScale(ot(this.ctx)),{viewportScale:o}=this,h=Math.ceil(i*this.outputScaleX*o),l=Math.ceil(r*this.outputScaleY*o);this.annotationCanvas=this.canvasFactory.create(h,l);const{canvas:c,context:d}=this.annotationCanvas;this.annotationCanvasMap.set(t,c),this.annotationCanvas.savedCtx=this.ctx,this.ctx=d,this.ctx.save(),this.ctx.setTransform(n,0,0,-a,0,r*a),oe(this.ctx)}else oe(this.ctx),this.endPath(),this.ctx.rect(e[0],e[1],i,r),this.ctx.clip(),this.ctx.beginPath()}this.current=new ie(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...s),this.transform(...i)}
2endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#Ne(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const e=t.count;(t=this.getObject(t.data,t)).count=e;const s=this.ctx,i=this.processingType3;if(i&&(void 0===i.compiled&&(i.compiled=function(t){const{width:e,height:s}=t;if(e>1e3||s>1e3)return null;const i=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),n=e+1;let r,a,o,h=new Uint8Array(n*(s+1));const l=e+7&-8;let c=new Uint8Array(l*s),d=0;for(const g of t.data){let t=128;for(;t>0;)c[d++]=g&t?0:255,t>>=1}let u=0;for(d=0,0!==c[d]&&(h[0]=1,++u),a=1;a<e;a++)c[d]!==c[d+1]&&(h[a]=c[d]?2:1,++u),d++;for(0!==c[d]&&(h[a]=2,++u),r=1;r<s;r++){d=r*l,o=r*n,c[d-l]!==c[d]&&(h[o]=c[d]?1:8,++u);let t=(c[d]?4:0)+(c[d-l]?8:0);for(a=1;a<e;a++)t=(t>>2)+(c[d+1]?4:0)+(c[d-l+1]?8:0),i[t]&&(h[o+a]=i[t],++u),d++;if(c[d-l]!==c[d]&&(h[o+a]=c[d]?2:4,++u),u>1e3)return null}for(d=l*(s-1),o=r*n,0!==c[d]&&(h[o]=8,++u),a=1;a<e;a++)c[d]!==c[d+1]&&(h[o+a]=c[d]?4:8,++u),d++;if(0!==c[d]&&(h[o+a]=4,++u),u>1e3)return null;const p=new Int32Array([0,n,-1,0,-n,0,0,0,1]),f=new Path2D;for(r=0;u&&r<=s;r++){let t=r*n;const s=t+e;for(;t<s&&!h[t];)t++;if(t===s)continue;f.moveTo(t%n,r);const i=t;let a=h[t];do{const e=p[a];do{t+=e}while(!h[t]);const s=h[t];5!==s&&10!==s?(a=s,h[t]=0):(a=s&51*a>>4,h[t]&=a>>2|a<<2),f.lineTo(t%n,t/n|0),h[t]||--u}while(i!==t);--r}return c=null,h=null,function(t){t.save(),t.scale(1/e,-1/s),t.translate(0,-s),t.fill(f),t.beginPath(),t.restore()}}(t)),i.compiled))return void i.compiled(s);const n=this._createMaskCanvas(t),r=n.canvas;s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(r,n.offsetX,n.offsetY),s.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,s=0,i=0,n,r){if(!this.contentVisible)return;t=this.getObject(t.data,t);const a=this.ctx;a.save();const o=ot(a);a.transform(e,s,i,n,0,0);const h=this._createMaskCanvas(t);a.setTransform(1,0,0,1,h.offsetX-o[4],h.offsetY-o[5]);for(let l=0,c=r.length;l<c;l+=2){const t=H.transform(o,[e,s,i,n,r[l],r[l+1]]),[c,d]=H.applyTransform([0,0],t);a.drawImage(h.canvas,c,d)}a.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,s=this.current.fillColor,i=this.current.patternFill;for(const n of t){const{data:t,width:r,height:a,transform:o}=n,h=this.cachedCanvases.getCanvas("maskCanvas",r,a),l=h.context;l.save(),re(l,this.getObject(t,n)),l.globalCompositeOperation="source-in",l.fillStyle=i?s.getPattern(l,this,ht(e),zt):s,l.fillRect(0,0,r,a),l.restore(),e.save(),e.transform(...o),e.scale(1,-1),se(e,h.canvas,0,0,r,a,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);e?this.paintInlineImageXObject(e):_("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,s,i){if(!this.contentVisible)return;const n=this.getObject(t);if(!n)return void _("Dependent image isn't ready yet");const r=n.width,a=n.height,o=[];for(let h=0,l=i.length;h<l;h+=2)o.push({transform:[e,0,0,s,i[h],i[h+1]],x:0,y:0,w:r,h:a});this.paintInlineImageXObjectGroup(n,o)}applyTransferMapsToCanvas(t){return"none"!==this.current.transferMaps&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if("none"===this.current.transferMaps)return t.bitmap;const{bitmap:e,width:s,height:i}=t,n=this.cachedCanvases.getCanvas("inlineImage",s,i),r=n.context;return r.filter=this.current.transferMaps,r.drawImage(e,0,0),r.filter="none",n.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,s=t.height,i=this.ctx;if(this.save(),!o){const{filter:t}=i;"none"!==t&&""!==t&&(i.filter="none")}let n;if(i.scale(1/e,-1/s),t.bitmap)n=this.applyTransferMapsToBitmap(t);else if("function"==typeof HTMLElement&&t instanceof HTMLElement||!t.data)n=t;else{const i=this.cachedCanvases.getCanvas("inlineImage",e,s).context;ne(i,t),n=this.applyTransferMapsToCanvas(i)}const r=this._scaleImage(n,ht(i));i.imageSmoothingEnabled=he(ot(i),t.interpolate),se(i,r.img,0,0,r.paintWidth,r.paintHeight,0,-s,e,s),this.compose(),this.restore(
2)}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const s=this.ctx;let i;if(t.bitmap)i=t.bitmap;else{const e=t.width,s=t.height,n=this.cachedCanvases.getCanvas("inlineImage",e,s).context;ne(n,t),i=this.applyTransferMapsToCanvas(n)}for(const n of e)s.save(),s.transform(...n.transform),s.scale(1,-1),se(s,i,n.x,n.y,n.w,n.h,0,-1,1,1),s.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){"OC"===t?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(e)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const s=this.ctx;this.pendingClip&&(e||(this.pendingClip===ue?s.clip("evenodd"):s.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),s.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=ot(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),s=Math.hypot(t[0],t[2]),i=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(s,i)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:t}=this.current,{a:e,b:s,c:i,d:n}=this.ctx.getTransform();let r,a;if(0===s&&0===i){const s=Math.abs(e),i=Math.abs(n);if(s===i)if(0===t)r=a=1/s;else{const e=s*t;r=a=e<1?1/e:1}else if(0===t)r=1/s,a=1/i;else{const e=s*t,n=i*t;r=e<1?1/e:1,a=n<1?1/n:1}}else{const o=Math.abs(e*n-s*i),h=Math.hypot(e,s),l=Math.hypot(i,n);if(0===t)r=l/o,a=h/o;else{const e=t*o;r=l>e?l/e:1,a=h>e?h/e:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=a}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:s}=this.current,[i,n]=this.getScaleForStroking();if(e.lineWidth=s||1,1===i&&1===n)return void e.stroke();const r=e.getLineDash();if(t&&e.save(),e.scale(i,n),r.length>0){const t=Math.max(i,n);e.setLineDash(r.map((e=>e/t))),e.lineDashOffset/=t}e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}for(const Ai in v)void 0!==pe.prototype[Ai]&&(pe.prototype[v[Ai]]=pe.prototype[Ai]);class fe{static#je=null;static#Be="";static get workerPort(){return this.#je}static set workerPort(t){if(!("undefined"!=typeof Worker&&t instanceof Worker)&&null!==t)throw new Error("Invalid `workerPort` type.");this.#je=t}static get workerSrc(){return this.#Be}static set workerSrc(t){if("string"!=typeof t)throw new Error("Invalid `workerSrc` type.");this.#Be=t}}function ge(t){switch(t instanceof Error||"object"==typeof t&&null!==t||x('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new D(t.message);case"MissingPDFException":return new P(t.message);case"PasswordException":return new T(t.message,t.code);case"UnexpectedResponseException":return new I(t.message,t.status);case"UnknownErrorException":return new k(t.message,t.details);default:return new k(t.message,t.toString())}}class me{#He=new AbortController;constructor(t,e,s){this.sourceName=t,this.targetName=e,this.comObj=s,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),s.addEventListener("message",this.#$e.bind(this),{signal:this.#He.signal})}#$e({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream)return void this.#ze(t);if(t.callback){const e=t.callbackId,s=this.callbackCapabilities[e];if(!s)throw new Error(`Cannot resolve callback ${e}`);if(delete this.callbackCapabilities[e],1===t.callback)s.resolve(t.data);else{if(2!==t.callback)throw new Error("Unexpected callback case");s.reject(ge(t.reason))}return}const e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const s=this.sourceName,i=t.sourceName,n=this.comObj;new Promise((function(s){s(e(t.data))})).then((function(e){n.postMessage({sourceName:s,targetName:i,callback:1,callbackId:t.callbackId,data:e})}),(function(e){n.postMessage({sourceName:s,targetName:i,callback:2,callbackId:t.callbackId,reason:ge(e)})}))}else t.streamId?this.#Ue(t):e(t.data)}on(t,e){const s=this.actionHandler;if(s[t])throw new Error(`There is already an actionName called "${t}"`);s[t]=e}send(t,e,s){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},s)}
2sendWithPromise(t,e,s){const i=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[i]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:i,data:e},s)}catch(t){n.reject(t)}return n.promise}sendWithStream(t,e,s,i){const n=this.streamId++,r=this.sourceName,a=this.targetName,o=this.comObj;return new ReadableStream({start:s=>{const h=Promise.withResolvers();return this.streamControllers[n]={controller:s,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},o.postMessage({sourceName:r,targetName:a,action:t,streamId:n,data:e,desiredSize:s.desiredSize},i),h.promise},pull:t=>{const e=Promise.withResolvers();return this.streamControllers[n].pullCall=e,o.postMessage({sourceName:r,targetName:a,stream:6,streamId:n,desiredSize:t.desiredSize}),e.promise},cancel:t=>{E(t instanceof Error,"cancel must have a valid reason");const e=Promise.withResolvers();return this.streamControllers[n].cancelCall=e,this.streamControllers[n].isClosed=!0,o.postMessage({sourceName:r,targetName:a,stream:1,streamId:n,reason:ge(t)}),e.promise}},s)}#Ue(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,r=this,a=this.actionHandler[t.action],o={enqueue(t,r=1,a){if(this.isCancelled)return;const o=this.desiredSize;this.desiredSize-=r,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:s,targetName:i,stream:4,streamId:e,chunk:t},a)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:3,streamId:e}),delete r.streamSinks[e])},error(t){E(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:5,streamId:e,reason:ge(t)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};o.sinkCapability.resolve(),o.ready=o.sinkCapability.promise,this.streamSinks[e]=o,new Promise((function(e){e(a(t.data,o))})).then((function(){n.postMessage({sourceName:s,targetName:i,stream:8,streamId:e,success:!0})}),(function(t){n.postMessage({sourceName:s,targetName:i,stream:8,streamId:e,reason:ge(t)})}))}#ze(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,r=this.streamControllers[e],a=this.streamSinks[e];switch(t.stream){case 8:t.success?r.startCall.resolve():r.startCall.reject(ge(t.reason));break;case 7:t.success?r.pullCall.resolve():r.pullCall.reject(ge(t.reason));break;case 6:if(!a){n.postMessage({sourceName:s,targetName:i,stream:7,streamId:e,success:!0});break}a.desiredSize<=0&&t.desiredSize>0&&a.sinkCapability.resolve(),a.desiredSize=t.desiredSize,new Promise((function(t){t(a.onPull?.())})).then((function(){n.postMessage({sourceName:s,targetName:i,stream:7,streamId:e,success:!0})}),(function(t){n.postMessage({sourceName:s,targetName:i,stream:7,streamId:e,reason:ge(t)})}));break;case 4:if(E(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(t.chunk);break;case 3:if(E(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),this.#Ge(r,e);break;case 5:E(r,"error should have stream controller"),r.controller.error(ge(t.reason)),this.#Ge(r,e);break;case 2:t.success?r.cancelCall.resolve():r.cancelCall.reject(ge(t.reason)),this.#Ge(r,e);break;case 1:if(!a)break;new Promise((function(e){e(a.onCancel?.(ge(t.reason)))})).then((function(){n.postMessage({sourceName:s,targetName:i,stream:2,streamId:e,success:!0})}),(function(t){n.postMessage({sourceName:s,targetName:i,stream:2,streamId:e,reason:ge(t)})})),a.sinkCapability.reject(ge(t.reason)),a.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async#Ge(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]}destroy(){this.#He?.abort(),this.#He=null}}class ve{#Ve;#We;constructor({parsedData:t,rawData:e}){this.#Ve=t,this.#We=e}getRaw(){return this.#We}get(t){return this.#Ve.get(t)??null}getAll(){return N(this.#Ve)}has(t){return this.#Ve.has(t)}}const be=Symbol("INTERNAL");class ye{#qe=!1;#Xe=!1;#Ye=!1;#Ke=!0;constructor(t,{name:e,intent:s,usage:i,rbGroups:n}){this.#qe=!!(2&t),this.#Xe=!!(4&t),this.name=e,this.intent=s,this.usage=i,this.rbGroups=n}get visible(){if(this.#Ye)return this.#Ke;if(!this.#Ke)return!1;const{print:t,view:e}=this.usage;return this.#qe?"OFF"!==e?.viewState:!this.#Xe||"OFF"!==t?.printState}_setVisible(t,e,s=!1){t!==be&&x("Internal method `_setVisible` called."),this.#Ye=s,this.#Ke=e}}class Ae{#Je=null;#Ze=new Map;#Qe=null;#ts=null;constructor(t,e=2){if(this.renderingIntent=e,this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,this.#ts=t.order;for(const s of t.groups)this.#Ze.set(s.id,new ye(e,s));if("OFF"===t.baseState)for(const t of this.#Ze.values())t._setVisible(be,!1);for(const e of t.on)this.#Ze.get(e)._setVisible(be,!0);for(const e of t.off)this.#Ze.get(e)._setVisible(be,!1);this.#Qe=this.getHash()}}#es(t){const e=t.length;if(e<2)return!0;const s=t[0];for(let i=1;i<e;i++){const e=t[i];let n;if(Array.isArray(e))n=this.#es(e);else{if(!this.#Ze.has(e))return _(`Optional content group not found: ${e}`),!0;n=this.#Ze.get(e).visible}switch(s){case"And":if(!n)return!1;break;case"Or":if(n)return!0;break;case"Not":return!n;default:return!0}}return"And"===s}isVisible(t){if(0===this.#Ze.size)return!0;
2if(!t)return w("Optional content group not defined."),!0;if("OCG"===t.type)return this.#Ze.has(t.id)?this.#Ze.get(t.id).visible:(_(`Optional content group not found: ${t.id}`),!0);if("OCMD"===t.type){if(t.expression)return this.#es(t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!this.#Ze.has(e))return _(`Optional content group not found: ${e}`),!0;if(this.#Ze.get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!this.#Ze.has(e))return _(`Optional content group not found: ${e}`),!0;if(!this.#Ze.get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!this.#Ze.has(e))return _(`Optional content group not found: ${e}`),!0;if(!this.#Ze.get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!this.#Ze.has(e))return _(`Optional content group not found: ${e}`),!0;if(this.#Ze.get(e).visible)return!1}return!0}return _(`Unknown optional content policy ${t.policy}.`),!0}return _(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,s=!0){const i=this.#Ze.get(t);if(i){if(s&&e&&i.rbGroups.length)for(const e of i.rbGroups)for(const s of e)s!==t&&this.#Ze.get(s)?._setVisible(be,!1,!0);i._setVisible(be,!!e,!0),this.#Je=null}else _(`Optional content group not found: ${t}`)}setOCGState({state:t,preserveRB:e}){let s;for(const i of t){switch(i){case"ON":case"OFF":case"Toggle":s=i;continue}const t=this.#Ze.get(i);if(t)switch(s){case"ON":this.setVisibility(i,!0,e);break;case"OFF":this.setVisibility(i,!1,e);break;case"Toggle":this.setVisibility(i,!t.visible,e)}}this.#Je=null}get hasInitialVisibility(){return null===this.#Qe||this.getHash()===this.#Qe}getOrder(){return this.#Ze.size?this.#ts?this.#ts.slice():[...this.#Ze.keys()]:null}getGroups(){return this.#Ze.size>0?N(this.#Ze):null}getGroup(t){return this.#Ze.get(t)||null}getHash(){if(null!==this.#Je)return this.#Je;const t=new Ct;for(const[e,s]of this.#Ze)t.update(`${e}:${s.visible}`);return this.#Je=t.hexdigest()}}class we{constructor(t,{disableRange:e=!1,disableStream:s=!1}){E(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:i,initialData:n,progressiveDone:r,contentDispositionFilename:a}=t;if(this._queuedChunks=[],this._progressiveDone=r,this._contentDispositionFilename=a,n?.length>0){const t=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!s,this._isRangeSupported=!e,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener(((t,e)=>{this._onReceiveData({begin:t,chunk:e})})),t.addProgressListener(((t,e)=>{this._onProgress({loaded:t,total:e})})),t.addProgressiveReadListener((t=>{this._onReceiveData({chunk:t})})),t.addProgressiveDoneListener((()=>{this._onProgressiveDone()})),t.transportReady()}_onReceiveData({begin:t,chunk:e}){const s=e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;void 0===t?this._fullRequestReader?this._fullRequestReader._enqueue(s):this._queuedChunks.push(s):E(this._rangeReaders.some((function(e){return e._begin===t&&(e._enqueue(s),!0)})),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(t){void 0===t.total?this._rangeReaders[0]?.onProgress?.({loaded:t.loaded}):this._fullRequestReader?.onProgress?.({loaded:t.loaded,total:t.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){E(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new _e(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new xe(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(s),s}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const e of this._rangeReaders.slice(0))e.cancel(t);this._pdfDataRangeTransport.abort()}}class _e{constructor(t,e,s=!1,i=null){this._stream=t,this._done=s||!1,this._filename=J(i)?i:null,this._queuedChunks=e||[],this._loaded=0;for(const n of this._queuedChunks)this._loaded+=n.byteLength;
2this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.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 t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){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 xe{constructor(t,e,s){this._stream=t,this._begin=e,this._end=s,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const t of this._requests)t.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 t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function Ee(t,e){const s=new Headers;if(!t||!e||"object"!=typeof e)return s;for(const i in e){const t=e[i];void 0!==t&&s.append(i,t)}return s}function Se({responseHeaders:t,isHttp:e,rangeChunkSize:s,disableRange:i}){const n={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(t.get("Content-Length"),10);return Number.isInteger(r)?(n.suggestedLength=r,r<=2*s||i||!e||"bytes"!==t.get("Accept-Ranges")||"identity"!==(t.get("Content-Encoding")||"identity")||(n.allowRangeRequests=!0),n):n}function Ce(t){const e=t.get("Content-Disposition");if(e){let t=function(t){let e=!0,s=i("filename\\*","i").exec(t);if(s){s=s[1];let t=a(s);return t=unescape(t),t=o(t),t=h(t),r(t)}if(s=function(t){const e=[];let s;const n=i("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(s=n.exec(t));){let[,t,i,n]=s;if(t=parseInt(t,10),t in e){if(0===t)break}else e[t]=[i,n]}const r=[];for(let i=0;i<e.length&&i in e;++i){let[t,s]=e[i];s=a(s),t&&(s=unescape(s),0===i&&(s=o(s))),r.push(s)}return r.join("")}(t),s)return r(h(s));if(s=i("filename","i").exec(t),s){s=s[1];let t=a(s);return t=h(t),r(t)}function i(t,e){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function n(t,s){if(t){if(!/^[\x00-\xFF]+$/.test(s))return s;try{const i=new TextDecoder(t,{fatal:!0}),n=O(s);s=i.decode(n),e=!1}catch{}}return s}function r(t){return e&&/[\x80-\xff]/.test(t)&&(t=n("utf-8",t),e&&(t=n("iso-8859-1",t))),t}function a(t){if(t.startsWith('"')){const e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){const s=e[t].indexOf('"');-1!==s&&(e[t]=e[t].slice(0,s),e.length=t+1),e[t]=e[t].replaceAll(/\\(.)/g,"$1")}t=e.join('"')}return t}function o(t){const e=t.indexOf("'");return-1===e?t:n(t.slice(0,e),t.slice(e+1).replace(/^[^']*'/,""))}function h(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(t,e,s,i){if("q"===s||"Q"===s)return n(e,i=(i=i.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,(function(t,e){return String.fromCharCode(parseInt(e,16))})));try{i=atob(i)}catch{}return n(e,i)}))}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(J(t))return t}return null}function Re(t,e){return 404===t||0===t&&e.startsWith("file:")?new P('Missing PDF "'+e+'".'):new I(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t)}function Te(t){return 200===t||206===t}function ke(t,e,s){return{method:"GET",headers:t,signal:s.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function Me(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(_(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class Pe{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=Ee(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return E(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Ie(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new Le(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}}class Ie{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange;const s=new Headers(t.headers),i=e.url;fetch(i,ke(s,this._withCredentials,this._abortController)).then((e=>{if(!Te(e.status))throw Re(e.status,i);this._reader=e.body.getReader(),this._headersCapability.resolve();const s=e.headers,{allowRangeRequests:n,suggestedLength:r}=Se({responseHeaders:s,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=n,this._contentLength=r||this._contentLength,this._filename=Ce(s),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new D("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:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:Me(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class Le{constructor(t,e,s){this._stream=t,this._reader=null,this._loaded=0;const i=t.source;this._withCredentials=i.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!i.disableStream,this._abortController=new AbortController;const n=new Headers(t.headers);n.append("Range",`bytes=${e}-${s-1}`);const r=i.url;fetch(r,ke(n,this._withCredentials,this._abortController)).then((t=>{if(!Te(t.status))throw Re(t.status,r);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:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded}),{value:Me(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class De{constructor({url:t,httpHeaders:e,withCredentials:s}){this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=Ee(this.isHttp,e),this.withCredentials=s||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,s){const i={begin:t,end:e};for(const n in s)i[n]=s[n];return this.request(i)}requestFull(t){return this.request(t)}request(t){const e=new XMLHttpRequest,s=this.currXhrId++,i=this.pendingRequests[s]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const[n,r]of this.headers)e.setRequestHeader(n,r);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),i.expectedStatus=206):i.expectedStatus=200,e.responseType="arraybuffer",t.onError&&(e.onerror=function(s){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,s),e.onprogress=this.onProgress.bind(this,s),i.onHeadersReceived=t.onHeadersReceived,i.onDone=t.onDone,i.onError=t.onError,i.onProgress=t.onProgress,e.send(null),s}onProgress(t,e){const s=this.pendingRequests[t];s&&s.onProgress?.(e)}onStateChange(t,e){const s=this.pendingRequests[t];if(!s)return;const i=s.xhr;if(i.readyState>=2&&s.onHeadersReceived&&(s.onHeadersReceived(),delete s.onHeadersReceived),4!==i.readyState)return;if(!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===i.status&&this.isHttp)return void s.onError?.(i.status);const n=i.status||200;if((200!==n||206!==s.expectedStatus)&&n!==s.expectedStatus)return void s.onError?.(i.status);const r=function(t){const e=t.response;return"string"!=typeof e?e:O(e).buffer}(i);if(206===n){const t=i.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);s.onDone({begin:parseInt(e[1],10),chunk:r})}else r?s.onDone({begin:0,chunk:r}):s.onError?.(i.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}
2abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class Fe{constructor(t){this._source=t,this._manager=new De(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return E(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Oe(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const s=new Ne(this._manager,t,e);return s.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(s),s}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}}class Oe{constructor(t,e){this._manager=t;const s={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(s),this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.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 t=this._fullRequestId,e=this._manager.getRequestXhr(t),s=new Headers(e.getAllResponseHeaders().trim().split(/[\r\n]+/).map((t=>{const[e,...s]=t.split(": ");return[e,s.join(": ")]}))),{allowRangeRequests:i,suggestedLength:n}=Se({responseHeaders:s,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=n||this._contentLength,this._filename=Ce(s),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=Re(t,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(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t);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 Ne{constructor(t,e,s){this._manager=t;const i={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,s,i),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(t){const e=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0;for(const s of this._requests)s.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=Re(t,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){this.isStreamingSupported||this.onProgress?.({loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;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
2(this._requestId),this._close()}}const je=/^[a-z][a-z0-9\-+.]+:/i;function Be(t,e,s){return"http:"===t.protocol?Ht.get("http").request(t,{headers:e},s):Ht.get("https").request(t,{headers:e},s)}class He{constructor(t){this.source=t,this.url=function(t){if(je.test(t))return new URL(t);const e=Ht.get("url");return new URL(e.pathToFileURL(t))}(t.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.headers=Ee(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return E(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new Ve(this):new Ue(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=this.isFsUrl?new We(this,t,e):new Ge(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}}class $e{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return null===t?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",(()=>{this._readCapability.resolve()})),t.on("end",(()=>{t.destroy(),this._done=!0,this._readCapability.resolve()})),t.on("error",(t=>{this._error(t)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new D("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class ze{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const e=t.source;this._isStreamingSupported=!e.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return null===t?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",(()=>{this._readCapability.resolve()})),t.on("end",(()=>{t.destroy(),this._done=!0,this._readCapability.resolve()})),t.on("error",(t=>{this._error(t)})),this._storedError&&this._readableStream.destroy(this._storedError)}}class Ue extends $e{constructor(t){super(t);const e=Object.fromEntries(t.headers);this._request=Be(this._url,e,(e=>{if(404===e.statusCode){const t=new P(`Missing PDF "${this._url}".`);return this._storedError=t,void this._headersCapability.reject(t)}this._headersCapability.resolve(),this._setReadableStream(e);const s=new Headers(this._readableStream.headers),{allowRangeRequests:i,suggestedLength:n}=Se({responseHeaders:s,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=i,this._contentLength=n||this._contentLength,this._filename=Ce(s)})),this._request.on("error",(t=>{this._storedError=t,this._headersCapability.reject(t)})),this._request.end()}}class Ge extends ze{constructor(t,e,s){super(t);const i=Object.fromEntries(t.headers);i.Range=`bytes=${e}-${s-1}`,this._request=Be(this._url,i,(t=>
2{if(404!==t.statusCode)this._setReadableStream(t);else{const t=new P(`Missing PDF "${this._url}".`);this._storedError=t}})),this._request.on("error",(t=>{this._storedError=t})),this._request.end()}}class Ve extends $e{constructor(t){super(t);const e=Ht.get("fs");e.promises.lstat(this._url).then((t=>{this._contentLength=t.size,this._setReadableStream(e.createReadStream(this._url)),this._headersCapability.resolve()}),(t=>{"ENOENT"===t.code&&(t=new P(`Missing PDF "${this._url}".`)),this._storedError=t,this._headersCapability.reject(t)}))}}class We extends ze{constructor(t,e,s){super(t);const i=Ht.get("fs");this._setReadableStream(i.createReadStream(this._url,{start:e,end:s-1}))}}const qe=30;class Xe{#ss=Promise.withResolvers();#ut=null;#is=!1;#ns=!!globalThis.FontInspector?.enabled;#rs=null;#as=null;#os=0;#hs=0;#ls=null;#cs=null;#ds=0;#us=0;#ps=Object.create(null);#fs=[];#gs=null;#ms=[];#vs=new WeakMap;#bs=null;static#ys=new Map;static#As=new Map;static#ws=new WeakMap;static#_s=null;static#xs=new Set;constructor({textContentSource:t,container:e,viewport:s}){if(t instanceof ReadableStream)this.#gs=t;else{if("object"!=typeof t)throw new Error('No "textContentSource" parameter specified.');this.#gs=new ReadableStream({start(e){e.enqueue(t),e.close()}})}this.#ut=this.#cs=e,this.#us=s.scale*(globalThis.devicePixelRatio||1),this.#ds=s.rotation,this.#as={div:null,properties:null,ctx:null};const{pageWidth:i,pageHeight:n,pageX:r,pageY:a}=s.rawDims;this.#bs=[1,0,0,-1,-r,a+n],this.#hs=i,this.#os=n,Xe.#Es(),lt(e,s),this.#ss.promise.finally((()=>{Xe.#xs.delete(this),this.#as=null,this.#ps=null})).catch((()=>{}))}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=j.platform;return C(this,"fontFamilyMap",new Map([["sans-serif",(t&&e?"Calibri, ":"")+"sans-serif"],["monospace",(t&&e?"Lucida Console, ":"")+"monospace"]]))}render(){const t=()=>{this.#ls.read().then((({value:e,done:s})=>{s?this.#ss.resolve():(this.#rs??=e.lang,Object.assign(this.#ps,e.styles),this.#Ss(e.items),t())}),this.#ss.reject)};return this.#ls=this.#gs.getReader(),Xe.#xs.add(this),t(),this.#ss.promise}update({viewport:t,onBefore:e=null}){const s=t.scale*(globalThis.devicePixelRatio||1),i=t.rotation;if(i!==this.#ds&&(e?.(),this.#ds=i,lt(this.#cs,{rotation:i})),s!==this.#us){e?.(),this.#us=s;const t={div:null,properties:null,ctx:Xe.#Cs(this.#rs)};for(const e of this.#ms)t.properties=this.#vs.get(e),t.div=e,this.#Rs(t)}}cancel(){const t=new D("TextLayer task cancelled.");this.#ls?.cancel(t).catch((()=>{})),this.#ls=null,this.#ss.reject(t)}get textDivs(){return this.#ms}get textContentItemsStr(){return this.#fs}#Ss(t){if(this.#is)return;this.#as.ctx??=Xe.#Cs(this.#rs);const e=this.#ms,s=this.#fs;for(const i of t){if(e.length>1e5)return _("Ignoring additional textDivs for performance reasons."),void(this.#is=!0);if(void 0!==i.str)s.push(i.str),this.#Ts(i);else if("beginMarkedContentProps"===i.type||"beginMarkedContent"===i.type){const t=this.#ut;this.#ut=document.createElement("span"),this.#ut.classList.add("markedContent"),null!==i.id&&this.#ut.setAttribute("id",`${i.id}`),t.append(this.#ut)}else"endMarkedContent"===i.type&&(this.#ut=this.#ut.parentNode)}}#Ts(t){const e=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};this.#ms.push(e);const i=H.transform(this.#bs,t.transform);let n=Math.atan2(i[1],i[0]);const r=this.#ps[t.fontName];r.vertical&&(n+=Math.PI/2);let a=this.#ns&&r.fontSubstitution||r.fontFamily;a=Xe.fontFamilyMap.get(a)||a;const o=Math.hypot(i[2],i[3]),h=o*Xe.#ks(a,this.#rs);let l,c;0===n?(l=i[4],c=i[5]-h):(l=i[4]+h*Math.sin(n),c=i[5]-h*Math.cos(n));const d="calc(var(--scale-factor)*",u=e.style;this.#ut===this.#cs?(u.left=`${(100*l/this.#hs).toFixed(2)}%`,u.top=`${(100*c/this.#os).toFixed(2)}%`):(u.left=`${d}${l.toFixed(2)}px)`,u.top=`${d}${c.toFixed(2)}px)`),u.fontSize=`${d}${(Xe.#_s*o).toFixed(2)}px)`,u.fontFamily=a,s.fontSize=o,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,this.#ns&&(e.dataset.fontName=r.fontSubstitutionLoadedName||t.fontName),0!==n&&(s.angle=n*(180/Math.PI));let p=!1;if(t.str.length>1)p=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){const e=Math.abs(t.transform[0]),s=Math.abs(t.transform[3]);e!==s&&Math.max(e,s)/Math.min(e,s)>1.5&&(p=!0)}if(p&&(s.canvasWidth=r.vertical?t.height:t.width),this.#vs.set(e,s),this.#as.div=e,this.#as.properties=s,this.#Rs(this.#as),s.hasText&&this.#ut.append(e),s.hasEOL){const t=document.createElement("br");t.setAttribute("role","presentation"),this.#ut.append(t)}}#Rs(t){const{div:e,properties:s,ctx:i}=t,{style:n}=e;let r="";if(Xe.#_s>1&&(r=`scale(${1/Xe.#_s})`),0!==s.canvasWidth&&s.hasText){const{fontFamily:t}=n,{canvasWidth:a,fontSize:o}=s;Xe.#Ms(i,o*this.#us,t);const{width:h}=i.measureText(e.textContent);h>0&&(r=`scaleX(${a*this.#us/h}) ${r}`)}0!==s.angle&&(r=`rotate(${s.angle}deg) ${r}`),r.length>0&&(n.transform=r)}static cleanup(){if(!(this.#xs.size>0)){this.#ys.clear();for(const{canvas:t}of this.#As.values())t.remove();this.#As.clear()}}static#Cs(t=null){let e=this.#As.get(t||="");if(!e){const s=document.createElement("canvas");s.className="hiddenCanvasElement",s.lang=t,document.body.append(s),e=s.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#As.set(t,e),this.#ws.set(e,{size:0,family:""})}return e}static#Ms(t,e,s){const i=this.#ws.get(t);e===i.size&&s===i.family||(t.font=`${e}px ${s}`,i.size=e,i.family=s)}static#Es(){if(null!==this.#_s)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),this.#_s=t.getBoundingClientRect().height,t.remove()}static#ks(t,e){const s=this.#ys.get(t);if(s)return s;const i=this.#Cs(e);i.canvas.width=i.canvas.height=qe,this.#Ms(i,qe,t);const n=i.measureText("");let r=n.fontBoundingBoxAscent,a=Math.abs(n.fontBoundingBoxDescent);if(r){const e=r/(r+a);return this.#ys.set(t,e),i.canvas.width=i.canvas.height=0,e}i.strokeStyle="red",i.clearRect(0,0,qe,qe),i.strokeText("g",0,0);let o=i.getImageData(0,0,qe,qe).data;a=0;for(let l=o.length-1-3;l>=0;l-=4)if(o[l]>0){a=Math.ceil(l/4/qe);break}i.clearRect(0,0,qe,qe),i.strokeText("A",0,qe),o=i.getImageData(0,0,qe,qe).data,r=0;for(let l=0,c=o.length;l<c;l+=4)if(o[l]>0){r=qe-Math.floor(l/4/qe);break}i.canvas.width=i.canvas.height=0;const h=r?r/(r+a):.8;return this.#ys.set(t,h),h}}class Ye{static textContent(t){const e=[],s={items:e,styles:Object.create(null)};return function t(s){if(!s)return;let i=null;const n=s.name;if("#text"===n)i=s.value;else{if(!Ye.shouldBuildText(n))return;s?.attributes?.textContent?i=s.attributes.textContent:s.value&&(i=s.value)}if(null!==i&&e.push({str:i}),s.children)for(const e of s.children)t(e)}(t),s}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}const Ke=65536,Je=o?class extends It{_createCanvas(t,e){return Ht.get("canvas").createCanvas(t,e)}}:class extends It{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){const s=this._document.createElement("canvas");return s.width=t,s.height=e,s}}
vendor: 6,881 bytes, line 2
2,Ze=o?class extends Lt{async _fetch(t){return $t(t)}}:Dt,Qe=o?class extends Ft{}:class extends Ft{#Ps;#Is;#Ls;#Ds;#Fs;#Os;#y=0;constructor({docId:t,ownerDocument:e=globalThis.document}){super(),this.#Ds=t,this.#Fs=e}get#w(){return this.#Is||=new Map}get#Ns(){return this.#Os||=new Map}get#js(){if(!this.#Ls){const t=this.#Fs.createElement("div"),{style:e}=t;e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;const s=this.#Fs.createElementNS(V,"svg");s.setAttribute("width",0),s.setAttribute("height",0),this.#Ls=this.#Fs.createElementNS(V,"defs"),t.append(s),s.append(this.#Ls),this.#Fs.body.append(t)}return this.#Ls}#Bs(t){if(1===t.length){const e=t[0],s=new Array(256);for(let t=0;t<256;t++)s[t]=e[t]/255;const i=s.join(",");return[i,i,i]}const[e,s,i]=t,n=new Array(256),r=new Array(256),a=new Array(256);for(let o=0;o<256;o++)n[o]=e[o]/255,r[o]=s[o]/255,a[o]=i[o]/255;return[n.join(","),r.join(","),a.join(",")]}#Hs(t){if(void 0===this.#Ps){this.#Ps="";const t=this.#Fs.URL;t!==this.#Fs.baseURI&&(K(t)?_('#createUrl: ignore "data:"-URL for performance reasons.'):this.#Ps=t.split("#",1)[0])}return`url(${this.#Ps}#${t})`}addFilter(t){if(!t)return"none";let e=this.#w.get(t);if(e)return e;const[s,i,n]=this.#Bs(t),r=1===t.length?s:`${s}${i}${n}`;if(e=this.#w.get(r),e)return this.#w.set(t,e),e;const a=`g_${this.#Ds}_transfer_map_${this.#y++}`,o=this.#Hs(a);this.#w.set(t,o),this.#w.set(r,o);const h=this.#$s(a);return this.#zs(s,i,n,h),o}addHCMFilter(t,e){const s=`${t}-${e}`,i="base";let n=this.#Ns.get(i);if(n?.key===s)return n.url;if(n?(n.filter?.remove(),n.key=s,n.url="none",n.filter=null):(n={key:s,url:"none",filter:null},this.#Ns.set(i,n)),!t||!e)return n.url;const r=this.#Us(t);t=H.makeHexColor(...r);const a=this.#Us(e);if(e=H.makeHexColor(...a),this.#js.style.color="","#000000"===t&&"#ffffff"===e||t===e)return n.url;const o=new Array(256);for(let u=0;u<=255;u++){const t=u/255;o[u]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const h=o.join(","),l=`g_${this.#Ds}_hcm_filter`,c=n.filter=this.#$s(l);this.#zs(h,h,h,c),this.#Gs(c);const d=(t,e)=>{const s=r[t]/255,i=a[t]/255,n=new Array(e+1);for(let r=0;r<=e;r++)n[r]=s+r/e*(i-s);return n.join(",")};return this.#zs(d(0,5),d(1,5),d(2,5),c),n.url=this.#Hs(l),n.url}addAlphaFilter(t){let e=this.#w.get(t);if(e)return e;const[s]=this.#Bs([t]),i=`alpha_${s}`;if(e=this.#w.get(i),e)return this.#w.set(t,e),e;const n=`g_${this.#Ds}_alpha_map_${this.#y++}`,r=this.#Hs(n);this.#w.set(t,r),this.#w.set(i,r);const a=this.#$s(n);return this.#Vs(s,a),r}addLuminosityFilter(t){let e,s,i=this.#w.get(t||"luminosity");if(i)return i;if(t?([e]=this.#Bs([t]),s=`luminosity_${e}`):s="luminosity",i=this.#w.get(s),i)return this.#w.set(t,i),i;const n=`g_${this.#Ds}_luminosity_map_${this.#y++}`,r=this.#Hs(n);this.#w.set(t,r),this.#w.set(s,r);const a=this.#$s(n);return this.#Ws(a),t&&this.#Vs(e,a),r}addHighlightHCMFilter(t,e,s,i,n){const r=`${e}-${s}-${i}-${n}`;let a=this.#Ns.get(t);if(a?.key===r)return a.url;if(a?(a.filter?.remove(),a.key=r,a.url="none",a.filter=null):(a={key:r,url:"none",filter:null},this.#Ns.set(t,a)),!e||!s)return a.url;const[o,h]=[e,s].map(this.#Us.bind(this));let l=Math.round(.2126*o[0]+.7152*o[1]+.0722*o[2]),c=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[d,u]=[i,n].map(this.#Us.bind(this));c<l&&([l,c,d,u]=[c,l,u,d]),this.#js.style.color="";const p=(t,e,s)=>{const i=new Array(256),n=(c-l)/s,r=t/255,a=(e-t)/(255*s);let o=0;for(let h=0;h<=s;h++){const t=Math.round(l+h*n),e=r+h*a;for(let s=o;s<=t;s++)i[s]=e;o=t+1}for(let h=o;h<256;h++)i[h]=i[o-1];return i.join(",")},f=`g_${this.#Ds}_hcm_${t}_filter`,g=a.filter=this.#$s(f);return this.#Gs(g),this.#zs(p(d[0],u[0],5),p(d[1],u[1],5),p(d[2],u[2],5),g),a.url=this.#Hs(f),a.url}destroy(t=!1){t&&0!==this.#Ns.size||(this.#Ls&&(this.#Ls.parentNode.parentNode.remove(),this.#Ls=null),this.#Is&&(this.#Is.clear(),this.#Is=null),this.#y=0)}#Ws(t){const e=this.#Fs.createElementNS(V,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(e)}#Gs(t){const e=this.#Fs.createElementNS(V,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(e)}#$s(t){const e=this.#Fs.createElementNS(V,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),this.#js.append(e),e}#qs(t,e,s){const i=this.#Fs.createElementNS(V,e);i.setAttribute("type","discrete"),i.setAttribute("tableValues",s),t.append(i)}#zs(t,e,s,i){const n=this.#Fs.createElementNS(V,"feComponentTransfer");i.append(n),this.#qs(n,"feFuncR",t),this.#qs(n,"feFuncG",e),this.#qs(n,"feFuncB",s)}#Vs(t,e){const s=this.#Fs.createElementNS(V,"feComponentTransfer");e.append(s),this.#qs(s,"feFuncA",t)}#Us(t){return this.#js.style.color=t,at(getComputedStyle(this.#js).getPropertyValue("color"))}},ts=o?class extends Ot{async _fetch(t){return $t(t)}}:Nt;function es(t={}){"string"==typeof t||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});const e=new is,{docId:s}=e,i=t.url?function(t){if(t instanceof URL)return t.href;try{return new URL(t,window.location).href}catch{if(o&&"string"==typeof t)return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(t.url):null,n=t.data?function(t){if(o&&"undefined"!=typeof Buffer&&t instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if("string"==typeof t)return O(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"==typeof t&&!isNaN(t?.length))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(t.data):null,r=t.httpHeaders||null,a=!0===t.withCredentials,h=t.password??null,l=t.range instanceof ns?t.range:null,c=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:Ke;let d=t.worker instanceof hs?t.worker:null;const u=t.verbosity,p="string"!=typeof t.docBaseUrl||K(t.docBaseUrl)?null:t.docBaseUrl,f="string"==typeof t.cMapUrl?t.cMapUrl:null,g=!1!==t.cMapPacked,m=t.CMapReaderFactory||Ze,v="string"==typeof t.standardFontDataUrl?t.standardFontDataUrl:null,b=t.StandardFontDataFactory||ts,A=!0!==t.stopAtErrors,w=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,_=!1!==t.isEvalSupported,x="boolean"==typeof t.isOffscreenCanvasSupported?t.isOffscreenCanvasSupported:!o,E="boolean"==typeof t.isChrome?t.isChrome:!j.platform.isFirefox&&"undefined"!=typeof window&&!!window?.chrome,S=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,C="boolean"==typeof t.disableFontFace?t.disableFontFace:o,R=!0===t.fontE
2xtraProperties,T=!0===t.enableXfa,k=t.ownerDocument||globalThis.document,M=!0===t.disableRange,P=!0===t.disableStream,I=!0===t.disableAutoFetch,L=!0===t.pdfBug,D=t.CanvasFactory||Je,F=t.FilterFactory||Qe,N=!0===t.enableHWA,B=l?l.length:t.length??NaN,H="boolean"==typeof t.useSystemFonts?t.useSystemFonts:!o&&!C,$="boolean"==typeof t.useWorkerFetch?t.useWorkerFetch:m===Dt&&b===Nt&&f&&v&&et(f,document.baseURI)&&et(v,document.baseURI);t.canvasFactory&&it("`canvasFactory`-instance option, please use `CanvasFactory` instead."),t.filterFactory&&it("`filterFactory`-instance option, please use `FilterFactory` instead."),function(t){Number.isInteger(t)&&(y=t)}(u);const z={canvasFactory:new D({ownerDocument:k,enableHWA:N}),filterFactory:new F({docId:s,ownerDocument:k}),cMapReaderFactory:$?null:new m({baseUrl:f,isCompressed:g}),standardFontDataFactory:$?null:new b({baseUrl:v})};if(!d){const t={verbosity:u,port:fe.workerPort};d=t.port?hs.fromPort(t):new hs(t),e._worker=d}const U={docId:s,apiVersion:"4.8.69",data:n,password:h,disableAutoFetch:I,rangeChunkSize:c,length:B,docBaseUrl:p,enableXfa:T,evaluatorOptions:{maxImageSize:w,disableFontFace:C,ignoreErrors:A,isEvalSupported:_,isOffscreenCanvasSupported:x,isChrome:E,canvasMaxAreaInBytes:S,fontExtraProperties:R,useSystemFonts:H,cMapUrl:$?f:null,standardFontDataUrl:$?v:null}},G={disableFontFace:C,fontExtraProperties:R,ownerDocument:k,pdfBug:L,styleElement:null,loadingParams:{disableAutoFetch:I,enableXfa:T}};return d.promise.then((function(){if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const t=d.messageHandler.sendWithPromise("GetDocRequest",U,n?[n.buffer]:null);let h;if(l)h=new we(l,{disableRange:M,disableStream:P});else if(!n){if(!i)throw new Error("getDocument - no `url` parameter provided.");let t;t=o?"undefined"!=typeof fetch&&"undefined"!=typeof Response&&"body"in Response.prototype&&et(i)?Pe:He:et(i)?Pe:Fe,h=new t({url:i,length:B,httpHeaders:r,withCredentials:a,rangeChunkSize:c,disableRange:M,disableStream:P})}return t.then((t=>{if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const i=new me(s,t,d.port),n=new ls(i,e,h,G,z);e._transport=n,i.send("Ready",null)}))})).catch(e._capability.reject),e}function ss(t){return"object"==typeof t&&Number.isInteger(t?.num)&&t.num>=0&&Number.isInteger(t?.gen)&&t.gen>=0}class is{static#Ds=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d"+is.#Ds++,this.destroyed=!1,this.onPassword=null,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(i){throw this._worker?.port&&delete this._worker._pendingDestroy,i}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}class ns{constructor(t,e,s=!1,i=null){this.length=t,this.initialData=e,this.progressiveDone=s,this.contentDispositionFilename=i,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,e){for(const s of this._rangeListeners)s(t,e)}onDataProgress(t,e){this._readyCapability.promise.then((()=>{for(const s of this._progressListeners)s(t,e)}))}onDataProgressiveRead(t){this._readyCapability.promise.then((()=>{for(const e of this._progressiveReadListeners)e(t)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(const t of this._progressiveDoneListeners)t()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){x("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class rs{constructor(t,e){this._pdfInfo=t,this._transport=e}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 C(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}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({intent:t="display"}={}){const{renderingIntent:e}
2=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}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()}}class as{#Xs=null;#Ys=!1;constructor(t,e,s,i=!1){this._pageIndex=t,this._pageInfo=e,this._transport=s,this._stats=i?new tt:null,this._pdfBug=i,this.commonObjs=s.commonObjs,this.objs=new ds,this._maybeCleanupAfterRender=!1,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({scale:t,rotation:e=this.rotate,offsetX:s=0,offsetY:i=0,dontFlip:n=!1}={}){return new X({viewBox:this.view,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}getAnnotations({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return C(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,viewport:e,intent:s="display",annotationMode:i=d.ENABLE,transform:n=null,background:r=null,optionalContentConfigPromise:a=null,annotationCanvasMap:o=null,pageColors:h=null,printAnnotationStorage:l=null,isEditing:c=!1}){this._stats?.time("Overall");const u=this._transport.getRenderingIntent(s,i,l,c),{renderingIntent:p,cacheKey:f}=u;this.#Ys=!1,this.#Ks(),a||=this._transport.getOptionalContentConfig(p);let g=this._intentStates.get(f);g||(g=Object.create(null),this._intentStates.set(f,g)),g.streamReaderCancelTimeout&&(clearTimeout(g.streamReaderCancelTimeout),g.streamReaderCancelTimeout=null);const m=!!(4&p);g.displayReadyCapability||(g.displayReadyCapability=Promise.withResolvers(),g.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(u));const v=t=>{g.renderTasks.delete(b),(this._maybeCleanupAfterRender||m)&&(this.#Ys=!0),this.#Js(!m),t?(b.capability.reject(t),this._abortOperatorList({intentState:g,reason:t instanceof Error?t:new Error(t)})):b.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},b=new ps({callback:v,params:{canvasContext:t,viewport:e,transform:n,background:r},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:o,operatorList:g.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!m,pdfBug:this._pdfBug,pageColors:h});(g.renderTasks||=new Set).add(b);const y=b.task;return Promise.all([g.displayReadyCapability.promise,a]).then((([t,e])=>{if(this.destroyed)v();else{if(this._stats?.time("Rendering"),!(e.renderingIntent&p))throw new Error("Mu
2st use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");b.initializeGraphics({transparency:t,optionalContentConfig:e}),b.operatorListChanged()}})).catch(v),y}getOperatorList({intent:t="display",annotationMode:e=d.ENABLE,printAnnotationStorage:s=null,isEditing:i=!1}={}){const n=this._transport.getRenderingIntent(t,e,s,i,!0);let r,a=this._intentStates.get(n.cacheKey);return a||(a=Object.create(null),this._intentStates.set(n.cacheKey,a)),a.opListReadCapability||(r=Object.create(null),r.operatorListChanged=function(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(r))},a.opListReadCapability=Promise.withResolvers(),(a.renderTasks||=new Set).add(r),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(n)),a.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then((t=>Ye.textContent(t)));const e=this.streamTextContent(t);return new Promise((function(t,s){const i=e.getReader(),n={items:[],styles:Object.create(null),lang:null};!function e(){i.read().then((function({value:s,done:i}){i?t(n):(n.lang??=s.lang,Object.assign(n.styles,s.styles),n.items.push(...s.items),e())}),s)}()}))}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const s of e.renderTasks)t.push(s.completed),s.cancel();return this.objs.clear(),this.#Ys=!1,this.#Ks(),Promise.all(t)}cleanup(t=!1){this.#Ys=!0;const e=this.#Js(!1);return t&&e&&(this._stats&&=new tt),e}#Js(t=!1){if(this.#Ks(),!this.#Ys||this.destroyed)return!1;if(t)return this.#Xs=setTimeout((()=>{this.#Xs=null,this.#Js(!1)}),5e3),!1;for(const{renderTasks:e,operatorList:s}of this._intentStates.values())if(e.size>0||!s.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#Ys=!1,!0}#Ks(){this.#Xs&&(clearTimeout(this.#Xs),this.#Xs=null)}_startRenderPage(t,e){const s=this._intentStates.get(e);s&&(this._stats?.timeEnd("Page Request"),s.displayReadyCapability?.resolve(t))}_renderPageChunk(t,e){for(let s=0,i=t.length;s<i;s++)e.operatorList.fnArray.push(t.fnArray[s]),e.operatorList.argsArray.push(t.argsArray[s]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const s of e.renderTasks)s.operatorListChanged();t.lastChunk&&this.#Js(!0)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:s,modifiedIds:i}){const{map:n,transfer:r}=s,a=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:n,modifiedIds:i},r).getReader(),o=this._intentStates.get(e);o.streamReader=a;const h=()=>{a.read().then((({value:t,done:e})=>{e?o.streamReader=null:this._transport.destroyed||(this._renderPageChunk(t,o),h())}),(t=>{if(o.streamReader=null,!this._transport.destroyed){if(o.operatorList){o.operatorList.lastChunk=!0;for(const t of o.renderTasks)t.operatorListChanged();this.#Js(!0)}if(o.displayReadyCapability)o.displayReadyCapability.reject(t);else{if(!o.opListReadCapability)throw t;o.opListReadCapability.reject(t)}}}))};h()}_abortOperatorList({intentState:t,reason:e,force:s=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!s){if(t.renderTasks.size>0)return;if(e instanceof Y){let s=100;return e.extraDelay>0&&e.extraDelay<1e3&&(s+=e.extraDelay),void(t.streamReaderCancelTimeout=setTimeout((()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})}),s))}}if(t.streamReader.cancel(new D(e.message)).catch((()=>{})),t.streamReader=null,!this._transport.destroyed){for(const[e,s]of this._intentStates)if(s===t){this._intentStates.delete(e);break}this.cleanup()}}}get stats(){return this._stats}}class os{#Zs=new Map;#Qs=Promise.resolve();postMessage(t,e){const s={data:structuredClone(t,e?{transfer:e}:null)};this.#Qs.then((()=>{for(const[t]of this.#Zs)t.call(this,s)}))}addEventListener(t,e,s=null){let i=null;if(s?.signal instanceof AbortSignal){const{signal:n}=s;if(n.aborted)return void _("LoopbackPort - cannot use an `aborted` signal.");const r=()=>this.removeEventListener(t,e);i=()=>n.removeEventListener("abort",r),n.addEventListener("abort",r)}this.#Zs.set(e,i)}removeEventListener(t,e){const s=this.#Zs.get(e);s?.(),this.#Zs.delete(e)}terminate(){for(const[,t]of this.#Zs)t?.();this.#Zs.clear()}}class hs{static#ti=0;static#ei=!1;static#si;static{o&&(this.#ei=!0,fe.workerSrc||="./pdf.worker.mjs"),this._isSameOrigin=(t,e)=>{let s;try{if(s=new URL(t),!s.origin||"null"===s.origin)return!1}catch{return!1}const i=new URL(e,s);return s.origin===i.origin},this._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))}}constructor({name:t=null,port:e=null,verbosity:s=A()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=s,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){if(hs.#si?.has(e))throw new Error("Cannot use more than one PDFWorker per port.");(hs.#si||=new WeakMap).set(e,this),this._initializeFromPort(e)}else this._initialize()}get promise(){return o?Promise.all([Ht.promise,this._readyCapability.promise]):this._readyCapability.promise}#ii(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new me("main","worker",t),this._messageHandler.on("ready",(function(){})),this.#ii()}_initialize(){if(hs.#ei||hs.#ni)return void this._setupFakeWorker();let{workerSrc:t}=hs;try{hs._isSameOrigin(window.location.href,t)||(t=hs._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),s=new me("main","worker",e),i=()=>{n.abort(),s.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},n=new AbortController;e.addEventListener("error",(()=>{this._webWorker||i()}),{signal:n.signal}),s.on("test",(t=>{n.abort(),!this.destroyed&&t?(this._messageHandler=s,this._port=e,this._webWorker=e,this.#ii()):i()})),s.on("ready",(t=>{if(n.abort(),this.destroyed)i();else try{r()}catch{this._setupFakeWorker()}}));const r=()=>{const t=new Uint8Array;s.send("test",t,[t.buffer])};return void r()}catch{w("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){hs.#ei||(_("Setting up fake worker."),hs.#ei=!0),hs._setupFakeWorkerGlobal.then((t=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const e=new os;this._port=e;const s="fake"+hs.#ti++,i=new me(s+"_worker",s,e);t.setup(i,e),this._messageHandler=new me(s,s+"_worker",e),this.#ii()})).catch((t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))}))}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),hs.#si?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(!t?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const e=this.#si?.get(t.port);
2if(e){if(e._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new hs(t)}static get workerSrc(){if(fe.workerSrc)return fe.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#ni(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return C(this,"_setupFakeWorkerGlobal",(async()=>this.#ni?this.#ni:(await s(33998)(this.workerSrc)).WorkerMessageHandler)())}}class ls{#ri=new Map;#ai=new Map;#oi=new Map;#hi=new Map;#li=null;constructor(t,e,s,i,n){this.messageHandler=t,this.loadingTask=e,this.commonObjs=new ds,this.fontLoader=new Mt({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=s,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#ci(t,e=null){const s=this.#ri.get(t);if(s)return s;const i=this.messageHandler.sendWithPromise(t,e);return this.#ri.set(t,i),i}get annotationStorage(){return C(this,"annotationStorage",new Tt)}getRenderingIntent(t,e=d.ENABLE,s=null,i=!1,n=!1){let r=2,a=Rt;switch(t){case"any":r=1;break;case"display":break;case"print":r=4;break;default:_(`getRenderingIntent - invalid intent: ${t}`)}const o=4&r&&s instanceof kt?s:this.annotationStorage;switch(e){case d.DISABLE:r+=64;break;case d.ENABLE:break;case d.ENABLE_FORMS:r+=16;break;case d.ENABLE_STORAGE:r+=32,a=o.serializable;break;default:_(`getRenderingIntent - invalid annotationMode: ${e}`)}i&&(r+=128),n&&(r+=256);const{ids:h,hash:l}=o.modifiedIds;return{renderingIntent:r,cacheKey:[r,a.hash,l].join("_"),annotationStorageSerializable:a,modifiedIds:h}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#li?.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const s of this.#ai.values())t.push(s._destroy());this.#ai.clear(),this.#oi.clear(),this.#hi.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then((()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#ri.clear(),this.filterFactory.destroy(),Xe.cleanup(),this._networkStream?.cancelAllRequests(new D("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",((t,e)=>{E(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}},e.onPull=()=>{this._fullReader.read().then((function({value:t,done:s}){s?e.close():(E(t instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(t),1,[t]))})).catch((t=>{e.error(t)}))},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch((t=>{if(!this.destroyed)throw t}))}})),t.on("ReaderHeadersReady",(async t=>{await this._fullReader.headersReady;const{isStreamingSupported:s,isRangeSupported:i,contentLength:n}=this._fullReader;return s&&i||(this._lastProgress&&e.onProgress?.(this._lastProgress),this._fullReader.onProgress=t=>{e.onProgress?.({loaded:t.loaded,total:t.total})}),{isStreamingSupported:s,isRangeSupported:i,contentLength:n}})),t.on("GetRangeReader",((t,e)=>{E(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const s=this._networkStream.getRangeReader(t.begin,t.end);s?(e.onPull=()=>{s.read().then((function({value:t,done:s}){s?e.close():(E(t instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(t),1,[t]))})).catch((t=>{e.error(t)}))},e.onCancel=t=>{s.cancel(t),e.ready.catch((t=>{if(!this.destroyed)throw t}))}):e.close()})),t.on("GetDoc",(({pdfInfo:t})=>{this._numPages=t.numPages,this._htmlForXfa=t.htmlForXfa,delete t.htmlForXfa,e._capability.resolve(new rs(t,this))})),t.on("DocException",(function(t){let s;switch(t.name){case"PasswordException":s=new T(t.message,t.code);break;case"InvalidPDFException":s=new M(t.message);break;case"MissingPDFException":s=new P(t.message);break;case"UnexpectedResponseException":s=new I(t.message,t.status);break;case"UnknownErrorException":s=new k(t.message,t.details);break;default:x("DocException - expected a valid Error.")}e._capability.reject(s)})),t.on("PasswordRequest",(t=>{if(this.#li=Promise.withResolvers(),e.onPassword){const s=t=>{t instanceof Error?this.#li.reject(t):this.#li.resolve({password:t})};try{e.onPassword(s,t.code)}catch(t){this.#li.reject(t)}}else this.#li.reject(new T(t.message,t.code));return this.#li.promise})),t.on("DataLoaded",(t=>{e.onProgress?.({loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)})),t.on("StartRenderPage",(t=>{this.destroyed||this.#ai.get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)})),t.on("commonobj",(([e,s,i])=>{if(this.destroyed)return null;if(this.commonObjs.has(e))return null;switch(s){case"Font":const{disableFontFace:n,fontExtraProperties:r,pdfBug:a}=this._params;if("error"in i){const t=i.error;_(`Error during font loading: ${t}`),this.commonObjs.resolve(e,t);break}const o=a&&globalThis.FontInspector?.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null,h=new Pt(i,{disableFontFace:n,inspectFont:o});this.fontLoader.bind(h).catch((()=>
2t.sendWithPromise("FontFallback",{id:e}))).finally((()=>{!r&&h.data&&(h.data=null),this.commonObjs.resolve(e,h)}));break;case"CopyLocalImage":const{imageRef:l}=i;E(l,"The imageRef must be defined.");for(const t of this.#ai.values())for(const[,s]of t.objs)if(s?.ref===l)return s.dataLen?(this.commonObjs.resolve(e,structuredClone(s)),s.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(e,i);break;default:throw new Error(`Got unknown common object type ${s}`)}return null})),t.on("obj",(([t,e,s,i])=>{if(this.destroyed)return;const n=this.#ai.get(e);if(!n.objs.has(t))if(0!==n._intentStates.size)switch(s){case"Image":n.objs.resolve(t,i),i?.dataLen>1e7&&(n._maybeCleanupAfterRender=!0);break;case"Pattern":n.objs.resolve(t,i);break;default:throw new Error(`Got unknown object type ${s}`)}else i?.bitmap?.close()})),t.on("DocProgress",(t=>{this.destroyed||e.onProgress?.({loaded:t.loaded,total:t.total})})),t.on("FetchBuiltInCMap",(async t=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(t)})),t.on("FetchStandardFontData",(async t=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(t)}))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&_("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null},e).finally((()=>{this.annotationStorage.resetModified()}))}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,s=this.#oi.get(e);if(s)return s;const i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then((s=>{if(this.destroyed)throw new Error("Transport destroyed");s.refStr&&this.#hi.set(s.refStr,t);const i=new as(e,s,this,this._params.pdfBug);return this.#ai.set(e,i),i}));return this.#oi.set(e,i),i}getPageIndex(t){return ss(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return this.#ci("GetFieldObjects")}hasJSActions(){return this.#ci("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!=typeof t?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}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 this.#ci("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return this.#ci("GetOptionalContentConfig").then((e=>new Ae(e,t)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=this.#ri.get(t);if(e)return e;
2const s=this.messageHandler.sendWithPromise(t,null).then((t=>({info:t[0],metadata:t[1]?new ve(t[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})));return this.#ri.set(t,s),s}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of this.#ai.values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),this.#ri.clear(),this.filterFactory.destroy(!0),Xe.cleanup()}}cachedPageNumber(t){if(!ss(t))return null;const e=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`;return this.#hi.get(e)??null}}const cs=Symbol("INITIAL_DATA");class ds{#di=Object.create(null);#ui(t){return this.#di[t]||={...Promise.withResolvers(),data:cs}}get(t,e=null){if(e){const s=this.#ui(t);return s.promise.then((()=>e(s.data))),null}const s=this.#di[t];if(!s||s.data===cs)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return s.data}has(t){const e=this.#di[t];return!!e&&e.data!==cs}resolve(t,e=null){const s=this.#ui(t);s.data=e,s.resolve()}clear(){for(const t in this.#di){const{data:e}=this.#di[t];e?.bitmap?.close()}this.#di=Object.create(null)}*[Symbol.iterator](){for(const t in this.#di){const{data:e}=this.#di[t];e!==cs&&(yield[t,e])}}}class us{#pi=null;constructor(t){this.#pi=t,this.onContinue=null}get promise(){return this.#pi.capability.promise}cancel(t=0){this.#pi.cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=this.#pi.operatorList;if(!t)return!1;const{annotationCanvasMap:e}=this.#pi;return t.form||t.canvas&&e?.size>0}}class ps{#fi=null;static#gi=new WeakSet;constructor({callback:t,params:e,objs:s,commonObjs:i,annotationCanvasMap:n,operatorList:r,pageIndex:a,canvasFactory:o,filterFactory:h,useRequestAnimationFrame:l=!1,pdfBug:c=!1,pageColors:d=null}){this.callback=t,this.params=e,this.objs=s,this.commonObjs=i,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=a,this.canvasFactory=o,this.filterFactory=h,this._pdfBug=c,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===l&&"undefined"!=typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new us(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=e.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(ps.#gi.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.");ps.#gi.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:s,viewport:i,transform:n,background:r}=this.params;this.gfx=new pe(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:n,viewport:i,transparency:t,background:r}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,e=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#fi&&(window.cancelAnimationFrame(this.#fi),this.#fi=null),ps.#gi.delete(this._canvas),this.callback(t||new Y(`Rendering cancelled, page ${this._pageIndex+1}`,e))}operatorListChanged(){this.graphicsReady?(this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||=this._continueBound}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#fi=window.requestAnimationFrame((()=>{this.#fi=null,this._nextBound().catch(this._cancelBound)}
vendor: 4,559 bytes, line 2
2)):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),ps.#gi.delete(this._canvas),this.callback())))}}const fs="4.8.69",gs="3634dab10";function ms(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function vs(t){return Math.max(0,Math.min(255,255*t))}r(670);class bs{static CMYK_G([t,e,s,i]){return["G",1-Math.min(1,.3*t+.59*s+.11*e+i)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return[t=vs(t),t,t]}static G_HTML([t]){const e=ms(t);return`#${e}${e}${e}`}static RGB_G([t,e,s]){return["G",.3*t+.59*e+.11*s]}static RGB_rgb(t){return t.map(vs)}static RGB_HTML(t){return`#${t.map(ms).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,s,i]){return["RGB",1-Math.min(1,t+i),1-Math.min(1,s+i),1-Math.min(1,e+i)]}static CMYK_rgb([t,e,s,i]){return[vs(1-Math.min(1,t+i)),vs(1-Math.min(1,s+i)),vs(1-Math.min(1,e+i))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,s]){const i=1-t,n=1-e,r=1-s;return["CMYK",i,n,r,Math.min(i,n,r)]}}class ys{create(t,e,s=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),s||(i.setAttribute("width",`${t}px`),i.setAttribute("height",`${e}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${t} ${e}`),i}createElement(t){if("string"!=typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){x("Abstract method `_createSVG` called.")}}class As extends ys{_createSVG(t){return document.createElementNS(V,t)}}class ws{static setupStorage(t,e,s,i,n){const r=i.getValue(e,{value:null});switch(s.name){case"textarea":if(null!==r.value&&(t.textContent=r.value),"print"===n)break;t.addEventListener("input",(t=>{i.setValue(e,{value:t.target.value})}));break;case"input":if("radio"===s.attributes.type||"checkbox"===s.attributes.type){if(r.value===s.attributes.xfaOn?t.setAttribute("checked",!0):r.value===s.attributes.xfaOff&&t.removeAttribute("checked"),"print"===n)break;t.addEventListener("change",(t=>{i.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})}))}else{if(null!==r.value&&t.setAttribute("value",r.value),"print"===n)break;t.addEventListener("input",(t=>{i.setValue(e,{value:t.target.value})}))}break;case"select":if(null!==r.value){t.setAttribute("value",r.value);for(const t of s.children)t.attributes.value===r.value?t.attributes.selected=!0:t.attributes.hasOwnProperty("selected")&&delete t.attributes.selected}t.addEventListener("input",(t=>{const s=t.target.options,n=-1===s.selectedIndex?"":s[s.selectedIndex].value;i.setValue(e,{value:n})}))}}static setAttributes({html:t,element:e,storage:s=null,intent:i,linkService:n}){const{attributes:r}=e,a=t instanceof HTMLAnchorElement;"radio"===r.type&&(r.name=`${r.name}-${i}`);for(const[o,h]of Object.entries(r))if(null!=h)switch(o){case"class":h.length&&t.setAttribute(o,h.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",h);break;case"style":Object.assign(t.style,h);break;case"textContent":t.textContent=h;break;default:(!a||"href"!==o&&"newWindow"!==o)&&t.setAttribute(o,h)}a&&n.addLinkAttributes(t,r.href,r.newWindow),s&&r.dataId&&this.setupStorage(t,r.dataId,e,s)}static render(t){const e=t.annotationStorage,s=t.linkService,i=t.xfaHtml,n=t.intent||"display",r=document.createElement(i.name);i.attributes&&this.setAttributes({html:r,element:i,intent:n,linkService:s});const a="richText"!==n,o=t.div;if(o.append(r),t.viewport){const e=`matrix(${t.viewport.transform.join(",")})`;o.style.transform=e}a&&o.setAttribute("class","xfaLayer xfaFont");const h=[];if(0===i.children.length){if(i.value){const t=document.createTextNode(i.value);r.append(t),a&&Ye.shouldBuildText(i.name)&&h.push(t)}return{textDivs:h}}const l=[[i,-1,r]];for(;l.length>0;){const[t,i,r]=l.at(-1);if(i+1===t.children.length){l.pop();continue}const o=t.children[++l.at(-1)[1]];if(null===o)continue;const{name:c}=o;if("#text"===c){const t=document.createTextNode(o.value);h.push(t),r.append(t);continue}const d=o?.attributes?.xmlns?document.createElementNS(o.attributes.xmlns,c):document.createElement(c);
2if(r.append(d),o.attributes&&this.setAttributes({html:d,element:o,storage:e,intent:n,linkService:s}),o.children?.length>0)l.push([o,-1,d]);else if(o.value){const t=document.createTextNode(o.value);a&&Ye.shouldBuildText(c)&&h.push(t),d.append(t)}}for(const c of o.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))c.setAttribute("readOnly",!0);return{textDivs:h}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}const _s=1e3,xs=new WeakSet;function Es(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class Ss{static create(t){switch(t.data.annotationType){case 2:return new Rs(t);case 1:return new Ts(t);case 20:switch(t.data.fieldType){case"Tx":return new Ms(t);case"Btn":return t.data.radioButton?new Ls(t):t.data.checkBox?new Is(t):new Ds(t);case"Ch":return new Fs(t);case"Sig":return new Ps(t)}return new ks(t);case 16:return new Os(t);case 3:return new js(t);case 4:return new Bs(t);case 5:return new Hs(t);case 6:return new $s(t);case 8:return new zs(t);case 14:return new Gs(t);case 15:return new Vs(t);case 7:return new Us(t);case 9:return new Ws(t);case 10:return new qs(t);case 11:return new Xs(t);case 12:return new Ys(t);case 13:return new Ks(t);case 17:return new Js(t);default:return new Cs(t)}}}class Cs{#mi=null;#vi=!1;#bi=null;constructor(t,{isRenderable:e=!1,ignoreBorder:s=!1,createQuadrilaterals:i=!1}={}){this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(s)),i&&this._createQuadrilaterals()}static _hasPopupData({titleObj:t,contentsObj:e,richText:s}){return!!(t?.str||e?.str||s?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Cs._hasPopupData(this.data)}updateEdited(t){if(!this.container)return;this.#mi||={rect:this.data.rect.slice(0)};const{rect:e}=t;e&&this.#yi(e),this.#bi?.popup.updateEdited(t)}resetEdited(){this.#mi&&(this.#yi(this.#mi.rect),this.#bi?.popup.resetEdited(),this.#mi=null)}#yi(t){const{container:{style:e},data:{rect:s,rotation:i},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:r,pageX:a,pageY:o}}}}=this;s?.splice(0,4,...t);const{width:h,height:l}=Es(t);e.left=100*(t[0]-a)/n+"%",e.top=100*(r-t[3]+o)/r+"%",0===i?(e.width=100*h/n+"%",e.height=100*l/r+"%"):this.setRotation(i)}_createContainer(t){const{data:e,parent:{page:s,viewport:i}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",e.id),this instanceof ks||(n.tabIndex=_s);const{style:r}=n;if(r.zIndex=this.parent.zIndex++,e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof Os){const{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,n),n}const{width:a,height:o}=Es(e.rect);if(!t&&e.borderStyle.width>0){r.borderWidth=`${e.borderStyle.width}px`;const t=e.borderStyle.horizontalCornerRadius,s=e.borderStyle.verticalCornerRadius;if(t>0||s>0){const e=`calc(${t}px * var(--scale-factor)) / calc(${s}px * var(--scale-factor))`;r.borderRadius=e}else if(this instanceof Ls){const t=`calc(${a}px * var(--scale-factor)) / calc(${o}px * var(--scale-factor))`;r.borderRadius=t}switch(e.borderStyle.style){case 1:r.borderStyle="solid";break;case 2:r.borderStyle="dashed";break;case 3:_("Unimplemented border style: beveled");break;case 4:_("Unimplemented border style: inset");break;case 5:r.borderBottomStyle="solid"}const i=e.borderColor||null;i?(this.#vi=!0,r.borderColor=H.makeHexColor(0|i[0],0|i[1],0|i[2])):r.borderWidth=0}const h=H.normalizeRect([e.rect[0],s.view[3]-e.rect[1]+s.view[1],e.rect[2],s.view[3]-e.rect[3]+s.view[1]]),{pageWidth:l,pageHeight:c,pageX:d,pageY:u}=i.rawDims;r.left=100*(h[0]-d)/l+"%",r.top=100*(h[1]-u)/c+"%";const{rotation:p}=e;return e.hasOwnCanvas||0===p?(r.width=100*a/l+"%",r.height=100*o/c+"%"):this.setRotation(p,n),n}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:s,pageHeight:i}=this.parent.viewport.rawDims,{width:n,height:r}=Es(this.data.rect);let a,o;t%180==0?(a=100*n/s,o=100*r/i):(a=100*r/s,o=100*n/i),e.style.width=`${a}%`,e.style.height=`${o}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(t,e,s)=>{const i=s.detail[t],n=i[0],r=i.slice(1);s.target.style[e]=bs[`${n}_HTML`](r),this.annotationStorage.setValue(this.data.id,{[e]:bs[`${n}_rgb`](r)})};return C(this,"_commonActions",{display:t=>{const{display:e}=t.detail,s=e%2==1;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:s,noPrint:1===e||2===e})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:e}=t.detail;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout((()=>
2t.target.focus({preventScroll:!1})),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:t=>{const e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){const s=this._commonActions;for(const i of Object.keys(e.detail)){const n=t[i]||s[i];n?.(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const s=this._commonActions;for(const[i,n]of Object.entries(e)){const r=s[i];r&&(r({detail:{[i]:n},target:t}),delete e[i])}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,s,i,n]=this.data.rect.map((t=>Math.fround(t)));if(8===t.length){const[r,a,o,h]=t.subarray(2,6);if(i===r&&n===a&&e===o&&s===h)return}const{style:r}=this.container;let a;if(this.#vi){const{borderColor:t,borderWidth:e}=r;r.borderWidth=0,a=["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="${t}" stroke-width="${e}">`],this.container.classList.add("hasBorder")}const o=i-e,h=n-s,{svgFactory:l}=this,c=l.createElement("svg");c.classList.add("quadrilateralsContainer"),c.setAttribute("width",0),c.setAttribute("height",0);const d=l.createElement("defs");c.append(d);const u=l.createElement("clipPath"),p=`clippath_${this.data.id}`;u.setAttribute("id",p),u.setAttribute("clipPathUnits","objectBoundingBox"),d.append(u);for(let f=2,g=t.length;f<g;f+=8){const s=t[f],i=t[f+1],r=t[f+2],c=t[f+3],d=l.createElement("rect"),p=(r-e)/o,g=(n-i)/h,m=(s-r)/o,v=(i-c)/h;d.setAttribute("x",p),d.setAttribute("y",g),d.setAttribute("width",m),d.setAttribute("height",v),u.append(d),a?.push(`<rect vector-effect="non-scaling-stroke" x="${p}" y="${g}" width="${m}" height="${v}"/>`)}this.#vi&&(a.push("</g></svg>')"),r.backgroundImage=a.join("")),this.container.append(c),this.container.style.clipPath=`url(#${p})`}_createPopup(){const{data:t}=this,e=this.#bi=new Os({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation},parent:this.parent,elements:[this]});this.parent.div.append(e.render())}render(){x("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const s=[];if(this._fieldObjects){const i=this._fieldObjects[t];if(i)for(const{page:t,id:n,exportValues:r}of i){if(-1===t)continue;if(n===e)continue;const i="string"==typeof r?r:null,a=document.querySelector(`[data-element-id="${n}"]`);!a||xs.has(a)?s.push({id:n,exportValue:i,domElement:a}):_(`_getElementsByName - element not allowed: ${n}`)}return s}for(const i of document.getElementsByName(t)){const{exportValue:t}=i,n=i.getAttribute("data-element-id");n!==e&&xs.has(i)&&s.push({id:n,exportValue:t,domElement:i})}return s}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 t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",(()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})}))}}class Rs extends Cs{constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!e?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:e}=this,s=document.createElement("a");s.setAttribute("data-element-id",t.id);let i=!1;return t.url?(e.addLinkAttributes(s,t.url,t.newWindow),i=!0):t.action?(this._bindNamedAction(s,t.action),i=!0):t.attachment?(this.#Ai(s,t.attachment,t.attachmentDest),i=!0):t.setOCGState?(this.#wi(s,t.setOCGState),i=!0):t.dest?(this._bindLink(s,t.dest),i=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(s,t),i=!0),t.resetForm?(this._bindResetFormAction(s,t.resetForm),i=!0):this.isTooltipOnly&&!i&&(this._bindLink(s,""),i=!0)),this.container.classList.add("linkA
2nnotation"),i&&this.container.append(s),this.container}#_i(){this.container.setAttribute("data-internal-link","")}_bindLink(t,e){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&this.#_i()}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),this.#_i()}#Ai(t,e,s=null){t.href=this.linkService.getAnchorUrl(""),e.description&&(t.title=e.description),t.onclick=()=>(this.downloadManager?.openOrDownloadData(e.content,e.filename,s),!1),this.#_i()}#wi(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),this.#_i()}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");const s=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const i of Object.keys(e.actions)){const n=s.get(i);n&&(t[n]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:i}}),!1))}t.onclick||(t.onclick=()=>!1),this.#_i()}_bindResetFormAction(t,e){const s=t.onclick;s||(t.href=this.linkService.getAnchorUrl("")),this.#_i(),this._fieldObjects?t.onclick=()=>{s?.();const{fields:t,refs:i,include:n}=e,r=[];if(0!==t.length||0!==i.length){const e=new Set(i);for(const s of t){const t=this._fieldObjects[s]||[];for(const{id:s}of t)e.add(s)}for(const t of Object.values(this._fieldObjects))for(const s of t)e.has(s.id)===n&&r.push(s)}else for(const e of Object.values(this._fieldObjects))r.push(...e);const a=this.annotationStorage,o=[];for(const e of r){const{id:t}=e;switch(o.push(t),e.type){case"text":{const s=e.defaultValue||"";a.setValue(t,{value:s});break}case"checkbox":case"radiobutton":{const s=e.defaultValue===e.exportValues;a.setValue(t,{value:s});break}case"combobox":case"listbox":{const s=e.defaultValue||"";a.setValue(t,{value:s});break}default:continue}const s=document.querySelector(`[data-element-id="${t}"]`);s&&(xs.has(s)?s.dispatchEvent(new Event("resetform")):_(`_bindResetFormAction - element not allowed: ${t}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}}),!1}:(_('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),s||(t.onclick=()=>!1))}}class Ts extends Cs{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class ks extends Cs{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&("CANVAS"===t.previousSibling?.nodeName&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return j.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,s,i,n){s.includes("mouse")?t.addEventListener(s,(t=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})})):t.addEventListener(s,(t=>{if("blur"===s){if(!e.focused||!t.relatedTarget)return;e.focused=!1}else if("focus"===s){if(e.focused)return;e.focused=!0}n&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(t)}})}))}_setEventListeners(t,e,s,i){for(const[n,r]of s)("Action"===r||this.data.actions?.[r])&&("Focus"!==r&&"Blur"!==r||(e||={focused:!1}),this._setEventListener(t,e,n,r,i),"Focus"!==r||this.data.actions?.Blur?"Blur"!==r||this.data.actions?.Focus||this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null))}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":H.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const{fontColor:e}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||9,i=t.style;let n;const r=t=>Math.round(10*t)/10;if(this.data.multiLine){const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),e=t/(Math.round(t/(c*s))||1);n=Math.min(s,r(e/c))}else{const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2);n=Math.min(s,r(t/c))}i.fontSize=`calc(${n}px * var(--scale-factor))`,i.color=H.makeHexColor(e[0],e[1],e[2]),null!==this.data.textAlignment&&(i.textAlign=["left","center","right"][this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class Ms extends ks{constructor(t){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,s,i){const n=this.annotationStorage;
2for(const r of this._getElementsByName(t.name,t.id))r.domElement&&(r.domElement[e]=s),n.setValue(r.id,{[i]:s})}render(){const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let s=null;if(this.renderForms){const i=t.getValue(e,{value:this.data.fieldValue});let n=i.value||"";const r=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;r&&n.length>r&&(n=n.slice(0,r));let a=i.formattedValue||this.data.textContent?.join("\n")||null;a&&this.data.comb&&(a=a.replaceAll(/\s+/g,""));const o={userValue:n,formattedValue:a,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=a??n,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type="text",s.setAttribute("value",a??n),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(s.hidden=!0),xs.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=_s,this._setRequired(s,this.data.required),r&&(s.maxLength=r),s.addEventListener("input",(i=>{t.setValue(e,{value:i.target.value}),this.setPropertyOnSiblings(s,"value",i.target.value,"value"),o.formattedValue=null})),s.addEventListener("resetform",(t=>{const e=this.data.defaultFieldValue??"";s.value=o.userValue=e,o.formattedValue=null}));let h=t=>{const{formattedValue:e}=o;null!=e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",(t=>{if(o.focused)return;const{target:e}=t;o.userValue&&(e.value=o.userValue),o.lastCommittedValue=e.value,o.commitKey=1,this.data.actions?.Focus||(o.focused=!0)})),s.addEventListener("updatefromsandbox",(s=>{this.showElementAndHideCanvas(s.target);const i={value(s){o.userValue=s.detail.value??"",t.setValue(e,{value:o.userValue.toString()}),s.target.value=o.userValue},formattedValue(s){const{formattedValue:i}=s.detail;o.formattedValue=i,null!=i&&s.target!==document.activeElement&&(s.target.value=i),t.setValue(e,{formattedValue:i})},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:s=>{const{charLimit:i}=s.detail,{target:n}=s;if(0===i)return void n.removeAttribute("maxLength");n.setAttribute("maxLength",i);let r=o.userValue;!r||r.length<=i||(r=r.slice(0,i),n.value=o.userValue=r,t.setValue(e,{value:r}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,willCommit:!0,commitKey:1,selStart:n.selectionStart,selEnd:n.selectionEnd}}))}};this._dispatchEventFromSandbox(i,s)})),s.addEventListener("keydown",(t=>{o.commitKey=1;let s=-1;if("Escape"===t.key?s=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(o.commitKey=3):s=2,-1===s)return;const{value:i}=t.target;o.lastCommittedValue!==i&&(o.lastCommittedValue=i,o.userValue=i,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:i,willCommit:!0,commitKey:s,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))}));const i=h;h=null,s.addEventListener("blur",(t=>{if(!o.focused||!t.relatedTarget)return;this.data.actions?.Blur||(o.focused=!1);const{value:s}=t.target;o.userValue=s,o.lastCommittedValue!==s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,willCommit:!0,commitKey:o.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}),i(t)})),this.data.actions?.Keystroke&&s.addEventListener("beforeinput",(t=>{o.lastCommittedValue=null;const{data:s,target:i}=t,{value:n,selectionStart:r,selectionEnd:a}=i;let h=r,l=a;switch(t.inputType){case"deleteWordBackward":{const t=n.substring(0,r).match(/\w*[^\w]*$/);t&&(h-=t[0].length);break}
2case"deleteWordForward":{const t=n.substring(r).match(/^[^\w]*\w*/);t&&(l+=t[0].length);break}case"deleteContentBackward":r===a&&(h-=1);break;case"deleteContentForward":r===a&&(l+=1)}t.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,change:s||"",willCommit:!1,selStart:h,selEnd:l}})})),this._setEventListeners(s,o,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(t=>t.target.value))}if(h&&s.addEventListener("blur",h),this.data.comb){const t=(this.data.rect[2]-this.data.rect[0])/r;s.classList.add("comb"),s.style.letterSpacing=`calc(${t}px * var(--scale-factor) - 1ch)`}}else s=document.createElement("div"),s.textContent=this.data.fieldValue,s.style.verticalAlign="middle",s.style.display="table-cell",this.data.hasOwnCanvas&&(s.hidden=!0);return this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Ps extends ks{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class Is extends ks{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.exportValue===e.fieldValue}).value;"string"==typeof i&&(i="Off"!==i,t.setValue(s,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const n=document.createElement("input");return xs.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=_s,n.addEventListener("change",(i=>{const{name:n,checked:r}=i.target;for(const a of this._getElementsByName(n,s)){const s=r&&a.exportValue===e.exportValue;a.domElement&&(a.domElement.checked=s),t.setValue(a.id,{value:s})}t.setValue(s,{value:r})})),n.addEventListener("resetform",(t=>{const s=e.defaultFieldValue||"Off";t.target.checked=s===e.exportValue})),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",(e=>{const i={value(e){e.target.checked="Off"!==e.detail.value,t.setValue(s,{value:e.target.checked})}};this._dispatchEventFromSandbox(i,e)})),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(t=>t.target.checked))),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Ls extends ks{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.fieldValue===e.buttonValue}).value;if("string"==typeof i&&(i=i!==e.buttonValue,t.setValue(s,{value:i})),i)for(const r of this._getElementsByName(e.fieldName,s))t.setValue(r.id,{value:!1});const n=document.createElement("input");if(xs.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.tabIndex=_s,n.addEventListener("change",(e=>{const{name:i,checked:n}=e.target;for(const r of this._getElementsByName(i,s))t.setValue(r.id,{value:!1});t.setValue(s,{value:n})})),n.addEventListener("resetform",(t=>{const s=e.defaultFieldValue;t.target.checked=null!=s&&s===e.buttonValue})),this.enableScripting&&this.hasJSActions){const i=e.buttonValue;n.addEventListener("updatefromsandbox",(e=>{const n={value:e=>{const n=i===e.detail.value;for(const i of this._getElementsByName(e.target.name)){const e=n&&i.id===s;i.domElement&&(i.domElement.checked=e),t.setValue(i.id,{value:e})}}};this._dispatchEventFromSandbox(n,e)})),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(t=>t.target.checked))}
2return this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Ds extends Rs{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",(t=>{this._dispatchEventFromSandbox({},t)}))),t}}class Fs extends ks{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,s=t.getValue(e,{value:this.data.fieldValue}),i=document.createElement("select");xs.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=_s;let n=this.data.combo&&this.data.options.length>0;this.data.combo||(i.size=this.data.options.length,this.data.multiSelect&&(i.multiple=!0)),i.addEventListener("resetform",(t=>{const e=this.data.defaultFieldValue;for(const s of i.options)s.selected=s.value===e}));for(const l of this.data.options){const t=document.createElement("option");t.textContent=l.displayValue,t.value=l.exportValue,s.value.includes(l.exportValue)&&(t.setAttribute("selected",!0),n=!1),i.append(t)}let r=null;if(n){const t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),i.prepend(t),r=()=>{t.remove(),i.removeEventListener("input",r),r=null},i.addEventListener("input",r)}const a=t=>{const e=t?"value":"textContent",{options:s,multiple:n}=i;return n?Array.prototype.filter.call(s,(t=>t.selected)).map((t=>t[e])):-1===s.selectedIndex?null:s[s.selectedIndex][e]};let o=a(!1);const h=t=>{const e=t.target.options;return Array.prototype.map.call(e,(t=>({displayValue:t.textContent,exportValue:t.value})))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",(s=>{const n={value(s){r?.();const n=s.detail.value,h=new Set(Array.isArray(n)?n:[n]);for(const t of i.options)t.selected=h.has(t.value);t.setValue(e,{value:a(!0)}),o=a(!1)},multipleSelection(t){i.multiple=!0},remove(s){const n=i.options,r=s.detail.remove;n[r].selected=!1,i.remove(r),n.length>0&&-1===Array.prototype.findIndex.call(n,(t=>t.selected))&&(n[0].selected=!0),t.setValue(e,{value:a(!0),items:h(s)}),o=a(!1)},clear(s){for(;0!==i.length;)i.remove(0);t.setValue(e,{value:null,items:[]}),o=a(!1)},insert(s){const{index:n,displayValue:r,exportValue:l}=s.detail.insert,c=i.children[n],d=document.createElement("option");d.textContent=r,d.value=l,c?c.before(d):i.append(d),t.setValue(e,{value:a(!0),items:h(s)}),o=a(!1)},items(s){const{items:n}=s.detail;for(;0!==i.length;)i.remove(0);for(const t of n){const{displayValue:e,exportValue:s}=t,n=document.createElement("option");n.textContent=e,n.value=s,i.append(n)}i.options.length>0&&(i.options[0].selected=!0),t.setValue(e,{value:a(!0),items:h(s)}),o=a(!1)},indices(s){const i=new Set(s.detail.indices);for(const t of s.target.options)t.selected=i.has(t.index);t.setValue(e,{value:a(!0)}),o=a(!1)},editable(t){t.target.disabled=!t.detail.editable}};this._dispatchEventFromSandbox(n,s)})),i.addEventListener("input",(s=>{const i=a(!0),n=a(!1);t.setValue(e,{value:i}),s.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,change:n,changeEx:i,willCommit:!1,commitKey:1,keyDown:!1}})})),this._setEventListeners(i,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(t=>t.target.value))):i.addEventListener("input",(function(s){t.setValue(e,{value:a(!0)})})),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Os extends Cs{constructor(t){const{data:e,elements:s}=t;super(t,{isRenderable:Cs._hasPopupData(e)}),this.elements=s,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new Ns({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,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}),e=[];for(const s of this.elements)s.popup=t,s.container.ariaHasPopup="dialog",e.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",e.map((t=>`${G}${t}`)).join(",")),this.container}}
2class Ns{#xi=this.#Ei.bind(this);#Si=this.#Ci.bind(this);#Ri=this.#Ti.bind(this);#ki=this.#Mi.bind(this);#Pi=null;#ut=null;#Ii=null;#Li=null;#Di=null;#Fi=null;#Oi=null;#Ni=!1;#ji=null;#C=null;#Bi=null;#Hi=null;#$i=null;#mi=null;#zi=!1;constructor({container:t,color:e,elements:s,titleObj:i,modificationDate:n,contentsObj:r,richText:a,parent:o,rect:h,parentRect:l,open:c}){this.#ut=t,this.#$i=i,this.#Ii=r,this.#Hi=a,this.#Fi=o,this.#Pi=e,this.#Bi=h,this.#Oi=l,this.#Di=s,this.#Li=nt.toDateObject(n),this.trigger=s.flatMap((t=>t.getElementsToTriggerPopup()));for(const d of this.trigger)d.addEventListener("click",this.#ki),d.addEventListener("mouseenter",this.#Ri),d.addEventListener("mouseleave",this.#Si),d.classList.add("popupTriggerArea");for(const d of s)d.container?.addEventListener("keydown",this.#xi);this.#ut.hidden=!0,c&&this.#Mi()}render(){if(this.#ji)return;const t=this.#ji=document.createElement("div");if(t.className="popup",this.#Pi){const e=t.style.outlineColor=H.makeHexColor(...this.#Pi);if(CSS.supports("background-color","color-mix(in srgb, red 30%, white)"))t.style.backgroundColor=`color-mix(in srgb, ${e} 30%, white)`;else{const e=.7;t.style.backgroundColor=H.makeHexColor(...this.#Pi.map((t=>Math.floor(e*(255-t)+t))))}}const e=document.createElement("span");e.className="header";const s=document.createElement("h1");if(e.append(s),({dir:s.dir,str:s.textContent}=this.#$i),t.append(e),this.#Li){const t=document.createElement("span");t.classList.add("popupDate"),t.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),t.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#Li.valueOf()})),e.append(t)}const i=this.#Ui;if(i)ws.render({xfaHtml:i,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const e=this._formatContents(this.#Ii);t.append(e)}this.#ut.append(t)}get#Ui(){const t=this.#Hi,e=this.#Ii;return!t?.str||e?.str&&e.str!==t.str?null:this.#Hi.html||null}get#Gi(){return this.#Ui?.attributes?.style?.fontSize||0}get#Vi(){return this.#Ui?.attributes?.style?.color||null}#Wi(t){const e=[],s={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},i={style:{color:this.#Vi,fontSize:this.#Gi?`calc(${this.#Gi}px * var(--scale-factor))`:""}};for(const n of t.split("\n"))e.push({name:"span",value:n,attributes:i});return s}_formatContents({str:t,dir:e}){const s=document.createElement("p");s.classList.add("popupContent"),s.dir=e;const i=t.split(/(?:\r\n?|\n)/);for(let n=0,r=i.length;n<r;++n){const t=i[n];s.append(document.createTextNode(t)),n<r-1&&s.append(document.createElement("br"))}return s}#Ei(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&this.#Ni)&&this.#Mi()}updateEdited({rect:t,popupContent:e}){this.#mi||={contentsObj:this.#Ii,richText:this.#Hi},t&&(this.#C=null),e&&(this.#Hi=this.#Wi(e),this.#Ii=null),this.#ji?.remove(),this.#ji=null}resetEdited(){this.#mi&&(({contentsObj:this.#Ii,richText:this.#Hi}=this.#mi),this.#mi=null,this.#ji?.remove(),this.#ji=null,this.#C=null)}#qi(){if(null!==this.#C)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:s,pageX:i,pageY:n}}}=this.#Fi;let r=!!this.#Oi,a=r?this.#Oi:this.#Bi;for(const u of this.#Di)if(!a||null!==H.intersect(u.data.rect,a)){a=u.data.rect,r=!0;break}const o=H.normalizeRect([a[0],t[3]-a[1]+t[1],a[2],t[3]-a[3]+t[1]]),h=r?a[2]-a[0]+5:0,l=o[0]+h,c=o[1];this.#C=[100*(l-i)/e,100*(c-n)/s];const{style:d}=this.#ut;d.left=`${this.#C[0]}%`,d.top=`${this.#C[1]}%`}#Mi(){this.#Ni=!this.#Ni,this.#Ni?(this.#Ti(),this.#ut.addEventListener("click",this.#ki),this.#ut.addEventListener("keydown",this.#xi)):(this.#Ci(),this.#ut.removeEventListener("click",this.#ki),this.#ut.removeEventListener("keydown",this.#xi))}#Ti(){this.#ji||this.render(),this.isVisible?this.#Ni&&this.#ut.classList.add("focused"):(this.#qi(),this.#ut.hidden=!1,this.#ut.style.zIndex=parseInt(this.#ut.style.zIndex)+1e3)}#Ci(){this.#ut.classList.remove("focused"),!this.#Ni&&this.isVisible&&(this.#ut.hidden=!0,this.#ut.style.zIndex=parseInt(this.#ut.style.zIndex)-1e3)}forceHide(){this.#zi=this.isVisible,this.#zi&&(this.#ut.hidden=!0)}maybeShow(){this.#zi&&(this.#ji||this.#Ti(),this.#zi=!1,this.#ut.hidden=!1)}get isVisible(){return!1===this.#ut.hidden}}class js extends Cs{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=u.FREETEXT}
2render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const s=document.createElement("span");s.textContent=e,t.append(s)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class Bs extends Cs{#Xi=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const t=this.data,{width:e,height:s}=Es(t.rect),i=this.svgFactory.create(e,s,!0),n=this.#Xi=this.svgFactory.createElement("svg:line");return n.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),n.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),n.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),n.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),n.setAttribute("stroke-width",t.borderStyle.width||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),i.append(n),this.container.append(i),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Xi}addHighlightArea(){this.container.classList.add("highlightArea")}}class Hs extends Cs{#Yi=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const t=this.data,{width:e,height:s}=Es(t.rect),i=this.svgFactory.create(e,s,!0),n=t.borderStyle.width,r=this.#Yi=this.svgFactory.createElement("svg:rect");return r.setAttribute("x",n/2),r.setAttribute("y",n/2),r.setAttribute("width",e-n),r.setAttribute("height",s-n),r.setAttribute("stroke-width",n||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),i.append(r),this.container.append(i),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Yi}addHighlightArea(){this.container.classList.add("highlightArea")}}class $s extends Cs{#Ki=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const t=this.data,{width:e,height:s}=Es(t.rect),i=this.svgFactory.create(e,s,!0),n=t.borderStyle.width,r=this.#Ki=this.svgFactory.createElement("svg:ellipse");return r.setAttribute("cx",e/2),r.setAttribute("cy",s/2),r.setAttribute("rx",e/2-n/2),r.setAttribute("ry",s/2-n/2),r.setAttribute("stroke-width",n||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),i.append(r),this.container.append(i),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Ki}addHighlightArea(){this.container.classList.add("highlightArea")}}class zs extends Cs{#Ji=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:e,borderStyle:s,popupRef:i}}=this;if(!e)return this.container;const{width:n,height:r}=Es(t),a=this.svgFactory.create(n,r,!0);let o=[];for(let l=0,c=e.length;l<c;l+=2){const s=e[l]-t[0],i=t[3]-e[l+1];o.push(`${s},${i}`)}o=o.join(" ");const h=this.#Ji=this.svgFactory.createElement(this.svgElementName);return h.setAttribute("points",o),h.setAttribute("stroke-width",s.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),a.append(h),this.container.append(a),!i&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Ji}addHighlightArea(){this.container.classList.add("highlightArea")}}class Us extends zs{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Gs extends Cs{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class Vs extends Cs{#Zi=[];constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?u.HIGHLIGHT:u.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,inkLists:e,borderStyle:s,popupRef:i}}=this,{width:n,height:r}=Es(t),a=this.svgFactory.create(n,r,!0);for(const o of e){let e=[];for(let s=0,n=o.length;s<n;s+=2){const i=o[s]-t[0],n=t[3]-o[s+1];e.push(`${i},${n}`)}e=e.join(" ");const i=this.svgFactory.createElement(this.svgElementName);this.#Zi.push(i),i.setAttribute("points",e),i.setAttribute("stroke-width",s.width||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),a.append(i)}return!i&&this.hasPopupData&&this._createPopup(),this.container.append(a),this._editOnDoubleClick(),this.container}getElementsToTriggerPopup(){return this.#Zi}addHighlightArea(){this.container.classList.add("highlightArea")}}class Ws extends Cs{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=u.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}
2class qs extends Cs{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class Xs extends Cs{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class Ys extends Cs{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class Ks extends Cs{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=u.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class Js extends Cs{#Qi=null;constructor(t){super(t,{isRenderable:!0});const{file:e}=this.data;this.filename=e.filename,this.content=e.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...e})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:e}=this;let s;e.hasAppearance||0===e.fillAlpha?s=document.createElement("div"):(s=document.createElement("img"),s.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(e.name)?"paperclip":"pushpin"}.svg`,e.fillAlpha&&e.fillAlpha<1&&(s.style=`filter: opacity(${Math.round(100*e.fillAlpha)}%);`)),s.addEventListener("dblclick",this.#tn.bind(this)),this.#Qi=s;const{isMac:i}=j.platform;return t.addEventListener("keydown",(t=>{"Enter"===t.key&&(i?t.metaKey:t.ctrlKey)&&this.#tn()})),!e.popupRef&&this.hasPopupData?this._createPopup():s.classList.add("popupTriggerArea"),t.append(s),t}getElementsToTriggerPopup(){return this.#Qi}addHighlightArea(){this.container.classList.add("highlightArea")}#tn(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class Zs{#en=null;#sn=null;#in=new Map;#nn=null;constructor({div:t,accessibilityManager:e,annotationCanvasMap:s,annotationEditorUIManager:i,page:n,viewport:r,structTreeLayer:a}){this.div=t,this.#en=e,this.#sn=s,this.#nn=a||null,this.page=n,this.viewport=r,this.zIndex=0,this._annotationEditorUIManager=i}hasEditableAnnotations(){return this.#in.size>0}async#rn(t,e){const s=t.firstChild||t,i=s.id=`${G}${e}`,n=await(this.#nn?.getAriaAttributes(i));if(n)for(const[r,a]of n)s.setAttribute(r,a);this.div.append(t),this.#en?.moveElementInDOM(this.div,t,s,!1)}async render(t){const{annotations:e}=t,s=this.div;lt(s,this.viewport);const i=new Map,n={data:null,layer:s,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new As,annotationStorage:t.annotationStorage||new Tt,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const r of e){if(r.noHTML)continue;const t=16===r.annotationType;if(t){const t=i.get(r.id);if(!t)continue;n.elements=t}else{const{width:t,height:e}=Es(r.rect);if(t<=0||e<=0)continue}n.data=r;const e=Ss.create(n);if(!e.isRenderable)continue;if(!t&&r.popupRef){const t=i.get(r.popupRef);t?t.push(e):i.set(r.popupRef,[e])}const s=e.render();r.hidden&&(s.style.visibility="hidden"),await this.#rn(s,r.id),e._isEditable&&(this.#in.set(e.data.id,e),this._annotationEditorUIManager?.renderAnnotationElement(e))}this.#an()}update({viewport:t}){const e=this.div;this.viewport=t,lt(e,{rotation:t.rotation}),this.#an(),e.hidden=!1}#an(){if(!this.#sn)return;const t=this.div;for(const[e,s]of this.#sn){const i=t.querySelector(`[data-annotation-id="${e}"]`);if(!i)continue;s.className="annotationContent";const{firstChild:n}=i;n?"CANVAS"===n.nodeName?n.replaceWith(s):n.classList.contains("annotationContent")?n.after(s):n.before(s):i.append(s)}this.#sn.clear()}getEditableAnnotations(){return Array.from(this.#in.values())}getEditableAnnotation(t){return this.#in.get(t)}}const Qs=/\r\n?|\n/g;class ti extends wt{#Pi;#on="";#hn=`${this.id}-editor`;#ln=null;#Gi;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const t=ti.prototype,e=t=>t.isEmpty(),s=yt.TRANSLATE_SMALL,i=yt.TRANSLATE_BIG;return C(this,"_keyboardManager",new vt([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-s,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[s,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-s],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,s],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}]]))}static _type="freetext";static _editorType=u.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.#Pi=t.color||ti._defaultColor||wt._defaultLineColor,this.#Gi=t.fontSize||ti._defaultFontSize}static initialize(t,e){wt.initialize(t,e);const s=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(s.getPropertyValue("--freetext-padding"))}
vendor: 4,681 bytes, line 2
2static updateDefaultParams(t,e){switch(t){case p.FREETEXT_SIZE:ti._defaultFontSize=e;break;case p.FREETEXT_COLOR:ti._defaultColor=e}}updateParams(t,e){switch(t){case p.FREETEXT_SIZE:this.#cn(e);break;case p.FREETEXT_COLOR:this.#dn(e)}}static get defaultPropertiesToUpdate(){return[[p.FREETEXT_SIZE,ti._defaultFontSize],[p.FREETEXT_COLOR,ti._defaultColor||wt._defaultLineColor]]}get propertiesToUpdate(){return[[p.FREETEXT_SIZE,this.#Gi],[p.FREETEXT_COLOR,this.#Pi]]}#cn(t){const e=t=>{this.editorDiv.style.fontSize=`calc(${t}px * var(--scale-factor))`,this.translate(0,-(t-this.#Gi)*this.parentScale),this.#Gi=t,this.#un()},s=this.#Gi;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:p.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#dn(t){const e=t=>{this.#Pi=this.editorDiv.style.color=t},s=this.#Pi;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:p.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){const t=this.parentScale;return[-ti._internalPadding*t,-(ti._internalPadding+this.#Gi)*t]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(u.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.#ln=new AbortController;const t=this._uiManager.combinedSignal(this.#ln);this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t})}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#hn),this._isDraggable=!0,this.#ln?.abort(),this.#ln=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){this.width||(this.enableEditMode(),this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}#pn(){const t=[];this.editorDiv.normalize();let e=null;for(const s of this.editorDiv.childNodes)e?.nodeType===Node.TEXT_NODE&&"BR"===s.nodeName||(t.push(ti.#fn(s)),e=s);return t.join("\n")}#un(){const[t,e]=this.parentDimensions;let s;if(this.isAttachedToDOM)s=this.div.getBoundingClientRect();else{const{currentLayer:t,div:e}=this,i=e.style.display,n=e.classList.contains("hidden");e.classList.remove("hidden"),e.style.display="hidden",t.div.append(this.div),s=e.getBoundingClientRect(),e.remove(),e.style.display=i,e.classList.toggle("hidden",n)}this.rotation%180==this.parentRotation%180?(this.width=s.width/t,this.height=s.height/e):(this.width=s.height/t,this.height=s.width/e),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=this.#on,e=this.#on=this.#pn().trimEnd();if(t===e)return;const s=t=>{this.#on=t,t?(this.#gn(),this._uiManager.rebuild(this),this.#un()):this.remove()};this.addCommands({cmd:()=>{s(e)},undo:()=>{s(t)},mustExec:!1}),this.#un()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(t){this.enterInEditMode()}keydown(t){t.target===this.div&&"Enter"===t.key&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){ti._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}
2render(){if(this.div)return this.div;let t,e;this.width&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#hn),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:s}=this.editorDiv;if(s.fontSize=`calc(${this.#Gi}px * var(--scale-factor))`,s.color=this.#Pi,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),pt(this,this.div,["dblclick","keydown"]),this.width){const[s,i]=this.parentDimensions;if(this.annotationElementId){const{position:n}=this._initialData;let[r,a]=this.getInitialTranslation();[r,a]=this.pageTranslationToScreen(r,a);const[o,h]=this.pageDimensions,[l,c]=this.pageTranslation;let d,u;switch(this.rotation){case 0:d=t+(n[0]-l)/o,u=e+this.height-(n[1]-c)/h;break;case 90:d=t+(n[0]-l)/o,u=e-(n[1]-c)/h,[r,a]=[a,-r];break;case 180:d=t-this.width+(n[0]-l)/o,u=e-(n[1]-c)/h,[r,a]=[-r,-a];break;case 270:d=t+(n[0]-l-this.height*h)/o,u=e+(n[1]-c-this.width*o)/h,[r,a]=[-a,r]}this.setAt(d*s,u*i,r,a)}else this.setAt(t*s,e*i,this.width*s,this.height*i);this.#gn(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#fn(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(Qs,"")}editorDivPaste(t){const e=t.clipboardData||window.clipboardData,{types:s}=e;if(1===s.length&&"text/plain"===s[0])return;t.preventDefault();const i=ti.#mn(e.getData("text")||"").replaceAll(Qs,"\n");if(!i)return;const n=window.getSelection();if(!n.rangeCount)return;this.editorDiv.normalize(),n.deleteFromDocument();const r=n.getRangeAt(0);if(!i.includes("\n"))return r.insertNode(document.createTextNode(i)),this.editorDiv.normalize(),void n.collapseToStart();const{startContainer:a,startOffset:o}=r,h=[],l=[];if(a.nodeType===Node.TEXT_NODE){const t=a.parentElement;if(l.push(a.nodeValue.slice(o).replaceAll(Qs,"")),t!==this.editorDiv){let e=h;for(const s of this.editorDiv.childNodes)s!==t?e.push(ti.#fn(s)):e=l}h.push(a.nodeValue.slice(0,o).replaceAll(Qs,""))}else if(a===this.editorDiv){let t=h,e=0;for(const s of this.editorDiv.childNodes)e++===o&&(t=l),t.push(ti.#fn(s))}this.#on=`${h.join("\n")}${i}${l.join("\n")}`,this.#gn();const c=new Range;let d=h.reduce(((t,e)=>t+e.length),0);for(const{firstChild:u}of this.editorDiv.childNodes)if(u.nodeType===Node.TEXT_NODE){const t=u.nodeValue.length;if(d<=t){c.setStart(u,d),c.setEnd(u,d);break}d-=t}n.removeAllRanges(),n.addRange(c)}#gn(){if(this.editorDiv.replaceChildren(),this.#on)for(const t of this.#on.split("\n")){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#vn(){return this.#on.replaceAll("\xa0"," ")}static#mn(t){return t.replaceAll(" ","\xa0")}get contentDiv(){return this.editorDiv}static async deserialize(t,e,s){let i=null;if(t instanceof js){const{data:{defaultAppearanceData:{fontSize:e,fontColor:s},rect:n,rotation:r,id:a,popupRef:o},textContent:h,textPosition:l,parent:{page:{pageNumber:c}}}=t;if(!h||0===h.length)return null;i=t={annotationType:u.FREETEXT,color:Array.from(s),fontSize:e,value:h.join("\n"),position:l,pageIndex:c-1,rect:n.slice(0),rotation:r,id:a,deleted:!1,popupRef:o}}const n=await super.deserialize(t,e,s);return n.#Gi=t.fontSize,n.#Pi=H.makeHexColor(...t.color),n.#on=ti.#mn(t.value),n.annotationElementId=t.id||null,n._initialData=i,n}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const e=ti._internalPadding*this.parentScale,s=this.getRect(e,e),i=wt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#Pi),n={annotationType:u.FREETEXT,color:i,fontSize:this.#Gi,value:this.#vn(),pageIndex:this.pageIndex,rect:s,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?n:this.annotationElementId&&!this.#bn(n)?null:(n.id=this.annotationElementId,n)}#bn(t){const{value:e,fontSize:s,color:i,pageIndex:n}=this._initialData;return this._hasBeenMoved||t.value!==e||t.fontSize!==s||t.color.some(((t,e)=>t!==i[e]))||t.pageIndex!==n}renderAnnotationElement(t){const e=super.renderAnnotationElement(t);if(this.deleted)return e;const{style:s}=e;s.fontSize=`calc(${this.#Gi}px * var(--scale-factor))`,s.color=this.#Pi,e.replaceChildren();for(const n of this.#on.split("\n")){const t=document.createElement("div");t.append(n?document.createTextNode(n):document.createElement("br")),e.append(t)}const i=ti._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(i,i),popupContent:this.#on}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}class ei{toSVGPath(){x("Abstract method `toSVGPath` must be implemented.")}get box(){x("Abstract getter `box` must be implemented.")}serialize(t,e){x("Abstract method `serialize` must be implemented.")}get classNamesForDrawing(){x("Abstract getter `classNamesForDrawing` must be implemented.")}get classNamesForOutlining(){x("Abstract getter `classNamesForOutlining` must be implemented.")}get mustRemoveSelfIntersections(){return!1}}class si{#yn;#An=[];#wn;#_n;#xn=[];#En=new Float64Array(18);#Sn;#Cn;#Rn;#Tn;#kn;#Mn;#Pn=[];static#In=8;static#Ln=2;static#Dn=si.#In+si.#Ln;constructor({x:t,y:e}
vendor: 1,787 bytes, line 2
2,s,i,n,r,a=0){this.#yn=s,this.#Mn=n*i,this.#_n=r,this.#En.set([NaN,NaN,NaN,NaN,t,e],6),this.#wn=a,this.#Tn=si.#In*i,this.#Rn=si.#Dn*i,this.#kn=i,this.#Pn.push(t,e)}isEmpty(){return isNaN(this.#En[8])}#Fn(){const t=this.#En.subarray(4,6),e=this.#En.subarray(16,18),[s,i,n,r]=this.#yn;return[(this.#Sn+(t[0]-e[0])/2-s)/n,(this.#Cn+(t[1]-e[1])/2-i)/r,(this.#Sn+(e[0]-t[0])/2-s)/n,(this.#Cn+(e[1]-t[1])/2-i)/r]}add({x:t,y:e}){this.#Sn=t,this.#Cn=e;const[s,i,n,r]=this.#yn;let[a,o,h,l]=this.#En.subarray(8,12);const c=t-h,d=e-l,u=Math.hypot(c,d);if(u<this.#Rn)return!1;const p=u-this.#Tn,f=p/u,g=f*c,m=f*d;let v=a,b=o;a=h,o=l,h+=g,l+=m,this.#Pn?.push(t,e);const y=g/p,A=-m/p*this.#Mn,w=y*this.#Mn;return this.#En.set(this.#En.subarray(2,8),0),this.#En.set([h+A,l+w],4),this.#En.set(this.#En.subarray(14,18),12),this.#En.set([h-A,l-w],16),isNaN(this.#En[6])?(0===this.#xn.length&&(this.#En.set([a+A,o+w],2),this.#xn.push(NaN,NaN,NaN,NaN,(a+A-s)/n,(o+w-i)/r),this.#En.set([a-A,o-w],14),this.#An.push(NaN,NaN,NaN,NaN,(a-A-s)/n,(o-w-i)/r)),this.#En.set([v,b,a,o,h,l],6),!this.isEmpty()):(this.#En.set([v,b,a,o,h,l],6),Math.abs(Math.atan2(b-o,v-a)-Math.atan2(m,g))<Math.PI/2?([a,o,h,l]=this.#En.subarray(2,6),this.#xn.push(NaN,NaN,NaN,NaN,((a+h)/2-s)/n,((o+l)/2-i)/r),[a,o,v,b]=this.#En.subarray(14,18),this.#An.push(NaN,NaN,NaN,NaN,((v+a)/2-s)/n,((b+o)/2-i)/r),!0):([v,b,a,o,h,l]=this.#En.subarray(0,6),this.#xn.push(((v+5*a)/6-s)/n,((b+5*o)/6-i)/r,((5*a+h)/6-s)/n,((5*o+l)/6-i)/r,((a+h)/2-s)/n,((o+l)/2-i)/r),[h,l,a,o,v,b]=this.#En.subarray(12,18),this.#An.push(((v+5*a)/6-s)/n,((b+5*o)/6-i)/r,((5*a+h)/6-s)/n,((5*o+l)/6-i)/r,((a+h)/2-s)/n,((o+l)/2-i)/r),!0))}toSVGPath(){if(this.isEmpty())return"";const t=this.#xn,e=this.#An;if(isNaN(this.#En[6])&&!this.isEmpty())return this.#On();const s=[];
2s.push(`M${t[4]} ${t[5]}`);for(let i=6;i<t.length;i+=6)isNaN(t[i])?s.push(`L${t[i+4]} ${t[i+5]}`):s.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);this.#Nn(s);for(let i=e.length-6;i>=6;i-=6)isNaN(e[i])?s.push(`L${e[i+4]} ${e[i+5]}`):s.push(`C${e[i]} ${e[i+1]} ${e[i+2]} ${e[i+3]} ${e[i+4]} ${e[i+5]}`);return this.#jn(s),s.join(" ")}#On(){const[t,e,s,i]=this.#yn,[n,r,a,o]=this.#Fn();return`M${(this.#En[2]-t)/s} ${(this.#En[3]-e)/i} L${(this.#En[4]-t)/s} ${(this.#En[5]-e)/i} L${n} ${r} L${a} ${o} L${(this.#En[16]-t)/s} ${(this.#En[17]-e)/i} L${(this.#En[14]-t)/s} ${(this.#En[15]-e)/i} Z`}#jn(t){const e=this.#An;t.push(`L${e[4]} ${e[5]} Z`)}#Nn(t){const[e,s,i,n]=this.#yn,r=this.#En.subarray(4,6),a=this.#En.subarray(16,18),[o,h,l,c]=this.#Fn();t.push(`L${(r[0]-e)/i} ${(r[1]-s)/n} L${o} ${h} L${l} ${c} L${(a[0]-e)/i} ${(a[1]-s)/n}`)}newFreeDrawOutline(t,e,s,i,n,r){return new ii(t,e,s,i,n,r)}getOutlines(){const t=this.#xn,e=this.#An,s=this.#En,[i,n,r,a]=this.#yn,o=new Float64Array((this.#Pn?.length??0)+2);for(let c=0,d=o.length-2;c<d;c+=2)o[c]=(this.#Pn[c]-i)/r,o[c+1]=(this.#Pn[c+1]-n)/a;if(o[o.length-2]=(this.#Sn-i)/r,o[o.length-1]=(this.#Cn-n)/a,isNaN(s[6])&&!this.isEmpty())return this.#Bn(o);const h=new Float64Array(this.#xn.length+24+this.#An.length);let l=t.length;for(let c=0;c<l;c+=2)isNaN(t[c])?h[c]=h[c+1]=NaN:(h[c]=t[c],h[c+1]=t[c+1]);l=this.#Hn(h,l);for(let c=e.length-6;c>=6;c-=6)for(let t=0;t<6;t+=2)isNaN(e[c+t])?(h[l]=h[l+1]=NaN,l+=2):(h[l]=e[c+t],h[l+1]=e[c+t+1],l+=2);return this.#$n(h,l),this.newFreeDrawOutline(h,o,this.#yn,this.#kn,this.#wn,this.#_n)}#Bn(t){const e=this.#En,[s,i,n,r]=this.#yn,[a,o,h,l]=this.#Fn(),c=new Float64Array(36);return c.set([NaN,NaN,NaN,NaN,(e[2]-s)/n,(e[3]-i)/r,NaN,NaN,NaN,NaN,(e[4]-s)/n,(e[5]-i)/r,NaN,NaN,NaN,NaN,a,o,NaN,NaN,NaN,NaN,h,l,NaN,NaN,NaN,NaN,(e[16]-s)/n,(e[17]-i)/r,NaN,NaN,NaN,NaN,(e[14]-s)/n,(e[15]-i)/r],0),this.newFreeDrawOutline(c,t,this.#yn,this.#kn,this.#wn,this.#_n)}#$n(t,e){const s=this.#An;return t.set([NaN,NaN,NaN,NaN,s[4],s[5]],e),e+6}#Hn(t,e){const s=this.#En.subarray(4,6),i=this.#En.subarray(16,18),[n,r,a,o]=this.#yn,[h,l,c,d]=this.#Fn();return t.set([NaN,NaN,NaN,NaN,(s[0]-n)/a,(s[1]-r)/o,NaN,NaN,NaN,NaN,h,l,NaN,NaN,NaN,NaN,c,d,NaN,NaN,NaN,NaN,(i[0]-n)/a,(i[1]-r)/o],e),e+24}}class ii extends ei{#yn;#zn=null;#wn;#_n;#Pn;#kn;#Un;constructor(t,e,s,i,n,r){super(),this.#Un=t,this.#Pn=e,this.#yn=s,this.#kn=i,this.#wn=n,this.#_n=r,this.#Gn(r);const{x:a,y:o,width:h,height:l}=this.#zn;for(let c=0,d=t.length;c<d;c+=2)t[c]=(t[c]-a)/h,t[c+1]=(t[c+1]-o)/l;for(let c=0,d=e.length;c<d;c+=2)e[c]=(e[c]-a)/h,e[c+1]=(e[c+1]-o)/l}toSVGPath(){const t=[`M${this.#Un[4]} ${this.#Un[5]}`];for(let e=6,s=this.#Un.length;e<s;e+=6)isNaN(this.#Un[e])?t.push(`L${this.#Un[e+4]} ${this.#Un[e+5]}`):t.push(`C${this.#Un[e]} ${this.#Un[e+1]} ${this.#Un[e+2]} ${this.#Un[e+3]} ${this.#Un[e+4]} ${this.#Un[e+5]}`);return t.push("Z"),t.join(" ")}serialize([t,e,s,i],n){const r=s-t,a=i-e;let o,h;switch(n){case 0:o=this.#Vn(this.#Un,t,i,r,-a),h=this.#Vn(this.#Pn,t,i,r,-a);break;case 90:o=this.#Wn(this.#Un,t,e,r,a),h=this.#Wn(this.#Pn,t,e,r,a);break;case 180:o=this.#Vn(this.#Un,s,e,-r,a),h=this.#Vn(this.#Pn,s,e,-r,a);break;case 270:o=this.#Wn(this.#Un,s,i,-r,-a),h=this.#Wn(this.#Pn,s,i,-r,-a)}return{outline:Array.from(o),points:[Array.from(h)]}}#Vn(t,e,s,i,n){const r=new Float64Array(t.length);for(let a=0,o=t.length;a<o;a+=2)r[a]=e+t[a]*i,r[a+1]=s+t[a+1]*n;return r}#Wn(t,e,s,i,n){const r=new Float64Array(t.length);for(let a=0,o=t.length;a<o;a+=2)r[a]=e+t[a+1]*i,r[a+1]=s+t[a]*n;return r}#Gn(t){const e=this.#Un;let s=e[4],i=e[5],n=s,r=i,a=s,o=i,h=s,l=i;const c=t?Math.max:Math.min;for(let g=6,m=e.length;g<m;g+=6){if(isNaN(e[g]))n=Math.min(n,e[g+4]),r=Math.min(r,e[g+5]),a=Math.max(a,e[g+4]),o=Math.max(o,e[g+5]),l<e[g+5]?(h=e[g+4],l=e[g+5]):l===e[g+5]&&(h=c(h,e[g+4]));else{const t=H.bezierBoundingBox(s,i,...e.slice(g,g+6));n=Math.min(n,t[0]),r=Math.min(r,t[1]),a=Math.max(a,t[2]),o=Math.max(o,t[3]),l<t[3]?(h=t[2],l=t[3]):l===t[3]&&(h=c(h,t[2]))}s=e[g+4],i=e[g+5]}const d=n-this.#wn,u=r-this.#wn,p=a-n+2*this.#wn,f=o-r+2*this.#wn;this.#zn={x:d,y:u,width:p,height:f,lastPoint:[h,l]}}get box(){return this.#zn}newOutliner(t,e,s,i,n,r=0){return new si(t,e,s,i,n,r)}getNewOutline(t,e){const{x:s,y:i,width:n,height:r}=this.#zn,[a,o,h,l]=this.#yn,c=n*h,d=r*l,u=s*h+a,p=i*l+o,f=this.newOutliner({x:this.#Pn[
20]*c+u,y:this.#Pn[1]*d+p},this.#yn,this.#kn,t,this.#_n,e??this.#wn);for(let g=2;g<this.#Pn.length;g+=2)f.add({x:this.#Pn[g]*c+u,y:this.#Pn[g+1]*d+p});return f.getOutlines()}get mustRemoveSelfIntersections(){return!0}}class ni{#yn;#qn=[];#Xn=[];constructor(t,e=0,s=0,i=!0){let n=1/0,r=-1/0,a=1/0,o=-1/0;const h=1e-4;for(const{x:g,y:m,width:v,height:b}of t){const t=Math.floor((g-e)/h)*h,s=Math.ceil((g+v+e)/h)*h,i=Math.floor((m-e)/h)*h,l=Math.ceil((m+b+e)/h)*h,c=[t,i,l,!0],d=[s,i,l,!1];this.#qn.push(c,d),n=Math.min(n,t),r=Math.max(r,s),a=Math.min(a,i),o=Math.max(o,l)}const l=r-n+2*s,c=o-a+2*s,d=n-s,u=a-s,p=this.#qn.at(i?-1:-2),f=[p[0],p[2]];for(const g of this.#qn){const[t,e,s]=g;g[0]=(t-d)/l,g[1]=(e-u)/c,g[2]=(s-u)/c}this.#yn={x:d,y:u,width:l,height:c,lastPoint:f}}getOutlines(){this.#qn.sort(((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]));const t=[];for(const e of this.#qn)e[3]?(t.push(...this.#Yn(e)),this.#Kn(e)):(this.#Jn(e),t.push(...this.#Yn(e)));return this.#Zn(t)}#Zn(t){const e=[],s=new Set;for(const r of t){const[t,s,i]=r;e.push([t,s,r],[t,i,r])}e.sort(((t,e)=>t[1]-e[1]||t[0]-e[0]));for(let r=0,a=e.length;r<a;r+=2){const t=e[r][2],i=e[r+1][2];t.push(i),i.push(t),s.add(t),s.add(i)}const i=[];let n;for(;s.size>0;){const t=s.values().next().value;let[e,r,a,o,h]=t;s.delete(t);let l=e,c=r;for(n=[e,a],i.push(n);;){let t;if(s.has(o))t=o;else{if(!s.has(h))break;t=h}s.delete(t),[e,r,a,o,h]=t,l!==e&&(n.push(l,c,e,c===r?r:a),l=e),c=c===r?a:r}n.push(l,c)}return new ri(i,this.#yn)}#Qn(t){const e=this.#Xn;let s=0,i=e.length-1;for(;s<=i;){const n=s+i>>1,r=e[n][0];if(r===t)return n;r<t?s=n+1:i=n-1}return i+1}#Kn([,t,e]){const s=this.#Qn(t);this.#Xn.splice(s,0,[t,e])}#Jn([,t,e]){const s=this.#Qn(t);for(let i=s;i<this.#Xn.length;i++){const[s,n]=this.#Xn[i];if(s!==t)break;if(s===t&&n===e)return void this.#Xn.splice(i,1)}for(let i=s-1;i>=0;i--){const[s,n]=this.#Xn[i];if(s!==t)break;if(s===t&&n===e)return void this.#Xn.splice(i,1)}}#Yn(t){const[e,s,i]=t,n=[[e,s,i]],r=this.#Qn(i);for(let a=0;a<r;a++){const[t,s]=this.#Xn[a];for(let i=0,r=n.length;i<r;i++){const[,a,o]=n[i];if(!(s<=a||o<=t))if(a>=t)if(o>s)n[i][1]=s;else{if(1===r)return[];n.splice(i,1),i--,r--}else n[i][2]=t,o>s&&n.push([e,s,o])}}return n}}class ri extends ei{#yn;#tr;constructor(t,e){super(),this.#tr=t,this.#yn=e}toSVGPath(){const t=[];for(const e of this.#tr){let[s,i]=e;t.push(`M${s} ${i}`);for(let n=2;n<e.length;n+=2){const r=e[n],a=e[n+1];r===s?(t.push(`V${a}`),i=a):a===i&&(t.push(`H${r}`),s=r)}t.push("Z")}return t.join(" ")}serialize([t,e,s,i],n){const r=[],a=s-t,o=i-e;for(const h of this.#tr){const e=new Array(h.length);for(let s=0;s<h.length;s+=2)e[s]=t+h[s]*a,e[s+1]=i-h[s+1]*o;r.push(e)}return r}get box(){return this.#yn}get classNamesForDrawing(){return["highlight"]}get classNamesForOutlining(){return["highlightOutline"]}}class ai extends si{newFreeDrawOutline(t,e,s,i,n,r){return new oi(t,e,s,i,n,r)}get classNamesForDrawing(){return["highlight","free"]}}class oi extends ii{get classNamesForDrawing(){return["highlight","free"]}get classNamesForOutlining(){return["highlightOutline","free"]}newOutliner(t,e,s,i,n,r=0){return new ai(t,e,s,i,n,r)}}class hi{#er=null;#sr=null;#ir;#nr=null;#rr=!1;#ar=!1;#r=null;#or;#hr=null;#g=null;#lr;static#cr=null;static get _keyboardManager(){return C(this,"_keyboardManager",new vt([[["Escape","mac+Escape"],hi.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],hi.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],hi.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],hi.prototype._moveToPrevious],[["Home","mac+Home"],hi.prototype._moveToBeginning],[["End","mac+End"],hi.prototype._moveToEnd]]))}constructor({editor:t=null,uiManager:e=null}){t?(this.#ar=!1,this.#lr=p.HIGHLIGHT_COLOR,this.#r=t):(this.#ar=!0,this.#lr=p.HIGHLIGHT_DEFAULT_COLOR),this.#g=t?._uiManager||e,this.#or=this.#g._eventBus,this.#ir=t?.color||this.#g?.highlightColors.values().next().value||"#FFFF98",hi.#cr||=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 t=this.#er=document.createElement("button");
2t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0);const e=this.#g._signal;t.addEventListener("click",this.#dr.bind(this),{signal:e}),t.addEventListener("keydown",this.#Ei.bind(this),{signal:e});const s=this.#sr=document.createElement("span");return s.className="swatch",s.setAttribute("aria-hidden",!0),s.style.backgroundColor=this.#ir,t.append(s),t}renderMainDropdown(){const t=this.#nr=this.#ur();return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}#ur(){const t=document.createElement("div"),e=this.#g._signal;t.addEventListener("contextmenu",st,{signal:e}),t.className="dropdown",t.role="listbox",t.setAttribute("aria-multiselectable",!1),t.setAttribute("aria-orientation","vertical"),t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[s,i]of this.#g.highlightColors){const n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",i),n.title=s,n.setAttribute("data-l10n-id",hi.#cr[s]);const r=document.createElement("span");n.append(r),r.className="swatch",r.style.backgroundColor=i,n.setAttribute("aria-selected",i===this.#ir),n.addEventListener("click",this.#pr.bind(this,i),{signal:e}),t.append(n)}return t.addEventListener("keydown",this.#Ei.bind(this),{signal:e}),t}#pr(t,e){e.stopPropagation(),this.#or.dispatch("switchannotationeditorparams",{source:this,type:this.#lr,value:t})}_colorSelectFromKeyboard(t){if(t.target===this.#er)return void this.#dr(t);const e=t.target.getAttribute("data-color");e&&this.#pr(e,t)}_moveToNext(t){this.#fr?t.target!==this.#er?t.target.nextSibling?.focus():this.#nr.firstChild?.focus():this.#dr(t)}_moveToPrevious(t){t.target!==this.#nr?.firstChild&&t.target!==this.#er?(this.#fr||this.#dr(t),t.target.previousSibling?.focus()):this.#fr&&this._hideDropdownFromKeyboard()}_moveToBeginning(t){this.#fr?this.#nr.firstChild?.focus():this.#dr(t)}_moveToEnd(t){this.#fr?this.#nr.lastChild?.focus():this.#dr(t)}#Ei(t){hi._keyboardManager.exec(this,t)}#dr(t){if(this.#fr)return void this.hideDropdown();if(this.#rr=0===t.detail,this.#hr||(this.#hr=new AbortController,window.addEventListener("pointerdown",this.#l.bind(this),{signal:this.#g.combinedSignal(this.#hr)})),this.#nr)return void this.#nr.classList.remove("hidden");const e=this.#nr=this.#ur();this.#er.append(e)}#l(t){this.#nr?.contains(t.target)||this.hideDropdown()}hideDropdown(){this.#nr?.classList.add("hidden"),this.#hr?.abort(),this.#hr=null}get#fr(){return this.#nr&&!this.#nr.classList.contains("hidden")}_hideDropdownFromKeyboard(){this.#ar||(this.#fr?(this.hideDropdown(),this.#er.focus({preventScroll:!0,focusVisible:this.#rr})):this.#r?.unselect())}updateColor(t){if(this.#sr&&(this.#sr.style.backgroundColor=t),!this.#nr)return;const e=this.#g.highlightColors.values();for(const s of this.#nr.children)s.setAttribute("aria-selected",e.next().value===t)}destroy(){this.#er?.remove(),this.#er=null,this.#sr=null,this.#nr?.remove(),this.#nr=null}}class li extends wt{#gr=null;#mr=0;#vr;#br=null;#n=null;#yr=null;#Ar=null;#wr=0;#_r=null;#xr=null;#y=null;#Er=!1;#Sr=null;#Cr;#Rr=null;#Tr="";#Mn;#kr="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=u.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){const t=li.prototype;return C(this,"_keyboardManager",new vt([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super({...t,name:"highlightEditor"}),this.color=t.color||li._defaultColor,this.#Mn=t.thickness||li._defaultThickness,this.#Cr=t.opacity||li._defaultOpacity,this.#vr=t.boxes||null,this.#kr=t.methodOfCreation||"",this.#Tr=t.text||"",this._isDraggable=!1,t.highlightId>-1?(this.#Er=!0,this.#Mr(t),this.#Pr()):this.#vr&&(this.#gr=t.anchorNode,this.#mr=t.anchorOffset,this.#Ar=t.focusNode,this.#wr=t.focusOffset,this.#Ir(),this.#Pr(),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:this.#Er?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:this.#Mn,methodOfCreation:this.#kr}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#Ir(){const t=new ni(this.#vr,.001);this.#xr=t.getOutlines(),({x:this.x,y:this.y,width:this.width,height:this.height}=this.#xr.box);const e=new ni(this.#vr,.0025,.001,"ltr"===this._uiManager.direction);this.#yr=e.getOutlines();const{lastPoint:s}=this.#yr.box;this.#Sr=[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height]}#Mr({highlightOutlines:t,highlightId:e,clipPathId:s}){if(this.#xr=t,this.#yr=t.getNewOutline(this.#Mn/2+1.5,.0025),e>=0)this.#y=e,this.#br=s,this.parent.drawLayer.finalizeLine(e,t),this.#Rr=this.parent.drawLayer.drawOutline(this.#yr);else if(this.parent){const e=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(this.#y,t),this.parent.drawLayer.updateBox(this.#y,li.#Lr(this.#xr.box,(e-this.rotation+360)%360)),this.parent.drawLayer.updateLine(this.#Rr,this.#yr),this.parent.drawLayer.updateBox(this.#Rr,li.#Lr(this.#yr.box,e))}const{x:i,y:n,width:r,height:a}=t.box;switch(this.rotation){case 0:this.x=i,this.y=n,this.width=r,this.height=a;break;case 90:{const[t,e]=this.parentDimensions;this.x=n,this.y=1-i,this.width=r*e/t,this.height=a*t/e;break}case 180:this.x=1-i,this.y=1-n,this.width=r,this.height=a;break;case 270:{const[t,e]=this.parentDimensions;this.x=1-n,this.y=i,this.width=r*e/t,this.height=a*t/e;break}}const{lastPoint:o}=this.#yr.box;this.#Sr=[(o[0]-i)/r,(o[1]-n)/a]}static initialize(t,e){wt.initialize(t,e),li._defaultColor||=e.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,e){switch(t){case p.HIGHLIGHT_DEFAULT_COLOR:li._defaultColor=e;break;case p.HIGHLIGHT_THICKNESS:li._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return this.#Sr}updateParams(t,e){switch(t){case p.HIGHLIGHT_COLOR:this.#dn(e);break;case p.HIGHLIGHT_THICKNESS:this.#Dr(e)}}static get defaultPropertiesToUpdate(){return[[p.HIGHLIGHT_DEFAULT_COLOR,li._defaultColor],[p.HIGHLIGHT_THICKNESS,li._defaultThickness]]}get propertiesToUpdate(){return[[p.HIGHLIGHT_COLOR,this.color||li._defaultColor],[p.HIGHLIGHT_THICKNESS,this.#Mn||li._defaultThickness],[p.HIGHLIGHT_FREE,this.#Er]]}#dn(t){const e=(t,e)=>{this.color=t,this.parent?.drawLayer.changeColor(this.#y,t),this.#n?.updateColor(t),this.#Cr=e,this.parent?.drawLayer.changeOpacity(this.#y,e)},s=this.color,i=this.#Cr;this.addCommands({cmd:e.bind(this,t,li._defaultOpacity),undo:e.bind(this,s,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:p.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)}#Dr(t){const e=this.#Mn,s=t=>{this.#Mn=t,this.#Fr(t)};this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:p.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}async addEditToolbar(){const t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&(this.#n=new hi({editor:this}),t.addColorPicker(this.#n)),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#Or())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#Or())}onceAdded(){this.annotationElementId||this.parent.addUndoableEditor(this),this.div.focus()}remove(){this.#Nr(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.#Pr(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?this.#Nr():t&&(this.#Pr(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),e&&this.select()}#Fr(t){if(!this.#Er)return;this.#Mr({highlightOutlines:this.#xr.getNewOutline(t/2)}),this.fixAndSetPosition();const[e,s]=this.parentDimensions;this.setDims(this.width*e,this.height*s)}#Nr(){null!==this.#y&&this.parent&&(this.parent.drawLayer.remove(this.#y),this.#y=null,this.parent.drawLayer.remove(this.#Rr),this.#Rr=null)}#Pr(t=this.parent){null===this.#y&&(({id:this.#y,clipPathId:this.#br}=t.drawLayer.draw(this.#xr,this.color,this.#Cr)),this.#Rr=t.drawLayer.drawOutline(this.#yr),this.#_r&&(this.#_r.style.clipPath=this.#br))}static#Lr({x:t,y:e,width:s,height:i},n){switch(n){case 90:return{x:1-e-i,y:t,width:i,height:s};case 180:return{x:1-t-s,y:1-e-i,width:s,height:i};case 270:return{x:e,y:1-t-s,width:i,height:s}}return{x:t,y:e,width:s,height:i}}rotate(t){const{drawLayer:e}=this.parent;let s;this.#Er?(t=(t-this.rotation+360)%360,s=li.#Lr(this.#xr.box,t)):s=li.#Lr(this,t),e.rotate(this.#y,t),e.rotate(this.#Rr,t),e.updateBox(this.#y,s),e.updateBox(this.#Rr,li.#Lr(this.#yr.box,t))}
2render(){if(this.div)return this.div;const t=super.render();this.#Tr&&(t.setAttribute("aria-label",this.#Tr),t.setAttribute("role","mark")),this.#Er?t.classList.add("free"):this.div.addEventListener("keydown",this.#jr.bind(this),{signal:this._uiManager._signal});const e=this.#_r=document.createElement("div");t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#br;const[s,i]=this.parentDimensions;return this.setDims(this.width*s,this.height*i),pt(this,this.#_r,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.isSelected||this.parent.drawLayer.addClass(this.#Rr,"hovered")}pointerleave(){this.isSelected||this.parent.drawLayer.removeClass(this.#Rr,"hovered")}#jr(t){li._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#Br(!0);break;case 1:case 3:this.#Br(!1)}}#Br(t){if(!this.#gr)return;const e=window.getSelection();t?e.setPosition(this.#gr,this.#mr):e.setPosition(this.#Ar,this.#wr)}select(){super.select(),this.#Rr&&(this.parent?.drawLayer.removeClass(this.#Rr,"hovered"),this.parent?.drawLayer.addClass(this.#Rr,"selected"))}unselect(){super.unselect(),this.#Rr&&(this.parent?.drawLayer.removeClass(this.#Rr,"selected"),this.#Er||this.#Br(!1))}get _mustFixPosition(){return!this.#Er}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.show(this.#y,t),this.parent.drawLayer.show(this.#Rr,t))}#Or(){return this.#Er?this.rotation:0}#Hr(){if(this.#Er)return null;const[t,e]=this.pageDimensions,[s,i]=this.pageTranslation,n=this.#vr,r=new Float32Array(8*n.length);let a=0;for(const{x:o,y:h,width:l,height:c}of n){const n=o*t+s,d=(1-h-c)*e+i;r[a]=r[a+4]=n,r[a+1]=r[a+3]=d,r[a+2]=r[a+6]=n+l*t,r[a+5]=r[a+7]=d+c*e,a+=8}return r}#$r(t){return this.#xr.serialize(t,this.#Or())}static startHighlighting(t,e,{target:s,x:i,y:n}){const{x:r,y:a,width:o,height:h}=s.getBoundingClientRect(),l=new AbortController,c=t.combinedSignal(l),d=e=>{l.abort(),this.#zr(t,e)};window.addEventListener("blur",d,{signal:c}),window.addEventListener("pointerup",d,{signal:c}),window.addEventListener("pointerdown",(t=>{t.preventDefault(),t.stopPropagation()}),{capture:!0,passive:!1,signal:c}),window.addEventListener("contextmenu",st,{signal:c}),s.addEventListener("pointermove",this.#Ur.bind(this,t),{signal:c}),this._freeHighlight=new ai({x:i,y:n},[r,a,o,h],t.scale,this._defaultThickness/2,e,.001),({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0))}static#Ur(t,e){this._freeHighlight.add(e)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}static#zr(t,e){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(t,e,s){let i=null;if(t instanceof Ws){const{data:{quadPoints:e,rect:s,rotation:n,id:r,color:a,opacity:o,popupRef:h},parent:{page:{pageNumber:l}}}=t;i=t={annotationType:u.HIGHLIGHT,color:Array.from(a),opacity:o,quadPoints:e,boxes:null,pageIndex:l-1,rect:s.slice(0),rotation:n,id:r,deleted:!1,popupRef:h}}else if(t instanceof Vs){const{data:{inkLists:e,rect:s,rotation:n,id:r,color:a,borderStyle:{rawWidth:o},popupRef:h},parent:{page:{pageNumber:l}}}=t;i=t={annotationType:u.HIGHLIGHT,color:Array.from(a),thickness:o,inkLists:e,boxes:null,pageIndex:l-1,rect:s.slice(0),rotation:n,id:r,deleted:!1,popupRef:h}}const{color:n,quadPoints:r,inkLists:a,opacity:o}=t,h=await super.deserialize(t,e,s);h.color=H.makeHexColor(...n),h.#Cr=o||1,a&&(h.#Mn=t.thickness),h.annotationElementId=t.id||null,h._initialData=i;const[l,c]=h.pageDimensions,[d,p]=h.pageTranslation;if(r){const t=h.#vr=[];for(let e=0;e<r.length;e+=8)t.push({x:(r[e]-d)/l,y:1-(r[e+1]-p)/c,width:(r[e+2]-r[e])/l,height:(r[e+1]-r[e+5])/c});h.#Ir(),h.#Pr(),h.rotate(h.rotation)}else if(a){h.#Er=!0;const t=a[0],s={x:t[0]-d,y:c-(t[1]-p)},i=new ai(s,[0,0,l,c],1,h.#Mn/2,!0,.001);for(let e=0,a=t.length;e<a;e+=2)s.x=t[e]-d,s.y=c-(t[e+1]-p),i.add(s);const{id:n,clipPathId:r}=e.drawLayer.draw(i,h.color,h._defaultOpacity,!0);h.#Mr({highlightOutlines:i.getOutlines(),highlightId:n,clipPathId:r}),h.#Pr()}return h}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const e=this.getRect(0,0),s=wt._colorManager.convert(this.color),i={annotationType:u.HIGHLIGHT,color:s,opacity:this.#Cr,thickness:this.#Mn,quadPoints:this.#Hr(),outlines:this.#$r(e),pageIndex:this.pageIndex,rect:e,rotation:this.#Or(),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!this.#bn(i)?null:(i.id=this.annotationElementId,i)}#bn(t){const{color:e}=this._initialData;return t.color.some(((t,s)=>t!==e[s]))}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}}class ci extends wt{#Gr=0;#Vr=0;#Wr=null;#qr=new Path2D;#Xr=!1;#Yr=null;#Kr=!1;#Jr=!1;#Zr=null;#Qr=null;#ta=0;#ea=0;#sa=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _type="ink";static _editorType=u.INK;constructor(t){super({...t,name:"inkEditor"}),this.color=t.color||null,this.thickness=t.thickness||null,this.opacity=t.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(t,e){wt.initialize(t,e)}static updateDefaultParams(t,e){switch(t){case p.INK_THICKNESS:ci._defaultThickness=e;break;case p.INK_COLOR:ci._defaultColor=e;break;case p.INK_OPACITY:ci._defaultOpacity=e/100}}updateParams(t,e){switch(t){case p.INK_THICKNESS:this.#Dr(e);break;case p.INK_COLOR:this.#dn(e);break;case p.INK_OPACITY:this.#ia(e)}}static get defaultPropertiesToUpdate(){return[[p.INK_THICKNESS,ci._defaultThickness],[p.INK_COLOR,ci._defaultColor||wt._defaultLineColor],[p.INK_OPACITY,Math.round(100*ci._defaultOpacity)]]}get propertiesToUpdate(){return[[p.INK_THICKNESS,this.thickness||ci._defaultThickness],[p.INK_COLOR,this.color||ci._defaultColor||wt._defaultLineColor],[p.INK_OPACITY,Math.round(100*(this.opacity??ci._defaultOpacity))]]}#Dr(t){const e=t=>{this.thickness=t,this.#na()},s=this.thickness;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:p.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#dn(t){const e=t=>{this.color=t,this.#ra()},s=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:p.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#ia(t){const e=t=>{this.opacity=t,this.#ra()};t/=100;const s=this.opacity;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:p.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.canvas||(this.#aa(),this.#oa()),this.isAttachedToDOM||(this.parent.add(this),this.#ha()),this.#na()))}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#Wr&&(clearTimeout(this.#Wr),this.#Wr=null),this.#Zr?.disconnect(),this.#Zr=null,super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&null===t&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){const[t,e]=this.parentDimensions,s=this.width*t,i=this.height*e;this.setDimensions(s,i)}enableEditMode(){this.#Xr||null===this.canvas||(super.enableEditMode(),this._isDraggable=!1,this.#la())}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.#ca())}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#da(){const{parentRotation:t,parentDimensions:[e,s]}=this;switch(t){case 90:return[0,s,s,e];case 180:return[e,s,e,s];case 270:return[e,0,s,e];default:return[0,0,e,s]}}#ua(){const{ctx:t,color:e,opacity:s,thickness:i,parentScale:n,scaleFactor:r}=this;
2t.lineWidth=i*n/r,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${e}${function(t){return Math.round(Math.min(255,Math.max(1,255*t))).toString(16).padStart(2,"0")}(s)}`}#pa(t,e){this.canvas.addEventListener("contextmenu",st,{signal:this._uiManager._signal}),this.#ca(),this.#Yr=new AbortController;const s=this._uiManager.combinedSignal(this.#Yr);this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:s}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:s}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:s}),this.isEditing=!0,this.#Jr||(this.#Jr=!0,this.#ha(),this.thickness||=ci._defaultThickness,this.color||=ci._defaultColor||wt._defaultLineColor,this.opacity??=ci._defaultOpacity),this.currentPath.push([t,e]),this.#Kr=!1,this.#ua(),this.#sa=()=>{this.#fa(),this.#sa&&window.requestAnimationFrame(this.#sa)},window.requestAnimationFrame(this.#sa)}#ga(t,e){const[s,i]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===s&&e===i)return;const n=this.currentPath;let r=this.#qr;n.push([t,e]),this.#Kr=!0,n.length<=2?(r.moveTo(...n[0]),r.lineTo(t,e)):(3===n.length&&(this.#qr=r=new Path2D,r.moveTo(...n[0])),this.#ma(r,...n.at(-3),...n.at(-2),t,e))}#va(){if(0===this.currentPath.length)return;const t=this.currentPath.at(-1);this.#qr.lineTo(...t)}#ba(t,e){let s;if(this.#sa=null,t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height),this.#ga(t,e),this.#va(),1!==this.currentPath.length)s=this.#ya();else{const i=[t,e];s=[[i,i.slice(),i.slice(),i]]}const i=this.#qr,n=this.currentPath;this.currentPath=[],this.#qr=new Path2D,this.addCommands({cmd:()=>{this.allRawPaths.push(n),this.paths.push(s),this.bezierPath2D.push(i),this._uiManager.rebuild(this)},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(this.#aa(),this.#oa()),this.#na())},mustExec:!0})}#fa(){if(!this.#Kr)return;this.#Kr=!1;Math.ceil(this.thickness*this.parentScale);const t=this.currentPath.slice(-3),e=t.map((t=>t[0])),s=t.map((t=>t[1])),{ctx:i}=(Math.min(...e),Math.max(...e),Math.min(...s),Math.max(...s),this);i.save(),i.clearRect(0,0,this.canvas.width,this.canvas.height);for(const n of this.bezierPath2D)i.stroke(n);i.stroke(this.#qr),i.restore()}#ma(t,e,s,i,n,r,a){const o=(e+i)/2,h=(s+n)/2,l=(i+r)/2,c=(n+a)/2;t.bezierCurveTo(o+2*(i-o)/3,h+2*(n-h)/3,l+2*(i-l)/3,c+2*(n-c)/3,l,c)}#ya(){const t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];const e=[];let s,[i,n]=t[0];for(s=1;s<t.length-2;s++){const[r,a]=t[s],[o,h]=t[s+1],l=(r+o)/2,c=(a+h)/2,d=[i+2*(r-i)/3,n+2*(a-n)/3],u=[l+2*(r-l)/3,c+2*(a-c)/3];e.push([[i,n],d,u,[l,c]]),[i,n]=[l,c]}const[r,a]=t[s],[o,h]=t[s+1],l=[i+2*(r-i)/3,n+2*(a-n)/3],c=[o+2*(r-o)/3,h+2*(a-h)/3];return e.push([[i,n],l,c,[o,h]]),e}#ra(){if(this.isEmpty())return void this.#Aa();this.#ua();const{canvas:t,ctx:e}=this;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height),this.#Aa();for(const s of this.bezierPath2D)e.stroke(s)}commit(){this.#Xr||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#Xr=!0,this.div.classList.add("disabled"),this.#na(!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),this.enableEditMode())}#la(){if(this.#Qr)return;this.#Qr=new AbortController;const t=this._uiManager.combinedSignal(this.#Qr);this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:t})}#ca(){this.pointerdownAC?.abort(),this.pointerdownAC=null}canvasPointerdown(t){0===t.button&&this.isInEditMode()&&!this.#Xr&&(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),this.#pa(t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),this.#ga(t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),this.#wa(t)}canvasPointerleave(t){this.#wa(t)}#wa(t){this.#Yr?.abort(),this.#Yr=null,this.#la(),this.#Wr&&clearTimeout(this.#Wr),this.#Wr=setTimeout((()=>{this.#Wr=null,this.canvas.removeEventListener("contextmenu",st)}),10),this.#ba(t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackgroun
2d()}#aa(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#oa(){this.#Zr=new ResizeObserver((t=>{const e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)})),this.#Zr.observe(this.div),this._uiManager._signal.addEventListener("abort",(()=>{this.#Zr?.disconnect(),this.#Zr=null}),{once:!0})}get isResizable(){return!this.isEmpty()&&this.#Xr}render(){if(this.div)return this.div;let t,e;this.width&&(t=this.x,e=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[s,i,n,r]=this.#da();if(this.setAt(s,i,0,0),this.setDims(n,r),this.#aa(),this.width){const[s,i]=this.parentDimensions;this.setAspectRatio(this.width*s,this.height*i),this.setAt(t*s,e*i,this.width*s,this.height*i),this.#Jr=!0,this.#ha(),this.setDims(this.width*s,this.height*i),this.#ra(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#oa(),this.div}#ha(){if(!this.#Jr)return;const[t,e]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),this.#Aa()}setDimensions(t,e){const s=Math.round(t),i=Math.round(e);if(this.#ta===s&&this.#ea===i)return;this.#ta=s,this.#ea=i,this.canvas.style.visibility="hidden";const[n,r]=this.parentDimensions;this.width=t/n,this.height=e/r,this.fixAndSetPosition(),this.#Xr&&this.#_a(t,e),this.#ha(),this.#ra(),this.canvas.style.visibility="visible",this.fixDims()}#_a(t,e){const s=this.#xa(),i=(t-s)/this.#Vr,n=(e-s)/this.#Gr;this.scaleFactor=Math.min(i,n)}#Aa(){const t=this.#xa()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}static#Ea(t){const e=new Path2D;for(let s=0,i=t.length;s<i;s++){const[i,n,r,a]=t[s];0===s&&e.moveTo(...i),e.bezierCurveTo(n[0],n[1],r[0],r[1],a[0],a[1])}return e}static#Sa(t,e,s){const[i,n,r,a]=e;switch(s){case 0:for(let e=0,s=t.length;e<s;e+=2)t[e]+=i,t[e+1]=a-t[e+1];break;case 90:for(let e=0,s=t.length;e<s;e+=2){const s=t[e];t[e]=t[e+1]+i,t[e+1]=s+n}break;case 180:for(let e=0,s=t.length;e<s;e+=2)t[e]=r-t[e],t[e+1]+=n;break;case 270:for(let e=0,s=t.length;e<s;e+=2){const s=t[e];t[e]=r-t[e+1],t[e+1]=a-s}break;default:throw new Error("Invalid rotation")}return t}static#Ca(t,e,s){const[i,n,r,a]=e;switch(s){case 0:for(let e=0,s=t.length;e<s;e+=2)t[e]-=i,t[e+1]=a-t[e+1];break;case 90:for(let e=0,s=t.length;e<s;e+=2){const s=t[e];t[e]=t[e+1]-n,t[e+1]=s-i}break;case 180:for(let e=0,s=t.length;e<s;e+=2)t[e]=r-t[e],t[e+1]-=n;break;case 270:for(let e=0,s=t.length;e<s;e+=2){const s=t[e];t[e]=a-t[e+1],t[e+1]=r-s}break;default:throw new Error("Invalid rotation")}return t}#Ra(t,e,s,i){const n=[],r=this.thickness/2,a=t*e+r,o=t*s+r;for(const h of this.paths){const e=[],s=[];for(let i=0,n=h.length;i<n;i++){const[r,l,c,d]=h[i];if(r[0]===d[0]&&r[1]===d[1]&&1===n){const i=t*r[0]+a,n=t*r[1]+o;e.push(i,n),s.push(i,n);break}const u=t*r[0]+a,p=t*r[1]+o,f=t*l[0]+a,g=t*l[1]+o,m=t*c[0]+a,v=t*c[1]+o,b=t*d[0]+a,y=t*d[1]+o;0===i&&(e.push(u,p),s.push(u,p)),e.push(f,g,m,v,b,y),s.push(f,g),i===n-1&&s.push(b,y)}n.push({bezier:ci.#Sa(e,i,this.rotation),points:ci.#Sa(s,i,this.rotation)})}return n}#Ta(){let t=1/0,e=-1/0,s=1/0,i=-1/0;for(const n of this.paths)for(const[r,a,o,h]of n){const n=H.bezierBoundingBox(...r,...a,...o,...h);t=Math.min(t,n[0]),s=Math.min(s,n[1]),e=Math.max(e,n[2]),i=Math.max(i,n[3])}return[t,s,e,i]}#xa(){return this.#Xr?Math.ceil(this.thickness*this.parentScale):0}#na(t=!1){if(this.isEmpty())return;if(!this.#Xr)return void this.#ra();const e=this.#Ta(),s=this.#xa();this.#Vr=Math.max(wt.MIN_SIZE,e[2]-e[0]),this.#Gr=Math.max(wt.MIN_SIZE,e[3]-e[1]);const i=Math.ceil(s+this.#Vr*this.scaleFactor),n=Math.ceil(s+this.#Gr*this.scaleFactor),[r,a]=this.parentDimensions;this.width=i/r,this.height=n/a,this.setAspectRatio(i,n);const o=this.translationX,h=this.translationY;this.translationX=-e[0],this.translationY=-e[1],this.#ha(),this.#ra(),this.#ta=i,this.#ea=n,this.setDims(i,n);const l=t?s/this.scaleFactor/2:0;this.translate(o-this.translationX-l,h-this.translationY-l)}static async deserialize(t,e,s){if(t instanceof Vs)return null;const i=await super.deserialize(t,e,s);i.thickness=t.thickness,i.color=H.makeHexColor(...t.color),i.opacity=t.opacity;const[n,r]=i.pageDimensions,a=i.width*n,o=i.height*r,h=i.parentScale,l=t.thickness/2;i.#Xr=!0,i.#ta=Math.round(a),i.#ea=Math.round(o);const{paths:c,rect:d,rotation:u}=t;for(let{bezier:f}of c){f=ci.#Ca(f,d,u);const t=[];i.paths.push(t);let e=h*(f[0]-l),s=h*(f[1]-l);for(let i=2,r=f.length;i<r;i+=6){const n=h*(f[i]-l),r=h*(f[i+1]-l),a=h*(f[i+2]-l),o=h*(f[i+3]-l),c=h*(f[i+4]-l),d=h*(f[i+5]-l);t.push([[e,s],[n,r],[a,o],[c,d]]),e=c,s=d}const n=this.#Ea(t);i.bezierPath2D.push(n)}const p=i.#Ta();return i.#Vr=Math.max(wt.MIN_SIZE,p[2]-p[0]),i.#Gr=Math.max(wt.MIN_SIZE,p[3]-p[1]),i.#_a(a,o),i}serialize(){if(this.isEmpty())return null;const t=this.getRect(0,0),e=wt._colorManager.convert(this.ctx.strokeStyle);return{annotationType:u.INK,color:e,thickness:this.thickness,opacity:this.opacity,paths:this.#Ra(this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}class di extends wt{#ka=null;#Ma=null;#Pa=null;#Ia=null;#La=null;#Da="";#Fa=null;#Zr=null;#Oa=null;#Na=!1;#ja=!1;static _type="stamp";static _editorType=u.STAMP;constructor(t){super({...t,name:"stampEditor"}),this.#Ia=t.bitmapUrl,this.#La=t.bitmapFile}static initialize(t,e){wt.initialize(t,e)}static get supportedTypes(){return C(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map((t=>`image/${t}`)))}static get supportedTypesStr(){return C(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(u.STAMP,{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(t){const e=t.get("hasAltText");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}#Ba(t,e=!1){t?(this.#ka=t.bitmap,e||(this.#Ma=t.id,this.#Na=t.isSvg),t.file&&(this.#Da=t.file.name),this.#aa()):this.remove()}#Ha(){if(this.#Pa=null,this._uiManager.enableWaiting(!1),this.#Fa)if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#ka)this._editToolbar.hide(),this._uiManager.editAltText(this,!0);else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#ka){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(t=null,e=!0){if(this.hasAltTextData())return null;const{mlManager:s}=this._uiManager;if(!s)throw new Error("No ML.");if(!await s.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:i,width:n,height:r}=t||this.copyCanvas(null,null,!0).imageData,a=await s.guess({name:"altText",request:{data:i,width:n,height:r,channels:i.length/(n*r)}});if(!a)throw new Error("No response from the AI service.");if(a.error)throw new Error("Error from the AI service.");if(a.cancel)return null;if(!a.output)throw new Error("No valid response from the AI service.");const o=a.output;return await this.setGuessedAltText(o),e&&!this.hasAltTextData()&&(this.altTextData={alt:o,decorative:!1}),o}#$a(){if(this.#Ma)return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(this.#Ma).then((t=>this.#Ba(t,!0))).finally((()=>this.#Ha()));if(this.#Ia){const t=this.#Ia;return this.#Ia=null,this._uiManager.enableWaiting(!0),void(this.#Pa=this._uiManager.imageManager.getFromUrl(t).then((t=>this.#Ba(t))).finally((()=>this.#Ha())))}if(this.#La){const t=this.#La;return this.#La=null,this._uiManager.enableWaiting(!0),void(this.#Pa=this._uiManager.imageManager.getFromFile(t).then((t=>this.#Ba(t))).finally((()=>this.#Ha())))}const t=document.createElement("input");t.type="file",t.accept=di.supportedTypesStr;const e=this._uiManager._signal;this.#Pa=new Promise((s=>{t.addEventListener("change",(async()=>
2{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);const e=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#Ba(e)}else this.remove();s()}),{signal:e}),t.addEventListener("cancel",(()=>{this.remove(),s()}),{signal:e})})).finally((()=>this.#Ha())),t.click()}remove(){this.#Ma&&(this.#ka=null,this._uiManager.imageManager.deleteId(this.#Ma),this.#Fa?.remove(),this.#Fa=null,this.#Zr?.disconnect(),this.#Zr=null,this.#Oa&&(clearTimeout(this.#Oa),this.#Oa=null)),super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(this.#Ma&&null===this.#Fa&&this.#$a(),this.isAttachedToDOM||this.parent.add(this))):this.#Ma&&this.#$a()}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#Pa||this.#ka||this.#Ia||this.#La||this.#Ma)}get isResizable(){return!0}render(){if(this.div)return this.div;let t,e;if(this.width&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),this.#ka?this.#aa():this.#$a(),this.width&&!this.annotationElementId){const[s,i]=this.parentDimensions;this.setAt(t*s,e*i,this.width*s,this.height*i)}return this.div}#aa(){const{div:t}=this;let{width:e,height:s}=this.#ka;const[i,n]=this.pageDimensions,r=.75;if(this.width)e=this.width*i,s=this.height*n;else if(e>r*i||s>r*n){const t=Math.min(r*i/e,r*n/s);e*=t,s*=t}const[a,o]=this.parentDimensions;this.setDims(e*a/i,s*o/n),this._uiManager.enableWaiting(!1);const h=this.#Fa=document.createElement("canvas");h.setAttribute("role","img"),this.addContainer(h),this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(t.hidden=!1),this.#za(e,s),this.#oa(),this.#ja||(this.parent.addUndoableEditor(this),this.#ja=!0),this._reportTelemetry({action:"inserted_image"}),this.#Da&&h.setAttribute("aria-label",this.#Da)}copyCanvas(t,e,s=!1){t||(t=224);const{width:i,height:n}=this.#ka,r=new ct;let a=this.#ka,o=i,h=n,l=null;if(e){if(i>e||n>e){const t=Math.min(e/i,e/n);o=Math.floor(i*t),h=Math.floor(n*t)}l=document.createElement("canvas");const t=l.width=Math.ceil(o*r.sx),s=l.height=Math.ceil(h*r.sy);this.#Na||(a=this.#Ua(t,s));const c=l.getContext("2d");c.filter=this._uiManager.hcmFilter;let d="white",u="#cfcfd8";"none"!==this._uiManager.hcmFilter?u="black":window.matchMedia?.("(prefers-color-scheme: dark)").matches&&(d="#8f8f9d",u="#42414d");const p=15,f=p*r.sx,g=p*r.sy,m=new OffscreenCanvas(2*f,2*g),v=m.getContext("2d");v.fillStyle=d,v.fillRect(0,0,2*f,2*g),v.fillStyle=u,v.fillRect(0,0,f,g),v.fillRect(f,g,f,g),c.fillStyle=c.createPattern(m,"repeat"),c.fillRect(0,0,t,s),c.drawImage(a,0,0,a.width,a.height,0,0,t,s)}let c=null;if(s){let e,s;if(r.symmetric&&a.width<t&&a.height<t)e=a.width,s=a.height;else if(a=this.#ka,i>t||n>t){const r=Math.min(t/i,t/n);e=Math.floor(i*r),s=Math.floor(n*r),this.#Na||(a=this.#Ua(e,s))}const o=new OffscreenCanvas(e,s).getContext("2d",{willReadFrequently:!0});o.drawImage(a,0,0,a.width,a.height,0,0,e,s),c={width:e,height:s,data:o.getImageData(0,0,e,s).data}}return{canvas:l,width:o,height:h,imageData:c}}#Ga(t,e){const[s,i]=this.parentDimensions;this.width=t/s,this.height=e/i,this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==this.#Oa&&clearTimeout(this.#Oa),this.#Oa=setTimeout((()=>{this.#Oa=null,this.#za(t,e)}),200)}#Ua(t,e){const{width:s,height:i}=this.#ka;let n=s,r=i,a=this.#ka;for(;n>2*t||r>2*e;){const s=n,i=r;n>2*t&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2)),r>2*e&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2));const o=new OffscreenCanvas(n,r);o.getContext("2d").drawImage(a,0,0,s,i,0,0,n,r),a=o.transferToImageBitmap()}return a}#za(t,e){const s=new ct,i=Math.ceil(t*s.sx),n=Math.ceil(e*s.sy),r=this.#Fa;if(!r||r.width===i&&r.height===n)return;r.width=i,r.height=n;const a=this.#Na?this.#ka:this.#Ua(i,n),o=r.getContext("2d");o.filter=this._uiManager.hcmFilter,o.drawImage(a,0,0,a.width,a.height,0,0,i,n)}getImageForAltText(){return this.#Fa}#Va(t){if(t){if(this.#Na){const t=this._uiManager.imageManager.getSvgUrl(this.#Ma);if(t)return t}const t=document.createElement("canvas");return({width:t.width,height:t.height}=this.#ka),t.getContext("2d").drawImage(this.#ka,0,0),t.toDataURL()}if(this.#Na){const[t,e]=this.pageDimensions,s=Math.round(this.width*t*W.PDF_TO_CSS_UNITS),i=Math.round(this.height*e*W.PDF_TO_CSS_UNITS),n=new OffscreenCanvas(s,i);return n.getContext("2d").drawImage(this.#ka,0,0,this.#ka.width,this.#ka.height,0,0,s,i),n.transferToImageBitmap()}return structuredClone(this.#ka)}#oa(){this._uiManager._signal&&(this.#Zr=new ResizeObserver((t=>{const e=t[0].contentRect;e.width&&e.height&&this.#Ga(e.width,e.height)})),this.#Zr.observe(this.div),this._uiManager._signal.addEventListener("abort",(()=>{this.#Zr?.disconnect(),this.#Zr=null}),{once:!0}))}static async deserialize(t,e,s){let i=null;if(t instanceof Ks){const{data:{rect:n,rotation:r,id:a,structParent:o,popupRef:h},container:l,parent:{page:{pageNumber:c}}}=t,d=l.querySelector("canvas"),p=s.imageManager.getFromCanvas(l.id,d);d.remove();const f=(await e._structTree.getAriaAttributes(`${G}${a}
2`))?.get("aria-label")||"";i=t={annotationType:u.STAMP,bitmapId:p.id,bitmap:p.bitmap,pageIndex:c-1,rect:n.slice(0),rotation:r,id:a,deleted:!1,accessibilityData:{decorative:!1,altText:f},isSvg:!1,structParent:o,popupRef:h}}const n=await super.deserialize(t,e,s),{rect:r,bitmap:a,bitmapUrl:o,bitmapId:h,isSvg:l,accessibilityData:c}=t;h&&s.imageManager.isValidId(h)?(n.#Ma=h,a&&(n.#ka=a)):n.#Ia=o,n.#Na=l;const[d,p]=n.pageDimensions;return n.width=(r[2]-r[0])/d,n.height=(r[3]-r[1])/p,n.annotationElementId=t.id||null,c&&(n.altTextData=c),n._initialData=i,n.#ja=!!i,n}serialize(t=!1,e=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s={annotationType:u.STAMP,bitmapId:this.#Ma,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#Na,structTreeParentId:this._structTreeParentId};if(t)return s.bitmapUrl=this.#Va(!0),s.accessibilityData=this.serializeAltText(!0),s;const{decorative:i,altText:n}=this.serializeAltText(!1);if(!i&&n&&(s.accessibilityData={type:"Figure",alt:n}),this.annotationElementId){const t=this.#bn(s);if(t.isSame)return null;t.isSameAltText?delete s.accessibilityData:s.accessibilityData.structParent=this._initialData.structParent??-1}if(s.id=this.annotationElementId,null===e)return s;e.stamps||=new Map;const r=this.#Na?(s.rect[2]-s.rect[0])*(s.rect[3]-s.rect[1]):null;if(e.stamps.has(this.#Ma)){if(this.#Na){const t=e.stamps.get(this.#Ma);r>t.area&&(t.area=r,t.serialized.bitmap.close(),t.serialized.bitmap=this.#Va(!1))}}else e.stamps.set(this.#Ma,{area:r,serialized:s}),s.bitmap=this.#Va(!1);return s}#bn(t){const{rect:e,pageIndex:s,accessibilityData:{altText:i}}=this._initialData,n=t.rect.every(((t,s)=>Math.abs(t-e[s])<1)),r=t.pageIndex===s,a=(t.accessibilityData?.alt||"")===i;return{isSame:n&&r&&a,isSameAltText:a}}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}}class ui{#en;#Wa=!1;#qa=null;#Xa=null;#Ya=null;#Ka=new Map;#Ja=!1;#Za=!1;#Qa=!1;#to=null;#eo=null;#g;static _initialized=!1;static#H=new Map([ti,ci,di,li].map((t=>[t._editorType,t])));constructor({uiManager:t,pageIndex:e,div:s,structTreeLayer:i,accessibilityManager:n,annotationLayer:r,drawLayer:a,textLayer:o,viewport:h,l10n:l}){const c=[...ui.#H.values()];if(!ui._initialized){ui._initialized=!0;for(const e of c)e.initialize(l,t)}t.registerEditorTypes(c),this.#g=t,this.pageIndex=e,this.div=s,this.#en=n,this.#qa=r,this.viewport=h,this.#to=o,this.drawLayer=a,this._structTree=i,this.#g.addLayer(this)}get isEmpty(){return 0===this.#Ka.size}get isInvisible(){return this.isEmpty&&this.#g.getMode()===u.NONE}updateToolbar(t){this.#g.updateToolbar(t)}updateMode(t=this.#g.getMode()){switch(this.#so(),t){case u.NONE:return this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case u.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case u.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;for(const s of ui.#H.values())e.toggle(`${s._type}Editing`,t===s._editorType);this.div.hidden=!1}hasTextLayer(t){return t===this.#to?.div}addInkEditorIfNeeded(t){if(this.#g.getMode()===u.INK){if(!t)for(const t of this.#Ka.values())if(t.isEmpty())return void t.setInBackground();this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(t){this.#g.setEditingState(t)}addCommands(t){this.#g.addCommands(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){this.#qa?.div.classList.toggle("disabled",!t)}async enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const t=new Set;for(const s of this.#Ka.values())s.enableEditing(),s.show(!0),s.annotationElementId&&(this.#g.removeChangedExistingAnnotation(s),t.add(s.annotationElementId));if(!this.#qa)return;const e=this.#qa.getEditableAnnotations();for(const s of e){if(s.hide(),this.#g.isDeletedAnnotationElement(s.data.id))continue;if(t.has(s.data.id))continue;const e=await this.deserialize(s);e&&(this.addOrRebuild(e),e.enableEditing())}}disable(){this.#Qa=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1);const t=new Map,e=new Map;for(const i of this.#Ka.values())i.disableEditing(),i.annotationElementId&&(null===i.serialize()?(e.set(i.annotationElementId,i),this.getEditableAnnotation(i.annotationElementId)?.show(),i.remove()):t.set(i.annotationElementId,i));if(this.#qa){const s=this.#qa.getEditableAnnotations();for(const i of s){const{id:s}=i.data;if(this.#g.isDeletedAnnotationElement(s))continue;let n=e.get(s);n?(n.resetAnnotationElement(i),n.show(!1),i.show()):(n=t.get(s),n&&(this.#g.addChangedExistingAnnotation(n),n.renderAnnotationElement(i)&&n.show(!1)),i.show())}}this.#so(),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const i of ui.#H.values())s.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#Qa=!1}getEditableAnnotation(t){return this.#qa?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#g.getActive()!==t&&this.#g.setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,this.#to?.div&&!this.#eo){this.#eo=new AbortController;const t=this.#g.combinedSignal(this.#eo);this.#to.div.addEventListener("pointerdown",this.#io.bind(this),{signal:t}),this.#to.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#to?.div&&this.#eo&&(this.#eo.abort(),this.#eo=null,this.#to.div.classList.remove("highlighting"))}#io(t){this.#g.unselectAll();const{target:e}=t;if(e===this.#to.div||("img"===e.getAttribute("role")||e.classList.contains("endOfContent"))&&this.#to.div.contains(e)){const{isMac:e}=j.platform;if(0!==t.button||t.ctrlKey&&e)return;this.#g.showAllEditors("highlight",!0,!0),this.#to.div.classList.add("free"),this.toggleDrawing(),li.startHighlighting(this,"ltr"===this.#g.direction,{target:this.#to.div,x:t.x,y:t.y}),this.#to.div.addEventListener("pointerup",(()=>{this.#to.div.classList.remove("free"),this.toggleDrawing(!0)}),{once:!0,signal:this.#g._signal}),t.preventDefault()}}enableClick(){if(this.#Xa)return;this.#Xa=new AbortController;const t=this.#g.combinedSignal(this.#Xa);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:t})}disableClick(){this.#Xa?.abort(),this.#Xa=null}
2attach(t){this.#Ka.set(t.id,t);const{annotationElementId:e}=t;e&&this.#g.isDeletedAnnotationElement(e)&&this.#g.removeDeletedAnnotationElement(t)}detach(t){this.#Ka.delete(t.id),this.#en?.removePointerInTextLayer(t.contentDiv),!this.#Qa&&t.annotationElementId&&this.#g.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#g.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,this.#Za||this.addInkEditorIfNeeded(!1)}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(this.#g.addDeletedAnnotationElement(t.annotationElementId),wt.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(t.parent!==this||!t.isAttachedToDOM){if(this.changeParent(t),this.#g.addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),this.#g.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!this.#Ya&&(t._focusEventsAllowed=!1,this.#Ya=setTimeout((()=>{this.#Ya=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",(()=>{t._focusEventsAllowed=!0}),{once:!0,signal:this.#g._signal}),e.focus())}),0)),t._structTreeParentId=this.#en?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||=this,t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getNextId(){return this.#g.getId()}get#no(){return ui.#H.get(this.#g.getMode())}combinedSignal(t){return this.#g.combinedSignal(t)}#ro(t){const e=this.#no;return e?new e.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#no?.canCreateNewEmptyEditor()}pasteEditor(t,e){this.#g.updateToolbar(t),this.#g.updateMode(t);const{offsetX:s,offsetY:i}=this.#ao(),n=this.getNextId(),r=this.#ro({parent:this,id:n,x:s,y:i,uiManager:this.#g,isCentered:!0,...e});r&&this.add(r)}async deserialize(t){return await(ui.#H.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#g))||null}createAndAddNewEditor(t,e,s={}){const i=this.getNextId(),n=this.#ro({parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:this.#g,isCentered:e,...s});return n&&this.add(n),n}#ao(){const{x:t,y:e,width:s,height:i}=this.div.getBoundingClientRect(),n=Math.max(0,t),r=Math.max(0,e),a=(n+Math.min(window.innerWidth,t+s))/2-t,o=(r+Math.min(window.innerHeight,e+i))/2-e,[h,l]=this.viewport.rotation%180==0?[a,o]:[o,a];return{offsetX:h,offsetY:l}}addNewEditor(){this.createAndAddNewEditor(this.#ao(),!0)}setSelected(t){this.#g.setSelected(t)}toggleSelected(t){this.#g.toggleSelected(t)}unselect(t){this.#g.unselect(t)}pointerup(t){const{isMac:e}=j.platform;0!==t.button||t.ctrlKey&&e||t.target!==this.div||!this.#Ja||(this.#Ja=!1,this.#Wa?this.#g.getMode()!==u.STAMP?this.createAndAddNewEditor(t,!1):this.#g.unselectAll():this.#Wa=!0)}pointerdown(t){if(this.#g.getMode()===u.HIGHLIGHT&&this.enableTextSelection(),this.#Ja)return void(this.#Ja=!1);const{isMac:e}=j.platform;if(0!==t.button||t.ctrlKey&&e)return;if(t.target!==this.div)return;this.#Ja=!0;const s=this.#g.getActive();this.#Wa=!s||s.isEmpty()}findNewParent(t,e,s){const i=this.#g.findParent(e,s);return null!==i&&i!==this&&(i.changeParent(t),!0)}destroy(){this.#g.getActive()?.parent===this&&(this.#g.commitOrRemove(),this.#g.setActiveEditor(null)),this.#Ya&&(clearTimeout(this.#Ya),this.#Ya=null);for(const t of this.#Ka.values())this.#en?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#Ka.clear(),this.#g.removeLayer(this)}#so(){this.#Za=!0;for(const t of this.#Ka.values())t.isEmpty()&&t.remove();this.#Za=!1}render({viewport:t}){this.viewport=t,lt(this.div,t);for(const e of this.#g.getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){this.#g.commitOrRemove(),this.#so();const e=this.viewport.rotation,s=t.rotation;if(this.viewport=t,lt(this.div,{rotation:s}),e!==s)for(const i of this.#Ka.values())i.rotate(s);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return this.#g.viewParameters.realScale}}class pi{#Fi=null;#y=0;#oo=new Map;#ho=new Map;constructor({pageIndex:t}){this.pageIndex=t}setParent(t){if(this.#Fi){if(this.#Fi!==t){if(this.#oo.size>0)for(const e of this.#oo.values())e.remove(),t.append(e);this.#Fi=t}}else this.#Fi=t}static get _svgFactory(){return C(this,"_svgFactory",new As)}static#lo(t,{x:e=0,y:s=0,width:i=1,height:n=1}={}){const{style:r}=t;r.top=100*s+"%",r.left=100*e+"%",r.width=100*i+"%",r.height=100*n+"%"}#co(t){const e=pi._svgFactory.create(1,1,!0);return this.#Fi.append(e),e.setAttribute("aria-hidden",!0),pi.#lo(e,t),e}#do(t,e){const s=pi._svgFactory.createElement("clipPath");t.append(s);const i=`clip_${e}`;s.setAttribute("id",i),s.setAttribute("clipPathUnits","objectBoundingBox");const n=pi._svgFactory.createElement("use");return s.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),i}draw(t,e,s,i=!1){const n=this.#y++,r=this.#co(t.box);r.classList.add(...t.classNamesForDrawing);const a=pi._svgFactory.createElement("defs");r.append(a);const o=pi._svgFactory.createElement("path");a.append(o);const h=`path_p${this.pageIndex}_${n}`;o.setAttribute("id",h),o.setAttribute("d",t.toSVGPath()),i&&this.#ho.set(n,o);const l=this.#do(a,h),c=pi._svgFactory.createElement("use");return r.append(c),r.setAttribute("fill",e),r.setAttribute("fill-opacity",s),c.setAttribute("href",`#${h}`),this.#oo.set(n,r),{id:n,clipPathId:`url(#${l})`}}drawOutline(t){const e=this.#y++,s=this.#co(t.box);s.classList.add(...t.classNamesForOutlining);const i=pi._svgFactory.createElement("defs");s.append(i);const n=pi._svgFactory.createElement("path");i.append(n);const r=`path_p${this.pageIndex}_${e}`;let a;if(n.setAttribute("id",r),n.setAttribute("d",t.toSVGPath()),n.setAttribute("vector-effect","non-scaling-stroke"),t.mustRemoveSelfIntersections){const t=pi._svgFactory.createElement("mask");i.append(t),a=`mask_p${this.pageIndex}_${e}`,t.setAttribute("id",a),t.setAttribute("maskUnits","objectBoundingBox");const s=pi._svgFactory.createElement("rect");t.append(s),s.setAttribute("width","1"),s.setAttribute("height","1"),s.setAttribute("fill","white");const n=pi._svgFactory.createElement("use");t.append(n),n.setAttribute("href",`#${r}`),n.setAttribute("stroke","none"),n.setAttribute("fill","black"),n.setAttribute("fill-rule","nonzero"),n.classList.add("mask")}const o=pi._svgFactory.createElement("use");s.append(o),o.setAttribute("href",`#${r}`),a&&o.setAttribute("mask",`url(#${a})`);const h=o.cloneNode();return s.append(h),o.classList.add("mainOutline"),h.classList.add("secondaryOutline"),this.#oo.set(e,s),e}finalizeLine(t,e){const s=this.#ho.get(t);this.#ho.delete(t),this.updateBox(t,e.box),s.setAttribute("d",e.toSVGPath())}updateLine(t,e){this.#oo.get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}updatePath(t,e){this.#ho.get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){pi.#lo(this.#oo.get(t),e)}show(t,e){this.#oo.get(t).classList.toggle("hidden",!e)}rotate(t,e){this.#oo.get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){this.#oo.get(t).setAttribute("fill",e)}
2changeOpacity(t,e){this.#oo.get(t).setAttribute("fill-opacity",e)}addClass(t,e){this.#oo.get(t).classList.add(e)}removeClass(t,e){this.#oo.get(t).classList.remove(e)}getSVGRoot(t){return this.#oo.get(t)}remove(t){this.#ho.delete(t),null!==this.#Fi&&(this.#oo.get(t).remove(),this.#oo.delete(t))}destroy(){this.#Fi=null;for(const t of this.#oo.values())t.remove();this.#oo.clear(),this.#ho.clear()}}var fi=a.AnnotationLayer,gi=a.AnnotationMode,mi=a.GlobalWorkerOptions,vi=a.PDFDataRangeTransport,bi=a.TextLayer,yi=a.getDocument},98819:(t,e,s)=>{s.d(e,{Z:()=>S});var i=s(85893),n=s(67294),r=s(99211),a=s(94886),o=s(56576),h=s(38776),l=s(10970),c=Object.prototype.hasOwnProperty;function d(t,e,s){for(s of t.keys())if(u(s,e))return s}function u(t,e){var s,i,n;if(t===e)return!0;if(t&&e&&(s=t.constructor)===e.constructor){if(s===Date)return t.getTime()===e.getTime();if(s===RegExp)return t.toString()===e.toString();if(s===Array){if((i=t.length)===e.length)for(;i--&&u(t[i],e[i]););return-1===i}if(s===Set){if(t.size!==e.size)return!1;for(i of t){if((n=i)&&"object"==typeof n&&!(n=d(e,n)))return!1;if(!e.has(n))return!1}return!0}if(s===Map){if(t.size!==e.size)return!1;for(i of t){if((n=i[0])&&"object"==typeof n&&!(n=d(e,n)))return!1;if(!u(i[1],e.get(n)))return!1}return!0}if(s===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(s===DataView){if((i=t.byteLength)===e.byteLength)for(;i--&&t.getInt8(i)===e.getInt8(i););return-1===i}if(ArrayBuffer.isView(t)){if((i=t.byteLength)===e.byteLength)for(;i--&&t[i]===e[i];);return-1===i}if(!s||"object"==typeof t){for(s in i=0,t){if(c.call(t,s)&&++i&&!c.call(e,s))return!1;if(!(s in e)||!u(t[s],e[s]))return!1}return Object.keys(e).length===i}}return t!=t&&e!=e}var p=s(6637),f=s(92956),g=s(41453);class m{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(t){this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setExternalLinkRel(t){this.externalLinkRel=t}setExternalLinkTarget(t){this.externalLinkTarget=t}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return(0,h.Z)(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(t){(0,h.Z)(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}goToDestination(t){return new Promise((e=>{(0,h.Z)(this.pdfDocument,"PDF document not loaded."),(0,h.Z)(t,"Destination is not specified."),"string"==typeof t?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)})).then((t=>{(0,h.Z)(Array.isArray(t),`"${t}" is not a valid destination array.`);const e=t[0];new Promise((t=>{(0,h.Z)(this.pdfDocument,"PDF document not loaded."),e instanceof Object?this.pdfDocument.getPageIndex(e).then((e=>{t(e)})).catch((()=>{(0,h.Z)(!1,`"${e}" is not a valid page reference.`)})):"number"==typeof e?t(e):(0,h.Z)(!1,`"${e}" is not a valid destination reference.`)})).then((e=>{const s=e+1;(0,h.Z)(this.pdfViewer,"PDF viewer is not initialized."),(0,h.Z)(s>=1&&s<=this.pagesCount,`"${s}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:e,pageNumber:s})}))}))}navigateTo(t){this.goToDestination(t)}goToPage(t){const e=t-1;(0,h.Z)(this.pdfViewer,"PDF viewer is not initialized."),(0,h.Z)(t>=1&&t<=this.pagesCount,`"${t}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}addLinkAttributes(t,e,s){t.href=e,t.rel=this.externalLinkRel||"noopener noreferrer nofollow",t.target=s?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}const v={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};var b=s(52782),y=s(75777),A=function(t,e,s,i){return new(s||(s=Promise))((function(n,r){function a(t){try{h(i.next(t))}catch(e){r(e)}}function o(t){try{h(i.throw(t))}catch(e){r(e)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,o)}h((i=i.apply(t,e||[])).next())}))},w=function(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(s[i[n]]=t[i[n]])}return s};const{PDFDataRangeTransport:_}=p,x=(t,e)=>{switch(e){case v.NEED_PASSWORD:t(prompt("Enter the password to open this PDF file."));break;case v.INCORRECT_PASSWORD:t(prompt("Invalid password. Please try again."));break}};function E(t){return"object"==typeof t&&null!==t&&("data"in t||"range"in t||"url"in t)}const S=(0,n.forwardRef)((function(t,e){var{children:s,className:c,error:d="Failed to load PDF file.",externalLinkRel:v,externalLinkTarget:S,file:C,inputRef:R,imageResourcesPath:T,loading:k="Loading PDF\u2026",noData:M="No PDF file specified.",onItemClick:P,onLoadError:I,onLoadProgress:L,onLoadSuccess:D,onPassword:F=x,onSourceError:O,onSourceSuccess:N,options:j,renderMode:B,rotate:H}=t,$=w(t,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[z,U]=(0,y.Z)(),{value:G,error:V}=z,[W,q]=(0,y.Z)(),{value:X,error:Y}=W,K=(0,n.useRef)(new m),J=(0,n.useRef)([]),Z=(0,n.useRef)(void 0),Q=(0,n.useRef)(void 0);C&&C!==Z.current&&E(C)&&(l(!u(C,Z.current),'File prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.'),Z.current=C),j&&j!==Q.current&&(l(!u(j,Q.current),'Options prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.'),Q.current=j);const tt=(0,n.useRef)({scrollPageIntoView:t=>{const{dest:e,pageNumber:s,pageIndex:i=s-1}=t;if(P)return void P({dest:e,pageIndex:i,pageNumber:s});const n=J.current[i];n?n.scrollIntoView():l(!1,`An internal link leading to page ${s} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document>
2 and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});(0,n.useImperativeHandle)(e,(()=>({linkService:K,pages:J,viewer:tt})),[]),(0,n.useEffect)((function(){U({type:"RESET"})}),[C,U]);const et=(0,n.useCallback)((()=>A(this,void 0,void 0,(function*(){if(!C)return null;if("string"==typeof C){if((0,b.gJ)(C)){return{data:(0,b.us)(C)}}return(0,b.tN)(),{url:C}}if(C instanceof _)return{range:C};if((0,b.eP)(C))return{data:C};if(b.jU&&(0,b.Lj)(C)){return{data:yield(0,b.eR)(C)}}if((0,h.Z)("object"==typeof C,"Invalid parameter in file, need either Uint8Array, string or a parameter object"),(0,h.Z)(E(C),"Invalid parameter object: need either .data, .range or .url"),"url"in C&&"string"==typeof C.url){if((0,b.gJ)(C.url)){const{url:t}=C,e=w(C,["url"]),s=(0,b.us)(t);return Object.assign({data:s},e)}(0,b.tN)()}return C}))),[C]);(0,n.useEffect)((()=>{const t=(0,a.Z)(et());return t.promise.then((t=>{U({type:"RESOLVE",value:t})})).catch((t=>{U({type:"REJECT",error:t})})),()=>{(0,b.LJ)(t)}}),[et,U]),(0,n.useEffect)((()=>{void 0!==G&&(!1!==G?N&&N():V&&(l(!1,V.toString()),O&&O(V)))}),[G]),(0,n.useEffect)((function(){q({type:"RESET"})}),[q,G]),(0,n.useEffect)((function(){if(!G)return;const t=j?Object.assign(Object.assign({},G),j):G,e=p.Me(t);L&&(e.onProgress=L),F&&(e.onPassword=F);const s=e,i=s.promise.then((t=>{q({type:"RESOLVE",value:t})})).catch((t=>{s.destroyed||q({type:"REJECT",error:t})}));return()=>{i.finally((()=>s.destroy()))}}),[j,q,G]),(0,n.useEffect)((()=>{void 0!==X&&(!1!==X?X&&(D&&D(X),J.current=new Array(X.numPages),K.current.setDocument(X)):Y&&(l(!1,Y.toString()),I&&I(Y)))}),[X]),(0,n.useEffect)((function(){K.current.setViewer(tt.current),K.current.setExternalLinkRel(v),K.current.setExternalLinkTarget(S)}),[v,S]);const st=(0,n.useCallback)(((t,e)=>{J.current[t]=e}),[]),it=(0,n.useCallback)((t=>{delete J.current[t]}),[]),nt=(0,n.useMemo)((()=>({imageResourcesPath:T,linkService:K.current,onItemClick:P,pdf:X,registerPage:st,renderMode:B,rotate:H,unregisterPage:it})),[T,P,X,st,B,H,it]),rt=(0,n.useMemo)((()=>(0,r.ZP)($,(()=>X))),[$,X]);return(0,i.jsx)("div",Object.assign({className:(0,o.Z)("react-pdf__Document",c),ref:R,style:{"--scale-factor":"1"}},rt,{children:C?null==X?(0,i.jsx)(g.Z,{type:"loading",children:"function"==typeof k?k():k}):!1===X?(0,i.jsx)(g.Z,{type:"error",children:"function"==typeof d?d():d}):(0,i.jsx)(f.Z.Provider,{value:nt,children:s}):(0,i.jsx)(g.Z,{type:"no-data",children:"function"==typeof M?M():M})}))}))},92956:(t,e,s)=>{s.d(e,{Z:()=>i});const i=(0,s(67294).createContext)(null)},41453:(t,e,s)=>{s.d(e,{Z:()=>n});var i=s(85893);function n({children:t,type:e}){return(0,i.jsx)("div",{className:`react-pdf__message react-pdf__message--${e}`,children:t})}},64455:(t,e,s)=>{s.d(e,{Z:()=>D});var i=s(85893),n=s(67294),r=s(94886),a=s(99211),o=s(56576);function h(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var s=t.filter(Boolean);return s.length<=1?s[0]||null:function(t){s.forEach((function(e){"function"==typeof e?e(t):e&&(e.current=t)}))}}var l=s(38776),c=s(10970);const d=(0,n.createContext)(null);var u=s(41453),p=s(6637);const f={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},g=/^H(\d+)$/;function m(t){return"children"in t}function v(t){return!!m(t)&&(1===t.children.length&&0 in t.children&&"id"in t.children[0])}function b(t){const e={};if(m(t)){const{role:s}=t,i=s.match(g);if(i)e.role="heading",e["aria-level"]=Number(i[1]);else if(function(t){return t in f}(s)){const t=f[s];t&&(e.role=t)}}return e}function y(t){const e={};if(m(t)){if(void 0!==t.alt&&(e["aria-label"]=t.alt),void 0!==t.lang&&(e.lang=t.lang),v(t)){const[s]=t.children;if(s){const t=y(s);return Object.assign(Object.assign({},e),t)}}}else"id"in t&&(e["aria-owns"]=t.id);return e}function A(t){return t?Object.assign(Object.assign({},b(t)),y(t)):null}function w({className:t,node:e}){const s=(0,n.useMemo)((()=>A(e)),[e]),r=(0,n.useMemo)((()=>
2m(e)?v(e)?null:e.children.map(((t,e)=>(0,i.jsx)(w,{node:t},e))):null),[e]);return(0,i.jsx)("span",Object.assign({className:t},s,{children:r}))}function _(){return(0,n.useContext)(d)}var x=s(75777),E=s(52782);function S(){const t=_();(0,l.Z)(t,"Unable to find Page context.");const{onGetStructTreeError:e,onGetStructTreeSuccess:s}=t,[a,o]=(0,x.Z)(),{value:h,error:d}=a,{customTextRenderer:u,page:p}=t;return(0,n.useEffect)((function(){o({type:"RESET"})}),[o,p]),(0,n.useEffect)((function(){if(u)return;if(!p)return;const t=(0,r.Z)(p.getStructTree()),e=t;return t.promise.then((t=>{o({type:"RESOLVE",value:t})})).catch((t=>{o({type:"REJECT",error:t})})),()=>(0,E.LJ)(e)}),[u,p,o]),(0,n.useEffect)((()=>{void 0!==h&&(!1!==h?h&&s&&s(h):d&&(c(!1,d.toString()),e&&e(d)))}),[h]),h?(0,i.jsx)(w,{className:"react-pdf__Page__structTree structTree",node:h}):null}const C=p.bM;function R(t){const e=_();(0,l.Z)(e,"Unable to find Page context.");const s=Object.assign(Object.assign({},e),t),{_className:r,canvasBackground:a,devicePixelRatio:o=(0,E.x_)(),onRenderError:d,onRenderSuccess:u,page:p,renderForms:f,renderTextLayer:g,rotate:m,scale:v}=s,{canvasRef:b}=t;(0,l.Z)(p,"Attempted to render page canvas, but no page was specified.");const y=(0,n.useRef)(null);function A(t){(0,E.DE)(t)||(c(!1,t.toString()),d&&d(t))}const w=(0,n.useMemo)((()=>p.getViewport({scale:v*o,rotation:m})),[o,p,m,v]),x=(0,n.useMemo)((()=>p.getViewport({scale:v,rotation:m})),[p,m,v]);(0,n.useEffect)((function(){if(!p)return;p.cleanup();const{current:t}=y;if(!t)return;t.width=w.width,t.height=w.height,t.style.width=`${Math.floor(x.width)}px`,t.style.height=`${Math.floor(x.height)}px`,t.style.visibility="hidden";const e={annotationMode:f?C.ENABLE_FORMS:C.ENABLE,canvasContext:t.getContext("2d",{alpha:!1}),viewport:w};a&&(e.background=a);const s=p.render(e),i=s;return s.promise.then((()=>{t.style.visibility="",p&&u&&u((0,E.XZ)(p,v))})).catch(A),()=>(0,E.LJ)(i)}),[a,p,f,w,x]);const R=(0,n.useCallback)((()=>{const{current:t}=y;t&&(t.width=0,t.height=0)}),[]);return(0,n.useEffect)((()=>R),[R]),(0,i.jsx)("canvas",{className:`${r}__canvas`,dir:"ltr",ref:h(b,y),style:{display:"block",userSelect:"none"},children:g?(0,i.jsx)(S,{}):null})}function T(){const t=_();(0,l.Z)(t,"Unable to find Page context.");const{customTextRenderer:e,onGetTextError:s,onGetTextSuccess:a,onRenderTextLayerError:h,onRenderTextLayerSuccess:d,page:u,pageIndex:f,pageNumber:g,rotate:m,scale:v}=t;(0,l.Z)(u,"Attempted to load page text content, but no page was specified.");const[b,y]=(0,x.Z)(),{value:A,error:w}=b,S=(0,n.useRef)(null);c(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10),"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer"),(0,n.useEffect)((function(){y({type:"RESET"})}),[u,y]),(0,n.useEffect)((function(){if(!u)return;const t=(0,r.Z)(u.getTextContent()),e=t;return t.promise.then((t=>{y({type:"RESOLVE",value:t})})).catch((t=>{y({type:"REJECT",error:t})})),()=>(0,E.LJ)(e)}),[u,y]),(0,n.useEffect)((()=>{void 0!==A&&(!1!==A?A&&a&&a(A):w&&(c(!1,w.toString()),s&&s(w)))}),[A]);const C=(0,n.useCallback)((()=>{d&&d()}),[d]),R=(0,n.useCallback)((t=>{c(!1,t.toString()),h&&h(t)}),[h]);const T=(0,n.useMemo)((()=>u.getViewport({scale:v,rotation:m})),[u,m,v]);return(0,n.useLayoutEffect)((function(){if(!u||!A)return;const{current:t}=S;if(!t)return;t.innerHTML="";const s=u.streamTextContent({includeMarkedContent:!0}),i={container:t,textContentSource:s,viewport:T},n=new p.AB(i),r=n;return n.render().then((()=>{const s=document.createElement("div");s.className="endOfContent",t.append(s);const i=t.querySelectorAll('[role="presentation"]');if(e){let t=0;A.items.forEach(((s,n)=>{if(!function(t){return"str"in t}(s))return;const r=i[t];if(!r)return;const a=e(Object.assign({pageIndex:f,pageNumber:g,itemIndex:n},s));r.innerHTML=a,t+=s.str&&s.hasEOL?2:1}))}C()})).catch(R),()=>(0,E.LJ)(r)}),[e,R,C,u,f,g,A,T]),(0,i.jsx)("div",{className:(0,o.Z)("react-pdf__Page__textContent","textLayer"),onMouseUp:function(){const t=S.current;t&&t.classList.remove("selecting")},onMouseDown:function(){const t=S.current;t&&t.classList.add("selecting")},ref:S})}var k=s(92956);function M(){return(0,n.useContext)(k.Z)}function P(){const t=M(),e=_();(0,l.Z)(e,"Unable to find Page context.");const s=Object.assign(Object.assign({},t),e),{imageResourcesPath:a,linkService:h,onGetAnnotationsError:d,onGetAnnotationsSuccess:u,onRenderAnnotationLayerError:f,onRenderAnnotationLayerSuccess:g,page:m,pdf:v,renderForms:b,rotate:y,scale:A=1}=s;(0,l.Z)(v,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document />
2 or pass explicit `pdf` prop."),(0,l.Z)(m,"Attempted to load page annotations, but no page was specified."),(0,l.Z)(h,"Attempted to load page annotations, but no linkService was specified.");const[w,S]=(0,x.Z)(),{value:C,error:R}=w,T=(0,n.useRef)(null);c(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10),"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations"),(0,n.useEffect)((function(){S({type:"RESET"})}),[S,m]),(0,n.useEffect)((function(){if(!m)return;const t=(0,r.Z)(m.getAnnotations()),e=t;return t.promise.then((t=>{S({type:"RESOLVE",value:t})})).catch((t=>{S({type:"REJECT",error:t})})),()=>{(0,E.LJ)(e)}}),[S,m]),(0,n.useEffect)((()=>{void 0!==C&&(!1!==C?C&&u&&u(C):R&&(c(!1,R.toString()),d&&d(R)))}),[C]);const k=(0,n.useMemo)((()=>m.getViewport({scale:A,rotation:y})),[m,y,A]);return(0,n.useEffect)((function(){if(!(v&&m&&h&&C))return;const{current:t}=T;if(!t)return;const e=k.clone({dontFlip:!0}),s={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:t,l10n:null,page:m,structTreeLayer:null,viewport:e},i={annotations:C,annotationStorage:v.annotationStorage,div:t,imageResourcesPath:a,linkService:h,page:m,renderForms:b,viewport:e};t.innerHTML="";try{new p.sO(s).render(i),g&&g()}catch(n){!function(t){c(!1,`${t}`),f&&f(t)}(n)}return()=>{}}),[C,a,h,m,v,b,k]),(0,i.jsx)("div",{className:(0,o.Z)("react-pdf__Page__annotations","annotationLayer"),ref:T})}var I=function(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(s[i[n]]=t[i[n]])}return s};const L=1;function D(t){const e=M(),s=Object.assign(Object.assign({},e),t),{_className:p="react-pdf__Page",_enableRegisterUnregisterPage:f=!0,canvasBackground:g,canvasRef:m,children:v,className:b,customRenderer:y,customTextRenderer:A,devicePixelRatio:w,error:_="Failed to load the page.",height:S,inputRef:C,loading:k="Loading page\u2026",noData:D="No page specified.",onGetAnnotationsError:F,onGetAnnotationsSuccess:O,onGetStructTreeError:N,onGetStructTreeSuccess:j,onGetTextError:B,onGetTextSuccess:H,onLoadError:$,onLoadSuccess:z,onRenderAnnotationLayerError:U,onRenderAnnotationLayerSuccess:G,onRenderError:V,onRenderSuccess:W,onRenderTextLayerError:q,onRenderTextLayerSuccess:X,pageIndex:Y,pageNumber:K,pdf:J,registerPage:Z,renderAnnotationLayer:Q=!0,renderForms:tt=!1,renderMode:et="canvas",renderTextLayer:st=!0,rotate:it,scale:nt=L,unregisterPage:rt,width:at}=s,ot=I(s,["_className","_enableRegisterUnregisterPage","canvasBackground","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"]),[ht,lt]=(0,x.Z)(),{value:ct,error:dt}=ht,ut=(0,n.useRef)(null);(0,l.Z)(J,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");const pt=(0,E.T8)(K)?K-1:null!=Y?Y:null,ft=null!=K?K:(0,E.T8)(Y)?Y+1:null,gt=null!=it?it:ct?ct.rotate:null,mt=(0,n.useMemo)((()=>{if(!ct)return null;let t=1;const e=null!=nt?nt:L;if(at||S){const e=ct.getViewport({scale:1,rotation:gt});at?t=at/e.width:S&&(t=S/e.height)}return e*t}),[S,ct,gt,nt,at]);(0,n.useEffect)((function(){return()=>{(0,E.T8)(pt)&&f&&rt&&rt(pt)}}),[f,J,pt,rt]),(0,n.useEffect)((function(){lt({type:"RESET"})}),[lt,J,pt]),(0,n.useEffect)((function(){if(!J||!ft)return;const t=(0,r.Z)(J.getPage(ft)),e=t;return t.promise.then((t=>{lt({type:"RESOLVE",value:t})})).catch((t=>{lt({type:"REJECT",error:t})}
2)),()=>(0,E.LJ)(e)}),[lt,J,ft]),(0,n.useEffect)((()=>{void 0!==ct&&(!1!==ct?function(){if(z){if(!ct||!mt)return;z((0,E.XZ)(ct,mt))}if(f&&Z){if(!(0,E.T8)(pt)||!ut.current)return;Z(pt,ut.current)}}():dt&&(c(!1,dt.toString()),$&&$(dt)))}),[ct,mt]);const vt=(0,n.useMemo)((()=>ct&&(0,E.T8)(pt)&&ft&&(0,E.T8)(gt)&&(0,E.T8)(mt)?{_className:p,canvasBackground:g,customTextRenderer:A,devicePixelRatio:w,onGetAnnotationsError:F,onGetAnnotationsSuccess:O,onGetStructTreeError:N,onGetStructTreeSuccess:j,onGetTextError:B,onGetTextSuccess:H,onRenderAnnotationLayerError:U,onRenderAnnotationLayerSuccess:G,onRenderError:V,onRenderSuccess:W,onRenderTextLayerError:q,onRenderTextLayerSuccess:X,page:ct,pageIndex:pt,pageNumber:ft,renderForms:tt,renderTextLayer:st,rotate:gt,scale:mt}:null),[p,g,A,w,F,O,N,j,B,H,U,G,V,W,q,X,ct,pt,ft,tt,st,gt,mt]),bt=(0,n.useMemo)((()=>(0,a.ZP)(ot,(()=>ct?mt?(0,E.XZ)(ct,mt):void 0:ct))),[ot,ct,mt]),yt=`${pt}@${mt}/${gt}`;function At(){switch(et){case"custom":return(0,l.Z)(y,'renderMode was set to "custom", but no customRenderer was passed.'),(0,i.jsx)(y,{},`${yt}_custom`);case"none":return null;default:return(0,i.jsx)(R,{canvasRef:m},`${yt}_canvas`)}}return(0,i.jsx)("div",Object.assign({className:(0,o.Z)(p,b),"data-page-number":ft,ref:h(C,ut),style:{"--scale-factor":`${mt}`,backgroundColor:g||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},bt,{children:ft?null===J||null==ct?(0,i.jsx)(u.Z,{type:"loading",children:"function"==typeof k?k():k}):!1===J||!1===ct?(0,i.jsx)(u.Z,{type:"error",children:"function"==typeof _?_():_}):(0,i.jsxs)(d.Provider,{value:vt,children:[At(),st?(0,i.jsx)(T,{},`${yt}_text`):null,Q?(0,i.jsx)(P,{},`${yt}_annotations`):null,v]}):(0,i.jsx)(u.Z,{type:"no-data",children:"function"==typeof D?D():D})}))}},75777:(t,e,s)=>{s.d(e,{Z:()=>r});var i=s(67294);function n(t,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return t}}function r(){return(0,i.useReducer)(n,{value:void 0,error:void 0})}},52782:(t,e,s)=>{s.d(e,{DE:()=>v,LJ:()=>g,Lj:()=>l,T8:()=>o,XZ:()=>m,eP:()=>h,eR:()=>b,gJ:()=>c,jU:()=>r,tN:()=>f,us:()=>d,x_:()=>u});var i=s(38776),n=s(10970);const r="undefined"!=typeof window,a=r&&"file:"===window.location.protocol;function o(t){return function(t){return void 0!==t}(t)&&null!==t}function h(t){return t instanceof ArrayBuffer}function l(t){return(0,i.Z)(r,"isBlob can only be used in a browser environment"),t instanceof Blob}function c(t){return function(t){return"string"==typeof t}(t)&&/^data:/.test(t)}function d(t){(0,i.Z)(c(t),"Invalid data URI.");const[e="",s=""]=t.split(",");return-1!==e.split(";").indexOf("base64")?atob(s):unescape(s)}function u(){return r&&window.devicePixelRatio||1}const p="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function f(){n(!a,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${p}`)}function g(t){(null==t?void 0:t.cancel)&&t.cancel()}function m(t,e){return Object.defineProperty(t,"width",{get(){return this.view[2]*e},configurable:!0}),Object.defineProperty(t,"height",{get(){return this.view[3]*e},configurable:!0}),Object.defineProperty(t,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(t,"originalHeight",{get(){return this.view[3]},configurable:!0}),t}
2function v(t){return"RenderingCancelledException"===t.name}function b(t){return new Promise(((e,s)=>{const i=new FileReader;i.onload=()=>{if(!i.result)return s(new Error("Error while reading a file."));e(i.result)},i.onerror=t=>{if(!t.target)return s(new Error("Error while reading a file."));const{error:e}=t.target;if(!e)return s(new Error("Error while reading a file."));switch(e.code){case e.NOT_FOUND_ERR:return s(new Error("Error while reading a file: File not found."));case e.SECURITY_ERR:return s(new Error("Error while reading a file: Security error."));case e.ABORT_ERR:return s(new Error("Error while reading a file: Aborted."));default:return s(new Error("Error while reading a file."))}},i.readAsArrayBuffer(t)}))}},56576:(t,e,s)=>{function i(t){var e,s,n="";if("string"==typeof t||"number"==typeof t)n+=t;else if("object"==typeof t)if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(s=i(t[e]))&&(n&&(n+=" "),n+=s)}else for(s in t)t[s]&&(n&&(n+=" "),n+=s);return n}s.d(e,{Z:()=>n});const n=function(){for(var t,e,s=0,n="",r=arguments.length;s<r;s++)(t=arguments[s])&&(e=i(t))&&(n&&(n+=" "),n+=e);return n}},38776:(t,e,s)=>{s.d(e,{Z:()=>r});var i=!0,n="Invariant failed";function r(t,e){if(!t){if(i)throw new Error(n);var s="function"==typeof e?e():e,r=s?"".concat(n,": ").concat(s):n;throw new Error(r)}}}}]); 3//# sourceMappingURL=3639.ed69bc46a80aabc944ba.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.