1(self.webpackChunkreact_saas_template=self.webpackChunkreact_saas_template||[]).push([[1101],{1391:function(t,e,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(t,e,i,s){void 0===s&&(s=i);var n=Object.getOwnPropertyDescriptor(e,i);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,s,n)}:function(t,e,i,s){void 0===s&&(s=i),t[s]=e[i]}),n=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&s(e,t,i);return n(e,t),e},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){const e=(0,f.default)();(0,c.default)(e,"Unable to find Page context.");const i=Object.assign(Object.assign({},e),t),{_className:s,canvasBackground:n,devicePixelRatio:a=(0,g.getDevicePixelRatio)(),onRenderError:r,onRenderSuccess:u,page:v,renderForms:b,renderTextLayer:A,rotate:w,scale:y}=i,{canvasRef:_}=t;(0,c.default)(v,"Attempted to render page canvas, but no page was specified.");const x=(0,l.useRef)(null);function E(t){(0,g.isCancelException)(t)||((0,d.default)(!1,t.toString()),r&&r(t))}const k=(0,l.useMemo)((()=>v.getViewport({scale:y*a,rotation:w})),[a,v,w,y]),S=(0,l.useMemo)((()=>v.getViewport({scale:y,rotation:w})),[v,w,y]);(0,l.useEffect)((function(){if(!v)return;v.cleanup();const{current:t}=x;if(!t)return;t.width=k.width,t.height=k.height,t.style.width="".concat(Math.floor(S.width),"px"),t.style.height="".concat(Math.floor(S.height),"px"),t.style.visibility="hidden";const e={annotationMode:b?m.ENABLE_FORMS:m.ENABLE,canvasContext:t.getContext("2d",{alpha:!1}),viewport:k};n&&(e.background=n);const i=v.render(e),s=i;return i.promise.then((()=>{t.style.visibility="",v&&u&&u((0,g.makePageCallback)(v,y))})).catch(E),()=>(0,g.cancelRunningTask)(s)}),[n,v,b,k,S]);const M=(0,l.useCallback)((()=>{const{current:t}=x;t&&(t.width=0,t.height=0)}),[]);return(0,l.useEffect)((()=>M),[M]),(0,o.jsx)("canvas",{className:"".concat(s,"__canvas"),dir:"ltr",ref:(0,h.default)(_,x),style:{display:"block",userSelect:"none"},children:A?(0,o.jsx)(p.default,{}):null})};const o=i(70579),l=i(65043),h=r(i(41614)),c=r(i(62213)),d=r(i(96440)),u=a(i(52051)),p=r(i(96690)),f=r(i(96111)),g=i(87632),m=u.AnnotationMode},2570:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(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}}}},2807:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){return(0,s.useReducer)(n,{value:void 0,error:void 0})};const 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}}},3021:(t,e,i)=>{"use strict";var s=i(24994);e.A=void 0;var n=s(i(40039)),a=i(70579);e.A=(0,n.default)((0,a.jsx)("path",{d:"M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 18H4V8h16z"}),"CalendarToday")},12110:(t,e,i)=>{"use strict";i.d(e,{A:()=>v});var s=i(58168),n=i(98587),a=i(65043),r=i(58387),o=i(98610),l=i(34535),h=i(98206),c=i(61596),d=i(92532),u=i(72372);function p(t){return(0,u.Ay)("MuiCard",t)}(0,d.A)("MuiCard",["root"]);var f=i(70579);const g=["className","raised"],m=(0,l.Ay)(c.A,{name:"MuiCard",slot:"Root",overridesResolver:(t,e)=>e.root})((()=>({overflow:"hidden"}))),v=a.forwardRef((function(t,e){const i=(0,h.b)({props:t,name:"MuiCard"}),{className:a,raised:l=!1}=i,c=(0,n.A)(i,g),d=(0,s.A)({},i,{raised:l}),u=(t=>{const{classes:e}=t;return(0,o.A)({root:["root"]},p,e)})(d);return(0,f.jsx)(m,(0,s.A)({className:(0,r.A)(u.root,a),elevation:l?8:void 0,ref:e,ownerState:d},c))}))},12949:t=>{function e(t){var i,s,n="";if("string"==typeof t||"number"==typeof t)n+=t;else if("object"==typeof t)if(Array.isArray(t)){var a=t.length;for(i=0;i<a;i++)t[i]&&(s=e(t[i]))&&(n&&(n+=" "),n+=s)}else for(s in t)t[s]&&(n&&(n+=" "),n+=s);return n}function i(){for(var t,i,s=0,n="",a=arguments.length;s<a;s++)(t=arguments[s])&&(i=e(t))&&(n&&(n+=" "),n+=i);return n}t.exports=i,t.exports.clsx=i},15660:(t,e)=>{"use strict";
1Object.defineProperty(e,"__esModule",{value:!0}),e.HEADING_PATTERN=e.PDF_ROLE_TO_HTML_ROLE=void 0,e.PDF_ROLE_TO_HTML_ROLE={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},e.HEADING_PATTERN=/^H(\d+)$/},23390:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{constructor(t){let{num:e,gen:i}=t;this.num=e,this.gen=i}toString(){let t="".concat(this.num,"R");return 0!==this.gen&&(t+=this.gen),t}}},24873:function(t,e){"use strict";var i=this&&this.__spreadArray||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))};Object.defineProperty(e,"__esModule",{value:!0}),e.allEvents=e.changeEvents=e.otherEvents=e.transitionEvents=e.animationEvents=e.wheelEvents=e.uiEvents=e.pointerEvents=e.touchEvents=e.selectionEvents=e.dragEvents=e.mouseEvents=e.mediaEvents=e.keyboardEvents=e.imageEvents=e.formEvents=e.focusEvents=e.compositionEvents=e.clipboardEvents=void 0,e.clipboardEvents=["onCopy","onCut","onPaste"],e.compositionEvents=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],e.focusEvents=["onFocus","onBlur"],e.formEvents=["onInput","onInvalid","onReset","onSubmit"],e.imageEvents=["onLoad","onError"],e.keyboardEvents=["onKeyDown","onKeyPress","onKeyUp"],e.mediaEvents=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],e.mouseEvents=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],e.dragEvents=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],e.selectionEvents=["onSelect"],e.touchEvents=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],e.pointerEvents=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],e.uiEvents=["onScroll"],e.wheelEvents=["onWheel"],e.animationEvents=["onAnimationStart","onAnimationEnd","onAnimationIteration"],e.transitionEvents=["onTransitionEnd"],e.otherEvents=["onToggle"],e.changeEvents=["onChange"],e.allEvents=i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i([],e.clipboardEvents,!0),e.compositionEvents,!0),e.focusEvents,!0),e.formEvents,!0),e.imageEvents,!0),e.keyboardEvents,!0),e.mediaEvents,!0),e.mouseEvents,!0),e.dragEvents,!0),e.selectionEvents,!0),e.touchEvents,!0),e.pointerEvents,!0),e.uiEvents,!0),e.wheelEvents,!0),e.animationEvents,!0),e.transitionEvents,!0),e.changeEvents,!0),e.otherEvents,!0),e.default=function(t,i){var s={};return e.allEvents.forEach((function(e){var n=t[e];n&&(s[e]=i?function(t){return n(t,i(e))}:n)})),s}},25379:function(t,e,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(t,e,i,s){void 0===s&&(s=i);var n=Object.getOwnPropertyDescriptor(e,i);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,s,n)}:function(t,e,i,s){void 0===s&&(s=i),t[s]=e[i]}),n=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&s(e,t,i);return n(e,t),e},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};
1Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){const t=(0,f.default)();(0,d.default)(t,"Unable to find Page context.");const{customTextRenderer:e,onGetTextError:i,onGetTextSuccess:s,onRenderTextLayerError:n,onRenderTextLayerSuccess:a,page:r,pageIndex:v,pageNumber:b,rotate:A,scale:w}=t;(0,d.default)(r,"Attempted to load page text content, but no page was specified.");const[y,_]=(0,g.default)(),{value:x,error:E}=y,k=(0,l.useRef)(null);(0,u.default)(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,l.useEffect)((function(){_({type:"RESET"})}),[r,_]),(0,l.useEffect)((function(){if(!r)return;const t=(0,h.default)(r.getTextContent()),e=t;return t.promise.then((t=>{_({type:"RESOLVE",value:t})})).catch((t=>{_({type:"REJECT",error:t})})),()=>(0,m.cancelRunningTask)(e)}),[r,_]),(0,l.useEffect)((()=>{void 0!==x&&(!1!==x?x&&s&&s(x):E&&((0,u.default)(!1,E.toString()),i&&i(E)))}),[x]);const S=(0,l.useCallback)((()=>{a&&a()}),[a]),M=(0,l.useCallback)((t=>{(0,u.default)(!1,t.toString()),n&&n(t)}),[n]);const C=(0,l.useMemo)((()=>r.getViewport({scale:w,rotation:A})),[r,A,w]);return(0,l.useLayoutEffect)((function(){if(!r||!x)return;const{current:t}=k;if(!t)return;t.innerHTML="";const i=r.streamTextContent({includeMarkedContent:!0}),s={container:t,textContentSource:i,viewport:C},n=new p.TextLayer(s),a=n;return n.render().then((()=>{const i=document.createElement("div");i.className="endOfContent",t.append(i);const s=t.querySelectorAll('[role="presentation"]');if(e){let t=0;x.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:v,pageNumber:b,itemIndex:n},i));a.innerHTML=r,t+=i.str&&i.hasEOL?2:1}))}S()})).catch(M),()=>(0,m.cancelRunningTask)(a)}),[e,M,S,r,v,b,x,C]),(0,o.jsx)("div",{className:(0,c.default)("react-pdf__Page__textContent","textLayer"),onMouseUp:function(){const t=k.current;if(!t)return;t.classList.remove("selecting")},onMouseDown:function(){const t=k.current;if(!t)return;t.classList.add("selecting")},ref:k})};const o=i(70579),l=i(65043),h=r(i(2570)),c=r(i(12949)),d=r(i(62213)),u=r(i(96440)),p=a(i(52051)),f=r(i(96111)),g=r(i(2807)),m=i(87632)},25851:function(t,e,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(t,e,i,s){void 0===s&&(s=i);var n=Object.getOwnPropertyDescriptor(e,i);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,s,n)}:function(t,e,i,s){void 0===s&&(s=i),t[s]=e[i]}),n=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&s(e,t,i);return n(e,t),e},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.PasswordResponses=e.usePageContext=e.useOutlineContext=e.useDocumentContext=e.Thumbnail=e.Page=e.Outline=e.Document=e.pdfjs=void 0;const o=a(i(52051));e.pdfjs=o;const l=r(i(99282));e.Document=l.default;const h=r(i(77057));e.Outline=h.default;const c=r(i(86440));e.Page=c.default;const d=r(i(95179));e.Thumbnail=d.default;const u=r(i(48857));e.useDocumentContext=u.default;const p=r(i(82660));e.useOutlineContext=p.default;const f=r(i(96111));e.usePageContext=f.default;const g=r(i(96960));e.PasswordResponses=g.default;(0,i(87632).displayWorkerWarning)(),o.GlobalWorkerOptions.workerSrc="pdf.worker.mjs"},26494:(t,e,i)=>{"use strict";i.d(e,{A:()=>m});var s=i(58168),n=i(98587),a=i(65043),r=i(58387),o=i(98610),l=i(34535),h=i(98206),c=i(92532),d=i(72372);function u(t){return(0,d.Ay)("MuiCardContent",t)}(0,c.A)("MuiCardContent",["root"]);var p=i(70579);const f=["className","component"],g=(0,l.Ay)("div",{name:"MuiCardContent",slot:"Root",overridesResolver:(t,e)=>e.root})((()=>({padding:16,"&:last-child":{paddingBottom:24}}))),m=a.forwardRef((function(t,e){const i=(0,h.b)({props:t,name:"MuiCardContent"}),{className:a,component:l="div"}=i,c=(0,n.A)(i,f),d=(0,s.A)({},i,{component:l}),m=(t=>{const{classes:e}=t;return(0,o.A)({root:["root"]},u,e)})(d);return(0,p.jsx)(g,(0,s.A)({as:l,className:(0,r.A)(m.root,a),ownerState:d,ref:e},c))}
1))},29347:(t,e,i)=>{"use strict";i.d(e,{A:()=>m});var s=i(98587),n=i(58168),a=i(65043),r=i(58387),o=i(98610),l=i(34535),h=i(98206),c=i(92532),d=i(72372);function u(t){return(0,d.Ay)("MuiDialogActions",t)}(0,c.A)("MuiDialogActions",["root","spacing"]);var p=i(70579);const f=["className","disableSpacing"],g=(0,l.Ay)("div",{name:"MuiDialogActions",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:i}=t;return[e.root,!i.disableSpacing&&e.spacing]}})((t=>{let{ownerState:e}=t;return(0,n.A)({display:"flex",alignItems:"center",padding:8,justifyContent:"flex-end",flex:"0 0 auto"},!e.disableSpacing&&{"& > :not(style) ~ :not(style)":{marginLeft:8}})})),m=a.forwardRef((function(t,e){const i=(0,h.b)({props:t,name:"MuiDialogActions"}),{className:a,disableSpacing:l=!1}=i,c=(0,s.A)(i,f),d=(0,n.A)({},i,{disableSpacing:l}),m=(t=>{const{classes:e,disableSpacing:i}=t,s={root:["root",!i&&"spacing"]};return(0,o.A)(s,u,e)})(d);return(0,p.jsx)(g,(0,n.A)({className:(0,r.A)(m.root,a),ownerState:d,ref:e},c))}))},30973:(t,e)=>{var i=Object.prototype.hasOwnProperty;function s(t,e,i){for(i of t.keys())if(n(i,e))return i}function n(t,e){var a,r,o;if(t===e)return!0;if(t&&e&&(a=t.constructor)===e.constructor){if(a===Date)return t.getTime()===e.getTime();if(a===RegExp)return t.toString()===e.toString();if(a===Array){if((r=t.length)===e.length)for(;r--&&n(t[r],e[r]););return-1===r}if(a===Set){if(t.size!==e.size)return!1;for(r of t){if((o=r)&&"object"===typeof o&&!(o=s(e,o)))return!1;if(!e.has(o))return!1}return!0}if(a===Map){if(t.size!==e.size)return!1;for(r of t){if((o=r[0])&&"object"===typeof o&&!(o=s(e,o)))return!1;if(!n(r[1],e.get(o)))return!1}return!0}if(a===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(a===DataView){if((r=t.byteLength)===e.byteLength)for(;r--&&t.getInt8(r)===e.getInt8(r););return-1===r}if(ArrayBuffer.isView(t)){if((r=t.byteLength)===e.byteLength)for(;r--&&t[r]===e[r];);return-1===r}if(!a||"object"===typeof t){for(a in r=0,t){if(i.call(t,a)&&++r&&!i.call(e,a))return!1;if(!(a in e)||!n(t[a],e[a]))return!1}return Object.keys(e).length===r}}return t!==t&&e!==e}e.dequal=n},35695:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=(0,i(65043).createContext)(null);e.default=s},41614:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){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)}))}}},43470:function(t,e,i){"use strict";var s=this&&this.__awaiter||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())}))},n=this&&this.__rest||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},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function t(e){const i=(0,c.default)(),a=(0,d.default)();(0,o.default)(a,"Unable to find Outline context.");const u=Object.assign(Object.assign(Object.assign({},i),a),e),{item:p,linkService:f,onItemClick:g,pdf:m}=u,v=n(u,["item","linkService","onItemClick","pdf"]);(0,o.default)(m,"Attempted to load an outline, but no document was specified. Wrap <Outline /> in a <Document /> or pass explicit `pdf` prop.");const b=(0,h.default)((()=>"string"===typeof p.dest?m.getDestination(p.dest):p.dest)),A=(0,h.default)((()=>s(this,void 0,void 0,(function*(){const t=yield b();if(!t)throw new Error("Destination not found.");const[e]=t;return m.getPageIndex(new l.default(e))})))),w=(0,h.default)((()=>s(this,void 0,void 0,(function*(){return(yield A())+1}))));function y(){if(!p.items||!p.items.length)return null;const{items:e}=p;return(0,r.jsx)("ul",{children:e.map(((e,i)=>(0,r.jsx)(t,Object.assign({item:e,pdf:m},v),"string"===typeof e.dest?e.dest:i)))})}return(0,r.jsxs)("li",{children:[(0,r.jsx)("a",{href:"#",onClick:function(t){t.preventDefault(),(0,o.default)(g||f,"Either onItemClick callback or linkService must be defined in order to navigate to an outline item."),g?Promise.all([b(),A(),w()]).then((t=>{let[e,i,s]=t;g({dest:e,pageIndex:i,pageNumber:s})})):f&&f.goToDestination(p.dest)},children:p.title}),y()]})};
1const r=i(70579),o=a(i(62213)),l=a(i(23390)),h=a(i(56926)),c=a(i(48857)),d=a(i(82660))},48857:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){return(0,n.useContext)(a.default)};const n=i(65043),a=s(i(35695))},52051:(t,e,i)=>{"use strict";i.r(e),i.d(e,{AbortException:()=>Af,AnnotationEditorLayer:()=>wf,AnnotationEditorParamsType:()=>yf,AnnotationEditorType:()=>_f,AnnotationEditorUIManager:()=>xf,AnnotationLayer:()=>Ef,AnnotationMode:()=>kf,ColorPicker:()=>Sf,DOMSVGFactory:()=>Mf,DrawLayer:()=>Cf,FeatureTest:()=>Tf,GlobalWorkerOptions:()=>Rf,ImageKind:()=>Pf,InvalidPDFException:()=>Lf,MissingPDFException:()=>If,OPS:()=>Df,OutputScale:()=>Ff,PDFDataRangeTransport:()=>Of,PDFDateString:()=>Nf,PDFWorker:()=>Wf,PasswordResponses:()=>jf,PermissionFlag:()=>Bf,PixelsPerInch:()=>Hf,RenderingCancelledException:()=>zf,TextLayer:()=>Gf,UnexpectedResponseException:()=>Vf,Util:()=>Uf,VerbosityLevel:()=>qf,XfaLayer:()=>Xf,build:()=>Kf,createValidAbsoluteUrl:()=>Yf,fetchData:()=>Qf,getDocument:()=>Jf,getFilenameFromUrl:()=>Zf,getPdfFilenameFromUrl:()=>$f,getXfaPageViewport:()=>tg,isDataScheme:()=>eg,isPdfFile:()=>ig,noContextMenu:()=>sg,normalizeUnicode:()=>ng,setLayerDimensions:()=>ag,shadow:()=>rg,version:()=>og});var s=i(89379);function n(t,e,i){e||(e=[]);var s=e.length++;return Object.defineProperty({},"_",{set:function(n){e[s]=n,t.apply(i,e)}})}function a(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function r(t,e){a(t,e),e.add(t)}function o(t,e,i){a(t,e),e.set(t,i)}function l(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 h(t,e,i){return i(l(t,e))}function c(t,e){return t.get(l(t,e))}function d(t,e,i){return t.set(l(t,e),i),i}var u,p,f,g,m,v,b,A,w,y,_,x,E=i(64467),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)},S=globalThis.pdfjsLib={};k.d(S,{AbortException:()=>Wt,AnnotationEditorLayer:()=>sf,AnnotationEditorParamsType:()=>H,AnnotationEditorType:()=>B,AnnotationEditorUIManager:()=>es,AnnotationLayer:()=>dc,AnnotationMode:()=>j,ColorPicker:()=>Hd,DOMSVGFactory:()=>Ol,DrawLayer:()=>gf,FeatureTest:()=>zt,GlobalWorkerOptions:()=>Ya,ImageKind:()=>Y,InvalidPDFException:()=>Dt,MissingPDFException:()=>Ft,OPS:()=>wt,OutputScale:()=>Se,PDFDataRangeTransport:()=>Ko,PDFDateString:()=>Ae,PDFWorker:()=>rl,PasswordResponses:()=>yt,PermissionFlag:()=>z,PixelsPerInch:()=>oe,RenderingCancelledException:()=>ce,TextLayer:()=>ko,UnexpectedResponseException:()=>Ot,Util:()=>Vt,VerbosityLevel:()=>At,XfaLayer:()=>Nl,build:()=>Pl,createValidAbsoluteUrl:()=>Tt,fetchData:()=>le,getDocument:()=>Vo,getFilenameFromUrl:()=>pe,getPdfFilenameFromUrl:()=>fe,getXfaPageViewport:()=>ye,isDataScheme:()=>de,isPdfFile:()=>ue,noContextMenu:()=>ve,normalizeUnicode:()=>Yt,setLayerDimensions:()=>ke,shadow:()=>Rt,version:()=>Rl});const M="object"===typeof process&&process+""==="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&"browser"!==process.type),C=[1,0,0,1,0,0],T=[.001,0,0,.001,0,0],R=1.35,P=1,L=2,I=4,D=16,F=32,O=64,N=128,W=256,j={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},B={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},H={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},z={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},G=0,V=1,U=2,q=3,X=3,K=4,Y={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Q=1,J=2,Z=3,$=4,tt=5,et=6,it=7,st=8,nt=9,at=10,rt=11,ot=12,lt=13,ht=14,ct=15,dt=16,ut=17,pt=20,ft=1,gt=2,mt=3,vt=4,bt=5,At={ERRORS:0,WARNINGS:1,INFOS:5},wt={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93},yt={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let _t=At.WARNINGS;function xt(t){Number.isInteger(t)&&(_t=t)}function Et(){return _t}function kt(t){_t>=At.INFOS&&console.log("Info: ".concat(t))}function St(t){_t>=At.WARNINGS&&console.log("Warning: ".concat(t))}function Mt(t){throw new Error(t)}function Ct(t,e){t||Mt(e)}function Tt(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))}
1if(i.tryConvertEncoding)try{t=decodeURIComponent(escape(t))}catch(s){}}const n=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}}(n))return n}catch(n){}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 Pt=function(){function t(t,e){this.message=t,this.name=e}return t.prototype=new Error,t.constructor=t,t}();class Lt extends Pt{constructor(t,e){super(t,"PasswordException"),this.code=e}}class It extends Pt{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class Dt extends Pt{constructor(t){super(t,"InvalidPDFException")}}class Ft extends Pt{constructor(t){super(t,"MissingPDFException")}}class Ot extends Pt{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class Nt extends Pt{constructor(t){super(t,"FormatError")}}class Wt extends Pt{constructor(t){super(t,"AbortException")}}function jt(t){"object"===typeof t&&void 0!==(null===t||void 0===t?void 0:t.length)||Mt("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 Bt(t){"string"!==typeof t&&Mt("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 Ht(t){const e=Object.create(null);for(const[i,s]of t)e[i]=s;return e}class zt{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(t){return!1}}())}static get isOffscreenCanvasSupported(){return Rt(this,"isOffscreenCanvasSupported","undefined"!==typeof OffscreenCanvas)}static get platform(){var t,e;return"undefined"!==typeof navigator&&"string"===typeof(null===(t=navigator)||void 0===t?void 0:t.platform)?Rt(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:"string"===typeof(null===(e=navigator)||void 0===e?void 0:e.userAgent)&&navigator.userAgent.includes("Firefox")}):Rt(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!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 Gt=Array.from(Array(256).keys(),(t=>t.toString(16).padStart(2,"0")));class Vt{static makeHexColor(t,e,i){return"#".concat(Gt[t]).concat(Gt[e]).concat(Gt[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,r,o,h){return h?(h[0]=Math.min(h[0],t,r),h[1]=Math.min(h[1],e,o),h[2]=Math.max(h[2],t,r),h[3]=Math.max(h[3],e,o)):h=[Math.min(t,r),Math.min(e,o),Math.max(t,r),Math.max(e,o)],l(Vt,this,qt).call(this,t,i,n,r,e,s,a,o,3*(3*(i-n)-t+r),6*(t-2*i+n),3*(i-t),h),l(Vt,this,qt).call(this,t,i,n,r,e,s,a,o,3*(3*(s-a)-e+o),6*(e-2*s+a),3*(s-e),h),h}}function Ut(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 qt(t,e,i,s,n,a,r,o,h,c,d,p){if(Math.abs(h)<1e-12)return void(Math.abs(c)>=1e-12&&l(u,this,Ut).call(this,t,e,i,s,n,a,r,o,-d/c,p));const f=c**2-4*d*h;if(f<0)return;const g=Math.sqrt(f),m=2*h;l(u,this,Ut).call(this,t,e,i,s,n,a,r,o,(-c+g)/m,p),l(u,this,Ut).call(this,t,e,i,s,n,a,r,o,(-c-g)/m,p)}u=Vt;let Xt=null,Kt=null;function Yt(t){return Xt||(Xt=/([\xA0\xB5\u037E\u0EB3\u2000-\u200A\u202F\u2126\uFB00-\uFB04\uFB06\uFB20-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBA1\uFBA4-\uFBA9\uFBAE-\uFBB1\uFB
1D3-\uFBDC\uFBDE-\uFBE7\uFBEA-\uFBF8\uFBFC\uFBFD\uFC00-\uFC5D\uFC64-\uFCF1\uFCF5-\uFD3D\uFD88\uFDF4\uFDFA\uFDFB\uFE71\uFE77\uFE79\uFE7B\uFE7D]+)|(\uFB05+)/g,Kt=new Map([["\ufb05","\u017ft"]])),t.replaceAll(Xt,((t,e,i)=>e?e.normalize("NFKC"):Kt.get(i)))}const Qt="pdfjs_internal_id_",Jt=0,Zt=1,$t=2,te=3,ee=4,ie=5,se=6,ne=7,ae=8;const re="http://www.w3.org/2000/svg";class oe{}async function le(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";if(me(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)}))}p=oe,(0,E.A)(oe,"CSS",96),(0,E.A)(oe,"PDF",72),(0,E.A)(oe,"PDF_TO_CSS_UNITS",p.CSS/p.PDF);class he{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 he({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 ce extends Pt{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t,"RenderingCancelledException"),this.extraDelay=e}}function de(t){const e=t.length;let i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function ue(t){return"string"===typeof t&&/\.pdf$/i.test(t)}function pe(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function fe(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!==typeof t)return e;if(de(t))return St('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(a){}return n||e}class ge{constructor(){(0,E.A)(this,"started",Object.create(null)),(0,E.A)(this,"times",[])}time(t){t in this.started&&St("Timer is already running for ".concat(t)),this.started[t]=Date.now()}timeEnd(t){t in this.started||St("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 me(t,e){try{const{protocol:i}=e?new URL(t,e):new URL(t);return"http:"===i||"https:"===i}catch(i){return!1}}function ve(t){t.preventDefault()}function be(t){console.log("Deprecated API usage: "+t)}class Ae{static toDateObject(t){if(!t||"string"!==typeof t)return null;l(Ae,this,we)._||(we._=l(Ae,this,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?")));const e=l(Ae,this,we)._.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 h=e[7]||"Z";
1let c=parseInt(e[8],10);c=c>=0&&c<=23?c:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,"-"===h?(a+=c,r+=d):"+"===h&&(a-=c,r-=d),new Date(Date.UTC(i,s,n,a,r,o))}}var we={_:void 0};function ye(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 he({viewBox:r,scale:i,rotation:s})}function _e(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):(St('Not a valid color format: "'.concat(t,'"')),[0,0,0])}function xe(t){const{a:e,b:i,c:s,d:n,e:a,f:r}=t.getTransform();return[e,i,s,n,a,r]}function Ee(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 ke(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 he){const{pageWidth:s,pageHeight:n}=e.rawDims,{style:a}=t,r=zt.isCSSRoundSupported,o="var(--scale-factor) * ".concat(s,"px"),l="var(--scale-factor) * ".concat(n,"px"),h=r?"round(down, ".concat(o,", var(--scale-round-x, 1px))"):"calc(".concat(o,")"),c=r?"round(down, ".concat(l,", var(--scale-round-y, 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)}class Se{constructor(){const t=window.devicePixelRatio||1;this.sx=t,this.sy=t}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}}var Me=new WeakMap,Ce=new WeakMap,Te=new WeakMap,Re=new WeakMap,Pe=new WeakMap,Le=new WeakSet;class Ie{constructor(t){r(this,Le),o(this,Me,null),o(this,Ce,null),o(this,Te,void 0),o(this,Re,null),o(this,Pe,null),d(Te,this,t),Be._||(Be._=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"}))}render(){const t=d(Me,this,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=c(Te,this)._uiManager._signal;t.addEventListener("contextmenu",ve,{signal:e}),t.addEventListener("pointerdown",De,{signal:e});const i=d(Re,this,document.createElement("div"));i.className="buttons",t.append(i);const s=c(Te,this).toolbarPosition;if(s){const{style:e}=t,i="ltr"===c(Te,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 l(Le,this,We).call(this),t}get div(){return c(Me,this)}hide(){var t;c(Me,this).classList.add("hidden"),null===(t=c(Ce,this))||void 0===t||t.hideDropdown()}show(){var t;c(Me,this).classList.remove("hidden"),null===(t=c(Pe,this))||void 0===t||t.shown()}async addAltText(t){const e=await t.render();l(Le,this,Ne).call(this,e),c(Re,this).prepend(e,h(Le,this,je)),d(Pe,this,t)}addColorPicker(t){d(Ce,this,t);const e=t.renderButton();l(Le,this,Ne).call(this,e),c(Re,this).prepend(e,h(Le,this,je))}remove(){var t;c(Me,this).remove(),null===(t=c(Ce,this))||void 0===t||t.destroy(),d(Ce,this,null)}}function De(t){t.stopPropagation()}function Fe(t){c(Te,this)._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}function Oe(t){c(Te,this)._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}function Ne(t){const e=c(Te,this)._uiManager._signal;t.addEventListener("focusin",l(Le,this,Fe).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",l(Le,this,Oe).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",ve,{signal:e})}function We(){const{editorType:t,_uiManager:e}=c(Te,this),i=document.createElement("button");i.className="delete",i.tabIndex=0,i.setAttribute("data-l10n-id",Be._[t]),l(Le,this,Ne).call(this,i),i.addEventListener("click",(t=>{e.delete()}),{signal:e._signal}),c(Re,this).append(i)}function je(t){const e=document.createElement("div");return e.className="divider",e}var Be={_:null},He=new WeakMap,ze=new WeakMap,Ge=new WeakMap,Ve=new WeakSet;
1class Ue{constructor(t){r(this,Ve),o(this,He,null),o(this,ze,null),o(this,Ge,void 0),d(Ge,this,t)}show(t,e,i){const[s,n]=l(Ve,this,Xe).call(this,e,i),{style:a}=c(ze,this)||d(ze,this,l(Ve,this,qe).call(this));t.append(c(ze,this)),a.insetInlineEnd="".concat(100*s,"%"),a.top="calc(".concat(100*n,"% + var(--editor-toolbar-vert-offset))")}hide(){c(ze,this).remove()}}function qe(){const t=d(ze,this,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",ve,{signal:c(Ge,this)._signal});const e=d(He,this,document.createElement("div"));return e.className="buttons",t.append(e),l(Ve,this,Ke).call(this),t}function Xe(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 Ke(){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=c(Ge,this)._signal;t.addEventListener("contextmenu",ve,{signal:i}),t.addEventListener("click",(()=>{c(Ge,this).highlightSelection("floating_button")}),{signal:i}),c(He,this).append(t)}function Ye(t,e,i){for(const s of i)e.addEventListener(s,t[s].bind(t))}var Qe=new WeakMap;class Je{constructor(){o(this,Qe,0)}get id(){var t,e;return"".concat("pdfjs_internal_editor_").concat((d(Qe,this,(t=c(Qe,this),e=t++,t)),e))}}var Ze=new WeakMap,$e=new WeakMap,ti=new WeakMap,ei=new WeakSet;class ii{constructor(){r(this,ei),o(this,Ze,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 jt(i)}()),o(this,$e,0),o(this,ti,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 l(ei,this,si).call(this,"".concat(e,"_").concat(i,"_").concat(s,"_").concat(n),t)}async getFromUrl(t){return l(ei,this,si).call(this,t,t)}async getFromBlob(t,e){const i=await e;return l(ei,this,si).call(this,t,i)}async getFromId(t){c(ti,this)||d(ti,this,new Map);const e=c(ti,this).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){const{blobPromise:t}=e;return delete e.blobPromise,this.getFromBlob(e.id,t)}return this.getFromUrl(e.url)}getFromCanvas(t,e){var i,s,n;c(ti,this)||d(ti,this,new Map);let a=c(ti,this).get(t);if(null!==(n=a)&&void 0!==n&&n.bitmap)return a.refCounter+=1,a;const r=new OffscreenCanvas(e.width,e.height);return r.getContext("2d").drawImage(e,0,0),a={bitmap:r.transferToImageBitmap(),id:"image_".concat(c(Ze,this),"_").concat((d($e,this,(i=c($e,this),s=i++,i)),s)),refCounter:1,isSvg:!1},c(ti,this).set(t,a),c(ti,this).set(a.id,a),a}getSvgUrl(t){const e=c(ti,this).get(t);return null!==e&&void 0!==e&&e.isSvg?e.svgUrl:null}deleteId(t){var e;c(ti,this)||d(ti,this,new Map);const i=c(ti,this).get(t);if(!i)return;if(i.refCounter-=1,0!==i.refCounter)return;const{bitmap:s}=i;if(!i.url&&!i.file){const t=new OffscreenCanvas(s.width,s.height);t.getContext("bitmaprenderer").transferFromImageBitmap(s),i.blobPromise=t.convertToBlob()}null===(e=s.close)||void 0===e||e.call(s),i.bitmap=null}isValidId(t){return t.startsWith("image_".concat(c(Ze,this),"_"))}}async function si(t,e){var i;c(ti,this)||d(ti,this,new Map);let s=c(ti,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(c(Ze,this),"_").concat((d($e,this,(n=c($e,this),a=n++,n)),a)),refCounter:0,isSvg:!1}),"string"===typeof e?(s.url=e,t=await le(e,"blob")):e instanceof File?t=s.file=e:e instanceof Blob&&(t=e),"image/svg+xml"===t.type){const e=f._isSVGFittingCanvas,i=new FileReader,n=new Image,a=new Promise(((t,a)=>{n.onload=()=>
1{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 c(ti,this).set(t,s),s&&c(ti,this).set(s.id,s),s}f=ii;var ni=new WeakMap,ai=new WeakMap,ri=new WeakMap,oi=new WeakMap;class li{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;o(this,ni,[]),o(this,ai,!1),o(this,ri,void 0),o(this,oi,-1),d(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(),c(ai,this))return;const l={cmd:e,undo:i,post:s,type:a};if(-1===c(oi,this))return c(ni,this).length>0&&(c(ni,this).length=0),d(oi,this,0),void c(ni,this).push(l);if(r&&c(ni,this)[c(oi,this)].type===a)return o&&(l.undo=c(ni,this)[c(oi,this)].undo),void(c(ni,this)[c(oi,this)]=l);const h=c(oi,this)+1;h===c(ri,this)?c(ni,this).splice(0,1):(d(oi,this,h),h<c(ni,this).length&&c(ni,this).splice(h)),c(ni,this).push(l)}undo(){if(-1===c(oi,this))return;d(ai,this,!0);const{undo:t,post:e}=c(ni,this)[c(oi,this)];t(),null===e||void 0===e||e(),d(ai,this,!1),d(oi,this,c(oi,this)-1)}redo(){if(c(oi,this)<c(ni,this).length-1){d(oi,this,c(oi,this)+1),d(ai,this,!0);const{cmd:t,post:e}=c(ni,this)[c(oi,this)];t(),null===e||void 0===e||e(),d(ai,this,!1)}}hasSomethingToUndo(){return-1!==c(oi,this)}hasSomethingToRedo(){return c(oi,this)<c(ni,this).length-1}destroy(){d(ni,this,null)}}var hi=new WeakSet;class ci{constructor(t){r(this,hi),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=zt.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(l(hi,this,di).call(this,e));if(!i)return;const{callback:s,options:{bubbles:n=!1,args:a=[],checker:r=null}}=i;r&&!r(t,e)||(s.bind(t,...a,e)(),n||(e.stopPropagation(),e.preventDefault()))}}function di(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 ui{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,_e(s))}e.remove()}(t),Rt(this,"_colors",t)}convert(t){const e=_e(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 ui._colorsMapping.get(i);return e}getHexCode(t){const e=this._colors.get(t);return e?Vt.makeHexColor(...e):t}}(0,E.A)(ui,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));var pi=new WeakMap,fi=new WeakMap,gi=new WeakMap,mi=new WeakMap,vi=new WeakMap,bi=new WeakMap,Ai=new WeakMap,wi=new WeakMap,yi=new WeakMap,_i=new WeakMap,xi=new WeakMap,Ei=new WeakMap,ki=new WeakMap,Si=new WeakMap,Mi=new WeakMap,Ci=new WeakMap,Ti=new WeakMap,Ri=new WeakMap,Pi=new WeakMap,Li=new WeakMap,Ii=new WeakMap,Di=new WeakMap,Fi=new WeakMap,Oi=new WeakMap,Ni=new WeakMap,Wi=new WeakMap,ji=new WeakMap,Bi=new WeakMap,Hi=new WeakMap,zi=new WeakMap,Gi=new WeakMap,Vi=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 WeakSet;class es{static get _keyboardManager(){const t=es.prototype,e=t=>c(Ji,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 ci([[["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)&&c(Ji,t).contains(i)&&!t.isEnterHandled}}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&c(Ji,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,a,h,u,p,f,g){r(this,ts),o(this,pi,new AbortController),o(this,fi,null),o(this,gi,new Map),o(this,mi,new Map),o(this,vi,null),o(this,bi,null),o(this,Ai,null),o(this,wi,new li),o(this,yi,null),o(this,_i,0),o(this,xi,new Set),o(this,Ei,null),o(this,ki,null),o(this,Si,new Set),o(this,Mi,!1),o(this,Ci,!1),o(this,Ti,!1),o(this,Ri,null),o(this,Pi,null),o(this,Li,null),o(this,Ii,null),o(this,Di,!1),o(this,Fi,null),o(this,Oi,new Je),o(this,Ni,!1),o(this,Wi,!1),o(this,ji,null),o(this,Bi,null),o(this,Hi,null),o(this,zi,null),o(this,Gi,B.NONE),o(this,Vi,new Set),o(this,Ui,null),o(this,qi,null),o(this,Xi,null),o(this,Ki,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),o(this,Yi,[0,0]),o(this,Qi,null),o(this,Ji,null),o(this,Zi,null),o(this,$i,null);const m=this._signal=c(pi,this).signal;d(Ji,this,t),d(Zi,this,e),d(vi,this,i),this._eventBus=s,s._on("editingaction",this.onEditingAction.bind(this),{signal:m}),s._on("pagechanging",this.onPageChanging.bind(this),{signal:m}),s._on("scalechanging",this.onScaleChanging.bind(this),{signal:m}),s._on("rotationchanging",this.onRotationChanging.bind(this),{signal:m}),s._on("setpreference",this.onSetPreference.bind(this),{signal:m}),s._on("switchannotationeditorparams",(t=>this.updateParams(t.type,t.value)),{signal:m}),l(ts,this,os).call(this),l(ts,this,fs).call(this),l(ts,this,cs).call(this),d(bi,this,n.annotationStorage),d(Ri,this,n.filterFactory),d(qi,this,a),d(Ii,this,h||null),d(Mi,this,u),d(Ci,this,p),d(Ti,this,f),d(zi,this,g||null),this.viewParameters={realScale:oe.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){var t,e,i,s;null===(t=c($i,this))||void 0===t||t.resolve(),d($i,this,null),null===(e=c(pi,this))||void 0===e||e.abort(),d(pi,this,null),this._signal=null;for(const n of c(mi,this).values())n.destroy();c(mi,this).clear(),c(gi,this).clear(),c(Si,this).clear(),d(fi,this,null),
1c(Vi,this).clear(),c(wi,this).destroy(),null===(i=c(vi,this))||void 0===i||i.destroy(),null===(s=c(Fi,this))||void 0===s||s.hide(),d(Fi,this,null),c(Pi,this)&&(clearTimeout(c(Pi,this)),d(Pi,this,null)),c(Qi,this)&&(clearTimeout(c(Qi,this)),d(Qi,this,null))}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return c(zi,this)}get useNewAltTextFlow(){return c(Ci,this)}get useNewAltTextWhenAddingImage(){return c(Ti,this)}get hcmFilter(){return Rt(this,"hcmFilter",c(qi,this)?c(Ri,this).addHCMFilter(c(qi,this).foreground,c(qi,this).background):"none")}get direction(){return Rt(this,"direction",getComputedStyle(c(Ji,this)).direction)}get highlightColors(){return Rt(this,"highlightColors",c(Ii,this)?new Map(c(Ii,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){d(Hi,this,t)}editAltText(t){var e;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];null===(e=c(vi,this))||void 0===e||e.editAltText(this,t,i)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference(t){let{name:e,value:i}=t;if("enableNewAltTextWhenAddingImage"===e)d(Ti,this,i)}onPageChanging(t){let{pageNumber:e}=t;d(_i,this,e-1)}focusMainContainer(){c(Ji,this).focus()}findParent(t,e){for(const i of c(mi,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];c(Zi,this).classList.toggle("noUserSelect",t)}addShouldRescale(t){c(Si,this).add(t)}removeShouldRescale(t){c(Si,this).delete(t)}onScaleChanging(t){let{scale:e}=t;this.commitOrRemove(),this.viewParameters.realScale=e*oe.PDF_TO_CSS_UNITS;for(const i of c(Si,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,r=e.toString(),o=l(ts,this,is).call(this,e).closest(".textLayer"),h=this.getSelectionBoxes(o);if(!h)return;e.empty();const d=l(ts,this,ss).call(this,o),u=c(Gi,this)===B.NONE,p=()=>{null===d||void 0===d||d.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:i,anchorOffset:s,focusNode:n,focusOffset:a,text:r}),u&&this.showAllEditors("highlight",!0,!0)};u?this.switchToMode(B.HIGHLIGHT,p):p()}addToAnnotationStorage(t){t.isEmpty()||!c(bi,this)||c(bi,this).has(t.id)||c(bi,this).setValue(t.id,t)}blur(){if(this.isShiftKeyDown=!1,c(Di,this)&&(d(Di,this,!1),l(ts,this,rs).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of c(Vi,this))if(e.div.contains(t)){d(Bi,this,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!c(Bi,this))return;const[t,e]=c(Bi,this);d(Bi,this,null),e.addEventListener("focusin",(()=>{t._focusEventsAllowed=!0}),{once:!0,signal:this._signal}),e.focus()}addEditListeners(){l(ts,this,cs).call(this),l(ts,this,us).call(this)}removeEditListeners(){l(ts,this,ds).call(this),l(ts,this,ps).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const i of c(ki,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 c(ki,this))if(i.isHandlingMimeForPasting(e.type))return i.paste(e,this.currentLayer),void t.preventDefault()}copy(t){var e;if(t.preventDefault(),null===(e=c(fi,this))||void 0===e||e.commitOrRemove(),!this.hasSelection)return;const i=[];for(const s of c(Vi,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()}async paste(t){t.preventDefault();const{clipboardData:e}=t;for(const a of e.items)for(const t of c(ki,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 St('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=await s.deserialize(a);if(!e)return;t.push(e)}const e=()=>{for(const e of t)l(ts,this,As).call(this,e);l(ts,this,_s).call(this,t)},n=()=>{for(const e of t)e.remove()};this.addCommands({cmd:e,undo:n,mustExec:!0})}catch(n){St('paste: "'.concat(n.message,'".'))}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),c(Gi,this)===B.NONE||this.isEditorHandlingKeyboard||es._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,c(Di,this)&&(d(Di,this,!1),l(ts,this,rs).c
1all(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?(l(ts,this,ls).call(this),l(ts,this,us).call(this),l(ts,this,gs).call(this,{isEditing:c(Gi,this)!==B.NONE,isEmpty:l(ts,this,ys).call(this),hasSomethingToUndo:c(wi,this).hasSomethingToUndo(),hasSomethingToRedo:c(wi,this).hasSomethingToRedo(),hasSelectedEditor:!1})):(l(ts,this,hs).call(this),l(ts,this,ps).call(this),l(ts,this,gs).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!c(ki,this)){d(ki,this,t);for(const t of c(ki,this))l(ts,this,ms).call(this,t.defaultPropertiesToUpdate)}}getId(){return c(Oi,this).id}get currentLayer(){return c(mi,this).get(c(_i,this))}getLayer(t){return c(mi,this).get(t)}get currentPageIndex(){return c(_i,this)}addLayer(t){c(mi,this).set(t.pageIndex,t),c(Ni,this)?t.enable():t.disable()}removeLayer(t){c(mi,this).delete(t.pageIndex)}async 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(c(Gi,this)!==t&&(!c($i,this)||(await c($i,this).promise,c($i,this)))){if(d($i,this,Promise.withResolvers()),d(Gi,this,t),t===B.NONE)return this.setEditingState(!1),l(ts,this,bs).call(this),void c($i,this).resolve();this.setEditingState(!0),await l(ts,this,vs).call(this),this.unselectAll();for(const e of c(mi,this).values())e.updateMode(t);if(!e)return i&&this.addNewEditorFromKeyboard(),void c($i,this).resolve();for(const t of c(gi,this).values())t.annotationElementId===e?(this.setSelected(t),t.enterInEditMode()):t.unselect();c($i,this).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==c(Gi,this)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){var i;if(c(ki,this)){switch(t){case H.CREATE:return void this.currentLayer.addNewEditor();case H.HIGHLIGHT_DEFAULT_COLOR:null===(i=c(Hi,this))||void 0===i||i.updateColor(e);break;case H.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(c(Xi,this)||d(Xi,this,new Map)).set(t,e),this.showAllEditors("highlight",e)}for(const i of c(Vi,this))i.updateParams(t,e);for(const i of c(ki,this))i.updateDefaultParams(t,e)}}showAllEditors(t,e){var i,s;for(const n of c(gi,this).values())n.editorType===t&&n.show(e);(null===(i=null===(s=c(Xi,this))||void 0===s?void 0:s.get(H.HIGHLIGHT_SHOW_ALL))||void 0===i||i)!==e&&l(ts,this,ms).call(this,[[H.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(c(Wi,this)!==t){d(Wi,this,t);for(const e of c(mi,this).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}getEditors(t){const e=[];for(const i of c(gi,this).values())i.pageIndex===t&&e.push(i);return e}getEditor(t){return c(gi,this).get(t)}addEditor(t){c(gi,this).set(t.id,t)}removeEditor(t){var e;(t.div.contains(document.activeElement)&&(c(Pi,this)&&clearTimeout(c(Pi,this)),d(Pi,this,setTimeout((()=>{this.focusMainContainer(),d(Pi,this,null)}),0))),c(gi,this).delete(t.id),this.unselect(t),t.annotationElementId&&c(xi,this).has(t.annotationElementId))||(null===(e=c(bi,this))||void 0===e||e.remove(t.id))}addDeletedAnnotationElement(t){c(xi,this).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return c(xi,this).has(t)}removeDeletedAnnotationElement(t){c(xi,this).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){c(fi,this)!==t&&(d(fi,this,t),t&&l(ts,this,ms).call(this,t.propertiesToUpdate))}updateUI(t){h(ts,this,ws)===t&&l(ts,this,ms).call(this,t.propertiesToUpdate)}toggleSelected(t){if(c(Vi,this).has(t))return c(Vi,this).delete(t),t.unselect(),void l(ts,this,gs).call(this,{hasSelectedEditor:this.hasSelection});c(Vi,this).add(t),t.select(),l(ts,this,ms).call(this,t.propertiesToUpdate),l(ts,this,gs).call(this,{hasSelectedEditor:!0})}setSelected(t){for(const e of c(Vi,this))e!==t&&e.unselect();c(Vi,this).clear(),c(Vi,this).add(t),t.select(),l(ts,this,ms).call(this,t.propertiesToUpdate),l(ts,this,gs).call(this,{hasSelectedEditor:!0})}isSelected(t){return c(Vi,this).has(t)}get firstSelectedEditor(){return c(Vi,this).values().next().value}unselect(t){t.unselect(),c(Vi,this).delete(t),l(ts,this,gs).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==c(Vi,this).size}get isEnterHandled(){return 1===c(Vi,this).size&&this.firstSelectedEditor.isEnterHandled}
1undo(){c(wi,this).undo(),l(ts,this,gs).call(this,{hasSomethingToUndo:c(wi,this).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:l(ts,this,ys).call(this)})}redo(){c(wi,this).redo(),l(ts,this,gs).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:c(wi,this).hasSomethingToRedo(),isEmpty:l(ts,this,ys).call(this)})}addCommands(t){c(wi,this).add(t),l(ts,this,gs).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:l(ts,this,ys).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...c(Vi,this)];this.addCommands({cmd:()=>{for(const e of t)e.remove()},undo:()=>{for(const e of t)l(ts,this,As).call(this,e)},mustExec:!0})}commitOrRemove(){var t;null===(t=c(fi,this))||void 0===t||t.commitOrRemove()}hasSomethingToControl(){return c(fi,this)||this.hasSelection}selectAll(){for(const t of c(Vi,this))t.commit();l(ts,this,_s).call(this,c(gi,this).values())}unselectAll(){if((!c(fi,this)||(c(fi,this).commitOrRemove(),c(Gi,this)===B.NONE))&&this.hasSelection){for(const t of c(Vi,this))t.unselect();c(Vi,this).clear(),l(ts,this,gs).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]||this.commitOrRemove(),!this.hasSelection)return;c(Yi,this)[0]+=t,c(Yi,this)[1]+=e;const[i,s]=c(Yi,this),n=[...c(Vi,this)];c(Qi,this)&&clearTimeout(c(Qi,this)),d(Qi,this,setTimeout((()=>{d(Qi,this,null),c(Yi,this)[0]=c(Yi,this)[1]=0,this.addCommands({cmd:()=>{for(const t of n)c(gi,this).has(t.id)&&t.translateInPage(i,s)},undo:()=>{for(const t of n)c(gi,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),d(Ei,this,new Map);for(const t of c(Vi,this))c(Ei,this).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!c(Ei,this))return!1;this.disableUserSelect(!1);const t=c(Ei,this);d(Ei,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(c(gi,this).has(t.id)){const n=c(mi,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(c(Ei,this))for(const i of c(Ei,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===c(Vi,this).size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return c(fi,this)===t}getActive(){return c(fi,this)}getMode(){return c(Gi,this)}get imageManager(){return Rt(this,"imageManager",new ii)}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;(c(Ai,this)||d(Ai,this,new Map)).set(e,i)}removeChangedExistingAnnotation(t){var e;let{annotationElementId:i}=t;null===(e=c(Ai,this))||void 0===e||e.delete(i)}renderAnnotationElement(t){var e;const i=null===(e=c(Ai,this))||void 0===e?void 0:e.get(t.data.id);if(!i)return;const s=c(bi,this).getRawValue(i);s&&(c(Gi,this)!==B.NONE||s.hasBeenModified)&&s.renderAnnotationElement(t)}}function is(t){let{anchorNode:e}=t;
1return e.nodeType===Node.TEXT_NODE?e.parentElement:e}function ss(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const i of c(mi,this).values())if(i.hasTextLayer(t))return i;return null}function ns(){const t=document.getSelection();if(!t||t.isCollapsed)return;const e=l(ts,this,is).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&(c(Fi,this)||d(Fi,this,new Ue(this)),c(Fi,this).show(e,i,"ltr"===this.direction))}function as(){var t;const e=document.getSelection();if(!e||e.isCollapsed){var i;if(c(Ui,this))null===(i=c(Fi,this))||void 0===i||i.hide(),d(Ui,this,null),l(ts,this,gs).call(this,{hasSelectedText:!1});return}const{anchorNode:s}=e;if(s===c(Ui,this))return;const n=l(ts,this,is).call(this,e).closest(".textLayer");var a;if(n){if(null===(t=c(Fi,this))||void 0===t||t.hide(),d(Ui,this,s),l(ts,this,gs).call(this,{hasSelectedText:!0}),(c(Gi,this)===B.HIGHLIGHT||c(Gi,this)===B.NONE)&&(c(Gi,this)===B.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),d(Di,this,this.isShiftKeyDown),!this.isShiftKeyDown)){const t=c(Gi,this)===B.HIGHLIGHT?l(ts,this,ss).call(this,n):null;null===t||void 0===t||t.toggleDrawing();const e=new AbortController,i=this.combinedSignal(e),s=i=>{"pointerup"===i.type&&0!==i.button||(e.abort(),null===t||void 0===t||t.toggleDrawing(!0),"pointerup"===i.type&&l(ts,this,rs).call(this,"main_toolbar"))};window.addEventListener("pointerup",s,{signal:i}),window.addEventListener("blur",s,{signal:i})}}else c(Ui,this)&&(null===(a=c(Fi,this))||void 0===a||a.hide(),d(Ui,this,null),l(ts,this,gs).call(this,{hasSelectedText:!1}))}function rs(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";c(Gi,this)===B.HIGHLIGHT?this.highlightSelection(t):c(Mi,this)&&l(ts,this,ns).call(this)}function os(){document.addEventListener("selectionchange",l(ts,this,as).bind(this),{signal:this._signal})}function ls(){if(c(Li,this))return;d(Li,this,new AbortController);const t=this.combinedSignal(c(Li,this));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}function hs(){var t;null===(t=c(Li,this))||void 0===t||t.abort(),d(Li,this,null)}function cs(){if(c(ji,this))return;d(ji,this,new AbortController);const t=this.combinedSignal(c(ji,this));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})}function ds(){var t;null===(t=c(ji,this))||void 0===t||t.abort(),d(ji,this,null)}function us(){if(c(yi,this))return;d(yi,this,new AbortController);const t=this.combinedSignal(c(yi,this));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})}function ps(){var t;null===(t=c(yi,this))||void 0===t||t.abort(),d(yi,this,null)}function fs(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}function gs(t){Object.entries(t).some((t=>{let[e,i]=t;return c(Ki,this)[e]!==i}))&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(c(Ki,this),t)}),c(Gi,this)===B.HIGHLIGHT&&!1===t.hasSelectedEditor&&l(ts,this,ms).call(this,[[H.HIGHLIGHT_FREE,!0]]))}function ms(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}async function vs(){if(!c(Ni,this)){d(Ni,this,!0);const t=[];for(const e of c(mi,this).values())t.push(e.enable());await Promise.all(t);for(const e of c(gi,this).values())e.enable()}}function bs(){if(this.unselectAll(),c(Ni,this)){d(Ni,this,!1);for(const t of c(mi,this).values())t.disable();for(const t of c(gi,this).values())t.disable()}}function As(t){const e=c(mi,this).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}function ws(t){let e=null;for(e of c(Vi,t));return e}function ys(){if(0===c(gi,this).size)return!0;if(1===c(gi,this).size)for(const t of c(gi,this).values())return t.isEmpty();return!1}function _s(t){for(const e of c(Vi,this))e.unselect();c(Vi,this).clear();for(const e of t)e.isEmpty()||(c(Vi,this).add(e),e.select());l(ts,this,gs).call(this,{hasSelectedEditor:this.hasSelection})}(0,E.A)(es,"TRANSLATE_SMALL",1),(0,E.A)(es,"TRANSLATE_BIG",10);var xs=new WeakMap,Es=new WeakMap,ks=new WeakMap,Ss=new WeakMap,Ms=new WeakMap,Cs=new WeakMap,Ts=new WeakMap,Rs=new WeakMap,Ps=new WeakMap,Ls=new WeakMap,Is=new WeakMap,Ds=new WeakMap,Fs=new WeakSet;class Os{constructor(t){r(this,Fs),o(this,xs,null),o(this,Es,!1),o(this,ks,null),o(this,Ss,null),o(this,Ms,null),o(this,Cs,null),o(this,Ts,!1),o(this,Rs,null),o(this,Ps,null),o(this,Ls,null),o(this,Is,null),o(this,Ds,!1),d(Ps,this,t),d(Ds,this,t._uiManager.useNewAltTextFlow),js._||(js._=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(t){var e;null!==(e=Os._l10n)&&void 0!==e||(Os._l10n=t)}async render(){const t=d(ks,this,document.createElement("button"));t.className="altText",t.tabIndex="0";
1const e=d(Ss,this,document.createElement("span"));t.append(e),c(Ds,this)?(t.classList.add("new"),t.setAttribute("data-l10n-id",js._.missing),e.setAttribute("data-l10n-id",js._["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const i=c(Ps,this)._uiManager._signal;t.addEventListener("contextmenu",ve,{signal:i}),t.addEventListener("pointerdown",(t=>t.stopPropagation()),{signal:i});const s=t=>{t.preventDefault(),c(Ps,this)._uiManager.editAltText(c(Ps,this)),c(Ds,this)&&c(Ps,this)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:h(Fs,this,Ns)}})};return t.addEventListener("click",s,{capture:!0,signal:i}),t.addEventListener("keydown",(e=>{e.target===t&&"Enter"===e.key&&(d(Ts,this,!0),s(e))}),{signal:i}),await l(Fs,this,Ws).call(this),t}finish(){c(ks,this)&&(c(ks,this).focus({focusVisible:c(Ts,this)}),d(Ts,this,!1))}isEmpty(){return c(Ds,this)?null===c(xs,this):!c(xs,this)&&!c(Es,this)}hasData(){return c(Ds,this)?null!==c(xs,this)||!!c(Ls,this):this.isEmpty()}get guessedText(){return c(Ls,this)}async setGuessedText(t){null===c(xs,this)&&(d(Ls,this,t),d(Is,this,await Os._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),l(Fs,this,Ws).call(this))}toggleAltTextBadge(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];var e;if(!c(Ds,this)||c(xs,this))return null===(e=c(Rs,this))||void 0===e||e.remove(),void d(Rs,this,null);if(!c(Rs,this)){const t=d(Rs,this,document.createElement("div"));t.className="noAltTextBadge",c(Ps,this).div.append(t)}c(Rs,this).classList.toggle("hidden",!t)}serialize(t){let e=c(xs,this);return t||c(Ls,this)!==e||(e=c(Is,this)),{altText:e,decorative:c(Es,this),guessedText:c(Ls,this),textWithDisclaimer:c(Is,this)}}get data(){return{altText:c(xs,this),decorative:c(Es,this)}}set data(t){let{altText:e,decorative:i,guessedText:s,textWithDisclaimer:n,cancel:a=!1}=t;s&&(d(Ls,this,s),d(Is,this,n)),c(xs,this)===e&&c(Es,this)===i||(a||(d(xs,this,e),d(Es,this,i)),l(Fs,this,Ws).call(this))}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];c(ks,this)&&(!t&&c(Cs,this)&&(clearTimeout(c(Cs,this)),d(Cs,this,null)),c(ks,this).disabled=!t)}shown(){c(Ps,this)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:h(Fs,this,Ns)}})}destroy(){var t,e;null===(t=c(ks,this))||void 0===t||t.remove(),d(ks,this,null),d(Ss,this,null),d(Ms,this,null),null===(e=c(Rs,this))||void 0===e||e.remove(),d(Rs,this,null)}}function Ns(t){return(c(xs,t)?"added":null===c(xs,t)&&t.guessedText&&"review")||"missing"}async function Ws(){const t=c(ks,this);if(!t)return;if(c(Ds,this)){var e,i;if(t.classList.toggle("done",!!c(xs,this)),t.setAttribute("data-l10n-id",js._[h(Fs,this,Ns)]),null===(e=c(Ss,this))||void 0===e||e.setAttribute("data-l10n-id",js._["".concat(h(Fs,this,Ns),"-label")]),!c(xs,this))return void(null===(i=c(Ms,this))||void 0===i||i.remove())}else{var s;if(!c(xs,this)&&!c(Es,this))return t.classList.remove("done"),void(null===(s=c(Ms,this))||void 0===s||s.remove());t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let n=c(Ms,this);if(!n){d(Ms,this,n=document.createElement("span")),n.className="tooltip",n.setAttribute("role","tooltip"),n.id="alt-text-tooltip-".concat(c(Ps,this).id);const e=100,i=c(Ps,this)._uiManager._signal;i.addEventListener("abort",(()=>{clearTimeout(c(Cs,this)),d(Cs,this,null)}),{once:!0}),t.addEventListener("mouseenter",(()=>{d(Cs,this,setTimeout((()=>{d(Cs,this,null),c(Ms,this).classList.add("show"),c(Ps,this)._reportTelemetry({action:"alt_text_tooltip"})}),e))}),{signal:i}),t.addEventListener("mouseleave",(()=>{var t;c(Cs,this)&&(clearTimeout(c(Cs,this)),d(Cs,this,null)),null===(t=c(Ms,this))||void 0===t||t.classList.remove("show")}),{signal:i})}c(Es,this)?n.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(n.removeAttribute("data-l10n-id"),n.textContent=c(xs,this)),n.parentNode||t.append(n);const a=c(Ps,this).getImageForAltText();null===a||void 0===a||a.setAttribute("aria-describedby",n.id)}var js={_:null};(0,E.A)(Os,"_l10n",null);var Bs=new WeakMap,Hs=new WeakMap,zs=new WeakMap,Gs=new WeakMap,Vs=new WeakMap,Us=new WeakMap,qs=new WeakMap,Xs=new WeakMap,Ks=new WeakMap,Ys=new WeakMap,Qs=new WeakMap,Js=new WeakMap,Zs=new WeakMap,$s=new WeakMap,tn=new WeakMap,en=new WeakMap,sn=new WeakMap,nn=new WeakMap,an=new WeakMap,rn=new WeakMap,on=new WeakSet;class ln{static get _resizerKeyboardManager(){const t=ln.prototype._resizeWithKeyboard,e=es.TRANSLATE_SMALL,i=es.TRANSLATE_BIG;return Rt(this,"_resizerKeyboardManager",new ci([[["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"],ln.prototype._stopResizingWithKeyboard]]))}constructor(t){r(this,on),o(this,Bs,null),o(this,Hs,null),o(this,zs,null),o(this,Gs,!1),o(this,Vs,!1),o(this,Us,null),o(this,qs,null),o(this,Xs,null),o(this,Ks,""),o(this,Ys,!1),o(this,Qs,null),o(this,Js,!1),o(this,Zs,!1),o(this,$s,!1),o(this,tn,null),o(this,en,0),o(this,sn,0),o(this,nn,null),(0,E.A)(this,"_editToolbar",null),(0,E.A)(this,"_initialOptions",Object.create(null)),(0,E.A)(this,"_initialData",null),(0,E.A)(this,"_isVisible",!0),(0,E.A)(this,"_uiManager",null),(0,E.A)(this,"_focusEventsAllowed",!0),o(this,an,!1),o(this,rn,ln._zIndex++),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:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,s],this.pageTranslation=[n,a];const[l,h]=this.parentDimensions;this.x=t.x/l,this.y=t.y/h,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 En({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){var i;if(null!==(i=ln._l10n)&&void 0!==i||(ln._l10n=t),ln._l10nResizer||(ln._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),-1!==ln._borderLineWidth)return;const s=getComputedStyle(document.documentElement);ln._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){Mt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return c(an,this)}set _isDraggable(t){var e;d(an,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}
1setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=c(rn,this)}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):l(on,this,xn).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&(c(Ys,this)?d(Ys,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){l(on,this,hn).call(this,this.parentDimensions,t,e)}translateInPage(t,e){c(Qs,this)||d(Qs,this,[this.x,this.y]),l(on,this,hn).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){c(Qs,this)||d(Qs,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!!c(Qs,this)&&(c(Qs,this)[0]!==this.x||c(Qs,this)[1]!==this.y)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:i}=ln,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 cn.call(ln,t,e,this.parentRotation)}pageTranslationToScreen(t,e){return cn.call(ln,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;return[e*t,i*t]}setDims(t,e){const[i,s]=this.parentDimensions;this.div.style.width="".concat((100*t/i).toFixed(2),"%"),c(Vs,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=!c(Vs,this)&&e.endsWith("%");if(s&&n)return;const[a,r]=this.parentDimensions;s||(t.width="".concat((100*parseFloat(i)/a).toFixed(2),"%")),c(Vs,this)||n||(t.height="".concat((100*parseFloat(e)/r).toFixed(2),"%"))}getInitialTranslation(){return[0,0]}altTextFinish(){var t;null===(t=c(zs,this))||void 0===t||t.finish()}async addEditToolbar(){return this._editToolbar||c(Zs,this)||(this._editToolbar=new Ie(this),this.div.append(this._editToolbar.render()),c(zs,this)&&await this._editToolbar.addAltText(c(zs,this))),this._editToolbar}removeEditToolbar(){var t;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,null===(t=c(zs,this))||void 0===t||t.destroy())}addContainer(t){var e;const i=null===(e=this._editToolbar)||void 0===e?void 0:e.div;i?i.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){c(zs,this)||(Os.initialize(ln._l10n),d(zs,this,new Os(this)),c(Bs,this)&&(c(zs,this).data=c(Bs,this),d(Bs,this,null)),await this.addEditToolbar())}get altTextData(){var t;return null===(t=c(zs,this))||void 0===t?void 0:t.data}set altTextData(t){c(zs,this)&&(c(zs,this).data=t)}get guessedAltText(){var t;return null===(t=c(zs,this))||void 0===t?void 0:t.guessedText}async setGuessedAltText(t){var e;await(null===(e=c(zs,this))||void 0===e?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return null===(e=c(zs,this))||void 0===e?void 0:e.serialize(t)}hasAltText(){return!!c(zs,this)&&!c(zs,this).isEmpty()}hasAltTextData(){var t,e;return null!==(t=null===(e=c(zs,this))||void 0===e?void 0:e.hasData())&&void 0!==t&&t}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=c(Gs,this)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),l(on,this,bn).call(this);const[t,e]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth="".concat((100*e/t).toFixed(2),"%"),this.div.style.maxHeight="".concat((100*t/e).toFixed(2),"%"));const[i,s]=this.getInitialTranslation();return this.translate(i,s),Ye(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:e}=zt.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():(d(Ys,this,!0),this._isDraggable?l(on,this,vn).call(this,t):l(on,this,mn).call(this,t))}get isSelected(){return this._uiManager.isSelected(this)}moveInDOM(){c(tn,this)&&clearTimeout(c(tn,this)),d(tn,this,setTimeout((()=>{var t;d(tn,this,null),null===(t=this.parent)||void 0===t||t.moveEditorInDOM(this)}),0))}
1_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(){d(Zs,this,!0)}disableEditMode(){d(Zs,this,!1)}isInEditMode(){return c(Zs,this)}shouldGetKeyboardEvents(){return c($s,this)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){l(on,this,bn).call(this)}rotate(t){}serializeDeleted(){var t;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:(null===(t=this._initialData)||void 0===t?void 0:t.popupRef)||""}}serialize(){Mt("An editor must be serializable")}static async deserialize(t,e,i){const s=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i});s.rotation=t.rotation,d(Bs,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(){var t;if(null===(t=c(Xs,this))||void 0===t||t.abort(),d(Xs,this,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),c(tn,this)&&(clearTimeout(c(tn,this)),d(tn,this,null)),l(on,this,xn).call(this),this.removeEditToolbar(),c(nn,this)){for(const t of c(nn,this).values())clearTimeout(t);d(nn,this,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(l(on,this,un).call(this),c(Us,this).classList.remove("hidden"),Ye(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),d(qs,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=c(Us,this).children;if(!c(Hs,this)){d(Hs,this,Array.from(e));const t=l(on,this,An).bind(this),i=l(on,this,wn).bind(this),s=this._uiManager._signal;for(const e of c(Hs,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",l(on,this,yn).bind(this,n),{signal:s}),e.setAttribute("data-l10n-id",ln._l10nResizer[n])}}const i=c(Hs,this)[0];let s=0;for(const a of e){if(a===i)break;s++}const n=(360-this.rotation+this.parentRotation)%360/90*(c(Hs,this).length/4);if(n!==s){if(n<s)for(let e=0;e<s-n;e++)c(Us,this).append(c(Us,this).firstChild);else if(n>s)for(let e=0;e<n-s;e++)c(Us,this).firstChild.before(c(Us,this).lastChild);let t=0;for(const i of e){const e=c(Hs,this)[t++].getAttribute("data-resizer-name");i.setAttribute("data-l10n-id",ln._l10nResizer[e])}}l(on,this,_n).call(this,0),d($s,this,!0),c(Us,this).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){c($s,this)&&l(on,this,gn).call(this,c(Ks,this),{movementX:t,movementY:e})}_stopResizingWithKeyboard(){l(on,this,xn).call(this),this.div.focus()}select(){var t,e,i;this.makeResizable(),null===(t=this.div)||void 0===t||t.classList.add("selectedEditor"),this._editToolbar?(null===(e=this._editToolbar)||void 0===e||e.show(),null===(i=c(zs,this))||void 0===i||i.toggleAltTextBadge(!1)):this.addEditToolbar().then((()=>{var t,e;null!==(t=this.div)&&void 0!==t&&t.classList.contains("selectedEditor")&&(null===(e=this._editToolbar)||void 0===e||e.show())}))}unselect(){var t,e,i,s,n;null===(t=c(Us,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=this._editToolbar)||void 0===s||s.hide(),null===(n=c(zs,this))||void 0===n||n.toggleAltTextBadge(!0)}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return c(Js,this)}set isEditing(t){d(Js,this,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){d(Vs,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]){c(nn,this)||d(nn,this,new Map);const{action:e}=t;let i=c(nn,this).get(e);return i&&clearTimeout(i),i=setTimeout((()=>{this._reportTelemetry(t),c(nn,this).delete(e),0===c(nn,this).size&&d(nn,this,null)}),ln._telemetryTimeout),void c(nn,this).set(e,i)}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}
1show(){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),d(Gs,this,!1)}disable(){this.div&&(this.div.tabIndex=-1),d(Gs,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"===(null===e||void 0===e?void 0:e.nodeName)&&e.classList.contains("annotationContent")&&e.remove()}}function hn(t,e,i){let[s,n]=t;[e,i]=this.screenToPageTranslation(e,i),this.x+=e/s,this.y+=i/n,this.fixAndSetPosition()}function cn(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 un(){if(c(Us,this))return;d(Us,this,document.createElement("div")),c(Us,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");c(Us,this).append(t),t.classList.add("resizer",i),t.setAttribute("data-resizer-name",i),t.addEventListener("pointerdown",l(on,this,pn).bind(this,i),{signal:e}),t.addEventListener("contextmenu",ve,{signal:e}),t.tabIndex=-1}this.div.prepend(c(Us,this))}function pn(t,e){var i;e.preventDefault();const{isMac:s}=zt.platform;if(0!==e.button||e.ctrlKey&&s)return;null===(i=c(zs,this))||void 0===i||i.toggle(!1);const n=this._isDraggable;this._isDraggable=!1;const a=new AbortController,r=this._uiManager.combinedSignal(a);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",l(on,this,gn).bind(this,t),{passive:!0,capture:!0,signal:r}),window.addEventListener("contextmenu",ve,{signal:r});const o=this.x,h=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;a.abort(),this.parent.togglePointerEvents(!0),null===(t=c(zs,this))||void 0===t||t.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=p,this.div.style.cursor=f,l(on,this,fn).call(this,o,h,d,u)};window.addEventListener("pointerup",g,{signal:r}),window.addEventListener("blur",g,{signal:r})}function fn(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 gn(t,e){const[i,s]=this.parentDimensions,n=this.x,a=this.y,r=this.width,o=this.height,h=g.MIN_SIZE/i,c=g.MIN_SIZE/s,d=t=>Math.round(1e4*t)/1e4,u=l(on,this,dn).call(this,this.rotation),p=(t,e)=>[u[0]*t+u[2]*e,u[1]*t+u[3]*e],f=l(on,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 w=m(r,o),y=v(r,o);let _=p(...y);const x=d(n+_[0]),E=d(a+_[1]);let k=1,S=1,[M,C]=this.screenToPageTranslation(e.movementX,e.movementY);var T,R;if([M,C]=(T=M/i,R=C/s,[f[0]*T+f[2]*R,f[1]*T+f[3]*R]),b){const t=Math.hypot(r,o);k=S=Math.max(Math.min(Math.hypot(y[0]-w[0]-M,y[1]-w[1]-C)/t,1/r,1/o),h/r,c/o)}else A?k=Math.max(h,Math.min(1,Math.abs(y[0]-w[0]-M)))/r:S=Math.max(c,Math.min(1,Math.abs(y[1]-w[1]-C)))/o;const P=d(r*k),L=d(o*S);_=p(...v(P,L));const I=x-_[0],D=E-_[1];this.width=P,this.height=L,this.x=I,this.y=D,this.setDims(i*P,s*L),this.fixAndSetPosition()}function mn(t){const{isMac:e}=zt.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}function vn(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();const i=new AbortController,s=this._uiManager.combinedSignal(i);if(e){this.div.classList.add("moving"),d(en,this,t.clientX),d(sn,this,t.clientY);const e=t=>{const{clientX:e,clientY:i}=t,[s,n]=this.screenToPageTranslation(e-c(en,this),i-c(sn,this));d(en,this,e),d(sn,this,i),this._uiManager.dragSelectedEditors(s,n)};window.addEventListener("pointermove",e,{passive:!0,capture:!0,signal:s})}const n=()=>{i.abort(),e&&this.div.classList.remove("moving"),d(Ys,this,!1),this._uiManager.endDragSession()||l(on,this,mn).call(this,t)};window.addEventListener("pointerup",n,{signal:s}),window.addEventListener("blur",n,{signal:s})}function bn(){if(c(Xs,this)||!this.div)return;d(Xs,this,new AbortController);const t=this._uiManager.combinedSignal(c(Xs,this));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}function An(t){g._resizerKeyboardManager.exec(this,t)}function wn(t){var e;c($s,this)&&(null===(e=t.relatedTarget)||void 0===e?void 0:e.parentNode)!==c(Us,this)&&l(on,this,xn).call(this)}function yn(t){d(Ks,this,c($s,this)?t:"")}function _n(t){if(c(Hs,this))for(const e of c(Hs,this))e.tabIndex=t}function xn(){if(d($s,this,!1),l(on,this,_n).call(this,-1),c(qs,this)){const{savedX:t,savedY:e,savedWidth:i,savedHeight:s}=c(qs,this);l(on,this,fn).call(this,t,e,i,s),d(qs,this,null)}}g=ln,(0,E.A)(ln,"_l10n",null),(0,E.A)(ln,"_l10nResizer",null),(0,E.A)(ln,"_borderLineWidth",-1),(0,E.A)(ln,"_colorManager",new ui),(0,E.A)(ln,"_zIndex",1),(0,E.A)(ln,"_telemetryTimeout",1e3);class En extends ln{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}
1serialize(){return this.serializeDeleted()}}const kn=3285377520,Sn=4294901760,Mn=65535;class Cn{constructor(t){this.h1=t?4294967295&t:kn,this.h2=t?4294967295&t:kn}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&Sn|r*u&Mn,r=r<<15|r>>>17,r=r*d&Sn|r*p&Mn,l^=r,l=l<<13|l>>>19,l=5*l+3864292196):(o=a[f],o=o*c&Sn|o*u&Mn,o=o<<15|o>>>17,o=o*d&Sn|o*p&Mn,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&Sn|r*u&Mn,r=r<<15|r>>>17,r=r*d&Sn|r*p&Mn,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&Sn|36045*t&Mn,e=4283543511*e&Sn|(2950163797*(e<<16|t>>>16)&Sn)>>>16,t^=e>>>1,t=444984403*t&Sn|60499*t&Mn,e=3301882366*e&Sn|(3120437893*(e<<16|t>>>16)&Sn)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Tn=Object.freeze({map:null,hash:"",transfer:void 0});var Rn=new WeakMap,Pn=new WeakMap,Ln=new WeakMap,In=new WeakSet;class Dn{constructor(){r(this,In),o(this,Rn,!1),o(this,Pn,null),o(this,Ln,new Map),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const i=c(Ln,this).get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return c(Ln,this).get(t)}remove(t){if(c(Ln,this).delete(t),0===c(Ln,this).size&&this.resetModified(),"function"===typeof this.onAnnotationEditor){for(const t of c(Ln,this).values())if(t instanceof ln)return;this.onAnnotationEditor(null)}}setValue(t,e){const i=c(Ln,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,c(Ln,this).set(t,e);s&&l(In,this,Fn).call(this),e instanceof ln&&"function"===typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type)}has(t){return c(Ln,this).has(t)}getAll(){return c(Ln,this).size>0?Ht(c(Ln,this)):null}setAll(t){for(const[e,i]of Object.entries(t))this.setValue(e,i)}get size(){return c(Ln,this).size}resetModified(){c(Rn,this)&&(d(Rn,this,!1),"function"===typeof this.onResetModified&&this.onResetModified())}get print(){return new Nn(this)}get serializable(){if(0===c(Ln,this).size)return Tn;const t=new Map,e=new Cn,i=[],s=Object.create(null);let n=!1;for(const[a,r]of c(Ln,this)){const i=r instanceof ln?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}:Tn}get editorStats(){let t=null;const e=new Map;for(const n of c(Ln,this).values()){var i;if(!(n instanceof ln))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}resetModifiedIds(){d(Pn,this,null)}get modifiedIds(){if(c(Pn,this))return c(Pn,this);const t=[];for(const e of c(Ln,this).values())e instanceof ln&&e.annotationElementId&&e.serialize()&&t.push(e.annotationElementId);return d(Pn,this,{ids:new Set(t),hash:t.join(",")})}}function Fn(){c(Rn,this)||(d(Rn,this,!0),"function"===typeof this.onSetModified&&this.onSetModified())}var On=new WeakMap;class Nn extends Dn{constructor(t){super(),o(this,On,void 0);const{map:e,hash:i,transfer:s}=t.serializable,n=structuredClone(e,s?{transfer:s}:null);d(On,this,{map:n,hash:i,transfer:s})}get print(){Mt("Should not call PrintAnnotationStorage.print")}get serializable(){return c(On,this)}get modifiedIds(){return Rt(this,"modifiedIds",{ids:new Set,hash:""})}}var Wn=new WeakMap;
1class jn{constructor(t){let{ownerDocument:e=globalThis.document,styleElement:i=null}=t;o(this,Wn,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(),c(Wn,this).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(t){let{systemFontInfo:e,_inspectFont:i}=t;if(e&&!c(Wn,this).has(e.loadedName))if(Ct(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:t,src:n,style:a}=e,r=new FontFace(t,n,a);this.addNativeFontFace(r);try{await r.load(),c(Wn,this).add(t),null===i||void 0===i||i(e)}catch(s){St("Cannot load system font: ".concat(e.baseFontName,", installing it could help to improve PDF rendering.")),this.removeNativeFontFace(r)}}else Mt("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 St("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(M||"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(Ct(!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 St("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()}
1))}}class Bn{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="url(data:".concat(this.mimetype,";base64,").concat((i=this.data,Uint8Array.prototype.toBase64?i.toBase64():btoa(jt(i))),");");var i;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(e,"}")}else s='@font-face {font-family:"'.concat(this.loadedName,'";src:').concat(e,"}");return null===(t=this._inspectFont)||void 0===t||t.call(this,this,e),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){St('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 Jt:{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 Zt:{const[t,e]=i.slice(a,a+2);s.push((i=>i.moveTo(t,e))),a+=2}break;case $t:{const[t,e]=i.slice(a,a+2);s.push((i=>i.lineTo(t,e))),a+=2}break;case te:{const[t,e,n,r]=i.slice(a,a+4);s.push((i=>i.quadraticCurveTo(t,e,n,r))),a+=4}break;case ee:s.push((t=>t.restore()));break;case ie:s.push((t=>t.save()));break;case se:Ct(2===s.length,"Scale command is only valid at the third position.");break;case ne:{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 ae:{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)}}}var Hn=new WeakMap;class zn{constructor(t){let{enableHWA:e=!1}=t;o(this,Hn,!1),d(Hn,this,e)}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:!c(Hn,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){Mt("Abstract method `_createCanvas` called.")}}class Gn{constructor(t){let{baseUrl:e=null,isCompressed:i=!0}=t;this.baseUrl=e,this.isCompressed=i}async fetch(t){let{name:e}=t;if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const i=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(i).then((t=>({cMapData:t,isCompressed:this.isCompressed}))).catch((t=>{throw new Error("Unable to load ".concat(this.isCompressed?"binary ":"","CMap at: ").concat(i))}))}async _fetch(t){Mt("Abstract method `_fetch` called.")}}class Vn extends Gn{async _fetch(t){const e=await le(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):Bt(e)}}class Un{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 qn=new WeakMap,Xn=new WeakMap,Kn=new WeakMap,Yn=new WeakMap,Qn=new WeakMap,Jn=new WeakMap,Zn=new WeakMap,$n=new WeakSet;function ta(t){return c(Xn,t)||d(Xn,t,new Map)}function ea(t){return c(Jn,t)||d(Jn,t,new Map)}function ia(t){if(!c(Kn,t)){const e=c(Qn,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=c(Qn,t).createElementNS(re,"svg");s.setAttribute("width",0),s.setAttribute("height",0),d(Kn,t,c(Qn,t).createElementNS(re,"defs")),e.append(s),s.append(c(Kn,t)),c(Qn,t).body.append(e)}return c(Kn,t)}function sa(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 na(t){if(void 0===c(qn,this)){d(qn,this,"");const t=c(Qn,this).URL;t!==c(Qn,this).baseURI&&(de(t)?St('#createUrl: ignore "data:"-URL for performance reasons.'):d(qn,this,t.split("#",1)[0]))}
1return"url(".concat(c(qn,this),"#").concat(t,")")}function aa(t){const e=c(Qn,this).createElementNS(re,"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 ra(t){const e=c(Qn,this).createElementNS(re,"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 oa(t){const e=c(Qn,this).createElementNS(re,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),h($n,this,ia).append(e),e}function la(t,e,i){const s=c(Qn,this).createElementNS(re,e);s.setAttribute("type","discrete"),s.setAttribute("tableValues",i),t.append(s)}function ha(t,e,i,s){const n=c(Qn,this).createElementNS(re,"feComponentTransfer");s.append(n),l($n,this,la).call(this,n,"feFuncR",t),l($n,this,la).call(this,n,"feFuncG",e),l($n,this,la).call(this,n,"feFuncB",i)}function ca(t,e){const i=c(Qn,this).createElementNS(re,"feComponentTransfer");e.append(i),l($n,this,la).call(this,i,"feFuncA",t)}function da(t){return h($n,this,ia).style.color=t,_e(getComputedStyle(h($n,this,ia)).getPropertyValue("color"))}class ua{constructor(t){let{baseUrl:e=null}=t;this.baseUrl=e}async fetch(t){let{filename:e}=t;if(!this.baseUrl)throw new Error("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._fetch(i).catch((t=>{throw new Error("Unable to load font data at: ".concat(i))}))}async _fetch(t){Mt("Abstract method `_fetch` called.")}}class pa extends ua{async _fetch(t){const e=await le(t,"arraybuffer");return new Uint8Array(e)}}if(M){var fa=Promise.withResolvers(),ga=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=>{ga=t,fa.resolve()}),(t=>{St("loadPackages: ".concat(t)),ga=new Map,fa.resolve()}))}class ma{static get promise(){return fa.promise}static get(t){var e;return null===(e=ga)||void 0===e?void 0:e.get(t)}}async function va(t){const e=ma.get("fs"),i=await e.promises.readFile(t);return new Uint8Array(i)}const ba="Fill",Aa="Stroke",wa="Shading";function ya(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 _a{getPattern(){Mt("Abstract method `getPattern` called.")}}class xa extends _a{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===Aa||s===ba){const a=e.current.getClippedPathBoundingBox(s,xe(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),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),ya(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 ya(t,this._bbox),n=this._createGradient(t);return n}}function Ea(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],w=h[a+1],y=h[a+2],_=h[r],x=h[r+1],E=h[r+2],k=h[o],S=h[o+1],M=h[o+2],C=Math.round(f),T=Math.round(b);let R,P,L,I,D,F,O,N;for(let W=C;W<=T;W++){if(W<m){const t=W<f?0:(f-W)/(f-m);R=p-(p-g)*t,P=A-(A-_)*t,L=w-(w-x)*t,I=y-(y-E)*t}else{let t;t=W>b?1:m===b?0:(m-W)/(m-b),R=g-(g-v)*t,P=_-(_-k)*t,L=x-(x-S)*t,I=E-(E-M)*t}let t;t=W<f?0:W>b?1:(f-W)/(f-b),D=p-(p-v)*t,F=A-(A-k)*t,O=w-(w-S)*t,N=y-(y-M)*t;const e=Math.round(Math.min(R,D)),i=Math.round(Math.max(R,D));let s=d*W+4*e;for(let n=e;n<=i;n++)t=(R-n)/(R-D),t<0?t=0:t>1&&(t=1),c[s++]=P-(P-F)*t|0,c[s++]=L-(L-O)*t|0,c[s++]=I-(I-N)*t|0,c[s++]=255}}function ka(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++)Ea(t,i,s[e],s[e+1],s[e+o],n[e],n[e+1],n[e+o]),Ea(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)Ea(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 Sa extends _a{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),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)ka(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(ya(t,this._bbox),s===wa)n=Vt.singularValueDecompose2dScale(xe(t));else if(n=Vt.singularValueDecompose2dScale(e.baseTransform),this.matrix
1){const t=Vt.singularValueDecompose2dScale(this.matrix);n=[n[0]*t[0],n[1]*t[1]]}const a=this._createMeshCanvas(n,s===wa?null:this._background,e.cachedCanvases);return s!==wa&&(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 Ma extends _a{getPattern(){return"hotpink"}}const Ca=1,Ta=2;class Ra{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{bbox:e,operatorList:i,paintType:s,tilingType:n,color:a,canvasGraphicsFactory:r}=this;let{xstep:o,ystep:l}=this;o=Math.abs(o),l=Math.abs(l),kt("TilingType: "+n);const h=e[0],c=e[1],d=e[2],u=e[3],p=d-h,f=u-c,g=Vt.singularValueDecompose2dScale(this.matrix),m=Vt.singularValueDecompose2dScale(this.baseTransform),v=g[0]*m[0],b=g[1]*m[1];let A=p,w=f,y=!1,_=!1;const x=Math.ceil(o*v),E=Math.ceil(l*b);x>=Math.ceil(p*v)?A=o:y=!0,E>=Math.ceil(f*b)?w=l:_=!0;const k=this.getSizeAndScale(A,this.ctx.canvas.width,v),S=this.getSizeAndScale(w,this.ctx.canvas.height,b),M=t.cachedCanvases.getCanvas("pattern",k.size,S.size),C=M.context,T=r.createCanvasGraphics(C);if(T.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(T,s,a),C.translate(-k.scale*h,-S.scale*c),T.transform(k.scale,0,0,S.scale,0,0),C.save(),this.clipBbox(T,h,c,d,u),T.baseTransform=xe(T.ctx),T.executeOperatorList(i),T.endDrawing(),C.restore(),y||_){const e=M.canvas;y&&(A=o),_&&(w=l);const i=this.getSizeAndScale(A,this.ctx.canvas.width,v),s=this.getSizeAndScale(w,this.ctx.canvas.height,b),n=i.size,a=s.size,r=t.cachedCanvases.getCanvas("pattern-workaround",n,a),d=r.context,u=y?Math.floor(p/o):0,g=_?Math.floor(f/l):0;for(let t=0;t<=u;t++)for(let i=0;i<=g;i++)d.drawImage(e,n*t,a*i,n,a,0,0,n,a);return{canvas:r.canvas,scaleX:i.scale,scaleY:s.scale,offsetX:h,offsetY:c}}return{canvas:M.canvas,scaleX:k.scale,scaleY:S.scale,offsetX:h,offsetY:c}}getSizeAndScale(t,e,i){const s=Math.max(Ra.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(xe(t.ctx),[e,i,s,n]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){const s=t.ctx,n=t.current;switch(e){case Ca:const t=this.ctx;s.fillStyle=t.fillStyle,s.strokeStyle=t.strokeStyle,n.fillColor=t.fillStyle,n.strokeColor=t.strokeStyle;break;case Ta: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 Nt("Unsupported paint type: ".concat(e))}}getPattern(t,e,i,s){let n=i;s!==wa&&(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 Pa(t){let{src:e,srcPos:i=0,dest:s,width:n,height:a,nonBlackColor:r=4294967295,inverseDecode:o=!1}=t;const l=zt.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,E.A)(Ra,"MAX_PATTERN_SIZE",3e3);const La=16;class Ia{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 Da(t,e,i,s,n,a,r,o,l,h){const[c,d,u,p,f,g]=xe(t);if(0===d&&0===u){const m=r*c+f,v=Math.round(m),b=o*p+g,A=Math.round(b),w=(r+l)*c+f,y=Math.abs(Math.round(w)-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,y,x),t.setTransform(c,d,u,p,f,g),[y,x]}if(0===c&&0===p){const m=o*u+f,v=Math.round(m),b=r*d+g,A=Math.round(b),w=(o+h)*u+f,y=Math.abs(Math.round(w)-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,y),t.setTransform(c,d,u,p,f,g),[x,y]}t.drawImage(e,i,s,n,a,r,o,l,h);return[Math.hypot(c,d)*l,Math.hypot(u,p)*h]}class Fa{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=C,this.textMatrixScale=1,this.fontMatrix=T,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=G,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]:ba,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[this.minX,this.minY,this.maxX,this.maxY];if(t===Aa){e||Mt("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]:ba,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Vt.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function Oa(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%La,a=(i-n)/La,r=0===n?a:a+1,o=t.createImageData(s,La);let l,h=0;const c=e.data,d=o.data;let u,p,f,g;if(e.kind===Y.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=zt.isLittleEndian?4278190080:255;for(u=0;
1u<r;u++){for(f=u<a?La: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*La)}}else if(e.kind===Y.RGBA_32BPP){for(p=0,g=s*La*4,u=0;u<a;u++)d.set(c.subarray(h,h+g)),h+=g,t.putImageData(o,0,p),p+=La;u<r&&(g=s*n*4,d.set(c.subarray(h,h+g)),t.putImageData(o,0,p))}else{if(e.kind!==Y.RGB_24BPP)throw new Error("bad image kind: ".concat(e.kind));for(f=La,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*La)}}}function Na(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);const i=e.height,s=e.width,n=i%La,a=(i-n)/La,r=0===n?a:a+1,o=t.createImageData(s,La);let l=0;const h=e.data,c=o.data;for(let d=0;d<r;d++){const e=d<a?La:n;({srcPos:l}=Pa({src:h,srcPos:l,dest:c,width:s,height:e,nonBlackColor:0})),t.putImageData(o,0,d*La)}}function Wa(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 ja(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),!M){const{filter:e}=t;"none"!==e&&""!==e&&(t.filter="none")}}function Ba(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)*oe.PDF_TO_CSS_UNITS);return i[0]<=s&&i[1]<=s}const Ha=["butt","round","square"],za=["miter","round","bevel"],Ga={},Va={};var Ua=new WeakSet;class qa{constructor(t,e,i,s,n,a,o,l){let{optionalContentConfig:h,markedContentStack:c=null}=a;
1r(this,Ua),this.ctx=t,this.current=new Fa(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 Ia(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(...xe(this.compositeCtx))}this.ctx.save(),ja(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=xe(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!==wt.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(){l(Ua,this,Xa).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(),l(Ua,this,Ka).call(this)}_scaleImage(t,e){var i,s;const n=null!==(i=t.width)&&void 0!==i?i:t.displayWidth,a=null!==(s=t.height)&&void 0!==s?s:t.displayHeight;let r,o,l=Math.max(Math.hypot(e[0],e[1]),1),h=Math.max(Math.hypot(e[2],e[3]),1),c=n,d=a,u="prescale1";for(;l>2&&c>1||h>2&&d>1;){let e=c,i=d;l>2&&c>1&&(e=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c/2),l/=c/e),h>2&&d>1&&(i=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d)/2,h/=d/i),r=this.cachedCanvases.getCanvas(u,e,i),o=r.context,o.clearRect(0,0,e,i),o.drawImage(t,0,0,c,d,0,0,e,i),t=r.canvas,c=e,d=i,u="prescale1"===u?"prescale2":"prescale1"}return{img:t,paintWidth:c,paintHeight:d}}_createMaskCanvas(t){const e=this.ctx,{width:i,height:s}=t,n=this.current.fillColor,a=this.current.patternFill,r=xe(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),Na(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,w=u,y=p;A.translate(-w,-y),A.transform(...d),h||(h=this._scaleImage(c.canvas,Ee(A)),h=h.img,o&&a&&o.set(l,h)),A.imageSmoothingEnabled=Ba(xe(A),t.interpolate),Da(A,h,0,0,h.width,h.height,0,0,i,s),A.globalCompositeOperation="source-in";const _=Vt.transform(Ee(A),[1,0,0,1,-w,-y]);return A.fillStyle=a?n.getPattern(e,this,_,ba):n,A.fillRect(0,0,i,s),o&&!a&&(this.cachedCanvases.delete("fillCanvas"),o.set(l,b.canvas)),{canvas:b.canvas,offsetX:Math.round(w),offsetY:Math.round(y)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=Ha[t]}setLineJoin(t){this.ctx.lineJoin=za[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(t),i.lineDashOffset=e)}
1setRenderingIntent(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(...xe(this.suspendedCtx)),Wa(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(),Wa(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(
1)}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){const e=Vt.makeHexColor(...a);if(u<0||p<0||u+i>d.width||p+s>d.height){const t=this.cachedCanvases.getCanvas("maskExtension",i,s),n=t.context;n.drawImage(d,-u,-p),n.globalCompositeOperation="destination-atop",n.fillStyle=e,n.fillRect(0,0,i,s),n.globalCompositeOperation="source-over",d=t.canvas,u=p=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const n=new Path2D;n.rect(u,p,i,s),t.clip(n),t.globalCompositeOperation="destination-atop",t.fillStyle=e,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?(Wa(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(),Wa(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=xe(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 wt.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 wt.moveTo:o=e[p++],l=e[p++],s.moveTo(o,l),c||n.updatePathMinMax(h,o,l);break;case wt.lineTo:o=e[p++],l=e[p++],s.lineTo(o,l),c||n.updatePathMinMax(h,o,l);break;case wt.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 wt.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 wt.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 wt.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,Ee(e),Aa),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,Ee(e),ba),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=Ga}eoClip(){this.pendingClip=Va}beginText(){this.current.textMatrix=C,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);
1e.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||T,0!==n.fontMatrix[0]&&0!==n.fontMatrix[3]||St("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&X,c=!!(o&K),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!==G&&h!==U||n.fill(),h!==V&&h!==U||n.stroke(),n.restore()):(h!==G&&h!==U||n.fillText(t,e,i),h!==V&&h!==U||n.strokeText(t,e,i)),c){(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:xe(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===G&&!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,Ee(n),ba);m=xe(n),n.restore(),n.fillStyle=t}let v=e.lineWidth;const b=e.textMatrixScale;if(0===b||0===v){const t=e.textRenderingMode&X;t!==V&&t!==U||(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,w=0;for(A=0;A<c;++A){const e=t[A];if("number"===typeof e){w+=u*e*s/1e3;continue}let h=!1;const c=(e.isSpace?o:0)+r,v=e.fontChar,b=e.accent;let y,_,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,y=i/a,_=(w+s)/a}else y=w/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),y/=e}else x!==t&&(y+=(x-t)/2e3*s/a)}if(this.contentVisible&&(e.isInFont||i.missingFile))if(g&&!b)n.fillText(v,y,_);else if(this.paintChar(v,y,_,m),b){const t=y+s*b.offset.x/a,e=_-s*b.offset.y/a;this.paintChar(b.fontChar,t,e,m)}w+=d?x*f-c*l:x*f+c*l,h&&n.restore()}d?e.y-=w:e.x+=w*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||T,d=t.length;let u,p,f,g;if(!(i.textRenderingMode===q)&&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){St('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(
1));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||xe(this.ctx),n={createCanvasGraphics:t=>new qa(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new Ra(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){this.ctx.strokeStyle=this.current.strokeColor=Vt.makeHexColor(t,e,i)}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(t,e,i){this.ctx.fillStyle=this.current.fillColor=Vt.makeHexColor(t,e,i),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",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 xa(t);case"Mesh":return new Sa(t);case"Dummy":return new Ma}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,Ee(e),wa);const s=Ee(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(){Mt("Should not call beginInlineImage")}beginImageData(){Mt("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=xe(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(xe(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;
1t.isolated||kt("TODO: Support non-isolated groups."),t.knockout&&St("Knockout groups not supported.");const i=xe(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let s=Vt.getAxialAlignedBoundingBox(t.bbox,xe(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()),Wa(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=xe(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(l(Ua,this,Xa).call(this),ja(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(xe(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),ja(this.ctx)}else ja(this.ctx),this.endPath(),this.ctx.rect(e[0],e[1],s,a),this.ctx.clip(),this.ctx.beginPath()}this.current=new Fa(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),l(Ua,this,Ka).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(
1),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=xe(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();Na(h,this.getObject(t,n)),h.globalCompositeOperation="source-in",h.fillStyle=s?i.getPattern(h,this,Ee(e),ba):i,h.fillRect(0,0,a,r),h.restore(),e.save(),e.transform(...o),e.scale(1,-1),Da(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):St("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,i,s){if(!this.contentVisible)return;const n=this.getObject(t);if(!n)return void St("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(),!M){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;Oa(s,t),n=this.applyTransferMapsToCanvas(s)}const a=this._scaleImage(n,Ee(s));s.imageSmoothingEnabled=Ba(xe(s),t.interpolate),Da(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;Oa(n,t),s=this.applyTransferMapsToCanvas(n)}for(const n of e)i.save(),i.transform(...n.transform),i.scale(1,-1),Da(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===Va?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=xe(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}
1e.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 Xa(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}function Ka(){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 lg in wt)void 0!==qa.prototype[lg]&&(qa.prototype[wt[lg]]=qa.prototype[lg]);class Ya{static get workerPort(){return l(Ya,this,Qa)._}static set workerPort(t){if(!("undefined"!==typeof Worker&&t instanceof Worker)&&null!==t)throw new Error("Invalid `workerPort` type.");Qa._=l(Ya,this,t)}static get workerSrc(){return l(Ya,this,Ja)._}static set workerSrc(t){if("string"!==typeof t)throw new Error("Invalid `workerSrc` type.");Ja._=l(Ya,this,t)}}var Qa={_:null},Ja={_:""};const Za=1,$a=2,tr=1,er=2,ir=3,sr=4,nr=5,ar=6,rr=7,or=8;function lr(t){switch(t instanceof Error||"object"===typeof t&&null!==t||Mt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new Wt(t.message);case"MissingPDFException":return new Ft(t.message);case"PasswordException":return new Lt(t.message,t.code);case"UnexpectedResponseException":return new Ot(t.message,t.status);case"UnknownErrorException":return new It(t.message,t.details);default:return new It(t.message,t.toString())}}var hr=new WeakMap,cr=new WeakSet;class dr{constructor(t,e,i){r(this,cr),o(this,hr,new AbortController),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),i.addEventListener("message",l(cr,this,ur).bind(this),{signal:c(hr,this).signal})}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:ar,streamId:n,desiredSize:t.desiredSize}),e.promise},cancel:t=>{Ct(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:tr,streamId:n,reason:lr(t)}),e.promise}},i)}destroy(){var t;null===(t=c(hr,this))||void 0===t||t.abort(),d(hr,this,null)}}function ur(t){let{data:e}=t;if(e.targetName!==this.sourceName)return;if(e.stream)return void l(cr,this,fr).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===Za)i.resolve(e.data);else{if(e.callback!==$a)throw new Error("Unexpected callback case");i.reject(lr(e.reason))}return}const i=this.actionHandler[e.action];if(!i)throw new Error("Unknown action from worker: ".concat(e.action));if(e.callbackId){const t=this.sourceName,s=e.sourceName,n=this.comObj;new Promise((function(t){t(i(e.data))})).then((function(i){n.postMessage({sourceName:t,targetName:s,callback:Za,callbackId:e.callbackId,data:i})}),(function(i){n.postMessage({sourceName:t,targetName:s,callback:$a,
1callbackId:e.callbackId,reason:lr(i)})}))}else e.streamId?l(cr,this,pr).call(this,e):i(e.data)}function pr(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:sr,streamId:e,chunk:t},r)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:s,stream:ir,streamId:e}),delete a.streamSinks[e])},error(t){Ct(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:s,stream:nr,streamId:e,reason:lr(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:or,streamId:e,success:!0})}),(function(t){n.postMessage({sourceName:i,targetName:s,stream:or,streamId:e,reason:lr(t)})}))}function fr(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,n=this.comObj,a=this.streamControllers[e],r=this.streamSinks[e];switch(t.stream){case or:t.success?a.startCall.resolve():a.startCall.reject(lr(t.reason));break;case rr:t.success?a.pullCall.resolve():a.pullCall.reject(lr(t.reason));break;case ar:if(!r){n.postMessage({sourceName:i,targetName:s,stream:rr,streamId:e,success:!0});break}r.desiredSize<=0&&t.desiredSize>0&&r.sinkCapability.resolve(),r.desiredSize=t.desiredSize,new Promise((function(t){var e;t(null===(e=r.onPull)||void 0===e?void 0:e.call(r))})).then((function(){n.postMessage({sourceName:i,targetName:s,stream:rr,streamId:e,success:!0})}),(function(t){n.postMessage({sourceName:i,targetName:s,stream:rr,streamId:e,reason:lr(t)})}));break;case sr:if(Ct(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case ir:if(Ct(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),l(cr,this,gr).call(this,a,e);break;case nr:Ct(a,"error should have stream controller"),a.controller.error(lr(t.reason)),l(cr,this,gr).call(this,a,e);break;case er:t.success?a.cancelCall.resolve():a.cancelCall.reject(lr(t.reason)),l(cr,this,gr).call(this,a,e);break;case tr:if(!r)break;new Promise((function(e){var i;e(null===(i=r.onCancel)||void 0===i?void 0:i.call(r,lr(t.reason)))})).then((function(){n.postMessage({sourceName:i,targetName:s,stream:er,streamId:e,success:!0})}),(function(t){n.postMessage({sourceName:i,targetName:s,stream:er,streamId:e,reason:lr(t)})})),r.sinkCapability.reject(lr(t.reason)),r.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async function gr(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 mr=new WeakMap,vr=new WeakMap;class br{constructor(t){let{parsedData:e,rawData:i}=t;o(this,mr,void 0),o(this,vr,void 0),d(mr,this,e),d(vr,this,i)}getRaw(){return c(vr,this)}get(t){var e;return null!==(e=c(mr,this).get(t))&&void 0!==e?e:null}getAll(){return Ht(c(mr,this))}has(t){return c(mr,this).has(t)}}const Ar=Symbol("INTERNAL");var wr=new WeakMap,yr=new WeakMap,_r=new WeakMap,xr=new WeakMap;class Er{constructor(t,e){let{name:i,intent:s,usage:n,rbGroups:a}=e;o(this,wr,!1),o(this,yr,!1),o(this,_r,!1),o(this,xr,!0),d(wr,this,!!(t&L)),d(yr,this,!!(t&I)),this.name=i,this.intent=s,this.usage=n,this.rbGroups=a}get visible(){if(c(_r,this))return c(xr,this);if(!c(xr,this))return!1;const{print:t,view:e}=this.usage;return c(wr,this)?"OFF"!==(null===e||void 0===e?void 0:e.viewState):!c(yr,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!==Ar&&Mt("Internal method `_setVisible` called."),d(_r,this,i),d(xr,this,e)}}var kr=new WeakMap,Sr=new WeakMap,Mr=new WeakMap,Cr=new WeakMap,Tr=new WeakSet;class Rr{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:L;if(r(this,Tr),o(this,kr,null),o(this,Sr,new Map),o(this,Mr,null),o(this,Cr,null),this.renderingIntent=e,this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,d(Cr,this,t.order);for(const i of t.groups)c(Sr,this).set(i.id,new Er(e,i));if("OFF"===t.baseState)for(const t of c(Sr,this).values())t._setVisible(Ar,!1);for(const e of t.on)c(Sr,this).get(e)._setVisible(Ar,!0);for(const e of t.off)c(Sr,this).get(e)._setVisible(Ar,!1);d(Mr,this,this.getHash())}}isVisible(t){if(0===c(Sr,this).size)return!0;
1if(!t)return kt("Optional content group not defined."),!0;if("OCG"===t.type)return c(Sr,this).has(t.id)?c(Sr,this).get(t.id).visible:(St("Optional content group not found: ".concat(t.id)),!0);if("OCMD"===t.type){if(t.expression)return l(Tr,this,Pr).call(this,t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!c(Sr,this).has(e))return St("Optional content group not found: ".concat(e)),!0;if(c(Sr,this).get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!c(Sr,this).has(e))return St("Optional content group not found: ".concat(e)),!0;if(!c(Sr,this).get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!c(Sr,this).has(e))return St("Optional content group not found: ".concat(e)),!0;if(!c(Sr,this).get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!c(Sr,this).has(e))return St("Optional content group not found: ".concat(e)),!0;if(c(Sr,this).get(e).visible)return!1}return!0}return St("Unknown optional content policy ".concat(t.policy,".")),!0}return St("Unknown group type ".concat(t.type,".")),!0}setVisibility(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=c(Sr,this).get(t);if(s){if(i&&e&&s.rbGroups.length)for(const e of s.rbGroups)for(const i of e){var n;if(i!==t)null===(n=c(Sr,this).get(i))||void 0===n||n._setVisible(Ar,!1,!0)}s._setVisible(Ar,!!e,!0),d(kr,this,null)}else St("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=c(Sr,this).get(n);if(t)switch(e){case"ON":this.setVisibility(n,!0,s);break;case"OFF":this.setVisibility(n,!1,s);break;case"Toggle":this.setVisibility(n,!t.visible,s)}}d(kr,this,null)}get hasInitialVisibility(){return null===c(Mr,this)||this.getHash()===c(Mr,this)}getOrder(){return c(Sr,this).size?c(Cr,this)?c(Cr,this).slice():[...c(Sr,this).keys()]:null}getGroups(){return c(Sr,this).size>0?Ht(c(Sr,this)):null}getGroup(t){return c(Sr,this).get(t)||null}getHash(){if(null!==c(kr,this))return c(kr,this);const t=new Cn;for(const[e,i]of c(Sr,this))t.update("".concat(e,":").concat(i.visible));return d(kr,this,t.hexdigest())}}function Pr(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=l(Tr,this,Pr).call(this,e);else{if(!c(Sr,this).has(e))return St("Optional content group not found: ".concat(e)),!0;n=c(Sr,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 Lr{constructor(t,e){let{disableRange:i=!1,disableStream:s=!1}=e;Ct(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{Ct(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(){Ct(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new Ir(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new Dr(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 Ir{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=ue(s)?s:null,this._queuedChunks=e||[],this._loaded=0;for(const n of this._queuedChunks)this._loaded+=n.byteLength;
1this._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 Dr{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 Fr(t,e){const i=new Headers;if(!t||!e||"object"!==typeof e)return i;for(const s in e){const t=e[s];void 0!==t&&i.append(s,t)}return i}function Or(t){let{responseHeaders:e,isHttp:i,rangeChunkSize:s,disableRange:n}=t;const a={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(e.get("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.get("Accept-Ranges"))return a;return"identity"!==(e.get("Content-Encoding")||"identity")||(a.allowRangeRequests=!0),a}function Nr(t){const e=t.get("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=Bt(i);i=s.decode(n),e=!1}catch(s){}}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(a){}return n(e,s)}))}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch(i){}if(ue(t))return t}return null}function Wr(t,e){return 404===t||0===t&&e.startsWith("file:")?new Ft('Missing PDF "'+e+'".'):new Ot("Unexpected server response
1(".concat(t,') while retrieving PDF "').concat(e,'".'),t)}function jr(t){return 200===t||206===t}function Br(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function Hr(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(St("getArrayBuffer - unexpected data format: ".concat(t)),new Uint8Array(t).buffer)}class zr{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=Fr(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 Ct(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Gr(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new Vr(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 Gr{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange;const i=new Headers(t.headers),s=e.url;fetch(s,Br(i,this._withCredentials,this._abortController)).then((e=>{if(!jr(e.status))throw Wr(e.status,s);this._reader=e.body.getReader(),this._headersCapability.resolve();const i=e.headers,{allowRangeRequests:n,suggestedLength:a}=Or({responseHeaders:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=n,this._contentLength=a||this._contentLength,this._filename=Nr(i),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Wt("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:Hr(e),done:!1})}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t),this._abortController.abort()}}class Vr{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;const n=new Headers(t.headers);n.append("Range","bytes=".concat(e,"-").concat(i-1));const a=s.url;fetch(a,Br(n,this._withCredentials,this._abortController)).then((t=>{if(!jr(t.status))throw Wr(t.status,a);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:Hr(e),done:!1})}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t),this._abortController.abort()}}class Ur{constructor(t){let{url:e,httpHeaders:i,withCredentials:s}=t;this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=Fr(this.isHttp,i),this.withCredentials=s||!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,a]of this.headers)e.setRequestHeader(n,a);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>
1=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:Bt(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 qr{constructor(t){this._source=t,this._manager=new Ur(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return Ct(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Xr(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const i=new Kr(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 Xr{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._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t),i=new Headers(e.getAllResponseHeaders().trim().split(/[\r\n]+/).map((t=>{const[e,...i]=t.split(": ");return[e,i.join(": ")]}))),{allowRangeRequests:s,suggestedLength:n}=Or({responseHeaders:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=n||this._contentLength,this._filename=Nr(i),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.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=Wr(t,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){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._headersCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0){return{value:this._cachedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest
1(this._fullRequestId),this._fullRequestReader=null}}class Kr{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=Wr(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 Yr=/^[a-z][a-z0-9\-+.]+:/i;function Qr(t,e,i){if("http:"===t.protocol){return ma.get("http").request(t,{headers:e},i)}return ma.get("https").request(t,{headers:e},i)}class Jr{constructor(t){this.source=t,this.url=function(t){if(Yr.test(t))return new URL(t);const e=ma.get("url");return new URL(e.pathToFileURL(t))}(t.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.headers=Fr(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 Ct(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new io(this):new to(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=this.isFsUrl?new so(this,t,e):new eo(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 Wt("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class $r{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)}}class to extends Zr{constructor(t){super(t);const e=Object.fromEntries(t.headers);this._request=Qr(this._url,e,(e=>{if(404===e.statusCode){const t=new Ft('Missing PDF "'.concat(this._url,'".'));return this._storedError=t,void this._headersCapability.reject(t)}this._headersCapability.resolve(),this._setReadableStream(e);const i=new Headers(this._readableStream.headers),{allowRangeRequests:s,suggestedLength:n}=Or({responseHeaders:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=n||this._contentLength,this._filename=Nr(i)})),this._request.on("error",(t=>{this._storedError=t,this._headersCapability.reject(t)})),this._request.end()}}class eo extends $r{constructor(t,e,i){super(t);const s=Object.fromEntries(t.headers);s.Range="bytes=".concat(e,"-").concat(i-1);this._request=Qr(this._url,s,(t=>
1{if(404!==t.statusCode)this._setReadableStream(t);else{const t=new Ft('Missing PDF "'.concat(this._url,'".'));this._storedError=t}})),this._request.on("error",(t=>{this._storedError=t})),this._request.end()}}class io extends Zr{constructor(t){super(t);const e=ma.get("fs");e.promises.lstat(this._url).then((t=>{this._contentLength=t.size,this._setReadableStream(e.createReadStream(this._url)),this._headersCapability.resolve()}),(t=>{"ENOENT"===t.code&&(t=new Ft('Missing PDF "'.concat(this._url,'".'))),this._storedError=t,this._headersCapability.reject(t)}))}}class so extends $r{constructor(t,e,i){super(t);const s=ma.get("fs");this._setReadableStream(s.createReadStream(this._url,{start:e,end:i-1}))}}const no=30;var 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 WeakMap,vo=new WeakMap,bo=new WeakMap,Ao=new WeakMap,wo=new WeakMap,yo=new WeakMap,_o=new WeakMap,xo=new WeakMap,Eo=new WeakSet;class ko{constructor(t){var e;let{textContentSource:i,container:s,viewport:n}=t;if(r(this,Eo),o(this,ao,Promise.withResolvers()),o(this,ro,null),o(this,oo,!1),o(this,lo,!(null===(e=globalThis.FontInspector)||void 0===e||!e.enabled)),o(this,ho,null),o(this,co,null),o(this,uo,0),o(this,po,0),o(this,fo,null),o(this,go,null),o(this,mo,0),o(this,vo,0),o(this,bo,Object.create(null)),o(this,Ao,[]),o(this,wo,null),o(this,yo,[]),o(this,_o,new WeakMap),o(this,xo,null),i instanceof ReadableStream)d(wo,this,i);else{if("object"!==typeof i)throw new Error('No "textContentSource" parameter specified.');d(wo,this,new ReadableStream({start(t){t.enqueue(i),t.close()}}))}d(ro,this,d(go,this,s)),d(vo,this,n.scale*(globalThis.devicePixelRatio||1)),d(mo,this,n.rotation),d(co,this,{div:null,properties:null,ctx:null});const{pageWidth:a,pageHeight:l,pageX:h,pageY:u}=n.rawDims;d(xo,this,[1,0,0,-1,-h,u+l]),d(po,this,a),d(uo,this,l),Po.call(ko),ke(s,n),c(ao,this).promise.finally((()=>{No._.delete(this),d(co,this,null),d(bo,this,null)})).catch((()=>{}))}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=zt.platform;return Rt(this,"fontFamilyMap",new Map([["sans-serif","".concat(t&&e?"Calibri, ":"","sans-serif")],["monospace","".concat(t&&e?"Lucida Console, ":"","monospace")]]))}render(){const t=()=>{c(fo,this).read().then((e=>{var i;let{value:s,done:n}=e;n?c(ao,this).resolve():(null!==(i=c(ho,this))&&void 0!==i||d(ho,this,s.lang),Object.assign(c(bo,this),s.styles),l(Eo,this,So).call(this,s.items),t())}),c(ao,this).reject)};return d(fo,this,c(wo,this).getReader()),No._.add(this),t(),c(ao,this).promise}update(t){let{viewport:e,onBefore:i=null}=t;const s=e.scale*(globalThis.devicePixelRatio||1),n=e.rotation;if(n!==c(mo,this)&&(null===i||void 0===i||i(),d(mo,this,n),ke(c(go,this),{rotation:n})),s!==c(vo,this)){null===i||void 0===i||i(),d(vo,this,s);const t={div:null,properties:null,ctx:To.call(ko,c(ho,this))};for(const e of c(yo,this))t.properties=c(_o,this).get(e),t.div=e,l(Eo,this,Co).call(this,t)}}cancel(){var t;const e=new Wt("TextLayer task cancelled.");null===(t=c(fo,this))||void 0===t||t.cancel(e).catch((()=>{})),d(fo,this,null),c(ao,this).reject(e)}get textDivs(){return c(yo,this)}get textContentItemsStr(){return c(Ao,this)}static cleanup(){if(!(l(ko,this,No)._.size>0)){l(ko,this,Io)._.clear();for(const{canvas:t}of l(ko,this,Do)._.values())t.remove();l(ko,this,Do)._.clear()}}}function So(t){var e,i;if(c(oo,this))return;null!==(i=(e=c(co,this)).ctx)&&void 0!==i||(e.ctx=To.call(m,c(ho,this)));const s=c(yo,this),n=c(Ao,this);for(const a of t){if(s.length>1e5)return St("Ignoring additional textDivs for performance reasons."),void d(oo,this,!0);if(void 0!==a.str)n.push(a.str),l(Eo,this,Mo).call(this,a);else if("beginMarkedContentProps"===a.type||"beginMarkedContent"===a.type){const t=c(ro,this);d(ro,this,document.createElement("span")),c(ro,this).classList.add("markedContent"),null!==a.id&&c(ro,this).setAttribute("id","".concat(a.id)),t.append(c(ro,this))}else"endMarkedContent"===a.type&&d(ro,this,c(ro,this).parentNode)}}function Mo(t){const e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};c(yo,this).push(e);const s=Vt.transform(c(xo,this),t.transform);let n=Math.atan2(s[1],s[0]);const a=c(bo,this)[t.fontName];a.vertical&&(n+=Math.PI/2);let r=c(lo,this)&&a.fontSubstitution||a.fontFamily;r=m.fontFamilyMap.get(r)||r;const o=Math.hypot(s[2],s[3]),h=o*Lo.call(m,r,c(ho,this));let d,u;0===n?(d=s[4],u=s[5]-h):(d=s[4]+h*Math.sin(n),u=s[5]-h*Math.cos(n));const p="calc(var(--scale-factor)*",f=e.style;c(ro,this)===c(go,this)?(f.left="".concat((100*d/c(po,this)).toFixed(2),"%"),f.top="".concat((100*u/c(uo,this)).toFixed(2),"%")):(f.left="".concat(p).concat(d.toFixed(2),"px)"),f.top="".concat(p).concat(u.toFixed(2),"px)")),f.fontSize="".concat(p).concat((Oo._*o).toFixed(2),"px)"),f.fontFamily=r,i.fontSize=o,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,c(lo,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),c(_o,this).set(e,i),c(co,this).div=e,c(co,this).properties=i,l(Eo,this,Co).call(this,c(co,this)),i.hasText&&c(ro,this).append(e),i.hasEOL){const t=document.createElement("br");t.setAttribute("role","presentation"),c(ro,this).append(t)}}function Co(t){const{div:e,properties:i,ctx:s}=t,{style:n}=e;let a="";if(Oo._>1&&(a="scale(".concat(1/Oo._,")")),0!==i.canvasWidth&&i.hasText){const{fontFamily:t}=n,{canvasWidth:r,fontSize:o}=i;Ro.call(m,s,o*c(vo,this),t);const{width:l}=s.measureText(e.textContent);l>0&&(a="scaleX(".concat(r*c(vo,this)/l,") ").concat(a))}0!==i.angle&&(a="rotate(".concat(i.angle,"deg) ").concat(a)),a.length>0&&(n.transform=a)}function To(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=l(m,this,Do)._.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}),l(m,this,Do)._.set(t,e),l(m,this,Fo)._.set(e,{size:0,family:""})}return e}function Ro(t,e,i){const s=l(m,this,Fo)._.get(t);e===s.size&&i===s.family||(t.font="".concat(e,"px ").concat(i),s.size=e,s.family=i)}function Po(){if(null!==l(m,this,Oo)._)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),Oo._=l(m,this,t.getBoundingClientRect().height),t.remove()}function Lo(t,e){const i=l(m,this,Io)._.get(t);if(i)return i;const s=l(m,this,To).call(this,e);s.canvas.width=s.canvas.height=no,l(m,this,Ro).call(this,s,no,t);const n=s.measureText("");let a=n.fontBoundingBoxAscent,r=Math.abs(n.fontBoundingBoxDescent);if(a){const e=a/(a+r);return l(m,this,Io)._.set(t,e),s.canvas.width=s.canvas.height=0,e}s.strokeStyle="red",s.clearRect(0,0,no,no),s.strokeText("g",0,0);let o=s.getImageData(0,0,no,no).data;r=0;for(let l=o.length-1-3;l>=0;l-=4)if(o[l]>0){r=Math.ceil(l/4/no);break}s.clearRect(0,0,no,no),s.strokeText("A",0,no),o=s.getImageData(0,0,no,no).data,a=0;for(let l=0,c=o.length;l<c;l+=4)if(o[l]>0){a=no-Math.floor(l/4/no);break}s.canvas.width=s.canvas.height=0;const h=a?a/(a+r):.8;return l(m,this,Io)._.set(t,h),h}m=ko;var Io={_:new Map},Do={_:new Map},Fo={_:new WeakMap},Oo={_:null},No={_:new Set};class Wo{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(!Wo.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 jo=65536,Bo=M?class extends zn{_createCanvas(t,e){return ma.get("canvas").createCanvas(t,e)}}:class extends zn{constructor(t){let{ownerDocument:e=globalThis.document,enableHWA:i=!1}=t;super({enableHWA:i}),this._document=e}_createCanvas(t,e){const i=this._document.createElement("canvas");return i.width=t,i.height=e,i}},Ho=M?class extends Gn{async _fetch(t){return va(t)}}:Vn,zo=M?class extends Un{}:class extends Un{constructor(t){let{docId:e,ownerDocument:i=globalThis.document}=t;super(),r(this,$n),o(this,qn,void 0),o(this,Xn,void 0),o(this,Kn,void 0),o(this,Yn,void 0),o(this,Qn,void 0),o(this,Jn,void 0),o(this,Zn,0),d(Yn,this,e),d(Qn,this,i)}addFilter(t){var e,i;if(!t)return"none";let s=h($n,this,ta).get(t);if(s)return s;const[n,a,r]=l($n,this,sa).call(this,t),o=1===t.length?n:"".concat(n).concat(a).concat(r);if(s=h($n,this,ta).get(o),s)return h($n,this,ta).set(t,s),s;const u="g_".concat(c(Yn,this),"_transfer_map_").concat((d(Zn,this,(e=c(Zn,this),i=e++,e)),i)),p=l($n,this,na).call(this,u);h($n,this,ta).set(t,p),h($n,this,ta).set(o,p);const f=l($n,this,oa).call(this,u);return l($n,this,ha).call(this,n,a,r,f),p}addHCMFilter(t,e){var i;const s="".concat(t,"-").concat(e),n="base";let a=h($n,this,ea).get(n);if((null===(i=a)||void 0===i?void 0:i.key)===s)return a.url;var r;a?(null===(r=a.filter)||void 0===r||r.remove(),a.key=s,a.url="none",a.filter=null):(a={key:s,url:"none",filter:null},h($n,this,ea).set(n,a));if(!t||!e)return a.url;const o=l($n,this,da).call(this,t);t=Vt.makeHexColor(...o);const d=l($n,this,da).call(this,e);if(e=Vt.makeHexColor(...d),h($n,this,ia).style.color="","#000000"===t&&"#ffffff"===e||t===e)return a.url;const u=new Array(256);for(let l=0;l<=255;l++){const t=l/255;u[l]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const p=u.join(","),f="g_".concat(c(Yn,this),"_hcm_filter"),g=a.filter=l($n,this,oa).call(this,f);
1l($n,this,ha).call(this,p,p,p,g),l($n,this,ra).call(this,g);const m=(t,e)=>{const i=o[t]/255,s=d[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 l($n,this,ha).call(this,m(0,5),m(1,5),m(2,5),g),a.url=l($n,this,na).call(this,f),a.url}addAlphaFilter(t){var e,i;let s=h($n,this,ta).get(t);if(s)return s;const[n]=l($n,this,sa).call(this,[t]),a="alpha_".concat(n);if(s=h($n,this,ta).get(a),s)return h($n,this,ta).set(t,s),s;const r="g_".concat(c(Yn,this),"_alpha_map_").concat((d(Zn,this,(e=c(Zn,this),i=e++,e)),i)),o=l($n,this,na).call(this,r);h($n,this,ta).set(t,o),h($n,this,ta).set(a,o);const u=l($n,this,oa).call(this,r);return l($n,this,ca).call(this,n,u),o}addLuminosityFilter(t){var e,i;let s,n,a=h($n,this,ta).get(t||"luminosity");if(a)return a;if(t?([s]=l($n,this,sa).call(this,[t]),n="luminosity_".concat(s)):n="luminosity",a=h($n,this,ta).get(n),a)return h($n,this,ta).set(t,a),a;const r="g_".concat(c(Yn,this),"_luminosity_map_").concat((d(Zn,this,(e=c(Zn,this),i=e++,e)),i)),o=l($n,this,na).call(this,r);h($n,this,ta).set(t,o),h($n,this,ta).set(n,o);const u=l($n,this,oa).call(this,r);return l($n,this,aa).call(this,u),t&&l($n,this,ca).call(this,s,u),o}addHighlightHCMFilter(t,e,i,s,n){var a;const r="".concat(e,"-").concat(i,"-").concat(s,"-").concat(n);let o=h($n,this,ea).get(t);if((null===(a=o)||void 0===a?void 0:a.key)===r)return o.url;var d;o?(null===(d=o.filter)||void 0===d||d.remove(),o.key=r,o.url="none",o.filter=null):(o={key:r,url:"none",filter:null},h($n,this,ea).set(t,o));if(!e||!i)return o.url;const[u,p]=[e,i].map(l($n,this,da).bind(this));let f=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),g=Math.round(.2126*p[0]+.7152*p[1]+.0722*p[2]),[m,v]=[s,n].map(l($n,this,da).bind(this));g<f&&([f,g,m,v]=[g,f,v,m]),h($n,this,ia).style.color="";const b=(t,e,i)=>{const s=new Array(256),n=(g-f)/i,a=t/255,r=(e-t)/(255*i);let o=0;for(let l=0;l<=i;l++){const t=Math.round(f+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(",")},A="g_".concat(c(Yn,this),"_hcm_").concat(t,"_filter"),w=o.filter=l($n,this,oa).call(this,A);return l($n,this,ra).call(this,w),l($n,this,ha).call(this,b(m[0],v[0],5),b(m[1],v[1],5),b(m[2],v[2],5),w),o.url=l($n,this,na).call(this,A),o.url}destroy(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&0!==h($n,this,ea).size||(c(Kn,this)&&(c(Kn,this).parentNode.parentNode.remove(),d(Kn,this,null)),c(Xn,this)&&(c(Xn,this).clear(),d(Xn,this,null)),d(Zn,this,0))}},Go=M?class extends ua{async _fetch(t){return va(t)}}:pa;function Vo(){var t,e,i;let s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"string"===typeof s||s instanceof URL?s={url:s}:(s instanceof ArrayBuffer||ArrayBuffer.isView(s))&&(s={data:s});const n=new qo,{docId:a}=n,r=s.url?function(t){if(t instanceof URL)return t.href;try{return new URL(t,window.location).href}catch(e){if(M&&"string"===typeof t)return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(s.url):null,o=s.data?function(t){if(M&&"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 Bt(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.")}(s.data):null,l=s.httpHeaders||null,h=!0===s.withCredentials,c=null!==(t=s.password)&&void 0!==t?t:null,d=s.range instanceof Ko?s.range:null,u=Number.isInteger(s.rangeChunkSize)&&s.rangeChunkSize>0?s.rangeChunkSize:jo;let p=s.worker instanceof rl?s.worker:null;const f=s.verbosity,g="string"!==typeof s.docBaseUrl||de(s.docBaseUrl)?null:s.docBaseUrl,m="string"===typeof s.cMapUrl?s.cMapUrl:null,v=!1!==s.cMapPacked,b=s.CMapReaderFactory||Ho,A="string"===typeof s.standardFontDataUrl?s.standardFontDataUrl:null,w=s.StandardFontDataFactory||Go,y=!0!==s.stopAtErrors,_=Number.isInteger(s.maxImageSize)&&s.maxImageSize>-1?s.maxImageSize:-1,x=!1!==s.isEvalSupported,E="boolean"===typeof s.isOffscreenCanvasSupported?s.isOffscreenCanvasSupported:!M,k="boolean"===typeof s.isChrome?s.isChrome:!zt.platform.isFirefox&&"undefined"!==typeof window&&!(null===(e=window)||void 0===e||!e.chrome),S=Number.isInteger(s.canvasMaxAreaInBytes)?s.canvasMaxAreaInBytes:-1,C="boolean"===typeof s.disableFontFace?s.disableFontFace:M,T=!0===s.fontExtraProperties,R=!0===s.enableXfa,P=s.ownerDocument||globalThis.document,L=!0===s.disableRange,I=!0===s.disableStream,D=!0===s.disableAutoFetch,F=!0===s.pdfBug,O=s.CanvasFactory||Bo,N=s.FilterFactory||zo,W=!0===s.enableHWA,j=d?d.length:null!==(i=s.length)&&void 0!==i?i:NaN,B="boolean"===typeof s.useSystemFonts?s.useSystemFonts:!M&&!C,H="boolean"===typeof s.useWorkerFetch?s.useWorkerFetch:b===Vn&&w===pa&&m&&A&&me(m,document.baseURI)&&me(A,document.baseURI);s.canvasFactory&&be("`canvasFactory`-instance option, please use `CanvasFactory` instead."),s.filterFactory&&be("`filterFactory`-instance option, please use `FilterFactory` instead.");xt(f);const z={canvasFactory:new O({ownerDocument:P,enableHWA:W}),filterFactory:new N({docId:a,ownerDocument:P}),cMapReaderFactory:H?null:new b({baseUrl:m,isCompressed:v}),standardFontDataFactory:H?null:new w({baseUrl:A})};if(!p){const t={verbosity:f,port:Ya.workerPort};p=t.port?rl.fromPort(t):new rl(t),n._worker=p}const G={docId:a,apiVersion:"4.8.69",data:o,password:c,disableAutoFetch:D,rangeChunkSize:u,length:j,docBaseUrl:g,enableXfa:R,evaluatorOptions:{maxImageSize:_,disableFontFace:C,ignoreErrors:y,isEvalSupported:x,isOffscreenCanvasSupported:E,isChrome:k,canvasMaxAreaInBytes:S,fontExtraProperties:T,useSystemFonts:B,cMapUrl:H?m:null,standardFontDataUrl:H?A:null}},V={disableFontFace:C,fontExtraProperties:T,ownerDocument:P,pdfBug:F,styleElement:null,loadingParams:{disableAutoFetch:D,enableXfa:R}};return p.promise.then((function(){if(n.destroyed)throw new Error("Loading aborted");if(p.destroyed)throw new Error("Worker was destroyed");
1const t=p.messageHandler.sendWithPromise("GetDocRequest",G,o?[o.buffer]:null);let e;if(d)e=new Lr(d,{disableRange:L,disableStream:I});else if(!o){if(!r)throw new Error("getDocument - no `url` parameter provided.");let t;if(M){t="undefined"!==typeof fetch&&"undefined"!==typeof Response&&"body"in Response.prototype&&me(r)?zr:Jr}else t=me(r)?zr:qr;e=new t({url:r,length:j,httpHeaders:l,withCredentials:h,rangeChunkSize:u,disableRange:L,disableStream:I})}return t.then((t=>{if(n.destroyed)throw new Error("Loading aborted");if(p.destroyed)throw new Error("Worker was destroyed");const i=new dr(a,t,p.port),s=new bl(i,n,e,V,z);n._transport=s,i.send("Ready",null)}))})).catch(n._capability.reject),n}function Uo(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 qo{constructor(){var t,e;this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d".concat((Xo._=(t=Xo._,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 Xo={_:0};class Ko{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){Mt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class Yo{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return 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 Qo=new WeakMap,Jo=new WeakMap,Zo=new WeakSet;class $o{constructor(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];r(this,Zo),o(this,Qo,null),o(this,Jo,!1),this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new ge:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new xl,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 he({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}
1=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:r=j.ENABLE,transform:o=null,background:h=null,optionalContentConfigPromise:c=null,annotationCanvasMap:u=null,pageColors:p=null,printAnnotationStorage:f=null,isEditing:g=!1}=t;null===(e=this._stats)||void 0===e||e.time("Overall");const m=this._transport.getRenderingIntent(a,r,f,g),{renderingIntent:v,cacheKey:b}=m;d(Jo,this,!1),l(Zo,this,el).call(this),c||(c=this._transport.getOptionalContentConfig(v));let A=this._intentStates.get(b);A||(A=Object.create(null),this._intentStates.set(b,A)),A.streamReaderCancelTimeout&&(clearTimeout(A.streamReaderCancelTimeout),A.streamReaderCancelTimeout=null);const w=!!(v&I);var y;A.displayReadyCapability||(A.displayReadyCapability=Promise.withResolvers(),A.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(y=this._stats)||void 0===y||y.time("Page Request"),this._pumpOperatorList(m));const _=t=>{var e;(A.renderTasks.delete(x),(this._maybeCleanupAfterRender||w)&&d(Jo,this,!0),l(Zo,this,tl).call(this,!w),t?(x.capability.reject(t),this._abortOperatorList({intentState:A,reason:t instanceof Error?t:new Error(t)})):x.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))},x=new Cl({callback:_,params:{canvasContext:s,viewport:n,transform:o,background:h},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:A.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!w,pdfBug:this._pdfBug,pageColors:p});((i=A).renderTasks||(i.renderTasks=new Set)).add(x);const E=x.task;return Promise.all([A.displayReadyCapability.promise,c]).then((t=>{var e;let[i,s]=t;if(this.destroyed)_();else{if(null===(e=this._stats)||void 0===e||e.time("Rendering"),!(s.renderingIntent&v))throw new Error("Mu
1st use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");x.initializeGraphics({transparency:i,optionalContentConfig:s}),x.operatorListChanged()}})).catch(_),E}getOperatorList(){let{intent:t="display",annotationMode:e=j.ENABLE,printAnnotationStorage:i=null,isEditing:s=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=this._transport.getRenderingIntent(t,e,i,s,!0);let a,r=this._intentStates.get(n.cacheKey);var o,l;(r||(r=Object.create(null),this._intentStates.set(n.cacheKey,r)),r.opListReadCapability)||(a=Object.create(null),a.operatorListChanged=function(){r.operatorList.lastChunk&&(r.opListReadCapability.resolve(r.operatorList),r.renderTasks.delete(a))},r.opListReadCapability=Promise.withResolvers(),((o=r).renderTasks||(o.renderTasks=new Set)).add(a),r.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(l=this._stats)||void 0===l||l.time("Page Request"),this._pumpOperatorList(n));return r.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=>Wo.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(),d(Jo,this,!1),l(Zo,this,el).call(this),Promise.all(t)}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];d(Jo,this,!0);const e=l(Zo,this,tl).call(this,!1);return t&&e&&this._stats&&(this._stats=new ge),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&&l(Zo,this,tl).call(this,!0)}_pumpOperatorList(t){let{renderingIntent:e,cacheKey:i,annotationStorageSerializable:s,modifiedIds:n}=t;const{map:a,transfer:r}=s,o=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:a,modifiedIds:n},r).getReader(),h=this._intentStates.get(i);h.streamReader=o;const c=()=>{o.read().then((t=>{let{value:e,done:i}=t;i?h.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,h),c())}),(t=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const t of h.renderTasks)t.operatorListChanged();l(Zo,this,tl).call(this,!0)}if(h.displayReadyCapability)h.displayReadyCapability.reject(t);else{if(!h.opListReadCapability)throw t;h.opListReadCapability.reject(t)}}}))};c()}_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 ce){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 Wt(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 tl(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(l(Zo,this,el).call(this),!c(Jo,this)||this.destroyed)return!1;if(t)return d(Qo,this,setTimeout((()=>{d(Qo,this,null),l(Zo,this,tl).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(),d(Jo,this,!1),!0}function el(){c(Qo,this)&&(clearTimeout(c(Qo,this)),d(Qo,this,null))}var il=new WeakMap,sl=new WeakMap;
1class nl{constructor(){o(this,il,new Map),o(this,sl,Promise.resolve())}postMessage(t,e){const i={data:structuredClone(t,e?{transfer:e}:null)};c(sl,this).then((()=>{for(const[t]of c(il,this))t.call(this,i)}))}addEventListener(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=null;if((null===i||void 0===i?void 0:i.signal)instanceof AbortSignal){const{signal:n}=i;if(n.aborted)return void St("LoopbackPort - cannot use an `aborted` signal.");const a=()=>this.removeEventListener(t,e);s=()=>n.removeEventListener("abort",a),n.addEventListener("abort",a)}c(il,this).set(e,s)}removeEventListener(t,e){const i=c(il,this).get(e);null===i||void 0===i||i(),c(il,this).delete(e)}terminate(){for(const[,t]of c(il,this))null===t||void 0===t||t();c(il,this).clear()}}var al=new WeakSet;class rl{constructor(){let{name:t=null,port:e=null,verbosity:i=Et()}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(r(this,al),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=dl._)&&void 0!==s&&s.has(e))throw new Error("Cannot use more than one PDFWorker per port.");return(dl._||(dl._=new WeakMap)).set(e,this),void this._initializeFromPort(e)}this._initialize()}get promise(){return M?Promise.all([ma.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 dr("main","worker",t),this._messageHandler.on("ready",(function(){})),l(al,this,ol).call(this)}_initialize(){if(cl._||ll(rl))return void this._setupFakeWorker();let{workerSrc:t}=rl;try{rl._isSameOrigin(window.location.href,t)||(t=rl._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),i=new dr("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,l(al,this,ol).call(this)):s()})),i.on("ready",(t=>{if(n.abort(),this.destroyed)s();else try{a()}catch(e){this._setupFakeWorker()}}));const a=()=>{const t=new Uint8Array;i.send("test",t,[t.buffer])};return void a()}catch(e){kt("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){cl._||(St("Setting up fake worker."),cl._=!0),rl._setupFakeWorkerGlobal.then((t=>{var e,i;if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const s=new nl;this._port=s;const n="fake".concat((hl._=(e=hl._,i=e++,e),i)),a=new dr(n+"_worker",n,s);t.setup(a,s),this._messageHandler=new dr(n,n+"_worker",s),l(al,this,ol).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=dl._)||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=l(rl,this,dl)._)||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 rl(t)}static get workerSrc(){if(Ya.workerSrc)return Ya.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Rt(this,"_setupFakeWorkerGlobal",(async()=>{if(h(rl,this,ll))return h(rl,this,ll);return(await import(this.workerSrc)).WorkerMessageHandler})())}}function ol(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}function ll(t){try{var e;return(null===(e=globalThis.pdfjsWorker)||void 0===e?void 0:e.WorkerMessageHandler)||null}catch(i){return null}}v=rl;var hl={_:0},cl={_:!1},dl={_:void 0};
1M&&(cl._=l(v,v,!0),Ya.workerSrc||(Ya.workerSrc="./pdf.worker.mjs")),v._isSameOrigin=(t,e)=>{let i;try{if(i=new URL(t),!i.origin||"null"===i.origin)return!1}catch(n){return!1}const s=new URL(e,i);return i.origin===s.origin},v._createCDNWrapper=t=>{const e='await import("'.concat(t,'");');return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};var ul=new WeakMap,pl=new WeakMap,fl=new WeakMap,gl=new WeakMap,ml=new WeakMap,vl=new WeakSet;class bl{constructor(t,e,i,s,n){r(this,vl),o(this,ul,new Map),o(this,pl,new Map),o(this,fl,new Map),o(this,gl,new Map),o(this,ml,null),this.messageHandler=t,this.loadingTask=e,this.commonObjs=new xl,this.fontLoader=new jn({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 Dn)}getRenderingIntent(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:j.ENABLE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=L,r=Tn;switch(t){case"any":a=P;break;case"display":break;case"print":a=I;break;default:St("getRenderingIntent - invalid intent: ".concat(t))}const o=a&I&&i instanceof Nn?i:this.annotationStorage;switch(e){case j.DISABLE:a+=O;break;case j.ENABLE:break;case j.ENABLE_FORMS:a+=D;break;case j.ENABLE_STORAGE:a+=F,r=o.serializable;break;default:St("getRenderingIntent - invalid annotationMode: ".concat(e))}s&&(a+=N),n&&(a+=W);const{ids:l,hash:h}=o.modifiedIds;return{renderingIntent:a,cacheKey:[a,r.hash,h].join("_"),annotationStorageSerializable:r,modifiedIds:l}}destroy(){var t;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),null===(t=c(ml,this))||void 0===t||t.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const s of c(pl,this).values())e.push(s._destroy());c(pl,this).clear(),c(fl,this).clear(),c(gl,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(),c(ul,this).clear(),this.filterFactory.destroy(),ko.cleanup(),null===(t=this._networkStream)||void 0===t||t.cancelAllRequests(new Wt("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)=>{Ct(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():(Ct(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",(async t=>{await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:s,contentLength:n}=this._fullReader;if(!i||!s){var a;if(this._lastProgress)null===(a=e.onProgress)||void 0===a||a.call(e,this._lastProgress);this._fullReader.onProgress=t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})}}return{isStreamingSupported:i,isRangeSupported:s,contentLength:n}})),t.on("GetRangeReader",((t,e)=>{Ct(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():(Ct(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 Yo(i,this))})),t.on("DocException",(function(t){let i;switch(t.name){case"PasswordException":i=new Lt(t.message,t.code);break;case"InvalidPDFException":i=new Dt(t.message);break;case"MissingPDFException":i=new Ft(t.message);break;case"UnexpectedResponseException":i=new Ot(t.message,t.status);break;case"UnknownErrorException":i=new It(t.message,t.details);break;default:Mt("DocException - expected a valid Error.")}e._capability.reject(i)})),t.on("PasswordRequest",(t=>{if(d(ml,this,Promise.withResolvers()),e.onPassword){const s=t=>{t instanceof Error?c(ml,this).reject(t):c(ml,this).resolve({password:t})};try{e.onPassword(s,t.code)}catch(i){c(ml,this).reject(i)}}else c(ml,this).reject(new Lt(t.message,t.code));return c(ml,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;c(pl,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;St("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 Bn(a,{disableFontFace:e,inspectFont:l});this.fontLoader.bind(h).catch((()=>
1t.sendWithPromise("FontFallback",{id:s}))).finally((()=>{!r&&h.data&&(h.data=null),this.commonObjs.resolve(s,h)}));break;case"CopyLocalImage":const{imageRef:d}=a;Ct(d,"The imageRef must be defined.");for(const t of c(pl,this).values())for(const[,e]of t.objs)if((null===e||void 0===e?void 0:e.ref)===d)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=c(pl,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",(async t=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(t)})),t.on("FetchStandardFontData",(async t=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(t)}))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var t,e;this.annotationStorage.size<=0&&St("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=c(fl,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&&c(gl,this).set(i.refStr,t);const s=new $o(e,i,this,this._params.pdfBug);return c(pl,this).set(e,s),s}));return c(fl,this).set(e,s),s}getPageIndex(t){return Uo(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 l(vl,this,Al).call(this,"GetFieldObjects")}hasJSActions(){return l(vl,this,Al).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 l(vl,this,Al).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}
1getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return l(vl,this,Al).call(this,"GetOptionalContentConfig").then((e=>new Rr(e,t)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=c(ul,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 br(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 c(ul,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 c(pl,this).values()){if(!t.cleanup())throw new Error("startCleanup: Page ".concat(t.pageNumber," is currently rendering."))}this.commonObjs.clear(),t||this.fontLoader.clear(),c(ul,this).clear(),this.filterFactory.destroy(!0),ko.cleanup()}}cachedPageNumber(t){var e;if(!Uo(t))return null;const i=0===t.gen?"".concat(t.num,"R"):"".concat(t.num,"R").concat(t.gen);return null!==(e=c(gl,this).get(i))&&void 0!==e?e:null}}function Al(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=c(ul,this).get(t);if(i)return i;const s=this.messageHandler.sendWithPromise(t,e);return c(ul,this).set(t,s),s}const wl=Symbol("INITIAL_DATA");var yl=new WeakMap,_l=new WeakSet;class xl{constructor(){r(this,_l),o(this,yl,Object.create(null))}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){const i=l(_l,this,El).call(this,t);return i.promise.then((()=>e(i.data))),null}const i=c(yl,this)[t];if(!i||i.data===wl)throw new Error("Requesting object that isn't resolved yet ".concat(t,"."));return i.data}has(t){const e=c(yl,this)[t];return!!e&&e.data!==wl}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=l(_l,this,El).call(this,t);i.data=e,i.resolve()}clear(){for(const e in c(yl,this)){var t;const{data:i}=c(yl,this)[e];null===i||void 0===i||null===(t=i.bitmap)||void 0===t||t.close()}d(yl,this,Object.create(null))}*[Symbol.iterator](){for(const t in c(yl,this)){const{data:e}=c(yl,this)[t];e!==wl&&(yield[t,e])}}}function El(t){var e;return(e=c(yl,this))[t]||(e[t]=(0,s.A)((0,s.A)({},Promise.withResolvers()),{},{data:wl}))}var kl=new WeakMap;class Sl{constructor(t){o(this,kl,null),d(kl,this,t),this.onContinue=null}get promise(){return c(kl,this).capability.promise}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;c(kl,this).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=c(kl,this).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=c(kl,this);return t.form||t.canvas&&(null===e||void 0===e?void 0:e.size)>0}}var Ml=new WeakMap;class Cl{constructor(t){let{callback:e,params:i,objs:s,commonObjs:n,annotationCanvasMap:a,operatorList:r,pageIndex:l,canvasFactory:h,filterFactory:c,useRequestAnimationFrame:d=!1,pdfBug:u=!1,pageColors:p=null}=t;o(this,Ml,null),this.callback=e,this.params=i,this.objs=s,this.commonObjs=n,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=l,this.canvasFactory=h,this.filterFactory=c,this._pdfBug=u,this.pageColors=p,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===d&&"undefined"!==typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new Sl(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;
1if(this._canvas){if(Tl._.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.");Tl._.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 qa(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(),c(Ml,this)&&(window.cancelAnimationFrame(c(Ml,this)),d(Ml,this,null)),Tl._.delete(this._canvas),this.callback(e||new ce("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?d(Ml,this,window.requestAnimationFrame((()=>{d(Ml,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(),Tl._.delete(this._canvas),this.callback())))}}var Tl={_:new WeakSet};const Rl="4.8.69",Pl="3634dab10";function Ll(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function Il(t){return Math.max(0,Math.min(255,255*t))}class Dl{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=Il(e),[e,e,e]}static G_HTML(t){let[e]=t;const i=Ll(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(Il)}static RGB_HTML(t){return"#".concat(t.map(Ll).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[Il(1-Math.min(1,e+n)),Il(1-Math.min(1,s+n)),Il(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 Fl{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){Mt("Abstract method `_createSVG` called.")}}class Ol extends Fl{_createSVG(t){return document.createElementNS(re,t)}}class Nl{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})}
1))}}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&&Wo.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&&Wo.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 Wl=1e3,jl=new WeakSet;function Bl(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class Hl{static create(t){switch(t.data.annotationType){case J:return new Yl(t);case Q:return new $l(t);case pt:switch(t.data.fieldType){case"Tx":return new eh(t);case"Btn":return t.data.radioButton?new nh(t):t.data.checkBox?new sh(t):new ah(t);case"Ch":return new rh(t);case"Sig":return new ih(t)}return new th(t);case dt:return new oh(t);case Z:return new Wh(t);case $:return new Bh(t);case tt:return new zh(t);case et:return new Vh(t);case st:return new qh(t);case ht:return new Kh(t);case ct:return new Qh(t);case it:return new Xh(t);case nt:return new Jh(t);case at:return new Zh(t);case rt:return new $h(t);case ot:return new tc(t);case lt:return new ec(t);case ut:return new nc(t);default:return new ql(t)}}}var zl=new WeakMap,Gl=new WeakMap,Vl=new WeakMap,Ul=new WeakSet;class ql{constructor(t){let{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:s=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r(this,Ul),o(this,zl,null),o(this,Gl,!1),o(this,Vl,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 _isEditable(){return this.data.isEditable}get hasPopupData(){return ql._hasPopupData(this.data)}updateEdited(t){var e;if(!this.container)return;c(zl,this)||d(zl,this,{rect:this.data.rect.slice(0)});const{rect:i}=t;i&&l(Ul,this,Xl).call(this,i),null===(e=c(Vl,this))||void 0===e||e.popup.updateEdited(t)}resetEdited(){var t;c(zl,this)&&(l(Ul,this,Xl).call(this,c(zl,this).rect),null===(t=c(Vl,this))||void 0===t||t.popup.resetEdited(),d(zl,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 th||(n.tabIndex=Wl);const{style:a}=n;
1if(a.zIndex=this.parent.zIndex++,e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof oh){const{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,n),n}const{width:r,height:o}=Bl(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 nh){const t="calc(".concat(r,"px * var(--scale-factor)) / calc(").concat(o,"px * var(--scale-factor))");a.borderRadius=t}switch(e.borderStyle.style){case ft:a.borderStyle="solid";break;case gt:a.borderStyle="dashed";break;case mt:St("Unimplemented border style: beveled");break;case vt:St("Unimplemented border style: inset");break;case bt:a.borderBottomStyle="solid"}const s=e.borderColor||null;s?(d(Gl,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:u,pageY:p}=s.rawDims;a.left="".concat(100*(l[0]-u)/h,"%"),a.top="".concat(100*(l[1]-p)/c,"%");const{rotation:f}=e;return e.hasOwnCanvas||0===f?(a.width="".concat(100*r/h,"%"),a.height="".concat(100*o/c,"%")):this.setRotation(f,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}=Bl(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]=Dl["".concat(n,"_HTML")](a),this.annotationStorage.setValue(this.data.id,{[e]:Dl["".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]}}}
1_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(c(Gl,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,d=h.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0);const u=h.createElement("defs");d.append(u);const p=h.createElement("clipPath"),f="clippath_".concat(this.data.id);p.setAttribute("id",f),p.setAttribute("clipPathUnits","objectBoundingBox"),u.append(p);for(let c=2,m=t.length;c<m;c+=8){var g;const i=t[c],s=t[c+1],a=t[c+2],d=t[c+3],u=h.createElement("rect"),f=(a-e)/o,m=(n-s)/l,v=(i-a)/o,b=(s-d)/l;u.setAttribute("x",f),u.setAttribute("y",m),u.setAttribute("width",v),u.setAttribute("height",b),p.append(u),null===(g=r)||void 0===g||g.push('<rect vector-effect="non-scaling-stroke" x="'.concat(f,'" y="').concat(m,'" width="').concat(v,'" height="').concat(b,'"/>'))}c(Gl,this)&&(r.push("</g></svg>')"),a.backgroundImage=r.join("")),this.container.append(d),this.container.style.clipPath="url(#".concat(f,")")}_createPopup(){const{data:t}=this,e=d(Vl,this,new oh({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:"popup_".concat(t.id),rotation:t.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(e.render())}render(){Mt("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||jl.has(r)?i.push({id:n,exportValue:s,domElement:r}):St("_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&&(jl.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")}_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 Xl(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}=Bl(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 Kl=new WeakSet;class Yl extends ql{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}),r(this,Kl),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?(l(Kl,this,Jl).call(this,i,t.attachment,t.attachmentDest),s=!0):t.setOCGState?(l(Kl,this,Zl).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("linkA
1nnotation"),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)&&l(Kl,this,Ql).call(this)}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),l(Kl,this,Ql).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),l(Kl,this,Ql).call(this)}_bindResetFormAction(t,e){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),l(Kl,this,Ql).call(this),!this._fieldObjects)return St('_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&&(jl.has(i)?i.dispatchEvent(new Event("resetform")):St("_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 Ql(){this.container.setAttribute("data-internal-link","")}function Jl(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},l(Kl,this,Ql).call(this)}function Zl(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),l(Kl,this,Ql).call(this)}class $l extends ql{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 th extends ql{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 zt.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)}}
1_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 eh extends th{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 a=t.getValue(e,{value:this.data.fieldValue});let r=a.value||"";const o=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;o&&r.length>o&&(r=r.slice(0,o));let l=a.formattedValue||(null===(s=this.data.textContent)||void 0===s?void 0:s.join("\n"))||null;l&&this.data.comb&&(l=l.replaceAll(/\s+/g,""));const h={userValue:r,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=null!==l&&void 0!==l?l:r,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type="text",i.setAttribute("value",null!==l&&void 0!==l?l:r),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),jl.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=Wl,this._setRequired(i,this.data.required),o&&(i.maxLength=o),i.addEventListener("input",(s=>{t.setValue(e,{value:s.target.value}),this.setPropertyOnSiblings(i,"value",s.target.value,"value"),h.formattedValue=null})),i.addEventListener("resetform",(t=>{var e;const s=null!==(e=this.data.defaultFieldValue)&&void 0!==e?e:"";i.value=h.userValue=s,h.formattedValue=null}));let c=t=>{const{formattedValue:e}=h;null!==e&&void 0!==e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){var n;i.addEventListener("focus",(t=>{var e;if(h.focused)return;const{target:i}=t;h.userValue&&(i.value=h.userValue),h.lastCommittedValue=i.value,h.commitKey=1,null!==(e=this.data.actions)&&void 0!==e&&e.Focus||(h.focused=!0)})),i.addEventListener("updatefromsandbox",(i=>{this.showElementAndHideCanvas(i.target);const s={value(i){var s;h.userValue=null!==(s=i.detail.value)&&void 0!==s?s:"",t.setValue(e,{value:h.userValue.toString()}),i.target.value=h.userValue},formattedValue(i){const{formattedValue:s}=i.detail;h.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=h.userValue;!r||r.length<=n||(r=r.slice(0,n),a.value=h.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;h.commitKey=1;let s=-1;if("Escape"===t.key?s=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(h.commitKey=3):s=2,-1===s)return;const{value:n}=t.target;h.lastCommittedValue!==n&&(h.lastCommittedValue=n,h.userValue=n,null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,willCommit:!0,
1commitKey:s,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))}));const s=c;c=null,i.addEventListener("blur",(t=>{var i;if(!h.focused||!t.relatedTarget)return;null!==(i=this.data.actions)&&void 0!==i&&i.Blur||(h.focused=!1);const{value:n}=t.target;var a;(h.userValue=n,h.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:h.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}));s(t)})),null!==(n=this.data.actions)&&void 0!==n&&n.Keystroke&&i.addEventListener("beforeinput",(t=>{var i;h.lastCommittedValue=null;const{data:s,target:n}=t,{value:a,selectionStart:r,selectionEnd:o}=n;let l=r,c=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&&(c+=t[0].length);break}case"deleteContentBackward":r===o&&(l-=1);break;case"deleteContentForward":r===o&&(c+=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:c}})})),this._setEventListeners(i,h,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(t=>t.target.value))}if(c&&i.addEventListener("blur",c),this.data.comb){const t=(this.data.rect[2]-this.data.rect[0])/o;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 ih extends th{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class sh extends th{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 jl.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=Wl,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 nh extends th{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(jl.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=Wl,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})}
1)),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 ah extends Yl{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 rh extends th{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");jl.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=Wl;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)})}
1)),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class oh extends ql{constructor(t){const{data:e,elements:i}=t;super(t,{isRenderable:ql._hasPopupData(e)}),this.elements=i,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new Ch({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,i.container.ariaHasPopup="dialog",e.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",e.map((t=>"".concat(Qt).concat(t))).join(",")),this.container}}var 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 WeakMap,vh=new WeakMap,bh=new WeakMap,Ah=new WeakMap,wh=new WeakMap,yh=new WeakMap,_h=new WeakMap,xh=new WeakMap,Eh=new WeakMap,kh=new WeakMap,Sh=new WeakMap,Mh=new WeakSet;class Ch{constructor(t){let{container:e,color:i,elements:s,titleObj:n,modificationDate:a,contentsObj:h,richText:u,parent:p,rect:f,parentRect:g,open:m}=t;r(this,Mh),o(this,lh,l(Mh,this,Ih).bind(this)),o(this,hh,l(Mh,this,Nh).bind(this)),o(this,ch,l(Mh,this,Oh).bind(this)),o(this,dh,l(Mh,this,Fh).bind(this)),o(this,uh,null),o(this,ph,null),o(this,fh,null),o(this,gh,null),o(this,mh,null),o(this,vh,null),o(this,bh,null),o(this,Ah,!1),o(this,wh,null),o(this,yh,null),o(this,_h,null),o(this,xh,null),o(this,Eh,null),o(this,kh,null),o(this,Sh,!1),d(ph,this,e),d(Eh,this,n),d(fh,this,h),d(xh,this,u),d(vh,this,p),d(uh,this,i),d(_h,this,f),d(bh,this,g),d(mh,this,s),d(gh,this,Ae.toDateObject(a)),this.trigger=s.flatMap((t=>t.getElementsToTriggerPopup()));for(const r of this.trigger)r.addEventListener("click",c(dh,this)),r.addEventListener("mouseenter",c(ch,this)),r.addEventListener("mouseleave",c(hh,this)),r.classList.add("popupTriggerArea");for(const r of s){var v;null===(v=r.container)||void 0===v||v.addEventListener("keydown",c(lh,this))}c(ph,this).hidden=!0,m&&l(Mh,this,Fh).call(this)}render(){if(c(wh,this))return;const t=d(wh,this,document.createElement("div"));if(t.className="popup",c(uh,this)){const e=t.style.outlineColor=Vt.makeHexColor(...c(uh,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(...c(uh,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}=c(Eh,this)),t.append(e),c(gh,this)){const t=document.createElement("span");t.classList.add("popupDate"),t.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),t.setAttribute("data-l10n-args",JSON.stringify({dateObj:c(gh,this).valueOf()})),e.append(t)}const s=h(Mh,this,Th);if(s)Nl.render({xfaHtml:s,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const e=this._formatContents(c(fh,this));t.append(e)}c(ph,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;c(kh,this)||d(kh,this,{contentsObj:c(fh,this),richText:c(xh,this)}),i&&d(yh,this,null),s&&(d(xh,this,l(Mh,this,Lh).call(this,s)),d(fh,this,null)),null===(e=c(wh,this))||void 0===e||e.remove(),d(wh,this,null)}resetEdited(){var t;c(kh,this)&&(({contentsObj:n(d,[fh,this])._,richText:n(d,[xh,this])._}=c(kh,this)),d(kh,this,null),null===(t=c(wh,this))||void 0===t||t.remove(),d(wh,this,null),d(yh,this,null))}forceHide(){d(Sh,this,this.isVisible),c(Sh,this)&&(c(ph,this).hidden=!0)}maybeShow(){c(Sh,this)&&(c(wh,this)||l(Mh,this,Oh).call(this),d(Sh,this,!1),c(ph,this).hidden=!1)}get isVisible(){return!1===c(ph,this).hidden}}function Th(t){const e=c(xh,t),i=c(fh,t);return null===e||void 0===e||!e.str||null!==i&&void 0!==i&&i.str&&i.str!==e.str?null:c(xh,t).html||null}function Rh(t){var e;return(null===(e=h(Mh,t,Th))||void 0===e||null===(e=e.attributes)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.fontSize)||0}function Ph(t){var e;return(null===(e=h(Mh,t,Th))||void 0===e||null===(e=e.attributes)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.color)||null}function Lh(t){const e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},s={style:{color:h(Mh,this,Ph),fontSize:h(Mh,this,Rh)?"calc(".concat(h(Mh,this,Rh),"px * var(--scale-factor))"):""}};for(const n of t.split("\n"))e.push({name:"span",value:n,attributes:s});return i}function Ih(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&c(Ah,this))&&l(Mh,this,Fh).call(this)}function Dh(){if(null!==c(yh,this))return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:s,pageY:n}}}=c(vh,this);let a=!!c(bh,this),r=c(a?bh:_h,this);for(const d of c(mh,this))if(!r||null!==Vt.intersect(d.data.rect,r)){r=d.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,u=o[1];d(yh,this,[100*(h-s)/e,100*(u-n)/i]);const{style:p}=c(ph,this);p.left="".concat(c(yh,this)[0],"%"),p.top="".concat(c(yh,this)[1],"%")}function Fh(){d(Ah,this,!c(Ah,this)),c(Ah,this)?(l(Mh,this,Oh).call(this),c(ph,this).addEventListener("click",c(dh,this)),c(ph,this).addEventListener("keydown",c(lh,this))):(l(Mh,this,Nh).call(this),c(ph,this).removeEventListener("click",c(dh,this)),c(ph,this).removeEventListener("keydown",c(lh,this)))}function Oh(){c(wh,this)||this.render(),this.isVisible?c(Ah,this)&&c(ph,this).classList.add("focused"):(l(Mh,this,Dh).call(this),c(ph,this).hidden=!1,c(ph,this).style.zIndex=parseInt(c(ph,this).style.zIndex)+1e3)}function Nh(){c(ph,this).classList.remove("focused"),!c(Ah,this)&&this.isVisible&&(c(ph,this).hidden=!0,c(ph,this).style.zIndex=parseInt(c(ph,this).style.zIndex)-1e3)}class Wh extends ql{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=B.FREETEXT}
1render(){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}}var jh=new WeakMap;class Bh extends ql{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),o(this,jh,null)}render(){this.container.classList.add("lineAnnotation");const t=this.data,{width:e,height:i}=Bl(t.rect),s=this.svgFactory.create(e,i,!0),n=d(jh,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 c(jh,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Hh=new WeakMap;class zh extends ql{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),o(this,Hh,null)}render(){this.container.classList.add("squareAnnotation");const t=this.data,{width:e,height:i}=Bl(t.rect),s=this.svgFactory.create(e,i,!0),n=t.borderStyle.width,a=d(Hh,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 c(Hh,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Gh=new WeakMap;class Vh extends ql{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),o(this,Gh,null)}render(){this.container.classList.add("circleAnnotation");const t=this.data,{width:e,height:i}=Bl(t.rect),s=this.svgFactory.create(e,i,!0),n=t.borderStyle.width,a=d(Gh,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 c(Gh,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Uh=new WeakMap;class qh extends ql{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),o(this,Uh,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}=Bl(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=d(Uh,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 c(Uh,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}class Xh extends qh{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Kh extends ql{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}
1var Yh=new WeakMap;class Qh extends ql{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),o(this,Yh,[]),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?B.HIGHLIGHT:B.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,inkLists:e,borderStyle:i,popupRef:s}}=this,{width:n,height:a}=Bl(t),r=this.svgFactory.create(n,a,!0);for(const o of e){let e=[];for(let i=0,n=o.length;i<n;i+=2){const s=o[i]-t[0],n=t[3]-o[i+1];e.push("".concat(s,",").concat(n))}e=e.join(" ");const s=this.svgFactory.createElement(this.svgElementName);c(Yh,this).push(s),s.setAttribute("points",e),s.setAttribute("stroke-width",i.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),r.append(s)}return!s&&this.hasPopupData&&this._createPopup(),this.container.append(r),this._editOnDoubleClick(),this.container}getElementsToTriggerPopup(){return c(Yh,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}class Jh extends ql{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=B.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class Zh extends ql{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 $h extends ql{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 tc extends ql{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 ec extends ql{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=B.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var ic=new WeakMap,sc=new WeakSet;class nc extends ql{constructor(t){var e;super(t,{isRenderable:!0}),r(this,sc),o(this,ic,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",(0,s.A)({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",l(sc,this,ac).bind(this)),d(ic,this,i);const{isMac:s}=zt.platform;return t.addEventListener("keydown",(t=>{"Enter"===t.key&&(s?t.metaKey:t.ctrlKey)&&l(sc,this,ac).call(this)})),!e.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return c(ic,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}function ac(){var t;null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(this.content,this.filename)}var rc=new WeakMap,oc=new WeakMap,lc=new WeakMap,hc=new WeakMap,cc=new WeakSet;class dc{constructor(t){let{div:e,accessibilityManager:i,annotationCanvasMap:s,annotationEditorUIManager:n,page:a,viewport:l,structTreeLayer:h}=t;r(this,cc),o(this,rc,null),o(this,oc,null),o(this,lc,new Map),o(this,hc,null),this.div=e,d(rc,this,i),d(oc,this,s),d(hc,this,h||null),this.page=a,this.viewport=l,this.zIndex=0,this._annotationEditorUIManager=n}hasEditableAnnotations(){return c(lc,this).size>0}async render(t){const{annotations:e}=t,i=this.div;ke(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 Ol,annotationStorage:t.annotationStorage||new Dn,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const r of e){if(r.noHTML)continue;const t=r.annotationType===dt;if(t){const t=s.get(r.id);if(!t)continue;n.elements=t}else{const{width:t,height:e}=Bl(r.rect);if(t<=0||e<=0)continue}n.data=r;const e=Hl.create(n);if(!e.isRenderable)continue;if(!t&&r.popupRef){const t=s.get(r.popupRef);t?t.push(e):s.set(r.popupRef,[e])}const i=e.render();var a;if(r.hidden&&(i.style.visibility="hidden"),await l(cc,this,uc).call(this,i,r.id),e._isEditable)c(lc,this).set(e.data.id,e),null===(a=this._annotationEditorUIManager)||void 0===a||a.renderAnnotationElement(e)}l(cc,this,pc).call(this)}update(t){let{viewport:e}=t;const i=this.div;this.viewport=e,ke(i,{rotation:e.rotation}),l(cc,this,pc).call(this),i.hidden=!1}getEditableAnnotations(){return Array.from(c(lc,this).values())}getEditableAnnotation(t){return c(lc,this).get(t)}}async function uc(t,e){var i,s;const n=t.firstChild||t,a=n.id="".concat(Qt).concat(e),r=await(null===(i=c(hc,this))||void 0===i?void 0:i.getAriaAttributes(a));if(r)for(const[o,l]of r)n.setAttribute(o,l);this.div.append(t),null===(s=c(rc,this))||void 0===s||s.moveElementInDOM(this.div,t,n,!1)}function pc(){if(!c(oc,this))return;const t=this.div;for(const[e,i]of c(oc,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)}c(oc,this).clear()}const fc=/\r\n?|\n/g;var gc=new WeakMap,mc=new WeakMap,vc=new WeakMap,bc=new WeakMap,Ac=new WeakMap,wc=new WeakSet;class yc extends ln{static get _keyboardManager(){const t=yc.prototype,e=t=>t.isEmpty(),i=es.TRANSLATE_SMALL,s=es.TRANSLATE_BIG;return Rt(this,"_keyboardManager",new ci([[["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((0,s.A)((0,s.A)({},t),{},{name:"freeTextEditor"})),r(this,wc),o(this,gc,void 0),o(this,mc,""),o(this,vc,"".concat(this.id,"-editor")),o(this,bc,null),o(this,Ac,void 0),d(gc,this,t.color||yc._defaultColor||ln._defaultLineColor),d(Ac,this,t.fontSize||yc._defaultFontSize)}static initialize(t,e){ln.initialize(t,e);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}
1static updateDefaultParams(t,e){switch(t){case H.FREETEXT_SIZE:yc._defaultFontSize=e;break;case H.FREETEXT_COLOR:yc._defaultColor=e}}updateParams(t,e){switch(t){case H.FREETEXT_SIZE:l(wc,this,_c).call(this,e);break;case H.FREETEXT_COLOR:l(wc,this,xc).call(this,e)}}static get defaultPropertiesToUpdate(){return[[H.FREETEXT_SIZE,yc._defaultFontSize],[H.FREETEXT_COLOR,yc._defaultColor||ln._defaultLineColor]]}get propertiesToUpdate(){return[[H.FREETEXT_SIZE,c(Ac,this)],[H.FREETEXT_COLOR,c(gc,this)]]}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){const t=this.parentScale;return[-yc._internalPadding*t,-(yc._internalPadding+c(Ac,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(B.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),d(bc,this,new AbortController);const t=this._uiManager.combinedSignal(c(bc,this));this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t})}disableEditMode(){var t;this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",c(vc,this)),this._isDraggable=!0,null===(t=c(bc,this))||void 0===t||t.abort(),d(bc,this,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){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=c(mc,this),e=d(mc,this,l(wc,this,Ec).call(this).trimEnd());if(t===e)return;const i=t=>{d(mc,this,t),t?(l(wc,this,Mc).call(this),this._uiManager.rebuild(this),l(wc,this,kc).call(this)):this.remove()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),l(wc,this,kc).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){yc._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",c(vc,this)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize="calc(".concat(c(Ac,this),"px * var(--scale-factor))"),i.color=c(gc,this),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),Ye(this,this.div,["dblclick","keydown"]),this.width){const[i,s]=this.parentDimensions;
1if(this.annotationElementId){const{position:n}=this._initialData;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);l(wc,this,Mc).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=Tc.call(yc,e.getData("text")||"").replaceAll(fc,"\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:r,startOffset:o}=a,h=[],c=[];if(r.nodeType===Node.TEXT_NODE){const t=r.parentElement;if(c.push(r.nodeValue.slice(o).replaceAll(fc,"")),t!==this.editorDiv){let e=h;for(const i of this.editorDiv.childNodes)i!==t?e.push(Sc.call(yc,i)):e=c}h.push(r.nodeValue.slice(0,o).replaceAll(fc,""))}else if(r===this.editorDiv){let t=h,e=0;for(const i of this.editorDiv.childNodes)e++===o&&(t=c),t.push(Sc.call(yc,i))}d(mc,this,"".concat(h.join("\n")).concat(s).concat(c.join("\n"))),l(wc,this,Mc).call(this);const u=new Range;let p=h.reduce(((t,e)=>t+e.length),0);for(const{firstChild:l}of this.editorDiv.childNodes)if(l.nodeType===Node.TEXT_NODE){const t=l.nodeValue.length;if(p<=t){u.setStart(l,p),u.setEnd(l,p);break}p-=t}n.removeAllRanges(),n.addRange(u)}get contentDiv(){return this.editorDiv}static async deserialize(t,e,i){let s=null;if(t instanceof Wh){const{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:n,rotation:a,id:r,popupRef:o},textContent:l,textPosition:h,parent:{page:{pageNumber:c}}}=t;if(!l||0===l.length)return null;s=t={annotationType:B.FREETEXT,color:Array.from(i),fontSize:e,value:l.join("\n"),position:h,pageIndex:c-1,rect:n.slice(0),rotation:a,id:r,deleted:!1,popupRef:o}}const n=await super.deserialize(t,e,i);return d(Ac,n,t.fontSize),d(gc,n,Vt.makeHexColor(...t.color)),d(mc,n,Tc.call(yc,t.value)),n.annotationElementId=t.id||null,n._initialData=s,n}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const e=yc._internalPadding*this.parentScale,i=this.getRect(e,e),s=ln._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:c(gc,this)),n={annotationType:B.FREETEXT,color:s,fontSize:c(Ac,this),value:l(wc,this,Cc).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?n:this.annotationElementId&&!l(wc,this,Rc).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(c(Ac,this),"px * var(--scale-factor))"),i.color=c(gc,this),e.replaceChildren();for(const n of c(mc,this).split("\n")){const t=document.createElement("div");t.append(n?document.createTextNode(n):document.createElement("br")),e.append(t)}const s=yc._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(s,s),popupContent:c(mc,this)}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}function _c(t){const e=t=>{this.editorDiv.style.fontSize="calc(".concat(t,"px * var(--scale-factor))"),this.translate(0,-(t-c(Ac,this))*this.parentScale),d(Ac,this,t),l(wc,this,kc).call(this)},i=c(Ac,this);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:H.FREETEXT_S
1IZE,overwriteIfSameType:!0,keepUndo:!0})}function xc(t){const e=t=>{d(gc,this,this.editorDiv.style.color=t)},i=c(gc,this);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:H.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function Ec(){const t=[];this.editorDiv.normalize();let e=null;for(const s of this.editorDiv.childNodes){var i;(null===(i=e)||void 0===i?void 0:i.nodeType)===Node.TEXT_NODE&&"BR"===s.nodeName||(t.push(Sc.call(b,s)),e=s)}return t.join("\n")}function kc(){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 Sc(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(fc,"")}function Mc(){if(this.editorDiv.replaceChildren(),c(mc,this))for(const t of c(mc,this).split("\n")){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}function Cc(){return c(mc,this).replaceAll("\xa0"," ")}function Tc(t){return t.replaceAll(" ","\xa0")}function Rc(t){const{value:e,fontSize:i,color:s,pageIndex:n}=this._initialData;return this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some(((t,e)=>t!==s[e]))||t.pageIndex!==n}b=yc,(0,E.A)(yc,"_freeTextDefaultContent",""),(0,E.A)(yc,"_internalPadding",0),(0,E.A)(yc,"_defaultColor",null),(0,E.A)(yc,"_defaultFontSize",10),(0,E.A)(yc,"_type","freetext"),(0,E.A)(yc,"_editorType",B.FREETEXT);class Pc{toSVGPath(){Mt("Abstract method `toSVGPath` must be implemented.")}get box(){Mt("Abstract getter `box` must be implemented.")}serialize(t,e){Mt("Abstract method `serialize` must be implemented.")}get classNamesForDrawing(){Mt("Abstract getter `classNamesForDrawing` must be implemented.")}get classNamesForOutlining(){Mt("Abstract getter `classNamesForOutlining` must be implemented.")}get mustRemoveSelfIntersections(){return!1}}var Lc=new WeakMap,Ic=new WeakMap,Dc=new WeakMap,Fc=new WeakMap,Oc=new WeakMap,Nc=new WeakMap,Wc=new WeakMap,jc=new WeakMap,Bc=new WeakMap,Hc=new WeakMap,zc=new WeakMap,Gc=new WeakMap,Vc=new WeakMap,Uc=new WeakSet;class qc{constructor(t,e,i,s,n){let{x:a,y:l}=t,h=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;r(this,Uc),o(this,Lc,void 0),o(this,Ic,[]),o(this,Dc,void 0),o(this,Fc,void 0),o(this,Oc,[]),o(this,Nc,new Float64Array(18)),o(this,Wc,void 0),o(this,jc,void 0),o(this,Bc,void 0),o(this,Hc,void 0),o(this,zc,void 0),o(this,Gc,void 0),o(this,Vc,[]),d(Lc,this,e),d(Gc,this,s*i),d(Fc,this,n),c(Nc,this).set([NaN,NaN,NaN,NaN,a,l],6),d(Dc,this,h),d(Hc,this,td._*i),d(Bc,this,ed._*i),d(zc,this,i),c(Vc,this).push(a,l)}isEmpty(){return isNaN(c(Nc,this)[8])}add(t){var e;let{x:i,y:s}=t;d(Wc,this,i),d(jc,this,s);const[n,a,r,o]=c(Lc,this);let[l,h,u,p]=c(Nc,this).subarray(8,12);const f=i-u,g=s-p,m=Math.hypot(f,g);if(m<c(Bc,this))return!1;const v=m-c(Hc,this),b=v/m,A=b*f,w=b*g;let y=l,_=h;l=u,h=p,u+=A,p+=w,null===(e=c(Vc,this))||void 0===e||e.push(i,s);const x=A/v,E=-w/v*c(Gc,this),k=x*c(Gc,this);if(c(Nc,this).set(c(Nc,this).subarray(2,8),0),c(Nc,this).set([u+E,p+k],4),c(Nc,this).set(c(Nc,this).subarray(14,18),12),c(Nc,this).set([u-E,p-k],16),isNaN(c(Nc,this)[6]))return 0===c(Oc,this).length&&(c(Nc,this).set([l+E,h+k],2),c(Oc,this).push(NaN,NaN,NaN,NaN,(l+E-n)/r,(h+k-a)/o),c(Nc,this).set([l-E,h-k],14),c(Ic,this).push(NaN,NaN,NaN,NaN,(l-E-n)/r,(h-k-a)/o)),c(Nc,this).set([y,_,l,h,u,p],6),!this.isEmpty();c(Nc,this).set([y,_,l,h,u,p],6);return Math.abs(Math.atan2(_-h,y-l)-Math.atan2(w,A))<Math.PI/2?([l,h,u,p]=c(Nc,this).subarray(2,6),c(Oc,this).push(NaN,NaN,NaN,NaN,((l+u)/2-n)/r,((h+p)/2-a)/o),[l,h,y,_]=c(Nc,this).subarray(14,18),c(Ic,this).push(NaN,NaN,NaN,NaN,((y+l)/2-n)/r,((_+h)/2-a)
1/o),!0):([y,_,l,h,u,p]=c(Nc,this).subarray(0,6),c(Oc,this).push(((y+5*l)/6-n)/r,((_+5*h)/6-a)/o,((5*l+u)/6-n)/r,((5*h+p)/6-a)/o,((l+u)/2-n)/r,((h+p)/2-a)/o),[u,p,l,h,y,_]=c(Nc,this).subarray(12,18),c(Ic,this).push(((y+5*l)/6-n)/r,((_+5*h)/6-a)/o,((5*l+u)/6-n)/r,((5*h+p)/6-a)/o,((l+u)/2-n)/r,((h+p)/2-a)/o),!0)}toSVGPath(){if(this.isEmpty())return"";const t=c(Oc,this),e=c(Ic,this);if(isNaN(c(Nc,this)[6])&&!this.isEmpty())return l(Uc,this,Kc).call(this);const i=[];i.push("M".concat(t[4]," ").concat(t[5]));for(let s=6;s<t.length;s+=6)isNaN(t[s])?i.push("L".concat(t[s+4]," ").concat(t[s+5])):i.push("C".concat(t[s]," ").concat(t[s+1]," ").concat(t[s+2]," ").concat(t[s+3]," ").concat(t[s+4]," ").concat(t[s+5]));l(Uc,this,Qc).call(this,i);for(let s=e.length-6;s>=6;s-=6)isNaN(e[s])?i.push("L".concat(e[s+4]," ").concat(e[s+5])):i.push("C".concat(e[s]," ").concat(e[s+1]," ").concat(e[s+2]," ").concat(e[s+3]," ").concat(e[s+4]," ").concat(e[s+5]));return l(Uc,this,Yc).call(this,i),i.join(" ")}newFreeDrawOutline(t,e,i,s,n,a){return new cd(t,e,i,s,n,a)}getOutlines(){var t,e;const i=c(Oc,this),s=c(Ic,this),n=c(Nc,this),[a,r,o,h]=c(Lc,this),d=new Float64Array((null!==(t=null===(e=c(Vc,this))||void 0===e?void 0:e.length)&&void 0!==t?t:0)+2);for(let l=0,f=d.length-2;l<f;l+=2)d[l]=(c(Vc,this)[l]-a)/o,d[l+1]=(c(Vc,this)[l+1]-r)/h;if(d[d.length-2]=(c(Wc,this)-a)/o,d[d.length-1]=(c(jc,this)-r)/h,isNaN(n[6])&&!this.isEmpty())return l(Uc,this,Jc).call(this,d);const u=new Float64Array(c(Oc,this).length+24+c(Ic,this).length);let p=i.length;for(let l=0;l<p;l+=2)isNaN(i[l])?u[l]=u[l+1]=NaN:(u[l]=i[l],u[l+1]=i[l+1]);p=l(Uc,this,$c).call(this,u,p);for(let l=s.length-6;l>=6;l-=6)for(let t=0;t<6;t+=2)isNaN(s[l+t])?(u[p]=u[p+1]=NaN,p+=2):(u[p]=s[l+t],u[p+1]=s[l+t+1],p+=2);return l(Uc,this,Zc).call(this,u,p),this.newFreeDrawOutline(u,d,c(Lc,this),c(zc,this),c(Dc,this),c(Fc,this))}}function Xc(){const t=c(Nc,this).subarray(4,6),e=c(Nc,this).subarray(16,18),[i,s,n,a]=c(Lc,this);return[(c(Wc,this)+(t[0]-e[0])/2-i)/n,(c(jc,this)+(t[1]-e[1])/2-s)/a,(c(Wc,this)+(e[0]-t[0])/2-i)/n,(c(jc,this)+(e[1]-t[1])/2-s)/a]}function Kc(){const[t,e,i,s]=c(Lc,this),[n,a,r,o]=l(Uc,this,Xc).call(this);return"M".concat((c(Nc,this)[2]-t)/i," ").concat((c(Nc,this)[3]-e)/s," L").concat((c(Nc,this)[4]-t)/i," ").concat((c(Nc,this)[5]-e)/s," L").concat(n," ").concat(a," L").concat(r," ").concat(o," L").concat((c(Nc,this)[16]-t)/i," ").concat((c(Nc,this)[17]-e)/s," L").concat((c(Nc,this)[14]-t)/i," ").concat((c(Nc,this)[15]-e)/s," Z")}function Yc(t){const e=c(Ic,this);t.push("L".concat(e[4]," ").concat(e[5]," Z"))}function Qc(t){const[e,i,s,n]=c(Lc,this),a=c(Nc,this).subarray(4,6),r=c(Nc,this).subarray(16,18),[o,h,d,u]=l(Uc,this,Xc).call(this);t.push("L".concat((a[0]-e)/s," ").concat((a[1]-i)/n," L").concat(o," ").concat(h," L").concat(d," ").concat(u," L").concat((r[0]-e)/s," ").concat((r[1]-i)/n))}function Jc(t){const e=c(Nc,this),[i,s,n,a]=c(Lc,this),[r,o,h,d]=l(Uc,this,Xc).call(this),u=new Float64Array(36);return u.set([NaN,NaN,NaN,NaN,(e[2]-i)/n,(e[3]-s)/a,NaN,NaN,NaN,NaN,(e[4]-i)/n,(e[5]-s)/a,NaN,NaN,NaN,NaN,r,o,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,(e[16]-i)/n,(e[17]-s)/a,NaN,NaN,NaN,NaN,(e[14]-i)/n,(e[15]-s)/a],0),this.newFreeDrawOutline(u,t,c(Lc,this),c(zc,this),c(Dc,this),c(Fc,this))}function Zc(t,e){const i=c(Ic,this);return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+6}function $c(t,e){const i=c(Nc,this).subarray(4,6),s=c(Nc,this).subarray(16,18),[n,a,r,o]=c(Lc,this),[h,d,u,p]=l(Uc,this,Xc).call(this);return t.set([NaN,NaN,NaN,NaN,(i[0]-n)/r,(i[1]-a)/o,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,u,p,NaN,NaN,NaN,NaN,(s[0]-n)/r,(s[1]-a)/o],e),e+24}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 Pc{constructor(t,e,i,s,n,a){super(),r(this,hd),o(this,id,void 0),o(this,sd,null),o(this,nd,void 0),o(this,ad,void 0),o(this,rd,void 0),o(this,od,void 0),o(this,ld,void 0),d(ld,this,t),d(rd,this,e),d(id,this,i),d(od,this,s),d(nd,this,n),d(ad,this,a),l(hd,this,pd).call(this,a);const{x:h,y:u,width:p,height:f}=c(sd,this);for(let r=0,o=t.length;r<o;r+=2)t[r]=(t[r]-h)/p,t[r+1]=(t[r+1]-u)/f;for(let r=0,o=e.length;r<o;r+=2)e[r]=(e[r]-h)/p,e[r+1]=(e[r+1]-u)/f}toSVGPath(){const t=["M".concat(c(ld,this)[4]," ").concat(c(ld,this)[5])];for(let e=6,i=c(ld,this).length;e<i;e+=6)isNaN(c(ld,this)[e])?t.push("L".concat(c(ld,this)[e+4]," ").concat(c(ld,this)[e+5])):t.push("C".concat(c(ld,this)[e]," ").concat(c(ld,this)[e+1]," ").concat(c(ld,this)[e+2]," ").concat(c(ld,this)[e+3]," ").concat(c(ld,this)[e+4]," ").concat(c(ld,this)[e+5]));return t.push("Z"),t.join(" ")}serialize(t,e){let[i,s,n,a]=t;const r=n-i,o=a-s;let h,d;switch(e){case 0:h=l(hd,this,dd).call(this,c(ld,this),i,a,r,-o),d=l(hd,this,dd).call(this,c(rd,this),i,a,r,-o);break;case 90:h=l(hd,this,ud).call(this,c(ld,this),i,s,r,o),d=l(hd,this,ud).call(this,c(rd,this),i,s,r,o);break;case 180:h=l(hd,this,dd).call(this,c(ld,this),n,s,-r,o),d=l(hd,this,dd).call(this,c(rd,this),n,s,-r,o);break;case 270:h=l(hd,this,ud).call(this,c(ld,this),n,a,-r,-o),d=l(hd,this,ud).call(this,c(rd,this),n,a,-r,-o)}return{outline:Array.from(h),points:[Array.from(d)]}}get box(){return c(sd,this)}newOutliner(t,e,i,s,n){return new qc(t,e,i,s,n,arguments.length>5&&void 0!==arguments[5]?arguments[5]:0)}getNewOutline(t,e){const{x:i,y:s,width:n,height:a}=c(sd,this),[r,o,l,h]=c(id,this),d=n*l,u=a*h,p=i*l+r,f=s*h+o,g=this.newOutliner({x:c(rd,this)[0]*d+p,y:c(rd,this)[1]*u+f},c(id,this),c(od,this),t,c(ad,this),null!==e&&void 0!==e?e:c(nd,this));for(let m=2;m<c(rd,this).length;m+=2)g.add({x:c(rd,this)[m]*d+p,y:c(rd,this)[m+1]*u+f});return g.getOutlines()}get mustRemoveSelfIntersections(){return!0}}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}
1function 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=c(ld,this);let i=e[4],s=e[5],n=i,a=s,r=i,o=s,l=i,h=s;const u=t?Math.max:Math.min;for(let c=6,d=e.length;c<d;c+=6){if(isNaN(e[c]))n=Math.min(n,e[c+4]),a=Math.min(a,e[c+5]),r=Math.max(r,e[c+4]),o=Math.max(o,e[c+5]),h<e[c+5]?(l=e[c+4],h=e[c+5]):h===e[c+5]&&(l=u(l,e[c+4]));else{const t=Vt.bezierBoundingBox(i,s,...e.slice(c,c+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=u(l,t[2]))}i=e[c+4],s=e[c+5]}const p=n-c(nd,this),f=a-c(nd,this),g=r-n+2*c(nd,this),m=o-a+2*c(nd,this);d(sd,this,{x:p,y:f,width:g,height:m,lastPoint:[l,h]})}var fd=new WeakMap,gd=new WeakMap,md=new WeakMap,vd=new WeakSet;class bd{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];r(this,vd),o(this,fd,void 0),o(this,gd,[]),o(this,md,[]);let n=1/0,a=-1/0,l=1/0,h=-1/0;const u=10**-4;for(const{x:r,y:o,width:d,height:A}of t){const t=Math.floor((r-e)/u)*u,i=Math.ceil((r+d+e)/u)*u,s=Math.floor((o-e)/u)*u,p=Math.ceil((o+A+e)/u)*u,f=[t,s,p,!0],g=[i,s,p,!1];c(gd,this).push(f,g),n=Math.min(n,t),a=Math.max(a,i),l=Math.min(l,s),h=Math.max(h,p)}const p=a-n+2*i,f=h-l+2*i,g=n-i,m=l-i,v=c(gd,this).at(s?-1:-2),b=[v[0],v[2]];for(const r of c(gd,this)){const[t,e,i]=r;r[0]=(t-g)/p,r[1]=(e-m)/f,r[2]=(i-m)/f}d(fd,this,{x:g,y:m,width:p,height:f,lastPoint:b})}getOutlines(){c(gd,this).sort(((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]));const t=[];for(const e of c(gd,this))e[3]?(t.push(...l(vd,this,xd).call(this,e)),l(vd,this,yd).call(this,e)):(l(vd,this,_d).call(this,e),t.push(...l(vd,this,xd).call(this,e)));return l(vd,this,Ad).call(this,t)}}function Ad(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 Sd(s,c(fd,this))}function wd(t){const e=c(md,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 yd(t){let[,e,i]=t;const s=l(vd,this,wd).call(this,e);c(md,this).splice(s,0,[e,i])}function _d(t){let[,e,i]=t;const s=l(vd,this,wd).call(this,e);for(let n=s;n<c(md,this).length;n++){const[t,s]=c(md,this)[n];if(t!==e)break;if(t===e&&s===i)return void c(md,this).splice(n,1)}for(let n=s-1;n>=0;n--){const[t,s]=c(md,this)[n];if(t!==e)break;if(t===e&&s===i)return void c(md,this).splice(n,1)}}function xd(t){const[e,i,s]=t,n=[[e,i,s]],a=l(vd,this,wd).call(this,s);for(let r=0;r<a;r++){const[t,i]=c(md,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}var Ed=new WeakMap,kd=new WeakMap;class Sd extends Pc{constructor(t,e){super(),o(this,Ed,void 0),o(this,kd,void 0),d(kd,this,t),d(Ed,this,e)}toSVGPath(){const t=[];for(const e of c(kd,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 c(kd,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 c(Ed,this)}get classNamesForDrawing(){return["highlight"]}get classNamesForOutlining(){return["highlightOutline"]}}class Md extends qc{newFreeDrawOutline(t,e,i,s,n,a){return new Cd(t,e,i,s,n,a)}get classNamesForDrawing(){return["highlight","free"]}}class Cd extends cd{get classNamesForDrawing(){return["highlight","free"]}get classNamesForOutlining(){return["highlightOutline","free"]}newOutliner(t,e,i,s,n){return new Md(t,e,i,s,n,arguments.length>5&&void 0!==arguments[5]?arguments[5]:0)}}var Td=new WeakMap,Rd=new WeakMap,Pd=new WeakMap,Ld=new WeakMap,Id=new WeakMap,Dd=new WeakMap,Fd=new WeakMap,Od=new WeakMap,Nd=new WeakMap,Wd=new WeakMap,jd=new WeakMap,Bd=new WeakSet;class Hd{static get _keyboardManager(){return Rt(this,"_keyboardManager",new ci([[["Escape","mac+Escape"],Hd.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Hd.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Hd.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Hd.prototype._moveToPrevious],[["Home","mac+Home"],Hd.prototype._moveToBeginning],[["End","mac+End"],Hd.prototype._moveToEnd]]))}constructor(t){var e;let{editor:i=null,uiManager:s=null}=t;r(this,Bd),o(this,Td,null),o(this,Rd,null),o(this,Pd,void 0),o(this,Ld,null),o(this,Id,!1),o(this,Dd,!1),o(this,Fd,null),o(this,Od,void 0),o(this,Nd,null),o(this,Wd,null),o(this,jd,void 0),i?(d(Dd,this,!1),d(jd,this,H.HIGHLIGHT_COLOR),d(Fd,this,i)):(d(Dd,this,!0),d(jd,this,H.HIGHLIGHT_DEFAULT_COLOR)),d(Wd,this,(null===i||void 0===i?void 0:i._uiManager)||s),d(Od,this,c(Wd,this)._eventBus),d(Pd,this,(null===i||void 0===i?void 0:i.color)||(null===(e=c(Wd,this))||void 0===e?void 0:e.highlightColors.values().next().value)||"#FFFF98"),Kd._||(Kd._=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}renderButton(){const t=d(Td,this,document.createElement("button"));
1t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0);const e=c(Wd,this)._signal;t.addEventListener("click",l(Bd,this,Ud).bind(this),{signal:e}),t.addEventListener("keydown",l(Bd,this,Vd).bind(this),{signal:e});const i=d(Rd,this,document.createElement("span"));return i.className="swatch",i.setAttribute("aria-hidden",!0),i.style.backgroundColor=c(Pd,this),t.append(i),t}renderMainDropdown(){const t=d(Ld,this,l(Bd,this,zd).call(this));return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}_colorSelectFromKeyboard(t){if(t.target===c(Td,this))return void l(Bd,this,Ud).call(this,t);const e=t.target.getAttribute("data-color");e&&l(Bd,this,Gd).call(this,e,t)}_moveToNext(t){var e,i;h(Bd,this,Xd)?t.target!==c(Td,this)?null===(e=t.target.nextSibling)||void 0===e||e.focus():null===(i=c(Ld,this).firstChild)||void 0===i||i.focus():l(Bd,this,Ud).call(this,t)}_moveToPrevious(t){var e,i;t.target!==(null===(e=c(Ld,this))||void 0===e?void 0:e.firstChild)&&t.target!==c(Td,this)?(h(Bd,this,Xd)||l(Bd,this,Ud).call(this,t),null===(i=t.target.previousSibling)||void 0===i||i.focus()):h(Bd,this,Xd)&&this._hideDropdownFromKeyboard()}_moveToBeginning(t){var e;h(Bd,this,Xd)?null===(e=c(Ld,this).firstChild)||void 0===e||e.focus():l(Bd,this,Ud).call(this,t)}_moveToEnd(t){var e;h(Bd,this,Xd)?null===(e=c(Ld,this).lastChild)||void 0===e||e.focus():l(Bd,this,Ud).call(this,t)}hideDropdown(){var t,e;null===(t=c(Ld,this))||void 0===t||t.classList.add("hidden"),null===(e=c(Nd,this))||void 0===e||e.abort(),d(Nd,this,null)}_hideDropdownFromKeyboard(){var t;c(Dd,this)||(h(Bd,this,Xd)?(this.hideDropdown(),c(Td,this).focus({preventScroll:!0,focusVisible:c(Id,this)})):null===(t=c(Fd,this))||void 0===t||t.unselect())}updateColor(t){if(c(Rd,this)&&(c(Rd,this).style.backgroundColor=t),!c(Ld,this))return;const e=c(Wd,this).highlightColors.values();for(const i of c(Ld,this).children)i.setAttribute("aria-selected",e.next().value===t)}destroy(){var t,e;null===(t=c(Td,this))||void 0===t||t.remove(),d(Td,this,null),d(Rd,this,null),null===(e=c(Ld,this))||void 0===e||e.remove(),d(Ld,this,null)}}function zd(){const t=document.createElement("div"),e=c(Wd,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 c(Wd,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",Kd._[i]);const a=document.createElement("span");n.append(a),a.className="swatch",a.style.backgroundColor=s,n.setAttribute("aria-selected",s===c(Pd,this)),n.addEventListener("click",l(Bd,this,Gd).bind(this,s),{signal:e}),t.append(n)}return t.addEventListener("keydown",l(Bd,this,Vd).bind(this),{signal:e}),t}function Gd(t,e){e.stopPropagation(),c(Od,this).dispatch("switchannotationeditorparams",{source:this,type:c(jd,this),value:t})}function Vd(t){A._keyboardManager.exec(this,t)}function Ud(t){if(h(Bd,this,Xd))return void this.hideDropdown();if(d(Id,this,0===t.detail),c(Nd,this)||(d(Nd,this,new AbortController),window.addEventListener("pointerdown",l(Bd,this,qd).bind(this),{signal:c(Wd,this).combinedSignal(c(Nd,this))})),c(Ld,this))return void c(Ld,this).classList.remove("hidden");const e=d(Ld,this,l(Bd,this,zd).call(this));c(Td,this).append(e)}function qd(t){var e;null!==(e=c(Ld,this))&&void 0!==e&&e.contains(t.target)||this.hideDropdown()}function Xd(t){return c(Ld,t)&&!c(Ld,t).classList.contains("hidden")}A=Hd;var Kd={_:null},Yd=new WeakMap,Qd=new WeakMap,Jd=new WeakMap,Zd=new WeakMap,$d=new WeakMap,tu=new WeakMap,eu=new WeakMap,iu=new WeakMap,su=new WeakMap,nu=new WeakMap,au=new WeakMap,ru=new WeakMap,ou=new WeakMap,lu=new WeakMap,hu=new WeakMap,cu=new WeakMap,du=new WeakMap,uu=new WeakMap,pu=new WeakSet;class fu extends ln{static get _keyboardManager(){const t=fu.prototype;return Rt(this,"_keyboardManager",new ci([[["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((0,s.A)((0,s.A)({},t),{},{name:"highlightEditor"})),r(this,pu),o(this,Yd,null),o(this,Qd,0),o(this,Jd,void 0),o(this,Zd,null),o(this,$d,null),o(this,tu,null),o(this,eu,null),o(this,iu,0),o(this,su,null),o(this,nu,null),o(this,au,null),o(this,ru,!1),o(this,ou,null),o(this,lu,void 0),o(this,hu,null),o(this,cu,""),o(this,du,void 0),o(this,uu,""),this.color=t.color||fu._defaultColor,d(du,this,t.thickness||fu._defaultThickness),d(lu,this,t.opacity||fu._defaultOpacity),d(Jd,this,t.boxes||null),d(uu,this,t.methodOfCreation||""),d(cu,this,t.text||""),this._isDraggable=!1,t.highlightId>
1-1?(d(ru,this,!0),l(pu,this,mu).call(this,t),l(pu,this,yu).call(this)):c(Jd,this)&&(d(Yd,this,t.anchorNode),d(Qd,this,t.anchorOffset),d(eu,this,t.focusNode),d(iu,this,t.focusOffset),l(pu,this,gu).call(this),l(pu,this,yu).call(this),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:c(ru,this)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:c(du,this),methodOfCreation:c(uu,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;ln.initialize(t,e),fu._defaultColor||(fu._defaultColor=(null===(i=e.highlightColors)||void 0===i?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(t,e){switch(t){case H.HIGHLIGHT_DEFAULT_COLOR:fu._defaultColor=e;break;case H.HIGHLIGHT_THICKNESS:fu._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return c(ou,this)}updateParams(t,e){switch(t){case H.HIGHLIGHT_COLOR:l(pu,this,vu).call(this,e);break;case H.HIGHLIGHT_THICKNESS:l(pu,this,bu).call(this,e)}}static get defaultPropertiesToUpdate(){return[[H.HIGHLIGHT_DEFAULT_COLOR,fu._defaultColor],[H.HIGHLIGHT_THICKNESS,fu._defaultThickness]]}get propertiesToUpdate(){return[[H.HIGHLIGHT_COLOR,this.color||fu._defaultColor],[H.HIGHLIGHT_THICKNESS,c(du,this)||fu._defaultThickness],[H.HIGHLIGHT_FREE,c(ru,this)]]}async addEditToolbar(){const t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&(d($d,this,new Hd({editor:this})),t.addColorPicker(c($d,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(l(pu,this,ku).call(this))}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,l(pu,this,ku).call(this))}onceAdded(){this.annotationElementId||this.parent.addUndoableEditor(this),this.div.focus()}remove(){l(pu,this,wu).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(l(pu,this,yu).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;if(this.parent&&!t)l(pu,this,wu).call(this);else if(t){var i;l(pu,this,yu).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;c(ru,this)?(t=(t-this.rotation+360)%360,i=_u.call(fu,c(nu,this).box,t)):i=_u.call(fu,this,t),e.rotate(c(au,this),t),e.rotate(c(hu,this),t),e.updateBox(c(au,this),i),e.updateBox(c(hu,this),_u.call(fu,c(tu,this).box,t))}render(){if(this.div)return this.div;const t=super.render();c(cu,this)&&(t.setAttribute("aria-label",c(cu,this)),t.setAttribute("role","mark")),c(ru,this)?t.classList.add("free"):this.div.addEventListener("keydown",l(pu,this,xu).bind(this),{signal:this._uiManager._signal});const e=d(su,this,document.createElement("div"));t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=c(Zd,this);const[i,s]=this.parentDimensions;return this.setDims(this.width*i,this.height*s),Ye(this,c(su,this),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.isSelected||this.parent.drawLayer.addClass(c(hu,this),"hovered")}pointerleave(){this.isSelected||this.parent.drawLayer.removeClass(c(hu,this),"hovered")}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:l(pu,this,Eu).call(this,!0);break;case 1:case 3:l(pu,this,Eu).call(this,!1)}}select(){var t,e;super.select(),c(hu,this)&&(null===(t=this.parent)||void 0===t||t.drawLayer.removeClass(c(hu,this),"hovered"),null===(e=this.parent)||void 0===e||e.drawLayer.addClass(c(hu,this),"selected"))}unselect(){var t;super.unselect(),c(hu,this)&&(null===(t=this.parent)||void 0===t||t.drawLayer.removeClass(c(hu,this),"selected"),c(ru,this)||l(pu,this,Eu).call(this,!1))}get _mustFixPosition(){return!c(ru,this)}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;super.show(t),this.parent&&(this.parent.drawLayer.show(c(au,this),t),this.parent.drawLayer.show(c(hu,this),t))}static startHighlighting(t,e,i){let{target:s,x:n,y:a}=i;const{x:r,y:o,width:h,height:c}=s.getBoundingClientRect(),d=new AbortController,u=t.combinedSignal(d),p=e=>{d.abort(),l(fu,this,Tu).call(this,t,e)};window.addEventListener("blur",p,{signal:u}),window.addEventListener("pointerup",p,{signal:u}),window.addEventListener("pointerdown",(t=>{t.preventDefault(),t.stopPropagation()}),{capture:!0,passive:!1,signal:u}),window.addEventListener("contextmenu",ve,{signal:u}),s.addEventListener("pointermove",l(fu,this,Cu).bind(this,t),{signal:u}),this._freeHighlight=new Md({x:n,y:a},[r,o,h,c],t.scale,this._defaultThickness/2,e,.001),({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0))}static async deserialize(t,e,i){let s=null;if(t instanceof Jh){const{data:{quadPoints:e,rect:i,rotation:n,id:a,color:r,opacity:o,popupRef:l},parent:{page:{pageNumber:h}}}=t;s=t={annotationType:B.HIGHLIGHT,color:Array.from(r),opacity:o,quadPoints:e,boxes:null,pageIndex:h-1,rect:i.slice(0),rotation:n,id:a,deleted:!1,popupRef:l}}else if(t instanceof Qh){const{data:{inkLists:e,rect:i,rotation:n,id:a,color:r,borderStyle:{rawWidth:o},popupRef:l},parent:{page:{pageNumber:h}}}=t;s=t={annotationType:B.HIGHLIGHT,color:Array.from(r),thickness:o,inkLists:e,boxes:null,pageIndex:h-1,rect:i.slice(0),rotation:n,id:a,deleted:!1,popupRef:l}}const{color:n,quadPoints:a,inkLists:r,opacity:o}=t,h=await super.deserialize(t,e,i);h.color=Vt.makeHexColor(...n),d(lu,h,o||1),r&&d(du,h,t.thickness),h.annotationElementId=t.id||null,h._initialData=s;const[u,p]=h.pageDimensions,[f,g]=h.pageTranslation;if(a){const t=d(Jd,h,[]);for(let e=0;e<a.length;e+=8)t.push({x:(a[e]-f)/u,y:1-(a[e+1]-g)/p,width:(a[e+2]-a[e])/u,height:(a[e+1]-a[e+5])/p});l(pu,h,gu).call(h),l(pu,h,yu).call(h),h.rotate(h.rotation)}else if(r){d(ru,h,!0);const t=r[0],i={x:t[0]-f,y:p-(t[1]-g)},s=new Md(i,[0,0,u,p],1,c(du,h)/2,!0,.001);for(let e=0,r=t.length;e<r;e+=2)i.x=t[e]-f,i.y=p-(t[e+1]-g),s.add(i);const{id:n,clipPathId:a}=e.drawLayer.draw(s,h.color,h._defaultOpacity,!0);l(pu,h,mu).call(h,{highlightOutlines:s.getOutlines(),highlightId:n,clipPathId:a}),l(pu,h,yu).call(h)}return h}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const e=this.getRect(0,0),i=ln._colorManager.convert(this.color),s={annotationType:B.HIGHLIGHT,color:i,opacity:c(lu,this),thickness:c(du,this),quadPoints:l(pu,this,Su).call(this),outlines:l(pu,this,Mu).call(this,e),pageIndex:this.pageIndex,rect:e,rotation:l(pu,this,ku).call(this),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!l(pu,this,Ru).call(this,s)?null:(s.id=this.annotationElementId,s)}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}}function gu(){const t=new bd(c(Jd,this),.001);d(nu,this,t.getOutlines()),({x:this.x,y:this.y,width:this.width,height:this.height}=c(nu,this).box);const e=new bd(c(Jd,this),.0025,.001,"ltr"===this._uiManager.direction);d(tu,this,e.getOutlines());const{lastPoint:i}=c(tu,this).box;d(ou,this,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])}function mu(t){let{highlightOutlines:e,highlightId:i,clipPathId:s}=t;d(nu,this,e);if(d(tu,this,e.getNewOutline(c(du,this)/2+1.5,.0025)),i>=0)d(au,this,i),d(Zd,this,s),this.parent.drawLayer.finalizeLine(i,e),d(hu,this,this.parent.drawLayer.drawOutline(c(tu,this)));else if(this.parent){const t=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(c(au,this),e),this.parent.drawLayer.updateBox(c(au,this),_u.call(w,c(nu,this).box,(t-this.rotation+360)%360)),this.parent.drawLayer.updateLine(c(hu,this),c(tu,this)),this.parent.drawLayer.updateBox(c(hu,this),_u.call(w,c(tu,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}=c(tu,this).box;d(ou,this,[(l[0]-n)/r,(l[1]-a)/o])}function vu(t){const e=(t,e)=>{var i,s,n;this.color=t,null===(i=this.parent)||void 0===i||i.drawLayer.changeColor(c(au,this),t),null===(s=c($d,this))||void 0===s||s.updateColor(t),d(lu,this,e),null===(n=this.parent)||void 0===n||n.drawLayer.changeOpacity(c(au,this),e)},i=this.color,s=c(lu,this);this.addCommands({cmd:e.bind(this,t,w._defaultOpacity),undo:e.bind(this,i,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:H.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)}function bu(t){const e=c(du,this),i=t=>{d(du,this,t),l(pu,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:H.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}function Au(t){if(!c(ru,this))return;l(pu,this,mu).call(this,{highlightOutlines:c(nu,this).getNewOutline(t/2)}),this.fixAndSetPosition();const[e,i]=this.parentDimensions;this.setDims(this.width*e,this.height*i)}function wu(){null!==c(au,this)&&this.parent&&(this.parent.drawLayer.remove(c(au,this)),d(au,this,null),this.parent.drawLayer.remove(c(hu,this)),d(hu,this,null))}function yu(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;null===c(au,this)&&(({id:n(d,[au,this])._,clipPathId:n(d,[Zd,this])._}=t.drawLayer.draw(c(nu,this),this.color,c(lu,this))),d(hu,this,t.drawLayer.drawOutline(c(tu,this))),c(su,this)&&(c(su,this).style.clipPath=c(Zd,this)))}function _u(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 xu(t){w._keyboardManager.exec(this,t)}function Eu(t){if(!c(Yd,this))return;const e=window.getSelection();t?e.setPosition(c(Yd,this),c(Qd,this)):e.setPosition(c(eu,this),c(iu,this))}function ku(){return c(ru,this)?this.rotation:0}
1function Su(){if(c(ru,this))return null;const[t,e]=this.pageDimensions,[i,s]=this.pageTranslation,n=c(Jd,this),a=new Float32Array(8*n.length);let r=0;for(const{x:o,y:l,width:h,height:c}of n){const n=o*t+i,d=(1-l-c)*e+s;a[r]=a[r+4]=n,a[r+1]=a[r+3]=d,a[r+2]=a[r+6]=n+h*t,a[r+5]=a[r+7]=d+c*e,r+=8}return a}function Mu(t){return c(nu,this).serialize(t,l(pu,this,ku).call(this))}function Cu(t,e){this._freeHighlight.add(e)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}function Tu(t,e){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}function Ru(t){const{color:e}=this._initialData;return t.color.some(((t,i)=>t!==e[i]))}w=fu,(0,E.A)(fu,"_defaultColor",null),(0,E.A)(fu,"_defaultOpacity",1),(0,E.A)(fu,"_defaultThickness",12),(0,E.A)(fu,"_type","highlight"),(0,E.A)(fu,"_editorType",B.HIGHLIGHT),(0,E.A)(fu,"_freeHighlightId",-1),(0,E.A)(fu,"_freeHighlight",null),(0,E.A)(fu,"_freeHighlightClipId","");var Pu=new WeakMap,Lu=new WeakMap,Iu=new WeakMap,Du=new WeakMap,Fu=new WeakMap,Ou=new WeakMap,Nu=new WeakMap,Wu=new WeakMap,ju=new WeakMap,Bu=new WeakMap,Hu=new WeakMap,zu=new WeakMap,Gu=new WeakMap,Vu=new WeakSet;class Uu extends ln{constructor(t){super((0,s.A)((0,s.A)({},t),{},{name:"inkEditor"})),r(this,Vu),o(this,Pu,0),o(this,Lu,0),o(this,Iu,null),o(this,Du,new Path2D),o(this,Fu,!1),o(this,Ou,null),o(this,Nu,!1),o(this,Wu,!1),o(this,ju,null),o(this,Bu,null),o(this,Hu,0),o(this,zu,0),o(this,Gu,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){ln.initialize(t,e)}static updateDefaultParams(t,e){switch(t){case H.INK_THICKNESS:Uu._defaultThickness=e;break;case H.INK_COLOR:Uu._defaultColor=e;break;case H.INK_OPACITY:Uu._defaultOpacity=e/100}}updateParams(t,e){switch(t){case H.INK_THICKNESS:l(Vu,this,qu).call(this,e);break;case H.INK_COLOR:l(Vu,this,Xu).call(this,e);break;case H.INK_OPACITY:l(Vu,this,Ku).call(this,e)}}static get defaultPropertiesToUpdate(){return[[H.INK_THICKNESS,Uu._defaultThickness],[H.INK_COLOR,Uu._defaultColor||ln._defaultLineColor],[H.INK_OPACITY,Math.round(100*Uu._defaultOpacity)]]}get propertiesToUpdate(){var t;return[[H.INK_THICKNESS,this.thickness||Uu._defaultThickness],[H.INK_COLOR,this.color||Uu._defaultColor||ln._defaultLineColor],[H.INK_OPACITY,Math.round(100*(null!==(t=this.opacity)&&void 0!==t?t:Uu._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.canvas||(l(Vu,this,lp).call(this),l(Vu,this,hp).call(this)),this.isAttachedToDOM||(this.parent.add(this),l(Vu,this,cp).call(this)),l(Vu,this,Ap).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,c(Iu,this)&&(clearTimeout(c(Iu,this)),d(Iu,this,null)),null===(t=c(ju,this))||void 0===t||t.disconnect(),d(ju,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(){c(Fu,this)||null===this.canvas||(super.enableEditMode(),this._isDraggable=!1,l(Vu,this,ap).call(this))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),l(Vu,this,rp).call(this))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}commit(){c(Fu,this)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),d(Fu,this,!0),this.div.classList.add("disabled"),l(Vu,this,Ap).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()&&!c(Fu,this)&&(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),l(Vu,this,Ju).call(this,t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),l(Vu,this,Zu).call(this,t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),l(Vu,this,op).call(this,t)}canvasPointerleave(t){l(Vu,this,op).call(this,t)}get isResizable(){return!this.isEmpty()&&c(Fu,this)}
1render(){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]=l(Vu,this,Yu).call(this);if(this.setAt(i,s,0,0),this.setDims(n,a),l(Vu,this,lp).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),d(Wu,this,!0),l(Vu,this,cp).call(this),this.setDims(this.width*i,this.height*s),l(Vu,this,np).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return l(Vu,this,hp).call(this),this.div}setDimensions(t,e){const i=Math.round(t),s=Math.round(e);if(c(Hu,this)===i&&c(zu,this)===s)return;d(Hu,this,i),d(zu,this,s),this.canvas.style.visibility="hidden";const[n,a]=this.parentDimensions;this.width=t/n,this.height=e/a,this.fixAndSetPosition(),c(Fu,this)&&l(Vu,this,dp).call(this,t,e),l(Vu,this,cp).call(this),l(Vu,this,np).call(this),this.canvas.style.visibility="visible",this.fixDims()}static async deserialize(t,e,i){if(t instanceof Qh)return null;const s=await super.deserialize(t,e,i);s.thickness=t.thickness,s.color=Vt.makeHexColor(...t.color),s.opacity=t.opacity;const[n,a]=s.pageDimensions,r=s.width*n,o=s.height*a,h=s.parentScale,c=t.thickness/2;d(Fu,s,!0),d(Hu,s,Math.round(r)),d(zu,s,Math.round(o));const{paths:u,rect:p,rotation:f}=t;for(let{bezier:d}of u){d=gp.call(Uu,d,p,f);const t=[];s.paths.push(t);let e=h*(d[0]-c),i=h*(d[1]-c);for(let s=2,a=d.length;s<a;s+=6){const n=h*(d[s]-c),a=h*(d[s+1]-c),r=h*(d[s+2]-c),o=h*(d[s+3]-c),l=h*(d[s+4]-c),u=h*(d[s+5]-c);t.push([[e,i],[n,a],[r,o],[l,u]]),e=l,i=u}const n=l(Uu,this,pp).call(this,t);s.bezierPath2D.push(n)}const g=l(Vu,s,vp).call(s);return d(Lu,s,Math.max(ln.MIN_SIZE,g[2]-g[0])),d(Pu,s,Math.max(ln.MIN_SIZE,g[3]-g[1])),l(Vu,s,dp).call(s,r,o),s}serialize(){if(this.isEmpty())return null;const t=this.getRect(0,0),e=ln._colorManager.convert(this.ctx.strokeStyle);return{annotationType:B.INK,color:e,thickness:this.thickness,opacity:this.opacity,paths:l(Vu,this,mp).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}function qu(t){const e=t=>{this.thickness=t,l(Vu,this,Ap).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:H.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}function Xu(t){const e=t=>{this.color=t,l(Vu,this,np).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:H.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function Ku(t){const e=t=>{this.opacity=t,l(Vu,this,np).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:H.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}function Yu(){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 Qu(){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 Ju(t,e){this.canvas.addEventListener("contextmenu",ve,{signal:this._uiManager._signal}),l(Vu,this,rp).call(this),d(Ou,this,new AbortController);const i=this._uiManager.combinedSignal(c(Ou,this));var s;(this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:i}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:i}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:i}
1),this.isEditing=!0,c(Wu,this))||(d(Wu,this,!0),l(Vu,this,cp).call(this),this.thickness||(this.thickness=y._defaultThickness),this.color||(this.color=y._defaultColor||ln._defaultLineColor),null!==(s=this.opacity)&&void 0!==s||(this.opacity=y._defaultOpacity));this.currentPath.push([t,e]),d(Nu,this,!1),l(Vu,this,Qu).call(this),d(Gu,this,(()=>{l(Vu,this,ep).call(this),c(Gu,this)&&window.requestAnimationFrame(c(Gu,this))})),window.requestAnimationFrame(c(Gu,this))}function Zu(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=c(Du,this);if(n.push([t,e]),d(Nu,this,!0),n.length<=2)return a.moveTo(...n[0]),void a.lineTo(t,e);3===n.length&&(d(Du,this,a=new Path2D),a.moveTo(...n[0])),l(Vu,this,ip).call(this,a,...n.at(-3),...n.at(-2),t,e)}function $u(){if(0===this.currentPath.length)return;const t=this.currentPath.at(-1);c(Du,this).lineTo(...t)}function tp(t,e){let i;if(d(Gu,this,null),t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height),l(Vu,this,Zu).call(this,t,e),l(Vu,this,$u).call(this),1!==this.currentPath.length)i=l(Vu,this,sp).call(this);else{const s=[t,e];i=[[s,s.slice(),s.slice(),s]]}const s=c(Du,this),n=this.currentPath;this.currentPath=[],d(Du,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||(l(Vu,this,lp).call(this),l(Vu,this,hp).call(this)),l(Vu,this,Ap).call(this))},mustExec:!0})}function ep(){if(!c(Nu,this))return;d(Nu,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(c(Du,this)),n.restore()}function ip(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 sp(){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 np(){if(this.isEmpty())return void l(Vu,this,up).call(this);l(Vu,this,Qu).call(this);const{canvas:t,ctx:e}=this;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height),l(Vu,this,up).call(this);for(const i of this.bezierPath2D)e.stroke(i)}function ap(){if(c(Bu,this))return;d(Bu,this,new AbortController);const t=this._uiManager.combinedSignal(c(Bu,this));this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:t})}function rp(){var t;null===(t=this.pointerdownAC)||void 0===t||t.abort(),this.pointerdownAC=null}function op(t){var e;null===(e=c(Ou,this))||void 0===e||e.abort(),d(Ou,this,null),l(Vu,this,ap).call(this),c(Iu,this)&&clearTimeout(c(Iu,this)),d(Iu,this,setTimeout((()=>{d(Iu,this,null),this.canvas.removeEventListener("contextmenu",ve)}),10)),l(Vu,this,tp).call(this,t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()}function lp(){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 hp(){d(ju,this,new ResizeObserver((t=>{const e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)}))),c(ju,this).observe(this.div),this._uiManager._signal.addEventListener("abort",(()=>{var t;null===(t=c(ju,this))||void 0===t||t.disconnect(),d(ju,this,null)}),{once:!0})}function cp(){if(!c(Wu,this))return;const[t,e]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),l(Vu,this,up).call(this)}function dp(t,e){const i=l(Vu,this,bp).call(this),s=(t-i)/c(Lu,this),n=(e-i)/c(Pu,this);this.scaleFactor=Math.min(s,n)}function up(){const t=l(Vu,this,bp).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}
1function pp(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 fp(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 gp(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 mp(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:fp.call(y,e,s,this.rotation),points:fp.call(y,i,s,this.rotation)})}return n}function vp(){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 bp(){return c(Fu,this)?Math.ceil(this.thickness*this.parentScale):0}function Ap(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return;if(!c(Fu,this))return void l(Vu,this,np).call(this);const e=l(Vu,this,vp).call(this),i=l(Vu,this,bp).call(this);d(Lu,this,Math.max(ln.MIN_SIZE,e[2]-e[0])),d(Pu,this,Math.max(ln.MIN_SIZE,e[3]-e[1]));const s=Math.ceil(i+c(Lu,this)*this.scaleFactor),n=Math.ceil(i+c(Pu,this)*this.scaleFactor),[a,r]=this.parentDimensions;this.width=s/a,this.height=n/r,this.setAspectRatio(s,n);const o=this.translationX,h=this.translationY;this.translationX=-e[0],this.translationY=-e[1],l(Vu,this,cp).call(this),l(Vu,this,np).call(this),d(Hu,this,s),d(zu,this,n),this.setDims(s,n);const u=t?i/this.scaleFactor/2:0;this.translate(o-this.translationX-u,h-this.translationY-u)}y=Uu,(0,E.A)(Uu,"_defaultColor",null),(0,E.A)(Uu,"_defaultOpacity",1),(0,E.A)(Uu,"_defaultThickness",1),(0,E.A)(Uu,"_type","ink"),(0,E.A)(Uu,"_editorType",B.INK);var wp=new WeakMap,yp=new WeakMap,_p=new WeakMap,xp=new WeakMap,Ep=new WeakMap,kp=new WeakMap,Sp=new WeakMap,Mp=new WeakMap,Cp=new WeakMap,Tp=new WeakMap,Rp=new WeakMap,Pp=new WeakSet;class Lp extends ln{constructor(t){super((0,s.A)((0,s.A)({},t),{},{name:"stampEditor"})),r(this,Pp),o(this,wp,null),o(this,yp,null),o(this,_p,null),o(this,xp,null),o(this,Ep,null),o(this,kp,""),o(this,Sp,null),o(this,Mp,null),o(this,Cp,null),o(this,Tp,!1),o(this,Rp,!1),d(xp,this,t.bitmapUrl),d(Ep,this,t.bitmapFile)}static initialize(t,e){ln.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(B.STAMP,{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!(null===(t=this.altTextData)||void 0===t||!t.altText)}}static computeTelemetryFinalData(t){var e,i;const s=t.get("hasAltText");return{hasAltText:null!==(e=s.get(!0))&&void 0!==e?e:0,hasNoAltText:null!==(i=s.get(!1))&&void 0!==i?i:0}}async mlGuessAltText(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:s,width:n,height:a}=t||this.copyCanvas(null,null,!0).imageData,r=await i.guess({name:"altText",request:{data:s,width:n,height:a,channels:s.length/(n*a)}});if(!r)throw new Error("No response from the AI service.");if(r.error)throw new Error("Error from the AI service.");if(r.cancel)return null;if(!r.output)throw new Error("No valid response from the AI service.");const o=r.output;return await this.setGuessedAltText(o),e&&!this.hasAltTextData()&&(this.altTextData={alt:o,decorative:!1}),o}remove(){var t,e;c(yp,this)&&(d(wp,this,null),this._uiManager.imageManager.deleteId(c(yp,this)),null===(t=c(Sp,this))||void 0===t||t.remove(),d(Sp,this,null),null===(e=c(Mp,this))||void 0===e||e.disconnect(),d(Mp,this,null),
1c(Cp,this)&&(clearTimeout(c(Cp,this)),d(Cp,this,null)));super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(c(yp,this)&&null===c(Sp,this)&&l(Pp,this,Fp).call(this),this.isAttachedToDOM||this.parent.add(this))):c(yp,this)&&l(Pp,this,Fp).call(this)}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(c(_p,this)||c(wp,this)||c(xp,this)||c(Ep,this)||c(yp,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.div.setAttribute("role","figure"),this.addAltTextButton(),c(wp,this)?l(Pp,this,Op).call(this):l(Pp,this,Fp).call(this),this.width&&!this.annotationElementId){const[i,s]=this.parentDimensions;this.setAt(t*i,e*s,this.width*i,this.height*s)}return this.div}copyCanvas(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t||(t=224);const{width:s,height:n}=c(wp,this),a=new Se;let r=c(wp,this),o=s,h=n,d=null;if(e){var u,p;if(s>e||n>e){const t=Math.min(e/s,e/n);o=Math.floor(s*t),h=Math.floor(n*t)}d=document.createElement("canvas");const t=d.width=Math.ceil(o*a.sx),i=d.height=Math.ceil(h*a.sy);c(Tp,this)||(r=l(Pp,this,Wp).call(this,t,i));const f=d.getContext("2d");f.filter=this._uiManager.hcmFilter;let g="white",m="#cfcfd8";"none"!==this._uiManager.hcmFilter?m="black":null!==(u=(p=window).matchMedia)&&void 0!==u&&u.call(p,"(prefers-color-scheme: dark)").matches&&(g="#8f8f9d",m="#42414d");const v=15,b=v*a.sx,A=v*a.sy,w=new OffscreenCanvas(2*b,2*A),y=w.getContext("2d");y.fillStyle=g,y.fillRect(0,0,2*b,2*A),y.fillStyle=m,y.fillRect(0,0,b,A),y.fillRect(b,A,b,A),f.fillStyle=f.createPattern(w,"repeat"),f.fillRect(0,0,t,i),f.drawImage(r,0,0,r.width,r.height,0,0,t,i)}let f=null;if(i){let e,i;if(a.symmetric&&r.width<t&&r.height<t)e=r.width,i=r.height;else if(r=c(wp,this),s>t||n>t){const a=Math.min(t/s,t/n);e=Math.floor(s*a),i=Math.floor(n*a),c(Tp,this)||(r=l(Pp,this,Wp).call(this,e,i))}const o=new OffscreenCanvas(e,i).getContext("2d",{willReadFrequently:!0});o.drawImage(r,0,0,r.width,r.height,0,0,e,i),f={width:e,height:i,data:o.getImageData(0,0,e,i).data}}return{canvas:d,width:o,height:h,imageData:f}}getImageForAltText(){return c(Sp,this)}static async deserialize(t,e,i){let s=null;if(t instanceof ec){var n;const{data:{rect:a,rotation:r,id:o,structParent:l,popupRef:h},container:c,parent:{page:{pageNumber:d}}}=t,u=c.querySelector("canvas"),p=i.imageManager.getFromCanvas(c.id,u);u.remove();const f=(null===(n=await e._structTree.getAriaAttributes("".concat(Qt).concat(o)))||void 0===n?void 0:n.get("aria-label"))||"";s=t={annotationType:B.STAMP,bitmapId:p.id,bitmap:p.bitmap,pageIndex:d-1,rect:a.slice(0),rotation:r,id:o,deleted:!1,accessibilityData:{decorative:!1,altText:f},isSvg:!1,structParent:l,popupRef:h}}const a=await super.deserialize(t,e,i),{rect:r,bitmap:o,bitmapUrl:l,bitmapId:h,isSvg:c,accessibilityData:u}=t;h&&i.imageManager.isValidId(h)?(d(yp,a,h),o&&d(wp,a,o)):d(xp,a,l),d(Tp,a,c);const[p,f]=a.pageDimensions;return a.width=(r[2]-r[0])/p,a.height=(r[3]-r[1])/f,a.annotationElementId=t.id||null,u&&(a.altTextData=u),a._initialData=s,d(Rp,a,!!s),a}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;if(this.deleted)return this.serializeDeleted();const i={annotationType:B.STAMP,bitmapId:c(yp,this),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:c(Tp,this),structTreeParentId:this._structTreeParentId};if(t)return i.bitmapUrl=l(Pp,this,Bp).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i;const{decorative:s,altText:n}=this.serializeAltText(!1);if(!s&&n&&(i.accessibilityData={type:"Figure",alt:n}),this.annotationElementId){const t=l(Pp,this,zp).call(this,i);if(t.isSame)return null;var a;if(t.isSameAltText)delete i.accessibilityData;else i.accessibilityData.structParent=null!==(a=this._initialData.structParent)&&void 0!==a?a:-1}if(i.id=this.annotationElementId,null===e)return i;e.stamps||(e.stamps=new Map);const r=c(Tp,this)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has(c(yp,this))){if(c(Tp,this)){const t=e.stamps.get(c(yp,this));r>t.area&&(t.area=r,t.serialized.bitmap.close(),t.serialized.bitmap=l(Pp,this,Bp).call(this,!1))}}else e.stamps.set(c(yp,this),{area:r,serialized:i}),i.bitmap=l(Pp,this,Bp).call(this,!1);return i}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}}function Ip(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t?(d(wp,this,t.bitmap),e||(d(yp,this,t.id),d(Tp,this,t.isSvg)),t.file&&d(kp,this,t.file.name),l(Pp,this,Op).call(this)):this.remove()}function Dp(){if(d(_p,this,null),this._uiManager.enableWaiting(!1),c(Sp,this)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&c(wp,this))return this._editToolbar.hide(),void this._uiManager.editAltText(this,!0);if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&c(wp,this)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch(t){}}this.div.focus()}}function Fp(){if(c(yp,this))return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(c(yp,this)).then((t=>l(Pp,this,Ip).call(this,t,!0))).finally((()=>l(Pp,this,Dp).call(this)));if(c(xp,this)){const t=c(xp,this);return d(xp,this,null),this._uiManager.enableWaiting(!0),void d(_p,this,this._uiManager.imageManager.getFromUrl(t).then((t=>l(Pp,this,Ip).call(this,t))).finally((()=>l(Pp,this,Dp).call(this))))}if(c(Ep,this)){const t=c(Ep,this);return d(Ep,this,null),this._uiManager.enableWaiting(!0),void d(_p,this,this._uiManager.imageManager.getFromFile(t).then((t=>l(Pp,this,Ip).call(this,t))).finally((()=>l(Pp,this,Dp).call(this))))}const t=document.createElement("input");t.type="file",t.accept=_.supportedTypesStr;const e=this._uiManager._signal;d(_p,this,new Promise((i=>{t.addEventListener("change",(async()=>
1{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);const e=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),l(Pp,this,Ip).call(this,e)}else this.remove();i()}),{signal:e}),t.addEventListener("cancel",(()=>{this.remove(),i()}),{signal:e})})).finally((()=>l(Pp,this,Dp).call(this)))),t.click()}function Op(){const{div:t}=this;let{width:e,height:i}=c(wp,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[r,o]=this.parentDimensions;this.setDims(e*r/s,i*o/n),this._uiManager.enableWaiting(!1);const h=d(Sp,this,document.createElement("canvas"));h.setAttribute("role","img"),this.addContainer(h),this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(t.hidden=!1),l(Pp,this,jp).call(this,e,i),l(Pp,this,Hp).call(this),c(Rp,this)||(this.parent.addUndoableEditor(this),d(Rp,this,!0)),this._reportTelemetry({action:"inserted_image"}),c(kp,this)&&h.setAttribute("aria-label",c(kp,this))}function Np(t,e){var i;const[s,n]=this.parentDimensions;this.width=t/s,this.height=e/n,null!==(i=this._initialOptions)&&void 0!==i&&i.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==c(Cp,this)&&clearTimeout(c(Cp,this));d(Cp,this,setTimeout((()=>{d(Cp,this,null),l(Pp,this,jp).call(this,t,e)}),200))}function Wp(t,e){const{width:i,height:s}=c(wp,this);let n=i,a=s,r=c(wp,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 jp(t,e){const i=new Se,s=Math.ceil(t*i.sx),n=Math.ceil(e*i.sy),a=c(Sp,this);if(!a||a.width===s&&a.height===n)return;a.width=s,a.height=n;const r=c(Tp,this)?c(wp,this):l(Pp,this,Wp).call(this,s,n),o=a.getContext("2d");o.filter=this._uiManager.hcmFilter,o.drawImage(r,0,0,r.width,r.height,0,0,s,n)}function Bp(t){if(t){if(c(Tp,this)){const t=this._uiManager.imageManager.getSvgUrl(c(yp,this));if(t)return t}const t=document.createElement("canvas");({width:t.width,height:t.height}=c(wp,this));return t.getContext("2d").drawImage(c(wp,this),0,0),t.toDataURL()}if(c(Tp,this)){const[t,e]=this.pageDimensions,i=Math.round(this.width*t*oe.PDF_TO_CSS_UNITS),s=Math.round(this.height*e*oe.PDF_TO_CSS_UNITS),n=new OffscreenCanvas(i,s);return n.getContext("2d").drawImage(c(wp,this),0,0,c(wp,this).width,c(wp,this).height,0,0,i,s),n.transferToImageBitmap()}return structuredClone(c(wp,this))}function Hp(){this._uiManager._signal&&(d(Mp,this,new ResizeObserver((t=>{const e=t[0].contentRect;e.width&&e.height&&l(Pp,this,Np).call(this,e.width,e.height)}))),c(Mp,this).observe(this.div),this._uiManager._signal.addEventListener("abort",(()=>{var t;null===(t=c(Mp,this))||void 0===t||t.disconnect(),d(Mp,this,null)}),{once:!0}))}function zp(t){var e;const{rect:i,pageIndex:s,accessibilityData:{altText:n}}=this._initialData,a=t.rect.every(((t,e)=>Math.abs(t-i[e])<1)),r=t.pageIndex===s,o=((null===(e=t.accessibilityData)||void 0===e?void 0:e.alt)||"")===n;return{isSame:a&&r&&o,isSameAltText:o}}_=Lp,(0,E.A)(Lp,"_type","stamp"),(0,E.A)(Lp,"_editorType",B.STAMP);var Gp=new WeakMap,Vp=new WeakMap,Up=new WeakMap,qp=new WeakMap,Xp=new WeakMap,Kp=new WeakMap,Yp=new WeakMap,Qp=new WeakMap,Jp=new WeakMap,Zp=new WeakMap,$p=new WeakMap,tf=new WeakMap,ef=new WeakSet;class sf{constructor(t){let{uiManager:e,pageIndex:i,div:s,structTreeLayer:n,accessibilityManager:a,annotationLayer:l,drawLayer:h,textLayer:u,viewport:p,l10n:f}=t;r(this,ef),o(this,Gp,void 0),o(this,Vp,!1),o(this,Up,null),o(this,qp,null),o(this,Xp,null),o(this,Kp,new Map),o(this,Yp,!1),o(this,Qp,!1),o(this,Jp,!1),o(this,Zp,null),o(this,$p,null),o(this,tf,void 0);const g=[...hf._.values()];if(!sf._initialized){sf._initialized=!0;for(const t of g)t.initialize(f,e)}e.registerEditorTypes(g),d(tf,this,e),this.pageIndex=i,this.div=s,d(Gp,this,a),d(Up,this,l),this.viewport=p,d(Zp,this,u),this.drawLayer=h,this._structTree=n,c(tf,this).addLayer(this)}get isEmpty(){return 0===c(Kp,this).size}get isInvisible(){return this.isEmpty&&c(tf,this).getMode()===B.NONE}updateToolbar(t){c(tf,this).updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c(tf,this).getMode();
1switch(l(ef,this,lf).call(this),t){case B.NONE:return this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case B.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case B.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 hf._.values())e.toggle("".concat(i._type,"Editing"),t===i._editorType);this.div.hidden=!1}hasTextLayer(t){var e;return t===(null===(e=c(Zp,this))||void 0===e?void 0:e.div)}addInkEditorIfNeeded(t){if(c(tf,this).getMode()!==B.INK)return;if(!t)for(const e of c(Kp,this).values())if(e.isEmpty())return void e.setInBackground();this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(t){c(tf,this).setEditingState(t)}addCommands(t){c(tf,this).addCommands(t)}toggleDrawing(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("drawing",!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=c(Up,this))||void 0===t||t.div.classList.toggle("disabled",!e)}async enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const t=new Set;for(const i of c(Kp,this).values())i.enableEditing(),i.show(!0),i.annotationElementId&&(c(tf,this).removeChangedExistingAnnotation(i),t.add(i.annotationElementId));if(!c(Up,this))return;const e=c(Up,this).getEditableAnnotations();for(const i of e){if(i.hide(),c(tf,this).isDeletedAnnotationElement(i.data.id))continue;if(t.has(i.data.id))continue;const e=await this.deserialize(i);e&&(this.addOrRebuild(e),e.enableEditing())}}disable(){d(Jp,this,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const t=new Map,e=new Map;for(const n of c(Kp,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(c(Up,this)){const i=c(Up,this).getEditableAnnotations();for(const s of i){const{id:i}=s.data;if(c(tf,this).isDeletedAnnotationElement(i))continue;let n=e.get(i);n?(n.resetAnnotationElement(s),n.show(!1),s.show()):(n=t.get(i),n&&(c(tf,this).addChangedExistingAnnotation(n),n.renderAnnotationElement(s)&&n.show(!1)),s.show())}}l(ef,this,lf).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const n of hf._.values())s.remove("".concat(n._type,"Editing"));this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),d(Jp,this,!1)}getEditableAnnotation(t){var e;return(null===(e=c(Up,this))||void 0===e?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){c(tf,this).getActive()!==t&&c(tf,this).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,null!==(t=c(Zp,this))&&void 0!==t&&t.div&&!c($p,this)){d($p,this,new AbortController);const t=c(tf,this).combinedSignal(c($p,this));c(Zp,this).div.addEventListener("pointerdown",l(ef,this,nf).bind(this),{signal:t}),c(Zp,this).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,null!==(t=c(Zp,this))&&void 0!==t&&t.div&&c($p,this)&&(c($p,this).abort(),d($p,this,null),c(Zp,this).div.classList.remove("highlighting"))}enableClick(){if(c(qp,this))return;d(qp,this,new AbortController);const t=c(tf,this).combinedSignal(c(qp,this));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:t})}disableClick(){var t;null===(t=c(qp,this))||void 0===t||t.abort(),d(qp,this,null)}attach(t){c(Kp,this).set(t.id,t);const{annotationElementId:e}=t;e&&c(tf,this).isDeletedAnnotationElement(e)&&c(tf,this).removeDeletedAnnotationElement(t)}detach(t){var e;c(Kp,this).delete(t.id),null===(e=c(Gp,this))||void 0===e||e.removePointerInTextLayer(t.contentDiv),!c(Jp,this)&&t.annotationElementId&&c(tf,this).addDeletedAnnotationElement(t)}remove(t){this.detach(t),c(tf,this).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,c(Qp,this)||this.addInkEditorIfNeeded(!1)}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(c(tf,this).addDeletedAnnotationElement(t.annotationElementId),ln.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),c(tf,this).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),c(tf,this).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var e;if(!t.isAttachedToDOM)return;const{activeElement:i}=document;t.div.contains(i)&&!c(Xp,this)&&(t._focusEventsAllowed=!1,d(Xp,this,setTimeout((()=>{d(Xp,this,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",(()=>{t._focusEventsAllowed=!0}),{once:!0,signal:c(tf,this)._signal}),i.focus())}),0))),t._structTreeParentId=null===(e=c(Gp,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 c(tf,this).getId()}combinedSignal(t){return c(tf,this).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return null===(t=h(ef,this,af))||void 0===t?void 0:t.canCreateNewEmptyEditor()}pasteEditor(t,e){c(tf,this).updateToolbar(t),c(tf,this).updateMode(t);const{offsetX:i,offsetY:n}=l(ef,this,of).call(this),a=this.getNextId(),r=l(ef,this,rf).call(this,(0,s.A)({parent:this,id:a,x:i,y:n,uiManager:c(tf,this),isCentered:!0},e));r&&this.add(r)}async deserialize(t){var e,i;return await(null===(e=hf._.get(null!==(i=t.annotationType)&&void 0!==i?i:t.annotationEditorType))||void 0===e?void 0:e.deserialize(t,this,c(tf,this)))||null}createAndAddNewEditor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getNextId(),a=l(ef,this,rf).call(this,(0,s.A)({parent:this,id:n,x:t.offsetX,y:t.offsetY,uiManager:c(tf,this),isCentered:e},i));return a&&this.add(a),a}addNewEditor(){this.createAndAddNewEditor(l(ef,this,of).call(this),!0)}setSelected(t){c(tf,this).setSelected(t)}toggleSelected(t){c(tf,this).toggleSelected(t)}unselect(t){c(tf,this).unselect(t)}pointerup(t){const{isMac:e}=zt.platform;0!==t.button||t.ctrlKey&&e||t.target===this.div&&c(Yp,this)&&(d(Yp,this,!1),c(Vp,this)?c(tf,this).getMode()!==B.STAMP?this.createAndAddNewEditor(t,!1):c(tf,this).unselectAll():d(Vp,this,!0))}pointerdown(t){if(c(tf,this).getMode()===B.HIGHLIGHT&&this.enableTextSelection(),c(Yp,this))return void d(Yp,this,!1);const{isMac:e}=zt.platform;if(0!==t.button||t.ctrlKey&&e)return;if(t.target!==this.div)return;d(Yp,this,!0);const i=c(tf,this).getActive();d(Vp,this,!i||i.isEmpty())}findNewParent(t,e,i){const s=c(tf,this).findParent(e,i);return null!==s&&s!==this&&(s.changeParent(t),!0)}destroy(){var t;(null===(t=c(tf,this).getActive())||void 0===t?void 0:t.parent)===this&&(c(tf,this).commitOrRemove(),c(tf,this).setActiveEditor(null)),c(Xp,this)&&(clearTimeout(c(Xp,this)),d(Xp,this,null));for(const i of c(Kp,this).values()){var e;null===(e=c(Gp,this))||void 0===e||e.removePointerInTextLayer(i.contentDiv),i.setParent(null),i.isAttachedToDOM=!1,i.div.remove()}this.div=null,c(Kp,this).clear(),c(tf,this).removeLayer(this)}render(t){let{viewport:e}=t;this.viewport=e,ke(this.div,e);for(const i of c(tf,this).getEditors(this.pageIndex))this.add(i),i.rebuild();this.updateMode()}update(t){let{viewport:e}=t;
1c(tf,this).commitOrRemove(),l(ef,this,lf).call(this);const i=this.viewport.rotation,s=e.rotation;if(this.viewport=e,ke(this.div,{rotation:s}),i!==s)for(const n of c(Kp,this).values())n.rotate(s);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return c(tf,this).viewParameters.realScale}}function nf(t){c(tf,this).unselectAll();const{target:e}=t;if(e===c(Zp,this).div||("img"===e.getAttribute("role")||e.classList.contains("endOfContent"))&&c(Zp,this).div.contains(e)){const{isMac:e}=zt.platform;if(0!==t.button||t.ctrlKey&&e)return;c(tf,this).showAllEditors("highlight",!0,!0),c(Zp,this).div.classList.add("free"),this.toggleDrawing(),fu.startHighlighting(this,"ltr"===c(tf,this).direction,{target:c(Zp,this).div,x:t.x,y:t.y}),c(Zp,this).div.addEventListener("pointerup",(()=>{c(Zp,this).div.classList.remove("free"),this.toggleDrawing(!0)}),{once:!0,signal:c(tf,this)._signal}),t.preventDefault()}}function af(t){return hf._.get(c(tf,t).getMode())}function rf(t){const e=h(ef,this,af);return e?new e.prototype.constructor(t):null}function of(){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 lf(){d(Qp,this,!0);for(const t of c(Kp,this).values())t.isEmpty()&&t.remove();d(Qp,this,!1)}(0,E.A)(sf,"_initialized",!1);var hf={_:new Map([yc,Uu,Lp,fu].map((t=>[t._editorType,t])))},cf=new WeakMap,df=new WeakMap,uf=new WeakMap,pf=new WeakMap,ff=new WeakSet;class gf{constructor(t){let{pageIndex:e}=t;r(this,ff),o(this,cf,null),o(this,df,0),o(this,uf,new Map),o(this,pf,new Map),this.pageIndex=e}setParent(t){if(c(cf,this)){if(c(cf,this)!==t){if(c(uf,this).size>0)for(const e of c(uf,this).values())e.remove(),t.append(e);d(cf,this,t)}}else d(cf,this,t)}static get _svgFactory(){return Rt(this,"_svgFactory",new Ol)}draw(t,e,i){var s,n;let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=(d(df,this,(s=c(df,this),n=s++,s)),n),o=l(ff,this,vf).call(this,t.box);o.classList.add(...t.classNamesForDrawing);const h=gf._svgFactory.createElement("defs");o.append(h);const u=gf._svgFactory.createElement("path");h.append(u);const p="path_p".concat(this.pageIndex,"_").concat(r);u.setAttribute("id",p),u.setAttribute("d",t.toSVGPath()),a&&c(pf,this).set(r,u);const f=l(ff,this,bf).call(this,h,p),g=gf._svgFactory.createElement("use");return o.append(g),o.setAttribute("fill",e),o.setAttribute("fill-opacity",i),g.setAttribute("href","#".concat(p)),c(uf,this).set(r,o),{id:r,clipPathId:"url(#".concat(f,")")}}drawOutline(t){var e,i;const s=(d(df,this,(e=c(df,this),i=e++,e)),i),n=l(ff,this,vf).call(this,t.box);n.classList.add(...t.classNamesForOutlining);const a=gf._svgFactory.createElement("defs");n.append(a);const r=gf._svgFactory.createElement("path");a.append(r);const o="path_p".concat(this.pageIndex,"_").concat(s);let h;if(r.setAttribute("id",o),r.setAttribute("d",t.toSVGPath()),r.setAttribute("vector-effect","non-scaling-stroke"),t.mustRemoveSelfIntersections){const t=gf._svgFactory.createElement("mask");a.append(t),h="mask_p".concat(this.pageIndex,"_").concat(s),t.setAttribute("id",h),t.setAttribute("maskUnits","objectBoundingBox");const e=gf._svgFactory.createElement("rect");t.append(e),e.setAttribute("width","1"),e.setAttribute("height","1"),e.setAttribute("fill","white");const i=gf._svgFactory.createElement("use");t.append(i),i.setAttribute("href","#".concat(o)),i.setAttribute("stroke","none"),i.setAttribute("fill","black"),i.setAttribute("fill-rule","nonzero"),i.classList.add("mask")}const u=gf._svgFactory.createElement("use");n.append(u),u.setAttribute("href","#".concat(o)),h&&u.setAttribute("mask","url(#".concat(h,")"));const p=u.cloneNode();return n.append(p),u.classList.add("mainOutline"),p.classList.add("secondaryOutline"),c(uf,this).set(s,n),s}finalizeLine(t,e){const i=c(pf,this).get(t);c(pf,this).delete(t),this.updateBox(t,e.box),i.setAttribute("d",e.toSVGPath())}updateLine(t,e){c(uf,this).get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}updatePath(t,e){c(pf,this).get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){mf.call(gf,c(uf,this).get(t),e)}show(t,e){c(uf,this).get(t).classList.toggle("hidden",!e)}rotate(t,e){c(uf,this).get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){c(uf,this).get(t).setAttribute("fill",e)}
1changeOpacity(t,e){c(uf,this).get(t).setAttribute("fill-opacity",e)}addClass(t,e){c(uf,this).get(t).classList.add(e)}removeClass(t,e){c(uf,this).get(t).classList.remove(e)}getSVGRoot(t){return c(uf,this).get(t)}remove(t){c(pf,this).delete(t),null!==c(cf,this)&&(c(uf,this).get(t).remove(),c(uf,this).delete(t))}destroy(){d(cf,this,null);for(const t of c(uf,this).values())t.remove();c(uf,this).clear(),c(pf,this).clear()}}function mf(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 vf(t){const e=x._svgFactory.create(1,1,!0);return c(cf,this).append(e),e.setAttribute("aria-hidden",!0),mf.call(x,e,t),e}function bf(t,e){const i=x._svgFactory.createElement("clipPath");t.append(i);const s="clip_".concat(e);i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");const n=x._svgFactory.createElement("use");return i.append(n),n.setAttribute("href","#".concat(e)),n.classList.add("clip"),s}x=gf;var Af=S.AbortException,wf=S.AnnotationEditorLayer,yf=S.AnnotationEditorParamsType,_f=S.AnnotationEditorType,xf=S.AnnotationEditorUIManager,Ef=S.AnnotationLayer,kf=S.AnnotationMode,Sf=S.ColorPicker,Mf=S.DOMSVGFactory,Cf=S.DrawLayer,Tf=S.FeatureTest,Rf=S.GlobalWorkerOptions,Pf=S.ImageKind,Lf=S.InvalidPDFException,If=S.MissingPDFException,Df=S.OPS,Ff=S.OutputScale,Of=S.PDFDataRangeTransport,Nf=S.PDFDateString,Wf=S.PDFWorker,jf=S.PasswordResponses,Bf=S.PermissionFlag,Hf=S.PixelsPerInch,zf=S.RenderingCancelledException,Gf=S.TextLayer,Vf=S.UnexpectedResponseException,Uf=S.Util,qf=S.VerbosityLevel,Xf=S.XfaLayer,Kf=S.build,Yf=S.createValidAbsoluteUrl,Qf=S.fetchData,Jf=S.getDocument,Zf=S.getFilenameFromUrl,$f=S.getPdfFilenameFromUrl,tg=S.getXfaPageViewport,eg=S.isDataScheme,ig=S.isPdfFile,sg=S.noContextMenu,ng=S.normalizeUnicode,ag=S.setLayerDimensions,rg=S.shadow,og=S.version},52477:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=(0,i(65043).createContext)(null);e.default=s},54468:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){let{children:e,type:i}=t;return(0,s.jsx)("div",{className:"react-pdf__message react-pdf__message--".concat(i),children:e})};const s=i(70579)},55935:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isPdfRole=n,e.isStructTreeNode=a,e.isStructTreeNodeWithOnlyContentChild=r,e.getRoleAttributes=o,e.getBaseAttributes=l,e.getAttributes=function(t){if(!t)return null;return Object.assign(Object.assign({},o(t)),l(t))};const s=i(15660);function n(t){return t in s.PDF_ROLE_TO_HTML_ROLE}function a(t){return"children"in t}function r(t){return!!a(t)&&(1===t.children.length&&0 in t.children&&"id"in t.children[0])}function o(t){const e={};if(a(t)){const{role:i}=t,a=i.match(s.HEADING_PATTERN);if(a)e.role="heading",e["aria-level"]=Number(a[1]);else if(n(i)){const t=s.PDF_ROLE_TO_HTML_ROLE[i];t&&(e.role=t)}}return e}function l(t){const e={};if(a(t)){if(void 0!==t.alt&&(e["aria-label"]=t.alt),void 0!==t.lang&&(e.lang=t.lang),r(t)){const[i]=t.children;if(i){const t=l(i);return Object.assign(Object.assign({},e),t)}}}else"id"in t&&(e["aria-owns"]=t.id);return e}},56926:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){const e=(0,s.useRef)(void 0),i=e.current;if((0,n.isDefined)(i))return()=>i;return()=>{const i=t();return e.current=i,i}};const s=i(65043),n=i(87632)},67343:function(t,e,i){"use strict";var s=this&&this.__awaiter||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())}))};Object.defineProperty(e,"__esModule",{value:!0});const n=i(25851);n.pdfjs.GlobalWorkerOptions.workerSrc="//cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(n.pdfjs.version,"/pdf.worker.mjs");e.default=t=>s(void 0,void 0,void 0,(function*(){const e=URL.createObjectURL(t),i=n.pdfjs.getDocument(e);let s="";try{const t=yield i.promise,e=t.numPages;for(let i=1;i<=e;i++){const e=yield t.getPage(i),n=yield e.getTextContent();s+=n.items.map((t=>"str"in t?t.str:"")).join(" ")}}catch(a){throw new Error("Failed to extract text from PDF: ".concat(a))}finally{URL.revokeObjectURL(e),i.destroy()}return s}))}
1,77057:function(t,e,i){"use strict";var s=this&&this.__rest||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},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){const e=(0,g.default)(),i=Object.assign(Object.assign({},e),t),{className:n,inputRef:v,onItemClick:b,onLoadError:A,onLoadSuccess:w,pdf:y}=i,_=s(i,["className","inputRef","onItemClick","onLoadError","onLoadSuccess","pdf"]);(0,c.default)(y,"Attempted to load an outline, but no document was specified. Wrap <Outline /> in a <Document /> or pass explicit `pdf` prop.");const[x,E]=(0,m.default)(),{value:k,error:S}=x;(0,r.useEffect)((function(){E({type:"RESET"})}),[E,y]),(0,r.useEffect)((function(){if(!y)return;const t=(0,o.default)(y.getOutline()),e=t;return t.promise.then((t=>{E({type:"RESOLVE",value:t})})).catch((t=>{E({type:"REJECT",error:t})})),()=>(0,f.cancelRunningTask)(e)}),[E,y]),(0,r.useEffect)((()=>{void 0!==k&&(!1!==k?"undefined"!==typeof k&&!1!==k&&w&&w(k):S&&((0,d.default)(!1,S.toString()),A&&A(S)))}),[k]);const M=(0,r.useMemo)((()=>({onItemClick:b})),[b]),C=(0,r.useMemo)((()=>(0,l.default)(_,(()=>k))),[_,k]);if(!k)return null;return(0,a.jsx)("div",Object.assign({className:(0,h.default)("react-pdf__Outline",n),ref:v},C,{children:(0,a.jsx)(u.default.Provider,{value:M,children:k?(0,a.jsx)("ul",{children:k.map(((t,e)=>(0,a.jsx)(p.default,{item:t,pdf:y},"string"===typeof t.dest?t.dest:e)))}):null})}))};const a=i(70579),r=i(65043),o=n(i(2570)),l=n(i(24873)),h=n(i(12949)),c=n(i(62213)),d=n(i(96440)),u=n(i(81002)),p=n(i(43470)),f=i(87632),g=n(i(48857)),m=n(i(2807))},81002:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=(0,i(65043).createContext)(null);e.default=s},82660:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){return(0,n.useContext)(a.default)};const n=i(65043),a=s(i(81002))},86440:function(t,e,i){"use strict";var s=this&&this.__rest||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},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){const e=(0,A.default)(),i=Object.assign(Object.assign({},e),t),{_className:n="react-pdf__Page",_enableRegisterUnregisterPage:_=!0,canvasBackground:x,canvasRef:E,children:k,className:S,customRenderer:M,customTextRenderer:C,devicePixelRatio:T,error:R="Failed to load the page.",height:P,inputRef:L,loading:I="Loading page\u2026",noData:D="No page specified.",onGetAnnotationsError:F,onGetAnnotationsSuccess:O,onGetStructTreeError:N,onGetStructTreeSuccess:W,onGetTextError:j,onGetTextSuccess:B,onLoadError:H,onLoadSuccess:z,onRenderAnnotationLayerError:G,onRenderAnnotationLayerSuccess:V,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=y,unregisterPage:at,width:rt}=i,ot=s(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,w.default)(),{value:ct,error:dt}=lt,ut=(0,r.useRef)(null);(0,d.default)(J,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");const pt=(0,b.isProvided)(Q)?Q-1:null!==Y&&void 0!==Y?Y:null,ft=null!==Q&&void 0!==Q?Q:(0,b.isProvided)(Y)?Y+1:null,gt=null!==st&&void 0!==st?st:ct?ct.rotate:null,mt=(0,r.useMemo)((()=>
1{if(!ct)return null;let t=1;const e=null!==nt&&void 0!==nt?nt:y;if(rt||P){const e=ct.getViewport({scale:1,rotation:gt});rt?t=rt/e.width:P&&(t=P/e.height)}return e*t}),[P,ct,gt,nt,rt]);(0,r.useEffect)((function(){return()=>{(0,b.isProvided)(pt)&&_&&at&&at(pt)}}),[_,J,pt,at]),(0,r.useEffect)((function(){ht({type:"RESET"})}),[ht,J,pt]),(0,r.useEffect)((function(){if(!J||!ft)return;const t=(0,o.default)(J.getPage(ft)),e=t;return t.promise.then((t=>{ht({type:"RESOLVE",value:t})})).catch((t=>{ht({type:"REJECT",error:t})})),()=>(0,b.cancelRunningTask)(e)}),[ht,J,ft]),(0,r.useEffect)((()=>{void 0!==ct&&(!1!==ct?function(){if(z){if(!ct||!mt)return;z((0,b.makePageCallback)(ct,mt))}if(_&&Z){if(!(0,b.isProvided)(pt)||!ut.current)return;Z(pt,ut.current)}}():dt&&((0,u.default)(!1,dt.toString()),H&&H(dt)))}),[ct,mt]);const vt=(0,r.useMemo)((()=>ct&&(0,b.isProvided)(pt)&&ft&&(0,b.isProvided)(gt)&&(0,b.isProvided)(mt)?{_className:n,canvasBackground:x,customTextRenderer:C,devicePixelRatio:T,onGetAnnotationsError:F,onGetAnnotationsSuccess:O,onGetStructTreeError:N,onGetStructTreeSuccess:W,onGetTextError:j,onGetTextSuccess:B,onRenderAnnotationLayerError:G,onRenderAnnotationLayerSuccess:V,onRenderError:U,onRenderSuccess:q,onRenderTextLayerError:X,onRenderTextLayerSuccess:K,page:ct,pageIndex:pt,pageNumber:ft,renderForms:tt,renderTextLayer:it,rotate:gt,scale:mt}:null),[n,x,C,T,F,O,N,W,j,B,G,V,U,q,X,K,ct,pt,ft,tt,it,gt,mt]),bt=(0,r.useMemo)((()=>(0,l.default)(ot,(()=>ct?mt?(0,b.makePageCallback)(ct,mt):void 0:ct))),[ot,ct,mt]),At="".concat(pt,"@").concat(mt,"/").concat(gt);function wt(){switch(et){case"custom":return(0,d.default)(M,'renderMode was set to "custom", but no customRenderer was passed.'),(0,a.jsx)(M,{},"".concat(At,"_custom"));case"none":return null;default:return(0,a.jsx)(g.default,{canvasRef:E},"".concat(At,"_canvas"))}}return(0,a.jsx)("div",Object.assign({className:(0,h.default)(n,S),"data-page-number":ft,ref:(0,c.default)(L,ut),style:{"--scale-factor":"".concat(mt),backgroundColor:x||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},bt,{children:ft?null===J||void 0===ct||null===ct?(0,a.jsx)(f.default,{type:"loading",children:"function"===typeof I?I():I}):!1===J||!1===ct?(0,a.jsx)(f.default,{type:"error",children:"function"===typeof R?R():R}):(0,a.jsxs)(p.default.Provider,{value:vt,children:[wt(),it?(0,a.jsx)(m.default,{},"".concat(At,"_text")):null,$?(0,a.jsx)(v.default,{},"".concat(At,"_annotations")):null,k]}):(0,a.jsx)(f.default,{type:"no-data",children:"function"===typeof D?D():D})}))};const a=i(70579),r=i(65043),o=n(i(2570)),l=n(i(24873)),h=n(i(12949)),c=n(i(41614)),d=n(i(62213)),u=n(i(96440)),p=n(i(52477)),f=n(i(54468)),g=n(i(1391)),m=n(i(25379)),v=n(i(93645)),b=i(87632),A=n(i(48857)),w=n(i(2807)),y=1},87632:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.isLocalFileSystem=e.isBrowser=void 0,e.isDefined=r,e.isProvided=function(t){return r(t)&&null!==t},e.isString=o,e.isArrayBuffer=function(t){return t instanceof ArrayBuffer},e.isBlob=function(t){return(0,n.default)(e.isBrowser,"isBlob can only be used in a browser environment"),t instanceof Blob},e.isDataURI=l,e.dataURItoByteString=function(t){(0,n.default)(l(t),"Invalid data URI.");const[e="",i=""]=t.split(",");if(-1!==e.split(";").indexOf("base64"))return atob(i);return unescape(i)},e.getDevicePixelRatio=function(){return e.isBrowser&&window.devicePixelRatio||1},e.displayCORSWarning=function(){(0,a.default)(!e.isLocalFileSystem,"Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ".concat(h))},e.displayWorkerWarning=function(){(0,a.default)(!e.isLocalFileSystem,"Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ".concat(h))},e.cancelRunningTask=function(t){(null===t||void 0===t?void 0:t.cancel)&&t.cancel()},e.makePageCallback=function(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}
1,e.isCancelException=function(t){return"RenderingCancelledException"===t.name},e.loadFromFile=function(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)}))};const n=s(i(62213)),a=s(i(96440));function r(t){return"undefined"!==typeof t}function o(t){return"string"===typeof t}function l(t){return o(t)&&/^data:/.test(t)}e.isBrowser="undefined"!==typeof window,e.isLocalFileSystem=e.isBrowser&&"file:"===window.location.protocol;const h="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes."},92797:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function t(e){let{className:i,node:r}=e;const o=(0,n.useMemo)((()=>(0,a.getAttributes)(r)),[r]),l=(0,n.useMemo)((()=>(0,a.isStructTreeNode)(r)?(0,a.isStructTreeNodeWithOnlyContentChild)(r)?null:r.children.map(((e,i)=>(0,s.jsx)(t,{node:e},i))):null),[r]);return(0,s.jsx)("span",Object.assign({className:i},o,{children:l}))};const s=i(70579),n=i(65043),a=i(55935)},93645:function(t,e,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(t,e,i,s){void 0===s&&(s=i);var n=Object.getOwnPropertyDescriptor(e,i);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,s,n)}:function(t,e,i,s){void 0===s&&(s=i),t[s]=e[i]}),n=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&s(e,t,i);return n(e,t),e},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){const t=(0,f.default)(),e=(0,g.default)();(0,d.default)(e,"Unable to find Page context.");const i=Object.assign(Object.assign({},t),e),{imageResourcesPath:s,linkService:n,onGetAnnotationsError:a,onGetAnnotationsSuccess:r,onRenderAnnotationLayerError:b,onRenderAnnotationLayerSuccess:A,page:w,pdf:y,renderForms:_,rotate:x,scale:E=1}=i;(0,d.default)(y,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),(0,d.default)(w,"Attempted to load page annotations, but no page was specified."),(0,d.default)(n,"Attempted to load page annotations, but no linkService was specified.");const[k,S]=(0,m.default)(),{value:M,error:C}=k,T=(0,l.useRef)(null);(0,u.default)(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,l.useEffect)((function(){S({type:"RESET"})}),[S,w]),(0,l.useEffect)((function(){if(!w)return;const t=(0,h.default)(w.getAnnotations()),e=t;return t.promise.then((t=>{S({type:"RESOLVE",value:t})})).catch((t=>{S({type:"REJECT",error:t})})),()=>{(0,v.cancelRunningTask)(e)}}),[S,w]),(0,l.useEffect)((()=>{void 0!==M&&(!1!==M?M&&r&&r(M):C&&((0,u.default)(!1,C.toString()),a&&a(C)))}),[M]);const R=(0,l.useMemo)((()=>w.getViewport({scale:E,rotation:x})),[w,x,E]);return(0,l.useEffect)((function(){if(!y||!w||!n||!M)return;const{current:t}=T;if(!t)return;const e=R.clone({dontFlip:!0}),i={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:t,l10n:null,page:w,structTreeLayer:null,viewport:e},a={annotations:M,annotationStorage:y.annotationStorage,div:t,imageResourcesPath:s,linkService:n,page:w,renderForms:_,viewport:e};t.innerHTML="";try{new p.AnnotationLayer(i).render(a),A&&A()}catch(r){!function(t){(0,u.default)(!1,"".concat(t)),b&&b(t)}(r)}return()=>{}}
1),[M,s,n,w,y,_,R]),(0,o.jsx)("div",{className:(0,c.default)("react-pdf__Page__annotations","annotationLayer"),ref:T})};const o=i(70579),l=i(65043),h=r(i(2570)),c=r(i(12949)),d=r(i(62213)),u=r(i(96440)),p=a(i(52051)),f=r(i(48857)),g=r(i(96111)),m=r(i(2807)),v=i(87632)},95179:function(t,e,i){"use strict";var s=this&&this.__rest||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},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){const e=(0,c.default)(),i=Object.assign(Object.assign({},e),t),{className:n,linkService:d,onItemClick:u,pageIndex:p,pageNumber:f,pdf:g}=i;(0,o.default)(g,"Attempted to load a thumbnail, but no document was specified. Wrap <Thumbnail /> in a <Document /> or pass explicit `pdf` prop.");const m=(0,h.isProvided)(f)?f-1:null!==p&&void 0!==p?p:null,v=null!==f&&void 0!==f?f:(0,h.isProvided)(p)?p+1:null;const{className:b,onItemClick:A}=t,w=s(t,["className","onItemClick"]);return(0,a.jsx)("a",{className:(0,r.default)("react-pdf__Thumbnail",n),href:v?"#":void 0,onClick:function(t){t.preventDefault(),(0,h.isProvided)(m)&&v&&((0,o.default)(u||d,"Either onItemClick callback or linkService must be defined in order to navigate to an outline item."),u?u({pageIndex:m,pageNumber:v}):d&&d.goToPage(v))},children:(0,a.jsx)(l.default,Object.assign({},w,{_className:"react-pdf__Thumbnail__page",_enableRegisterUnregisterPage:!1,renderAnnotationLayer:!1,renderTextLayer:!1}))})};const a=i(70579),r=n(i(12949)),o=n(i(62213)),l=n(i(86440)),h=i(87632),c=n(i(48857))},96111:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){return(0,n.useContext)(a.default)};const n=i(65043),a=s(i(52477))},96440:t=>{"use strict";var e=function(){};t.exports=e},96690:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){const t=(0,c.default)();(0,o.default)(t,"Unable to find Page context.");const{onGetStructTreeError:e,onGetStructTreeSuccess:i}=t,[s,p]=(0,d.default)(),{value:f,error:g}=s,{customTextRenderer:m,page:v}=t;if((0,a.useEffect)((function(){p({type:"RESET"})}),[p,v]),(0,a.useEffect)((function(){if(m)return;if(!v)return;const t=(0,r.default)(v.getStructTree()),e=t;return t.promise.then((t=>{p({type:"RESOLVE",value:t})})).catch((t=>{p({type:"REJECT",error:t})})),()=>(0,u.cancelRunningTask)(e)}),[m,v,p]),(0,a.useEffect)((()=>{void 0!==f&&(!1!==f?function(){if(!f)return;i&&i(f)}():function(){if(!g)return;(0,l.default)(!1,g.toString()),e&&e(g)}())}),[f]),!f)return null;return(0,n.jsx)(h.default,{className:"react-pdf__Page__structTree structTree",node:f})};const n=i(70579),a=i(65043),r=s(i(2570)),o=s(i(62213)),l=s(i(96440)),h=s(i(92797)),c=s(i(96111)),d=s(i(2807)),u=i(87632)},96960:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={NEED_PASSWORD:1,INCORRECT_PASSWORD:2}},97412:(t,e,i)=>{"use strict";var s=i(24994);e.A=void 0;var n=s(i(40039)),a=i(70579);e.A=(0,n.default)((0,a.jsx)("path",{d:"M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"}),"Star")},98352:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=s(i(62213));e.default=class{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,n.default)(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(t){(0,n.default)(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,n.default)(this.pdfDocument,"PDF document not loaded."),(0,n.default)(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,n.default)(Array.isArray(t),'"'.concat(t,'" is not a valid destination array.'));const e=t[0];new Promise((t=>{(0,n.default)(this.pdfDocument,"PDF document not loaded."),e instanceof Object?this.pdfDocument.getPageIndex(e).then((e=>{t(e)})).catch((()=>{(0,n.default)(!1,'"'.concat(e,'" is not a valid page reference.'))})):"number"===typeof e?t(e):(0,n.default)(!1,'"'.concat(e,'" is not a valid destination reference.'))})).then((e=>{const i=e+1;(0,n.default)(this.pdfViewer,"PDF viewer is not initialized."),(0,n.default)(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,n.default)(this.pdfViewer,"PDF viewer is not initialized."),(0,n.default)(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(){}}},98468:(t,e,i)=>{"use strict";var s=i(24994);e.A=void 0;var n=s(i(40039)),a=i(70579);e.A=(0,n.default)((0,a.jsx)("path",{d:"m23 12-2.44-2.79.34-3.69-3.61-.82-1.89-3.2L12 2.96 8.6 1.5 6.71 4.69 3.1 5.5l.34 3.7L1 12l2.44 2.79-.34 3.7 3.61.82L8.6 22.5l3.4-1.47 3.4 1.46 1.89-3.19 3.61-.82-.34-3.69zm-12.91 4.72-3.8-3.81 1.48-1.48 2.32 2.33 5.85-5.87 1.48 1.48z"}),"Verified")}
1,99282:function(t,e,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(t,e,i,s){void 0===s&&(s=i);var n=Object.getOwnPropertyDescriptor(e,i);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,s,n)}:function(t,e,i,s){void 0===s&&(s=i),t[s]=e[i]}),n=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&s(e,t,i);return n(e,t),e},r=this&&this.__awaiter||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())}))},o=this&&this.__rest||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},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const h=i(70579),c=i(65043),d=l(i(24873)),u=l(i(2570)),p=l(i(12949)),f=l(i(62213)),g=l(i(96440)),m=i(30973),v=a(i(52051)),b=l(i(35695)),A=l(i(54468)),w=l(i(98352)),y=l(i(96960)),_=i(87632),x=l(i(2807)),{PDFDataRangeTransport:E}=v,k=(t,e)=>{switch(e){case y.default.NEED_PASSWORD:t(prompt("Enter the password to open this PDF file."));break;case y.default.INCORRECT_PASSWORD:t(prompt("Invalid password. Please try again."));break}};function S(t){return"object"===typeof t&&null!==t&&("data"in t||"range"in t||"url"in t)}const M=(0,c.forwardRef)((function(t,e){var{children:i,className:s,error:n="Failed to load PDF file.",externalLinkRel:a,externalLinkTarget:l,file:y,inputRef:M,imageResourcesPath:C,loading:T="Loading PDF\u2026",noData:R="No PDF file specified.",onItemClick:P,onLoadError:L,onLoadProgress:I,onLoadSuccess:D,onPassword:F=k,onSourceError:O,onSourceSuccess:N,options:W,renderMode:j,rotate:B}=t,H=o(t,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[z,G]=(0,x.default)(),{value:V,error:U}=z,[q,X]=(0,x.default)(),{value:K,error:Y}=q,Q=(0,c.useRef)(new w.default),J=(0,c.useRef)([]),Z=(0,c.useRef)(void 0),$=(0,c.useRef)(void 0);y&&y!==Z.current&&S(y)&&((0,g.default)(!(0,m.dequal)(y,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=y),W&&W!==$.current&&((0,g.default)(!(0,m.dequal)(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,c.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():(0,g.default)(!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,c.useImperativeHandle)(e,(()=>({linkService:Q,pages:J,viewer:tt})),[]),(0,c.useEffect)((function(){G({type:"RESET"})}),[y,G]);const et=(0,c.useCallback)((()=>r(this,void 0,void 0,(function*(){if(!y)return null;if("string"===typeof y){if((0,_.isDataURI)(y)){return{data:(0,_.dataURItoByteString)(y)}}return(0,_.displayCORSWarning)(),{url:y}}if(y instanceof E)return{range:y};if((0,_.isArrayBuffer)(y))return{data:y};if(_.isBrowser&&(0,_.isBlob)(y)){return{data:yield(0,_.loadFromFile)(y)}}if((0,f.default)("object"===typeof y,"Invalid parameter in file, need either Uint8Array, string or a parameter object"),(0,f.default)(S(y),"Invalid parameter object: need either .data, .range or .url"),"url"in y&&"string"===typeof y.url){if((0,_.isDataURI)(y.url)){const{url:t}=y,e=o(y,["url"]),i=(0,_.dataURItoByteString)(t);return Object.assign({data:i},e)}(0,_.displayCORSWarning)()}return y}
1))),[y]);(0,c.useEffect)((()=>{const t=(0,u.default)(et());return t.promise.then((t=>{G({type:"RESOLVE",value:t})})).catch((t=>{G({type:"REJECT",error:t})})),()=>{(0,_.cancelRunningTask)(t)}}),[et,G]),(0,c.useEffect)((()=>{"undefined"!==typeof V&&(!1!==V?N&&N():U&&((0,g.default)(!1,U.toString()),O&&O(U)))}),[V]),(0,c.useEffect)((function(){X({type:"RESET"})}),[X,V]),(0,c.useEffect)((function(){if(!V)return;const t=W?Object.assign(Object.assign({},V),W):V,e=v.getDocument(t);I&&(e.onProgress=I),F&&(e.onPassword=F);const i=e,s=i.promise.then((t=>{X({type:"RESOLVE",value:t})})).catch((t=>{i.destroyed||X({type:"REJECT",error:t})}));return()=>{s.finally((()=>i.destroy()))}}),[W,X,V]),(0,c.useEffect)((()=>{"undefined"!==typeof K&&(!1!==K?K&&(D&&D(K),J.current=new Array(K.numPages),Q.current.setDocument(K)):Y&&((0,g.default)(!1,Y.toString()),L&&L(Y)))}),[K]),(0,c.useEffect)((function(){Q.current.setViewer(tt.current),Q.current.setExternalLinkRel(a),Q.current.setExternalLinkTarget(l)}),[a,l]);const it=(0,c.useCallback)(((t,e)=>{J.current[t]=e}),[]),st=(0,c.useCallback)((t=>{delete J.current[t]}),[]),nt=(0,c.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,c.useMemo)((()=>(0,d.default)(H,(()=>K))),[H,K]);return(0,h.jsx)("div",Object.assign({className:(0,p.default)("react-pdf__Document",s),ref:M,style:{"--scale-factor":"1"}},at,{children:y?void 0===K||null===K?(0,h.jsx)(A.default,{type:"loading",children:"function"===typeof T?T():T}):!1===K?(0,h.jsx)(A.default,{type:"error",children:"function"===typeof n?n():n}):(0,h.jsx)(b.default.Provider,{value:nt,children:i}):(0,h.jsx)(A.default,{type:"no-data",children:"function"===typeof R?R():R})}))}));e.default=M}}]); 2//# sourceMappingURL=1101.1aafbca8.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.