Files
openmaxio-object-browser/web-app/build/static/js/2346.9d72333b.chunk.js
2024-10-16 09:00:37 -07:00

3 lines
389 KiB
JavaScript

/*! For license information please see 2346.9d72333b.chunk.js.LICENSE.txt */
(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[2346],{18628:(t,e)=>{"use strict";e.A=function(t,e){if(t&&e){var i=Array.isArray(e)?e:e.split(","),s=t.name||"",n=(t.type||"").toLowerCase(),a=n.replace(/\/.*$/,"");return i.some((function(t){var e=t.trim().toLowerCase();return"."===e.charAt(0)?s.toLowerCase().endsWith(e):e.endsWith("/*")?a===e.replace(/\/.*$/,""):n===e}))}return!0}},75270:(t,e,i)=>{"use strict";var s=i(40139),n={"text/plain":"Text","text/html":"Url",default:"Text"};t.exports=function(t,e){var i,a,r,o,l,h,c=!1;e||(e={}),i=e.debug||!1;try{if(r=s(),o=document.createRange(),l=document.getSelection(),(h=document.createElement("span")).textContent=t,h.ariaHidden="true",h.style.all="unset",h.style.position="fixed",h.style.top=0,h.style.clip="rect(0, 0, 0, 0)",h.style.whiteSpace="pre",h.style.webkitUserSelect="text",h.style.MozUserSelect="text",h.style.msUserSelect="text",h.style.userSelect="text",h.addEventListener("copy",(function(s){if(s.stopPropagation(),e.format)if(s.preventDefault(),"undefined"===typeof s.clipboardData){i&&console.warn("unable to use e.clipboardData"),i&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var a=n[e.format]||n.default;window.clipboardData.setData(a,t)}else s.clipboardData.clearData(),s.clipboardData.setData(e.format,t);e.onCopy&&(s.preventDefault(),e.onCopy(s.clipboardData))})),document.body.appendChild(h),o.selectNodeContents(h),l.addRange(o),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!0}catch(d){i&&console.error("unable to copy using execCommand: ",d),i&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),c=!0}catch(d){i&&console.error("unable to copy using clipboardData: ",d),i&&console.error("falling back to prompt"),a=function(t){var e=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return t.replace(/#{\s*key\s*}/g,e)}("message"in e?e.message:"Copy to clipboard: #{key}, Enter"),window.prompt(a,t)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(o):l.removeAllRanges()),h&&document.body.removeChild(h),r()}return c}},24480:(t,e,i)=>{"use strict";function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.CopyToClipboard=void 0;var n=o(i(65043)),a=o(i(75270)),r=["text","onCopy","options","children"];function o(t){return t&&t.__esModule?t:{default:t}}function l(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,s)}return i}function h(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?l(Object(i),!0).forEach((function(e){m(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):l(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function c(t,e){if(null==t)return{};var i,s,n=function(t,e){if(null==t)return{};var i,s,n={},a=Object.keys(t);for(s=0;s<a.length;s++)i=a[s],e.indexOf(i)>=0||(n[i]=t[i]);return n}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)i=a[s],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(n[i]=t[i])}return n}function d(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}function u(t,e){return u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},u(t,e)}function p(t){var e=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=g(t);if(e){var a=g(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"===s(e)||"function"===typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return f(t)}(this,i)}}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g(t){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},g(t)}function m(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var v=function(t){!function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&u(t,e)}(l,t);var e,i,s,o=p(l);function l(){var t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l);for(var e=arguments.length,i=new Array(e),s=0;s<e;s++)i[s]=arguments[s];return m(f(t=o.call.apply(o,[this].concat(i))),"onClick",(function(e){var i=t.props,s=i.text,r=i.onCopy,o=i.children,l=i.options,h=n.default.Children.only(o),c=(0,a.default)(s,l);r&&r(s,c),h&&h.props&&"function"===typeof h.props.onClick&&h.props.onClick(e)})),t}return e=l,(i=[{key:"render",value:function(){var t=this.props,e=(t.text,t.onCopy,t.options,t.children),i=c(t,r),s=n.default.Children.only(e);return n.default.cloneElement(s,h(h({},i),{},{onClick:this.onClick}))}}])&&d(e.prototype,i),s&&d(e,s),Object.defineProperty(e,"prototype",{writable:!1}),l}(n.default.PureComponent);e.CopyToClipboard=v,m(v,"defaultProps",{onCopy:void 0,options:void 0})},61476:(t,e,i)=>{"use strict";var s=i(24480).CopyToClipboard;s.CopyToClipboard=s,t.exports=s},94281:(t,e,i)=>{"use strict";i.d(e,{VB:()=>dt});var s=i(65043),n=i(65173),a=i.n(n);function r(t,e,i,s){return new(i||(i=Promise))((function(n,a){function r(t){try{l(s.next(t))}catch(e){a(e)}}function o(t){try{l(s.throw(t))}catch(e){a(e)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,o)}l((s=s.apply(t,e||[])).next())}))}function o(t,e){var i,s,n,a,r={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"===typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(l){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(r=0)),r;)try{if(i=1,s&&(n=2&o[0]?s.return:o[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,o[1])).done)return n;switch(s=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,s=o[1],o=[0];continue;case 7:o=r.ops.pop(),r.trys.pop();continue;default:if(!(n=(n=r.trys).length>0&&n[n.length-1])&&(6===o[0]||2===o[0])){r=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){r.label=o[1];break}if(6===o[0]&&r.label<n[1]){r.label=n[1],n=o;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(o);break}n[2]&&r.ops.pop(),r.trys.pop();continue}o=e.call(t,r)}catch(l){o=[6,l],s=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}}Object.create;function l(t,e){var i="function"===typeof Symbol&&t[Symbol.iterator];if(!i)return t;var s,n,a=i.call(t),r=[];try{for(;(void 0===e||e-- >0)&&!(s=a.next()).done;)r.push(s.value)}catch(o){n={error:o}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return r}function h(t,e,i){if(i||2===arguments.length)for(var s,n=0,a=e.length;n<a;n++)!s&&n in e||(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}Object.create;"function"===typeof SuppressedError&&SuppressedError;var c=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function d(t,e){var i=function(t){var e=t.name;if(e&&-1!==e.lastIndexOf(".")&&!t.type){var i=e.split(".").pop().toLowerCase(),s=c.get(i);s&&Object.defineProperty(t,"type",{value:s,writable:!1,configurable:!1,enumerable:!0})}return t}(t);if("string"!==typeof i.path){var s=t.webkitRelativePath;Object.defineProperty(i,"path",{value:"string"===typeof e?e:"string"===typeof s&&s.length>0?s:t.name,writable:!1,configurable:!1,enumerable:!0})}return i}var u=[".DS_Store","Thumbs.db"];function p(t){return"object"===typeof t&&null!==t}function f(t){return b(t.target.files).map((function(t){return d(t)}))}function g(t){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,Promise.all(t.map((function(t){return t.getFile()})))];case 1:return[2,e.sent().map((function(t){return d(t)}))]}}))}))}function m(t,e){return r(this,void 0,void 0,(function(){var i;return o(this,(function(s){switch(s.label){case 0:return t.items?(i=b(t.items).filter((function(t){return"file"===t.kind})),"drop"!==e?[2,i]:[4,Promise.all(i.map(A))]):[3,2];case 1:return[2,v(y(s.sent()))];case 2:return[2,v(b(t.files).map((function(t){return d(t)})))]}}))}))}function v(t){return t.filter((function(t){return-1===u.indexOf(t.name)}))}function b(t){if(null===t)return[];for(var e=[],i=0;i<t.length;i++){var s=t[i];e.push(s)}return e}function A(t){if("function"!==typeof t.webkitGetAsEntry)return w(t);var e=t.webkitGetAsEntry();return e&&e.isDirectory?x(e):w(t)}function y(t){return t.reduce((function(t,e){return h(h([],l(t),!1),l(Array.isArray(e)?y(e):[e]),!1)}),[])}function w(t){var e=t.getAsFile();if(!e)return Promise.reject("".concat(t," is not a File"));var i=d(e);return Promise.resolve(i)}function _(t){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,t.isDirectory?x(t):k(t)]}))}))}function x(t){var e=t.createReader();return new Promise((function(t,i){var s=[];!function n(){var a=this;e.readEntries((function(e){return r(a,void 0,void 0,(function(){var a,r,l;return o(this,(function(o){switch(o.label){case 0:if(e.length)return[3,5];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,Promise.all(s)];case 2:return a=o.sent(),t(a),[3,4];case 3:return r=o.sent(),i(r),[3,4];case 4:return[3,6];case 5:l=Promise.all(e.map(_)),s.push(l),n(),o.label=6;case 6:return[2]}}))}))}),(function(t){i(t)}))}()}))}function k(t){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new Promise((function(e,i){t.file((function(i){var s=d(i,t.fullPath);e(s)}),(function(t){i(t)}))}))]}))}))}var E=i(18628);function S(t){return function(t){if(Array.isArray(t))return L(t)}(t)||function(t){if("undefined"!==typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||P(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,s)}return i}function C(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?M(Object(i),!0).forEach((function(e){R(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):M(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function R(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function T(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!==typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==i)return;var s,n,a=[],r=!0,o=!1;try{for(i=i.call(t);!(r=(s=i.next()).done)&&(a.push(s.value),!e||a.length!==e);r=!0);}catch(l){o=!0,n=l}finally{try{r||null==i.return||i.return()}finally{if(o)throw n}}return a}(t,e)||P(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function P(t,e){if(t){if("string"===typeof t)return L(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?L(t,e):void 0}}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=new Array(e);i<e;i++)s[i]=t[i];return s}var D="file-invalid-type",I="file-too-large",F="file-too-small",O="too-many-files",N=function(t){t=Array.isArray(t)&&1===t.length?t[0]:t;var e=Array.isArray(t)?"one of ".concat(t.join(", ")):t;return{code:D,message:"File type must be ".concat(e)}},W=function(t){return{code:I,message:"File is larger than ".concat(t," ").concat(1===t?"byte":"bytes")}},j=function(t){return{code:F,message:"File is smaller than ".concat(t," ").concat(1===t?"byte":"bytes")}},B={code:O,message:"Too many files"};function H(t,e){var i="application/x-moz-file"===t.type||(0,E.A)(t,e);return[i,i?null:N(e)]}function z(t,e,i){if(V(t.size))if(V(e)&&V(i)){if(t.size>i)return[!1,W(i)];if(t.size<e)return[!1,j(e)]}else{if(V(e)&&t.size<e)return[!1,j(e)];if(V(i)&&t.size>i)return[!1,W(i)]}return[!0,null]}function V(t){return void 0!==t&&null!==t}function G(t){return"function"===typeof t.isPropagationStopped?t.isPropagationStopped():"undefined"!==typeof t.cancelBubble&&t.cancelBubble}function U(t){return t.dataTransfer?Array.prototype.some.call(t.dataTransfer.types,(function(t){return"Files"===t||"application/x-moz-file"===t})):!!t.target&&!!t.target.files}function q(t){t.preventDefault()}function X(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(t){for(var i=arguments.length,s=new Array(i>1?i-1:0),n=1;n<i;n++)s[n-1]=arguments[n];return e.some((function(e){return!G(t)&&e&&e.apply(void 0,[t].concat(s)),G(t)}))}}function K(t){return"audio/*"===t||"video/*"===t||"image/*"===t||"text/*"===t||/\w+\/[-+.\w]+/g.test(t)}function Y(t){return/^.*\.[\w]+$/.test(t)}var Q=["children"],J=["open"],Z=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],$=["refKey","onChange","onClick"];function tt(t){return function(t){if(Array.isArray(t))return st(t)}(t)||function(t){if("undefined"!==typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||it(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function et(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!==typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==i)return;var s,n,a=[],r=!0,o=!1;try{for(i=i.call(t);!(r=(s=i.next()).done)&&(a.push(s.value),!e||a.length!==e);r=!0);}catch(l){o=!0,n=l}finally{try{r||null==i.return||i.return()}finally{if(o)throw n}}return a}(t,e)||it(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){if(t){if("string"===typeof t)return st(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?st(t,e):void 0}}function st(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=new Array(e);i<e;i++)s[i]=t[i];return s}function nt(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,s)}return i}function at(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?nt(Object(i),!0).forEach((function(e){rt(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):nt(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function rt(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ot(t,e){if(null==t)return{};var i,s,n=function(t,e){if(null==t)return{};var i,s,n={},a=Object.keys(t);for(s=0;s<a.length;s++)i=a[s],e.indexOf(i)>=0||(n[i]=t[i]);return n}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)i=a[s],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(n[i]=t[i])}return n}var lt=(0,s.forwardRef)((function(t,e){var i=t.children,n=dt(ot(t,Q)),a=n.open,r=ot(n,J);return(0,s.useImperativeHandle)(e,(function(){return{open:a}}),[a]),s.createElement(s.Fragment,null,i(at(at({},r),{},{open:a})))}));lt.displayName="Dropzone";var ht={disabled:!1,getFilesFromEvent:function(t){return r(this,void 0,void 0,(function(){return o(this,(function(e){return p(t)&&p(t.dataTransfer)?[2,m(t.dataTransfer,t.type)]:function(t){return p(t)&&p(t.target)}(t)?[2,f(t)]:Array.isArray(t)&&t.every((function(t){return"getFile"in t&&"function"===typeof t.getFile}))?[2,g(t)]:[2,[]]}))}))},maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};lt.defaultProps=ht,lt.propTypes={children:a().func,accept:a().objectOf(a().arrayOf(a().string)),multiple:a().bool,preventDropOnDocument:a().bool,noClick:a().bool,noKeyboard:a().bool,noDrag:a().bool,noDragEventsBubbling:a().bool,minSize:a().number,maxSize:a().number,maxFiles:a().number,disabled:a().bool,getFilesFromEvent:a().func,onFileDialogCancel:a().func,onFileDialogOpen:a().func,useFsAccessApi:a().bool,autoFocus:a().bool,onDragEnter:a().func,onDragLeave:a().func,onDragOver:a().func,onDrop:a().func,onDropAccepted:a().func,onDropRejected:a().func,onError:a().func,validator:a().func};var ct={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function dt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=at(at({},ht),t),i=e.accept,n=e.disabled,a=e.getFilesFromEvent,r=e.maxSize,o=e.minSize,l=e.multiple,h=e.maxFiles,c=e.onDragEnter,d=e.onDragLeave,u=e.onDragOver,p=e.onDrop,f=e.onDropAccepted,g=e.onDropRejected,m=e.onFileDialogCancel,v=e.onFileDialogOpen,b=e.useFsAccessApi,A=e.autoFocus,y=e.preventDropOnDocument,w=e.noClick,_=e.noKeyboard,x=e.noDrag,k=e.noDragEventsBubbling,E=e.onError,M=e.validator,P=(0,s.useMemo)((function(){return function(t){if(V(t))return Object.entries(t).reduce((function(t,e){var i=T(e,2),s=i[0],n=i[1];return[].concat(S(t),[s],S(n))}),[]).filter((function(t){return K(t)||Y(t)})).join(",")}(i)}),[i]),L=(0,s.useMemo)((function(){return function(t){return V(t)?[{description:"Files",accept:Object.entries(t).filter((function(t){var e=T(t,2),i=e[0],s=e[1],n=!0;return K(i)||(console.warn('Skipped "'.concat(i,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),n=!1),Array.isArray(s)&&s.every(Y)||(console.warn('Skipped "'.concat(i,'" because an invalid file extension was provided.')),n=!1),n})).reduce((function(t,e){var i=T(e,2),s=i[0],n=i[1];return C(C({},t),{},R({},s,n))}),{})}]:t}(i)}),[i]),D=(0,s.useMemo)((function(){return"function"===typeof v?v:pt}),[v]),I=(0,s.useMemo)((function(){return"function"===typeof m?m:pt}),[m]),F=(0,s.useRef)(null),O=(0,s.useRef)(null),N=et((0,s.useReducer)(ut,ct),2),W=N[0],j=N[1],Q=W.isFocused,J=W.isFileDialogActive,it=(0,s.useRef)("undefined"!==typeof window&&window.isSecureContext&&b&&"showOpenFilePicker"in window),st=function(){!it.current&&J&&setTimeout((function(){O.current&&(O.current.files.length||(j({type:"closeDialog"}),I()))}),300)};(0,s.useEffect)((function(){return window.addEventListener("focus",st,!1),function(){window.removeEventListener("focus",st,!1)}}),[O,J,I,it]);var nt=(0,s.useRef)([]),lt=function(t){F.current&&F.current.contains(t.target)||(t.preventDefault(),nt.current=[])};(0,s.useEffect)((function(){return y&&(document.addEventListener("dragover",q,!1),document.addEventListener("drop",lt,!1)),function(){y&&(document.removeEventListener("dragover",q),document.removeEventListener("drop",lt))}}),[F,y]),(0,s.useEffect)((function(){return!n&&A&&F.current&&F.current.focus(),function(){}}),[F,A,n]);var dt=(0,s.useCallback)((function(t){E?E(t):console.error(t)}),[E]),ft=(0,s.useCallback)((function(t){t.preventDefault(),t.persist(),Mt(t),nt.current=[].concat(tt(nt.current),[t.target]),U(t)&&Promise.resolve(a(t)).then((function(e){if(!G(t)||k){var i=e.length,s=i>0&&function(t){var e=t.files,i=t.accept,s=t.minSize,n=t.maxSize,a=t.multiple,r=t.maxFiles,o=t.validator;return!(!a&&e.length>1||a&&r>=1&&e.length>r)&&e.every((function(t){var e=T(H(t,i),1)[0],a=T(z(t,s,n),1)[0],r=o?o(t):null;return e&&a&&!r}))}({files:e,accept:P,minSize:o,maxSize:r,multiple:l,maxFiles:h,validator:M});j({isDragAccept:s,isDragReject:i>0&&!s,isDragActive:!0,type:"setDraggedFiles"}),c&&c(t)}})).catch((function(t){return dt(t)}))}),[a,c,dt,k,P,o,r,l,h,M]),gt=(0,s.useCallback)((function(t){t.preventDefault(),t.persist(),Mt(t);var e=U(t);if(e&&t.dataTransfer)try{t.dataTransfer.dropEffect="copy"}catch(i){}return e&&u&&u(t),!1}),[u,k]),mt=(0,s.useCallback)((function(t){t.preventDefault(),t.persist(),Mt(t);var e=nt.current.filter((function(t){return F.current&&F.current.contains(t)})),i=e.indexOf(t.target);-1!==i&&e.splice(i,1),nt.current=e,e.length>0||(j({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),U(t)&&d&&d(t))}),[F,d,k]),vt=(0,s.useCallback)((function(t,e){var i=[],s=[];t.forEach((function(t){var e=et(H(t,P),2),n=e[0],a=e[1],l=et(z(t,o,r),2),h=l[0],c=l[1],d=M?M(t):null;if(n&&h&&!d)i.push(t);else{var u=[a,c];d&&(u=u.concat(d)),s.push({file:t,errors:u.filter((function(t){return t}))})}})),(!l&&i.length>1||l&&h>=1&&i.length>h)&&(i.forEach((function(t){s.push({file:t,errors:[B]})})),i.splice(0)),j({acceptedFiles:i,fileRejections:s,type:"setFiles"}),p&&p(i,s,e),s.length>0&&g&&g(s,e),i.length>0&&f&&f(i,e)}),[j,l,P,o,r,h,p,f,g,M]),bt=(0,s.useCallback)((function(t){t.preventDefault(),t.persist(),Mt(t),nt.current=[],U(t)&&Promise.resolve(a(t)).then((function(e){G(t)&&!k||vt(e,t)})).catch((function(t){return dt(t)})),j({type:"reset"})}),[a,vt,dt,k]),At=(0,s.useCallback)((function(){if(it.current){j({type:"openDialog"}),D();var t={multiple:l,types:L};window.showOpenFilePicker(t).then((function(t){return a(t)})).then((function(t){vt(t,null),j({type:"closeDialog"})})).catch((function(t){var e;(e=t)instanceof DOMException&&("AbortError"===e.name||e.code===e.ABORT_ERR)?(I(t),j({type:"closeDialog"})):!function(t){return t instanceof DOMException&&("SecurityError"===t.name||t.code===t.SECURITY_ERR)}(t)?dt(t):(it.current=!1,O.current?(O.current.value=null,O.current.click()):dt(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided.")))}))}else O.current&&(j({type:"openDialog"}),D(),O.current.value=null,O.current.click())}),[j,D,I,b,vt,dt,L,l]),yt=(0,s.useCallback)((function(t){F.current&&F.current.isEqualNode(t.target)&&(" "!==t.key&&"Enter"!==t.key&&32!==t.keyCode&&13!==t.keyCode||(t.preventDefault(),At()))}),[F,At]),wt=(0,s.useCallback)((function(){j({type:"focus"})}),[]),_t=(0,s.useCallback)((function(){j({type:"blur"})}),[]),xt=(0,s.useCallback)((function(){w||(!function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.navigator.userAgent;return function(t){return-1!==t.indexOf("MSIE")||-1!==t.indexOf("Trident/")}(t)||function(t){return-1!==t.indexOf("Edge/")}(t)}()?At():setTimeout(At,0))}),[w,At]),kt=function(t){return n?null:t},Et=function(t){return _?null:kt(t)},St=function(t){return x?null:kt(t)},Mt=function(t){k&&t.stopPropagation()},Ct=(0,s.useMemo)((function(){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.refKey,i=void 0===e?"ref":e,s=t.role,a=t.onKeyDown,r=t.onFocus,o=t.onBlur,l=t.onClick,h=t.onDragEnter,c=t.onDragOver,d=t.onDragLeave,u=t.onDrop,p=ot(t,Z);return at(at(rt({onKeyDown:Et(X(a,yt)),onFocus:Et(X(r,wt)),onBlur:Et(X(o,_t)),onClick:kt(X(l,xt)),onDragEnter:St(X(h,ft)),onDragOver:St(X(c,gt)),onDragLeave:St(X(d,mt)),onDrop:St(X(u,bt)),role:"string"===typeof s&&""!==s?s:"presentation"},i,F),n||_?{}:{tabIndex:0}),p)}}),[F,yt,wt,_t,xt,ft,gt,mt,bt,_,x,n]),Rt=(0,s.useCallback)((function(t){t.stopPropagation()}),[]),Tt=(0,s.useMemo)((function(){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.refKey,i=void 0===e?"ref":e,s=t.onChange,n=t.onClick,a=ot(t,$);return at(at({},rt({accept:P,multiple:l,type:"file",style:{display:"none"},onChange:kt(X(s,bt)),onClick:kt(X(n,Rt)),tabIndex:-1},i,O)),a)}}),[O,i,l,bt,n]);return at(at({},W),{},{isFocused:Q&&!n,getRootProps:Ct,getInputProps:Tt,rootRef:F,inputRef:O,open:kt(At)})}function ut(t,e){switch(e.type){case"focus":return at(at({},t),{},{isFocused:!0});case"blur":return at(at({},t),{},{isFocused:!1});case"openDialog":return at(at({},ct),{},{isFileDialogActive:!0});case"closeDialog":return at(at({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return at(at({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return at(at({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections});case"reset":return at({},ct);default:return t}}function pt(){}},40139:t=>{t.exports=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,i=[],s=0;s<t.rangeCount;s++)i.push(t.getRangeAt(s));switch(e.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":e.blur();break;default:e=null}return t.removeAllRanges(),function(){"Caret"===t.type&&t.removeAllRanges(),t.rangeCount||i.forEach((function(e){t.addRange(e)})),e&&e.focus()}}},96440:t=>{"use strict";var e=function(){};t.exports=e},40645:(t,e,i)=>{"use strict";function s(t){var e=!1;return{promise:new Promise((function(i,s){t.then((function(t){return!e&&i(t)})).catch((function(t){return!e&&s(t)}))})),cancel:function(){e=!0}}}i.d(e,{A:()=>s})},77906:(t,e,i)=>{"use strict";i.d(e,{Ay:()=>a});var s=function(t,e,i){if(i||2===arguments.length)for(var s,n=0,a=e.length;n<a;n++)!s&&n in e||(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))},n=s(s(s(s(s(s(s(s(s(s(s(s(s(s(s(s(s(s([],["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 a(t,e){var i={};return n.forEach((function(s){var n=t[s];n&&(i[s]=e?function(t){return n(t,e(s))}:n)})),i}},77397:(t,e,i)=>{"use strict";function s(t,e,i){e||(e=[]);var s=e.length++;return Object.defineProperty({},"_",{set:function(n){e[s]=n,t.apply(i,e)}})}function n(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function a(t,e){n(t,e),e.add(t)}function r(t,e,i){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:i;throw new TypeError("Private element is not present on this object")}function o(t,e,i){return i(r(t,e))}i.d(e,{dU:()=>nf,ng:()=>af,EA:()=>rf,Tm:()=>of,D6:()=>lf,YE:()=>hf});var l,h,c,d,u,p,f,g,m,v,b,A,y=i(64467);function w(t,e,i){n(t,e),e.set(t,i)}function _(t,e){return t.get(r(t,e))}function x(t,e,i){return t.set(r(t,e),i),i}var k={d:(t,e)=>{for(var i in e)k.o(e,i)&&!k.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},E=globalThis.pdfjsLib={};k.d(E,{AbortException:()=>Nt,AnnotationEditorLayer:()=>Hp,AnnotationEditorParamsType:()=>j,AnnotationEditorType:()=>W,AnnotationEditorUIManager:()=>Rs,AnnotationLayer:()=>$h,AnnotationMode:()=>N,CMapCompressionType:()=>bt,ColorPicker:()=>Md,DOMSVGFactory:()=>Ie,DrawLayer:()=>$p,FeatureTest:()=>Ht,GlobalWorkerOptions:()=>za,ImageKind:()=>X,InvalidPDFException:()=>Dt,MissingPDFException:()=>It,OPS:()=>At,Outliner:()=>Cc,PDFDataRangeTransport:()=>Bo,PDFDateString:()=>qe,PDFWorker:()=>$o,PasswordResponses:()=>yt,PermissionFlag:()=>B,PixelsPerInch:()=>ue,RenderingCancelledException:()=>Oe,TextLayer:()=>vo,UnexpectedResponseException:()=>Ft,Util:()=>Vt,VerbosityLevel:()=>vt,XfaLayer:()=>Sl,build:()=>_l,createValidAbsoluteUrl:()=>Ct,fetchData:()=>Pe,getDocument:()=>Oo,getFilenameFromUrl:()=>je,getPdfFilenameFromUrl:()=>Be,getXfaPageViewport:()=>Xe,isDataScheme:()=>Ne,isPdfFile:()=>We,noContextMenu:()=>Ve,normalizeUnicode:()=>Kt,renderTextLayer:()=>Co,setLayerDimensions:()=>Je,shadow:()=>Rt,updateTextLayer:()=>Ro,version:()=>wl});const S="object"===typeof process&&process+""==="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&"browser"!==process.type),M=[1,0,0,1,0,0],C=[.001,0,0,.001,0,0],R=1.35,T=1,P=2,L=4,D=16,I=32,F=64,O=256,N={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},W={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},j={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},B={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},H=0,z=1,V=2,G=3,U=3,q=4,X={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},K=1,Y=2,Q=3,J=4,Z=5,$=6,tt=7,et=8,it=9,st=10,nt=11,at=12,rt=13,ot=14,lt=15,ht=16,ct=17,dt=20,ut=1,pt=2,ft=3,gt=4,mt=5,vt={ERRORS:0,WARNINGS:1,INFOS:5},bt={NONE:0,BINARY:1},At={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},yt={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let wt=vt.WARNINGS;function _t(t){Number.isInteger(t)&&(wt=t)}function xt(){return wt}function kt(t){wt>=vt.INFOS&&console.log("Info: ".concat(t))}function Et(t){wt>=vt.WARNINGS&&console.log("Warning: ".concat(t))}function St(t){throw new Error(t)}function Mt(t,e){t||St(e)}function Ct(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!t)return null;try{if(i&&"string"===typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);(null===e||void 0===e?void 0:e.length)>=2&&(t="http://".concat(t))}if(i.tryConvertEncoding)try{t=decodeURIComponent(escape(t))}catch{}}const s=e?new URL(t,e):new URL(t);if(function(t){switch(null===t||void 0===t?void 0:t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(s))return s}catch{}return null}function Rt(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Object.defineProperty(t,e,{value:i,enumerable:!s,configurable:!0,writable:!1}),i}const Tt=function(){function t(e,i){this.constructor===t&&St("Cannot initialize BaseException."),this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t}();class Pt extends Tt{constructor(t,e){super(t,"PasswordException"),this.code=e}}class Lt extends Tt{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class Dt extends Tt{constructor(t){super(t,"InvalidPDFException")}}class It extends Tt{constructor(t){super(t,"MissingPDFException")}}class Ft extends Tt{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class Ot extends Tt{constructor(t){super(t,"FormatError")}}class Nt extends Tt{constructor(t){super(t,"AbortException")}}function Wt(t){"object"===typeof t&&void 0!==(null===t||void 0===t?void 0:t.length)||St("Invalid argument for bytesToString");const e=t.length,i=8192;if(e<i)return String.fromCharCode.apply(null,t);const s=[];for(let n=0;n<e;n+=i){const a=Math.min(n+i,e),r=t.subarray(n,a);s.push(String.fromCharCode.apply(null,r))}return s.join("")}function jt(t){"string"!==typeof t&&St("Invalid argument for stringToBytes");const e=t.length,i=new Uint8Array(e);for(let s=0;s<e;++s)i[s]=255&t.charCodeAt(s);return i}function Bt(t){const e=Object.create(null);for(const[i,s]of t)e[i]=s;return e}class Ht{static get isLittleEndian(){return Rt(this,"isLittleEndian",function(){const t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return Rt(this,"isEvalSupported",function(){try{return new Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return Rt(this,"isOffscreenCanvasSupported","undefined"!==typeof OffscreenCanvas)}static get platform(){var t;return"undefined"!==typeof navigator&&"string"===typeof(null===(t=navigator)||void 0===t?void 0:t.platform)?Rt(this,"platform",{isMac:navigator.platform.includes("Mac")}):Rt(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){var t,e;return Rt(this,"isCSSRoundSupported",null===(t=globalThis.CSS)||void 0===t||null===(e=t.supports)||void 0===e?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const zt=Array.from(Array(256).keys(),(t=>t.toString(16).padStart(2,"0")));class Vt{static makeHexColor(t,e,i){return"#".concat(zt[t]).concat(zt[e]).concat(zt[i])}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),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 i=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])/i,(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i]}static getAxialAlignedBoundingBox(t,e){const i=this.applyTransform(t,e),s=this.applyTransform(t.slice(2,4),e),n=this.applyTransform([t[0],t[3]],e),a=this.applyTransform([t[2],t[1]],e);return[Math.min(i[0],s[0],n[0],a[0]),Math.min(i[1],s[1],n[1],a[1]),Math.max(i[0],s[0],n[0],a[0]),Math.max(i[1],s[1],n[1],a[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]],i=t[0]*e[0]+t[1]*e[2],s=t[0]*e[1]+t[1]*e[3],n=t[2]*e[0]+t[3]*e[2],a=t[2]*e[1]+t[3]*e[3],r=(i+a)/2,o=Math.sqrt((i+a)**2-4*(i*a-n*s))/2,l=r+o||1,h=r-o||1;return[Math.sqrt(l),Math.sqrt(h)]}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 i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),s=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>s)return null;const n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>a?null:[i,n,s,a]}static bezierBoundingBox(t,e,i,s,n,a,o,l,h){return h?(h[0]=Math.min(h[0],t,o),h[1]=Math.min(h[1],e,l),h[2]=Math.max(h[2],t,o),h[3]=Math.max(h[3],e,l)):h=[Math.min(t,o),Math.min(e,l),Math.max(t,o),Math.max(e,l)],r(Vt,this,Ut).call(this,t,i,n,o,e,s,a,l,3*(3*(i-n)-t+o),6*(t-2*i+n),3*(i-t),h),r(Vt,this,Ut).call(this,t,i,n,o,e,s,a,l,3*(3*(s-a)-e+l),6*(e-2*s+a),3*(s-e),h),h}}function Gt(t,e,i,s,n,a,r,o,l,h){if(l<=0||l>=1)return;const c=1-l,d=l*l,u=d*l,p=c*(c*(c*t+3*l*e)+3*d*i)+u*s,f=c*(c*(c*n+3*l*a)+3*d*r)+u*o;h[0]=Math.min(h[0],p),h[1]=Math.min(h[1],f),h[2]=Math.max(h[2],p),h[3]=Math.max(h[3],f)}function Ut(t,e,i,s,n,a,o,h,c,d,u,p){if(Math.abs(c)<1e-12)return void(Math.abs(d)>=1e-12&&r(l,this,Gt).call(this,t,e,i,s,n,a,o,h,-u/d,p));const f=d**2-4*u*c;if(f<0)return;const g=Math.sqrt(f),m=2*c;r(l,this,Gt).call(this,t,e,i,s,n,a,o,h,(-d+g)/m,p),r(l,this,Gt).call(this,t,e,i,s,n,a,o,h,(-d-g)/m,p)}l=Vt;let qt=null,Xt=null;function Kt(t){return qt||(qt=/([\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,Xt=new Map([["\ufb05","\u017ft"]])),t.replaceAll(qt,((t,e,i)=>e?e.normalize("NFKC"):Xt.get(i)))}const Yt="pdfjs_internal_id_",Qt=0,Jt=1,Zt=2,$t=3,te=4,ee=5,ie=6,se=7,ne=8;class ae{constructor(){this.constructor===ae&&St("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,s,n){return"none"}destroy(){}}var re=new WeakMap;class oe{constructor(){let{enableHWA:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};w(this,re,!1),this.constructor===oe&&St("Cannot initialize BaseCanvasFactory."),x(re,this,t)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!_(re,this)})}}reset(t,e,i){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}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){St("Abstract method `_createCanvas` called.")}}class le{constructor(t){let{baseUrl:e=null,isCompressed:i=!0}=t;this.constructor===le&&St("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=e,this.isCompressed=i}async fetch(t){let{name:e}=t;if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!e)throw new Error("CMap name must be specified.");const i=this.baseUrl+e+(this.isCompressed?".bcmap":""),s=this.isCompressed?bt.BINARY:bt.NONE;return this._fetchData(i,s).catch((t=>{throw new Error("Unable to load ".concat(this.isCompressed?"binary ":"","CMap at: ").concat(i))}))}_fetchData(t,e){St("Abstract method `_fetchData` called.")}}class he{constructor(t){let{baseUrl:e=null}=t;this.constructor===he&&St("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=e}async fetch(t){let{filename:e}=t;if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!e)throw new Error("Font filename must be specified.");const i="".concat(this.baseUrl).concat(e);return this._fetchData(i).catch((t=>{throw new Error("Unable to load font data at: ".concat(i))}))}_fetchData(t){St("Abstract method `_fetchData` called.")}}class ce{constructor(){this.constructor===ce&&St("Cannot initialize BaseSVGFactory.")}create(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),i||(s.setAttribute("width","".concat(t,"px")),s.setAttribute("height","".concat(e,"px"))),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox","0 0 ".concat(t," ").concat(e)),s}createElement(t){if("string"!==typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){St("Abstract method `_createSVG` called.")}}const de="http://www.w3.org/2000/svg";class ue{}h=ue,(0,y.A)(ue,"CSS",96),(0,y.A)(ue,"PDF",72),(0,y.A)(ue,"PDF_TO_CSS_UNITS",h.CSS/h.PDF);var pe=new WeakMap,fe=new WeakMap,ge=new WeakMap,me=new WeakMap,ve=new WeakMap,be=new WeakMap,Ae=new WeakSet;function ye(t){return _(pe,t)||x(pe,t,new Map)}function we(t){return _(ve,t)||x(ve,t,new Map)}function _e(t){if(!_(fe,t)){const e=_(me,t).createElement("div"),{style:i}=e;i.visibility="hidden",i.contain="strict",i.width=i.height=0,i.position="absolute",i.top=i.left=0,i.zIndex=-1;const s=_(me,t).createElementNS(de,"svg");s.setAttribute("width",0),s.setAttribute("height",0),x(fe,t,_(me,t).createElementNS(de,"defs")),e.append(s),s.append(_(fe,t)),_(me,t).body.append(e)}return _(fe,t)}function xe(t){if(1===t.length){const e=t[0],i=new Array(256);for(let t=0;t<256;t++)i[t]=e[t]/255;const s=i.join(",");return[s,s,s]}const[e,i,s]=t,n=new Array(256),a=new Array(256),r=new Array(256);for(let o=0;o<256;o++)n[o]=e[o]/255,a[o]=i[o]/255,r[o]=s[o]/255;return[n.join(","),a.join(","),r.join(",")]}function ke(t){const e=_(me,this).createElementNS(de,"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)}function Ee(t){const e=_(me,this).createElementNS(de,"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)}function Se(t){const e=_(me,this).createElementNS(de,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),o(Ae,this,_e).append(e),e}function Me(t,e,i){const s=_(me,this).createElementNS(de,e);s.setAttribute("type","discrete"),s.setAttribute("tableValues",i),t.append(s)}function Ce(t,e,i,s){const n=_(me,this).createElementNS(de,"feComponentTransfer");s.append(n),r(Ae,this,Me).call(this,n,"feFuncR",t),r(Ae,this,Me).call(this,n,"feFuncG",e),r(Ae,this,Me).call(this,n,"feFuncB",i)}function Re(t,e){const i=_(me,this).createElementNS(de,"feComponentTransfer");e.append(i),r(Ae,this,Me).call(this,i,"feFuncA",t)}function Te(t){return o(Ae,this,_e).style.color=t,Ke(getComputedStyle(o(Ae,this,_e)).getPropertyValue("color"))}async function Pe(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";if(ze(t,document.baseURI)){const i=await fetch(t);if(!i.ok)throw new Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise(((i,s)=>{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)s(new Error(n.statusText));else{switch(e){case"arraybuffer":case"blob":case"json":return void i(n.response)}i(n.responseText)}},n.send(null)}))}class Le extends le{_fetchData(t,e){return Pe(t,this.isCompressed?"arraybuffer":"text").then((t=>({cMapData:t instanceof ArrayBuffer?new Uint8Array(t):jt(t),compressionType:e})))}}class De extends he{_fetchData(t){return Pe(t,"arraybuffer").then((t=>new Uint8Array(t)))}}class Ie extends ce{_createSVG(t){return document.createElementNS(de,t)}}class Fe{constructor(t){let{viewBox:e,scale:i,rotation:s,offsetX:n=0,offsetY:a=0,dontFlip:r=!1}=t;this.viewBox=e,this.scale=i,this.rotation=s,this.offsetX=n,this.offsetY=a;const o=(e[2]+e[0])/2,l=(e[3]+e[1])/2;let h,c,d,u,p,f,g,m;switch(s%=360,s<0&&(s+=360),s){case 180:h=-1,c=0,d=0,u=1;break;case 90:h=0,c=1,d=1,u=0;break;case 270:h=0,c=-1,d=-1,u=0;break;case 0:h=1,c=0,d=0,u=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(d=-d,u=-u),0===h?(p=Math.abs(l-e[1])*i+n,f=Math.abs(o-e[0])*i+a,g=(e[3]-e[1])*i,m=(e[2]-e[0])*i):(p=Math.abs(o-e[0])*i+n,f=Math.abs(l-e[1])*i+a,g=(e[2]-e[0])*i,m=(e[3]-e[1])*i),this.transform=[h*i,c*i,d*i,u*i,p-h*i*o-d*i*l,f-c*i*o-u*i*l],this.width=g,this.height=m}get rawDims(){const{viewBox:t}=this;return Rt(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone(){let{scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:s=this.offsetY,dontFlip:n=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Fe({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:n})}convertToViewportPoint(t,e){return Vt.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=Vt.applyTransform([t[0],t[1]],this.transform),i=Vt.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){return Vt.applyInverseTransform([t,e],this.transform)}}class Oe extends Tt{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t,"RenderingCancelledException"),this.extraDelay=e}}function Ne(t){const e=t.length;let i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function We(t){return"string"===typeof t&&/\.pdf$/i.test(t)}function je(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function Be(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!==typeof t)return e;if(Ne(t))return Et('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,s=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(t);let n=i.exec(s[1])||i.exec(s[2])||i.exec(s[3]);if(n&&(n=n[0],n.includes("%")))try{n=i.exec(decodeURIComponent(n))[0]}catch{}return n||e}class He{constructor(){(0,y.A)(this,"started",Object.create(null)),(0,y.A)(this,"times",[])}time(t){t in this.started&&Et("Timer is already running for ".concat(t)),this.started[t]=Date.now()}timeEnd(t){t in this.started||Et("Timer has not been started for ".concat(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:i}of this.times)e=Math.max(i.length,e);for(const{name:i,start:s,end:n}of this.times)t.push("".concat(i.padEnd(e)," ").concat(n-s,"ms\n"));return t.join("")}}function ze(t,e){try{const{protocol:i}=e?new URL(t,e):new URL(t);return"http:"===i||"https:"===i}catch{return!1}}function Ve(t){t.preventDefault()}function Ge(t){console.log("Deprecated API usage: "+t)}let Ue;class qe{static toDateObject(t){if(!t||"string"!==typeof t)return null;Ue||(Ue=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=Ue.exec(t);if(!e)return null;const i=parseInt(e[1],10);let s=parseInt(e[2],10);s=s>=1&&s<=12?s-1:0;let n=parseInt(e[3],10);n=n>=1&&n<=31?n:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let r=parseInt(e[5],10);r=r>=0&&r<=59?r:0;let o=parseInt(e[6],10);o=o>=0&&o<=59?o:0;const l=e[7]||"Z";let h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let c=parseInt(e[9],10)||0;return c=c>=0&&c<=59?c:0,"-"===l?(a+=h,r+=c):"+"===l&&(a-=h,r-=c),new Date(Date.UTC(i,s,n,a,r,o))}}function Xe(t,e){let{scale:i=1,rotation:s=0}=e;const{width:n,height:a}=t.attributes.style,r=[0,0,parseInt(n),parseInt(a)];return new Fe({viewBox:r,scale:i,rotation:s})}function Ke(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):(Et('Not a valid color format: "'.concat(t,'"')),[0,0,0])}function Ye(t){const{a:e,b:i,c:s,d:n,e:a,f:r}=t.getTransform();return[e,i,s,n,a,r]}function Qe(t){const{a:e,b:i,c:s,d:n,e:a,f:r}=t.getTransform().invertSelf();return[e,i,s,n,a,r]}function Je(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e instanceof Fe){const{pageWidth:s,pageHeight:n}=e.rawDims,{style:a}=t,r=Ht.isCSSRoundSupported,o="var(--scale-factor) * ".concat(s,"px"),l="var(--scale-factor) * ".concat(n,"px"),h=r?"round(".concat(o,", 1px)"):"calc(".concat(o,")"),c=r?"round(".concat(l,", 1px)"):"calc(".concat(l,")");i&&e.rotation%180!==0?(a.width=c,a.height=h):(a.width=h,a.height=c)}s&&t.setAttribute("data-main-rotation",e.rotation)}var Ze=new WeakMap,$e=new WeakMap,ti=new WeakMap,ei=new WeakMap,ii=new WeakSet;class si{constructor(t){a(this,ii),w(this,Ze,null),w(this,$e,null),w(this,ti,void 0),w(this,ei,null),x(ti,this,t)}render(){const t=x(Ze,this,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar");const e=_(ti,this)._uiManager._signal;t.addEventListener("contextmenu",Ve,{signal:e}),t.addEventListener("pointerdown",ni,{signal:e});const i=x(ei,this,document.createElement("div"));i.className="buttons",t.append(i);const s=_(ti,this).toolbarPosition;if(s){const{style:e}=t,i="ltr"===_(ti,this)._uiManager.direction?1-s[0]:s[0];e.insetInlineEnd="".concat(100*i,"%"),e.top="calc(".concat(100*s[1],"% + var(--editor-toolbar-vert-offset))")}return r(ii,this,li).call(this),t}hide(){var t;_(Ze,this).classList.add("hidden"),null===(t=_($e,this))||void 0===t||t.hideDropdown()}show(){_(Ze,this).classList.remove("hidden")}addAltTextButton(t){r(ii,this,oi).call(this,t),_(ei,this).prepend(t,o(ii,this,hi))}addColorPicker(t){x($e,this,t);const e=t.renderButton();r(ii,this,oi).call(this,e),_(ei,this).prepend(e,o(ii,this,hi))}remove(){var t;_(Ze,this).remove(),null===(t=_($e,this))||void 0===t||t.destroy(),x($e,this,null)}}function ni(t){t.stopPropagation()}function ai(t){_(ti,this)._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}function ri(t){_(ti,this)._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}function oi(t){const e=_(ti,this)._uiManager._signal;t.addEventListener("focusin",r(ii,this,ai).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",r(ii,this,ri).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Ve,{signal:e})}function li(){const t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-editor-remove-".concat(_(ti,this).editorType,"-button")),r(ii,this,oi).call(this,t),t.addEventListener("click",(t=>{_(ti,this)._uiManager.delete()}),{signal:_(ti,this)._uiManager._signal}),_(ei,this).append(t)}function hi(t){const e=document.createElement("div");return e.className="divider",e}var ci=new WeakMap,di=new WeakMap,ui=new WeakMap,pi=new WeakSet;class fi{constructor(t){a(this,pi),w(this,ci,null),w(this,di,null),w(this,ui,void 0),x(ui,this,t)}show(t,e,i){const[s,n]=r(pi,this,mi).call(this,e,i),{style:a}=_(di,this)||x(di,this,r(pi,this,gi).call(this));t.append(_(di,this)),a.insetInlineEnd="".concat(100*s,"%"),a.top="calc(".concat(100*n,"% + var(--editor-toolbar-vert-offset))")}hide(){_(di,this).remove()}}function gi(){const t=x(di,this,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",Ve,{signal:_(ui,this)._signal});const e=x(ci,this,document.createElement("div"));return e.className="buttons",t.append(e),r(pi,this,vi).call(this),t}function mi(t,e){let i=0,s=0;for(const n of t){const t=n.y+n.height;if(t<i)continue;const a=n.x+(e?n.width:0);t>i?(s=a,i=t):e?a>s&&(s=a):a<s&&(s=a)}return[e?1-s:s,i]}function vi(){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 i=_(ui,this)._signal;t.addEventListener("contextmenu",Ve,{signal:i}),t.addEventListener("click",(()=>{_(ui,this).highlightSelection("floating_button")}),{signal:i}),_(ci,this).append(t)}function bi(t,e,i){for(const s of i)e.addEventListener(s,t[s].bind(t))}var Ai=new WeakMap;class yi{constructor(){w(this,Ai,0)}get id(){var t,e;return"".concat("pdfjs_internal_editor_").concat((x(Ai,this,(t=_(Ai,this),e=t++,t)),e))}}var wi=new WeakMap,_i=new WeakMap,xi=new WeakMap,ki=new WeakSet;class Ei{constructor(){a(this,ki),w(this,wi,function(){var t,e;if("undefined"!==typeof crypto&&"function"===typeof(null===(t=crypto)||void 0===t?void 0:t.randomUUID))return crypto.randomUUID();const i=new Uint8Array(32);if("undefined"!==typeof crypto&&"function"===typeof(null===(e=crypto)||void 0===e?void 0:e.getRandomValues))crypto.getRandomValues(i);else for(let s=0;s<32;s++)i[s]=Math.floor(255*Math.random());return Wt(i)}()),w(this,_i,0),w(this,xi,null)}static get _isSVGFittingCanvas(){const t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),e=new Image;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>';return Rt(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 getFromFile(t){const{lastModified:e,name:i,size:s,type:n}=t;return r(ki,this,Si).call(this,"".concat(e,"_").concat(i,"_").concat(s,"_").concat(n),t)}async getFromUrl(t){return r(ki,this,Si).call(this,t,t)}async getFromId(t){_(xi,this)||x(xi,this,new Map);const e=_(xi,this).get(t);return e?e.bitmap?(e.refCounter+=1,e):e.file?this.getFromFile(e.file):this.getFromUrl(e.url):null}getSvgUrl(t){const e=_(xi,this).get(t);return null!==e&&void 0!==e&&e.isSvg?e.svgUrl:null}deleteId(t){_(xi,this)||x(xi,this,new Map);const e=_(xi,this).get(t);e&&(e.refCounter-=1,0===e.refCounter&&(e.bitmap=null))}isValidId(t){return t.startsWith("image_".concat(_(wi,this),"_"))}}async function Si(t,e){var i;_(xi,this)||x(xi,this,new Map);let s=_(xi,this).get(t);if(null===s)return null;if(null!==(i=s)&&void 0!==i&&i.bitmap)return s.refCounter+=1,s;try{var n,a;let t;if(s||(s={bitmap:null,id:"image_".concat(_(wi,this),"_").concat((x(_i,this,(n=_(_i,this),a=n++,n)),a)),refCounter:0,isSvg:!1}),"string"===typeof e?(s.url=e,t=await Pe(e,"blob")):t=s.file=e,"image/svg+xml"===t.type){const e=c._isSVGFittingCanvas,i=new FileReader,n=new Image,a=new Promise(((t,a)=>{n.onload=()=>{s.bitmap=n,s.isSvg=!0,t()},i.onload=async()=>{const t=s.svgUrl=i.result;n.src=await e?"".concat(t,"#svgView(preserveAspectRatio(none))"):t},n.onerror=i.onerror=a}));i.readAsDataURL(t),await a}else s.bitmap=await createImageBitmap(t);s.refCounter=1}catch(r){console.error(r),s=null}return _(xi,this).set(t,s),s&&_(xi,this).set(s.id,s),s}c=Ei;var Mi=new WeakMap,Ci=new WeakMap,Ri=new WeakMap,Ti=new WeakMap;class Pi{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;w(this,Mi,[]),w(this,Ci,!1),w(this,Ri,void 0),w(this,Ti,-1),x(Ri,this,t)}add(t){let{cmd:e,undo:i,post:s,mustExec:n,type:a=NaN,overwriteIfSameType:r=!1,keepUndo:o=!1}=t;if(n&&e(),_(Ci,this))return;const l={cmd:e,undo:i,post:s,type:a};if(-1===_(Ti,this))return _(Mi,this).length>0&&(_(Mi,this).length=0),x(Ti,this,0),void _(Mi,this).push(l);if(r&&_(Mi,this)[_(Ti,this)].type===a)return o&&(l.undo=_(Mi,this)[_(Ti,this)].undo),void(_(Mi,this)[_(Ti,this)]=l);const h=_(Ti,this)+1;h===_(Ri,this)?_(Mi,this).splice(0,1):(x(Ti,this,h),h<_(Mi,this).length&&_(Mi,this).splice(h)),_(Mi,this).push(l)}undo(){if(-1===_(Ti,this))return;x(Ci,this,!0);const{undo:t,post:e}=_(Mi,this)[_(Ti,this)];t(),null===e||void 0===e||e(),x(Ci,this,!1),x(Ti,this,_(Ti,this)-1)}redo(){if(_(Ti,this)<_(Mi,this).length-1){x(Ti,this,_(Ti,this)+1),x(Ci,this,!0);const{cmd:t,post:e}=_(Mi,this)[_(Ti,this)];t(),null===e||void 0===e||e(),x(Ci,this,!1)}}hasSomethingToUndo(){return-1!==_(Ti,this)}hasSomethingToRedo(){return _(Ti,this)<_(Mi,this).length-1}destroy(){x(Mi,this,null)}}var Li=new WeakSet;class Di{constructor(t){a(this,Li),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=Ht.platform;for(const[i,s,n={}]of t)for(const t of i){const i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),{callback:s,options:n}),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,{callback:s,options:n}),this.allKeys.add(t.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const i=this.callbacks.get(r(Li,this,Ii).call(this,e));if(!i)return;const{callback:s,options:{bubbles:n=!1,args:a=[],checker:o=null}}=i;o&&!o(t,e)||(s.bind(t,...a,e)(),n||(e.stopPropagation(),e.preventDefault()))}}function Ii(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}class Fi{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 i of t.keys()){e.style.color=i;const s=window.getComputedStyle(e).color;t.set(i,Ke(s))}e.remove()}(t),Rt(this,"_colors",t)}convert(t){const e=Ke(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[i,s]of this._colors)if(s.every(((t,i)=>t===e[i])))return Fi._colorsMapping.get(i);return e}getHexCode(t){const e=this._colors.get(t);return e?Vt.makeHexColor(...e):t}}(0,y.A)(Fi,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));var Oi=new WeakMap,Ni=new WeakMap,Wi=new WeakMap,ji=new WeakMap,Bi=new WeakMap,Hi=new WeakMap,zi=new WeakMap,Vi=new WeakMap,Gi=new WeakMap,Ui=new WeakMap,qi=new WeakMap,Xi=new WeakMap,Ki=new WeakMap,Yi=new WeakMap,Qi=new WeakMap,Ji=new WeakMap,Zi=new WeakMap,$i=new WeakMap,ts=new WeakMap,es=new WeakMap,is=new WeakMap,ss=new WeakMap,ns=new WeakMap,as=new WeakMap,rs=new WeakMap,os=new WeakMap,ls=new WeakMap,hs=new WeakMap,cs=new WeakMap,ds=new WeakMap,us=new WeakMap,ps=new WeakMap,fs=new WeakMap,gs=new WeakMap,ms=new WeakMap,vs=new WeakMap,bs=new WeakMap,As=new WeakMap,ys=new WeakMap,ws=new WeakMap,_s=new WeakMap,xs=new WeakMap,ks=new WeakMap,Es=new WeakMap,Ss=new WeakMap,Ms=new WeakMap,Cs=new WeakSet;class Rs{static get _keyboardManager(){const t=Rs.prototype,e=t=>_(Ss,t).contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),i=(t,e)=>{let{target:i}=e;if(i instanceof HTMLInputElement){const{type:t}=i;return"text"!==t&&"number"!==t}return!0},s=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return Rt(this,"_keyboardManager",new Di([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["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:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&_(Ss,t).contains(i)&&!t.isEnterHandled}}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&_(Ss,t).contains(document.activeElement)}}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}constructor(t,e,i,s,n,o,l,h,c){a(this,Cs),w(this,Oi,new AbortController),w(this,Ni,null),w(this,Wi,new Map),w(this,ji,new Map),w(this,Bi,null),w(this,Hi,null),w(this,zi,null),w(this,Vi,new Pi),w(this,Gi,0),w(this,Ui,new Set),w(this,qi,null),w(this,Xi,null),w(this,Ki,new Set),w(this,Yi,!1),w(this,Qi,null),w(this,Ji,null),w(this,Zi,null),w(this,$i,!1),w(this,ts,null),w(this,es,new yi),w(this,is,!1),w(this,ss,!1),w(this,ns,null),w(this,as,null),w(this,rs,null),w(this,os,W.NONE),w(this,ls,new Set),w(this,hs,null),w(this,cs,null),w(this,ds,null),w(this,us,this.blur.bind(this)),w(this,ps,this.focus.bind(this)),w(this,fs,this.copy.bind(this)),w(this,gs,this.cut.bind(this)),w(this,ms,this.paste.bind(this)),w(this,vs,this.keydown.bind(this)),w(this,bs,this.keyup.bind(this)),w(this,As,this.onEditingAction.bind(this)),w(this,ys,this.onPageChanging.bind(this)),w(this,ws,this.onScaleChanging.bind(this)),w(this,_s,this.onRotationChanging.bind(this)),w(this,xs,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),w(this,ks,[0,0]),w(this,Es,null),w(this,Ss,null),w(this,Ms,null),this._signal=_(Oi,this).signal,x(Ss,this,t),x(Ms,this,e),x(Bi,this,i),this._eventBus=s,this._eventBus._on("editingaction",_(As,this)),this._eventBus._on("pagechanging",_(ys,this)),this._eventBus._on("scalechanging",_(ws,this)),this._eventBus._on("rotationchanging",_(_s,this)),r(Cs,this,Is).call(this),r(Cs,this,Hs).call(this),r(Cs,this,Ns).call(this),x(Hi,this,n.annotationStorage),x(Qi,this,n.filterFactory),x(cs,this,o),x(Zi,this,l||null),x(Yi,this,h),x(rs,this,c||null),this.viewParameters={realScale:ue.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){var t,e,i;null===(t=_(Oi,this))||void 0===t||t.abort(),x(Oi,this,null),this._signal=null,this._eventBus._off("editingaction",_(As,this)),this._eventBus._off("pagechanging",_(ys,this)),this._eventBus._off("scalechanging",_(ws,this)),this._eventBus._off("rotationchanging",_(_s,this));for(const s of _(ji,this).values())s.destroy();_(ji,this).clear(),_(Wi,this).clear(),_(Ki,this).clear(),x(Ni,this,null),_(ls,this).clear(),_(Vi,this).destroy(),null===(e=_(Bi,this))||void 0===e||e.destroy(),null===(i=_(ts,this))||void 0===i||i.hide(),x(ts,this,null),_(Ji,this)&&(clearTimeout(_(Ji,this)),x(Ji,this,null)),_(Es,this)&&(clearTimeout(_(Es,this)),x(Es,this,null))}async mlGuess(t){var e;return(null===(e=_(rs,this))||void 0===e?void 0:e.guess(t))||null}get hasMLManager(){return!!_(rs,this)}get hcmFilter(){return Rt(this,"hcmFilter",_(cs,this)?_(Qi,this).addHCMFilter(_(cs,this).foreground,_(cs,this).background):"none")}get direction(){return Rt(this,"direction",getComputedStyle(_(Ss,this)).direction)}get highlightColors(){return Rt(this,"highlightColors",_(Zi,this)?new Map(_(Zi,this).split(",").map((t=>t.split("=").map((t=>t.trim()))))):null)}get highlightColorNames(){return Rt(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,(t=>t.reverse()))):null)}setMainHighlightColorPicker(t){x(as,this,t)}editAltText(t){var e;null===(e=_(Bi,this))||void 0===e||e.editAltText(this,t)}onPageChanging(t){let{pageNumber:e}=t;x(Gi,this,e-1)}focusMainContainer(){_(Ss,this).focus()}findParent(t,e){for(const i of _(ji,this).values()){const{x:s,y:n,width:a,height:r}=i.div.getBoundingClientRect();if(t>=s&&t<=s+a&&e>=n&&e<=n+r)return i}return null}disableUserSelect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];_(Ms,this).classList.toggle("noUserSelect",t)}addShouldRescale(t){_(Ki,this).add(t)}removeShouldRescale(t){_(Ki,this).delete(t)}onScaleChanging(t){let{scale:e}=t;this.commitOrRemove(),this.viewParameters.realScale=e*ue.PDF_TO_CSS_UNITS;for(const i of _(Ki,this))i.onScaleChanging()}onRotationChanging(t){let{pagesRotation:e}=t;this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const e=document.getSelection();if(!e||e.isCollapsed)return;const{anchorNode:i,anchorOffset:s,focusNode:n,focusOffset:a}=e,o=e.toString(),l=r(Cs,this,Ts).call(this,e).closest(".textLayer"),h=this.getSelectionBoxes(l);if(h){e.empty(),_(os,this)===W.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:W.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const e of _(ji,this).values())if(e.hasTextLayer(l)){e.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:i,anchorOffset:s,focusNode:n,focusOffset:a,text:o});break}}}addToAnnotationStorage(t){t.isEmpty()||!_(Hi,this)||_(Hi,this).has(t.id)||_(Hi,this).setValue(t.id,t)}blur(){if(this.isShiftKeyDown=!1,_($i,this)&&(x($i,this,!1),r(Cs,this,Ds).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of _(ls,this))if(e.div.contains(t)){x(ns,this,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!_(ns,this))return;const[t,e]=_(ns,this);x(ns,this,null),e.addEventListener("focusin",(()=>{t._focusEventsAllowed=!0}),{once:!0,signal:this._signal}),e.focus()}addEditListeners(){r(Cs,this,Ns).call(this),r(Cs,this,js).call(this)}removeEditListeners(){r(Cs,this,Ws).call(this),r(Cs,this,Bs).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const i of _(Xi,this))if(i.isHandlingMimeForPasting(e))return t.dataTransfer.dropEffect="copy",void t.preventDefault()}drop(t){for(const e of t.dataTransfer.items)for(const i of _(Xi,this))if(i.isHandlingMimeForPasting(e.type))return i.paste(e,this.currentLayer),void t.preventDefault()}copy(t){var e;if(t.preventDefault(),null===(e=_(Ni,this))||void 0===e||e.commitOrRemove(),!this.hasSelection)return;const i=[];for(const s of _(ls,this)){const t=s.serialize(!0);t&&i.push(t)}0!==i.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(i))}cut(t){this.copy(t),this.delete()}paste(t){t.preventDefault();const{clipboardData:e}=t;for(const a of e.items)for(const t of _(Xi,this))if(t.isHandlingMimeForPasting(a.type))return void t.paste(a,this.currentLayer);let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(n){return void Et('paste: "'.concat(n.message,'".'))}if(!Array.isArray(i))return;this.unselectAll();const s=this.currentLayer;try{const t=[];for(const a of i){const e=s.deserialize(a);if(!e)return;t.push(e)}const e=()=>{for(const e of t)r(Cs,this,qs).call(this,e);r(Cs,this,Ys).call(this,t)},n=()=>{for(const e of t)e.remove()};this.addCommands({cmd:e,undo:n,mustExec:!0})}catch(n){Et('paste: "'.concat(n.message,'".'))}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),_(os,this)===W.NONE||this.isEditorHandlingKeyboard||Rs._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,_($i,this)&&(x($i,this,!1),r(Cs,this,Ds).call(this,"main_toolbar")))}onEditingAction(t){let{name:e}=t;switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu")}}setEditingState(t){t?(r(Cs,this,Fs).call(this),r(Cs,this,js).call(this),r(Cs,this,zs).call(this,{isEditing:_(os,this)!==W.NONE,isEmpty:r(Cs,this,Ks).call(this),hasSomethingToUndo:_(Vi,this).hasSomethingToUndo(),hasSomethingToRedo:_(Vi,this).hasSomethingToRedo(),hasSelectedEditor:!1})):(r(Cs,this,Os).call(this),r(Cs,this,Bs).call(this),r(Cs,this,zs).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!_(Xi,this)){x(Xi,this,t);for(const t of _(Xi,this))r(Cs,this,Vs).call(this,t.defaultPropertiesToUpdate)}}getId(){return _(es,this).id}get currentLayer(){return _(ji,this).get(_(Gi,this))}getLayer(t){return _(ji,this).get(t)}get currentPageIndex(){return _(Gi,this)}addLayer(t){_(ji,this).set(t.pageIndex,t),_(is,this)?t.enable():t.disable()}removeLayer(t){_(ji,this).delete(t.pageIndex)}updateMode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(_(os,this)!==t){if(x(os,this,t),t===W.NONE)return this.setEditingState(!1),void r(Cs,this,Us).call(this);this.setEditingState(!0),r(Cs,this,Gs).call(this),this.unselectAll();for(const e of _(ji,this).values())e.updateMode(t);if(e||!i){if(e)for(const t of _(Wi,this).values())if(t.annotationElementId===e){this.setSelected(t),t.enterInEditMode();break}}else this.addNewEditorFromKeyboard()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==_(os,this)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){var i;if(_(Xi,this)){switch(t){case j.CREATE:return void this.currentLayer.addNewEditor();case j.HIGHLIGHT_DEFAULT_COLOR:null===(i=_(as,this))||void 0===i||i.updateColor(e);break;case j.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(_(ds,this)||x(ds,this,new Map)).set(t,e),this.showAllEditors("highlight",e)}for(const i of _(ls,this))i.updateParams(t,e);for(const i of _(Xi,this))i.updateDefaultParams(t,e)}}showAllEditors(t,e){var i,s;for(const n of _(Wi,this).values())n.editorType===t&&n.show(e);(null===(i=null===(s=_(ds,this))||void 0===s?void 0:s.get(j.HIGHLIGHT_SHOW_ALL))||void 0===i||i)!==e&&r(Cs,this,Vs).call(this,[[j.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(_(ss,this)!==t){x(ss,this,t);for(const e of _(ji,this).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}getEditors(t){const e=[];for(const i of _(Wi,this).values())i.pageIndex===t&&e.push(i);return e}getEditor(t){return _(Wi,this).get(t)}addEditor(t){_(Wi,this).set(t.id,t)}removeEditor(t){var e;(t.div.contains(document.activeElement)&&(_(Ji,this)&&clearTimeout(_(Ji,this)),x(Ji,this,setTimeout((()=>{this.focusMainContainer(),x(Ji,this,null)}),0))),_(Wi,this).delete(t.id),this.unselect(t),t.annotationElementId&&_(Ui,this).has(t.annotationElementId))||(null===(e=_(Hi,this))||void 0===e||e.remove(t.id))}addDeletedAnnotationElement(t){_(Ui,this).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return _(Ui,this).has(t)}removeDeletedAnnotationElement(t){_(Ui,this).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){_(Ni,this)!==t&&(x(Ni,this,t),t&&r(Cs,this,Vs).call(this,t.propertiesToUpdate))}updateUI(t){o(Cs,this,Xs)===t&&r(Cs,this,Vs).call(this,t.propertiesToUpdate)}toggleSelected(t){if(_(ls,this).has(t))return _(ls,this).delete(t),t.unselect(),void r(Cs,this,zs).call(this,{hasSelectedEditor:this.hasSelection});_(ls,this).add(t),t.select(),r(Cs,this,Vs).call(this,t.propertiesToUpdate),r(Cs,this,zs).call(this,{hasSelectedEditor:!0})}setSelected(t){for(const e of _(ls,this))e!==t&&e.unselect();_(ls,this).clear(),_(ls,this).add(t),t.select(),r(Cs,this,Vs).call(this,t.propertiesToUpdate),r(Cs,this,zs).call(this,{hasSelectedEditor:!0})}isSelected(t){return _(ls,this).has(t)}get firstSelectedEditor(){return _(ls,this).values().next().value}unselect(t){t.unselect(),_(ls,this).delete(t),r(Cs,this,zs).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==_(ls,this).size}get isEnterHandled(){return 1===_(ls,this).size&&this.firstSelectedEditor.isEnterHandled}undo(){_(Vi,this).undo(),r(Cs,this,zs).call(this,{hasSomethingToUndo:_(Vi,this).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:r(Cs,this,Ks).call(this)})}redo(){_(Vi,this).redo(),r(Cs,this,zs).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:_(Vi,this).hasSomethingToRedo(),isEmpty:r(Cs,this,Ks).call(this)})}addCommands(t){_(Vi,this).add(t),r(Cs,this,zs).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:r(Cs,this,Ks).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[..._(ls,this)];this.addCommands({cmd:()=>{for(const e of t)e.remove()},undo:()=>{for(const e of t)r(Cs,this,qs).call(this,e)},mustExec:!0})}commitOrRemove(){var t;null===(t=_(Ni,this))||void 0===t||t.commitOrRemove()}hasSomethingToControl(){return _(Ni,this)||this.hasSelection}selectAll(){for(const t of _(ls,this))t.commit();r(Cs,this,Ys).call(this,_(Wi,this).values())}unselectAll(){if((!_(Ni,this)||(_(Ni,this).commitOrRemove(),_(os,this)===W.NONE))&&this.hasSelection){for(const t of _(ls,this))t.unselect();_(ls,this).clear(),r(Cs,this,zs).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]||this.commitOrRemove(),!this.hasSelection)return;_(ks,this)[0]+=t,_(ks,this)[1]+=e;const[i,s]=_(ks,this),n=[..._(ls,this)];_(Es,this)&&clearTimeout(_(Es,this)),x(Es,this,setTimeout((()=>{x(Es,this,null),_(ks,this)[0]=_(ks,this)[1]=0,this.addCommands({cmd:()=>{for(const t of n)_(Wi,this).has(t.id)&&t.translateInPage(i,s)},undo:()=>{for(const t of n)_(Wi,this).has(t.id)&&t.translateInPage(-i,-s)},mustExec:!1})}),1e3));for(const a of n)a.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),x(qi,this,new Map);for(const t of _(ls,this))_(qi,this).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!_(qi,this))return!1;this.disableUserSelect(!1);const t=_(qi,this);x(qi,this,null);let e=!1;for(const[{x:s,y:n,pageIndex:a},r]of t)r.newX=s,r.newY=n,r.newPageIndex=a,e||(e=s!==r.savedX||n!==r.savedY||a!==r.savedPageIndex);if(!e)return!1;const i=(t,e,i,s)=>{if(_(Wi,this).has(t.id)){const n=_(ji,this).get(s);n?t._setParentAndPosition(n,e,i):(t.pageIndex=s,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(const[e,{newX:s,newY:n,newPageIndex:a}]of t)i(e,s,n,a)},undo:()=>{for(const[e,{savedX:s,savedY:n,savedPageIndex:a}]of t)i(e,s,n,a)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(_(qi,this))for(const i of _(qi,this).keys())i.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(){var t;return(null===(t=this.getActive())||void 0===t?void 0:t.shouldGetKeyboardEvents())||1===_(ls,this).size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return _(Ni,this)===t}getActive(){return _(Ni,this)}getMode(){return _(os,this)}get imageManager(){return Rt(this,"imageManager",new Ei)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let l=0,h=e.rangeCount;l<h;l++)if(!t.contains(e.getRangeAt(l).commonAncestorContainer))return null;const{x:i,y:s,width:n,height:a}=t.getBoundingClientRect();let r;switch(t.getAttribute("data-main-rotation")){case"90":r=(t,e,r,o)=>({x:(e-s)/a,y:1-(t+r-i)/n,width:o/a,height:r/n});break;case"180":r=(t,e,r,o)=>({x:1-(t+r-i)/n,y:1-(e+o-s)/a,width:r/n,height:o/a});break;case"270":r=(t,e,r,o)=>({x:1-(e+o-s)/a,y:(t-i)/n,width:o/a,height:r/n});break;default:r=(t,e,r,o)=>({x:(t-i)/n,y:(e-s)/a,width:r/n,height:o/a})}const o=[];for(let l=0,h=e.rangeCount;l<h;l++){const t=e.getRangeAt(l);if(!t.collapsed)for(const{x:e,y:i,width:s,height:n}of t.getClientRects())0!==s&&0!==n&&o.push(r(e,i,s,n))}return 0===o.length?null:o}addChangedExistingAnnotation(t){let{annotationElementId:e,id:i}=t;(_(zi,this)||x(zi,this,new Map)).set(e,i)}removeChangedExistingAnnotation(t){var e;let{annotationElementId:i}=t;null===(e=_(zi,this))||void 0===e||e.delete(i)}renderAnnotationElement(t){var e;const i=null===(e=_(zi,this))||void 0===e?void 0:e.get(t.data.id);if(!i)return;const s=_(Hi,this).getRawValue(i);s&&(_(os,this)!==W.NONE||s.hasBeenModified)&&s.renderAnnotationElement(t)}}function Ts(t){let{anchorNode:e}=t;return e.nodeType===Node.TEXT_NODE?e.parentElement:e}function Ps(){const t=document.getSelection();if(!t||t.isCollapsed)return;const e=r(Cs,this,Ts).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&(_(ts,this)||x(ts,this,new fi(this)),_(ts,this).show(e,i,"ltr"===this.direction))}function Ls(){var t;const e=document.getSelection();if(!e||e.isCollapsed){var i;if(_(hs,this))null===(i=_(ts,this))||void 0===i||i.hide(),x(hs,this,null),r(Cs,this,zs).call(this,{hasSelectedText:!1});return}const{anchorNode:s}=e;if(s===_(hs,this))return;var n;if(r(Cs,this,Ts).call(this,e).closest(".textLayer")){if(null===(t=_(ts,this))||void 0===t||t.hide(),x(hs,this,s),r(Cs,this,zs).call(this,{hasSelectedText:!0}),(_(os,this)===W.HIGHLIGHT||_(os,this)===W.NONE)&&(_(os,this)===W.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),x($i,this,this.isShiftKeyDown),!this.isShiftKeyDown)){const t=this._signal,e=t=>{"pointerup"===t.type&&0!==t.button||(window.removeEventListener("pointerup",e),window.removeEventListener("blur",e),"pointerup"===t.type&&r(Cs,this,Ds).call(this,"main_toolbar"))};window.addEventListener("pointerup",e,{signal:t}),window.addEventListener("blur",e,{signal:t})}}else _(hs,this)&&(null===(n=_(ts,this))||void 0===n||n.hide(),x(hs,this,null),r(Cs,this,zs).call(this,{hasSelectedText:!1}))}function Ds(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";_(os,this)===W.HIGHLIGHT?this.highlightSelection(t):_(Yi,this)&&r(Cs,this,Ps).call(this)}function Is(){document.addEventListener("selectionchange",r(Cs,this,Ls).bind(this),{signal:this._signal})}function Fs(){const t=this._signal;window.addEventListener("focus",_(ps,this),{signal:t}),window.addEventListener("blur",_(us,this),{signal:t})}function Os(){window.removeEventListener("focus",_(ps,this)),window.removeEventListener("blur",_(us,this))}function Ns(){const t=this._signal;window.addEventListener("keydown",_(vs,this),{signal:t}),window.addEventListener("keyup",_(bs,this),{signal:t})}function Ws(){window.removeEventListener("keydown",_(vs,this)),window.removeEventListener("keyup",_(bs,this))}function js(){const t=this._signal;document.addEventListener("copy",_(fs,this),{signal:t}),document.addEventListener("cut",_(gs,this),{signal:t}),document.addEventListener("paste",_(ms,this),{signal:t})}function Bs(){document.removeEventListener("copy",_(fs,this)),document.removeEventListener("cut",_(gs,this)),document.removeEventListener("paste",_(ms,this))}function Hs(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}function zs(t){Object.entries(t).some((t=>{let[e,i]=t;return _(xs,this)[e]!==i}))&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(_(xs,this),t)}),_(os,this)===W.HIGHLIGHT&&!1===t.hasSelectedEditor&&r(Cs,this,Vs).call(this,[[j.HIGHLIGHT_FREE,!0]]))}function Vs(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}function Gs(){if(!_(is,this)){x(is,this,!0);for(const t of _(ji,this).values())t.enable();for(const t of _(Wi,this).values())t.enable()}}function Us(){if(this.unselectAll(),_(is,this)){x(is,this,!1);for(const t of _(ji,this).values())t.disable();for(const t of _(Wi,this).values())t.disable()}}function qs(t){const e=_(ji,this).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}function Xs(t){let e=null;for(e of _(ls,t));return e}function Ks(){if(0===_(Wi,this).size)return!0;if(1===_(Wi,this).size)for(const t of _(Wi,this).values())return t.isEmpty();return!1}function Ys(t){for(const e of _(ls,this))e.unselect();_(ls,this).clear();for(const e of t)e.isEmpty()||(_(ls,this).add(e),e.select());r(Cs,this,zs).call(this,{hasSelectedEditor:this.hasSelection})}(0,y.A)(Rs,"TRANSLATE_SMALL",1),(0,y.A)(Rs,"TRANSLATE_BIG",10);var Qs=new WeakMap,Js=new WeakMap,Zs=new WeakMap,$s=new WeakMap,tn=new WeakMap,en=new WeakMap,sn=new WeakMap,nn=new WeakSet;class an{constructor(t){a(this,nn),w(this,Qs,""),w(this,Js,!1),w(this,Zs,null),w(this,$s,null),w(this,tn,null),w(this,en,!1),w(this,sn,null),x(sn,this,t)}static initialize(t){an._l10nPromise||(an._l10nPromise=t)}async render(){const t=x(Zs,this,document.createElement("button"));t.className="altText";const e=await an._l10nPromise.get("pdfjs-editor-alt-text-button-label");t.textContent=e,t.setAttribute("aria-label",e),t.tabIndex="0";const i=_(sn,this)._uiManager._signal;t.addEventListener("contextmenu",Ve,{signal:i}),t.addEventListener("pointerdown",(t=>t.stopPropagation()),{signal:i});const s=t=>{t.preventDefault(),_(sn,this)._uiManager.editAltText(_(sn,this))};return t.addEventListener("click",s,{capture:!0,signal:i}),t.addEventListener("keydown",(e=>{e.target===t&&"Enter"===e.key&&(x(en,this,!0),s(e))}),{signal:i}),await r(nn,this,rn).call(this),t}finish(){_(Zs,this)&&(_(Zs,this).focus({focusVisible:_(en,this)}),x(en,this,!1))}isEmpty(){return!_(Qs,this)&&!_(Js,this)}get data(){return{altText:_(Qs,this),decorative:_(Js,this)}}set data(t){let{altText:e,decorative:i}=t;_(Qs,this)===e&&_(Js,this)===i||(x(Qs,this,e),x(Js,this,i),r(nn,this,rn).call(this))}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];_(Zs,this)&&(!t&&_(tn,this)&&(clearTimeout(_(tn,this)),x(tn,this,null)),_(Zs,this).disabled=!t)}destroy(){var t;null===(t=_(Zs,this))||void 0===t||t.remove(),x(Zs,this,null),x($s,this,null)}}async function rn(){const t=_(Zs,this);if(!t)return;var e;if(!_(Qs,this)&&!_(Js,this))return t.classList.remove("done"),void(null===(e=_($s,this))||void 0===e||e.remove());t.classList.add("done"),d._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then((e=>{t.setAttribute("aria-label",e)}));let i=_($s,this);if(!i){x($s,this,i=document.createElement("span")),i.className="tooltip",i.setAttribute("role","tooltip");const e=i.id="alt-text-tooltip-".concat(_(sn,this).id);t.setAttribute("aria-describedby",e);const s=100,n=_(sn,this)._uiManager._signal;n.addEventListener("abort",(()=>{clearTimeout(_(tn,this)),x(tn,this,null)}),{once:!0}),t.addEventListener("mouseenter",(()=>{x(tn,this,setTimeout((()=>{x(tn,this,null),_($s,this).classList.add("show"),_(sn,this)._reportTelemetry({action:"alt_text_tooltip"})}),s))}),{signal:n}),t.addEventListener("mouseleave",(()=>{var t;_(tn,this)&&(clearTimeout(_(tn,this)),x(tn,this,null)),null===(t=_($s,this))||void 0===t||t.classList.remove("show")}),{signal:n})}i.innerText=_(Js,this)?await d._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):_(Qs,this),i.parentNode||t.append(i);const s=_(sn,this).getImageForAltText();null===s||void 0===s||s.setAttribute("aria-describedby",i.id)}d=an,(0,y.A)(an,"_l10nPromise",null);var on=new WeakMap,ln=new WeakMap,hn=new WeakMap,cn=new WeakMap,dn=new WeakMap,un=new WeakMap,pn=new WeakMap,fn=new WeakMap,gn=new WeakMap,mn=new WeakMap,vn=new WeakMap,bn=new WeakMap,An=new WeakMap,yn=new WeakMap,wn=new WeakMap,_n=new WeakMap,xn=new WeakMap,kn=new WeakMap,En=new WeakMap,Sn=new WeakMap,Mn=new WeakMap,Cn=new WeakMap,Rn=new WeakSet;class Tn{static get _resizerKeyboardManager(){const t=Tn.prototype._resizeWithKeyboard,e=Rs.TRANSLATE_SMALL,i=Rs.TRANSLATE_BIG;return Rt(this,"_resizerKeyboardManager",new Di([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],Tn.prototype._stopResizingWithKeyboard]]))}constructor(t){a(this,Rn),w(this,on,null),w(this,ln,null),w(this,hn,null),w(this,cn,!1),w(this,dn,!1),w(this,un,null),w(this,pn,null),w(this,fn,this.focusin.bind(this)),w(this,gn,this.focusout.bind(this)),w(this,mn,null),w(this,vn,""),w(this,bn,!1),w(this,An,null),w(this,yn,!1),w(this,wn,!1),w(this,_n,!1),w(this,xn,null),w(this,kn,0),w(this,En,0),w(this,Sn,null),(0,y.A)(this,"_initialOptions",Object.create(null)),(0,y.A)(this,"_isVisible",!0),(0,y.A)(this,"_uiManager",null),(0,y.A)(this,"_focusEventsAllowed",!0),(0,y.A)(this,"_l10nPromise",null),w(this,Mn,!1),w(this,Cn,Tn._zIndex++),this.constructor===Tn&&St("Cannot initialize AnnotationEditor."),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:i,pageHeight:s,pageX:n,pageY:r}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,s],this.pageTranslation=[n,r];const[o,l]=this.parentDimensions;this.x=t.x/o,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return Rt(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new Un({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,i){if(Tn._l10nPromise||(Tn._l10nPromise=new Map(["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-resizer-label-topLeft","pdfjs-editor-resizer-label-topMiddle","pdfjs-editor-resizer-label-topRight","pdfjs-editor-resizer-label-middleRight","pdfjs-editor-resizer-label-bottomRight","pdfjs-editor-resizer-label-bottomMiddle","pdfjs-editor-resizer-label-bottomLeft","pdfjs-editor-resizer-label-middleLeft"].map((e=>[e,t.get(e.replaceAll(/([A-Z])/g,(t=>"-".concat(t.toLowerCase()))))])))),null!==i&&void 0!==i&&i.strings)for(const n of i.strings)Tn._l10nPromise.set(n,t.get(n));if(-1!==Tn._borderLineWidth)return;const s=getComputedStyle(document.documentElement);Tn._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){St("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return _(Mn,this)}set _isDraggable(t){var e;x(Mn,this,t),null===(e=this.div)||void 0===e||e.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}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=_(Cn,this)}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):r(Rn,this,Gn).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&(_(bn,this)?x(bn,this,!1):this.parent.setSelected(this))}focusout(t){var e;if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const i=t.relatedTarget;null!==i&&void 0!==i&&i.closest("#".concat(this.id))||(t.preventDefault(),null!==(e=this.parent)&&void 0!==e&&e.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,s){const[n,a]=this.parentDimensions;[i,s]=this.screenToPageTranslation(i,s),this.x=(t+i)/n,this.y=(e+s)/a,this.fixAndSetPosition()}translate(t,e){r(Rn,this,Pn).call(this,this.parentDimensions,t,e)}translateInPage(t,e){_(An,this)||x(An,this,[this.x,this.y]),r(Rn,this,Pn).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){_(An,this)||x(An,this,[this.x,this.y]);const[i,s]=this.parentDimensions;if(this.x+=t/i,this.y+=e/s,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:a}=this;const[r,o]=this.getBaseTranslation();n+=r,a+=o,this.div.style.left="".concat((100*n).toFixed(2),"%"),this.div.style.top="".concat((100*a).toFixed(2),"%"),this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!_(An,this)&&(_(An,this)[0]!==this.x||_(An,this)[1]!==this.y)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:i}=Tn,s=i/t,n=i/e;switch(this.rotation){case 90:return[-s,n];case 180:return[s,n];case 270:return[s,-n];default:return[-s,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.rotation;const[e,i]=this.pageDimensions;let{x:s,y:n,width:a,height:r}=this;if(a*=e,r*=i,s*=e,n*=i,this._mustFixPosition)switch(t){case 0:s=Math.max(0,Math.min(e-a,s)),n=Math.max(0,Math.min(i-r,n));break;case 90:s=Math.max(0,Math.min(e-r,s)),n=Math.min(i,Math.max(a,n));break;case 180:s=Math.min(e,Math.max(a,s)),n=Math.min(i,Math.max(r,n));break;case 270:s=Math.min(e,Math.max(r,s)),n=Math.max(0,Math.min(i-a,n))}this.x=s/=e,this.y=n/=i;const[o,l]=this.getBaseTranslation();s+=o,n+=l;const{style:h}=this.div;h.left="".concat((100*s).toFixed(2),"%"),h.top="".concat((100*n).toFixed(2),"%"),this.moveInDOM()}screenToPageTranslation(t,e){return Ln.call(Tn,t,e,this.parentRotation)}pageTranslationToScreen(t,e){return Ln.call(Tn,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,i]}=this,s=e*t,n=i*t;return Ht.isCSSRoundSupported?[Math.round(s),Math.round(n)]:[s,n]}setDims(t,e){const[i,s]=this.parentDimensions;this.div.style.width="".concat((100*t/i).toFixed(2),"%"),_(dn,this)||(this.div.style.height="".concat((100*e/s).toFixed(2),"%"))}fixDims(){const{style:t}=this.div,{height:e,width:i}=t,s=i.endsWith("%"),n=!_(dn,this)&&e.endsWith("%");if(s&&n)return;const[a,r]=this.parentDimensions;s||(t.width="".concat((100*parseFloat(i)/a).toFixed(2),"%")),_(dn,this)||n||(t.height="".concat((100*parseFloat(e)/r).toFixed(2),"%"))}getInitialTranslation(){return[0,0]}altTextFinish(){var t;null===(t=_(hn,this))||void 0===t||t.finish()}async addEditToolbar(){return _(mn,this)||_(wn,this)||(x(mn,this,new si(this)),this.div.append(_(mn,this).render()),_(hn,this)&&_(mn,this).addAltTextButton(await _(hn,this).render())),_(mn,this)}removeEditToolbar(){var t;_(mn,this)&&(_(mn,this).remove(),x(mn,this,null),null===(t=_(hn,this))||void 0===t||t.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){_(hn,this)||(an.initialize(Tn._l10nPromise),x(hn,this,new an(this)),_(on,this)&&(_(hn,this).data=_(on,this),x(on,this,null)),await this.addEditToolbar())}get altTextData(){var t;return null===(t=_(hn,this))||void 0===t?void 0:t.data}set altTextData(t){_(hn,this)&&(_(hn,this).data=t)}hasAltText(){var t;return!(null!==(t=_(hn,this))&&void 0!==t&&t.isEmpty())}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=_(cn,this)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground();const t=this._uiManager._signal;this.div.addEventListener("focusin",_(fn,this),{signal:t}),this.div.addEventListener("focusout",_(gn,this),{signal:t});const[e,i]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth="".concat((100*i/e).toFixed(2),"%"),this.div.style.maxHeight="".concat((100*e/i).toFixed(2),"%"));const[s,n]=this.getInitialTranslation();return this.translate(s,n),bi(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:e}=Ht.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():(x(bn,this,!0),this._isDraggable?r(Rn,this,jn).call(this,t):r(Rn,this,Wn).call(this,t))}moveInDOM(){_(xn,this)&&clearTimeout(_(xn,this)),x(xn,this,setTimeout((()=>{var t;x(xn,this,null),null===(t=this.parent)||void 0===t||t.moveEditorInDOM(this)}),0))}_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition()}getRect(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.rotation;const s=this.parentScale,[n,a]=this.pageDimensions,[r,o]=this.pageTranslation,l=t/s,h=e/s,c=this.x*n,d=this.y*a,u=this.width*n,p=this.height*a;switch(i){case 0:return[c+l+r,a-d-h-p+o,c+l+u+r,a-d-h+o];case 90:return[c+h+r,a-d+l+o,c+h+p+r,a-d+l+u+o];case 180:return[c-l-u+r,a-d+h+o,c-l+r,a-d+h+p+o];case 270:return[c-h-p+r,a-d-l-u+o,c-h+r,a-d-l+o];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[i,s,n,a]=t,r=n-i,o=a-s;switch(this.rotation){case 0:return[i,e-a,r,o];case 90:return[i,e-s,o,r];case 180:return[n,e-s,r,o];case 270:return[n,e-a,o,r];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){x(wn,this,!0)}disableEditMode(){x(wn,this,!1)}isInEditMode(){return _(wn,this)}shouldGetKeyboardEvents(){return _(_n,this)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var t,e;const i=this._uiManager._signal;null===(t=this.div)||void 0===t||t.addEventListener("focusin",_(fn,this),{signal:i}),null===(e=this.div)||void 0===e||e.addEventListener("focusout",_(gn,this),{signal:i})}rotate(t){}serialize(){St("An editor must be serializable")}static deserialize(t,e,i){const s=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i});s.rotation=t.rotation,x(on,s,t.accessibilityData);const[n,a]=s.pageDimensions,[r,o,l,h]=s.getRectInCurrentCoords(t.rect,a);return s.x=r/n,s.y=o/a,s.width=l/n,s.height=h/a,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){if(this.div.removeEventListener("focusin",_(fn,this)),this.div.removeEventListener("focusout",_(gn,this)),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),_(xn,this)&&(clearTimeout(_(xn,this)),x(xn,this,null)),r(Rn,this,Gn).call(this),this.removeEditToolbar(),_(Sn,this)){for(const t of _(Sn,this).values())clearTimeout(t);x(Sn,this,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(r(Rn,this,In).call(this),_(un,this).classList.remove("hidden"),bi(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),x(pn,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=_(un,this).children;if(!_(ln,this)){x(ln,this,Array.from(e));const t=r(Rn,this,Bn).bind(this),i=r(Rn,this,Hn).bind(this),s=this._uiManager._signal;for(const e of _(ln,this)){const n=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t,{signal:s}),e.addEventListener("blur",i,{signal:s}),e.addEventListener("focus",r(Rn,this,zn).bind(this,n),{signal:s}),Tn._l10nPromise.get("pdfjs-editor-resizer-label-".concat(n)).then((t=>e.setAttribute("aria-label",t)))}}const i=_(ln,this)[0];let s=0;for(const a of e){if(a===i)break;s++}const n=(360-this.rotation+this.parentRotation)%360/90*(_(ln,this).length/4);if(n!==s){if(n<s)for(let e=0;e<s-n;e++)_(un,this).append(_(un,this).firstChild);else if(n>s)for(let e=0;e<n-s;e++)_(un,this).firstChild.before(_(un,this).lastChild);let t=0;for(const i of e){const e=_(ln,this)[t++].getAttribute("data-resizer-name");Tn._l10nPromise.get("pdfjs-editor-resizer-label-".concat(e)).then((t=>i.setAttribute("aria-label",t)))}}r(Rn,this,Vn).call(this,0),x(_n,this,!0),_(un,this).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){_(_n,this)&&r(Rn,this,Nn).call(this,_(vn,this),{movementX:t,movementY:e})}_stopResizingWithKeyboard(){r(Rn,this,Gn).call(this),this.div.focus()}select(){var t,e;this.makeResizable(),null===(t=this.div)||void 0===t||t.classList.add("selectedEditor"),_(mn,this)?null===(e=_(mn,this))||void 0===e||e.show():this.addEditToolbar().then((()=>{var t,e;null!==(t=this.div)&&void 0!==t&&t.classList.contains("selectedEditor")&&(null===(e=_(mn,this))||void 0===e||e.show())}))}unselect(){var t,e,i,s;null===(t=_(un,this))||void 0===t||t.classList.add("hidden"),null===(e=this.div)||void 0===e||e.classList.remove("selectedEditor"),null!==(i=this.div)&&void 0!==i&&i.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),null===(s=_(mn,this))||void 0===s||s.hide()}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return _(yn,this)}set isEditing(t){x(yn,this,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){x(dn,this,!0);const i=t/e,{style:s}=this.div;s.aspectRatio=i,s.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){_(Sn,this)||x(Sn,this,new Map);const{action:e}=t;let i=_(Sn,this).get(e);return i&&clearTimeout(i),i=setTimeout((()=>{this._reportTelemetry(t),_(Sn,this).delete(e),0===_(Sn,this).size&&x(Sn,this,null)}),Tn._telemetryTimeout),void _(Sn,this).set(e,i)}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),x(cn,this,!1)}disable(){this.div&&(this.div.tabIndex=-1),x(cn,this,!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()}}function Pn(t,e,i){let[s,n]=t;[e,i]=this.screenToPageTranslation(e,i),this.x+=e/s,this.y+=i/n,this.fixAndSetPosition()}function Ln(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}function Dn(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]}}function In(){if(_(un,this))return;x(un,this,document.createElement("div")),_(un,this).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 i of t){const t=document.createElement("div");_(un,this).append(t),t.classList.add("resizer",i),t.setAttribute("data-resizer-name",i),t.addEventListener("pointerdown",r(Rn,this,Fn).bind(this,i),{signal:e}),t.addEventListener("contextmenu",Ve,{signal:e}),t.tabIndex=-1}this.div.prepend(_(un,this))}function Fn(t,e){var i;e.preventDefault();const{isMac:s}=Ht.platform;if(0!==e.button||e.ctrlKey&&s)return;null===(i=_(hn,this))||void 0===i||i.toggle(!1);const n=r(Rn,this,Nn).bind(this,t),a=this._isDraggable;this._isDraggable=!1;const o=this._uiManager._signal,l={passive:!0,capture:!0,signal:o};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",n,l),window.addEventListener("contextmenu",Ve,{signal:o});const h=this.x,c=this.y,d=this.width,u=this.height,p=this.parent.div.style.cursor,f=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const g=()=>{var t;this.parent.togglePointerEvents(!0),null===(t=_(hn,this))||void 0===t||t.toggle(!0),this._isDraggable=a,window.removeEventListener("pointerup",g),window.removeEventListener("blur",g),window.removeEventListener("pointermove",n,l),window.removeEventListener("contextmenu",Ve),this.parent.div.style.cursor=p,this.div.style.cursor=f,r(Rn,this,On).call(this,h,c,d,u)};window.addEventListener("pointerup",g,{signal:o}),window.addEventListener("blur",g,{signal:o})}function On(t,e,i,s){const n=this.x,a=this.y,r=this.width,o=this.height;n===t&&a===e&&r===i&&o===s||this.addCommands({cmd:()=>{this.width=r,this.height=o,this.x=n,this.y=a;const[t,e]=this.parentDimensions;this.setDims(t*r,e*o),this.fixAndSetPosition()},undo:()=>{this.width=i,this.height=s,this.x=t,this.y=e;const[n,a]=this.parentDimensions;this.setDims(n*i,a*s),this.fixAndSetPosition()},mustExec:!0})}function Nn(t,e){const[i,s]=this.parentDimensions,n=this.x,a=this.y,o=this.width,l=this.height,h=u.MIN_SIZE/i,c=u.MIN_SIZE/s,d=t=>Math.round(1e4*t)/1e4,p=r(Rn,this,Dn).call(this,this.rotation),f=(t,e)=>[p[0]*t+p[2]*e,p[1]*t+p[3]*e],g=r(Rn,this,Dn).call(this,360-this.rotation);let m,v,b=!1,A=!1;switch(t){case"topLeft":b=!0,m=(t,e)=>[0,0],v=(t,e)=>[t,e];break;case"topMiddle":m=(t,e)=>[t/2,0],v=(t,e)=>[t/2,e];break;case"topRight":b=!0,m=(t,e)=>[t,0],v=(t,e)=>[0,e];break;case"middleRight":A=!0,m=(t,e)=>[t,e/2],v=(t,e)=>[0,e/2];break;case"bottomRight":b=!0,m=(t,e)=>[t,e],v=(t,e)=>[0,0];break;case"bottomMiddle":m=(t,e)=>[t/2,e],v=(t,e)=>[t/2,0];break;case"bottomLeft":b=!0,m=(t,e)=>[0,e],v=(t,e)=>[t,0];break;case"middleLeft":A=!0,m=(t,e)=>[0,e/2],v=(t,e)=>[t,e/2]}const y=m(o,l),w=v(o,l);let _=f(...w);const x=d(n+_[0]),k=d(a+_[1]);let E=1,S=1,[M,C]=this.screenToPageTranslation(e.movementX,e.movementY);var R,T;if([M,C]=(R=M/i,T=C/s,[g[0]*R+g[2]*T,g[1]*R+g[3]*T]),b){const t=Math.hypot(o,l);E=S=Math.max(Math.min(Math.hypot(w[0]-y[0]-M,w[1]-y[1]-C)/t,1/o,1/l),h/o,c/l)}else A?E=Math.max(h,Math.min(1,Math.abs(w[0]-y[0]-M)))/o:S=Math.max(c,Math.min(1,Math.abs(w[1]-y[1]-C)))/l;const P=d(o*E),L=d(l*S);_=f(...v(P,L));const D=x-_[0],I=k-_[1];this.width=P,this.height=L,this.x=D,this.y=I,this.setDims(i*P,s*L),this.fixAndSetPosition()}function Wn(t){const{isMac:e}=Ht.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}function jn(t){const e=this._uiManager.isSelected(this);let i,s;this._uiManager.setUpDragSession();const n=this._uiManager._signal;e&&(this.div.classList.add("moving"),i={passive:!0,capture:!0,signal:n},x(kn,this,t.clientX),x(En,this,t.clientY),s=t=>{const{clientX:e,clientY:i}=t,[s,n]=this.screenToPageTranslation(e-_(kn,this),i-_(En,this));x(kn,this,e),x(En,this,i),this._uiManager.dragSelectedEditors(s,n)},window.addEventListener("pointermove",s,i));const a=()=>{window.removeEventListener("pointerup",a),window.removeEventListener("blur",a),e&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",s,i)),x(bn,this,!1),this._uiManager.endDragSession()||r(Rn,this,Wn).call(this,t)};window.addEventListener("pointerup",a,{signal:n}),window.addEventListener("blur",a,{signal:n})}function Bn(t){u._resizerKeyboardManager.exec(this,t)}function Hn(t){var e;_(_n,this)&&(null===(e=t.relatedTarget)||void 0===e?void 0:e.parentNode)!==_(un,this)&&r(Rn,this,Gn).call(this)}function zn(t){x(vn,this,_(_n,this)?t:"")}function Vn(t){if(_(ln,this))for(const e of _(ln,this))e.tabIndex=t}function Gn(){if(x(_n,this,!1),r(Rn,this,Vn).call(this,-1),_(pn,this)){const{savedX:t,savedY:e,savedWidth:i,savedHeight:s}=_(pn,this);r(Rn,this,On).call(this,t,e,i,s),x(pn,this,null)}}u=Tn,(0,y.A)(Tn,"_borderLineWidth",-1),(0,y.A)(Tn,"_colorManager",new Fi),(0,y.A)(Tn,"_zIndex",1),(0,y.A)(Tn,"_telemetryTimeout",1e3);class Un extends Tn{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}const qn=3285377520,Xn=4294901760,Kn=65535;class Yn{constructor(t){this.h1=t?4294967295&t:qn,this.h2=t?4294967295&t:qn}update(t){let e,i;if("string"===typeof t){e=new Uint8Array(2*t.length),i=0;for(let s=0,n=t.length;s<n;s++){const n=t.charCodeAt(s);n<=255?e[i++]=n:(e[i++]=n>>>8,e[i++]=255&n)}}else{if(!ArrayBuffer.isView(t))throw new Error("Invalid data format, must be a string or TypedArray.");e=t.slice(),i=e.byteLength}const s=i>>2,n=i-4*s,a=new Uint32Array(e.buffer,0,s);let r=0,o=0,l=this.h1,h=this.h2;const c=3432918353,d=461845907,u=11601,p=13715;for(let f=0;f<s;f++)1&f?(r=a[f],r=r*c&Xn|r*u&Kn,r=r<<15|r>>>17,r=r*d&Xn|r*p&Kn,l^=r,l=l<<13|l>>>19,l=5*l+3864292196):(o=a[f],o=o*c&Xn|o*u&Kn,o=o<<15|o>>>17,o=o*d&Xn|o*p&Kn,h^=o,h=h<<13|h>>>19,h=5*h+3864292196);switch(r=0,n){case 3:r^=e[4*s+2]<<16;case 2:r^=e[4*s+1]<<8;case 1:r^=e[4*s],r=r*c&Xn|r*u&Kn,r=r<<15|r>>>17,r=r*d&Xn|r*p&Kn,1&s?l^=r:h^=r}this.h1=l,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=3981806797*t&Xn|36045*t&Kn,e=4283543511*e&Xn|(2950163797*(e<<16|t>>>16)&Xn)>>>16,t^=e>>>1,t=444984403*t&Xn|60499*t&Kn,e=3301882366*e&Xn|(3120437893*(e<<16|t>>>16)&Xn)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Qn=Object.freeze({map:null,hash:"",transfer:void 0});var Jn=new WeakMap,Zn=new WeakMap,$n=new WeakSet;class ta{constructor(){a(this,$n),w(this,Jn,!1),w(this,Zn,new Map),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const i=_(Zn,this).get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return _(Zn,this).get(t)}remove(t){if(_(Zn,this).delete(t),0===_(Zn,this).size&&this.resetModified(),"function"===typeof this.onAnnotationEditor){for(const t of _(Zn,this).values())if(t instanceof Tn)return;this.onAnnotationEditor(null)}}setValue(t,e){const i=_(Zn,this).get(t);let s=!1;if(void 0!==i)for(const[n,a]of Object.entries(e))i[n]!==a&&(s=!0,i[n]=a);else s=!0,_(Zn,this).set(t,e);s&&r($n,this,ea).call(this),e instanceof Tn&&"function"===typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type)}has(t){return _(Zn,this).has(t)}getAll(){return _(Zn,this).size>0?Bt(_(Zn,this)):null}setAll(t){for(const[e,i]of Object.entries(t))this.setValue(e,i)}get size(){return _(Zn,this).size}resetModified(){_(Jn,this)&&(x(Jn,this,!1),"function"===typeof this.onResetModified&&this.onResetModified())}get print(){return new sa(this)}get serializable(){if(0===_(Zn,this).size)return Qn;const t=new Map,e=new Yn,i=[],s=Object.create(null);let n=!1;for(const[a,r]of _(Zn,this)){const i=r instanceof Tn?r.serialize(!1,s):r;i&&(t.set(a,i),e.update("".concat(a,":").concat(JSON.stringify(i))),n||(n=!!i.bitmap))}if(n)for(const a of t.values())a.bitmap&&i.push(a.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:Qn}get editorStats(){let t=null;const e=new Map;for(const n of _(Zn,this).values()){var i;if(!(n instanceof Tn))continue;const a=n.telemetryFinalData;if(!a)continue;const{type:r}=a;e.has(r)||e.set(r,Object.getPrototypeOf(n).constructor),t||(t=Object.create(null));const o=(i=t)[r]||(i[r]=new Map);for(const[t,e]of Object.entries(a)){var s;if("type"===t)continue;let i=o.get(t);i||(i=new Map,o.set(t,i));const n=null!==(s=i.get(e))&&void 0!==s?s:0;i.set(e,n+1)}}for(const[n,a]of e)t[n]=a.computeTelemetryFinalData(t[n]);return t}}function ea(){_(Jn,this)||(x(Jn,this,!0),"function"===typeof this.onSetModified&&this.onSetModified())}var ia=new WeakMap;class sa extends ta{constructor(t){super(),w(this,ia,void 0);const{map:e,hash:i,transfer:s}=t.serializable,n=structuredClone(e,s?{transfer:s}:null);x(ia,this,{map:n,hash:i,transfer:s})}get print(){St("Should not call PrintAnnotationStorage.print")}get serializable(){return _(ia,this)}}var na=new WeakMap;class aa{constructor(t){let{ownerDocument:e=globalThis.document,styleElement:i=null}=t;w(this,na,new Set),this._document=e,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(),_(na,this).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(t){let{systemFontInfo:e,_inspectFont:i}=t;if(e&&!_(na,this).has(e.loadedName))if(Mt(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:t,src:s,style:n}=e,a=new FontFace(t,s,n);this.addNativeFontFace(a);try{await a.load(),_(na,this).add(t),null===i||void 0===i||i(e)}catch{Et("Cannot load system font: ".concat(e.baseFontName,", installing it could help to improve PDF rendering.")),this.removeNativeFontFace(a)}}else St("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(i){throw Et("Failed to load font '".concat(e.family,"': '").concat(i,"'.")),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise((e=>{const i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)}))}}get isFontLoadingAPISupported(){var t;return Rt(this,"isFontLoadingAPISupported",!(null===(t=this._document)||void 0===t||!t.fonts))}get isSyncFontLoadingSupported(){var t;let e=!1;return(S||"undefined"!==typeof navigator&&"string"===typeof(null===(t=navigator)||void 0===t?void 0:t.userAgent)&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),Rt(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(t){const{loadingRequests:e}=this,i={done:!1,complete:function(){for(Mt(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;){const t=e.shift();setTimeout(t.callback,0)}},callback:t};return e.push(i),i}get _loadTestFont(){return Rt(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){function i(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function s(t,e,i,s){return t.substring(0,e)+s+t.substring(e+i)}let n,a;const r=this._document.createElement("canvas");r.width=1,r.height=1;const o=r.getContext("2d");let l=0;const h="lt".concat(Date.now()).concat(this.loadTestFontId++);let c=this._loadTestFont;c=s(c,976,h.length,h);const d=1482184792;let u=i(c,16);for(n=0,a=h.length-3;n<a;n+=4)u=u-d+i(h,n)|0;var p;n<h.length&&(u=u-d+i(h+"XXX",n)|0),c=s(c,16,4,(p=u,String.fromCharCode(p>>24&255,p>>16&255,p>>8&255,255&p)));const f="url(data:font/opentype;base64,".concat(btoa(c),");"),g='@font-face {font-family:"'.concat(h,'";src:').concat(f,"}");this.insertRule(g);const m=this._document.createElement("div");m.style.visibility="hidden",m.style.width=m.style.height="10px",m.style.position="absolute",m.style.top=m.style.left="0px";for(const v of[t.loadedName,h]){const t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=v,m.append(t)}this._document.body.append(m),function t(e,i){if(++l>30)return Et("Load test font never loaded."),void i();o.font="30px "+e,o.fillText(".",0,20),o.getImageData(0,0,1,1).data[3]>0?i():setTimeout(t.bind(null,e,i))}(h,(()=>{m.remove(),e.complete()}))}}class ra{constructor(t,e){let{disableFontFace:i=!1,inspectFont:s=null}=e;this.compiledGlyphs=Object.create(null);for(const n in t)this[n]=t[n];this.disableFontFace=!0===i,this._inspectFont=s}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style="oblique ".concat(this.cssFontInfo.italicAngle,"deg")),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return null===(t=this._inspectFont)||void 0===t||t.call(this,this),e}createFontFaceRule(){var t;if(!this.data||this.disableFontFace)return null;const e=Wt(this.data),i="url(data:".concat(this.mimetype,";base64,").concat(btoa(e),");");let s;if(this.cssFontInfo){let t="font-weight: ".concat(this.cssFontInfo.fontWeight,";");this.cssFontInfo.italicAngle&&(t+="font-style: oblique ".concat(this.cssFontInfo.italicAngle,"deg;")),s='@font-face {font-family:"'.concat(this.cssFontInfo.fontFamily,'";').concat(t,"src:").concat(i,"}")}else s='@font-face {font-family:"'.concat(this.loadedName,'";src:').concat(i,"}");return null===(t=this._inspectFont)||void 0===t||t.call(this,this,i),s}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];let i;try{i=t.get(this.loadedName+"_path_"+e)}catch(n){Et('getPathGenerator - ignoring character: "'.concat(n,'".'))}if(!Array.isArray(i)||0===i.length)return this.compiledGlyphs[e]=function(t,e){};const s=[];for(let a=0,r=i.length;a<r;)switch(i[a++]){case Qt:{const[t,e,n,r,o,l]=i.slice(a,a+6);s.push((i=>i.bezierCurveTo(t,e,n,r,o,l))),a+=6}break;case Jt:{const[t,e]=i.slice(a,a+2);s.push((i=>i.moveTo(t,e))),a+=2}break;case Zt:{const[t,e]=i.slice(a,a+2);s.push((i=>i.lineTo(t,e))),a+=2}break;case $t:{const[t,e,n,r]=i.slice(a,a+4);s.push((i=>i.quadraticCurveTo(t,e,n,r))),a+=4}break;case te:s.push((t=>t.restore()));break;case ee:s.push((t=>t.save()));break;case ie:Mt(2===s.length,"Scale command is only valid at the third position.");break;case se:{const[t,e,n,r,o,l]=i.slice(a,a+6);s.push((i=>i.transform(t,e,n,r,o,l))),a+=6}break;case ne:{const[t,e]=i.slice(a,a+2);s.push((i=>i.translate(t,e))),a+=2}}return this.compiledGlyphs[e]=function(t,e){s[0](t),s[1](t),t.scale(e,-e);for(let i=2,n=s.length;i<n;i++)s[i](t)}}}if(S){var oa=Promise.withResolvers(),la=null;(async()=>{const t=await import("fs"),e=await import("http"),i=await import("https"),s=await import("url");return new Map(Object.entries({fs:t,http:e,https:i,url:s,canvas:undefined,path2d:undefined}))})().then((t=>{la=t,oa.resolve()}),(t=>{Et("loadPackages: ".concat(t)),la=new Map,oa.resolve()}))}class ha{static get promise(){return oa.promise}static get(t){var e;return null===(e=la)||void 0===e?void 0:e.get(t)}}const ca=function(t){return ha.get("fs").promises.readFile(t).then((t=>new Uint8Array(t)))};const da="Fill",ua="Stroke",pa="Shading";function fa(t,e){if(!e)return;const i=e[2]-e[0],s=e[3]-e[1],n=new Path2D;n.rect(e[0],e[1],i,s),t.clip(n)}class ga{constructor(){this.constructor===ga&&St("Cannot initialize BaseShadingPattern.")}getPattern(){St("Abstract method `getPattern` called.")}}class ma extends ga{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 i of this._colorStops)e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,s){let n;if(s===ua||s===da){const a=e.current.getClippedPathBoundingBox(s,Ye(t))||[0,0,0,0],r=Math.ceil(a[2]-a[0])||1,o=Math.ceil(a[3]-a[1])||1,l=e.cachedCanvases.getCanvas("pattern",r,o,!0),h=l.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-a[0],-a[1]),i=Vt.transform(i,[1,0,0,1,a[0],a[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),fa(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),n=t.createPattern(l.canvas,"no-repeat");const c=new DOMMatrix(i);n.setTransform(c)}else fa(t,this._bbox),n=this._createGradient(t);return n}}function va(t,e,i,s,n,a,r,o){const l=e.coords,h=e.colors,c=t.data,d=4*t.width;let u;l[i+1]>l[s+1]&&(u=i,i=s,s=u,u=a,a=r,r=u),l[s+1]>l[n+1]&&(u=s,s=n,n=u,u=r,r=o,o=u),l[i+1]>l[s+1]&&(u=i,i=s,s=u,u=a,a=r,r=u);const p=(l[i]+e.offsetX)*e.scaleX,f=(l[i+1]+e.offsetY)*e.scaleY,g=(l[s]+e.offsetX)*e.scaleX,m=(l[s+1]+e.offsetY)*e.scaleY,v=(l[n]+e.offsetX)*e.scaleX,b=(l[n+1]+e.offsetY)*e.scaleY;if(f>=b)return;const A=h[a],y=h[a+1],w=h[a+2],_=h[r],x=h[r+1],k=h[r+2],E=h[o],S=h[o+1],M=h[o+2],C=Math.round(f),R=Math.round(b);let T,P,L,D,I,F,O,N;for(let W=C;W<=R;W++){if(W<m){const t=W<f?0:(f-W)/(f-m);T=p-(p-g)*t,P=A-(A-_)*t,L=y-(y-x)*t,D=w-(w-k)*t}else{let t;t=W>b?1:m===b?0:(m-W)/(m-b),T=g-(g-v)*t,P=_-(_-E)*t,L=x-(x-S)*t,D=k-(k-M)*t}let t;t=W<f?0:W>b?1:(f-W)/(f-b),I=p-(p-v)*t,F=A-(A-E)*t,O=y-(y-S)*t,N=w-(w-M)*t;const e=Math.round(Math.min(T,I)),i=Math.round(Math.max(T,I));let s=d*W+4*e;for(let n=e;n<=i;n++)t=(T-n)/(T-I),t<0?t=0:t>1&&(t=1),c[s++]=P-(P-F)*t|0,c[s++]=L-(L-O)*t|0,c[s++]=D-(D-N)*t|0,c[s++]=255}}function ba(t,e,i){const s=e.coords,n=e.colors;let a,r;switch(e.type){case"lattice":const o=e.verticesPerRow,l=Math.floor(s.length/o)-1,h=o-1;for(a=0;a<l;a++){let e=a*o;for(let a=0;a<h;a++,e++)va(t,i,s[e],s[e+1],s[e+o],n[e],n[e+1],n[e+o]),va(t,i,s[e+o+1],s[e+1],s[e+o],n[e+o+1],n[e+1],n[e+o])}break;case"triangles":for(a=0,r=s.length;a<r;a+=3)va(t,i,s[a],s[a+1],s[a+2],n[a],n[a+1],n[a+2]);break;default:throw new Error("illegal figure")}}class Aa extends ga{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,i){const s=Math.floor(this._bounds[0]),n=Math.floor(this._bounds[1]),a=Math.ceil(this._bounds[2])-s,r=Math.ceil(this._bounds[3])-n,o=Math.min(Math.ceil(Math.abs(a*t[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(r*t[1]*1.1)),3e3),h=a/o,c=r/l,d={coords:this._coords,colors:this._colors,offsetX:-s,offsetY:-n,scaleX:1/h,scaleY:1/c},u=o+4,p=l+4,f=i.getCanvas("mesh",u,p,!1),g=f.context,m=g.createImageData(o,l);if(e){const t=m.data;for(let i=0,s=t.length;i<s;i+=4)t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=255}for(const v of this._figures)ba(m,v,d);g.putImageData(m,2,2);return{canvas:f.canvas,offsetX:s-2*h,offsetY:n-2*c,scaleX:h,scaleY:c}}getPattern(t,e,i,s){let n;if(fa(t,this._bbox),s===pa)n=Vt.singularValueDecompose2dScale(Ye(t));else if(n=Vt.singularValueDecompose2dScale(e.baseTransform),this.matrix){const t=Vt.singularValueDecompose2dScale(this.matrix);n=[n[0]*t[0],n[1]*t[1]]}const a=this._createMeshCanvas(n,s===pa?null:this._background,e.cachedCanvases);return s!==pa&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(a.offsetX,a.offsetY),t.scale(a.scaleX,a.scaleY),t.createPattern(a.canvas,"no-repeat")}}class ya extends ga{getPattern(){return"hotpink"}}const wa=1,_a=2;class xa{constructor(t,e,i,s,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=i,this.canvasGraphicsFactory=s,this.baseTransform=n}createPatternCanvas(t){const e=this.operatorList,i=this.bbox,s=this.xstep,n=this.ystep,a=this.paintType,r=this.tilingType,o=this.color,l=this.canvasGraphicsFactory;kt("TilingType: "+r);const h=i[0],c=i[1],d=i[2],u=i[3],p=Vt.singularValueDecompose2dScale(this.matrix),f=Vt.singularValueDecompose2dScale(this.baseTransform),g=[p[0]*f[0],p[1]*f[1]],m=this.getSizeAndScale(s,this.ctx.canvas.width,g[0]),v=this.getSizeAndScale(n,this.ctx.canvas.height,g[1]),b=t.cachedCanvases.getCanvas("pattern",m.size,v.size,!0),A=b.context,y=l.createCanvasGraphics(A);y.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(y,a,o);let w=h,_=c,x=d,k=u;return h<0&&(w=0,x+=Math.abs(h)),c<0&&(_=0,k+=Math.abs(c)),A.translate(-m.scale*w,-v.scale*_),y.transform(m.scale,0,0,v.scale,0,0),A.save(),this.clipBbox(y,w,_,x,k),y.baseTransform=Ye(y.ctx),y.executeOperatorList(e),y.endDrawing(),{canvas:b.canvas,scaleX:m.scale,scaleY:v.scale,offsetX:w,offsetY:_}}getSizeAndScale(t,e,i){t=Math.abs(t);const s=Math.max(xa.MAX_PATTERN_SIZE,e);let n=Math.ceil(t*i);return n>=s?n=s:i=n/t,{scale:i,size:n}}clipBbox(t,e,i,s,n){const a=s-e,r=n-i;t.ctx.rect(e,i,a,r),t.current.updateRectMinMax(Ye(t.ctx),[e,i,s,n]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){const s=t.ctx,n=t.current;switch(e){case wa:const t=this.ctx;s.fillStyle=t.fillStyle,s.strokeStyle=t.strokeStyle,n.fillColor=t.fillStyle,n.strokeColor=t.strokeStyle;break;case _a:const a=Vt.makeHexColor(i[0],i[1],i[2]);s.fillStyle=a,s.strokeStyle=a,n.fillColor=a,n.strokeColor=a;break;default:throw new Ot("Unsupported paint type: ".concat(e))}}getPattern(t,e,i,s){let n=i;s!==pa&&(n=Vt.transform(n,e.baseTransform),this.matrix&&(n=Vt.transform(n,this.matrix)));const a=this.createPatternCanvas(e);let r=new DOMMatrix(n);r=r.translate(a.offsetX,a.offsetY),r=r.scale(1/a.scaleX,1/a.scaleY);const o=t.createPattern(a.canvas,"repeat");return o.setTransform(r),o}}function ka(t){let{src:e,srcPos:i=0,dest:s,width:n,height:a,nonBlackColor:r=4294967295,inverseDecode:o=!1}=t;const l=Ht.isLittleEndian?4278190080:255,[h,c]=o?[r,l]:[l,r],d=n>>3,u=7&n,p=e.length;s=new Uint32Array(s.buffer);let f=0;for(let g=0;g<a;g++){for(const n=i+d;i<n;i++){const t=i<p?e[i]:255;s[f++]=128&t?c:h,s[f++]=64&t?c:h,s[f++]=32&t?c:h,s[f++]=16&t?c:h,s[f++]=8&t?c:h,s[f++]=4&t?c:h,s[f++]=2&t?c:h,s[f++]=1&t?c:h}if(0===u)continue;const t=i<p?e[i++]:255;for(let e=0;e<u;e++)s[f++]=t&1<<7-e?c:h}return{srcPos:i,destPos:f}}(0,y.A)(xa,"MAX_PATTERN_SIZE",3e3);const Ea=16;class Sa{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let s;return void 0!==this.cache[t]?(s=this.cache[t],this.canvasFactory.reset(s,e,i)):(s=this.canvasFactory.create(e,i),this.cache[t]=s),s}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 Ma(t,e,i,s,n,a,r,o,l,h){const[c,d,u,p,f,g]=Ye(t);if(0===d&&0===u){const m=r*c+f,v=Math.round(m),b=o*p+g,A=Math.round(b),y=(r+l)*c+f,w=Math.abs(Math.round(y)-v)||1,_=(o+h)*p+g,x=Math.abs(Math.round(_)-A)||1;return t.setTransform(Math.sign(c),0,0,Math.sign(p),v,A),t.drawImage(e,i,s,n,a,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=r*d+g,A=Math.round(b),y=(o+h)*u+f,w=Math.abs(Math.round(y)-v)||1,_=(r+l)*d+g,x=Math.abs(Math.round(_)-A)||1;return t.setTransform(0,Math.sign(d),Math.sign(u),0,v,A),t.drawImage(e,i,s,n,a,0,0,x,w),t.setTransform(c,d,u,p,f,g),[x,w]}t.drawImage(e,i,s,n,a,r,o,l,h);return[Math.hypot(c,d)*l,Math.hypot(u,p)*h]}class Ca{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=M,this.textMatrixScale=1,this.fontMatrix=C,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=H,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,i){[e,i]=Vt.applyTransform([e,i],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,i),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,i)}updateRectMinMax(t,e){const i=Vt.applyTransform(e,t),s=Vt.applyTransform(e.slice(2),t),n=Vt.applyTransform([e[0],e[3]],t),a=Vt.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,i[0],s[0],n[0],a[0]),this.minY=Math.min(this.minY,i[1],s[1],n[1],a[1]),this.maxX=Math.max(this.maxX,i[0],s[0],n[0],a[0]),this.maxY=Math.max(this.maxY,i[1],s[1],n[1],a[1])}updateScalingPathMinMax(t,e){Vt.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,i,s,n,a,r,o,l,h){const c=Vt.bezierBoundingBox(e,i,s,n,a,r,o,l,h);h||this.updateRectMinMax(t,c)}getPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:da,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[this.minX,this.minY,this.maxX,this.maxY];if(t===ua){e||St("Stroke bounding box must include transform.");const t=Vt.singularValueDecompose2dScale(e),s=t[0]*this.lineWidth/2,n=t[1]*this.lineWidth/2;i[0]-=s,i[1]-=n,i[2]+=s,i[3]+=n}return i}updateClipFromPath(){const t=Vt.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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:da,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Vt.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function Ra(t,e){if("undefined"!==typeof ImageData&&e instanceof ImageData)return void t.putImageData(e,0,0);const i=e.height,s=e.width,n=i%Ea,a=(i-n)/Ea,r=0===n?a:a+1,o=t.createImageData(s,Ea);let l,h=0;const c=e.data,d=o.data;let u,p,f,g;if(e.kind===X.GRAYSCALE_1BPP){const e=c.byteLength,i=new Uint32Array(d.buffer,0,d.byteLength>>2),g=i.length,m=s+7>>3,v=4294967295,b=Ht.isLittleEndian?4278190080:255;for(u=0;u<r;u++){for(f=u<a?Ea:n,l=0,p=0;p<f;p++){const t=e-h;let n=0;const a=t>m?s:8*t-7,r=-8&a;let o=0,d=0;for(;n<r;n+=8)d=c[h++],i[l++]=128&d?v:b,i[l++]=64&d?v:b,i[l++]=32&d?v:b,i[l++]=16&d?v:b,i[l++]=8&d?v:b,i[l++]=4&d?v:b,i[l++]=2&d?v:b,i[l++]=1&d?v:b;for(;n<a;n++)0===o&&(d=c[h++],o=128),i[l++]=d&o?v:b,o>>=1}for(;l<g;)i[l++]=0;t.putImageData(o,0,u*Ea)}}else if(e.kind===X.RGBA_32BPP){for(p=0,g=s*Ea*4,u=0;u<a;u++)d.set(c.subarray(h,h+g)),h+=g,t.putImageData(o,0,p),p+=Ea;u<r&&(g=s*n*4,d.set(c.subarray(h,h+g)),t.putImageData(o,0,p))}else{if(e.kind!==X.RGB_24BPP)throw new Error("bad image kind: ".concat(e.kind));for(f=Ea,g=s*f,u=0;u<r;u++){for(u>=a&&(f=n,g=s*f),l=0,p=g;p--;)d[l++]=c[h++],d[l++]=c[h++],d[l++]=c[h++],d[l++]=255;t.putImageData(o,0,u*Ea)}}}function Ta(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);const i=e.height,s=e.width,n=i%Ea,a=(i-n)/Ea,r=0===n?a:a+1,o=t.createImageData(s,Ea);let l=0;const h=e.data,c=o.data;for(let d=0;d<r;d++){const e=d<a?Ea:n;({srcPos:l}=ka({src:h,srcPos:l,dest:c,width:s,height:e,nonBlackColor:0})),t.putImageData(o,0,d*Ea)}}function Pa(t,e){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of i)void 0!==t[s]&&(e[s]=t[s]);void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function La(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),!S){const{filter:e}=t;"none"!==e&&""!==e&&(t.filter="none")}}function Da(t,e){if(e)return!0;const i=Vt.singularValueDecompose2dScale(t);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);const s=Math.fround((globalThis.devicePixelRatio||1)*ue.PDF_TO_CSS_UNITS);return i[0]<=s&&i[1]<=s}const Ia=["butt","round","square"],Fa=["miter","round","bevel"],Oa={},Na={};var Wa=new WeakSet;class ja{constructor(t,e,i,s,n,r,o,l){let{optionalContentConfig:h,markedContentStack:c=null}=r;a(this,Wa),this.ctx=t,this.current=new Ca(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=i,this.canvasFactory=s,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=c||[],this.optionalContentConfig=h,this.cachedCanvases=new Sa(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=o,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"===typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing(t){let{transform:e,viewport:i,transparency:s=!1,background:n=null}=t;const a=this.ctx.canvas.width,r=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=n||"#ffffff",this.ctx.fillRect(0,0,a,r),this.ctx.fillStyle=o,s){const t=this.cachedCanvases.getCanvas("transparent",a,r);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...Ye(this.compositeCtx))}this.ctx.save(),La(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...i.transform),this.viewportScale=i.scale,this.baseTransform=Ye(this.ctx)}executeOperatorList(t,e,i,s){const n=t.argsArray,a=t.fnArray;let r=e||0;const o=n.length;if(o===r)return r;const l=o-r>10&&"function"===typeof i,h=l?Date.now()+15:0;let c=0;const d=this.commonObjs,u=this.objs;let p;for(;;){if(void 0!==s&&r===s.nextBreakPoint)return s.breakIt(r,i),r;if(p=a[r],p!==At.dependency)this[p].apply(this,n[r]);else for(const t of n[r]){const e=t.startsWith("g_")?d:u;if(!e.has(t))return e.get(t,i),r}if(r++,r===o)return r;if(l&&++c>10){if(Date.now()>h)return i(),r;c=0}}}endDrawing(){r(Wa,this,Ba).call(this),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(),r(Wa,this,Ha).call(this)}_scaleImage(t,e){const i=t.width,s=t.height;let n,a,r=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),l=i,h=s,c="prescale1";for(;r>2&&l>1||o>2&&h>1;){let e=l,i=h;r>2&&l>1&&(e=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),r/=l/e),o>2&&h>1&&(i=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h)/2,o/=h/i),n=this.cachedCanvases.getCanvas(c,e,i),a=n.context,a.clearRect(0,0,e,i),a.drawImage(t,0,0,l,h,0,0,e,i),t=n.canvas,l=e,h=i,c="prescale1"===c?"prescale2":"prescale1"}return{img:t,paintWidth:l,paintHeight:h}}_createMaskCanvas(t){const e=this.ctx,{width:i,height:s}=t,n=this.current.fillColor,a=this.current.patternFill,r=Ye(e);let o,l,h,c;if((t.bitmap||t.data)&&t.count>1){const e=t.bitmap||t.data.buffer;l=JSON.stringify(a?r:[r.slice(0,4),n]),o=this._cachedBitmapsMap.get(e),o||(o=new Map,this._cachedBitmapsMap.set(e,o));const i=o.get(l);if(i&&!a){return{canvas:i,offsetX:Math.round(Math.min(r[0],r[2])+r[4]),offsetY:Math.round(Math.min(r[1],r[3])+r[5])}}h=i}h||(c=this.cachedCanvases.getCanvas("maskCanvas",i,s),Ta(c.context,t));let d=Vt.transform(r,[1/i,0,0,-1/s,0,0]);d=Vt.transform(d,[1,0,0,1,0,-s]);const[u,p,f,g]=Vt.getAxialAlignedBoundingBox([0,0,i,s],d),m=Math.round(f-u)||1,v=Math.round(g-p)||1,b=this.cachedCanvases.getCanvas("fillCanvas",m,v),A=b.context,y=u,w=p;A.translate(-y,-w),A.transform(...d),h||(h=this._scaleImage(c.canvas,Qe(A)),h=h.img,o&&a&&o.set(l,h)),A.imageSmoothingEnabled=Da(Ye(A),t.interpolate),Ma(A,h,0,0,h.width,h.height,0,0,i,s),A.globalCompositeOperation="source-in";const _=Vt.transform(Qe(A),[1,0,0,1,-y,-w]);return A.fillStyle=a?n.getPattern(e,this,_,da):n,A.fillRect(0,0,i,s),o&&!a&&(this.cachedCanvases.delete("fillCanvas"),o.set(l,b.canvas)),{canvas:b.canvas,offsetX:Math.round(y),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=Ia[t]}setLineJoin(t){this.ctx.lineJoin=Fa[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(t),i.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,i]of t)switch(e){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.current.fillAlpha=i,this.ctx.globalAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const 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,i="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(i,t,e);this.suspendedCtx=this.ctx,this.ctx=s.context;const n=this.ctx;n.setTransform(...Ye(this.suspendedCtx)),Pa(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()},t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(t,i){e.translate(t,i),this.__originalTranslate(t,i)},t.scale=function(t,i){e.scale(t,i),this.__originalScale(t,i)},t.transform=function(t,i,s,n,a,r){e.transform(t,i,s,n,a,r),this.__originalTransform(t,i,s,n,a,r)},t.setTransform=function(t,i,s,n,a,r){e.setTransform(t,i,s,n,a,r),this.__originalSetTransform(t,i,s,n,a,r)},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,i){e.moveTo(t,i),this.__originalMoveTo(t,i)},t.lineTo=function(t,i){e.lineTo(t,i),this.__originalLineTo(t,i)},t.bezierCurveTo=function(t,i,s,n,a,r){e.bezierCurveTo(t,i,s,n,a,r),this.__originalBezierCurveTo(t,i,s,n,a,r)},t.rect=function(t,i,s,n){e.rect(t,i,s,n),this.__originalRect(t,i,s,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(),Pa(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,i=this.suspendedCtx;this.composeSMask(i,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,i,s){const n=s[0],a=s[1],r=s[2]-n,o=s[3]-a;0!==r&&0!==o&&(this.genericComposeSMask(e.context,i,r,o,e.subtype,e.backdrop,e.transferMap,n,a,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}genericComposeSMask(t,e,i,s,n,a,r,o,l,h,c){let d=t.canvas,u=o-h,p=l-c;if(a)if(u<0||p<0||u+i>d.width||p+s>d.height){const t=this.cachedCanvases.getCanvas("maskExtension",i,s),e=t.context;e.drawImage(d,-u,-p),a.some((t=>0!==t))&&(e.globalCompositeOperation="destination-atop",e.fillStyle=Vt.makeHexColor(...a),e.fillRect(0,0,i,s),e.globalCompositeOperation="source-over"),d=t.canvas,u=p=0}else if(a.some((t=>0!==t))){t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const e=new Path2D;e.rect(u,p,i,s),t.clip(e),t.globalCompositeOperation="destination-atop",t.fillStyle=Vt.makeHexColor(...a),t.fillRect(u,p,i,s),t.restore()}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),"Alpha"===n&&r?e.filter=this.filterFactory.addAlphaFilter(r):"Luminosity"===n&&(e.filter=this.filterFactory.addLuminosityFilter(r));const f=new Path2D;f.rect(o,l,i,s),e.clip(f),e.globalCompositeOperation="destination-in",e.drawImage(d,u,p,i,s,o,l,i,s),e.restore()}save(){this.inSMaskMode?(Pa(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(),Pa(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,i,s,n,a){this.ctx.transform(t,e,i,s,n,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i){const s=this.ctx,n=this.current;let a,r,o=n.x,l=n.y;const h=Ye(s),c=0===h[0]&&0===h[3]||0===h[1]&&0===h[2],d=c?i.slice(0):null;for(let u=0,p=0,f=t.length;u<f;u++)switch(0|t[u]){case At.rectangle:o=e[p++],l=e[p++];const t=e[p++],i=e[p++],u=o+t,f=l+i;s.moveTo(o,l),0===t||0===i?s.lineTo(u,f):(s.lineTo(u,l),s.lineTo(u,f),s.lineTo(o,f)),c||n.updateRectMinMax(h,[o,l,u,f]),s.closePath();break;case At.moveTo:o=e[p++],l=e[p++],s.moveTo(o,l),c||n.updatePathMinMax(h,o,l);break;case At.lineTo:o=e[p++],l=e[p++],s.lineTo(o,l),c||n.updatePathMinMax(h,o,l);break;case At.curveTo:a=o,r=l,o=e[p+4],l=e[p+5],s.bezierCurveTo(e[p],e[p+1],e[p+2],e[p+3],o,l),n.updateCurvePathMinMax(h,a,r,e[p],e[p+1],e[p+2],e[p+3],o,l,d),p+=6;break;case At.curveTo2:a=o,r=l,s.bezierCurveTo(o,l,e[p],e[p+1],e[p+2],e[p+3]),n.updateCurvePathMinMax(h,a,r,o,l,e[p],e[p+1],e[p+2],e[p+3],d),o=e[p+2],l=e[p+3],p+=4;break;case At.curveTo3:a=o,r=l,o=e[p+2],l=e[p+3],s.bezierCurveTo(e[p],e[p+1],o,l,o,l),n.updateCurvePathMinMax(h,a,r,e[p],e[p+1],o,l,o,l,d),p+=4;break;case At.closePath:s.closePath()}c&&n.updateScalingPathMinMax(h,d),n.setCurrentPoint(o,l)}closePath(){this.ctx.closePath()}stroke(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.ctx,i=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"===typeof i&&null!==i&&void 0!==i&&i.getPattern?(e.save(),e.strokeStyle=i.getPattern(e,this,Qe(e),ua),this.rescaleAndStroke(!1),e.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.ctx,i=this.current.fillColor;let s=!1;this.current.patternFill&&(e.save(),e.fillStyle=i.getPattern(e,this,Qe(e),da),s=!0);const n=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==n&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),s&&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=Oa}eoClip(){this.pendingClip=Na}beginText(){this.current.textMatrix=M,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 i of t)e.setTransform(...i.transform),e.translate(i.x,i.y),i.addToPath(e,i.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){var i;const s=this.commonObjs.get(t),n=this.current;if(!s)throw new Error("Can't find font for ".concat(t));if(n.fontMatrix=s.fontMatrix||C,0!==n.fontMatrix[0]&&0!==n.fontMatrix[3]||Et("Invalid font matrix for font "+t),e<0?(e=-e,n.fontDirection=-1):n.fontDirection=1,this.current.font=s,this.current.fontSize=e,s.isType3Font)return;const a=s.loadedName||"sans-serif",r=(null===(i=s.systemFontInfo)||void 0===i?void 0:i.css)||'"'.concat(a,'", ').concat(s.fallbackName);let o="normal";s.black?o="900":s.bold&&(o="bold");const l=s.italic?"italic":"normal";let h=e;e<16?h=16:e>100&&(h=100),this.current.fontSizeScale=e/h,this.ctx.font="".concat(l," ").concat(o," ").concat(h,"px ").concat(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,i,s,n,a){this.current.textMatrix=[t,e,i,s,n,a],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,i,s){const n=this.ctx,a=this.current,r=a.font,o=a.textRenderingMode,l=a.fontSize/a.fontSizeScale,h=o&U,c=!!(o&q),d=a.patternFill&&!r.missingFile;let u;if((r.disableFontFace||c||d)&&(u=r.getPathGenerator(this.commonObjs,t)),r.disableFontFace||d?(n.save(),n.translate(e,i),n.beginPath(),u(n,l),s&&n.setTransform(...s),h!==H&&h!==V||n.fill(),h!==z&&h!==V||n.stroke(),n.restore()):(h!==H&&h!==V||n.fillText(t,e,i),h!==z&&h!==V||n.strokeText(t,e,i)),c){(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Ye(n),x:e,y:i,fontSize:l,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 i=!1;for(let s=3;s<e.length;s+=4)if(e[s]>0&&e[s]<255){i=!0;break}return Rt(this,"isFontSubpixelAAEnabled",i)}showText(t){const e=this.current,i=e.font;if(i.isType3Font)return this.showType3Text(t);const s=e.fontSize;if(0===s)return;const n=this.ctx,a=e.fontSizeScale,r=e.charSpacing,o=e.wordSpacing,l=e.fontDirection,h=e.textHScale*l,c=t.length,d=i.vertical,u=d?1:-1,p=i.defaultVMetrics,f=s*e.fontMatrix[0],g=e.textRenderingMode===H&&!i.disableFontFace&&!e.patternFill;let m;if(n.save(),n.transform(...e.textMatrix),n.translate(e.x,e.y+e.textRise),l>0?n.scale(h,-1):n.scale(h,1),e.patternFill){n.save();const t=e.fillColor.getPattern(n,this,Qe(n),da);m=Ye(n),n.restore(),n.fillStyle=t}let v=e.lineWidth;const b=e.textMatrixScale;if(0===b||0===v){const t=e.textRenderingMode&U;t!==z&&t!==V||(v=this.getSinglePixelWidth())}else v/=b;if(1!==a&&(n.scale(a,a),v/=a),n.lineWidth=v,i.isInvalidPDFjsFont){const i=[];let s=0;for(const e of t)i.push(e.unicode),s+=e.width;return n.fillText(i.join(""),0,0),e.x+=s*f*h,n.restore(),void this.compose()}let A,y=0;for(A=0;A<c;++A){const e=t[A];if("number"===typeof e){y+=u*e*s/1e3;continue}let h=!1;const c=(e.isSpace?o:0)+r,v=e.fontChar,b=e.accent;let w,_,x=e.width;if(d){const t=e.vmetric||p,i=-(e.vmetric?t[1]:.5*x)*f,s=t[2]*f;x=t?-t[0]:x,w=i/a,_=(y+s)/a}else w=y/a,_=0;if(i.remeasure&&x>0){const t=1e3*n.measureText(v).width/s*a;if(x<t&&this.isFontSubpixelAAEnabled){const e=x/t;h=!0,n.save(),n.scale(e,1),w/=e}else x!==t&&(w+=(x-t)/2e3*s/a)}if(this.contentVisible&&(e.isInFont||i.missingFile))if(g&&!b)n.fillText(v,w,_);else if(this.paintChar(v,w,_,m),b){const t=w+s*b.offset.x/a,e=_-s*b.offset.y/a;this.paintChar(b.fontChar,t,e,m)}y+=d?x*f-c*l:x*f+c*l,h&&n.restore()}d?e.y-=y:e.x+=y*h,n.restore(),this.compose()}showType3Text(t){const e=this.ctx,i=this.current,s=i.font,n=i.fontSize,a=i.fontDirection,r=s.vertical?1:-1,o=i.charSpacing,l=i.wordSpacing,h=i.textHScale*a,c=i.fontMatrix||C,d=t.length;let u,p,f,g;if(!(i.textRenderingMode===G)&&0!==n){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...i.textMatrix),e.translate(i.x,i.y),e.scale(h,a),u=0;u<d;++u){if(p=t[u],"number"===typeof p){g=r*p*n/1e3,this.ctx.translate(g,0),i.x+=g*h;continue}const a=(p.isSpace?l:0)+o,d=s.charProcOperatorList[p.operatorListId];if(!d){Et('Type3 character "'.concat(p.operatorListId,'" is not available.'));continue}this.contentVisible&&(this.processingType3=p,this.save(),e.scale(n,n),e.transform(...c),this.executeOperatorList(d),this.restore());f=Vt.applyTransform([p.width,0],c)[0]*n+a,e.translate(f,0),i.x+=f*h}e.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,i,s,n,a){this.ctx.rect(i,s,n-i,a-s),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if("TilingPattern"===t[0]){const i=t[1],s=this.baseTransform||Ye(this.ctx),n={createCanvasGraphics:t=>new ja(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new xa(t,i,this.ctx,n,s)}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,i){const s=Vt.makeHexColor(t,e,i);this.ctx.strokeStyle=s,this.current.strokeColor=s}setFillRGBColor(t,e,i){const s=Vt.makeHexColor(t,e,i);this.ctx.fillStyle=s,this.current.fillColor=s,this.current.patternFill=!1}_getPattern(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.cachedPatterns.has(t)?e=this.cachedPatterns.get(t):(e=function(t){switch(t[0]){case"RadialAxial":return new ma(t);case"Mesh":return new Aa(t);case"Dummy":return new ya}throw new Error("Unknown IR type: ".concat(t[0]))}(this.getObject(t)),this.cachedPatterns.set(t,e)),i&&(e.matrix=i),e}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const i=this._getPattern(t);e.fillStyle=i.getPattern(e,this,Qe(e),pa);const s=Qe(e);if(s){const{width:t,height:i}=e.canvas,[n,a,r,o]=Vt.getAxialAlignedBoundingBox([0,0,t,i],s);this.ctx.fillRect(n,a,r-n,o-a)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){St("Should not call beginInlineImage")}beginImageData(){St("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=Ye(this.ctx),e)){const t=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],t,i),this.current.updateRectMinMax(Ye(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||kt("TODO: Support non-isolated groups."),t.knockout&&Et("Knockout groups not supported.");const i=Ye(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let s=Vt.getAxialAlignedBoundingBox(t.bbox,Ye(e));const n=[0,0,e.canvas.width,e.canvas.height];s=Vt.intersect(s,n)||[0,0,0,0];const a=Math.floor(s[0]),r=Math.floor(s[1]),o=Math.max(Math.ceil(s[2])-a,1),l=Math.max(Math.ceil(s[3])-r,1);this.current.startNewPathAndClipBox([0,0,o,l]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);const c=this.cachedCanvases.getCanvas(h,o,l),d=c.context;d.translate(-a,-r),d.transform(...i),t.smask?this.smaskStack.push({canvas:c.canvas,context:d,offsetX:a,offsetY:r,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(a,r),e.save()),Pa(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,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const t=Ye(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...t);const i=Vt.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],t);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(t,e,i,s,n){if(r(Wa,this,Ba).call(this),La(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const s=e[2]-e[0],a=e[3]-e[1];if(n&&this.annotationCanvasMap){(i=i.slice())[4]-=e[0],i[5]-=e[1],(e=e.slice())[0]=e[1]=0,e[2]=s,e[3]=a;const[n,r]=Vt.singularValueDecompose2dScale(Ye(this.ctx)),{viewportScale:o}=this,l=Math.ceil(s*this.outputScaleX*o),h=Math.ceil(a*this.outputScaleY*o);this.annotationCanvas=this.canvasFactory.create(l,h);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,-r,0,a*r),La(this.ctx)}else La(this.ctx),this.ctx.rect(e[0],e[1],s,a),this.ctx.clip(),this.endPath()}this.current=new Ca(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),r(Wa,this,Ha).call(this),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 i=this.ctx,s=this.processingType3;if(s&&(void 0===s.compiled&&(s.compiled=function(t){const{width:e,height:i}=t;if(e>1e3||i>1e3)return null;const s=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),n=e+1;let a,r,o,l=new Uint8Array(n*(i+1));const h=e+7&-8;let c=new Uint8Array(h*i),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]&&(l[0]=1,++u),r=1;r<e;r++)c[d]!==c[d+1]&&(l[r]=c[d]?2:1,++u),d++;for(0!==c[d]&&(l[r]=2,++u),a=1;a<i;a++){d=a*h,o=a*n,c[d-h]!==c[d]&&(l[o]=c[d]?1:8,++u);let t=(c[d]?4:0)+(c[d-h]?8:0);for(r=1;r<e;r++)t=(t>>2)+(c[d+1]?4:0)+(c[d-h+1]?8:0),s[t]&&(l[o+r]=s[t],++u),d++;if(c[d-h]!==c[d]&&(l[o+r]=c[d]?2:4,++u),u>1e3)return null}for(d=h*(i-1),o=a*n,0!==c[d]&&(l[o]=8,++u),r=1;r<e;r++)c[d]!==c[d+1]&&(l[o+r]=c[d]?4:8,++u),d++;if(0!==c[d]&&(l[o+r]=4,++u),u>1e3)return null;const p=new Int32Array([0,n,-1,0,-n,0,0,0,1]),f=new Path2D;for(a=0;u&&a<=i;a++){let t=a*n;const i=t+e;for(;t<i&&!l[t];)t++;if(t===i)continue;f.moveTo(t%n,a);const s=t;let r=l[t];do{const e=p[r];do{t+=e}while(!l[t]);const i=l[t];5!==i&&10!==i?(r=i,l[t]=0):(r=i&51*r>>4,l[t]&=r>>2|r<<2),f.lineTo(t%n,t/n|0),l[t]||--u}while(s!==t);--a}return c=null,l=null,function(t){t.save(),t.scale(1/e,-1/i),t.translate(0,-i),t.fill(f),t.beginPath(),t.restore()}}(t)),s.compiled))return void s.compiled(i);const n=this._createMaskCanvas(t),a=n.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(a,n.offsetX,n.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0;if(!this.contentVisible)return;t=this.getObject(t.data,t);const r=this.ctx;r.save();const o=Ye(r);r.transform(e,i,s,n,0,0);const l=this._createMaskCanvas(t);r.setTransform(1,0,0,1,l.offsetX-o[4],l.offsetY-o[5]);for(let h=0,c=a.length;h<c;h+=2){const t=Vt.transform(o,[e,i,s,n,a[h],a[h+1]]),[c,d]=Vt.applyTransform([0,0],t);r.drawImage(l.canvas,c,d)}r.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,i=this.current.fillColor,s=this.current.patternFill;for(const n of t){const{data:t,width:a,height:r,transform:o}=n,l=this.cachedCanvases.getCanvas("maskCanvas",a,r),h=l.context;h.save();Ta(h,this.getObject(t,n)),h.globalCompositeOperation="source-in",h.fillStyle=s?i.getPattern(h,this,Qe(e),da):i,h.fillRect(0,0,a,r),h.restore(),e.save(),e.transform(...o),e.scale(1,-1),Ma(e,l.canvas,0,0,a,r,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);e?this.paintInlineImageXObject(e):Et("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,i,s){if(!this.contentVisible)return;const n=this.getObject(t);if(!n)return void Et("Dependent image isn't ready yet");const a=n.width,r=n.height,o=[];for(let l=0,h=s.length;l<h;l+=2)o.push({transform:[e,0,0,i,s[l],s[l+1]],x:0,y:0,w:a,h:r});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:i,height:s}=t,n=this.cachedCanvases.getCanvas("inlineImage",i,s),a=n.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",n.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,i=t.height,s=this.ctx;if(this.save(),!S){const{filter:t}=s;"none"!==t&&""!==t&&(s.filter="none")}let n;if(s.scale(1/e,-1/i),t.bitmap)n=this.applyTransferMapsToBitmap(t);else if("function"===typeof HTMLElement&&t instanceof HTMLElement||!t.data)n=t;else{const s=this.cachedCanvases.getCanvas("inlineImage",e,i).context;Ra(s,t),n=this.applyTransferMapsToCanvas(s)}const a=this._scaleImage(n,Qe(s));s.imageSmoothingEnabled=Da(Ye(s),t.interpolate),Ma(s,a.img,0,0,a.paintWidth,a.paintHeight,0,-i,e,i),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const i=this.ctx;let s;if(t.bitmap)s=t.bitmap;else{const e=t.width,i=t.height,n=this.cachedCanvases.getCanvas("inlineImage",e,i).context;Ra(n,t),s=this.applyTransferMapsToCanvas(n)}for(const n of e)i.save(),i.transform(...n.transform),i.scale(1,-1),Ma(i,s,n.x,n.y,n.w,n.h,0,-1,1,1),i.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 i=this.ctx;this.pendingClip&&(e||(this.pendingClip===Na?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=Ye(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]),i=Math.hypot(t[0],t[2]),s=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,s)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:t}=this.current,{a:e,b:i,c:s,d:n}=this.ctx.getTransform();let a,r;if(0===i&&0===s){const i=Math.abs(e),s=Math.abs(n);if(i===s)if(0===t)a=r=1/i;else{const e=i*t;a=r=e<1?1/e:1}else if(0===t)a=1/i,r=1/s;else{const e=i*t,n=s*t;a=e<1?1/e:1,r=n<1?1/n:1}}else{const o=Math.abs(e*n-i*s),l=Math.hypot(e,i),h=Math.hypot(s,n);if(0===t)a=h/o,r=l/o;else{const e=t*o;a=h>e?h/e:1,r=l>e?l/e:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=r}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:i}=this.current,[s,n]=this.getScaleForStroking();if(e.lineWidth=i||1,1===s&&1===n)return void e.stroke();const a=e.getLineDash();if(t&&e.save(),e.scale(s,n),a.length>0){const t=Math.max(s,n);e.setLineDash(a.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}}function Ba(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();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)}function Ha(){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}}}for(const cf in At)void 0!==ja.prototype[cf]&&(ja.prototype[At[cf]]=ja.prototype[cf]);class za{static get workerPort(){return r(za,this,Va)._}static set workerPort(t){if(!("undefined"!==typeof Worker&&t instanceof Worker)&&null!==t)throw new Error("Invalid `workerPort` type.");Va._=r(za,this,t)}static get workerSrc(){return r(za,this,Ga)._}static set workerSrc(t){if("string"!==typeof t)throw new Error("Invalid `workerSrc` type.");Ga._=r(za,this,t)}}var Va={_:null},Ga={_:""};const Ua=1,qa=2,Xa=1,Ka=2,Ya=3,Qa=4,Ja=5,Za=6,$a=7,tr=8;function er(t){switch(t instanceof Error||"object"===typeof t&&null!==t||St('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new Nt(t.message);case"MissingPDFException":return new It(t.message);case"PasswordException":return new Pt(t.message,t.code);case"UnexpectedResponseException":return new Ft(t.message,t.status);case"UnknownErrorException":return new Lt(t.message,t.details);default:return new Lt(t.message,t.toString())}}var ir=new WeakSet;class sr{constructor(t,e,i){a(this,ir),this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=t=>{const e=t.data;if(e.targetName!==this.sourceName)return;if(e.stream)return void r(ir,this,ar).call(this,e);if(e.callback){const t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw new Error("Cannot resolve callback ".concat(t));if(delete this.callbackCapabilities[t],e.callback===Ua)i.resolve(e.data);else{if(e.callback!==qa)throw new Error("Unexpected callback case");i.reject(er(e.reason))}return}const s=this.actionHandler[e.action];if(!s)throw new Error("Unknown action from worker: ".concat(e.action));if(e.callbackId){const t=this.sourceName,n=e.sourceName;new Promise((function(t){t(s(e.data))})).then((function(s){i.postMessage({sourceName:t,targetName:n,callback:Ua,callbackId:e.callbackId,data:s})}),(function(s){i.postMessage({sourceName:t,targetName:n,callback:qa,callbackId:e.callbackId,reason:er(s)})}))}else e.streamId?r(ir,this,nr).call(this,e):s(e.data)},i.addEventListener("message",this._onComObjOnMessage)}on(t,e){const i=this.actionHandler;if(i[t])throw new Error('There is already an actionName called "'.concat(t,'"'));i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){const s=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[s]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},i)}catch(a){n.reject(a)}return n.promise}sendWithStream(t,e,i,s){const n=this.streamId++,a=this.sourceName,r=this.targetName,o=this.comObj;return new ReadableStream({start:i=>{const l=Promise.withResolvers();return this.streamControllers[n]={controller:i,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},o.postMessage({sourceName:a,targetName:r,action:t,streamId:n,data:e,desiredSize:i.desiredSize},s),l.promise},pull:t=>{const e=Promise.withResolvers();return this.streamControllers[n].pullCall=e,o.postMessage({sourceName:a,targetName:r,stream:Za,streamId:n,desiredSize:t.desiredSize}),e.promise},cancel:t=>{Mt(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:a,targetName:r,stream:Xa,streamId:n,reason:er(t)}),e.promise}},i)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}function nr(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,n=this.comObj,a=this,r=this.actionHandler[t.action],o={enqueue(t){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;const o=this.desiredSize;this.desiredSize-=a,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:i,targetName:s,stream:Qa,streamId:e,chunk:t},r)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:s,stream:Ya,streamId:e}),delete a.streamSinks[e])},error(t){Mt(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:s,stream:Ja,streamId:e,reason:er(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(r(t.data,o))})).then((function(){n.postMessage({sourceName:i,targetName:s,stream:tr,streamId:e,success:!0})}),(function(t){n.postMessage({sourceName:i,targetName:s,stream:tr,streamId:e,reason:er(t)})}))}function ar(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,n=this.comObj,a=this.streamControllers[e],o=this.streamSinks[e];switch(t.stream){case tr:t.success?a.startCall.resolve():a.startCall.reject(er(t.reason));break;case $a:t.success?a.pullCall.resolve():a.pullCall.reject(er(t.reason));break;case Za:if(!o){n.postMessage({sourceName:i,targetName:s,stream:$a,streamId:e,success:!0});break}o.desiredSize<=0&&t.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=t.desiredSize,new Promise((function(t){var e;t(null===(e=o.onPull)||void 0===e?void 0:e.call(o))})).then((function(){n.postMessage({sourceName:i,targetName:s,stream:$a,streamId:e,success:!0})}),(function(t){n.postMessage({sourceName:i,targetName:s,stream:$a,streamId:e,reason:er(t)})}));break;case Qa:if(Mt(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case Ya:if(Mt(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),r(ir,this,rr).call(this,a,e);break;case Ja:Mt(a,"error should have stream controller"),a.controller.error(er(t.reason)),r(ir,this,rr).call(this,a,e);break;case Ka:t.success?a.cancelCall.resolve():a.cancelCall.reject(er(t.reason)),r(ir,this,rr).call(this,a,e);break;case Xa:if(!o)break;new Promise((function(e){var i;e(null===(i=o.onCancel)||void 0===i?void 0:i.call(o,er(t.reason)))})).then((function(){n.postMessage({sourceName:i,targetName:s,stream:Ka,streamId:e,success:!0})}),(function(t){n.postMessage({sourceName:i,targetName:s,stream:Ka,streamId:e,reason:er(t)})})),o.sinkCapability.reject(er(t.reason)),o.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async function rr(t,e){var i,s,n;await Promise.allSettled([null===(i=t.startCall)||void 0===i?void 0:i.promise,null===(s=t.pullCall)||void 0===s?void 0:s.promise,null===(n=t.cancelCall)||void 0===n?void 0:n.promise]),delete this.streamControllers[e]}var or=new WeakMap,lr=new WeakMap;class hr{constructor(t){let{parsedData:e,rawData:i}=t;w(this,or,void 0),w(this,lr,void 0),x(or,this,e),x(lr,this,i)}getRaw(){return _(lr,this)}get(t){var e;return null!==(e=_(or,this).get(t))&&void 0!==e?e:null}getAll(){return Bt(_(or,this))}has(t){return _(or,this).has(t)}}const cr=Symbol("INTERNAL");var dr=new WeakMap,ur=new WeakMap,pr=new WeakMap,fr=new WeakMap;class gr{constructor(t,e){let{name:i,intent:s,usage:n}=e;w(this,dr,!1),w(this,ur,!1),w(this,pr,!1),w(this,fr,!0),x(dr,this,!!(t&P)),x(ur,this,!!(t&L)),this.name=i,this.intent=s,this.usage=n}get visible(){if(_(pr,this))return _(fr,this);if(!_(fr,this))return!1;const{print:t,view:e}=this.usage;return _(dr,this)?"OFF"!==(null===e||void 0===e?void 0:e.viewState):!_(ur,this)||"OFF"!==(null===t||void 0===t?void 0:t.printState)}_setVisible(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t!==cr&&St("Internal method `_setVisible` called."),x(pr,this,i),x(fr,this,e)}}var mr=new WeakMap,vr=new WeakMap,br=new WeakMap,Ar=new WeakMap,yr=new WeakSet;class wr{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:P;if(a(this,yr),w(this,mr,null),w(this,vr,new Map),w(this,br,null),w(this,Ar,null),this.renderingIntent=e,this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,x(Ar,this,t.order);for(const i of t.groups)_(vr,this).set(i.id,new gr(e,i));if("OFF"===t.baseState)for(const t of _(vr,this).values())t._setVisible(cr,!1);for(const e of t.on)_(vr,this).get(e)._setVisible(cr,!0);for(const e of t.off)_(vr,this).get(e)._setVisible(cr,!1);x(br,this,this.getHash())}}isVisible(t){if(0===_(vr,this).size)return!0;if(!t)return kt("Optional content group not defined."),!0;if("OCG"===t.type)return _(vr,this).has(t.id)?_(vr,this).get(t.id).visible:(Et("Optional content group not found: ".concat(t.id)),!0);if("OCMD"===t.type){if(t.expression)return r(yr,this,_r).call(this,t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!_(vr,this).has(e))return Et("Optional content group not found: ".concat(e)),!0;if(_(vr,this).get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!_(vr,this).has(e))return Et("Optional content group not found: ".concat(e)),!0;if(!_(vr,this).get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!_(vr,this).has(e))return Et("Optional content group not found: ".concat(e)),!0;if(!_(vr,this).get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!_(vr,this).has(e))return Et("Optional content group not found: ".concat(e)),!0;if(_(vr,this).get(e).visible)return!1}return!0}return Et("Unknown optional content policy ".concat(t.policy,".")),!0}return Et("Unknown group type ".concat(t.type,".")),!0}setVisibility(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=_(vr,this).get(t);i?(i._setVisible(cr,!!e,!0),x(mr,this,null)):Et("Optional content group not found: ".concat(t))}setOCGState(t){let e,{state:i,preserveRB:s}=t;for(const n of i){switch(n){case"ON":case"OFF":case"Toggle":e=n;continue}const t=_(vr,this).get(n);if(t)switch(e){case"ON":t._setVisible(cr,!0);break;case"OFF":t._setVisible(cr,!1);break;case"Toggle":t._setVisible(cr,!t.visible)}}x(mr,this,null)}get hasInitialVisibility(){return null===_(br,this)||this.getHash()===_(br,this)}getOrder(){return _(vr,this).size?_(Ar,this)?_(Ar,this).slice():[..._(vr,this).keys()]:null}getGroups(){return _(vr,this).size>0?Bt(_(vr,this)):null}getGroup(t){return _(vr,this).get(t)||null}getHash(){if(null!==_(mr,this))return _(mr,this);const t=new Yn;for(const[e,i]of _(vr,this))t.update("".concat(e,":").concat(i.visible));return x(mr,this,t.hexdigest())}}function _r(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let s=1;s<e;s++){const e=t[s];let n;if(Array.isArray(e))n=r(yr,this,_r).call(this,e);else{if(!_(vr,this).has(e))return Et("Optional content group not found: ".concat(e)),!0;n=_(vr,this).get(e).visible}switch(i){case"And":if(!n)return!1;break;case"Or":if(n)return!0;break;case"Not":return!n;default:return!0}}return"And"===i}class xr{constructor(t,e){let{disableRange:i=!1,disableStream:s=!1}=e;Mt(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:n,initialData:a,progressiveDone:r,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=r,this._contentDispositionFilename=o,(null===a||void 0===a?void 0:a.length)>0){const t=a instanceof Uint8Array&&a.byteLength===a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!s,this._isRangeSupported=!i,this._contentLength=n,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(t){let{begin:e,chunk:i}=t;const s=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;if(void 0===e)this._fullRequestReader?this._fullRequestReader._enqueue(s):this._queuedChunks.push(s);else{Mt(this._rangeReaders.some((function(t){return t._begin===e&&(t._enqueue(s),!0)})),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}_onProgress(t){var e,i,s,n;void 0===t.total?null===(e=this._rangeReaders[0])||void 0===e||null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded}):null===(s=this._fullRequestReader)||void 0===s||null===(n=s.onProgress)||void 0===n||n.call(s,{loaded:t.loaded,total:t.total})}_onProgressiveDone(){var t;null===(t=this._fullRequestReader)||void 0===t||t.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){Mt(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new kr(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new Er(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeReaders.slice(0))i.cancel(t);this._pdfDataRangeTransport.abort()}}class kr{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this._stream=t,this._done=i||!1,this._filename=We(s)?s:null,this._queuedChunks=e||[],this._loaded=0;for(const n of this._queuedChunks)this._loaded+=n.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else 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 Er{constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,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 Sr(t){let{getResponseHeader:e,isHttp:i,rangeChunkSize:s,disableRange:n}=t;const a={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(e("Content-Length"),10);if(!Number.isInteger(r))return a;if(a.suggestedLength=r,r<=2*s)return a;if(n||!i)return a;if("bytes"!==e("Accept-Ranges"))return a;return"identity"!==(e("Content-Encoding")||"identity")||(a.allowRangeRequests=!0),a}function Mr(t){const e=t("Content-Disposition");if(e){let t=function(t){let e=!0,i=s("filename\\*","i").exec(t);if(i){i=i[1];let t=r(i);return t=unescape(t),t=o(t),t=l(t),a(t)}if(i=function(t){const e=[];let i;const n=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=n.exec(t));){let[,t,s,n]=i;if(t=parseInt(t,10),t in e){if(0===t)break}else e[t]=[s,n]}const a=[];for(let s=0;s<e.length&&s in e;++s){let[t,i]=e[s];i=r(i),t&&(i=unescape(i),0===s&&(i=o(i))),a.push(i)}return a.join("")}(t),i)return a(l(i));if(i=s("filename","i").exec(t),i){i=i[1];let t=r(i);return t=l(t),a(t)}function s(t,e){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function n(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const s=new TextDecoder(t,{fatal:!0}),n=jt(i);i=s.decode(n),e=!1}catch{}}return i}function a(t){return e&&/[\x80-\xff]/.test(t)&&(t=n("utf-8",t),e&&(t=n("iso-8859-1",t))),t}function r(t){if(t.startsWith('"')){const e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){const i=e[t].indexOf('"');-1!==i&&(e[t]=e[t].slice(0,i),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 l(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(t,e,i,s){if("q"===i||"Q"===i)return n(e,s=(s=s.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,(function(t,e){return String.fromCharCode(parseInt(e,16))})));try{s=atob(s)}catch{}return n(e,s)}))}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(We(t))return t}return null}function Cr(t,e){return 404===t||0===t&&e.startsWith("file:")?new It('Missing PDF "'+e+'".'):new Ft("Unexpected server response (".concat(t,') while retrieving PDF "').concat(e,'".'),t)}function Rr(t){return 200===t||206===t}function Tr(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function Pr(t){const e=new Headers;for(const i in t){const s=t[i];void 0!==s&&e.append(i,s)}return e}function Lr(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(Et("getArrayBuffer - unexpected data format: ".concat(t)),new Uint8Array(t).buffer)}class Dr{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}getFullReader(){return Mt(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Ir(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new Fr(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class Ir{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,this._headers=Pr(this._stream.httpHeaders);const i=e.url;fetch(i,Tr(this._headers,this._withCredentials,this._abortController)).then((t=>{if(!Rr(t.status))throw Cr(t.status,i);this._reader=t.body.getReader(),this._headersCapability.resolve();const e=e=>t.headers.get(e),{allowRangeRequests:s,suggestedLength:n}=Sr({getResponseHeader:e,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=n||this._contentLength,this._filename=Mr(e),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Nt("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(){var t;await this._headersCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength}),{value:Lr(e),done:!1})}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t),this._abortController.abort()}}class Fr{constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;const s=t.source;this._withCredentials=s.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController,this._headers=Pr(this._stream.httpHeaders),this._headers.append("Range","bytes=".concat(e,"-").concat(i-1));const n=s.url;fetch(n,Tr(this._headers,this._withCredentials,this._abortController)).then((t=>{if(!Rr(t.status))throw Cr(t.status,n);this._readCapability.resolve(),this._reader=t.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._readCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded}),{value:Lr(e),done:!1})}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t),this._abortController.abort()}}class Or{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.url=t,this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&e.httpHeaders||Object.create(null),this.withCredentials=e.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,i){const s={begin:t,end:e};for(const n in i)s[n]=i[n];return this.request(s)}requestFull(t){return this.request(t)}request(t){const e=new XMLHttpRequest,i=this.currXhrId++,s=this.pendingRequests[i]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const n in this.httpHeaders){const t=this.httpHeaders[n];void 0!==t&&e.setRequestHeader(n,t)}return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range","bytes=".concat(t.begin,"-").concat(t.end-1)),s.expectedStatus=206):s.expectedStatus=200,e.responseType="arraybuffer",t.onError&&(e.onerror=function(i){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),s.onHeadersReceived=t.onHeadersReceived,s.onDone=t.onDone,s.onError=t.onError,s.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){var i;const s=this.pendingRequests[t];s&&(null===(i=s.onProgress)||void 0===i||i.call(s,e))}onStateChange(t,e){const i=this.pendingRequests[t];if(!i)return;const s=i.xhr;if(s.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==s.readyState)return;if(!(t in this.pendingRequests))return;var n;if(delete this.pendingRequests[t],0===s.status&&this.isHttp)return void(null===(n=i.onError)||void 0===n||n.call(i,s.status));const a=s.status||200;var r;if(!(200===a&&206===i.expectedStatus)&&a!==i.expectedStatus)return void(null===(r=i.onError)||void 0===r||r.call(i,s.status));const o=function(t){const e=t.response;return"string"!==typeof e?e:jt(e).buffer}(s);if(206===a){const t=s.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);i.onDone({begin:parseInt(e[1],10),chunk:o})}else if(o)i.onDone({begin:0,chunk:o});else{var l;null===(l=i.onError)||void 0===l||l.call(i,s.status)}}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class Nr{constructor(t){this._source=t,this._manager=new Or(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),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 Mt(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Wr(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const i=new jr(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class Wr{constructor(t,e){this._manager=t;const i={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(i),this._headersReceivedCapability=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),i=t=>e.getResponseHeader(t),{allowRangeRequests:s,suggestedLength:n}=Sr({getResponseHeader:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=n||this._contentLength,this._filename=Mr(i),this._isRangeSupported&&this._manager.abortRequest(t),this._headersReceivedCapability.resolve()}_onDone(t){if(t)if(this._requests.length>0){this._requests.shift().resolve({value:t.chunk,done:!1})}else this._cachedChunks.push(t.chunk);if(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=Cr(t,this._url),this._headersReceivedCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;null===(e=this.onProgress)||void 0===e||e.call(this,{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._headersReceivedCapability.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._headersReceivedCapability.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 jr{constructor(t,e,i){this._manager=t;const s={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,i,s),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var t;null===(t=this.onClosed)||void 0===t||t.call(this,this)}_onDone(t){const e=t.chunk;if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._queuedChunk=e;this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=Cr(t,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){var e;this.isStreamingSupported||(null===(e=this.onProgress)||void 0===e||e.call(this,{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(this._requestId),this._close()}}const Br=/^file:\/\/\/[a-zA-Z]:\//;class Hr{constructor(t){this.source=t,this.url=function(t){const e=ha.get("url"),i=e.parse(t);return"file:"===i.protocol||i.host?i:/^[a-z]:[/\\]/i.test(t)?e.parse("file:///".concat(t)):(i.host||(i.protocol="file:"),i)}(t.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}getFullReader(){return Mt(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new Xr(this):new Ur(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=this.isFsUrl?new Kr(this,t,e):new qr(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class zr{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(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=e.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(e).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 Nt("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Vr{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(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=e.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded});return{value:new Uint8Array(e).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)}}function Gr(t,e){return{protocol:t.protocol,auth:t.auth,host:t.hostname,port:t.port,path:t.path,method:"GET",headers:e}}class Ur extends zr{constructor(t){super(t);const e=e=>{if(404===e.statusCode){const t=new It('Missing PDF "'.concat(this._url,'".'));return this._storedError=t,void this._headersCapability.reject(t)}this._headersCapability.resolve(),this._setReadableStream(e);const i=t=>this._readableStream.headers[t.toLowerCase()],{allowRangeRequests:s,suggestedLength:n}=Sr({getResponseHeader:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=n||this._contentLength,this._filename=Mr(i)};if(this._request=null,"http:"===this._url.protocol){const i=ha.get("http");this._request=i.request(Gr(this._url,t.httpHeaders),e)}else{const i=ha.get("https");this._request=i.request(Gr(this._url,t.httpHeaders),e)}this._request.on("error",(t=>{this._storedError=t,this._headersCapability.reject(t)})),this._request.end()}}class qr extends Vr{constructor(t,e,i){super(t),this._httpHeaders={};for(const n in t.httpHeaders){const e=t.httpHeaders[n];void 0!==e&&(this._httpHeaders[n]=e)}this._httpHeaders.Range="bytes=".concat(e,"-").concat(i-1);const s=t=>{if(404!==t.statusCode)this._setReadableStream(t);else{const t=new It('Missing PDF "'.concat(this._url,'".'));this._storedError=t}};if(this._request=null,"http:"===this._url.protocol){const t=ha.get("http");this._request=t.request(Gr(this._url,this._httpHeaders),s)}else{const t=ha.get("https");this._request=t.request(Gr(this._url,this._httpHeaders),s)}this._request.on("error",(t=>{this._storedError=t})),this._request.end()}}class Xr extends zr{constructor(t){super(t);let e=decodeURIComponent(this._url.path);Br.test(this._url.href)&&(e=e.replace(/^\//,""));const i=ha.get("fs");i.promises.lstat(e).then((t=>{this._contentLength=t.size,this._setReadableStream(i.createReadStream(e)),this._headersCapability.resolve()}),(t=>{"ENOENT"===t.code&&(t=new It('Missing PDF "'.concat(e,'".'))),this._storedError=t,this._headersCapability.reject(t)}))}}class Kr extends Vr{constructor(t,e,i){super(t);let s=decodeURIComponent(this._url.path);Br.test(this._url.href)&&(s=s.replace(/^\//,""));const n=ha.get("fs");this._setReadableStream(n.createReadStream(s,{start:e,end:i-1}))}}const Yr=30,Qr=.8;var Jr=new WeakMap,Zr=new WeakMap,$r=new WeakMap,to=new WeakMap,eo=new WeakMap,io=new WeakMap,so=new WeakMap,no=new WeakMap,ao=new WeakMap,ro=new WeakMap,oo=new WeakMap,lo=new WeakMap,ho=new WeakMap,co=new WeakMap,uo=new WeakMap,po=new WeakMap,fo=new WeakMap,go=new WeakMap,mo=new WeakSet;class vo{constructor(t){var e;let{textContentSource:i,container:s,viewport:n}=t;if(a(this,mo),w(this,Jr,Promise.withResolvers()),w(this,Zr,null),w(this,$r,!1),w(this,to,!(null===(e=globalThis.FontInspector)||void 0===e||!e.enabled)),w(this,eo,null),w(this,io,null),w(this,so,0),w(this,no,0),w(this,ao,null),w(this,ro,null),w(this,oo,0),w(this,lo,0),w(this,ho,Object.create(null)),w(this,co,[]),w(this,uo,null),w(this,po,[]),w(this,fo,new WeakMap),w(this,go,null),i instanceof ReadableStream)x(uo,this,i);else{if("object"!==typeof i)throw new Error('No "textContentSource" parameter specified.');x(uo,this,new ReadableStream({start(t){t.enqueue(i),t.close()}}))}x(Zr,this,x(ro,this,s)),x(lo,this,n.scale*(globalThis.devicePixelRatio||1)),x(oo,this,n.rotation),x(io,this,{prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:null});const{pageWidth:r,pageHeight:o,pageX:l,pageY:h}=n.rawDims;x(go,this,[1,0,0,-1,-l,h+o]),x(no,this,r),x(so,this,o),_o.call(vo),Je(s,n),_(Jr,this).promise.catch((()=>{})).then((()=>{Mo._.delete(this),x(io,this,null),x(ho,this,null)}))}render(){const t=()=>{_(ao,this).read().then((e=>{var i;let{value:s,done:n}=e;n?_(Jr,this).resolve():(null!==(i=_(eo,this))&&void 0!==i||x(eo,this,s.lang),Object.assign(_(ho,this),s.styles),r(mo,this,bo).call(this,s.items),t())}),_(Jr,this).reject)};return x(ao,this,_(uo,this).getReader()),Mo._.add(this),t(),_(Jr,this).promise}update(t){let{viewport:e,onBefore:i=null}=t;const s=e.scale*(globalThis.devicePixelRatio||1),n=e.rotation;if(n!==_(oo,this)&&(null===i||void 0===i||i(),x(oo,this,n),Je(_(ro,this),{rotation:n})),s!==_(lo,this)){null===i||void 0===i||i(),x(lo,this,s);const t={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:wo.call(vo,_(eo,this))};for(const e of _(po,this))t.properties=_(fo,this).get(e),t.div=e,r(mo,this,yo).call(this,t)}}cancel(){var t;const e=new Nt("TextLayer task cancelled.");null===(t=_(ao,this))||void 0===t||t.cancel(e).catch((()=>{})),x(ao,this,null),_(Jr,this).reject(e)}get textDivs(){return _(po,this)}get textContentItemsStr(){return _(co,this)}static cleanup(){if(!(r(vo,this,Mo)._.size>0)){r(vo,this,ko)._.clear();for(const{canvas:t}of r(vo,this,Eo)._.values())t.remove();r(vo,this,Eo)._.clear()}}}function bo(t){var e,i;if(_($r,this))return;null!==(i=(e=_(io,this)).ctx)&&void 0!==i||(e.ctx=wo.call(p,_(eo,this)));const s=_(po,this),n=_(co,this);for(const a of t){if(s.length>1e5)return Et("Ignoring additional textDivs for performance reasons."),void x($r,this,!0);if(void 0!==a.str)n.push(a.str),r(mo,this,Ao).call(this,a);else if("beginMarkedContentProps"===a.type||"beginMarkedContent"===a.type){const t=_(Zr,this);x(Zr,this,document.createElement("span")),_(Zr,this).classList.add("markedContent"),null!==a.id&&_(Zr,this).setAttribute("id","".concat(a.id)),t.append(_(Zr,this))}else"endMarkedContent"===a.type&&x(Zr,this,_(Zr,this).parentNode)}}function Ao(t){const e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};_(po,this).push(e);const s=Vt.transform(_(go,this),t.transform);let n=Math.atan2(s[1],s[0]);const a=_(ho,this)[t.fontName];a.vertical&&(n+=Math.PI/2);const o=_(to,this)&&a.fontSubstitution||a.fontFamily,l=Math.hypot(s[2],s[3]),h=l*xo.call(p,o,_(eo,this));let c,d;0===n?(c=s[4],d=s[5]-h):(c=s[4]+h*Math.sin(n),d=s[5]-h*Math.cos(n));const u="calc(var(--scale-factor)*",f=e.style;_(Zr,this)===_(ro,this)?(f.left="".concat((100*c/_(no,this)).toFixed(2),"%"),f.top="".concat((100*d/_(so,this)).toFixed(2),"%")):(f.left="".concat(u).concat(c.toFixed(2),"px)"),f.top="".concat(u).concat(d.toFixed(2),"px)")),f.fontSize="".concat(u).concat((So._*l).toFixed(2),"px)"),f.fontFamily=o,i.fontSize=l,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,_(to,this)&&(e.dataset.fontName=a.fontSubstitutionLoadedName||t.fontName),0!==n&&(i.angle=n*(180/Math.PI));let g=!1;if(t.str.length>1)g=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){const e=Math.abs(t.transform[0]),i=Math.abs(t.transform[3]);e!==i&&Math.max(e,i)/Math.min(e,i)>1.5&&(g=!0)}if(g&&(i.canvasWidth=a.vertical?t.height:t.width),_(fo,this).set(e,i),_(io,this).div=e,_(io,this).properties=i,r(mo,this,yo).call(this,_(io,this)),i.hasText&&_(Zr,this).append(e),i.hasEOL){const t=document.createElement("br");t.setAttribute("role","presentation"),_(Zr,this).append(t)}}function yo(t){const{div:e,properties:i,ctx:s,prevFontSize:n,prevFontFamily:a}=t,{style:r}=e;let o="";if(So._>1&&(o="scale(".concat(1/So._,")")),0!==i.canvasWidth&&i.hasText){const{fontFamily:l}=r,{canvasWidth:h,fontSize:c}=i;n===c&&a===l||(s.font="".concat(c*_(lo,this),"px ").concat(l),t.prevFontSize=c,t.prevFontFamily=l);const{width:d}=s.measureText(e.textContent);d>0&&(o="scaleX(".concat(h*_(lo,this)/d,") ").concat(o))}0!==i.angle&&(o="rotate(".concat(i.angle,"deg) ").concat(o)),o.length>0&&(r.transform=o)}function wo(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=r(p,this,Eo)._.get(t||(t=""));if(!e){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),r(p,this,Eo)._.set(t,e)}return e}function _o(){if(null!==r(p,this,So)._)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.textContent="X",document.body.append(t),So._=r(p,this,t.getBoundingClientRect().height),t.remove()}function xo(t,e){const i=r(p,this,ko)._.get(t);if(i)return i;const s=r(p,this,wo).call(this,e),n=s.font;s.canvas.width=s.canvas.height=Yr,s.font="".concat(Yr,"px ").concat(t);const a=s.measureText("");let o=a.fontBoundingBoxAscent,l=Math.abs(a.fontBoundingBoxDescent);if(o){const e=o/(o+l);return r(p,this,ko)._.set(t,e),s.canvas.width=s.canvas.height=0,s.font=n,e}s.strokeStyle="red",s.clearRect(0,0,Yr,Yr),s.strokeText("g",0,0);let h=s.getImageData(0,0,Yr,Yr).data;l=0;for(let r=h.length-1-3;r>=0;r-=4)if(h[r]>0){l=Math.ceil(r/4/Yr);break}s.clearRect(0,0,Yr,Yr),s.strokeText("A",0,Yr),h=s.getImageData(0,0,Yr,Yr).data,o=0;for(let r=0,d=h.length;r<d;r+=4)if(h[r]>0){o=Yr-Math.floor(r/4/Yr);break}s.canvas.width=s.canvas.height=0,s.font=n;const c=o?o/(o+l):Qr;return r(p,this,ko)._.set(t,c),c}p=vo;var ko={_:new Map},Eo={_:new Map},So={_:null},Mo={_:new Set};function Co(){Ge("`renderTextLayer`, please use `TextLayer` instead.");const{textContentSource:t,container:e,viewport:i,...s}=arguments[0],n=Object.keys(s);n.length>0&&Et("Ignoring `renderTextLayer` parameters: "+n.join(", "));const a=new vo({textContentSource:t,container:e,viewport:i}),{textDivs:r,textContentItemsStr:o}=a;return{promise:a.render(),textDivs:r,textContentItemsStr:o}}function Ro(){Ge("`updateTextLayer`, please use `TextLayer` instead.")}class To{static textContent(t){const e=[],i={items:e,styles:Object.create(null)};return function t(i){var s;if(!i)return;let n=null;const a=i.name;if("#text"===a)n=i.value;else{if(!To.shouldBuildText(a))return;null!==i&&void 0!==i&&null!==(s=i.attributes)&&void 0!==s&&s.textContent?n=i.attributes.textContent:i.value&&(n=i.value)}if(null!==n&&e.push({str:n}),i.children)for(const e of i.children)t(e)}(t),i}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}const Po=65536,Lo=S?class extends oe{_createCanvas(t,e){return ha.get("canvas").createCanvas(t,e)}}:class extends oe{constructor(){let{ownerDocument:t=globalThis.document,enableHWA:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super({enableHWA:e}),this._document=t}_createCanvas(t,e){const i=this._document.createElement("canvas");return i.width=t,i.height=e,i}},Do=S?class extends le{_fetchData(t,e){return ca(t).then((t=>({cMapData:t,compressionType:e})))}}:Le,Io=S?class extends ae{}:class extends ae{constructor(){let{docId:t,ownerDocument:e=globalThis.document}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),a(this,Ae),w(this,pe,void 0),w(this,fe,void 0),w(this,ge,void 0),w(this,me,void 0),w(this,ve,void 0),w(this,be,0),x(ge,this,t),x(me,this,e)}addFilter(t){var e,i;if(!t)return"none";let s=o(Ae,this,ye).get(t);if(s)return s;const[n,a,l]=r(Ae,this,xe).call(this,t),h=1===t.length?n:"".concat(n).concat(a).concat(l);if(s=o(Ae,this,ye).get(h),s)return o(Ae,this,ye).set(t,s),s;const c="g_".concat(_(ge,this),"_transfer_map_").concat((x(be,this,(e=_(be,this),i=e++,e)),i)),d="url(#".concat(c,")");o(Ae,this,ye).set(t,d),o(Ae,this,ye).set(h,d);const u=r(Ae,this,Se).call(this,c);return r(Ae,this,Ce).call(this,n,a,l,u),d}addHCMFilter(t,e){var i;const s="".concat(t,"-").concat(e),n="base";let a=o(Ae,this,we).get(n);if((null===(i=a)||void 0===i?void 0:i.key)===s)return a.url;var l;a?(null===(l=a.filter)||void 0===l||l.remove(),a.key=s,a.url="none",a.filter=null):(a={key:s,url:"none",filter:null},o(Ae,this,we).set(n,a));if(!t||!e)return a.url;const h=r(Ae,this,Te).call(this,t);t=Vt.makeHexColor(...h);const c=r(Ae,this,Te).call(this,e);if(e=Vt.makeHexColor(...c),o(Ae,this,_e).style.color="","#000000"===t&&"#ffffff"===e||t===e)return a.url;const d=new Array(256);for(let r=0;r<=255;r++){const t=r/255;d[r]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const u=d.join(","),p="g_".concat(_(ge,this),"_hcm_filter"),f=a.filter=r(Ae,this,Se).call(this,p);r(Ae,this,Ce).call(this,u,u,u,f),r(Ae,this,Ee).call(this,f);const g=(t,e)=>{const i=h[t]/255,s=c[t]/255,n=new Array(e+1);for(let a=0;a<=e;a++)n[a]=i+a/e*(s-i);return n.join(",")};return r(Ae,this,Ce).call(this,g(0,5),g(1,5),g(2,5),f),a.url="url(#".concat(p,")"),a.url}addAlphaFilter(t){var e,i;let s=o(Ae,this,ye).get(t);if(s)return s;const[n]=r(Ae,this,xe).call(this,[t]),a="alpha_".concat(n);if(s=o(Ae,this,ye).get(a),s)return o(Ae,this,ye).set(t,s),s;const l="g_".concat(_(ge,this),"_alpha_map_").concat((x(be,this,(e=_(be,this),i=e++,e)),i)),h="url(#".concat(l,")");o(Ae,this,ye).set(t,h),o(Ae,this,ye).set(a,h);const c=r(Ae,this,Se).call(this,l);return r(Ae,this,Re).call(this,n,c),h}addLuminosityFilter(t){var e,i;let s,n,a=o(Ae,this,ye).get(t||"luminosity");if(a)return a;if(t?([s]=r(Ae,this,xe).call(this,[t]),n="luminosity_".concat(s)):n="luminosity",a=o(Ae,this,ye).get(n),a)return o(Ae,this,ye).set(t,a),a;const l="g_".concat(_(ge,this),"_luminosity_map_").concat((x(be,this,(e=_(be,this),i=e++,e)),i)),h="url(#".concat(l,")");o(Ae,this,ye).set(t,h),o(Ae,this,ye).set(n,h);const c=r(Ae,this,Se).call(this,l);return r(Ae,this,ke).call(this,c),t&&r(Ae,this,Re).call(this,s,c),h}addHighlightHCMFilter(t,e,i,s,n){var a;const l="".concat(e,"-").concat(i,"-").concat(s,"-").concat(n);let h=o(Ae,this,we).get(t);if((null===(a=h)||void 0===a?void 0:a.key)===l)return h.url;var c;h?(null===(c=h.filter)||void 0===c||c.remove(),h.key=l,h.url="none",h.filter=null):(h={key:l,url:"none",filter:null},o(Ae,this,we).set(t,h));if(!e||!i)return h.url;const[d,u]=[e,i].map(r(Ae,this,Te).bind(this));let p=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),f=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),[g,m]=[s,n].map(r(Ae,this,Te).bind(this));f<p&&([p,f,g,m]=[f,p,m,g]),o(Ae,this,_e).style.color="";const v=(t,e,i)=>{const s=new Array(256),n=(f-p)/i,a=t/255,r=(e-t)/(255*i);let o=0;for(let l=0;l<=i;l++){const t=Math.round(p+l*n),e=a+l*r;for(let i=o;i<=t;i++)s[i]=e;o=t+1}for(let l=o;l<256;l++)s[l]=s[o-1];return s.join(",")},b="g_".concat(_(ge,this),"_hcm_").concat(t,"_filter"),A=h.filter=r(Ae,this,Se).call(this,b);return r(Ae,this,Ee).call(this,A),r(Ae,this,Ce).call(this,v(g[0],m[0],5),v(g[1],m[1],5),v(g[2],m[2],5),A),h.url="url(#".concat(b,")"),h.url}destroy(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&0!==o(Ae,this,we).size||(_(fe,this)&&(_(fe,this).parentNode.parentNode.remove(),x(fe,this,null)),_(pe,this)&&(_(pe,this).clear(),x(pe,this,null)),x(be,this,0))}},Fo=S?class extends he{_fetchData(t){return ca(t)}}:De;function Oo(){var t,e;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"string"===typeof i||i instanceof URL?i={url:i}:(i instanceof ArrayBuffer||ArrayBuffer.isView(i))&&(i={data:i});const s=new Wo,{docId:n}=s,a=i.url?function(t){if(t instanceof URL)return t.href;try{return new URL(t,window.location).href}catch{if(S&&"string"===typeof t)return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(i.url):null,r=i.data?function(t){if(S&&"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 jt(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"===typeof t&&!isNaN(null===t||void 0===t?void 0: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.")}(i.data):null,o=i.httpHeaders||null,l=!0===i.withCredentials,h=null!==(t=i.password)&&void 0!==t?t:null,c=i.range instanceof Bo?i.range:null,d=Number.isInteger(i.rangeChunkSize)&&i.rangeChunkSize>0?i.rangeChunkSize:Po;let u=i.worker instanceof $o?i.worker:null;const p=i.verbosity,f="string"!==typeof i.docBaseUrl||Ne(i.docBaseUrl)?null:i.docBaseUrl,g="string"===typeof i.cMapUrl?i.cMapUrl:null,m=!1!==i.cMapPacked,v=i.CMapReaderFactory||Do,b="string"===typeof i.standardFontDataUrl?i.standardFontDataUrl:null,A=i.StandardFontDataFactory||Fo,y=!0!==i.stopAtErrors,w=Number.isInteger(i.maxImageSize)&&i.maxImageSize>-1?i.maxImageSize:-1,_=!1!==i.isEvalSupported,x="boolean"===typeof i.isOffscreenCanvasSupported?i.isOffscreenCanvasSupported:!S,k=Number.isInteger(i.canvasMaxAreaInBytes)?i.canvasMaxAreaInBytes:-1,E="boolean"===typeof i.disableFontFace?i.disableFontFace:S,M=!0===i.fontExtraProperties,C=!0===i.enableXfa,R=i.ownerDocument||globalThis.document,T=!0===i.disableRange,P=!0===i.disableStream,L=!0===i.disableAutoFetch,D=!0===i.pdfBug,I=!0===i.enableHWA,F=c?c.length:null!==(e=i.length)&&void 0!==e?e:NaN,O="boolean"===typeof i.useSystemFonts?i.useSystemFonts:!S&&!E,N="boolean"===typeof i.useWorkerFetch?i.useWorkerFetch:v===Le&&A===De&&g&&b&&ze(g,document.baseURI)&&ze(b,document.baseURI),W=i.canvasFactory||new Lo({ownerDocument:R,enableHWA:I}),j=i.filterFactory||new Io({docId:n,ownerDocument:R});_t(p);const B={canvasFactory:W,filterFactory:j};if(N||(B.cMapReaderFactory=new v({baseUrl:g,isCompressed:m}),B.standardFontDataFactory=new A({baseUrl:b})),!u){const t={verbosity:p,port:za.workerPort};u=t.port?$o.fromPort(t):new $o(t),s._worker=u}const H={docId:n,apiVersion:"4.4.168",data:r,password:h,disableAutoFetch:L,rangeChunkSize:d,length:F,docBaseUrl:f,enableXfa:C,evaluatorOptions:{maxImageSize:w,disableFontFace:E,ignoreErrors:y,isEvalSupported:_,isOffscreenCanvasSupported:x,canvasMaxAreaInBytes:k,fontExtraProperties:M,useSystemFonts:O,cMapUrl:N?g:null,standardFontDataUrl:N?b:null}},z={disableFontFace:E,fontExtraProperties:M,ownerDocument:R,pdfBug:D,styleElement:null,loadingParams:{disableAutoFetch:L,enableXfa:C}};return u.promise.then((function(){if(s.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const t=u.messageHandler.sendWithPromise("GetDocRequest",H,r?[r.buffer]:null);let e;if(c)e=new xr(c,{disableRange:T,disableStream:P});else if(!r){if(!a)throw new Error("getDocument - no `url` parameter provided.");e=(t=>{if(S){return function(){return"undefined"!==typeof fetch&&"undefined"!==typeof Response&&"body"in Response.prototype}()&&ze(t.url)?new Dr(t):new Hr(t)}return ze(t.url)?new Dr(t):new Nr(t)})({url:a,length:F,httpHeaders:o,withCredentials:l,rangeChunkSize:d,disableRange:T,disableStream:P})}return t.then((t=>{if(s.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const i=new sr(n,t,u.port),a=new hl(i,s,e,z,B);s._transport=a,i.send("Ready",null)}))})).catch(s._capability.reject),s}function No(t){return"object"===typeof t&&Number.isInteger(null===t||void 0===t?void 0:t.num)&&t.num>=0&&Number.isInteger(null===t||void 0===t?void 0:t.gen)&&t.gen>=0}class Wo{constructor(){var t,e;this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d".concat((jo._=(t=jo._,e=t++,t),e)),this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{var t,e;null!==(t=this._worker)&&void 0!==t&&t.port&&(this._worker._pendingDestroy=!0),await(null===(e=this._transport)||void 0===e?void 0:e.destroy())}catch(s){var i;throw null!==(i=this._worker)&&void 0!==i&&i.port&&delete this._worker._pendingDestroy,s}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}var jo={_:0};class Bo{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=s,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 i of this._rangeListeners)i(t,e)}onDataProgress(t,e){this._readyCapability.promise.then((()=>{for(const i of this._progressListeners)i(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){St("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class Ho{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Rt(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(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{renderingIntent:e}=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(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];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()}}var zo=new WeakMap,Vo=new WeakMap,Go=new WeakSet;class Uo{constructor(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];a(this,Go),w(this,zo,null),w(this,Vo,!1),this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new He:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new fl,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(){let{scale:t,rotation:e=this.rotate,offsetX:i=0,offsetY:s=0,dontFlip:n=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Fe({viewBox:this.view,scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:n})}getAnnotations(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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 Rt(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return(null===(t=this._transport._htmlForXfa)||void 0===t?void 0:t.children[this._pageIndex])||null}render(t){var e,i;let{canvasContext:s,viewport:n,intent:a="display",annotationMode:o=N.ENABLE,transform:l=null,background:h=null,optionalContentConfigPromise:c=null,annotationCanvasMap:d=null,pageColors:u=null,printAnnotationStorage:p=null}=t;null===(e=this._stats)||void 0===e||e.time("Overall");const f=this._transport.getRenderingIntent(a,o,p),{renderingIntent:g,cacheKey:m}=f;x(Vo,this,!1),r(Go,this,Xo).call(this),c||(c=this._transport.getOptionalContentConfig(g));let v=this._intentStates.get(m);v||(v=Object.create(null),this._intentStates.set(m,v)),v.streamReaderCancelTimeout&&(clearTimeout(v.streamReaderCancelTimeout),v.streamReaderCancelTimeout=null);const b=!!(g&L);var A;v.displayReadyCapability||(v.displayReadyCapability=Promise.withResolvers(),v.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(A=this._stats)||void 0===A||A.time("Page Request"),this._pumpOperatorList(f));const y=t=>{var e;(v.renderTasks.delete(w),(this._maybeCleanupAfterRender||b)&&x(Vo,this,!0),r(Go,this,qo).call(this,!b),t?(w.capability.reject(t),this._abortOperatorList({intentState:v,reason:t instanceof Error?t:new Error(t)})):w.capability.resolve(),this._stats)&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),null!==(e=globalThis.Stats)&&void 0!==e&&e.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},w=new Al({callback:y,params:{canvasContext:s,viewport:n,transform:l,background:h},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:d,operatorList:v.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!b,pdfBug:this._pdfBug,pageColors:u});((i=v).renderTasks||(i.renderTasks=new Set)).add(w);const _=w.task;return Promise.all([v.displayReadyCapability.promise,c]).then((t=>{var e;let[i,s]=t;if(this.destroyed)y();else{if(null===(e=this._stats)||void 0===e||e.time("Rendering"),!(s.renderingIntent&g))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");w.initializeGraphics({transparency:i,optionalContentConfig:s}),w.operatorListChanged()}})).catch(y),_}getOperatorList(){let{intent:t="display",annotationMode:e=N.ENABLE,printAnnotationStorage:i=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=this._transport.getRenderingIntent(t,e,i,!0);let n,a=this._intentStates.get(s.cacheKey);var r,o;(a||(a=Object.create(null),this._intentStates.set(s.cacheKey,a)),a.opListReadCapability)||(n=Object.create(null),n.operatorListChanged=function(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(n))},a.opListReadCapability=Promise.withResolvers(),((r=a).renderTasks||(r.renderTasks=new Set)).add(n),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(o=this._stats)||void 0===o||o.time("Page Request"),this._pumpOperatorList(s));return a.opListReadCapability.promise}streamTextContent(){let{includeMarkedContent:t=!1,disableNormalization:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then((t=>To.textContent(t)));const e=this.streamTextContent(t);return new Promise((function(t,i){const s=e.getReader(),n={items:[],styles:Object.create(null),lang:null};!function e(){s.read().then((function(i){var s;let{value:a,done:r}=i;r?t(n):(null!==(s=n.lang)&&void 0!==s||(n.lang=a.lang),Object.assign(n.styles,a.styles),n.items.push(...a.items),e())}),i)}()}))}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 i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),x(Vo,this,!1),r(Go,this,Xo).call(this),Promise.all(t)}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];x(Vo,this,!0);const e=r(Go,this,qo).call(this,!1);return t&&e&&this._stats&&(this._stats=new He),e}_startRenderPage(t,e){var i,s;const n=this._intentStates.get(e);n&&(null===(i=this._stats)||void 0===i||i.timeEnd("Page Request"),null===(s=n.displayReadyCapability)||void 0===s||s.resolve(t))}_renderPageChunk(t,e){for(let i=0,s=t.length;i<s;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const i of e.renderTasks)i.operatorListChanged();t.lastChunk&&r(Go,this,qo).call(this,!0)}_pumpOperatorList(t){let{renderingIntent:e,cacheKey:i,annotationStorageSerializable:s}=t;const{map:n,transfer:a}=s,o=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:n},a).getReader(),l=this._intentStates.get(i);l.streamReader=o;const h=()=>{o.read().then((t=>{let{value:e,done:i}=t;i?l.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,l),h())}),(t=>{if(l.streamReader=null,!this._transport.destroyed){if(l.operatorList){l.operatorList.lastChunk=!0;for(const t of l.renderTasks)t.operatorListChanged();r(Go,this,qo).call(this,!0)}if(l.displayReadyCapability)l.displayReadyCapability.reject(t);else{if(!l.opListReadCapability)throw t;l.opListReadCapability.reject(t)}}}))};h()}_abortOperatorList(t){let{intentState:e,reason:i,force:s=!1}=t;if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!s){if(e.renderTasks.size>0)return;if(i instanceof Oe){let t=100;return i.extraDelay>0&&i.extraDelay<1e3&&(t+=i.extraDelay),void(e.streamReaderCancelTimeout=setTimeout((()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:i,force:!0})}),t))}}if(e.streamReader.cancel(new Nt(i.message)).catch((()=>{})),e.streamReader=null,!this._transport.destroyed){for(const[t,i]of this._intentStates)if(i===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}function qo(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r(Go,this,Xo).call(this),!_(Vo,this)||this.destroyed)return!1;if(t)return x(zo,this,setTimeout((()=>{x(zo,this,null),r(Go,this,qo).call(this,!1)}),5e3)),!1;for(const{renderTasks:e,operatorList:i}of this._intentStates.values())if(e.size>0||!i.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),x(Vo,this,!1),!0}function Xo(){_(zo,this)&&(clearTimeout(_(zo,this)),x(zo,this,null))}var Ko=new WeakMap,Yo=new WeakMap;class Qo{constructor(){w(this,Ko,new Set),w(this,Yo,Promise.resolve())}postMessage(t,e){const i={data:structuredClone(t,e?{transfer:e}:null)};_(Yo,this).then((()=>{for(const t of _(Ko,this))t.call(this,i)}))}addEventListener(t,e){_(Ko,this).add(e)}removeEventListener(t,e){_(Ko,this).delete(e)}terminate(){_(Ko,this).clear()}}const Jo={isWorkerDisabled:!1,fakeWorkerId:0};S&&(Jo.isWorkerDisabled=!0,za.workerSrc||(za.workerSrc="./pdf.worker.mjs")),Jo.isSameOrigin=function(t,e){let i;try{if(i=new URL(t),!i.origin||"null"===i.origin)return!1}catch{return!1}const s=new URL(e,i);return i.origin===s.origin},Jo.createCDNWrapper=function(t){const e='await import("'.concat(t,'");');return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};var Zo=new WeakSet;class $o{constructor(){let{name:t=null,port:e=null,verbosity:i=xt()}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(a(this,Zo),this.name=t,this.destroyed=!1,this.verbosity=i,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){var s;if(null!==(s=il._)&&void 0!==s&&s.has(e))throw new Error("Cannot use more than one PDFWorker per port.");return(il._||(il._=new WeakMap)).set(e,this),void this._initializeFromPort(e)}this._initialize()}get promise(){return S?Promise.all([ha.promise,this._readyCapability.promise]):this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new sr("main","worker",t),this._messageHandler.on("ready",(function(){})),r(Zo,this,tl).call(this)}_initialize(){if(Jo.isWorkerDisabled||el($o))return void this._setupFakeWorker();let{workerSrc:t}=$o;try{Jo.isSameOrigin(window.location.href,t)||(t=Jo.createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),i=new sr("main","worker",e),s=()=>{n.abort(),i.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},n=new AbortController;e.addEventListener("error",(()=>{this._webWorker||s()}),{signal:n.signal}),i.on("test",(t=>{n.abort(),!this.destroyed&&t?(this._messageHandler=i,this._port=e,this._webWorker=e,r(Zo,this,tl).call(this)):s()})),i.on("ready",(t=>{if(n.abort(),this.destroyed)s();else try{a()}catch{this._setupFakeWorker()}}));const a=()=>{const t=new Uint8Array;i.send("test",t,[t.buffer])};return void a()}catch{kt("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){Jo.isWorkerDisabled||(Et("Setting up fake worker."),Jo.isWorkerDisabled=!0),$o._setupFakeWorkerGlobal.then((t=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const e=new Qo;this._port=e;const i="fake".concat(Jo.fakeWorkerId++),s=new sr(i+"_worker",i,e);t.setup(s,e),this._messageHandler=new sr(i,i+"_worker",e),r(Zo,this,tl).call(this)})).catch((t=>{this._readyCapability.reject(new Error('Setting up fake worker failed: "'.concat(t.message,'".')))}))}destroy(){var t;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),null===(t=il._)||void 0===t||t.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){var e;if(null===t||void 0===t||!t.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const i=null===(e=r($o,this,il)._)||void 0===e?void 0:e.get(t.port);if(i){if(i._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return i}return new $o(t)}static get workerSrc(){if(za.workerSrc)return za.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Rt(this,"_setupFakeWorkerGlobal",(async()=>{if(o($o,this,el))return o($o,this,el);return(await import(this.workerSrc)).WorkerMessageHandler})())}}function tl(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}function el(t){try{var e;return(null===(e=globalThis.pdfjsWorker)||void 0===e?void 0:e.WorkerMessageHandler)||null}catch{return null}}var il={_:void 0},sl=new WeakMap,nl=new WeakMap,al=new WeakMap,rl=new WeakMap,ol=new WeakMap,ll=new WeakSet;class hl{constructor(t,e,i,s,n){a(this,ll),w(this,sl,new Map),w(this,nl,new Map),w(this,al,new Map),w(this,rl,new Map),w(this,ol,null),this.messageHandler=t,this.loadingTask=e,this.commonObjs=new fl,this.fontLoader=new aa({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return Rt(this,"annotationStorage",new ta)}getRenderingIntent(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:N.ENABLE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=P,a=Qn;switch(t){case"any":n=T;break;case"display":break;case"print":n=L;break;default:Et("getRenderingIntent - invalid intent: ".concat(t))}switch(e){case N.DISABLE:n+=F;break;case N.ENABLE:break;case N.ENABLE_FORMS:n+=D;break;case N.ENABLE_STORAGE:n+=I;a=(n&L&&i instanceof sa?i:this.annotationStorage).serializable;break;default:Et("getRenderingIntent - invalid annotationMode: ".concat(e))}return s&&(n+=O),{renderingIntent:n,cacheKey:"".concat(n,"_").concat(a.hash),annotationStorageSerializable:a}}destroy(){var t;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),null===(t=_(ol,this))||void 0===t||t.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const s of _(nl,this).values())e.push(s._destroy());_(nl,this).clear(),_(al,this).clear(),_(rl,this).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const i=this.messageHandler.sendWithPromise("Terminate",null);return e.push(i),Promise.all(e).then((()=>{var t;this.commonObjs.clear(),this.fontLoader.clear(),_(sl,this).clear(),this.filterFactory.destroy(),vo.cleanup(),null===(t=this._networkStream)||void 0===t||t.cancelAllRequests(new Nt("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)=>{Mt(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(t){let{value:i,done:s}=t;s?e.close():(Mt(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))})).catch((t=>{e.error(t)}))},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch((t=>{if(!this.destroyed)throw t}))}})),t.on("ReaderHeadersReady",(t=>{const i=Promise.withResolvers(),s=this._fullReader;return s.headersReady.then((()=>{if(!s.isStreamingSupported||!s.isRangeSupported){var t;if(this._lastProgress)null===(t=e.onProgress)||void 0===t||t.call(e,this._lastProgress);s.onProgress=t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})}}i.resolve({isStreamingSupported:s.isStreamingSupported,isRangeSupported:s.isRangeSupported,contentLength:s.contentLength})}),i.reject),i.promise})),t.on("GetRangeReader",((t,e)=>{Mt(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(t.begin,t.end);i?(e.onPull=()=>{i.read().then((function(t){let{value:i,done:s}=t;s?e.close():(Mt(i instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))})).catch((t=>{e.error(t)}))},e.onCancel=t=>{i.cancel(t),e.ready.catch((t=>{if(!this.destroyed)throw t}))}):e.close()})),t.on("GetDoc",(t=>{let{pdfInfo:i}=t;this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new Ho(i,this))})),t.on("DocException",(function(t){let i;switch(t.name){case"PasswordException":i=new Pt(t.message,t.code);break;case"InvalidPDFException":i=new Dt(t.message);break;case"MissingPDFException":i=new It(t.message);break;case"UnexpectedResponseException":i=new Ft(t.message,t.status);break;case"UnknownErrorException":i=new Lt(t.message,t.details);break;default:St("DocException - expected a valid Error.")}e._capability.reject(i)})),t.on("PasswordRequest",(t=>{if(x(ol,this,Promise.withResolvers()),e.onPassword){const s=t=>{t instanceof Error?_(ol,this).reject(t):_(ol,this).resolve({password:t})};try{e.onPassword(s,t.code)}catch(i){_(ol,this).reject(i)}}else _(ol,this).reject(new Pt(t.message,t.code));return _(ol,this).promise})),t.on("DataLoaded",(t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)})),t.on("StartRenderPage",(t=>{if(this.destroyed)return;_(nl,this).get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)})),t.on("commonobj",(e=>{var i;let[s,n,a]=e;if(this.destroyed)return null;if(this.commonObjs.has(s))return null;switch(n){case"Font":const{disableFontFace:e,fontExtraProperties:r,pdfBug:o}=this._params;if("error"in a){const t=a.error;Et("Error during font loading: ".concat(t)),this.commonObjs.resolve(s,t);break}const l=o&&null!==(i=globalThis.FontInspector)&&void 0!==i&&i.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null,h=new ra(a,{disableFontFace:e,inspectFont:l});this.fontLoader.bind(h).catch((()=>t.sendWithPromise("FontFallback",{id:s}))).finally((()=>{!r&&h.data&&(h.data=null),this.commonObjs.resolve(s,h)}));break;case"CopyLocalImage":const{imageRef:c}=a;Mt(c,"The imageRef must be defined.");for(const t of _(nl,this).values())for(const[,e]of t.objs)if((null===e||void 0===e?void 0:e.ref)===c)return e.dataLen?(this.commonObjs.resolve(s,structuredClone(e)),e.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(s,a);break;default:throw new Error("Got unknown common object type ".concat(n))}return null})),t.on("obj",(t=>{let[e,i,s,n]=t;if(this.destroyed)return;const a=_(nl,this).get(i);var r;if(!a.objs.has(e))if(0!==a._intentStates.size)switch(s){case"Image":a.objs.resolve(e,n),(null===n||void 0===n?void 0:n.dataLen)>1e7&&(a._maybeCleanupAfterRender=!0);break;case"Pattern":a.objs.resolve(e,n);break;default:throw new Error("Got unknown object type ".concat(s))}else null===n||void 0===n||null===(r=n.bitmap)||void 0===r||r.close()})),t.on("DocProgress",(t=>{var i;this.destroyed||null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})})),t.on("FetchBuiltInCMap",(t=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(t):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.")))),t.on("FetchStandardFontData",(t=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(t):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."))))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var t,e;this.annotationStorage.size<=0&&Et("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:i,transfer:s}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:i,filename:null!==(t=null===(e=this._fullReader)||void 0===e?void 0:e.filename)&&void 0!==t?t:null},s).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,i=_(al,this).get(e);if(i)return i;const s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then((i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&_(rl,this).set(i.refStr,t);const s=new Uo(e,i,this,this._params.pdfBug);return _(nl,this).set(e,s),s}));return _(al,this).set(e,s),s}getPageIndex(t){return No(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 r(ll,this,cl).call(this,"GetFieldObjects")}hasJSActions(){return r(ll,this,cl).call(this,"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 r(ll,this,cl).call(this,"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 r(ll,this,cl).call(this,"GetOptionalContentConfig").then((e=>new wr(e,t)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=_(sl,this).get(t);if(e)return e;const i=this.messageHandler.sendWithPromise(t,null).then((t=>{var e,i,s,n;return{info:t[0],metadata:t[1]?new hr(t[1]):null,contentDispositionFilename:null!==(e=null===(i=this._fullReader)||void 0===i?void 0:i.filename)&&void 0!==e?e:null,contentLength:null!==(s=null===(n=this._fullReader)||void 0===n?void 0:n.contentLength)&&void 0!==s?s:null}}));return _(sl,this).set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of _(nl,this).values()){if(!t.cleanup())throw new Error("startCleanup: Page ".concat(t.pageNumber," is currently rendering."))}this.commonObjs.clear(),t||this.fontLoader.clear(),_(sl,this).clear(),this.filterFactory.destroy(!0),vo.cleanup()}}cachedPageNumber(t){var e;if(!No(t))return null;const i=0===t.gen?"".concat(t.num,"R"):"".concat(t.num,"R").concat(t.gen);return null!==(e=_(rl,this).get(i))&&void 0!==e?e:null}}function cl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=_(sl,this).get(t);if(i)return i;const s=this.messageHandler.sendWithPromise(t,e);return _(sl,this).set(t,s),s}const dl=Symbol("INITIAL_DATA");var ul=new WeakMap,pl=new WeakSet;class fl{constructor(){a(this,pl),w(this,ul,Object.create(null))}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){const i=r(pl,this,gl).call(this,t);return i.promise.then((()=>e(i.data))),null}const i=_(ul,this)[t];if(!i||i.data===dl)throw new Error("Requesting object that isn't resolved yet ".concat(t,"."));return i.data}has(t){const e=_(ul,this)[t];return!!e&&e.data!==dl}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=r(pl,this,gl).call(this,t);i.data=e,i.resolve()}clear(){for(const e in _(ul,this)){var t;const{data:i}=_(ul,this)[e];null===i||void 0===i||null===(t=i.bitmap)||void 0===t||t.close()}x(ul,this,Object.create(null))}*[Symbol.iterator](){for(const t in _(ul,this)){const{data:e}=_(ul,this)[t];e!==dl&&(yield[t,e])}}}function gl(t){var e;return(e=_(ul,this))[t]||(e[t]={...Promise.withResolvers(),data:dl})}var ml=new WeakMap;class vl{constructor(t){w(this,ml,null),x(ml,this,t),this.onContinue=null}get promise(){return _(ml,this).capability.promise}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;_(ml,this).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=_(ml,this).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=_(ml,this);return t.form||t.canvas&&(null===e||void 0===e?void 0:e.size)>0}}var bl=new WeakMap;class Al{constructor(t){let{callback:e,params:i,objs:s,commonObjs:n,annotationCanvasMap:a,operatorList:r,pageIndex:o,canvasFactory:l,filterFactory:h,useRequestAnimationFrame:c=!1,pdfBug:d=!1,pageColors:u=null}=t;w(this,bl,null),this.callback=e,this.params=i,this.objs=s,this.commonObjs=n,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=h,this._pdfBug=d,this.pageColors=u,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===c&&"undefined"!==typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new vl(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=i.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics(t){var e,i;let{transparency:s=!1,optionalContentConfig:n}=t;if(this.cancelled)return;if(this._canvas){if(yl._.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");yl._.add(this._canvas)}this._pdfBug&&null!==(e=globalThis.StepperManager)&&void 0!==e&&e.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:a,viewport:r,transform:o,background:l}=this.params;this.gfx=new ja(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:n},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:o,viewport:r,transparency:s,background:l}),this.operatorListIdx=0,this.graphicsReady=!0,null===(i=this.graphicsReadyCallback)||void 0===i||i.call(this)}cancel(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.running=!1,this.cancelled=!0,null===(t=this.gfx)||void 0===t||t.endDrawing(),_(bl,this)&&(window.cancelAnimationFrame(_(bl,this)),x(bl,this,null)),yl._.delete(this._canvas),this.callback(e||new Oe("Rendering cancelled, page ".concat(this._pageIndex+1),i))}operatorListChanged(){var t;this.graphicsReady?(null===(t=this.stepper)||void 0===t||t.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?x(bl,this,window.requestAnimationFrame((()=>{x(bl,this,null),this._nextBound().catch(this._cancelBound)}))):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),yl._.delete(this._canvas),this.callback())))}}var yl={_:new WeakSet};const wl="4.4.168",_l="19fbc8998";function xl(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function kl(t){return Math.max(0,Math.min(255,255*t))}class El{static CMYK_G(t){let[e,i,s,n]=t;return["G",1-Math.min(1,.3*e+.59*s+.11*i+n)]}static G_CMYK(t){let[e]=t;return["CMYK",0,0,0,1-e]}static G_RGB(t){let[e]=t;return["RGB",e,e,e]}static G_rgb(t){let[e]=t;return e=kl(e),[e,e,e]}static G_HTML(t){let[e]=t;const i=xl(e);return"#".concat(i).concat(i).concat(i)}static RGB_G(t){let[e,i,s]=t;return["G",.3*e+.59*i+.11*s]}static RGB_rgb(t){return t.map(kl)}static RGB_HTML(t){return"#".concat(t.map(xl).join(""))}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB(t){let[e,i,s,n]=t;return["RGB",1-Math.min(1,e+n),1-Math.min(1,s+n),1-Math.min(1,i+n)]}static CMYK_rgb(t){let[e,i,s,n]=t;return[kl(1-Math.min(1,e+n)),kl(1-Math.min(1,s+n)),kl(1-Math.min(1,i+n))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK(t){let[e,i,s]=t;const n=1-e,a=1-i,r=1-s;return["CMYK",n,a,r,Math.min(n,a,r)]}}class Sl{static setupStorage(t,e,i,s,n){const a=s.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==a.value&&(t.textContent=a.value),"print"===n)break;t.addEventListener("input",(t=>{s.setValue(e,{value:t.target.value})}));break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(a.value===i.attributes.xfaOn?t.setAttribute("checked",!0):a.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===n)break;t.addEventListener("change",(t=>{s.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})}))}else{if(null!==a.value&&t.setAttribute("value",a.value),"print"===n)break;t.addEventListener("input",(t=>{s.setValue(e,{value:t.target.value})}))}break;case"select":if(null!==a.value){t.setAttribute("value",a.value);for(const t of i.children)t.attributes.value===a.value?t.attributes.selected=!0:t.attributes.hasOwnProperty("selected")&&delete t.attributes.selected}t.addEventListener("input",(t=>{const i=t.target.options,n=-1===i.selectedIndex?"":i[i.selectedIndex].value;s.setValue(e,{value:n})}))}}static setAttributes(t){let{html:e,element:i,storage:s=null,intent:n,linkService:a}=t;const{attributes:r}=i,o=e instanceof HTMLAnchorElement;"radio"===r.type&&(r.name="".concat(r.name,"-").concat(n));for(const[l,h]of Object.entries(r))if(null!==h&&void 0!==h)switch(l){case"class":h.length&&e.setAttribute(l,h.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",h);break;case"style":Object.assign(e.style,h);break;case"textContent":e.textContent=h;break;default:(!o||"href"!==l&&"newWindow"!==l)&&e.setAttribute(l,h)}o&&a.addLinkAttributes(e,r.href,r.newWindow),s&&r.dataId&&this.setupStorage(e,r.dataId,i,s)}static render(t){const e=t.annotationStorage,i=t.linkService,s=t.xfaHtml,n=t.intent||"display",a=document.createElement(s.name);s.attributes&&this.setAttributes({html:a,element:s,intent:n,linkService:i});const r="richText"!==n,o=t.div;if(o.append(a),t.viewport){const e="matrix(".concat(t.viewport.transform.join(","),")");o.style.transform=e}r&&o.setAttribute("class","xfaLayer xfaFont");const l=[];if(0===s.children.length){if(s.value){const t=document.createTextNode(s.value);a.append(t),r&&To.shouldBuildText(s.name)&&l.push(t)}return{textDivs:l}}const h=[[s,-1,a]];for(;h.length>0;){var c,d;const[t,s,a]=h.at(-1);if(s+1===t.children.length){h.pop();continue}const o=t.children[++h.at(-1)[1]];if(null===o)continue;const{name:u}=o;if("#text"===u){const t=document.createTextNode(o.value);l.push(t),a.append(t);continue}const p=null!==o&&void 0!==o&&null!==(c=o.attributes)&&void 0!==c&&c.xmlns?document.createElementNS(o.attributes.xmlns,u):document.createElement(u);if(a.append(p),o.attributes&&this.setAttributes({html:p,element:o,storage:e,intent:n,linkService:i}),(null===(d=o.children)||void 0===d?void 0:d.length)>0)h.push([o,-1,p]);else if(o.value){const t=document.createTextNode(o.value);r&&To.shouldBuildText(u)&&l.push(t),p.append(t)}}for(const u of o.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))u.setAttribute("readOnly",!0);return{textDivs:l}}static update(t){const e="matrix(".concat(t.viewport.transform.join(","),")");t.div.style.transform=e,t.div.hidden=!1}}const Ml=1e3,Cl=new WeakSet;function Rl(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class Tl{static create(t){switch(t.data.annotationType){case Y:return new Wl(t);case K:return new zl(t);case dt:switch(t.data.fieldType){case"Tx":return new Gl(t);case"Btn":return t.data.radioButton?new Xl(t):t.data.checkBox?new ql(t):new Kl(t);case"Ch":return new Yl(t);case"Sig":return new Ul(t)}return new Vl(t);case ht:return new Ql(t);case Q:return new Mh(t);case J:return new Rh(t);case Z:return new Ph(t);case $:return new Dh(t);case et:return new Fh(t);case ot:return new Nh(t);case lt:return new jh(t);case tt:return new Oh(t);case it:return new Bh(t);case st:return new Hh(t);case nt:return new zh(t);case at:return new Vh(t);case rt:return new Gh(t);case ct:return new Xh(t);default:return new Fl(t)}}}var Pl=new WeakMap,Ll=new WeakMap,Dl=new WeakMap,Il=new WeakSet;class Fl{constructor(t){let{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:s=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,Il),w(this,Pl,null),w(this,Ll,!1),w(this,Dl,null),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(i)),s&&this._createQuadrilaterals()}static _hasPopupData(t){let{titleObj:e,contentsObj:i,richText:s}=t;return!!(null!==e&&void 0!==e&&e.str||null!==i&&void 0!==i&&i.str||null!==s&&void 0!==s&&s.str)}get hasPopupData(){return Fl._hasPopupData(this.data)}updateEdited(t){var e;if(!this.container)return;_(Pl,this)||x(Pl,this,{rect:this.data.rect.slice(0)});const{rect:i}=t;i&&r(Il,this,Ol).call(this,i),null===(e=_(Dl,this))||void 0===e||e.popup.updateEdited(t)}resetEdited(){var t;_(Pl,this)&&(r(Il,this,Ol).call(this,_(Pl,this).rect),null===(t=_(Dl,this))||void 0===t||t.popup.resetEdited(),x(Pl,this,null))}_createContainer(t){const{data:e,parent:{page:i,viewport:s}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",e.id),this instanceof Vl||(n.tabIndex=Ml);const{style:a}=n;if(a.zIndex=this.parent.zIndex++,e.popupRef&&n.setAttribute("aria-haspopup","dialog"),e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof Ql){const{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,n),n}const{width:r,height:o}=Rl(e.rect);if(!t&&e.borderStyle.width>0){a.borderWidth="".concat(e.borderStyle.width,"px");const t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;if(t>0||i>0){const e="calc(".concat(t,"px * var(--scale-factor)) / calc(").concat(i,"px * var(--scale-factor))");a.borderRadius=e}else if(this instanceof Xl){const t="calc(".concat(r,"px * var(--scale-factor)) / calc(").concat(o,"px * var(--scale-factor))");a.borderRadius=t}switch(e.borderStyle.style){case ut:a.borderStyle="solid";break;case pt:a.borderStyle="dashed";break;case ft:Et("Unimplemented border style: beveled");break;case gt:Et("Unimplemented border style: inset");break;case mt:a.borderBottomStyle="solid"}const s=e.borderColor||null;s?(x(Ll,this,!0),a.borderColor=Vt.makeHexColor(0|s[0],0|s[1],0|s[2])):a.borderWidth=0}const l=Vt.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:h,pageHeight:c,pageX:d,pageY:u}=s.rawDims;a.left="".concat(100*(l[0]-d)/h,"%"),a.top="".concat(100*(l[1]-u)/c,"%");const{rotation:p}=e;return e.hasOwnCanvas||0===p?(a.width="".concat(100*r/h,"%"),a.height="".concat(100*o/c,"%")):this.setRotation(p,n),n}setRotation(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;if(!this.data.rect)return;const{pageWidth:i,pageHeight:s}=this.parent.viewport.rawDims,{width:n,height:a}=Rl(this.data.rect);let r,o;t%180===0?(r=100*n/i,o=100*a/s):(r=100*a/i,o=100*n/s),e.style.width="".concat(r,"%"),e.style.height="".concat(o,"%"),e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(t,e,i)=>{const s=i.detail[t],n=s[0],a=s.slice(1);i.target.style[e]=El["".concat(n,"_HTML")](a),this.annotationStorage.setValue(this.data.id,{[e]:El["".concat(n,"_rgb")](a)})};return Rt(this,"_commonActions",{display:t=>{const{display:e}=t.detail,i=e%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,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((()=>t.target.focus({preventScroll:!1})),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor: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 i=this._commonActions;for(const s of Object.keys(e.detail)){const n=t[s]||i[s];null===n||void 0===n||n(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const i=this._commonActions;for(const[s,n]of Object.entries(e)){const a=i[s];if(a){a({detail:{[s]:n},target:t}),delete e[s]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,i,s,n]=this.data.rect.map((t=>Math.fround(t)));if(8===t.length){const[a,r,o,l]=t.subarray(2,6);if(s===a&&n===r&&e===o&&i===l)return}const{style:a}=this.container;let r;if(_(Ll,this)){const{borderColor:t,borderWidth:e}=a;a.borderWidth=0,r=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">','<g fill="transparent" stroke="'.concat(t,'" stroke-width="').concat(e,'">')],this.container.classList.add("hasBorder")}const o=s-e,l=n-i,{svgFactory:h}=this,c=h.createElement("svg");c.classList.add("quadrilateralsContainer"),c.setAttribute("width",0),c.setAttribute("height",0);const d=h.createElement("defs");c.append(d);const u=h.createElement("clipPath"),p="clippath_".concat(this.data.id);u.setAttribute("id",p),u.setAttribute("clipPathUnits","objectBoundingBox"),d.append(u);for(let g=2,m=t.length;g<m;g+=8){var f;const i=t[g],s=t[g+1],a=t[g+2],c=t[g+3],d=h.createElement("rect"),p=(a-e)/o,m=(n-s)/l,v=(i-a)/o,b=(s-c)/l;d.setAttribute("x",p),d.setAttribute("y",m),d.setAttribute("width",v),d.setAttribute("height",b),u.append(d),null===(f=r)||void 0===f||f.push('<rect vector-effect="non-scaling-stroke" x="'.concat(p,'" y="').concat(m,'" width="').concat(v,'" height="').concat(b,'"/>'))}_(Ll,this)&&(r.push("</g></svg>')"),a.backgroundImage=r.join("")),this.container.append(c),this.container.style.clipPath="url(#".concat(p,")")}_createPopup(){const{container:t,data:e}=this;t.setAttribute("aria-haspopup","dialog");const i=x(Dl,this,new Ql({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:"popup_".concat(e.id),rotation:e.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(i.render())}render(){St("Abstract method `AnnotationElement.render` called")}_getElementsByName(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[];if(this._fieldObjects){const s=this._fieldObjects[t];if(s)for(const{page:t,id:n,exportValues:a}of s){if(-1===t)continue;if(n===e)continue;const s="string"===typeof a?a:null,r=document.querySelector('[data-element-id="'.concat(n,'"]'));!r||Cl.has(r)?i.push({id:n,exportValue:s,domElement:r}):Et("_getElementsByName - element not allowed: ".concat(n))}return i}for(const s of document.getElementsByName(t)){const{exportValue:t}=s,n=s.getAttribute("data-element-id");n!==e&&(Cl.has(s)&&i.push({id:n,exportValue:t,domElement:s}))}return i}show(){var t;this.container&&(this.container.hidden=!1),null===(t=this.popup)||void 0===t||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),null===(t=this.popup)||void 0===t||t.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")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",(()=>{var i;null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})}))}}function Ol(t){const{container:{style:e},data:{rect:i,rotation:s},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:a,pageX:r,pageY:o}}}}=this;null===i||void 0===i||i.splice(0,4,...t);const{width:l,height:h}=Rl(t);e.left="".concat(100*(t[0]-r)/n,"%"),e.top="".concat(100*(a-t[3]+o)/a,"%"),0===s?(e.width="".concat(100*l/n,"%"),e.height="".concat(100*h/a,"%")):this.setRotation(s)}var Nl=new WeakSet;class Wl extends Fl{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(t,{isRenderable:!0,ignoreBorder:!(null===e||void 0===e||!e.ignoreBorder),createQuadrilaterals:!0}),a(this,Nl),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let s=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),s=!0):t.action?(this._bindNamedAction(i,t.action),s=!0):t.attachment?(r(Nl,this,Bl).call(this,i,t.attachment,t.attachmentDest),s=!0):t.setOCGState?(r(Nl,this,Hl).call(this,i,t.setOCGState),s=!0):t.dest?(this._bindLink(i,t.dest),s=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),s=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),s=!0):this.isTooltipOnly&&!s&&(this._bindLink(i,""),s=!0)),this.container.classList.add("linkAnnotation"),s&&this.container.append(i),this.container}_bindLink(t,e){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&r(Nl,this,jl).call(this)}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),r(Nl,this,jl).call(this)}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const s of Object.keys(e.actions)){const n=i.get(s);n&&(t[n]=()=>{var t;return null===(t=this.linkService.eventBus)||void 0===t||t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:s}}),!1})}t.onclick||(t.onclick=()=>!1),r(Nl,this,jl).call(this)}_bindResetFormAction(t,e){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),r(Nl,this,jl).call(this),!this._fieldObjects)return Et('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(i||(t.onclick=()=>!1));t.onclick=()=>{null===i||void 0===i||i();const{fields:t,refs:s,include:n}=e,a=[];if(0!==t.length||0!==s.length){const e=new Set(s);for(const i of t){const t=this._fieldObjects[i]||[];for(const{id:i}of t)e.add(i)}for(const t of Object.values(this._fieldObjects))for(const i of t)e.has(i.id)===n&&a.push(i)}else for(const e of Object.values(this._fieldObjects))a.push(...e);const r=this.annotationStorage,o=[];for(const e of a){const{id:t}=e;switch(o.push(t),e.type){case"text":{const i=e.defaultValue||"";r.setValue(t,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;r.setValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";r.setValue(t,{value:i});break}default:continue}const i=document.querySelector('[data-element-id="'.concat(t,'"]'));i&&(Cl.has(i)?i.dispatchEvent(new Event("resetform")):Et("_bindResetFormAction - element not allowed: ".concat(t)))}var l;this.enableScripting&&(null===(l=this.linkService.eventBus)||void 0===l||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}}));return!1}}}function jl(){this.container.setAttribute("data-internal-link","")}function Bl(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t.href=this.linkService.getAnchorUrl(""),e.description&&(t.title=e.description),t.onclick=()=>{var t;return null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(e.content,e.filename,i),!1},r(Nl,this,jl).call(this)}function Hl(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),r(Nl,this,jl).call(this)}class zl extends Fl{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 Vl extends Fl{render(){return this.container}showElementAndHideCanvas(t){var e;this.data.hasOwnCanvas&&("CANVAS"===(null===(e=t.previousSibling)||void 0===e?void 0:e.nodeName)&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return Ht.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,s,n){i.includes("mouse")?t.addEventListener(i,(t=>{var e;null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:n(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})})):t.addEventListener(i,(t=>{var a;if("blur"===i){if(!e.focused||!t.relatedTarget)return;e.focused=!1}else if("focus"===i){if(e.focused)return;e.focused=!0}n&&(null===(a=this.linkService.eventBus)||void 0===a||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:n(t)}}))}))}_setEventListeners(t,e,i,s){for(const[o,l]of i){var n,a,r;if("Action"===l||null!==(n=this.data.actions)&&void 0!==n&&n[l])"Focus"!==l&&"Blur"!==l||e||(e={focused:!1}),this._setEventListener(t,e,o,l,s),"Focus"!==l||null!==(a=this.data.actions)&&void 0!==a&&a.Blur?"Blur"!==l||null!==(r=this.data.actions)&&void 0!==r&&r.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":Vt.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||9,n=t.style;let a;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/(R*s))||1);a=Math.min(s,r(e/R))}else{const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(s,r(t/R))}n.fontSize="calc(".concat(a,"px * var(--scale-factor))"),n.color=Vt.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(n.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class Gl extends Vl{constructor(t){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,i,s){const n=this.annotationStorage;for(const a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=i),n.setValue(a.id,{[s]:i})}render(){const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){var s;const o=t.getValue(e,{value:this.data.fieldValue});let l=o.value||"";const h=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;h&&l.length>h&&(l=l.slice(0,h));let c=o.formattedValue||(null===(s=this.data.textContent)||void 0===s?void 0:s.join("\n"))||null;c&&this.data.comb&&(c=c.replaceAll(/\s+/g,""));const d={userValue:l,formattedValue:c,lastCommittedValue:null,commitKey:1,focused:!1};var n,a;if(this.data.multiLine)i=document.createElement("textarea"),i.textContent=null!==(n=c)&&void 0!==n?n:l,this.data.doNotScroll&&(i.style.overflowY="hidden");else i=document.createElement("input"),i.type="text",i.setAttribute("value",null!==(a=c)&&void 0!==a?a:l),this.data.doNotScroll&&(i.style.overflowX="hidden");this.data.hasOwnCanvas&&(i.hidden=!0),Cl.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=Ml,this._setRequired(i,this.data.required),h&&(i.maxLength=h),i.addEventListener("input",(s=>{t.setValue(e,{value:s.target.value}),this.setPropertyOnSiblings(i,"value",s.target.value,"value"),d.formattedValue=null})),i.addEventListener("resetform",(t=>{var e;const s=null!==(e=this.data.defaultFieldValue)&&void 0!==e?e:"";i.value=d.userValue=s,d.formattedValue=null}));let u=t=>{const{formattedValue:e}=d;null!==e&&void 0!==e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){var r;i.addEventListener("focus",(t=>{var e;if(d.focused)return;const{target:i}=t;d.userValue&&(i.value=d.userValue),d.lastCommittedValue=i.value,d.commitKey=1,null!==(e=this.data.actions)&&void 0!==e&&e.Focus||(d.focused=!0)})),i.addEventListener("updatefromsandbox",(i=>{this.showElementAndHideCanvas(i.target);const s={value(i){var s;d.userValue=null!==(s=i.detail.value)&&void 0!==s?s:"",t.setValue(e,{value:d.userValue.toString()}),i.target.value=d.userValue},formattedValue(i){const{formattedValue:s}=i.detail;d.formattedValue=s,null!==s&&void 0!==s&&i.target!==document.activeElement&&(i.target.value=s),t.setValue(e,{formattedValue:s})},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{var s;const{charLimit:n}=i.detail,{target:a}=i;if(0===n)return void a.removeAttribute("maxLength");a.setAttribute("maxLength",n);let r=d.userValue;!r||r.length<=n||(r=r.slice(0,n),a.value=d.userValue=r,t.setValue(e,{value:r}),null===(s=this.linkService.eventBus)||void 0===s||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,willCommit:!0,commitKey:1,selStart:a.selectionStart,selEnd:a.selectionEnd}}))}};this._dispatchEventFromSandbox(s,i)})),i.addEventListener("keydown",(t=>{var i;d.commitKey=1;let s=-1;if("Escape"===t.key?s=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(d.commitKey=3):s=2,-1===s)return;const{value:n}=t.target;d.lastCommittedValue!==n&&(d.lastCommittedValue=n,d.userValue=n,null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,willCommit:!0,commitKey:s,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))}));const s=u;u=null,i.addEventListener("blur",(t=>{var i;if(!d.focused||!t.relatedTarget)return;null!==(i=this.data.actions)&&void 0!==i&&i.Blur||(d.focused=!1);const{value:n}=t.target;var a;(d.userValue=n,d.lastCommittedValue!==n)&&(null===(a=this.linkService.eventBus)||void 0===a||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,willCommit:!0,commitKey:d.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}));s(t)})),null!==(r=this.data.actions)&&void 0!==r&&r.Keystroke&&i.addEventListener("beforeinput",(t=>{var i;d.lastCommittedValue=null;const{data:s,target:n}=t,{value:a,selectionStart:r,selectionEnd:o}=n;let l=r,h=o;switch(t.inputType){case"deleteWordBackward":{const t=a.substring(0,r).match(/\w*[^\w]*$/);t&&(l-=t[0].length);break}case"deleteWordForward":{const t=a.substring(r).match(/^[^\w]*\w*/);t&&(h+=t[0].length);break}case"deleteContentBackward":r===o&&(l-=1);break;case"deleteContentForward":r===o&&(h+=1)}t.preventDefault(),null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:a,change:s||"",willCommit:!1,selStart:l,selEnd:h}})})),this._setEventListeners(i,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(t=>t.target.value))}if(u&&i.addEventListener("blur",u),this.data.comb){const t=(this.data.rect[2]-this.data.rect[0])/h;i.classList.add("comb"),i.style.letterSpacing="calc(".concat(t,"px * var(--scale-factor) - 1ch)")}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Ul extends Vl{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class ql extends Vl{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,i=e.id;let s=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"===typeof s&&(s="Off"!==s,t.setValue(i,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const n=document.createElement("input");return Cl.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,s&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=Ml,n.addEventListener("change",(s=>{const{name:n,checked:a}=s.target;for(const r of this._getElementsByName(n,i)){const i=a&&r.exportValue===e.exportValue;r.domElement&&(r.domElement.checked=i),t.setValue(r.id,{value:i})}t.setValue(i,{value:a})})),n.addEventListener("resetform",(t=>{const i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue})),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",(e=>{const s={value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}};this._dispatchEventFromSandbox(s,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 Xl extends Vl{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,i=e.id;let s=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"===typeof s&&(s=s!==e.buttonValue,t.setValue(i,{value:s})),s)for(const a of this._getElementsByName(e.fieldName,i))t.setValue(a.id,{value:!1});const n=document.createElement("input");if(Cl.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,s&&n.setAttribute("checked",!0),n.tabIndex=Ml,n.addEventListener("change",(e=>{const{name:s,checked:n}=e.target;for(const a of this._getElementsByName(s,i))t.setValue(a.id,{value:!1});t.setValue(i,{value:n})})),n.addEventListener("resetform",(t=>{const i=e.defaultFieldValue;t.target.checked=null!==i&&void 0!==i&&i===e.buttonValue})),this.enableScripting&&this.hasJSActions){const s=e.buttonValue;n.addEventListener("updatefromsandbox",(e=>{const n={value:e=>{const n=s===e.detail.value;for(const s of this._getElementsByName(e.target.name)){const e=n&&s.id===i;s.domElement&&(s.domElement.checked=e),t.setValue(s.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))}return this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Kl extends Wl{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 Yl extends Vl{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),s=document.createElement("select");Cl.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=Ml;let n=this.data.combo&&this.data.options.length>0;this.data.combo||(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",(t=>{const e=this.data.defaultFieldValue;for(const i of s.options)i.selected=i.value===e}));for(const h of this.data.options){const t=document.createElement("option");t.textContent=h.displayValue,t.value=h.exportValue,i.value.includes(h.exportValue)&&(t.setAttribute("selected",!0),n=!1),s.append(t)}let a=null;if(n){const t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),s.prepend(t),a=()=>{t.remove(),s.removeEventListener("input",a),a=null},s.addEventListener("input",a)}const r=t=>{const e=t?"value":"textContent",{options:i,multiple:n}=s;return n?Array.prototype.filter.call(i,(t=>t.selected)).map((t=>t[e])):-1===i.selectedIndex?null:i[i.selectedIndex][e]};let o=r(!1);const l=t=>{const e=t.target.options;return Array.prototype.map.call(e,(t=>({displayValue:t.textContent,exportValue:t.value})))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",(i=>{const n={value(i){var n;null===(n=a)||void 0===n||n();const l=i.detail.value,h=new Set(Array.isArray(l)?l:[l]);for(const t of s.options)t.selected=h.has(t.value);t.setValue(e,{value:r(!0)}),o=r(!1)},multipleSelection(t){s.multiple=!0},remove(i){const n=s.options,a=i.detail.remove;if(n[a].selected=!1,s.remove(a),n.length>0){-1===Array.prototype.findIndex.call(n,(t=>t.selected))&&(n[0].selected=!0)}t.setValue(e,{value:r(!0),items:l(i)}),o=r(!1)},clear(i){for(;0!==s.length;)s.remove(0);t.setValue(e,{value:null,items:[]}),o=r(!1)},insert(i){const{index:n,displayValue:a,exportValue:h}=i.detail.insert,c=s.children[n],d=document.createElement("option");d.textContent=a,d.value=h,c?c.before(d):s.append(d),t.setValue(e,{value:r(!0),items:l(i)}),o=r(!1)},items(i){const{items:n}=i.detail;for(;0!==s.length;)s.remove(0);for(const t of n){const{displayValue:e,exportValue:i}=t,n=document.createElement("option");n.textContent=e,n.value=i,s.append(n)}s.options.length>0&&(s.options[0].selected=!0),t.setValue(e,{value:r(!0),items:l(i)}),o=r(!1)},indices(i){const s=new Set(i.detail.indices);for(const t of i.target.options)t.selected=s.has(t.index);t.setValue(e,{value:r(!0)}),o=r(!1)},editable(t){t.target.disabled=!t.detail.editable}};this._dispatchEventFromSandbox(n,i)})),s.addEventListener("input",(i=>{var s;const n=r(!0),a=r(!1);t.setValue(e,{value:n}),i.preventDefault(),null===(s=this.linkService.eventBus)||void 0===s||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,change:a,changeEx:n,willCommit:!1,commitKey:1,keyDown:!1}})})),this._setEventListeners(s,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))):s.addEventListener("input",(function(i){t.setValue(e,{value:r(!0)})})),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Ql extends Fl{constructor(t){const{data:e,elements:i}=t;super(t,{isRenderable:Fl._hasPopupData(e)}),this.elements=i,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new vh({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 i of this.elements)i.popup=t,e.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",e.map((t=>"".concat(Yt).concat(t))).join(",")),this.container}}var Jl=new WeakMap,Zl=new WeakMap,$l=new WeakMap,th=new WeakMap,eh=new WeakMap,ih=new WeakMap,sh=new WeakMap,nh=new WeakMap,ah=new WeakMap,rh=new WeakMap,oh=new WeakMap,lh=new WeakMap,hh=new WeakMap,ch=new WeakMap,dh=new WeakMap,uh=new WeakMap,ph=new WeakMap,fh=new WeakMap,gh=new WeakMap,mh=new WeakSet;class vh{constructor(t){let{container:e,color:i,elements:s,titleObj:n,modificationDate:o,contentsObj:l,richText:h,parent:c,rect:d,parentRect:u,open:p}=t;a(this,mh),w(this,Jl,r(mh,this,_h).bind(this)),w(this,Zl,r(mh,this,Sh).bind(this)),w(this,$l,r(mh,this,Eh).bind(this)),w(this,th,r(mh,this,kh).bind(this)),w(this,eh,null),w(this,ih,null),w(this,sh,null),w(this,nh,null),w(this,ah,null),w(this,rh,null),w(this,oh,null),w(this,lh,!1),w(this,hh,null),w(this,ch,null),w(this,dh,null),w(this,uh,null),w(this,ph,null),w(this,fh,null),w(this,gh,!1),x(ih,this,e),x(ph,this,n),x(sh,this,l),x(uh,this,h),x(rh,this,c),x(eh,this,i),x(dh,this,d),x(oh,this,u),x(ah,this,s),x(nh,this,qe.toDateObject(o)),this.trigger=s.flatMap((t=>t.getElementsToTriggerPopup()));for(const a of this.trigger)a.addEventListener("click",_(th,this)),a.addEventListener("mouseenter",_($l,this)),a.addEventListener("mouseleave",_(Zl,this)),a.classList.add("popupTriggerArea");for(const a of s){var f;null===(f=a.container)||void 0===f||f.addEventListener("keydown",_(Jl,this))}_(ih,this).hidden=!0,p&&r(mh,this,kh).call(this)}render(){if(_(hh,this))return;const t=x(hh,this,document.createElement("div"));if(t.className="popup",_(eh,this)){const e=t.style.outlineColor=Vt.makeHexColor(..._(eh,this));if(CSS.supports("background-color","color-mix(in srgb, red 30%, white)"))t.style.backgroundColor="color-mix(in srgb, ".concat(e," 30%, white)");else{const e=.7;t.style.backgroundColor=Vt.makeHexColor(..._(eh,this).map((t=>Math.floor(e*(255-t)+t))))}}const e=document.createElement("span");e.className="header";const i=document.createElement("h1");if(e.append(i),({dir:i.dir,str:i.textContent}=_(ph,this)),t.append(e),_(nh,this)){const t=document.createElement("span");t.classList.add("popupDate"),t.setAttribute("data-l10n-id","pdfjs-annotation-date-string"),t.setAttribute("data-l10n-args",JSON.stringify({date:_(nh,this).toLocaleDateString(),time:_(nh,this).toLocaleTimeString()})),e.append(t)}const s=o(mh,this,bh);if(s)Sl.render({xfaHtml:s,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const e=this._formatContents(_(sh,this));t.append(e)}_(ih,this).append(t)}_formatContents(t){let{str:e,dir:i}=t;const s=document.createElement("p");s.classList.add("popupContent"),s.dir=i;const n=e.split(/(?:\r\n?|\n)/);for(let a=0,r=n.length;a<r;++a){const t=n[a];s.append(document.createTextNode(t)),a<r-1&&s.append(document.createElement("br"))}return s}updateEdited(t){var e;let{rect:i,popupContent:s}=t;_(fh,this)||x(fh,this,{contentsObj:_(sh,this),richText:_(uh,this)}),i&&x(ch,this,null),s&&(x(uh,this,r(mh,this,wh).call(this,s)),x(sh,this,null)),null===(e=_(hh,this))||void 0===e||e.remove(),x(hh,this,null)}resetEdited(){var t;_(fh,this)&&(({contentsObj:s(x,[sh,this])._,richText:s(x,[uh,this])._}=_(fh,this)),x(fh,this,null),null===(t=_(hh,this))||void 0===t||t.remove(),x(hh,this,null),x(ch,this,null))}forceHide(){x(gh,this,this.isVisible),_(gh,this)&&(_(ih,this).hidden=!0)}maybeShow(){_(gh,this)&&(_(hh,this)||r(mh,this,Eh).call(this),x(gh,this,!1),_(ih,this).hidden=!1)}get isVisible(){return!1===_(ih,this).hidden}}function bh(t){const e=_(uh,t),i=_(sh,t);return null===e||void 0===e||!e.str||null!==i&&void 0!==i&&i.str&&i.str!==e.str?null:_(uh,t).html||null}function Ah(t){var e;return(null===(e=o(mh,t,bh))||void 0===e||null===(e=e.attributes)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.fontSize)||0}function yh(t){var e;return(null===(e=o(mh,t,bh))||void 0===e||null===(e=e.attributes)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.color)||null}function wh(t){const e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},s={style:{color:o(mh,this,yh),fontSize:o(mh,this,Ah)?"calc(".concat(o(mh,this,Ah),"px * var(--scale-factor))"):""}};for(const n of t.split("\n"))e.push({name:"span",value:n,attributes:s});return i}function _h(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&_(lh,this))&&r(mh,this,kh).call(this)}function xh(){if(null!==_(ch,this))return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:s,pageY:n}}}=_(rh,this);let a=!!_(oh,this),r=_(a?oh:dh,this);for(const u of _(ah,this))if(!r||null!==Vt.intersect(u.data.rect,r)){r=u.data.rect,a=!0;break}const o=Vt.normalizeRect([r[0],t[3]-r[1]+t[1],r[2],t[3]-r[3]+t[1]]),l=a?r[2]-r[0]+5:0,h=o[0]+l,c=o[1];x(ch,this,[100*(h-s)/e,100*(c-n)/i]);const{style:d}=_(ih,this);d.left="".concat(_(ch,this)[0],"%"),d.top="".concat(_(ch,this)[1],"%")}function kh(){x(lh,this,!_(lh,this)),_(lh,this)?(r(mh,this,Eh).call(this),_(ih,this).addEventListener("click",_(th,this)),_(ih,this).addEventListener("keydown",_(Jl,this))):(r(mh,this,Sh).call(this),_(ih,this).removeEventListener("click",_(th,this)),_(ih,this).removeEventListener("keydown",_(Jl,this)))}function Eh(){_(hh,this)||this.render(),this.isVisible?_(lh,this)&&_(ih,this).classList.add("focused"):(r(mh,this,xh).call(this),_(ih,this).hidden=!1,_(ih,this).style.zIndex=parseInt(_(ih,this).style.zIndex)+1e3)}function Sh(){_(ih,this).classList.remove("focused"),!_(lh,this)&&this.isVisible&&(_(ih,this).hidden=!0,_(ih,this).style.zIndex=parseInt(_(ih,this).style.zIndex)-1e3)}class Mh extends Fl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=W.FREETEXT}render(){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 i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}get _isEditable(){return this.data.hasOwnCanvas}}var Ch=new WeakMap;class Rh extends Fl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),w(this,Ch,null)}render(){this.container.classList.add("lineAnnotation");const t=this.data,{width:e,height:i}=Rl(t.rect),s=this.svgFactory.create(e,i,!0),n=x(Ch,this,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"),s.append(n),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return _(Ch,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Th=new WeakMap;class Ph extends Fl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),w(this,Th,null)}render(){this.container.classList.add("squareAnnotation");const t=this.data,{width:e,height:i}=Rl(t.rect),s=this.svgFactory.create(e,i,!0),n=t.borderStyle.width,a=x(Th,this,this.svgFactory.createElement("svg:rect"));return a.setAttribute("x",n/2),a.setAttribute("y",n/2),a.setAttribute("width",e-n),a.setAttribute("height",i-n),a.setAttribute("stroke-width",n||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return _(Th,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Lh=new WeakMap;class Dh extends Fl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),w(this,Lh,null)}render(){this.container.classList.add("circleAnnotation");const t=this.data,{width:e,height:i}=Rl(t.rect),s=this.svgFactory.create(e,i,!0),n=t.borderStyle.width,a=x(Lh,this,this.svgFactory.createElement("svg:ellipse"));return a.setAttribute("cx",e/2),a.setAttribute("cy",i/2),a.setAttribute("rx",e/2-n/2),a.setAttribute("ry",i/2-n/2),a.setAttribute("stroke-width",n||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return _(Lh,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Ih=new WeakMap;class Fh extends Fl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),w(this,Ih,null),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:e,borderStyle:i,popupRef:s}}=this;if(!e)return this.container;const{width:n,height:a}=Rl(t),r=this.svgFactory.create(n,a,!0);let o=[];for(let h=0,c=e.length;h<c;h+=2){const i=e[h]-t[0],s=t[3]-e[h+1];o.push("".concat(i,",").concat(s))}o=o.join(" ");const l=x(Ih,this,this.svgFactory.createElement(this.svgElementName));return l.setAttribute("points",o),l.setAttribute("stroke-width",i.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),r.append(l),this.container.append(r),!s&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return _(Ih,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}class Oh extends Fh{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Nh extends Fl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var Wh=new WeakMap;class jh extends Fl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),w(this,Wh,[]),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=W.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,inkLists:e,borderStyle:i,popupRef:s}}=this,{width:n,height:a}=Rl(t),r=this.svgFactory.create(n,a,!0);for(const o of e){let e=[];for(let i=0,s=o.length;i<s;i+=2){const s=o[i]-t[0],n=t[3]-o[i+1];e.push("".concat(s,",").concat(n))}e=e.join(" ");const n=this.svgFactory.createElement(this.svgElementName);_(Wh,this).push(n),n.setAttribute("points",e),n.setAttribute("stroke-width",i.width||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),!s&&this.hasPopupData&&this._createPopup(),r.append(n)}return this.container.append(r),this.container}getElementsToTriggerPopup(){return _(Wh,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}class Bh extends Fl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class Hh extends Fl{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 zh extends Fl{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 Vh extends Fl{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 Gh extends Fl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var Uh=new WeakMap,qh=new WeakSet;class Xh extends Fl{constructor(t){var e;super(t,{isRenderable:!0}),a(this,qh),w(this,Uh,null);const{file:i}=this.data;this.filename=i.filename,this.content=i.content,null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("fileattachmentannotation",{source:this,...i})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:e}=this;let i;e.hasAppearance||0===e.fillAlpha?i=document.createElement("div"):(i=document.createElement("img"),i.src="".concat(this.imageResourcesPath,"annotation-").concat(/paperclip/i.test(e.name)?"paperclip":"pushpin",".svg"),e.fillAlpha&&e.fillAlpha<1&&(i.style="filter: opacity(".concat(Math.round(100*e.fillAlpha),"%);"))),i.addEventListener("dblclick",r(qh,this,Kh).bind(this)),x(Uh,this,i);const{isMac:s}=Ht.platform;return t.addEventListener("keydown",(t=>{"Enter"===t.key&&(s?t.metaKey:t.ctrlKey)&&r(qh,this,Kh).call(this)})),!e.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return _(Uh,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}function Kh(){var t;null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(this.content,this.filename)}var Yh=new WeakMap,Qh=new WeakMap,Jh=new WeakMap,Zh=new WeakSet;class $h{constructor(t){let{div:e,accessibilityManager:i,annotationCanvasMap:s,annotationEditorUIManager:n,page:r,viewport:o}=t;a(this,Zh),w(this,Yh,null),w(this,Qh,null),w(this,Jh,new Map),this.div=e,x(Yh,this,i),x(Qh,this,s),this.page=r,this.viewport=o,this.zIndex=0,this._annotationEditorUIManager=n}async render(t){const{annotations:e}=t,i=this.div;Je(i,this.viewport);const s=new Map,n={data:null,layer:i,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new Ie,annotationStorage:t.annotationStorage||new ta,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const o of e){if(o.noHTML)continue;const t=o.annotationType===ht;if(t){const t=s.get(o.id);if(!t)continue;n.elements=t}else{const{width:t,height:e}=Rl(o.rect);if(t<=0||e<=0)continue}n.data=o;const e=Tl.create(n);if(!e.isRenderable)continue;if(!t&&o.popupRef){const t=s.get(o.popupRef);t?t.push(e):s.set(o.popupRef,[e])}const i=e.render();var a;if(o.hidden&&(i.style.visibility="hidden"),r(Zh,this,tc).call(this,i,o.id),e.annotationEditorType>0)_(Jh,this).set(e.data.id,e),null===(a=this._annotationEditorUIManager)||void 0===a||a.renderAnnotationElement(e)}r(Zh,this,ec).call(this)}update(t){let{viewport:e}=t;const i=this.div;this.viewport=e,Je(i,{rotation:e.rotation}),r(Zh,this,ec).call(this),i.hidden=!1}getEditableAnnotations(){return Array.from(_(Jh,this).values())}getEditableAnnotation(t){return _(Jh,this).get(t)}}function tc(t,e){var i;const s=t.firstChild||t;s.id="".concat(Yt).concat(e),this.div.append(t),null===(i=_(Yh,this))||void 0===i||i.moveElementInDOM(this.div,t,s,!1)}function ec(){if(!_(Qh,this))return;const t=this.div;for(const[e,i]of _(Qh,this)){const s=t.querySelector('[data-annotation-id="'.concat(e,'"]'));if(!s)continue;i.className="annotationContent";const{firstChild:n}=s;n?"CANVAS"===n.nodeName?n.replaceWith(i):n.classList.contains("annotationContent")?n.after(i):n.before(i):s.append(i)}_(Qh,this).clear()}const ic=/\r\n?|\n/g;var sc=new WeakMap,nc=new WeakMap,ac=new WeakMap,rc=new WeakMap,oc=new WeakMap,lc=new WeakMap,hc=new WeakMap,cc=new WeakMap,dc=new WeakMap,uc=new WeakMap,pc=new WeakSet;class fc extends Tn{static get _keyboardManager(){const t=fc.prototype,e=t=>t.isEmpty(),i=Rs.TRANSLATE_SMALL,s=Rs.TRANSLATE_BIG;return Rt(this,"_keyboardManager",new Di([[["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:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-s,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[s,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-s],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,s],checker:e}]]))}constructor(t){super({...t,name:"freeTextEditor"}),a(this,pc),w(this,sc,this.editorDivBlur.bind(this)),w(this,nc,this.editorDivFocus.bind(this)),w(this,ac,this.editorDivInput.bind(this)),w(this,rc,this.editorDivKeydown.bind(this)),w(this,oc,this.editorDivPaste.bind(this)),w(this,lc,void 0),w(this,hc,""),w(this,cc,"".concat(this.id,"-editor")),w(this,dc,void 0),w(this,uc,null),x(lc,this,t.color||fc._defaultColor||Tn._defaultLineColor),x(dc,this,t.fontSize||fc._defaultFontSize)}static initialize(t,e){Tn.initialize(t,e,{strings:["pdfjs-free-text-default-content"]});const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case j.FREETEXT_SIZE:fc._defaultFontSize=e;break;case j.FREETEXT_COLOR:fc._defaultColor=e}}updateParams(t,e){switch(t){case j.FREETEXT_SIZE:r(pc,this,gc).call(this,e);break;case j.FREETEXT_COLOR:r(pc,this,mc).call(this,e)}}static get defaultPropertiesToUpdate(){return[[j.FREETEXT_SIZE,fc._defaultFontSize],[j.FREETEXT_COLOR,fc._defaultColor||Tn._defaultLineColor]]}get propertiesToUpdate(){return[[j.FREETEXT_SIZE,_(dc,this)],[j.FREETEXT_COLOR,_(lc,this)]]}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){const t=this.parentScale;return[-fc._internalPadding*t,-(fc._internalPadding+_(dc,this))*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(W.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant");const t=this._uiManager._signal;this.editorDiv.addEventListener("keydown",_(rc,this),{signal:t}),this.editorDiv.addEventListener("focus",_(nc,this),{signal:t}),this.editorDiv.addEventListener("blur",_(sc,this),{signal:t}),this.editorDiv.addEventListener("input",_(ac,this),{signal:t}),this.editorDiv.addEventListener("paste",_(oc,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",_(cc,this)),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",_(rc,this)),this.editorDiv.removeEventListener("focus",_(nc,this)),this.editorDiv.removeEventListener("blur",_(sc,this)),this.editorDiv.removeEventListener("input",_(ac,this)),this.editorDiv.removeEventListener("paste",_(oc,this)),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(){var t;this.width||(this.enableEditMode(),this.editorDiv.focus(),null!==(t=this._initialOptions)&&void 0!==t&&t.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=_(hc,this),e=x(hc,this,r(pc,this,vc).call(this).trimEnd());if(t===e)return;const i=t=>{x(hc,this,t),t?(r(pc,this,yc).call(this),this._uiManager.rebuild(this),r(pc,this,bc).call(this)):this.remove()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),r(pc,this,bc).call(this)}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){fc._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)}render(){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",_(cc,this)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),Tn._l10nPromise.get("pdfjs-free-text-default-content").then((t=>{var e;return null===(e=this.editorDiv)||void 0===e?void 0:e.setAttribute("default-content",t)})),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize="calc(".concat(_(dc,this),"px * var(--scale-factor))"),i.color=_(lc,this),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),bi(this,this.div,["dblclick","keydown"]),this.width){const[i,s]=this.parentDimensions;if(this.annotationElementId){const{position:n}=_(uc,this);let[a,r]=this.getInitialTranslation();[a,r]=this.pageTranslationToScreen(a,r);const[o,l]=this.pageDimensions,[h,c]=this.pageTranslation;let d,u;switch(this.rotation){case 0:d=t+(n[0]-h)/o,u=e+this.height-(n[1]-c)/l;break;case 90:d=t+(n[0]-h)/o,u=e-(n[1]-c)/l,[a,r]=[r,-a];break;case 180:d=t-this.width+(n[0]-h)/o,u=e-(n[1]-c)/l,[a,r]=[-a,-r];break;case 270:d=t+(n[0]-h-this.height*l)/o,u=e+(n[1]-c-this.width*o)/l,[a,r]=[-r,a]}this.setAt(d*i,u*s,a,r)}else this.setAt(t*i,e*s,this.width*i,this.height*s);r(pc,this,yc).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){const e=t.clipboardData||window.clipboardData,{types:i}=e;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();const s=_c.call(fc,e.getData("text")||"").replaceAll(ic,"\n");if(!s)return;const n=window.getSelection();if(!n.rangeCount)return;this.editorDiv.normalize(),n.deleteFromDocument();const a=n.getRangeAt(0);if(!s.includes("\n"))return a.insertNode(document.createTextNode(s)),this.editorDiv.normalize(),void n.collapseToStart();const{startContainer:o,startOffset:l}=a,h=[],c=[];if(o.nodeType===Node.TEXT_NODE){const t=o.parentElement;if(c.push(o.nodeValue.slice(l).replaceAll(ic,"")),t!==this.editorDiv){let e=h;for(const i of this.editorDiv.childNodes)i!==t?e.push(Ac.call(fc,i)):e=c}h.push(o.nodeValue.slice(0,l).replaceAll(ic,""))}else if(o===this.editorDiv){let t=h,e=0;for(const i of this.editorDiv.childNodes)e++===l&&(t=c),t.push(Ac.call(fc,i))}x(hc,this,"".concat(h.join("\n")).concat(s).concat(c.join("\n"))),r(pc,this,yc).call(this);const d=new Range;let u=h.reduce(((t,e)=>t+e.length),0);for(const{firstChild:r}of this.editorDiv.childNodes)if(r.nodeType===Node.TEXT_NODE){const t=r.nodeValue.length;if(u<=t){d.setStart(r,u),d.setEnd(r,u);break}u-=t}n.removeAllRanges(),n.addRange(d)}get contentDiv(){return this.editorDiv}static deserialize(t,e,i){let s=null;if(t instanceof Mh){const{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:n,rotation:a,id:r},textContent:o,textPosition:l,parent:{page:{pageNumber:h}}}=t;if(!o||0===o.length)return null;s=t={annotationType:W.FREETEXT,color:Array.from(i),fontSize:e,value:o.join("\n"),position:l,pageIndex:h-1,rect:n.slice(0),rotation:a,id:r,deleted:!1}}const n=super.deserialize(t,e,i);return x(dc,n,t.fontSize),x(lc,n,Vt.makeHexColor(...t.color)),x(hc,n,_c.call(fc,t.value)),n.annotationElementId=t.id||null,x(uc,n,s),n}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const e=fc._internalPadding*this.parentScale,i=this.getRect(e,e),s=Tn._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:_(lc,this)),n={annotationType:W.FREETEXT,color:s,fontSize:_(dc,this),value:r(pc,this,wc).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?n:this.annotationElementId&&!r(pc,this,xc).call(this,n)?null:(n.id=this.annotationElementId,n)}renderAnnotationElement(t){const e=super.renderAnnotationElement(t);if(this.deleted)return e;const{style:i}=e;i.fontSize="calc(".concat(_(dc,this),"px * var(--scale-factor))"),i.color=_(lc,this),e.replaceChildren();for(const n of _(hc,this).split("\n")){const t=document.createElement("div");t.append(n?document.createTextNode(n):document.createElement("br")),e.append(t)}const s=fc._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(s,s),popupContent:_(hc,this)}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}function gc(t){const e=t=>{this.editorDiv.style.fontSize="calc(".concat(t,"px * var(--scale-factor))"),this.translate(0,-(t-_(dc,this))*this.parentScale),x(dc,this,t),r(pc,this,bc).call(this)},i=_(dc,this);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:j.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}function mc(t){const e=t=>{x(lc,this,this.editorDiv.style.color=t)},i=_(lc,this);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:j.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function vc(){const t=[];this.editorDiv.normalize();for(const e of this.editorDiv.childNodes)t.push(Ac.call(f,e));return t.join("\n")}function bc(){const[t,e]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:t,div:e}=this,s=e.style.display,n=e.classList.contains("hidden");e.classList.remove("hidden"),e.style.display="hidden",t.div.append(this.div),i=e.getBoundingClientRect(),e.remove(),e.style.display=s,e.classList.toggle("hidden",n)}this.rotation%180===this.parentRotation%180?(this.width=i.width/t,this.height=i.height/e):(this.width=i.height/t,this.height=i.width/e),this.fixAndSetPosition()}function Ac(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(ic,"")}function yc(){if(this.editorDiv.replaceChildren(),_(hc,this))for(const t of _(hc,this).split("\n")){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}function wc(){return _(hc,this).replaceAll("\xa0"," ")}function _c(t){return t.replaceAll(" ","\xa0")}function xc(t){const{value:e,fontSize:i,color:s,pageIndex:n}=_(uc,this);return this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some(((t,e)=>t!==s[e]))||t.pageIndex!==n}f=fc,(0,y.A)(fc,"_freeTextDefaultContent",""),(0,y.A)(fc,"_internalPadding",0),(0,y.A)(fc,"_defaultColor",null),(0,y.A)(fc,"_defaultFontSize",10),(0,y.A)(fc,"_type","freetext"),(0,y.A)(fc,"_editorType",W.FREETEXT);var kc=new WeakMap,Ec=new WeakMap,Sc=new WeakMap,Mc=new WeakSet;class Cc{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];a(this,Mc),w(this,kc,void 0),w(this,Ec,[]),w(this,Sc,[]);let n=1/0,r=-1/0,o=1/0,l=-1/0;const h=10**-4;for(const{x:a,y:m,width:v,height:b}of t){const t=Math.floor((a-e)/h)*h,i=Math.ceil((a+v+e)/h)*h,s=Math.floor((m-e)/h)*h,c=Math.ceil((m+b+e)/h)*h,d=[t,s,c,!0],u=[i,s,c,!1];_(Ec,this).push(d,u),n=Math.min(n,t),r=Math.max(r,i),o=Math.min(o,s),l=Math.max(l,c)}const c=r-n+2*i,d=l-o+2*i,u=n-i,p=o-i,f=_(Ec,this).at(s?-1:-2),g=[f[0],f[2]];for(const a of _(Ec,this)){const[t,e,i]=a;a[0]=(t-u)/c,a[1]=(e-p)/d,a[2]=(i-p)/d}x(kc,this,{x:u,y:p,width:c,height:d,lastPoint:g})}getOutlines(){_(Ec,this).sort(((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]));const t=[];for(const e of _(Ec,this))e[3]?(t.push(...r(Mc,this,Dc).call(this,e)),r(Mc,this,Pc).call(this,e)):(r(Mc,this,Lc).call(this,e),t.push(...r(Mc,this,Dc).call(this,e)));return r(Mc,this,Rc).call(this,t)}}function Rc(t){const e=[],i=new Set;for(const a of t){const[t,i,s]=a;e.push([t,i,a],[t,s,a])}e.sort(((t,e)=>t[1]-e[1]||t[0]-e[0]));for(let a=0,r=e.length;a<r;a+=2){const t=e[a][2],s=e[a+1][2];t.push(s),s.push(t),i.add(t),i.add(s)}const s=[];let n;for(;i.size>0;){const t=i.values().next().value;let[e,a,r,o,l]=t;i.delete(t);let h=e,c=a;for(n=[e,r],s.push(n);;){let t;if(i.has(o))t=o;else{if(!i.has(l))break;t=l}i.delete(t),[e,a,r,o,l]=t,h!==e&&(n.push(h,c,e,c===a?a:r),h=e),c=c===a?r:a}n.push(h,c)}return new Nc(s,_(kc,this))}function Tc(t){const e=_(Sc,this);let i=0,s=e.length-1;for(;i<=s;){const n=i+s>>1,a=e[n][0];if(a===t)return n;a<t?i=n+1:s=n-1}return s+1}function Pc(t){let[,e,i]=t;const s=r(Mc,this,Tc).call(this,e);_(Sc,this).splice(s,0,[e,i])}function Lc(t){let[,e,i]=t;const s=r(Mc,this,Tc).call(this,e);for(let n=s;n<_(Sc,this).length;n++){const[t,s]=_(Sc,this)[n];if(t!==e)break;if(t===e&&s===i)return void _(Sc,this).splice(n,1)}for(let n=s-1;n>=0;n--){const[t,s]=_(Sc,this)[n];if(t!==e)break;if(t===e&&s===i)return void _(Sc,this).splice(n,1)}}function Dc(t){const[e,i,s]=t,n=[[e,i,s]],a=r(Mc,this,Tc).call(this,s);for(let r=0;r<a;r++){const[t,i]=_(Sc,this)[r];for(let s=0,a=n.length;s<a;s++){const[,r,o]=n[s];if(!(i<=r||o<=t))if(r>=t)if(o>i)n[s][1]=i;else{if(1===a)return[];n.splice(s,1),s--,a--}else n[s][2]=t,o>i&&n.push([e,i,o])}}return n}class Ic{toSVGPath(){throw new Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw new Error("Abstract getter `box` must be implemented.")}serialize(t,e){throw new Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof cd}}var Fc=new WeakMap,Oc=new WeakMap;class Nc extends Ic{constructor(t,e){super(),w(this,Fc,void 0),w(this,Oc,void 0),x(Oc,this,t),x(Fc,this,e)}toSVGPath(){const t=[];for(const e of _(Oc,this)){let[i,s]=e;t.push("M".concat(i," ").concat(s));for(let n=2;n<e.length;n+=2){const a=e[n],r=e[n+1];a===i?(t.push("V".concat(r)),s=r):r===s&&(t.push("H".concat(a)),i=a)}t.push("Z")}return t.join(" ")}serialize(t,e){let[i,s,n,a]=t;const r=[],o=n-i,l=a-s;for(const h of _(Oc,this)){const t=new Array(h.length);for(let e=0;e<h.length;e+=2)t[e]=i+h[e]*o,t[e+1]=a-h[e+1]*l;r.push(t)}return r}get box(){return _(Fc,this)}}var Wc=new WeakMap,jc=new WeakMap,Bc=new WeakMap,Hc=new WeakMap,zc=new WeakMap,Vc=new WeakMap,Gc=new WeakMap,Uc=new WeakMap,qc=new WeakMap,Xc=new WeakMap,Kc=new WeakMap,Yc=new WeakMap,Qc=new WeakMap,Jc=new WeakSet;class Zc{constructor(t,e,i,s,n){let{x:r,y:o}=t,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;a(this,Jc),w(this,Wc,void 0),w(this,jc,[]),w(this,Bc,void 0),w(this,Hc,void 0),w(this,zc,[]),w(this,Vc,new Float64Array(18)),w(this,Gc,void 0),w(this,Uc,void 0),w(this,qc,void 0),w(this,Xc,void 0),w(this,Kc,void 0),w(this,Yc,void 0),w(this,Qc,[]),x(Wc,this,e),x(Yc,this,s*i),x(Hc,this,n),_(Vc,this).set([NaN,NaN,NaN,NaN,r,o],6),x(Bc,this,l),x(Xc,this,td._*i),x(qc,this,ed._*i),x(Kc,this,i),_(Qc,this).push(r,o)}get free(){return!0}isEmpty(){return isNaN(_(Vc,this)[8])}add(t){var e;let{x:i,y:s}=t;x(Gc,this,i),x(Uc,this,s);const[n,a,r,o]=_(Wc,this);let[l,h,c,d]=_(Vc,this).subarray(8,12);const u=i-c,p=s-d,f=Math.hypot(u,p);if(f<_(qc,this))return!1;const g=f-_(Xc,this),m=g/f,v=m*u,b=m*p;let A=l,y=h;l=c,h=d,c+=v,d+=b,null===(e=_(Qc,this))||void 0===e||e.push(i,s);const w=v/g,k=-b/g*_(Yc,this),E=w*_(Yc,this);if(_(Vc,this).set(_(Vc,this).subarray(2,8),0),_(Vc,this).set([c+k,d+E],4),_(Vc,this).set(_(Vc,this).subarray(14,18),12),_(Vc,this).set([c-k,d-E],16),isNaN(_(Vc,this)[6]))return 0===_(zc,this).length&&(_(Vc,this).set([l+k,h+E],2),_(zc,this).push(NaN,NaN,NaN,NaN,(l+k-n)/r,(h+E-a)/o),_(Vc,this).set([l-k,h-E],14),_(jc,this).push(NaN,NaN,NaN,NaN,(l-k-n)/r,(h-E-a)/o)),_(Vc,this).set([A,y,l,h,c,d],6),!this.isEmpty();_(Vc,this).set([A,y,l,h,c,d],6);return Math.abs(Math.atan2(y-h,A-l)-Math.atan2(b,v))<Math.PI/2?([l,h,c,d]=_(Vc,this).subarray(2,6),_(zc,this).push(NaN,NaN,NaN,NaN,((l+c)/2-n)/r,((h+d)/2-a)/o),[l,h,A,y]=_(Vc,this).subarray(14,18),_(jc,this).push(NaN,NaN,NaN,NaN,((A+l)/2-n)/r,((y+h)/2-a)/o),!0):([A,y,l,h,c,d]=_(Vc,this).subarray(0,6),_(zc,this).push(((A+5*l)/6-n)/r,((y+5*h)/6-a)/o,((5*l+c)/6-n)/r,((5*h+d)/6-a)/o,((l+c)/2-n)/r,((h+d)/2-a)/o),[c,d,l,h,A,y]=_(Vc,this).subarray(12,18),_(jc,this).push(((A+5*l)/6-n)/r,((y+5*h)/6-a)/o,((5*l+c)/6-n)/r,((5*h+d)/6-a)/o,((l+c)/2-n)/r,((h+d)/2-a)/o),!0)}toSVGPath(){if(this.isEmpty())return"";const t=_(zc,this),e=_(jc,this),i=_(Vc,this).subarray(4,6),s=_(Vc,this).subarray(16,18),[n,a,o,l]=_(Wc,this),[h,c,d,u]=r(Jc,this,$c).call(this);if(isNaN(_(Vc,this)[6])&&!this.isEmpty())return"M".concat((_(Vc,this)[2]-n)/o," ").concat((_(Vc,this)[3]-a)/l," L").concat((_(Vc,this)[4]-n)/o," ").concat((_(Vc,this)[5]-a)/l," L").concat(h," ").concat(c," L").concat(d," ").concat(u," L").concat((_(Vc,this)[16]-n)/o," ").concat((_(Vc,this)[17]-a)/l," L").concat((_(Vc,this)[14]-n)/o," ").concat((_(Vc,this)[15]-a)/l," Z");const p=[];p.push("M".concat(t[4]," ").concat(t[5]));for(let r=6;r<t.length;r+=6)isNaN(t[r])?p.push("L".concat(t[r+4]," ").concat(t[r+5])):p.push("C".concat(t[r]," ").concat(t[r+1]," ").concat(t[r+2]," ").concat(t[r+3]," ").concat(t[r+4]," ").concat(t[r+5]));p.push("L".concat((i[0]-n)/o," ").concat((i[1]-a)/l," L").concat(h," ").concat(c," L").concat(d," ").concat(u," L").concat((s[0]-n)/o," ").concat((s[1]-a)/l));for(let r=e.length-6;r>=6;r-=6)isNaN(e[r])?p.push("L".concat(e[r+4]," ").concat(e[r+5])):p.push("C".concat(e[r]," ").concat(e[r+1]," ").concat(e[r+2]," ").concat(e[r+3]," ").concat(e[r+4]," ").concat(e[r+5]));return p.push("L".concat(e[4]," ").concat(e[5]," Z")),p.join(" ")}getOutlines(){var t,e;const i=_(zc,this),s=_(jc,this),n=_(Vc,this),a=n.subarray(4,6),o=n.subarray(16,18),[l,h,c,d]=_(Wc,this),u=new Float64Array((null!==(t=null===(e=_(Qc,this))||void 0===e?void 0:e.length)&&void 0!==t?t:0)+2);for(let r=0,A=u.length-2;r<A;r+=2)u[r]=(_(Qc,this)[r]-l)/c,u[r+1]=(_(Qc,this)[r+1]-h)/d;u[u.length-2]=(_(Gc,this)-l)/c,u[u.length-1]=(_(Uc,this)-h)/d;const[p,f,g,m]=r(Jc,this,$c).call(this);if(isNaN(n[6])&&!this.isEmpty()){const t=new Float64Array(36);return t.set([NaN,NaN,NaN,NaN,(n[2]-l)/c,(n[3]-h)/d,NaN,NaN,NaN,NaN,(n[4]-l)/c,(n[5]-h)/d,NaN,NaN,NaN,NaN,p,f,NaN,NaN,NaN,NaN,g,m,NaN,NaN,NaN,NaN,(n[16]-l)/c,(n[17]-h)/d,NaN,NaN,NaN,NaN,(n[14]-l)/c,(n[15]-h)/d],0),new cd(t,u,_(Wc,this),_(Kc,this),_(Bc,this),_(Hc,this))}const v=new Float64Array(_(zc,this).length+24+_(jc,this).length);let b=i.length;for(let r=0;r<b;r+=2)isNaN(i[r])?v[r]=v[r+1]=NaN:(v[r]=i[r],v[r+1]=i[r+1]);v.set([NaN,NaN,NaN,NaN,(a[0]-l)/c,(a[1]-h)/d,NaN,NaN,NaN,NaN,p,f,NaN,NaN,NaN,NaN,g,m,NaN,NaN,NaN,NaN,(o[0]-l)/c,(o[1]-h)/d],b),b+=24;for(let r=s.length-6;r>=6;r-=6)for(let t=0;t<6;t+=2)isNaN(s[r+t])?(v[b]=v[b+1]=NaN,b+=2):(v[b]=s[r+t],v[b+1]=s[r+t+1],b+=2);return v.set([NaN,NaN,NaN,NaN,s[4],s[5]],b),new cd(v,u,_(Wc,this),_(Kc,this),_(Bc,this),_(Hc,this))}}function $c(){const t=_(Vc,this).subarray(4,6),e=_(Vc,this).subarray(16,18),[i,s,n,a]=_(Wc,this);return[(_(Gc,this)+(t[0]-e[0])/2-i)/n,(_(Uc,this)+(t[1]-e[1])/2-s)/a,(_(Gc,this)+(e[0]-t[0])/2-i)/n,(_(Uc,this)+(e[1]-t[1])/2-s)/a]}var td={_:8},ed={_:td._+2},id=new WeakMap,sd=new WeakMap,nd=new WeakMap,ad=new WeakMap,rd=new WeakMap,od=new WeakMap,ld=new WeakMap,hd=new WeakSet;class cd extends Ic{constructor(t,e,i,s,n,o){super(),a(this,hd),w(this,id,void 0),w(this,sd,null),w(this,nd,void 0),w(this,ad,void 0),w(this,rd,void 0),w(this,od,void 0),w(this,ld,void 0),x(ld,this,t),x(rd,this,e),x(id,this,i),x(od,this,s),x(nd,this,n),x(ad,this,o),r(hd,this,pd).call(this,o);const{x:l,y:h,width:c,height:d}=_(sd,this);for(let a=0,r=t.length;a<r;a+=2)t[a]=(t[a]-l)/c,t[a+1]=(t[a+1]-h)/d;for(let a=0,r=e.length;a<r;a+=2)e[a]=(e[a]-l)/c,e[a+1]=(e[a+1]-h)/d}toSVGPath(){const t=["M".concat(_(ld,this)[4]," ").concat(_(ld,this)[5])];for(let e=6,i=_(ld,this).length;e<i;e+=6)isNaN(_(ld,this)[e])?t.push("L".concat(_(ld,this)[e+4]," ").concat(_(ld,this)[e+5])):t.push("C".concat(_(ld,this)[e]," ").concat(_(ld,this)[e+1]," ").concat(_(ld,this)[e+2]," ").concat(_(ld,this)[e+3]," ").concat(_(ld,this)[e+4]," ").concat(_(ld,this)[e+5]));return t.push("Z"),t.join(" ")}serialize(t,e){let[i,s,n,a]=t;const o=n-i,l=a-s;let h,c;switch(e){case 0:h=r(hd,this,dd).call(this,_(ld,this),i,a,o,-l),c=r(hd,this,dd).call(this,_(rd,this),i,a,o,-l);break;case 90:h=r(hd,this,ud).call(this,_(ld,this),i,s,o,l),c=r(hd,this,ud).call(this,_(rd,this),i,s,o,l);break;case 180:h=r(hd,this,dd).call(this,_(ld,this),n,s,-o,l),c=r(hd,this,dd).call(this,_(rd,this),n,s,-o,l);break;case 270:h=r(hd,this,ud).call(this,_(ld,this),n,a,-o,-l),c=r(hd,this,ud).call(this,_(rd,this),n,a,-o,-l)}return{outline:Array.from(h),points:[Array.from(c)]}}get box(){return _(sd,this)}getNewOutline(t,e){const{x:i,y:s,width:n,height:a}=_(sd,this),[r,o,l,h]=_(id,this),c=n*l,d=a*h,u=i*l+r,p=s*h+o,f=new Zc({x:_(rd,this)[0]*c+u,y:_(rd,this)[1]*d+p},_(id,this),_(od,this),t,_(ad,this),null!==e&&void 0!==e?e:_(nd,this));for(let g=2;g<_(rd,this).length;g+=2)f.add({x:_(rd,this)[g]*c+u,y:_(rd,this)[g+1]*d+p});return f.getOutlines()}}function dd(t,e,i,s,n){const a=new Float64Array(t.length);for(let r=0,o=t.length;r<o;r+=2)a[r]=e+t[r]*s,a[r+1]=i+t[r+1]*n;return a}function ud(t,e,i,s,n){const a=new Float64Array(t.length);for(let r=0,o=t.length;r<o;r+=2)a[r]=e+t[r+1]*s,a[r+1]=i+t[r]*n;return a}function pd(t){const e=_(ld,this);let i=e[4],s=e[5],n=i,a=s,r=i,o=s,l=i,h=s;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]),a=Math.min(a,e[g+5]),r=Math.max(r,e[g+4]),o=Math.max(o,e[g+5]),h<e[g+5]?(l=e[g+4],h=e[g+5]):h===e[g+5]&&(l=c(l,e[g+4]));else{const t=Vt.bezierBoundingBox(i,s,...e.slice(g,g+6));n=Math.min(n,t[0]),a=Math.min(a,t[1]),r=Math.max(r,t[2]),o=Math.max(o,t[3]),h<t[3]?(l=t[2],h=t[3]):h===t[3]&&(l=c(l,t[2]))}i=e[g+4],s=e[g+5]}const d=n-_(nd,this),u=a-_(nd,this),p=r-n+2*_(nd,this),f=o-a+2*_(nd,this);x(sd,this,{x:d,y:u,width:p,height:f,lastPoint:[l,h]})}var fd=new WeakMap,gd=new WeakMap,md=new WeakMap,vd=new WeakMap,bd=new WeakMap,Ad=new WeakMap,yd=new WeakMap,wd=new WeakMap,_d=new WeakMap,xd=new WeakMap,kd=new WeakMap,Ed=new WeakMap,Sd=new WeakSet;class Md{static get _keyboardManager(){return Rt(this,"_keyboardManager",new Di([[["Escape","mac+Escape"],Md.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Md.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Md.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Md.prototype._moveToPrevious],[["Home","mac+Home"],Md.prototype._moveToBeginning],[["End","mac+End"],Md.prototype._moveToEnd]]))}constructor(t){var e;let{editor:i=null,uiManager:s=null}=t;a(this,Sd),w(this,fd,r(Sd,this,Td).bind(this)),w(this,gd,r(Sd,this,Ld).bind(this)),w(this,md,null),w(this,vd,null),w(this,bd,void 0),w(this,Ad,null),w(this,yd,!1),w(this,wd,!1),w(this,_d,null),w(this,xd,void 0),w(this,kd,null),w(this,Ed,void 0),i?(x(wd,this,!1),x(Ed,this,j.HIGHLIGHT_COLOR),x(_d,this,i)):(x(wd,this,!0),x(Ed,this,j.HIGHLIGHT_DEFAULT_COLOR)),x(kd,this,(null===i||void 0===i?void 0:i._uiManager)||s),x(xd,this,_(kd,this)._eventBus),x(bd,this,(null===i||void 0===i?void 0:i.color)||(null===(e=_(kd,this))||void 0===e?void 0:e.highlightColors.values().next().value)||"#FFFF98")}renderButton(){const t=x(md,this,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0);const e=_(kd,this)._signal;t.addEventListener("click",r(Sd,this,Pd).bind(this),{signal:e}),t.addEventListener("keydown",_(fd,this),{signal:e});const i=x(vd,this,document.createElement("span"));return i.className="swatch",i.setAttribute("aria-hidden",!0),i.style.backgroundColor=_(bd,this),t.append(i),t}renderMainDropdown(){const t=x(Ad,this,r(Sd,this,Cd).call(this));return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}_colorSelectFromKeyboard(t){if(t.target===_(md,this))return void r(Sd,this,Pd).call(this,t);const e=t.target.getAttribute("data-color");e&&r(Sd,this,Rd).call(this,e,t)}_moveToNext(t){var e,i;o(Sd,this,Dd)?t.target!==_(md,this)?null===(e=t.target.nextSibling)||void 0===e||e.focus():null===(i=_(Ad,this).firstChild)||void 0===i||i.focus():r(Sd,this,Pd).call(this,t)}_moveToPrevious(t){var e,i;t.target!==(null===(e=_(Ad,this))||void 0===e?void 0:e.firstChild)&&t.target!==_(md,this)?(o(Sd,this,Dd)||r(Sd,this,Pd).call(this,t),null===(i=t.target.previousSibling)||void 0===i||i.focus()):o(Sd,this,Dd)&&this._hideDropdownFromKeyboard()}_moveToBeginning(t){var e;o(Sd,this,Dd)?null===(e=_(Ad,this).firstChild)||void 0===e||e.focus():r(Sd,this,Pd).call(this,t)}_moveToEnd(t){var e;o(Sd,this,Dd)?null===(e=_(Ad,this).lastChild)||void 0===e||e.focus():r(Sd,this,Pd).call(this,t)}hideDropdown(){var t;null===(t=_(Ad,this))||void 0===t||t.classList.add("hidden"),window.removeEventListener("pointerdown",_(gd,this))}_hideDropdownFromKeyboard(){var t;_(wd,this)||(o(Sd,this,Dd)?(this.hideDropdown(),_(md,this).focus({preventScroll:!0,focusVisible:_(yd,this)})):null===(t=_(_d,this))||void 0===t||t.unselect())}updateColor(t){if(_(vd,this)&&(_(vd,this).style.backgroundColor=t),!_(Ad,this))return;const e=_(kd,this).highlightColors.values();for(const i of _(Ad,this).children)i.setAttribute("aria-selected",e.next().value===t)}destroy(){var t,e;null===(t=_(md,this))||void 0===t||t.remove(),x(md,this,null),x(vd,this,null),null===(e=_(Ad,this))||void 0===e||e.remove(),x(Ad,this,null)}}function Cd(){const t=document.createElement("div"),e=_(kd,this)._signal;t.addEventListener("contextmenu",Ve,{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[i,s]of _(kd,this).highlightColors){const n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",s),n.title=i,n.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-".concat(i));const a=document.createElement("span");n.append(a),a.className="swatch",a.style.backgroundColor=s,n.setAttribute("aria-selected",s===_(bd,this)),n.addEventListener("click",r(Sd,this,Rd).bind(this,s),{signal:e}),t.append(n)}return t.addEventListener("keydown",_(fd,this),{signal:e}),t}function Rd(t,e){e.stopPropagation(),_(xd,this).dispatch("switchannotationeditorparams",{source:this,type:_(Ed,this),value:t})}function Td(t){g._keyboardManager.exec(this,t)}function Pd(t){if(o(Sd,this,Dd))return void this.hideDropdown();if(x(yd,this,0===t.detail),window.addEventListener("pointerdown",_(gd,this),{signal:_(kd,this)._signal}),_(Ad,this))return void _(Ad,this).classList.remove("hidden");const e=x(Ad,this,r(Sd,this,Cd).call(this));_(md,this).append(e)}function Ld(t){var e;null!==(e=_(Ad,this))&&void 0!==e&&e.contains(t.target)||this.hideDropdown()}function Dd(t){return _(Ad,t)&&!_(Ad,t).classList.contains("hidden")}g=Md;var Id=new WeakMap,Fd=new WeakMap,Od=new WeakMap,Nd=new WeakMap,Wd=new WeakMap,jd=new WeakMap,Bd=new WeakMap,Hd=new WeakMap,zd=new WeakMap,Vd=new WeakMap,Gd=new WeakMap,Ud=new WeakMap,qd=new WeakMap,Xd=new WeakMap,Kd=new WeakMap,Yd=new WeakMap,Qd=new WeakMap,Jd=new WeakMap,Zd=new WeakMap,$d=new WeakSet;class tu extends Tn{static get _keyboardManager(){const t=tu.prototype;return Rt(this,"_keyboardManager",new Di([[["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"}),a(this,$d),w(this,Id,null),w(this,Fd,0),w(this,Od,void 0),w(this,Nd,null),w(this,Wd,null),w(this,jd,null),w(this,Bd,null),w(this,Hd,0),w(this,zd,null),w(this,Vd,null),w(this,Gd,null),w(this,Ud,!1),w(this,qd,r($d,this,hu).bind(this)),w(this,Xd,null),w(this,Kd,void 0),w(this,Yd,null),w(this,Qd,""),w(this,Jd,void 0),w(this,Zd,""),this.color=t.color||tu._defaultColor,x(Jd,this,t.thickness||tu._defaultThickness),x(Kd,this,t.opacity||tu._defaultOpacity),x(Od,this,t.boxes||null),x(Zd,this,t.methodOfCreation||""),x(Qd,this,t.text||""),this._isDraggable=!1,t.highlightId>-1?(x(Ud,this,!0),r($d,this,iu).call(this,t),r($d,this,ou).call(this)):(x(Id,this,t.anchorNode),x(Fd,this,t.anchorOffset),x(Bd,this,t.focusNode),x(Hd,this,t.focusOffset),r($d,this,eu).call(this),r($d,this,ou).call(this),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:_(Ud,this)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:_(Jd,this),methodOfCreation:_(Zd,this)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,e){var i;Tn.initialize(t,e),tu._defaultColor||(tu._defaultColor=(null===(i=e.highlightColors)||void 0===i?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(t,e){switch(t){case j.HIGHLIGHT_DEFAULT_COLOR:tu._defaultColor=e;break;case j.HIGHLIGHT_THICKNESS:tu._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return _(Xd,this)}updateParams(t,e){switch(t){case j.HIGHLIGHT_COLOR:r($d,this,su).call(this,e);break;case j.HIGHLIGHT_THICKNESS:r($d,this,nu).call(this,e)}}static get defaultPropertiesToUpdate(){return[[j.HIGHLIGHT_DEFAULT_COLOR,tu._defaultColor],[j.HIGHLIGHT_THICKNESS,tu._defaultThickness]]}get propertiesToUpdate(){return[[j.HIGHLIGHT_COLOR,this.color||tu._defaultColor],[j.HIGHLIGHT_THICKNESS,_(Jd,this)||tu._defaultThickness],[j.HIGHLIGHT_FREE,_(Ud,this)]]}async addEditToolbar(){const t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&(x(Wd,this,new Md({editor:this})),t.addColorPicker(_(Wd,this))),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(r($d,this,du).call(this))}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,r($d,this,du).call(this))}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){r($d,this,ru).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(r($d,this,ou).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;if(this.parent&&!t)r($d,this,ru).call(this);else if(t){var i;r($d,this,ou).call(this,t),e=!this.parent&&(null===(i=this.div)||void 0===i?void 0:i.classList.contains("selectedEditor"))}super.setParent(t),this.show(this._isVisible),e&&this.select()}rotate(t){const{drawLayer:e}=this.parent;let i;_(Ud,this)?(t=(t-this.rotation+360)%360,i=lu.call(tu,_(Vd,this).box,t)):i=lu.call(tu,this,t),e.rotate(_(Gd,this),t),e.rotate(_(Yd,this),t),e.updateBox(_(Gd,this),i),e.updateBox(_(Yd,this),lu.call(tu,_(jd,this).box,t))}render(){if(this.div)return this.div;const t=super.render();_(Qd,this)&&(t.setAttribute("aria-label",_(Qd,this)),t.setAttribute("role","mark")),_(Ud,this)?t.classList.add("free"):this.div.addEventListener("keydown",_(qd,this),{signal:this._uiManager._signal});const e=x(zd,this,document.createElement("div"));t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=_(Nd,this);const[i,s]=this.parentDimensions;return this.setDims(this.width*i,this.height*s),bi(this,_(zd,this),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.parent.drawLayer.addClass(_(Yd,this),"hovered")}pointerleave(){this.parent.drawLayer.removeClass(_(Yd,this),"hovered")}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:r($d,this,cu).call(this,!0);break;case 1:case 3:r($d,this,cu).call(this,!1)}}select(){var t,e;super.select(),_(Yd,this)&&(null===(t=this.parent)||void 0===t||t.drawLayer.removeClass(_(Yd,this),"hovered"),null===(e=this.parent)||void 0===e||e.drawLayer.addClass(_(Yd,this),"selected"))}unselect(){var t;super.unselect(),_(Yd,this)&&(null===(t=this.parent)||void 0===t||t.drawLayer.removeClass(_(Yd,this),"selected"),_(Ud,this)||r($d,this,cu).call(this,!1))}get _mustFixPosition(){return!_(Ud,this)}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;super.show(t),this.parent&&(this.parent.drawLayer.show(_(Gd,this),t),this.parent.drawLayer.show(_(Yd,this),t))}static startHighlighting(t,e,i){let{target:s,x:n,y:a}=i;const{x:o,y:l,width:h,height:c}=s.getBoundingClientRect(),d=e=>{r(tu,this,fu).call(this,t,e)},u=t._signal,p={capture:!0,passive:!1,signal:u},f=t=>{t.preventDefault(),t.stopPropagation()},g=e=>{s.removeEventListener("pointermove",d),window.removeEventListener("blur",g),window.removeEventListener("pointerup",g),window.removeEventListener("pointerdown",f,p),window.removeEventListener("contextmenu",Ve),r(tu,this,gu).call(this,t,e)};window.addEventListener("blur",g,{signal:u}),window.addEventListener("pointerup",g,{signal:u}),window.addEventListener("pointerdown",f,p),window.addEventListener("contextmenu",Ve,{signal:u}),s.addEventListener("pointermove",d,{signal:u}),this._freeHighlight=new Zc({x:n,y:a},[o,l,h,c],t.scale,this._defaultThickness/2,e,.001),({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0))}static deserialize(t,e,i){const s=super.deserialize(t,e,i),{rect:[n,a,o,l],color:h,quadPoints:c}=t;s.color=Vt.makeHexColor(...h),x(Kd,s,t.opacity);const[d,u]=s.pageDimensions;s.width=(o-n)/d,s.height=(l-a)/u;const p=x(Od,s,[]);for(let r=0;r<c.length;r+=8)p.push({x:(c[4]-o)/d,y:(l-(1-c[r+5]))/u,width:(c[r+2]-c[r])/d,height:(c[r+5]-c[r+1])/u});return r($d,s,eu).call(s),s}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty()||t)return null;const e=this.getRect(0,0),i=Tn._colorManager.convert(this.color);return{annotationType:W.HIGHLIGHT,color:i,opacity:_(Kd,this),thickness:_(Jd,this),quadPoints:r($d,this,uu).call(this),outlines:r($d,this,pu).call(this,e),pageIndex:this.pageIndex,rect:e,rotation:r($d,this,du).call(this),structTreeParentId:this._structTreeParentId}}static canCreateNewEmptyEditor(){return!1}}function eu(){const t=new Cc(_(Od,this),.001);x(Vd,this,t.getOutlines()),({x:this.x,y:this.y,width:this.width,height:this.height}=_(Vd,this).box);const e=new Cc(_(Od,this),.0025,.001,"ltr"===this._uiManager.direction);x(jd,this,e.getOutlines());const{lastPoint:i}=_(jd,this).box;x(Xd,this,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])}function iu(t){let{highlightOutlines:e,highlightId:i,clipPathId:s}=t;x(Vd,this,e);if(x(jd,this,e.getNewOutline(_(Jd,this)/2+1.5,.0025)),i>=0)x(Gd,this,i),x(Nd,this,s),this.parent.drawLayer.finalizeLine(i,e),x(Yd,this,this.parent.drawLayer.highlightOutline(_(jd,this)));else if(this.parent){const t=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(_(Gd,this),e),this.parent.drawLayer.updateBox(_(Gd,this),lu.call(m,_(Vd,this).box,(t-this.rotation+360)%360)),this.parent.drawLayer.updateLine(_(Yd,this),_(jd,this)),this.parent.drawLayer.updateBox(_(Yd,this),lu.call(m,_(jd,this).box,t))}const{x:n,y:a,width:r,height:o}=e.box;switch(this.rotation){case 0:this.x=n,this.y=a,this.width=r,this.height=o;break;case 90:{const[t,e]=this.parentDimensions;this.x=a,this.y=1-n,this.width=r*e/t,this.height=o*t/e;break}case 180:this.x=1-n,this.y=1-a,this.width=r,this.height=o;break;case 270:{const[t,e]=this.parentDimensions;this.x=1-a,this.y=n,this.width=r*e/t,this.height=o*t/e;break}}const{lastPoint:l}=_(jd,this).box;x(Xd,this,[(l[0]-n)/r,(l[1]-a)/o])}function su(t){const e=t=>{var e,i;this.color=t,null===(e=this.parent)||void 0===e||e.drawLayer.changeColor(_(Gd,this),t),null===(i=_(Wd,this))||void 0===i||i.updateColor(t)},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:j.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)}function nu(t){const e=_(Jd,this),i=t=>{x(Jd,this,t),r($d,this,au).call(this,t)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:j.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}function au(t){if(!_(Ud,this))return;r($d,this,iu).call(this,{highlightOutlines:_(Vd,this).getNewOutline(t/2)}),this.fixAndSetPosition();const[e,i]=this.parentDimensions;this.setDims(this.width*e,this.height*i)}function ru(){null!==_(Gd,this)&&this.parent&&(this.parent.drawLayer.remove(_(Gd,this)),x(Gd,this,null),this.parent.drawLayer.remove(_(Yd,this)),x(Yd,this,null))}function ou(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;null===_(Gd,this)&&(({id:s(x,[Gd,this])._,clipPathId:s(x,[Nd,this])._}=t.drawLayer.highlight(_(Vd,this),this.color,_(Kd,this))),x(Yd,this,t.drawLayer.highlightOutline(_(jd,this))),_(zd,this)&&(_(zd,this).style.clipPath=_(Nd,this)))}function lu(t,e){let{x:i,y:s,width:n,height:a}=t;switch(e){case 90:return{x:1-s-a,y:i,width:a,height:n};case 180:return{x:1-i-n,y:1-s-a,width:n,height:a};case 270:return{x:s,y:1-i-n,width:a,height:n}}return{x:i,y:s,width:n,height:a}}function hu(t){m._keyboardManager.exec(this,t)}function cu(t){if(!_(Id,this))return;const e=window.getSelection();t?e.setPosition(_(Id,this),_(Fd,this)):e.setPosition(_(Bd,this),_(Hd,this))}function du(){return _(Ud,this)?this.rotation:0}function uu(){if(_(Ud,this))return null;const[t,e]=this.pageDimensions,i=_(Od,this),s=new Float32Array(8*i.length);let n=0;for(const{x:a,y:r,width:o,height:l}of i){const i=a*t,h=(1-r-l)*e;s[n]=s[n+4]=i,s[n+1]=s[n+3]=h,s[n+2]=s[n+6]=i+o*t,s[n+5]=s[n+7]=h+l*e,n+=8}return s}function pu(t){return _(Vd,this).serialize(t,r($d,this,du).call(this))}function fu(t,e){this._freeHighlight.add(e)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}function gu(t,e){this._freeHighlight.isEmpty()?t.drawLayer.removeFreeHighlight(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=""}m=tu,(0,y.A)(tu,"_defaultColor",null),(0,y.A)(tu,"_defaultOpacity",1),(0,y.A)(tu,"_defaultThickness",12),(0,y.A)(tu,"_l10nPromise",void 0),(0,y.A)(tu,"_type","highlight"),(0,y.A)(tu,"_editorType",W.HIGHLIGHT),(0,y.A)(tu,"_freeHighlightId",-1),(0,y.A)(tu,"_freeHighlight",null),(0,y.A)(tu,"_freeHighlightClipId","");var mu=new WeakMap,vu=new WeakMap,bu=new WeakMap,Au=new WeakMap,yu=new WeakMap,wu=new WeakMap,_u=new WeakMap,xu=new WeakMap,ku=new WeakMap,Eu=new WeakMap,Su=new WeakMap,Mu=new WeakMap,Cu=new WeakMap,Ru=new WeakMap,Tu=new WeakMap,Pu=new WeakSet;class Lu extends Tn{constructor(t){super({...t,name:"inkEditor"}),a(this,Pu),w(this,mu,0),w(this,vu,0),w(this,bu,this.canvasPointermove.bind(this)),w(this,Au,this.canvasPointerleave.bind(this)),w(this,yu,this.canvasPointerup.bind(this)),w(this,wu,this.canvasPointerdown.bind(this)),w(this,_u,null),w(this,xu,new Path2D),w(this,ku,!1),w(this,Eu,!1),w(this,Su,!1),w(this,Mu,null),w(this,Cu,0),w(this,Ru,0),w(this,Tu,null),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){Tn.initialize(t,e)}static updateDefaultParams(t,e){switch(t){case j.INK_THICKNESS:Lu._defaultThickness=e;break;case j.INK_COLOR:Lu._defaultColor=e;break;case j.INK_OPACITY:Lu._defaultOpacity=e/100}}updateParams(t,e){switch(t){case j.INK_THICKNESS:r(Pu,this,Du).call(this,e);break;case j.INK_COLOR:r(Pu,this,Iu).call(this,e);break;case j.INK_OPACITY:r(Pu,this,Fu).call(this,e)}}static get defaultPropertiesToUpdate(){return[[j.INK_THICKNESS,Lu._defaultThickness],[j.INK_COLOR,Lu._defaultColor||Tn._defaultLineColor],[j.INK_OPACITY,Math.round(100*Lu._defaultOpacity)]]}get propertiesToUpdate(){var t;return[[j.INK_THICKNESS,this.thickness||Lu._defaultThickness],[j.INK_COLOR,this.color||Lu._defaultColor||Tn._defaultLineColor],[j.INK_OPACITY,Math.round(100*(null!==(t=this.opacity)&&void 0!==t?t:Lu._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.canvas||(r(Pu,this,Xu).call(this),r(Pu,this,Ku).call(this)),this.isAttachedToDOM||(this.parent.add(this),r(Pu,this,Yu).call(this)),r(Pu,this,np).call(this)))}remove(){var t;null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,_(_u,this)&&(clearTimeout(_(_u,this)),x(_u,this,null)),null===(t=_(Mu,this))||void 0===t||t.disconnect(),x(Mu,this,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,i=this.width*t,s=this.height*e;this.setDimensions(i,s)}enableEditMode(){_(ku,this)||null===this.canvas||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",_(wu,this),{signal:this._uiManager._signal}))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",_(wu,this)))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}commit(){_(ku,this)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),x(ku,this,!0),this.div.classList.add("disabled"),r(Pu,this,np).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),this.enableEditMode())}canvasPointerdown(t){0===t.button&&this.isInEditMode()&&!_(ku,this)&&(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),r(Pu,this,Wu).call(this,t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),r(Pu,this,ju).call(this,t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),r(Pu,this,qu).call(this,t)}canvasPointerleave(t){r(Pu,this,qu).call(this,t)}get isResizable(){return!this.isEmpty()&&_(ku,this)}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[i,s,n,a]=r(Pu,this,Ou).call(this);if(this.setAt(i,s,0,0),this.setDims(n,a),r(Pu,this,Xu).call(this),this.width){const[i,s]=this.parentDimensions;this.setAspectRatio(this.width*i,this.height*s),this.setAt(t*i,e*s,this.width*i,this.height*s),x(Su,this,!0),r(Pu,this,Yu).call(this),this.setDims(this.width*i,this.height*s),r(Pu,this,Uu).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return r(Pu,this,Ku).call(this),this.div}setDimensions(t,e){const i=Math.round(t),s=Math.round(e);if(_(Cu,this)===i&&_(Ru,this)===s)return;x(Cu,this,i),x(Ru,this,s),this.canvas.style.visibility="hidden";const[n,a]=this.parentDimensions;this.width=t/n,this.height=e/a,this.fixAndSetPosition(),_(ku,this)&&r(Pu,this,Qu).call(this,t,e),r(Pu,this,Yu).call(this),r(Pu,this,Uu).call(this),this.canvas.style.visibility="visible",this.fixDims()}static deserialize(t,e,i){if(t instanceof jh)return null;const s=super.deserialize(t,e,i);s.thickness=t.thickness,s.color=Vt.makeHexColor(...t.color),s.opacity=t.opacity;const[n,a]=s.pageDimensions,o=s.width*n,l=s.height*a,h=s.parentScale,c=t.thickness/2;x(ku,s,!0),x(Cu,s,Math.round(o)),x(Ru,s,Math.round(l));const{paths:d,rect:u,rotation:p}=t;for(let{bezier:g}of d){g=tp.call(Lu,g,u,p);const t=[];s.paths.push(t);let e=h*(g[0]-c),i=h*(g[1]-c);for(let s=2,a=g.length;s<a;s+=6){const n=h*(g[s]-c),a=h*(g[s+1]-c),r=h*(g[s+2]-c),o=h*(g[s+3]-c),l=h*(g[s+4]-c),d=h*(g[s+5]-c);t.push([[e,i],[n,a],[r,o],[l,d]]),e=l,i=d}const n=r(Lu,this,Zu).call(this,t);s.bezierPath2D.push(n)}const f=r(Pu,s,ip).call(s);return x(vu,s,Math.max(Tn.MIN_SIZE,f[2]-f[0])),x(mu,s,Math.max(Tn.MIN_SIZE,f[3]-f[1])),r(Pu,s,Qu).call(s,o,l),s}serialize(){if(this.isEmpty())return null;const t=this.getRect(0,0),e=Tn._colorManager.convert(this.ctx.strokeStyle);return{annotationType:W.INK,color:e,thickness:this.thickness,opacity:this.opacity,paths:r(Pu,this,ep).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}function Du(t){const e=t=>{this.thickness=t,r(Pu,this,np).call(this)},i=this.thickness;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:j.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}function Iu(t){const e=t=>{this.color=t,r(Pu,this,Uu).call(this)},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:j.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function Fu(t){const e=t=>{this.opacity=t,r(Pu,this,Uu).call(this)};t/=100;const i=this.opacity;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:j.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}function Ou(){const{parentRotation:t,parentDimensions:[e,i]}=this;switch(t){case 90:return[0,i,i,e];case 180:return[e,i,e,i];case 270:return[e,0,i,e];default:return[0,0,e,i]}}function Nu(){const{ctx:t,color:e,opacity:i,thickness:s,parentScale:n,scaleFactor:a}=this;t.lineWidth=s*n/a,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle="".concat(e).concat(function(t){return Math.round(Math.min(255,Math.max(1,255*t))).toString(16).padStart(2,"0")}(i))}function Wu(t,e){const i=this._uiManager._signal;var s;(this.canvas.addEventListener("contextmenu",Ve,{signal:i}),this.canvas.addEventListener("pointerleave",_(Au,this),{signal:i}),this.canvas.addEventListener("pointermove",_(bu,this),{signal:i}),this.canvas.addEventListener("pointerup",_(yu,this),{signal:i}),this.canvas.removeEventListener("pointerdown",_(wu,this)),this.isEditing=!0,_(Su,this))||(x(Su,this,!0),r(Pu,this,Yu).call(this),this.thickness||(this.thickness=v._defaultThickness),this.color||(this.color=v._defaultColor||Tn._defaultLineColor),null!==(s=this.opacity)&&void 0!==s||(this.opacity=v._defaultOpacity));this.currentPath.push([t,e]),x(Eu,this,!1),r(Pu,this,Nu).call(this),x(Tu,this,(()=>{r(Pu,this,zu).call(this),_(Tu,this)&&window.requestAnimationFrame(_(Tu,this))})),window.requestAnimationFrame(_(Tu,this))}function ju(t,e){const[i,s]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===i&&e===s)return;const n=this.currentPath;let a=_(xu,this);if(n.push([t,e]),x(Eu,this,!0),n.length<=2)return a.moveTo(...n[0]),void a.lineTo(t,e);3===n.length&&(x(xu,this,a=new Path2D),a.moveTo(...n[0])),r(Pu,this,Vu).call(this,a,...n.at(-3),...n.at(-2),t,e)}function Bu(){if(0===this.currentPath.length)return;const t=this.currentPath.at(-1);_(xu,this).lineTo(...t)}function Hu(t,e){let i;if(x(Tu,this,null),t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height),r(Pu,this,ju).call(this,t,e),r(Pu,this,Bu).call(this),1!==this.currentPath.length)i=r(Pu,this,Gu).call(this);else{const s=[t,e];i=[[s,s.slice(),s.slice(),s]]}const s=_(xu,this),n=this.currentPath;this.currentPath=[],x(xu,this,new Path2D);this.addCommands({cmd:()=>{this.allRawPaths.push(n),this.paths.push(i),this.bezierPath2D.push(s),this._uiManager.rebuild(this)},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(r(Pu,this,Xu).call(this),r(Pu,this,Ku).call(this)),r(Pu,this,np).call(this))},mustExec:!0})}function zu(){if(!_(Eu,this))return;x(Eu,this,!1);const t=Math.ceil(this.thickness*this.parentScale),e=this.currentPath.slice(-3),i=e.map((t=>t[0])),s=e.map((t=>t[1])),{ctx:n}=(Math.min(...i),Math.max(...i),Math.min(...s),Math.max(...s),this);n.save(),n.clearRect(0,0,this.canvas.width,this.canvas.height);for(const a of this.bezierPath2D)n.stroke(a);n.stroke(_(xu,this)),n.restore()}function Vu(t,e,i,s,n,a,r){const o=(e+s)/2,l=(i+n)/2,h=(s+a)/2,c=(n+r)/2;t.bezierCurveTo(o+2*(s-o)/3,l+2*(n-l)/3,h+2*(s-h)/3,c+2*(n-c)/3,h,c)}function Gu(){const t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];const e=[];let i,[s,n]=t[0];for(i=1;i<t.length-2;i++){const[a,r]=t[i],[o,l]=t[i+1],h=(a+o)/2,c=(r+l)/2,d=[s+2*(a-s)/3,n+2*(r-n)/3],u=[h+2*(a-h)/3,c+2*(r-c)/3];e.push([[s,n],d,u,[h,c]]),[s,n]=[h,c]}const[a,r]=t[i],[o,l]=t[i+1],h=[s+2*(a-s)/3,n+2*(r-n)/3],c=[o+2*(a-o)/3,l+2*(r-l)/3];return e.push([[s,n],h,c,[o,l]]),e}function Uu(){if(this.isEmpty())return void r(Pu,this,Ju).call(this);r(Pu,this,Nu).call(this);const{canvas:t,ctx:e}=this;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height),r(Pu,this,Ju).call(this);for(const i of this.bezierPath2D)e.stroke(i)}function qu(t){this.canvas.removeEventListener("pointerleave",_(Au,this)),this.canvas.removeEventListener("pointermove",_(bu,this)),this.canvas.removeEventListener("pointerup",_(yu,this)),this.canvas.addEventListener("pointerdown",_(wu,this),{signal:this._uiManager._signal}),_(_u,this)&&clearTimeout(_(_u,this)),x(_u,this,setTimeout((()=>{x(_u,this,null),this.canvas.removeEventListener("contextmenu",Ve)}),10)),r(Pu,this,Hu).call(this,t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()}function Xu(){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")}function Ku(){x(Mu,this,new ResizeObserver((t=>{const e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)}))),_(Mu,this).observe(this.div),this._uiManager._signal.addEventListener("abort",(()=>{var t;null===(t=_(Mu,this))||void 0===t||t.disconnect(),x(Mu,this,null)}),{once:!0})}function Yu(){if(!_(Su,this))return;const[t,e]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),r(Pu,this,Ju).call(this)}function Qu(t,e){const i=r(Pu,this,sp).call(this),s=(t-i)/_(vu,this),n=(e-i)/_(mu,this);this.scaleFactor=Math.min(s,n)}function Ju(){const t=r(Pu,this,sp).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}function Zu(t){const e=new Path2D;for(let i=0,s=t.length;i<s;i++){const[s,n,a,r]=t[i];0===i&&e.moveTo(...s),e.bezierCurveTo(n[0],n[1],a[0],a[1],r[0],r[1])}return e}function $u(t,e,i){const[s,n,a,r]=e;switch(i){case 0:for(let e=0,i=t.length;e<i;e+=2)t[e]+=s,t[e+1]=r-t[e+1];break;case 90:for(let e=0,i=t.length;e<i;e+=2){const i=t[e];t[e]=t[e+1]+s,t[e+1]=i+n}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=a-t[e],t[e+1]+=n;break;case 270:for(let e=0,i=t.length;e<i;e+=2){const i=t[e];t[e]=a-t[e+1],t[e+1]=r-i}break;default:throw new Error("Invalid rotation")}return t}function tp(t,e,i){const[s,n,a,r]=e;switch(i){case 0:for(let e=0,i=t.length;e<i;e+=2)t[e]-=s,t[e+1]=r-t[e+1];break;case 90:for(let e=0,i=t.length;e<i;e+=2){const i=t[e];t[e]=t[e+1]-n,t[e+1]=i-s}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=a-t[e],t[e+1]-=n;break;case 270:for(let e=0,i=t.length;e<i;e+=2){const i=t[e];t[e]=r-t[e+1],t[e+1]=a-i}break;default:throw new Error("Invalid rotation")}return t}function ep(t,e,i,s){const n=[],a=this.thickness/2,r=t*e+a,o=t*i+a;for(const l of this.paths){const e=[],i=[];for(let s=0,n=l.length;s<n;s++){const[a,h,c,d]=l[s];if(a[0]===d[0]&&a[1]===d[1]&&1===n){const s=t*a[0]+r,n=t*a[1]+o;e.push(s,n),i.push(s,n);break}const u=t*a[0]+r,p=t*a[1]+o,f=t*h[0]+r,g=t*h[1]+o,m=t*c[0]+r,v=t*c[1]+o,b=t*d[0]+r,A=t*d[1]+o;0===s&&(e.push(u,p),i.push(u,p)),e.push(f,g,m,v,b,A),i.push(f,g),s===n-1&&i.push(b,A)}n.push({bezier:$u.call(v,e,s,this.rotation),points:$u.call(v,i,s,this.rotation)})}return n}function ip(){let t=1/0,e=-1/0,i=1/0,s=-1/0;for(const n of this.paths)for(const[a,r,o,l]of n){const n=Vt.bezierBoundingBox(...a,...r,...o,...l);t=Math.min(t,n[0]),i=Math.min(i,n[1]),e=Math.max(e,n[2]),s=Math.max(s,n[3])}return[t,i,e,s]}function sp(){return _(ku,this)?Math.ceil(this.thickness*this.parentScale):0}function np(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return;if(!_(ku,this))return void r(Pu,this,Uu).call(this);const e=r(Pu,this,ip).call(this),i=r(Pu,this,sp).call(this);x(vu,this,Math.max(Tn.MIN_SIZE,e[2]-e[0])),x(mu,this,Math.max(Tn.MIN_SIZE,e[3]-e[1]));const s=Math.ceil(i+_(vu,this)*this.scaleFactor),n=Math.ceil(i+_(mu,this)*this.scaleFactor),[a,o]=this.parentDimensions;this.width=s/a,this.height=n/o,this.setAspectRatio(s,n);const l=this.translationX,h=this.translationY;this.translationX=-e[0],this.translationY=-e[1],r(Pu,this,Yu).call(this),r(Pu,this,Uu).call(this),x(Cu,this,s),x(Ru,this,n),this.setDims(s,n);const c=t?i/this.scaleFactor/2:0;this.translate(l-this.translationX-c,h-this.translationY-c)}v=Lu,(0,y.A)(Lu,"_defaultColor",null),(0,y.A)(Lu,"_defaultOpacity",1),(0,y.A)(Lu,"_defaultThickness",1),(0,y.A)(Lu,"_type","ink"),(0,y.A)(Lu,"_editorType",W.INK);var ap=new WeakMap,rp=new WeakMap,op=new WeakMap,lp=new WeakMap,hp=new WeakMap,cp=new WeakMap,dp=new WeakMap,up=new WeakMap,pp=new WeakMap,fp=new WeakMap,gp=new WeakMap,mp=new WeakSet;class vp extends Tn{constructor(t){super({...t,name:"stampEditor"}),a(this,mp),w(this,ap,null),w(this,rp,null),w(this,op,null),w(this,lp,null),w(this,hp,null),w(this,cp,""),w(this,dp,null),w(this,up,null),w(this,pp,null),w(this,fp,!1),w(this,gp,!1),x(lp,this,t.bitmapUrl),x(hp,this,t.bitmapFile)}static initialize(t,e){Tn.initialize(t,e)}static get supportedTypes(){return Rt(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map((t=>"image/".concat(t))))}static get supportedTypesStr(){return Rt(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(W.STAMP,{bitmapFile:t.getAsFile()})}remove(){var t,e;_(rp,this)&&(x(ap,this,null),this._uiManager.imageManager.deleteId(_(rp,this)),null===(t=_(dp,this))||void 0===t||t.remove(),x(dp,this,null),null===(e=_(up,this))||void 0===e||e.disconnect(),x(up,this,null),_(pp,this)&&(clearTimeout(_(pp,this)),x(pp,this,null)));super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(_(rp,this)&&null===_(dp,this)&&r(mp,this,yp).call(this),this.isAttachedToDOM||this.parent.add(this))):_(rp,this)&&r(mp,this,yp).call(this)}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(_(op,this)||_(ap,this)||_(lp,this)||_(hp,this)||_(rp,this))}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.addAltTextButton(),_(ap,this)?r(mp,this,wp).call(this):r(mp,this,yp).call(this),this.width){const[i,s]=this.parentDimensions;this.setAt(t*i,e*s,this.width*i,this.height*s)}return this.div}getImageForAltText(){return _(dp,this)}static deserialize(t,e,i){if(t instanceof Gh)return null;const s=super.deserialize(t,e,i),{rect:n,bitmapUrl:a,bitmapId:r,isSvg:o,accessibilityData:l}=t;r&&i.imageManager.isValidId(r)?x(rp,s,r):x(lp,s,a),x(fp,s,o);const[h,c]=s.pageDimensions;return s.width=(n[2]-n[0])/h,s.height=(n[3]-n[1])/c,l&&(s.altTextData=l),s}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isEmpty())return null;const i={annotationType:W.STAMP,bitmapId:_(rp,this),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:_(fp,this),structTreeParentId:this._structTreeParentId};if(t)return i.bitmapUrl=r(mp,this,Ep).call(this,!0),i.accessibilityData=this.altTextData,i;const{decorative:s,altText:n}=this.altTextData;if(!s&&n&&(i.accessibilityData={type:"Figure",alt:n}),null===e)return i;e.stamps||(e.stamps=new Map);const a=_(fp,this)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has(_(rp,this))){if(_(fp,this)){const t=e.stamps.get(_(rp,this));a>t.area&&(t.area=a,t.serialized.bitmap.close(),t.serialized.bitmap=r(mp,this,Ep).call(this,!1))}}else e.stamps.set(_(rp,this),{area:a,serialized:i}),i.bitmap=r(mp,this,Ep).call(this,!1);return i}}function bp(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t?(x(ap,this,t.bitmap),e||(x(rp,this,t.id),x(fp,this,t.isSvg)),t.file&&x(cp,this,t.file.name),r(mp,this,wp).call(this)):this.remove()}function Ap(){x(op,this,null),this._uiManager.enableWaiting(!1),_(dp,this)&&this.div.focus()}function yp(){if(_(rp,this))return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(_(rp,this)).then((t=>r(mp,this,bp).call(this,t,!0))).finally((()=>r(mp,this,Ap).call(this)));if(_(lp,this)){const t=_(lp,this);return x(lp,this,null),this._uiManager.enableWaiting(!0),void x(op,this,this._uiManager.imageManager.getFromUrl(t).then((t=>r(mp,this,bp).call(this,t))).finally((()=>r(mp,this,Ap).call(this))))}if(_(hp,this)){const t=_(hp,this);return x(hp,this,null),this._uiManager.enableWaiting(!0),void x(op,this,this._uiManager.imageManager.getFromFile(t).then((t=>r(mp,this,bp).call(this,t))).finally((()=>r(mp,this,Ap).call(this))))}const t=document.createElement("input");t.type="file",t.accept=b.supportedTypesStr;const e=this._uiManager._signal;x(op,this,new Promise((i=>{t.addEventListener("change",(async()=>{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);const e=await this._uiManager.imageManager.getFromFile(t.files[0]);r(mp,this,bp).call(this,e)}else this.remove();i()}),{signal:e}),t.addEventListener("cancel",(()=>{this.remove(),i()}),{signal:e})})).finally((()=>r(mp,this,Ap).call(this)))),t.click()}function wp(){const{div:t}=this;let{width:e,height:i}=_(ap,this);const[s,n]=this.pageDimensions,a=.75;if(this.width)e=this.width*s,i=this.height*n;else if(e>a*s||i>a*n){const t=Math.min(a*s/e,a*n/i);e*=t,i*=t}const[o,l]=this.parentDimensions;this.setDims(e*o/s,i*l/n),this._uiManager.enableWaiting(!1);const h=x(dp,this,document.createElement("canvas"));t.append(h),t.hidden=!1,r(mp,this,kp).call(this,e,i),r(mp,this,Sp).call(this),_(gp,this)||(this.parent.addUndoableEditor(this),x(gp,this,!0)),this._reportTelemetry({action:"inserted_image"}),_(cp,this)&&h.setAttribute("aria-label",_(cp,this))}function _p(t,e){var i;const[s,n]=this.parentDimensions;this.width=t/s,this.height=e/n,this.setDims(t,e),null!==(i=this._initialOptions)&&void 0!==i&&i.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==_(pp,this)&&clearTimeout(_(pp,this));x(pp,this,setTimeout((()=>{x(pp,this,null),r(mp,this,kp).call(this,t,e)}),200))}function xp(t,e){const{width:i,height:s}=_(ap,this);let n=i,a=s,r=_(ap,this);for(;n>2*t||a>2*e;){const i=n,s=a;n>2*t&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2)),a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2));const o=new OffscreenCanvas(n,a);o.getContext("2d").drawImage(r,0,0,i,s,0,0,n,a),r=o.transferToImageBitmap()}return r}function kp(t,e){t=Math.ceil(t),e=Math.ceil(e);const i=_(dp,this);if(!i||i.width===t&&i.height===e)return;i.width=t,i.height=e;const s=_(fp,this)?_(ap,this):r(mp,this,xp).call(this,t,e);if(this._uiManager.hasMLManager&&!this.hasAltText()){const i=new OffscreenCanvas(t,e).getContext("2d");i.drawImage(s,0,0,s.width,s.height,0,0,t,e),this._uiManager.mlGuess({service:"image-to-text",request:{data:i.getImageData(0,0,t,e).data,width:t,height:e,channels:4}}).then((t=>{const e=(null===t||void 0===t?void 0:t.output)||"";this.parent&&e&&!this.hasAltText()&&(this.altTextData={altText:e,decorative:!1})}))}const n=i.getContext("2d");n.filter=this._uiManager.hcmFilter,n.drawImage(s,0,0,s.width,s.height,0,0,t,e)}function Ep(t){if(t){if(_(fp,this)){const t=this._uiManager.imageManager.getSvgUrl(_(rp,this));if(t)return t}const t=document.createElement("canvas");({width:t.width,height:t.height}=_(ap,this));return t.getContext("2d").drawImage(_(ap,this),0,0),t.toDataURL()}if(_(fp,this)){const[t,e]=this.pageDimensions,i=Math.round(this.width*t*ue.PDF_TO_CSS_UNITS),s=Math.round(this.height*e*ue.PDF_TO_CSS_UNITS),n=new OffscreenCanvas(i,s);return n.getContext("2d").drawImage(_(ap,this),0,0,_(ap,this).width,_(ap,this).height,0,0,i,s),n.transferToImageBitmap()}return structuredClone(_(ap,this))}function Sp(){this._uiManager._signal&&(x(up,this,new ResizeObserver((t=>{const e=t[0].contentRect;e.width&&e.height&&r(mp,this,_p).call(this,e.width,e.height)}))),_(up,this).observe(this.div),this._uiManager._signal.addEventListener("abort",(()=>{var t;null===(t=_(up,this))||void 0===t||t.disconnect(),x(up,this,null)}),{once:!0}))}b=vp,(0,y.A)(vp,"_type","stamp"),(0,y.A)(vp,"_editorType",W.STAMP);var Mp=new WeakMap,Cp=new WeakMap,Rp=new WeakMap,Tp=new WeakMap,Pp=new WeakMap,Lp=new WeakMap,Dp=new WeakMap,Ip=new WeakMap,Fp=new WeakMap,Op=new WeakMap,Np=new WeakMap,Wp=new WeakMap,jp=new WeakMap,Bp=new WeakSet;class Hp{constructor(t){let{uiManager:e,pageIndex:i,div:s,accessibilityManager:n,annotationLayer:r,drawLayer:o,textLayer:l,viewport:h,l10n:c}=t;a(this,Bp),w(this,Mp,void 0),w(this,Cp,!1),w(this,Rp,null),w(this,Tp,null),w(this,Pp,null),w(this,Lp,null),w(this,Dp,null),w(this,Ip,new Map),w(this,Fp,!1),w(this,Op,!1),w(this,Np,!1),w(this,Wp,null),w(this,jp,void 0);const d=[...Xp._.values()];if(!Hp._initialized){Hp._initialized=!0;for(const t of d)t.initialize(c,e)}e.registerEditorTypes(d),x(jp,this,e),this.pageIndex=i,this.div=s,x(Mp,this,n),x(Rp,this,r),this.viewport=h,x(Wp,this,l),this.drawLayer=o,_(jp,this).addLayer(this)}get isEmpty(){return 0===_(Ip,this).size}get isInvisible(){return this.isEmpty&&_(jp,this).getMode()===W.NONE}updateToolbar(t){_(jp,this).updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_(jp,this).getMode();switch(r(Bp,this,qp).call(this),t){case W.NONE:return this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case W.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case W.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 i of Xp._.values())e.toggle("".concat(i._type,"Editing"),t===i._editorType);this.div.hidden=!1}hasTextLayer(t){var e;return t===(null===(e=_(Wp,this))||void 0===e?void 0:e.div)}addInkEditorIfNeeded(t){if(_(jp,this).getMode()!==W.INK)return;if(!t)for(const e of _(Ip,this).values())if(e.isEmpty())return void e.setInBackground();this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(t){_(jp,this).setEditingState(t)}addCommands(t){_(jp,this).addCommands(t)}togglePointerEvents(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(){var t;let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null===(t=_(Rp,this))||void 0===t||t.div.classList.toggle("disabled",!e)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const t=new Set;for(const i of _(Ip,this).values())i.enableEditing(),i.show(!0),i.annotationElementId&&(_(jp,this).removeChangedExistingAnnotation(i),t.add(i.annotationElementId));if(!_(Rp,this))return;const e=_(Rp,this).getEditableAnnotations();for(const i of e){if(i.hide(),_(jp,this).isDeletedAnnotationElement(i.data.id))continue;if(t.has(i.data.id))continue;const e=this.deserialize(i);e&&(this.addOrRebuild(e),e.enableEditing())}}disable(){x(Np,this,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const t=new Map,e=new Map;for(const n of _(Ip,this).values()){var i;n.disableEditing(),n.annotationElementId&&(null===n.serialize()?(e.set(n.annotationElementId,n),null===(i=this.getEditableAnnotation(n.annotationElementId))||void 0===i||i.show(),n.remove()):t.set(n.annotationElementId,n))}if(_(Rp,this)){const i=_(Rp,this).getEditableAnnotations();for(const s of i){const{id:i}=s.data;if(_(jp,this).isDeletedAnnotationElement(i))continue;let n=e.get(i);n?(n.resetAnnotationElement(s),n.show(!1),s.show()):(n=t.get(i),n&&(_(jp,this).addChangedExistingAnnotation(n),n.renderAnnotationElement(s),n.show(!1)),s.show())}}r(Bp,this,qp).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const n of Xp._.values())s.remove("".concat(n._type,"Editing"));this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),x(Np,this,!1)}getEditableAnnotation(t){var e;return(null===(e=_(Rp,this))||void 0===e?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){_(jp,this).getActive()!==t&&_(jp,this).setActiveEditor(t)}enableTextSelection(){var t;this.div.tabIndex=-1,null!==(t=_(Wp,this))&&void 0!==t&&t.div&&!_(Lp,this)&&(x(Lp,this,r(Bp,this,zp).bind(this)),_(Wp,this).div.addEventListener("pointerdown",_(Lp,this),{signal:_(jp,this)._signal}),_(Wp,this).div.classList.add("highlighting"))}disableTextSelection(){var t;this.div.tabIndex=0,null!==(t=_(Wp,this))&&void 0!==t&&t.div&&_(Lp,this)&&(_(Wp,this).div.removeEventListener("pointerdown",_(Lp,this)),x(Lp,this,null),_(Wp,this).div.classList.remove("highlighting"))}enableClick(){if(_(Pp,this))return;const t=_(jp,this)._signal;x(Pp,this,this.pointerdown.bind(this)),x(Tp,this,this.pointerup.bind(this)),this.div.addEventListener("pointerdown",_(Pp,this),{signal:t}),this.div.addEventListener("pointerup",_(Tp,this),{signal:t})}disableClick(){_(Pp,this)&&(this.div.removeEventListener("pointerdown",_(Pp,this)),this.div.removeEventListener("pointerup",_(Tp,this)),x(Pp,this,null),x(Tp,this,null))}attach(t){_(Ip,this).set(t.id,t);const{annotationElementId:e}=t;e&&_(jp,this).isDeletedAnnotationElement(e)&&_(jp,this).removeDeletedAnnotationElement(t)}detach(t){var e;_(Ip,this).delete(t.id),null===(e=_(Mp,this))||void 0===e||e.removePointerInTextLayer(t.contentDiv),!_(Np,this)&&t.annotationElementId&&_(jp,this).addDeletedAnnotationElement(t)}remove(t){this.detach(t),_(jp,this).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,_(Op,this)||this.addInkEditorIfNeeded(!1)}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(_(jp,this).addDeletedAnnotationElement(t.annotationElementId),Tn.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),null===(e=t.parent)||void 0===e||e.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),_(jp,this).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),_(jp,this).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var e;if(!t.isAttachedToDOM)return;const{activeElement:i}=document;t.div.contains(i)&&!_(Dp,this)&&(t._focusEventsAllowed=!1,x(Dp,this,setTimeout((()=>{x(Dp,this,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",(()=>{t._focusEventsAllowed=!0}),{once:!0,signal:_(jp,this)._signal}),i.focus())}),0))),t._structTreeParentId=null===(e=_(Mp,this))||void 0===e?void 0:e.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(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 _(jp,this).getId()}get _signal(){return _(jp,this)._signal}canCreateNewEmptyEditor(){var t;return null===(t=o(Bp,this,Vp))||void 0===t?void 0:t.canCreateNewEmptyEditor()}pasteEditor(t,e){_(jp,this).updateToolbar(t),_(jp,this).updateMode(t);const{offsetX:i,offsetY:s}=r(Bp,this,Up).call(this),n=this.getNextId(),a=r(Bp,this,Gp).call(this,{parent:this,id:n,x:i,y:s,uiManager:_(jp,this),isCentered:!0,...e});a&&this.add(a)}deserialize(t){var e,i;return(null===(e=Xp._.get(null!==(i=t.annotationType)&&void 0!==i?i:t.annotationEditorType))||void 0===e?void 0:e.deserialize(t,this,_(jp,this)))||null}createAndAddNewEditor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=this.getNextId(),n=r(Bp,this,Gp).call(this,{parent:this,id:s,x:t.offsetX,y:t.offsetY,uiManager:_(jp,this),isCentered:e,...i});return n&&this.add(n),n}addNewEditor(){this.createAndAddNewEditor(r(Bp,this,Up).call(this),!0)}setSelected(t){_(jp,this).setSelected(t)}toggleSelected(t){_(jp,this).toggleSelected(t)}isSelected(t){return _(jp,this).isSelected(t)}unselect(t){_(jp,this).unselect(t)}pointerup(t){const{isMac:e}=Ht.platform;0!==t.button||t.ctrlKey&&e||t.target===this.div&&_(Fp,this)&&(x(Fp,this,!1),_(Cp,this)?_(jp,this).getMode()!==W.STAMP?this.createAndAddNewEditor(t,!1):_(jp,this).unselectAll():x(Cp,this,!0))}pointerdown(t){if(_(jp,this).getMode()===W.HIGHLIGHT&&this.enableTextSelection(),_(Fp,this))return void x(Fp,this,!1);const{isMac:e}=Ht.platform;if(0!==t.button||t.ctrlKey&&e)return;if(t.target!==this.div)return;x(Fp,this,!0);const i=_(jp,this).getActive();x(Cp,this,!i||i.isEmpty())}findNewParent(t,e,i){const s=_(jp,this).findParent(e,i);return null!==s&&s!==this&&(s.changeParent(t),!0)}destroy(){var t;(null===(t=_(jp,this).getActive())||void 0===t?void 0:t.parent)===this&&(_(jp,this).commitOrRemove(),_(jp,this).setActiveEditor(null)),_(Dp,this)&&(clearTimeout(_(Dp,this)),x(Dp,this,null));for(const i of _(Ip,this).values()){var e;null===(e=_(Mp,this))||void 0===e||e.removePointerInTextLayer(i.contentDiv),i.setParent(null),i.isAttachedToDOM=!1,i.div.remove()}this.div=null,_(Ip,this).clear(),_(jp,this).removeLayer(this)}render(t){let{viewport:e}=t;this.viewport=e,Je(this.div,e);for(const i of _(jp,this).getEditors(this.pageIndex))this.add(i),i.rebuild();this.updateMode()}update(t){let{viewport:e}=t;_(jp,this).commitOrRemove(),r(Bp,this,qp).call(this);const i=this.viewport.rotation,s=e.rotation;if(this.viewport=e,Je(this.div,{rotation:s}),i!==s)for(const n of _(Ip,this).values())n.rotate(s);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return _(jp,this).viewParameters.realScale}}function zp(t){if(_(jp,this).unselectAll(),t.target===_(Wp,this).div){const{isMac:e}=Ht.platform;if(0!==t.button||t.ctrlKey&&e)return;_(jp,this).showAllEditors("highlight",!0,!0),_(Wp,this).div.classList.add("free"),tu.startHighlighting(this,"ltr"===_(jp,this).direction,t),_(Wp,this).div.addEventListener("pointerup",(()=>{_(Wp,this).div.classList.remove("free")}),{once:!0,signal:_(jp,this)._signal}),t.preventDefault()}}function Vp(t){return Xp._.get(_(jp,t).getMode())}function Gp(t){const e=o(Bp,this,Vp);return e?new e.prototype.constructor(t):null}function Up(){const{x:t,y:e,width:i,height:s}=this.div.getBoundingClientRect(),n=Math.max(0,t),a=Math.max(0,e),r=(n+Math.min(window.innerWidth,t+i))/2-t,o=(a+Math.min(window.innerHeight,e+s))/2-e,[l,h]=this.viewport.rotation%180===0?[r,o]:[o,r];return{offsetX:l,offsetY:h}}function qp(){x(Op,this,!0);for(const t of _(Ip,this).values())t.isEmpty()&&t.remove();x(Op,this,!1)}(0,y.A)(Hp,"_initialized",!1);var Xp={_:new Map([fc,Lu,vp,tu].map((t=>[t._editorType,t])))},Kp=new WeakMap,Yp=new WeakMap,Qp=new WeakMap,Jp=new WeakMap,Zp=new WeakSet;class $p{constructor(t){let{pageIndex:e}=t;a(this,Zp),w(this,Kp,null),w(this,Yp,0),w(this,Qp,new Map),w(this,Jp,new Map),this.pageIndex=e}setParent(t){if(_(Kp,this)){if(_(Kp,this)!==t){if(_(Qp,this).size>0)for(const e of _(Qp,this).values())e.remove(),t.append(e);x(Kp,this,t)}}else x(Kp,this,t)}static get _svgFactory(){return Rt(this,"_svgFactory",new Ie)}highlight(t,e,i){var s,n;let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const o=(x(Yp,this,(s=_(Yp,this),n=s++,s)),n),l=r(Zp,this,ef).call(this,t.box);l.classList.add("highlight"),t.free&&l.classList.add("free");const h=$p._svgFactory.createElement("defs");l.append(h);const c=$p._svgFactory.createElement("path");h.append(c);const d="path_p".concat(this.pageIndex,"_").concat(o);c.setAttribute("id",d),c.setAttribute("d",t.toSVGPath()),a&&_(Jp,this).set(o,c);const u=r(Zp,this,sf).call(this,h,d),p=$p._svgFactory.createElement("use");return l.append(p),l.setAttribute("fill",e),l.setAttribute("fill-opacity",i),p.setAttribute("href","#".concat(d)),_(Qp,this).set(o,l),{id:o,clipPathId:"url(#".concat(u,")")}}highlightOutline(t){var e,i;const s=(x(Yp,this,(e=_(Yp,this),i=e++,e)),i),n=r(Zp,this,ef).call(this,t.box);n.classList.add("highlightOutline");const a=$p._svgFactory.createElement("defs");n.append(a);const o=$p._svgFactory.createElement("path");a.append(o);const l="path_p".concat(this.pageIndex,"_").concat(s);let h;if(o.setAttribute("id",l),o.setAttribute("d",t.toSVGPath()),o.setAttribute("vector-effect","non-scaling-stroke"),t.free){n.classList.add("free");const t=$p._svgFactory.createElement("mask");a.append(t),h="mask_p".concat(this.pageIndex,"_").concat(s),t.setAttribute("id",h),t.setAttribute("maskUnits","objectBoundingBox");const e=$p._svgFactory.createElement("rect");t.append(e),e.setAttribute("width","1"),e.setAttribute("height","1"),e.setAttribute("fill","white");const i=$p._svgFactory.createElement("use");t.append(i),i.setAttribute("href","#".concat(l)),i.setAttribute("stroke","none"),i.setAttribute("fill","black"),i.setAttribute("fill-rule","nonzero"),i.classList.add("mask")}const c=$p._svgFactory.createElement("use");n.append(c),c.setAttribute("href","#".concat(l)),h&&c.setAttribute("mask","url(#".concat(h,")"));const d=c.cloneNode();return n.append(d),c.classList.add("mainOutline"),d.classList.add("secondaryOutline"),_(Qp,this).set(s,n),s}finalizeLine(t,e){const i=_(Jp,this).get(t);_(Jp,this).delete(t),this.updateBox(t,e.box),i.setAttribute("d",e.toSVGPath())}updateLine(t,e){_(Qp,this).get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}removeFreeHighlight(t){this.remove(t),_(Jp,this).delete(t)}updatePath(t,e){_(Jp,this).get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){tf.call($p,_(Qp,this).get(t),e)}show(t,e){_(Qp,this).get(t).classList.toggle("hidden",!e)}rotate(t,e){_(Qp,this).get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){_(Qp,this).get(t).setAttribute("fill",e)}changeOpacity(t,e){_(Qp,this).get(t).setAttribute("fill-opacity",e)}addClass(t,e){_(Qp,this).get(t).classList.add(e)}removeClass(t,e){_(Qp,this).get(t).classList.remove(e)}remove(t){null!==_(Kp,this)&&(_(Qp,this).get(t).remove(),_(Qp,this).delete(t))}destroy(){x(Kp,this,null);for(const t of _(Qp,this).values())t.remove();_(Qp,this).clear()}}function tf(t){let{x:e=0,y:i=0,width:s=1,height:n=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{style:a}=t;a.top="".concat(100*i,"%"),a.left="".concat(100*e,"%"),a.width="".concat(100*s,"%"),a.height="".concat(100*n,"%")}function ef(t){const e=A._svgFactory.create(1,1,!0);return _(Kp,this).append(e),e.setAttribute("aria-hidden",!0),tf.call(A,e,t),e}function sf(t,e){const i=A._svgFactory.createElement("clipPath");t.append(i);const s="clip_".concat(e);i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");const n=A._svgFactory.createElement("use");return i.append(n),n.setAttribute("href","#".concat(e)),n.classList.add("clip"),s}A=$p;var nf=E.AnnotationLayer,af=E.AnnotationMode,rf=E.GlobalWorkerOptions,of=E.PDFDataRangeTransport,lf=E.TextLayer,hf=E.getDocument},97806:(t,e,i)=>{"use strict";i.d(e,{A:()=>E});var s=i(70579),n=i(65043),a=i(77906),r=i(40645),o=i(58387),l=i(3404),h=i(96440),c=Object.prototype.hasOwnProperty;function d(t,e,i){for(i of t.keys())if(u(i,e))return i}function u(t,e){var i,s,n;if(t===e)return!0;if(t&&e&&(i=t.constructor)===e.constructor){if(i===Date)return t.getTime()===e.getTime();if(i===RegExp)return t.toString()===e.toString();if(i===Array){if((s=t.length)===e.length)for(;s--&&u(t[s],e[s]););return-1===s}if(i===Set){if(t.size!==e.size)return!1;for(s of t){if((n=s)&&"object"===typeof n&&!(n=d(e,n)))return!1;if(!e.has(n))return!1}return!0}if(i===Map){if(t.size!==e.size)return!1;for(s of t){if((n=s[0])&&"object"===typeof n&&!(n=d(e,n)))return!1;if(!u(s[1],e.get(n)))return!1}return!0}if(i===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(i===DataView){if((s=t.byteLength)===e.byteLength)for(;s--&&t.getInt8(s)===e.getInt8(s););return-1===s}if(ArrayBuffer.isView(t)){if((s=t.byteLength)===e.byteLength)for(;s--&&t[s]===e[s];);return-1===s}if(!i||"object"===typeof t){for(i in s=0,t){if(c.call(t,i)&&++s&&!c.call(e,i))return!1;if(!(i in e)||!u(t[i],e[i]))return!1}return Object.keys(e).length===s}}return t!==t&&e!==e}var p=i(77397),f=i(16512),g=i(48599);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,l.A)(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(t){(0,l.A)(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,l.A)(this.pdfDocument,"PDF document not loaded."),(0,l.A)(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,l.A)(Array.isArray(t),'"'.concat(t,'" is not a valid destination array.'));const e=t[0];new Promise((t=>{(0,l.A)(this.pdfDocument,"PDF document not loaded."),e instanceof Object?this.pdfDocument.getPageIndex(e).then((e=>{t(e)})).catch((()=>{(0,l.A)(!1,'"'.concat(e,'" is not a valid page reference.'))})):"number"===typeof e?t(e):(0,l.A)(!1,'"'.concat(e,'" is not a valid destination reference.'))})).then((e=>{const i=e+1;(0,l.A)(this.pdfViewer,"PDF viewer is not initialized."),(0,l.A)(i>=1&&i<=this.pagesCount,'"'.concat(i,'" is not a valid page number.')),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:e,pageNumber:i})}))}))}navigateTo(t){this.goToDestination(t)}goToPage(t){const e=t-1;(0,l.A)(this.pdfViewer,"PDF viewer is not initialized."),(0,l.A)(t>=1&&t<=this.pagesCount,'"'.concat(t,'" is not a valid page number.')),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}addLinkAttributes(t,e,i){t.href=e,t.rel=this.externalLinkRel||"noopener noreferrer nofollow",t.target=i?"_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=i(20665),A=i(28234),y=function(t,e,i,s){return new(i||(i=Promise))((function(n,a){function r(t){try{l(s.next(t))}catch(e){a(e)}}function o(t){try{l(s.throw(t))}catch(e){a(e)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,o)}l((s=s.apply(t,e||[])).next())}))},w=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};const{Tm:_}=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 k(t){return"object"===typeof t&&null!==t&&("data"in t||"range"in t||"url"in t)}const E=(0,n.forwardRef)((function(t,e){var{children:i,className:c,error:d="Failed to load PDF file.",externalLinkRel:v,externalLinkTarget:E,file:S,inputRef:M,imageResourcesPath:C,loading:R="Loading PDF\u2026",noData:T="No PDF file specified.",onItemClick:P,onLoadError:L,onLoadProgress:D,onLoadSuccess:I,onPassword:F=x,onSourceError:O,onSourceSuccess:N,options:W,renderMode:j,rotate:B}=t,H=w(t,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[z,V]=(0,A.A)(),{value:G,error:U}=z,[q,X]=(0,A.A)(),{value:K,error:Y}=q,Q=(0,n.useRef)(new m),J=(0,n.useRef)([]),Z=(0,n.useRef)(void 0),$=(0,n.useRef)(void 0);S&&S!==Z.current&&k(S)&&(h(!u(S,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=S),W&&W!==$.current&&(h(!u(W,$.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.'),$.current=W);const tt=(0,n.useRef)({scrollPageIntoView:t=>{const{dest:e,pageNumber:i,pageIndex:s=i-1}=t;if(P)return void P({dest:e,pageIndex:s,pageNumber:i});const n=J.current[s];n?n.scrollIntoView():h(!1,"An internal link leading to page ".concat(i," was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>."))}});(0,n.useImperativeHandle)(e,(()=>({linkService:Q,pages:J,viewer:tt})),[]),(0,n.useEffect)((function(){V({type:"RESET"})}),[S,V]);const et=(0,n.useCallback)((()=>y(this,void 0,void 0,(function*(){if(!S)return null;if("string"===typeof S){if((0,b.zL)(S)){return{data:(0,b.jA)(S)}}return(0,b.qC)(),{url:S}}if(S instanceof _)return{range:S};if((0,b.mw)(S))return{data:S};if(b.Bd&&(0,b.qf)(S)){return{data:yield(0,b.h1)(S)}}if((0,l.A)("object"===typeof S,"Invalid parameter in file, need either Uint8Array, string or a parameter object"),(0,l.A)(k(S),"Invalid parameter object: need either .data, .range or .url"),"url"in S&&"string"===typeof S.url){if((0,b.zL)(S.url)){const{url:t}=S,e=w(S,["url"]),i=(0,b.jA)(t);return Object.assign({data:i},e)}(0,b.qC)()}return S}))),[S]);(0,n.useEffect)((()=>{const t=(0,r.A)(et());return t.promise.then((t=>{V({type:"RESOLVE",value:t})})).catch((t=>{V({type:"REJECT",error:t})})),()=>{(0,b.xL)(t)}}),[et,V]),(0,n.useEffect)((()=>{"undefined"!==typeof G&&(!1!==G?N&&N():U&&(h(!1,U.toString()),O&&O(U)))}),[G]),(0,n.useEffect)((function(){X({type:"RESET"})}),[X,G]),(0,n.useEffect)((function(){if(!G)return;const t=Object.assign(Object.assign({},G),W),e=p.YE(t);D&&(e.onProgress=D),F&&(e.onPassword=F);const i=e;return i.promise.then((t=>{X({type:"RESOLVE",value:t})})).catch((t=>{i.destroyed||X({type:"REJECT",error:t})})),()=>{i.destroy()}}),[W,X,G]),(0,n.useEffect)((()=>{"undefined"!==typeof K&&(!1!==K?K&&(I&&I(K),J.current=new Array(K.numPages),Q.current.setDocument(K)):Y&&(h(!1,Y.toString()),L&&L(Y)))}),[K]),(0,n.useEffect)((function(){Q.current.setViewer(tt.current),Q.current.setExternalLinkRel(v),Q.current.setExternalLinkTarget(E)}),[v,E]);const it=(0,n.useCallback)(((t,e)=>{J.current[t]=e}),[]),st=(0,n.useCallback)((t=>{delete J.current[t]}),[]),nt=(0,n.useMemo)((()=>({imageResourcesPath:C,linkService:Q.current,onItemClick:P,pdf:K,registerPage:it,renderMode:j,rotate:B,unregisterPage:st})),[C,P,K,it,j,B,st]),at=(0,n.useMemo)((()=>(0,a.Ay)(H,(()=>K))),[H,K]);return(0,s.jsx)("div",Object.assign({className:(0,o.A)("react-pdf__Document",c),ref:M,style:{"--scale-factor":"1"}},at,{children:S?void 0===K||null===K?(0,s.jsx)(g.A,{type:"loading",children:"function"===typeof R?R():R}):!1===K?(0,s.jsx)(g.A,{type:"error",children:"function"===typeof d?d():d}):(0,s.jsx)(f.A.Provider,{value:nt,children:i}):(0,s.jsx)(g.A,{type:"no-data",children:"function"===typeof T?T():T})}))}))},16512:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});const s=(0,i(65043).createContext)(null)},48599:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var s=i(70579);function n(t){let{children:e,type:i}=t;return(0,s.jsx)("div",{className:"react-pdf__message react-pdf__message--".concat(i),children:e})}},6584:(t,e,i)=>{"use strict";i.d(e,{A:()=>I});var s=i(70579),n=i(65043),a=i(40645),r=i(77906),o=i(58387);function l(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=t.filter(Boolean);return i.length<=1?i[0]||null:function(t){i.forEach((function(e){"function"===typeof e?e(t):e&&(e.current=t)}))}}var h=i(3404),c=i(96440);const d=(0,n.createContext)(null);var u=i(48599),p=i(77397);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:i}=t,s=i.match(g);if(s)e.role="heading",e["aria-level"]=Number(s[1]);else if(function(t){return t in f}(i)){const t=f[i];t&&(e.role=t)}}return e}function A(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[i]=t.children;if(i){const t=A(i);return Object.assign(Object.assign({},e),t)}}}else"id"in t&&(e["aria-owns"]=t.id);return e}function y(t){return t?Object.assign(Object.assign({},b(t)),A(t)):null}function w(t){let{className:e,node:i}=t;const a=(0,n.useMemo)((()=>y(i)),[i]),r=(0,n.useMemo)((()=>m(i)?v(i)?null:i.children.map(((t,e)=>(0,s.jsx)(w,{node:t},e))):null),[i]);return(0,s.jsx)("span",Object.assign({className:e},a,{children:r}))}function _(){return(0,n.useContext)(d)}var x=i(28234),k=i(20665);function E(){const t=_();(0,h.A)(t,"Unable to find Page context.");const{onGetStructTreeError:e,onGetStructTreeSuccess:i}=t,[r,o]=(0,x.A)(),{value:l,error:d}=r,{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,a.A)(p.getStructTree()),e=t;return t.promise.then((t=>{o({type:"RESOLVE",value:t})})).catch((t=>{o({type:"REJECT",error:t})})),()=>(0,k.xL)(e)}),[u,p,o]),(0,n.useEffect)((()=>{void 0!==l&&(!1!==l?l&&i&&i(l):d&&(c(!1,d.toString()),e&&e(d)))}),[l]),l?(0,s.jsx)(w,{className:"react-pdf__Page__structTree structTree",node:l}):null}const S=p.ng;function M(t){const e=_();(0,h.A)(e,"Unable to find Page context.");const i=Object.assign(Object.assign({},e),t),{_className:a,canvasBackground:r,devicePixelRatio:o=(0,k.mZ)(),onRenderError:d,onRenderSuccess:u,page:p,renderForms:f,renderTextLayer:g,rotate:m,scale:v}=i,{canvasRef:b}=t;(0,h.A)(p,"Attempted to render page canvas, but no page was specified.");const A=(0,n.useRef)(null);function y(t){(0,k.UT)(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}=A;if(!t)return;t.width=w.width,t.height=w.height,t.style.width="".concat(Math.floor(x.width),"px"),t.style.height="".concat(Math.floor(x.height),"px"),t.style.visibility="hidden";const e={annotationMode:f?S.ENABLE_FORMS:S.ENABLE,canvasContext:t.getContext("2d",{alpha:!1}),viewport:w};r&&(e.background=r);const i=p.render(e),s=i;return i.promise.then((()=>{t.style.visibility="",p&&u&&u((0,k.vS)(p,v))})).catch(y),()=>(0,k.xL)(s)}),[r,p,f,w,x]);const M=(0,n.useCallback)((()=>{const{current:t}=A;t&&(t.width=0,t.height=0)}),[]);return(0,n.useEffect)((()=>M),[M]),(0,s.jsx)("canvas",{className:"".concat(a,"__canvas"),dir:"ltr",ref:l(b,A),style:{display:"block",userSelect:"none"},children:g?(0,s.jsx)(E,{}):null})}function C(){const t=_();(0,h.A)(t,"Unable to find Page context.");const{customTextRenderer:e,onGetTextError:i,onGetTextSuccess:r,onRenderTextLayerError:l,onRenderTextLayerSuccess:d,page:u,pageIndex:f,pageNumber:g,rotate:m,scale:v}=t;(0,h.A)(u,"Attempted to load page text content, but no page was specified.");const[b,A]=(0,x.A)(),{value:y,error:w}=b,E=(0,n.useRef)(null),S=(0,n.useRef)(void 0);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(){A({type:"RESET"})}),[u,A]),(0,n.useEffect)((function(){if(!u)return;const t=(0,a.A)(u.getTextContent()),e=t;return t.promise.then((t=>{A({type:"RESOLVE",value:t})})).catch((t=>{A({type:"REJECT",error:t})})),()=>(0,k.xL)(e)}),[u,A]),(0,n.useEffect)((()=>{void 0!==y&&(!1!==y?y&&r&&r(y):w&&(c(!1,w.toString()),i&&i(w)))}),[y]);const M=(0,n.useCallback)((()=>{d&&d()}),[d]),C=(0,n.useCallback)((t=>{c(!1,t.toString()),l&&l(t)}),[l]);const R=(0,n.useMemo)((()=>u.getViewport({scale:v,rotation:m})),[u,m,v]);return(0,n.useLayoutEffect)((function(){if(!u||!y)return;const{current:t}=E;if(!t)return;t.innerHTML="";const i=u.streamTextContent({includeMarkedContent:!0}),s={container:t,textContentSource:i,viewport:R},n=new p.D6(s),a=n;return n.render().then((()=>{const i=document.createElement("div");i.className="endOfContent",t.append(i),S.current=i;const s=t.querySelectorAll('[role="presentation"]');if(e){let t=0;y.items.forEach(((i,n)=>{if(!function(t){return"str"in t}(i))return;const a=s[t];if(!a)return;const r=e(Object.assign({pageIndex:f,pageNumber:g,itemIndex:n},i));a.innerHTML=r,t+=i.str&&i.hasEOL?2:1}))}M()})).catch(C),()=>(0,k.xL)(a)}),[e,C,M,u,f,g,y,R]),(0,s.jsx)("div",{className:(0,o.A)("react-pdf__Page__textContent","textLayer"),onMouseUp:function(){const t=S.current;t&&t.classList.remove("active")},onMouseDown:function(){const t=S.current;t&&t.classList.add("active")},ref:E})}var R=i(16512);function T(){return(0,n.useContext)(R.A)}function P(){const t=T(),e=_();(0,h.A)(e,"Unable to find Page context.");const i=Object.assign(Object.assign({},t),e),{imageResourcesPath:r,linkService:l,onGetAnnotationsError:d,onGetAnnotationsSuccess:u,onRenderAnnotationLayerError:f,onRenderAnnotationLayerSuccess:g,page:m,pdf:v,renderForms:b,rotate:A,scale:y=1}=i;(0,h.A)(v,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),(0,h.A)(m,"Attempted to load page annotations, but no page was specified."),(0,h.A)(l,"Attempted to load page annotations, but no linkService was specified.");const[w,E]=(0,x.A)(),{value:S,error:M}=w,C=(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(){E({type:"RESET"})}),[E,m]),(0,n.useEffect)((function(){if(!m)return;const t=(0,a.A)(m.getAnnotations()),e=t;return t.promise.then((t=>{E({type:"RESOLVE",value:t})})).catch((t=>{E({type:"REJECT",error:t})})),()=>{(0,k.xL)(e)}}),[E,m]),(0,n.useEffect)((()=>{void 0!==S&&(!1!==S?S&&u&&u(S):M&&(c(!1,M.toString()),d&&d(M)))}),[S]);const R=(0,n.useMemo)((()=>m.getViewport({scale:y,rotation:A})),[m,A,y]);return(0,n.useEffect)((function(){if(!v||!m||!l||!S)return;const{current:t}=C;if(!t)return;const e=R.clone({dontFlip:!0}),i={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:t,l10n:null,page:m,viewport:e},s={annotations:S,annotationStorage:v.annotationStorage,div:t,imageResourcesPath:r,linkService:l,page:m,renderForms:b,viewport:e};t.innerHTML="";try{new p.dU(i).render(s),g&&g()}catch(n){!function(t){c(!1,"".concat(t)),f&&f(t)}(n)}return()=>{}}),[S,r,l,m,v,b,R]),(0,s.jsx)("div",{className:(0,o.A)("react-pdf__Page__annotations","annotationLayer"),ref:C})}var L=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};const D=1;function I(t){const e=T(),i=Object.assign(Object.assign({},e),t),{_className:p="react-pdf__Page",_enableRegisterUnregisterPage:f=!0,canvasBackground:g,canvasRef:m,children:v,className:b,customRenderer:A,customTextRenderer:y,devicePixelRatio:w,error:_="Failed to load the page.",height:E,inputRef:S,loading:R="Loading page\u2026",noData:I="No page specified.",onGetAnnotationsError:F,onGetAnnotationsSuccess:O,onGetStructTreeError:N,onGetStructTreeSuccess:W,onGetTextError:j,onGetTextSuccess:B,onLoadError:H,onLoadSuccess:z,onRenderAnnotationLayerError:V,onRenderAnnotationLayerSuccess:G,onRenderError:U,onRenderSuccess:q,onRenderTextLayerError:X,onRenderTextLayerSuccess:K,pageIndex:Y,pageNumber:Q,pdf:J,registerPage:Z,renderAnnotationLayer:$=!0,renderForms:tt=!1,renderMode:et="canvas",renderTextLayer:it=!0,rotate:st,scale:nt=D,unregisterPage:at,width:rt}=i,ot=L(i,["_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"]),[lt,ht]=(0,x.A)(),{value:ct,error:dt}=lt,ut=(0,n.useRef)(null);(0,h.A)(J,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");const pt=(0,k.ci)(Q)?Q-1:null!==Y&&void 0!==Y?Y:null,ft=null!==Q&&void 0!==Q?Q:(0,k.ci)(Y)?Y+1:null,gt=null!==st&&void 0!==st?st:ct?ct.rotate:null,mt=(0,n.useMemo)((()=>{if(!ct)return null;let t=1;const e=null!==nt&&void 0!==nt?nt:D;if(rt||E){const e=ct.getViewport({scale:1,rotation:gt});rt?t=rt/e.width:E&&(t=E/e.height)}return e*t}),[E,ct,gt,nt,rt]);(0,n.useEffect)((function(){return()=>{(0,k.ci)(pt)&&f&&at&&at(pt)}}),[f,J,pt,at]),(0,n.useEffect)((function(){ht({type:"RESET"})}),[ht,J,pt]),(0,n.useEffect)((function(){if(!J||!ft)return;const t=(0,a.A)(J.getPage(ft)),e=t;return t.promise.then((t=>{ht({type:"RESOLVE",value:t})})).catch((t=>{ht({type:"REJECT",error:t})})),()=>(0,k.xL)(e)}),[ht,J,ft]),(0,n.useEffect)((()=>{void 0!==ct&&(!1!==ct?function(){if(z){if(!ct||!mt)return;z((0,k.vS)(ct,mt))}if(f&&Z){if(!(0,k.ci)(pt)||!ut.current)return;Z(pt,ut.current)}}():dt&&(c(!1,dt.toString()),H&&H(dt)))}),[ct,mt]);const vt=(0,n.useMemo)((()=>ct&&(0,k.ci)(pt)&&ft&&(0,k.ci)(gt)&&(0,k.ci)(mt)?{_className:p,canvasBackground:g,customTextRenderer:y,devicePixelRatio:w,onGetAnnotationsError:F,onGetAnnotationsSuccess:O,onGetStructTreeError:N,onGetStructTreeSuccess:W,onGetTextError:j,onGetTextSuccess:B,onRenderAnnotationLayerError:V,onRenderAnnotationLayerSuccess:G,onRenderError:U,onRenderSuccess:q,onRenderTextLayerError:X,onRenderTextLayerSuccess:K,page:ct,pageIndex:pt,pageNumber:ft,renderForms:tt,renderTextLayer:it,rotate:gt,scale:mt}:null),[p,g,y,w,F,O,N,W,j,B,V,G,U,q,X,K,ct,pt,ft,tt,it,gt,mt]),bt=(0,n.useMemo)((()=>(0,r.Ay)(ot,(()=>ct?mt?(0,k.vS)(ct,mt):void 0:ct))),[ot,ct,mt]),At="".concat(pt,"@").concat(mt,"/").concat(gt);function yt(){switch(et){case"custom":return(0,h.A)(A,'renderMode was set to "custom", but no customRenderer was passed.'),(0,s.jsx)(A,{},"".concat(At,"_custom"));case"none":return null;default:return(0,s.jsx)(M,{canvasRef:m},"".concat(At,"_canvas"))}}return(0,s.jsx)("div",Object.assign({className:(0,o.A)(p,b),"data-page-number":ft,ref:l(S,ut),style:{"--scale-factor":"".concat(mt),backgroundColor:g||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},bt,{children:ft?null===J||void 0===ct||null===ct?(0,s.jsx)(u.A,{type:"loading",children:"function"===typeof R?R():R}):!1===J||!1===ct?(0,s.jsx)(u.A,{type:"error",children:"function"===typeof _?_():_}):(0,s.jsxs)(d.Provider,{value:vt,children:[yt(),it?(0,s.jsx)(C,{},"".concat(At,"_text")):null,$?(0,s.jsx)(P,{},"".concat(At,"_annotations")):null,v]}):(0,s.jsx)(u.A,{type:"no-data",children:"function"===typeof I?I():I})}))}},28234:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var s=i(65043);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 a(){return(0,s.useReducer)(n,{value:void 0,error:void 0})}},20665:(t,e,i)=>{"use strict";i.d(e,{Bd:()=>a,UT:()=>v,ci:()=>o,h1:()=>b,jA:()=>d,mZ:()=>u,mw:()=>l,qC:()=>f,qf:()=>h,vS:()=>m,xL:()=>g,zL:()=>c});var s=i(3404),n=i(96440);const a="undefined"!==typeof document,r=a&&"file:"===window.location.protocol;function o(t){return function(t){return"undefined"!==typeof t}(t)&&null!==t}function l(t){return t instanceof ArrayBuffer}function h(t){return(0,s.A)(a,"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,s.A)(c(t),"Invalid data URI.");const[e="",i=""]=t.split(",");return-1!==e.split(";").indexOf("base64")?atob(i):unescape(i)}function u(){return a&&window.devicePixelRatio||1}const p="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function f(){n(!r,"Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ".concat(p))}function g(t){(null===t||void 0===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}function v(t){return"RenderingCancelledException"===t.name}function b(t){return new Promise(((e,i)=>{const s=new FileReader;s.onload=()=>{if(!s.result)return i(new Error("Error while reading a file."));e(s.result)},s.onerror=t=>{if(!t.target)return i(new Error("Error while reading a file."));const{error:e}=t.target;if(!e)return i(new Error("Error while reading a file."));switch(e.code){case e.NOT_FOUND_ERR:return i(new Error("Error while reading a file: File not found."));case e.SECURITY_ERR:return i(new Error("Error while reading a file: Security error."));case e.ABORT_ERR:return i(new Error("Error while reading a file: Aborted."));default:return i(new Error("Error while reading a file."))}},s.readAsArrayBuffer(t)}))}}}]);
//# sourceMappingURL=2346.9d72333b.chunk.js.map