@infinilabs/doc-detail 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode("*,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }:root{--color-primary: #1677ff;--color-border: #d9d9d9;--color-primary-bg: #e6f4ff;--color-text-secondary: rgba(0,0,0,.65);--color-bg-layout: #f5f5f5}.dark{--color-primary: #1668dc;--color-border: #424242;--color-primary-bg: #15325b;--color-text-secondary: rgba(255,255,255,.65);--color-bg-layout: #000000}.float-left{float:left}.my-2{margin-top:.5rem;margin-bottom:.5rem}.ml-2{margin-left:.5rem}.mr-3{margin-right:.75rem}.children\\:size-4>*{width:1rem;height:1rem}.size-3{width:.75rem;height:.75rem}.size-6{width:1.5rem;height:1.5rem}.size-full\\!{width:100%!important;height:100%!important}.children\\:h-unset\\!>*{height:unset!important}.children\\:w-full\\!>*{width:100%!important}.h-full{height:100%}.w-1\\/2{width:50%}.w-24{width:6rem}.w-full{width:100%}.flex{display:flex}.inline-flex{display:inline-flex}.flex-1{flex:1 1 0%}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.rotate-90{--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-rotate:90deg;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.-scale-y-100{--un-scale-y:-1;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-between{justify-content:space-between}.gap-0{gap:0}.gap-0\\.5{gap:.125rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-row-2{row-gap:.5rem}.\\[\\&_\\.pptx-preview-wrapper\\]\\:overflow-hidden .pptx-preview-wrapper,.overflow-hidden{overflow:hidden}.overflow-auto{overflow:auto}.border{border-width:1px}.border-border{border-color:var(--color-border)}.rounded-lg{border-radius:.5rem}.border-solid{border-style:solid}.bg-black\\/3{background-color:#00000008}.bg-transparent{background-color:transparent}.dark .dark\\:bg-white\\/4{background-color:#ffffff0a}.\\[\\&\\>\\.docx\\]\\:p-0\\!>.docx{padding:0!important}.p-4{padding:1rem}.p-4\\!{padding:1rem!important}.text-3{font-size:.75rem}.text-3\\.5{font-size:.875rem}.text-4\\.5\\/6{font-size:1.125rem;line-height:1.5rem}.text-primary,.hover\\:text-primary:hover{color:var(--color-primary)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}@media (max-width: 639.9px){.\\<sm\\:w-full{width:100%}}@keyframes x-markdown-fade-in{0%{opacity:0}to{opacity:1}}.x-markdown{--text-color: inherit;--font-size: inherit;--margin-block: 0 0 1em 0;--td-th-padding: .85em 1em;--pre-th-td-padding: 2px 0;--border-font-weight: 600;--padding-ul-ol: 0 0 0 1em;--margin-ul-ol: 0 0 1em 1.8em;--margin-li: .25em 0;--margin-pre: 1em 0;--padding-code-inline: .2em .4em;--margin-code-inline: 0 .2em;--code-inline-text: .85em;--small-border-radius: 2px;--image-margin: .5em 0;--hr-margin: 1.5em 0;--table-margin: 1em 0;font-size:var(--font-size);line-height:1.5714285714285714;width:100%;color:var(--text-color)}.x-markdown p,.x-markdown div,.x-markdown span,.x-markdown li{word-break:break-word;overflow-wrap:break-word}.x-markdown pre,.x-markdown code{word-break:break-word;overflow-wrap:break-word;white-space:pre-wrap}.x-markdown th,.x-markdown td{padding:var(--td-th-padding)}.x-markdown th{font-weight:var(--border-font-weight)}.x-markdown pre table{box-shadow:none}.x-markdown pre td,.x-markdown pre th{padding:var(--pre-th-td-padding);border:none;text-align:left}.x-markdown p{margin:var(--margin-block)}.x-markdown p:first-child{margin-top:0}.x-markdown p:last-child{margin-bottom:0}.x-markdown ul,.x-markdown ol{margin:var(--margin-ul-ol);padding:var(--padding-ul-ol)}.x-markdown ul:first-child,.x-markdown ol:first-child{margin-top:0}.x-markdown ul:last-child,.x-markdown ol:last-child{margin-bottom:0}.x-markdown ol>li{list-style:decimal}.x-markdown ul>li{list-style:disc}.x-markdown li{margin:var(--margin-li)}.x-markdown li:first-child{margin-top:0}.x-markdown li:last-child{margin-bottom:0}.x-markdown pre{margin:var(--margin-pre);overflow-x:auto}.x-markdown pre:first-child{margin-top:0}.x-markdown pre:last-child{margin-bottom:0}.x-markdown code{padding:var(--padding-code-inline);margin:var(--margin-code-inline);font-size:var(--code-inline-text);border-radius:var(--small-border-radius)}.x-markdown pre code{padding:0;margin:0;font-size:inherit;border-radius:0;line-height:2}.x-markdown img{max-width:100%;height:auto;margin:var(--image-margin)}.x-markdown hr{margin:var(--hr-margin)}.x-markdown table:not(pre){margin:var(--table-margin);border-collapse:collapse;display:block;width:max-content;max-width:100%;overflow:auto}.x-markdown table:not(pre):first-child{margin-top:0}.x-markdown table:not(pre):last-child{margin-bottom:0}.x-markdown .inline-katex .katex-display{display:inline-block;margin:0;text-align:initial;vertical-align:middle}.x-markdown .inline-katex .katex-display>.katex{display:inline-block;text-align:initial;white-space:normal}.x-markdown .inline-katex .katex-display>.katex>.katex-html{display:inline-block;position:static}.x-markdown .inline-katex .katex-display>.katex>.katex-html>.tag{position:static}")),document.head.appendChild(r)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
1
+ (function(){"use strict";(function(n,e){try{const r=globalThis.document;if(r){var a=r.createElement("style");for(var t in e.attributes)a.setAttribute(t,e.attributes[t]);var o=r.querySelector("[data-fullscreen-host]"),i=o&&o.shadowRoot;if(i){var d=n.replace(/@layer properties\{@supports[^{]*\{([\s\S]*?)\}\s*\}/g,"@layer properties{$1}");a.appendChild(r.createTextNode(d)),i.appendChild(a)}else a.appendChild(r.createTextNode(n)),r.head.appendChild(a)}}catch{}})("*,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }:root{--color-primary: #1677ff;--color-border: #d9d9d9;--color-primary-bg: #e6f4ff;--color-text-secondary: rgba(0,0,0,.65);--color-bg-layout: #f5f5f5}.dark{--color-primary: #1668dc;--color-border: #424242;--color-primary-bg: #15325b;--color-text-secondary: rgba(255,255,255,.65);--color-bg-layout: #000000}.float-left{float:left}.my-2{margin-top:.5rem;margin-bottom:.5rem}.ml-2{margin-left:.5rem}.mr-3{margin-right:.75rem}.children\\:size-4>*{width:1rem;height:1rem}.size-3{width:.75rem;height:.75rem}.size-6{width:1.5rem;height:1.5rem}.size-full\\!{width:100%!important;height:100%!important}.children\\:h-unset\\!>*{height:unset!important}.children\\:w-full\\!>*{width:100%!important}.h-full{height:100%}.w-1\\/2{width:50%}.w-24{width:6rem}.w-full{width:100%}.flex{display:flex}.inline-flex{display:inline-flex}.flex-1{flex:1 1 0%}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.rotate-90{--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-rotate:90deg;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.-scale-y-100{--un-scale-y:-1;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-between{justify-content:space-between}.gap-0{gap:0}.gap-0\\.5{gap:.125rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-row-2{row-gap:.5rem}.\\[\\&_\\.pptx-preview-wrapper\\]\\:overflow-hidden .pptx-preview-wrapper,.overflow-hidden{overflow:hidden}.overflow-auto{overflow:auto}.border{border-width:1px}.border-border{border-color:var(--color-border)}.rounded-lg{border-radius:.5rem}.border-solid{border-style:solid}.bg-black\\/3{background-color:#00000008}.bg-transparent{background-color:transparent}.dark .dark\\:bg-white\\/4{background-color:#ffffff0a}.\\[\\&\\>\\.docx\\]\\:p-0\\!>.docx{padding:0!important}.p-4{padding:1rem}.p-4\\!{padding:1rem!important}.text-3{font-size:.75rem}.text-3\\.5{font-size:.875rem}.text-4\\.5\\/6{font-size:1.125rem;line-height:1.5rem}.text-primary,.hover\\:text-primary:hover{color:var(--color-primary)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}@media (max-width: 639.9px){.\\<sm\\:w-full{width:100%}}@keyframes x-markdown-fade-in{0%{opacity:0}to{opacity:1}}.x-markdown{--text-color: inherit;--font-size: inherit;--margin-block: 0 0 1em 0;--td-th-padding: .85em 1em;--pre-th-td-padding: 2px 0;--border-font-weight: 600;--padding-ul-ol: 0 0 0 1em;--margin-ul-ol: 0 0 1em 1.8em;--margin-li: .25em 0;--margin-pre: 1em 0;--padding-code-inline: .2em .4em;--margin-code-inline: 0 .2em;--code-inline-text: .85em;--small-border-radius: 2px;--image-margin: .5em 0;--hr-margin: 1.5em 0;--table-margin: 1em 0;font-size:var(--font-size);line-height:1.5714285714285714;width:100%;color:var(--text-color)}.x-markdown p,.x-markdown div,.x-markdown span,.x-markdown li{word-break:break-word;overflow-wrap:break-word}.x-markdown pre,.x-markdown code{word-break:break-word;overflow-wrap:break-word;white-space:pre-wrap}.x-markdown th,.x-markdown td{padding:var(--td-th-padding)}.x-markdown th{font-weight:var(--border-font-weight)}.x-markdown pre table{box-shadow:none}.x-markdown pre td,.x-markdown pre th{padding:var(--pre-th-td-padding);border:none;text-align:left}.x-markdown p{margin:var(--margin-block)}.x-markdown p:first-child{margin-top:0}.x-markdown p:last-child{margin-bottom:0}.x-markdown ul,.x-markdown ol{margin:var(--margin-ul-ol);padding:var(--padding-ul-ol)}.x-markdown ul:first-child,.x-markdown ol:first-child{margin-top:0}.x-markdown ul:last-child,.x-markdown ol:last-child{margin-bottom:0}.x-markdown ol>li{list-style:decimal}.x-markdown ul>li{list-style:disc}.x-markdown li{margin:var(--margin-li)}.x-markdown li:first-child{margin-top:0}.x-markdown li:last-child{margin-bottom:0}.x-markdown pre{margin:var(--margin-pre);overflow-x:auto}.x-markdown pre:first-child{margin-top:0}.x-markdown pre:last-child{margin-bottom:0}.x-markdown code{padding:var(--padding-code-inline);margin:var(--margin-code-inline);font-size:var(--code-inline-text);border-radius:var(--small-border-radius)}.x-markdown pre code{padding:0;margin:0;font-size:inherit;border-radius:0;line-height:2}.x-markdown img{max-width:100%;height:auto;margin:var(--image-margin)}.x-markdown hr{margin:var(--hr-margin)}.x-markdown table:not(pre){margin:var(--table-margin);border-collapse:collapse;display:block;width:max-content;max-width:100%;overflow:auto}.x-markdown table:not(pre):first-child{margin-top:0}.x-markdown table:not(pre):last-child{margin-bottom:0}.x-markdown .inline-katex .katex-display{display:inline-block;margin:0;text-align:initial;vertical-align:middle}.x-markdown .inline-katex .katex-display>.katex{display:inline-block;text-align:initial;white-space:normal}.x-markdown .inline-katex .katex-display>.katex>.katex-html{display:inline-block;position:static}.x-markdown .inline-katex .katex-display>.katex>.katex-html>.tag{position:static}",{})})();
2
2
  "use strict";var kme=t=>{throw TypeError(t)};var iU=(t,e,r)=>e.has(t)||kme("Cannot "+r);var Ci=(t,e,r)=>(iU(t,e,"read from private field"),r?r.call(t):e.get(t)),gf=(t,e,r)=>e.has(t)?kme("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Lc=(t,e,r,n)=>(iU(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),mf=(t,e,r)=>(iU(t,e,"access private method"),r);var Ome=(t,e,r,n)=>({set _(a){Lc(t,e,a,r)},get _(){return Ci(t,e,n)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Me=require("react"),rr=require("react/jsx-runtime"),ki=require("antd"),SD=require("lucide-react");var sU=typeof document<"u"?document.currentScript:null;function qdt(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Ir=qdt(Me),t4e=Me.createContext({});function Xdt(t){const e=Me.useRef(null);return e.current===null&&(e.current=t()),e.current}const Kte=typeof window<"u",jdt=Kte?Me.useLayoutEffect:Me.useEffect,Zte=Me.createContext(null);function Qte(t,e){t.indexOf(e)===-1&&t.push(e)}function Jte(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}const cp=(t,e,r)=>r>e?e:r<t?t:r;function Rj(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let iw=()=>{},Wg=()=>{};typeof process<"u"&&process.env?.NODE_ENV!=="production"&&(iw=(t,e,r)=>{!t&&typeof console<"u"&&console.warn(Rj(e,r))},Wg=(t,e,r)=>{if(!t)throw new Error(Rj(e,r))});const qg={},r4e=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function n4e(t){return typeof t=="object"&&t!==null}const a4e=t=>/^0[^.\s]+$/u.test(t);function ere(t){let e;return()=>(e===void 0&&(e=t()),e)}const Vd=t=>t,Kdt=(t,e)=>r=>e(t(r)),jI=(...t)=>t.reduce(Kdt),hN=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n};class tre{constructor(){this.subscriptions=[]}add(e){return Qte(this.subscriptions,e),()=>Jte(this.subscriptions,e)}notify(e,r,n){const a=this.subscriptions.length;if(a)if(a===1)this.subscriptions[0](e,r,n);else for(let i=0;i<a;i++){const s=this.subscriptions[i];s&&s(e,r,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const np=t=>t*1e3,Pd=t=>t/1e3;function i4e(t,e){return e?t*(1e3/e):0}const Dme=new Set;function rre(t,e,r){t||Dme.has(e)||(console.warn(Rj(e,r)),Dme.add(e))}const s4e=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,Zdt=1e-7,Qdt=12;function Jdt(t,e,r,n,a){let i,s,o=0;do s=e+(r-e)/2,i=s4e(s,n,a)-t,i>0?r=s:e=s;while(Math.abs(i)>Zdt&&++o<Qdt);return s}function KI(t,e,r,n){if(t===e&&r===n)return Vd;const a=i=>Jdt(i,0,1,t,r);return i=>i===0||i===1?i:s4e(a(i),e,n)}const o4e=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,l4e=t=>e=>1-t(1-e),c4e=KI(.33,1.53,.69,.99),nre=l4e(c4e),u4e=o4e(nre),d4e=t=>(t*=2)<1?.5*nre(t):.5*(2-Math.pow(2,-10*(t-1))),are=t=>1-Math.sin(Math.acos(t)),h4e=l4e(are),f4e=o4e(are),eht=KI(.42,0,1,1),tht=KI(0,0,.58,1),p4e=KI(.42,0,.58,1),rht=t=>Array.isArray(t)&&typeof t[0]!="number",g4e=t=>Array.isArray(t)&&typeof t[0]=="number",Lme={linear:Vd,easeIn:eht,easeInOut:p4e,easeOut:tht,circIn:are,circInOut:f4e,circOut:h4e,backIn:nre,backInOut:u4e,backOut:c4e,anticipate:d4e},nht=t=>typeof t=="string",Mme=t=>{if(g4e(t)){Wg(t.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,r,n,a]=t;return KI(e,r,n,a)}else if(nht(t))return Wg(Lme[t]!==void 0,`Invalid easing type '${t}'`,"invalid-easing-type"),Lme[t];return t},TD=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function aht(t,e){let r=new Set,n=new Set,a=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function l(d){s.has(d)&&(u.schedule(d),t()),d(o)}const u={schedule:(d,h=!1,f=!1)=>{const g=f&&a?r:n;return h&&s.add(d),g.has(d)||g.add(d),d},cancel:d=>{n.delete(d),s.delete(d)},process:d=>{if(o=d,a){i=!0;return}a=!0,[r,n]=[n,r],r.forEach(l),r.clear(),a=!1,i&&(i=!1,u.process(d))}};return u}const iht=40;function m4e(t,e){let r=!1,n=!0;const a={delta:0,timestamp:0,isProcessing:!1},i=()=>r=!0,s=TD.reduce((b,E)=>(b[E]=aht(i),b),{}),{setup:o,read:l,resolveKeyframes:u,preUpdate:d,update:h,preRender:f,render:p,postRender:g}=s,m=()=>{const b=qg.useManualTiming?a.timestamp:performance.now();r=!1,qg.useManualTiming||(a.delta=n?1e3/60:Math.max(Math.min(b-a.timestamp,iht),1)),a.timestamp=b,a.isProcessing=!0,o.process(a),l.process(a),u.process(a),d.process(a),h.process(a),f.process(a),p.process(a),g.process(a),a.isProcessing=!1,r&&e&&(n=!1,t(m))},_=()=>{r=!0,n=!0,a.isProcessing||t(m)};return{schedule:TD.reduce((b,E)=>{const S=s[E];return b[E]=(T,x=!1,w=!1)=>(r||_(),S.schedule(T,x,w)),b},{}),cancel:b=>{for(let E=0;E<TD.length;E++)s[TD[E]].cancel(b)},state:a,steps:s}}const{schedule:bi,cancel:Yv,state:Ho,steps:oU}=m4e(typeof requestAnimationFrame<"u"?requestAnimationFrame:Vd,!0);let _P;function sht(){_P=void 0}const ec={now:()=>(_P===void 0&&ec.set(Ho.isProcessing||qg.useManualTiming?Ho.timestamp:performance.now()),_P),set:t=>{_P=t,queueMicrotask(sht)}},v4e=t=>e=>typeof e=="string"&&e.startsWith(t),y4e=v4e("--"),oht=v4e("var(--"),ire=t=>oht(t)?lht.test(t.split("/*")[0].trim()):!1,lht=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Pme(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const sw={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},fN={...sw,transform:t=>cp(0,1,t)},xD={...sw,default:1},TR=t=>Math.round(t*1e5)/1e5,sre=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function cht(t){return t==null}const uht=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ore=(t,e)=>r=>!!(typeof r=="string"&&uht.test(r)&&r.startsWith(t)||e&&!cht(r)&&Object.prototype.hasOwnProperty.call(r,e)),_4e=(t,e,r)=>n=>{if(typeof n!="string")return n;const[a,i,s,o]=n.match(sre);return{[t]:parseFloat(a),[e]:parseFloat(i),[r]:parseFloat(s),alpha:o!==void 0?parseFloat(o):1}},dht=t=>cp(0,255,t),lU={...sw,transform:t=>Math.round(dht(t))},__={test:ore("rgb","red"),parse:_4e("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+lU.transform(t)+", "+lU.transform(e)+", "+lU.transform(r)+", "+TR(fN.transform(n))+")"};function hht(t){let e="",r="",n="",a="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),a=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),a=t.substring(4,5),e+=e,r+=r,n+=n,a+=a),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:a?parseInt(a,16)/255:1}}const Nj={test:ore("#"),parse:hht,transform:__.transform},ZI=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),tv=ZI("deg"),ap=ZI("%"),yr=ZI("px"),fht=ZI("vh"),pht=ZI("vw"),Bme={...ap,parse:t=>ap.parse(t)/100,transform:t=>ap.transform(t*100)},nS={test:ore("hsl","hue"),parse:_4e("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+ap.transform(TR(e))+", "+ap.transform(TR(r))+", "+TR(fN.transform(n))+")"},ks={test:t=>__.test(t)||Nj.test(t)||nS.test(t),parse:t=>__.test(t)?__.parse(t):nS.test(t)?nS.parse(t):Nj.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?__.transform(t):nS.transform(t),getAnimatableNone:t=>{const e=ks.parse(t);return e.alpha=0,ks.transform(e)}},ght=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function mht(t){return isNaN(t)&&typeof t=="string"&&(t.match(sre)?.length||0)+(t.match(ght)?.length||0)>0}const b4e="number",E4e="color",vht="var",yht="var(",Fme="${}",_ht=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function pN(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},a=[];let i=0;const o=e.replace(_ht,l=>(ks.test(l)?(n.color.push(i),a.push(E4e),r.push(ks.parse(l))):l.startsWith(yht)?(n.var.push(i),a.push(vht),r.push(l)):(n.number.push(i),a.push(b4e),r.push(parseFloat(l))),++i,Fme)).split(Fme);return{values:r,split:o,indexes:n,types:a}}function S4e(t){return pN(t).values}function T4e(t){const{split:e,types:r}=pN(t),n=e.length;return a=>{let i="";for(let s=0;s<n;s++)if(i+=e[s],a[s]!==void 0){const o=r[s];o===b4e?i+=TR(a[s]):o===E4e?i+=ks.transform(a[s]):i+=a[s]}return i}}const bht=t=>typeof t=="number"?0:ks.test(t)?ks.getAnimatableNone(t):t;function Eht(t){const e=S4e(t);return T4e(t)(e.map(bht))}const Wv={test:mht,parse:S4e,createTransformer:T4e,getAnimatableNone:Eht};function cU(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function Sht({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let a=0,i=0,s=0;if(!e)a=i=s=r;else{const o=r<.5?r*(1+e):r+e-r*e,l=2*r-o;a=cU(l,o,t+1/3),i=cU(l,o,t),s=cU(l,o,t-1/3)}return{red:Math.round(a*255),green:Math.round(i*255),blue:Math.round(s*255),alpha:n}}function c4(t,e){return r=>r>0?e:t}const Yi=(t,e,r)=>t+(e-t)*r,uU=(t,e,r)=>{const n=t*t,a=r*(e*e-n)+n;return a<0?0:Math.sqrt(a)},Tht=[Nj,__,nS],xht=t=>Tht.find(e=>e.test(t));function Ume(t){const e=xht(t);if(iw(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!e)return!1;let r=e.parse(t);return e===nS&&(r=Sht(r)),r}const $me=(t,e)=>{const r=Ume(t),n=Ume(e);if(!r||!n)return c4(t,e);const a={...r};return i=>(a.red=uU(r.red,n.red,i),a.green=uU(r.green,n.green,i),a.blue=uU(r.blue,n.blue,i),a.alpha=Yi(r.alpha,n.alpha,i),__.transform(a))},Ij=new Set(["none","hidden"]);function wht(t,e){return Ij.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function Cht(t,e){return r=>Yi(t,e,r)}function lre(t){return typeof t=="number"?Cht:typeof t=="string"?ire(t)?c4:ks.test(t)?$me:Nht:Array.isArray(t)?x4e:typeof t=="object"?ks.test(t)?$me:Aht:c4}function x4e(t,e){const r=[...t],n=r.length,a=t.map((i,s)=>lre(i)(i,e[s]));return i=>{for(let s=0;s<n;s++)r[s]=a[s](i);return r}}function Aht(t,e){const r={...t,...e},n={};for(const a in r)t[a]!==void 0&&e[a]!==void 0&&(n[a]=lre(t[a])(t[a],e[a]));return a=>{for(const i in n)r[i]=n[i](a);return r}}function Rht(t,e){const r=[],n={color:0,var:0,number:0};for(let a=0;a<e.values.length;a++){const i=e.types[a],s=t.indexes[i][n[i]],o=t.values[s]??0;r[a]=o,n[i]++}return r}const Nht=(t,e)=>{const r=Wv.createTransformer(e),n=pN(t),a=pN(e);return n.indexes.var.length===a.indexes.var.length&&n.indexes.color.length===a.indexes.color.length&&n.indexes.number.length>=a.indexes.number.length?Ij.has(t)&&!a.values.length||Ij.has(e)&&!n.values.length?wht(t,e):jI(x4e(Rht(n,a),a.values),r):(iw(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),c4(t,e))};function w4e(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Yi(t,e,r):lre(t)(t,e)}const Iht=t=>{const e=({timestamp:r})=>t(r);return{start:(r=!0)=>bi.update(e,r),stop:()=>Yv(e),now:()=>Ho.isProcessing?Ho.timestamp:ec.now()}},C4e=(t,e,r=10)=>{let n="";const a=Math.max(Math.round(e/r),2);for(let i=0;i<a;i++)n+=Math.round(t(i/(a-1))*1e4)/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},u4=2e4;function cre(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e<u4;)e+=r,n=t.next(e);return e>=u4?1/0:e}function kht(t,e=100,r){const n=r({...t,keyframes:[0,e]}),a=Math.min(cre(n),u4);return{type:"keyframes",ease:i=>n.next(a*i).value/e,duration:Pd(a)}}const Oht=5;function A4e(t,e,r){const n=Math.max(e-Oht,0);return i4e(r-t(n),e-n)}const Gi={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},dU=.001;function Dht({duration:t=Gi.duration,bounce:e=Gi.bounce,velocity:r=Gi.velocity,mass:n=Gi.mass}){let a,i;iw(t<=np(Gi.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-e;s=cp(Gi.minDamping,Gi.maxDamping,s),t=cp(Gi.minDuration,Gi.maxDuration,Pd(t)),s<1?(a=u=>{const d=u*s,h=d*t,f=d-r,p=kj(u,s),g=Math.exp(-h);return dU-f/p*g},i=u=>{const h=u*s*t,f=h*r+r,p=Math.pow(s,2)*Math.pow(u,2)*t,g=Math.exp(-h),m=kj(Math.pow(u,2),s);return(-a(u)+dU>0?-1:1)*((f-p)*g)/m}):(a=u=>{const d=Math.exp(-u*t),h=(u-r)*t+1;return-dU+d*h},i=u=>{const d=Math.exp(-u*t),h=(r-u)*(t*t);return d*h});const o=5/t,l=Mht(a,i,o);if(t=np(t),isNaN(l))return{stiffness:Gi.stiffness,damping:Gi.damping,duration:t};{const u=Math.pow(l,2)*n;return{stiffness:u,damping:s*2*Math.sqrt(n*u),duration:t}}}const Lht=12;function Mht(t,e,r){let n=r;for(let a=1;a<Lht;a++)n=n-t(n)/e(n);return n}function kj(t,e){return t*Math.sqrt(1-e*e)}const Pht=["duration","bounce"],Bht=["stiffness","damping","mass"];function Gme(t,e){return e.some(r=>t[r]!==void 0)}function Fht(t){let e={velocity:Gi.velocity,stiffness:Gi.stiffness,damping:Gi.damping,mass:Gi.mass,isResolvedFromDuration:!1,...t};if(!Gme(t,Bht)&&Gme(t,Pht))if(t.visualDuration){const r=t.visualDuration,n=2*Math.PI/(r*1.2),a=n*n,i=2*cp(.05,1,1-(t.bounce||0))*Math.sqrt(a);e={...e,mass:Gi.mass,stiffness:a,damping:i}}else{const r=Dht(t);e={...e,...r,mass:Gi.mass},e.isResolvedFromDuration=!0}return e}function d4(t=Gi.visualDuration,e=Gi.bounce){const r=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:n,restDelta:a}=r;const i=r.keyframes[0],s=r.keyframes[r.keyframes.length-1],o={done:!1,value:i},{stiffness:l,damping:u,mass:d,duration:h,velocity:f,isResolvedFromDuration:p}=Fht({...r,velocity:-Pd(r.velocity||0)}),g=f||0,m=u/(2*Math.sqrt(l*d)),_=s-i,y=Pd(Math.sqrt(l/d)),v=Math.abs(_)<5;n||(n=v?Gi.restSpeed.granular:Gi.restSpeed.default),a||(a=v?Gi.restDelta.granular:Gi.restDelta.default);let b;if(m<1){const S=kj(y,m);b=T=>{const x=Math.exp(-m*y*T);return s-x*((g+m*y*_)/S*Math.sin(S*T)+_*Math.cos(S*T))}}else if(m===1)b=S=>s-Math.exp(-y*S)*(_+(g+y*_)*S);else{const S=y*Math.sqrt(m*m-1);b=T=>{const x=Math.exp(-m*y*T),w=Math.min(S*T,300);return s-x*((g+m*y*_)*Math.sinh(w)+S*_*Math.cosh(w))/S}}const E={calculatedDuration:p&&h||null,next:S=>{const T=b(S);if(p)o.done=S>=h;else{let x=S===0?g:0;m<1&&(x=S===0?np(g):A4e(b,S,T));const w=Math.abs(x)<=n,C=Math.abs(s-T)<=a;o.done=w&&C}return o.value=o.done?s:T,o},toString:()=>{const S=Math.min(cre(E),u4),T=C4e(x=>E.next(S*x).value,S,30);return S+"ms "+T},toTransition:()=>{}};return E}d4.applyToOptions=t=>{const e=kht(t,100,d4);return t.ease=e.ease,t.duration=np(e.duration),t.type="keyframes",t};function Oj({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:a=10,bounceStiffness:i=500,modifyTarget:s,min:o,max:l,restDelta:u=.5,restSpeed:d}){const h=t[0],f={done:!1,value:h},p=w=>o!==void 0&&w<o||l!==void 0&&w>l,g=w=>o===void 0?l:l===void 0||Math.abs(o-w)<Math.abs(l-w)?o:l;let m=r*e;const _=h+m,y=s===void 0?_:s(_);y!==_&&(m=y-h);const v=w=>-m*Math.exp(-w/n),b=w=>y+v(w),E=w=>{const C=v(w),R=b(w);f.done=Math.abs(C)<=u,f.value=f.done?y:R};let S,T;const x=w=>{p(f.value)&&(S=w,T=d4({keyframes:[f.value,g(f.value)],velocity:A4e(b,w,f.value),damping:a,stiffness:i,restDelta:u,restSpeed:d}))};return x(0),{calculatedDuration:null,next:w=>{let C=!1;return!T&&S===void 0&&(C=!0,E(w),x(w)),S!==void 0&&w>=S?T.next(w-S):(!C&&E(w),f)}}}function Uht(t,e,r){const n=[],a=r||qg.mix||w4e,i=t.length-1;for(let s=0;s<i;s++){let o=a(t[s],t[s+1]);if(e){const l=Array.isArray(e)?e[s]||Vd:e;o=jI(l,o)}n.push(o)}return n}function $ht(t,e,{clamp:r=!0,ease:n,mixer:a}={}){const i=t.length;if(Wg(i===e.length,"Both input and output ranges must be the same length","range-length"),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const s=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=Uht(e,n,a),l=o.length,u=d=>{if(s&&d<t[0])return e[0];let h=0;if(l>1)for(;h<t.length-2&&!(d<t[h+1]);h++);const f=hN(t[h],t[h+1],d);return o[h](f)};return r?d=>u(cp(t[0],t[i-1],d)):u}function Ght(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const a=hN(0,e,n);t.push(Yi(r,1,a))}}function zht(t){const e=[0];return Ght(e,t.length-1),e}function Vht(t,e){return t.map(r=>r*e)}function Hht(t,e){return t.map(()=>e||p4e).splice(0,t.length-1)}function aS({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const a=rht(n)?n.map(Mme):Mme(n),i={done:!1,value:e[0]},s=Vht(r&&r.length===e.length?r:zht(e),t),o=$ht(s,e,{ease:Array.isArray(a)?a:Hht(e,a)});return{calculatedDuration:t,next:l=>(i.value=o(l),i.done=l>=t,i)}}const Yht=t=>t!==null;function ure(t,{repeat:e,repeatType:r="loop"},n,a=1){const i=t.filter(Yht),o=a<0||e&&r!=="loop"&&e%2===1?0:i.length-1;return!o||n===void 0?i[o]:n}const Wht={decay:Oj,inertia:Oj,tween:aS,keyframes:aS,spring:d4};function R4e(t){typeof t.type=="string"&&(t.type=Wht[t.type])}class dre{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,r){return this.finished.then(e,r)}}const qht=t=>t/100;class hre extends dre{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:r}=this.options;r&&r.updatedAt!==ec.now()&&this.tick(ec.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;R4e(e);const{type:r=aS,repeat:n=0,repeatDelay:a=0,repeatType:i,velocity:s=0}=e;let{keyframes:o}=e;const l=r||aS;process.env.NODE_ENV!=="production"&&l!==aS&&Wg(o.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${o}`,"spring-two-frames"),l!==aS&&typeof o[0]!="number"&&(this.mixKeyframes=jI(qht,w4e(o[0],o[1])),o=[0,100]);const u=l({...e,keyframes:o});i==="mirror"&&(this.mirroredGenerator=l({...e,keyframes:[...o].reverse(),velocity:-s})),u.calculatedDuration===null&&(u.calculatedDuration=cre(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+a,this.totalDuration=this.resolvedDuration*(n+1)-a,this.generator=u}updateTime(e){const r=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=r}tick(e,r=!1){const{generator:n,totalDuration:a,mixKeyframes:i,mirroredGenerator:s,resolvedDuration:o,calculatedDuration:l}=this;if(this.startTime===null)return n.next(0);const{delay:u=0,keyframes:d,repeat:h,repeatType:f,repeatDelay:p,type:g,onUpdate:m,finalKeyframe:_}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-a/this.speed,this.startTime)),r?this.currentTime=e:this.updateTime(e);const y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?y<0:y>a;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=a);let b=this.currentTime,E=n;if(h){const w=Math.min(this.currentTime,a)/o;let C=Math.floor(w),R=w%1;!R&&w>=1&&(R=1),R===1&&C--,C=Math.min(C,h+1),!!(C%2)&&(f==="reverse"?(R=1-R,p&&(R-=p/o)):f==="mirror"&&(E=s)),b=cp(0,1,R)*o}const S=v?{done:!1,value:d[0]}:E.next(b);i&&(S.value=i(S.value));let{done:T}=S;!v&&l!==null&&(T=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const x=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&T);return x&&g!==Oj&&(S.value=ure(d,this.options,_,this.speed)),m&&m(S.value),x&&this.finish(),S}then(e,r){return this.finished.then(e,r)}get duration(){return Pd(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Pd(e)}get time(){return Pd(this.currentTime)}set time(e){e=np(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(ec.now());const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=Pd(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=Iht,startTime:r}=this.options;this.driver||(this.driver=e(a=>this.tick(a))),this.options.onPlay?.();const n=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=n):this.holdTime!==null?this.startTime=n-this.holdTime:this.startTime||(this.startTime=r??n),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(ec.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function Xht(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const b_=t=>t*180/Math.PI,Dj=t=>{const e=b_(Math.atan2(t[1],t[0]));return Lj(e)},jht={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Dj,rotateZ:Dj,skewX:t=>b_(Math.atan(t[1])),skewY:t=>b_(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Lj=t=>(t=t%360,t<0&&(t+=360),t),zme=Dj,Vme=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Hme=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Kht={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Vme,scaleY:Hme,scale:t=>(Vme(t)+Hme(t))/2,rotateX:t=>Lj(b_(Math.atan2(t[6],t[5]))),rotateY:t=>Lj(b_(Math.atan2(-t[2],t[0]))),rotateZ:zme,rotate:zme,skewX:t=>b_(Math.atan(t[4])),skewY:t=>b_(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Mj(t){return t.includes("scale")?1:0}function Pj(t,e){if(!t||t==="none")return Mj(e);const r=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,a;if(r)n=Kht,a=r;else{const o=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=jht,a=o}if(!a)return Mj(e);const i=n[e],s=a[1].split(",").map(Qht);return typeof i=="function"?i(s):s[i]}const Zht=(t,e)=>{const{transform:r="none"}=getComputedStyle(t);return Pj(r,e)};function Qht(t){return parseFloat(t.trim())}const ow=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],lw=new Set(ow),Yme=t=>t===sw||t===yr,Jht=new Set(["x","y","z"]),eft=ow.filter(t=>!Jht.has(t));function tft(t){const e=[];return eft.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const mv={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>Pj(e,"x"),y:(t,{transform:e})=>Pj(e,"y")};mv.translateX=mv.x;mv.translateY=mv.y;const V_=new Set;let Bj=!1,Fj=!1,Uj=!1;function N4e(){if(Fj){const t=Array.from(V_).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const a=tft(n);a.length&&(r.set(n,a),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const a=r.get(n);a&&a.forEach(([i,s])=>{n.getValue(i)?.set(s)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Fj=!1,Bj=!1,V_.forEach(t=>t.complete(Uj)),V_.clear()}function I4e(){V_.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Fj=!0)})}function rft(){Uj=!0,I4e(),N4e(),Uj=!1}class fre{constructor(e,r,n,a,i,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=a,this.element=i,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(V_.add(this),Bj||(Bj=!0,bi.read(I4e),bi.resolveKeyframes(N4e))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:a}=this;if(e[0]===null){const i=a?.get(),s=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&r){const o=n.readValue(r,s);o!=null&&(e[0]=o)}e[0]===void 0&&(e[0]=s),a&&i===void 0&&a.set(e[0])}Xht(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),V_.delete(this)}cancel(){this.state==="scheduled"&&(V_.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const nft=t=>t.startsWith("--");function aft(t,e,r){nft(e)?t.style.setProperty(e,r):t.style[e]=r}const ift=ere(()=>window.ScrollTimeline!==void 0),sft={};function oft(t,e){const r=ere(t);return()=>sft[e]??r()}const k4e=oft(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),e2=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,Wme={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:e2([0,.65,.55,1]),circOut:e2([.55,0,1,.45]),backIn:e2([.31,.01,.66,-.59]),backOut:e2([.33,1.53,.69,.99])};function O4e(t,e){if(t)return typeof t=="function"?k4e()?C4e(t,e):"ease-out":g4e(t)?e2(t):Array.isArray(t)?t.map(r=>O4e(r,e)||Wme.easeOut):Wme[t]}function lft(t,e,r,{delay:n=0,duration:a=300,repeat:i=0,repeatType:s="loop",ease:o="easeOut",times:l}={},u=void 0){const d={[e]:r};l&&(d.offset=l);const h=O4e(o,a);Array.isArray(h)&&(d.easing=h);const f={delay:n,duration:a,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:s==="reverse"?"alternate":"normal"};return u&&(f.pseudoElement=u),t.animate(d,f)}function D4e(t){return typeof t=="function"&&"applyToOptions"in t}function cft({type:t,...e}){return D4e(t)&&k4e()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class uft extends dre{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:r,name:n,keyframes:a,pseudoElement:i,allowFlatten:s=!1,finalKeyframe:o,onComplete:l}=e;this.isPseudoElement=!!i,this.allowFlatten=s,this.options=e,Wg(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const u=cft(e);this.animation=lft(r,n,a,u,i),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const d=ure(a,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(d):aft(r,n,d),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return Pd(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Pd(e)}get time(){return Pd(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=np(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&ift()?(this.animation.timeline=e,Vd):r(this)}}const L4e={anticipate:d4e,backInOut:u4e,circInOut:f4e};function dft(t){return t in L4e}function hft(t){typeof t.ease=="string"&&dft(t.ease)&&(t.ease=L4e[t.ease])}const hU=10;class fft extends uft{constructor(e){hft(e),R4e(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:r,onUpdate:n,onComplete:a,element:i,...s}=this.options;if(!r)return;if(e!==void 0){r.set(e);return}const o=new hre({...s,autoplay:!1}),l=Math.max(hU,ec.now()-this.startTime),u=cp(0,hU,l-hU);r.setWithVelocity(o.sample(Math.max(0,l-u)).value,o.sample(l).value,u),o.stop()}}const qme=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Wv.test(t)||t==="0")&&!t.startsWith("url("));function pft(t){const e=t[0];if(t.length===1)return!0;for(let r=0;r<t.length;r++)if(t[r]!==e)return!0}function gft(t,e,r,n){const a=t[0];if(a===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],s=qme(a,e),o=qme(i,e);return iw(s===o,`You are trying to animate ${e} from "${a}" to "${i}". "${s?i:a}" is not an animatable value.`,"value-not-animatable"),!s||!o?!1:pft(t)||(r==="spring"||D4e(r))&&n}function $j(t){t.duration=0,t.type="keyframes"}const mft=new Set(["opacity","clipPath","filter","transform"]),vft=ere(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function yft(t){const{motionValue:e,name:r,repeatDelay:n,repeatType:a,damping:i,type:s}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:u}=e.owner.getProps();return vft()&&r&&mft.has(r)&&(r!=="transform"||!u)&&!l&&!n&&a!=="mirror"&&i!==0&&s!=="inertia"}const _ft=40;class bft extends dre{constructor({autoplay:e=!0,delay:r=0,type:n="keyframes",repeat:a=0,repeatDelay:i=0,repeatType:s="loop",keyframes:o,name:l,motionValue:u,element:d,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=ec.now();const f={autoplay:e,delay:r,type:n,repeat:a,repeatDelay:i,repeatType:s,name:l,motionValue:u,element:d,...h},p=d?.KeyframeResolver||fre;this.keyframeResolver=new p(o,(g,m,_)=>this.onKeyframesResolved(g,m,f,!_),l,u,d),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,r,n,a){this.keyframeResolver=void 0;const{name:i,type:s,velocity:o,delay:l,isHandoff:u,onUpdate:d}=n;this.resolvedAt=ec.now(),gft(e,i,s,o)||((qg.instantAnimations||!l)&&d?.(ure(e,n,r)),e[0]=e[e.length-1],$j(n),n.repeat=0);const f={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>_ft?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:r,...n,keyframes:e},p=!u&&yft(f)?new fft({...f,element:f.motionValue.owner.current}):new hre(f);p.finished.then(()=>this.notifyFinished()).catch(Vd),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(e,r){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),rft()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const Eft=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Sft(t){const e=Eft.exec(t);if(!e)return[,];const[,r,n,a]=e;return[`--${r??n}`,a]}const Tft=4;function M4e(t,e,r=1){Wg(r<=Tft,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[n,a]=Sft(t);if(!n)return;const i=window.getComputedStyle(e).getPropertyValue(n);if(i){const s=i.trim();return r4e(s)?parseFloat(s):s}return ire(a)?M4e(a,e,r+1):a}function pre(t,e){return t?.[e]??t?.default??t}const P4e=new Set(["width","height","top","left","right","bottom",...ow]),xft={test:t=>t==="auto",parse:t=>t},B4e=t=>e=>e.test(t),F4e=[sw,yr,ap,tv,pht,fht,xft],Xme=t=>F4e.find(B4e(t));function wft(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||a4e(t):!0}const Cft=new Set(["brightness","contrast","saturate","opacity"]);function Aft(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(sre)||[];if(!n)return t;const a=r.replace(n,"");let i=Cft.has(e)?1:0;return n!==r&&(i*=100),e+"("+i+a+")"}const Rft=/\b([a-z-]*)\(.*?\)/gu,Gj={...Wv,getAnimatableNone:t=>{const e=t.match(Rft);return e?e.map(Aft).join(" "):t}},jme={...sw,transform:Math.round},Nft={rotate:tv,rotateX:tv,rotateY:tv,rotateZ:tv,scale:xD,scaleX:xD,scaleY:xD,scaleZ:xD,skew:tv,skewX:tv,skewY:tv,distance:yr,translateX:yr,translateY:yr,translateZ:yr,x:yr,y:yr,z:yr,perspective:yr,transformPerspective:yr,opacity:fN,originX:Bme,originY:Bme,originZ:yr},gre={borderWidth:yr,borderTopWidth:yr,borderRightWidth:yr,borderBottomWidth:yr,borderLeftWidth:yr,borderRadius:yr,radius:yr,borderTopLeftRadius:yr,borderTopRightRadius:yr,borderBottomRightRadius:yr,borderBottomLeftRadius:yr,width:yr,maxWidth:yr,height:yr,maxHeight:yr,top:yr,right:yr,bottom:yr,left:yr,inset:yr,insetBlock:yr,insetBlockStart:yr,insetBlockEnd:yr,insetInline:yr,insetInlineStart:yr,insetInlineEnd:yr,padding:yr,paddingTop:yr,paddingRight:yr,paddingBottom:yr,paddingLeft:yr,paddingBlock:yr,paddingBlockStart:yr,paddingBlockEnd:yr,paddingInline:yr,paddingInlineStart:yr,paddingInlineEnd:yr,margin:yr,marginTop:yr,marginRight:yr,marginBottom:yr,marginLeft:yr,marginBlock:yr,marginBlockStart:yr,marginBlockEnd:yr,marginInline:yr,marginInlineStart:yr,marginInlineEnd:yr,backgroundPositionX:yr,backgroundPositionY:yr,...Nft,zIndex:jme,fillOpacity:fN,strokeOpacity:fN,numOctaves:jme},Ift={...gre,color:ks,backgroundColor:ks,outlineColor:ks,fill:ks,stroke:ks,borderColor:ks,borderTopColor:ks,borderRightColor:ks,borderBottomColor:ks,borderLeftColor:ks,filter:Gj,WebkitFilter:Gj},U4e=t=>Ift[t];function $4e(t,e){let r=U4e(t);return r!==Gj&&(r=Wv),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const kft=new Set(["auto","none","0"]);function Oft(t,e,r){let n=0,a;for(;n<t.length&&!a;){const i=t[n];typeof i=="string"&&!kft.has(i)&&pN(i).values.length&&(a=t[n]),n++}if(a&&r)for(const i of e)t[i]=$4e(r,a)}class Dft extends fre{constructor(e,r,n,a,i){super(e,r,n,a,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:r,name:n}=this;if(!r||!r.current)return;super.readKeyframes();for(let d=0;d<e.length;d++){let h=e[d];if(typeof h=="string"&&(h=h.trim(),ire(h))){const f=M4e(h,r.current);f!==void 0&&(e[d]=f),d===e.length-1&&(this.finalKeyframe=h)}}if(this.resolveNoneKeyframes(),!P4e.has(n)||e.length!==2)return;const[a,i]=e,s=Xme(a),o=Xme(i),l=Pme(a),u=Pme(i);if(l!==u&&mv[n]){this.needsMeasurement=!0;return}if(s!==o)if(Yme(s)&&Yme(o))for(let d=0;d<e.length;d++){const h=e[d];typeof h=="string"&&(e[d]=parseFloat(h))}else mv[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:r}=this,n=[];for(let a=0;a<e.length;a++)(e[a]===null||wft(e[a]))&&n.push(a);n.length&&Oft(e,n,r)}measureInitialState(){const{element:e,unresolvedKeyframes:r,name:n}=this;if(!e||!e.current)return;n==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=mv[n](e.measureViewportBox(),window.getComputedStyle(e.current)),r[0]=this.measuredOrigin;const a=r[r.length-1];a!==void 0&&e.getValue(n,a).jump(a,!1)}measureEndState(){const{element:e,name:r,unresolvedKeyframes:n}=this;if(!e||!e.current)return;const a=e.getValue(r);a&&a.jump(this.measuredOrigin,!1);const i=n.length-1,s=n[i];n[i]=mv[r](e.measureViewportBox(),window.getComputedStyle(e.current)),s!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=s),this.removedTransforms?.length&&this.removedTransforms.forEach(([o,l])=>{e.getValue(o).set(l)}),this.resolveNoneKeyframes()}}function Lft(t,e,r){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let n=document;const a=r?.[t]??n.querySelectorAll(t);return a?Array.from(a):[]}return Array.from(t)}const G4e=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Mft(t){return n4e(t)&&"offsetHeight"in t}const Kme=30,Pft=t=>!isNaN(parseFloat(t));class Bft{constructor(e,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{const a=ec.now();if(this.updatedAt!==a&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const i of this.dependents)i.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=ec.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Pft(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&rre(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new tre);const n=this.events[e].add(r);return e==="change"?()=>{n(),bi.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=ec.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Kme)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,Kme);return i4e(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ix(t,e){return new Bft(t,e)}const{schedule:mre}=m4e(queueMicrotask,!1),mh={x:!1,y:!1};function z4e(){return mh.x||mh.y}function Fft(t){return t==="x"||t==="y"?mh[t]?null:(mh[t]=!0,()=>{mh[t]=!1}):mh.x||mh.y?null:(mh.x=mh.y=!0,()=>{mh.x=mh.y=!1})}function V4e(t,e){const r=Lft(t),n=new AbortController,a={passive:!0,...e,signal:n.signal};return[r,a,()=>n.abort()]}function Zme(t){return!(t.pointerType==="touch"||z4e())}function Uft(t,e,r={}){const[n,a,i]=V4e(t,r),s=o=>{if(!Zme(o))return;const{target:l}=o,u=e(l,o);if(typeof u!="function"||!l)return;const d=h=>{Zme(h)&&(u(h),l.removeEventListener("pointerleave",d))};l.addEventListener("pointerleave",d,a)};return n.forEach(o=>{o.addEventListener("pointerenter",s,a)}),i}const H4e=(t,e)=>e?t===e?!0:H4e(t,e.parentElement):!1,vre=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,$ft=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Y4e(t){return $ft.has(t.tagName)||t.isContentEditable===!0}const bP=new WeakSet;function Qme(t){return e=>{e.key==="Enter"&&t(e)}}function fU(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Gft=(t,e)=>{const r=t.currentTarget;if(!r)return;const n=Qme(()=>{if(bP.has(r))return;fU(r,"down");const a=Qme(()=>{fU(r,"up")}),i=()=>fU(r,"cancel");r.addEventListener("keyup",a,e),r.addEventListener("blur",i,e)});r.addEventListener("keydown",n,e),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),e)};function Jme(t){return vre(t)&&!z4e()}function zft(t,e,r={}){const[n,a,i]=V4e(t,r),s=o=>{const l=o.currentTarget;if(!Jme(o))return;bP.add(l);const u=e(l,o),d=(p,g)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",f),bP.has(l)&&bP.delete(l),Jme(p)&&typeof u=="function"&&u(p,{success:g})},h=p=>{d(p,l===window||l===document||r.useGlobalTarget||H4e(l,p.target))},f=p=>{d(p,!1)};window.addEventListener("pointerup",h,a),window.addEventListener("pointercancel",f,a)};return n.forEach(o=>{(r.useGlobalTarget?window:o).addEventListener("pointerdown",s,a),Mft(o)&&(o.addEventListener("focus",u=>Gft(u,a)),!Y4e(o)&&!o.hasAttribute("tabindex")&&(o.tabIndex=0))}),i}function W4e(t){return n4e(t)&&"ownerSVGElement"in t}function Vft(t){return W4e(t)&&t.tagName==="svg"}const Tl=t=>!!(t&&t.getVelocity),Hft=[...F4e,ks,Wv],Yft=t=>Hft.find(B4e(t)),q4e=Me.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Wft(t=!0){const e=Me.useContext(Zte);if(e===null)return[!0,null];const{isPresent:r,onExitComplete:n,register:a}=e,i=Me.useId();Me.useEffect(()=>{if(t)return a(i)},[t]);const s=Me.useCallback(()=>t&&n&&n(i),[i,n,t]);return!r&&n?[!1,s]:[!0]}const X4e=Me.createContext({strict:!1}),eve={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},sx={};for(const t in eve)sx[t]={isEnabled:e=>eve[t].some(r=>!!e[r])};function qft(t){for(const e in t)sx[e]={...sx[e],...t[e]}}const Xft=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function h4(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Xft.has(t)}let j4e=t=>!h4(t);function jft(t){typeof t=="function"&&(j4e=e=>e.startsWith("on")?!h4(e):t(e))}try{jft(require("@emotion/is-prop-valid").default)}catch{}function Kft(t,e,r){const n={};for(const a in t)a==="values"&&typeof t.values=="object"||(j4e(a)||r===!0&&h4(a)||!e&&!h4(a)||t.draggable&&a.startsWith("onDrag"))&&(n[a]=t[a]);return n}const DB=Me.createContext({});function LB(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function gN(t){return typeof t=="string"||Array.isArray(t)}const yre=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],_re=["initial",...yre];function MB(t){return LB(t.animate)||_re.some(e=>gN(t[e]))}function K4e(t){return!!(MB(t)||t.variants)}function Zft(t,e){if(MB(t)){const{initial:r,animate:n}=t;return{initial:r===!1||gN(r)?r:void 0,animate:gN(n)?n:void 0}}return t.inherit!==!1?e:{}}function Qft(t){const{initial:e,animate:r}=Zft(t,Me.useContext(DB));return Me.useMemo(()=>({initial:e,animate:r}),[tve(e),tve(r)])}function tve(t){return Array.isArray(t)?t.join(" "):t}function rve(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const bC={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(yr.test(t))t=parseFloat(t);else return t;const r=rve(t,e.target.x),n=rve(t,e.target.y);return`${r}% ${n}%`}},Jft={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,a=Wv.parse(t);if(a.length>5)return n;const i=Wv.createTransformer(t),s=typeof a[0]!="number"?1:0,o=r.x.scale*e.x,l=r.y.scale*e.y;a[0+s]/=o,a[1+s]/=l;const u=Yi(o,l,.5);return typeof a[2+s]=="number"&&(a[2+s]/=u),typeof a[3+s]=="number"&&(a[3+s]/=u),i(a)}},zj={borderRadius:{...bC,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:bC,borderTopRightRadius:bC,borderBottomLeftRadius:bC,borderBottomRightRadius:bC,boxShadow:Jft};function Z4e(t,{layout:e,layoutId:r}){return lw.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!zj[t]||t==="opacity")}const ept={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},tpt=ow.length;function rpt(t,e,r){let n="",a=!0;for(let i=0;i<tpt;i++){const s=ow[i],o=t[s];if(o===void 0)continue;let l=!0;if(typeof o=="number"?l=o===(s.startsWith("scale")?1:0):l=parseFloat(o)===0,!l||r){const u=G4e(o,gre[s]);if(!l){a=!1;const d=ept[s]||s;n+=`${d}(${u}) `}r&&(e[s]=u)}}return n=n.trim(),r?n=r(e,a?"":n):a&&(n="none"),n}function bre(t,e,r){const{style:n,vars:a,transformOrigin:i}=t;let s=!1,o=!1;for(const l in e){const u=e[l];if(lw.has(l)){s=!0;continue}else if(y4e(l)){a[l]=u;continue}else{const d=G4e(u,gre[l]);l.startsWith("origin")?(o=!0,i[l]=d):n[l]=d}}if(e.transform||(s||r?n.transform=rpt(e,t.transform,r):n.transform&&(n.transform="none")),o){const{originX:l="50%",originY:u="50%",originZ:d=0}=i;n.transformOrigin=`${l} ${u} ${d}`}}const Ere=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Q4e(t,e,r){for(const n in e)!Tl(e[n])&&!Z4e(n,r)&&(t[n]=e[n])}function npt({transformTemplate:t},e){return Me.useMemo(()=>{const r=Ere();return bre(r,e,t),Object.assign({},r.vars,r.style)},[e])}function apt(t,e){const r=t.style||{},n={};return Q4e(n,r,t),Object.assign(n,npt(t,e)),n}function ipt(t,e){const r={},n=apt(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const spt={offset:"stroke-dashoffset",array:"stroke-dasharray"},opt={offset:"strokeDashoffset",array:"strokeDasharray"};function lpt(t,e,r=1,n=0,a=!0){t.pathLength=1;const i=a?spt:opt;t[i.offset]=yr.transform(-n);const s=yr.transform(e),o=yr.transform(r);t[i.array]=`${s} ${o}`}const cpt=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function J4e(t,{attrX:e,attrY:r,attrScale:n,pathLength:a,pathSpacing:i=1,pathOffset:s=0,...o},l,u,d){if(bre(t,o,u),l){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:f}=t;h.transform&&(f.transform=h.transform,delete h.transform),(f.transform||h.transformOrigin)&&(f.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),f.transform&&(f.transformBox=d?.transformBox??"fill-box",delete h.transformBox);for(const p of cpt)h[p]!==void 0&&(f[p]=h[p],delete h[p]);e!==void 0&&(h.x=e),r!==void 0&&(h.y=r),n!==void 0&&(h.scale=n),a!==void 0&&lpt(h,a,i,s,!1)}const e5e=()=>({...Ere(),attrs:{}}),t5e=t=>typeof t=="string"&&t.toLowerCase()==="svg";function upt(t,e,r,n){const a=Me.useMemo(()=>{const i=e5e();return J4e(i,e,t5e(n),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};Q4e(i,t.style,t),a.style={...i,...a.style}}return a}const dpt=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Sre(t){return typeof t!="string"||t.includes("-")?!1:!!(dpt.indexOf(t)>-1||/[A-Z]/u.test(t))}function hpt(t,e,r,{latestValues:n},a,i=!1,s){const l=(s??Sre(t)?upt:ipt)(e,n,a,t),u=Kft(e,typeof t=="string",i),d=t!==Me.Fragment?{...u,...l,ref:r}:{},{children:h}=e,f=Me.useMemo(()=>Tl(h)?h.get():h,[h]);return Me.createElement(t,{...d,children:f})}function nve(t){const e=[{},{}];return t?.values.forEach((r,n)=>{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function Tre(t,e,r,n){if(typeof e=="function"){const[a,i]=nve(n);e=e(r!==void 0?r:t.custom,a,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[a,i]=nve(n);e=e(r!==void 0?r:t.custom,a,i)}return e}function EP(t){return Tl(t)?t.get():t}function fpt({scrapeMotionValuesFromProps:t,createRenderState:e},r,n,a){return{latestValues:ppt(r,n,a,t),renderState:e()}}function ppt(t,e,r,n){const a={},i=n(t,{});for(const f in i)a[f]=EP(i[f]);let{initial:s,animate:o}=t;const l=MB(t),u=K4e(t);e&&u&&!l&&t.inherit!==!1&&(s===void 0&&(s=e.initial),o===void 0&&(o=e.animate));let d=r?r.initial===!1:!1;d=d||s===!1;const h=d?o:s;if(h&&typeof h!="boolean"&&!LB(h)){const f=Array.isArray(h)?h:[h];for(let p=0;p<f.length;p++){const g=Tre(t,f[p]);if(g){const{transitionEnd:m,transition:_,...y}=g;for(const v in y){let b=y[v];if(Array.isArray(b)){const E=d?b.length-1:0;b=b[E]}b!==null&&(a[v]=b)}for(const v in m)a[v]=m[v]}}}return a}const r5e=t=>(e,r)=>{const n=Me.useContext(DB),a=Me.useContext(Zte),i=()=>fpt(t,e,n,a);return r?i():Xdt(i)};function xre(t,e,r){const{style:n}=t,a={};for(const i in n)(Tl(n[i])||e.style&&Tl(e.style[i])||Z4e(i,t)||r?.getValue(i)?.liveStyle!==void 0)&&(a[i]=n[i]);return a}const gpt=r5e({scrapeMotionValuesFromProps:xre,createRenderState:Ere});function n5e(t,e,r){const n=xre(t,e,r);for(const a in t)if(Tl(t[a])||Tl(e[a])){const i=ow.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;n[i]=t[a]}return n}const mpt=r5e({scrapeMotionValuesFromProps:n5e,createRenderState:e5e}),vpt=Symbol.for("motionComponentSymbol");function ypt(t,e,r){const n=Me.useRef(r);Me.useInsertionEffect(()=>{n.current=r});const a=Me.useRef(null);return Me.useCallback(i=>{i&&t.onMount?.(i),e&&(i?e.mount(i):e.unmount());const s=n.current;if(typeof s=="function")if(i){const o=s(i);typeof o=="function"&&(a.current=o)}else a.current?(a.current(),a.current=null):s(i);else s&&(s.current=i)},[e])}const wre=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),_pt="framerAppearId",a5e="data-"+wre(_pt),i5e=Me.createContext({});function t2(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function bpt(t,e,r,n,a,i){const{visualElement:s}=Me.useContext(DB),o=Me.useContext(X4e),l=Me.useContext(Zte),u=Me.useContext(q4e).reducedMotion,d=Me.useRef(null);n=n||o.renderer,!d.current&&n&&(d.current=n(t,{visualState:e,parent:s,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,isSVG:i}));const h=d.current,f=Me.useContext(i5e);h&&!h.projection&&a&&(h.type==="html"||h.type==="svg")&&Ept(d.current,r,a,f);const p=Me.useRef(!1);Me.useInsertionEffect(()=>{h&&p.current&&h.update(r,l)});const g=r[a5e],m=Me.useRef(!!g&&!window.MotionHandoffIsComplete?.(g)&&window.MotionHasOptimisedAnimation?.(g));return jdt(()=>{h&&(p.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),h.scheduleRenderMicrotask(),m.current&&h.animationState&&h.animationState.animateChanges())}),Me.useEffect(()=>{h&&(!m.current&&h.animationState&&h.animationState.animateChanges(),m.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(g)}),m.current=!1),h.enteringChildren=void 0)}),h}function Ept(t,e,r,n){const{layoutId:a,layout:i,drag:s,dragConstraints:o,layoutScroll:l,layoutRoot:u,layoutCrossfade:d}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:s5e(t.parent)),t.projection.setOptions({layoutId:a,layout:i,alwaysMeasureLayout:!!s||o&&t2(o),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:n,crossfade:d,layoutScroll:l,layoutRoot:u})}function s5e(t){if(t)return t.options.allowProjection!==!1?t.projection:s5e(t.parent)}function pU(t,{forwardMotionProps:e=!1,type:r}={},n,a){n&&qft(n);const i=r?r==="svg":Sre(t),s=i?mpt:gpt;function o(u,d){let h;const f={...Me.useContext(q4e),...u,layoutId:Spt(u)},{isStatic:p}=f,g=Qft(u),m=s(u,p);if(!p&&Kte){Tpt(f,n);const _=xpt(f);h=_.MeasureLayout,g.visualElement=bpt(t,m,f,a,_.ProjectionNode,i)}return rr.jsxs(DB.Provider,{value:g,children:[h&&g.visualElement?rr.jsx(h,{visualElement:g.visualElement,...f}):null,hpt(t,u,ypt(m,g.visualElement,d),m,p,e,i)]})}o.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const l=Me.forwardRef(o);return l[vpt]=t,l}function Spt({layoutId:t}){const e=Me.useContext(t4e).id;return e&&t!==void 0?e+"-"+t:t}function Tpt(t,e){const r=Me.useContext(X4e).strict;if(process.env.NODE_ENV!=="production"&&e&&r){const n="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?iw(!1,n,"lazy-strict-mode"):Wg(!1,n,"lazy-strict-mode")}}function xpt(t){const{drag:e,layout:r}=sx;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e?.isEnabled(t)||r?.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}function wpt(t,e){if(typeof Proxy>"u")return pU;const r=new Map,n=(i,s)=>pU(i,s,t,e),a=(i,s)=>(process.env.NODE_ENV!=="production"&&rre(!1,"motion() is deprecated. Use motion.create() instead."),n(i,s));return new Proxy(a,{get:(i,s)=>s==="create"?n:(r.has(s)||r.set(s,pU(s,void 0,t,e)),r.get(s))})}function o5e({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function Cpt({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function Apt(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function gU(t){return t===void 0||t===1}function Vj({scale:t,scaleX:e,scaleY:r}){return!gU(t)||!gU(e)||!gU(r)}function Xy(t){return Vj(t)||l5e(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function l5e(t){return ave(t.x)||ave(t.y)}function ave(t){return t&&t!=="0%"}function f4(t,e,r){const n=t-r,a=e*n;return r+a}function ive(t,e,r,n,a){return a!==void 0&&(t=f4(t,a,n)),f4(t,r,n)+e}function Hj(t,e=0,r=1,n,a){t.min=ive(t.min,e,r,n,a),t.max=ive(t.max,e,r,n,a)}function c5e(t,{x:e,y:r}){Hj(t.x,e.translate,e.scale,e.originPoint),Hj(t.y,r.translate,r.scale,r.originPoint)}const sve=.999999999999,ove=1.0000000000001;function Rpt(t,e,r,n=!1){const a=r.length;if(!a)return;e.x=e.y=1;let i,s;for(let o=0;o<a;o++){i=r[o],s=i.projectionDelta;const{visualElement:l}=i.options;l&&l.props.style&&l.props.style.display==="contents"||(n&&i.options.layoutScroll&&i.scroll&&i!==i.root&&sS(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),s&&(e.x*=s.x.scale,e.y*=s.y.scale,c5e(t,s)),n&&Xy(i.latestValues)&&sS(t,i.latestValues))}e.x<ove&&e.x>sve&&(e.x=1),e.y<ove&&e.y>sve&&(e.y=1)}function iS(t,e){t.min=t.min+e,t.max=t.max+e}function lve(t,e,r,n,a=.5){const i=Yi(t.min,t.max,a);Hj(t,e,r,i,n)}function sS(t,e){lve(t.x,e.x,e.scaleX,e.scale,e.originX),lve(t.y,e.y,e.scaleY,e.scale,e.originY)}function u5e(t,e){return o5e(Apt(t.getBoundingClientRect(),e))}function Npt(t,e,r){const n=u5e(t,r),{scroll:a}=e;return a&&(iS(n.x,a.offset.x),iS(n.y,a.offset.y)),n}const cve=()=>({translate:0,scale:1,origin:0,originPoint:0}),oS=()=>({x:cve(),y:cve()}),uve=()=>({min:0,max:0}),js=()=>({x:uve(),y:uve()}),Yj={current:null},d5e={current:!1};function Ipt(){if(d5e.current=!0,!!Kte)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Yj.current=t.matches;t.addEventListener("change",e),e()}else Yj.current=!1}const kpt=new WeakMap;function Opt(t,e,r){for(const n in e){const a=e[n],i=r[n];if(Tl(a))t.addValue(n,a);else if(Tl(i))t.addValue(n,ix(a,{owner:t}));else if(i!==a)if(t.hasValue(n)){const s=t.getValue(n);s.liveStyle===!0?s.jump(a):s.hasAnimated||s.set(a)}else{const s=t.getStaticValue(n);t.addValue(n,ix(s!==void 0?s:a,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const dve=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Dpt{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:a,blockInitialAnimation:i,visualState:s},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=fre,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=ec.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,bi.render(this.render,!1,!0))};const{latestValues:l,renderState:u}=s;this.latestValues=l,this.baseTarget={...l},this.initialValues=r.initial?{...l}:{},this.renderState=u,this.parent=e,this.props=r,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=a,this.options=o,this.blockInitialAnimation=!!i,this.isControllingVariants=MB(r),this.isVariantNode=K4e(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...h}=this.scrapeMotionValuesFromProps(r,{},this);for(const f in h){const p=h[f];l[f]!==void 0&&Tl(p)&&p.set(l[f])}}mount(e){this.current=e,kpt.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,n)=>this.bindToMotionValue(n,r)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(d5e.current||Ipt(),this.shouldReduceMotion=Yj.current),process.env.NODE_ENV!=="production"&&rre(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Yv(this.notifyUpdate),Yv(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=lw.has(e);n&&this.onBindTransform&&this.onBindTransform();const a=r.on("change",s=>{this.latestValues[e]=s,this.props.onUpdate&&bi.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{a(),i&&i(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in sx){const r=sx[e];if(!r)continue;const{isEnabled:n,Feature:a}=r;if(!this.features[e]&&a&&n(this.props)&&(this.features[e]=new a(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):js()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;n<dve.length;n++){const a=dve[n];this.propEventSubscriptions[a]&&(this.propEventSubscriptions[a](),delete this.propEventSubscriptions[a]);const i="on"+a,s=e[i];s&&(this.propEventSubscriptions[a]=this.on(a,s))}this.prevMotionValues=Opt(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(e),()=>r.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=ix(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n=="string"&&(r4e(n)||a4e(n))?n=parseFloat(n):!Yft(n)&&Wv.test(r)&&(n=$4e(e,r)),this.setBaseTarget(e,Tl(n)?n.get():n)),Tl(n)?n.get():n}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){const{initial:r}=this.props;let n;if(typeof r=="string"||typeof r=="object"){const i=Tre(this.props,r,this.presenceContext?.custom);i&&(n=i[e])}if(r&&n!==void 0)return n;const a=this.getBaseTargetFromProps(this.props,e);return a!==void 0&&!Tl(a)?a:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new tre),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}scheduleRenderMicrotask(){mre.render(this.render)}}class h5e extends Dpt{constructor(){super(...arguments),this.KeyframeResolver=Dft}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Tl(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}function f5e(t,{style:e,vars:r},n,a){const i=t.style;let s;for(s in e)i[s]=e[s];a?.applyProjectionStyles(i,n);for(s in r)i.setProperty(s,r[s])}function Lpt(t){return window.getComputedStyle(t)}class Mpt extends h5e{constructor(){super(...arguments),this.type="html",this.renderInstance=f5e}readValueFromInstance(e,r){if(lw.has(r))return this.projection?.isProjecting?Mj(r):Zht(e,r);{const n=Lpt(e),a=(y4e(r)?n.getPropertyValue(r):n[r])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(e,{transformPagePoint:r}){return u5e(e,r)}build(e,r,n){bre(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return xre(e,r,n)}}const p5e=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Ppt(t,e,r,n){f5e(t,e,void 0,n);for(const a in e.attrs)t.setAttribute(p5e.has(a)?a:wre(a),e.attrs[a])}class Bpt extends h5e{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=js}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(lw.has(r)){const n=U4e(r);return n&&n.default||0}return r=p5e.has(r)?r:wre(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return n5e(e,r,n)}build(e,r,n){J4e(e,r,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,r,n,a){Ppt(e,r,n,a)}mount(e){this.isSVGTag=t5e(e.tagName),super.mount(e)}}const Fpt=(t,e)=>e.isSVG??Sre(t)?new Bpt(e):new Mpt(e,{allowProjection:t!==Me.Fragment});function RS(t,e,r){const n=t.getProps();return Tre(n,e,r!==void 0?r:n.custom,t)}const Wj=t=>Array.isArray(t);function Upt(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,ix(r))}function $pt(t){return Wj(t)?t[t.length-1]||0:t}function Gpt(t,e){const r=RS(t,e);let{transitionEnd:n={},transition:a={},...i}=r||{};i={...i,...n};for(const s in i){const o=$pt(i[s]);Upt(t,s,o)}}function zpt(t){return!!(Tl(t)&&t.add)}function qj(t,e){const r=t.getValue("willChange");if(zpt(r))return r.add(e);if(!r&&qg.WillChange){const n=new qg.WillChange("auto");t.addValue("willChange",n),n.add(e)}}function g5e(t){return t.props[a5e]}const Vpt=t=>t!==null;function Hpt(t,{repeat:e,repeatType:r="loop"},n){const a=t.filter(Vpt),i=e&&r!=="loop"&&e%2===1?0:a.length-1;return a[i]}const Ypt={type:"spring",stiffness:500,damping:25,restSpeed:10},Wpt=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),qpt={type:"keyframes",duration:.8},Xpt={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},jpt=(t,{keyframes:e})=>e.length>2?qpt:lw.has(t)?t.startsWith("scale")?Wpt(e[1]):Ypt:Xpt;function Kpt({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:a,repeat:i,repeatType:s,repeatDelay:o,from:l,elapsed:u,...d}){return!!Object.keys(d).length}const Cre=(t,e,r,n={},a,i)=>s=>{const o=pre(n,t)||{},l=o.delay||n.delay||0;let{elapsed:u=0}=n;u=u-np(l);const d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...o,delay:-u,onUpdate:f=>{e.set(f),o.onUpdate&&o.onUpdate(f)},onComplete:()=>{s(),o.onComplete&&o.onComplete()},name:t,motionValue:e,element:i?void 0:a};Kpt(o)||Object.assign(d,jpt(t,d)),d.duration&&(d.duration=np(d.duration)),d.repeatDelay&&(d.repeatDelay=np(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let h=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&($j(d),d.delay===0&&(h=!0)),(qg.instantAnimations||qg.skipAnimations)&&(h=!0,$j(d),d.delay=0),d.allowFlatten=!o.type&&!o.ease,h&&!i&&e.get()!==void 0){const f=Hpt(d.keyframes,o);if(f!==void 0){bi.update(()=>{d.onUpdate(f),d.onComplete()});return}}return o.isSync?new hre(d):new bft(d)};function Zpt({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function m5e(t,e,{delay:r=0,transitionOverride:n,type:a}={}){let{transition:i=t.getDefaultTransition(),transitionEnd:s,...o}=e;n&&(i=n);const l=[],u=a&&t.animationState&&t.animationState.getState()[a];for(const d in o){const h=t.getValue(d,t.latestValues[d]??null),f=o[d];if(f===void 0||u&&Zpt(u,d))continue;const p={delay:r,...pre(i||{},d)},g=h.get();if(g!==void 0&&!h.isAnimating&&!Array.isArray(f)&&f===g&&!p.velocity)continue;let m=!1;if(window.MotionHandoffAnimation){const y=g5e(t);if(y){const v=window.MotionHandoffAnimation(y,d,bi);v!==null&&(p.startTime=v,m=!0)}}qj(t,d),h.start(Cre(d,h,f,t.shouldReduceMotion&&P4e.has(d)?{type:!1}:p,t,m));const _=h.animation;_&&l.push(_)}return s&&Promise.all(l).then(()=>{bi.update(()=>{s&&Gpt(t,s)})}),l}function v5e(t,e,r,n=0,a=1){const i=Array.from(t).sort((u,d)=>u.sortNodePosition(d)).indexOf(e),s=t.size,o=(s-1)*n;return typeof r=="function"?r(i,s):a===1?i*n:o-i*n}function Xj(t,e,r={}){const n=RS(t,e,r.type==="exit"?t.presenceContext?.custom:void 0);let{transition:a=t.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(a=r.transitionOverride);const i=n?()=>Promise.all(m5e(t,n,r)):()=>Promise.resolve(),s=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:d,staggerDirection:h}=a;return Qpt(t,e,l,u,d,h,r)}:()=>Promise.resolve(),{when:o}=a;if(o){const[l,u]=o==="beforeChildren"?[i,s]:[s,i];return l().then(()=>u())}else return Promise.all([i(),s(r.delay)])}function Qpt(t,e,r=0,n=0,a=0,i=1,s){const o=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),o.push(Xj(l,e,{...s,delay:r+(typeof n=="function"?0:n)+v5e(t.variantChildren,l,n,a,i)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(o)}function Jpt(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const a=e.map(i=>Xj(t,i,r));n=Promise.all(a)}else if(typeof e=="string")n=Xj(t,e,r);else{const a=typeof e=="function"?RS(t,e,r.custom):e;n=Promise.all(m5e(t,a,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}function y5e(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}const egt=_re.length;function _5e(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?_5e(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;r<egt;r++){const n=_re[r],a=t.props[n];(gN(a)||a===!1)&&(e[n]=a)}return e}const tgt=[...yre].reverse(),rgt=yre.length;function ngt(t){return e=>Promise.all(e.map(({animation:r,options:n})=>Jpt(t,r,n)))}function agt(t){let e=ngt(t),r=hve(),n=!0;const a=l=>(u,d)=>{const h=RS(t,d,l==="exit"?t.presenceContext?.custom:void 0);if(h){const{transition:f,transitionEnd:p,...g}=h;u={...u,...g,...p}}return u};function i(l){e=l(t)}function s(l){const{props:u}=t,d=_5e(t.parent)||{},h=[],f=new Set;let p={},g=1/0;for(let _=0;_<rgt;_++){const y=tgt[_],v=r[y],b=u[y]!==void 0?u[y]:d[y],E=gN(b),S=y===l?v.isActive:null;S===!1&&(g=_);let T=b===d[y]&&b!==u[y]&&E;if(T&&n&&t.manuallyAnimateOnMount&&(T=!1),v.protectedKeys={...p},!v.isActive&&S===null||!b&&!v.prevProp||LB(b)||typeof b=="boolean")continue;const x=igt(v.prevProp,b);let w=x||y===l&&v.isActive&&!T&&E||_>g&&E,C=!1;const R=Array.isArray(b)?b:[b];let N=R.reduce(a(y),{});S===!1&&(N={});const{prevResolvedValues:k={}}=v,L={...k,...N},A=B=>{w=!0,f.has(B)&&(C=!0,f.delete(B)),v.needsAnimating[B]=!0;const F=t.getValue(B);F&&(F.liveStyle=!1)};for(const B in L){const F=N[B],U=k[B];if(p.hasOwnProperty(B))continue;let V=!1;Wj(F)&&Wj(U)?V=!y5e(F,U):V=F!==U,V?F!=null?A(B):f.add(B):F!==void 0&&f.has(B)?A(B):v.protectedKeys[B]=!0}v.prevProp=b,v.prevResolvedValues=N,v.isActive&&(p={...p,...N}),n&&t.blockInitialAnimation&&(w=!1);const D=T&&x;w&&(!D||C)&&h.push(...R.map(B=>{const F={type:y};if(typeof B=="string"&&n&&!D&&t.manuallyAnimateOnMount&&t.parent){const{parent:U}=t,V=RS(U,B);if(U.enteringChildren&&V){const{delayChildren:$}=V.transition||{};F.delay=v5e(U.enteringChildren,t,$)}}return{animation:B,options:F}}))}if(f.size){const _={};if(typeof u.initial!="boolean"){const y=RS(t,Array.isArray(u.initial)?u.initial[0]:u.initial);y&&y.transition&&(_.transition=y.transition)}f.forEach(y=>{const v=t.getBaseTarget(y),b=t.getValue(y);b&&(b.liveStyle=!0),_[y]=v??null}),h.push({animation:_})}let m=!!h.length;return n&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(m=!1),n=!1,m?e(h):Promise.resolve()}function o(l,u){if(r[l].isActive===u)return Promise.resolve();t.variantChildren?.forEach(h=>h.animationState?.setActive(l,u)),r[l].isActive=u;const d=s(l);for(const h in r)r[h].protectedKeys={};return d}return{animateChanges:s,setActive:o,setAnimateFunction:i,getState:()=>r,reset:()=>{r=hve()}}}function igt(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!y5e(e,t):!1}function ly(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function hve(){return{animate:ly(!0),whileInView:ly(),whileHover:ly(),whileTap:ly(),whileDrag:ly(),whileFocus:ly(),exit:ly()}}class C0{constructor(e){this.isMounted=!1,this.node=e}update(){}}class sgt extends C0{constructor(e){super(e),e.animationState||(e.animationState=agt(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();LB(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let ogt=0;class lgt extends C0{constructor(){super(...arguments),this.id=ogt++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const a=this.node.animationState.setActive("exit",!e);r&&!e&&a.then(()=>{r(this.id)})}mount(){const{register:e,onExitComplete:r}=this.node.presenceContext||{};r&&r(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const cgt={animation:{Feature:sgt},exit:{Feature:lgt}};function mN(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function QI(t){return{point:{x:t.pageX,y:t.pageY}}}const ugt=t=>e=>vre(e)&&t(e,QI(e));function xR(t,e,r,n){return mN(t,e,ugt(r),n)}const b5e=1e-4,dgt=1-b5e,hgt=1+b5e,E5e=.01,fgt=0-E5e,pgt=0+E5e;function tc(t){return t.max-t.min}function ggt(t,e,r){return Math.abs(t-e)<=r}function fve(t,e,r,n=.5){t.origin=n,t.originPoint=Yi(e.min,e.max,t.origin),t.scale=tc(r)/tc(e),t.translate=Yi(r.min,r.max,t.origin)-t.originPoint,(t.scale>=dgt&&t.scale<=hgt||isNaN(t.scale))&&(t.scale=1),(t.translate>=fgt&&t.translate<=pgt||isNaN(t.translate))&&(t.translate=0)}function wR(t,e,r,n){fve(t.x,e.x,r.x,n?n.originX:void 0),fve(t.y,e.y,r.y,n?n.originY:void 0)}function pve(t,e,r){t.min=r.min+e.min,t.max=t.min+tc(e)}function mgt(t,e,r){pve(t.x,e.x,r.x),pve(t.y,e.y,r.y)}function gve(t,e,r){t.min=e.min-r.min,t.max=t.min+tc(e)}function p4(t,e,r){gve(t.x,e.x,r.x),gve(t.y,e.y,r.y)}function _d(t){return[t("x"),t("y")]}const S5e=({current:t})=>t?t.ownerDocument.defaultView:null,mve=(t,e)=>Math.abs(t-e);function vgt(t,e){const r=mve(t.x,e.x),n=mve(t.y,e.y);return Math.sqrt(r**2+n**2)}const vve=new Set(["auto","scroll"]);class T5e{constructor(e,r,{transformPagePoint:n,contextWindow:a=window,dragSnapToOrigin:i=!1,distanceThreshold:s=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=p=>{this.handleScroll(p.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=vU(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,m=vgt(p.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!m)return;const{point:_}=p,{timestamp:y}=Ho;this.history.push({..._,timestamp:y});const{onStart:v,onMove:b}=this.handlers;g||(v&&v(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),b&&b(this.lastMoveEvent,p)},this.handlePointerMove=(p,g)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=mU(g,this.transformPagePoint),bi.update(this.updatePoint,!0)},this.handlePointerUp=(p,g)=>{this.end();const{onEnd:m,onSessionEnd:_,resumeAnimation:y}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=vU(p.type==="pointercancel"?this.lastMoveEventInfo:mU(g,this.transformPagePoint),this.history);this.startEvent&&m&&m(p,v),_&&_(p,v)},!vre(e))return;this.dragSnapToOrigin=i,this.handlers=r,this.transformPagePoint=n,this.distanceThreshold=s,this.contextWindow=a||window;const l=QI(e),u=mU(l,this.transformPagePoint),{point:d}=u,{timestamp:h}=Ho;this.history=[{...d,timestamp:h}];const{onSessionStart:f}=r;f&&f(e,vU(u,this.history)),this.removeListeners=jI(xR(this.contextWindow,"pointermove",this.handlePointerMove),xR(this.contextWindow,"pointerup",this.handlePointerUp),xR(this.contextWindow,"pointercancel",this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let r=e.parentElement;for(;r;){const n=getComputedStyle(r);(vve.has(n.overflowX)||vve.has(n.overflowY))&&this.scrollPositions.set(r,{x:r.scrollLeft,y:r.scrollTop}),r=r.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const r=this.scrollPositions.get(e);if(!r)return;const n=e===window,a=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:a.x-r.x,y:a.y-r.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,a),bi.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Yv(this.updatePoint)}}function mU(t,e){return e?{point:e(t.point)}:t}function yve(t,e){return{x:t.x-e.x,y:t.y-e.y}}function vU({point:t},e){return{point:t,delta:yve(t,x5e(e)),offset:yve(t,ygt(e)),velocity:_gt(e,.1)}}function ygt(t){return t[0]}function x5e(t){return t[t.length-1]}function _gt(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const a=x5e(t);for(;r>=0&&(n=t[r],!(a.timestamp-n.timestamp>np(e)));)r--;if(!n)return{x:0,y:0};const i=Pd(a.timestamp-n.timestamp);if(i===0)return{x:0,y:0};const s={x:(a.x-n.x)/i,y:(a.y-n.y)/i};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function bgt(t,{min:e,max:r},n){return e!==void 0&&t<e?t=n?Yi(e,t,n.min):Math.max(t,e):r!==void 0&&t>r&&(t=n?Yi(r,t,n.max):Math.min(t,r)),t}function _ve(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function Egt(t,{top:e,left:r,bottom:n,right:a}){return{x:_ve(t.x,r,a),y:_ve(t.y,e,n)}}function bve(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.min<t.max-t.min&&([r,n]=[n,r]),{min:r,max:n}}function Sgt(t,e){return{x:bve(t.x,e.x),y:bve(t.y,e.y)}}function Tgt(t,e){let r=.5;const n=tc(t),a=tc(e);return a>n?r=hN(e.min,e.max-n,t.min):n>a&&(r=hN(t.min,t.max-a,e.min)),cp(0,1,r)}function xgt(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const jj=.35;function wgt(t=jj){return t===!1?t=0:t===!0&&(t=jj),{x:Eve(t,"left","right"),y:Eve(t,"top","bottom")}}function Eve(t,e,r){return{min:Sve(t,e),max:Sve(t,r)}}function Sve(t,e){return typeof t=="number"?t:t[e]||0}const Cgt=new WeakMap;class Agt{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=js(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:r=!1,distanceThreshold:n}={}){const{presenceContext:a}=this.visualElement;if(a&&a.isPresent===!1)return;const i=h=>{r?(this.stopAnimation(),this.snapToCursor(QI(h).point)):this.pauseAnimation()},s=(h,f)=>{this.stopAnimation();const{drag:p,dragPropagation:g,onDragStart:m}=this.getProps();if(p&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Fft(p),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),_d(y=>{let v=this.getAxisMotionValue(y).get()||0;if(ap.test(v)){const{projection:b}=this.visualElement;if(b&&b.layout){const E=b.layout.layoutBox[y];E&&(v=tc(E)*(parseFloat(v)/100))}}this.originPoint[y]=v}),m&&bi.postRender(()=>m(h,f)),qj(this.visualElement,"transform");const{animationState:_}=this.visualElement;_&&_.setActive("whileDrag",!0)},o=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f;const{dragPropagation:p,dragDirectionLock:g,onDirectionLock:m,onDrag:_}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:y}=f;if(g&&this.currentDirection===null){this.currentDirection=Rgt(y),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),_&&_(h,f)},l=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f,this.stop(h,f),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>_d(h=>this.getAnimationState(h)==="paused"&&this.getAxisMotionValue(h).animation?.play()),{dragSnapToOrigin:d}=this.getProps();this.panSession=new T5e(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:l,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:n,contextWindow:S5e(this.visualElement),element:this.visualElement.current})}stop(e,r){const n=e||this.latestPointerEvent,a=r||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!a||!n)return;const{velocity:s}=a;this.startAnimation(s);const{onDragEnd:o}=this.getProps();o&&bi.postRender(()=>o(n,a))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:a}=this.getProps();if(!n||!wD(e,a,this.currentDirection))return;const i=this.getAxisMotionValue(e);let s=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(s=bgt(s,this.constraints[e],this.elastic[e])),i.set(s)}resolveConstraints(){const{dragConstraints:e,dragElastic:r}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,a=this.constraints;e&&t2(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&n?this.constraints=Egt(n.layoutBox,e):this.constraints=!1,this.elastic=wgt(r),a!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&_d(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=xgt(n.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!t2(e))return!1;const n=e.current;Wg(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const i=Npt(n,a.root,this.visualElement.getTransformPagePoint());let s=Sgt(a.layout.layoutBox,i);if(r){const o=r(Cpt(s));this.hasMutatedConstraints=!!o,o&&(s=o5e(o))}return s}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:a,dragTransition:i,dragSnapToOrigin:s,onDragTransitionEnd:o}=this.getProps(),l=this.constraints||{},u=_d(d=>{if(!wD(d,r,this.currentDirection))return;let h=l&&l[d]||{};s&&(h={min:0,max:0});const f=a?200:1e6,p=a?40:1e7,g={type:"inertia",velocity:n?e[d]:0,bounceStiffness:f,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(o)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return qj(this.visualElement,e),n.start(Cre(e,n,0,r,this.visualElement,!1))}stopAnimation(){_d(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){_d(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),a=n[r];return a||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){_d(r=>{const{drag:n}=this.getProps();if(!wD(r,n,this.currentDirection))return;const{projection:a}=this.visualElement,i=this.getAxisMotionValue(r);if(a&&a.layout){const{min:s,max:o}=a.layout.layoutBox[r],l=i.get()||0;i.set(e[r]-Yi(s,o,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!t2(r)||!n||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};_d(s=>{const o=this.getAxisMotionValue(s);if(o&&this.constraints!==!1){const l=o.get();a[s]=Tgt({min:l,max:l},this.constraints[s])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),_d(s=>{if(!wD(s,e,null))return;const o=this.getAxisMotionValue(s),{min:l,max:u}=this.constraints[s];o.set(Yi(l,u,a[s]))})}addListeners(){if(!this.visualElement.current)return;Cgt.set(this.visualElement,this);const e=this.visualElement.current,r=xR(e,"pointerdown",l=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&!Y4e(l.target)&&this.start(l)}),n=()=>{const{dragConstraints:l}=this.getProps();t2(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:a}=this.visualElement,i=a.addEventListener("measure",n);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),bi.read(n);const s=mN(window,"resize",()=>this.scalePositionWithinConstraints()),o=a.addEventListener("didUpdate",(({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(_d(d=>{const h=this.getAxisMotionValue(d);h&&(this.originPoint[d]+=l[d].translate,h.set(h.get()+l[d].translate))}),this.visualElement.render())}));return()=>{s(),r(),i(),o&&o()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:a=!1,dragConstraints:i=!1,dragElastic:s=jj,dragMomentum:o=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:a,dragConstraints:i,dragElastic:s,dragMomentum:o}}}function wD(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function Rgt(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class Ngt extends C0{constructor(e){super(e),this.removeGroupControls=Vd,this.removeListeners=Vd,this.controls=new Agt(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Vd}update(){const{dragControls:e}=this.node.getProps(),{dragControls:r}=this.node.prevProps||{};e!==r&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners()}}const Tve=t=>(e,r)=>{t&&bi.postRender(()=>t(e,r))};class Igt extends C0{constructor(){super(...arguments),this.removePointerDownListener=Vd}onPointerDown(e){this.session=new T5e(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:S5e(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:a}=this.node.getProps();return{onSessionStart:Tve(e),onStart:Tve(r),onMove:n,onEnd:(i,s)=>{delete this.session,a&&bi.postRender(()=>a(i,s))}}}mount(){this.removePointerDownListener=xR(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const SP={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let yU=!1;class kgt extends Me.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:a}=this.props,{projection:i}=e;i&&(r.group&&r.group.add(i),n&&n.register&&a&&n.register(i),yU&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),SP.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:a,isPresent:i}=this.props,{projection:s}=n;return s&&(s.isPresent=i,yU=!0,a||e.layoutDependency!==r||r===void 0||e.isPresent!==i?s.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?s.promote():s.relegate()||bi.postRender(()=>{const o=s.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),mre.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:a}=e;yU=!0,a&&(a.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(a),n&&n.deregister&&n.deregister(a))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function w5e(t){const[e,r]=Wft(),n=Me.useContext(t4e);return rr.jsx(kgt,{...t,layoutGroup:n,switchLayoutGroup:Me.useContext(i5e),isPresent:e,safeToRemove:r})}function Ogt(t,e,r){const n=Tl(t)?t:ix(t);return n.start(Cre("",n,e,r)),n.animation}const Dgt=(t,e)=>t.depth-e.depth;class Lgt{constructor(){this.children=[],this.isDirty=!1}add(e){Qte(this.children,e),this.isDirty=!0}remove(e){Jte(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Dgt),this.isDirty=!1,this.children.forEach(e)}}function Mgt(t,e){const r=ec.now(),n=({timestamp:a})=>{const i=a-r;i>=e&&(Yv(n),t(i-e))};return bi.setup(n,!0),()=>Yv(n)}const C5e=["TopLeft","TopRight","BottomLeft","BottomRight"],Pgt=C5e.length,xve=t=>typeof t=="string"?parseFloat(t):t,wve=t=>typeof t=="number"||yr.test(t);function Bgt(t,e,r,n,a,i){a?(t.opacity=Yi(0,r.opacity??1,Fgt(n)),t.opacityExit=Yi(e.opacity??1,0,Ugt(n))):i&&(t.opacity=Yi(e.opacity??1,r.opacity??1,n));for(let s=0;s<Pgt;s++){const o=`border${C5e[s]}Radius`;let l=Cve(e,o),u=Cve(r,o);if(l===void 0&&u===void 0)continue;l||(l=0),u||(u=0),l===0||u===0||wve(l)===wve(u)?(t[o]=Math.max(Yi(xve(l),xve(u),n),0),(ap.test(u)||ap.test(l))&&(t[o]+="%")):t[o]=u}(e.rotate||r.rotate)&&(t.rotate=Yi(e.rotate||0,r.rotate||0,n))}function Cve(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Fgt=A5e(0,.5,h4e),Ugt=A5e(.5,.95,Vd);function A5e(t,e,r){return n=>n<t?0:n>e?1:r(hN(t,e,n))}function Ave(t,e){t.min=e.min,t.max=e.max}function hh(t,e){Ave(t.x,e.x),Ave(t.y,e.y)}function Rve(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Nve(t,e,r,n,a){return t-=e,t=f4(t,1/r,n),a!==void 0&&(t=f4(t,1/a,n)),t}function $gt(t,e=0,r=1,n=.5,a,i=t,s=t){if(ap.test(e)&&(e=parseFloat(e),e=Yi(s.min,s.max,e/100)-s.min),typeof e!="number")return;let o=Yi(i.min,i.max,n);t===i&&(o-=e),t.min=Nve(t.min,e,r,o,a),t.max=Nve(t.max,e,r,o,a)}function Ive(t,e,[r,n,a],i,s){$gt(t,e[r],e[n],e[a],e.scale,i,s)}const Ggt=["x","scaleX","originX"],zgt=["y","scaleY","originY"];function kve(t,e,r,n){Ive(t.x,e,Ggt,r?r.x:void 0,n?n.x:void 0),Ive(t.y,e,zgt,r?r.y:void 0,n?n.y:void 0)}function Ove(t){return t.translate===0&&t.scale===1}function R5e(t){return Ove(t.x)&&Ove(t.y)}function Dve(t,e){return t.min===e.min&&t.max===e.max}function Vgt(t,e){return Dve(t.x,e.x)&&Dve(t.y,e.y)}function Lve(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function N5e(t,e){return Lve(t.x,e.x)&&Lve(t.y,e.y)}function Mve(t){return tc(t.x)/tc(t.y)}function Pve(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Hgt{constructor(){this.members=[]}add(e){Qte(this.members,e),e.scheduleRender()}remove(e){if(Jte(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(a=>e===a);if(r===0)return!1;let n;for(let a=r;a>=0;a--){const i=this.members[a];if(i.isPresent!==!1){n=i;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:a}=e.options;a===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function Ygt(t,e,r){let n="";const a=t.x.translate/e.x,i=t.y.translate/e.y,s=r?.z||0;if((a||i||s)&&(n=`translate3d(${a}px, ${i}px, ${s}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:u,rotate:d,rotateX:h,rotateY:f,skewX:p,skewY:g}=r;u&&(n=`perspective(${u}px) ${n}`),d&&(n+=`rotate(${d}deg) `),h&&(n+=`rotateX(${h}deg) `),f&&(n+=`rotateY(${f}deg) `),p&&(n+=`skewX(${p}deg) `),g&&(n+=`skewY(${g}deg) `)}const o=t.x.scale*e.x,l=t.y.scale*e.y;return(o!==1||l!==1)&&(n+=`scale(${o}, ${l})`),n||"none"}const _U=["","X","Y","Z"],Wgt=1e3;let qgt=0;function bU(t,e,r,n){const{latestValues:a}=e;a[t]&&(r[t]=a[t],e.setStaticValue(t,0),n&&(n[t]=0))}function I5e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=g5e(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:a,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",bi,!(a||i))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&I5e(n)}function k5e({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:a}){return class{constructor(s={},o=e?.()){this.id=qgt++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Kgt),this.nodes.forEach(emt),this.nodes.forEach(tmt),this.nodes.forEach(Zgt)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=s,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new Lgt)}addEventListener(s,o){return this.eventHandlers.has(s)||this.eventHandlers.set(s,new tre),this.eventHandlers.get(s).add(o)}notifyListeners(s,...o){const l=this.eventHandlers.get(s);l&&l.notify(...o)}hasListeners(s){return this.eventHandlers.has(s)}mount(s){if(this.instance)return;this.isSVG=W4e(s)&&!Vft(s),this.instance=s;const{layoutId:o,layout:l,visualElement:u}=this.options;if(u&&!u.current&&u.mount(s),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||o)&&(this.isLayoutDirty=!0),t){let d,h=0;const f=()=>this.root.updateBlockedByResize=!1;bi.read(()=>{h=window.innerWidth}),t(s,()=>{const p=window.innerWidth;p!==h&&(h=p,this.root.updateBlockedByResize=!0,d&&d(),d=Mgt(f,250),SP.hasAnimatedSinceResize&&(SP.hasAnimatedSinceResize=!1,this.nodes.forEach(Uve)))})}o&&this.root.registerSharedNode(o,this),this.options.animate!==!1&&u&&(o||l)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:h,hasRelativeLayoutChanged:f,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||u.getDefaultTransition()||smt,{onLayoutAnimationStart:m,onLayoutAnimationComplete:_}=u.getProps(),y=!this.targetLayout||!N5e(this.targetLayout,p),v=!h&&f;if(this.options.layoutRoot||this.resumeFrom||v||h&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const b={...pre(g,"layout"),onPlay:m,onComplete:_};(u.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b),this.setAnimationOrigin(d,v)}else h||Uve(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const s=this.getStack();s&&s.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Yv(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(rmt),this.animationId++)}getTransformTemplate(){const{visualElement:s}=this.options;return s&&s.getProps().transformTemplate}willUpdate(s=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&I5e(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const h=this.path[d];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:o,layout:l}=this.options;if(o===void 0&&!l)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),s&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Bve);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Fve);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Jgt),this.nodes.forEach(Xgt),this.nodes.forEach(jgt)):this.nodes.forEach(Fve),this.clearAllSnapshots();const o=ec.now();Ho.delta=cp(0,1e3/60,o-Ho.timestamp),Ho.timestamp=o,Ho.isProcessing=!0,oU.update.process(Ho),oU.preRender.process(Ho),oU.render.process(Ho),Ho.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,mre.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Qgt),this.sharedNodes.forEach(nmt)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,bi.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){bi.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!tc(this.snapshot.measuredBox.x)&&!tc(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const s=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=js(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:o}=this.options;o&&o.notify("LayoutMeasure",this.layout.layoutBox,s?s.layoutBox:void 0)}updateScroll(s="measure"){let o=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===s&&(o=!1),o&&this.instance){const l=n(this.instance);this.scroll={animationId:this.root.animationId,phase:s,isRoot:l,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!a)return;const s=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,o=this.projectionDelta&&!R5e(this.projectionDelta),l=this.getTransformTemplate(),u=l?l(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;s&&this.instance&&(o||Xy(this.latestValues)||d)&&(a(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(s=!0){const o=this.measurePageBox();let l=this.removeElementScroll(o);return s&&(l=this.removeTransform(l)),omt(l),{animationId:this.root.animationId,measuredBox:o,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:s}=this.options;if(!s)return js();const o=s.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(lmt))){const{scroll:u}=this.root;u&&(iS(o.x,u.offset.x),iS(o.y,u.offset.y))}return o}removeElementScroll(s){const o=js();if(hh(o,s),this.scroll?.wasRoot)return o;for(let l=0;l<this.path.length;l++){const u=this.path[l],{scroll:d,options:h}=u;u!==this.root&&d&&h.layoutScroll&&(d.wasRoot&&hh(o,s),iS(o.x,d.offset.x),iS(o.y,d.offset.y))}return o}applyTransform(s,o=!1){const l=js();hh(l,s);for(let u=0;u<this.path.length;u++){const d=this.path[u];!o&&d.options.layoutScroll&&d.scroll&&d!==d.root&&sS(l,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Xy(d.latestValues)&&sS(l,d.latestValues)}return Xy(this.latestValues)&&sS(l,this.latestValues),l}removeTransform(s){const o=js();hh(o,s);for(let l=0;l<this.path.length;l++){const u=this.path[l];if(!u.instance||!Xy(u.latestValues))continue;Vj(u.latestValues)&&u.updateSnapshot();const d=js(),h=u.measurePageBox();hh(d,h),kve(o,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return Xy(this.latestValues)&&kve(o,this.latestValues),o}setTargetDelta(s){this.targetDelta=s,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(s){this.options={...this.options,...s,crossfade:s.crossfade!==void 0?s.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ho.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(s=!1){const o=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=o.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=o.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=o.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==o;if(!(s||l&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:h}=this.options;if(!this.layout||!(d||h))return;this.resolvedRelativeTargetAt=Ho.timestamp;const f=this.getClosestProjectingParent();f&&this.linkedParentVersion!==f.layoutVersion&&!f.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=js(),this.targetWithTransforms=js()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),mgt(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):hh(this.target,this.layout.layoutBox),c5e(this.target,this.targetDelta)):hh(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Vj(this.parent.latestValues)||l5e(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(s,o,l){this.relativeParent=s,this.linkedParentVersion=s.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=js(),this.relativeTargetOrigin=js(),p4(this.relativeTargetOrigin,o,l),hh(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const s=this.getLead(),o=!!this.resumingFrom||this!==s;let l=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(l=!1),o&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===Ho.timestamp&&(l=!1),l)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;hh(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,f=this.treeScale.y;Rpt(this.layoutCorrected,this.treeScale,this.path,o),s.layout&&!s.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(s.target=s.layout.layoutBox,s.targetWithTransforms=js());const{target:p}=s;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Rve(this.prevProjectionDelta.x,this.projectionDelta.x),Rve(this.prevProjectionDelta.y,this.projectionDelta.y)),wR(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==f||!Pve(this.projectionDelta.x,this.prevProjectionDelta.x)||!Pve(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(s=!0){if(this.options.visualElement?.scheduleRender(),s){const o=this.getStack();o&&o.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=oS(),this.projectionDelta=oS(),this.projectionDeltaWithTransform=oS()}setAnimationOrigin(s,o=!1){const l=this.snapshot,u=l?l.latestValues:{},d={...this.latestValues},h=oS();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!o;const f=js(),p=l?l.source:void 0,g=this.layout?this.layout.source:void 0,m=p!==g,_=this.getStack(),y=!_||_.members.length<=1,v=!!(m&&!y&&this.options.crossfade===!0&&!this.path.some(imt));this.animationProgress=0;let b;this.mixTargetDelta=E=>{const S=E/1e3;$ve(h.x,s.x,S),$ve(h.y,s.y,S),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(p4(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),amt(this.relativeTarget,this.relativeTargetOrigin,f,S),b&&Vgt(this.relativeTarget,b)&&(this.isProjectionDirty=!1),b||(b=js()),hh(b,this.relativeTarget)),m&&(this.animationValues=d,Bgt(d,u,this.latestValues,S,v,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(s){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Yv(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=bi.update(()=>{SP.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ix(0)),this.currentAnimation=Ogt(this.motionValue,[0,1e3],{...s,velocity:0,isSync:!0,onUpdate:o=>{this.mixTargetDelta(o),s.onUpdate&&s.onUpdate(o)},onStop:()=>{},onComplete:()=>{s.onComplete&&s.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const s=this.getStack();s&&s.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Wgt),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const s=this.getLead();let{targetWithTransforms:o,target:l,layout:u,latestValues:d}=s;if(!(!o||!l||!u)){if(this!==s&&this.layout&&u&&O5e(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||js();const h=tc(this.layout.layoutBox.x);l.x.min=s.target.x.min,l.x.max=l.x.min+h;const f=tc(this.layout.layoutBox.y);l.y.min=s.target.y.min,l.y.max=l.y.min+f}hh(o,l),sS(o,d),wR(this.projectionDeltaWithTransform,this.layoutCorrected,o,d)}}registerSharedNode(s,o){this.sharedNodes.has(s)||this.sharedNodes.set(s,new Hgt),this.sharedNodes.get(s).add(o);const u=o.options.initialPromotionConfig;o.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(o):void 0})}isLead(){const s=this.getStack();return s?s.lead===this:!0}getLead(){const{layoutId:s}=this.options;return s?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:s}=this.options;return s?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:s}=this.options;if(s)return this.root.sharedNodes.get(s)}promote({needsReset:s,transition:o,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),s&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const s=this.getStack();return s?s.relegate(this):!1}resetSkewAndRotation(){const{visualElement:s}=this.options;if(!s)return;let o=!1;const{latestValues:l}=s;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(o=!0),!o)return;const u={};l.z&&bU("z",s,u,this.animationValues);for(let d=0;d<_U.length;d++)bU(`rotate${_U[d]}`,s,u,this.animationValues),bU(`skew${_U[d]}`,s,u,this.animationValues);s.render();for(const d in u)s.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);s.scheduleRender()}applyProjectionStyles(s,o){if(!this.instance||this.isSVG)return;if(!this.isVisible){s.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,s.visibility="",s.opacity="",s.pointerEvents=EP(o?.pointerEvents)||"",s.transform=l?l(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(s.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,s.pointerEvents=EP(o?.pointerEvents)||""),this.hasProjected&&!Xy(this.latestValues)&&(s.transform=l?l({},""):"none",this.hasProjected=!1);return}s.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let h=Ygt(this.projectionDeltaWithTransform,this.treeScale,d);l&&(h=l(d,h)),s.transform=h;const{x:f,y:p}=this.projectionDelta;s.transformOrigin=`${f.origin*100}% ${p.origin*100}% 0`,u.animationValues?s.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:s.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const g in zj){if(d[g]===void 0)continue;const{correct:m,applyTo:_,isCSSVariable:y}=zj[g],v=h==="none"?d[g]:m(d[g],u);if(_){const b=_.length;for(let E=0;E<b;E++)s[_[E]]=v}else y?this.options.visualElement.renderState.vars[g]=v:s[g]=v}this.options.layoutId&&(s.pointerEvents=u===this?EP(o?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(s=>s.currentAnimation?.stop()),this.root.nodes.forEach(Bve),this.root.sharedNodes.clear()}}}function Xgt(t){t.updateLayout()}function jgt(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:n}=t.layout,{animationType:a}=t.options,i=e.source!==t.layout.source;a==="size"?_d(d=>{const h=i?e.measuredBox[d]:e.layoutBox[d],f=tc(h);h.min=r[d].min,h.max=h.min+f}):O5e(a,e.layoutBox,r)&&_d(d=>{const h=i?e.measuredBox[d]:e.layoutBox[d],f=tc(r[d]);h.max=h.min+f,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[d].max=t.relativeTarget[d].min+f)});const s=oS();wR(s,r,e.layoutBox);const o=oS();i?wR(o,t.applyTransform(n,!0),e.measuredBox):wR(o,r,e.layoutBox);const l=!R5e(s);let u=!1;if(!t.resumeFrom){const d=t.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:h,layout:f}=d;if(h&&f){const p=js();p4(p,e.layoutBox,h.layoutBox);const g=js();p4(g,r,f.layoutBox),N5e(p,g)||(u=!0),d.options.layoutRoot&&(t.relativeTarget=g,t.relativeTargetOrigin=p,t.relativeParent=d)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:e,delta:o,layoutDelta:s,hasLayoutChanged:l,hasRelativeLayoutChanged:u})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function Kgt(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Zgt(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Qgt(t){t.clearSnapshot()}function Bve(t){t.clearMeasurements()}function Fve(t){t.isLayoutDirty=!1}function Jgt(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Uve(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function emt(t){t.resolveTargetDelta()}function tmt(t){t.calcProjection()}function rmt(t){t.resetSkewAndRotation()}function nmt(t){t.removeLeadSnapshot()}function $ve(t,e,r){t.translate=Yi(e.translate,0,r),t.scale=Yi(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function Gve(t,e,r,n){t.min=Yi(e.min,r.min,n),t.max=Yi(e.max,r.max,n)}function amt(t,e,r,n){Gve(t.x,e.x,r.x,n),Gve(t.y,e.y,r.y,n)}function imt(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const smt={duration:.45,ease:[.4,0,.1,1]},zve=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Vve=zve("applewebkit/")&&!zve("chrome/")?Math.round:Vd;function Hve(t){t.min=Vve(t.min),t.max=Vve(t.max)}function omt(t){Hve(t.x),Hve(t.y)}function O5e(t,e,r){return t==="position"||t==="preserve-aspect"&&!ggt(Mve(e),Mve(r),.2)}function lmt(t){return t!==t.root&&t.scroll?.wasRoot}const cmt=k5e({attachResizeListener:(t,e)=>mN(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),EU={current:void 0},D5e=k5e({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!EU.current){const t=new cmt({});t.mount(window),t.setOptions({layoutScroll:!0}),EU.current=t}return EU.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),umt={pan:{Feature:Igt},drag:{Feature:Ngt,ProjectionNode:D5e,MeasureLayout:w5e}};function Yve(t,e,r){const{props:n}=t;t.animationState&&n.whileHover&&t.animationState.setActive("whileHover",r==="Start");const a="onHover"+r,i=n[a];i&&bi.postRender(()=>i(e,QI(e)))}class dmt extends C0{mount(){const{current:e}=this.node;e&&(this.unmount=Uft(e,(r,n)=>(Yve(this.node,n,"Start"),a=>Yve(this.node,a,"End"))))}unmount(){}}class hmt extends C0{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=jI(mN(this.node.current,"focus",()=>this.onFocus()),mN(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Wve(t,e,r){const{props:n}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&n.whileTap&&t.animationState.setActive("whileTap",r==="Start");const a="onTap"+(r==="End"?"":r),i=n[a];i&&bi.postRender(()=>i(e,QI(e)))}class fmt extends C0{mount(){const{current:e}=this.node;e&&(this.unmount=zft(e,(r,n)=>(Wve(this.node,n,"Start"),(a,{success:i})=>Wve(this.node,a,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Kj=new WeakMap,SU=new WeakMap,pmt=t=>{const e=Kj.get(t.target);e&&e(t)},gmt=t=>{t.forEach(pmt)};function mmt({root:t,...e}){const r=t||document;SU.has(r)||SU.set(r,{});const n=SU.get(r),a=JSON.stringify(e);return n[a]||(n[a]=new IntersectionObserver(gmt,{root:t,...e})),n[a]}function vmt(t,e,r){const n=mmt(e);return Kj.set(t,r),n.observe(t),()=>{Kj.delete(t),n.unobserve(t)}}const ymt={some:0,all:1};class _mt extends C0{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:a="some",once:i}=e,s={root:r?r.current:void 0,rootMargin:n,threshold:typeof a=="number"?a:ymt[a]},o=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:h}=this.node.getProps(),f=u?d:h;f&&f(l)};return vmt(this.node.current,s,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(bmt(e,r))&&this.startObserver()}unmount(){}}function bmt({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const Emt={inView:{Feature:_mt},tap:{Feature:fmt},focus:{Feature:hmt},hover:{Feature:dmt}},Smt={layout:{ProjectionNode:D5e,MeasureLayout:w5e}},Tmt={...cgt,...Emt,...umt,...Smt},L5e=wpt(Tmt,Fpt);function M5e(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e<a;e++)t[e]&&(r=M5e(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function $a(){for(var t,e,r=0,n="",a=arguments.length;r<a;r++)(t=arguments[r])&&(e=M5e(t))&&(n&&(n+=" "),n+=e);return n}function Are(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Wb=Are();function P5e(t){Wb=t}var CR={exec:()=>null};function Ga(t,e=""){let r=typeof t=="string"?t:t.source;const n={replace:(a,i)=>{let s=typeof i=="string"?i:i.source;return s=s.replace(rc.caret,"$1"),r=r.replace(a,s),n},getRegex:()=>new RegExp(r,e)};return n}var rc={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},xmt=/^(?:[ \t]*(?:\n|$))+/,wmt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Cmt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,JI=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Amt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Rre=/(?:[*+-]|\d{1,9}[.)])/,B5e=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,F5e=Ga(B5e).replace(/bull/g,Rre).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Rmt=Ga(B5e).replace(/bull/g,Rre).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Nre=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Nmt=/^[^\n]+/,Ire=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Imt=Ga(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ire).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),kmt=Ga(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Rre).getRegex(),PB="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",kre=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Omt=Ga("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",kre).replace("tag",PB).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),U5e=Ga(Nre).replace("hr",JI).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",PB).getRegex(),Dmt=Ga(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",U5e).getRegex(),Ore={blockquote:Dmt,code:wmt,def:Imt,fences:Cmt,heading:Amt,hr:JI,html:Omt,lheading:F5e,list:kmt,newline:xmt,paragraph:U5e,table:CR,text:Nmt},qve=Ga("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",JI).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",PB).getRegex(),Lmt={...Ore,lheading:Rmt,table:qve,paragraph:Ga(Nre).replace("hr",JI).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",qve).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",PB).getRegex()},Mmt={...Ore,html:Ga(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",kre).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:CR,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ga(Nre).replace("hr",JI).replace("heading",` *#{1,6} *[^
3
3
  ]`).replace("lheading",F5e).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Pmt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Bmt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,$5e=/^( {2,}|\\)\n(?!\s*$)/,Fmt=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,BB=/[\p{P}\p{S}]/u,Dre=/[\s\p{P}\p{S}]/u,G5e=/[^\s\p{P}\p{S}]/u,Umt=Ga(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Dre).getRegex(),z5e=/(?!~)[\p{P}\p{S}]/u,$mt=/(?!~)[\s\p{P}\p{S}]/u,Gmt=/(?:[^\s\p{P}\p{S}]|~)/u,zmt=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,V5e=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Vmt=Ga(V5e,"u").replace(/punct/g,BB).getRegex(),Hmt=Ga(V5e,"u").replace(/punct/g,z5e).getRegex(),H5e="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ymt=Ga(H5e,"gu").replace(/notPunctSpace/g,G5e).replace(/punctSpace/g,Dre).replace(/punct/g,BB).getRegex(),Wmt=Ga(H5e,"gu").replace(/notPunctSpace/g,Gmt).replace(/punctSpace/g,$mt).replace(/punct/g,z5e).getRegex(),qmt=Ga("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,G5e).replace(/punctSpace/g,Dre).replace(/punct/g,BB).getRegex(),Xmt=Ga(/\\(punct)/,"gu").replace(/punct/g,BB).getRegex(),jmt=Ga(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Kmt=Ga(kre).replace("(?:-->|$)","-->").getRegex(),Zmt=Ga("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Kmt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),g4=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Qmt=Ga(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",g4).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Y5e=Ga(/^!?\[(label)\]\[(ref)\]/).replace("label",g4).replace("ref",Ire).getRegex(),W5e=Ga(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ire).getRegex(),Jmt=Ga("reflink|nolink(?!\\()","g").replace("reflink",Y5e).replace("nolink",W5e).getRegex(),Lre={_backpedal:CR,anyPunctuation:Xmt,autolink:jmt,blockSkip:zmt,br:$5e,code:Bmt,del:CR,emStrongLDelim:Vmt,emStrongRDelimAst:Ymt,emStrongRDelimUnd:qmt,escape:Pmt,link:Qmt,nolink:W5e,punctuation:Umt,reflink:Y5e,reflinkSearch:Jmt,tag:Zmt,text:Fmt,url:CR},evt={...Lre,link:Ga(/^!?\[(label)\]\((.*?)\)/).replace("label",g4).getRegex(),reflink:Ga(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",g4).getRegex()},Zj={...Lre,emStrongRDelimAst:Wmt,emStrongLDelim:Hmt,url:Ga(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},tvt={...Zj,br:Ga($5e).replace("{2,}","*").getRegex(),text:Ga(Zj.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},CD={normal:Ore,gfm:Lmt,pedantic:Mmt},EC={normal:Lre,gfm:Zj,breaks:tvt,pedantic:evt},rvt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Xve=t=>rvt[t];function Rf(t,e){if(e){if(rc.escapeTest.test(t))return t.replace(rc.escapeReplace,Xve)}else if(rc.escapeTestNoEncode.test(t))return t.replace(rc.escapeReplaceNoEncode,Xve);return t}function jve(t){try{t=encodeURI(t).replace(rc.percentDecode,"%")}catch{return null}return t}function Kve(t,e){const r=t.replace(rc.findPipe,(i,s,o)=>{let l=!1,u=s;for(;--u>=0&&o[u]==="\\";)l=!l;return l?"|":" |"}),n=r.split(rc.splitPipe);let a=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;a<n.length;a++)n[a]=n[a].trim().replace(rc.slashPipe,"|");return n}function SC(t,e,r){const n=t.length;if(n===0)return"";let a=0;for(;a<n&&t.charAt(n-a-1)===e;)a++;return t.slice(0,n-a)}function nvt(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])r++;else if(t[n]===e[1]&&(r--,r<0))return n;return r>0?-2:-1}function Zve(t,e,r,n,a){const i=e.href,s=e.title||null,o=t[1].replace(a.other.outputLinkReplace,"$1");n.state.inLink=!0;const l={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:i,title:s,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=!1,l}function avt(t,e,r){const n=t.match(r.other.indentCodeCompensation);if(n===null)return e;const a=n[1];return e.split(`
4
4
  `).map(i=>{const s=i.match(r.other.beginningSpace);if(s===null)return i;const[o]=s;return o.length>=a.length?i.slice(a.length):i}).join(`
@@ -448,7 +448,7 @@ ${t.themeCSS}`),t.fontFamily!==void 0&&(r+=`
448
448
  :root { --mermaid-font-family: ${t.fontFamily}}`),t.altFontFamily!==void 0&&(r+=`
449
449
  :root { --mermaid-alt-font-family: ${t.altFontFamily}}`),e instanceof Map){const s=t.htmlLabels??t.flowchart?.htmlLabels?["> *","span"]:["rect","polygon","ellipse","circle","path"];e.forEach(o=>{FN(o.styles)||s.forEach(l=>{r+=iTe(o.id,l,o.styles)}),FN(o.textStyles)||(r+=iTe(o.id,"tspan",(o?.textStyles||[]).map(l=>l.replace("color","fill"))))})}return r},"createCssStyles"),E5t=O((t,e,r,n)=>{const a=b5t(t,r),i=swt(e,a,t.themeVariables);return cx(uK(`${n}{${i}}`),dK)},"createUserStyles"),S5t=O((t="",e,r)=>{let n=t;return!r&&!e&&(n=n.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),n=hp(n),n=n.replace(/<br>/g,"<br/>"),n},"cleanUpSvgCode"),T5t=O((t="",e)=>{const r=e?.viewBox?.baseVal?.height?e.viewBox.baseVal.height+"px":f5t,n=_Ge(`<body style="${g5t}">${t}</body>`);return`<iframe style="width:${h5t};height:${r};${p5t}" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="${m5t}">
450
450
  ${v5t}
451
- </iframe>`},"putIntoIFrame"),sTe=O((t,e,r,n,a)=>{const i=t.append("div");i.attr("id",r),n&&i.attr("style",n);const s=i.append("svg").attr("id",e).attr("width","100%").attr("xmlns",c5t);return a&&s.attr("xmlns:xlink",a),s.append("g"),t},"appendDivSvgG");function FZ(t,e){return t.append("iframe").attr("id",e).attr("style","width: 100%; height: 100%;").attr("sandbox","")}O(FZ,"sandboxedIframe");var x5t=O((t,e,r,n)=>{t.getElementById(e)?.remove(),t.getElementById(r)?.remove(),t.getElementById(n)?.remove()},"removeExistingElements"),w5t=O(async function(t,e,r){PF();const n=sce(e);e=n.code;const a=va();me.debug(a),e.length>(a?.maxTextSize??i5t)&&(e=s5t);const i="#"+t,s="i"+t,o="#"+s,l="d"+t,u="#"+l,d=O(()=>{const L=Ot(f?o:u).node();L&&"remove"in L&&L.remove()},"removeTempElements");let h=Ot("body");const f=a.securityLevel===o5t,p=a.securityLevel===l5t,g=a.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),f){const k=FZ(Ot(r),s);h=Ot(k.nodes()[0].contentDocument.body),h.node().style.margin=0}else h=Ot(r);sTe(h,t,l,`font-family: ${g}`,u5t)}else{if(x5t(document,t,l,s),f){const k=FZ(Ot("body"),s);h=Ot(k.nodes()[0].contentDocument.body),h.node().style.margin=0}else h=Ot("body");sTe(h,t,l)}let m,_;try{m=await BZ.fromText(e,{title:n.title})}catch(k){if(a.suppressErrorRendering)throw d(),k;m=await BZ.fromText("error"),_=k}const y=h.select(u).node(),v=m.type,b=y.firstChild,E=b.firstChild,S=m.renderer.getClasses?.(e,m),T=E5t(a,v,S,i),x=document.createElement("style");x.innerHTML=T,b.insertBefore(x,E);try{await m.renderer.draw(e,t,BK.version,m)}catch(k){throw a.suppressErrorRendering?d():h4t.draw(e,t,BK.version),k}const w=h.select(`${u} svg`),C=m.db.getAccTitle?.(),R=m.db.getAccDescription?.();TGe(v,w,C,R),h.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",d5t);let N=h.select(u).node().innerHTML;if(me.debug("config.arrowMarkerAbsolute",a.arrowMarkerAbsolute),N=S5t(N,f,Wa(a.arrowMarkerAbsolute)),f){const k=h.select(u+" svg").node();N=T5t(N,k)}else p||(N=ib.sanitize(N,{ADD_TAGS:y5t,ADD_ATTR:_5t,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(e5t(),_)throw _;return d(),{diagramType:v,svg:N,bindFunctions:m.db.bindFunctions}},"render");function EGe(t={}){const e=vs({},t);e?.fontFamily&&!e.themeVariables?.fontFamily&&(e.themeVariables||(e.themeVariables={}),e.themeVariables.fontFamily=e.fontFamily),Uxt(e),e?.theme&&e.theme in Lg?e.themeVariables=Lg[e.theme].getThemeVariables(e.themeVariables):e&&(e.themeVariables=Lg.default.getThemeVariables(e.themeVariables));const r=typeof e=="object"?Fxt(e):XBe();tle(r.logLevel),PF()}O(EGe,"initialize");var SGe=O((t,e={})=>{const{code:r}=ice(t);return BZ.fromText(r,e)},"getDiagramFromText");function TGe(t,e,r,n){mGe(e,t),vGe(e,r,n,e.attr("id"))}O(TGe,"addA11yInfo");var vb=Object.freeze({render:w5t,parse:bGe,getDiagramFromText:SGe,initialize:EGe,getConfig:va,setConfig:jBe,getSiteConfig:XBe,updateSiteConfig:$xt,reset:O(()=>{T4()},"reset"),globalReset:O(()=>{T4(dx)},"globalReset"),defaultConfig:dx});tle(va().logLevel);T4(va());var C5t=O((t,e,r)=>{me.warn(t),zle(t)?(r&&r(t.str,t.hash),e.push({...t,message:t.str,error:t})):(r&&r(t),t instanceof Error&&e.push({str:t.message,message:t.message,hash:t.name,error:t}))},"handleError"),xGe=O(async function(t={querySelector:".mermaid"}){try{await A5t(t)}catch(e){if(zle(e)&&me.error(e.str),Qg.parseError&&Qg.parseError(e),!t.suppressErrors)throw me.error("Use the suppressErrors option to suppress these errors"),e}},"run"),A5t=O(async function({postRenderCallback:t,querySelector:e,nodes:r}={querySelector:".mermaid"}){const n=vb.getConfig();me.debug(`${t?"":"No "}Callback function found`);let a;if(r)a=r;else if(e)a=document.querySelectorAll(e);else throw new Error("Nodes and querySelector are both undefined");me.debug(`Found ${a.length} diagrams`),n?.startOnLoad!==void 0&&(me.debug("Start On Load: "+n?.startOnLoad),vb.updateSiteConfig({startOnLoad:n?.startOnLoad}));const i=new Sn.InitIDGenerator(n.deterministicIds,n.deterministicIDSeed);let s;const o=[];for(const l of Array.from(a)){if(me.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");const u=`mermaid-${i.next()}`;s=l.innerHTML,s=H9e(Sn.entityDecode(s)).trim().replace(/<br\s*\/?>/gi,"<br/>");const d=Sn.detectInit(s);d&&me.debug("Detected early reinit: ",d);try{const{svg:h,bindFunctions:f}=await RGe(u,s,l);l.innerHTML=h,t&&await t(u),f&&f(l)}catch(h){C5t(h,o,Qg.parseError)}}if(o.length>0)throw o[0]},"runThrowsErrors"),wGe=O(function(t){vb.initialize(t)},"initialize"),R5t=O(async function(t,e,r){me.warn("mermaid.init is deprecated. Please use run instead."),t&&wGe(t);const n={postRenderCallback:r,querySelector:".mermaid"};typeof e=="string"?n.querySelector=e:e&&(e instanceof HTMLElement?n.nodes=[e]:n.nodes=e),await xGe(n)},"init"),N5t=O(async(t,{lazyLoad:e=!0}={})=>{PF(),FK(...t),e===!1&&await Q4t()},"registerExternalDiagrams"),CGe=O(function(){if(Qg.startOnLoad){const{startOnLoad:t}=vb.getConfig();t&&Qg.run().catch(e=>me.error("Mermaid failed to initialize",e))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",CGe,!1);var I5t=O(function(t){Qg.parseError=t},"setParseErrorHandler"),d5=[],jV=!1,AGe=O(async()=>{if(!jV){for(jV=!0;d5.length>0;){const t=d5.shift();if(t)try{await t()}catch(e){me.error("Error executing queue",e)}}jV=!1}},"executeQueue"),k5t=O(async(t,e)=>new Promise((r,n)=>{const a=O(()=>new Promise((i,s)=>{vb.parse(t,e).then(o=>{i(o),r(o)},o=>{me.error("Error parsing",o),Qg.parseError?.(o),s(o),n(o)})}),"performCall");d5.push(a),AGe().catch(n)}),"parse"),RGe=O((t,e,r)=>new Promise((n,a)=>{const i=O(()=>new Promise((s,o)=>{vb.render(t,e,r).then(l=>{s(l),n(l)},l=>{me.error("Error parsing",l),Qg.parseError?.(l),o(l),a(l)})}),"performCall");d5.push(i),AGe().catch(a)}),"render"),O5t=O(()=>Object.keys(ob).map(t=>({id:t})),"getRegisteredDiagramsMetadata"),Qg={startOnLoad:!0,mermaidAPI:vb,parse:k5t,render:RGe,init:R5t,run:xGe,registerExternalDiagrams:N5t,registerLayoutLoaders:$$e,initialize:wGe,parseError:void 0,contentLoaded:CGe,setParseErrorHandler:I5t,detectType:nle,registerIconPacks:q9e,getRegisteredDiagramsMetadata:O5t},KV=Qg;const D5t=t=>{const{componentCls:e}=t;return{[e]:{[`${e}-header`]:{display:"flex",alignItems:"center",justifyContent:"space-between",background:t.colorBgTitle,color:t.colorTextTitle,padding:t.paddingSM,borderStartStartRadius:t.borderRadius,borderStartEndRadius:t.borderRadius},[`${e}-graph`]:{display:"flex",alignItems:"center",justifyContent:"center",border:`1px solid ${t.colorBgTitle}`,borderTop:"none",padding:t.paddingSM,background:t.colorBgContainer,overflow:"auto",borderEndEndRadius:t.borderRadius,borderEndStartRadius:t.borderRadius,height:"400px"},[`${e}-graph-hidden`]:{display:"none"},[`${e}-graph svg`]:{maxWidth:"100%",maxHeight:"100%",height:"auto",width:"auto"},[`${e}-code`]:{borderEndEndRadius:t.borderRadius,borderEndStartRadius:t.borderRadius,borderBottom:`1px solid ${t.colorBgTitle}`,borderInlineStart:`1px solid ${t.colorBgTitle}`,borderInlineEnd:`1px solid ${t.colorBgTitle}`,background:t.colorBgContainer,paddingInline:t.paddingSM,paddingBlock:t.paddingSM,overflow:"auto",height:"400px","pre,code":{whiteSpace:"pre",fontSize:t.fontSize,fontFamily:t.fontFamilyCode,lineHeight:2,borderRadius:0,border:"none"},"code[class*='language-'],pre[class*='language-']":{background:"none"}},[`&${e}-rtl`]:{direction:"rtl"}}}},L5t=t=>({colorBgTitle:t.colorFillContent,colorBorderCode:t.colorBorderSecondary,colorBorderGraph:t.colorBorderSecondary,colorTextTitle:t.colorText}),M5t=Qre("Mermaid",t=>{const e=ek(t,{});return[D5t(e)]},L5t);var Su=(function(t){return t.Code="code",t.Image="image",t})(Su||{});let P5t=0;const B5t=Me.memo(t=>{const{prefixCls:e,className:r,style:n,classNames:a={},styles:i={},header:s,children:o,highlightProps:l,onRenderTypeChange:u}=t,[d,h]=Me.useState(Su.Image),[f,p]=Me.useState(1),[g,m]=Me.useState({x:0,y:0}),[_,y]=Me.useState(!1),[v,b]=Me.useState({x:0,y:0}),E=Me.useRef(null),S=`mermaid-${P5t++}-${o?.length||0}`;Me.useEffect(()=>{KV.initialize({startOnLoad:!1,securityLevel:"strict",theme:"default",fontFamily:"monospace"})},[]);const[T]=HB("Mermaid",ux.Mermaid),{getPrefixCls:x,direction:w}=Xg(),C=x("mermaid",e),[R,N]=M5t(C),k=qre("mermaid"),L=$a(C,k.className,k.classNames?.root,r,a.root,R,N,{[`${C}-rtl`]:w==="rtl"}),A=pxt(async()=>{if(!(!o||!E.current||d===Su.Code))try{if(!await KV.parse(o,{suppressErrors:!0}))throw new Error("Invalid Mermaid syntax");const X=o.replace(/[`\s]+$/g,""),{svg:ie}=await KV.render(S,X,E.current);E.current.innerHTML=ie}catch(j){Xre(!1,"Mermaid",`Render failed: ${j}`)}},100);Me.useEffect(()=>{d===Su.Code&&E.current?E.current.innerHTML="":A()},[o,d]),Me.useEffect(()=>{const j=E.current;if(!j||d!==Su.Image)return;let X=0;const ie=ne=>{ne.preventDefault(),ne.stopPropagation();const ue=Date.now();if(ue-X<16)return;X=ue;const J=ne.deltaY>0?-.1:.1;p(re=>Math.max(.5,Math.min(3,re+J)))};return j.addEventListener("wheel",ie,{passive:!1}),()=>{j.removeEventListener("wheel",ie)}},[d]),Me.useEffect(()=>{if(E.current&&d===Su.Image){const j=E.current.querySelector("svg");j&&(j.style.transform=`scale(${f}) translate(${g.x}px, ${g.y}px)`,j.style.transformOrigin="center",j.style.transition=_?"none":"transform 0.1s ease-out",j.style.cursor=_?"grabbing":"grab")}},[f,g,d,_]);const D=j=>{d===Su.Image&&(j.preventDefault(),y(!0),b({x:j.clientX,y:j.clientY}))},M=j=>{if(!_||d!==Su.Image)return;j.preventDefault();const X=j.clientX-v.x,ie=j.clientY-v.y;m(ne=>({x:ne.x+X/f,y:ne.y+ie/f})),b({x:j.clientX,y:j.clientY})},B=()=>{y(!1)},F=()=>{p(1),m({x:0,y:0})};if(!o)return null;const U=async()=>{const j=E.current?.querySelector("svg");if(!j)return;const X=new XMLSerializer().serializeToString(j),ie=document.createElement("canvas"),ne=ie.getContext("2d");if(!ne)return;const{width:ue,height:J}=j.getBoundingClientRect(),re=window.devicePixelRatio||1;ie.width=ue*re,ie.height=J*re,ie.style.width=`${ue}px`,ie.style.height=`${J}px`,ne.scale(re,re);const Z=new Image;Z.onload=()=>{ne.drawImage(Z,0,0,ue,J);const ee=document.createElement("a");ee.download=`${Date.now()}.png`,ee.href=ie.toDataURL("image/png",1),ee.click()},Z.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`},V=()=>{p(j=>Math.min(j+.2,3))},$=()=>{p(j=>Math.max(j-.2,.5))},z=()=>{if(s===null)return null;if(s)return s;const j=d===Su.Image?[{key:"zoomIn",icon:Me.createElement(oBe,null),label:T.zoomIn,onItemClick:V},{key:"zoomOut",icon:Me.createElement(lBe,null),label:T.zoomOut,onItemClick:$},{key:"zoomReset",actionRender:()=>Me.createElement(ki.Tooltip,{title:T.zoomReset},Me.createElement(ki.Button,{type:"text",size:"small",onClick:F},T.zoomReset))},{key:"download",icon:Me.createElement(tBe,null),label:T.download,onItemClick:U}]:[{key:"copy",actionRender:()=>Me.createElement(qv.Copy,{text:o})}];return Me.createElement("div",{className:$a(`${C}-header`,k.classNames?.header,a?.header),style:{...k.styles?.header,...i.header}},Me.createElement(ki.Segmented,{options:[{label:T.image,value:Su.Image},{label:T.code,value:Su.Code}],value:d,onChange:X=>{h(X),u?.(X)}}),Me.createElement(qv,{items:j}))},q=()=>Me.createElement(Me.Fragment,null,Me.createElement("div",{className:$a(`${C}-graph`,k.classNames?.graph,d===Su.Code&&`${C}-graph-hidden`,a?.graph),style:{...k.styles?.graph,...i.graph},ref:E,onMouseDown:D,onMouseMove:M,onMouseUp:B,onMouseLeave:B}),d===Su.Code?Me.createElement("div",{className:$a(`${C}-code`,k.classNames?.code,a?.code),style:{...k.styles?.code,...i.code}},Me.createElement(wBe,jd({customStyle:{padding:0,background:"transparent"},language:"mermaid",wrapLines:!0},l),o.replace(/\n$/,""))):null);return Me.createElement("div",{className:L,style:{...n,...k.style,...k.styles?.root,...i.root}},z(),q())});(function(){try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode("*,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.\\[\\&_\\:is\\(h1\\,h2\\,h3\\,h4\\,h5\\,h6\\,ul\\,ol\\,p\\)\\]\\:\\[all\\:revert\\] :is(h1,h2,h3,h4,h5,h6,ul,ol,p){all:revert}.\\[\\&_table\\]\\:w-full\\! table{width:100%!important}.\\[\\&_table\\]\\:table\\! table{display:table!important}.table{display:table}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const{Text:F5t}=ki.Typography,U5t=t=>{const{className:e,children:r}=t,n=e?.match(/language-(\w+)/)?.[1]??"";return typeof r!="string"?null:n==="mermaid"?rr.jsx(B5t,{children:r}):n?rr.jsx(UBe,{lang:n,children:r}):rr.jsx(F5t,{code:!0,children:r})},UZ=t=>typeof t=="string"||typeof t=="number"?String(t):Me.isValidElement(t)?UZ(t.props.children):Array.isArray(t)?t.map(UZ).join(""):"",$5t=t=>{const e=[],r=[],n=Me.Children.toArray(t);for(const a of n){if(!Me.isValidElement(a))continue;const i=a.type;if(i==="thead"){const s=Me.Children.toArray(a.props.children);for(const o of s){if(!Me.isValidElement(o))continue;const l=Me.Children.toArray(o.props.children);let u=0;for(const d of l){if(!Me.isValidElement(d))continue;const h=UZ(d.props.children);e.push({title:h,dataIndex:`col_${u}`,key:`col_${u}`}),u++}}}if(i==="tbody"){const s=Me.Children.toArray(a.props.children);let o=0;for(const l of s){if(!Me.isValidElement(l))continue;const u={key:`row_${o}`},d=Me.Children.toArray(l.props.children);let h=0;for(const f of d)Me.isValidElement(f)&&(u[`col_${h}`]=f.props.children,h++);r.push(u),o++}}}return{columns:e,dataSource:r}},G5t=({children:t})=>{const{columns:e,dataSource:r}=$5t(t);return rr.jsx(ki.Table,{className:"[&_table]:w-full! [&_table]:table!",columns:e,dataSource:r,pagination:!1,size:"small",bordered:!0})},{Link:z5t}=ki.Typography,NGe=t=>{const{url:e,requestHeaders:r,className:n,components:a,...i}=t,[s,o]=Me.useState(i.content),l=Me.useMemo(()=>$re(),[]),u=async d=>{const h=await(await fetch(d,{headers:r})).text();o(h)};return Me.useEffect(()=>{e&&u(e)},[e]),Me.useEffect(()=>{o(i.content)},[i.content]),rr.jsx(o0t,{cache:l,children:rr.jsx(ki.ConfigProvider,{theme:{inherit:!1},children:rr.jsx(s6e,{...i,className:$a("[&_:is(h1,h2,h3,h4,h5,h6,ul,ol,p)]:[all:revert]",n),content:s,components:{code:U5t,a:z5t,table:G5t,...a}})})})},Xl=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),$Z=[.001,0,0,.001,0,0],ZV=1.35,xu={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Vf={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},UN="pdfjs_internal_editor_",wn={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},ta={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},IGe={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Uo={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},BR={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},cs={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},HE={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Ek={ERRORS:0,WARNINGS:1,INFOS:5},xx={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},nL={moveTo:0,lineTo:1,curveTo:2,closePath:3},kGe={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let BF=Ek.WARNINGS;function V5t(t){Number.isInteger(t)&&(BF=t)}function H5t(){return BF}function FF(t){BF>=Ek.INFOS&&console.info(`Info: ${t}`)}function Cn(t){BF>=Ek.WARNINGS&&console.warn(`Warning: ${t}`)}function ti(t){throw new Error(t)}function ca(t,e){t||ti(e)}function Y5t(t){switch(t?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function oce(t,e=null,r=null){if(!t)return null;if(r&&typeof t=="string"&&(r.addDefaultProtocol&&t.startsWith("www.")&&t.match(/\./g)?.length>=2&&(t=`http://${t}`),r.tryConvertEncoding))try{t=K5t(t)}catch{}const n=e?URL.parse(t,e):URL.parse(t);return Y5t(n)?n:null}function lce(t,e,r=!1){const n=URL.parse(t);return n?(n.hash=e,n.href):r&&oce(t,"http://example.com")?t.split("#",1)[0]+`${e?`#${e}`:""}`:""}function Dn(t,e,r,n=!1){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!0,writable:!1}),r}const o1=(function(){function e(r,n){this.message=r,this.name=n}return e.prototype=new Error,e.constructor=e,e})();class oTe extends o1{constructor(e,r){super(e,"PasswordException"),this.code=r}}class QV extends o1{constructor(e,r){super(e,"UnknownErrorException"),this.details=r}}class h5 extends o1{constructor(e){super(e,"InvalidPDFException")}}class $N extends o1{constructor(e,r,n){super(e,"ResponseException"),this.status=r,this.missing=n}}class W5t extends o1{constructor(e){super(e,"FormatError")}}class Jg extends o1{constructor(e){super(e,"AbortException")}}function OGe(t){(typeof t!="object"||t?.length===void 0)&&ti("Invalid argument for bytesToString");const e=t.length,r=8192;if(e<r)return String.fromCharCode.apply(null,t);const n=[];for(let a=0;a<e;a+=r){const i=Math.min(a+r,e),s=t.subarray(a,i);n.push(String.fromCharCode.apply(null,s))}return n.join("")}function Sk(t){typeof t!="string"&&ti("Invalid argument for stringToBytes");const e=t.length,r=new Uint8Array(e);for(let n=0;n<e;++n)r[n]=t.charCodeAt(n)&255;return r}function q5t(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,t&255)}function X5t(){const t=new Uint8Array(4);return t[0]=1,new Uint32Array(t.buffer,0,1)[0]===1}function j5t(){try{return new Function(""),!0}catch{return!1}}class Ao{static get isLittleEndian(){return Dn(this,"isLittleEndian",X5t())}static get isEvalSupported(){return Dn(this,"isEvalSupported",j5t())}static get isOffscreenCanvasSupported(){return Dn(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Dn(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:e,userAgent:r}=navigator;return Dn(this,"platform",{isAndroid:r.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:r.includes("Firefox")})}static get isCSSRoundSupported(){return Dn(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const JV=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));class Er{static makeHexColor(e,r,n){return`#${JV[e]}${JV[r]}${JV[n]}`}static domMatrixToTransform(e){return[e.a,e.b,e.c,e.d,e.e,e.f]}static scaleMinMax(e,r){let n;e[0]?(e[0]<0&&(n=r[0],r[0]=r[2],r[2]=n),r[0]*=e[0],r[2]*=e[0],e[3]<0&&(n=r[1],r[1]=r[3],r[3]=n),r[1]*=e[3],r[3]*=e[3]):(n=r[0],r[0]=r[1],r[1]=n,n=r[2],r[2]=r[3],r[3]=n,e[1]<0&&(n=r[1],r[1]=r[3],r[3]=n),r[1]*=e[1],r[3]*=e[1],e[2]<0&&(n=r[0],r[0]=r[2],r[2]=n),r[0]*=e[2],r[2]*=e[2]),r[0]+=e[4],r[1]+=e[5],r[2]+=e[4],r[3]+=e[5]}static transform(e,r){return[e[0]*r[0]+e[2]*r[1],e[1]*r[0]+e[3]*r[1],e[0]*r[2]+e[2]*r[3],e[1]*r[2]+e[3]*r[3],e[0]*r[4]+e[2]*r[5]+e[4],e[1]*r[4]+e[3]*r[5]+e[5]]}static multiplyByDOMMatrix(e,r){return[e[0]*r.a+e[2]*r.b,e[1]*r.a+e[3]*r.b,e[0]*r.c+e[2]*r.d,e[1]*r.c+e[3]*r.d,e[0]*r.e+e[2]*r.f+e[4],e[1]*r.e+e[3]*r.f+e[5]]}static applyTransform(e,r,n=0){const a=e[n],i=e[n+1];e[n]=a*r[0]+i*r[2]+r[4],e[n+1]=a*r[1]+i*r[3]+r[5]}static applyTransformToBezier(e,r,n=0){const a=r[0],i=r[1],s=r[2],o=r[3],l=r[4],u=r[5];for(let d=0;d<6;d+=2){const h=e[n+d],f=e[n+d+1];e[n+d]=h*a+f*s+l,e[n+d+1]=h*i+f*o+u}}static applyInverseTransform(e,r){const n=e[0],a=e[1],i=r[0]*r[3]-r[1]*r[2];e[0]=(n*r[3]-a*r[2]+r[2]*r[5]-r[4]*r[3])/i,e[1]=(-n*r[1]+a*r[0]+r[4]*r[1]-r[5]*r[0])/i}static axialAlignedBoundingBox(e,r,n){const a=r[0],i=r[1],s=r[2],o=r[3],l=r[4],u=r[5],d=e[0],h=e[1],f=e[2],p=e[3];let g=a*d+l,m=g,_=a*f+l,y=_,v=o*h+u,b=v,E=o*p+u,S=E;if(i!==0||s!==0){const T=i*d,x=i*f,w=s*h,C=s*p;g+=w,y+=w,_+=C,m+=C,v+=T,S+=T,E+=x,b+=x}n[0]=Math.min(n[0],g,_,m,y),n[1]=Math.min(n[1],v,E,b,S),n[2]=Math.max(n[2],g,_,m,y),n[3]=Math.max(n[3],v,E,b,S)}static inverseTransform(e){const r=e[0]*e[3]-e[1]*e[2];return[e[3]/r,-e[1]/r,-e[2]/r,e[0]/r,(e[2]*e[5]-e[4]*e[3])/r,(e[4]*e[1]-e[5]*e[0])/r]}static singularValueDecompose2dScale(e,r){const n=e[0],a=e[1],i=e[2],s=e[3],o=n**2+a**2,l=n*i+a*s,u=i**2+s**2,d=(o+u)/2,h=Math.sqrt(d**2-(o*u-l**2));r[0]=Math.sqrt(d+h||1),r[1]=Math.sqrt(d-h||1)}static normalizeRect(e){const r=e.slice(0);return e[0]>e[2]&&(r[0]=e[2],r[2]=e[0]),e[1]>e[3]&&(r[1]=e[3],r[3]=e[1]),r}static intersect(e,r){const n=Math.max(Math.min(e[0],e[2]),Math.min(r[0],r[2])),a=Math.min(Math.max(e[0],e[2]),Math.max(r[0],r[2]));if(n>a)return null;const i=Math.max(Math.min(e[1],e[3]),Math.min(r[1],r[3])),s=Math.min(Math.max(e[1],e[3]),Math.max(r[1],r[3]));return i>s?null:[n,i,a,s]}static pointBoundingBox(e,r,n){n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],r),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],r)}static rectBoundingBox(e,r,n,a,i){i[0]=Math.min(i[0],e,n),i[1]=Math.min(i[1],r,a),i[2]=Math.max(i[2],e,n),i[3]=Math.max(i[3],r,a)}static#e(e,r,n,a,i,s,o,l,u,d){if(u<=0||u>=1)return;const h=1-u,f=u*u,p=f*u,g=h*(h*(h*e+3*u*r)+3*f*n)+p*a,m=h*(h*(h*i+3*u*s)+3*f*o)+p*l;d[0]=Math.min(d[0],g),d[1]=Math.min(d[1],m),d[2]=Math.max(d[2],g),d[3]=Math.max(d[3],m)}static#t(e,r,n,a,i,s,o,l,u,d,h,f){if(Math.abs(u)<1e-12){Math.abs(d)>=1e-12&&this.#e(e,r,n,a,i,s,o,l,-h/d,f);return}const p=d**2-4*h*u;if(p<0)return;const g=Math.sqrt(p),m=2*u;this.#e(e,r,n,a,i,s,o,l,(-d+g)/m,f),this.#e(e,r,n,a,i,s,o,l,(-d-g)/m,f)}static bezierBoundingBox(e,r,n,a,i,s,o,l,u){u[0]=Math.min(u[0],e,o),u[1]=Math.min(u[1],r,l),u[2]=Math.max(u[2],e,o),u[3]=Math.max(u[3],r,l),this.#t(e,n,i,o,r,a,s,l,3*(-e+3*(n-i)+o),6*(e-2*n+i),3*(n-e),u),this.#t(e,n,i,o,r,a,s,l,3*(-r+3*(a-s)+l),6*(r-2*a+s),3*(a-r),u)}}function K5t(t){return decodeURIComponent(escape(t))}let eH=null,lTe=null;function DGe(t){return eH||(eH=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,lTe=new Map([["ſt","ſt"]])),t.replaceAll(eH,(e,r,n)=>r?r.normalize("NFKC"):lTe.get(n))}function cce(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const t=new Uint8Array(32);return crypto.getRandomValues(t),OGe(t)}const uce="pdfjs_internal_id_";function Z5t(t,e,r){if(!Array.isArray(r)||r.length<2)return!1;const[n,a,...i]=r;if(!t(n)&&!Number.isInteger(n)||!e(a))return!1;const s=i.length;let o=!0;switch(a.name){case"XYZ":if(s<2||s>3)return!1;break;case"Fit":case"FitB":return s===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(s>1)return!1;break;case"FitR":if(s!==4)return!1;o=!1;break;default:return!1}for(const l of i)if(!(typeof l=="number"||o&&l===null))return!1;return!0}function bl(t,e,r){return Math.min(Math.max(t,e),r)}function LGe(t){return Uint8Array.prototype.toBase64?t.toBase64():btoa(OGe(t))}function Q5t(t){return Uint8Array.fromBase64?Uint8Array.fromBase64(t):Sk(atob(t))}typeof Promise.try!="function"&&(Promise.try=function(t,...e){return new Promise(r=>{r(t(...e))})});typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(t){return t.reduce((e,r)=>e+r,0)});class GN{static textContent(e){const r=[],n={items:r,styles:Object.create(null)};function a(i){if(!i)return;let s=null;const o=i.name;if(o==="#text")s=i.value;else if(GN.shouldBuildText(o))i?.attributes?.textContent?s=i.attributes.textContent:i.value&&(s=i.value);else return;if(s!==null&&r.push({str:s}),!!i.children)for(const l of i.children)a(l)}return a(e),n}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}class dce{static setupStorage(e,r,n,a,i){const s=a.getValue(r,{value:null});switch(n.name){case"textarea":if(s.value!==null&&(e.textContent=s.value),i==="print")break;e.addEventListener("input",o=>{a.setValue(r,{value:o.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(s.value===n.attributes.xfaOn?e.setAttribute("checked",!0):s.value===n.attributes.xfaOff&&e.removeAttribute("checked"),i==="print")break;e.addEventListener("change",o=>{a.setValue(r,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(s.value!==null&&e.setAttribute("value",s.value),i==="print")break;e.addEventListener("input",o=>{a.setValue(r,{value:o.target.value})})}break;case"select":if(s.value!==null){e.setAttribute("value",s.value);for(const o of n.children)o.attributes.value===s.value?o.attributes.selected=!0:o.attributes.hasOwnProperty("selected")&&delete o.attributes.selected}e.addEventListener("input",o=>{const l=o.target.options,u=l.selectedIndex===-1?"":l[l.selectedIndex].value;a.setValue(r,{value:u})});break}}static setAttributes({html:e,element:r,storage:n=null,intent:a,linkService:i}){const{attributes:s}=r,o=e instanceof HTMLAnchorElement;s.type==="radio"&&(s.name=`${s.name}-${a}`);for(const[l,u]of Object.entries(s))if(u!=null)switch(l){case"class":u.length&&e.setAttribute(l,u.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",u);break;case"style":Object.assign(e.style,u);break;case"textContent":e.textContent=u;break;default:(!o||l!=="href"&&l!=="newWindow")&&e.setAttribute(l,u)}o&&i.addLinkAttributes(e,s.href,s.newWindow),n&&s.dataId&&this.setupStorage(e,s.dataId,r,n)}static render(e){const r=e.annotationStorage,n=e.linkService,a=e.xfaHtml,i=e.intent||"display",s=document.createElement(a.name);a.attributes&&this.setAttributes({html:s,element:a,intent:i,linkService:n});const o=i!=="richText",l=e.div;if(l.append(s),e.viewport){const h=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=h}o&&l.setAttribute("class","xfaLayer xfaFont");const u=[];if(a.children.length===0){if(a.value){const h=document.createTextNode(a.value);s.append(h),o&&GN.shouldBuildText(a.name)&&u.push(h)}return{textDivs:u}}const d=[[a,-1,s]];for(;d.length>0;){const[h,f,p]=d.at(-1);if(f+1===h.children.length){d.pop();continue}const g=h.children[++d.at(-1)[1]];if(g===null)continue;const{name:m}=g;if(m==="#text"){const y=document.createTextNode(g.value);u.push(y),p.append(y);continue}const _=g?.attributes?.xmlns?document.createElementNS(g.attributes.xmlns,m):document.createElement(m);if(p.append(_),g.attributes&&this.setAttributes({html:_,element:g,storage:r,intent:i,linkService:n}),g.children?.length>0)d.push([g,-1,_]);else if(g.value){const y=document.createTextNode(g.value);o&&GN.shouldBuildText(m)&&u.push(y),_.append(y)}}for(const h of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))h.setAttribute("readOnly",!0);return{textDivs:u}}static update(e){const r=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=r,e.div.hidden=!1}}const lg="http://www.w3.org/2000/svg";class yb{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function xw(t,e="text"){if(f2(t,document.baseURI)){const r=await fetch(t);if(!r.ok)throw new Error(r.statusText);switch(e){case"arraybuffer":return r.arrayBuffer();case"blob":return r.blob();case"json":return r.json()}return r.text()}return new Promise((r,n)=>{const a=new XMLHttpRequest;a.open("GET",t,!0),a.responseType=e,a.onreadystatechange=()=>{if(a.readyState===XMLHttpRequest.DONE){if(a.status===200||a.status===0){switch(e){case"arraybuffer":case"blob":case"json":r(a.response);return}r(a.responseText);return}n(new Error(a.statusText))}},a.send(null)})}class Tk{constructor({viewBox:e,userUnit:r,scale:n,rotation:a,offsetX:i=0,offsetY:s=0,dontFlip:o=!1}){this.viewBox=e,this.userUnit=r,this.scale=n,this.rotation=a,this.offsetX=i,this.offsetY=s,n*=r;const l=(e[2]+e[0])/2,u=(e[3]+e[1])/2;let d,h,f,p;switch(a%=360,a<0&&(a+=360),a){case 180:d=-1,h=0,f=0,p=1;break;case 90:d=0,h=1,f=1,p=0;break;case 270:d=0,h=-1,f=-1,p=0;break;case 0:d=1,h=0,f=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(f=-f,p=-p);let g,m,_,y;d===0?(g=Math.abs(u-e[1])*n+i,m=Math.abs(l-e[0])*n+s,_=(e[3]-e[1])*n,y=(e[2]-e[0])*n):(g=Math.abs(l-e[0])*n+i,m=Math.abs(u-e[1])*n+s,_=(e[2]-e[0])*n,y=(e[3]-e[1])*n),this.transform=[d*n,h*n,f*n,p*n,g-d*n*l-f*n*u,m-h*n*l-p*n*u],this.width=_,this.height=y}get rawDims(){const e=this.viewBox;return Dn(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:r=this.rotation,offsetX:n=this.offsetX,offsetY:a=this.offsetY,dontFlip:i=!1}={}){return new Tk({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:r,offsetX:n,offsetY:a,dontFlip:i})}convertToViewportPoint(e,r){const n=[e,r];return Er.applyTransform(n,this.transform),n}convertToViewportRectangle(e){const r=[e[0],e[1]];Er.applyTransform(r,this.transform);const n=[e[2],e[3]];return Er.applyTransform(n,this.transform),[r[0],r[1],n[0],n[1]]}convertToPdfPoint(e,r){const n=[e,r];return Er.applyInverseTransform(n,this.transform),n}}class UF extends o1{constructor(e,r=0){super(e,"RenderingCancelledException"),this.extraDelay=r}}function xk(t){const e=t.length;let r=0;for(;r<e&&t[r].trim()==="";)r++;return t.substring(r,r+5).toLowerCase()==="data:"}function $F(t){return typeof t=="string"&&/\.pdf$/i.test(t)}function MGe(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function PGe(t,e="document.pdf"){if(typeof t!="string")return e;if(xk(t))return Cn('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const n=(o=>{try{return new URL(o)}catch{try{return new URL(decodeURIComponent(o))}catch{try{return new URL(o,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(o),"https://foo.bar")}catch{return null}}}}})(t);if(!n)return e;const a=o=>{try{let l=decodeURIComponent(o);return l.includes("/")?(l=l.split("/").at(-1),l.test(/^\.pdf$/i)?l:o):l}catch{return o}},i=/\.pdf$/i,s=n.pathname.split("/").at(-1);if(i.test(s))return a(s);if(n.searchParams.size>0){const o=Array.from(n.searchParams.values()).reverse();for(const u of o)if(i.test(u))return a(u);const l=Array.from(n.searchParams.keys()).reverse();for(const u of l)if(i.test(u))return a(u)}if(n.hash){const l=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(n.hash);if(l)return a(l[0])}return e}class cTe{started=Object.create(null);times=[];time(e){e in this.started&&Cn(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||Cn(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let r=0;for(const{name:n}of this.times)r=Math.max(n.length,r);for(const{name:n,start:a,end:i}of this.times)e.push(`${n.padEnd(r)} ${i-a}ms
451
+ </iframe>`},"putIntoIFrame"),sTe=O((t,e,r,n,a)=>{const i=t.append("div");i.attr("id",r),n&&i.attr("style",n);const s=i.append("svg").attr("id",e).attr("width","100%").attr("xmlns",c5t);return a&&s.attr("xmlns:xlink",a),s.append("g"),t},"appendDivSvgG");function FZ(t,e){return t.append("iframe").attr("id",e).attr("style","width: 100%; height: 100%;").attr("sandbox","")}O(FZ,"sandboxedIframe");var x5t=O((t,e,r,n)=>{t.getElementById(e)?.remove(),t.getElementById(r)?.remove(),t.getElementById(n)?.remove()},"removeExistingElements"),w5t=O(async function(t,e,r){PF();const n=sce(e);e=n.code;const a=va();me.debug(a),e.length>(a?.maxTextSize??i5t)&&(e=s5t);const i="#"+t,s="i"+t,o="#"+s,l="d"+t,u="#"+l,d=O(()=>{const L=Ot(f?o:u).node();L&&"remove"in L&&L.remove()},"removeTempElements");let h=Ot("body");const f=a.securityLevel===o5t,p=a.securityLevel===l5t,g=a.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),f){const k=FZ(Ot(r),s);h=Ot(k.nodes()[0].contentDocument.body),h.node().style.margin=0}else h=Ot(r);sTe(h,t,l,`font-family: ${g}`,u5t)}else{if(x5t(document,t,l,s),f){const k=FZ(Ot("body"),s);h=Ot(k.nodes()[0].contentDocument.body),h.node().style.margin=0}else h=Ot("body");sTe(h,t,l)}let m,_;try{m=await BZ.fromText(e,{title:n.title})}catch(k){if(a.suppressErrorRendering)throw d(),k;m=await BZ.fromText("error"),_=k}const y=h.select(u).node(),v=m.type,b=y.firstChild,E=b.firstChild,S=m.renderer.getClasses?.(e,m),T=E5t(a,v,S,i),x=document.createElement("style");x.innerHTML=T,b.insertBefore(x,E);try{await m.renderer.draw(e,t,BK.version,m)}catch(k){throw a.suppressErrorRendering?d():h4t.draw(e,t,BK.version),k}const w=h.select(`${u} svg`),C=m.db.getAccTitle?.(),R=m.db.getAccDescription?.();TGe(v,w,C,R),h.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",d5t);let N=h.select(u).node().innerHTML;if(me.debug("config.arrowMarkerAbsolute",a.arrowMarkerAbsolute),N=S5t(N,f,Wa(a.arrowMarkerAbsolute)),f){const k=h.select(u+" svg").node();N=T5t(N,k)}else p||(N=ib.sanitize(N,{ADD_TAGS:y5t,ADD_ATTR:_5t,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(e5t(),_)throw _;return d(),{diagramType:v,svg:N,bindFunctions:m.db.bindFunctions}},"render");function EGe(t={}){const e=vs({},t);e?.fontFamily&&!e.themeVariables?.fontFamily&&(e.themeVariables||(e.themeVariables={}),e.themeVariables.fontFamily=e.fontFamily),Uxt(e),e?.theme&&e.theme in Lg?e.themeVariables=Lg[e.theme].getThemeVariables(e.themeVariables):e&&(e.themeVariables=Lg.default.getThemeVariables(e.themeVariables));const r=typeof e=="object"?Fxt(e):XBe();tle(r.logLevel),PF()}O(EGe,"initialize");var SGe=O((t,e={})=>{const{code:r}=ice(t);return BZ.fromText(r,e)},"getDiagramFromText");function TGe(t,e,r,n){mGe(e,t),vGe(e,r,n,e.attr("id"))}O(TGe,"addA11yInfo");var vb=Object.freeze({render:w5t,parse:bGe,getDiagramFromText:SGe,initialize:EGe,getConfig:va,setConfig:jBe,getSiteConfig:XBe,updateSiteConfig:$xt,reset:O(()=>{T4()},"reset"),globalReset:O(()=>{T4(dx)},"globalReset"),defaultConfig:dx});tle(va().logLevel);T4(va());var C5t=O((t,e,r)=>{me.warn(t),zle(t)?(r&&r(t.str,t.hash),e.push({...t,message:t.str,error:t})):(r&&r(t),t instanceof Error&&e.push({str:t.message,message:t.message,hash:t.name,error:t}))},"handleError"),xGe=O(async function(t={querySelector:".mermaid"}){try{await A5t(t)}catch(e){if(zle(e)&&me.error(e.str),Qg.parseError&&Qg.parseError(e),!t.suppressErrors)throw me.error("Use the suppressErrors option to suppress these errors"),e}},"run"),A5t=O(async function({postRenderCallback:t,querySelector:e,nodes:r}={querySelector:".mermaid"}){const n=vb.getConfig();me.debug(`${t?"":"No "}Callback function found`);let a;if(r)a=r;else if(e)a=document.querySelectorAll(e);else throw new Error("Nodes and querySelector are both undefined");me.debug(`Found ${a.length} diagrams`),n?.startOnLoad!==void 0&&(me.debug("Start On Load: "+n?.startOnLoad),vb.updateSiteConfig({startOnLoad:n?.startOnLoad}));const i=new Sn.InitIDGenerator(n.deterministicIds,n.deterministicIDSeed);let s;const o=[];for(const l of Array.from(a)){if(me.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");const u=`mermaid-${i.next()}`;s=l.innerHTML,s=H9e(Sn.entityDecode(s)).trim().replace(/<br\s*\/?>/gi,"<br/>");const d=Sn.detectInit(s);d&&me.debug("Detected early reinit: ",d);try{const{svg:h,bindFunctions:f}=await RGe(u,s,l);l.innerHTML=h,t&&await t(u),f&&f(l)}catch(h){C5t(h,o,Qg.parseError)}}if(o.length>0)throw o[0]},"runThrowsErrors"),wGe=O(function(t){vb.initialize(t)},"initialize"),R5t=O(async function(t,e,r){me.warn("mermaid.init is deprecated. Please use run instead."),t&&wGe(t);const n={postRenderCallback:r,querySelector:".mermaid"};typeof e=="string"?n.querySelector=e:e&&(e instanceof HTMLElement?n.nodes=[e]:n.nodes=e),await xGe(n)},"init"),N5t=O(async(t,{lazyLoad:e=!0}={})=>{PF(),FK(...t),e===!1&&await Q4t()},"registerExternalDiagrams"),CGe=O(function(){if(Qg.startOnLoad){const{startOnLoad:t}=vb.getConfig();t&&Qg.run().catch(e=>me.error("Mermaid failed to initialize",e))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",CGe,!1);var I5t=O(function(t){Qg.parseError=t},"setParseErrorHandler"),d5=[],jV=!1,AGe=O(async()=>{if(!jV){for(jV=!0;d5.length>0;){const t=d5.shift();if(t)try{await t()}catch(e){me.error("Error executing queue",e)}}jV=!1}},"executeQueue"),k5t=O(async(t,e)=>new Promise((r,n)=>{const a=O(()=>new Promise((i,s)=>{vb.parse(t,e).then(o=>{i(o),r(o)},o=>{me.error("Error parsing",o),Qg.parseError?.(o),s(o),n(o)})}),"performCall");d5.push(a),AGe().catch(n)}),"parse"),RGe=O((t,e,r)=>new Promise((n,a)=>{const i=O(()=>new Promise((s,o)=>{vb.render(t,e,r).then(l=>{s(l),n(l)},l=>{me.error("Error parsing",l),Qg.parseError?.(l),o(l),a(l)})}),"performCall");d5.push(i),AGe().catch(a)}),"render"),O5t=O(()=>Object.keys(ob).map(t=>({id:t})),"getRegisteredDiagramsMetadata"),Qg={startOnLoad:!0,mermaidAPI:vb,parse:k5t,render:RGe,init:R5t,run:xGe,registerExternalDiagrams:N5t,registerLayoutLoaders:$$e,initialize:wGe,parseError:void 0,contentLoaded:CGe,setParseErrorHandler:I5t,detectType:nle,registerIconPacks:q9e,getRegisteredDiagramsMetadata:O5t},KV=Qg;const D5t=t=>{const{componentCls:e}=t;return{[e]:{[`${e}-header`]:{display:"flex",alignItems:"center",justifyContent:"space-between",background:t.colorBgTitle,color:t.colorTextTitle,padding:t.paddingSM,borderStartStartRadius:t.borderRadius,borderStartEndRadius:t.borderRadius},[`${e}-graph`]:{display:"flex",alignItems:"center",justifyContent:"center",border:`1px solid ${t.colorBgTitle}`,borderTop:"none",padding:t.paddingSM,background:t.colorBgContainer,overflow:"auto",borderEndEndRadius:t.borderRadius,borderEndStartRadius:t.borderRadius,height:"400px"},[`${e}-graph-hidden`]:{display:"none"},[`${e}-graph svg`]:{maxWidth:"100%",maxHeight:"100%",height:"auto",width:"auto"},[`${e}-code`]:{borderEndEndRadius:t.borderRadius,borderEndStartRadius:t.borderRadius,borderBottom:`1px solid ${t.colorBgTitle}`,borderInlineStart:`1px solid ${t.colorBgTitle}`,borderInlineEnd:`1px solid ${t.colorBgTitle}`,background:t.colorBgContainer,paddingInline:t.paddingSM,paddingBlock:t.paddingSM,overflow:"auto",height:"400px","pre,code":{whiteSpace:"pre",fontSize:t.fontSize,fontFamily:t.fontFamilyCode,lineHeight:2,borderRadius:0,border:"none"},"code[class*='language-'],pre[class*='language-']":{background:"none"}},[`&${e}-rtl`]:{direction:"rtl"}}}},L5t=t=>({colorBgTitle:t.colorFillContent,colorBorderCode:t.colorBorderSecondary,colorBorderGraph:t.colorBorderSecondary,colorTextTitle:t.colorText}),M5t=Qre("Mermaid",t=>{const e=ek(t,{});return[D5t(e)]},L5t);var Su=(function(t){return t.Code="code",t.Image="image",t})(Su||{});let P5t=0;const B5t=Me.memo(t=>{const{prefixCls:e,className:r,style:n,classNames:a={},styles:i={},header:s,children:o,highlightProps:l,onRenderTypeChange:u}=t,[d,h]=Me.useState(Su.Image),[f,p]=Me.useState(1),[g,m]=Me.useState({x:0,y:0}),[_,y]=Me.useState(!1),[v,b]=Me.useState({x:0,y:0}),E=Me.useRef(null),S=`mermaid-${P5t++}-${o?.length||0}`;Me.useEffect(()=>{KV.initialize({startOnLoad:!1,securityLevel:"strict",theme:"default",fontFamily:"monospace"})},[]);const[T]=HB("Mermaid",ux.Mermaid),{getPrefixCls:x,direction:w}=Xg(),C=x("mermaid",e),[R,N]=M5t(C),k=qre("mermaid"),L=$a(C,k.className,k.classNames?.root,r,a.root,R,N,{[`${C}-rtl`]:w==="rtl"}),A=pxt(async()=>{if(!(!o||!E.current||d===Su.Code))try{if(!await KV.parse(o,{suppressErrors:!0}))throw new Error("Invalid Mermaid syntax");const X=o.replace(/[`\s]+$/g,""),{svg:ie}=await KV.render(S,X,E.current);E.current.innerHTML=ie}catch(j){Xre(!1,"Mermaid",`Render failed: ${j}`)}},100);Me.useEffect(()=>{d===Su.Code&&E.current?E.current.innerHTML="":A()},[o,d]),Me.useEffect(()=>{const j=E.current;if(!j||d!==Su.Image)return;let X=0;const ie=ne=>{ne.preventDefault(),ne.stopPropagation();const ue=Date.now();if(ue-X<16)return;X=ue;const J=ne.deltaY>0?-.1:.1;p(re=>Math.max(.5,Math.min(3,re+J)))};return j.addEventListener("wheel",ie,{passive:!1}),()=>{j.removeEventListener("wheel",ie)}},[d]),Me.useEffect(()=>{if(E.current&&d===Su.Image){const j=E.current.querySelector("svg");j&&(j.style.transform=`scale(${f}) translate(${g.x}px, ${g.y}px)`,j.style.transformOrigin="center",j.style.transition=_?"none":"transform 0.1s ease-out",j.style.cursor=_?"grabbing":"grab")}},[f,g,d,_]);const D=j=>{d===Su.Image&&(j.preventDefault(),y(!0),b({x:j.clientX,y:j.clientY}))},M=j=>{if(!_||d!==Su.Image)return;j.preventDefault();const X=j.clientX-v.x,ie=j.clientY-v.y;m(ne=>({x:ne.x+X/f,y:ne.y+ie/f})),b({x:j.clientX,y:j.clientY})},B=()=>{y(!1)},F=()=>{p(1),m({x:0,y:0})};if(!o)return null;const U=async()=>{const j=E.current?.querySelector("svg");if(!j)return;const X=new XMLSerializer().serializeToString(j),ie=document.createElement("canvas"),ne=ie.getContext("2d");if(!ne)return;const{width:ue,height:J}=j.getBoundingClientRect(),re=window.devicePixelRatio||1;ie.width=ue*re,ie.height=J*re,ie.style.width=`${ue}px`,ie.style.height=`${J}px`,ne.scale(re,re);const Z=new Image;Z.onload=()=>{ne.drawImage(Z,0,0,ue,J);const ee=document.createElement("a");ee.download=`${Date.now()}.png`,ee.href=ie.toDataURL("image/png",1),ee.click()},Z.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`},V=()=>{p(j=>Math.min(j+.2,3))},$=()=>{p(j=>Math.max(j-.2,.5))},z=()=>{if(s===null)return null;if(s)return s;const j=d===Su.Image?[{key:"zoomIn",icon:Me.createElement(oBe,null),label:T.zoomIn,onItemClick:V},{key:"zoomOut",icon:Me.createElement(lBe,null),label:T.zoomOut,onItemClick:$},{key:"zoomReset",actionRender:()=>Me.createElement(ki.Tooltip,{title:T.zoomReset},Me.createElement(ki.Button,{type:"text",size:"small",onClick:F},T.zoomReset))},{key:"download",icon:Me.createElement(tBe,null),label:T.download,onItemClick:U}]:[{key:"copy",actionRender:()=>Me.createElement(qv.Copy,{text:o})}];return Me.createElement("div",{className:$a(`${C}-header`,k.classNames?.header,a?.header),style:{...k.styles?.header,...i.header}},Me.createElement(ki.Segmented,{options:[{label:T.image,value:Su.Image},{label:T.code,value:Su.Code}],value:d,onChange:X=>{h(X),u?.(X)}}),Me.createElement(qv,{items:j}))},q=()=>Me.createElement(Me.Fragment,null,Me.createElement("div",{className:$a(`${C}-graph`,k.classNames?.graph,d===Su.Code&&`${C}-graph-hidden`,a?.graph),style:{...k.styles?.graph,...i.graph},ref:E,onMouseDown:D,onMouseMove:M,onMouseUp:B,onMouseLeave:B}),d===Su.Code?Me.createElement("div",{className:$a(`${C}-code`,k.classNames?.code,a?.code),style:{...k.styles?.code,...i.code}},Me.createElement(wBe,jd({customStyle:{padding:0,background:"transparent"},language:"mermaid",wrapLines:!0},l),o.replace(/\n$/,""))):null);return Me.createElement("div",{className:L,style:{...n,...k.style,...k.styles?.root,...i.root}},z(),q())});(function(){(function(t,e){try{const o=globalThis.document;if(o){var r=o.createElement("style");for(var n in e.attributes)r.setAttribute(n,e.attributes[n]);var a=o.querySelector("[data-fullscreen-host]"),i=a&&a.shadowRoot;if(i){var s=t.replace(/@layer properties\{@supports[^{]*\{([\s\S]*?)\}\s*\}/g,"@layer properties{$1}");r.appendChild(o.createTextNode(s)),i.appendChild(r)}else r.appendChild(o.createTextNode(t)),o.head.appendChild(r)}}catch{}})("*,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.\\[\\&_\\:is\\(h1\\,h2\\,h3\\,h4\\,h5\\,h6\\,ul\\,ol\\,p\\)\\]\\:\\[all\\:revert\\] :is(h1,h2,h3,h4,h5,h6,ul,ol,p){all:revert}.\\[\\&_table\\]\\:w-full\\! table{width:100%!important}.\\[\\&_table\\]\\:table\\! table{display:table!important}.table{display:table}",{})})();const{Text:F5t}=ki.Typography,U5t=t=>{const{className:e,children:r}=t,n=e?.match(/language-(\w+)/)?.[1]??"";return typeof r!="string"?null:n==="mermaid"?rr.jsx(B5t,{children:r}):n?rr.jsx(UBe,{lang:n,children:r}):rr.jsx(F5t,{code:!0,children:r})},UZ=t=>typeof t=="string"||typeof t=="number"?String(t):Me.isValidElement(t)?UZ(t.props.children):Array.isArray(t)?t.map(UZ).join(""):"",$5t=t=>{const e=[],r=[],n=Me.Children.toArray(t);for(const a of n){if(!Me.isValidElement(a))continue;const i=a.type;if(i==="thead"){const s=Me.Children.toArray(a.props.children);for(const o of s){if(!Me.isValidElement(o))continue;const l=Me.Children.toArray(o.props.children);let u=0;for(const d of l){if(!Me.isValidElement(d))continue;const h=UZ(d.props.children);e.push({title:h,dataIndex:`col_${u}`,key:`col_${u}`}),u++}}}if(i==="tbody"){const s=Me.Children.toArray(a.props.children);let o=0;for(const l of s){if(!Me.isValidElement(l))continue;const u={key:`row_${o}`},d=Me.Children.toArray(l.props.children);let h=0;for(const f of d)Me.isValidElement(f)&&(u[`col_${h}`]=f.props.children,h++);r.push(u),o++}}}return{columns:e,dataSource:r}},G5t=({children:t})=>{const{columns:e,dataSource:r}=$5t(t);return rr.jsx(ki.Table,{className:"[&_table]:w-full! [&_table]:table!",columns:e,dataSource:r,pagination:!1,size:"small",bordered:!0})},{Link:z5t}=ki.Typography,NGe=t=>{const{url:e,requestHeaders:r,className:n,components:a,...i}=t,[s,o]=Me.useState(i.content),l=Me.useMemo(()=>$re(),[]),u=async d=>{const h=await(await fetch(d,{headers:r})).text();o(h)};return Me.useEffect(()=>{e&&u(e)},[e]),Me.useEffect(()=>{o(i.content)},[i.content]),rr.jsx(o0t,{cache:l,children:rr.jsx(ki.ConfigProvider,{theme:{inherit:!1},children:rr.jsx(s6e,{...i,className:$a("[&_:is(h1,h2,h3,h4,h5,h6,ul,ol,p)]:[all:revert]",n),content:s,components:{code:U5t,a:z5t,table:G5t,...a}})})})},Xl=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),$Z=[.001,0,0,.001,0,0],ZV=1.35,xu={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Vf={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},UN="pdfjs_internal_editor_",wn={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},ta={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},IGe={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Uo={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},BR={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},cs={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},HE={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Ek={ERRORS:0,WARNINGS:1,INFOS:5},xx={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},nL={moveTo:0,lineTo:1,curveTo:2,closePath:3},kGe={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let BF=Ek.WARNINGS;function V5t(t){Number.isInteger(t)&&(BF=t)}function H5t(){return BF}function FF(t){BF>=Ek.INFOS&&console.info(`Info: ${t}`)}function Cn(t){BF>=Ek.WARNINGS&&console.warn(`Warning: ${t}`)}function ti(t){throw new Error(t)}function ca(t,e){t||ti(e)}function Y5t(t){switch(t?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function oce(t,e=null,r=null){if(!t)return null;if(r&&typeof t=="string"&&(r.addDefaultProtocol&&t.startsWith("www.")&&t.match(/\./g)?.length>=2&&(t=`http://${t}`),r.tryConvertEncoding))try{t=K5t(t)}catch{}const n=e?URL.parse(t,e):URL.parse(t);return Y5t(n)?n:null}function lce(t,e,r=!1){const n=URL.parse(t);return n?(n.hash=e,n.href):r&&oce(t,"http://example.com")?t.split("#",1)[0]+`${e?`#${e}`:""}`:""}function Dn(t,e,r,n=!1){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!0,writable:!1}),r}const o1=(function(){function e(r,n){this.message=r,this.name=n}return e.prototype=new Error,e.constructor=e,e})();class oTe extends o1{constructor(e,r){super(e,"PasswordException"),this.code=r}}class QV extends o1{constructor(e,r){super(e,"UnknownErrorException"),this.details=r}}class h5 extends o1{constructor(e){super(e,"InvalidPDFException")}}class $N extends o1{constructor(e,r,n){super(e,"ResponseException"),this.status=r,this.missing=n}}class W5t extends o1{constructor(e){super(e,"FormatError")}}class Jg extends o1{constructor(e){super(e,"AbortException")}}function OGe(t){(typeof t!="object"||t?.length===void 0)&&ti("Invalid argument for bytesToString");const e=t.length,r=8192;if(e<r)return String.fromCharCode.apply(null,t);const n=[];for(let a=0;a<e;a+=r){const i=Math.min(a+r,e),s=t.subarray(a,i);n.push(String.fromCharCode.apply(null,s))}return n.join("")}function Sk(t){typeof t!="string"&&ti("Invalid argument for stringToBytes");const e=t.length,r=new Uint8Array(e);for(let n=0;n<e;++n)r[n]=t.charCodeAt(n)&255;return r}function q5t(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,t&255)}function X5t(){const t=new Uint8Array(4);return t[0]=1,new Uint32Array(t.buffer,0,1)[0]===1}function j5t(){try{return new Function(""),!0}catch{return!1}}class Ao{static get isLittleEndian(){return Dn(this,"isLittleEndian",X5t())}static get isEvalSupported(){return Dn(this,"isEvalSupported",j5t())}static get isOffscreenCanvasSupported(){return Dn(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Dn(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:e,userAgent:r}=navigator;return Dn(this,"platform",{isAndroid:r.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:r.includes("Firefox")})}static get isCSSRoundSupported(){return Dn(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const JV=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));class Er{static makeHexColor(e,r,n){return`#${JV[e]}${JV[r]}${JV[n]}`}static domMatrixToTransform(e){return[e.a,e.b,e.c,e.d,e.e,e.f]}static scaleMinMax(e,r){let n;e[0]?(e[0]<0&&(n=r[0],r[0]=r[2],r[2]=n),r[0]*=e[0],r[2]*=e[0],e[3]<0&&(n=r[1],r[1]=r[3],r[3]=n),r[1]*=e[3],r[3]*=e[3]):(n=r[0],r[0]=r[1],r[1]=n,n=r[2],r[2]=r[3],r[3]=n,e[1]<0&&(n=r[1],r[1]=r[3],r[3]=n),r[1]*=e[1],r[3]*=e[1],e[2]<0&&(n=r[0],r[0]=r[2],r[2]=n),r[0]*=e[2],r[2]*=e[2]),r[0]+=e[4],r[1]+=e[5],r[2]+=e[4],r[3]+=e[5]}static transform(e,r){return[e[0]*r[0]+e[2]*r[1],e[1]*r[0]+e[3]*r[1],e[0]*r[2]+e[2]*r[3],e[1]*r[2]+e[3]*r[3],e[0]*r[4]+e[2]*r[5]+e[4],e[1]*r[4]+e[3]*r[5]+e[5]]}static multiplyByDOMMatrix(e,r){return[e[0]*r.a+e[2]*r.b,e[1]*r.a+e[3]*r.b,e[0]*r.c+e[2]*r.d,e[1]*r.c+e[3]*r.d,e[0]*r.e+e[2]*r.f+e[4],e[1]*r.e+e[3]*r.f+e[5]]}static applyTransform(e,r,n=0){const a=e[n],i=e[n+1];e[n]=a*r[0]+i*r[2]+r[4],e[n+1]=a*r[1]+i*r[3]+r[5]}static applyTransformToBezier(e,r,n=0){const a=r[0],i=r[1],s=r[2],o=r[3],l=r[4],u=r[5];for(let d=0;d<6;d+=2){const h=e[n+d],f=e[n+d+1];e[n+d]=h*a+f*s+l,e[n+d+1]=h*i+f*o+u}}static applyInverseTransform(e,r){const n=e[0],a=e[1],i=r[0]*r[3]-r[1]*r[2];e[0]=(n*r[3]-a*r[2]+r[2]*r[5]-r[4]*r[3])/i,e[1]=(-n*r[1]+a*r[0]+r[4]*r[1]-r[5]*r[0])/i}static axialAlignedBoundingBox(e,r,n){const a=r[0],i=r[1],s=r[2],o=r[3],l=r[4],u=r[5],d=e[0],h=e[1],f=e[2],p=e[3];let g=a*d+l,m=g,_=a*f+l,y=_,v=o*h+u,b=v,E=o*p+u,S=E;if(i!==0||s!==0){const T=i*d,x=i*f,w=s*h,C=s*p;g+=w,y+=w,_+=C,m+=C,v+=T,S+=T,E+=x,b+=x}n[0]=Math.min(n[0],g,_,m,y),n[1]=Math.min(n[1],v,E,b,S),n[2]=Math.max(n[2],g,_,m,y),n[3]=Math.max(n[3],v,E,b,S)}static inverseTransform(e){const r=e[0]*e[3]-e[1]*e[2];return[e[3]/r,-e[1]/r,-e[2]/r,e[0]/r,(e[2]*e[5]-e[4]*e[3])/r,(e[4]*e[1]-e[5]*e[0])/r]}static singularValueDecompose2dScale(e,r){const n=e[0],a=e[1],i=e[2],s=e[3],o=n**2+a**2,l=n*i+a*s,u=i**2+s**2,d=(o+u)/2,h=Math.sqrt(d**2-(o*u-l**2));r[0]=Math.sqrt(d+h||1),r[1]=Math.sqrt(d-h||1)}static normalizeRect(e){const r=e.slice(0);return e[0]>e[2]&&(r[0]=e[2],r[2]=e[0]),e[1]>e[3]&&(r[1]=e[3],r[3]=e[1]),r}static intersect(e,r){const n=Math.max(Math.min(e[0],e[2]),Math.min(r[0],r[2])),a=Math.min(Math.max(e[0],e[2]),Math.max(r[0],r[2]));if(n>a)return null;const i=Math.max(Math.min(e[1],e[3]),Math.min(r[1],r[3])),s=Math.min(Math.max(e[1],e[3]),Math.max(r[1],r[3]));return i>s?null:[n,i,a,s]}static pointBoundingBox(e,r,n){n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],r),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],r)}static rectBoundingBox(e,r,n,a,i){i[0]=Math.min(i[0],e,n),i[1]=Math.min(i[1],r,a),i[2]=Math.max(i[2],e,n),i[3]=Math.max(i[3],r,a)}static#e(e,r,n,a,i,s,o,l,u,d){if(u<=0||u>=1)return;const h=1-u,f=u*u,p=f*u,g=h*(h*(h*e+3*u*r)+3*f*n)+p*a,m=h*(h*(h*i+3*u*s)+3*f*o)+p*l;d[0]=Math.min(d[0],g),d[1]=Math.min(d[1],m),d[2]=Math.max(d[2],g),d[3]=Math.max(d[3],m)}static#t(e,r,n,a,i,s,o,l,u,d,h,f){if(Math.abs(u)<1e-12){Math.abs(d)>=1e-12&&this.#e(e,r,n,a,i,s,o,l,-h/d,f);return}const p=d**2-4*h*u;if(p<0)return;const g=Math.sqrt(p),m=2*u;this.#e(e,r,n,a,i,s,o,l,(-d+g)/m,f),this.#e(e,r,n,a,i,s,o,l,(-d-g)/m,f)}static bezierBoundingBox(e,r,n,a,i,s,o,l,u){u[0]=Math.min(u[0],e,o),u[1]=Math.min(u[1],r,l),u[2]=Math.max(u[2],e,o),u[3]=Math.max(u[3],r,l),this.#t(e,n,i,o,r,a,s,l,3*(-e+3*(n-i)+o),6*(e-2*n+i),3*(n-e),u),this.#t(e,n,i,o,r,a,s,l,3*(-r+3*(a-s)+l),6*(r-2*a+s),3*(a-r),u)}}function K5t(t){return decodeURIComponent(escape(t))}let eH=null,lTe=null;function DGe(t){return eH||(eH=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,lTe=new Map([["ſt","ſt"]])),t.replaceAll(eH,(e,r,n)=>r?r.normalize("NFKC"):lTe.get(n))}function cce(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const t=new Uint8Array(32);return crypto.getRandomValues(t),OGe(t)}const uce="pdfjs_internal_id_";function Z5t(t,e,r){if(!Array.isArray(r)||r.length<2)return!1;const[n,a,...i]=r;if(!t(n)&&!Number.isInteger(n)||!e(a))return!1;const s=i.length;let o=!0;switch(a.name){case"XYZ":if(s<2||s>3)return!1;break;case"Fit":case"FitB":return s===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(s>1)return!1;break;case"FitR":if(s!==4)return!1;o=!1;break;default:return!1}for(const l of i)if(!(typeof l=="number"||o&&l===null))return!1;return!0}function bl(t,e,r){return Math.min(Math.max(t,e),r)}function LGe(t){return Uint8Array.prototype.toBase64?t.toBase64():btoa(OGe(t))}function Q5t(t){return Uint8Array.fromBase64?Uint8Array.fromBase64(t):Sk(atob(t))}typeof Promise.try!="function"&&(Promise.try=function(t,...e){return new Promise(r=>{r(t(...e))})});typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(t){return t.reduce((e,r)=>e+r,0)});class GN{static textContent(e){const r=[],n={items:r,styles:Object.create(null)};function a(i){if(!i)return;let s=null;const o=i.name;if(o==="#text")s=i.value;else if(GN.shouldBuildText(o))i?.attributes?.textContent?s=i.attributes.textContent:i.value&&(s=i.value);else return;if(s!==null&&r.push({str:s}),!!i.children)for(const l of i.children)a(l)}return a(e),n}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}class dce{static setupStorage(e,r,n,a,i){const s=a.getValue(r,{value:null});switch(n.name){case"textarea":if(s.value!==null&&(e.textContent=s.value),i==="print")break;e.addEventListener("input",o=>{a.setValue(r,{value:o.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(s.value===n.attributes.xfaOn?e.setAttribute("checked",!0):s.value===n.attributes.xfaOff&&e.removeAttribute("checked"),i==="print")break;e.addEventListener("change",o=>{a.setValue(r,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(s.value!==null&&e.setAttribute("value",s.value),i==="print")break;e.addEventListener("input",o=>{a.setValue(r,{value:o.target.value})})}break;case"select":if(s.value!==null){e.setAttribute("value",s.value);for(const o of n.children)o.attributes.value===s.value?o.attributes.selected=!0:o.attributes.hasOwnProperty("selected")&&delete o.attributes.selected}e.addEventListener("input",o=>{const l=o.target.options,u=l.selectedIndex===-1?"":l[l.selectedIndex].value;a.setValue(r,{value:u})});break}}static setAttributes({html:e,element:r,storage:n=null,intent:a,linkService:i}){const{attributes:s}=r,o=e instanceof HTMLAnchorElement;s.type==="radio"&&(s.name=`${s.name}-${a}`);for(const[l,u]of Object.entries(s))if(u!=null)switch(l){case"class":u.length&&e.setAttribute(l,u.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",u);break;case"style":Object.assign(e.style,u);break;case"textContent":e.textContent=u;break;default:(!o||l!=="href"&&l!=="newWindow")&&e.setAttribute(l,u)}o&&i.addLinkAttributes(e,s.href,s.newWindow),n&&s.dataId&&this.setupStorage(e,s.dataId,r,n)}static render(e){const r=e.annotationStorage,n=e.linkService,a=e.xfaHtml,i=e.intent||"display",s=document.createElement(a.name);a.attributes&&this.setAttributes({html:s,element:a,intent:i,linkService:n});const o=i!=="richText",l=e.div;if(l.append(s),e.viewport){const h=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=h}o&&l.setAttribute("class","xfaLayer xfaFont");const u=[];if(a.children.length===0){if(a.value){const h=document.createTextNode(a.value);s.append(h),o&&GN.shouldBuildText(a.name)&&u.push(h)}return{textDivs:u}}const d=[[a,-1,s]];for(;d.length>0;){const[h,f,p]=d.at(-1);if(f+1===h.children.length){d.pop();continue}const g=h.children[++d.at(-1)[1]];if(g===null)continue;const{name:m}=g;if(m==="#text"){const y=document.createTextNode(g.value);u.push(y),p.append(y);continue}const _=g?.attributes?.xmlns?document.createElementNS(g.attributes.xmlns,m):document.createElement(m);if(p.append(_),g.attributes&&this.setAttributes({html:_,element:g,storage:r,intent:i,linkService:n}),g.children?.length>0)d.push([g,-1,_]);else if(g.value){const y=document.createTextNode(g.value);o&&GN.shouldBuildText(m)&&u.push(y),_.append(y)}}for(const h of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))h.setAttribute("readOnly",!0);return{textDivs:u}}static update(e){const r=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=r,e.div.hidden=!1}}const lg="http://www.w3.org/2000/svg";class yb{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function xw(t,e="text"){if(f2(t,document.baseURI)){const r=await fetch(t);if(!r.ok)throw new Error(r.statusText);switch(e){case"arraybuffer":return r.arrayBuffer();case"blob":return r.blob();case"json":return r.json()}return r.text()}return new Promise((r,n)=>{const a=new XMLHttpRequest;a.open("GET",t,!0),a.responseType=e,a.onreadystatechange=()=>{if(a.readyState===XMLHttpRequest.DONE){if(a.status===200||a.status===0){switch(e){case"arraybuffer":case"blob":case"json":r(a.response);return}r(a.responseText);return}n(new Error(a.statusText))}},a.send(null)})}class Tk{constructor({viewBox:e,userUnit:r,scale:n,rotation:a,offsetX:i=0,offsetY:s=0,dontFlip:o=!1}){this.viewBox=e,this.userUnit=r,this.scale=n,this.rotation=a,this.offsetX=i,this.offsetY=s,n*=r;const l=(e[2]+e[0])/2,u=(e[3]+e[1])/2;let d,h,f,p;switch(a%=360,a<0&&(a+=360),a){case 180:d=-1,h=0,f=0,p=1;break;case 90:d=0,h=1,f=1,p=0;break;case 270:d=0,h=-1,f=-1,p=0;break;case 0:d=1,h=0,f=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(f=-f,p=-p);let g,m,_,y;d===0?(g=Math.abs(u-e[1])*n+i,m=Math.abs(l-e[0])*n+s,_=(e[3]-e[1])*n,y=(e[2]-e[0])*n):(g=Math.abs(l-e[0])*n+i,m=Math.abs(u-e[1])*n+s,_=(e[2]-e[0])*n,y=(e[3]-e[1])*n),this.transform=[d*n,h*n,f*n,p*n,g-d*n*l-f*n*u,m-h*n*l-p*n*u],this.width=_,this.height=y}get rawDims(){const e=this.viewBox;return Dn(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:r=this.rotation,offsetX:n=this.offsetX,offsetY:a=this.offsetY,dontFlip:i=!1}={}){return new Tk({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:r,offsetX:n,offsetY:a,dontFlip:i})}convertToViewportPoint(e,r){const n=[e,r];return Er.applyTransform(n,this.transform),n}convertToViewportRectangle(e){const r=[e[0],e[1]];Er.applyTransform(r,this.transform);const n=[e[2],e[3]];return Er.applyTransform(n,this.transform),[r[0],r[1],n[0],n[1]]}convertToPdfPoint(e,r){const n=[e,r];return Er.applyInverseTransform(n,this.transform),n}}class UF extends o1{constructor(e,r=0){super(e,"RenderingCancelledException"),this.extraDelay=r}}function xk(t){const e=t.length;let r=0;for(;r<e&&t[r].trim()==="";)r++;return t.substring(r,r+5).toLowerCase()==="data:"}function $F(t){return typeof t=="string"&&/\.pdf$/i.test(t)}function MGe(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function PGe(t,e="document.pdf"){if(typeof t!="string")return e;if(xk(t))return Cn('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const n=(o=>{try{return new URL(o)}catch{try{return new URL(decodeURIComponent(o))}catch{try{return new URL(o,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(o),"https://foo.bar")}catch{return null}}}}})(t);if(!n)return e;const a=o=>{try{let l=decodeURIComponent(o);return l.includes("/")?(l=l.split("/").at(-1),l.test(/^\.pdf$/i)?l:o):l}catch{return o}},i=/\.pdf$/i,s=n.pathname.split("/").at(-1);if(i.test(s))return a(s);if(n.searchParams.size>0){const o=Array.from(n.searchParams.values()).reverse();for(const u of o)if(i.test(u))return a(u);const l=Array.from(n.searchParams.keys()).reverse();for(const u of l)if(i.test(u))return a(u)}if(n.hash){const l=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(n.hash);if(l)return a(l[0])}return e}class cTe{started=Object.create(null);times=[];time(e){e in this.started&&Cn(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||Cn(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let r=0;for(const{name:n}of this.times)r=Math.max(n.length,r);for(const{name:n,start:a,end:i}of this.times)e.push(`${n.padEnd(r)} ${i-a}ms
452
452
  `);return e.join("")}}function f2(t,e){const r=e?URL.parse(t,e):URL.parse(t);return r?.protocol==="http:"||r?.protocol==="https:"}function Gu(t){t.preventDefault()}function zi(t){t.preventDefault(),t.stopPropagation()}function J5t(t){console.log("Deprecated API usage: "+t)}class f5{static#e;static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!="string")return null;this.#e||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const r=this.#e.exec(e);if(!r)return null;const n=parseInt(r[1],10);let a=parseInt(r[2],10);a=a>=1&&a<=12?a-1:0;let i=parseInt(r[3],10);i=i>=1&&i<=31?i:1;let s=parseInt(r[4],10);s=s>=0&&s<=23?s:0;let o=parseInt(r[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(r[6],10);l=l>=0&&l<=59?l:0;const u=r[7]||"Z";let d=parseInt(r[8],10);d=d>=0&&d<=23?d:0;let h=parseInt(r[9],10)||0;return h=h>=0&&h<=59?h:0,u==="-"?(s+=d,o+=h):u==="+"&&(s-=d,o-=h),new Date(Date.UTC(n,a,i,s,o,l))}}function BGe(t,{scale:e=1,rotation:r=0}){const{width:n,height:a}=t.attributes.style,i=[0,0,parseInt(n),parseInt(a)];return new Tk({viewBox:i,userUnit:1,scale:e,rotation:r})}function ww(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(e&16711680)>>16,(e&65280)>>8,e&255]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(e=>parseInt(e)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):(Cn(`Not a valid color format: "${t}"`),[0,0,0])}function e6t(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const r of t.keys()){e.style.color=r;const n=window.getComputedStyle(e).color;t.set(r,ww(n))}e.remove()}function Ui(t){const{a:e,b:r,c:n,d:a,e:i,f:s}=t.getTransform();return[e,r,n,a,i,s]}function _f(t){const{a:e,b:r,c:n,d:a,e:i,f:s}=t.getTransform().invertSelf();return[e,r,n,a,i,s]}function Jv(t,e,r=!1,n=!0){if(e instanceof Tk){const{pageWidth:a,pageHeight:i}=e.rawDims,{style:s}=t,o=Ao.isCSSRoundSupported,l=`var(--total-scale-factor) * ${a}px`,u=`var(--total-scale-factor) * ${i}px`,d=o?`round(down, ${l}, var(--scale-round-x))`:`calc(${l})`,h=o?`round(down, ${u}, var(--scale-round-y))`:`calc(${u})`;!r||e.rotation%180===0?(s.width=d,s.height=h):(s.width=h,s.height=d)}n&&t.setAttribute("data-main-rotation",e.rotation)}class Xh{constructor(){const{pixelRatio:e}=Xh;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(e,r,n,a,i=-1){let s=1/0,o=1/0,l=1/0;n=Xh.capPixels(n,i),n>0&&(s=Math.sqrt(n/(e*r))),a!==-1&&(o=a/e,l=a/r);const u=Math.min(s,o,l);return this.sx>u||this.sy>u?(this.sx=u,this.sy=u,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,r){if(r>=0){const n=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+r/100));return e>0?Math.min(e,n):n}return e}}const p5=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class t6t{static get isDarkMode(){return Dn(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}}class FGe{static get commentForegroundColor(){const e=document.createElement("span");e.classList.add("comment","sidebar");const{style:r}=e;r.width=r.height="0",r.display="none",r.color="var(--comment-fg-color)",document.body.append(e);const{color:n}=window.getComputedStyle(e);return e.remove(),Dn(this,"commentForegroundColor",ww(n))}}function UGe(t,e,r,n){n=Math.min(Math.max(n??1,0),1);const a=255*(1-n);return t=Math.round(t*n+a),e=Math.round(e*n+a),r=Math.round(r*n+a),[t,e,r]}function uTe(t,e){const r=t[0]/255,n=t[1]/255,a=t[2]/255,i=Math.max(r,n,a),s=Math.min(r,n,a),o=(i+s)/2;if(i===s)e[0]=e[1]=0;else{const l=i-s;switch(e[1]=o<.5?l/(i+s):l/(2-i-s),i){case r:e[0]=((n-a)/l+(n<a?6:0))*60;break;case n:e[0]=((a-r)/l+2)*60;break;case a:e[0]=((r-n)/l+4)*60;break}}e[2]=o}function GZ(t,e){const r=t[0],n=t[1],a=t[2],i=(1-Math.abs(2*a-1))*n,s=i*(1-Math.abs(r/60%2-1)),o=a-i/2;switch(Math.floor(r/60)){case 0:e[0]=i+o,e[1]=s+o,e[2]=o;break;case 1:e[0]=s+o,e[1]=i+o,e[2]=o;break;case 2:e[0]=o,e[1]=i+o,e[2]=s+o;break;case 3:e[0]=o,e[1]=s+o,e[2]=i+o;break;case 4:e[0]=s+o,e[1]=o,e[2]=i+o;break;case 5:case 6:e[0]=i+o,e[1]=o,e[2]=s+o;break}}function dTe(t){return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function hTe(t,e,r){GZ(t,r),r.map(dTe);const n=.2126*r[0]+.7152*r[1]+.0722*r[2];GZ(e,r),r.map(dTe);const a=.2126*r[0]+.7152*r[1]+.0722*r[2];return n>a?(n+.05)/(a+.05):(a+.05)/(n+.05)}const fTe=new Map;function $Ge(t,e){const r=t[0]+t[1]*256+t[2]*65536+e[0]*16777216+e[1]*4294967296+e[2]*1099511627776;let n=fTe.get(r);if(n)return n;const a=new Float32Array(9),i=a.subarray(0,3),s=a.subarray(3,6);uTe(t,s);const o=a.subarray(6,9);uTe(e,o);const l=o[2]<.5,u=l?12:4.5;if(s[2]=l?Math.sqrt(s[2]):1-Math.sqrt(1-s[2]),hTe(s,o,i)<u){let d,h;l?(d=s[2],h=1):(d=0,h=s[2]);const f=.005;for(;h-d>f;){const p=s[2]=(d+h)/2;l===hTe(s,o,i)<u?d=p:h=p}s[2]=l?h:d}return GZ(s,i),n=Er.makeHexColor(Math.round(i[0]*255),Math.round(i[1]*255),Math.round(i[2]*255)),fTe.set(r,n),n}function hce({html:t,dir:e,className:r},n){const a=document.createDocumentFragment();if(typeof t=="string"){const i=document.createElement("p");i.dir=e||"auto";const s=t.split(/(?:\r\n?|\n)/);for(let o=0,l=s.length;o<l;++o){const u=s[o];i.append(document.createTextNode(u)),o<l-1&&i.append(document.createElement("br"))}a.append(i)}else dce.render({xfaHtml:t,div:a,intent:"richText"});a.firstChild.classList.add("richText",r),n.append(a)}class FR{#e=null;#t=null;#n;#r=null;#s=null;#a=null;#i=null;#o=null;static#c=null;constructor(e){this.#n=e,FR.#c||=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"})}render(){const e=this.#e=document.createElement("div");e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const r=this.#n._uiManager._signal;r instanceof AbortSignal&&!r.aborted&&(e.addEventListener("contextmenu",Gu,{signal:r}),e.addEventListener("pointerdown",FR.#l,{signal:r}));const n=this.#r=document.createElement("div");n.className="buttons",e.append(n);const a=this.#n.toolbarPosition;if(a){const{style:i}=e,s=this.#n._uiManager.direction==="ltr"?1-a[0]:a[0];i.insetInlineEnd=`${100*s}%`,i.top=`calc(${100*a[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return this.#e}static#l(e){e.stopPropagation()}#h(e){this.#n._focusEventsAllowed=!1,zi(e)}#d(e){this.#n._focusEventsAllowed=!0,zi(e)}#f(e){const r=this.#n._uiManager._signal;return!(r instanceof AbortSignal)||r.aborted?!1:(e.addEventListener("focusin",this.#h.bind(this),{capture:!0,signal:r}),e.addEventListener("focusout",this.#d.bind(this),{capture:!0,signal:r}),e.addEventListener("contextmenu",Gu,{signal:r}),!0)}hide(){this.#e.classList.add("hidden"),this.#t?.hideDropdown()}show(){this.#e.classList.remove("hidden"),this.#s?.shown(),this.#a?.shown()}addDeleteButton(){const{editorType:e,_uiManager:r}=this.#n,n=document.createElement("button");n.classList.add("basic","deleteButton"),n.tabIndex=0,n.setAttribute("data-l10n-id",FR.#c[e]),this.#f(n)&&n.addEventListener("click",a=>{r.delete()},{signal:r._signal}),this.#r.append(n)}get#m(){const e=document.createElement("div");return e.className="divider",e}async addAltText(e){const r=await e.render();this.#f(r),this.#r.append(r,this.#m),this.#s=e}addComment(e,r=null){if(this.#a)return;const n=e.renderForToolbar();if(!n)return;this.#f(n);const a=this.#i=this.#m;r?(this.#r.insertBefore(n,r),this.#r.insertBefore(a,r)):this.#r.append(n,a),this.#a=e,e.toolbar=this}addColorPicker(e){if(this.#t)return;this.#t=e;const r=e.renderButton();this.#f(r),this.#r.append(r,this.#m)}async addEditSignatureButton(e){const r=this.#o=await e.renderEditButton(this.#n);this.#f(r),this.#r.append(r,this.#m)}removeButton(e){switch(e){case"comment":this.#a?.removeToolbarCommentButton(),this.#a=null,this.#i?.remove(),this.#i=null;break}}async addButton(e,r){switch(e){case"colorPicker":this.addColorPicker(r);break;case"altText":await this.addAltText(r);break;case"editSignature":await this.addEditSignatureButton(r);break;case"delete":this.addDeleteButton();break;case"comment":this.addComment(r);break}}async addButtonBefore(e,r,n){const a=this.#r.querySelector(n);a&&e==="comment"&&this.addComment(r,a)}updateEditSignatureButton(e){this.#o&&(this.#o.title=e)}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}}class r6t{#e=null;#t=null;#n;constructor(e){this.#n=e}#r(){const e=this.#t=document.createElement("div");e.className="editToolbar",e.setAttribute("role","toolbar");const r=this.#n._signal;r instanceof AbortSignal&&!r.aborted&&e.addEventListener("contextmenu",Gu,{signal:r});const n=this.#e=document.createElement("div");return n.className="buttons",e.append(n),this.#n.hasCommentManager()&&this.#a("commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{this.#n.commentSelection("floating_button")}),this.#a("highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{this.#n.highlightSelection("floating_button")}),e}#s(e,r){let n=0,a=0;for(const i of e){const s=i.y+i.height;if(s<n)continue;const o=i.x+(r?i.width:0);if(s>n){a=o,n=s;continue}r?o>a&&(a=o):o<a&&(a=o)}return[r?1-a:a,n]}show(e,r,n){const[a,i]=this.#s(r,n),{style:s}=this.#t||=this.#r();e.append(this.#t),s.insetInlineEnd=`${100*a}%`,s.top=`calc(${100*i}% + var(--editor-toolbar-vert-offset))`}hide(){this.#t.remove()}#a(e,r,n,a){const i=document.createElement("button");i.classList.add("basic",e),i.tabIndex=0,i.setAttribute("data-l10n-id",r);const s=document.createElement("span");i.append(s),s.className="visuallyHidden",s.setAttribute("data-l10n-id",n);const o=this.#n._signal;o instanceof AbortSignal&&!o.aborted&&(i.addEventListener("contextmenu",Gu,{signal:o}),i.addEventListener("click",a,{signal:o})),this.#e.append(i)}}function GGe(t,e,r){for(const n of r)e.addEventListener(n,t[n].bind(t))}class n6t{#e=0;get id(){return`${UN}${this.#e++}`}}class fce{#e=cce();#t=0;#n=null;static get _isSVGFittingCanvas(){const e='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>',n=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),a=new Image;a.src=e;const i=a.decode().then(()=>(n.drawImage(a,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return Dn(this,"_isSVGFittingCanvas",i)}async#r(e,r){this.#n||=new Map;let n=this.#n.get(e);if(n===null)return null;if(n?.bitmap)return n.refCounter+=1,n;try{n||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let a;if(typeof r=="string"?(n.url=r,a=await xw(r,"blob")):r instanceof File?a=n.file=r:r instanceof Blob&&(a=r),a.type==="image/svg+xml"){const i=fce._isSVGFittingCanvas,s=new FileReader,o=new Image,l=new Promise((u,d)=>{o.onload=()=>{n.bitmap=o,n.isSvg=!0,u()},s.onload=async()=>{const h=n.svgUrl=s.result;o.src=await i?`${h}#svgView(preserveAspectRatio(none))`:h},o.onerror=s.onerror=d});s.readAsDataURL(a),await l}else n.bitmap=await createImageBitmap(a);n.refCounter=1}catch(a){Cn(a),n=null}return this.#n.set(e,n),n&&this.#n.set(n.id,n),n}async getFromFile(e){const{lastModified:r,name:n,size:a,type:i}=e;return this.#r(`${r}_${n}_${a}_${i}`,e)}async getFromUrl(e){return this.#r(e,e)}async getFromBlob(e,r){const n=await r;return this.#r(e,n)}async getFromId(e){this.#n||=new Map;const r=this.#n.get(e);if(!r)return null;if(r.bitmap)return r.refCounter+=1,r;if(r.file)return this.getFromFile(r.file);if(r.blobPromise){const{blobPromise:n}=r;return delete r.blobPromise,this.getFromBlob(r.id,n)}return this.getFromUrl(r.url)}getFromCanvas(e,r){this.#n||=new Map;let n=this.#n.get(e);if(n?.bitmap)return n.refCounter+=1,n;const a=new OffscreenCanvas(r.width,r.height);return a.getContext("2d").drawImage(r,0,0),n={bitmap:a.transferToImageBitmap(),id:`image_${this.#e}_${this.#t++}`,refCounter:1,isSvg:!1},this.#n.set(e,n),this.#n.set(n.id,n),n}getSvgUrl(e){const r=this.#n.get(e);return r?.isSvg?r.svgUrl:null}deleteId(e){this.#n||=new Map;const r=this.#n.get(e);if(!r||(r.refCounter-=1,r.refCounter!==0))return;const{bitmap:n}=r;if(!r.url&&!r.file){const a=new OffscreenCanvas(n.width,n.height);a.getContext("bitmaprenderer").transferFromImageBitmap(n),r.blobPromise=a.convertToBlob()}n.close?.(),r.bitmap=null}isValidId(e){return e.startsWith(`image_${this.#e}_`)}}class a6t{#e=[];#t=!1;#n;#r=-1;constructor(e=128){this.#n=e}add({cmd:e,undo:r,post:n,mustExec:a,type:i=NaN,overwriteIfSameType:s=!1,keepUndo:o=!1}){if(a&&e(),this.#t)return;const l={cmd:e,undo:r,post:n,type:i};if(this.#r===-1){this.#e.length>0&&(this.#e.length=0),this.#r=0,this.#e.push(l);return}if(s&&this.#e[this.#r].type===i){o&&(l.undo=this.#e[this.#r].undo),this.#e[this.#r]=l;return}const u=this.#r+1;u===this.#n?this.#e.splice(0,1):(this.#r=u,u<this.#e.length&&this.#e.splice(u)),this.#e.push(l)}undo(){if(this.#r===-1)return;this.#t=!0;const{undo:e,post:r}=this.#e[this.#r];e(),r?.(),this.#t=!1,this.#r-=1}redo(){if(this.#r<this.#e.length-1){this.#r+=1,this.#t=!0;const{cmd:e,post:r}=this.#e[this.#r];e(),r?.(),this.#t=!1}}hasSomethingToUndo(){return this.#r!==-1}hasSomethingToRedo(){return this.#r<this.#e.length-1}cleanType(e){if(this.#r!==-1){for(let r=this.#r;r>=0;r--)if(this.#e[r].type!==e){this.#e.splice(r+1,this.#r-r),this.#r=r;return}this.#e.length=0,this.#r=-1}}destroy(){this.#e=null}}class wk{constructor(e){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:r}=Ao.platform;for(const[n,a,i={}]of e)for(const s of n){const o=s.startsWith("mac+");r&&o?(this.callbacks.set(s.slice(4),{callback:a,options:i}),this.allKeys.add(s.split("+").at(-1))):!r&&!o&&(this.callbacks.set(s,{callback:a,options:i}),this.allKeys.add(s.split("+").at(-1)))}}#e(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const r=this.buffer.join("+");return this.buffer.length=0,r}exec(e,r){if(!this.allKeys.has(r.key))return;const n=this.callbacks.get(this.#e(r));if(!n)return;const{callback:a,options:{bubbles:i=!1,args:s=[],checker:o=null}}=n;o&&!o(e,r)||(a.bind(e,...s,r)(),i||zi(r))}}class pce{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return e6t(e),Dn(this,"_colors",e)}convert(e){const r=ww(e);if(!window.matchMedia("(forced-colors: active)").matches)return r;for(const[n,a]of this._colors)if(a.every((i,s)=>i===r[s]))return pce._colorsMapping.get(n);return r}getHexCode(e){const r=this._colors.get(e);return r?Er.makeHexColor(...r):e}}class em{#e=new AbortController;#t=null;#n=null;#r=new Map;#s=new Map;#a=null;#i=null;#o=null;#c=new a6t;#l=null;#h=null;#d=null;#f=0;#m=new Set;#p=null;#u=null;#g=new Set;_editorUndoBar=null;#v=!1;#_=!1;#y=!1;#w=null;#T=null;#b=null;#A=null;#S=!1;#x=null;#I=new n6t;#R=!1;#N=!1;#B=!1;#O=null;#L=null;#F=null;#M=null;#H=null;#C=wn.NONE;#E=new Set;#D=null;#U=null;#G=null;#q=null;#W=null;#X={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#z=[0,0];#P=null;#Y=null;#Q=null;#J=null;#$=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const e=em.prototype,r=s=>s.#Y.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&s.hasSomethingToControl(),n=(s,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},a=this.TRANSLATE_SMALL,i=this.TRANSLATE_BIG;return Dn(this,"_keyboardManager",new wk([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],e.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:n}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:n}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(s,{target:o})=>!(o instanceof HTMLButtonElement)&&s.#Y.contains(o)&&!s.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(s,{target:o})=>!(o instanceof HTMLButtonElement)&&s.#Y.contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-a,0],checker:r}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:r}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[a,0],checker:r}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:r}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-a],checker:r}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:r}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,a],checker:r}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:r}]]))}constructor(e,r,n,a,i,s,o,l,u,d,h,f,p,g,m,_){const y=this._signal=this.#e.signal;this.#Y=e,this.#Q=r,this.#J=n,this.#a=a,this.#l=i,this.#U=s,this.#W=l,this._eventBus=o,o._on("editingaction",this.onEditingAction.bind(this),{signal:y}),o._on("pagechanging",this.onPageChanging.bind(this),{signal:y}),o._on("scalechanging",this.onScaleChanging.bind(this),{signal:y}),o._on("rotationchanging",this.onRotationChanging.bind(this),{signal:y}),o._on("setpreference",this.onSetPreference.bind(this),{signal:y}),o._on("switchannotationeditorparams",v=>this.updateParams(v.type,v.value),{signal:y}),window.addEventListener("pointerdown",()=>{this.#N=!0},{capture:!0,signal:y}),window.addEventListener("pointerup",()=>{this.#N=!1},{capture:!0,signal:y}),this.#le(),this.#he(),this.#te(),this.#i=l.annotationStorage,this.#w=l.filterFactory,this.#G=u,this.#A=d||null,this.#v=h,this.#_=f,this.#y=p,this.#H=g||null,this.viewParameters={realScale:yb.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=m||null,this._supportsPinchToZoom=_!==!1,i?.setSidebarUiManager(this)}destroy(){this.#$?.resolve(),this.#$=null,this.#e?.abort(),this.#e=null,this._signal=null;for(const e of this.#s.values())e.destroy();this.#s.clear(),this.#r.clear(),this.#g.clear(),this.#M?.clear(),this.#t=null,this.#E.clear(),this.#c.destroy(),this.#a?.destroy(),this.#l?.destroy(),this.#U?.destroy(),this.#x?.hide(),this.#x=null,this.#F?.destroy(),this.#F=null,this.#n=null,this.#T&&(clearTimeout(this.#T),this.#T=null),this.#P&&(clearTimeout(this.#P),this.#P=null),this._editorUndoBar?.destroy(),this.#W=null}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#H}get useNewAltTextFlow(){return this.#_}get useNewAltTextWhenAddingImage(){return this.#y}get hcmFilter(){return Dn(this,"hcmFilter",this.#G?this.#w.addHCMFilter(this.#G.foreground,this.#G.background):"none")}get direction(){return Dn(this,"direction",getComputedStyle(this.#Y).direction)}get _highlightColors(){return Dn(this,"_highlightColors",this.#A?new Map(this.#A.split(",").map(e=>(e=e.split("=").map(r=>r.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){const{_highlightColors:e}=this;if(!e)return Dn(this,"highlightColors",null);const r=new Map,n=!!this.#G;for(const[a,i]of e){const s=a.endsWith("_HCM");if(n&&s){r.set(a.replace("_HCM",""),i);continue}!n&&!s&&r.set(a,i)}return Dn(this,"highlightColors",r)}get highlightColorNames(){return Dn(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;const r=this.highlightColorNames.get(e);return this._highlightColors.get(r)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),this.#d=e}setMainHighlightColorPicker(e){this.#F=e}editAltText(e,r=!1){this.#a?.editAltText(this,e,r)}hasCommentManager(){return!!this.#l}editComment(e,r,n,a){this.#l?.showDialog(this,e,r,n,a)}selectComment(e,r){this.#s.get(e)?.getEditorByUID(r)?.toggleComment(!0,!0)}updateComment(e){this.#l?.updateComment(e.getData())}updatePopupColor(e){this.#l?.updatePopupColor(e)}removeComment(e){this.#l?.removeComments([e.uid])}toggleComment(e,r,n=void 0){this.#l?.toggleCommentPopup(e,r,n)}makeCommentColor(e,r){return e&&this.#l?.makeCommentColor(e,r)||null}getCommentDialogElement(){return this.#l?.dialogElement||null}async waitForEditorsRendered(e){if(this.#s.has(e-1))return;const{resolve:r,promise:n}=Promise.withResolvers(),a=i=>{i.pageNumber===e&&(this._eventBus._off("editorsrendered",a),r())};this._eventBus.on("editorsrendered",a),await n}getSignature(e){this.#U?.getSignature({uiManager:this,editor:e})}get signatureManager(){return this.#U}switchToMode(e,r){this._eventBus.on("annotationeditormodechanged",r,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,r){this._eventBus.dispatch("setpreference",{source:this,name:e,value:r})}onSetPreference({name:e,value:r}){switch(e){case"enableNewAltTextWhenAddingImage":this.#y=r;break}}onPageChanging({pageNumber:e}){this.#f=e-1}focusMainContainer(){this.#Y.focus()}findParent(e,r){for(const n of this.#s.values()){const{x:a,y:i,width:s,height:o}=n.div.getBoundingClientRect();if(e>=a&&e<=a+s&&r>=i&&r<=i+o)return n}return null}disableUserSelect(e=!1){this.#Q.classList.toggle("noUserSelect",e)}addShouldRescale(e){this.#g.add(e)}removeShouldRescale(e){this.#g.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*yb.PDF_TO_CSS_UNITS;for(const r of this.#g)r.onScaleChanging();this.#d?.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#Z({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#ee(e){const{currentLayer:r}=this;if(r.hasTextLayer(e))return r;for(const n of this.#s.values())if(n.hasTextLayer(e))return n;return null}highlightSelection(e="",r=!1){const n=document.getSelection();if(!n||n.isCollapsed)return;const{anchorNode:a,anchorOffset:i,focusNode:s,focusOffset:o}=n,l=n.toString(),d=this.#Z(n).closest(".textLayer"),h=this.getSelectionBoxes(d);if(!h)return;n.empty();const f=this.#ee(d),p=this.#C===wn.NONE,g=()=>{const m=f?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:h,anchorNode:a,anchorOffset:i,focusNode:s,focusOffset:o,text:l});p&&this.showAllEditors("highlight",!0,!0),r&&m?.editComment()};if(p){this.switchToMode(wn.HIGHLIGHT,g);return}g()}commentSelection(e=""){this.highlightSelection(e,!0)}#se(){const e=document.getSelection();if(!e||e.isCollapsed)return;const n=this.#Z(e).closest(".textLayer"),a=this.getSelectionBoxes(n);a&&(this.#x||=new r6t(this),this.#x.show(n,a,this.direction==="ltr"))}getAndRemoveDataFromAnnotationStorage(e){if(!this.#i)return null;const r=`${UN}${e}`,n=this.#i.getRawValue(r);return n&&this.#i.remove(r),n}addToAnnotationStorage(e){!e.isEmpty()&&this.#i&&!this.#i.has(e.id)&&this.#i.setValue(e.id,e)}a11yAlert(e,r=null){const n=this.#J;n&&(n.setAttribute("data-l10n-id",e),r?n.setAttribute("data-l10n-args",JSON.stringify(r)):n.removeAttribute("data-l10n-args"))}#oe(){const e=document.getSelection();if(!e||e.isCollapsed){this.#D&&(this.#x?.hide(),this.#D=null,this.#k({hasSelectedText:!1}));return}const{anchorNode:r}=e;if(r===this.#D)return;const a=this.#Z(e).closest(".textLayer");if(!a){this.#D&&(this.#x?.hide(),this.#D=null,this.#k({hasSelectedText:!1}));return}if(this.#x?.hide(),this.#D=r,this.#k({hasSelectedText:!0}),!(this.#C!==wn.HIGHLIGHT&&this.#C!==wn.NONE)&&(this.#C===wn.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#S=this.isShiftKeyDown,!this.isShiftKeyDown)){const i=this.#C===wn.HIGHLIGHT?this.#ee(a):null;if(i?.toggleDrawing(),this.#N){const s=new AbortController,o=this.combinedSignal(s),l=u=>{u.type==="pointerup"&&u.button!==0||(s.abort(),i?.toggleDrawing(!0),u.type==="pointerup"&&this.#j("main_toolbar"))};window.addEventListener("pointerup",l,{signal:o}),window.addEventListener("blur",l,{signal:o})}else i?.toggleDrawing(!0),this.#j("main_toolbar")}}#j(e=""){this.#C===wn.HIGHLIGHT?this.highlightSelection(e):this.#v&&this.#se()}#le(){document.addEventListener("selectionchange",this.#oe.bind(this),{signal:this._signal})}#ce(){if(this.#b)return;this.#b=new AbortController;const e=this.combinedSignal(this.#b);window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})}#ue(){this.#b?.abort(),this.#b=null}blur(){if(this.isShiftKeyDown=!1,this.#S&&(this.#S=!1,this.#j("main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const r of this.#E)if(r.div.contains(e)){this.#L=[r,e],r._focusEventsAllowed=!1;break}}focus(){if(!this.#L)return;const[e,r]=this.#L;this.#L=null,r.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),r.focus()}#te(){if(this.#O)return;this.#O=new AbortController;const e=this.combinedSignal(this.#O);window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})}#de(){this.#O?.abort(),this.#O=null}#re(){if(this.#h)return;this.#h=new AbortController;const e=this.combinedSignal(this.#h);document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})}#ne(){this.#h?.abort(),this.#h=null}#he(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})}addEditListeners(){this.#te(),this.#re()}removeEditListeners(){this.#de(),this.#ne()}dragOver(e){for(const{type:r}of e.dataTransfer.items)for(const n of this.#u)if(n.isHandlingMimeForPasting(r)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const r of e.dataTransfer.items)for(const n of this.#u)if(n.isHandlingMimeForPasting(r.type)){n.paste(r,this.currentLayer),e.preventDefault();return}}copy(e){if(e.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;const r=[];for(const n of this.#E){const a=n.serialize(!0);a&&r.push(a)}r.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(r))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:r}=e;for(const i of r.items)for(const s of this.#u)if(s.isHandlingMimeForPasting(i.type)){s.paste(i,this.currentLayer);return}let n=r.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(i){Cn(`paste: "${i.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();const a=this.currentLayer;try{const i=[];for(const l of n){const u=await a.deserialize(l);if(!u)return;i.push(u)}const s=()=>{for(const l of i)this.#ae(l);this.#ie(i)},o=()=>{for(const l of i)l.remove()};this.addCommands({cmd:s,undo:o,mustExec:!0})}catch(i){Cn(`paste: "${i.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),this.#C!==wn.NONE&&!this.isEditorHandlingKeyboard&&em._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,this.#S&&(this.#S=!1,this.#j("main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}#k(e){Object.entries(e).some(([n,a])=>this.#X[n]!==a)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#X,e)}),this.#C===wn.HIGHLIGHT&&e.hasSelectedEditor===!1&&this.#V([[ta.HIGHLIGHT_FREE,!0]]))}#V(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){e?(this.#ce(),this.#re(),this.#k({isEditing:this.#C!==wn.NONE,isEmpty:this.#K(),hasSomethingToUndo:this.#c.hasSomethingToUndo(),hasSomethingToRedo:this.#c.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ue(),this.#ne(),this.#k({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#u){this.#u=e;for(const r of this.#u)this.#V(r.defaultPropertiesToUpdate)}}getId(){return this.#I.id}get currentLayer(){return this.#s.get(this.#f)}getLayer(e){return this.#s.get(e)}get currentPageIndex(){return this.#f}addLayer(e){this.#s.set(e.pageIndex,e),this.#R?e.enable():e.disable()}removeLayer(e){this.#s.delete(e.pageIndex)}async updateMode(e,r=null,n=!1,a=!1,i=!1){if(this.#C!==e&&!(this.#$&&(await this.#$.promise,!this.#$))){if(this.#$=Promise.withResolvers(),this.#d?.commitOrRemove(),this.#C===wn.POPUP&&this.#l?.hideSidebar(),this.#l?.destroyPopup(),this.#C=e,e===wn.NONE){this.setEditingState(!1),this.#pe();for(const s of this.#r.values())s.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#$.resolve();return}for(const s of this.#r.values())s.addStandaloneCommentButton();e===wn.SIGNATURE&&await this.#U?.loadSignatures(),this.setEditingState(!0),await this.#fe(),this.unselectAll();for(const s of this.#s.values())s.updateMode(e);if(e===wn.POPUP){this.#n||=await this.#W.getAnnotationsByType(new Set(this.#u.map(l=>l._editorType)));const s=new Set,o=[];for(const l of this.#r.values()){const{annotationElementId:u,hasComment:d,deleted:h}=l;u&&s.add(u),d&&!h&&o.push(l.getData())}for(const l of this.#n){const{id:u,popupRef:d,contentsObj:h}=l;d&&h?.str&&!s.has(u)&&!this.#m.has(u)&&o.push(l)}this.#l?.showSidebar(o)}if(!r){n&&this.addNewEditorFromKeyboard(),this.#$.resolve();return}for(const s of this.#r.values())s.uid===r?(this.setSelected(s),i?s.editComment():a?s.enterInEditMode():s.focus()):s.unselect();this.#$.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==this.#C&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,r){if(this.#u){switch(e){case ta.CREATE:this.currentLayer.addNewEditor(r);return;case ta.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#q||=new Map).set(e,r),this.showAllEditors("highlight",r);break}if(this.hasSelection)for(const n of this.#E)n.updateParams(e,r);else for(const n of this.#u)n.updateDefaultParams(e,r)}}showAllEditors(e,r,n=!1){for(const i of this.#r.values())i.editorType===e&&i.show(r);(this.#q?.get(ta.HIGHLIGHT_SHOW_ALL)??!0)!==r&&this.#V([[ta.HIGHLIGHT_SHOW_ALL,r]])}enableWaiting(e=!1){if(this.#B!==e){this.#B=e;for(const r of this.#s.values())e?r.disableClick():r.enableClick(),r.div.classList.toggle("waiting",e)}}async#fe(){if(!this.#R){this.#R=!0;const e=[];for(const r of this.#s.values())e.push(r.enable());await Promise.all(e);for(const r of this.#r.values())r.enable()}}#pe(){if(this.unselectAll(),this.#R){this.#R=!1;for(const e of this.#s.values())e.disable();for(const e of this.#r.values())e.disable()}}*getEditors(e){for(const r of this.#r.values())r.pageIndex===e&&(yield r)}getEditor(e){return this.#r.get(e)}addEditor(e){this.#r.set(e.id,e)}removeEditor(e){e.div.contains(document.activeElement)&&(this.#T&&clearTimeout(this.#T),this.#T=setTimeout(()=>{this.focusMainContainer(),this.#T=null},0)),this.#r.delete(e.id),e.annotationElementId&&this.#M?.delete(e.annotationElementId),this.unselect(e),(!e.annotationElementId||!this.#m.has(e.annotationElementId))&&this.#i?.remove(e.id)}addDeletedAnnotationElement(e){this.#m.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#m.has(e)}removeDeletedAnnotationElement(e){this.#m.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#ae(e){const r=this.#s.get(e.pageIndex);r?r.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}setActiveEditor(e){this.#t!==e&&(this.#t=e,e&&this.#V(e.propertiesToUpdate))}get#ge(){let e=null;for(e of this.#E);return e}updateUI(e){this.#ge===e&&this.#V(e.propertiesToUpdate)}updateUIForDefaultProperties(e){this.#V(e.defaultPropertiesToUpdate)}toggleSelected(e){if(this.#E.has(e)){this.#E.delete(e),e.unselect(),this.#k({hasSelectedEditor:this.hasSelection});return}this.#E.add(e),e.select(),this.#V(e.propertiesToUpdate),this.#k({hasSelectedEditor:!0})}setSelected(e){this.updateToolbar({mode:e.mode,editId:e.id}),this.#d?.commitOrRemove();for(const r of this.#E)r!==e&&r.unselect();this.#E.clear(),this.#E.add(e),e.select(),this.#V(e.propertiesToUpdate),this.#k({hasSelectedEditor:!0})}isSelected(e){return this.#E.has(e)}get firstSelectedEditor(){return this.#E.values().next().value}unselect(e){e.unselect(),this.#E.delete(e),this.#k({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#E.size!==0}get isEnterHandled(){return this.#E.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#c.undo(),this.#k({hasSomethingToUndo:this.#c.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#K()}),this._editorUndoBar?.hide()}redo(){this.#c.redo(),this.#k({hasSomethingToUndo:!0,hasSomethingToRedo:this.#c.hasSomethingToRedo(),isEmpty:this.#K()})}addCommands(e){this.#c.add(e),this.#k({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#K()})}cleanUndoStack(e){this.#c.cleanType(e)}#K(){if(this.#r.size===0)return!0;if(this.#r.size===1)for(const e of this.#r.values())return e.isEmpty();return!1}delete(){this.commitOrRemove();const e=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const r=e?[e]:[...this.#E],n=()=>{this._editorUndoBar?.show(a,r.length===1?r[0].editorType:r.length);for(const i of r)i.remove()},a=()=>{for(const i of r)this.#ae(i)};this.addCommands({cmd:n,undo:a,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#ie(e){for(const r of this.#E)r.unselect();this.#E.clear();for(const r of e)r.isEmpty()||(this.#E.add(r),r.select());this.#k({hasSelectedEditor:this.hasSelection})}selectAll(){for(const e of this.#E)e.commit();this.#ie(this.#r.values())}unselectAll(){if(!(this.#t&&(this.#t.commitOrRemove(),this.#C!==wn.NONE))&&!this.#d?.commitOrRemove()&&this.hasSelection){for(const e of this.#E)e.unselect();this.#E.clear(),this.#k({hasSelectedEditor:!1})}}translateSelectedEditors(e,r,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#z[0]+=e,this.#z[1]+=r;const[a,i]=this.#z,s=[...this.#E],o=1e3;this.#P&&clearTimeout(this.#P),this.#P=setTimeout(()=>{this.#P=null,this.#z[0]=this.#z[1]=0,this.addCommands({cmd:()=>{for(const l of s)this.#r.has(l.id)&&(l.translateInPage(a,i),l.translationDone())},undo:()=>{for(const l of s)this.#r.has(l.id)&&(l.translateInPage(-a,-i),l.translationDone())},mustExec:!1})},o);for(const l of s)l.translateInPage(e,r),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#p=new Map;for(const e of this.#E)this.#p.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#p)return!1;this.disableUserSelect(!1);const e=this.#p;this.#p=null;let r=!1;for(const[{x:a,y:i,pageIndex:s},o]of e)o.newX=a,o.newY=i,o.newPageIndex=s,r||=a!==o.savedX||i!==o.savedY||s!==o.savedPageIndex;if(!r)return!1;const n=(a,i,s,o)=>{if(this.#r.has(a.id)){const l=this.#s.get(o);l?a._setParentAndPosition(l,i,s):(a.pageIndex=o,a.x=i,a.y=s)}};return this.addCommands({cmd:()=>{for(const[a,{newX:i,newY:s,newPageIndex:o}]of e)n(a,i,s,o)},undo:()=>{for(const[a,{savedX:i,savedY:s,savedPageIndex:o}]of e)n(a,i,s,o)},mustExec:!0}),!0}dragSelectedEditors(e,r){if(this.#p)for(const n of this.#p.keys())n.drag(e,r)}rebuild(e){if(e.parent===null){const r=this.getLayer(e.pageIndex);r?(r.changeParent(e),r.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#E.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#t===e}getActive(){return this.#t}getMode(){return this.#C}isEditingMode(){return this.#C!==wn.NONE}get imageManager(){return Dn(this,"imageManager",new fce)}getSelectionBoxes(e){if(!e)return null;const r=document.getSelection();for(let u=0,d=r.rangeCount;u<d;u++)if(!e.contains(r.getRangeAt(u).commonAncestorContainer))return null;const{x:n,y:a,width:i,height:s}=e.getBoundingClientRect();let o;switch(e.getAttribute("data-main-rotation")){case"90":o=(u,d,h,f)=>({x:(d-a)/s,y:1-(u+h-n)/i,width:f/s,height:h/i});break;case"180":o=(u,d,h,f)=>({x:1-(u+h-n)/i,y:1-(d+f-a)/s,width:h/i,height:f/s});break;case"270":o=(u,d,h,f)=>({x:1-(d+f-a)/s,y:(u-n)/i,width:f/s,height:h/i});break;default:o=(u,d,h,f)=>({x:(u-n)/i,y:(d-a)/s,width:h/i,height:f/s});break}const l=[];for(let u=0,d=r.rangeCount;u<d;u++){const h=r.getRangeAt(u);if(!h.collapsed)for(const{x:f,y:p,width:g,height:m}of h.getClientRects())g===0||m===0||l.push(o(f,p,g,m))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:e,id:r}){(this.#o||=new Map).set(e,r)}removeChangedExistingAnnotation({annotationElementId:e}){this.#o?.delete(e)}renderAnnotationElement(e){const r=this.#o?.get(e.data.id);if(!r)return;const n=this.#i.getRawValue(r);n&&(this.#C===wn.NONE&&!n.hasBeenModified||n.renderAnnotationElement(e))}setMissingCanvas(e,r,n){const a=this.#M?.get(e);a&&(a.setCanvas(r,n),this.#M.delete(e))}addMissingCanvas(e,r){(this.#M||=new Map).set(e,r)}}class Bf{#e=null;#t=!1;#n=null;#r=null;#s=null;#a=null;#i=!1;#o=null;#c=null;#l=null;#h=null;#d=!1;static#f=null;static _l10n=null;constructor(e){this.#c=e,this.#d=e._uiManager.useNewAltTextFlow,Bf.#f||=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"})}static initialize(e){Bf._l10n??=e}async render(){const e=this.#n=document.createElement("button");e.className="altText",e.tabIndex="0";const r=this.#r=document.createElement("span");e.append(r),this.#d?(e.classList.add("new"),e.setAttribute("data-l10n-id",Bf.#f.missing),r.setAttribute("data-l10n-id",Bf.#f["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),r.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const n=this.#c._uiManager._signal;e.addEventListener("contextmenu",Gu,{signal:n}),e.addEventListener("pointerdown",i=>i.stopPropagation(),{signal:n});const a=i=>{i.preventDefault(),this.#c._uiManager.editAltText(this.#c),this.#d&&this.#c._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#m}})};return e.addEventListener("click",a,{capture:!0,signal:n}),e.addEventListener("keydown",i=>{i.target===e&&i.key==="Enter"&&(this.#i=!0,a(i))},{signal:n}),await this.#p(),e}get#m(){return this.#e&&"added"||this.#e===null&&this.guessedText&&"review"||"missing"}finish(){this.#n&&(this.#n.focus({focusVisible:this.#i}),this.#i=!1)}isEmpty(){return this.#d?this.#e===null:!this.#e&&!this.#t}hasData(){return this.#d?this.#e!==null||!!this.#l:this.isEmpty()}get guessedText(){return this.#l}async setGuessedText(e){this.#e===null&&(this.#l=e,this.#h=await Bf._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e}),this.#p())}toggleAltTextBadge(e=!1){if(!this.#d||this.#e){this.#o?.remove(),this.#o=null;return}if(!this.#o){const r=this.#o=document.createElement("div");r.className="noAltTextBadge",this.#c.div.append(r)}this.#o.classList.toggle("hidden",!e)}serialize(e){let r=this.#e;return!e&&this.#l===r&&(r=this.#h),{altText:r,decorative:this.#t,guessedText:this.#l,textWithDisclaimer:this.#h}}get data(){return{altText:this.#e,decorative:this.#t}}set data({altText:e,decorative:r,guessedText:n,textWithDisclaimer:a,cancel:i=!1}){n&&(this.#l=n,this.#h=a),!(this.#e===e&&this.#t===r)&&(i||(this.#e=e,this.#t=r),this.#p())}toggle(e=!1){this.#n&&(!e&&this.#a&&(clearTimeout(this.#a),this.#a=null),this.#n.disabled=!e)}shown(){this.#c._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#m}})}destroy(){this.#n?.remove(),this.#n=null,this.#r=null,this.#s=null,this.#o?.remove(),this.#o=null}async#p(){const e=this.#n;if(!e)return;if(this.#d){if(e.classList.toggle("done",!!this.#e),e.setAttribute("data-l10n-id",Bf.#f[this.#m]),this.#r?.setAttribute("data-l10n-id",Bf.#f[`${this.#m}-label`]),!this.#e){this.#s?.remove();return}}else{if(!this.#e&&!this.#t){e.classList.remove("done"),this.#s?.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let r=this.#s;if(!r){this.#s=r=document.createElement("span"),r.className="tooltip",r.setAttribute("role","tooltip"),r.id=`alt-text-tooltip-${this.#c.id}`;const a=100,i=this.#c._uiManager._signal;i.addEventListener("abort",()=>{clearTimeout(this.#a),this.#a=null},{once:!0}),e.addEventListener("mouseenter",()=>{this.#a=setTimeout(()=>{this.#a=null,this.#s.classList.add("show"),this.#c._reportTelemetry({action:"alt_text_tooltip"})},a)},{signal:i}),e.addEventListener("mouseleave",()=>{this.#a&&(clearTimeout(this.#a),this.#a=null),this.#s?.classList.remove("show")},{signal:i})}this.#t?r.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(r.removeAttribute("data-l10n-id"),r.textContent=this.#e),r.parentNode||e.append(r),this.#c.getElementForAltText()?.setAttribute("aria-describedby",r.id)}}class aL{#e=null;#t=null;#n=!1;#r=null;#s=null;#a=null;#i=null;#o=null;#c=!1;#l=null;constructor(e){this.#r=e}renderForToolbar(){const e=this.#t=document.createElement("button");return e.className="comment",this.#h(e,!1)}renderForStandalone(){const e=this.#e=document.createElement("button");e.className="annotationCommentButton";const r=this.#r.commentButtonPosition;if(r){const{style:n}=e;n.insetInlineEnd=`calc(${100*(this.#r._uiManager.direction==="ltr"?1-r[0]:r[0])}% - var(--comment-button-dim))`,n.top=`calc(${100*r[1]}% - var(--comment-button-dim))`;const a=this.#r.commentButtonColor;a&&(n.backgroundColor=a)}return this.#h(e,!0)}focusButton(){setTimeout(()=>{(this.#e??this.#t)?.focus()},0)}onUpdatedColor(){if(!this.#e)return;const e=this.#r.commentButtonColor;e&&(this.#e.style.backgroundColor=e),this.#r._uiManager.updatePopupColor(this.#r)}get commentButtonWidth(){return(this.#e?.getBoundingClientRect().width??0)/this.#r.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#l)return this.#l;if(!this.#e)return null;const{x:e,y:r,height:n}=this.#e.getBoundingClientRect(),{x:a,y:i,width:s,height:o}=this.#r.parent.boundingClientRect;return[(e-a)/s,(r+n-i)/o]}set commentPopupPositionInLayer(e){this.#l=e}hasDefaultPopupPosition(){return this.#l===null}removeStandaloneCommentButton(){this.#e?.remove(),this.#e=null}removeToolbarCommentButton(){this.#t?.remove(),this.#t=null}setCommentButtonStates({selected:e,hasPopup:r}){this.#e&&(this.#e.classList.toggle("selected",e),this.#e.ariaExpanded=r)}#h(e,r){if(!this.#r._uiManager.hasCommentManager())return null;e.tabIndex="0",e.ariaHasPopup="dialog",r?(e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(e.ariaControlsElements=[this.#r._uiManager.getCommentDialogElement()],e.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-button"));const n=this.#r._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return e;e.addEventListener("contextmenu",Gu,{signal:n}),r&&(e.addEventListener("focusin",i=>{this.#r._focusEventsAllowed=!1,zi(i)},{capture:!0,signal:n}),e.addEventListener("focusout",i=>{this.#r._focusEventsAllowed=!0,zi(i)},{capture:!0,signal:n})),e.addEventListener("pointerdown",i=>i.stopPropagation(),{signal:n});const a=i=>{i.preventDefault(),e===this.#t?this.edit():this.#r.toggleComment(!0)};return e.addEventListener("click",a,{capture:!0,signal:n}),e.addEventListener("keydown",i=>{i.target===e&&i.key==="Enter"&&(this.#n=!0,a(i))},{signal:n}),e.addEventListener("pointerenter",()=>{this.#r.toggleComment(!1,!0)},{signal:n}),e.addEventListener("pointerleave",()=>{this.#r.toggleComment(!1,!1)},{signal:n}),e}edit(e){const r=this.commentPopupPositionInLayer;let n,a;if(r)[n,a]=r;else{[n,a]=this.#r.commentButtonPosition;const{width:d,height:h,x:f,y:p}=this.#r;n=f+n*d,a=p+a*h}const i=this.#r.parent.boundingClientRect,{x:s,y:o,width:l,height:u}=i;this.#r._uiManager.editComment(this.#r,s+n*l,o+a*u,{...e,parentDimensions:i})}finish(){this.#t&&(this.#t.focus({focusVisible:this.#n}),this.#n=!1)}isDeleted(){return this.#c||this.#i===""}isEmpty(){return this.#i===null}hasBeenEdited(){return this.isDeleted()||this.#i!==this.#s}serialize(){return this.data}get data(){return{text:this.#i,richText:this.#a,date:this.#o,deleted:this.isDeleted()}}set data(e){if(e!==this.#i&&(this.#a=null),e===null){this.#i="",this.#c=!0;return}this.#i=e,this.#o=new Date,this.#c=!1}setInitialText(e,r=null){this.#s=e,this.data=e,this.#o=null,this.#a=r}shown(){}destroy(){this.#t?.remove(),this.#t=null,this.#e?.remove(),this.#e=null,this.#i="",this.#a=null,this.#o=null,this.#r=null,this.#n=!1,this.#c=!1}}class Ck{#e;#t=!1;#n=null;#r;#s;#a;#i;#o=null;#c;#l=null;#h;#d=null;constructor({container:e,isPinchingDisabled:r=null,isPinchingStopped:n=null,onPinchStart:a=null,onPinching:i=null,onPinchEnd:s=null,signal:o}){this.#e=e,this.#n=n,this.#r=r,this.#s=a,this.#a=i,this.#i=s,this.#h=new AbortController,this.#c=AbortSignal.any([o,this.#h.signal]),e.addEventListener("touchstart",this.#f.bind(this),{passive:!1,signal:this.#c})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Xh.pixelRatio}#f(e){if(this.#r?.())return;if(e.touches.length===1){if(this.#o)return;const a=this.#o=new AbortController,i=AbortSignal.any([this.#c,a.signal]),s=this.#e,o={capture:!0,signal:i,passive:!1},l=u=>{u.pointerType==="touch"&&(this.#o?.abort(),this.#o=null)};s.addEventListener("pointerdown",u=>{u.pointerType==="touch"&&(zi(u),l(u))},o),s.addEventListener("pointerup",l,o),s.addEventListener("pointercancel",l,o);return}if(!this.#d){this.#d=new AbortController;const a=AbortSignal.any([this.#c,this.#d.signal]),i=this.#e,s={signal:a,capture:!1,passive:!1};i.addEventListener("touchmove",this.#m.bind(this),s);const o=this.#p.bind(this);i.addEventListener("touchend",o,s),i.addEventListener("touchcancel",o,s),s.capture=!0,i.addEventListener("pointerdown",zi,s),i.addEventListener("pointermove",zi,s),i.addEventListener("pointercancel",zi,s),i.addEventListener("pointerup",zi,s),this.#s?.()}if(zi(e),e.touches.length!==2||this.#n?.()){this.#l=null;return}let[r,n]=e.touches;r.identifier>n.identifier&&([r,n]=[n,r]),this.#l={touch0X:r.screenX,touch0Y:r.screenY,touch1X:n.screenX,touch1Y:n.screenY}}#m(e){if(!this.#l||e.touches.length!==2)return;zi(e);let[r,n]=e.touches;r.identifier>n.identifier&&([r,n]=[n,r]);const{screenX:a,screenY:i}=r,{screenX:s,screenY:o}=n,l=this.#l,{touch0X:u,touch0Y:d,touch1X:h,touch1Y:f}=l,p=h-u,g=f-d,m=s-a,_=o-i,y=Math.hypot(m,_)||1,v=Math.hypot(p,g)||1;if(!this.#t&&Math.abs(v-y)<=Ck.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=a,l.touch0Y=i,l.touch1X=s,l.touch1Y=o,!this.#t){this.#t=!0;return}const b=[(a+s)/2,(i+o)/2];this.#a?.(b,v,y)}#p(e){e.touches.length>=2||(this.#d&&(this.#d.abort(),this.#d=null,this.#i?.()),this.#l&&(zi(e),this.#l=null,this.#t=!1))}destroy(){this.#h?.abort(),this.#h=null,this.#o?.abort(),this.#o=null}}class Hr{#e=null;#t=null;#n=null;#r=null;#s=null;#a=!1;#i=null;#o="";#c=null;#l=null;#h=null;#d=null;#f=null;#m="";#p=!1;#u=null;#g=!1;#v=!1;#_=!1;#y=null;#w=0;#T=0;#b=null;#A=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nResizer=null;#S=!1;#x=Hr._zIndex++;static _borderLineWidth=-1;static _colorManager=new pce;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const e=Hr.prototype._resizeWithKeyboard,r=em.TRANSLATE_SMALL,n=em.TRANSLATE_BIG;return Dn(this,"_resizerKeyboardManager",new wk([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-r,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[r,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-r]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,r]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,n]}],[["Escape","mac+Escape"],Hr.prototype._stopResizingWithKeyboard]]))}constructor(e){this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null,this.annotationElementId=e.annotationElementId||null,this.creationDate=e.creationDate||new Date,this.modificationDate=e.modificationDate||null;const{rotation:r,rawDims:{pageWidth:n,pageHeight:a,pageX:i,pageY:s}}=this.parent.viewport;this.rotation=r,this.pageRotation=(360+r-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,a],this.pageTranslation=[i,s];const[o,l]=this.parentDimensions;this.x=e.x/o,this.y=e.y/l,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return Dn(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const r=new i6t({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});r.annotationElementId=e.annotationElementId,r.deleted=!0,r._uiManager.addToAnnotationStorage(r)}static initialize(e,r){if(Hr._l10n??=e,Hr._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"}),Hr._borderLineWidth!==-1)return;const n=getComputedStyle(document.documentElement);Hr._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,r){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,r){ti("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#S}set _isDraggable(e){this.#S=e,this.div?.classList.toggle("draggable",e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){const[e,r]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*r/(e*2),this.y+=this.width*e/(r*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*r/(e*2),this.y-=this.width*e/(r*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#x}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):(this.#P(),this.#d?.remove(),this.#d=null),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#p?this.#p=!1:this.parent.setSelected(this))}focusout(e){!this._focusEventsAllowed||!this.isAttachedToDOM||e.relatedTarget?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,r,n,a){const[i,s]=this.parentDimensions;[n,a]=this.screenToPageTranslation(n,a),this.x=(e+n)/i,this.y=(r+a)/s,this.fixAndSetPosition()}_moveAfterPaste(e,r){const[n,a]=this.parentDimensions;this.setAt(e*n,r*a,this.width*n,this.height*a),this._onTranslated()}#I([e,r],n,a){[n,a]=this.screenToPageTranslation(n,a),this.x+=n/e,this.y+=a/r,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(e,r){this.#I(this.parentDimensions,e,r)}translateInPage(e,r){this.#u||=[this.x,this.y,this.width,this.height],this.#I(this.pageDimensions,e,r),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,r){this.#u||=[this.x,this.y,this.width,this.height];const{div:n,parentDimensions:[a,i]}=this;if(this.x+=e/a,this.y+=r/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:h,y:f}=this.div.getBoundingClientRect();this.parent.findNewParent(this,h,f)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:s,y:o}=this;const[l,u]=this.getBaseTranslation();s+=l,o+=u;const{style:d}=n;d.left=`${(100*s).toFixed(2)}%`,d.top=`${(100*o).toFixed(2)}%`,this._onTranslating(s,o),n.scrollIntoView({block:"nearest"})}_onTranslating(e,r){}_onTranslated(e,r){}get _hasBeenMoved(){return!!this.#u&&(this.#u[0]!==this.x||this.#u[1]!==this.y)}get _hasBeenResized(){return!!this.#u&&(this.#u[2]!==this.width||this.#u[3]!==this.height)}getBaseTranslation(){const[e,r]=this.parentDimensions,{_borderLineWidth:n}=Hr,a=n/e,i=n/r;switch(this.rotation){case 90:return[-a,i];case 180:return[a,i];case 270:return[a,-i];default:return[-a,-i]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:r},pageDimensions:[n,a]}=this;let{x:i,y:s,width:o,height:l}=this;if(o*=n,l*=a,i*=n,s*=a,this._mustFixPosition)switch(e){case 0:i=bl(i,0,n-o),s=bl(s,0,a-l);break;case 90:i=bl(i,0,n-l),s=bl(s,o,a);break;case 180:i=bl(i,o,n),s=bl(s,l,a);break;case 270:i=bl(i,l,n),s=bl(s,0,a-o);break}this.x=i/=n,this.y=s/=a;const[u,d]=this.getBaseTranslation();i+=u,s+=d,r.left=`${(100*i).toFixed(2)}%`,r.top=`${(100*s).toFixed(2)}%`,this.moveInDOM()}static#R(e,r,n){switch(n){case 90:return[r,-e];case 180:return[-e,-r];case 270:return[-r,e];default:return[e,r]}}screenToPageTranslation(e,r){return Hr.#R(e,r,this.parentRotation)}pageTranslationToScreen(e,r){return Hr.#R(e,r,360-this.parentRotation)}#N(e){switch(e){case 90:{const[r,n]=this.pageDimensions;return[0,-r/n,n/r,0]}case 180:return[-1,0,0,-1];case 270:{const[r,n]=this.pageDimensions;return[0,r/n,-n/r,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[r,n]}=this;return[r*e,n*e]}setDims(){const{div:{style:e},width:r,height:n}=this;e.width=`${(100*r).toFixed(2)}%`,e.height=`${(100*n).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#B(){if(this.#c)return;this.#c=document.createElement("div"),this.#c.classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],r=this._uiManager._signal;for(const n of e){const a=document.createElement("div");this.#c.append(a),a.classList.add("resizer",n),a.setAttribute("data-resizer-name",n),a.addEventListener("pointerdown",this.#O.bind(this,n),{signal:r}),a.addEventListener("contextmenu",Gu,{signal:r}),a.tabIndex=-1}this.div.prepend(this.#c)}#O(e,r){r.preventDefault();const{isMac:n}=Ao.platform;if(r.button!==0||r.ctrlKey&&n)return;this.#n?.toggle(!1);const a=this._isDraggable;this._isDraggable=!1,this.#l=[r.screenX,r.screenY];const i=new AbortController,s=this._uiManager.combinedSignal(i);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#M.bind(this,e),{passive:!0,capture:!0,signal:s}),window.addEventListener("touchmove",zi,{passive:!1,signal:s}),window.addEventListener("contextmenu",Gu,{signal:s}),this.#h={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const o=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(r.target).cursor;const u=()=>{i.abort(),this.parent.togglePointerEvents(!0),this.#n?.toggle(!0),this._isDraggable=a,this.parent.div.style.cursor=o,this.div.style.cursor=l,this.#F()};window.addEventListener("pointerup",u,{signal:s}),window.addEventListener("blur",u,{signal:s})}#L(e,r,n,a){this.width=n,this.height=a,this.x=e,this.y=r,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#F(){if(!this.#h)return;const{savedX:e,savedY:r,savedWidth:n,savedHeight:a}=this.#h;this.#h=null;const i=this.x,s=this.y,o=this.width,l=this.height;i===e&&s===r&&o===n&&l===a||this.addCommands({cmd:this.#L.bind(this,i,s,o,l),undo:this.#L.bind(this,e,r,n,a),mustExec:!0})}static _round(e){return Math.round(e*1e4)/1e4}#M(e,r){const[n,a]=this.parentDimensions,i=this.x,s=this.y,o=this.width,l=this.height,u=Hr.MIN_SIZE/n,d=Hr.MIN_SIZE/a,h=this.#N(this.rotation),f=(M,B)=>[h[0]*M+h[2]*B,h[1]*M+h[3]*B],p=this.#N(360-this.rotation),g=(M,B)=>[p[0]*M+p[2]*B,p[1]*M+p[3]*B];let m,_,y=!1,v=!1;switch(e){case"topLeft":y=!0,m=(M,B)=>[0,0],_=(M,B)=>[M,B];break;case"topMiddle":m=(M,B)=>[M/2,0],_=(M,B)=>[M/2,B];break;case"topRight":y=!0,m=(M,B)=>[M,0],_=(M,B)=>[0,B];break;case"middleRight":v=!0,m=(M,B)=>[M,B/2],_=(M,B)=>[0,B/2];break;case"bottomRight":y=!0,m=(M,B)=>[M,B],_=(M,B)=>[0,0];break;case"bottomMiddle":m=(M,B)=>[M/2,B],_=(M,B)=>[M/2,0];break;case"bottomLeft":y=!0,m=(M,B)=>[0,B],_=(M,B)=>[M,0];break;case"middleLeft":v=!0,m=(M,B)=>[0,B/2],_=(M,B)=>[M,B/2];break}const b=m(o,l),E=_(o,l);let S=f(...E);const T=Hr._round(i+S[0]),x=Hr._round(s+S[1]);let w=1,C=1,R,N;if(r.fromKeyboard)({deltaX:R,deltaY:N}=r);else{const{screenX:M,screenY:B}=r,[F,U]=this.#l;[R,N]=this.screenToPageTranslation(M-F,B-U),this.#l[0]=M,this.#l[1]=B}if([R,N]=g(R/n,N/a),y){const M=Math.hypot(o,l);w=C=Math.max(Math.min(Math.hypot(E[0]-b[0]-R,E[1]-b[1]-N)/M,1/o,1/l),u/o,d/l)}else v?w=bl(Math.abs(E[0]-b[0]-R),u,1)/o:C=bl(Math.abs(E[1]-b[1]-N),d,1)/l;const k=Hr._round(o*w),L=Hr._round(l*C);S=f(..._(k,L));const A=T-S[0],D=x-S[1];this.#u||=[this.x,this.y,this.width,this.height],this.width=k,this.height=L,this.x=A,this.y=D,this.setDims(),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#n?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#v)return this._editToolbar;this._editToolbar=new FR(this),this.div.append(this._editToolbar.render());const{toolbarButtons:e}=this;if(e)for(const[r,n]of e)await this._editToolbar.addButton(r,n);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton("comment")}removeEditToolbar(){this._editToolbar?.remove(),this._editToolbar=null,this.#n?.destroy()}addContainer(e){const r=this._editToolbar?.div;r?r.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return this.#n||(Bf.initialize(Hr._l10n),this.#n=new Bf(this),this.#e&&(this.#n.data=this.#e,this.#e=null)),this.#n}get altTextData(){return this.#n?.data}set altTextData(e){this.#n&&(this.#n.data=e)}get guessedAltText(){return this.#n?.guessedText}async setGuessedAltText(e){await this.#n?.setGuessedText(e)}serializeAltText(e){return this.#n?.serialize(e)}hasAltText(){return!!this.#n&&!this.#n.isEmpty()}hasAltTextData(){return this.#n?.hasData()??!1}focusCommentButton(){this.#r?.focusButton()}addCommentButton(){return this.#r||=new aL(this)}addStandaloneCommentButton(){if(this.#s){this._uiManager.isEditingMode()&&this.#s.classList.remove("hidden");return}this.hasComment&&(this.#s=this.#r.renderForStandalone(),this.div.append(this.#s))}removeStandaloneCommentButton(){this.#r.removeStandaloneCommentButton(),this.#s=null}hideStandaloneCommentButton(){this.#s?.classList.add("hidden")}get comment(){const{data:{richText:e,text:r,date:n,deleted:a}}=this.#r;return{text:r,richText:e,date:n,deleted:a,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){this.#r||=new aL(this),this.#r.data=e,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:e,popupRef:r,richText:n}){if(!r||(this.#r||=new aL(this),this.#r.setInitialText(e,n),!this.annotationElementId))return;const a=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);a&&this.updateFromAnnotationLayer(a)}get hasEditedComment(){return this.#r?.hasBeenEdited()}get hasDeletedComment(){return this.#r?.isDeleted()}get hasComment(){return!!this.#r&&!this.#r.isEmpty()&&!this.#r.isDeleted()}async editComment(e){this.#r||=new aL(this),this.#r.edit(e)}toggleComment(e,r=void 0){this.hasComment&&this._uiManager.toggleComment(this,e,r)}setSelectedCommentButton(e){this.#r.setSelectedButton(e)}addComment(e){if(this.hasEditedComment){const[,,,a]=e.rect,[i]=this.pageDimensions,[s]=this.pageTranslation,o=s+i+1,l=a-100,u=o+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[o,l,u,a]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:r}}){this.#r.data=r?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){const e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=this.#a?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),this.#G();const[r,n]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth=`${(100*n/r).toFixed(2)}%`,e.style.maxHeight=`${(100*r/n).toFixed(2)}%`);const[a,i]=this.getInitialTranslation();return this.translate(a,i),GGe(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(this.#A||=new Ck({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#H.bind(this),onPinching:this.#C.bind(this),onPinchEnd:this.#E.bind(this),signal:this._uiManager._signal})),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),e}#H(){this.#h={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#n?.toggle(!1),this.parent.togglePointerEvents(!1)}#C(e,r,n){let i=.7*(n/r)+1-.7;if(i===1)return;const s=this.#N(this.rotation),o=(T,x)=>[s[0]*T+s[2]*x,s[1]*T+s[3]*x],[l,u]=this.parentDimensions,d=this.x,h=this.y,f=this.width,p=this.height,g=Hr.MIN_SIZE/l,m=Hr.MIN_SIZE/u;i=Math.max(Math.min(i,1/f,1/p),g/f,m/p);const _=Hr._round(f*i),y=Hr._round(p*i);if(_===f&&y===p)return;this.#u||=[d,h,f,p];const v=o(f/2,p/2),b=Hr._round(d+v[0]),E=Hr._round(h+v[1]),S=o(_/2,y/2);this.x=b-S[0],this.y=E-S[1],this.width=_,this.height=y,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#E(){this.#n?.toggle(!0),this.parent.togglePointerEvents(!0),this.#F()}pointerdown(e){const{isMac:r}=Ao.platform;if(e.button!==0||e.ctrlKey&&r){e.preventDefault();return}if(this.#p=!0,this._isDraggable){this.#U(e);return}this.#D(e)}#D(e){const{isMac:r}=Ao.platform;e.ctrlKey&&!r||e.shiftKey||e.metaKey&&r?this.parent.toggleSelected(this):this.parent.setSelected(this)}#U(e){const{isSelected:r}=this;this._uiManager.setUpDragSession();let n=!1;const a=new AbortController,i=this._uiManager.combinedSignal(a),s={capture:!0,passive:!1,signal:i},o=u=>{a.abort(),this.#i=null,this.#p=!1,this._uiManager.endDragSession()||this.#D(u),n&&this._onStopDragging()};r&&(this.#w=e.clientX,this.#T=e.clientY,this.#i=e.pointerId,this.#o=e.pointerType,window.addEventListener("pointermove",u=>{n||(n=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:d,clientY:h,pointerId:f}=u;if(f!==this.#i){zi(u);return}const[p,g]=this.screenToPageTranslation(d-this.#w,h-this.#T);this.#w=d,this.#T=h,this._uiManager.dragSelectedEditors(p,g)},s),window.addEventListener("touchmove",zi,s),window.addEventListener("pointerdown",u=>{u.pointerType===this.#o&&(this.#A||u.isPrimary)&&o(u),zi(u)},s));const l=u=>{if(!this.#i||this.#i===u.pointerId){o(u);return}zi(u)};window.addEventListener("pointerup",l,{signal:i}),window.addEventListener("blur",l,{signal:i})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(e,r,n){e.changeParent(this),this.x=r,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(e,r,n=this.rotation){const a=this.parentScale,[i,s]=this.pageDimensions,[o,l]=this.pageTranslation,u=e/a,d=r/a,h=this.x*i,f=this.y*s,p=this.width*i,g=this.height*s;switch(n){case 0:return[h+u+o,s-f-d-g+l,h+u+p+o,s-f-d+l];case 90:return[h+d+o,s-f+u+l,h+d+g+o,s-f+u+p+l];case 180:return[h-u-p+o,s-f+d+l,h-u+o,s-f+d+g+l];case 270:return[h-d-g+o,s-f-u-p+l,h-d+o,s-f-u+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,r){const[n,a,i,s]=e,o=i-n,l=s-a;switch(this.rotation){case 0:return[n,r-s,o,l];case 90:return[n,r-a,l,o];case 180:return[i,r-a,o,l];case 270:return[i,r-s,l,o];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&Hr._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#r?.onUpdatedColor()}getData(){const{comment:{text:e,color:r,date:n,opacity:a,deleted:i,richText:s},uid:o,pageIndex:l,creationDate:u,modificationDate:d}=this;return{id:o,pageIndex:l,rect:this.getPDFRect(),richText:s,contentsObj:{str:e},creationDate:u,modificationDate:n||d,popupRef:!i,color:r,opacity:a}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),this.#v=!0,!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),this.#v=!1,!0):!1}isInEditMode(){return this.#v}shouldGetKeyboardEvents(){return this.#_}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:r,bottom:n,right:a}=this.getClientDimensions(),{innerHeight:i,innerWidth:s}=window;return r<s&&a>0&&e<i&&n>0}#G(){if(this.#f||!this.div)return;this.#f=new AbortController;const e=this._uiManager.combinedSignal(this.#f);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})}rebuild(){this.#G()}rotate(e){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(e=!1,r=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||""}}static async deserialize(e,r,n){const a=new this.prototype.constructor({parent:r,id:r.getNextId(),uiManager:n,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});a.rotation=e.rotation,a.#e=e.accessibilityData,a._isCopy=e.isCopy||!1;const[i,s]=a.pageDimensions,[o,l,u,d]=a.getRectInCurrentCoords(e.rect,s);return a.x=o/i,a.y=l/s,a.width=u/i,a.height=d/s,a}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#f?.abort(),this.#f=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#y&&(clearTimeout(this.#y),this.#y=null),this.#P(),this.removeEditToolbar(),this.#b){for(const e of this.#b.values())clearTimeout(e);this.#b=null}this.parent=null,this.#A?.destroy(),this.#A=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#B(),this.#c.classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[e,r]}=this,[n,a,i,s]=this.getPDFRect();return[Hr._round(n+(i-n)*e),Hr._round(a+(s-a)*(1-r))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#r.commentPopupPositionInLayer}set commentPopupPosition(e){this.#r.commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return this.#r.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#r.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){this.#r.setCommentButtonStates(e)}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),this.#h={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const r=this.#c.children;if(!this.#t){this.#t=Array.from(r);const s=this.#q.bind(this),o=this.#W.bind(this),l=this._uiManager._signal;for(const u of this.#t){const d=u.getAttribute("data-resizer-name");u.setAttribute("role","spinbutton"),u.addEventListener("keydown",s,{signal:l}),u.addEventListener("blur",o,{signal:l}),u.addEventListener("focus",this.#X.bind(this,d),{signal:l}),u.setAttribute("data-l10n-id",Hr._l10nResizer[d])}}const n=this.#t[0];let a=0;for(const s of r){if(s===n)break;a++}const i=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(i!==a){if(i<a)for(let o=0;o<a-i;o++)this.#c.append(this.#c.firstChild);else if(i>a)for(let o=0;o<i-a;o++)this.#c.firstChild.before(this.#c.lastChild);let s=0;for(const o of r){const u=this.#t[s++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",Hr._l10nResizer[u])}}this.#z(0),this.#_=!0,this.#c.firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}#q(e){Hr._resizerKeyboardManager.exec(this,e)}#W(e){this.#_&&e.relatedTarget?.parentNode!==this.#c&&this.#P()}#X(e){this.#m=this.#_?e:""}#z(e){if(this.#t)for(const r of this.#t)r.tabIndex=e}_resizeWithKeyboard(e,r){this.#_&&this.#M(this.#m,{deltaX:e,deltaY:r,fromKeyboard:!0})}#P(){this.#_=!1,this.#z(-1),this.#F()}_stopResizingWithKeyboard(){this.#P(),this.div.focus()}select(){if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),this.div?.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()});return}this._editToolbar?.show(),this.#n?.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){this.isSelected&&(this.isSelected=!1,this.#c?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#n?.toggleAltTextBadge(!0),this.hasComment&&this._uiManager.toggleComment(this,!1,!1))}updateParams(e,r){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){e.target.nodeName!=="BUTTON"&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#g}set isEditing(e){this.#g=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,r=!1){if(r){this.#b||=new Map;const{action:n}=e;let a=this.#b.get(n);a&&clearTimeout(a),a=setTimeout(()=>{this._reportTelemetry(e),this.#b.delete(n),this.#b.size===0&&(this.#b=null)},Hr._telemetryTimeout),this.#b.set(n,a);return}e.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),this.#a=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#a=!0}updateFakeAnnotationElement(e){if(!this.#d&&!this.deleted){this.#d=e.addFakeAnnotation(this);return}if(this.deleted){this.#d.remove(),this.#d=null;return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&this.#d.updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let r=e.container.querySelector(".annotationContent");if(!r)r=document.createElement("div"),r.classList.add("annotationContent",this.editorType),e.container.prepend(r);else if(r.nodeName==="CANVAS"){const n=r;r=document.createElement("div"),r.classList.add("annotationContent",this.editorType),n.before(r)}return r}resetAnnotationElement(e){const{firstChild:r}=e.container;r?.nodeName==="DIV"&&r.classList.contains("annotationContent")&&r.remove()}}class i6t extends Hr{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const pTe=3285377520,ld=4294901760,bf=65535;class zGe{constructor(e){this.h1=e?e&4294967295:pTe,this.h2=e?e&4294967295:pTe}update(e){let r,n;if(typeof e=="string"){r=new Uint8Array(e.length*2),n=0;for(let m=0,_=e.length;m<_;m++){const y=e.charCodeAt(m);y<=255?r[n++]=y:(r[n++]=y>>>8,r[n++]=y&255)}}else if(ArrayBuffer.isView(e))r=e.slice(),n=r.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const a=n>>2,i=n-a*4,s=new Uint32Array(r.buffer,0,a);let o=0,l=0,u=this.h1,d=this.h2;const h=3432918353,f=461845907,p=h&bf,g=f&bf;for(let m=0;m<a;m++)m&1?(o=s[m],o=o*h&ld|o*p&bf,o=o<<15|o>>>17,o=o*f&ld|o*g&bf,u^=o,u=u<<13|u>>>19,u=u*5+3864292196):(l=s[m],l=l*h&ld|l*p&bf,l=l<<15|l>>>17,l=l*f&ld|l*g&bf,d^=l,d=d<<13|d>>>19,d=d*5+3864292196);switch(o=0,i){case 3:o^=r[a*4+2]<<16;case 2:o^=r[a*4+1]<<8;case 1:o^=r[a*4],o=o*h&ld|o*p&bf,o=o<<15|o>>>17,o=o*f&ld|o*g&bf,a&1?u^=o:d^=o}this.h1=u,this.h2=d}hexdigest(){let e=this.h1,r=this.h2;return e^=r>>>1,e=e*3981806797&ld|e*36045&bf,r=r*4283543511&ld|((r<<16|e>>>16)*2950163797&ld)>>>16,e^=r>>>1,e=e*444984403&ld|e*60499&bf,r=r*3301882366&ld|((r<<16|e>>>16)*3120437893&ld)>>>16,e^=r>>>1,(e>>>0).toString(16).padStart(8,"0")+(r>>>0).toString(16).padStart(8,"0")}}const zZ=Object.freeze({map:null,hash:"",transfer:void 0});class gce{#e=!1;#t=null;#n=null;#r=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,r){const n=this.#r.get(e);return n===void 0?r:Object.assign(r,n)}getRawValue(e){return this.#r.get(e)}remove(e){const r=this.#r.get(e);if(r!==void 0&&(r instanceof Hr&&this.#n.delete(r.annotationElementId),this.#r.delete(e),this.#r.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function")){for(const n of this.#r.values())if(n instanceof Hr)return;this.onAnnotationEditor(null)}}setValue(e,r){const n=this.#r.get(e);let a=!1;if(n!==void 0)for(const[i,s]of Object.entries(r))n[i]!==s&&(a=!0,n[i]=s);else a=!0,this.#r.set(e,r);a&&this.#s(),r instanceof Hr&&((this.#n||=new Map).set(r.annotationElementId,r),typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(r.constructor._type))}has(e){return this.#r.has(e)}get size(){return this.#r.size}#s(){this.#e||(this.#e=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#e&&(this.#e=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new VGe(this)}get serializable(){if(this.#r.size===0)return zZ;const e=new Map,r=new zGe,n=[],a=Object.create(null);let i=!1;for(const[s,o]of this.#r){const l=o instanceof Hr?o.serialize(!1,a):o;l&&(e.set(s,l),r.update(`${s}:${JSON.stringify(l)}`),i||=!!l.bitmap)}if(i)for(const s of e.values())s.bitmap&&n.push(s.bitmap);return e.size>0?{map:e,hash:r.hexdigest(),transfer:n}:zZ}get editorStats(){let e=null;const r=new Map;let n=0,a=0;for(const i of this.#r.values()){if(!(i instanceof Hr)){i.popup&&(i.popup.deleted?a+=1:n+=1);continue}i.isCommentDeleted?a+=1:i.hasEditedComment&&(n+=1);const s=i.telemetryFinalData;if(!s)continue;const{type:o}=s;r.has(o)||r.set(o,Object.getPrototypeOf(i).constructor),e||=Object.create(null);const l=e[o]||=new Map;for(const[u,d]of Object.entries(s)){if(u==="type")continue;let h=l.get(u);h||(h=new Map,l.set(u,h));const f=h.get(d)??0;h.set(d,f+1)}}if((a>0||n>0)&&(e||=Object.create(null),e.comments={deleted:a,edited:n}),!e)return null;for(const[i,s]of r)e[i]=s.computeTelemetryFinalData(e[i]);return e}resetModifiedIds(){this.#t=null}updateEditor(e,r){const n=this.#n?.get(e);return n?(n.updateFromAnnotationLayer(r),!0):!1}getEditor(e){return this.#n?.get(e)||null}get modifiedIds(){if(this.#t)return this.#t;const e=[];if(this.#n)for(const r of this.#n.values())r.serialize()&&e.push(r.annotationElementId);return this.#t={ids:new Set(e),hash:e.join(",")}}[Symbol.iterator](){return this.#r.entries()}}class VGe extends gce{#e;constructor(e){super();const{map:r,hash:n,transfer:a}=e.serializable,i=structuredClone(r,a?{transfer:a}:null);this.#e={map:i,hash:n,transfer:a}}get print(){ti("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}get modifiedIds(){return Dn(this,"modifiedIds",{ids:new Set,hash:""})}}class s6t{#e=new Set;constructor({ownerDocument:e=globalThis.document,styleElement:r=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const r=this.styleElement.sheet;r.insertRule(e,r.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),this.#e.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:r,_inspectFont:n}){if(!(!e||this.#e.has(e.loadedName))){if(ca(!r,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:a,src:i,style:s}=e,o=new FontFace(a,i,s);this.addNativeFontFace(o);try{await o.load(),this.#e.add(a),n?.(e)}catch{Cn(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}ti("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){const n=e.createNativeFontFace();if(n){this.addNativeFontFace(n);try{await n.loaded}catch(a){throw Cn(`Failed to load font '${n.family}': '${a}'.`),e.disableFontFace=!0,a}}return}const r=e.createFontFaceRule();if(r){if(this.insertRule(r),this.isSyncFontLoadingSupported)return;await new Promise(n=>{const a=this._queueLoadingCallback(n);this._prepareFontLoadEvent(e,a)})}}get isFontLoadingAPISupported(){const e=!!this._document?.fonts;return Dn(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return Dn(this,"isSyncFontLoadingSupported",Xl||Ao.platform.isFirefox)}_queueLoadingCallback(e){function r(){for(ca(!a.done,"completeRequest() cannot be called twice."),a.done=!0;n.length>0&&n[0].done;){const i=n.shift();setTimeout(i.callback,0)}}const{loadingRequests:n}=this,a={done:!1,complete:r,callback:e};return n.push(a),a}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Dn(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,r){function n(E,S){return E.charCodeAt(S)<<24|E.charCodeAt(S+1)<<16|E.charCodeAt(S+2)<<8|E.charCodeAt(S+3)&255}function a(E,S,T,x){const w=E.substring(0,S),C=E.substring(S+T);return w+x+C}let i,s;const o=this._document.createElement("canvas");o.width=1,o.height=1;const l=o.getContext("2d");let u=0;function d(E,S){if(++u>30){Cn("Load test font never loaded."),S();return}if(l.font="30px "+E,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){S();return}setTimeout(d.bind(null,E,S))}const h=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=a(f,976,h.length,h);const g=16,m=1482184792;let _=n(f,g);for(i=0,s=h.length-3;i<s;i+=4)_=_-m+n(h,i)|0;i<h.length&&(_=_-m+n(h+"XXX",i)|0),f=a(f,g,4,q5t(_));const y=`url(data:font/opentype;base64,${btoa(f)});`,v=`@font-face {font-family:"${h}";src:${y}}`;this.insertRule(v);const b=this._document.createElement("div");b.style.visibility="hidden",b.style.width=b.style.height="10px",b.style.position="absolute",b.style.top=b.style.left="0px";for(const E of[e.loadedName,h]){const S=this._document.createElement("span");S.textContent="Hi",S.style.fontFamily=E,b.append(S)}this._document.body.append(b),d(h,()=>{b.remove(),r.complete()})}}class o6t{#e;constructor(e,r=null,n,a){this.compiledGlyphs=Object.create(null),this.#e=e,this._inspectFont=r,n&&Object.assign(this,n),a&&(this.charProcOperatorList=a)}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const r={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(r.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,r)}return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${LGe(this.data)});`;let r;if(!this.cssFontInfo)r=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),r=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${n}src:${e}}`}return this._inspectFont?.(this,e),r}getPathGenerator(e,r){if(this.compiledGlyphs[r]!==void 0)return this.compiledGlyphs[r];const n=this.loadedName+"_path_"+r;let a;try{a=e.get(n)}catch(s){Cn(`getPathGenerator - ignoring character: "${s}".`)}const i=new Path2D(a||"");return this.fontExtraProperties||e.delete(n),this.compiledGlyphs[r]=i}get black(){return this.#e.black}get bold(){return this.#e.bold}get disableFontFace(){return this.#e.disableFontFace??!1}get fontExtraProperties(){return this.#e.fontExtraProperties??!1}get isInvalidPDFjsFont(){return this.#e.isInvalidPDFjsFont}get isType3Font(){return this.#e.isType3Font}get italic(){return this.#e.italic}get missingFile(){return this.#e.missingFile}get remeasure(){return this.#e.remeasure}get vertical(){return this.#e.vertical}get ascent(){return this.#e.ascent}get defaultWidth(){return this.#e.defaultWidth}get descent(){return this.#e.descent}get bbox(){return this.#e.bbox}get fontMatrix(){return this.#e.fontMatrix}get fallbackName(){return this.#e.fallbackName}get loadedName(){return this.#e.loadedName}get mimetype(){return this.#e.mimetype}get name(){return this.#e.name}get data(){return this.#e.data}clearData(){this.#e.clearData()}get cssFontInfo(){return this.#e.cssFontInfo}get systemFontInfo(){return this.#e.systemFontInfo}get defaultVMetrics(){return this.#e.defaultVMetrics}}function l6t(t){if(t instanceof URL)return t.href;if(typeof t=="string"){if(Xl)return t;const e=URL.parse(t,window.location);if(e)return e.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function c6t(t){if(Xl&&typeof Buffer<"u"&&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(typeof t=="string")return Sk(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||typeof t=="object"&&!isNaN(t?.length))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function iL(t){if(typeof t!="string")return null;if(t.endsWith("/"))return t;throw new Error(`Invalid factory url: "${t}" must include trailing slash.`)}const VZ=t=>typeof t=="object"&&Number.isInteger(t?.num)&&t.num>=0&&Number.isInteger(t?.gen)&&t.gen>=0,u6t=t=>typeof t=="object"&&typeof t?.name=="string",HGe=Z5t.bind(null,VZ,u6t);class d6t{#e=new Map;#t=Promise.resolve();postMessage(e,r){const n={data:structuredClone(e,r?{transfer:r}:null)};this.#t.then(()=>{for(const[a]of this.#e)a.call(this,n)})}addEventListener(e,r,n=null){let a=null;if(n?.signal instanceof AbortSignal){const{signal:i}=n;if(i.aborted){Cn("LoopbackPort - cannot use an `aborted` signal.");return}const s=()=>this.removeEventListener(e,r);a=()=>i.removeEventListener("abort",s),i.addEventListener("abort",s)}this.#e.set(r,a)}removeEventListener(e,r){this.#e.get(r)?.(),this.#e.delete(r)}terminate(){for(const[,e]of this.#e)e?.();this.#e.clear()}}const sL={DATA:1,ERROR:2},Cs={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function gTe(){}function Fc(t){if(t instanceof Jg||t instanceof h5||t instanceof oTe||t instanceof $N||t instanceof QV)return t;switch(t instanceof Error||typeof t=="object"&&t!==null||ti('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new Jg(t.message);case"InvalidPDFException":return new h5(t.message);case"PasswordException":return new oTe(t.message,t.code);case"ResponseException":return new $N(t.message,t.status,t.missing);case"UnknownErrorException":return new QV(t.message,t.details)}return new QV(t.message,t.toString())}class p2{#e=new AbortController;constructor(e,r,n){this.sourceName=e,this.targetName=r,this.comObj=n,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),n.addEventListener("message",this.#t.bind(this),{signal:this.#e.signal})}#t({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){this.#r(e);return}if(e.callback){const n=e.callbackId,a=this.callbackCapabilities[n];if(!a)throw new Error(`Cannot resolve callback ${n}`);if(delete this.callbackCapabilities[n],e.callback===sL.DATA)a.resolve(e.data);else if(e.callback===sL.ERROR)a.reject(Fc(e.reason));else throw new Error("Unexpected callback case");return}const r=this.actionHandler[e.action];if(!r)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const n=this.sourceName,a=e.sourceName,i=this.comObj;Promise.try(r,e.data).then(function(s){i.postMessage({sourceName:n,targetName:a,callback:sL.DATA,callbackId:e.callbackId,data:s})},function(s){i.postMessage({sourceName:n,targetName:a,callback:sL.ERROR,callbackId:e.callbackId,reason:Fc(s)})});return}if(e.streamId){this.#n(e);return}r(e.data)}on(e,r){const n=this.actionHandler;if(n[e])throw new Error(`There is already an actionName called "${e}"`);n[e]=r}send(e,r,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:r},n)}sendWithPromise(e,r,n){const a=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[a]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:a,data:r},n)}catch(s){i.reject(s)}return i.promise}sendWithStream(e,r,n,a){const i=this.streamId++,s=this.sourceName,o=this.targetName,l=this.comObj;return new ReadableStream({start:u=>{const d=Promise.withResolvers();return this.streamControllers[i]={controller:u,startCall:d,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:s,targetName:o,action:e,streamId:i,data:r,desiredSize:u.desiredSize},a),d.promise},pull:u=>{const d=Promise.withResolvers();return this.streamControllers[i].pullCall=d,l.postMessage({sourceName:s,targetName:o,stream:Cs.PULL,streamId:i,desiredSize:u.desiredSize}),d.promise},cancel:u=>{ca(u instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[i].cancelCall=d,this.streamControllers[i].isClosed=!0,l.postMessage({sourceName:s,targetName:o,stream:Cs.CANCEL,streamId:i,reason:Fc(u)}),d.promise}},n)}#n(e){const r=e.streamId,n=this.sourceName,a=e.sourceName,i=this.comObj,s=this,o=this.actionHandler[e.action],l={enqueue(u,d=1,h){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=d,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:n,targetName:a,stream:Cs.ENQUEUE,streamId:r,chunk:u},h)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:a,stream:Cs.CLOSE,streamId:r}),delete s.streamSinks[r])},error(u){ca(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:a,stream:Cs.ERROR,streamId:r,reason:Fc(u)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[r]=l,Promise.try(o,e.data,l).then(function(){i.postMessage({sourceName:n,targetName:a,stream:Cs.START_COMPLETE,streamId:r,success:!0})},function(u){i.postMessage({sourceName:n,targetName:a,stream:Cs.START_COMPLETE,streamId:r,reason:Fc(u)})})}#r(e){const r=e.streamId,n=this.sourceName,a=e.sourceName,i=this.comObj,s=this.streamControllers[r],o=this.streamSinks[r];switch(e.stream){case Cs.START_COMPLETE:e.success?s.startCall.resolve():s.startCall.reject(Fc(e.reason));break;case Cs.PULL_COMPLETE:e.success?s.pullCall.resolve():s.pullCall.reject(Fc(e.reason));break;case Cs.PULL:if(!o){i.postMessage({sourceName:n,targetName:a,stream:Cs.PULL_COMPLETE,streamId:r,success:!0});break}o.desiredSize<=0&&e.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=e.desiredSize,Promise.try(o.onPull||gTe).then(function(){i.postMessage({sourceName:n,targetName:a,stream:Cs.PULL_COMPLETE,streamId:r,success:!0})},function(u){i.postMessage({sourceName:n,targetName:a,stream:Cs.PULL_COMPLETE,streamId:r,reason:Fc(u)})});break;case Cs.ENQUEUE:if(ca(s,"enqueue should have stream controller"),s.isClosed)break;s.controller.enqueue(e.chunk);break;case Cs.CLOSE:if(ca(s,"close should have stream controller"),s.isClosed)break;s.isClosed=!0,s.controller.close(),this.#s(s,r);break;case Cs.ERROR:ca(s,"error should have stream controller"),s.controller.error(Fc(e.reason)),this.#s(s,r);break;case Cs.CANCEL_COMPLETE:e.success?s.cancelCall.resolve():s.cancelCall.reject(Fc(e.reason)),this.#s(s,r);break;case Cs.CANCEL:if(!o)break;const l=Fc(e.reason);Promise.try(o.onCancel||gTe,l).then(function(){i.postMessage({sourceName:n,targetName:a,stream:Cs.CANCEL_COMPLETE,streamId:r,success:!0})},function(u){i.postMessage({sourceName:n,targetName:a,stream:Cs.CANCEL_COMPLETE,streamId:r,reason:Fc(u)})}),o.sinkCapability.reject(l),o.isCancelled=!0,delete this.streamSinks[r];break;default:throw new Error("Unexpected stream case")}}async#s(e,r){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[r]}destroy(){this.#e?.abort(),this.#e=null}}class YGe{#e=!1;constructor({enableHWA:e=!1}){this.#e=e}create(e,r){if(e<=0||r<=0)throw new Error("Invalid canvas size");const n=this._createCanvas(e,r);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!this.#e})}}reset(e,r,n){if(!e.canvas)throw new Error("Canvas is not specified");if(r<=0||n<=0)throw new Error("Invalid canvas size");e.canvas.width=r,e.canvas.height=n}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,r){ti("Abstract method `_createCanvas` called.")}}class h6t extends YGe{constructor({ownerDocument:e=globalThis.document,enableHWA:r=!1}){super({enableHWA:r}),this._document=e}_createCanvas(e,r){const n=this._document.createElement("canvas");return n.width=e,n.height=r,n}}class WGe{constructor({baseUrl:e=null,isCompressed:r=!0}){this.baseUrl=e,this.isCompressed=r}async fetch({name:e}){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 r=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(r).then(n=>({cMapData:n,isCompressed:this.isCompressed})).catch(n=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${r}`)})}async _fetch(e){ti("Abstract method `_fetch` called.")}}class mTe extends WGe{async _fetch(e){const r=await xw(e,this.isCompressed?"arraybuffer":"text");return r instanceof ArrayBuffer?new Uint8Array(r):Sk(r)}}class qGe{addFilter(e){return"none"}addHCMFilter(e,r){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,r,n,a,i){return"none"}destroy(e=!1){}}class f6t extends qGe{#e;#t;#n;#r;#s;#a;#i=0;constructor({docId:e,ownerDocument:r=globalThis.document}){super(),this.#r=e,this.#s=r}get#o(){return this.#t||=new Map}get#c(){return this.#a||=new Map}get#l(){if(!this.#n){const e=this.#s.createElement("div"),{style:r}=e;r.visibility="hidden",r.contain="strict",r.width=r.height=0,r.position="absolute",r.top=r.left=0,r.zIndex=-1;const n=this.#s.createElementNS(lg,"svg");n.setAttribute("width",0),n.setAttribute("height",0),this.#n=this.#s.createElementNS(lg,"defs"),e.append(n),n.append(this.#n),this.#s.body.append(e)}return this.#n}#h(e){if(e.length===1){const l=e[0],u=new Array(256);for(let h=0;h<256;h++)u[h]=l[h]/255;const d=u.join(",");return[d,d,d]}const[r,n,a]=e,i=new Array(256),s=new Array(256),o=new Array(256);for(let l=0;l<256;l++)i[l]=r[l]/255,s[l]=n[l]/255,o[l]=a[l]/255;return[i.join(","),s.join(","),o.join(",")]}#d(e){if(this.#e===void 0){this.#e="";const r=this.#s.URL;r!==this.#s.baseURI&&(xk(r)?Cn('#createUrl: ignore "data:"-URL for performance reasons.'):this.#e=lce(r,""))}return`url(${this.#e}#${e})`}addFilter(e){if(!e)return"none";let r=this.#o.get(e);if(r)return r;const[n,a,i]=this.#h(e),s=e.length===1?n:`${n}${a}${i}`;if(r=this.#o.get(s),r)return this.#o.set(e,r),r;const o=`g_${this.#r}_transfer_map_${this.#i++}`,l=this.#d(o);this.#o.set(e,l),this.#o.set(s,l);const u=this.#p(o);return this.#g(n,a,i,u),l}addHCMFilter(e,r){const n=`${e}-${r}`,a="base";let i=this.#c.get(a);if(i?.key===n||(i?(i.filter?.remove(),i.key=n,i.url="none",i.filter=null):(i={key:n,url:"none",filter:null},this.#c.set(a,i)),!e||!r))return i.url;const s=this.#_(e);e=Er.makeHexColor(...s);const o=this.#_(r);if(r=Er.makeHexColor(...o),this.#l.style.color="",e==="#000000"&&r==="#ffffff"||e===r)return i.url;const l=new Array(256);for(let p=0;p<=255;p++){const g=p/255;l[p]=g<=.03928?g/12.92:((g+.055)/1.055)**2.4}const u=l.join(","),d=`g_${this.#r}_hcm_filter`,h=i.filter=this.#p(d);this.#g(u,u,u,h),this.#m(h);const f=(p,g)=>{const m=s[p]/255,_=o[p]/255,y=new Array(g+1);for(let v=0;v<=g;v++)y[v]=m+v/g*(_-m);return y.join(",")};return this.#g(f(0,5),f(1,5),f(2,5),h),i.url=this.#d(d),i.url}addAlphaFilter(e){let r=this.#o.get(e);if(r)return r;const[n]=this.#h([e]),a=`alpha_${n}`;if(r=this.#o.get(a),r)return this.#o.set(e,r),r;const i=`g_${this.#r}_alpha_map_${this.#i++}`,s=this.#d(i);this.#o.set(e,s),this.#o.set(a,s);const o=this.#p(i);return this.#v(n,o),s}addLuminosityFilter(e){let r=this.#o.get(e||"luminosity");if(r)return r;let n,a;if(e?([n]=this.#h([e]),a=`luminosity_${n}`):a="luminosity",r=this.#o.get(a),r)return this.#o.set(e,r),r;const i=`g_${this.#r}_luminosity_map_${this.#i++}`,s=this.#d(i);this.#o.set(e,s),this.#o.set(a,s);const o=this.#p(i);return this.#f(o),e&&this.#v(n,o),s}addHighlightHCMFilter(e,r,n,a,i){const s=`${r}-${n}-${a}-${i}`;let o=this.#c.get(e);if(o?.key===s||(o?(o.filter?.remove(),o.key=s,o.url="none",o.filter=null):(o={key:s,url:"none",filter:null},this.#c.set(e,o)),!r||!n))return o.url;const[l,u]=[r,n].map(this.#_.bind(this));let d=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),h=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),[f,p]=[a,i].map(this.#_.bind(this));h<d&&([d,h,f,p]=[h,d,p,f]),this.#l.style.color="";const g=(y,v,b)=>{const E=new Array(256),S=(h-d)/b,T=y/255,x=(v-y)/(255*b);let w=0;for(let C=0;C<=b;C++){const R=Math.round(d+C*S),N=T+C*x;for(let k=w;k<=R;k++)E[k]=N;w=R+1}for(let C=w;C<256;C++)E[C]=E[w-1];return E.join(",")},m=`g_${this.#r}_hcm_${e}_filter`,_=o.filter=this.#p(m);return this.#m(_),this.#g(g(f[0],p[0],5),g(f[1],p[1],5),g(f[2],p[2],5),_),o.url=this.#d(m),o.url}destroy(e=!1){e&&this.#a?.size||(this.#n?.parentNode.parentNode.remove(),this.#n=null,this.#t?.clear(),this.#t=null,this.#a?.clear(),this.#a=null,this.#i=0)}#f(e){const r=this.#s.createElementNS(lg,"feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(r)}#m(e){const r=this.#s.createElementNS(lg,"feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(r)}#p(e){const r=this.#s.createElementNS(lg,"filter");return r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("id",e),this.#l.append(r),r}#u(e,r,n){const a=this.#s.createElementNS(lg,r);a.setAttribute("type","discrete"),a.setAttribute("tableValues",n),e.append(a)}#g(e,r,n,a){const i=this.#s.createElementNS(lg,"feComponentTransfer");a.append(i),this.#u(i,"feFuncR",e),this.#u(i,"feFuncG",r),this.#u(i,"feFuncB",n)}#v(e,r){const n=this.#s.createElementNS(lg,"feComponentTransfer");r.append(n),this.#u(n,"feFuncA",e)}#_(e){return this.#l.style.color=e,ww(getComputedStyle(this.#l).getPropertyValue("color"))}}class XGe{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){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 r=`${this.baseUrl}${e}`;return this._fetch(r).catch(n=>{throw new Error(`Unable to load font data at: ${r}`)})}async _fetch(e){ti("Abstract method `_fetch` called.")}}class vTe extends XGe{async _fetch(e){const r=await xw(e,"arraybuffer");return new Uint8Array(r)}}class jGe{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!e)throw new Error("Wasm filename must be specified.");const r=`${this.baseUrl}${e}`;return this._fetch(r).catch(n=>{throw new Error(`Unable to load wasm data at: ${r}`)})}async _fetch(e){ti("Abstract method `_fetch` called.")}}class yTe extends jGe{async _fetch(e){const r=await xw(e,"arraybuffer");return new Uint8Array(r)}}Xl&&Cn("Please use the `legacy` build in Node.js environments.");async function mce(t){const r=await process.getBuiltinModule("fs").promises.readFile(t);return new Uint8Array(r)}class p6t extends qGe{}class g6t extends YGe{_createCanvas(e,r){return process.getBuiltinModule("module").createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:sU&&sU.tagName.toUpperCase()==="SCRIPT"&&sU.src||new URL("doc-detail.cjs",document.baseURI).href)("@napi-rs/canvas").createCanvas(e,r)}}class m6t extends WGe{async _fetch(e){return mce(e)}}class v6t extends XGe{async _fetch(e){return mce(e)}}class y6t extends jGe{async _fetch(e){return mce(e)}}const nE="__forcedDependency",{floor:_Te,ceil:bTe}=Math;function oL(t,e,r,n,a,i){t[e*4+0]=Math.min(t[e*4+0],r),t[e*4+1]=Math.min(t[e*4+1],n),t[e*4+2]=Math.max(t[e*4+2],a),t[e*4+3]=Math.max(t[e*4+3],i)}const HZ=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];class _6t{#e;#t;constructor(e,r){this.#e=e,this.#t=r}get length(){return this.#e.length}isEmpty(e){return this.#e[e]===HZ}minX(e){return this.#t[e*4+0]/256}minY(e){return this.#t[e*4+1]/256}maxX(e){return(this.#t[e*4+2]+1)/256}maxY(e){return(this.#t[e*4+3]+1)/256}}const lL=(t,e)=>{if(!t)return;let r=t.get(e);return r||(r={dependencies:new Set,isRenderingOperation:!1},t.set(e,r)),r};class b6t{#e={__proto__:null};#t={__proto__:null,transform:[],moveText:[],sameLineText:[],[nE]:[]};#n=new Map;#r=[];#s=[];#a=[[1,0,0,1,0,0]];#i=[-1/0,-1/0,1/0,1/0];#o=new Float64Array([1/0,1/0,-1/0,-1/0]);#c=-1;#l=new Set;#h=new Map;#d=new Map;#f;#m;#p;#u;#g;constructor(e,r,n=!1){this.#f=e.width,this.#m=e.height,this.#v(r),n&&(this.#g=new Map)}growOperationsCount(e){e>=this.#u.length&&this.#v(e,this.#u)}#v(e,r){const n=new ArrayBuffer(e*4);this.#p=new Uint8ClampedArray(n),this.#u=new Uint32Array(n),r&&r.length>0?(this.#u.set(r),this.#u.fill(HZ,r.length)):this.#u.fill(HZ)}save(e){return this.#e={__proto__:this.#e},this.#t={__proto__:this.#t,transform:{__proto__:this.#t.transform},moveText:{__proto__:this.#t.moveText},sameLineText:{__proto__:this.#t.sameLineText},[nE]:{__proto__:this.#t[nE]}},this.#i={__proto__:this.#i},this.#r.push(e),this}restore(e){const r=Object.getPrototypeOf(this.#e);if(r===null)return this;this.#e=r,this.#t=Object.getPrototypeOf(this.#t),this.#i=Object.getPrototypeOf(this.#i);const n=this.#r.pop();return n!==void 0&&(lL(this.#g,e)?.dependencies.add(n),this.#u[e]=this.#u[n]),this}recordOpenMarker(e){return this.#r.push(e),this}getOpenMarker(){return this.#r.length===0?null:this.#r.at(-1)}recordCloseMarker(e){const r=this.#r.pop();return r!==void 0&&(lL(this.#g,e)?.dependencies.add(r),this.#u[e]=this.#u[r]),this}beginMarkedContent(e){return this.#s.push(e),this}endMarkedContent(e){const r=this.#s.pop();return r!==void 0&&(lL(this.#g,e)?.dependencies.add(r),this.#u[e]=this.#u[r]),this}pushBaseTransform(e){return this.#a.push(Er.multiplyByDOMMatrix(this.#a.at(-1),e.getTransform())),this}popBaseTransform(){return this.#a.length>1&&this.#a.pop(),this}recordSimpleData(e,r){return this.#e[e]=r,this}recordIncrementalData(e,r){return this.#t[e].push(r),this}resetIncrementalData(e,r){return this.#t[e].length=0,this}recordNamedData(e,r){return this.#n.set(e,r),this}recordSimpleDataFromNamed(e,r,n){this.#e[e]=this.#n.get(r)??n}recordFutureForcedDependency(e,r){return this.recordIncrementalData(nE,r),this}inheritSimpleDataAsFutureForcedDependencies(e){for(const r of e)r in this.#e&&this.recordFutureForcedDependency(r,this.#e[r]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const e of this.#l)this.recordFutureForcedDependency(nE,e);return this}resetBBox(e){return this.#c!==e&&(this.#c=e,this.#o[0]=1/0,this.#o[1]=1/0,this.#o[2]=-1/0,this.#o[3]=-1/0),this}recordClipBox(e,r,n,a,i,s){const o=Er.multiplyByDOMMatrix(this.#a.at(-1),r.getTransform()),l=[1/0,1/0,-1/0,-1/0];Er.axialAlignedBoundingBox([n,i,a,s],o,l);const u=Er.intersect(this.#i,l);return u?(this.#i[0]=u[0],this.#i[1]=u[1],this.#i[2]=u[2],this.#i[3]=u[3]):(this.#i[0]=this.#i[1]=1/0,this.#i[2]=this.#i[3]=-1/0),this}recordBBox(e,r,n,a,i,s){const o=this.#i;if(o[0]===1/0)return this;const l=Er.multiplyByDOMMatrix(this.#a.at(-1),r.getTransform());if(o[0]===-1/0)return Er.axialAlignedBoundingBox([n,i,a,s],l,this.#o),this;const u=[1/0,1/0,-1/0,-1/0];return Er.axialAlignedBoundingBox([n,i,a,s],l,u),this.#o[0]=Math.min(this.#o[0],Math.max(u[0],o[0])),this.#o[1]=Math.min(this.#o[1],Math.max(u[1],o[1])),this.#o[2]=Math.max(this.#o[2],Math.min(u[2],o[2])),this.#o[3]=Math.max(this.#o[3],Math.min(u[3],o[3])),this}recordCharacterBBox(e,r,n,a=1,i=0,s=0,o){const l=n.bbox;let u,d;if(l&&(u=l[2]!==l[0]&&l[3]!==l[1]&&this.#d.get(n),u!==!1&&(d=[0,0,0,0],Er.axialAlignedBoundingBox(l,n.fontMatrix,d),(a!==1||i!==0||s!==0)&&Er.scaleMinMax([a,0,0,-a,i,s],d),u)))return this.recordBBox(e,r,d[0],d[2],d[1],d[3]);if(!o)return this.recordFullPageBBox(e);const h=o();return l&&d&&u===void 0&&(u=d[0]<=i-h.actualBoundingBoxLeft&&d[2]>=i+h.actualBoundingBoxRight&&d[1]<=s-h.actualBoundingBoxAscent&&d[3]>=s+h.actualBoundingBoxDescent,this.#d.set(n,u),u)?this.recordBBox(e,r,d[0],d[2],d[1],d[3]):this.recordBBox(e,r,i-h.actualBoundingBoxLeft,i+h.actualBoundingBoxRight,s-h.actualBoundingBoxAscent,s+h.actualBoundingBoxDescent)}recordFullPageBBox(e){return this.#o[0]=Math.max(0,this.#i[0]),this.#o[1]=Math.max(0,this.#i[1]),this.#o[2]=Math.min(this.#f,this.#i[2]),this.#o[3]=Math.min(this.#m,this.#i[3]),this}getSimpleIndex(e){return this.#e[e]}recordDependencies(e,r){const n=this.#l,a=this.#e,i=this.#t;for(const s of r)s in this.#e?n.add(a[s]):s in i&&i[s].forEach(n.add,n);return this}recordNamedDependency(e,r){return this.#n.has(r)&&this.#l.add(this.#n.get(r)),this}recordOperation(e,r=!1){if(this.recordDependencies(e,[nE]),this.#g){const n=lL(this.#g,e),{dependencies:a}=n;this.#l.forEach(a.add,a),this.#r.forEach(a.add,a),this.#s.forEach(a.add,a),a.delete(e),n.isRenderingOperation=!0}if(this.#c===e){const n=_Te(this.#o[0]*256/this.#f),a=_Te(this.#o[1]*256/this.#m),i=bTe(this.#o[2]*256/this.#f),s=bTe(this.#o[3]*256/this.#m);oL(this.#p,e,n,a,i,s);for(const o of this.#l)o!==e&&oL(this.#p,o,n,a,i,s);for(const o of this.#r)o!==e&&oL(this.#p,o,n,a,i,s);for(const o of this.#s)o!==e&&oL(this.#p,o,n,a,i,s);r||(this.#l.clear(),this.#c=-1)}return this}recordShowTextOperation(e,r=!1){const n=Array.from(this.#l);this.recordOperation(e,r),this.recordIncrementalData("sameLineText",e);for(const a of n)this.recordIncrementalData("sameLineText",a);return this}bboxToClipBoxDropOperation(e,r=!1){return this.#c===e&&(this.#c=-1,this.#i[0]=Math.max(this.#i[0],this.#o[0]),this.#i[1]=Math.max(this.#i[1],this.#o[1]),this.#i[2]=Math.min(this.#i[2],this.#o[2]),this.#i[3]=Math.min(this.#i[3],this.#o[3]),r||this.#l.clear()),this}_takePendingDependencies(){const e=this.#l;return this.#l=new Set,e}_extractOperation(e){const r=this.#h.get(e);return this.#h.delete(e),r}_pushPendingDependencies(e){for(const r of e)this.#l.add(r)}take(){return this.#d.clear(),new _6t(this.#u,this.#p)}takeDebugMetadata(){return this.#g}}class g5{#e;#t;#n;#r=0;#s=0;constructor(e,r,n){if(e instanceof g5&&e.#n===!!n)return e;this.#e=e,this.#t=r,this.#n=!!n}growOperationsCount(){throw new Error("Unreachable")}save(e){return this.#s++,this.#e.save(this.#t),this}restore(e){return this.#s>0&&(this.#e.restore(this.#t),this.#s--),this}recordOpenMarker(e){return this.#r++,this}getOpenMarker(){return this.#r>0?this.#t:this.#e.getOpenMarker()}recordCloseMarker(e){return this.#r--,this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return this.#e.pushBaseTransform(e),this}popBaseTransform(){return this.#e.popBaseTransform(),this}recordSimpleData(e,r){return this.#e.recordSimpleData(e,this.#t),this}recordIncrementalData(e,r){return this.#e.recordIncrementalData(e,this.#t),this}resetIncrementalData(e,r){return this.#e.resetIncrementalData(e,this.#t),this}recordNamedData(e,r){return this}recordSimpleDataFromNamed(e,r,n){return this.#e.recordSimpleDataFromNamed(e,r,this.#t),this}recordFutureForcedDependency(e,r){return this.#e.recordFutureForcedDependency(e,this.#t),this}inheritSimpleDataAsFutureForcedDependencies(e){return this.#e.inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return this.#e.inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){return this.#n||this.#e.resetBBox(this.#t),this}recordClipBox(e,r,n,a,i,s){return this.#n||this.#e.recordClipBox(this.#t,r,n,a,i,s),this}recordBBox(e,r,n,a,i,s){return this.#n||this.#e.recordBBox(this.#t,r,n,a,i,s),this}recordCharacterBBox(e,r,n,a,i,s,o){return this.#n||this.#e.recordCharacterBBox(this.#t,r,n,a,i,s,o),this}recordFullPageBBox(e){return this.#n||this.#e.recordFullPageBBox(this.#t),this}getSimpleIndex(e){return this.#e.getSimpleIndex(e)}recordDependencies(e,r){return this.#e.recordDependencies(this.#t,r),this}recordNamedDependency(e,r){return this.#e.recordNamedDependency(this.#t,r),this}recordOperation(e){return this.#e.recordOperation(this.#t,!0),this}recordShowTextOperation(e){return this.#e.recordShowTextOperation(this.#t,!0),this}bboxToClipBoxDropOperation(e){return this.#n||this.#e.bboxToClipBoxDropOperation(this.#t,!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}}const cd={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["filter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","fillColor"]},Wo={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function YZ(t,e){if(!e)return;const r=e[2]-e[0],n=e[3]-e[1],a=new Path2D;a.rect(e[0],e[1],r,n),t.clip(a)}class vce{isModifyingCurrentTransform(){return!1}getPattern(){ti("Abstract method `getPattern` called.")}}class E6t extends vce{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let r;this._type==="axial"?r=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(r=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const n of this._colorStops)r.addColorStop(n[0],n[1]);return r}getPattern(e,r,n,a){let i;if(a===Wo.STROKE||a===Wo.FILL){const s=r.current.getClippedPathBoundingBox(a,Ui(e))||[0,0,0,0],o=Math.ceil(s[2]-s[0])||1,l=Math.ceil(s[3]-s[1])||1,u=r.cachedCanvases.getCanvas("pattern",o,l),d=u.context;d.clearRect(0,0,d.canvas.width,d.canvas.height),d.beginPath(),d.rect(0,0,d.canvas.width,d.canvas.height),d.translate(-s[0],-s[1]),n=Er.transform(n,[1,0,0,1,s[0],s[1]]),d.transform(...r.baseTransform),this.matrix&&d.transform(...this.matrix),YZ(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),i=e.createPattern(u.canvas,"no-repeat");const h=new DOMMatrix(n);i.setTransform(h)}else YZ(e,this._bbox),i=this._createGradient(e);return i}}function tH(t,e,r,n,a,i,s,o){const l=e.coords,u=e.colors,d=t.data,h=t.width*4;let f;l[r+1]>l[n+1]&&(f=r,r=n,n=f,f=i,i=s,s=f),l[n+1]>l[a+1]&&(f=n,n=a,a=f,f=s,s=o,o=f),l[r+1]>l[n+1]&&(f=r,r=n,n=f,f=i,i=s,s=f);const p=(l[r]+e.offsetX)*e.scaleX,g=(l[r+1]+e.offsetY)*e.scaleY,m=(l[n]+e.offsetX)*e.scaleX,_=(l[n+1]+e.offsetY)*e.scaleY,y=(l[a]+e.offsetX)*e.scaleX,v=(l[a+1]+e.offsetY)*e.scaleY;if(g>=v)return;const b=u[i],E=u[i+1],S=u[i+2],T=u[s],x=u[s+1],w=u[s+2],C=u[o],R=u[o+1],N=u[o+2],k=Math.round(g),L=Math.round(v);let A,D,M,B,F,U,V,$;for(let z=k;z<=L;z++){if(z<_){const ne=z<g?0:(g-z)/(g-_);A=p-(p-m)*ne,D=b-(b-T)*ne,M=E-(E-x)*ne,B=S-(S-w)*ne}else{let ne;z>v?ne=1:_===v?ne=0:ne=(_-z)/(_-v),A=m-(m-y)*ne,D=T-(T-C)*ne,M=x-(x-R)*ne,B=w-(w-N)*ne}let q;z<g?q=0:z>v?q=1:q=(g-z)/(g-v),F=p-(p-y)*q,U=b-(b-C)*q,V=E-(E-R)*q,$=S-(S-N)*q;const j=Math.round(Math.min(A,F)),X=Math.round(Math.max(A,F));let ie=h*z+j*4;for(let ne=j;ne<=X;ne++)q=(A-ne)/(A-F),q<0?q=0:q>1&&(q=1),d[ie++]=D-(D-U)*q|0,d[ie++]=M-(M-V)*q|0,d[ie++]=B-(B-$)*q|0,d[ie++]=255}}function S6t(t,e,r){const n=e.coords,a=e.colors;let i,s;switch(e.type){case"lattice":const o=e.verticesPerRow,l=Math.floor(n.length/o)-1,u=o-1;for(i=0;i<l;i++){let d=i*o;for(let h=0;h<u;h++,d++)tH(t,r,n[d],n[d+1],n[d+o],a[d],a[d+1],a[d+o]),tH(t,r,n[d+o+1],n[d+1],n[d+o],a[d+o+1],a[d+1],a[d+o])}break;case"triangles":for(i=0,s=n.length;i<s;i+=3)tH(t,r,n[i],n[i+1],n[i+2],a[i],a[i+1],a[i+2]);break;default:throw new Error("illegal figure")}}class T6t extends vce{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],this.matrix=null}_createMeshCanvas(e,r,n){const o=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-o,d=Math.ceil(this._bounds[3])-l,h=Math.min(Math.ceil(Math.abs(u*e[0]*1.1)),3e3),f=Math.min(Math.ceil(Math.abs(d*e[1]*1.1)),3e3),p=u/h,g=d/f,m={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-l,scaleX:1/p,scaleY:1/g},_=h+4,y=f+4,v=n.getCanvas("mesh",_,y),b=v.context,E=b.createImageData(h,f);if(r){const T=E.data;for(let x=0,w=T.length;x<w;x+=4)T[x]=r[0],T[x+1]=r[1],T[x+2]=r[2],T[x+3]=255}for(const T of this._figures)S6t(E,T,m);return b.putImageData(E,2,2),{canvas:v.canvas,offsetX:o-2*p,offsetY:l-2*g,scaleX:p,scaleY:g}}isModifyingCurrentTransform(){return!0}getPattern(e,r,n,a){YZ(e,this._bbox);const i=new Float32Array(2);if(a===Wo.SHADING)Er.singularValueDecompose2dScale(Ui(e),i);else if(this.matrix){Er.singularValueDecompose2dScale(this.matrix,i);const[o,l]=i;Er.singularValueDecompose2dScale(r.baseTransform,i),i[0]*=o,i[1]*=l}else Er.singularValueDecompose2dScale(r.baseTransform,i);const s=this._createMeshCanvas(i,a===Wo.SHADING?null:this._background,r.cachedCanvases);return a!==Wo.SHADING&&(e.setTransform(...r.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(s.offsetX,s.offsetY),e.scale(s.scaleX,s.scaleY),e.createPattern(s.canvas,"no-repeat")}}class x6t extends vce{getPattern(){return"hotpink"}}function w6t(t){switch(t[0]){case"RadialAxial":return new E6t(t);case"Mesh":return new T6t(t);case"Dummy":return new x6t}throw new Error(`Unknown IR type: ${t[0]}`)}const ETe={COLORED:1,UNCOLORED:2};class yce{static MAX_PATTERN_SIZE=3e3;constructor(e,r,n,a){this.color=e[1],this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.ctx=r,this.canvasGraphicsFactory=n,this.baseTransform=a}createPatternCanvas(e,r){const{bbox:n,operatorList:a,paintType:i,tilingType:s,color:o,canvasGraphicsFactory:l}=this;let{xstep:u,ystep:d}=this;u=Math.abs(u),d=Math.abs(d),FF("TilingType: "+s);const h=n[0],f=n[1],p=n[2],g=n[3],m=p-h,_=g-f,y=new Float32Array(2);Er.singularValueDecompose2dScale(this.matrix,y);const[v,b]=y;Er.singularValueDecompose2dScale(this.baseTransform,y);const E=v*y[0],S=b*y[1];let T=m,x=_,w=!1,C=!1;const R=Math.ceil(u*E),N=Math.ceil(d*S),k=Math.ceil(m*E),L=Math.ceil(_*S);R>=k?T=u:w=!0,N>=L?x=d:C=!0;const A=this.getSizeAndScale(T,this.ctx.canvas.width,E),D=this.getSizeAndScale(x,this.ctx.canvas.height,S),M=e.cachedCanvases.getCanvas("pattern",A.size,D.size),B=M.context,F=l.createCanvasGraphics(B,r);if(F.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(F,i,o),B.translate(-A.scale*h,-D.scale*f),F.transform(0,A.scale,0,0,D.scale,0,0),B.save(),F.dependencyTracker?.save(),this.clipBbox(F,h,f,p,g),F.baseTransform=Ui(F.ctx),F.executeOperatorList(a),F.endDrawing(),F.dependencyTracker?.restore(),B.restore(),w||C){const U=M.canvas;w&&(T=u),C&&(x=d);const V=this.getSizeAndScale(T,this.ctx.canvas.width,E),$=this.getSizeAndScale(x,this.ctx.canvas.height,S),z=V.size,q=$.size,j=e.cachedCanvases.getCanvas("pattern-workaround",z,q),X=j.context,ie=w?Math.floor(m/u):0,ne=C?Math.floor(_/d):0;for(let ue=0;ue<=ie;ue++)for(let J=0;J<=ne;J++)X.drawImage(U,z*ue,q*J,z,q,0,0,z,q);return{canvas:j.canvas,scaleX:V.scale,scaleY:$.scale,offsetX:h,offsetY:f}}return{canvas:M.canvas,scaleX:A.scale,scaleY:D.scale,offsetX:h,offsetY:f}}getSizeAndScale(e,r,n){const a=Math.max(yce.MAX_PATTERN_SIZE,r);let i=Math.ceil(e*n);return i>=a?i=a:n=i/e,{scale:n,size:i}}clipBbox(e,r,n,a,i){const s=a-r,o=i-n;e.ctx.rect(r,n,s,o),Er.axialAlignedBoundingBox([r,n,a,i],Ui(e.ctx),e.current.minMax),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,r,n){const a=e.ctx,i=e.current;switch(r){case ETe.COLORED:const{fillStyle:s,strokeStyle:o}=this.ctx;a.fillStyle=i.fillColor=s,a.strokeStyle=i.strokeColor=o;break;case ETe.UNCOLORED:a.fillStyle=a.strokeStyle=n,i.fillColor=i.strokeColor=n;break;default:throw new W5t(`Unsupported paint type: ${r}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,r,n,a,i){let s=n;a!==Wo.SHADING&&(s=Er.transform(s,r.baseTransform),this.matrix&&(s=Er.transform(s,this.matrix)));const o=this.createPatternCanvas(r,i);let l=new DOMMatrix(s);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const u=e.createPattern(o.canvas,"repeat");return u.setTransform(l),u}}function C6t({src:t,srcPos:e=0,dest:r,width:n,height:a,nonBlackColor:i=4294967295,inverseDecode:s=!1}){const o=Ao.isLittleEndian?4278190080:255,[l,u]=s?[i,o]:[o,i],d=n>>3,h=n&7,f=t.length;r=new Uint32Array(r.buffer);let p=0;for(let g=0;g<a;g++){for(const _=e+d;e<_;e++){const y=e<f?t[e]:255;r[p++]=y&128?u:l,r[p++]=y&64?u:l,r[p++]=y&32?u:l,r[p++]=y&16?u:l,r[p++]=y&8?u:l,r[p++]=y&4?u:l,r[p++]=y&2?u:l,r[p++]=y&1?u:l}if(h===0)continue;const m=e<f?t[e++]:255;for(let _=0;_<h;_++)r[p++]=m&1<<7-_?u:l}return{srcPos:e,destPos:p}}const STe=16,TTe=100,A6t=15,xTe=10,Gc=16,rH=new DOMMatrix,Cu=new Float32Array(2),gS=new Float32Array([1/0,1/0,-1/0,-1/0]);function R6t(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(r,n){e.translate(r,n),this.__originalTranslate(r,n)},t.scale=function(r,n){e.scale(r,n),this.__originalScale(r,n)},t.transform=function(r,n,a,i,s,o){e.transform(r,n,a,i,s,o),this.__originalTransform(r,n,a,i,s,o)},t.setTransform=function(r,n,a,i,s,o){e.setTransform(r,n,a,i,s,o),this.__originalSetTransform(r,n,a,i,s,o)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(r){e.rotate(r),this.__originalRotate(r)},t.clip=function(r){e.clip(r),this.__originalClip(r)},t.moveTo=function(r,n){e.moveTo(r,n),this.__originalMoveTo(r,n)},t.lineTo=function(r,n){e.lineTo(r,n),this.__originalLineTo(r,n)},t.bezierCurveTo=function(r,n,a,i,s,o){e.bezierCurveTo(r,n,a,i,s,o),this.__originalBezierCurveTo(r,n,a,i,s,o)},t.rect=function(r,n,a,i){e.rect(r,n,a,i),this.__originalRect(r,n,a,i)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class N6t{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,r,n){let a;return this.cache[e]!==void 0?(a=this.cache[e],this.canvasFactory.reset(a,r,n)):(a=this.canvasFactory.create(r,n),this.cache[e]=a),a}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const r=this.cache[e];this.canvasFactory.destroy(r),delete this.cache[e]}}}function cL(t,e,r,n,a,i,s,o,l,u){const[d,h,f,p,g,m]=Ui(t);if(h===0&&f===0){const v=s*d+g,b=Math.round(v),E=o*p+m,S=Math.round(E),T=(s+l)*d+g,x=Math.abs(Math.round(T)-b)||1,w=(o+u)*p+m,C=Math.abs(Math.round(w)-S)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(p),b,S),t.drawImage(e,r,n,a,i,0,0,x,C),t.setTransform(d,h,f,p,g,m),[x,C]}if(d===0&&p===0){const v=o*f+g,b=Math.round(v),E=s*h+m,S=Math.round(E),T=(o+u)*f+g,x=Math.abs(Math.round(T)-b)||1,w=(s+l)*h+m,C=Math.abs(Math.round(w)-S)||1;return t.setTransform(0,Math.sign(h),Math.sign(f),0,b,S),t.drawImage(e,r,n,a,i,0,0,C,x),t.setTransform(d,h,f,p,g,m),[C,x]}t.drawImage(e,r,n,a,i,s,o,l,u);const _=Math.hypot(d,h),y=Math.hypot(f,p);return[_*l,y*u]}class wTe{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=$Z;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=Uo.FILL;textRise=0;fillColor="#000000";strokeColor="#000000";patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps="none";constructor(e,r,n){n?.(this),this.clipBox=new Float32Array([0,0,e,r]),this.minMax=gS.slice()}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e}getPathBoundingBox(e=Wo.FILL,r=null){const n=this.minMax.slice();if(e===Wo.STROKE){r||ti("Stroke bounding box must include transform."),Er.singularValueDecompose2dScale(r,Cu);const a=Cu[0]*this.lineWidth/2,i=Cu[1]*this.lineWidth/2;n[0]-=a,n[1]-=i,n[2]+=a,n[3]+=i}return n}updateClipFromPath(){const e=Er.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set(gS,0)}getClippedPathBoundingBox(e=Wo.FILL,r=null){return Er.intersect(this.clipBox,this.getPathBoundingBox(e,r))}}function CTe(t,e){if(e instanceof ImageData){t.putImageData(e,0,0);return}const r=e.height,n=e.width,a=r%Gc,i=(r-a)/Gc,s=a===0?i:i+1,o=t.createImageData(n,Gc);let l=0,u;const d=e.data,h=o.data;let f,p,g,m;if(e.kind===BR.GRAYSCALE_1BPP){const _=d.byteLength,y=new Uint32Array(h.buffer,0,h.byteLength>>2),v=y.length,b=n+7>>3,E=4294967295,S=Ao.isLittleEndian?4278190080:255;for(f=0;f<s;f++){for(g=f<i?Gc:a,u=0,p=0;p<g;p++){const T=_-l;let x=0;const w=T>b?n:T*8-7,C=w&-8;let R=0,N=0;for(;x<C;x+=8)N=d[l++],y[u++]=N&128?E:S,y[u++]=N&64?E:S,y[u++]=N&32?E:S,y[u++]=N&16?E:S,y[u++]=N&8?E:S,y[u++]=N&4?E:S,y[u++]=N&2?E:S,y[u++]=N&1?E:S;for(;x<w;x++)R===0&&(N=d[l++],R=128),y[u++]=N&R?E:S,R>>=1}for(;u<v;)y[u++]=0;t.putImageData(o,0,f*Gc)}}else if(e.kind===BR.RGBA_32BPP){for(p=0,m=n*Gc*4,f=0;f<i;f++)h.set(d.subarray(l,l+m)),l+=m,t.putImageData(o,0,p),p+=Gc;f<s&&(m=n*a*4,h.set(d.subarray(l,l+m)),t.putImageData(o,0,p))}else if(e.kind===BR.RGB_24BPP)for(g=Gc,m=n*g,f=0;f<s;f++){for(f>=i&&(g=a,m=n*g),u=0,p=m;p--;)h[u++]=d[l++],h[u++]=d[l++],h[u++]=d[l++],h[u++]=255;t.putImageData(o,0,f*Gc)}else throw new Error(`bad image kind: ${e.kind}`)}function ATe(t,e){if(e.bitmap){t.drawImage(e.bitmap,0,0);return}const r=e.height,n=e.width,a=r%Gc,i=(r-a)/Gc,s=a===0?i:i+1,o=t.createImageData(n,Gc);let l=0;const u=e.data,d=o.data;for(let h=0;h<s;h++){const f=h<i?Gc:a;({srcPos:l}=C6t({src:u,srcPos:l,dest:d,width:n,height:f,nonBlackColor:0})),t.putImageData(o,0,h*Gc)}}function rA(t,e){const r=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of r)t[n]!==void 0&&(e[n]=t[n]);t.setLineDash!==void 0&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function uL(t){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",t.setLineDash!==void 0&&(t.setLineDash([]),t.lineDashOffset=0);const{filter:e}=t;e!=="none"&&e!==""&&(t.filter="none")}function RTe(t,e){if(e)return!0;Er.singularValueDecompose2dScale(t,Cu);const r=Math.fround(Xh.pixelRatio*yb.PDF_TO_CSS_UNITS);return Cu[0]<=r&&Cu[1]<=r}const I6t=["butt","round","square"],k6t=["miter","round","bevel"],O6t={},NTe={};class FS{constructor(e,r,n,a,i,{optionalContentConfig:s,markedContentStack:o=null},l,u,d){this.ctx=e,this.current=new wTe(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=r,this.objs=n,this.canvasFactory=a,this.filterFactory=i,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=s,this.cachedCanvases=new N6t(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=u,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=d??null}getObject(e,r,n=null){return typeof r=="string"?(this.dependencyTracker?.recordNamedDependency(e,r),r.startsWith("g_")?this.commonObjs.get(r):this.objs.get(r)):n}beginDrawing({transform:e,viewport:r,transparency:n=!1,background:a=null}){const i=this.ctx.canvas.width,s=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=a||"#ffffff",this.ctx.fillRect(0,0,i,s),this.ctx.fillStyle=o,n){const l=this.cachedCanvases.getCanvas("transparent",i,s);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...Ui(this.compositeCtx))}this.ctx.save(),uL(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...r.transform),this.viewportScale=r.scale,this.baseTransform=Ui(this.ctx)}executeOperatorList(e,r,n,a,i){const s=e.argsArray,o=e.fnArray;let l=r||0;const u=s.length;if(u===l)return l;const d=u-l>xTe&&typeof n=="function",h=d?Date.now()+A6t:0;let f=0;const p=this.commonObjs,g=this.objs;let m,_;for(;;){if(a!==void 0&&l===a.nextBreakPoint)return a.breakIt(l,n),l;if(!i||i(l))if(m=o[l],_=s[l]??null,m!==xx.dependency)_===null?this[m](l):this[m](l,..._);else for(const y of _){this.dependencyTracker?.recordNamedData(y,l);const v=y.startsWith("g_")?p:g;if(!v.has(y))return v.get(y,n),l}if(l++,l===u)return l;if(d&&++f>xTe){if(Date.now()>h)return n(),l;f=0}}}#e(){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)}endDrawing(){this.#e(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const r of e.values())typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&(r.width=r.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#t()}#t(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const r=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=r}}}_scaleImage(e,r){const n=e.width??e.displayWidth,a=e.height??e.displayHeight;let i=Math.max(Math.hypot(r[0],r[1]),1),s=Math.max(Math.hypot(r[2],r[3]),1),o=n,l=a,u="prescale1",d,h;for(;i>2&&o>1||s>2&&l>1;){let f=o,p=l;i>2&&o>1&&(f=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),i/=o/f),s>2&&l>1&&(p=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,s/=l/p),d=this.cachedCanvases.getCanvas(u,f,p),h=d.context,h.clearRect(0,0,f,p),h.drawImage(e,0,0,o,l,0,0,f,p),e=d.canvas,o=f,l=p,u=u==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:o,paintHeight:l}}_createMaskCanvas(e,r){const n=this.ctx,{width:a,height:i}=r,s=this.current.fillColor,o=this.current.patternFill,l=Ui(n);let u,d,h,f;if((r.bitmap||r.data)&&r.count>1){const R=r.bitmap||r.data.buffer;d=JSON.stringify(o?l:[l.slice(0,4),s]),u=this._cachedBitmapsMap.get(R),u||(u=new Map,this._cachedBitmapsMap.set(R,u));const N=u.get(d);if(N&&!o){const k=Math.round(Math.min(l[0],l[2])+l[4]),L=Math.round(Math.min(l[1],l[3])+l[5]);return this.dependencyTracker?.recordDependencies(e,cd.transformAndFill),{canvas:N,offsetX:k,offsetY:L}}h=N}h||(f=this.cachedCanvases.getCanvas("maskCanvas",a,i),ATe(f.context,r));let p=Er.transform(l,[1/a,0,0,-1/i,0,0]);p=Er.transform(p,[1,0,0,1,0,-i]);const g=gS.slice();Er.axialAlignedBoundingBox([0,0,a,i],p,g);const[m,_,y,v]=g,b=Math.round(y-m)||1,E=Math.round(v-_)||1,S=this.cachedCanvases.getCanvas("fillCanvas",b,E),T=S.context,x=m,w=_;T.translate(-x,-w),T.transform(...p),h||(h=this._scaleImage(f.canvas,_f(T)),h=h.img,u&&o&&u.set(d,h)),T.imageSmoothingEnabled=RTe(Ui(T),r.interpolate),cL(T,h,0,0,h.width,h.height,0,0,a,i),T.globalCompositeOperation="source-in";const C=Er.transform(_f(T),[1,0,0,1,-x,-w]);return T.fillStyle=o?s.getPattern(n,this,C,Wo.FILL,e):s,T.fillRect(0,0,a,i),u&&!o&&(this.cachedCanvases.delete("fillCanvas"),u.set(d,S.canvas)),this.dependencyTracker?.recordDependencies(e,cd.transformAndFill),{canvas:S.canvas,offsetX:Math.round(x),offsetY:Math.round(w)}}setLineWidth(e,r){this.dependencyTracker?.recordSimpleData("lineWidth",e),r!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=r,this.ctx.lineWidth=r}setLineCap(e,r){this.dependencyTracker?.recordSimpleData("lineCap",e),this.ctx.lineCap=I6t[r]}setLineJoin(e,r){this.dependencyTracker?.recordSimpleData("lineJoin",e),this.ctx.lineJoin=k6t[r]}setMiterLimit(e,r){this.dependencyTracker?.recordSimpleData("miterLimit",e),this.ctx.miterLimit=r}setDash(e,r,n){this.dependencyTracker?.recordSimpleData("dash",e);const a=this.ctx;a.setLineDash!==void 0&&(a.setLineDash(r),a.lineDashOffset=n)}setRenderingIntent(e,r){}setFlatness(e,r){}setGState(e,r){for(const[n,a]of r)switch(n){case"LW":this.setLineWidth(e,a);break;case"LC":this.setLineCap(e,a);break;case"LJ":this.setLineJoin(e,a);break;case"ML":this.setMiterLimit(e,a);break;case"D":this.setDash(e,a[0],a[1]);break;case"RI":this.setRenderingIntent(e,a);break;case"FL":this.setFlatness(e,a);break;case"Font":this.setFont(e,a[0],a[1]);break;case"CA":this.dependencyTracker?.recordSimpleData("strokeAlpha",e),this.current.strokeAlpha=a;break;case"ca":this.dependencyTracker?.recordSimpleData("fillAlpha",e),this.ctx.globalAlpha=this.current.fillAlpha=a;break;case"BM":this.dependencyTracker?.recordSimpleData("globalCompositeOperation",e),this.ctx.globalCompositeOperation=a;break;case"SMask":this.dependencyTracker?.recordSimpleData("SMask",e),this.current.activeSMask=a?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.dependencyTracker?.recordSimpleData("filter",e),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(a);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(e){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const r=this.ctx.canvas.width,n=this.ctx.canvas.height,a="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(a,r,n);this.suspendedCtx=this.ctx;const s=this.ctx=i.context;s.setTransform(this.suspendedCtx.getTransform()),rA(this.suspendedCtx,s),R6t(s,this.suspendedCtx),this.setGState(e,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),rA(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const r=this.current.activeSMask,n=this.suspendedCtx;this.composeSMask(n,r,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(e,r,n,a){const i=a[0],s=a[1],o=a[2]-i,l=a[3]-s;o===0||l===0||(this.genericComposeSMask(r.context,n,o,l,r.subtype,r.backdrop,r.transferMap,i,s,r.offsetX,r.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,0,0),e.restore())}genericComposeSMask(e,r,n,a,i,s,o,l,u,d,h){let f=e.canvas,p=l-d,g=u-h;if(s)if(p<0||g<0||p+n>f.width||g+a>f.height){const _=this.cachedCanvases.getCanvas("maskExtension",n,a),y=_.context;y.drawImage(f,-p,-g),y.globalCompositeOperation="destination-atop",y.fillStyle=s,y.fillRect(0,0,n,a),y.globalCompositeOperation="source-over",f=_.canvas,p=g=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const _=new Path2D;_.rect(p,g,n,a),e.clip(_),e.globalCompositeOperation="destination-atop",e.fillStyle=s,e.fillRect(p,g,n,a),e.restore()}r.save(),r.globalAlpha=1,r.setTransform(1,0,0,1,0,0),i==="Alpha"&&o?r.filter=this.filterFactory.addAlphaFilter(o):i==="Luminosity"&&(r.filter=this.filterFactory.addLuminosityFilter(o));const m=new Path2D;m.rect(l,u,n,a),r.clip(m),r.globalCompositeOperation="destination-in",r.drawImage(f,p,g,n,a,l,u,n,a),r.restore()}save(e){this.inSMaskMode&&rA(this.ctx,this.suspendedCtx),this.ctx.save();const r=this.current;this.stateStack.push(r),this.current=r.clone(),this.dependencyTracker?.save(e)}restore(e){if(this.dependencyTracker?.restore(e),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&rA(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,r,n,a,i,s,o){this.dependencyTracker?.recordIncrementalData("transform",e),this.ctx.transform(r,n,a,i,s,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,r,n,a){let[i]=n;if(!a){i||=n[0]=new Path2D,this[r](e,i);return}if(this.dependencyTracker!==null){const s=r===xx.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(e).recordBBox(e,this.ctx,a[0]-s,a[2]+s,a[1]-s,a[3]+s).recordDependencies(e,["transform"])}if(!(i instanceof Path2D)){const s=n[0]=new Path2D;for(let o=0,l=i.length;o<l;)switch(i[o++]){case nL.moveTo:s.moveTo(i[o++],i[o++]);break;case nL.lineTo:s.lineTo(i[o++],i[o++]);break;case nL.curveTo:s.bezierCurveTo(i[o++],i[o++],i[o++],i[o++],i[o++],i[o++]);break;case nL.closePath:s.closePath();break;default:Cn(`Unrecognized drawing path operator: ${i[o-1]}`);break}i=s}Er.axialAlignedBoundingBox(a,Ui(this.ctx),this.current.minMax),this[r](e,i),this._pathStartIdx=e}closePath(e){this.ctx.closePath()}stroke(e,r,n=!0){const a=this.ctx,i=this.current.strokeColor;if(a.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof i=="object"&&i?.getPattern){const s=i.isModifyingCurrentTransform()?a.getTransform():null;if(a.save(),a.strokeStyle=i.getPattern(a,this,_f(a),Wo.STROKE,e),s){const o=new Path2D;o.addPath(r,a.getTransform().invertSelf().multiplySelf(s)),r=o}this.rescaleAndStroke(r,!1),a.restore()}else this.rescaleAndStroke(r,!0);this.dependencyTracker?.recordDependencies(e,cd.stroke),n&&this.consumePath(e,r,this.current.getClippedPathBoundingBox(Wo.STROKE,Ui(this.ctx))),a.globalAlpha=this.current.fillAlpha}closeStroke(e,r){this.stroke(e,r)}fill(e,r,n=!0){const a=this.ctx,i=this.current.fillColor,s=this.current.patternFill;let o=!1;if(s){const u=i.isModifyingCurrentTransform()?a.getTransform():null;if(this.dependencyTracker?.save(e),a.save(),a.fillStyle=i.getPattern(a,this,_f(a),Wo.FILL,e),u){const d=new Path2D;d.addPath(r,a.getTransform().invertSelf().multiplySelf(u)),r=d}o=!0}const l=this.current.getClippedPathBoundingBox();this.contentVisible&&l!==null&&(this.pendingEOFill?(a.fill(r,"evenodd"),this.pendingEOFill=!1):a.fill(r)),this.dependencyTracker?.recordDependencies(e,cd.fill),o&&(a.restore(),this.dependencyTracker?.restore(e)),n&&this.consumePath(e,r,l)}eoFill(e,r){this.pendingEOFill=!0,this.fill(e,r)}fillStroke(e,r){this.fill(e,r,!1),this.stroke(e,r,!1),this.consumePath(e,r)}eoFillStroke(e,r){this.pendingEOFill=!0,this.fillStroke(e,r)}closeFillStroke(e,r){this.fillStroke(e,r)}closeEOFillStroke(e,r){this.pendingEOFill=!0,this.fillStroke(e,r)}endPath(e,r){this.consumePath(e,r)}rawFillPath(e,r){this.ctx.fill(r),this.dependencyTracker?.recordDependencies(e,cd.rawFillPath).recordOperation(e)}clip(e){this.dependencyTracker?.recordFutureForcedDependency("clipMode",e),this.pendingClip=O6t}eoClip(e){this.dependencyTracker?.recordFutureForcedDependency("clipMode",e),this.pendingClip=NTe}beginText(e){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.dependencyTracker?.recordOpenMarker(e).resetIncrementalData("sameLineText").resetIncrementalData("moveText",e)}endText(e){const r=this.pendingTextPaths,n=this.ctx;if(this.dependencyTracker){const{dependencyTracker:a}=this;r!==void 0&&a.recordFutureForcedDependency("textClip",a.getOpenMarker()).recordFutureForcedDependency("textClip",e),a.recordCloseMarker(e)}if(r!==void 0){const a=new Path2D,i=n.getTransform().invertSelf();for(const{transform:s,x:o,y:l,fontSize:u,path:d}of r)d&&a.addPath(d,new DOMMatrix(s).preMultiplySelf(i).translate(o,l).scale(u,-u));n.clip(a)}delete this.pendingTextPaths}setCharSpacing(e,r){this.dependencyTracker?.recordSimpleData("charSpacing",e),this.current.charSpacing=r}setWordSpacing(e,r){this.dependencyTracker?.recordSimpleData("wordSpacing",e),this.current.wordSpacing=r}setHScale(e,r){this.dependencyTracker?.recordSimpleData("hScale",e),this.current.textHScale=r/100}setLeading(e,r){this.dependencyTracker?.recordSimpleData("leading",e),this.current.leading=-r}setFont(e,r,n){this.dependencyTracker?.recordSimpleData("font",e).recordSimpleDataFromNamed("fontObj",r,e);const a=this.commonObjs.get(r),i=this.current;if(!a)throw new Error(`Can't find font for ${r}`);if(i.fontMatrix=a.fontMatrix||$Z,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&Cn("Invalid font matrix for font "+r),n<0?(n=-n,i.fontDirection=-1):i.fontDirection=1,this.current.font=a,this.current.fontSize=n,a.isType3Font)return;const s=a.loadedName||"sans-serif",o=a.systemFontInfo?.css||`"${s}", ${a.fallbackName}`;let l="normal";a.black?l="900":a.bold&&(l="bold");const u=a.italic?"italic":"normal";let d=n;n<STe?d=STe:n>TTe&&(d=TTe),this.current.fontSizeScale=n/d,this.ctx.font=`${u} ${l} ${d}px ${o}`}setTextRenderingMode(e,r){this.dependencyTracker?.recordSimpleData("textRenderingMode",e),this.current.textRenderingMode=r}setTextRise(e,r){this.dependencyTracker?.recordSimpleData("textRise",e),this.current.textRise=r}moveText(e,r,n){this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText",e),this.current.x=this.current.lineX+=r,this.current.y=this.current.lineY+=n}setLeadingMoveText(e,r,n){this.setLeading(e,-n),this.moveText(e,r,n)}setTextMatrix(e,r){this.dependencyTracker?.recordSimpleData("textMatrix",e);const{current:n}=this;n.textMatrix=r,n.textMatrixScale=Math.hypot(r[0],r[1]),n.x=n.lineX=0,n.y=n.lineY=0}nextLine(e){this.moveText(e,0,this.current.leading),this.dependencyTracker?.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??e)}#n(e,r,n){const a=new Path2D;return a.addPath(e,new DOMMatrix(n).invertSelf().multiplySelf(r)),a}paintChar(e,r,n,a,i,s){const o=this.ctx,l=this.current,u=l.font,d=l.textRenderingMode,h=l.fontSize/l.fontSizeScale,f=d&Uo.FILL_STROKE_MASK,p=!!(d&Uo.ADD_TO_PATH_FLAG),g=l.patternFill&&!u.missingFile,m=l.patternStroke&&!u.missingFile;let _;if((u.disableFontFace||p||g||m)&&!u.missingFile&&(_=u.getPathGenerator(this.commonObjs,r)),_&&(u.disableFontFace||g||m)){o.save(),o.translate(n,a),o.scale(h,-h),this.dependencyTracker?.recordCharacterBBox(e,o,u);let y;if(f===Uo.FILL||f===Uo.FILL_STROKE)if(i){y=o.getTransform(),o.setTransform(...i);const v=this.#n(_,y,i);o.fill(v)}else o.fill(_);if(f===Uo.STROKE||f===Uo.FILL_STROKE)if(s){y||=o.getTransform(),o.setTransform(...s);const{a:v,b,c:E,d:S}=y,T=Er.inverseTransform(s),x=Er.transform([v,b,E,S,0,0],T);Er.singularValueDecompose2dScale(x,Cu),o.lineWidth*=Math.max(Cu[0],Cu[1])/h,o.stroke(this.#n(_,y,s))}else o.lineWidth/=h,o.stroke(_);o.restore()}else(f===Uo.FILL||f===Uo.FILL_STROKE)&&(o.fillText(r,n,a),this.dependencyTracker?.recordCharacterBBox(e,o,u,h,n,a,()=>o.measureText(r))),(f===Uo.STROKE||f===Uo.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(e,o,u,h,n,a,()=>o.measureText(r)).recordDependencies(e,cd.stroke),o.strokeText(r,n,a));p&&((this.pendingTextPaths||=[]).push({transform:Ui(o),x:n,y:a,fontSize:h,path:_}),this.dependencyTracker?.recordCharacterBBox(e,o,u,h,n,a))}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const r=e.getImageData(0,0,10,10).data;let n=!1;for(let a=3;a<r.length;a+=4)if(r[a]>0&&r[a]<255){n=!0;break}return Dn(this,"isFontSubpixelAAEnabled",n)}showText(e,r){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(e,cd.showText).resetBBox(e),this.current.textRenderingMode&Uo.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",e).inheritPendingDependenciesAsFutureForcedDependencies());const n=this.current,a=n.font;if(a.isType3Font){this.showType3Text(e,r),this.dependencyTracker?.recordShowTextOperation(e);return}const i=n.fontSize;if(i===0){this.dependencyTracker?.recordOperation(e);return}const s=this.ctx,o=n.fontSizeScale,l=n.charSpacing,u=n.wordSpacing,d=n.fontDirection,h=n.textHScale*d,f=r.length,p=a.vertical,g=p?1:-1,m=a.defaultVMetrics,_=i*n.fontMatrix[0],y=n.textRenderingMode===Uo.FILL&&!a.disableFontFace&&!n.patternFill;s.save(),n.textMatrix&&s.transform(...n.textMatrix),s.translate(n.x,n.y+n.textRise),d>0?s.scale(h,-1):s.scale(h,1);let v,b;if(n.patternFill){s.save();const w=n.fillColor.getPattern(s,this,_f(s),Wo.FILL,e);v=Ui(s),s.restore(),s.fillStyle=w}if(n.patternStroke){s.save();const w=n.strokeColor.getPattern(s,this,_f(s),Wo.STROKE,e);b=Ui(s),s.restore(),s.strokeStyle=w}let E=n.lineWidth;const S=n.textMatrixScale;if(S===0||E===0){const w=n.textRenderingMode&Uo.FILL_STROKE_MASK;(w===Uo.STROKE||w===Uo.FILL_STROKE)&&(E=this.getSinglePixelWidth())}else E/=S;if(o!==1&&(s.scale(o,o),E/=o),s.lineWidth=E,a.isInvalidPDFjsFont){const w=[];let C=0;for(const N of r)w.push(N.unicode),C+=N.width;const R=w.join("");if(s.fillText(R,0,0),this.dependencyTracker!==null){const N=s.measureText(R);this.dependencyTracker.recordBBox(e,this.ctx,-N.actualBoundingBoxLeft,N.actualBoundingBoxRight,-N.actualBoundingBoxAscent,N.actualBoundingBoxDescent).recordShowTextOperation(e)}n.x+=C*_*h,s.restore(),this.compose();return}let T=0,x;for(x=0;x<f;++x){const w=r[x];if(typeof w=="number"){T+=g*w*i/1e3;continue}let C=!1;const R=(w.isSpace?u:0)+l,N=w.fontChar,k=w.accent;let L,A,D=w.width;if(p){const F=w.vmetric||m,U=-(w.vmetric?F[1]:D*.5)*_,V=F[2]*_;D=F?-F[0]:D,L=U/o,A=(T+V)/o}else L=T/o,A=0;let M;if(a.remeasure&&D>0){M=s.measureText(N);const F=M.width*1e3/i*o;if(D<F&&this.isFontSubpixelAAEnabled){const U=D/F;C=!0,s.save(),s.scale(U,1),L/=U}else D!==F&&(L+=(D-F)/2e3*i/o)}if(this.contentVisible&&(w.isInFont||a.missingFile)){if(y&&!k)s.fillText(N,L,A),this.dependencyTracker?.recordCharacterBBox(e,s,M?{bbox:null}:a,i/o,L,A,()=>M??s.measureText(N));else if(this.paintChar(e,N,L,A,v,b),k){const F=L+i*k.offset.x/o,U=A-i*k.offset.y/o;this.paintChar(e,k.fontChar,F,U,v,b)}}const B=p?D*_-R*d:D*_+R*d;T+=B,C&&s.restore()}p?n.y-=T:n.x+=T*h,s.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(e)}showType3Text(e,r){const n=this.ctx,a=this.current,i=a.font,s=a.fontSize,o=a.fontDirection,l=i.vertical?1:-1,u=a.charSpacing,d=a.wordSpacing,h=a.textHScale*o,f=a.fontMatrix||$Z,p=r.length,g=a.textRenderingMode===Uo.INVISIBLE;let m,_,y,v;if(g||s===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,n.save(),a.textMatrix&&n.transform(...a.textMatrix),n.translate(a.x,a.y+a.textRise),n.scale(h,o);const b=this.dependencyTracker;for(this.dependencyTracker=b?new g5(b,e):null,m=0;m<p;++m){if(_=r[m],typeof _=="number"){v=l*_*s/1e3,this.ctx.translate(v,0),a.x+=v*h;continue}const E=(_.isSpace?d:0)+u,S=i.charProcOperatorList[_.operatorListId];S?this.contentVisible&&(this.save(),n.scale(s,s),n.transform(...f),this.executeOperatorList(S),this.restore()):Cn(`Type3 character "${_.operatorListId}" is not available.`);const T=[_.width,0];Er.applyTransform(T,f),y=T[0]*s+E,n.translate(y,0),a.x+=y*h}n.restore(),b&&(this.dependencyTracker=b)}setCharWidth(e,r,n){}setCharWidthAndBounds(e,r,n,a,i,s,o){const l=new Path2D;l.rect(a,i,s-a,o-i),this.ctx.clip(l),this.dependencyTracker?.recordBBox(e,this.ctx,a,s,i,o).recordClipBox(e,this.ctx,a,s,i,o),this.endPath(e)}getColorN_Pattern(e,r){let n;if(r[0]==="TilingPattern"){const a=this.baseTransform||Ui(this.ctx),i={createCanvasGraphics:(s,o)=>new FS(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new g5(this.dependencyTracker,o,!0):null)};n=new yce(r,this.ctx,i,a)}else n=this._getPattern(e,r[1],r[2]);return n}setStrokeColorN(e,...r){this.dependencyTracker?.recordSimpleData("strokeColor",e),this.current.strokeColor=this.getColorN_Pattern(e,r),this.current.patternStroke=!0}setFillColorN(e,...r){this.dependencyTracker?.recordSimpleData("fillColor",e),this.current.fillColor=this.getColorN_Pattern(e,r),this.current.patternFill=!0}setStrokeRGBColor(e,r){this.dependencyTracker?.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor=r,this.current.patternStroke=!1}setStrokeTransparent(e){this.dependencyTracker?.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e,r){this.dependencyTracker?.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor=r,this.current.patternFill=!1}setFillTransparent(e){this.dependencyTracker?.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,r,n=null){let a;return this.cachedPatterns.has(r)?a=this.cachedPatterns.get(r):(a=w6t(this.getObject(e,r)),this.cachedPatterns.set(r,a)),n&&(a.matrix=n),a}shadingFill(e,r){if(!this.contentVisible)return;const n=this.ctx;this.save(e);const a=this._getPattern(e,r);n.fillStyle=a.getPattern(n,this,_f(n),Wo.SHADING,e);const i=_f(n);if(i){const{width:s,height:o}=n.canvas,l=gS.slice();Er.axialAlignedBoundingBox([0,0,s,o],i,l);const[u,d,h,f]=l;this.ctx.fillRect(u,d,h-u,f-d)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(e).recordFullPageBBox(e).recordDependencies(e,cd.transform).recordDependencies(e,cd.fill).recordOperation(e),this.compose(this.current.getClippedPathBoundingBox()),this.restore(e)}beginInlineImage(){ti("Should not call beginInlineImage")}beginImageData(){ti("Should not call beginImageData")}paintFormXObjectBegin(e,r,n){if(this.contentVisible&&(this.save(e),this.baseTransformStack.push(this.baseTransform),r&&this.transform(e,...r),this.baseTransform=Ui(this.ctx),n)){Er.axialAlignedBoundingBox(n,this.baseTransform,this.current.minMax);const[a,i,s,o]=n,l=new Path2D;l.rect(a,i,s-a,o-i),this.ctx.clip(l),this.dependencyTracker?.recordClipBox(e,this.ctx,a,s,i,o),this.endPath(e)}}paintFormXObjectEnd(e){this.contentVisible&&(this.restore(e),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e,r){if(!this.contentVisible)return;this.save(e),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const n=this.ctx;r.isolated||FF("TODO: Support non-isolated groups."),r.knockout&&Cn("Knockout groups not supported.");const a=Ui(n);if(r.matrix&&n.transform(...r.matrix),!r.bbox)throw new Error("Bounding box is required.");let i=gS.slice();Er.axialAlignedBoundingBox(r.bbox,Ui(n),i);const s=[0,0,n.canvas.width,n.canvas.height];i=Er.intersect(i,s)||[0,0,0,0];const o=Math.floor(i[0]),l=Math.floor(i[1]),u=Math.max(Math.ceil(i[2])-o,1),d=Math.max(Math.ceil(i[3])-l,1);this.current.startNewPathAndClipBox([0,0,u,d]);let h="groupAt"+this.groupLevel;r.smask&&(h+="_smask_"+this.smaskCounter++%2);const f=this.cachedCanvases.getCanvas(h,u,d),p=f.context;p.translate(-o,-l),p.transform(...a);let g=new Path2D;const[m,_,y,v]=r.bbox;if(g.rect(m,_,y-m,v-_),r.matrix){const b=new Path2D;b.addPath(g,new DOMMatrix(r.matrix)),g=b}p.clip(g),r.smask&&this.smaskStack.push({canvas:f.canvas,context:p,offsetX:o,offsetY:l,subtype:r.smask.subtype,backdrop:r.smask.backdrop,transferMap:r.smask.transferMap||null,startTransformInverse:null}),(!r.smask||this.dependencyTracker)&&(n.setTransform(1,0,0,1,0,0),n.translate(o,l),n.save()),rA(n,p),this.ctx=p,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(n),this.setGState(e,[["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(n),this.groupLevel++}endGroup(e,r){if(!this.contentVisible)return;this.groupLevel--;const n=this.ctx,a=this.groupStack.pop();if(this.ctx=a,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),r.smask)this.tempSMask=this.smaskStack.pop(),this.restore(e),this.dependencyTracker&&this.ctx.restore();else{this.ctx.restore();const i=Ui(this.ctx);this.restore(e),this.ctx.save(),this.ctx.setTransform(...i);const s=gS.slice();Er.axialAlignedBoundingBox([0,0,n.canvas.width,n.canvas.height],i,s),this.ctx.drawImage(n.canvas,0,0),this.ctx.restore(),this.compose(s)}}beginAnnotation(e,r,n,a,i,s){if(this.#e(),uL(this.ctx),this.ctx.save(),this.save(e),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),n){const o=n[2]-n[0],l=n[3]-n[1];if(s&&this.annotationCanvasMap){a=a.slice(),a[4]-=n[0],a[5]-=n[1],n=n.slice(),n[0]=n[1]=0,n[2]=o,n[3]=l,Er.singularValueDecompose2dScale(Ui(this.ctx),Cu);const{viewportScale:u}=this,d=Math.ceil(o*this.outputScaleX*u),h=Math.ceil(l*this.outputScaleY*u);this.annotationCanvas=this.canvasFactory.create(d,h);const{canvas:f,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(r,f),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.save(),this.ctx.setTransform(Cu[0],0,0,-Cu[1],0,l*Cu[1]),uL(this.ctx)}else{uL(this.ctx),this.endPath(e);const u=new Path2D;u.rect(n[0],n[1],o,l),this.ctx.clip(u)}}this.current=new wTe(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(e,...a),this.transform(e,...i)}endAnnotation(e){this.annotationCanvas&&(this.ctx.restore(),this.#t(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e,r){if(!this.contentVisible)return;const n=r.count;r=this.getObject(e,r.data,r),r.count=n;const a=this.ctx,i=this._createMaskCanvas(e,r),s=i.canvas;a.save(),a.setTransform(1,0,0,1,0,0),a.drawImage(s,i.offsetX,i.offsetY),this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,i.offsetX,i.offsetX+s.width,i.offsetY,i.offsetY+s.height).recordOperation(e),a.restore(),this.compose()}paintImageMaskXObjectRepeat(e,r,n,a=0,i=0,s,o){if(!this.contentVisible)return;r=this.getObject(e,r.data,r);const l=this.ctx;l.save();const u=Ui(l);l.transform(n,a,i,s,0,0);const d=this._createMaskCanvas(e,r);l.setTransform(1,0,0,1,d.offsetX-u[4],d.offsetY-u[5]),this.dependencyTracker?.resetBBox(e);for(let h=0,f=o.length;h<f;h+=2){const p=Er.transform(u,[n,a,i,s,o[h],o[h+1]]);l.drawImage(d.canvas,p[4],p[5]),this.dependencyTracker?.recordBBox(e,this.ctx,p[4],p[4]+d.canvas.width,p[5],p[5]+d.canvas.height)}l.restore(),this.compose(),this.dependencyTracker?.recordOperation(e)}paintImageMaskXObjectGroup(e,r){if(!this.contentVisible)return;const n=this.ctx,a=this.current.fillColor,i=this.current.patternFill;this.dependencyTracker?.resetBBox(e).recordDependencies(e,cd.transformAndFill);for(const s of r){const{data:o,width:l,height:u,transform:d}=s,h=this.cachedCanvases.getCanvas("maskCanvas",l,u),f=h.context;f.save();const p=this.getObject(e,o,s);ATe(f,p),f.globalCompositeOperation="source-in",f.fillStyle=i?a.getPattern(f,this,_f(n),Wo.FILL,e):a,f.fillRect(0,0,l,u),f.restore(),n.save(),n.transform(...d),n.scale(1,-1),cL(n,h.canvas,0,0,l,u,0,-1,1,1),this.dependencyTracker?.recordBBox(e,n,0,l,0,u),n.restore()}this.compose(),this.dependencyTracker?.recordOperation(e)}paintImageXObject(e,r){if(!this.contentVisible)return;const n=this.getObject(e,r);if(!n){Cn("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e,n)}paintImageXObjectRepeat(e,r,n,a,i){if(!this.contentVisible)return;const s=this.getObject(e,r);if(!s){Cn("Dependent image isn't ready yet");return}const o=s.width,l=s.height,u=[];for(let d=0,h=i.length;d<h;d+=2)u.push({transform:[n,0,0,a,i[d],i[d+1]],x:0,y:0,w:o,h:l});this.paintInlineImageXObjectGroup(e,s,u)}applyTransferMapsToCanvas(e){return this.current.transferMaps!=="none"&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return e.bitmap;const{bitmap:r,width:n,height:a}=e,i=this.cachedCanvases.getCanvas("inlineImage",n,a),s=i.context;return s.filter=this.current.transferMaps,s.drawImage(r,0,0),s.filter="none",i.canvas}paintInlineImageXObject(e,r){if(!this.contentVisible)return;const n=r.width,a=r.height,i=this.ctx;this.save(e);const{filter:s}=i;s!=="none"&&s!==""&&(i.filter="none"),i.scale(1/n,-1/a);let o;if(r.bitmap)o=this.applyTransferMapsToBitmap(r);else if(typeof HTMLElement=="function"&&r instanceof HTMLElement||!r.data)o=r;else{const d=this.cachedCanvases.getCanvas("inlineImage",n,a).context;CTe(d,r),o=this.applyTransferMapsToCanvas(d)}const l=this._scaleImage(o,_f(i));i.imageSmoothingEnabled=RTe(Ui(i),r.interpolate),this.dependencyTracker?.resetBBox(e).recordBBox(e,i,0,n,-a,0).recordDependencies(e,cd.imageXObject).recordOperation(e),cL(i,l.img,0,0,l.paintWidth,l.paintHeight,0,-a,n,a),this.compose(),this.restore(e)}paintInlineImageXObjectGroup(e,r,n){if(!this.contentVisible)return;const a=this.ctx;let i;if(r.bitmap)i=r.bitmap;else{const s=r.width,o=r.height,u=this.cachedCanvases.getCanvas("inlineImage",s,o).context;CTe(u,r),i=this.applyTransferMapsToCanvas(u)}this.dependencyTracker?.resetBBox(e);for(const s of n)a.save(),a.transform(...s.transform),a.scale(1,-1),cL(a,i,s.x,s.y,s.w,s.h,0,-1,1,1),this.dependencyTracker?.recordBBox(e,a,0,1,-1,0),a.restore();this.dependencyTracker?.recordOperation(e),this.compose()}paintSolidColorImageMask(e){this.contentVisible&&(this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,0,1,0,1).recordDependencies(e,cd.fill).recordOperation(e),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e,r){}markPointProps(e,r,n){}beginMarkedContent(e,r){this.dependencyTracker?.beginMarkedContent(e),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,r,n){this.dependencyTracker?.beginMarkedContent(e),r==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(n)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(e){this.dependencyTracker?.endMarkedContent(e),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(e){}endCompat(e){}consumePath(e,r,n){const a=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(n);const i=this.ctx;this.pendingClip?(a||(this.pendingClip===NTe?i.clip(r,"evenodd"):i.clip(r)),this.pendingClip=null,this.dependencyTracker?.bboxToClipBoxDropOperation(e).recordFutureForcedDependency("clipPath",e)):this.dependencyTracker?.recordOperation(e),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=Ui(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const r=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),a=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(n,a)/r}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:r,b:n,c:a,d:i}=this.ctx.getTransform();let s,o;if(n===0&&a===0){const l=Math.abs(r),u=Math.abs(i);if(l===u)if(e===0)s=o=1/l;else{const d=l*e;s=o=d<1?1/d:1}else if(e===0)s=1/l,o=1/u;else{const d=l*e,h=u*e;s=d<1?1/d:1,o=h<1?1/h:1}}else{const l=Math.abs(r*i-n*a),u=Math.hypot(r,n),d=Math.hypot(a,i);if(e===0)s=d/l,o=u/l;else{const h=e*l;s=d>h?d/h:1,o=u>h?u/h:1}}this._cachedScaleForStroking[0]=s,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(e,r){const{ctx:n,current:{lineWidth:a}}=this,[i,s]=this.getScaleForStroking();if(i===s){n.lineWidth=(a||1)*i,n.stroke(e);return}const o=n.getLineDash();r&&n.save(),n.scale(i,s),rH.a=1/i,rH.d=1/s;const l=new Path2D;if(l.addPath(e,rH),o.length>0){const u=Math.max(i,s);n.setLineDash(o.map(d=>d/u)),n.lineDashOffset/=u}n.lineWidth=a||1,n.stroke(l),r&&n.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}for(const t in xx)FS.prototype[t]!==void 0&&(FS.prototype[xx[t]]=FS.prototype[t]);class US{#e;#t;#n;static strings=["fontFamily","fontWeight","italicAngle"];static write(e){const r=new TextEncoder,n={};let a=0;for(const u of US.strings){const d=r.encode(e[u]);n[u]=d,a+=4+d.length}const i=new ArrayBuffer(a),s=new Uint8Array(i),o=new DataView(i);let l=0;for(const u of US.strings){const d=n[u],h=d.length;o.setUint32(l,h),s.set(d,l+4),l+=4+h}return ca(l===i.byteLength,"CssFontInfo.write: Buffer overflow"),i}constructor(e){this.#e=e,this.#t=new DataView(this.#e),this.#n=new TextDecoder}#r(e){ca(e<US.strings.length,"Invalid string index");let r=0;for(let a=0;a<e;a++)r+=this.#t.getUint32(r)+4;const n=this.#t.getUint32(r);return this.#n.decode(new Uint8Array(this.#e,r+4,n))}get fontFamily(){return this.#r(0)}get fontWeight(){return this.#r(1)}get italicAngle(){return this.#r(2)}}class $S{#e;#t;#n;static strings=["css","loadedName","baseFontName","src"];static write(e){const r=new TextEncoder,n={};let a=0;for(const f of $S.strings){const p=r.encode(e[f]);n[f]=p,a+=4+p.length}a+=4;let i,s,o=1+a;e.style&&(i=r.encode(e.style.style),s=r.encode(e.style.weight),o+=4+i.length+4+s.length);const l=new ArrayBuffer(o),u=new Uint8Array(l),d=new DataView(l);let h=0;d.setUint8(h++,e.guessFallback?1:0),d.setUint32(h,0),h+=4,a=0;for(const f of $S.strings){const p=n[f],g=p.length;a+=4+g,d.setUint32(h,g),u.set(p,h+4),h+=4+g}return d.setUint32(h-a-4,a),e.style&&(d.setUint32(h,i.length),u.set(i,h+4),h+=4+i.length,d.setUint32(h,s.length),u.set(s,h+4),h+=4+s.length),ca(h<=l.byteLength,"SubstitionInfo.write: Buffer overflow"),l.transferToFixedLength(h)}constructor(e){this.#e=e,this.#t=new DataView(this.#e),this.#n=new TextDecoder}get guessFallback(){return this.#t.getUint8(0)!==0}#r(e){ca(e<$S.strings.length,"Invalid string index");let r=5;for(let a=0;a<e;a++)r+=this.#t.getUint32(r)+4;const n=this.#t.getUint32(r);return this.#n.decode(new Uint8Array(this.#e,r+4,n))}get css(){return this.#r(0)}get loadedName(){return this.#r(1)}get baseFontName(){return this.#r(2)}get src(){return this.#r(3)}get style(){let e=1;e+=4+this.#t.getUint32(e);const r=this.#t.getUint32(e),n=this.#n.decode(new Uint8Array(this.#e,e+4,r));e+=4+r;const a=this.#t.getUint32(e),i=this.#n.decode(new Uint8Array(this.#e,e+4,a));return{style:n,weight:i}}}class Za{static bools=["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"];static numbers=["ascent","defaultWidth","descent"];static strings=["fallbackName","loadedName","mimetype","name"];static#e=Math.ceil(this.bools.length*2/8);static#t=this.#e+this.numbers.length*8;static#n=this.#t+1+8;static#r=this.#n+1+48;static#s=this.#r+1+6;#a;#i;#o;constructor({data:e,extra:r}){this.#a=e,this.#i=new TextDecoder,this.#o=new DataView(this.#a),r&&Object.assign(this,r)}#c(e){ca(e<Za.bools.length,"Invalid boolean index");const r=Math.floor(e/4),n=e*2%8,a=this.#o.getUint8(r)>>n&3;return a===0?void 0:a===2}get black(){return this.#c(0)}get bold(){return this.#c(1)}get disableFontFace(){return this.#c(2)}get fontExtraProperties(){return this.#c(3)}get isInvalidPDFjsFont(){return this.#c(4)}get isType3Font(){return this.#c(5)}get italic(){return this.#c(6)}get missingFile(){return this.#c(7)}get remeasure(){return this.#c(8)}get vertical(){return this.#c(9)}#l(e){return ca(e<Za.numbers.length,"Invalid number index"),this.#o.getFloat64(Za.#e+e*8)}get ascent(){return this.#l(0)}get defaultWidth(){return this.#l(1)}get descent(){return this.#l(2)}get bbox(){let e=Za.#t;if(this.#o.getUint8(e)===0)return;e+=1;const n=[];for(let a=0;a<4;a++)n.push(this.#o.getInt16(e,!0)),e+=2;return n}get fontMatrix(){let e=Za.#n;if(this.#o.getUint8(e)===0)return;e+=1;const n=[];for(let a=0;a<6;a++)n.push(this.#o.getFloat64(e,!0)),e+=8;return n}get defaultVMetrics(){let e=Za.#r;if(this.#o.getUint8(e)===0)return;e+=1;const n=[];for(let a=0;a<3;a++)n.push(this.#o.getInt16(e,!0)),e+=2;return n}#h(e){ca(e<Za.strings.length,"Invalid string index");let r=Za.#s+4;for(let i=0;i<e;i++)r+=this.#o.getUint32(r)+4;const n=this.#o.getUint32(r),a=new Uint8Array(n);return a.set(new Uint8Array(this.#a,r+4,n)),this.#i.decode(a)}get fallbackName(){return this.#h(0)}get loadedName(){return this.#h(1)}get mimetype(){return this.#h(2)}get name(){return this.#h(3)}get data(){let e=Za.#s;const r=this.#o.getUint32(e);e+=4+r;const n=this.#o.getUint32(e);e+=4+n;const a=this.#o.getUint32(e);e+=4+a;const i=this.#o.getUint32(e);if(i!==0)return new Uint8Array(this.#a,e+4,i)}clearData(){let e=Za.#s;const r=this.#o.getUint32(e);e+=4+r;const n=this.#o.getUint32(e);e+=4+n;const a=this.#o.getUint32(e);e+=4+a;const i=this.#o.getUint32(e);new Uint8Array(this.#a,e+4,i).fill(0),this.#o.setUint32(e,0)}get cssFontInfo(){let e=Za.#s;const r=this.#o.getUint32(e);e+=4+r;const n=this.#o.getUint32(e);e+=4+n;const a=this.#o.getUint32(e);if(a===0)return null;const i=new Uint8Array(a);return i.set(new Uint8Array(this.#a,e+4,a)),new US(i.buffer)}get systemFontInfo(){let e=Za.#s;const r=this.#o.getUint32(e);e+=4+r;const n=this.#o.getUint32(e);if(n===0)return null;const a=new Uint8Array(n);return a.set(new Uint8Array(this.#a,e+4,n)),new $S(a.buffer)}static write(e){const r=e.systemFontInfo?$S.write(e.systemFontInfo):null,n=e.cssFontInfo?US.write(e.cssFontInfo):null,a=new TextEncoder,i={};let s=0;for(const m of Za.strings)i[m]=a.encode(e[m]),s+=4+i[m].length;const o=Za.#s+4+s+4+(r?r.byteLength:0)+4+(n?n.byteLength:0)+4+(e.data?e.data.length:0),l=new ArrayBuffer(o),u=new Uint8Array(l),d=new DataView(l);let h=0;const f=Za.bools.length;let p=0,g=0;for(let m=0;m<f;m++){const _=e[Za.bools[m]];p|=(_===void 0?0:_?2:1)<<g,g+=2,(g===8||m===f-1)&&(d.setUint8(h++,p),p=0,g=0)}ca(h===Za.#e,"FontInfo.write: Boolean properties offset mismatch");for(const m of Za.numbers)d.setFloat64(h,e[m]),h+=8;if(ca(h===Za.#t,"FontInfo.write: Number properties offset mismatch"),e.bbox){d.setUint8(h++,4);for(const m of e.bbox)d.setInt16(h,m,!0),h+=2}else d.setUint8(h++,0),h+=8;if(ca(h===Za.#n,"FontInfo.write: BBox properties offset mismatch"),e.fontMatrix){d.setUint8(h++,6);for(const m of e.fontMatrix)d.setFloat64(h,m,!0),h+=8}else d.setUint8(h++,0),h+=48;if(ca(h===Za.#r,"FontInfo.write: FontMatrix properties offset mismatch"),e.defaultVMetrics){d.setUint8(h++,1);for(const m of e.defaultVMetrics)d.setInt16(h,m,!0),h+=2}else d.setUint8(h++,0),h+=6;ca(h===Za.#s,"FontInfo.write: DefaultVMetrics properties offset mismatch"),d.setUint32(Za.#s,0),h+=4;for(const m of Za.strings){const _=i[m],y=_.length;d.setUint32(h,y),u.set(_,h+4),h+=4+y}if(d.setUint32(Za.#s,h-Za.#s-4),!r)d.setUint32(h,0),h+=4;else{const m=r.byteLength;d.setUint32(h,m),ca(h+4+m<=l.byteLength,"FontInfo.write: Buffer overflow at systemFontInfo"),u.set(new Uint8Array(r),h+4),h+=4+m}if(!n)d.setUint32(h,0),h+=4;else{const m=n.byteLength;d.setUint32(h,m),ca(h+4+m<=l.byteLength,"FontInfo.write: Buffer overflow at cssFontInfo"),u.set(new Uint8Array(n),h+4),h+=4+m}return e.data===void 0?(d.setUint32(h,0),h+=4):(d.setUint32(h,e.data.length),u.set(e.data,h+4),h+=4+e.data.length),ca(h<=l.byteLength,"FontInfo.write: Buffer overflow"),l.transferToFixedLength(h)}}class Fv{static#e=null;static#t="";static get workerPort(){return this.#e}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");this.#e=e}static get workerSrc(){return this.#t}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");this.#t=e}}class D6t{#e;#t;constructor({parsedData:e,rawData:r}){this.#e=e,this.#t=r}getRaw(){return this.#t}get(e){return this.#e.get(e)??null}[Symbol.iterator](){return this.#e.entries()}}const YE=Symbol("INTERNAL");class L6t{#e=!1;#t=!1;#n=!1;#r=!0;constructor(e,{name:r,intent:n,usage:a,rbGroups:i}){this.#e=!!(e&xu.DISPLAY),this.#t=!!(e&xu.PRINT),this.name=r,this.intent=n,this.usage=a,this.rbGroups=i}get visible(){if(this.#n)return this.#r;if(!this.#r)return!1;const{print:e,view:r}=this.usage;return this.#e?r?.viewState!=="OFF":this.#t?e?.printState!=="OFF":!0}_setVisible(e,r,n=!1){e!==YE&&ti("Internal method `_setVisible` called."),this.#n=n,this.#r=r}}class M6t{#e=null;#t=new Map;#n=null;#r=null;constructor(e,r=xu.DISPLAY){if(this.renderingIntent=r,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,this.#r=e.order;for(const n of e.groups)this.#t.set(n.id,new L6t(r,n));if(e.baseState==="OFF")for(const n of this.#t.values())n._setVisible(YE,!1);for(const n of e.on)this.#t.get(n)._setVisible(YE,!0);for(const n of e.off)this.#t.get(n)._setVisible(YE,!1);this.#n=this.getHash()}}#s(e){const r=e.length;if(r<2)return!0;const n=e[0];for(let a=1;a<r;a++){const i=e[a];let s;if(Array.isArray(i))s=this.#s(i);else if(this.#t.has(i))s=this.#t.get(i).visible;else return Cn(`Optional content group not found: ${i}`),!0;switch(n){case"And":if(!s)return!1;break;case"Or":if(s)return!0;break;case"Not":return!s;default:return!0}}return n==="And"}isVisible(e){if(this.#t.size===0)return!0;if(!e)return FF("Optional content group not defined."),!0;if(e.type==="OCG")return this.#t.has(e.id)?this.#t.get(e.id).visible:(Cn(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return this.#s(e.expression);if(!e.policy||e.policy==="AnyOn"){for(const r of e.ids){if(!this.#t.has(r))return Cn(`Optional content group not found: ${r}`),!0;if(this.#t.get(r).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const r of e.ids){if(!this.#t.has(r))return Cn(`Optional content group not found: ${r}`),!0;if(!this.#t.get(r).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const r of e.ids){if(!this.#t.has(r))return Cn(`Optional content group not found: ${r}`),!0;if(!this.#t.get(r).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const r of e.ids){if(!this.#t.has(r))return Cn(`Optional content group not found: ${r}`),!0;if(this.#t.get(r).visible)return!1}return!0}return Cn(`Unknown optional content policy ${e.policy}.`),!0}return Cn(`Unknown group type ${e.type}.`),!0}setVisibility(e,r=!0,n=!0){const a=this.#t.get(e);if(!a){Cn(`Optional content group not found: ${e}`);return}if(n&&r&&a.rbGroups.length)for(const i of a.rbGroups)for(const s of i)s!==e&&this.#t.get(s)?._setVisible(YE,!1,!0);a._setVisible(YE,!!r,!0),this.#e=null}setOCGState({state:e,preserveRB:r}){let n;for(const a of e){switch(a){case"ON":case"OFF":case"Toggle":n=a;continue}const i=this.#t.get(a);if(i)switch(n){case"ON":this.setVisibility(a,!0,r);break;case"OFF":this.setVisibility(a,!1,r);break;case"Toggle":this.setVisibility(a,!i.visible,r);break}}this.#e=null}get hasInitialVisibility(){return this.#n===null||this.getHash()===this.#n}getOrder(){return this.#t.size?this.#r?this.#r.slice():[...this.#t.keys()]:null}getGroup(e){return this.#t.get(e)||null}getHash(){if(this.#e!==null)return this.#e;const e=new zGe;for(const[r,n]of this.#t)e.update(`${r}:${n.visible}`);return this.#e=e.hexdigest()}[Symbol.iterator](){return this.#t.entries()}}class P6t{constructor(e,{disableRange:r=!1,disableStream:n=!1}){ca(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:a,initialData:i,progressiveDone:s,contentDispositionFilename:o}=e;if(this._queuedChunks=[],this._progressiveDone=s,this._contentDispositionFilename=o,i?.length>0){const l=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!n,this._isRangeSupported=!r,this._contentLength=a,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener((l,u)=>{this._onReceiveData({begin:l,chunk:u})}),e.addProgressListener((l,u)=>{this._onProgress({loaded:l,total:u})}),e.addProgressiveReadListener(l=>{this._onReceiveData({chunk:l})}),e.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),e.transportReady()}_onReceiveData({begin:e,chunk:r}){const n=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{const a=this._rangeReaders.some(function(i){return i._begin!==e?!1:(i._enqueue(n),!0)});ca(a,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){e.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const r=this._rangeReaders.indexOf(e);r>=0&&this._rangeReaders.splice(r,1)}getFullReader(){ca(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new B6t(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,r){if(r<=this._progressiveDataLength)return null;const n=new F6t(this,e,r);return this._pdfDataRangeTransport.requestDataRange(e,r),this._rangeReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const r of this._rangeReaders.slice(0))r.cancel(e);this._pdfDataRangeTransport.abort()}}class B6t{constructor(e,r,n=!1,a=null){this._stream=e,this._done=n||!1,this._filename=$F(a)?a:null,this._queuedChunks=r||[],this._loaded=0;for(const i of this._queuedChunks)this._loaded+=i.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class F6t{constructor(e,r,n){this._stream=e,this._begin=r,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length===0)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const n of this._requests)n.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 r=this._queuedChunk;return this._queuedChunk=null,{value:r,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function U6t(t){let e=!0,r=n("filename\\*","i").exec(t);if(r){r=r[1];let d=o(r);return d=unescape(d),d=l(d),d=u(d),i(d)}if(r=s(t),r){const d=u(r);return i(d)}if(r=n("filename","i").exec(t),r){r=r[1];let d=o(r);return d=u(d),i(d)}function n(d,h){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',h)}function a(d,h){if(d){if(!/^[\x00-\xFF]+$/.test(h))return h;try{const f=new TextDecoder(d,{fatal:!0}),p=Sk(h);h=f.decode(p),e=!1}catch{}}return h}function i(d){return e&&/[\x80-\xff]/.test(d)&&(d=a("utf-8",d),e&&(d=a("iso-8859-1",d))),d}function s(d){const h=[];let f;const p=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=p.exec(d))!==null;){let[,m,_,y]=f;if(m=parseInt(m,10),m in h){if(m===0)break;continue}h[m]=[_,y]}const g=[];for(let m=0;m<h.length&&m in h;++m){let[_,y]=h[m];y=o(y),_&&(y=unescape(y),m===0&&(y=l(y))),g.push(y)}return g.join("")}function o(d){if(d.startsWith('"')){const h=d.slice(1).split('\\"');for(let f=0;f<h.length;++f){const p=h[f].indexOf('"');p!==-1&&(h[f]=h[f].slice(0,p),h.length=f+1),h[f]=h[f].replaceAll(/\\(.)/g,"$1")}d=h.join('"')}return d}function l(d){const h=d.indexOf("'");if(h===-1)return d;const f=d.slice(0,h),g=d.slice(h+1).replace(/^[^']*'/,"");return a(f,g)}function u(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(h,f,p,g){if(p==="q"||p==="Q")return g=g.replaceAll("_"," "),g=g.replaceAll(/=([0-9a-fA-F]{2})/g,function(m,_){return String.fromCharCode(parseInt(_,16))}),a(f,g);try{g=atob(g)}catch{}return a(f,g)})}return""}function KGe(t,e){const r=new Headers;if(!t||!e||typeof e!="object")return r;for(const n in e){const a=e[n];a!==void 0&&r.append(n,a)}return r}function GF(t){return URL.parse(t)?.origin??null}function ZGe({responseHeaders:t,isHttp:e,rangeChunkSize:r,disableRange:n}){const a={allowRangeRequests:!1,suggestedLength:void 0},i=parseInt(t.get("Content-Length"),10);return!Number.isInteger(i)||(a.suggestedLength=i,i<=2*r)||n||!e||t.get("Accept-Ranges")!=="bytes"||(t.get("Content-Encoding")||"identity")!=="identity"||(a.allowRangeRequests=!0),a}function QGe(t){const e=t.get("Content-Disposition");if(e){let r=U6t(e);if(r.includes("%"))try{r=decodeURIComponent(r)}catch{}if($F(r))return r}return null}function Ak(t,e){return new $N(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t,t===404||t===0&&e.startsWith("file:"))}function JGe(t){return t===200||t===206}function eze(t,e,r){return{method:"GET",headers:t,signal:r.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function tze(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(Cn(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class $6t{_responseOrigin=null;constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=KGe(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return ca(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new G6t(this),this._fullRequestReader}getRangeReader(e,r){if(r<=this._progressiveDataLength)return null;const n=new z6t(this,e,r);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class G6t{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const r=e.source;this._withCredentials=r.withCredentials||!1,this._contentLength=r.length,this._headersCapability=Promise.withResolvers(),this._disableRange=r.disableRange||!1,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!r.disableStream,this._isRangeSupported=!r.disableRange;const n=new Headers(e.headers),a=r.url;fetch(a,eze(n,this._withCredentials,this._abortController)).then(i=>{if(e._responseOrigin=GF(i.url),!JGe(i.status))throw Ak(i.status,a);this._reader=i.body.getReader(),this._headersCapability.resolve();const s=i.headers,{allowRangeRequests:o,suggestedLength:l}=ZGe({responseHeaders:s,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=l||this._contentLength,this._filename=QGe(s),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Jg("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:e,done:r}=await this._reader.read();return r?{value:e,done:r}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:tze(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class z6t{constructor(e,r,n){this._stream=e,this._reader=null,this._loaded=0;const a=e.source;this._withCredentials=a.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!a.disableStream,this._abortController=new AbortController;const i=new Headers(e.headers);i.append("Range",`bytes=${r}-${n-1}`);const s=a.url;fetch(s,eze(i,this._withCredentials,this._abortController)).then(o=>{const l=GF(o.url);if(l!==e._responseOrigin)throw new Error(`Expected range response-origin "${l}" to match "${e._responseOrigin}".`);if(!JGe(o.status))throw Ak(o.status,s);this._readCapability.resolve(),this._reader=o.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:r}=await this._reader.read();return r?{value:e,done:r}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded}),{value:tze(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}const nH=200,aH=206;function V6t(t){const e=t.response;return typeof e!="string"?e:Sk(e).buffer}class H6t{_responseOrigin=null;constructor({url:e,httpHeaders:r,withCredentials:n}){this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=KGe(this.isHttp,r),this.withCredentials=n||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(e){const r=new XMLHttpRequest,n=this.currXhrId++,a=this.pendingRequests[n]={xhr:r};r.open("GET",this.url),r.withCredentials=this.withCredentials;for(const[i,s]of this.headers)r.setRequestHeader(i,s);return this.isHttp&&"begin"in e&&"end"in e?(r.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),a.expectedStatus=aH):a.expectedStatus=nH,r.responseType="arraybuffer",ca(e.onError,"Expected `onError` callback to be provided."),r.onerror=()=>{e.onError(r.status)},r.onreadystatechange=this.onStateChange.bind(this,n),r.onprogress=this.onProgress.bind(this,n),a.onHeadersReceived=e.onHeadersReceived,a.onDone=e.onDone,a.onError=e.onError,a.onProgress=e.onProgress,r.send(null),n}onProgress(e,r){const n=this.pendingRequests[e];n&&n.onProgress?.(r)}onStateChange(e,r){const n=this.pendingRequests[e];if(!n)return;const a=n.xhr;if(a.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),a.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],a.status===0&&this.isHttp){n.onError(a.status);return}const i=a.status||nH;if(!(i===nH&&n.expectedStatus===aH)&&i!==n.expectedStatus){n.onError(a.status);return}const o=V6t(a);if(i===aH){const l=a.getResponseHeader("Content-Range"),u=/bytes (\d+)-(\d+)\/(\d+)/.exec(l);u?n.onDone({begin:parseInt(u[1],10),chunk:o}):(Cn('Missing or invalid "Content-Range" header.'),n.onError(0))}else o?n.onDone({begin:0,chunk:o}):n.onError(a.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const r=this.pendingRequests[e].xhr;delete this.pendingRequests[e],r.abort()}}class Y6t{constructor(e){this._source=e,this._manager=new H6t(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const r=this._rangeRequestReaders.indexOf(e);r>=0&&this._rangeRequestReaders.splice(r,1)}getFullReader(){return ca(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new W6t(this._manager,this._source),this._fullRequestReader}getRangeReader(e,r){const n=new q6t(this._manager,e,r);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class W6t{constructor(e,r){this._manager=e,this._url=r.url,this._fullRequestId=e.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=r.disableRange||!1,this._contentLength=r.length,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,r=this._manager.getRequestXhr(e);this._manager._responseOrigin=GF(r.responseURL);const n=r.getAllResponseHeaders(),a=new Headers(n?n.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(o=>{const[l,...u]=o.split(": ");return[l,u.join(": ")]}):[]),{allowRangeRequests:i,suggestedLength:s}=ZGe({responseHeaders:a,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=QGe(a),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=Ak(e,this._url),this._headersCapability.reject(this._storedError);for(const r of this._requests)r.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e);for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class q6t{constructor(e,r,n){this._manager=e,this._url=e.url,this._requestId=e.request({begin:r,end:n,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){const e=GF(this._manager.getRequestXhr(this._requestId)?.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){this.onClosed?.(this)}_onDone(e){const r=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:r,done:!1}):this._queuedChunk=r,this._done=!0;for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError??=Ak(e,this._url);for(const r of this._requests)r.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const r=this._queuedChunk;return this._queuedChunk=null,{value:r,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const X6t=/^[a-z][a-z0-9\-+.]+:/i;function j6t(t){if(X6t.test(t))return new URL(t);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(t))}class K6t{constructor(e){this.source=e,this.url=j6t(e.url),ca(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return ca(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new Z6t(this),this._fullRequestReader}getRangeReader(e,r){if(r<=this._progressiveDataLength)return null;const n=new Q6t(this,e,r);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class Z6t{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const r=e.source;this._contentLength=r.length,this._loaded=0,this._filename=null,this._disableRange=r.disableRange||!1,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!r.disableStream,this._isRangeSupported=!r.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const n=process.getBuiltinModule("fs");n.promises.lstat(this._url).then(a=>{this._contentLength=a.size,this._setReadableStream(n.createReadStream(this._url)),this._headersCapability.resolve()},a=>{a.code==="ENOENT"&&(a=Ak(0,this._url.href)),this._storedError=a,this._headersCapability.reject(a)})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",r=>{this._error(r)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new Jg("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Q6t{constructor(e,r,n){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const a=e.source;this._isStreamingSupported=!a.disableStream;const i=process.getBuiltinModule("fs");this._setReadableStream(i.createReadStream(this._url,{start:r,end:n-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",r=>{this._error(r)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const nA=Symbol("INITIAL_DATA");class rze{#e=Object.create(null);#t(e){return this.#e[e]||={...Promise.withResolvers(),data:nA}}get(e,r=null){if(r){const a=this.#t(e);return a.promise.then(()=>r(a.data)),null}const n=this.#e[e];if(!n||n.data===nA)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){const r=this.#e[e];return!!r&&r.data!==nA}delete(e){const r=this.#e[e];return!r||r.data===nA?!1:(delete this.#e[e],!0)}resolve(e,r=null){const n=this.#t(e);n.data=r,n.resolve()}clear(){for(const e in this.#e){const{data:r}=this.#e[e];r?.bitmap?.close()}this.#e=Object.create(null)}*[Symbol.iterator](){for(const e in this.#e){const{data:r}=this.#e[e];r!==nA&&(yield[e,r])}}}const J6t=1e5,ITe=30;let zN=class md{#e=Promise.withResolvers();#t=null;#n=!1;#r=!!globalThis.FontInspector?.enabled;#s=null;#a=null;#i=0;#o=0;#c=null;#l=null;#h=0;#d=0;#f=Object.create(null);#m=[];#p=null;#u=[];#g=new WeakMap;#v=null;static#_=new Map;static#y=new Map;static#w=new WeakMap;static#T=null;static#b=new Set;constructor({textContentSource:e,container:r,viewport:n}){if(e instanceof ReadableStream)this.#p=e;else if(typeof e=="object")this.#p=new ReadableStream({start(l){l.enqueue(e),l.close()}});else throw new Error('No "textContentSource" parameter specified.');this.#t=this.#l=r,this.#d=n.scale*Xh.pixelRatio,this.#h=n.rotation,this.#a={div:null,properties:null,ctx:null};const{pageWidth:a,pageHeight:i,pageX:s,pageY:o}=n.rawDims;this.#v=[1,0,0,-1,-s,o+i],this.#o=a,this.#i=i,md.#N(),Jv(r,n),this.#e.promise.finally(()=>{md.#b.delete(this),this.#a=null,this.#f=null}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:r}=Ao.platform;return Dn(this,"fontFamilyMap",new Map([["sans-serif",`${e&&r?"Calibri, ":""}sans-serif`],["monospace",`${e&&r?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{this.#c.read().then(({value:r,done:n})=>{if(n){this.#e.resolve();return}this.#s??=r.lang,Object.assign(this.#f,r.styles),this.#A(r.items),e()},this.#e.reject)};return this.#c=this.#p.getReader(),md.#b.add(this),e(),this.#e.promise}update({viewport:e,onBefore:r=null}){const n=e.scale*Xh.pixelRatio,a=e.rotation;if(a!==this.#h&&(r?.(),this.#h=a,Jv(this.#l,{rotation:a})),n!==this.#d){r?.(),this.#d=n;const i={div:null,properties:null,ctx:md.#I(this.#s)};for(const s of this.#u)i.properties=this.#g.get(s),i.div=s,this.#x(i)}}cancel(){const e=new Jg("TextLayer task cancelled.");this.#c?.cancel(e).catch(()=>{}),this.#c=null,this.#e.reject(e)}get textDivs(){return this.#u}get textContentItemsStr(){return this.#m}#A(e){if(this.#n)return;this.#a.ctx??=md.#I(this.#s);const r=this.#u,n=this.#m;for(const a of e){if(r.length>J6t){Cn("Ignoring additional textDivs for performance reasons."),this.#n=!0;return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const i=this.#t;this.#t=document.createElement("span"),this.#t.classList.add("markedContent"),a.id&&this.#t.setAttribute("id",`${a.id}`),i.append(this.#t)}else a.type==="endMarkedContent"&&(this.#t=this.#t.parentNode);continue}n.push(a.str),this.#S(a)}}#S(e){const r=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};this.#u.push(r);const a=Er.transform(this.#v,e.transform);let i=Math.atan2(a[1],a[0]);const s=this.#f[e.fontName];s.vertical&&(i+=Math.PI/2);let o=this.#r&&s.fontSubstitution||s.fontFamily;o=md.fontFamilyMap.get(o)||o;const l=Math.hypot(a[2],a[3]),u=l*md.#B(o,s,this.#s);let d,h;i===0?(d=a[4],h=a[5]-u):(d=a[4]+u*Math.sin(i),h=a[5]-u*Math.cos(i));const f="calc(var(--total-scale-factor) *",p=r.style;this.#t===this.#l?(p.left=`${(100*d/this.#o).toFixed(2)}%`,p.top=`${(100*h/this.#i).toFixed(2)}%`):(p.left=`${f}${d.toFixed(2)}px)`,p.top=`${f}${h.toFixed(2)}px)`),p.fontSize=`${f}${(md.#T*l).toFixed(2)}px)`,p.fontFamily=o,n.fontSize=l,r.setAttribute("role","presentation"),r.textContent=e.str,r.dir=e.dir,this.#r&&(r.dataset.fontName=s.fontSubstitutionLoadedName||e.fontName),i!==0&&(n.angle=i*(180/Math.PI));let g=!1;if(e.str.length>1)g=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const m=Math.abs(e.transform[0]),_=Math.abs(e.transform[3]);m!==_&&Math.max(m,_)/Math.min(m,_)>1.5&&(g=!0)}if(g&&(n.canvasWidth=s.vertical?e.height:e.width),this.#g.set(r,n),this.#a.div=r,this.#a.properties=n,this.#x(this.#a),n.hasText&&this.#t.append(r),n.hasEOL){const m=document.createElement("br");m.setAttribute("role","presentation"),this.#t.append(m)}}#x(e){const{div:r,properties:n,ctx:a}=e,{style:i}=r;let s="";if(md.#T>1&&(s=`scale(${1/md.#T})`),n.canvasWidth!==0&&n.hasText){const{fontFamily:o}=i,{canvasWidth:l,fontSize:u}=n;md.#R(a,u*this.#d,o);const{width:d}=a.measureText(r.textContent);d>0&&(s=`scaleX(${l*this.#d/d}) ${s}`)}n.angle!==0&&(s=`rotate(${n.angle}deg) ${s}`),s.length>0&&(i.transform=s)}static cleanup(){if(!(this.#b.size>0)){this.#_.clear();for(const{canvas:e}of this.#y.values())e.remove();this.#y.clear()}}static#I(e=null){let r=this.#y.get(e||="");if(!r){const n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=e,document.body.append(n),r=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#y.set(e,r),this.#w.set(r,{size:0,family:""})}return r}static#R(e,r,n){const a=this.#w.get(e);r===a.size&&n===a.family||(e.font=`${r}px ${n}`,a.size=r,a.family=n)}static#N(){if(this.#T!==null)return;const e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),this.#T=e.getBoundingClientRect().height,e.remove()}static#B(e,r,n){const a=this.#_.get(e);if(a)return a;const i=this.#I(n);i.canvas.width=i.canvas.height=ITe,this.#R(i,ITe,e);const s=i.measureText(""),o=s.fontBoundingBoxAscent,l=Math.abs(s.fontBoundingBoxDescent);i.canvas.width=i.canvas.height=0;let u=.8;return o?u=o/(o+l):(Ao.platform.isFirefox&&Cn("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),r.ascent?u=r.ascent:r.descent&&(u=1+r.descent)),this.#_.set(e,u),u}};const eBt=100;function _ce(t={}){typeof t=="string"||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});const e=new bce,{docId:r}=e,n=t.url?l6t(t.url):null,a=t.data?c6t(t.data):null,i=t.httpHeaders||null,s=t.withCredentials===!0,o=t.password??null,l=t.range instanceof Ece?t.range:null,u=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:2**16;let d=t.worker instanceof Cx?t.worker:null;const h=t.verbosity,f=typeof t.docBaseUrl=="string"&&!xk(t.docBaseUrl)?t.docBaseUrl:null,p=iL(t.cMapUrl),g=t.cMapPacked!==!1,m=t.CMapReaderFactory||(Xl?m6t:mTe),_=iL(t.iccUrl),y=iL(t.standardFontDataUrl),v=t.StandardFontDataFactory||(Xl?v6t:vTe),b=iL(t.wasmUrl),E=t.WasmFactory||(Xl?y6t:yTe),S=t.stopAtErrors!==!0,T=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,x=t.isEvalSupported!==!1,w=typeof t.isOffscreenCanvasSupported=="boolean"?t.isOffscreenCanvasSupported:!Xl,C=typeof t.isImageDecoderSupported=="boolean"?t.isImageDecoderSupported:!Xl&&(Ao.platform.isFirefox||!globalThis.chrome),R=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,N=typeof t.disableFontFace=="boolean"?t.disableFontFace:Xl,k=t.fontExtraProperties===!0,L=t.enableXfa===!0,A=t.ownerDocument||globalThis.document,D=t.disableRange===!0,M=t.disableStream===!0,B=t.disableAutoFetch===!0,F=t.pdfBug===!0,U=t.CanvasFactory||(Xl?g6t:h6t),V=t.FilterFactory||(Xl?p6t:f6t),$=t.enableHWA===!0,z=t.useWasm!==!1,q=l?l.length:t.length??NaN,j=typeof t.useSystemFonts=="boolean"?t.useSystemFonts:!Xl&&!N,X=typeof t.useWorkerFetch=="boolean"?t.useWorkerFetch:!!(m===mTe&&v===vTe&&E===yTe&&p&&y&&b&&f2(p,document.baseURI)&&f2(y,document.baseURI)&&f2(b,document.baseURI)),ie=null;V5t(h);const ne={canvasFactory:new U({ownerDocument:A,enableHWA:$}),filterFactory:new V({docId:r,ownerDocument:A}),cMapReaderFactory:X?null:new m({baseUrl:p,isCompressed:g}),standardFontDataFactory:X?null:new v({baseUrl:y}),wasmFactory:X?null:new E({baseUrl:b})};d||(d=Cx.create({verbosity:h,port:Fv.workerPort}),e._worker=d);const ue={docId:r,apiVersion:"5.4.296",data:a,password:o,disableAutoFetch:B,rangeChunkSize:u,length:q,docBaseUrl:f,enableXfa:L,evaluatorOptions:{maxImageSize:T,disableFontFace:N,ignoreErrors:S,isEvalSupported:x,isOffscreenCanvasSupported:w,isImageDecoderSupported:C,canvasMaxAreaInBytes:R,fontExtraProperties:k,useSystemFonts:j,useWasm:z,useWorkerFetch:X,cMapUrl:p,iccUrl:_,standardFontDataUrl:y,wasmUrl:b}},J={ownerDocument:A,pdfBug:F,styleElement:ie,loadingParams:{disableAutoFetch:B,enableXfa:L}};return d.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const re=d.messageHandler.sendWithPromise("GetDocRequest",ue,a?[a.buffer]:null);let Z;if(l)Z=new P6t(l,{disableRange:D,disableStream:M});else if(!a){if(!n)throw new Error("getDocument - no `url` parameter provided.");const ee=f2(n)?$6t:Xl?K6t:Y6t;Z=new ee({url:n,length:q,httpHeaders:i,withCredentials:s,rangeChunkSize:u,disableRange:D,disableStream:M})}return re.then(ee=>{if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const se=new p2(r,ee,d.port),G=new nBt(se,e,Z,J,ne,$);e._transport=G,se.send("Ready",null)})}).catch(e._capability.reject),e}class bce{static#e=0;_capability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${bce.#e++}`;destroyed=!1;onPassword=null;onProgress=null;get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}}let Ece=class{#e=Promise.withResolvers();#t=[];#n=[];#r=[];#s=[];constructor(e,r,n=!1,a=null){this.length=e,this.initialData=r,this.progressiveDone=n,this.contentDispositionFilename=a}addRangeListener(e){this.#s.push(e)}addProgressListener(e){this.#r.push(e)}addProgressiveReadListener(e){this.#n.push(e)}addProgressiveDoneListener(e){this.#t.push(e)}onDataRange(e,r){for(const n of this.#s)n(e,r)}onDataProgress(e,r){this.#e.promise.then(()=>{for(const n of this.#r)n(e,r)})}onDataProgressiveRead(e){this.#e.promise.then(()=>{for(const r of this.#n)r(e)})}onDataProgressiveDone(){this.#e.promise.then(()=>{for(const e of this.#t)e()})}transportReady(){this.#e.resolve()}requestDataRange(e,r){ti("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class tBt{constructor(e,r){this._pdfInfo=e,this._transport=r}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 Dn(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAnnotationsByType(e,r){return this._transport.getAnnotationsByType(e,r)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:r}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(r)}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(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class rBt{#e=!1;constructor(e,r,n,a=!1){this._pageIndex=e,this._pageInfo=r,this._transport=n,this._stats=a?new cTe:null,this._pdfBug=a,this.commonObjs=n.commonObjs,this.objs=new rze,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:r=this.rotate,offsetX:n=0,offsetY:a=0,dontFlip:i=!1}={}){return new Tk({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:r,offsetX:n,offsetY:a,dontFlip:i})}getAnnotations({intent:e="display"}={}){const{renderingIntent:r}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,r)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Dn(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,canvas:r=e.canvas,viewport:n,intent:a="display",annotationMode:i=Vf.ENABLE,transform:s=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:u=null,pageColors:d=null,printAnnotationStorage:h=null,isEditing:f=!1,recordOperations:p=!1,operationsFilter:g=null}){this._stats?.time("Overall");const m=this._transport.getRenderingIntent(a,i,h,f),{renderingIntent:_,cacheKey:y}=m;this.#e=!1,l||=this._transport.getOptionalContentConfig(_);let v=this._intentStates.get(y);v||(v=Object.create(null),this._intentStates.set(y,v)),v.streamReaderCancelTimeout&&(clearTimeout(v.streamReaderCancelTimeout),v.streamReaderCancelTimeout=null);const b=!!(_&xu.PRINT);v.displayReadyCapability||(v.displayReadyCapability=Promise.withResolvers(),v.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(m));const E=!!(this._pdfBug&&globalThis.StepperManager?.enabled),S=!this.recordedBBoxes&&(p||E),T=C=>{if(v.renderTasks.delete(x),S){const R=x.gfx?.dependencyTracker.take();R&&(x.stepper&&x.stepper.setOperatorBBoxes(R,x.gfx.dependencyTracker.takeDebugMetadata()),p&&(this.recordedBBoxes=R))}b&&(this.#e=!0),this.#t(),C?(x.capability.reject(C),this._abortOperatorList({intentState:v,reason:C instanceof Error?C:new Error(C)})):x.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},x=new mS({callback:T,params:{canvas:r,canvasContext:e,dependencyTracker:S?new b6t(r,v.operatorList.length,E):null,viewport:n,transform:s,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:v.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!b,pdfBug:this._pdfBug,pageColors:d,enableHWA:this._transport.enableHWA,operationsFilter:g});(v.renderTasks||=new Set).add(x);const w=x.task;return Promise.all([v.displayReadyCapability.promise,l]).then(([C,R])=>{if(this.destroyed){T();return}if(this._stats?.time("Rendering"),!(R.renderingIntent&_))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");x.initializeGraphics({transparency:C,optionalContentConfig:R}),x.operatorListChanged()}).catch(T),w}getOperatorList({intent:e="display",annotationMode:r=Vf.ENABLE,printAnnotationStorage:n=null,isEditing:a=!1}={}){function i(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}const s=this._transport.getRenderingIntent(e,r,n,a,!0);let o=this._intentStates.get(s.cacheKey);o||(o=Object.create(null),this._intentStates.set(s.cacheKey,o));let l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=i,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||=new Set).add(l),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(s)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:r=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:r===!0},{highWaterMark:100,size(a){return a.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(n=>GN.textContent(n));const r=this.streamTextContent(e);return new Promise(function(n,a){function i(){s.read().then(function({value:l,done:u}){if(u){n(o);return}o.lang??=l.lang,Object.assign(o.styles,l.styles),o.items.push(...l.items),i()},a)}const s=r.getReader(),o={items:[],styles:Object.create(null),lang:null};i()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const r of this._intentStates.values())if(this._abortOperatorList({intentState:r,reason:new Error("Page was destroyed."),force:!0}),!r.opListReadCapability)for(const n of r.renderTasks)e.push(n.completed),n.cancel();return this.objs.clear(),this.#e=!1,Promise.all(e)}cleanup(e=!1){this.#e=!0;const r=this.#t();return e&&r&&(this._stats&&=new cTe),r}#t(){if(!this.#e||this.destroyed)return!1;for(const{renderTasks:e,operatorList:r}of this._intentStates.values())if(e.size>0||!r.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#e=!1,!0}_startRenderPage(e,r){const n=this._intentStates.get(r);n&&(this._stats?.timeEnd("Page Request"),n.displayReadyCapability?.resolve(e))}_renderPageChunk(e,r){for(let n=0,a=e.length;n<a;n++)r.operatorList.fnArray.push(e.fnArray[n]),r.operatorList.argsArray.push(e.argsArray[n]);r.operatorList.lastChunk=e.lastChunk,r.operatorList.separateAnnots=e.separateAnnots;for(const n of r.renderTasks)n.operatorListChanged();e.lastChunk&&this.#t()}_pumpOperatorList({renderingIntent:e,cacheKey:r,annotationStorageSerializable:n,modifiedIds:a}){const{map:i,transfer:s}=n,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:r,annotationStorage:i,modifiedIds:a},s).getReader(),u=this._intentStates.get(r);u.streamReader=l;const d=()=>{l.read().then(({value:h,done:f})=>{if(f){u.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,u),d())},h=>{if(u.streamReader=null,!this._transport.destroyed){if(u.operatorList){u.operatorList.lastChunk=!0;for(const f of u.renderTasks)f.operatorListChanged();this.#t()}if(u.displayReadyCapability)u.displayReadyCapability.reject(h);else if(u.opListReadCapability)u.opListReadCapability.reject(h);else throw h}})};d()}_abortOperatorList({intentState:e,reason:r,force:n=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!n){if(e.renderTasks.size>0)return;if(r instanceof UF){let a=eBt;r.extraDelay>0&&r.extraDelay<1e3&&(a+=r.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:r,force:!0})},a);return}}if(e.streamReader.cancel(new Jg(r.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[a,i]of this._intentStates)if(i===e){this._intentStates.delete(a);break}this.cleanup()}}}get stats(){return this._stats}}var gv,Sh,_g,$_,OB,G_,z_,oc,WP,nze,aze,g2,pT,qP;const Ri=class Ri{constructor({name:e=null,port:r=null,verbosity:n=H5t()}={}){gf(this,oc);gf(this,gv,Promise.withResolvers());gf(this,Sh,null);gf(this,_g,null);gf(this,$_,null);if(this.name=e,this.destroyed=!1,this.verbosity=n,r){if(Ci(Ri,z_).has(r))throw new Error("Cannot use more than one PDFWorker per port.");Ci(Ri,z_).set(r,this),mf(this,oc,nze).call(this,r)}else mf(this,oc,aze).call(this)}get promise(){return Ci(this,gv).promise}get port(){return Ci(this,_g)}get messageHandler(){return Ci(this,Sh)}destroy(){this.destroyed=!0,Ci(this,$_)?.terminate(),Lc(this,$_,null),Ci(Ri,z_).delete(Ci(this,_g)),Lc(this,_g,null),Ci(this,Sh)?.destroy(),Lc(this,Sh,null)}static create(e){const r=Ci(this,z_).get(e?.port);if(r){if(r._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return r}return new Ri(e)}static get workerSrc(){if(Fv.workerSrc)return Fv.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Dn(this,"_setupFakeWorkerGlobal",(async()=>Ci(this,pT,qP)?Ci(this,pT,qP):(await import(this.workerSrc)).WorkerMessageHandler)())}};gv=new WeakMap,Sh=new WeakMap,_g=new WeakMap,$_=new WeakMap,OB=new WeakMap,G_=new WeakMap,z_=new WeakMap,oc=new WeakSet,WP=function(){Ci(this,gv).resolve(),Ci(this,Sh).send("configure",{verbosity:this.verbosity})},nze=function(e){Lc(this,_g,e),Lc(this,Sh,new p2("main","worker",e)),Ci(this,Sh).on("ready",()=>{}),mf(this,oc,WP).call(this)},aze=function(){if(Ci(Ri,G_)||Ci(Ri,pT,qP)){mf(this,oc,g2).call(this);return}let{workerSrc:e}=Ri;try{Ri._isSameOrigin(window.location,e)||(e=Ri._createCDNWrapper(new URL(e,window.location).href));const r=new Worker(e,{type:"module"}),n=new p2("main","worker",r),a=()=>{i.abort(),n.destroy(),r.terminate(),this.destroyed?Ci(this,gv).reject(new Error("Worker was destroyed")):mf(this,oc,g2).call(this)},i=new AbortController;r.addEventListener("error",()=>{Ci(this,$_)||a()},{signal:i.signal}),n.on("test",o=>{if(i.abort(),this.destroyed||!o){a();return}Lc(this,Sh,n),Lc(this,_g,r),Lc(this,$_,r),mf(this,oc,WP).call(this)}),n.on("ready",o=>{if(i.abort(),this.destroyed){a();return}try{s()}catch{mf(this,oc,g2).call(this)}});const s=()=>{const o=new Uint8Array;n.send("test",o,[o.buffer])};s();return}catch{FF("The worker has been disabled.")}mf(this,oc,g2).call(this)},g2=function(){Ci(Ri,G_)||(Cn("Setting up fake worker."),Lc(Ri,G_,!0)),Ri._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){Ci(this,gv).reject(new Error("Worker was destroyed"));return}const r=new d6t;Lc(this,_g,r);const n=`fake${Ome(Ri,OB)._++}`,a=new p2(n+"_worker",n,r);e.setup(a,r),Lc(this,Sh,new p2(n,n+"_worker",r)),mf(this,oc,WP).call(this)}).catch(e=>{Ci(this,gv).reject(new Error(`Setting up fake worker failed: "${e.message}".`))})},pT=new WeakSet,qP=function(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}},gf(Ri,pT),gf(Ri,OB,0),gf(Ri,G_,!1),gf(Ri,z_,new WeakMap),Xl&&(Lc(Ri,G_,!0),Fv.workerSrc||="./pdf.worker.mjs"),Ri._isSameOrigin=(e,r)=>{const n=URL.parse(e);if(!n?.origin||n.origin==="null")return!1;const a=new URL(r,n);return n.origin===a.origin},Ri._createCDNWrapper=e=>{const r=`await import("${e}");`;return URL.createObjectURL(new Blob([r],{type:"text/javascript"}))},Ri.fromPort=e=>{if(J5t("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!e?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return Ri.create(e)};let Cx=Ri;class nBt{#e=new Map;#t=new Map;#n=new Map;#r=new Map;#s=null;constructor(e,r,n,a,i,s){this.messageHandler=e,this.loadingTask=r,this.commonObjs=new rze,this.fontLoader=new s6t({ownerDocument:a.ownerDocument,styleElement:a.styleElement}),this.loadingParams=a.loadingParams,this._params=a,this.canvasFactory=i.canvasFactory,this.filterFactory=i.filterFactory,this.cMapReaderFactory=i.cMapReaderFactory,this.standardFontDataFactory=i.standardFontDataFactory,this.wasmFactory=i.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.enableHWA=s,this.setupMessageHandler()}#a(e,r=null){const n=this.#e.get(e);if(n)return n;const a=this.messageHandler.sendWithPromise(e,r);return this.#e.set(e,a),a}get annotationStorage(){return Dn(this,"annotationStorage",new gce)}getRenderingIntent(e,r=Vf.ENABLE,n=null,a=!1,i=!1){let s=xu.DISPLAY,o=zZ;switch(e){case"any":s=xu.ANY;break;case"display":break;case"print":s=xu.PRINT;break;default:Cn(`getRenderingIntent - invalid intent: ${e}`)}const l=s&xu.PRINT&&n instanceof VGe?n:this.annotationStorage;switch(r){case Vf.DISABLE:s+=xu.ANNOTATIONS_DISABLE;break;case Vf.ENABLE:break;case Vf.ENABLE_FORMS:s+=xu.ANNOTATIONS_FORMS;break;case Vf.ENABLE_STORAGE:s+=xu.ANNOTATIONS_STORAGE,o=l.serializable;break;default:Cn(`getRenderingIntent - invalid annotationMode: ${r}`)}a&&(s+=xu.IS_EDITING),i&&(s+=xu.OPLIST);const{ids:u,hash:d}=l.modifiedIds,h=[s,o.hash,d];return{renderingIntent:s,cacheKey:h.join("_"),annotationStorageSerializable:o,modifiedIds:u}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#s?.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const n of this.#t.values())e.push(n._destroy());this.#t.clear(),this.#n.clear(),this.#r.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const r=this.messageHandler.sendWithPromise("Terminate",null);return e.push(r),Promise.all(e).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),zN.cleanup(),this._networkStream?.cancelAllRequests(new Jg("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:r}=this;e.on("GetReader",(n,a)=>{ca(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=i=>{this._lastProgress={loaded:i.loaded,total:i.total}},a.onPull=()=>{this._fullReader.read().then(function({value:i,done:s}){if(s){a.close();return}ca(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(i),1,[i])}).catch(i=>{a.error(i)})},a.onCancel=i=>{this._fullReader.cancel(i),a.ready.catch(s=>{if(!this.destroyed)throw s})}}),e.on("ReaderHeadersReady",async n=>{await this._fullReader.headersReady;const{isStreamingSupported:a,isRangeSupported:i,contentLength:s}=this._fullReader;return(!a||!i)&&(this._lastProgress&&r.onProgress?.(this._lastProgress),this._fullReader.onProgress=o=>{r.onProgress?.({loaded:o.loaded,total:o.total})}),{isStreamingSupported:a,isRangeSupported:i,contentLength:s}}),e.on("GetRangeReader",(n,a)=>{ca(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(n.begin,n.end);if(!i){a.close();return}a.onPull=()=>{i.read().then(function({value:s,done:o}){if(o){a.close();return}ca(s instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{a.error(s)})},a.onCancel=s=>{i.cancel(s),a.ready.catch(o=>{if(!this.destroyed)throw o})}}),e.on("GetDoc",({pdfInfo:n})=>{this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,r._capability.resolve(new tBt(n,this))}),e.on("DocException",n=>{r._capability.reject(Fc(n))}),e.on("PasswordRequest",n=>{this.#s=Promise.withResolvers();try{if(!r.onPassword)throw Fc(n);const a=i=>{i instanceof Error?this.#s.reject(i):this.#s.resolve({password:i})};r.onPassword(a,n.code)}catch(a){this.#s.reject(a)}return this.#s.promise}),e.on("DataLoaded",n=>{r.onProgress?.({loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),e.on("StartRenderPage",n=>{if(this.destroyed)return;this.#t.get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),e.on("commonobj",([n,a,i])=>{if(this.destroyed||this.commonObjs.has(n))return null;switch(a){case"Font":if("error"in i){const d=i.error;Cn(`Error during font loading: ${d}`),this.commonObjs.resolve(n,d);break}const s=new Za(i),o=this._params.pdfBug&&globalThis.FontInspector?.enabled?(d,h)=>globalThis.FontInspector.fontAdded(d,h):null,l=new o6t(s,o,i.extra,i.charProcOperatorList);this.fontLoader.bind(l).catch(()=>e.sendWithPromise("FontFallback",{id:n})).finally(()=>{!l.fontExtraProperties&&l.data&&l.clearData(),this.commonObjs.resolve(n,l)});break;case"CopyLocalImage":const{imageRef:u}=i;ca(u,"The imageRef must be defined.");for(const d of this.#t.values())for(const[,h]of d.objs)if(h?.ref===u)return h.dataLen?(this.commonObjs.resolve(n,structuredClone(h)),h.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,i);break;default:throw new Error(`Got unknown common object type ${a}`)}return null}),e.on("obj",([n,a,i,s])=>{if(this.destroyed)return;const o=this.#t.get(a);if(!o.objs.has(n)){if(o._intentStates.size===0){s?.bitmap?.close();return}switch(i){case"Image":case"Pattern":o.objs.resolve(n,s);break;default:throw new Error(`Got unknown object type ${i}`)}}}),e.on("DocProgress",n=>{this.destroyed||r.onProgress?.({loaded:n.loaded,total:n.total})}),e.on("FetchBinaryData",async n=>{if(this.destroyed)throw new Error("Worker was destroyed.");const a=this[n.type];if(!a)throw new Error(`${n.type} not initialized, see the \`useWorkerFetch\` parameter.`);return a.fetch(n)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&Cn("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:r}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this._fullReader?.filename??null},r).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const r=e-1,n=this.#n.get(r);if(n)return n;const a=this.messageHandler.sendWithPromise("GetPage",{pageIndex:r}).then(i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&this.#r.set(i.refStr,e);const s=new rBt(r,i,this,this._params.pdfBug);return this.#t.set(r,s),s});return this.#n.set(r,a),a}getPageIndex(e){return VZ(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,r){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:r})}getFieldObjects(){return this.#a("GetFieldObjects")}hasJSActions(){return this.#a("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return typeof e!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAnnotationsByType(e,r){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:e,pageIndexesToSkip:r})}getDocJSActions(){return this.#a("GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return this.#a("GetOptionalContentConfig").then(r=>new M6t(r,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",r=this.#e.get(e);if(r)return r;const n=this.messageHandler.sendWithPromise(e,null).then(a=>({info:a[0],metadata:a[1]?new D6t(a[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#e.set(e,n),n}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const r of this.#t.values())if(!r.cleanup())throw new Error(`startCleanup: Page ${r.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0),zN.cleanup()}}cachedPageNumber(e){if(!VZ(e))return null;const r=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return this.#r.get(r)??null}}class aBt{#e=null;onContinue=null;onError=null;constructor(e){this.#e=e}get promise(){return this.#e.capability.promise}cancel(e=0){this.#e.cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=this.#e.operatorList;if(!e)return!1;const{annotationCanvasMap:r}=this.#e;return e.form||e.canvas&&r?.size>0}}class mS{#e=null;static#t=new WeakSet;constructor({callback:e,params:r,objs:n,commonObjs:a,annotationCanvasMap:i,operatorList:s,pageIndex:o,canvasFactory:l,filterFactory:u,useRequestAnimationFrame:d=!1,pdfBug:h=!1,pageColors:f=null,enableHWA:p=!1,operationsFilter:g=null}){this.callback=e,this.params=r,this.objs=n,this.commonObjs=a,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=s,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=u,this._pdfBug=h,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=d===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new aBt(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=r.canvas,this._canvasContext=r.canvas?null:r.canvasContext,this._enableHWA=p,this._dependencyTracker=r.dependencyTracker,this._operationsFilter=g}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:r}){if(this.cancelled)return;if(this._canvas){if(mS.#t.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.");mS.#t.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:n,transform:a,background:i,dependencyTracker:s}=this.params,o=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new FS(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:r},this.annotationCanvasMap,this.pageColors,s),this.gfx.beginDrawing({transform:a,viewport:n,transparency:e,background:i}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,r=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e&&(window.cancelAnimationFrame(this.#e),this.#e=null),mS.#t.delete(this._canvas),e||=new UF(`Rendering cancelled, page ${this._pageIndex+1}`,r),this.callback(e),this.task.onError?.(e)}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#e=window.requestAnimationFrame(()=>{this.#e=null,this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),mS.#t.delete(this._canvas),this.callback())))}}const Sce="5.4.296",ize="f56dc8601";class wu{#e=null;#t=null;#n;#r=null;#s=!1;#a=!1;#i=null;#o;#c=null;#l=null;static#h=null;static get _keyboardManager(){return Dn(this,"_keyboardManager",new wk([[["Escape","mac+Escape"],wu.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],wu.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],wu.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],wu.prototype._moveToPrevious],[["Home","mac+Home"],wu.prototype._moveToBeginning],[["End","mac+End"],wu.prototype._moveToEnd]]))}constructor({editor:e=null,uiManager:r=null}){e?(this.#a=!1,this.#i=e):this.#a=!0,this.#l=e?._uiManager||r,this.#o=this.#l._eventBus,this.#n=e?.color?.toUpperCase()||this.#l?.highlightColors.values().next().value||"#FFFF98",wu.#h||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){const e=this.#e=document.createElement("button");e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",this.#i&&(e.ariaControls=`${this.#i.id}_colorpicker_dropdown`);const r=this.#l._signal;e.addEventListener("click",this.#p.bind(this),{signal:r}),e.addEventListener("keydown",this.#m.bind(this),{signal:r});const n=this.#t=document.createElement("span");return n.className="swatch",n.ariaHidden="true",n.style.backgroundColor=this.#n,e.append(n),e}renderMainDropdown(){const e=this.#r=this.#d();return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}#d(){const e=document.createElement("div"),r=this.#l._signal;e.addEventListener("contextmenu",Gu,{signal:r}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),this.#i&&(e.id=`${this.#i.id}_colorpicker_dropdown`);for(const[n,a]of this.#l.highlightColors){const i=document.createElement("button");i.tabIndex="0",i.role="option",i.setAttribute("data-color",a),i.title=n,i.setAttribute("data-l10n-id",wu.#h[n]);const s=document.createElement("span");i.append(s),s.className="swatch",s.style.backgroundColor=a,i.ariaSelected=a===this.#n,i.addEventListener("click",this.#f.bind(this,a),{signal:r}),e.append(i)}return e.addEventListener("keydown",this.#m.bind(this),{signal:r}),e}#f(e,r){r.stopPropagation(),this.#o.dispatch("switchannotationeditorparams",{source:this,type:ta.HIGHLIGHT_COLOR,value:e}),this.updateColor(e)}_colorSelectFromKeyboard(e){if(e.target===this.#e){this.#p(e);return}const r=e.target.getAttribute("data-color");r&&this.#f(r,e)}_moveToNext(e){if(!this.#g){this.#p(e);return}if(e.target===this.#e){this.#r.firstChild?.focus();return}e.target.nextSibling?.focus()}_moveToPrevious(e){if(e.target===this.#r?.firstChild||e.target===this.#e){this.#g&&this._hideDropdownFromKeyboard();return}this.#g||this.#p(e),e.target.previousSibling?.focus()}_moveToBeginning(e){if(!this.#g){this.#p(e);return}this.#r.firstChild?.focus()}_moveToEnd(e){if(!this.#g){this.#p(e);return}this.#r.lastChild?.focus()}#m(e){wu._keyboardManager.exec(this,e)}#p(e){if(this.#g){this.hideDropdown();return}if(this.#s=e.detail===0,this.#c||(this.#c=new AbortController,window.addEventListener("pointerdown",this.#u.bind(this),{signal:this.#l.combinedSignal(this.#c)})),this.#e.ariaExpanded="true",this.#r){this.#r.classList.remove("hidden");return}const r=this.#r=this.#d();this.#e.append(r)}#u(e){this.#r?.contains(e.target)||this.hideDropdown()}hideDropdown(){this.#r?.classList.add("hidden"),this.#e.ariaExpanded="false",this.#c?.abort(),this.#c=null}get#g(){return this.#r&&!this.#r.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(!this.#a){if(!this.#g){this.#i?.unselect();return}this.hideDropdown(),this.#e.focus({preventScroll:!0,focusVisible:this.#s})}}updateColor(e){if(this.#t&&(this.#t.style.backgroundColor=e),!this.#r)return;const r=this.#l.highlightColors.values();for(const n of this.#r.children)n.ariaSelected=r.next().value===e.toUpperCase()}destroy(){this.#e?.remove(),this.#e=null,this.#t=null,this.#r?.remove(),this.#r=null}}class VN{#e=null;#t=null;#n=null;static#r=null;constructor(e){this.#t=e,this.#n=e._uiManager,VN.#r||=Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"})}renderButton(){if(this.#e)return this.#e;const{editorType:e,colorType:r,colorValue:n}=this.#t,a=this.#e=document.createElement("input");return a.type="color",a.value=n||"#000000",a.className="basicColorPicker",a.tabIndex=0,a.setAttribute("data-l10n-id",VN.#r[e]),a.addEventListener("input",()=>{this.#n.updateParams(r,a.value)},{signal:this.#n._signal}),a}update(e){this.#e&&(this.#e.value=e)}destroy(){this.#e?.remove(),this.#e=null}hideDropdown(){}}function kTe(t){return Math.floor(Math.max(0,Math.min(1,t))*255).toString(16).padStart(2,"0")}function aA(t){return Math.max(0,Math.min(255,255*t))}class OTe{static CMYK_G([e,r,n,a]){return["G",1-Math.min(1,.3*e+.59*n+.11*r+a)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return e=aA(e),[e,e,e]}static G_HTML([e]){const r=kTe(e);return`#${r}${r}${r}`}static RGB_G([e,r,n]){return["G",.3*e+.59*r+.11*n]}static RGB_rgb(e){return e.map(aA)}static RGB_HTML(e){return`#${e.map(kTe).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,r,n,a]){return["RGB",1-Math.min(1,e+a),1-Math.min(1,n+a),1-Math.min(1,r+a)]}static CMYK_rgb([e,r,n,a]){return[aA(1-Math.min(1,e+a)),aA(1-Math.min(1,n+a)),aA(1-Math.min(1,r+a))]}static CMYK_HTML(e){const r=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(r)}static RGB_CMYK([e,r,n]){const a=1-e,i=1-r,s=1-n,o=Math.min(a,i,s);return["CMYK",a,i,s,o]}}class iBt{create(e,r,n=!1){if(e<=0||r<=0)throw new Error("Invalid SVG dimensions");const a=this._createSVG("svg:svg");return a.setAttribute("version","1.1"),n||(a.setAttribute("width",`${e}px`),a.setAttribute("height",`${r}px`)),a.setAttribute("preserveAspectRatio","none"),a.setAttribute("viewBox",`0 0 ${e} ${r}`),a}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){ti("Abstract method `_createSVG` called.")}}class HN extends iBt{_createSVG(e){return document.createElementNS(lg,e)}}const sBt=9,_b=new WeakSet,oBt=new Date().getTimezoneOffset()*60*1e3;class DTe{static create(e){switch(e.data.annotationType){case cs.LINK:return new Tce(e);case cs.TEXT:return new cBt(e);case cs.WIDGET:switch(e.data.fieldType){case"Tx":return new uBt(e);case"Btn":return e.data.radioButton?new sze(e):e.data.checkBox?new hBt(e):new fBt(e);case"Ch":return new pBt(e);case"Sig":return new dBt(e)}return new l1(e);case cs.POPUP:return new WZ(e);case cs.FREETEXT:return new oze(e);case cs.LINE:return new mBt(e);case cs.SQUARE:return new vBt(e);case cs.CIRCLE:return new yBt(e);case cs.POLYLINE:return new lze(e);case cs.CARET:return new bBt(e);case cs.INK:return new xce(e);case cs.POLYGON:return new _Bt(e);case cs.HIGHLIGHT:return new cze(e);case cs.UNDERLINE:return new EBt(e);case cs.SQUIGGLY:return new SBt(e);case cs.STRIKEOUT:return new TBt(e);case cs.STAMP:return new uze(e);case cs.FILEATTACHMENT:return new xBt(e);default:return new ji(e)}}}class ji{#e=null;#t=!1;#n=null;constructor(e,{isRenderable:r=!1,ignoreBorder:n=!1,createQuadrilaterals:a=!1}={}){this.isRenderable=r,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableComment=e.enableComment,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,r&&(this.container=this._createContainer(n)),a&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:r}){return!!(e?.str||r?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return ji._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){const{data:e}=this,r=this.annotationStorage?.getEditor(e.id);return r?r.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){const e=this.annotationStorage?.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;const{quadPoints:r,inkLists:n,rect:a}=this.data;let i=-1/0,s=-1/0;if(r?.length>=8){for(let o=0;o<r.length;o+=8)r[o+1]>s?(s=r[o+1],i=r[o+2]):r[o+1]===s&&(i=Math.max(i,r[o+2]));return[i,s]}if(n?.length>=1){for(const o of n)for(let l=0,u=o.length;l<u;l+=2)o[l+1]>s?(s=o[l+1],i=o[l]):o[l+1]===s&&(i=Math.max(i,o[l]));if(i!==1/0)return[i,s]}return a?[a[2],a[3]]:null}_normalizePoint(e){const{page:{view:r},viewport:{rawDims:{pageWidth:n,pageHeight:a,pageX:i,pageY:s}}}=this.parent;return e[1]=r[3]-e[1]+r[1],e[0]=100*(e[0]-i)/n,e[1]=100*(e[1]-s)/a,e}get commentText(){const{data:e}=this;return this.annotationStorage.getRawValue(`${UN}${e.id}`)?.popup?.contents||e.contentsObj?.str||""}set commentText(e){const{data:r}=this,n={deleted:!e,contents:e||""};this.annotationStorage.updateEditor(r.id,{popup:n})||this.annotationStorage.setValue(`${UN}${r.id}`,{id:r.id,annotationType:r.annotationType,pageIndex:this.parent.page._pageIndex,popup:n,popupRef:r.popupRef,modificationDate:new Date}),e||this.removePopup()}removePopup(){(this.#n?.popup||this.popup)?.remove(),this.#n=this.popup=null}updateEdited(e){if(!this.container)return;e.rect&&(this.#e||={rect:this.data.rect.slice(0)});const{rect:r,popup:n}=e;r&&this.#r(r);let a=this.#n?.popup||this.popup;!a&&n?.text&&(this._createPopup(n),a=this.#n.popup),a&&(a.updateEdited(e),n?.deleted&&(a.remove(),this.#n=null,this.popup=null))}resetEdited(){this.#e&&(this.#r(this.#e.rect),this.#n?.popup.resetEdited(),this.#e=null)}#r(e){const{container:{style:r},data:{rect:n,rotation:a},parent:{viewport:{rawDims:{pageWidth:i,pageHeight:s,pageX:o,pageY:l}}}}=this;n?.splice(0,4,...e),r.left=`${100*(e[0]-o)/i}%`,r.top=`${100*(s-e[3]+l)/s}%`,a===0?(r.width=`${100*(e[2]-e[0])/i}%`,r.height=`${100*(e[3]-e[1])/s}%`):this.setRotation(a)}_createContainer(e){const{data:r,parent:{page:n,viewport:a}}=this,i=document.createElement("section");i.setAttribute("data-annotation-id",r.id),!(this instanceof l1)&&!(this instanceof Tce)&&(i.tabIndex=0);const{style:s}=i;if(s.zIndex=this.parent.zIndex,this.parent.zIndex+=2,r.alternativeText&&(i.title=r.alternativeText),r.noRotate&&i.classList.add("norotate"),!r.rect||this instanceof WZ){const{rotation:m}=r;return!r.hasOwnCanvas&&m!==0&&this.setRotation(m,i),i}const{width:o,height:l}=this;if(!e&&r.borderStyle.width>0){s.borderWidth=`${r.borderStyle.width}px`;const m=r.borderStyle.horizontalCornerRadius,_=r.borderStyle.verticalCornerRadius;if(m>0||_>0){const v=`calc(${m}px * var(--total-scale-factor)) / calc(${_}px * var(--total-scale-factor))`;s.borderRadius=v}else if(this instanceof sze){const v=`calc(${o}px * var(--total-scale-factor)) / calc(${l}px * var(--total-scale-factor))`;s.borderRadius=v}switch(r.borderStyle.style){case HE.SOLID:s.borderStyle="solid";break;case HE.DASHED:s.borderStyle="dashed";break;case HE.BEVELED:Cn("Unimplemented border style: beveled");break;case HE.INSET:Cn("Unimplemented border style: inset");break;case HE.UNDERLINE:s.borderBottomStyle="solid";break}const y=r.borderColor||null;y?(this.#t=!0,s.borderColor=Er.makeHexColor(y[0]|0,y[1]|0,y[2]|0)):s.borderWidth=0}const u=Er.normalizeRect([r.rect[0],n.view[3]-r.rect[1]+n.view[1],r.rect[2],n.view[3]-r.rect[3]+n.view[1]]),{pageWidth:d,pageHeight:h,pageX:f,pageY:p}=a.rawDims;s.left=`${100*(u[0]-f)/d}%`,s.top=`${100*(u[1]-p)/h}%`;const{rotation:g}=r;return r.hasOwnCanvas||g===0?(s.width=`${100*o/d}%`,s.height=`${100*l/h}%`):this.setRotation(g,i),i}setRotation(e,r=this.container){if(!this.data.rect)return;const{pageWidth:n,pageHeight:a}=this.parent.viewport.rawDims;let{width:i,height:s}=this;e%180!==0&&([i,s]=[s,i]),r.style.width=`${100*i/n}%`,r.style.height=`${100*s/a}%`,r.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(r,n,a)=>{const i=a.detail[r],s=i[0],o=i.slice(1);a.target.style[n]=OTe[`${s}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[n]:OTe[`${s}_rgb`](o)})};return Dn(this,"_commonActions",{display:r=>{const{display:n}=r.detail,a=n%2===1;this.container.style.visibility=a?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:a,noPrint:n===1||n===2})},print:r=>{this.annotationStorage.setValue(this.data.id,{noPrint:!r.detail.print})},hidden:r=>{const{hidden:n}=r.detail;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:n,noView:n})},focus:r=>{setTimeout(()=>r.target.focus({preventScroll:!1}),0)},userName:r=>{r.target.title=r.detail.userName},readonly:r=>{r.target.disabled=r.detail.readonly},required:r=>{this._setRequired(r.target,r.detail.required)},bgColor:r=>{e("bgColor","backgroundColor",r)},fillColor:r=>{e("fillColor","backgroundColor",r)},fgColor:r=>{e("fgColor","color",r)},textColor:r=>{e("textColor","color",r)},borderColor:r=>{e("borderColor","borderColor",r)},strokeColor:r=>{e("strokeColor","borderColor",r)},rotation:r=>{const n=r.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(e,r){const n=this._commonActions;for(const a of Object.keys(r.detail))(e[a]||n[a])?.(r)}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const r=this.annotationStorage.getRawValue(this.data.id);if(!r)return;const n=this._commonActions;for(const[a,i]of Object.entries(r)){const s=n[a];if(s){const o={detail:{[a]:i},target:e};s(o),delete r[a]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[r,n,a,i]=this.data.rect.map(m=>Math.fround(m));if(e.length===8){const[m,_,y,v]=e.subarray(2,6);if(a===m&&i===_&&r===y&&n===v)return}const{style:s}=this.container;let o;if(this.#t){const{borderColor:m,borderWidth:_}=s;s.borderWidth=0,o=["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="${m}" stroke-width="${_}">`],this.container.classList.add("hasBorder")}const l=a-r,u=i-n,{svgFactory:d}=this,h=d.createElement("svg");h.classList.add("quadrilateralsContainer"),h.setAttribute("width",0),h.setAttribute("height",0),h.role="none";const f=d.createElement("defs");h.append(f);const p=d.createElement("clipPath"),g=`clippath_${this.data.id}`;p.setAttribute("id",g),p.setAttribute("clipPathUnits","objectBoundingBox"),f.append(p);for(let m=2,_=e.length;m<_;m+=8){const y=e[m],v=e[m+1],b=e[m+2],E=e[m+3],S=d.createElement("rect"),T=(b-r)/l,x=(i-v)/u,w=(y-b)/l,C=(v-E)/u;S.setAttribute("x",T),S.setAttribute("y",x),S.setAttribute("width",w),S.setAttribute("height",C),p.append(S),o?.push(`<rect vector-effect="non-scaling-stroke" x="${T}" y="${x}" width="${w}" height="${C}"/>`)}this.#t&&(o.push("</g></svg>')"),s.backgroundImage=o.join("")),this.container.append(h),this.container.style.clipPath=`url(#${g})`}_createPopup(e=null){const{data:r}=this;let n,a;e?(n={str:e.text},a=e.date):(n=r.contentsObj,a=r.modificationDate);const i=this.#n=new WZ({data:{color:r.color,titleObj:r.titleObj,modificationDate:a,contentsObj:n,richText:r.richText,parentRect:r.rect,borderStyle:0,id:`popup_${r.id}`,rotation:r.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]});this.parent._commentManager||this.parent.div.append(i.render())}get hasPopupElement(){return!!(this.#n||this.popup||this.data.popupRef)}get extraPopupElement(){return this.#n}render(){ti("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,r=null){const n=[];if(this._fieldObjects){const a=this._fieldObjects[e];if(a)for(const{page:i,id:s,exportValues:o}of a){if(i===-1||s===r)continue;const l=typeof o=="string"?o:null,u=document.querySelector(`[data-element-id="${s}"]`);if(u&&!_b.has(u)){Cn(`_getElementsByName - element not allowed: ${s}`);continue}n.push({id:s,exportValue:l,domElement:u})}return n}for(const a of document.getElementsByName(e)){const{exportValue:i}=a,s=a.getAttribute("data-element-id");s!==r&&_b.has(a)&&n.push({id:s,exportValue:i,domElement:a})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const r of e)r.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:r}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:r,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}}class lBt extends ji{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.editor=e.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){const{editor:e}=this;e.hasComment&&(this._createPopup(e.comment),this.extraPopupElement.popup.renderCommentButton())}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(e){this.editor.comment=e,e||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.container.remove(),this.container=null,this.removePopup()}}class Tce extends ji{constructor(e,r=null){super(e,{isRenderable:!0,ignoreBorder:!!r?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:r}=this,n=document.createElement("a");n.setAttribute("data-element-id",e.id);let a=!1;return e.url?(r.addLinkAttributes(n,e.url,e.newWindow),a=!0):e.action?(this._bindNamedAction(n,e.action,e.overlaidText),a=!0):e.attachment?(this.#t(n,e.attachment,e.overlaidText,e.attachmentDest),a=!0):e.setOCGState?(this.#n(n,e.setOCGState,e.overlaidText),a=!0):e.dest?(this._bindLink(n,e.dest,e.overlaidText),a=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,e),a=!0),e.resetForm?(this._bindResetFormAction(n,e.resetForm),a=!0):this.isTooltipOnly&&!a&&(this._bindLink(n,""),a=!0)),this.container.classList.add("linkAnnotation"),a&&this.container.append(n),this.container}#e(){this.container.setAttribute("data-internal-link","")}_bindLink(e,r,n=""){e.href=this.linkService.getDestinationHash(r),e.onclick=()=>(r&&this.linkService.goToDestination(r),!1),(r||r==="")&&this.#e(),n&&(e.title=n)}_bindNamedAction(e,r,n=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(r),!1),n&&(e.title=n),this.#e()}#t(e,r,n="",a=null){e.href=this.linkService.getAnchorUrl(""),r.description?e.title=r.description:n&&(e.title=n),e.onclick=()=>(this.downloadManager?.openOrDownloadData(r.content,r.filename,a),!1),this.#e()}#n(e,r,n=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(r),!1),n&&(e.title=n),this.#e()}_bindJSAction(e,r){e.href=this.linkService.getAnchorUrl("");const n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const a of Object.keys(r.actions)){const i=n.get(a);i&&(e[i]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r.id,name:a}}),!1))}r.overlaidText&&(e.title=r.overlaidText),e.onclick||(e.onclick=()=>!1),this.#e()}_bindResetFormAction(e,r){const n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl("")),this.#e(),!this._fieldObjects){Cn('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(e.onclick=()=>!1);return}e.onclick=()=>{n?.();const{fields:a,refs:i,include:s}=r,o=[];if(a.length!==0||i.length!==0){const d=new Set(i);for(const h of a){const f=this._fieldObjects[h]||[];for(const{id:p}of f)d.add(p)}for(const h of Object.values(this._fieldObjects))for(const f of h)d.has(f.id)===s&&o.push(f)}else for(const d of Object.values(this._fieldObjects))o.push(...d);const l=this.annotationStorage,u=[];for(const d of o){const{id:h}=d;switch(u.push(h),d.type){case"text":{const p=d.defaultValue||"";l.setValue(h,{value:p});break}case"checkbox":case"radiobutton":{const p=d.defaultValue===d.exportValues;l.setValue(h,{value:p});break}case"combobox":case"listbox":{const p=d.defaultValue||"";l.setValue(h,{value:p});break}default:continue}const f=document.querySelector(`[data-element-id="${h}"]`);if(f){if(!_b.has(f)){Cn(`_bindResetFormAction - element not allowed: ${h}`);continue}}else continue;f.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:u,name:"ResetForm"}}),!1}}}class cBt extends ji{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class l1 extends ji{render(){return this.container}showElementAndHideCanvas(e){this.data.hasOwnCanvas&&(e.previousSibling?.nodeName==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return Ao.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,r,n,a,i){n.includes("mouse")?e.addEventListener(n,s=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:i(s),shift:s.shiftKey,modifier:this._getKeyModifier(s)}})}):e.addEventListener(n,s=>{if(n==="blur"){if(!r.focused||!s.relatedTarget)return;r.focused=!1}else if(n==="focus"){if(r.focused)return;r.focused=!0}i&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:i(s)}})})}_setEventListeners(e,r,n,a){for(const[i,s]of n)(s==="Action"||this.data.actions?.[s])&&((s==="Focus"||s==="Blur")&&(r||={focused:!1}),this._setEventListener(e,r,i,s,a),s==="Focus"&&!this.data.actions?.Blur?this._setEventListener(e,r,"blur","Blur",null):s==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(e,r,"focus","Focus",null))}_setBackgroundColor(e){const r=this.data.backgroundColor||null;e.style.backgroundColor=r===null?"transparent":Er.makeHexColor(r[0],r[1],r[2])}_setTextStyle(e){const r=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,a=this.data.defaultAppearanceData.fontSize||sBt,i=e.style;let s;const o=2,l=u=>Math.round(10*u)/10;if(this.data.multiLine){const u=Math.abs(this.data.rect[3]-this.data.rect[1]-o),d=Math.round(u/(ZV*a))||1,h=u/d;s=Math.min(a,l(h/ZV))}else{const u=Math.abs(this.data.rect[3]-this.data.rect[1]-o);s=Math.min(a,l(u/ZV))}i.fontSize=`calc(${s}px * var(--total-scale-factor))`,i.color=Er.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(i.textAlign=r[this.data.textAlignment])}_setRequired(e,r){r?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",r)}}class uBt extends l1{constructor(e){const r=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:r})}setPropertyOnSiblings(e,r,n,a){const i=this.annotationStorage;for(const s of this._getElementsByName(e.name,e.id))s.domElement&&(s.domElement[r]=n),i.setValue(s.id,{[a]:n})}render(){const e=this.annotationStorage,r=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const a=e.getValue(r,{value:this.data.fieldValue});let i=a.value||"";const s=e.getValue(r,{charLimit:this.data.maxLen}).charLimit;s&&i.length>s&&(i=i.slice(0,s));let o=a.formattedValue||this.data.textContent?.join(`
453
453
  `)||null;o&&this.data.comb&&(o=o.replaceAll(/\s+/g,""));const l={userValue:i,formattedValue:o,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=o??i,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type=this.data.password?"password":"text",n.setAttribute("value",o??i),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),_b.add(n),n.setAttribute("data-element-id",r),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=0;const{datetimeFormat:u,datetimeType:d,timeStep:h}=this.data,f=!!d&&this.enableScripting;u&&(n.title=u),this._setRequired(n,this.data.required),s&&(n.maxLength=s),n.addEventListener("input",g=>{e.setValue(r,{value:g.target.value}),this.setPropertyOnSiblings(n,"value",g.target.value,"value"),l.formattedValue=null}),n.addEventListener("resetform",g=>{const m=this.data.defaultFieldValue??"";n.value=l.userValue=m,l.formattedValue=null});let p=g=>{const{formattedValue:m}=l;m!=null&&(g.target.value=m),g.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",m=>{if(l.focused)return;const{target:_}=m;if(f&&(_.type=d,h&&(_.step=h)),l.userValue){const y=l.userValue;if(f)if(d==="time"){const v=new Date(y),b=[v.getHours(),v.getMinutes(),v.getSeconds()];_.value=b.map(E=>E.toString().padStart(2,"0")).join(":")}else _.value=new Date(y-oBt).toISOString().split(d==="date"?"T":".",1)[0];else _.value=y}l.lastCommittedValue=_.value,l.commitKey=1,this.data.actions?.Focus||(l.focused=!0)}),n.addEventListener("updatefromsandbox",m=>{this.showElementAndHideCanvas(m.target);const _={value(y){l.userValue=y.detail.value??"",f||e.setValue(r,{value:l.userValue.toString()}),y.target.value=l.userValue},formattedValue(y){const{formattedValue:v}=y.detail;l.formattedValue=v,v!=null&&y.target!==document.activeElement&&(y.target.value=v);const b={formattedValue:v};f&&(b.value=v),e.setValue(r,b)},selRange(y){y.target.setSelectionRange(...y.detail.selRange)},charLimit:y=>{const{charLimit:v}=y.detail,{target:b}=y;if(v===0){b.removeAttribute("maxLength");return}b.setAttribute("maxLength",v);let E=l.userValue;!E||E.length<=v||(E=E.slice(0,v),b.value=l.userValue=E,e.setValue(r,{value:E}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:E,willCommit:!0,commitKey:1,selStart:b.selectionStart,selEnd:b.selectionEnd}}))}};this._dispatchEventFromSandbox(_,m)}),n.addEventListener("keydown",m=>{l.commitKey=1;let _=-1;if(m.key==="Escape"?_=0:m.key==="Enter"&&!this.data.multiLine?_=2:m.key==="Tab"&&(l.commitKey=3),_===-1)return;const{value:y}=m.target;l.lastCommittedValue!==y&&(l.lastCommittedValue=y,l.userValue=y,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:y,willCommit:!0,commitKey:_,selStart:m.target.selectionStart,selEnd:m.target.selectionEnd}}))});const g=p;p=null,n.addEventListener("blur",m=>{if(!l.focused||!m.relatedTarget)return;this.data.actions?.Blur||(l.focused=!1);const{target:_}=m;let{value:y}=_;if(f){if(y&&d==="time"){const v=y.split(":").map(b=>parseInt(b,10));y=new Date(2e3,0,1,v[0],v[1],v[2]||0).valueOf(),_.step=""}else y.includes("T")||(y=`${y}T00:00`),y=new Date(y).valueOf();_.type="text"}l.userValue=y,l.lastCommittedValue!==y&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:y,willCommit:!0,commitKey:l.commitKey,selStart:m.target.selectionStart,selEnd:m.target.selectionEnd}}),g(m)}),this.data.actions?.Keystroke&&n.addEventListener("beforeinput",m=>{l.lastCommittedValue=null;const{data:_,target:y}=m,{value:v,selectionStart:b,selectionEnd:E}=y;let S=b,T=E;switch(m.inputType){case"deleteWordBackward":{const x=v.substring(0,b).match(/\w*[^\w]*$/);x&&(S-=x[0].length);break}case"deleteWordForward":{const x=v.substring(b).match(/^[^\w]*\w*/);x&&(T+=x[0].length);break}case"deleteContentBackward":b===E&&(S-=1);break;case"deleteContentForward":b===E&&(T+=1);break}m.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:v,change:_||"",willCommit:!1,selStart:S,selEnd:T}})}),this._setEventListeners(n,l,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],m=>m.target.value)}if(p&&n.addEventListener("blur",p),this.data.comb){const m=(this.data.rect[2]-this.data.rect[0])/s;n.classList.add("comb"),n.style.letterSpacing=`calc(${m}px * var(--total-scale-factor) - 1ch)`}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell",this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class dBt extends l1{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class hBt extends l1{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,r=this.data,n=r.id;let a=e.getValue(n,{value:r.exportValue===r.fieldValue}).value;typeof a=="string"&&(a=a!=="Off",e.setValue(n,{value:a})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const i=document.createElement("input");return _b.add(i),i.setAttribute("data-element-id",n),i.disabled=r.readOnly,this._setRequired(i,this.data.required),i.type="checkbox",i.name=r.fieldName,a&&i.setAttribute("checked",!0),i.setAttribute("exportValue",r.exportValue),i.tabIndex=0,i.addEventListener("change",s=>{const{name:o,checked:l}=s.target;for(const u of this._getElementsByName(o,n)){const d=l&&u.exportValue===r.exportValue;u.domElement&&(u.domElement.checked=d),e.setValue(u.id,{value:d})}e.setValue(n,{value:l})}),i.addEventListener("resetform",s=>{const o=r.defaultFieldValue||"Off";s.target.checked=o===r.exportValue}),this.enableScripting&&this.hasJSActions&&(i.addEventListener("updatefromsandbox",s=>{const o={value(l){l.target.checked=l.detail.value!=="Off",e.setValue(n,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,s)}),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],s=>s.target.checked)),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class sze extends l1{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,r=this.data,n=r.id;let a=e.getValue(n,{value:r.fieldValue===r.buttonValue}).value;if(typeof a=="string"&&(a=a!==r.buttonValue,e.setValue(n,{value:a})),a)for(const s of this._getElementsByName(r.fieldName,n))e.setValue(s.id,{value:!1});const i=document.createElement("input");if(_b.add(i),i.setAttribute("data-element-id",n),i.disabled=r.readOnly,this._setRequired(i,this.data.required),i.type="radio",i.name=r.fieldName,a&&i.setAttribute("checked",!0),i.tabIndex=0,i.addEventListener("change",s=>{const{name:o,checked:l}=s.target;for(const u of this._getElementsByName(o,n))e.setValue(u.id,{value:!1});e.setValue(n,{value:l})}),i.addEventListener("resetform",s=>{const o=r.defaultFieldValue;s.target.checked=o!=null&&o===r.buttonValue}),this.enableScripting&&this.hasJSActions){const s=r.buttonValue;i.addEventListener("updatefromsandbox",o=>{const l={value:u=>{const d=s===u.detail.value;for(const h of this._getElementsByName(u.target.name)){const f=d&&h.id===n;h.domElement&&(h.domElement.checked=f),e.setValue(h.id,{value:f})}}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)}return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class fBt extends Tce{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const r=e.lastChild;return this.enableScripting&&this.hasJSActions&&r&&(this._setDefaultPropertiesFromJS(r),r.addEventListener("updatefromsandbox",n=>{this._dispatchEventFromSandbox({},n)})),e}}class pBt extends l1{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,r=this.data.id,n=e.getValue(r,{value:this.data.fieldValue}),a=document.createElement("select");_b.add(a),a.setAttribute("data-element-id",r),a.disabled=this.data.readOnly,this._setRequired(a,this.data.required),a.name=this.data.fieldName,a.tabIndex=0;let i=this.data.combo&&this.data.options.length>0;this.data.combo||(a.size=this.data.options.length,this.data.multiSelect&&(a.multiple=!0)),a.addEventListener("resetform",d=>{const h=this.data.defaultFieldValue;for(const f of a.options)f.selected=f.value===h});for(const d of this.data.options){const h=document.createElement("option");h.textContent=d.displayValue,h.value=d.exportValue,n.value.includes(d.exportValue)&&(h.setAttribute("selected",!0),i=!1),a.append(h)}let s=null;if(i){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),a.prepend(d),s=()=>{d.remove(),a.removeEventListener("input",s),s=null},a.addEventListener("input",s)}const o=d=>{const h=d?"value":"textContent",{options:f,multiple:p}=a;return p?Array.prototype.filter.call(f,g=>g.selected).map(g=>g[h]):f.selectedIndex===-1?null:f[f.selectedIndex][h]};let l=o(!1);const u=d=>{const h=d.target.options;return Array.prototype.map.call(h,f=>({displayValue:f.textContent,exportValue:f.value}))};return this.enableScripting&&this.hasJSActions?(a.addEventListener("updatefromsandbox",d=>{const h={value(f){s?.();const p=f.detail.value,g=new Set(Array.isArray(p)?p:[p]);for(const m of a.options)m.selected=g.has(m.value);e.setValue(r,{value:o(!0)}),l=o(!1)},multipleSelection(f){a.multiple=!0},remove(f){const p=a.options,g=f.detail.remove;p[g].selected=!1,a.remove(g),p.length>0&&Array.prototype.findIndex.call(p,_=>_.selected)===-1&&(p[0].selected=!0),e.setValue(r,{value:o(!0),items:u(f)}),l=o(!1)},clear(f){for(;a.length!==0;)a.remove(0);e.setValue(r,{value:null,items:[]}),l=o(!1)},insert(f){const{index:p,displayValue:g,exportValue:m}=f.detail.insert,_=a.children[p],y=document.createElement("option");y.textContent=g,y.value=m,_?_.before(y):a.append(y),e.setValue(r,{value:o(!0),items:u(f)}),l=o(!1)},items(f){const{items:p}=f.detail;for(;a.length!==0;)a.remove(0);for(const g of p){const{displayValue:m,exportValue:_}=g,y=document.createElement("option");y.textContent=m,y.value=_,a.append(y)}a.options.length>0&&(a.options[0].selected=!0),e.setValue(r,{value:o(!0),items:u(f)}),l=o(!1)},indices(f){const p=new Set(f.detail.indices);for(const g of f.target.options)g.selected=p.has(g.index);e.setValue(r,{value:o(!0)}),l=o(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(h,d)}),a.addEventListener("input",d=>{const h=o(!0),f=o(!1);e.setValue(r,{value:h}),d.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:l,change:f,changeEx:h,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(a,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],d=>d.target.value)):a.addEventListener("input",function(d){e.setValue(r,{value:o(!0)})}),this.data.combo&&this._setTextStyle(a),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class WZ extends ji{constructor(e){const{data:r,elements:n,parent:a}=e,i=!!a._commentManager;if(super(e,{isRenderable:!i&&ji._hasPopupData(r)}),this.elements=n,i&&ji._hasPopupData(r)){const s=this.popup=this.#e();for(const o of n)o.popup=s}else this.popup=null}#e(){return new gBt({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})}render(){const{container:e}=this;e.classList.add("popupAnnotation"),e.role="comment";const r=this.popup=this.#e(),n=[];for(const a of this.elements)a.popup=r,a.container.ariaHasPopup="dialog",n.push(a.data.id),a.addHighlightArea();return this.container.setAttribute("aria-controls",n.map(a=>`${uce}${a}`).join(",")),this.container}}class gBt{#e=null;#t=this.#H.bind(this);#n=this.#U.bind(this);#r=this.#D.bind(this);#s=this.#E.bind(this);#a=null;#i=null;#o=null;#c=null;#l=null;#h=null;#d=null;#f=!1;#m=null;#p=null;#u=null;#g=null;#v=null;#_=null;#y=null;#w=null;#T=null;#b=null;#A=!1;#S=null;#x=null;constructor({container:e,color:r,elements:n,titleObj:a,modificationDate:i,contentsObj:s,richText:o,parent:l,rect:u,parentRect:d,open:h,commentManager:f=null}){this.#i=e,this.#T=a,this.#o=s,this.#w=o,this.#h=l,this.#a=r,this.#y=u,this.#d=d,this.#l=n,this.#e=f,this.#S=n[0],this.#c=f5.toDateObject(i),this.trigger=n.flatMap(p=>p.getElementsToTriggerPopup()),f?this.renderCommentButton():(this.#I(),this.#i.hidden=!0,h&&this.#E())}#I(){if(this.#p)return;this.#p=new AbortController;const{signal:e}=this.#p;for(const r of this.trigger)r.addEventListener("click",this.#s,{signal:e}),r.addEventListener("pointerenter",this.#r,{signal:e}),r.addEventListener("pointerleave",this.#n,{signal:e}),r.classList.add("popupTriggerArea");for(const r of this.#l)r.container?.addEventListener("keydown",this.#t,{signal:e})}#R(){const e=this.#l.find(r=>r.hasCommentButton);e&&(this.#v=e._normalizePoint(e.commentButtonPosition))}renderCommentButton(){if(this.#g||(this.#v||this.#R(),!this.#v))return;const{signal:e}=this.#p=new AbortController,r=!!this.#S.extraPopupElement,n=()=>{this.#e.toggleCommentPopup(this,!0,void 0,!r)},a=()=>{this.#e.toggleCommentPopup(this,!1,!0,!r)},i=()=>{this.#e.toggleCommentPopup(this,!1,!1)};if(r){this.#g=this.#S.container;for(const s of this.trigger)s.ariaHasPopup="dialog",s.ariaControls="commentPopup",s.addEventListener("keydown",this.#t,{signal:e}),s.addEventListener("click",n,{signal:e}),s.addEventListener("pointerenter",a,{signal:e}),s.addEventListener("pointerleave",i,{signal:e}),s.classList.add("popupTriggerArea")}else{const s=this.#g=document.createElement("button");s.className="annotationCommentButton";const o=this.#S.container;s.style.zIndex=o.style.zIndex+1,s.tabIndex=0,s.ariaHasPopup="dialog",s.ariaControls="commentPopup",s.setAttribute("data-l10n-id","pdfjs-show-comment-button"),this.#B(),this.#N(),s.addEventListener("keydown",this.#t,{signal:e}),s.addEventListener("click",n,{signal:e}),s.addEventListener("pointerenter",a,{signal:e}),s.addEventListener("pointerleave",i,{signal:e}),o.after(s)}}#N(){if(this.#S.extraPopupElement&&!this.#S.editor)return;this.renderCommentButton();const[e,r]=this.#v,{style:n}=this.#g;n.left=`calc(${e}%)`,n.top=`calc(${r}% - var(--comment-button-dim))`}#B(){this.#S.extraPopupElement||(this.renderCommentButton(),this.#g.style.backgroundColor=this.commentButtonColor||"")}get commentButtonColor(){const{color:e,opacity:r}=this.#S.commentData;return e?this.#h._commentManager.makeCommentColor(e,r):null}focusCommentButton(){setTimeout(()=>{this.#g?.focus()},0)}getData(){const{richText:e,color:r,opacity:n,creationDate:a,modificationDate:i}=this.#S.commentData;return{contentsObj:{str:this.comment},richText:e,color:r,opacity:n,creationDate:a,modificationDate:i}}get elementBeforePopup(){return this.#g}get comment(){return this.#x||=this.#S.commentText,this.#x}set comment(e){e!==this.comment&&(this.#S.commentText=this.#x=e)}get parentBoundingClientRect(){return this.#S.layer.getBoundingClientRect()}setCommentButtonStates({selected:e,hasPopup:r}){this.#g&&(this.#g.classList.toggle("selected",e),this.#g.ariaExpanded=r)}setSelectedCommentButton(e){this.#g.classList.toggle("selected",e)}get commentPopupPosition(){if(this.#_)return this.#_;const{x:e,y:r,height:n}=this.#g.getBoundingClientRect(),{x:a,y:i,width:s,height:o}=this.#S.layer.getBoundingClientRect();return[(e-a)/s,(r+n-i)/o]}set commentPopupPosition(e){this.#_=e}hasDefaultPopupPosition(){return this.#_===null}get commentButtonPosition(){return this.#v}get commentButtonWidth(){return this.#g.getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(e){const[r,n]=this.#_||this.commentButtonPosition.map(u=>u/100),a=this.parentBoundingClientRect,{x:i,y:s,width:o,height:l}=a;this.#e.showDialog(null,this,i+r*o,s+n*l,{...e,parentDimensions:a})}render(){if(this.#m)return;const e=this.#m=document.createElement("div");if(e.className="popup",this.#a){const n=e.style.outlineColor=Er.makeHexColor(...this.#a);e.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`}const r=document.createElement("span");if(r.className="header",this.#T?.str){const n=document.createElement("span");n.className="title",r.append(n),{dir:n.dir,str:n.textContent}=this.#T}if(e.append(r),this.#c){const n=document.createElement("time");n.className="popupDate",n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#c.valueOf()})),n.dateTime=this.#c.toISOString(),r.append(n)}hce({html:this.#O||this.#o.str,dir:this.#o?.dir,className:"popupContent"},e),this.#i.append(e)}get#O(){const e=this.#w,r=this.#o;return e?.str&&(!r?.str||r.str===e.str)&&this.#w.html||null}get#L(){return this.#O?.attributes?.style?.fontSize||0}get#F(){return this.#O?.attributes?.style?.color||null}#M(e){const r=[],n={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:r}]}},a={style:{color:this.#F,fontSize:this.#L?`calc(${this.#L}px * var(--total-scale-factor))`:""}};for(const i of e.split(`
454
454
  `))r.push({name:"span",value:i,attributes:a});return n}#H(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&this.#f)&&this.#E()}updateEdited({rect:e,popup:r,deleted:n}){if(this.#e){n?(this.remove(),this.#x=null):r&&(r.deleted?this.remove():(this.#B(),this.#x=r.text)),e&&(this.#v=null,this.#R(),this.#N());return}if(n||r?.deleted){this.remove();return}this.#I(),this.#b||={contentsObj:this.#o,richText:this.#w},e&&(this.#u=null),r&&r.text&&(this.#w=this.#M(r.text),this.#c=f5.toDateObject(r.date),this.#o=null),this.#m?.remove(),this.#m=null}resetEdited(){this.#b&&({contentsObj:this.#o,richText:this.#w}=this.#b,this.#b=null,this.#m?.remove(),this.#m=null,this.#u=null)}remove(){if(this.#p?.abort(),this.#p=null,this.#m?.remove(),this.#m=null,this.#A=!1,this.#f=!1,this.#g?.remove(),this.#g=null,this.trigger)for(const e of this.trigger)e.classList.remove("popupTriggerArea")}#C(){if(this.#u!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:r,pageHeight:n,pageX:a,pageY:i}}}=this.#h;let s=!!this.#d,o=s?this.#d:this.#y;for(const g of this.#l)if(!o||Er.intersect(g.data.rect,o)!==null){o=g.data.rect,s=!0;break}const l=Er.normalizeRect([o[0],e[3]-o[1]+e[1],o[2],e[3]-o[3]+e[1]]),d=s?o[2]-o[0]+5:0,h=l[0]+d,f=l[1];this.#u=[100*(h-a)/r,100*(f-i)/n];const{style:p}=this.#i;p.left=`${this.#u[0]}%`,p.top=`${this.#u[1]}%`}#E(){if(this.#e){this.#e.toggleCommentPopup(this,!1);return}this.#f=!this.#f,this.#f?(this.#D(),this.#i.addEventListener("click",this.#s),this.#i.addEventListener("keydown",this.#t)):(this.#U(),this.#i.removeEventListener("click",this.#s),this.#i.removeEventListener("keydown",this.#t))}#D(){this.#m||this.render(),this.isVisible?this.#f&&this.#i.classList.add("focused"):(this.#C(),this.#i.hidden=!1,this.#i.style.zIndex=parseInt(this.#i.style.zIndex)+1e3)}#U(){this.#i.classList.remove("focused"),!(this.#f||!this.isVisible)&&(this.#i.hidden=!0,this.#i.style.zIndex=parseInt(this.#i.style.zIndex)-1e3)}forceHide(){this.#A=this.isVisible,this.#A&&(this.#i.hidden=!0)}maybeShow(){this.#e||(this.#I(),this.#A&&(this.#m||this.#D(),this.#A=!1,this.#i.hidden=!1))}get isVisible(){return this.#e?!1:this.#i.hidden===!1}}class oze extends ji{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=wn.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const r of this.textContent){const n=document.createElement("span");n.textContent=r,e.append(n)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class mBt extends ji{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const{data:e,width:r,height:n}=this,a=this.svgFactory.create(r,n,!0),i=this.#e=this.svgFactory.createElement("svg:line");return i.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),i.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),i.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),i.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),i.setAttribute("stroke-width",e.borderStyle.width||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),a.append(i),this.container.append(a),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class vBt extends ji{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const{data:e,width:r,height:n}=this,a=this.svgFactory.create(r,n,!0),i=e.borderStyle.width,s=this.#e=this.svgFactory.createElement("svg:rect");return s.setAttribute("x",i/2),s.setAttribute("y",i/2),s.setAttribute("width",r-i),s.setAttribute("height",n-i),s.setAttribute("stroke-width",i||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),a.append(s),this.container.append(a),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class yBt extends ji{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const{data:e,width:r,height:n}=this,a=this.svgFactory.create(r,n,!0),i=e.borderStyle.width,s=this.#e=this.svgFactory.createElement("svg:ellipse");return s.setAttribute("cx",r/2),s.setAttribute("cy",n/2),s.setAttribute("rx",r/2-i/2),s.setAttribute("ry",n/2-i/2),s.setAttribute("stroke-width",i||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),a.append(s),this.container.append(a),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class lze extends ji{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:r,borderStyle:n,popupRef:a},width:i,height:s}=this;if(!r)return this.container;const o=this.svgFactory.create(i,s,!0);let l=[];for(let d=0,h=r.length;d<h;d+=2){const f=r[d]-e[0],p=e[3]-r[d+1];l.push(`${f},${p}`)}l=l.join(" ");const u=this.#e=this.svgFactory.createElement(this.svgElementName);return u.setAttribute("points",l),u.setAttribute("stroke-width",n.width||1),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),o.append(u),this.container.append(o),!a&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class _Bt extends lze{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class bBt extends ji{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class xce extends ji{#e=null;#t=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?wn.HIGHLIGHT:wn.INK}#n(e,r){switch(e){case 90:return{transform:`rotate(90) translate(${-r[0]},${r[1]}) scale(1,-1)`,width:r[3]-r[1],height:r[2]-r[0]};case 180:return{transform:`rotate(180) translate(${-r[2]},${r[1]}) scale(1,-1)`,width:r[2]-r[0],height:r[3]-r[1]};case 270:return{transform:`rotate(270) translate(${-r[2]},${r[3]}) scale(1,-1)`,width:r[3]-r[1],height:r[2]-r[0]};default:return{transform:`translate(${-r[0]},${r[3]}) scale(1,-1)`,width:r[2]-r[0],height:r[3]-r[1]}}}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,rotation:r,inkLists:n,borderStyle:a,popupRef:i}}=this,{transform:s,width:o,height:l}=this.#n(r,e),u=this.svgFactory.create(o,l,!0),d=this.#e=this.svgFactory.createElement("svg:g");u.append(d),d.setAttribute("stroke-width",a.width||1),d.setAttribute("stroke-linecap","round"),d.setAttribute("stroke-linejoin","round"),d.setAttribute("stroke-miterlimit",10),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),d.setAttribute("transform",s);for(let h=0,f=n.length;h<f;h++){const p=this.svgFactory.createElement(this.svgElementName);this.#t.push(p),p.setAttribute("points",n[h].join(",")),d.append(p)}return!i&&this.hasPopupData&&this._createPopup(),this.container.append(u),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);const{thickness:r,points:n,rect:a}=e,i=this.#e;if(r>=0&&i.setAttribute("stroke-width",r||1),n)for(let s=0,o=this.#t.length;s<o;s++)this.#t[s].setAttribute("points",n[s].join(","));if(a){const{transform:s,width:o,height:l}=this.#n(this.data.rotation,a);i.parentElement.setAttribute("viewBox",`0 0 ${o} ${l}`),i.setAttribute("transform",s)}}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class cze extends ji{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=wn.HIGHLIGHT}render(){const{data:{overlaidText:e,popupRef:r}}=this;if(!r&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),e){const n=document.createElement("mark");n.classList.add("overlaidText"),n.textContent=e,this.container.append(n)}return this.container}}class EBt extends ji{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:r}}=this;if(!r&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),e){const n=document.createElement("u");n.classList.add("overlaidText"),n.textContent=e,this.container.append(n)}return this.container}}class SBt extends ji{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:r}}=this;if(!r&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),e){const n=document.createElement("u");n.classList.add("overlaidText"),n.textContent=e,this.container.append(n)}return this.container}}class TBt extends ji{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:r}}=this;if(!r&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),e){const n=document.createElement("s");n.classList.add("overlaidText"),n.textContent=e,this.container.append(n)}return this.container}}class uze extends ji{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=wn.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class xBt extends ji{#e=null;constructor(e){super(e,{isRenderable:!0});const{file:r}=this.data;this.filename=r.filename,this.content=r.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...r})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:r}=this;let n;r.hasAppearance||r.fillAlpha===0?n=document.createElement("div"):(n=document.createElement("img"),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(r.name)?"paperclip":"pushpin"}.svg`,r.fillAlpha&&r.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(r.fillAlpha*100)}%);`)),n.addEventListener("dblclick",this.#t.bind(this)),this.#e=n;const{isMac:a}=Ao.platform;return e.addEventListener("keydown",i=>{i.key==="Enter"&&(a?i.metaKey:i.ctrlKey)&&this.#t()}),!r.popupRef&&this.hasPopupData?this._createPopup():n.classList.add("popupTriggerArea"),e.append(n),e}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}#t(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}let wce=class dze{#e=null;#t=null;#n=null;#r=new Map;#s=null;#a=null;constructor({div:e,accessibilityManager:r,annotationCanvasMap:n,annotationEditorUIManager:a,page:i,viewport:s,structTreeLayer:o,commentManager:l,linkService:u,annotationStorage:d}){this.div=e,this.#e=r,this.#t=n,this.#s=o||null,this.#a=u||null,this.#n=d||new gce,this.page=i,this.viewport=s,this.zIndex=0,this._annotationEditorUIManager=a,this._commentManager=l||null}hasEditableAnnotations(){return this.#r.size>0}async#i(e,r,n){const a=e.firstChild||e,i=a.id=`${uce}${r}`,s=await this.#s?.getAriaAttributes(i);if(s)for(const[o,l]of s)a.setAttribute(o,l);n?n.at(-1).container.after(e):(this.div.append(e),this.#e?.moveElementInDOM(this.div,e,a,!1))}async render(e){const{annotations:r}=e,n=this.div;Jv(n,this.viewport);const a=new Map,i={data:null,layer:n,linkService:this.#a,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new HN,annotationStorage:this.#n,enableComment:e.enableComment===!0,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const s of r){if(s.noHTML)continue;const o=s.annotationType===cs.POPUP;if(o){const d=a.get(s.id);if(!d)continue;i.elements=d}else if(s.rect[2]===s.rect[0]||s.rect[3]===s.rect[1])continue;i.data=s;const l=DTe.create(i);if(!l.isRenderable)continue;if(!o&&s.popupRef){const d=a.get(s.popupRef);d?d.push(l):a.set(s.popupRef,[l])}const u=l.render();s.hidden&&(u.style.visibility="hidden"),await this.#i(u,s.id,i.elements),l.extraPopupElement?.popup?.renderCommentButton(),l._isEditable&&(this.#r.set(l.data.id,l),this._annotationEditorUIManager?.renderAnnotationElement(l))}this.#o()}async addLinkAnnotations(e){const r={data:null,layer:this.div,linkService:this.#a,svgFactory:new HN,parent:this};for(const n of e){n.borderStyle||=dze._defaultBorderStyle,r.data=n;const a=DTe.create(r);if(!a.isRenderable)continue;const i=a.render();await this.#i(i,n.id,null)}}update({viewport:e}){const r=this.div;this.viewport=e,Jv(r,{rotation:e.rotation}),this.#o(),r.hidden=!1}#o(){if(!this.#t)return;const e=this.div;for(const[r,n]of this.#t){const a=e.querySelector(`[data-annotation-id="${r}"]`);if(!a)continue;n.className="annotationContent";const{firstChild:i}=a;i?i.nodeName==="CANVAS"?i.replaceWith(n):i.classList.contains("annotationContent")?i.after(n):i.before(n):a.append(n);const s=this.#r.get(r);s&&(s._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(r,a.id,n),s._hasNoCanvas=!1):s.canvas=n)}this.#t.clear()}getEditableAnnotations(){return Array.from(this.#r.values())}getEditableAnnotation(e){return this.#r.get(e)}addFakeAnnotation(e){const{div:r}=this,{id:n,rotation:a}=e,i=new lBt({data:{id:n,rect:e.getPDFRect(),rotation:a},editor:e,layer:r,parent:this,enableComment:!!this._commentManager,linkService:this.#a,annotationStorage:this.#n}),s=i.render();return r.append(s),this.#e?.moveElementInDOM(r,s,s,!1),i.createOrUpdatePopup(),i}static get _defaultBorderStyle(){return Dn(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:HE.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}};const dL=/\r\n?|\n/g;class So extends Hr{#e="";#t=`${this.id}-editor`;#n=null;#r;_colorPicker=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const e=So.prototype,r=i=>i.isEmpty(),n=em.TRANSLATE_SMALL,a=em.TRANSLATE_BIG;return Dn(this,"_keyboardManager",new wk([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-n,0],checker:r}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-a,0],checker:r}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[n,0],checker:r}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[a,0],checker:r}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:r}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-a],checker:r}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,n],checker:r}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,a],checker:r}]]))}static _type="freetext";static _editorType=wn.FREETEXT;constructor(e){super({...e,name:"freeTextEditor"}),this.color=e.color||So._defaultColor||Hr._defaultLineColor,this.#r=e.fontSize||So._defaultFontSize,this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static initialize(e,r){Hr.initialize(e,r);const n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,r){switch(e){case ta.FREETEXT_SIZE:So._defaultFontSize=r;break;case ta.FREETEXT_COLOR:So._defaultColor=r;break}}updateParams(e,r){switch(e){case ta.FREETEXT_SIZE:this.#s(r);break;case ta.FREETEXT_COLOR:this.#a(r);break}}static get defaultPropertiesToUpdate(){return[[ta.FREETEXT_SIZE,So._defaultFontSize],[ta.FREETEXT_COLOR,So._defaultColor||Hr._defaultLineColor]]}get propertiesToUpdate(){return[[ta.FREETEXT_SIZE,this.#r],[ta.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||=new VN(this),[["colorPicker",this._colorPicker]]}get colorType(){return ta.FREETEXT_COLOR}#s(e){const r=a=>{this.editorDiv.style.fontSize=`calc(${a}px * var(--total-scale-factor))`,this.translate(0,-(a-this.#r)*this.parentScale),this.#r=a,this.#o()},n=this.#r;this.addCommands({cmd:r.bind(this,e),undo:r.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ta.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}#a(e){const r=a=>{this.color=a,this.onUpdatedColor()},n=this.color;this.addCommands({cmd:r.bind(this,e),undo:r.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ta.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,r){this._uiManager.translateSelectedEditors(e,r,!0)}getInitialTranslation(){const e=this.parentScale;return[-So._internalPadding*e,-(So._internalPadding+this.#r)*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.#n=new AbortController;const e=this._uiManager.combinedSignal(this.#n);return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e}),!0}disableEditMode(){return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#t),this._isDraggable=!0,this.#n?.abort(),this.#n=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}#i(){const e=[];this.editorDiv.normalize();let r=null;for(const n of this.editorDiv.childNodes)r?.nodeType===Node.TEXT_NODE&&n.nodeName==="BR"||(e.push(So.#c(n)),r=n);return e.join(`