@lateralus-ai/shipping-ui 1.1.2 → 1.2.0

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.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),S=require("@material-tailwind/react"),Hr=require("react-textarea-autosize"),ee=require("@iconify/react"),Dr={fontFamily:{sans:["Work Sans","sans-serif"],mono:["Roboto Mono","monospace"],signature:["Alex Brush","Lucida Handwriting","cursive"]},fontSize:{subheader:["18px",{lineHeight:"28px",letterSpacing:"-0.01em"}],"subheader-em":["18px",{lineHeight:"28px",letterSpacing:"-0.01em",fontWeight:"500"}],body:["16px",{lineHeight:"28px",letterSpacing:"-0.01em"}],"body-em":["16px",{lineHeight:"28px",letterSpacing:"-0.01em",fontWeight:"500"}],"caption-1":["16px",{lineHeight:"22px"}],"caption-1-em":["16px",{lineHeight:"22px",fontWeight:"500"}],"caption-2":["14px",{lineHeight:"20px"}],"caption-2-em":["14px",{lineHeight:"20px",fontWeight:"500"}],footnote:["13px",{lineHeight:"17px"}],"footnote-em":["13px",{lineHeight:"17px",fontWeight:"500"}]},width:{authPageWidth:"370px"},keyframes:{"accordion-down":{from:{height:0},to:{height:"var(--radix-accordion-content-height)"}},"accordion-up":{from:{height:"var(--radix-accordion-content-height)"},to:{height:0}}},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"},colors:{gray:{50:"#fafafa",100:"#f0f0f0",200:"#d6d6d6",300:"#bdbdbd",400:"#a3a3a3",500:"#8a8a8a",600:"#6e6e6e",700:"#525252",800:"#363636",900:"#1a1a1a"},green:{50:"#e0fff2",100:"#adf0d3",200:"#8aeac1",300:"#67e4ae",400:"#45de9c",500:"#26d489",600:"#1da56a",700:"#15754c",800:"#0c452d",900:"#04160e"},blue:{50:"#cae8f7",100:"#b8e0f4",200:"#95d1ef",300:"#71c1ea",400:"#4eb2e4",500:"#2aa2df",600:"#1b82b6",700:"#145f85",800:"#0d3c54",900:"#051923"},red:{50:"#f9dcdc",100:"#f6cbcb",200:"#f0a8a8",300:"#ea8686",400:"#e36363",500:"#dd4040",600:"#c32222",700:"#931a1a",800:"#641212",900:"#340909"},orange:{50:"#fff7eb",100:"#f8e0bf",200:"#f4cf9a",300:"#f0bd75",400:"#ecab51",500:"#e89a2c",600:"#C77C0A",700:"#935d10",800:"#603d0b",900:"#2e1d05"},"brand-purple":"#ab68ff",presentation:"var(--presentation)","text-primary":"var(--text-primary)","text-secondary":"var(--text-secondary)","text-secondary-alt":"var(--text-secondary-alt)","text-tertiary":"var(--text-tertiary)","ring-primary":"var(--ring-primary)","header-primary":"var(--header-primary)","header-hover":"var(--header-hover)","header-button-hover":"var(--header-button-hover)","surface-active":"var(--surface-active)","surface-active-alt":"var(--surface-active-alt)","surface-hover":"var(--surface-hover)","surface-primary":"var(--surface-primary)","surface-primary-alt":"var(--surface-primary-alt)","surface-primary-contrast":"var(--surface-primary-contrast)","surface-secondary":"var(--surface-secondary)","surface-secondary-alt":"var(--surface-secondary-alt)","surface-tertiary":"var(--surface-tertiary)","surface-tertiary-alt":"var(--surface-tertiary-alt)","surface-dialog":"var(--surface-dialog)","surface-submit":"var(--surface-submit)","border-light":"var(--border-light)","border-medium":"var(--border-medium)","border-medium-alt":"var(--border-medium-alt)","border-heavy":"var(--border-heavy)","border-xheavy":"var(--border-xheavy)",border:"hsl(var(--border))",input:"hsl(var(--input))","switch-unchecked":"hsl(var(--switch-unchecked))",ring:"hsl(var(--ring))",background:"hsl(var(--background))",foreground:"hsl(var(--foreground))",primary:{DEFAULT:"hsl(var(--primary))",foreground:"hsl(var(--primary-foreground))"},secondary:{DEFAULT:"hsl(var(--secondary))",foreground:"hsl(var(--secondary-foreground))"},destructive:{DEFAULT:"hsl(var(--destructive))",foreground:"hsl(var(--destructive-foreground))"},muted:{DEFAULT:"hsl(var(--muted))",foreground:"hsl(var(--muted-foreground))"},accent:{DEFAULT:"hsl(var(--accent))",foreground:"hsl(var(--accent-foreground))"},card:{DEFAULT:"hsl(var(--card))",foreground:"hsl(var(--card-foreground))"}},borderRadius:{lg:"8px",md:"calc(8px - 2px)",sm:"calc(8px - 4px)"}},Fr={button:{defaultProps:{className:"items-center normal-case shadow-none hover:shadow-none text-caption-1 font-medium h-10 rounded-lg flex gap-2 px-3 truncate tracking-[0.16px] justify-center",ripple:!1,color:"green"},styles:{sizes:{md:{fontSize:"text-md",className:"py-2"}},variants:{filled:{blue:{color:"!text-white",background:"bg-blue-400",hover:"hover:bg-blue-500",disabled:"disabled:bg-blue-200 disabled:!text-blue-600 !opacity-100"},green:{color:"!text-white",background:"bg-green-600",hover:"hover:bg-green-700",disabled:"disabled:bg-green-200 disabled:!text-green-600 !opacity-100"},red:{color:"!text-white",background:"bg-red-600",hover:"hover:bg-red-700",disabled:"disabled:bg-red-200 disabled:!text-red-600 !opacity-100"},gray:{color:"text-black",background:"bg-gray-50",hover:"hover:bg-gray-100",disabled:"disabled:bg-gray-50 disabled:!text-gray-200 !opacity-100"},orange:{color:"!text-orange-600",background:"bg-orange-50",hover:"hover:bg-orange-100",disabled:"disabled:bg-orange-50 disabled:!text-orange-200 !opacity-100"}},outlined:{gray:{background:"bg-white",color:"text-gray-700 border-gray-100",hover:"!text-gray-900 hover:bg-gray-100",disabled:"disabled:text-gray-500"}},text:{green:{color:"!text-green-600",hover:"hover:bg-gray-100",disabled:"disabled:!text-gray-500"},gray:{color:"!text-gray-700",hover:"hover:bg-gray-100",disabled:"disabled:!text-gray-500"}}}}},iconButton:{defaultProps:{className:"items-center justify-center normal-case shadow-none hover:shadow-none text-caption-1 font-medium h-10 rounded-lg flex gap-2 px-3 truncate",ripple:!1,color:"green"},styles:{sizes:{md:{fontSize:"text-md",className:"py-2"}},variants:{filled:{blue:{color:"!text-white",background:"bg-blue-400",hover:"hover:bg-blue-500",disabled:"disabled:bg-blue-200 disabled:!text-blue-600 !opacity-100"},green:{color:"!text-white",background:"bg-green-600",hover:"hover:bg-green-700",disabled:"disabled:bg-green-200 disabled:!text-green-600 !opacity-100"},red:{color:"!text-white",background:"bg-red-600",hover:"hover:bg-red-700",disabled:"disabled:bg-red-200 disabled:!text-red-600 !opacity-100"},gray:{color:"text-black",background:"bg-gray-50",hover:"hover:bg-gray-100",disabled:"disabled:bg-gray-50 disabled:!text-gray-200 !opacity-100"},orange:{color:"!text-orange-600",background:"bg-orange-50",hover:"hover:bg-orange-100",disabled:"disabled:bg-orange-50 disabled:!text-orange-200 !opacity-100"}},outlined:{gray:{background:"bg-white",color:"text-gray-700 border-gray-100",hover:"!text-gray-900 hover:bg-gray-100",disabled:"disabled:text-gray-500"}},text:{green:{color:"!text-green-600",hover:"hover:bg-gray-100",disabled:"disabled:!text-gray-500"},gray:{color:"!text-gray-700",hover:"hover:bg-gray-100",disabled:"disabled:!text-gray-500"}}}}},progress:{defaultProps:{className:"bg-gray-100",barProps:{className:"transform transition-all duration-300"}},styles:{sizes:{sm:{container:{initial:{height:"h-1"}}}}}},menu:{styles:{base:{menu:{border:"border border-gray-100",borderRadius:"rounded-xl",boxShadow:"shadow-sm",p:"p-2"},item:{initial:{display:"flex gap-2 items-center focus-within:outline-none text-gray-900",bg:"hover:bg-gray-100",p:"p-2"}}}}},dialog:{defaultProps:{size:"sm",dismiss:{},animate:{mount:{},unmount:{}},className:""},valid:{sizes:["xs","sm","md","lg","xl","xxl"]},styles:{base:{backdrop:{width:"w-full",display:"grid",placeItems:"place-items-center",position:"fixed",top:0,left:0,height:"h-screen",backgroundColor:"bg-[rgba(0,0,0,0.16)]",backgroundOpacity:"bg-opacity-100",backdropFilter:"backdrop-blur-none"},container:{height:"h-[450px]",position:"relative",bg:"bg-white",m:"m-4",borderRadius:"rounded-xl",boxShadow:"shadow-[0px_2px_8px_0px_#00000029,0px_2px_2px_0px_#0000000A,0px_8px_8px_-8px_#0000000A]",fontSmoothing:"antialiased"}},sizes:{sm:{maxWidth:"!max-w-[550px]"},lg:{maxWidth:"!max-w-[700px]"}}}},dialogHeader:{styles:{base:{display:"text-gray-900 font-normal"}}},checkbox:{defaultProps:{color:"custom",ripple:!1},valid:{colors:["blue-gray","gray","red","green","custom"]},styles:{base:{root:{display:"inline-flex",alignItems:"items-center"},container:{position:"relative",display:"flex",alignItems:"items-center",cursor:"cursor-pointer",p:"!p-0",borderRadius:"rounded-full"},input:{peer:"peer",position:"relative",appearance:"appearance-none",width:"w-5",height:"h-5",borderWidth:"border-[1.5px]",borderRadius:"rounded-md",borderColor:"border-gray-100",cursor:"cursor-pointer",transition:"transition-all",before:{content:"before:content-['']",display:"before:block",bg:"before:bg-transparent",width:"before:w-12",height:"before:h-12",borderRadius:"before:rounded-full",position:"before:absolute",opacity:"before:opacity-0 hover:before:opacity-10"}},label:{color:"text-gray-700",fontWeight:"font-light",userSelect:"select-none",cursor:"cursor-pointer",mt:"mt-px",px:"px-2"},icon:{display:"flex",alignItems:"items-center",justifyContent:"justify-center",width:"w-5",height:"h-5",color:"text-green-600",position:"absolute",pointerEvents:"pointer-events-none",opacity:"opacity-0 peer-checked:opacity-100",transition:"transition-opacity"},disabled:{opacity:"opacity-50",pointerEvents:"pointer-events-none"}},colors:{custom:{border:"checked:border-green-600"}}}},popover:{defaultProps:{placement:"top",offset:5,dismiss:{},animate:{unmount:{},mount:{}},className:""},styles:{base:{bg:"bg-white",p:"p-4",borderWidth:"border",borderColor:"border-gray-200",borderRadius:"rounded-lg",boxShadow:"[box-shadow:0px_2px_2px_0px_#0000000A,_0px_8px_8px_-8px_#0000000A]",fontSize:"text-sm",fontWeight:"font-normal",color:"text-blue-gray-500",outline:"focus:outline-none",overflowWrap:"break-words",whiteSpace:"whitespace-normal"}}},switch:{defaultProps:{color:"blue",label:"",ripple:!0,className:"",disabled:!1,containerProps:void 0,labelProps:void 0,circleProps:void 0},valid:{colors:["blue-gray","gray","brown","deep-orange","orange","amber","yellow","lime","light-green","green","teal","cyan","light-blue","blue","indigo","deep-purple","purple","pink","red"]},styles:{base:{input:{background:"bg-gray-500"},circle:{borderColor:"border-gray-500",borderRadius:"rounded-full",boxShadow:"shadow-md",position:"absolute",top:"top-2/4",left:"-left-1",transform:"-translate-y-2/4 peer-checked:translate-x-full",transition:"transition-all duration-300",cursor:"cursor-pointer",before:{content:"before:content['']",display:"before:block",bg:"before:bg-blue-gray-500",width:"before:w-10",height:"before:h-10",borderRadius:"before:rounded-full",position:"before:absolute",top:"before:top-2/4",left:"before:left-2/4",transform:"before:-translate-y-2/4 before:-translate-x-2/4",transition:"before:transition-opacity",opacity:"before:opacity-0 hover:before:opacity-10"}},ripple:{display:"inline-block",top:"top-2/4",left:"left-2/4",transform:"-translate-x-2/4 -translate-y-2/4",p:"p-5",borderRadius:"rounded-full"},label:{color:"text-gray-700",fontWeight:"font-light",userSelect:"select-none",cursor:"cursor-pointer",mt:"mt-px",ml:"ml-3",mb:"mb-0"},disabled:{opacity:"opacity-50",pointerEvents:"pointer-events-none"}},colors:{gray:{input:"checked:bg-blue-gray-100",circle:"peer-checked:border-blue-gray-100",before:"peer-checked:before:bg-gray-500"},green:{input:"checked:bg-green-600",circle:"peer-checked:border-green-600",before:"peer-checked:before:bg-green-600"}}}}};var Ie={exports:{}},ie={};/**
1
+ "use strict";var Db=Object.defineProperty;var Xf=c=>{throw TypeError(c)};var Nb=(c,t,e)=>t in c?Db(c,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[t]=e;var L=(c,t,e)=>Nb(c,typeof t!="symbol"?t+"":t,e),Vd=(c,t,e)=>t.has(c)||Xf("Cannot "+e);var r=(c,t,e)=>(Vd(c,t,"read from private field"),e?e.call(c):t.get(c)),m=(c,t,e)=>t.has(c)?Xf("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(c):t.set(c,e),p=(c,t,e,s)=>(Vd(c,t,"write to private field"),s?s.call(c,e):t.set(c,e),e),b=(c,t,e)=>(Vd(c,t,"access private method"),e);var Me=(c,t,e,s)=>({set _(i){p(c,t,i,e)},get _(){return r(c,t,s)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react"),lt=require("@material-tailwind/react"),Fb=require("react-textarea-autosize"),_s=require("@iconify/react");var Ud=typeof document<"u"?document.currentScript:null;const Ob={fontFamily:{sans:["Work Sans","sans-serif"],mono:["Roboto Mono","monospace"],signature:["Alex Brush","Lucida Handwriting","cursive"]},fontSize:{subheader:["18px",{lineHeight:"28px",letterSpacing:"-0.01em"}],"subheader-em":["18px",{lineHeight:"28px",letterSpacing:"-0.01em",fontWeight:"500"}],body:["16px",{lineHeight:"28px",letterSpacing:"-0.01em"}],"body-em":["16px",{lineHeight:"28px",letterSpacing:"-0.01em",fontWeight:"500"}],"caption-1":["16px",{lineHeight:"22px"}],"caption-1-em":["16px",{lineHeight:"22px",fontWeight:"500"}],"caption-2":["14px",{lineHeight:"20px"}],"caption-2-em":["14px",{lineHeight:"20px",fontWeight:"500"}],footnote:["13px",{lineHeight:"17px"}],"footnote-em":["13px",{lineHeight:"17px",fontWeight:"500"}]},width:{authPageWidth:"370px"},keyframes:{"accordion-down":{from:{height:0},to:{height:"var(--radix-accordion-content-height)"}},"accordion-up":{from:{height:"var(--radix-accordion-content-height)"},to:{height:0}}},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"},colors:{brand:{50:"#e0fff2",100:"#adf0d3",200:"#8aeac1",300:"#67e4ae",400:"#45de9c",500:"#26d489",600:"#1da56a",700:"#15754c",800:"#0c452d",900:"#04160e"},gray:{50:"#fafafa",100:"#f0f0f0",200:"#d6d6d6",300:"#bdbdbd",400:"#a3a3a3",500:"#8a8a8a",600:"#6e6e6e",700:"#525252",800:"#363636",900:"#1a1a1a"},green:{50:"#e0fff2",100:"#adf0d3",200:"#8aeac1",300:"#67e4ae",400:"#45de9c",500:"#26d489",600:"#1da56a",700:"#15754c",800:"#0c452d",900:"#04160e"},blue:{50:"#cae8f7",100:"#b8e0f4",200:"#95d1ef",300:"#71c1ea",400:"#4eb2e4",500:"#2aa2df",600:"#1b82b6",700:"#145f85",800:"#0d3c54",900:"#051923"},red:{50:"#f9dcdc",100:"#f6cbcb",200:"#f0a8a8",300:"#ea8686",400:"#e36363",500:"#dd4040",600:"#c32222",700:"#931a1a",800:"#641212",900:"#340909"},orange:{50:"#fff7eb",100:"#f8e0bf",200:"#f4cf9a",300:"#f0bd75",400:"#ecab51",500:"#e89a2c",600:"#C77C0A",700:"#935d10",800:"#603d0b",900:"#2e1d05"},"brand-purple":"#ab68ff",presentation:"var(--presentation)","text-primary":"var(--text-primary)","text-secondary":"var(--text-secondary)","text-secondary-alt":"var(--text-secondary-alt)","text-tertiary":"var(--text-tertiary)","ring-primary":"var(--ring-primary)","header-primary":"var(--header-primary)","header-hover":"var(--header-hover)","header-button-hover":"var(--header-button-hover)","surface-active":"var(--surface-active)","surface-active-alt":"var(--surface-active-alt)","surface-hover":"var(--surface-hover)","surface-primary":"var(--surface-primary)","surface-primary-alt":"var(--surface-primary-alt)","surface-primary-contrast":"var(--surface-primary-contrast)","surface-secondary":"var(--surface-secondary)","surface-secondary-alt":"var(--surface-secondary-alt)","surface-tertiary":"var(--surface-tertiary)","surface-tertiary-alt":"var(--surface-tertiary-alt)","surface-dialog":"var(--surface-dialog)","surface-submit":"var(--surface-submit)","border-light":"var(--border-light)","border-medium":"var(--border-medium)","border-medium-alt":"var(--border-medium-alt)","border-heavy":"var(--border-heavy)","border-xheavy":"var(--border-xheavy)",border:"hsl(var(--border))",input:"hsl(var(--input))","switch-unchecked":"hsl(var(--switch-unchecked))",ring:"hsl(var(--ring))",background:"hsl(var(--background))",foreground:"hsl(var(--foreground))",primary:{DEFAULT:"hsl(var(--primary))",foreground:"hsl(var(--primary-foreground))"},secondary:{DEFAULT:"hsl(var(--secondary))",foreground:"hsl(var(--secondary-foreground))"},destructive:{DEFAULT:"hsl(var(--destructive))",foreground:"hsl(var(--destructive-foreground))"},muted:{DEFAULT:"hsl(var(--muted))",foreground:"hsl(var(--muted-foreground))"},accent:{DEFAULT:"hsl(var(--accent))",foreground:"hsl(var(--accent-foreground))"},card:{DEFAULT:"hsl(var(--card))",foreground:"hsl(var(--card-foreground))"}},borderRadius:{lg:"8px",md:"calc(8px - 2px)",sm:"calc(8px - 4px)"}},Bb={button:{defaultProps:{className:"items-center normal-case shadow-none hover:shadow-none text-caption-1 font-medium h-10 rounded-lg flex gap-2 px-3 truncate tracking-[0.16px] justify-center",ripple:!1,color:"green"},styles:{sizes:{md:{fontSize:"text-md",className:"py-2"}},variants:{filled:{blue:{color:"!text-white",background:"bg-blue-400",hover:"hover:bg-blue-500",disabled:"disabled:bg-blue-200 disabled:!text-blue-600 !opacity-100"},green:{color:"!text-white",background:"bg-green-600",hover:"hover:bg-green-700",disabled:"disabled:bg-green-200 disabled:!text-green-600 !opacity-100"},red:{color:"!text-white",background:"bg-red-600",hover:"hover:bg-red-700",disabled:"disabled:bg-red-200 disabled:!text-red-600 !opacity-100"},gray:{color:"text-black",background:"bg-gray-50",hover:"hover:bg-gray-100",disabled:"disabled:bg-gray-50 disabled:!text-gray-200 !opacity-100"},orange:{color:"!text-orange-600",background:"bg-orange-50",hover:"hover:bg-orange-100",disabled:"disabled:bg-orange-50 disabled:!text-orange-200 !opacity-100"}},outlined:{gray:{background:"bg-white",color:"text-gray-700 border-gray-100",hover:"!text-gray-900 hover:bg-gray-100",disabled:"disabled:text-gray-500"}},text:{green:{color:"!text-green-600",hover:"hover:bg-gray-100",disabled:"disabled:!text-gray-500"},gray:{color:"!text-gray-700",hover:"hover:bg-gray-100",disabled:"disabled:!text-gray-500"}}}}},iconButton:{defaultProps:{className:"items-center justify-center normal-case shadow-none hover:shadow-none text-caption-1 font-medium h-10 rounded-lg flex gap-2 px-3 truncate",ripple:!1,color:"green"},styles:{sizes:{md:{fontSize:"text-md",className:"py-2"}},variants:{filled:{blue:{color:"!text-white",background:"bg-blue-400",hover:"hover:bg-blue-500",disabled:"disabled:bg-blue-200 disabled:!text-blue-600 !opacity-100"},green:{color:"!text-white",background:"bg-green-600",hover:"hover:bg-green-700",disabled:"disabled:bg-green-200 disabled:!text-green-600 !opacity-100"},red:{color:"!text-white",background:"bg-red-600",hover:"hover:bg-red-700",disabled:"disabled:bg-red-200 disabled:!text-red-600 !opacity-100"},gray:{color:"text-black",background:"bg-gray-50",hover:"hover:bg-gray-100",disabled:"disabled:bg-gray-50 disabled:!text-gray-200 !opacity-100"},orange:{color:"!text-orange-600",background:"bg-orange-50",hover:"hover:bg-orange-100",disabled:"disabled:bg-orange-50 disabled:!text-orange-200 !opacity-100"}},outlined:{gray:{background:"bg-white",color:"text-gray-700 border-gray-100",hover:"!text-gray-900 hover:bg-gray-100",disabled:"disabled:text-gray-500"}},text:{green:{color:"!text-green-600",hover:"hover:bg-gray-100",disabled:"disabled:!text-gray-500"},gray:{color:"!text-gray-700",hover:"hover:bg-gray-100",disabled:"disabled:!text-gray-500"}}}}},progress:{defaultProps:{className:"bg-gray-100",barProps:{className:"transform transition-all duration-300"}},styles:{sizes:{sm:{container:{initial:{height:"h-1"}}}}}},menu:{styles:{base:{menu:{border:"border border-gray-100",borderRadius:"rounded-xl",boxShadow:"shadow-sm",p:"p-2"},item:{initial:{display:"flex gap-2 items-center focus-within:outline-none text-gray-900",bg:"hover:bg-gray-100",p:"p-2"}}}}},dialog:{defaultProps:{size:"sm",dismiss:{},animate:{mount:{},unmount:{}},className:""},valid:{sizes:["xs","sm","md","lg","xl","xxl"]},styles:{base:{backdrop:{width:"w-full",display:"grid",placeItems:"place-items-center",position:"fixed",top:0,left:0,height:"h-screen",backgroundColor:"bg-[rgba(0,0,0,0.16)]",backgroundOpacity:"bg-opacity-100",backdropFilter:"backdrop-blur-none"},container:{height:"h-[450px]",position:"relative",bg:"bg-white",m:"m-4",borderRadius:"rounded-xl",boxShadow:"shadow-[0px_2px_8px_0px_#00000029,0px_2px_2px_0px_#0000000A,0px_8px_8px_-8px_#0000000A]",fontSmoothing:"antialiased"}},sizes:{sm:{maxWidth:"!max-w-[550px]"},lg:{maxWidth:"!max-w-[700px]"}}}},dialogHeader:{styles:{base:{display:"text-gray-900 font-normal"}}},checkbox:{defaultProps:{color:"custom",ripple:!1},valid:{colors:["blue-gray","gray","red","green","custom"]},styles:{base:{root:{display:"inline-flex",alignItems:"items-center"},container:{position:"relative",display:"flex",alignItems:"items-center",cursor:"cursor-pointer",p:"!p-0",borderRadius:"rounded-full"},input:{peer:"peer",position:"relative",appearance:"appearance-none",width:"w-5",height:"h-5",borderWidth:"border-[1.5px]",borderRadius:"rounded-md",borderColor:"border-gray-100",cursor:"cursor-pointer",transition:"transition-all",before:{content:"before:content-['']",display:"before:block",bg:"before:bg-transparent",width:"before:w-12",height:"before:h-12",borderRadius:"before:rounded-full",position:"before:absolute",opacity:"before:opacity-0 hover:before:opacity-10"}},label:{color:"text-gray-700",fontWeight:"font-light",userSelect:"select-none",cursor:"cursor-pointer",mt:"mt-px",px:"px-2"},icon:{display:"flex",alignItems:"items-center",justifyContent:"justify-center",width:"w-5",height:"h-5",color:"text-green-600",position:"absolute",pointerEvents:"pointer-events-none",opacity:"opacity-0 peer-checked:opacity-100",transition:"transition-opacity"},disabled:{opacity:"opacity-50",pointerEvents:"pointer-events-none"}},colors:{custom:{border:"checked:border-green-600"}}}},popover:{defaultProps:{placement:"top",offset:5,dismiss:{},animate:{unmount:{},mount:{}},className:""},styles:{base:{bg:"bg-white",p:"p-4",borderWidth:"border",borderColor:"border-gray-200",borderRadius:"rounded-lg",boxShadow:"[box-shadow:0px_2px_2px_0px_#0000000A,_0px_8px_8px_-8px_#0000000A]",fontSize:"text-sm",fontWeight:"font-normal",color:"text-blue-gray-500",outline:"focus:outline-none",overflowWrap:"break-words",whiteSpace:"whitespace-normal"}}},switch:{defaultProps:{color:"blue",label:"",ripple:!0,className:"",disabled:!1,containerProps:void 0,labelProps:void 0,circleProps:void 0},valid:{colors:["blue-gray","gray","brown","deep-orange","orange","amber","yellow","lime","light-green","green","teal","cyan","light-blue","blue","indigo","deep-purple","purple","pink","red"]},styles:{base:{input:{background:"bg-gray-500"},circle:{borderColor:"border-gray-500",borderRadius:"rounded-full",boxShadow:"shadow-md",position:"absolute",top:"top-2/4",left:"-left-1",transform:"-translate-y-2/4 peer-checked:translate-x-full",transition:"transition-all duration-300",cursor:"cursor-pointer",before:{content:"before:content['']",display:"before:block",bg:"before:bg-blue-gray-500",width:"before:w-10",height:"before:h-10",borderRadius:"before:rounded-full",position:"before:absolute",top:"before:top-2/4",left:"before:left-2/4",transform:"before:-translate-y-2/4 before:-translate-x-2/4",transition:"before:transition-opacity",opacity:"before:opacity-0 hover:before:opacity-10"}},ripple:{display:"inline-block",top:"top-2/4",left:"left-2/4",transform:"-translate-x-2/4 -translate-y-2/4",p:"p-5",borderRadius:"rounded-full"},label:{color:"text-gray-700",fontWeight:"font-light",userSelect:"select-none",cursor:"cursor-pointer",mt:"mt-px",ml:"ml-3",mb:"mb-0"},disabled:{opacity:"opacity-50",pointerEvents:"pointer-events-none"}},colors:{gray:{input:"checked:bg-blue-gray-100",circle:"peer-checked:border-blue-gray-100",before:"peer-checked:before:bg-gray-500"},green:{input:"checked:bg-green-600",circle:"peer-checked:border-green-600",before:"peer-checked:before:bg-green-600"}}}},tabsHeader:{defaultProps:{className:"grow gap-6 rounded-none bg-transparent !p-0 border-b border-b-gray-100 flex items-end px-0 w-full mb-6"}},tab:{defaultProps:{className:"min-w-fit max-w-fit justify-start font-medium text-gray-600 pl-0 pr-2 h-12"},styles:{base:{indicator:{bg:"bg-transparent border-b-2 border-gray-900 !transform-none",borderRadius:"radius-none",boxShadow:"shadow-none"}}}},tabPanel:{styles:{base:{p:"px-0"}}}};function jb(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var su={exports:{}},Ko={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Ke;function Gr(){if(Ke)return ie;Ke=1;var r=_,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function u(d,f,v){var g,x={},j=null,I=null;v!==void 0&&(j=""+v),f.key!==void 0&&(j=""+f.key),f.ref!==void 0&&(I=f.ref);for(g in f)o.call(f,g)&&!l.hasOwnProperty(g)&&(x[g]=f[g]);if(d&&d.defaultProps)for(g in f=d.defaultProps,f)x[g]===void 0&&(x[g]=f[g]);return{$$typeof:t,type:d,key:j,ref:I,props:x,_owner:i.current}}return ie.Fragment=n,ie.jsx=u,ie.jsxs=u,ie}var se={};/**
9
+ */var Yf;function Hb(){if(Yf)return Ko;Yf=1;var c=B,t=Symbol.for("react.element"),e=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n={key:!0,ref:!0,__self:!0,__source:!0};function a(o,l,h){var d,u={},f=null,g=null;h!==void 0&&(f=""+h),l.key!==void 0&&(f=""+l.key),l.ref!==void 0&&(g=l.ref);for(d in l)s.call(l,d)&&!n.hasOwnProperty(d)&&(u[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)u[d]===void 0&&(u[d]=l[d]);return{$$typeof:t,type:o,key:f,ref:g,props:u,_owner:i.current}}return Ko.Fragment=e,Ko.jsx=a,Ko.jsxs=a,Ko}var Jo={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,17 +14,28 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Xe;function Br(){return Xe||(Xe=1,process.env.NODE_ENV!=="production"&&function(){var r=_,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),I=Symbol.for("react.offscreen"),P=Symbol.iterator,N="@@iterator";function H(e){if(e===null||typeof e!="object")return null;var a=P&&e[P]||e[N];return typeof a=="function"?a:null}var A=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(e){{for(var a=arguments.length,c=new Array(a>1?a-1:0),p=1;p<a;p++)c[p-1]=arguments[p];te("error",e,c)}}function te(e,a,c){{var p=A.ReactDebugCurrentFrame,m=p.getStackAddendum();m!==""&&(a+="%s",c=c.concat([m]));var y=c.map(function(h){return String(h)});y.unshift("Warning: "+a),Function.prototype.apply.call(console[e],console,y)}}var fe=!1,pe=!1,ge=!1,be=!1,oe=!1,J;J=Symbol.for("react.module.reference");function ve(e){return!!(typeof e=="string"||typeof e=="function"||e===o||e===l||oe||e===i||e===v||e===g||be||e===I||fe||pe||ge||typeof e=="object"&&e!==null&&(e.$$typeof===j||e.$$typeof===x||e.$$typeof===u||e.$$typeof===d||e.$$typeof===f||e.$$typeof===J||e.getModuleId!==void 0))}function he(e,a,c){var p=e.displayName;if(p)return p;var m=a.displayName||a.name||"";return m!==""?c+"("+m+")":c}function $(e){return e.displayName||"Context"}function V(e){if(e==null)return null;if(typeof e.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case o:return"Fragment";case n:return"Portal";case l:return"Profiler";case i:return"StrictMode";case v:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case d:var a=e;return $(a)+".Consumer";case u:var c=e;return $(c._context)+".Provider";case f:return he(e,e.render,"ForwardRef");case x:var p=e.displayName||null;return p!==null?p:V(e.type)||"Memo";case j:{var m=e,y=m._payload,h=m._init;try{return V(h(y))}catch{return null}}}return null}var z=Object.assign,D=0,K,F,ne,G,U,T,Oe;function Ne(){}Ne.__reactDisabledLog=!0;function pr(){{if(D===0){K=console.log,F=console.info,ne=console.warn,G=console.error,U=console.group,T=console.groupCollapsed,Oe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ne,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}D++}}function gr(){{if(D--,D===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},e,{value:K}),info:z({},e,{value:F}),warn:z({},e,{value:ne}),error:z({},e,{value:G}),group:z({},e,{value:U}),groupCollapsed:z({},e,{value:T}),groupEnd:z({},e,{value:Oe})})}D<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ce=A.ReactCurrentDispatcher,je;function me(e,a,c){{if(je===void 0)try{throw Error()}catch(m){var p=m.stack.trim().match(/\n( *(at )?)/);je=p&&p[1]||""}return`
18
- `+je+e}}var ke=!1,xe;{var br=typeof WeakMap=="function"?WeakMap:Map;xe=new br}function ze(e,a){if(!e||ke)return"";{var c=xe.get(e);if(c!==void 0)return c}var p;ke=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var y;y=Ce.current,Ce.current=null,pr();try{if(a){var h=function(){throw Error()};if(Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(O){p=O}Reflect.construct(e,[],h)}else{try{h.call()}catch(O){p=O}e.call(h.prototype)}}else{try{throw Error()}catch(O){p=O}e()}}catch(O){if(O&&p&&typeof O.stack=="string"){for(var b=O.stack.split(`
19
- `),M=p.stack.split(`
20
- `),C=b.length-1,k=M.length-1;C>=1&&k>=0&&b[C]!==M[k];)k--;for(;C>=1&&k>=0;C--,k--)if(b[C]!==M[k]){if(C!==1||k!==1)do if(C--,k--,k<0||b[C]!==M[k]){var L=`
21
- `+b[C].replace(" at new "," at ");return e.displayName&&L.includes("<anonymous>")&&(L=L.replace("<anonymous>",e.displayName)),typeof e=="function"&&xe.set(e,L),L}while(C>=1&&k>=0);break}}}finally{ke=!1,Ce.current=y,gr(),Error.prepareStackTrace=m}var Q=e?e.displayName||e.name:"",Y=Q?me(Q):"";return typeof e=="function"&&xe.set(e,Y),Y}function vr(e,a,c){return ze(e,!1)}function hr(e){var a=e.prototype;return!!(a&&a.isReactComponent)}function ye(e,a,c){if(e==null)return"";if(typeof e=="function")return ze(e,hr(e));if(typeof e=="string")return me(e);switch(e){case v:return me("Suspense");case g:return me("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case f:return vr(e.render);case x:return ye(e.type,a,c);case j:{var p=e,m=p._payload,y=p._init;try{return ye(y(m),a,c)}catch{}}}return""}var ae=Object.prototype.hasOwnProperty,Le={},Ve=A.ReactDebugCurrentFrame;function we(e){if(e){var a=e._owner,c=ye(e.type,e._source,a?a.type:null);Ve.setExtraStackFrame(c)}else Ve.setExtraStackFrame(null)}function mr(e,a,c,p,m){{var y=Function.call.bind(ae);for(var h in e)if(y(e,h)){var b=void 0;try{if(typeof e[h]!="function"){var M=Error((p||"React class")+": "+c+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw M.name="Invariant Violation",M}b=e[h](a,h,p,c,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(C){b=C}b&&!(b instanceof Error)&&(we(m),E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",p||"React class",c,h,typeof b),we(null)),b instanceof Error&&!(b.message in Le)&&(Le[b.message]=!0,we(m),E("Failed %s type: %s",c,b.message),we(null))}}}var xr=Array.isArray;function Re(e){return xr(e)}function yr(e){{var a=typeof Symbol=="function"&&Symbol.toStringTag,c=a&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c}}function wr(e){try{return We(e),!1}catch{return!0}}function We(e){return""+e}function He(e){if(wr(e))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",yr(e)),We(e)}var De=A.ReactCurrentOwner,Cr={key:!0,ref:!0,__self:!0,__source:!0},Fe,Ge;function jr(e){if(ae.call(e,"ref")){var a=Object.getOwnPropertyDescriptor(e,"ref").get;if(a&&a.isReactWarning)return!1}return e.ref!==void 0}function kr(e){if(ae.call(e,"key")){var a=Object.getOwnPropertyDescriptor(e,"key").get;if(a&&a.isReactWarning)return!1}return e.key!==void 0}function Rr(e,a){typeof e.ref=="string"&&De.current}function _r(e,a){{var c=function(){Fe||(Fe=!0,E("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",a))};c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}}function Er(e,a){{var c=function(){Ge||(Ge=!0,E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",a))};c.isReactWarning=!0,Object.defineProperty(e,"ref",{get:c,configurable:!0})}}var Sr=function(e,a,c,p,m,y,h){var b={$$typeof:t,type:e,key:a,ref:c,props:h,_owner:y};return b._store={},Object.defineProperty(b._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(b,"_self",{configurable:!1,enumerable:!1,writable:!1,value:p}),Object.defineProperty(b,"_source",{configurable:!1,enumerable:!1,writable:!1,value:m}),Object.freeze&&(Object.freeze(b.props),Object.freeze(b)),b};function Tr(e,a,c,p,m){{var y,h={},b=null,M=null;c!==void 0&&(He(c),b=""+c),kr(a)&&(He(a.key),b=""+a.key),jr(a)&&(M=a.ref,Rr(a,m));for(y in a)ae.call(a,y)&&!Cr.hasOwnProperty(y)&&(h[y]=a[y]);if(e&&e.defaultProps){var C=e.defaultProps;for(y in C)h[y]===void 0&&(h[y]=C[y])}if(b||M){var k=typeof e=="function"?e.displayName||e.name||"Unknown":e;b&&_r(h,k),M&&Er(h,k)}return Sr(e,b,M,m,p,De.current,h)}}var _e=A.ReactCurrentOwner,Be=A.ReactDebugCurrentFrame;function X(e){if(e){var a=e._owner,c=ye(e.type,e._source,a?a.type:null);Be.setExtraStackFrame(c)}else Be.setExtraStackFrame(null)}var Ee;Ee=!1;function Se(e){return typeof e=="object"&&e!==null&&e.$$typeof===t}function $e(){{if(_e.current){var e=V(_e.current.type);if(e)return`
17
+ */var Kf;function $b(){return Kf||(Kf=1,process.env.NODE_ENV!=="production"&&function(){var c=B,t=Symbol.for("react.element"),e=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),u=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),y=Symbol.iterator,v="@@iterator";function w(E){if(E===null||typeof E!="object")return null;var M=y&&E[y]||E[v];return typeof M=="function"?M:null}var A=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(E){{for(var M=arguments.length,$=new Array(M>1?M-1:0),K=1;K<M;K++)$[K-1]=arguments[K];_("error",E,$)}}function _(E,M,$){{var K=A.ReactDebugCurrentFrame,pt=K.getStackAddendum();pt!==""&&(M+="%s",$=$.concat([pt]));var St=$.map(function(at){return String(at)});St.unshift("Warning: "+M),Function.prototype.apply.call(console[E],console,St)}}var S=!1,C=!1,R=!1,T=!1,k=!1,I;I=Symbol.for("react.module.reference");function D(E){return!!(typeof E=="string"||typeof E=="function"||E===s||E===n||k||E===i||E===h||E===d||T||E===g||S||C||R||typeof E=="object"&&E!==null&&(E.$$typeof===f||E.$$typeof===u||E.$$typeof===a||E.$$typeof===o||E.$$typeof===l||E.$$typeof===I||E.getModuleId!==void 0))}function N(E,M,$){var K=E.displayName;if(K)return K;var pt=M.displayName||M.name||"";return pt!==""?$+"("+pt+")":$}function Y(E){return E.displayName||"Context"}function q(E){if(E==null)return null;if(typeof E.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof E=="function")return E.displayName||E.name||null;if(typeof E=="string")return E;switch(E){case s:return"Fragment";case e:return"Portal";case n:return"Profiler";case i:return"StrictMode";case h:return"Suspense";case d:return"SuspenseList"}if(typeof E=="object")switch(E.$$typeof){case o:var M=E;return Y(M)+".Consumer";case a:var $=E;return Y($._context)+".Provider";case l:return N(E,E.render,"ForwardRef");case u:var K=E.displayName||null;return K!==null?K:q(E.type)||"Memo";case f:{var pt=E,St=pt._payload,at=pt._init;try{return q(at(St))}catch{return null}}}return null}var H=Object.assign,st=0,F,O,yt,Tt,zt,mt,_t;function ft(){}ft.__reactDisabledLog=!0;function we(){{if(st===0){F=console.log,O=console.info,yt=console.warn,Tt=console.error,zt=console.group,mt=console.groupCollapsed,_t=console.groupEnd;var E={configurable:!0,enumerable:!0,value:ft,writable:!0};Object.defineProperties(console,{info:E,log:E,warn:E,error:E,group:E,groupCollapsed:E,groupEnd:E})}st++}}function Ae(){{if(st--,st===0){var E={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:H({},E,{value:F}),info:H({},E,{value:O}),warn:H({},E,{value:yt}),error:H({},E,{value:Tt}),group:H({},E,{value:zt}),groupCollapsed:H({},E,{value:mt}),groupEnd:H({},E,{value:_t})})}st<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=A.ReactCurrentDispatcher,dt;function Pe(E,M,$){{if(dt===void 0)try{throw Error()}catch(pt){var K=pt.stack.trim().match(/\n( *(at )?)/);dt=K&&K[1]||""}return`
18
+ `+dt+E}}var ke=!1,vt;{var Ps=typeof WeakMap=="function"?WeakMap:Map;vt=new Ps}function ps(E,M){if(!E||ke)return"";{var $=vt.get(E);if($!==void 0)return $}var K;ke=!0;var pt=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var St;St=te.current,te.current=null,we();try{if(M){var at=function(){throw Error()};if(Object.defineProperty(at.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(at,[])}catch(ze){K=ze}Reflect.construct(E,[],at)}else{try{at.call()}catch(ze){K=ze}E.call(at.prototype)}}else{try{throw Error()}catch(ze){K=ze}E()}}catch(ze){if(ze&&K&&typeof ze.stack=="string"){for(var nt=ze.stack.split(`
19
+ `),Ie=K.stack.split(`
20
+ `),Gt=nt.length-1,Yt=Ie.length-1;Gt>=1&&Yt>=0&&nt[Gt]!==Ie[Yt];)Yt--;for(;Gt>=1&&Yt>=0;Gt--,Yt--)if(nt[Gt]!==Ie[Yt]){if(Gt!==1||Yt!==1)do if(Gt--,Yt--,Yt<0||nt[Gt]!==Ie[Yt]){var gs=`
21
+ `+nt[Gt].replace(" at new "," at ");return E.displayName&&gs.includes("<anonymous>")&&(gs=gs.replace("<anonymous>",E.displayName)),typeof E=="function"&&vt.set(E,gs),gs}while(Gt>=1&&Yt>=0);break}}}finally{ke=!1,te.current=St,Ae(),Error.prepareStackTrace=pt}var _a=E?E.displayName||E.name:"",Qn=_a?Pe(_a):"";return typeof E=="function"&&vt.set(E,Qn),Qn}function ot(E,M,$){return ps(E,!1)}function Rt(E){var M=E.prototype;return!!(M&&M.isReactComponent)}function It(E,M,$){if(E==null)return"";if(typeof E=="function")return ps(E,Rt(E));if(typeof E=="string")return Pe(E);switch(E){case h:return Pe("Suspense");case d:return Pe("SuspenseList")}if(typeof E=="object")switch(E.$$typeof){case l:return ot(E.render);case u:return It(E.type,M,$);case f:{var K=E,pt=K._payload,St=K._init;try{return It(St(pt),M,$)}catch{}}}return""}var Mt=Object.prototype.hasOwnProperty,yi={},an=A.ReactDebugCurrentFrame;function on(E){if(E){var M=E._owner,$=It(E.type,E._source,M?M.type:null);an.setExtraStackFrame($)}else an.setExtraStackFrame(null)}function Od(E,M,$,K,pt){{var St=Function.call.bind(Mt);for(var at in E)if(St(E,at)){var nt=void 0;try{if(typeof E[at]!="function"){var Ie=Error((K||"React class")+": "+$+" type `"+at+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof E[at]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ie.name="Invariant Violation",Ie}nt=E[at](M,at,K,$,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Gt){nt=Gt}nt&&!(nt instanceof Error)&&(on(pt),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",K||"React class",$,at,typeof nt),on(null)),nt instanceof Error&&!(nt.message in yi)&&(yi[nt.message]=!0,on(pt),x("Failed %s type: %s",$,nt.message),on(null))}}}var Aa=Array.isArray;function Yo(E){return Aa(E)}function Bd(E){{var M=typeof Symbol=="function"&&Symbol.toStringTag,$=M&&E[Symbol.toStringTag]||E.constructor.name||"Object";return $}}function jd(E){try{return ph(E),!1}catch{return!0}}function ph(E){return""+E}function gh(E){if(jd(E))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Bd(E)),ph(E)}var ks=A.ReactCurrentOwner,ln={key:!0,ref:!0,__self:!0,__source:!0},Is,xa;function bb(E){if(Mt.call(E,"ref")){var M=Object.getOwnPropertyDescriptor(E,"ref").get;if(M&&M.isReactWarning)return!1}return E.ref!==void 0}function yb(E){if(Mt.call(E,"key")){var M=Object.getOwnPropertyDescriptor(E,"key").get;if(M&&M.isReactWarning)return!1}return E.key!==void 0}function vb(E,M){typeof E.ref=="string"&&ks.current}function wb(E,M){{var $=function(){Is||(Is=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",M))};$.isReactWarning=!0,Object.defineProperty(E,"key",{get:$,configurable:!0})}}function Ab(E,M){{var $=function(){xa||(xa=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",M))};$.isReactWarning=!0,Object.defineProperty(E,"ref",{get:$,configurable:!0})}}var xb=function(E,M,$,K,pt,St,at){var nt={$$typeof:t,type:E,key:M,ref:$,props:at,_owner:St};return nt._store={},Object.defineProperty(nt._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(nt,"_self",{configurable:!1,enumerable:!1,writable:!1,value:K}),Object.defineProperty(nt,"_source",{configurable:!1,enumerable:!1,writable:!1,value:pt}),Object.freeze&&(Object.freeze(nt.props),Object.freeze(nt)),nt};function Eb(E,M,$,K,pt){{var St,at={},nt=null,Ie=null;$!==void 0&&(gh($),nt=""+$),yb(M)&&(gh(M.key),nt=""+M.key),bb(M)&&(Ie=M.ref,vb(M,pt));for(St in M)Mt.call(M,St)&&!ln.hasOwnProperty(St)&&(at[St]=M[St]);if(E&&E.defaultProps){var Gt=E.defaultProps;for(St in Gt)at[St]===void 0&&(at[St]=Gt[St])}if(nt||Ie){var Yt=typeof E=="function"?E.displayName||E.name||"Unknown":E;nt&&wb(at,Yt),Ie&&Ab(at,Yt)}return xb(E,nt,Ie,pt,K,ks.current,at)}}var Hd=A.ReactCurrentOwner,$f=A.ReactDebugCurrentFrame;function Ea(E){if(E){var M=E._owner,$=It(E.type,E._source,M?M.type:null);$f.setExtraStackFrame($)}else $f.setExtraStackFrame(null)}var $d;$d=!1;function zd(E){return typeof E=="object"&&E!==null&&E.$$typeof===t}function zf(){{if(Hd.current){var E=q(Hd.current.type);if(E)return`
22
22
 
23
- Check the render method of \``+e+"`."}return""}}function Mr(e){return""}var Ue={};function Ir(e){{var a=$e();if(!a){var c=typeof e=="string"?e:e.displayName||e.name;c&&(a=`
23
+ Check the render method of \``+E+"`."}return""}}function _b(E){return""}var Gf={};function Sb(E){{var M=zf();if(!M){var $=typeof E=="string"?E:E.displayName||E.name;$&&(M=`
24
24
 
25
- Check the top-level render call using <`+c+">.")}return a}}function Ye(e,a){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var c=Ir(a);if(Ue[c])return;Ue[c]=!0;var p="";e&&e._owner&&e._owner!==_e.current&&(p=" It was passed a child from "+V(e._owner.type)+"."),X(e),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',c,p),X(null)}}function Ze(e,a){{if(typeof e!="object")return;if(Re(e))for(var c=0;c<e.length;c++){var p=e[c];Se(p)&&Ye(p,a)}else if(Se(e))e._store&&(e._store.validated=!0);else if(e){var m=H(e);if(typeof m=="function"&&m!==e.entries)for(var y=m.call(e),h;!(h=y.next()).done;)Se(h.value)&&Ye(h.value,a)}}}function Pr(e){{var a=e.type;if(a==null||typeof a=="string")return;var c;if(typeof a=="function")c=a.propTypes;else if(typeof a=="object"&&(a.$$typeof===f||a.$$typeof===x))c=a.propTypes;else return;if(c){var p=V(a);mr(c,e.props,"prop",p,e)}else if(a.PropTypes!==void 0&&!Ee){Ee=!0;var m=V(a);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",m||"Unknown")}typeof a.getDefaultProps=="function"&&!a.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ar(e){{for(var a=Object.keys(e.props),c=0;c<a.length;c++){var p=a[c];if(p!=="children"&&p!=="key"){X(e),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",p),X(null);break}}e.ref!==null&&(X(e),E("Invalid attribute `ref` supplied to `React.Fragment`."),X(null))}}var qe={};function Je(e,a,c,p,m,y){{var h=ve(e);if(!h){var b="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(b+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var M=Mr();M?b+=M:b+=$e();var C;e===null?C="null":Re(e)?C="array":e!==void 0&&e.$$typeof===t?(C="<"+(V(e.type)||"Unknown")+" />",b=" Did you accidentally export a JSX literal instead of a component?"):C=typeof e,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",C,b)}var k=Tr(e,a,c,m,y);if(k==null)return k;if(h){var L=a.children;if(L!==void 0)if(p)if(Re(L)){for(var Q=0;Q<L.length;Q++)Ze(L[Q],e);Object.freeze&&Object.freeze(L)}else E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ze(L,e)}if(ae.call(a,"key")){var Y=V(e),O=Object.keys(a).filter(function(Wr){return Wr!=="key"}),Te=O.length>0?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}";if(!qe[Y+Te]){var Vr=O.length>0?"{"+O.join(": ..., ")+": ...}":"{}";E(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+$+">.")}return M}}function Vf(E,M){{if(!E._store||E._store.validated||E.key!=null)return;E._store.validated=!0;var $=Sb(M);if(Gf[$])return;Gf[$]=!0;var K="";E&&E._owner&&E._owner!==Hd.current&&(K=" It was passed a child from "+q(E._owner.type)+"."),Ea(E),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',$,K),Ea(null)}}function Uf(E,M){{if(typeof E!="object")return;if(Yo(E))for(var $=0;$<E.length;$++){var K=E[$];zd(K)&&Vf(K,M)}else if(zd(E))E._store&&(E._store.validated=!0);else if(E){var pt=w(E);if(typeof pt=="function"&&pt!==E.entries)for(var St=pt.call(E),at;!(at=St.next()).done;)zd(at.value)&&Vf(at.value,M)}}}function Cb(E){{var M=E.type;if(M==null||typeof M=="string")return;var $;if(typeof M=="function")$=M.propTypes;else if(typeof M=="object"&&(M.$$typeof===l||M.$$typeof===u))$=M.propTypes;else return;if($){var K=q(M);Od($,E.props,"prop",K,E)}else if(M.PropTypes!==void 0&&!$d){$d=!0;var pt=q(M);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",pt||"Unknown")}typeof M.getDefaultProps=="function"&&!M.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Tb(E){{for(var M=Object.keys(E.props),$=0;$<M.length;$++){var K=M[$];if(K!=="children"&&K!=="key"){Ea(E),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",K),Ea(null);break}}E.ref!==null&&(Ea(E),x("Invalid attribute `ref` supplied to `React.Fragment`."),Ea(null))}}var Wf={};function qf(E,M,$,K,pt,St){{var at=D(E);if(!at){var nt="";(E===void 0||typeof E=="object"&&E!==null&&Object.keys(E).length===0)&&(nt+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ie=_b();Ie?nt+=Ie:nt+=zf();var Gt;E===null?Gt="null":Yo(E)?Gt="array":E!==void 0&&E.$$typeof===t?(Gt="<"+(q(E.type)||"Unknown")+" />",nt=" Did you accidentally export a JSX literal instead of a component?"):Gt=typeof E,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Gt,nt)}var Yt=Eb(E,M,$,pt,St);if(Yt==null)return Yt;if(at){var gs=M.children;if(gs!==void 0)if(K)if(Yo(gs)){for(var _a=0;_a<gs.length;_a++)Uf(gs[_a],E);Object.freeze&&Object.freeze(gs)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Uf(gs,E)}if(Mt.call(M,"key")){var Qn=q(E),ze=Object.keys(M).filter(function(Lb){return Lb!=="key"}),Gd=ze.length>0?"{key: someKey, "+ze.join(": ..., ")+": ...}":"{key: someKey}";if(!Wf[Qn+Gd]){var Mb=ze.length>0?"{"+ze.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
26
26
  let props = %s;
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,Te,Y,Vr,Y),qe[Y+Te]=!0}}return e===o?Ar(k):Pr(k),k}}function Or(e,a,c){return Je(e,a,c,!0)}function Nr(e,a,c){return Je(e,a,c,!1)}var zr=Nr,Lr=Or;se.Fragment=o,se.jsx=zr,se.jsxs=Lr}()),se}process.env.NODE_ENV==="production"?Ie.exports=Gr():Ie.exports=Br();var s=Ie.exports;const $r=()=>s.jsx("div",{className:"bg-red-800 text-white p-2",children:"Hello world"});function Ur(){for(var r=0,t,n,o="";r<arguments.length;)(t=arguments[r++])&&(n=tr(t))&&(o&&(o+=" "),o+=n);return o}function tr(r){if(typeof r=="string")return r;for(var t,n="",o=0;o<r.length;o++)r[o]&&(t=tr(r[o]))&&(n&&(n+=" "),n+=t);return n}var Ae="-";function Yr(r){var t=qr(r);function n(i){var l=i.split(Ae);return l[0]===""&&l.length!==1&&l.shift(),or(l,t)||Zr(i)}function o(i){return r.conflictingClassGroups[i]||[]}return{getClassGroupId:n,getConflictingClassGroupIds:o}}function or(r,t){var u;if(r.length===0)return t.classGroupId;var n=r[0],o=t.nextPart.get(n),i=o?or(r.slice(1),o):void 0;if(i)return i;if(t.validators.length!==0){var l=r.join(Ae);return(u=t.validators.find(function(d){var f=d.validator;return f(l)}))==null?void 0:u.classGroupId}}var Qe=/^\[(.+)\]$/;function Zr(r){if(Qe.test(r)){var t=Qe.exec(r)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function qr(r){var t=r.theme,n=r.prefix,o={nextPart:new Map,validators:[]},i=Kr(Object.entries(r.classGroups),n);return i.forEach(function(l){var u=l[0],d=l[1];Pe(d,o,u,t)}),o}function Pe(r,t,n,o){r.forEach(function(i){if(typeof i=="string"){var l=i===""?t:er(t,i);l.classGroupId=n;return}if(typeof i=="function"){if(Jr(i)){Pe(i(o),t,n,o);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(function(u){var d=u[0],f=u[1];Pe(f,er(t,d),n,o)})})}function er(r,t){var n=r;return t.split(Ae).forEach(function(o){n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n}function Jr(r){return r.isThemeGetter}function Kr(r,t){return t?r.map(function(n){var o=n[0],i=n[1],l=i.map(function(u){return typeof u=="string"?t+u:typeof u=="object"?Object.fromEntries(Object.entries(u).map(function(d){var f=d[0],v=d[1];return[t+f,v]})):u});return[o,l]}):r}function Xr(r){if(r<1)return{get:function(){},set:function(){}};var t=0,n=new Map,o=new Map;function i(l,u){n.set(l,u),t++,t>r&&(t=0,o=n,n=new Map)}return{get:function(u){var d=n.get(u);if(d!==void 0)return d;if((d=o.get(u))!==void 0)return i(u,d),d},set:function(u,d){n.has(u)?n.set(u,d):i(u,d)}}}var nr="!";function Qr(r){var t=r.separator||":";return function(o){for(var i=0,l=[],u=0,d=0;d<o.length;d++){var f=o[d];i===0&&f===t[0]&&(t.length===1||o.slice(d,d+t.length)===t)&&(l.push(o.slice(u,d)),u=d+t.length),f==="["?i++:f==="]"&&i--}var v=l.length===0?o:o.substring(u),g=v.startsWith(nr),x=g?v.substring(1):v;return{modifiers:l,hasImportantModifier:g,baseClassName:x}}}function et(r){if(r.length<=1)return r;var t=[],n=[];return r.forEach(function(o){var i=o[0]==="[";i?(t.push.apply(t,n.sort().concat([o])),n=[]):n.push(o)}),t.push.apply(t,n.sort()),t}function rt(r){return{cache:Xr(r.cacheSize),splitModifiers:Qr(r),...Yr(r)}}var tt=/\s+/;function ot(r,t){var n=t.splitModifiers,o=t.getClassGroupId,i=t.getConflictingClassGroupIds,l=new Set;return r.trim().split(tt).map(function(u){var d=n(u),f=d.modifiers,v=d.hasImportantModifier,g=d.baseClassName,x=o(g);if(!x)return{isTailwindClass:!1,originalClassName:u};var j=et(f).join(":"),I=v?j+nr:j;return{isTailwindClass:!0,modifierId:I,classGroupId:x,originalClassName:u}}).reverse().filter(function(u){if(!u.isTailwindClass)return!0;var d=u.modifierId,f=u.classGroupId,v=d+f;return l.has(v)?!1:(l.add(v),i(f).forEach(function(g){return l.add(d+g)}),!0)}).reverse().map(function(u){return u.originalClassName}).join(" ")}function nt(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];var o,i,l,u=d;function d(v){var g=t[0],x=t.slice(1),j=x.reduce(function(I,P){return P(I)},g());return o=rt(j),i=o.cache.get,l=o.cache.set,u=f,f(v)}function f(v){var g=i(v);if(g)return g;var x=ot(v,o);return l(v,x),x}return function(){return u(Ur.apply(null,arguments))}}function w(r){var t=function(o){return o[r]||[]};return t.isThemeGetter=!0,t}var ar=/^\[(?:([a-z-]+):)?(.+)\]$/i,at=/^\d+\/\d+$/,it=new Set(["px","full","screen"]),st=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh)/,ct=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function W(r){return de(r)||it.has(r)||at.test(r)||Z(r)}function Z(r){return q(r,"length",gt)}function dt(r){return q(r,"size",ir)}function ut(r){return q(r,"position",ir)}function ft(r){return q(r,"url",bt)}function Me(r){return q(r,"number",de)}function de(r){return!Number.isNaN(Number(r))}function le(r){return rr(r)||q(r,"number",rr)}function R(r){return ar.test(r)}function ce(){return!0}function B(r){return st.test(r)}function pt(r){return q(r,"",vt)}function q(r,t,n){var o=ar.exec(r);return o?o[1]?o[1]===t:n(o[2]):!1}function gt(r){return lt.test(r)}function ir(){return!1}function bt(r){return r.startsWith("url(")}function rr(r){return Number.isInteger(Number(r))}function vt(r){return ct.test(r)}function ht(){var r=w("colors"),t=w("spacing"),n=w("blur"),o=w("brightness"),i=w("borderColor"),l=w("borderRadius"),u=w("borderSpacing"),d=w("borderWidth"),f=w("contrast"),v=w("grayscale"),g=w("hueRotate"),x=w("invert"),j=w("gap"),I=w("gradientColorStops"),P=w("inset"),N=w("margin"),H=w("opacity"),A=w("padding"),E=w("saturate"),te=w("scale"),fe=w("sepia"),pe=w("skew"),ge=w("space"),be=w("translate"),oe=function(){return["auto","contain","none"]},J=function(){return["auto","hidden","clip","visible","scroll"]},ve=function(){return["auto",t]},he=function(){return["",W]},$=function(){return["auto",de,R]},V=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},z=function(){return["solid","dashed","dotted","double","none"]},D=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},K=function(){return["start","end","center","between","around","evenly"]},F=function(){return["","0",R]},ne=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},G=function(){return[de,Me]},U=function(){return[de,R]};return{cacheSize:500,theme:{colors:[ce],spacing:[W],blur:["none","",B,Z],brightness:G(),borderColor:[r],borderRadius:["none","","full",B,Z],borderSpacing:[t],borderWidth:he(),contrast:G(),grayscale:F(),hueRotate:U(),invert:F(),gap:[t],gradientColorStops:[r],inset:ve(),margin:ve(),opacity:G(),padding:[t],saturate:G(),scale:G(),sepia:F(),skew:U(),space:[t],translate:[t]},classGroups:{aspect:[{aspect:["auto","square","video",R]}],container:["container"],columns:[{columns:[B]}],"break-after":[{"break-after":ne()}],"break-before":[{"break-before":ne()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[].concat(V(),[R])}],overflow:[{overflow:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:oe()}],"overscroll-x":[{"overscroll-x":oe()}],"overscroll-y":[{"overscroll-y":oe()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[P]}],"inset-x":[{"inset-x":[P]}],"inset-y":[{"inset-y":[P]}],top:[{top:[P]}],right:[{right:[P]}],bottom:[{bottom:[P]}],left:[{left:[P]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",le]}],basis:[{basis:[t]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",R]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",le]}],"grid-cols":[{"grid-cols":[ce]}],"col-start-end":[{col:["auto",{span:[le]},R]}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":[ce]}],"row-start-end":[{row:["auto",{span:[le]},R]}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",R]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",R]}],gap:[{gap:[j]}],"gap-x":[{"gap-x":[j]}],"gap-y":[{"gap-y":[j]}],"justify-content":[{justify:K()}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:[].concat(K(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(K(),["baseline","stretch"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[A]}],px:[{px:[A]}],py:[{py:[A]}],pt:[{pt:[A]}],pr:[{pr:[A]}],pb:[{pb:[A]}],pl:[{pl:[A]}],m:[{m:[N]}],mx:[{mx:[N]}],my:[{my:[N]}],mt:[{mt:[N]}],mr:[{mr:[N]}],mb:[{mb:[N]}],ml:[{ml:[N]}],"space-x":[{"space-x":[ge]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[ge]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",t]}],"min-w":[{"min-w":["min","max","fit",W]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[B]},B,Z]}],h:[{h:[t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",W]}],"max-h":[{"max-h":[t,"min","max","fit"]}],"font-size":[{text:["base",B,Z]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Me]}],"font-family":[{font:[ce]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Z]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",W]}],"list-style-type":[{list:["none","disc","decimal",R]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[r]}],"placeholder-opacity":[{"placeholder-opacity":[H]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[r]}],"text-opacity":[{"text-opacity":[H]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(z(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",W]}],"underline-offset":[{"underline-offset":["auto",W]}],"text-decoration-color":[{decoration:[r]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:[t]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Z]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap"]}],break:[{break:["normal","words","all","keep"]}],content:[{content:["none",R]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[H]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(V(),[ut])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",dt]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},ft]}],"bg-color":[{bg:[r]}],"gradient-from":[{from:[I]}],"gradient-via":[{via:[I]}],"gradient-to":[{to:[I]}],rounded:[{rounded:[l]}],"rounded-t":[{"rounded-t":[l]}],"rounded-r":[{"rounded-r":[l]}],"rounded-b":[{"rounded-b":[l]}],"rounded-l":[{"rounded-l":[l]}],"rounded-tl":[{"rounded-tl":[l]}],"rounded-tr":[{"rounded-tr":[l]}],"rounded-br":[{"rounded-br":[l]}],"rounded-bl":[{"rounded-bl":[l]}],"border-w":[{border:[d]}],"border-w-x":[{"border-x":[d]}],"border-w-y":[{"border-y":[d]}],"border-w-t":[{"border-t":[d]}],"border-w-r":[{"border-r":[d]}],"border-w-b":[{"border-b":[d]}],"border-w-l":[{"border-l":[d]}],"border-opacity":[{"border-opacity":[H]}],"border-style":[{border:[].concat(z(),["hidden"])}],"divide-x":[{"divide-x":[d]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[d]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[H]}],"divide-style":[{divide:z()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:[""].concat(z())}],"outline-offset":[{"outline-offset":[W]}],"outline-w":[{outline:[W]}],"outline-color":[{outline:[r]}],"ring-w":[{ring:he()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[r]}],"ring-opacity":[{"ring-opacity":[H]}],"ring-offset-w":[{"ring-offset":[W]}],"ring-offset-color":[{"ring-offset":[r]}],shadow:[{shadow:["","inner","none",B,pt]}],"shadow-color":[{shadow:[ce]}],opacity:[{opacity:[H]}],"mix-blend":[{"mix-blend":D()}],"bg-blend":[{"bg-blend":D()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[o]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",B,R]}],grayscale:[{grayscale:[v]}],"hue-rotate":[{"hue-rotate":[g]}],invert:[{invert:[x]}],saturate:[{saturate:[E]}],sepia:[{sepia:[fe]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[v]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g]}],"backdrop-invert":[{"backdrop-invert":[x]}],"backdrop-opacity":[{"backdrop-opacity":[H]}],"backdrop-saturate":[{"backdrop-saturate":[E]}],"backdrop-sepia":[{"backdrop-sepia":[fe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[u]}],"border-spacing-x":[{"border-spacing-x":[u]}],"border-spacing-y":[{"border-spacing-y":[u]}],"table-layout":[{table:["auto","fixed"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",R]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",R]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",R]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[te]}],"scale-x":[{"scale-x":[te]}],"scale-y":[{"scale-y":[te]}],rotate:[{rotate:[le,R]}],"translate-x":[{"translate-x":[be]}],"translate-y":[{"translate-y":[be]}],"skew-x":[{"skew-x":[pe]}],"skew-y":[{"skew-y":[pe]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",R]}],accent:[{accent:["auto",r]}],appearance:["appearance-none"],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",R]}],"caret-color":[{caret:[r]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":[t]}],"scroll-mx":[{"scroll-mx":[t]}],"scroll-my":[{"scroll-my":[t]}],"scroll-mt":[{"scroll-mt":[t]}],"scroll-mr":[{"scroll-mr":[t]}],"scroll-mb":[{"scroll-mb":[t]}],"scroll-ml":[{"scroll-ml":[t]}],"scroll-p":[{"scroll-p":[t]}],"scroll-px":[{"scroll-px":[t]}],"scroll-py":[{"scroll-py":[t]}],"scroll-pt":[{"scroll-pt":[t]}],"scroll-pr":[{"scroll-pr":[t]}],"scroll-pb":[{"scroll-pb":[t]}],"scroll-pl":[{"scroll-pl":[t]}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","pinch-zoom","manipulation",{pan:["x","left","right","y","up","down"]}]}],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",R]}],fill:[{fill:[r,"none"]}],"stroke-w":[{stroke:[W,Me]}],stroke:[{stroke:[r,"none"]}],sr:["sr-only","not-sr-only"]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],rounded:["rounded-t","rounded-r","rounded-b","rounded-l","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"]}}}var mt=nt(ht);function sr(r){var t,n,o="";if(typeof r=="string"||typeof r=="number")o+=r;else if(typeof r=="object")if(Array.isArray(r))for(t=0;t<r.length;t++)r[t]&&(n=sr(r[t]))&&(o&&(o+=" "),o+=n);else for(t in r)r[t]&&(o&&(o+=" "),o+=t);return o}function xt(){for(var r,t,n=0,o="";n<arguments.length;)(r=arguments[n++])&&(t=sr(r))&&(o&&(o+=" "),o+=t);return o}function ue(...r){return mt(xt(r))}function yt({className:r="",size:t="1em"}){return s.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:r,children:[s.jsx("path",{d:"M12.001 7.7395C12.2367 7.73978 12.4591 7.85076 12.6006 8.03931L15.376 11.7395C15.5459 11.9666 15.5731 12.2708 15.4463 12.5247C15.3193 12.7785 15.0592 12.9395 14.7754 12.9397H12.75V17.2766C12.7499 17.6907 12.4142 18.0266 12 18.0266C11.5858 18.0266 11.2501 17.6907 11.25 17.2766V12.9397H9.22559C8.94169 12.9397 8.68182 12.7785 8.55469 12.5247C8.42778 12.2706 8.45558 11.9667 8.62598 11.7395L11.4004 8.03931L11.457 7.97192C11.5977 7.82422 11.7945 7.7395 12.001 7.7395Z",fill:"currentColor"}),s.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 2.65161C17.5228 2.65161 22 7.12876 22 12.6516C22 18.1744 17.5228 22.6516 12 22.6516C6.47715 22.6516 2 18.1744 2 12.6516C2 7.12876 6.47715 2.65161 12 2.65161ZM12 4.15161C7.30558 4.15161 3.5 7.95719 3.5 12.6516C3.5 17.346 7.30558 21.1516 12 21.1516C16.6944 21.1516 20.5 17.346 20.5 12.6516C20.5 7.95719 16.6944 4.15161 12 4.15161Z",fill:"currentColor"})]})}function wt({className:r="",size:t="1em"}){return s.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:r,children:s.jsx("path",{d:"M12 2C10.0222 2 8.08879 2.58649 6.4443 3.6853C4.79981 4.78412 3.51809 6.3459 2.76121 8.17316C2.00433 10.0004 1.8063 12.0111 2.19215 13.9509C2.578 15.8907 3.53041 17.6725 4.92894 19.0711C6.32746 20.4696 8.10929 21.422 10.0491 21.8078C11.9889 22.1937 13.9996 21.9957 15.8268 21.2388C17.6541 20.4819 19.2159 19.2002 20.3147 17.5557C21.4135 15.9112 22 13.9778 22 12C21.9971 9.34871 20.9426 6.80684 19.0679 4.9321C17.1932 3.05736 14.6513 2.00287 12 2ZM15.7092 11.7642C15.6751 11.8349 15.6217 11.8945 15.5553 11.9363C15.4888 11.978 15.4118 12.0001 15.3333 12H12.8333V16.1667C12.8333 16.3877 12.7455 16.5996 12.5893 16.7559C12.433 16.9122 12.221 17 12 17C11.779 17 11.567 16.9122 11.4107 16.7559C11.2545 16.5996 11.1667 16.3877 11.1667 16.1667V12H8.66667C8.58819 12 8.5113 11.9779 8.44484 11.9362C8.37839 11.8945 8.32507 11.8348 8.29102 11.7641C8.25697 11.6934 8.24359 11.6145 8.2524 11.5365C8.26121 11.4586 8.29187 11.3847 8.34084 11.3233L11.6742 7.15667C11.7146 7.10991 11.7646 7.07241 11.8209 7.04671C11.8771 7.021 11.9382 7.0077 12 7.0077C12.0618 7.0077 12.1229 7.021 12.1791 7.04671C12.2354 7.07241 12.2854 7.10991 12.3258 7.15667L15.6592 11.3233C15.7082 11.3846 15.7389 11.4585 15.7477 11.5365C15.7566 11.6145 15.7432 11.6934 15.7092 11.7642Z",fill:"#1DA56A"})})}const Ct=({tooltipContent:r="Send message",className:t,...n})=>{const[o,i]=_.useState(!1);return s.jsx(S.Tooltip,{content:r,children:s.jsx(S.IconButton,{variant:"text",color:"gray",className:ue(t,"hover:rounded-lg hover:bg-gray-100"),type:"submit",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),...n,children:o?s.jsx(wt,{className:"size-6 "}):s.jsx(yt,{className:"size-6 "})})})},lr=({onSubmit:r=()=>{},...t})=>s.jsx(Hr,{autoFocus:!0,placeholder:"Write your message here",className:"pl-1 block w-full focus:outline-none max-h-32 resize-none placeholder:text-gray-400",onKeyDown:n=>{n.key==="Enter"&&!n.shiftKey&&(n.preventDefault(),r())},...t}),jt=({bottom:r,right:t,top:n,textArea:o=s.jsx(lr,{}),...i})=>s.jsxs("div",{className:"border gap-2 rounded-lg bg-white shadow-[0px_2px_2px_0px_#0000000A,0px_8px_8px_-8px_#0000000A] border-gray-100",...i,children:[n,s.jsxs("div",{className:"flex gap-2 p-4 rounded-lg bg-white",children:[s.jsxs("div",{className:"grow flex flex-col items-start justify-center",children:[o,r]}),s.jsx("div",{className:"shrink flex items-end justify-end",children:t})]})]}),kt=Object.freeze(Object.defineProperty({__proto__:null,Container:jt,SubmitButton:Ct,Textarea:lr},Symbol.toStringTag,{value:"Module"})),re=_.createContext(void 0),cr=({children:r,isCollapsed:t,onSwitchLayout:n})=>{const[o,i]=_.useState(!1),[l,u]=_.useState(!1),d=t!==void 0?t:o,f=v=>{const g=v??!d;t===void 0&&i(g),n==null||n(g)};return s.jsx(re.Provider,{value:{isCollapsed:d,toggleCollapsed:f,isHovered:l,setIsHovered:u},children:r})},dr=({className:r,children:t,...n})=>{const{isCollapsed:o,isHovered:i,setIsHovered:l}=_.useContext(re);return s.jsx("div",{className:ue(r,o&&"shadow-lg",o&&!i?"w-auto":"w-[280px]","bg-gray-50 p-2 flex flex-col justify-between items-center rounded-lg"),onMouseEnter:()=>o&&l(!0),onMouseLeave:()=>o&&l(!1),...n,children:t})},Rt=({className:r,children:t,isCollapsed:n,onSwitchLayout:o,...i})=>s.jsx(cr,{isCollapsed:n,onSwitchLayout:o,children:s.jsx(dr,{className:r,...i,children:t})}),_t=({icon:r,children:t,...n})=>{const{isCollapsed:o,isHovered:i}=_.useContext(re);return s.jsxs("button",{className:"flex items-center gap-2 w-full hover:bg-gray-100 text-caption-1-em text-gray-600 hover:text-gray-900 h-[38px] rounded-lg px-2",...n,children:[r," ",(!o||i)&&t]})};function Et(r){return s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:s.jsx("path",{d:"M13 1C14.6569 1 16 2.34315 16 4V12L15.9961 12.1543C15.9158 13.7394 14.6051 15 13 15H3L2.8457 14.9961C1.31166 14.9184 0.0816253 13.6883 0.00390625 12.1543L0 12V4C1.28853e-07 2.34315 1.34315 1 3 1H13ZM3 2.5C2.17157 2.5 1.5 3.17157 1.5 4V12C1.5 12.8284 2.17157 13.5 3 13.5H13C13.8284 13.5 14.5 12.8284 14.5 12V4C14.5 3.17157 13.8284 2.5 13 2.5H3ZM3.75 3.5C4.16421 3.5 4.5 3.83579 4.5 4.25V11.75C4.5 12.1642 4.16421 12.5 3.75 12.5C3.33579 12.5 3 12.1642 3 11.75V4.25C3 3.83579 3.33579 3.5 3.75 3.5Z",fill:"currentColor"})})}function St(r){return s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:s.jsx("path",{d:"M13 1C14.6569 1 16 2.34315 16 4V12L15.9961 12.1543C15.9158 13.7394 14.6051 15 13 15H3L2.8457 14.9961C1.31166 14.9184 0.0816253 13.6883 0.00390625 12.1543L0 12V4C1.28853e-07 2.34315 1.34315 1 3 1H13ZM3 2.5C2.17157 2.5 1.5 3.17157 1.5 4V12C1.5 12.8284 2.17157 13.5 3 13.5H13C13.8284 13.5 14.5 12.8284 14.5 12V4C14.5 3.17157 13.8284 2.5 13 2.5H3ZM7.5 4C7.77614 4 8 4.22386 8 4.5V11.5C8 11.7761 7.77614 12 7.5 12H3.5C3.22386 12 3 11.7761 3 11.5V4.5C3 4.22386 3.22386 4 3.5 4H7.5Z",fill:"currentColor"})})}const Tt=()=>{const{isCollapsed:r,isHovered:t,toggleCollapsed:n}=_.useContext(re);return r&&!t?null:s.jsx(S.IconButton,{variant:"text",color:"gray",onClick:()=>n(),children:r?s.jsx(Et,{className:"size-4"}):s.jsx(St,{className:"size-4"})})},Mt=({children:r,className:t,icon:n,isActive:o,trailing:i,...l})=>{const{isCollapsed:u,isHovered:d}=_.useContext(re);return s.jsxs("div",{className:ue(o?"!text-gray-900":"!text-gray-600","flex items-center justify-between w-full hover:bg-gray-100 text-caption-1-em hover:text-gray-900 h-[38px] rounded-lg px-2 cursor-pointer group",t),...l,children:[s.jsxs("div",{className:"flex items-center gap-2",children:[n,(!u||d)&&r]}),(!u||d)&&i]})},It=({children:r,className:t,isActive:n,trailing:o,icon:i,...l})=>{const{isCollapsed:u,isHovered:d}=_.useContext(re);return s.jsxs("div",{className:ue(n?"!text-gray-900":"!text-gray-600","flex items-center justify-between w-full hover:bg-gray-100 text-caption-1-em hover:text-gray-900 h-[38px] rounded-lg pr-2 pl-3 cursor-pointer group text-sm",t),...l,children:[s.jsxs("div",{className:"flex items-center gap-2 overflow-auto",children:[(!u||d)&&i," ",(!u||d)&&r]}),(!u||d)&&o]})},Pt=Object.freeze(Object.defineProperty({__proto__:null,Button:_t,Container:dr,Item:Mt,Layout:Rt,Provider:cr,SecondaryItem:It,ToggleCollapseButton:Tt},Symbol.toStringTag,{value:"Module"})),At=r=>s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:s.jsx("path",{d:"M12.7197 2.21954C13.0125 1.92683 13.4874 1.92694 13.7803 2.21954C14.073 2.51241 14.073 2.98722 13.7803 3.28008L9.05955 7.99981L13.7803 12.7205L13.832 12.7772C14.0721 13.0717 14.0548 13.5065 13.7803 13.7811C13.5057 14.0555 13.0709 14.0729 12.7764 13.8328L12.7197 13.7811L7.99901 9.06036L3.27928 13.7811C2.9864 14.0737 2.51156 14.0738 2.21873 13.7811C1.92618 13.4882 1.92616 13.0133 2.21873 12.7205L6.93846 7.99981L2.21873 3.28008C1.92615 2.98722 1.92607 2.51235 2.21873 2.21954C2.51154 1.92673 2.98637 1.92691 3.27928 2.21954L7.99901 6.93926L12.7197 2.21954Z",fill:"currentColor"})}),Ot=({onClose:r,right:t,children:n})=>s.jsxs("div",{className:"bg-gray-50 flex gap-2 items-center px-2 py-3 rounded-t-xl",children:[s.jsx("div",{className:"grow text-subheader-em",children:n}),s.jsxs("div",{className:"flex items-center gap-4",children:[t,s.jsx(S.IconButton,{variant:"text",size:"sm",color:"gray",className:"rounded-full",onClick:r,children:s.jsx(At,{className:"size-4 text-gray-600"})})]})]}),ur={Header:Ot},fr=r=>s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:s.jsx("path",{d:"M2.25 5.5C2.66421 5.5 3 5.83579 3 6.25C3 6.66421 2.66421 7 2.25 7H2C1.72386 7 1.5 7.22386 1.5 7.5V13.5C1.5 13.7761 1.72386 14 2 14H8C8.27614 14 8.5 13.7761 8.5 13.5V13.25C8.5 12.8358 8.83579 12.5 9.25 12.5C9.66421 12.5 10 12.8358 10 13.25V13.5C10 14.5357 9.21278 15.387 8.2041 15.4893L8 15.5H2L1.7959 15.4893C0.854346 15.3938 0.1062 14.6457 0.0107422 13.7041L0 13.5V7.5C0 6.39543 0.895431 5.5 2 5.5H2.25ZM13.75 0C14.7165 1.28853e-07 15.5 0.783502 15.5 1.75V9.75C15.5 10.7165 14.7165 11.5 13.75 11.5H5.75C4.7835 11.5 4 10.7165 4 9.75V1.75C4 0.783502 4.7835 8.0532e-09 5.75 0H13.75ZM5.75 1.5C5.61193 1.5 5.5 1.61193 5.5 1.75V9.75C5.5 9.88807 5.61193 10 5.75 10H13.75C13.8881 10 14 9.88807 14 9.75V1.75C14 1.61193 13.8881 1.5 13.75 1.5H5.75ZM11.75 3C11.795 3 11.839 3.00413 11.8818 3.01172C11.8874 3.0127 11.8929 3.01354 11.8984 3.01465C11.9118 3.01733 11.9244 3.02298 11.9375 3.02637C11.9707 3.03495 12.0041 3.04344 12.0361 3.05664C12.0653 3.06868 12.092 3.08512 12.1191 3.10059C12.1763 3.1331 12.2316 3.171 12.2803 3.21973C12.3287 3.26812 12.366 3.3232 12.3984 3.37988C12.414 3.40703 12.4303 3.43375 12.4424 3.46289C12.4631 3.51289 12.4779 3.56459 12.4873 3.61719C12.495 3.66035 12.5 3.70462 12.5 3.75V7.75C12.5 8.16421 12.1642 8.5 11.75 8.5C11.3358 8.5 11 8.16421 11 7.75V5.56055L8.28027 8.28027C7.98738 8.57317 7.51262 8.57317 7.21973 8.28027C6.92683 7.98738 6.92683 7.51262 7.21973 7.21973L9.93945 4.5H7.75C7.33579 4.5 7 4.16421 7 3.75C7 3.33579 7.33579 3 7.75 3H11.75Z",fill:"currentColor"})}),Nt=(r=100,t=50,n=990,o=10)=>{const[i,l]=_.useState(r);return[i,{...{zoomIn:()=>l(f=>Math.min(f+o,n)),zoomOut:()=>l(f=>Math.max(f-o,t)),reset:()=>l(r),zoomToValue:f=>l(Math.max(t,Math.min(f,n)))},handleWheel:f=>{f.preventDefault();const v=f.deltaY>0?-o:o;l(g=>Math.max(t,Math.min(g+v,n)))}}]},zt=()=>{const[r,t]=_.useState(0);return[r,{rotateClockwise:()=>t(o=>(o+90)%360),rotateCounterClockwise:()=>t(o=>(o-90+360)%360)}]},Lt=()=>{const[r,t]=_.useState({x:0,y:0}),[n,o]=_.useState(!1),[i,l]=_.useState({x:0,y:0});return[{pan:r,isDragging:n},{handleMouseDown:g=>{o(!0),l({x:g.clientX-r.x,y:g.clientY-r.y})},handleMouseMove:g=>{n&&t({x:g.clientX-i.x,y:g.clientY-i.y})},handleMouseUp:()=>{o(!1)},reset:()=>t({x:0,y:0})}]},Vt=(r=1)=>{const[t,n]=_.useState(1);return[t,{nextPage:()=>n(i=>Math.min(i+1,r)),prevPage:()=>n(i=>Math.max(i-1,1)),goToPage:i=>n(Math.max(1,Math.min(i,r)))}]},Wt=({onClose:r,totalPages:t,getImageSrc:n,title:o="PDF Viewer"})=>{const[i,l]=Nt(),[u,d]=zt(),[{pan:f,isDragging:v},g]=Lt(),[x,j]=Vt(t),I=s.jsx(S.IconButton,{variant:"text",color:"gray",children:s.jsx(fr,{className:"size-4"})});return s.jsxs("div",{className:"shadow rounded-t-lg",children:[s.jsx(ur.Header,{onClose:r,right:I,children:o}),s.jsx("div",{className:"flex-1 grid",children:s.jsxs("div",{className:"grid relative",children:[s.jsx("div",{className:"overflow-hidden col-start-1 row-start-1 bg-gray-200 h-full relative",onMouseMove:g.handleMouseMove,onMouseUp:g.handleMouseUp,onMouseLeave:g.handleMouseUp,onWheel:l.handleWheel,children:s.jsx("div",{style:{transform:`translate(${f.x}px, ${f.y}px)`,cursor:v?"grabbing":"grab",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},onMouseDown:g.handleMouseDown,children:s.jsx("div",{style:{transform:`scale(${i/100}) rotate(${u}deg)`,transformOrigin:"center",transition:v?"none":"transform 0.3s ease"},children:s.jsx("img",{src:n(x),style:{userSelect:"none",pointerEvents:"none"}})})})}),s.jsxs("div",{className:"col-start-1 row-start-1 self-end p-4 flex gap-2 justify-between w-full z-10",children:[s.jsxs(S.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[s.jsx(S.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:l.zoomOut,children:s.jsx(ee.Icon,{icon:"lucide:minus"})}),s.jsx(S.Tooltip,{content:"Click to reset zoom and pan",children:s.jsxs("button",{className:"!bg-white text-center cursor-pointer w-[60px]",onClick:()=>{l.reset(),g.reset()},children:[i,"%"]})}),s.jsx(S.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:l.zoomIn,children:s.jsx(ee.Icon,{icon:"lucide:plus"})})]}),s.jsxs(S.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[s.jsx(S.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:d.rotateClockwise,children:s.jsx(ee.Icon,{icon:"lucide:iteration-cw"})}),s.jsx(S.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:d.rotateCounterClockwise,children:s.jsx(ee.Icon,{icon:"lucide:iteration-ccw"})})]}),s.jsxs(S.ButtonGroup,{className:"divide-x-0 ",children:[s.jsx(S.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:j.prevPage,disabled:x===1,children:s.jsx(ee.Icon,{icon:"lucide:chevron-left"})}),s.jsx("input",{className:"bg-white pl-4 flex items-center w-[50px] text-center focus:outline-none w-[60px]",value:x,onChange:P=>{const N=parseInt(P.target.value);isNaN(N)||j.goToPage(N)},type:"number",min:"1",max:t}),s.jsxs("div",{className:"flex items-center bg-white px-2",children:["of ",t]}),s.jsx(S.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:j.nextPage,disabled:x===t,children:s.jsx(ee.Icon,{icon:"lucide:chevron-right"})})]})]})]})})]})},Ht=r=>{const[t,n]=_.useState({width:1,height:2});return _.useEffect(()=>{if(r.current){const{current:o}=r,i=o.getBoundingClientRect(),{width:l,height:u}=i;n({width:Math.round(l),height:Math.round(u)})}},[r]),t},Dt=({onClose:r,src:t,title:n="PDF Viewer",className:o})=>{const i=_.useRef(null);Ht(i);const l=s.jsx(S.IconButton,{variant:"text",color:"gray",children:s.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:s.jsx(fr,{className:"size-4"})})});return s.jsxs("div",{className:ue("shadow rounded-t-lg flex flex-col h-full",o),children:[s.jsx(ur.Header,{onClose:r,right:l,children:n}),s.jsx("div",{className:"flex-1 grid",children:s.jsx("div",{className:"grid relative",children:s.jsx("div",{ref:i,className:"overflow-hidden col-start-1 row-start-1 bg-gray-200 h-full relative",children:s.jsx("embed",{src:`${t}#view=FitH&navpanes=0&scrollbar=0`,type:"application/pdf",width:"100%",height:"100%",style:{border:"none"}})})})})]})};exports.HelloWorld=$r;exports.ImageViewer=Wt;exports.InputPrompt=kt;exports.PdfViewer=Dt;exports.Sidebar=Pt;exports.materialTheme=Fr;exports.tailwindTheme=Dr;
30
+ <%s key={someKey} {...props} />`,Gd,Qn,Mb,Qn),Wf[Qn+Gd]=!0}}return E===s?Tb(Yt):Cb(Yt),Yt}}function Rb(E,M,$){return qf(E,M,$,!0)}function Pb(E,M,$){return qf(E,M,$,!1)}var kb=Pb,Ib=Rb;Jo.Fragment=s,Jo.jsx=kb,Jo.jsxs=Ib}()),Jo}process.env.NODE_ENV==="production"?su.exports=Hb():su.exports=$b();var P=su.exports;const zb=()=>P.jsx("div",{className:"bg-red-800 text-white p-2",children:"Hello world"});function Gb(){for(var c=0,t,e,s="";c<arguments.length;)(t=arguments[c++])&&(e=Ip(t))&&(s&&(s+=" "),s+=e);return s}function Ip(c){if(typeof c=="string")return c;for(var t,e="",s=0;s<c.length;s++)c[s]&&(t=Ip(c[s]))&&(e&&(e+=" "),e+=t);return e}var wf="-";function Vb(c){var t=Wb(c);function e(i){var n=i.split(wf);return n[0]===""&&n.length!==1&&n.shift(),Mp(n,t)||Ub(i)}function s(i){return c.conflictingClassGroups[i]||[]}return{getClassGroupId:e,getConflictingClassGroupIds:s}}function Mp(c,t){var a;if(c.length===0)return t.classGroupId;var e=c[0],s=t.nextPart.get(e),i=s?Mp(c.slice(1),s):void 0;if(i)return i;if(t.validators.length!==0){var n=c.join(wf);return(a=t.validators.find(function(o){var l=o.validator;return l(n)}))==null?void 0:a.classGroupId}}var Jf=/^\[(.+)\]$/;function Ub(c){if(Jf.test(c)){var t=Jf.exec(c)[1],e=t==null?void 0:t.substring(0,t.indexOf(":"));if(e)return"arbitrary.."+e}}function Wb(c){var t=c.theme,e=c.prefix,s={nextPart:new Map,validators:[]},i=Xb(Object.entries(c.classGroups),e);return i.forEach(function(n){var a=n[0],o=n[1];iu(o,s,a,t)}),s}function iu(c,t,e,s){c.forEach(function(i){if(typeof i=="string"){var n=i===""?t:Zf(t,i);n.classGroupId=e;return}if(typeof i=="function"){if(qb(i)){iu(i(s),t,e,s);return}t.validators.push({validator:i,classGroupId:e});return}Object.entries(i).forEach(function(a){var o=a[0],l=a[1];iu(l,Zf(t,o),e,s)})})}function Zf(c,t){var e=c;return t.split(wf).forEach(function(s){e.nextPart.has(s)||e.nextPart.set(s,{nextPart:new Map,validators:[]}),e=e.nextPart.get(s)}),e}function qb(c){return c.isThemeGetter}function Xb(c,t){return t?c.map(function(e){var s=e[0],i=e[1],n=i.map(function(a){return typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(function(o){var l=o[0],h=o[1];return[t+l,h]})):a});return[s,n]}):c}function Yb(c){if(c<1)return{get:function(){},set:function(){}};var t=0,e=new Map,s=new Map;function i(n,a){e.set(n,a),t++,t>c&&(t=0,s=e,e=new Map)}return{get:function(a){var o=e.get(a);if(o!==void 0)return o;if((o=s.get(a))!==void 0)return i(a,o),o},set:function(a,o){e.has(a)?e.set(a,o):i(a,o)}}}var Lp="!";function Kb(c){var t=c.separator||":";return function(s){for(var i=0,n=[],a=0,o=0;o<s.length;o++){var l=s[o];i===0&&l===t[0]&&(t.length===1||s.slice(o,o+t.length)===t)&&(n.push(s.slice(a,o)),a=o+t.length),l==="["?i++:l==="]"&&i--}var h=n.length===0?s:s.substring(a),d=h.startsWith(Lp),u=d?h.substring(1):h;return{modifiers:n,hasImportantModifier:d,baseClassName:u}}}function Jb(c){if(c.length<=1)return c;var t=[],e=[];return c.forEach(function(s){var i=s[0]==="[";i?(t.push.apply(t,e.sort().concat([s])),e=[]):e.push(s)}),t.push.apply(t,e.sort()),t}function Zb(c){return{cache:Yb(c.cacheSize),splitModifiers:Kb(c),...Vb(c)}}var Qb=/\s+/;function t0(c,t){var e=t.splitModifiers,s=t.getClassGroupId,i=t.getConflictingClassGroupIds,n=new Set;return c.trim().split(Qb).map(function(a){var o=e(a),l=o.modifiers,h=o.hasImportantModifier,d=o.baseClassName,u=s(d);if(!u)return{isTailwindClass:!1,originalClassName:a};var f=Jb(l).join(":"),g=h?f+Lp:f;return{isTailwindClass:!0,modifierId:g,classGroupId:u,originalClassName:a}}).reverse().filter(function(a){if(!a.isTailwindClass)return!0;var o=a.modifierId,l=a.classGroupId,h=o+l;return n.has(h)?!1:(n.add(h),i(l).forEach(function(d){return n.add(o+d)}),!0)}).reverse().map(function(a){return a.originalClassName}).join(" ")}function e0(){for(var c=arguments.length,t=new Array(c),e=0;e<c;e++)t[e]=arguments[e];var s,i,n,a=o;function o(h){var d=t[0],u=t.slice(1),f=u.reduce(function(g,y){return y(g)},d());return s=Zb(f),i=s.cache.get,n=s.cache.set,a=l,l(h)}function l(h){var d=i(h);if(d)return d;var u=t0(h,s);return n(h,u),u}return function(){return a(Gb.apply(null,arguments))}}function Lt(c){var t=function(s){return s[c]||[]};return t.isThemeGetter=!0,t}var Dp=/^\[(?:([a-z-]+):)?(.+)\]$/i,s0=/^\d+\/\d+$/,i0=new Set(["px","full","screen"]),n0=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,r0=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh)/,a0=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function Ms(c){return El(c)||i0.has(c)||s0.test(c)||er(c)}function er(c){return ya(c,"length",d0)}function o0(c){return ya(c,"size",Np)}function l0(c){return ya(c,"position",Np)}function c0(c){return ya(c,"url",u0)}function Wd(c){return ya(c,"number",El)}function El(c){return!Number.isNaN(Number(c))}function Zo(c){return Qf(c)||ya(c,"number",Qf)}function Kt(c){return Dp.test(c)}function Qo(){return!0}function cn(c){return n0.test(c)}function h0(c){return ya(c,"",f0)}function ya(c,t,e){var s=Dp.exec(c);return s?s[1]?s[1]===t:e(s[2]):!1}function d0(c){return r0.test(c)}function Np(){return!1}function u0(c){return c.startsWith("url(")}function Qf(c){return Number.isInteger(Number(c))}function f0(c){return a0.test(c)}function p0(){var c=Lt("colors"),t=Lt("spacing"),e=Lt("blur"),s=Lt("brightness"),i=Lt("borderColor"),n=Lt("borderRadius"),a=Lt("borderSpacing"),o=Lt("borderWidth"),l=Lt("contrast"),h=Lt("grayscale"),d=Lt("hueRotate"),u=Lt("invert"),f=Lt("gap"),g=Lt("gradientColorStops"),y=Lt("inset"),v=Lt("margin"),w=Lt("opacity"),A=Lt("padding"),x=Lt("saturate"),_=Lt("scale"),S=Lt("sepia"),C=Lt("skew"),R=Lt("space"),T=Lt("translate"),k=function(){return["auto","contain","none"]},I=function(){return["auto","hidden","clip","visible","scroll"]},D=function(){return["auto",t]},N=function(){return["",Ms]},Y=function(){return["auto",El,Kt]},q=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},H=function(){return["solid","dashed","dotted","double","none"]},st=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},F=function(){return["start","end","center","between","around","evenly"]},O=function(){return["","0",Kt]},yt=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},Tt=function(){return[El,Wd]},zt=function(){return[El,Kt]};return{cacheSize:500,theme:{colors:[Qo],spacing:[Ms],blur:["none","",cn,er],brightness:Tt(),borderColor:[c],borderRadius:["none","","full",cn,er],borderSpacing:[t],borderWidth:N(),contrast:Tt(),grayscale:O(),hueRotate:zt(),invert:O(),gap:[t],gradientColorStops:[c],inset:D(),margin:D(),opacity:Tt(),padding:[t],saturate:Tt(),scale:Tt(),sepia:O(),skew:zt(),space:[t],translate:[t]},classGroups:{aspect:[{aspect:["auto","square","video",Kt]}],container:["container"],columns:[{columns:[cn]}],"break-after":[{"break-after":yt()}],"break-before":[{"break-before":yt()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[].concat(q(),[Kt])}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Zo]}],basis:[{basis:[t]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Kt]}],grow:[{grow:O()}],shrink:[{shrink:O()}],order:[{order:["first","last","none",Zo]}],"grid-cols":[{"grid-cols":[Qo]}],"col-start-end":[{col:["auto",{span:[Zo]},Kt]}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":[Qo]}],"row-start-end":[{row:["auto",{span:[Zo]},Kt]}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Kt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Kt]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:F()}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:[].concat(F(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(F(),["baseline","stretch"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[A]}],px:[{px:[A]}],py:[{py:[A]}],pt:[{pt:[A]}],pr:[{pr:[A]}],pb:[{pb:[A]}],pl:[{pl:[A]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",t]}],"min-w":[{"min-w":["min","max","fit",Ms]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[cn]},cn,er]}],h:[{h:[t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",Ms]}],"max-h":[{"max-h":[t,"min","max","fit"]}],"font-size":[{text:["base",cn,er]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Wd]}],"font-family":[{font:[Qo]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",er]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ms]}],"list-style-type":[{list:["none","disc","decimal",Kt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[c]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[c]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(H(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",Ms]}],"underline-offset":[{"underline-offset":["auto",Ms]}],"text-decoration-color":[{decoration:[c]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:[t]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",er]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap"]}],break:[{break:["normal","words","all","keep"]}],content:[{content:["none",Kt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(q(),[l0])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",o0]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},c0]}],"bg-color":[{bg:[c]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[n]}],"rounded-t":[{"rounded-t":[n]}],"rounded-r":[{"rounded-r":[n]}],"rounded-b":[{"rounded-b":[n]}],"rounded-l":[{"rounded-l":[n]}],"rounded-tl":[{"rounded-tl":[n]}],"rounded-tr":[{"rounded-tr":[n]}],"rounded-br":[{"rounded-br":[n]}],"rounded-bl":[{"rounded-bl":[n]}],"border-w":[{border:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[].concat(H(),["hidden"])}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:H()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:[""].concat(H())}],"outline-offset":[{"outline-offset":[Ms]}],"outline-w":[{outline:[Ms]}],"outline-color":[{outline:[c]}],"ring-w":[{ring:N()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[c]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[Ms]}],"ring-offset-color":[{"ring-offset":[c]}],shadow:[{shadow:["","inner","none",cn,h0]}],"shadow-color":[{shadow:[Qo]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":st()}],"bg-blend":[{"bg-blend":st()}],filter:[{filter:["","none"]}],blur:[{blur:[e]}],brightness:[{brightness:[s]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",cn,Kt]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[u]}],saturate:[{saturate:[x]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[e]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Kt]}],duration:[{duration:zt()}],ease:[{ease:["linear","in","out","in-out",Kt]}],delay:[{delay:zt()}],animate:[{animate:["none","spin","ping","pulse","bounce",Kt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[Zo,Kt]}],"translate-x":[{"translate-x":[T]}],"translate-y":[{"translate-y":[T]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Kt]}],accent:[{accent:["auto",c]}],appearance:["appearance-none"],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Kt]}],"caret-color":[{caret:[c]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":[t]}],"scroll-mx":[{"scroll-mx":[t]}],"scroll-my":[{"scroll-my":[t]}],"scroll-mt":[{"scroll-mt":[t]}],"scroll-mr":[{"scroll-mr":[t]}],"scroll-mb":[{"scroll-mb":[t]}],"scroll-ml":[{"scroll-ml":[t]}],"scroll-p":[{"scroll-p":[t]}],"scroll-px":[{"scroll-px":[t]}],"scroll-py":[{"scroll-py":[t]}],"scroll-pt":[{"scroll-pt":[t]}],"scroll-pr":[{"scroll-pr":[t]}],"scroll-pb":[{"scroll-pb":[t]}],"scroll-pl":[{"scroll-pl":[t]}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","pinch-zoom","manipulation",{pan:["x","left","right","y","up","down"]}]}],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Kt]}],fill:[{fill:[c,"none"]}],"stroke-w":[{stroke:[Ms,Wd]}],stroke:[{stroke:[c,"none"]}],sr:["sr-only","not-sr-only"]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],rounded:["rounded-t","rounded-r","rounded-b","rounded-l","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"]}}}var g0=e0(p0);function Fp(c){var t,e,s="";if(typeof c=="string"||typeof c=="number")s+=c;else if(typeof c=="object")if(Array.isArray(c))for(t=0;t<c.length;t++)c[t]&&(e=Fp(c[t]))&&(s&&(s+=" "),s+=e);else for(t in c)c[t]&&(s&&(s+=" "),s+=t);return s}function m0(){for(var c,t,e=0,s="";e<arguments.length;)(c=arguments[e++])&&(t=Fp(c))&&(s&&(s+=" "),s+=t);return s}function ga(...c){return g0(m0(c))}function b0({className:c="",size:t="1em"}){return P.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:c,children:[P.jsx("path",{d:"M12.001 7.7395C12.2367 7.73978 12.4591 7.85076 12.6006 8.03931L15.376 11.7395C15.5459 11.9666 15.5731 12.2708 15.4463 12.5247C15.3193 12.7785 15.0592 12.9395 14.7754 12.9397H12.75V17.2766C12.7499 17.6907 12.4142 18.0266 12 18.0266C11.5858 18.0266 11.2501 17.6907 11.25 17.2766V12.9397H9.22559C8.94169 12.9397 8.68182 12.7785 8.55469 12.5247C8.42778 12.2706 8.45558 11.9667 8.62598 11.7395L11.4004 8.03931L11.457 7.97192C11.5977 7.82422 11.7945 7.7395 12.001 7.7395Z",fill:"currentColor"}),P.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 2.65161C17.5228 2.65161 22 7.12876 22 12.6516C22 18.1744 17.5228 22.6516 12 22.6516C6.47715 22.6516 2 18.1744 2 12.6516C2 7.12876 6.47715 2.65161 12 2.65161ZM12 4.15161C7.30558 4.15161 3.5 7.95719 3.5 12.6516C3.5 17.346 7.30558 21.1516 12 21.1516C16.6944 21.1516 20.5 17.346 20.5 12.6516C20.5 7.95719 16.6944 4.15161 12 4.15161Z",fill:"currentColor"})]})}function y0({className:c="",size:t="1em"}){return P.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:c,children:P.jsx("path",{d:"M12 2C10.0222 2 8.08879 2.58649 6.4443 3.6853C4.79981 4.78412 3.51809 6.3459 2.76121 8.17316C2.00433 10.0004 1.8063 12.0111 2.19215 13.9509C2.578 15.8907 3.53041 17.6725 4.92894 19.0711C6.32746 20.4696 8.10929 21.422 10.0491 21.8078C11.9889 22.1937 13.9996 21.9957 15.8268 21.2388C17.6541 20.4819 19.2159 19.2002 20.3147 17.5557C21.4135 15.9112 22 13.9778 22 12C21.9971 9.34871 20.9426 6.80684 19.0679 4.9321C17.1932 3.05736 14.6513 2.00287 12 2ZM15.7092 11.7642C15.6751 11.8349 15.6217 11.8945 15.5553 11.9363C15.4888 11.978 15.4118 12.0001 15.3333 12H12.8333V16.1667C12.8333 16.3877 12.7455 16.5996 12.5893 16.7559C12.433 16.9122 12.221 17 12 17C11.779 17 11.567 16.9122 11.4107 16.7559C11.2545 16.5996 11.1667 16.3877 11.1667 16.1667V12H8.66667C8.58819 12 8.5113 11.9779 8.44484 11.9362C8.37839 11.8945 8.32507 11.8348 8.29102 11.7641C8.25697 11.6934 8.24359 11.6145 8.2524 11.5365C8.26121 11.4586 8.29187 11.3847 8.34084 11.3233L11.6742 7.15667C11.7146 7.10991 11.7646 7.07241 11.8209 7.04671C11.8771 7.021 11.9382 7.0077 12 7.0077C12.0618 7.0077 12.1229 7.021 12.1791 7.04671C12.2354 7.07241 12.2854 7.10991 12.3258 7.15667L15.6592 11.3233C15.7082 11.3846 15.7389 11.4585 15.7477 11.5365C15.7566 11.6145 15.7432 11.6934 15.7092 11.7642Z",fill:"#1DA56A"})})}const v0=({tooltipContent:c="Send message",className:t,...e})=>{const[s,i]=B.useState(!1);return P.jsx(lt.Tooltip,{content:c,children:P.jsx(lt.IconButton,{variant:"text",color:"gray",className:ga(t,"hover:rounded-lg hover:bg-gray-100"),type:"submit",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),...e,children:s?P.jsx(y0,{className:"size-6 "}):P.jsx(b0,{className:"size-6 "})})})},Op=({onSubmit:c=()=>{},...t})=>P.jsx(Fb,{autoFocus:!0,placeholder:"Write your message here",className:"pl-1 block w-full focus:outline-none max-h-32 resize-none placeholder:text-gray-400",onKeyDown:e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),c())},...t}),w0=({bottom:c,right:t,top:e,textArea:s=P.jsx(Op,{}),...i})=>P.jsxs("div",{className:"border gap-2 rounded-lg bg-white shadow-[0px_2px_2px_0px_#0000000A,0px_8px_8px_-8px_#0000000A] border-gray-100",...i,children:[e,P.jsxs("div",{className:"flex gap-2 p-4 rounded-lg bg-white",children:[P.jsxs("div",{className:"grow flex flex-col items-start justify-center",children:[s,c]}),P.jsx("div",{className:"shrink flex items-end justify-end",children:t})]})]}),A0=Object.freeze(Object.defineProperty({__proto__:null,Container:w0,SubmitButton:v0,Textarea:Op},Symbol.toStringTag,{value:"Module"})),qo=B.createContext(void 0),Bp=({children:c,isCollapsed:t,onSwitchLayout:e})=>{const[s,i]=B.useState(!1),[n,a]=B.useState(!1),o=t!==void 0?t:s,l=h=>{const d=h??!o;t===void 0&&i(d),e==null||e(d)};return P.jsx(qo.Provider,{value:{isCollapsed:o,toggleCollapsed:l,isHovered:n,setIsHovered:a},children:c})},jp=({className:c,children:t,...e})=>{const{isCollapsed:s,isHovered:i,setIsHovered:n}=B.useContext(qo);return P.jsx("div",{className:ga(c,s&&"shadow-lg",s&&!i?"w-auto":"w-[280px]","bg-gray-50 p-2 flex flex-col justify-between items-center rounded-lg"),onMouseEnter:()=>s&&n(!0),onMouseLeave:()=>s&&n(!1),...e,children:t})},x0=({className:c,children:t,isCollapsed:e,onSwitchLayout:s,...i})=>P.jsx(Bp,{isCollapsed:e,onSwitchLayout:s,children:P.jsx(jp,{className:c,...i,children:t})}),E0=({icon:c,children:t,...e})=>{const{isCollapsed:s,isHovered:i}=B.useContext(qo);return P.jsxs("button",{className:"flex items-center gap-2 w-full hover:bg-gray-100 text-caption-1-em text-gray-600 hover:text-gray-900 h-[38px] rounded-lg px-2",...e,children:[c," ",(!s||i)&&t]})};function _0(c){return P.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c,children:P.jsx("path",{d:"M13 1C14.6569 1 16 2.34315 16 4V12L15.9961 12.1543C15.9158 13.7394 14.6051 15 13 15H3L2.8457 14.9961C1.31166 14.9184 0.0816253 13.6883 0.00390625 12.1543L0 12V4C1.28853e-07 2.34315 1.34315 1 3 1H13ZM3 2.5C2.17157 2.5 1.5 3.17157 1.5 4V12C1.5 12.8284 2.17157 13.5 3 13.5H13C13.8284 13.5 14.5 12.8284 14.5 12V4C14.5 3.17157 13.8284 2.5 13 2.5H3ZM3.75 3.5C4.16421 3.5 4.5 3.83579 4.5 4.25V11.75C4.5 12.1642 4.16421 12.5 3.75 12.5C3.33579 12.5 3 12.1642 3 11.75V4.25C3 3.83579 3.33579 3.5 3.75 3.5Z",fill:"currentColor"})})}function S0(c){return P.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c,children:P.jsx("path",{d:"M13 1C14.6569 1 16 2.34315 16 4V12L15.9961 12.1543C15.9158 13.7394 14.6051 15 13 15H3L2.8457 14.9961C1.31166 14.9184 0.0816253 13.6883 0.00390625 12.1543L0 12V4C1.28853e-07 2.34315 1.34315 1 3 1H13ZM3 2.5C2.17157 2.5 1.5 3.17157 1.5 4V12C1.5 12.8284 2.17157 13.5 3 13.5H13C13.8284 13.5 14.5 12.8284 14.5 12V4C14.5 3.17157 13.8284 2.5 13 2.5H3ZM7.5 4C7.77614 4 8 4.22386 8 4.5V11.5C8 11.7761 7.77614 12 7.5 12H3.5C3.22386 12 3 11.7761 3 11.5V4.5C3 4.22386 3.22386 4 3.5 4H7.5Z",fill:"currentColor"})})}const C0=()=>{const{isCollapsed:c,isHovered:t,toggleCollapsed:e}=B.useContext(qo);return c&&!t?null:P.jsx(lt.IconButton,{variant:"text",color:"gray",onClick:()=>e(),children:c?P.jsx(_0,{className:"size-4"}):P.jsx(S0,{className:"size-4"})})},T0=({children:c,className:t,icon:e,isActive:s,trailing:i,...n})=>{const{isCollapsed:a,isHovered:o}=B.useContext(qo);return P.jsxs("div",{className:ga(s?"!text-gray-900":"!text-gray-600","flex items-center justify-between w-full hover:bg-gray-100 text-caption-1-em hover:text-gray-900 h-[38px] rounded-lg px-2 cursor-pointer group",t),...n,children:[P.jsxs("div",{className:"flex items-center gap-2",children:[e,(!a||o)&&c]}),(!a||o)&&i]})},R0=({children:c,className:t,isActive:e,trailing:s,icon:i,...n})=>{const{isCollapsed:a,isHovered:o}=B.useContext(qo);return P.jsxs("div",{className:ga(e?"!text-gray-900":"!text-gray-600","flex items-center justify-between w-full hover:bg-gray-100 text-caption-1-em hover:text-gray-900 h-[38px] rounded-lg pr-2 pl-3 cursor-pointer group text-sm",t),...n,children:[P.jsxs("div",{className:"flex items-center gap-2 overflow-auto",children:[(!a||o)&&i," ",(!a||o)&&c]}),(!a||o)&&s]})},P0=Object.freeze(Object.defineProperty({__proto__:null,Button:E0,Container:jp,Item:T0,Layout:x0,Provider:Bp,SecondaryItem:R0,ToggleCollapseButton:C0},Symbol.toStringTag,{value:"Module"})),k0=c=>P.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c,children:P.jsx("path",{d:"M12.7197 2.21954C13.0125 1.92683 13.4874 1.92694 13.7803 2.21954C14.073 2.51241 14.073 2.98722 13.7803 3.28008L9.05955 7.99981L13.7803 12.7205L13.832 12.7772C14.0721 13.0717 14.0548 13.5065 13.7803 13.7811C13.5057 14.0555 13.0709 14.0729 12.7764 13.8328L12.7197 13.7811L7.99901 9.06036L3.27928 13.7811C2.9864 14.0737 2.51156 14.0738 2.21873 13.7811C1.92618 13.4882 1.92616 13.0133 2.21873 12.7205L6.93846 7.99981L2.21873 3.28008C1.92615 2.98722 1.92607 2.51235 2.21873 2.21954C2.51154 1.92673 2.98637 1.92691 3.27928 2.21954L7.99901 6.93926L12.7197 2.21954Z",fill:"currentColor"})}),I0=({onClose:c,right:t,children:e})=>P.jsxs("div",{className:"bg-gray-50 flex gap-2 items-center px-2 py-3 rounded-t-xl",children:[P.jsx("div",{className:"grow text-subheader-em",children:e}),P.jsxs("div",{className:"flex items-center gap-4",children:[t,P.jsx(lt.IconButton,{variant:"text",size:"sm",color:"gray",className:"rounded-full",onClick:c,children:P.jsx(k0,{className:"size-4 text-gray-600"})})]})]}),Hp={Header:I0},$p=c=>P.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c,children:P.jsx("path",{d:"M2.25 5.5C2.66421 5.5 3 5.83579 3 6.25C3 6.66421 2.66421 7 2.25 7H2C1.72386 7 1.5 7.22386 1.5 7.5V13.5C1.5 13.7761 1.72386 14 2 14H8C8.27614 14 8.5 13.7761 8.5 13.5V13.25C8.5 12.8358 8.83579 12.5 9.25 12.5C9.66421 12.5 10 12.8358 10 13.25V13.5C10 14.5357 9.21278 15.387 8.2041 15.4893L8 15.5H2L1.7959 15.4893C0.854346 15.3938 0.1062 14.6457 0.0107422 13.7041L0 13.5V7.5C0 6.39543 0.895431 5.5 2 5.5H2.25ZM13.75 0C14.7165 1.28853e-07 15.5 0.783502 15.5 1.75V9.75C15.5 10.7165 14.7165 11.5 13.75 11.5H5.75C4.7835 11.5 4 10.7165 4 9.75V1.75C4 0.783502 4.7835 8.0532e-09 5.75 0H13.75ZM5.75 1.5C5.61193 1.5 5.5 1.61193 5.5 1.75V9.75C5.5 9.88807 5.61193 10 5.75 10H13.75C13.8881 10 14 9.88807 14 9.75V1.75C14 1.61193 13.8881 1.5 13.75 1.5H5.75ZM11.75 3C11.795 3 11.839 3.00413 11.8818 3.01172C11.8874 3.0127 11.8929 3.01354 11.8984 3.01465C11.9118 3.01733 11.9244 3.02298 11.9375 3.02637C11.9707 3.03495 12.0041 3.04344 12.0361 3.05664C12.0653 3.06868 12.092 3.08512 12.1191 3.10059C12.1763 3.1331 12.2316 3.171 12.2803 3.21973C12.3287 3.26812 12.366 3.3232 12.3984 3.37988C12.414 3.40703 12.4303 3.43375 12.4424 3.46289C12.4631 3.51289 12.4779 3.56459 12.4873 3.61719C12.495 3.66035 12.5 3.70462 12.5 3.75V7.75C12.5 8.16421 12.1642 8.5 11.75 8.5C11.3358 8.5 11 8.16421 11 7.75V5.56055L8.28027 8.28027C7.98738 8.57317 7.51262 8.57317 7.21973 8.28027C6.92683 7.98738 6.92683 7.51262 7.21973 7.21973L9.93945 4.5H7.75C7.33579 4.5 7 4.16421 7 3.75C7 3.33579 7.33579 3 7.75 3H11.75Z",fill:"currentColor"})}),zp=(c=100,t=50,e=990,s=10)=>{const[i,n]=B.useState(c);return[i,{...{zoomIn:()=>n(l=>Math.min(l+s,e)),zoomOut:()=>n(l=>Math.max(l-s,t)),reset:()=>n(c),zoomToValue:l=>n(Math.max(t,Math.min(l,e)))},handleWheel:l=>{l.preventDefault();const h=l.deltaY>0?-s:s;n(d=>Math.max(t,Math.min(d+h,e)))}}]},Gp=()=>{const[c,t]=B.useState(0);return[c,{rotateClockwise:()=>t(s=>(s+90)%360),rotateCounterClockwise:()=>t(s=>(s-90+360)%360)}]},Vp=()=>{const[c,t]=B.useState({x:0,y:0}),[e,s]=B.useState(!1),[i,n]=B.useState({x:0,y:0});return[{pan:c,isDragging:e},{handleMouseDown:d=>{s(!0),n({x:d.clientX-c.x,y:d.clientY-c.y})},handleMouseMove:d=>{e&&t({x:d.clientX-i.x,y:d.clientY-i.y})},handleMouseUp:()=>{s(!1)},reset:()=>t({x:0,y:0})}]},Up=(c=0)=>{const[t,e]=B.useState(1),[s,i]=B.useState(c),n={nextPage:B.useCallback(()=>{e(a=>a<s?a+1:a)},[s]),prevPage:B.useCallback(()=>{e(a=>Math.max(a-1,1))},[]),goToPage:B.useCallback(a=>{e(()=>Math.max(1,Math.min(a,s)))},[s]),setTotalPages:B.useCallback(a=>{i(a),e(o=>Math.min(o,a))},[])};return[{currentPage:t,totalPages:s},n]},M0=({className:c,onClose:t,totalPages:e,getImageSrc:s,documentUrl:i,title:n="PDF Viewer"})=>{const[a,o]=zp(),[l,h]=Gp(),[{pan:d,isDragging:u},f]=Vp(),[{currentPage:g},y]=Up(e),v=P.jsx(lt.IconButton,{variant:"text",color:"gray",children:P.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:P.jsx($p,{className:"size-4"})})});return P.jsxs("div",{className:ga("shadow rounded-t-lg flex flex-col h-full",c),children:[P.jsx(Hp.Header,{onClose:t,right:v,children:n}),P.jsx("div",{className:"flex-1 grid",children:P.jsxs("div",{className:"grid relative",children:[P.jsx("div",{className:"overflow-hidden col-start-1 row-start-1 bg-gray-200 h-full relative",onMouseMove:f.handleMouseMove,onMouseUp:f.handleMouseUp,onMouseLeave:f.handleMouseUp,onWheel:o.handleWheel,children:P.jsx("div",{style:{transform:`translate(${d.x}px, ${d.y}px)`,cursor:u?"grabbing":"grab",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},onMouseDown:f.handleMouseDown,children:P.jsx("div",{style:{transform:`scale(${a/100}) rotate(${l}deg)`,transformOrigin:"center",transition:u?"none":"transform 0.3s ease"},children:P.jsx("img",{src:s(g),style:{userSelect:"none",pointerEvents:"none"}})})})}),P.jsxs("div",{className:"col-start-1 row-start-1 self-end p-4 flex gap-2 justify-between w-full z-10",children:[P.jsxs(lt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:o.zoomOut,children:P.jsx(_s.Icon,{icon:"lucide:minus"})}),P.jsx(lt.Tooltip,{content:"Click to reset zoom and pan",children:P.jsxs("button",{className:"!bg-white text-center cursor-pointer w-[60px]",onClick:()=>{o.reset(),f.reset()},children:[a,"%"]})}),P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:o.zoomIn,children:P.jsx(_s.Icon,{icon:"lucide:plus"})})]}),P.jsxs(lt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:h.rotateClockwise,children:P.jsx(_s.Icon,{icon:"lucide:iteration-cw"})}),P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:h.rotateCounterClockwise,children:P.jsx(_s.Icon,{icon:"lucide:iteration-ccw"})})]}),P.jsxs(lt.ButtonGroup,{className:"divide-x-0 ",children:[P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:y.prevPage,disabled:g===1,children:P.jsx(_s.Icon,{icon:"lucide:chevron-left"})}),P.jsx("input",{className:"bg-white pl-4 flex items-center w-[50px] text-center focus:outline-none w-[60px]",value:g,onChange:w=>{const A=parseInt(w.target.value);isNaN(A)||y.goToPage(A)},type:"number",min:"1",max:e}),P.jsxs("div",{className:"flex items-center bg-white px-2",children:["of ",e]}),P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:y.nextPage,disabled:g===e,children:P.jsx(_s.Icon,{icon:"lucide:chevron-right"})})]})]})]})})]})},Be=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),nu=[.001,0,0,.001,0,0],qd=1.35,hs={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},gi={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Wp="pdfjs_internal_editor_",J={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,SIGNATURE:101},rt={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35,DRAW_STEP:41},qp={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},xe={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},_l={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Vt={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},Sa={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},ah={ERRORS:0,WARNINGS:1,INFOS:5},Sl={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},mh={moveTo:0,lineTo:1,curveTo:2,closePath:3},Xp={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Cd=ah.WARNINGS;function L0(c){Number.isInteger(c)&&(Cd=c)}function D0(){return Cd}function Td(c){Cd>=ah.INFOS&&console.log(`Info: ${c}`)}function Z(c){Cd>=ah.WARNINGS&&console.log(`Warning: ${c}`)}function xt(c){throw new Error(c)}function Zt(c,t){c||xt(t)}function N0(c){switch(c==null?void 0:c.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Af(c,t=null,e=null){if(!c)return null;if(e&&typeof c=="string"){if(e.addDefaultProtocol&&c.startsWith("www.")){const i=c.match(/\./g);(i==null?void 0:i.length)>=2&&(c=`http://${c}`)}if(e.tryConvertEncoding)try{c=H0(c)}catch{}}const s=t?URL.parse(c,t):URL.parse(c);return N0(s)?s:null}function xf(c,t,e=!1){const s=URL.parse(c);return s?(s.hash=t,s.href):e&&Af(c,"http://example.com")?c.split("#",1)[0]+`${t?`#${t}`:""}`:""}function it(c,t,e,s=!1){return Object.defineProperty(c,t,{value:e,enumerable:!s,configurable:!0,writable:!1}),e}const va=function(){function t(e,s){this.message=e,this.name=s}return t.prototype=new Error,t.constructor=t,t}();class tp extends va{constructor(t,e){super(t,"PasswordException"),this.code=e}}class Xd extends va{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class Qh extends va{constructor(t){super(t,"InvalidPDFException")}}class Cl extends va{constructor(t,e,s){super(t,"ResponseException"),this.status=e,this.missing=s}}class F0 extends va{constructor(t){super(t,"FormatError")}}class sn extends va{constructor(t){super(t,"AbortException")}}function Yp(c){(typeof c!="object"||(c==null?void 0:c.length)===void 0)&&xt("Invalid argument for bytesToString");const t=c.length,e=8192;if(t<e)return String.fromCharCode.apply(null,c);const s=[];for(let i=0;i<t;i+=e){const n=Math.min(i+e,t),a=c.subarray(i,n);s.push(String.fromCharCode.apply(null,a))}return s.join("")}function oh(c){typeof c!="string"&&xt("Invalid argument for stringToBytes");const t=c.length,e=new Uint8Array(t);for(let s=0;s<t;++s)e[s]=c.charCodeAt(s)&255;return e}function O0(c){return String.fromCharCode(c>>24&255,c>>16&255,c>>8&255,c&255)}function B0(){const c=new Uint8Array(4);return c[0]=1,new Uint32Array(c.buffer,0,1)[0]===1}function j0(){try{return new Function(""),!0}catch{return!1}}class ue{static get isLittleEndian(){return it(this,"isLittleEndian",B0())}static get isEvalSupported(){return it(this,"isEvalSupported",j0())}static get isOffscreenCanvasSupported(){return it(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return it(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:t,userAgent:e}=navigator;return it(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCSSRoundSupported(){var t,e;return it(this,"isCSSRoundSupported",(e=(t=globalThis.CSS)==null?void 0:t.supports)==null?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const Yd=Array.from(Array(256).keys(),c=>c.toString(16).padStart(2,"0"));var tn,Eh,ru;class W{static makeHexColor(t,e,s){return`#${Yd[t]}${Yd[e]}${Yd[s]}`}static scaleMinMax(t,e){let s;t[0]?(t[0]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[3],e[3]*=t[3]):(s=e[0],e[0]=e[1],e[1]=s,s=e[2],e[2]=e[3],e[3]=s,t[1]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e,s=0){const i=t[s],n=t[s+1];t[s]=i*e[0]+n*e[2]+e[4],t[s+1]=i*e[1]+n*e[3]+e[5]}static applyTransformToBezier(t,e,s=0){const i=e[0],n=e[1],a=e[2],o=e[3],l=e[4],h=e[5];for(let d=0;d<6;d+=2){const u=t[s+d],f=t[s+d+1];t[s+d]=u*i+f*a+l,t[s+d+1]=u*n+f*o+h}}static applyInverseTransform(t,e){const s=t[0],i=t[1],n=e[0]*e[3]-e[1]*e[2];t[0]=(s*e[3]-i*e[2]+e[2]*e[5]-e[4]*e[3])/n,t[1]=(-s*e[1]+i*e[0]+e[4]*e[1]-e[5]*e[0])/n}static axialAlignedBoundingBox(t,e,s){const i=e[0],n=e[1],a=e[2],o=e[3],l=e[4],h=e[5],d=t[0],u=t[1],f=t[2],g=t[3];let y=i*d+l,v=y,w=i*f+l,A=w,x=o*u+h,_=x,S=o*g+h,C=S;if(n!==0||a!==0){const R=n*d,T=n*f,k=a*u,I=a*g;y+=k,A+=k,w+=I,v+=I,x+=R,C+=R,S+=T,_+=T}s[0]=Math.min(s[0],y,w,v,A),s[1]=Math.min(s[1],x,S,_,C),s[2]=Math.max(s[2],y,w,v,A),s[3]=Math.max(s[3],x,S,_,C)}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){const s=t[0],i=t[1],n=t[2],a=t[3],o=s**2+i**2,l=s*n+i*a,h=n**2+a**2,d=(o+h)/2,u=Math.sqrt(d**2-(o*h-l**2));e[0]=Math.sqrt(d+u||1),e[1]=Math.sqrt(d-u||1)}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const s=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(s>i)return null;const n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>a?null:[s,n,i,a]}static pointBoundingBox(t,e,s){s[0]=Math.min(s[0],t),s[1]=Math.min(s[1],e),s[2]=Math.max(s[2],t),s[3]=Math.max(s[3],e)}static rectBoundingBox(t,e,s,i,n){n[0]=Math.min(n[0],t,s),n[1]=Math.min(n[1],e,i),n[2]=Math.max(n[2],t,s),n[3]=Math.max(n[3],e,i)}static bezierBoundingBox(t,e,s,i,n,a,o,l,h){h[0]=Math.min(h[0],t,o),h[1]=Math.min(h[1],e,l),h[2]=Math.max(h[2],t,o),h[3]=Math.max(h[3],e,l),b(this,tn,ru).call(this,t,s,n,o,e,i,a,l,3*(-t+3*(s-n)+o),6*(t-2*s+n),3*(s-t),h),b(this,tn,ru).call(this,t,s,n,o,e,i,a,l,3*(-e+3*(i-a)+l),6*(e-2*i+a),3*(i-e),h)}}tn=new WeakSet,Eh=function(t,e,s,i,n,a,o,l,h,d){if(h<=0||h>=1)return;const u=1-h,f=h*h,g=f*h,y=u*(u*(u*t+3*h*e)+3*f*s)+g*i,v=u*(u*(u*n+3*h*a)+3*f*o)+g*l;d[0]=Math.min(d[0],y),d[1]=Math.min(d[1],v),d[2]=Math.max(d[2],y),d[3]=Math.max(d[3],v)},ru=function(t,e,s,i,n,a,o,l,h,d,u,f){if(Math.abs(h)<1e-12){Math.abs(d)>=1e-12&&b(this,tn,Eh).call(this,t,e,s,i,n,a,o,l,-u/d,f);return}const g=d**2-4*u*h;if(g<0)return;const y=Math.sqrt(g),v=2*h;b(this,tn,Eh).call(this,t,e,s,i,n,a,o,l,(-d+y)/v,f),b(this,tn,Eh).call(this,t,e,s,i,n,a,o,l,(-d-y)/v,f)},m(W,tn);function H0(c){return decodeURIComponent(escape(c))}let Kd=null,ep=null;function Kp(c){return Kd||(Kd=/([\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,ep=new Map([["ſt","ſt"]])),c.replaceAll(Kd,(t,e,s)=>e?e.normalize("NFKC"):ep.get(s))}function Ef(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const c=new Uint8Array(32);return crypto.getRandomValues(c),Yp(c)}const _f="pdfjs_internal_id_";function $0(c,t,e){if(!Array.isArray(e)||e.length<2)return!1;const[s,i,...n]=e;if(!c(s)&&!Number.isInteger(s)||!t(i))return!1;const a=n.length;let o=!0;switch(i.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return a===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(a!==4)return!1;o=!1;break;default:return!1}for(const l of n)if(!(typeof l=="number"||o&&l===null))return!1;return!0}function Te(c,t,e){return Math.min(Math.max(c,t),e)}function Jp(c){return Uint8Array.prototype.toBase64?c.toBase64():btoa(Yp(c))}function z0(c){return Uint8Array.fromBase64?Uint8Array.fromBase64(c):oh(atob(c))}typeof Promise.try!="function"&&(Promise.try=function(c,...t){return new Promise(e=>{e(c(...t))})});typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(c){return c.reduce((t,e)=>t+e,0)});const vi="http://www.w3.org/2000/svg",rr=class rr{};L(rr,"CSS",96),L(rr,"PDF",72),L(rr,"PDF_TO_CSS_UNITS",rr.CSS/rr.PDF);let nn=rr;async function Xo(c,t="text"){if(nl(c,document.baseURI)){const e=await fetch(c);if(!e.ok)throw new Error(e.statusText);switch(t){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json()}return e.text()}return new Promise((e,s)=>{const i=new XMLHttpRequest;i.open("GET",c,!0),i.responseType=t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case"arraybuffer":case"blob":case"json":e(i.response);return}e(i.responseText);return}s(new Error(i.statusText))}},i.send(null)})}class lh{constructor({viewBox:t,userUnit:e,scale:s,rotation:i,offsetX:n=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=t,this.userUnit=e,this.scale=s,this.rotation=i,this.offsetX=n,this.offsetY=a,s*=e;const l=(t[2]+t[0])/2,h=(t[3]+t[1])/2;let d,u,f,g;switch(i%=360,i<0&&(i+=360),i){case 180:d=-1,u=0,f=0,g=1;break;case 90:d=0,u=1,f=1,g=0;break;case 270:d=0,u=-1,f=-1,g=0;break;case 0:d=1,u=0,f=0,g=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(f=-f,g=-g);let y,v,w,A;d===0?(y=Math.abs(h-t[1])*s+n,v=Math.abs(l-t[0])*s+a,w=(t[3]-t[1])*s,A=(t[2]-t[0])*s):(y=Math.abs(l-t[0])*s+n,v=Math.abs(h-t[1])*s+a,w=(t[2]-t[0])*s,A=(t[3]-t[1])*s),this.transform=[d*s,u*s,f*s,g*s,y-d*s*l-f*s*h,v-u*s*l-g*s*h],this.width=w,this.height=A}get rawDims(){const t=this.viewBox;return it(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:n=!1}={}){return new lh({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}convertToViewportPoint(t,e){const s=[t,e];return W.applyTransform(s,this.transform),s}convertToViewportRectangle(t){const e=[t[0],t[1]];W.applyTransform(e,this.transform);const s=[t[2],t[3]];return W.applyTransform(s,this.transform),[e[0],e[1],s[0],s[1]]}convertToPdfPoint(t,e){const s=[t,e];return W.applyInverseTransform(s,this.transform),s}}class Rd extends va{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function ch(c){const t=c.length;let e=0;for(;e<t&&c[e].trim()==="";)e++;return c.substring(e,e+5).toLowerCase()==="data:"}function Pd(c){return typeof c=="string"&&/\.pdf$/i.test(c)}function Zp(c){return[c]=c.split(/[#?]/,1),c.substring(c.lastIndexOf("/")+1)}function Qp(c,t="document.pdf"){if(typeof c!="string")return t;if(ch(c))return Z('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const s=(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}}}}})(c);if(!s)return t;const i=o=>{try{let l=decodeURIComponent(o);return l.includes("/")?(l=l.split("/").at(-1),l.test(/^\.pdf$/i)?l:o):l}catch{return o}},n=/\.pdf$/i,a=s.pathname.split("/").at(-1);if(n.test(a))return i(a);if(s.searchParams.size>0){const o=Array.from(s.searchParams.values()).reverse();for(const h of o)if(n.test(h))return i(h);const l=Array.from(s.searchParams.keys()).reverse();for(const h of l)if(n.test(h))return i(h)}if(s.hash){const l=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(s.hash);if(l)return i(l[0])}return t}class sp{constructor(){L(this,"started",Object.create(null));L(this,"times",[])}time(t){t in this.started&&Z(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||Z(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const{name:s}of this.times)e=Math.max(s.length,e);for(const{name:s,start:i,end:n}of this.times)t.push(`${s.padEnd(e)} ${n-i}ms
31
+ `);return t.join("")}}function nl(c,t){const e=t?URL.parse(c,t):URL.parse(c);return(e==null?void 0:e.protocol)==="http:"||(e==null?void 0:e.protocol)==="https:"}function Rs(c){c.preventDefault()}function qt(c){c.preventDefault(),c.stopPropagation()}function G0(c){console.log("Deprecated API usage: "+c)}var Ml;class kd{static toDateObject(t){if(!t||typeof t!="string")return null;r(this,Ml)||p(this,Ml,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=r(this,Ml).exec(t);if(!e)return null;const s=parseInt(e[1],10);let i=parseInt(e[2],10);i=i>=1&&i<=12?i-1:0;let n=parseInt(e[3],10);n=n>=1&&n<=31?n:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;const h=e[7]||"Z";let d=parseInt(e[8],10);d=d>=0&&d<=23?d:0;let u=parseInt(e[9],10)||0;return u=u>=0&&u<=59?u:0,h==="-"?(a+=d,o+=u):h==="+"&&(a-=d,o-=u),new Date(Date.UTC(s,i,n,a,o,l))}}Ml=new WeakMap,m(kd,Ml);function tg(c,{scale:t=1,rotation:e=0}){const{width:s,height:i}=c.attributes.style,n=[0,0,parseInt(s),parseInt(i)];return new lh({viewBox:n,userUnit:1,scale:t,rotation:e})}function Sf(c){if(c.startsWith("#")){const t=parseInt(c.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return c.startsWith("rgb(")?c.slice(4,-1).split(",").map(t=>parseInt(t)):c.startsWith("rgba(")?c.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(Z(`Not a valid color format: "${c}"`),[0,0,0])}function V0(c){const t=document.createElement("span");t.style.visibility="hidden",t.style.colorScheme="only light",document.body.append(t);for(const e of c.keys()){t.style.color=e;const s=window.getComputedStyle(t).color;c.set(e,Sf(s))}t.remove()}function jt(c){const{a:t,b:e,c:s,d:i,e:n,f:a}=c.getTransform();return[t,e,s,i,n,a]}function Ys(c){const{a:t,b:e,c:s,d:i,e:n,f:a}=c.getTransform().invertSelf();return[t,e,s,i,n,a]}function Xn(c,t,e=!1,s=!0){if(t instanceof lh){const{pageWidth:i,pageHeight:n}=t.rawDims,{style:a}=c,o=ue.isCSSRoundSupported,l=`var(--total-scale-factor) * ${i}px`,h=`var(--total-scale-factor) * ${n}px`,d=o?`round(down, ${l}, var(--scale-round-x))`:`calc(${l})`,u=o?`round(down, ${h}, var(--scale-round-y))`:`calc(${h})`;!e||t.rotation%180===0?(a.width=d,a.height=u):(a.width=u,a.height=d)}s&&c.setAttribute("data-main-rotation",t.rotation)}class qs{constructor(){const{pixelRatio:t}=qs;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,s,i,n=-1){let a=1/0,o=1/0,l=1/0;s=qs.capPixels(s,n),s>0&&(a=Math.sqrt(s/(t*e))),i!==-1&&(o=i/t,l=i/e);const h=Math.min(a,o,l);return this.sx>h||this.sy>h?(this.sx=h,this.sy=h,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){const s=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,s):s}return t}}const td=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];var dn,or,bs,un,Ll,Ba,Dl,od,eg,je,sg,ig,rl,_h;const xi=class xi{constructor(t){m(this,je);m(this,dn,null);m(this,or,null);m(this,bs);m(this,un,null);m(this,Ll,null);m(this,Ba,null);p(this,bs,t),r(xi,Dl)||p(xi,Dl,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 t=p(this,dn,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=r(this,bs)._uiManager._signal;t.addEventListener("contextmenu",Rs,{signal:e}),t.addEventListener("pointerdown",b(xi,od,eg),{signal:e});const s=p(this,un,document.createElement("div"));s.className="buttons",t.append(s);const i=r(this,bs).toolbarPosition;if(i){const{style:n}=t,a=r(this,bs)._uiManager.direction==="ltr"?1-i[0]:i[0];n.insetInlineEnd=`${100*a}%`,n.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return r(this,dn)}hide(){var t;r(this,dn).classList.add("hidden"),(t=r(this,or))==null||t.hideDropdown()}show(){var t;r(this,dn).classList.remove("hidden"),(t=r(this,Ll))==null||t.shown()}addDeleteButton(){const{editorType:t,_uiManager:e}=r(this,bs),s=document.createElement("button");s.className="delete",s.tabIndex=0,s.setAttribute("data-l10n-id",r(xi,Dl)[t]),b(this,je,rl).call(this,s),s.addEventListener("click",i=>{e.delete()},{signal:e._signal}),r(this,un).append(s)}async addAltText(t){const e=await t.render();b(this,je,rl).call(this,e),r(this,un).append(e,r(this,je,_h)),p(this,Ll,t)}addColorPicker(t){p(this,or,t);const e=t.renderButton();b(this,je,rl).call(this,e),r(this,un).append(e,r(this,je,_h))}async addEditSignatureButton(t){const e=p(this,Ba,await t.renderEditButton(r(this,bs)));b(this,je,rl).call(this,e),r(this,un).append(e,r(this,je,_h))}async addButton(t,e){switch(t){case"colorPicker":this.addColorPicker(e);break;case"altText":await this.addAltText(e);break;case"editSignature":await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break}}updateEditSignatureButton(t){r(this,Ba)&&(r(this,Ba).title=t)}remove(){var t;r(this,dn).remove(),(t=r(this,or))==null||t.destroy(),p(this,or,null)}};dn=new WeakMap,or=new WeakMap,bs=new WeakMap,un=new WeakMap,Ll=new WeakMap,Ba=new WeakMap,Dl=new WeakMap,od=new WeakSet,eg=function(t){t.stopPropagation()},je=new WeakSet,sg=function(t){r(this,bs)._focusEventsAllowed=!1,qt(t)},ig=function(t){r(this,bs)._focusEventsAllowed=!0,qt(t)},rl=function(t){const e=r(this,bs)._uiManager._signal;t.addEventListener("focusin",b(this,je,sg).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",b(this,je,ig).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Rs,{signal:e})},_h=function(){const t=document.createElement("div");return t.className="divider",t},m(xi,od),m(xi,Dl,null);let au=xi;var Nl,lr,cr,Kn,ng,rg,ag;class U0{constructor(t){m(this,Kn);m(this,Nl,null);m(this,lr,null);m(this,cr);p(this,cr,t)}show(t,e,s){const[i,n]=b(this,Kn,rg).call(this,e,s),{style:a}=r(this,lr)||p(this,lr,b(this,Kn,ng).call(this));t.append(r(this,lr)),a.insetInlineEnd=`${100*i}%`,a.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){r(this,lr).remove()}}Nl=new WeakMap,lr=new WeakMap,cr=new WeakMap,Kn=new WeakSet,ng=function(){const t=p(this,lr,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",Rs,{signal:r(this,cr)._signal});const e=p(this,Nl,document.createElement("div"));return e.className="buttons",t.append(e),b(this,Kn,ag).call(this),t},rg=function(t,e){let s=0,i=0;for(const n of t){const a=n.y+n.height;if(a<s)continue;const o=n.x+(e?n.width:0);if(a>s){i=o,s=a;continue}e?o>i&&(i=o):o<i&&(i=o)}return[e?1-i:i,s]},ag=function(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const s=r(this,cr)._signal;t.addEventListener("contextmenu",Rs,{signal:s}),t.addEventListener("click",()=>{r(this,cr).highlightSelection("floating_button")},{signal:s}),r(this,Nl).append(t)};function og(c,t,e){for(const s of e)t.addEventListener(s,c[s].bind(c))}var ld;class W0{constructor(){m(this,ld,0)}get id(){return`${Wp}${Me(this,ld)._++}`}}ld=new WeakMap;var ja,Fl,_e,Ha,Sh;const Of=class Of{constructor(){m(this,Ha);m(this,ja,Ef());m(this,Fl,0);m(this,_e,null)}static get _isSVGFittingCanvas(){const t='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>',s=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),i=new Image;i.src=t;const n=i.decode().then(()=>(s.drawImage(i,0,0,1,1,0,0,1,3),new Uint32Array(s.getImageData(0,0,1,1).data.buffer)[0]===0));return it(this,"_isSVGFittingCanvas",n)}async getFromFile(t){const{lastModified:e,name:s,size:i,type:n}=t;return b(this,Ha,Sh).call(this,`${e}_${s}_${i}_${n}`,t)}async getFromUrl(t){return b(this,Ha,Sh).call(this,t,t)}async getFromBlob(t,e){const s=await e;return b(this,Ha,Sh).call(this,t,s)}async getFromId(t){r(this,_e)||p(this,_e,new Map);const e=r(this,_e).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){const{blobPromise:s}=e;return delete e.blobPromise,this.getFromBlob(e.id,s)}return this.getFromUrl(e.url)}getFromCanvas(t,e){r(this,_e)||p(this,_e,new Map);let s=r(this,_e).get(t);if(s!=null&&s.bitmap)return s.refCounter+=1,s;const i=new OffscreenCanvas(e.width,e.height);return i.getContext("2d").drawImage(e,0,0),s={bitmap:i.transferToImageBitmap(),id:`image_${r(this,ja)}_${Me(this,Fl)._++}`,refCounter:1,isSvg:!1},r(this,_e).set(t,s),r(this,_e).set(s.id,s),s}getSvgUrl(t){const e=r(this,_e).get(t);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(t){var i;r(this,_e)||p(this,_e,new Map);const e=r(this,_e).get(t);if(!e||(e.refCounter-=1,e.refCounter!==0))return;const{bitmap:s}=e;if(!e.url&&!e.file){const n=new OffscreenCanvas(s.width,s.height);n.getContext("bitmaprenderer").transferFromImageBitmap(s),e.blobPromise=n.convertToBlob()}(i=s.close)==null||i.call(s),e.bitmap=null}isValidId(t){return t.startsWith(`image_${r(this,ja)}_`)}};ja=new WeakMap,Fl=new WeakMap,_e=new WeakMap,Ha=new WeakSet,Sh=async function(t,e){r(this,_e)||p(this,_e,new Map);let s=r(this,_e).get(t);if(s===null)return null;if(s!=null&&s.bitmap)return s.refCounter+=1,s;try{s||(s={bitmap:null,id:`image_${r(this,ja)}_${Me(this,Fl)._++}`,refCounter:0,isSvg:!1});let i;if(typeof e=="string"?(s.url=e,i=await Xo(e,"blob")):e instanceof File?i=s.file=e:e instanceof Blob&&(i=e),i.type==="image/svg+xml"){const n=Of._isSVGFittingCanvas,a=new FileReader,o=new Image,l=new Promise((h,d)=>{o.onload=()=>{s.bitmap=o,s.isSvg=!0,h()},a.onload=async()=>{const u=s.svgUrl=a.result;o.src=await n?`${u}#svgView(preserveAspectRatio(none))`:u},o.onerror=a.onerror=d});a.readAsDataURL(i),await l}else s.bitmap=await createImageBitmap(i);s.refCounter=1}catch(i){Z(i),s=null}return r(this,_e).set(t,s),s&&r(this,_e).set(s.id,s),s};let ou=Of;var Ut,fn,Ol,Bt;class q0{constructor(t=128){m(this,Ut,[]);m(this,fn,!1);m(this,Ol);m(this,Bt,-1);p(this,Ol,t)}add({cmd:t,undo:e,post:s,mustExec:i,type:n=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(i&&t(),r(this,fn))return;const l={cmd:t,undo:e,post:s,type:n};if(r(this,Bt)===-1){r(this,Ut).length>0&&(r(this,Ut).length=0),p(this,Bt,0),r(this,Ut).push(l);return}if(a&&r(this,Ut)[r(this,Bt)].type===n){o&&(l.undo=r(this,Ut)[r(this,Bt)].undo),r(this,Ut)[r(this,Bt)]=l;return}const h=r(this,Bt)+1;h===r(this,Ol)?r(this,Ut).splice(0,1):(p(this,Bt,h),h<r(this,Ut).length&&r(this,Ut).splice(h)),r(this,Ut).push(l)}undo(){if(r(this,Bt)===-1)return;p(this,fn,!0);const{undo:t,post:e}=r(this,Ut)[r(this,Bt)];t(),e==null||e(),p(this,fn,!1),p(this,Bt,r(this,Bt)-1)}redo(){if(r(this,Bt)<r(this,Ut).length-1){p(this,Bt,r(this,Bt)+1),p(this,fn,!0);const{cmd:t,post:e}=r(this,Ut)[r(this,Bt)];t(),e==null||e(),p(this,fn,!1)}}hasSomethingToUndo(){return r(this,Bt)!==-1}hasSomethingToRedo(){return r(this,Bt)<r(this,Ut).length-1}cleanType(t){if(r(this,Bt)!==-1){for(let e=r(this,Bt);e>=0;e--)if(r(this,Ut)[e].type!==t){r(this,Ut).splice(e+1,r(this,Bt)-e),p(this,Bt,e);return}r(this,Ut).length=0,p(this,Bt,-1)}}destroy(){p(this,Ut,null)}}Ut=new WeakMap,fn=new WeakMap,Ol=new WeakMap,Bt=new WeakMap;var cd,lg;class hh{constructor(t){m(this,cd);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=ue.platform;for(const[s,i,n={}]of t)for(const a of s){const o=a.startsWith("mac+");e&&o?(this.callbacks.set(a.slice(4),{callback:i,options:n}),this.allKeys.add(a.split("+").at(-1))):!e&&!o&&(this.callbacks.set(a,{callback:i,options:n}),this.allKeys.add(a.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const s=this.callbacks.get(b(this,cd,lg).call(this,e));if(!s)return;const{callback:i,options:{bubbles:n=!1,args:a=[],checker:o=null}}=s;o&&!o(t,e)||(i.bind(t,...a,e)(),n||qt(e))}}cd=new WeakSet,lg=function(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e};const hd=class hd{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return V0(t),it(this,"_colors",t)}convert(t){const e=Sf(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[s,i]of this._colors)if(i.every((n,a)=>n===e[a]))return hd._colorsMapping.get(s);return e}getHexCode(t){const e=this._colors.get(t);return e?W.makeHexColor(...e):t}};L(hd,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let lu=hd;var $a,Ke,se,fe,za,_i,Ga,ys,pn,gn,Va,hr,Zs,Ds,dr,Bl,jl,Ua,Hl,Qs,mn,Wa,bn,ti,dd,yn,$l,vn,ur,fr,wn,zl,re,bt,Si,An,pr,Gl,Vl,xn,ei,Ci,Ul,Wl,vs,j,Ch,cu,cg,hg,Th,dg,ug,fg,hu,pg,du,uu,gg,Le,wi,mg,bg,fu,yg,al,pu;const La=class La{constructor(t,e,s,i,n,a,o,l,h,d,u,f,g,y,v){m(this,j);m(this,$a,new AbortController);m(this,Ke,null);m(this,se,new Map);m(this,fe,new Map);m(this,za,null);m(this,_i,null);m(this,Ga,null);m(this,ys,new q0);m(this,pn,null);m(this,gn,null);m(this,Va,0);m(this,hr,new Set);m(this,Zs,null);m(this,Ds,null);m(this,dr,new Set);L(this,"_editorUndoBar",null);m(this,Bl,!1);m(this,jl,!1);m(this,Ua,!1);m(this,Hl,null);m(this,Qs,null);m(this,mn,null);m(this,Wa,null);m(this,bn,!1);m(this,ti,null);m(this,dd,new W0);m(this,yn,!1);m(this,$l,!1);m(this,vn,null);m(this,ur,null);m(this,fr,null);m(this,wn,null);m(this,zl,null);m(this,re,J.NONE);m(this,bt,new Set);m(this,Si,null);m(this,An,null);m(this,pr,null);m(this,Gl,null);m(this,Vl,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});m(this,xn,[0,0]);m(this,ei,null);m(this,Ci,null);m(this,Ul,null);m(this,Wl,null);m(this,vs,null);const w=this._signal=r(this,$a).signal;p(this,Ci,t),p(this,Ul,e),p(this,Wl,s),p(this,za,i),p(this,An,n),this._eventBus=a,a._on("editingaction",this.onEditingAction.bind(this),{signal:w}),a._on("pagechanging",this.onPageChanging.bind(this),{signal:w}),a._on("scalechanging",this.onScaleChanging.bind(this),{signal:w}),a._on("rotationchanging",this.onRotationChanging.bind(this),{signal:w}),a._on("setpreference",this.onSetPreference.bind(this),{signal:w}),a._on("switchannotationeditorparams",A=>this.updateParams(A.type,A.value),{signal:w}),b(this,j,dg).call(this),b(this,j,gg).call(this),b(this,j,hu).call(this),p(this,_i,o.annotationStorage),p(this,Hl,o.filterFactory),p(this,pr,l),p(this,Wa,h||null),p(this,Bl,d),p(this,jl,u),p(this,Ua,f),p(this,zl,g||null),this.viewParameters={realScale:nn.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=y||null,this._supportsPinchToZoom=v!==!1}static get _keyboardManager(){const t=La.prototype,e=a=>r(a,Ci).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),s=(a,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},i=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return it(this,"_keyboardManager",new hh([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:s}],[["ctrl+z","mac+meta+z"],t.undo,{checker:s}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:s}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:s}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,Ci).contains(o)&&!a.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,Ci).contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}destroy(){var t,e,s,i,n,a,o,l;(t=r(this,vs))==null||t.resolve(),p(this,vs,null),(e=r(this,$a))==null||e.abort(),p(this,$a,null),this._signal=null;for(const h of r(this,fe).values())h.destroy();r(this,fe).clear(),r(this,se).clear(),r(this,dr).clear(),(s=r(this,wn))==null||s.clear(),p(this,Ke,null),r(this,bt).clear(),r(this,ys).destroy(),(i=r(this,za))==null||i.destroy(),(n=r(this,An))==null||n.destroy(),(a=r(this,ti))==null||a.hide(),p(this,ti,null),(o=r(this,fr))==null||o.destroy(),p(this,fr,null),r(this,Qs)&&(clearTimeout(r(this,Qs)),p(this,Qs,null)),r(this,ei)&&(clearTimeout(r(this,ei)),p(this,ei,null)),(l=this._editorUndoBar)==null||l.destroy()}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return r(this,zl)}get useNewAltTextFlow(){return r(this,jl)}get useNewAltTextWhenAddingImage(){return r(this,Ua)}get hcmFilter(){return it(this,"hcmFilter",r(this,pr)?r(this,Hl).addHCMFilter(r(this,pr).foreground,r(this,pr).background):"none")}get direction(){return it(this,"direction",getComputedStyle(r(this,Ci)).direction)}get highlightColors(){return it(this,"highlightColors",r(this,Wa)?new Map(r(this,Wa).split(",").map(t=>(t=t.split("=").map(e=>e.trim()),t[1]=t[1].toUpperCase(),t))):null)}get highlightColorNames(){return it(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),p(this,gn,t)}setMainHighlightColorPicker(t){p(this,fr,t)}editAltText(t,e=!1){var s;(s=r(this,za))==null||s.editAltText(this,t,e)}getSignature(t){var e;(e=r(this,An))==null||e.getSignature({uiManager:this,editor:t})}get signatureManager(){return r(this,An)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference({name:t,value:e}){switch(t){case"enableNewAltTextWhenAddingImage":p(this,Ua,e);break}}onPageChanging({pageNumber:t}){p(this,Va,t-1)}focusMainContainer(){r(this,Ci).focus()}findParent(t,e){for(const s of r(this,fe).values()){const{x:i,y:n,width:a,height:o}=s.div.getBoundingClientRect();if(t>=i&&t<=i+a&&e>=n&&e<=n+o)return s}return null}disableUserSelect(t=!1){r(this,Ul).classList.toggle("noUserSelect",t)}addShouldRescale(t){r(this,dr).add(t)}removeShouldRescale(t){r(this,dr).delete(t)}onScaleChanging({scale:t}){var e;this.commitOrRemove(),this.viewParameters.realScale=t*nn.PDF_TO_CSS_UNITS;for(const s of r(this,dr))s.onScaleChanging();(e=r(this,gn))==null||e.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}highlightSelection(t=""){const e=document.getSelection();if(!e||e.isCollapsed)return;const{anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:a}=e,o=e.toString(),h=b(this,j,Ch).call(this,e).closest(".textLayer"),d=this.getSelectionBoxes(h);if(!d)return;e.empty();const u=b(this,j,cu).call(this,h),f=r(this,re)===J.NONE,g=()=>{u==null||u.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:d,anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:a,text:o}),f&&this.showAllEditors("highlight",!0,!0)};if(f){this.switchToMode(J.HIGHLIGHT,g);return}g()}addToAnnotationStorage(t){!t.isEmpty()&&r(this,_i)&&!r(this,_i).has(t.id)&&r(this,_i).setValue(t.id,t)}a11yAlert(t,e=null){const s=r(this,Wl);s&&(s.setAttribute("data-l10n-id",t),e?s.setAttribute("data-l10n-args",JSON.stringify(e)):s.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,r(this,bn)&&(p(this,bn,!1),b(this,j,Th).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of r(this,bt))if(e.div.contains(t)){p(this,ur,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!r(this,ur))return;const[t,e]=r(this,ur);p(this,ur,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){b(this,j,hu).call(this),b(this,j,du).call(this)}removeEditListeners(){b(this,j,pg).call(this),b(this,j,uu).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const s of r(this,Ds))if(s.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const e of t.dataTransfer.items)for(const s of r(this,Ds))if(s.isHandlingMimeForPasting(e.type)){s.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){var s;if(t.preventDefault(),(s=r(this,Ke))==null||s.commitOrRemove(),!this.hasSelection)return;const e=[];for(const i of r(this,bt)){const n=i.serialize(!0);n&&e.push(n)}e.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();const{clipboardData:e}=t;for(const n of e.items)for(const a of r(this,Ds))if(a.isHandlingMimeForPasting(n.type)){a.paste(n,this.currentLayer);return}let s=e.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(n){Z(`paste: "${n.message}".`);return}if(!Array.isArray(s))return;this.unselectAll();const i=this.currentLayer;try{const n=[];for(const l of s){const h=await i.deserialize(l);if(!h)return;n.push(h)}const a=()=>{for(const l of n)b(this,j,fu).call(this,l);b(this,j,pu).call(this,n)},o=()=>{for(const l of n)l.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(n){Z(`paste: "${n.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),r(this,re)!==J.NONE&&!this.isEditorHandlingKeyboard&&La._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,r(this,bn)&&(p(this,bn,!1),b(this,j,Th).call(this,"main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(t){t?(b(this,j,ug).call(this),b(this,j,du).call(this),b(this,j,Le).call(this,{isEditing:r(this,re)!==J.NONE,isEmpty:b(this,j,al).call(this),hasSomethingToUndo:r(this,ys).hasSomethingToUndo(),hasSomethingToRedo:r(this,ys).hasSomethingToRedo(),hasSelectedEditor:!1})):(b(this,j,fg).call(this),b(this,j,uu).call(this),b(this,j,Le).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!r(this,Ds)){p(this,Ds,t);for(const e of r(this,Ds))b(this,j,wi).call(this,e.defaultPropertiesToUpdate)}}getId(){return r(this,dd).id}get currentLayer(){return r(this,fe).get(r(this,Va))}getLayer(t){return r(this,fe).get(t)}get currentPageIndex(){return r(this,Va)}addLayer(t){r(this,fe).set(t.pageIndex,t),r(this,yn)?t.enable():t.disable()}removeLayer(t){r(this,fe).delete(t.pageIndex)}async updateMode(t,e=null,s=!1,i=!1){var n,a,o;if(r(this,re)!==t&&!(r(this,vs)&&(await r(this,vs).promise,!r(this,vs)))){if(p(this,vs,Promise.withResolvers()),(n=r(this,gn))==null||n.commitOrRemove(),p(this,re,t),t===J.NONE){this.setEditingState(!1),b(this,j,bg).call(this),(a=this._editorUndoBar)==null||a.hide(),r(this,vs).resolve();return}t===J.SIGNATURE&&await((o=r(this,An))==null?void 0:o.loadSignatures()),this.setEditingState(!0),await b(this,j,mg).call(this),this.unselectAll();for(const l of r(this,fe).values())l.updateMode(t);if(!e){s&&this.addNewEditorFromKeyboard(),r(this,vs).resolve();return}for(const l of r(this,se).values())l.annotationElementId===e||l.id===e?(this.setSelected(l),i&&l.enterInEditMode()):l.unselect();r(this,vs).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==r(this,re)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){var s;if(r(this,Ds)){switch(t){case rt.CREATE:this.currentLayer.addNewEditor(e);return;case rt.HIGHLIGHT_DEFAULT_COLOR:(s=r(this,fr))==null||s.updateColor(e);break;case rt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(r(this,Gl)||p(this,Gl,new Map)).set(t,e),this.showAllEditors("highlight",e);break}for(const i of r(this,bt))i.updateParams(t,e);for(const i of r(this,Ds))i.updateDefaultParams(t,e)}}showAllEditors(t,e,s=!1){var n;for(const a of r(this,se).values())a.editorType===t&&a.show(e);(((n=r(this,Gl))==null?void 0:n.get(rt.HIGHLIGHT_SHOW_ALL))??!0)!==e&&b(this,j,wi).call(this,[[rt.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(r(this,$l)!==t){p(this,$l,t);for(const e of r(this,fe).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}getEditors(t){const e=[];for(const s of r(this,se).values())s.pageIndex===t&&e.push(s);return e}getEditor(t){return r(this,se).get(t)}addEditor(t){r(this,se).set(t.id,t)}removeEditor(t){var e,s;t.div.contains(document.activeElement)&&(r(this,Qs)&&clearTimeout(r(this,Qs)),p(this,Qs,setTimeout(()=>{this.focusMainContainer(),p(this,Qs,null)},0))),r(this,se).delete(t.id),t.annotationElementId&&((e=r(this,wn))==null||e.delete(t.annotationElementId)),this.unselect(t),(!t.annotationElementId||!r(this,hr).has(t.annotationElementId))&&((s=r(this,_i))==null||s.remove(t.id))}addDeletedAnnotationElement(t){r(this,hr).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return r(this,hr).has(t)}removeDeletedAnnotationElement(t){r(this,hr).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){r(this,Ke)!==t&&(p(this,Ke,t),t&&b(this,j,wi).call(this,t.propertiesToUpdate))}updateUI(t){r(this,j,yg)===t&&b(this,j,wi).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){b(this,j,wi).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if(r(this,bt).has(t)){r(this,bt).delete(t),t.unselect(),b(this,j,Le).call(this,{hasSelectedEditor:this.hasSelection});return}r(this,bt).add(t),t.select(),b(this,j,wi).call(this,t.propertiesToUpdate),b(this,j,Le).call(this,{hasSelectedEditor:!0})}setSelected(t){var e;this.updateToolbar({mode:t.mode,editId:t.id}),(e=r(this,gn))==null||e.commitOrRemove();for(const s of r(this,bt))s!==t&&s.unselect();r(this,bt).clear(),r(this,bt).add(t),t.select(),b(this,j,wi).call(this,t.propertiesToUpdate),b(this,j,Le).call(this,{hasSelectedEditor:!0})}isSelected(t){return r(this,bt).has(t)}get firstSelectedEditor(){return r(this,bt).values().next().value}unselect(t){t.unselect(),r(this,bt).delete(t),b(this,j,Le).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return r(this,bt).size!==0}get isEnterHandled(){return r(this,bt).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var t;r(this,ys).undo(),b(this,j,Le).call(this,{hasSomethingToUndo:r(this,ys).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:b(this,j,al).call(this)}),(t=this._editorUndoBar)==null||t.hide()}redo(){r(this,ys).redo(),b(this,j,Le).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:r(this,ys).hasSomethingToRedo(),isEmpty:b(this,j,al).call(this)})}addCommands(t){r(this,ys).add(t),b(this,j,Le).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:b(this,j,al).call(this)})}cleanUndoStack(t){r(this,ys).cleanType(t)}delete(){var n;this.commitOrRemove();const t=(n=this.currentLayer)==null?void 0:n.endDrawingSession(!0);if(!this.hasSelection&&!t)return;const e=t?[t]:[...r(this,bt)],s=()=>{var a;(a=this._editorUndoBar)==null||a.show(i,e.length===1?e[0].editorType:e.length);for(const o of e)o.remove()},i=()=>{for(const a of e)b(this,j,fu).call(this,a)};this.addCommands({cmd:s,undo:i,mustExec:!0})}commitOrRemove(){var t;(t=r(this,Ke))==null||t.commitOrRemove()}hasSomethingToControl(){return r(this,Ke)||this.hasSelection}selectAll(){for(const t of r(this,bt))t.commit();b(this,j,pu).call(this,r(this,se).values())}unselectAll(){var t;if(!(r(this,Ke)&&(r(this,Ke).commitOrRemove(),r(this,re)!==J.NONE))&&!((t=r(this,gn))!=null&&t.commitOrRemove())&&this.hasSelection){for(const e of r(this,bt))e.unselect();r(this,bt).clear(),b(this,j,Le).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;r(this,xn)[0]+=t,r(this,xn)[1]+=e;const[i,n]=r(this,xn),a=[...r(this,bt)],o=1e3;r(this,ei)&&clearTimeout(r(this,ei)),p(this,ei,setTimeout(()=>{p(this,ei,null),r(this,xn)[0]=r(this,xn)[1]=0,this.addCommands({cmd:()=>{for(const l of a)r(this,se).has(l.id)&&(l.translateInPage(i,n),l.translationDone())},undo:()=>{for(const l of a)r(this,se).has(l.id)&&(l.translateInPage(-i,-n),l.translationDone())},mustExec:!1})},o));for(const l of a)l.translateInPage(t,e),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),p(this,Zs,new Map);for(const t of r(this,bt))r(this,Zs).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!r(this,Zs))return!1;this.disableUserSelect(!1);const t=r(this,Zs);p(this,Zs,null);let e=!1;for(const[{x:i,y:n,pageIndex:a},o]of t)o.newX=i,o.newY=n,o.newPageIndex=a,e||(e=i!==o.savedX||n!==o.savedY||a!==o.savedPageIndex);if(!e)return!1;const s=(i,n,a,o)=>{if(r(this,se).has(i.id)){const l=r(this,fe).get(o);l?i._setParentAndPosition(l,n,a):(i.pageIndex=o,i.x=n,i.y=a)}};return this.addCommands({cmd:()=>{for(const[i,{newX:n,newY:a,newPageIndex:o}]of t)s(i,n,a,o)},undo:()=>{for(const[i,{savedX:n,savedY:a,savedPageIndex:o}]of t)s(i,n,a,o)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(r(this,Zs))for(const s of r(this,Zs).keys())s.drag(t,e)}rebuild(t){if(t.parent===null){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){var t;return((t=this.getActive())==null?void 0:t.shouldGetKeyboardEvents())||r(this,bt).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return r(this,Ke)===t}getActive(){return r(this,Ke)}getMode(){return r(this,re)}get imageManager(){return it(this,"imageManager",new ou)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let h=0,d=e.rangeCount;h<d;h++)if(!t.contains(e.getRangeAt(h).commonAncestorContainer))return null;const{x:s,y:i,width:n,height:a}=t.getBoundingClientRect();let o;switch(t.getAttribute("data-main-rotation")){case"90":o=(h,d,u,f)=>({x:(d-i)/a,y:1-(h+u-s)/n,width:f/a,height:u/n});break;case"180":o=(h,d,u,f)=>({x:1-(h+u-s)/n,y:1-(d+f-i)/a,width:u/n,height:f/a});break;case"270":o=(h,d,u,f)=>({x:1-(d+f-i)/a,y:(h-s)/n,width:f/a,height:u/n});break;default:o=(h,d,u,f)=>({x:(h-s)/n,y:(d-i)/a,width:u/n,height:f/a});break}const l=[];for(let h=0,d=e.rangeCount;h<d;h++){const u=e.getRangeAt(h);if(!u.collapsed)for(const{x:f,y:g,width:y,height:v}of u.getClientRects())y===0||v===0||l.push(o(f,g,y,v))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:t,id:e}){(r(this,Ga)||p(this,Ga,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){var e;(e=r(this,Ga))==null||e.delete(t)}renderAnnotationElement(t){var i;const e=(i=r(this,Ga))==null?void 0:i.get(t.data.id);if(!e)return;const s=r(this,_i).getRawValue(e);s&&(r(this,re)===J.NONE&&!s.hasBeenModified||s.renderAnnotationElement(t))}setMissingCanvas(t,e,s){var n;const i=(n=r(this,wn))==null?void 0:n.get(t);i&&(i.setCanvas(e,s),r(this,wn).delete(t))}addMissingCanvas(t,e){(r(this,wn)||p(this,wn,new Map)).set(t,e)}};$a=new WeakMap,Ke=new WeakMap,se=new WeakMap,fe=new WeakMap,za=new WeakMap,_i=new WeakMap,Ga=new WeakMap,ys=new WeakMap,pn=new WeakMap,gn=new WeakMap,Va=new WeakMap,hr=new WeakMap,Zs=new WeakMap,Ds=new WeakMap,dr=new WeakMap,Bl=new WeakMap,jl=new WeakMap,Ua=new WeakMap,Hl=new WeakMap,Qs=new WeakMap,mn=new WeakMap,Wa=new WeakMap,bn=new WeakMap,ti=new WeakMap,dd=new WeakMap,yn=new WeakMap,$l=new WeakMap,vn=new WeakMap,ur=new WeakMap,fr=new WeakMap,wn=new WeakMap,zl=new WeakMap,re=new WeakMap,bt=new WeakMap,Si=new WeakMap,An=new WeakMap,pr=new WeakMap,Gl=new WeakMap,Vl=new WeakMap,xn=new WeakMap,ei=new WeakMap,Ci=new WeakMap,Ul=new WeakMap,Wl=new WeakMap,vs=new WeakMap,j=new WeakSet,Ch=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},cu=function(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const s of r(this,fe).values())if(s.hasTextLayer(t))return s;return null},cg=function(){const t=document.getSelection();if(!t||t.isCollapsed)return;const s=b(this,j,Ch).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(s);i&&(r(this,ti)||p(this,ti,new U0(this)),r(this,ti).show(s,i,this.direction==="ltr"))},hg=function(){var n,a,o;const t=document.getSelection();if(!t||t.isCollapsed){r(this,Si)&&((n=r(this,ti))==null||n.hide(),p(this,Si,null),b(this,j,Le).call(this,{hasSelectedText:!1}));return}const{anchorNode:e}=t;if(e===r(this,Si))return;const i=b(this,j,Ch).call(this,t).closest(".textLayer");if(!i){r(this,Si)&&((a=r(this,ti))==null||a.hide(),p(this,Si,null),b(this,j,Le).call(this,{hasSelectedText:!1}));return}if((o=r(this,ti))==null||o.hide(),p(this,Si,e),b(this,j,Le).call(this,{hasSelectedText:!0}),!(r(this,re)!==J.HIGHLIGHT&&r(this,re)!==J.NONE)&&(r(this,re)===J.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),p(this,bn,this.isShiftKeyDown),!this.isShiftKeyDown)){const l=r(this,re)===J.HIGHLIGHT?b(this,j,cu).call(this,i):null;l==null||l.toggleDrawing();const h=new AbortController,d=this.combinedSignal(h),u=f=>{f.type==="pointerup"&&f.button!==0||(h.abort(),l==null||l.toggleDrawing(!0),f.type==="pointerup"&&b(this,j,Th).call(this,"main_toolbar"))};window.addEventListener("pointerup",u,{signal:d}),window.addEventListener("blur",u,{signal:d})}},Th=function(t=""){r(this,re)===J.HIGHLIGHT?this.highlightSelection(t):r(this,Bl)&&b(this,j,cg).call(this)},dg=function(){document.addEventListener("selectionchange",b(this,j,hg).bind(this),{signal:this._signal})},ug=function(){if(r(this,mn))return;p(this,mn,new AbortController);const t=this.combinedSignal(r(this,mn));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},fg=function(){var t;(t=r(this,mn))==null||t.abort(),p(this,mn,null)},hu=function(){if(r(this,vn))return;p(this,vn,new AbortController);const t=this.combinedSignal(r(this,vn));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},pg=function(){var t;(t=r(this,vn))==null||t.abort(),p(this,vn,null)},du=function(){if(r(this,pn))return;p(this,pn,new AbortController);const t=this.combinedSignal(r(this,pn));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})},uu=function(){var t;(t=r(this,pn))==null||t.abort(),p(this,pn,null)},gg=function(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},Le=function(t){Object.entries(t).some(([s,i])=>r(this,Vl)[s]!==i)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(r(this,Vl),t)}),r(this,re)===J.HIGHLIGHT&&t.hasSelectedEditor===!1&&b(this,j,wi).call(this,[[rt.HIGHLIGHT_FREE,!0]]))},wi=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},mg=async function(){if(!r(this,yn)){p(this,yn,!0);const t=[];for(const e of r(this,fe).values())t.push(e.enable());await Promise.all(t);for(const e of r(this,se).values())e.enable()}},bg=function(){if(this.unselectAll(),r(this,yn)){p(this,yn,!1);for(const t of r(this,fe).values())t.disable();for(const t of r(this,se).values())t.disable()}},fu=function(t){const e=r(this,fe).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},yg=function(){let t=null;for(t of r(this,bt));return t},al=function(){if(r(this,se).size===0)return!0;if(r(this,se).size===1)for(const t of r(this,se).values())return t.isEmpty();return!1},pu=function(t){for(const e of r(this,bt))e.unselect();r(this,bt).clear();for(const e of t)e.isEmpty()||(r(this,bt).add(e),e.select());b(this,j,Le).call(this,{hasSelectedEditor:this.hasSelection})},L(La,"TRANSLATE_SMALL",1),L(La,"TRANSLATE_BIG",10);let Yn=La;var ae,si,Ns,qa,ii,Je,Xa,ni,Ue,Ti,gr,ri,En,Ws,ol,Rh;const De=class De{constructor(t){m(this,Ws);m(this,ae,null);m(this,si,!1);m(this,Ns,null);m(this,qa,null);m(this,ii,null);m(this,Je,null);m(this,Xa,!1);m(this,ni,null);m(this,Ue,null);m(this,Ti,null);m(this,gr,null);m(this,ri,!1);p(this,Ue,t),p(this,ri,t._uiManager.useNewAltTextFlow),r(De,En)||p(De,En,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(t){De._l10n??(De._l10n=t)}async render(){const t=p(this,Ns,document.createElement("button"));t.className="altText",t.tabIndex="0";const e=p(this,qa,document.createElement("span"));t.append(e),r(this,ri)?(t.classList.add("new"),t.setAttribute("data-l10n-id",r(De,En).missing),e.setAttribute("data-l10n-id",r(De,En)["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const s=r(this,Ue)._uiManager._signal;t.addEventListener("contextmenu",Rs,{signal:s}),t.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:s});const i=n=>{n.preventDefault(),r(this,Ue)._uiManager.editAltText(r(this,Ue)),r(this,ri)&&r(this,Ue)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:r(this,Ws,ol)}})};return t.addEventListener("click",i,{capture:!0,signal:s}),t.addEventListener("keydown",n=>{n.target===t&&n.key==="Enter"&&(p(this,Xa,!0),i(n))},{signal:s}),await b(this,Ws,Rh).call(this),t}finish(){r(this,Ns)&&(r(this,Ns).focus({focusVisible:r(this,Xa)}),p(this,Xa,!1))}isEmpty(){return r(this,ri)?r(this,ae)===null:!r(this,ae)&&!r(this,si)}hasData(){return r(this,ri)?r(this,ae)!==null||!!r(this,Ti):this.isEmpty()}get guessedText(){return r(this,Ti)}async setGuessedText(t){r(this,ae)===null&&(p(this,Ti,t),p(this,gr,await De._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),b(this,Ws,Rh).call(this))}toggleAltTextBadge(t=!1){var e;if(!r(this,ri)||r(this,ae)){(e=r(this,ni))==null||e.remove(),p(this,ni,null);return}if(!r(this,ni)){const s=p(this,ni,document.createElement("div"));s.className="noAltTextBadge",r(this,Ue).div.append(s)}r(this,ni).classList.toggle("hidden",!t)}serialize(t){let e=r(this,ae);return!t&&r(this,Ti)===e&&(e=r(this,gr)),{altText:e,decorative:r(this,si),guessedText:r(this,Ti),textWithDisclaimer:r(this,gr)}}get data(){return{altText:r(this,ae),decorative:r(this,si)}}set data({altText:t,decorative:e,guessedText:s,textWithDisclaimer:i,cancel:n=!1}){s&&(p(this,Ti,s),p(this,gr,i)),!(r(this,ae)===t&&r(this,si)===e)&&(n||(p(this,ae,t),p(this,si,e)),b(this,Ws,Rh).call(this))}toggle(t=!1){r(this,Ns)&&(!t&&r(this,Je)&&(clearTimeout(r(this,Je)),p(this,Je,null)),r(this,Ns).disabled=!t)}shown(){r(this,Ue)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:r(this,Ws,ol)}})}destroy(){var t,e;(t=r(this,Ns))==null||t.remove(),p(this,Ns,null),p(this,qa,null),p(this,ii,null),(e=r(this,ni))==null||e.remove(),p(this,ni,null)}};ae=new WeakMap,si=new WeakMap,Ns=new WeakMap,qa=new WeakMap,ii=new WeakMap,Je=new WeakMap,Xa=new WeakMap,ni=new WeakMap,Ue=new WeakMap,Ti=new WeakMap,gr=new WeakMap,ri=new WeakMap,En=new WeakMap,Ws=new WeakSet,ol=function(){return r(this,ae)&&"added"||r(this,ae)===null&&this.guessedText&&"review"||"missing"},Rh=async function(){var i,n,a;const t=r(this,Ns);if(!t)return;if(r(this,ri)){if(t.classList.toggle("done",!!r(this,ae)),t.setAttribute("data-l10n-id",r(De,En)[r(this,Ws,ol)]),(i=r(this,qa))==null||i.setAttribute("data-l10n-id",r(De,En)[`${r(this,Ws,ol)}-label`]),!r(this,ae)){(n=r(this,ii))==null||n.remove();return}}else{if(!r(this,ae)&&!r(this,si)){t.classList.remove("done"),(a=r(this,ii))==null||a.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=r(this,ii);if(!e){p(this,ii,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${r(this,Ue).id}`;const o=100,l=r(this,Ue)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(r(this,Je)),p(this,Je,null)},{once:!0}),t.addEventListener("mouseenter",()=>{p(this,Je,setTimeout(()=>{p(this,Je,null),r(this,ii).classList.add("show"),r(this,Ue)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:l}),t.addEventListener("mouseleave",()=>{var h;r(this,Je)&&(clearTimeout(r(this,Je)),p(this,Je,null)),(h=r(this,ii))==null||h.classList.remove("show")},{signal:l})}r(this,si)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=r(this,ae)),e.parentNode||t.append(e);const s=r(this,Ue).getElementForAltText();s==null||s.setAttribute("aria-describedby",e.id)},m(De,En,null),L(De,"_l10n",null);let ed=De;var Ya,mr,ql,Xl,Yl,Kl,Jl,Ri,br,Pi,yr,ki,Jn,vg,wg,Ag;const Bf=class Bf{constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:s=null,onPinchStart:i=null,onPinching:n=null,onPinchEnd:a=null,signal:o}){m(this,Jn);m(this,Ya);m(this,mr,!1);m(this,ql,null);m(this,Xl);m(this,Yl);m(this,Kl);m(this,Jl);m(this,Ri,null);m(this,br);m(this,Pi,null);m(this,yr);m(this,ki,null);p(this,Ya,t),p(this,ql,s),p(this,Xl,e),p(this,Yl,i),p(this,Kl,n),p(this,Jl,a),p(this,yr,new AbortController),p(this,br,AbortSignal.any([o,r(this,yr).signal])),t.addEventListener("touchstart",b(this,Jn,vg).bind(this),{passive:!1,signal:r(this,br)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/qs.pixelRatio}destroy(){var t,e;(t=r(this,yr))==null||t.abort(),p(this,yr,null),(e=r(this,Ri))==null||e.abort(),p(this,Ri,null)}};Ya=new WeakMap,mr=new WeakMap,ql=new WeakMap,Xl=new WeakMap,Yl=new WeakMap,Kl=new WeakMap,Jl=new WeakMap,Ri=new WeakMap,br=new WeakMap,Pi=new WeakMap,yr=new WeakMap,ki=new WeakMap,Jn=new WeakSet,vg=function(t){var i,n,a;if((i=r(this,Xl))!=null&&i.call(this))return;if(t.touches.length===1){if(r(this,Ri))return;const o=p(this,Ri,new AbortController),l=AbortSignal.any([r(this,br),o.signal]),h=r(this,Ya),d={capture:!0,signal:l,passive:!1},u=f=>{var g;f.pointerType==="touch"&&((g=r(this,Ri))==null||g.abort(),p(this,Ri,null))};h.addEventListener("pointerdown",f=>{f.pointerType==="touch"&&(qt(f),u(f))},d),h.addEventListener("pointerup",u,d),h.addEventListener("pointercancel",u,d);return}if(!r(this,ki)){p(this,ki,new AbortController);const o=AbortSignal.any([r(this,br),r(this,ki).signal]),l=r(this,Ya),h={signal:o,capture:!1,passive:!1};l.addEventListener("touchmove",b(this,Jn,wg).bind(this),h);const d=b(this,Jn,Ag).bind(this);l.addEventListener("touchend",d,h),l.addEventListener("touchcancel",d,h),h.capture=!0,l.addEventListener("pointerdown",qt,h),l.addEventListener("pointermove",qt,h),l.addEventListener("pointercancel",qt,h),l.addEventListener("pointerup",qt,h),(n=r(this,Yl))==null||n.call(this)}if(qt(t),t.touches.length!==2||(a=r(this,ql))!=null&&a.call(this)){p(this,Pi,null);return}let[e,s]=t.touches;e.identifier>s.identifier&&([e,s]=[s,e]),p(this,Pi,{touch0X:e.screenX,touch0Y:e.screenY,touch1X:s.screenX,touch1Y:s.screenY})},wg=function(t){var S;if(!r(this,Pi)||t.touches.length!==2)return;qt(t);let[e,s]=t.touches;e.identifier>s.identifier&&([e,s]=[s,e]);const{screenX:i,screenY:n}=e,{screenX:a,screenY:o}=s,l=r(this,Pi),{touch0X:h,touch0Y:d,touch1X:u,touch1Y:f}=l,g=u-h,y=f-d,v=a-i,w=o-n,A=Math.hypot(v,w)||1,x=Math.hypot(g,y)||1;if(!r(this,mr)&&Math.abs(x-A)<=Bf.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=i,l.touch0Y=n,l.touch1X=a,l.touch1Y=o,!r(this,mr)){p(this,mr,!0);return}const _=[(i+a)/2,(n+o)/2];(S=r(this,Kl))==null||S.call(this,_,x,A)},Ag=function(t){var e;t.touches.length>=2||(r(this,ki)&&(r(this,ki).abort(),p(this,ki,null),(e=r(this,Jl))==null||e.call(this)),r(this,Pi)&&(qt(t),p(this,Pi,null),p(this,mr,!1)))};let Tl=Bf;var vr,Fs,Nt,Ka,_n,Zl,wr,pe,Ar,Ii,Sn,Ql,xr,Ze,tc,Er,Mi,ai,Ja,Za,ws,_r,ec,ud,X,gu,sc,mu,Ph,xg,Eg,bu,kh,yu,_g,Sg,Cg,vu,Tg,wu,Rg,Pg,kg,Au,ll;const tt=class tt{constructor(t){m(this,X);m(this,vr,null);m(this,Fs,null);m(this,Nt,null);m(this,Ka,!1);m(this,_n,null);m(this,Zl,"");m(this,wr,!1);m(this,pe,null);m(this,Ar,null);m(this,Ii,null);m(this,Sn,null);m(this,Ql,"");m(this,xr,!1);m(this,Ze,null);m(this,tc,!1);m(this,Er,!1);m(this,Mi,!1);m(this,ai,null);m(this,Ja,0);m(this,Za,0);m(this,ws,null);m(this,_r,null);L(this,"isSelected",!1);L(this,"_isCopy",!1);L(this,"_editToolbar",null);L(this,"_initialOptions",Object.create(null));L(this,"_initialData",null);L(this,"_isVisible",!0);L(this,"_uiManager",null);L(this,"_focusEventsAllowed",!0);m(this,ec,!1);m(this,ud,tt._zIndex++);this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null,this.annotationElementId=t.annotationElementId||null;const{rotation:e,rawDims:{pageWidth:s,pageHeight:i,pageX:n,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,i],this.pageTranslation=[n,a];const[o,l]=this.parentDimensions;this.x=t.x/o,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const t=tt.prototype._resizeWithKeyboard,e=Yn.TRANSLATE_SMALL,s=Yn.TRANSLATE_BIG;return it(this,"_resizerKeyboardManager",new hh([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-s,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[s,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-s]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,s]}],[["Escape","mac+Escape"],tt.prototype._stopResizingWithKeyboard]]))}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 it(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new X0({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(tt._l10n??(tt._l10n=t),tt._l10nResizer||(tt._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"})),tt._borderLineWidth!==-1)return;const s=getComputedStyle(document.documentElement);tt._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){xt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return r(this,ec)}set _isDraggable(t){var e;p(this,ec,t),(e=this.div)==null||e.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(t*2),this.y+=this.width*t/(e*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(t*2),this.y-=this.width*t/(e*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=r(this,ud)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):b(this,X,ll).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&(r(this,xr)?p(this,xr,!1):this.parent.setSelected(this))}focusout(t){var s;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const e=t.relatedTarget;e!=null&&e.closest(`#${this.id}`)||(t.preventDefault(),(s=this.parent)!=null&&s.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,s,i){const[n,a]=this.parentDimensions;[s,i]=this.screenToPageTranslation(s,i),this.x=(t+s)/n,this.y=(e+i)/a,this.fixAndSetPosition()}_moveAfterPaste(t,e){const[s,i]=this.parentDimensions;this.setAt(t*s,e*i,this.width*s,this.height*i),this._onTranslated()}translate(t,e){b(this,X,gu).call(this,this.parentDimensions,t,e)}translateInPage(t,e){r(this,Ze)||p(this,Ze,[this.x,this.y,this.width,this.height]),b(this,X,gu).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){r(this,Ze)||p(this,Ze,[this.x,this.y,this.width,this.height]);const{div:s,parentDimensions:[i,n]}=this;if(this.x+=t/i,this.y+=e/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:f}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,f)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this;const[l,h]=this.getBaseTranslation();a+=l,o+=h;const{style:d}=s;d.left=`${(100*a).toFixed(2)}%`,d.top=`${(100*o).toFixed(2)}%`,this._onTranslating(a,o),s.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!r(this,Ze)&&(r(this,Ze)[0]!==this.x||r(this,Ze)[1]!==this.y)}get _hasBeenResized(){return!!r(this,Ze)&&(r(this,Ze)[2]!==this.width||r(this,Ze)[3]!==this.height)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:s}=tt,i=s/t,n=s/e;switch(this.rotation){case 90:return[-i,n];case 180:return[i,n];case 270:return[i,-n];default:return[-i,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const{div:{style:e},pageDimensions:[s,i]}=this;let{x:n,y:a,width:o,height:l}=this;if(o*=s,l*=i,n*=s,a*=i,this._mustFixPosition)switch(t){case 0:n=Te(n,0,s-o),a=Te(a,0,i-l);break;case 90:n=Te(n,0,s-l),a=Te(a,o,i);break;case 180:n=Te(n,o,s),a=Te(a,l,i);break;case 270:n=Te(n,l,s),a=Te(a,0,i-o);break}this.x=n/=s,this.y=a/=i;const[h,d]=this.getBaseTranslation();n+=h,a+=d,e.left=`${(100*n).toFixed(2)}%`,e.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var s;return b(s=tt,sc,mu).call(s,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var s;return b(s=tt,sc,mu).call(s,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,s]}=this;return[e*t,s*t]}setDims(t,e){const[s,i]=this.parentDimensions,{style:n}=this.div;n.width=`${(100*t/s).toFixed(2)}%`,r(this,wr)||(n.height=`${(100*e/i).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:e,width:s}=t,i=s.endsWith("%"),n=!r(this,wr)&&e.endsWith("%");if(i&&n)return;const[a,o]=this.parentDimensions;i||(t.width=`${(100*parseFloat(s)/a).toFixed(2)}%`),!r(this,wr)&&!n&&(t.height=`${(100*parseFloat(e)/o).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}_onResized(){}static _round(t){return Math.round(t*1e4)/1e4}_onResizing(){}altTextFinish(){var t;(t=r(this,Nt))==null||t.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||r(this,Er))return this._editToolbar;this._editToolbar=new au(this),this.div.append(this._editToolbar.render());const{toolbarButtons:t}=this;if(t)for(const[e,s]of t)await this._editToolbar.addButton(e,s);return this._editToolbar.addButton("delete"),this._editToolbar}removeEditToolbar(){var t;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(t=r(this,Nt))==null||t.destroy())}addContainer(t){var s;const e=(s=this._editToolbar)==null?void 0:s.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return r(this,Nt)||(ed.initialize(tt._l10n),p(this,Nt,new ed(this)),r(this,vr)&&(r(this,Nt).data=r(this,vr),p(this,vr,null))),r(this,Nt)}get altTextData(){var t;return(t=r(this,Nt))==null?void 0:t.data}set altTextData(t){r(this,Nt)&&(r(this,Nt).data=t)}get guessedAltText(){var t;return(t=r(this,Nt))==null?void 0:t.guessedText}async setGuessedAltText(t){var e;await((e=r(this,Nt))==null?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return(e=r(this,Nt))==null?void 0:e.serialize(t)}hasAltText(){return!!r(this,Nt)&&!r(this,Nt).isEmpty()}hasAltTextData(){var t;return((t=r(this,Nt))==null?void 0:t.hasData())??!1}render(){var a;const t=this.div=document.createElement("div");t.setAttribute("data-editor-rotation",(360-this.rotation)%360),t.className=this.name,t.setAttribute("id",this.id),t.tabIndex=r(this,Ka)?-1:0,t.setAttribute("role","application"),this.defaultL10nId&&t.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||t.classList.add("hidden"),this.setInForeground(),b(this,X,wu).call(this);const[e,s]=this.parentDimensions;this.parentRotation%180!==0&&(t.style.maxWidth=`${(100*s/e).toFixed(2)}%`,t.style.maxHeight=`${(100*e/s).toFixed(2)}%`);const[i,n]=this.getInitialTranslation();return this.translate(i,n),og(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(r(this,_r)||p(this,_r,new Tl({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:b(this,X,_g).bind(this),onPinching:b(this,X,Sg).bind(this),onPinchEnd:b(this,X,Cg).bind(this),signal:this._uiManager._signal}))),(a=this._uiManager._editorUndoBar)==null||a.hide(),t}pointerdown(t){const{isMac:e}=ue.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(p(this,xr,!0),this._isDraggable){b(this,X,Tg).call(this,t);return}b(this,X,vu).call(this,t)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){r(this,ai)&&clearTimeout(r(this,ai)),p(this,ai,setTimeout(()=>{var t;p(this,ai,null),(t=this.parent)==null||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,s){t.changeParent(this),this.x=e,this.y=s,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,s=this.rotation){const i=this.parentScale,[n,a]=this.pageDimensions,[o,l]=this.pageTranslation,h=t/i,d=e/i,u=this.x*n,f=this.y*a,g=this.width*n,y=this.height*a;switch(s){case 0:return[u+h+o,a-f-d-y+l,u+h+g+o,a-f-d+l];case 90:return[u+d+o,a-f+h+l,u+d+y+o,a-f+h+g+l];case 180:return[u-h-g+o,a-f+d+l,u-h+o,a-f+d+y+l];case 270:return[u-d-y+o,a-f-h-g+l,u-d+o,a-f-h+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[s,i,n,a]=t,o=n-s,l=a-i;switch(this.rotation){case 0:return[s,e-a,o,l];case 90:return[s,e-i,l,o];case 180:return[n,e-i,o,l];case 270:return[n,e-a,l,o];default:throw new Error("Invalid rotation")}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),p(this,Er,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),p(this,Er,!1),!0):!1}isInEditMode(){return r(this,Er)}shouldGetKeyboardEvents(){return r(this,Mi)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:t,left:e,bottom:s,right:i}=this.getClientDimensions(),{innerHeight:n,innerWidth:a}=window;return e<a&&i>0&&t<n&&s>0}rebuild(){b(this,X,wu).call(this)}rotate(t){}resize(){}serializeDeleted(){var t;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((t=this._initialData)==null?void 0:t.popupRef)||""}}serialize(t=!1,e=null){xt("An editor must be serializable")}static async deserialize(t,e,s){const i=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:s,annotationElementId:t.annotationElementId});i.rotation=t.rotation,p(i,vr,t.accessibilityData),i._isCopy=t.isCopy||!1;const[n,a]=i.pageDimensions,[o,l,h,d]=i.getRectInCurrentCoords(t.rect,a);return i.x=o/n,i.y=l/a,i.width=h/n,i.height=d/a,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var t,e;if((t=r(this,Sn))==null||t.abort(),p(this,Sn,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),r(this,ai)&&(clearTimeout(r(this,ai)),p(this,ai,null)),b(this,X,ll).call(this),this.removeEditToolbar(),r(this,ws)){for(const s of r(this,ws).values())clearTimeout(s);p(this,ws,null)}this.parent=null,(e=r(this,_r))==null||e.destroy(),p(this,_r,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(b(this,X,xg).call(this),r(this,pe).classList.remove("hidden"))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),p(this,Ii,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=r(this,pe).children;if(!r(this,Fs)){p(this,Fs,Array.from(e));const a=b(this,X,Rg).bind(this),o=b(this,X,Pg).bind(this),l=this._uiManager._signal;for(const h of r(this,Fs)){const d=h.getAttribute("data-resizer-name");h.setAttribute("role","spinbutton"),h.addEventListener("keydown",a,{signal:l}),h.addEventListener("blur",o,{signal:l}),h.addEventListener("focus",b(this,X,kg).bind(this,d),{signal:l}),h.setAttribute("data-l10n-id",tt._l10nResizer[d])}}const s=r(this,Fs)[0];let i=0;for(const a of e){if(a===s)break;i++}const n=(360-this.rotation+this.parentRotation)%360/90*(r(this,Fs).length/4);if(n!==i){if(n<i)for(let o=0;o<i-n;o++)r(this,pe).append(r(this,pe).firstChild);else if(n>i)for(let o=0;o<n-i;o++)r(this,pe).firstChild.before(r(this,pe).lastChild);let a=0;for(const o of e){const h=r(this,Fs)[a++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",tt._l10nResizer[h])}}b(this,X,Au).call(this,0),p(this,Mi,!0),r(this,pe).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){r(this,Mi)&&b(this,X,yu).call(this,r(this,Ql),{deltaX:t,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){b(this,X,ll).call(this),this.div.focus()}select(){var t,e,s;if(!(this.isSelected&&this._editToolbar)){if(this.isSelected=!0,this.makeResizable(),(t=this.div)==null||t.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var i,n;(i=this.div)!=null&&i.classList.contains("selectedEditor")&&((n=this._editToolbar)==null||n.show())});return}(e=this._editToolbar)==null||e.show(),(s=r(this,Nt))==null||s.toggleAltTextBadge(!1)}}unselect(){var t,e,s,i,n;this.isSelected&&(this.isSelected=!1,(t=r(this,pe))==null||t.classList.add("hidden"),(e=this.div)==null||e.classList.remove("selectedEditor"),(s=this.div)!=null&&s.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(i=this._editToolbar)==null||i.hide(),(n=r(this,Nt))==null||n.toggleAltTextBadge(!0))}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(t){this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id})}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return r(this,tc)}set isEditing(t){p(this,tc,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){p(this,wr,!0);const s=t/e,{style:i}=this.div;i.aspectRatio=s,i.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){r(this,ws)||p(this,ws,new Map);const{action:s}=t;let i=r(this,ws).get(s);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),r(this,ws).delete(s),r(this,ws).size===0&&p(this,ws,null)},tt._telemetryTimeout),r(this,ws).set(s,i);return}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),p(this,Ka,!1)}disable(){this.div&&(this.div.tabIndex=-1),p(this,Ka,!0)}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(!e)e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);else if(e.nodeName==="CANVAS"){const s=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),s.before(e)}return e}resetAnnotationElement(t){const{firstChild:e}=t.container;(e==null?void 0:e.nodeName)==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};vr=new WeakMap,Fs=new WeakMap,Nt=new WeakMap,Ka=new WeakMap,_n=new WeakMap,Zl=new WeakMap,wr=new WeakMap,pe=new WeakMap,Ar=new WeakMap,Ii=new WeakMap,Sn=new WeakMap,Ql=new WeakMap,xr=new WeakMap,Ze=new WeakMap,tc=new WeakMap,Er=new WeakMap,Mi=new WeakMap,ai=new WeakMap,Ja=new WeakMap,Za=new WeakMap,ws=new WeakMap,_r=new WeakMap,ec=new WeakMap,ud=new WeakMap,X=new WeakSet,gu=function([t,e],s,i){[s,i]=this.screenToPageTranslation(s,i),this.x+=s/t,this.y+=i/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},sc=new WeakSet,mu=function(t,e,s){switch(s){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}},Ph=function(t){switch(t){case 90:{const[e,s]=this.pageDimensions;return[0,-e/s,s/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,s]=this.pageDimensions;return[0,e/s,-s/e,0]}default:return[1,0,0,1]}},xg=function(){if(r(this,pe))return;p(this,pe,document.createElement("div")),r(this,pe).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const s of t){const i=document.createElement("div");r(this,pe).append(i),i.classList.add("resizer",s),i.setAttribute("data-resizer-name",s),i.addEventListener("pointerdown",b(this,X,Eg).bind(this,s),{signal:e}),i.addEventListener("contextmenu",Rs,{signal:e}),i.tabIndex=-1}this.div.prepend(r(this,pe))},Eg=function(t,e){var d;e.preventDefault();const{isMac:s}=ue.platform;if(e.button!==0||e.ctrlKey&&s)return;(d=r(this,Nt))==null||d.toggle(!1);const i=this._isDraggable;this._isDraggable=!1,p(this,Ar,[e.screenX,e.screenY]);const n=new AbortController,a=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",b(this,X,yu).bind(this,t),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",qt,{passive:!1,signal:a}),window.addEventListener("contextmenu",Rs,{signal:a}),p(this,Ii,{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(e.target).cursor;const h=()=>{var u;n.abort(),this.parent.togglePointerEvents(!0),(u=r(this,Nt))==null||u.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=o,this.div.style.cursor=l,b(this,X,kh).call(this)};window.addEventListener("pointerup",h,{signal:a}),window.addEventListener("blur",h,{signal:a})},bu=function(t,e,s,i){this.width=s,this.height=i,this.x=t,this.y=e;const[n,a]=this.parentDimensions;this.setDims(n*s,a*i),this.fixAndSetPosition(),this._onResized()},kh=function(){if(!r(this,Ii))return;const{savedX:t,savedY:e,savedWidth:s,savedHeight:i}=r(this,Ii);p(this,Ii,null);const n=this.x,a=this.y,o=this.width,l=this.height;n===t&&a===e&&o===s&&l===i||this.addCommands({cmd:b(this,X,bu).bind(this,n,a,o,l),undo:b(this,X,bu).bind(this,t,e,s,i),mustExec:!0})},yu=function(t,e){const[s,i]=this.parentDimensions,n=this.x,a=this.y,o=this.width,l=this.height,h=tt.MIN_SIZE/s,d=tt.MIN_SIZE/i,u=b(this,X,Ph).call(this,this.rotation),f=(F,O)=>[u[0]*F+u[2]*O,u[1]*F+u[3]*O],g=b(this,X,Ph).call(this,360-this.rotation),y=(F,O)=>[g[0]*F+g[2]*O,g[1]*F+g[3]*O];let v,w,A=!1,x=!1;switch(t){case"topLeft":A=!0,v=(F,O)=>[0,0],w=(F,O)=>[F,O];break;case"topMiddle":v=(F,O)=>[F/2,0],w=(F,O)=>[F/2,O];break;case"topRight":A=!0,v=(F,O)=>[F,0],w=(F,O)=>[0,O];break;case"middleRight":x=!0,v=(F,O)=>[F,O/2],w=(F,O)=>[0,O/2];break;case"bottomRight":A=!0,v=(F,O)=>[F,O],w=(F,O)=>[0,0];break;case"bottomMiddle":v=(F,O)=>[F/2,O],w=(F,O)=>[F/2,0];break;case"bottomLeft":A=!0,v=(F,O)=>[0,O],w=(F,O)=>[F,0];break;case"middleLeft":x=!0,v=(F,O)=>[0,O/2],w=(F,O)=>[F,O/2];break}const _=v(o,l),S=w(o,l);let C=f(...S);const R=tt._round(n+C[0]),T=tt._round(a+C[1]);let k=1,I=1,D,N;if(e.fromKeyboard)({deltaX:D,deltaY:N}=e);else{const{screenX:F,screenY:O}=e,[yt,Tt]=r(this,Ar);[D,N]=this.screenToPageTranslation(F-yt,O-Tt),r(this,Ar)[0]=F,r(this,Ar)[1]=O}if([D,N]=y(D/s,N/i),A){const F=Math.hypot(o,l);k=I=Math.max(Math.min(Math.hypot(S[0]-_[0]-D,S[1]-_[1]-N)/F,1/o,1/l),h/o,d/l)}else x?k=Te(Math.abs(S[0]-_[0]-D),h,1)/o:I=Te(Math.abs(S[1]-_[1]-N),d,1)/l;const Y=tt._round(o*k),q=tt._round(l*I);C=f(...w(Y,q));const H=R-C[0],st=T-C[1];r(this,Ze)||p(this,Ze,[this.x,this.y,this.width,this.height]),this.width=Y,this.height=q,this.x=H,this.y=st,this.setDims(s*Y,i*q),this.fixAndSetPosition(),this._onResizing()},_g=function(){var t;p(this,Ii,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(t=r(this,Nt))==null||t.toggle(!1),this.parent.togglePointerEvents(!1)},Sg=function(t,e,s){let n=.7*(s/e)+1-.7;if(n===1)return;const a=b(this,X,Ph).call(this,this.rotation),o=(R,T)=>[a[0]*R+a[2]*T,a[1]*R+a[3]*T],[l,h]=this.parentDimensions,d=this.x,u=this.y,f=this.width,g=this.height,y=tt.MIN_SIZE/l,v=tt.MIN_SIZE/h;n=Math.max(Math.min(n,1/f,1/g),y/f,v/g);const w=tt._round(f*n),A=tt._round(g*n);if(w===f&&A===g)return;r(this,Ze)||p(this,Ze,[d,u,f,g]);const x=o(f/2,g/2),_=tt._round(d+x[0]),S=tt._round(u+x[1]),C=o(w/2,A/2);this.x=_-C[0],this.y=S-C[1],this.width=w,this.height=A,this.setDims(l*w,h*A),this.fixAndSetPosition(),this._onResizing()},Cg=function(){var t;(t=r(this,Nt))==null||t.toggle(!0),this.parent.togglePointerEvents(!0),b(this,X,kh).call(this)},vu=function(t){const{isMac:e}=ue.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},Tg=function(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();let s=!1;const i=new AbortController,n=this._uiManager.combinedSignal(i),a={capture:!0,passive:!1,signal:n},o=h=>{i.abort(),p(this,_n,null),p(this,xr,!1),this._uiManager.endDragSession()||b(this,X,vu).call(this,h),s&&this._onStopDragging()};e&&(p(this,Ja,t.clientX),p(this,Za,t.clientY),p(this,_n,t.pointerId),p(this,Zl,t.pointerType),window.addEventListener("pointermove",h=>{s||(s=!0,this._onStartDragging());const{clientX:d,clientY:u,pointerId:f}=h;if(f!==r(this,_n)){qt(h);return}const[g,y]=this.screenToPageTranslation(d-r(this,Ja),u-r(this,Za));p(this,Ja,d),p(this,Za,u),this._uiManager.dragSelectedEditors(g,y)},a),window.addEventListener("touchmove",qt,a),window.addEventListener("pointerdown",h=>{h.pointerType===r(this,Zl)&&(r(this,_r)||h.isPrimary)&&o(h),qt(h)},a));const l=h=>{if(!r(this,_n)||r(this,_n)===h.pointerId){o(h);return}qt(h)};window.addEventListener("pointerup",l,{signal:n}),window.addEventListener("blur",l,{signal:n})},wu=function(){if(r(this,Sn)||!this.div)return;p(this,Sn,new AbortController);const t=this._uiManager.combinedSignal(r(this,Sn));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},Rg=function(t){tt._resizerKeyboardManager.exec(this,t)},Pg=function(t){var e;r(this,Mi)&&((e=t.relatedTarget)==null?void 0:e.parentNode)!==r(this,pe)&&b(this,X,ll).call(this)},kg=function(t){p(this,Ql,r(this,Mi)?t:"")},Au=function(t){if(r(this,Fs))for(const e of r(this,Fs))e.tabIndex=t},ll=function(){p(this,Mi,!1),b(this,X,Au).call(this,-1),b(this,X,kh).call(this)},m(tt,sc),L(tt,"_l10n",null),L(tt,"_l10nResizer",null),L(tt,"_borderLineWidth",-1),L(tt,"_colorManager",new lu),L(tt,"_zIndex",1),L(tt,"_telemetryTimeout",1e3);let kt=tt;class X0 extends kt{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const ip=3285377520,ms=4294901760,Ks=65535;class Ig{constructor(t){this.h1=t?t&4294967295:ip,this.h2=t?t&4294967295:ip}update(t){let e,s;if(typeof t=="string"){e=new Uint8Array(t.length*2),s=0;for(let v=0,w=t.length;v<w;v++){const A=t.charCodeAt(v);A<=255?e[s++]=A:(e[s++]=A>>>8,e[s++]=A&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),s=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const i=s>>2,n=s-i*4,a=new Uint32Array(e.buffer,0,i);let o=0,l=0,h=this.h1,d=this.h2;const u=3432918353,f=461845907,g=u&Ks,y=f&Ks;for(let v=0;v<i;v++)v&1?(o=a[v],o=o*u&ms|o*g&Ks,o=o<<15|o>>>17,o=o*f&ms|o*y&Ks,h^=o,h=h<<13|h>>>19,h=h*5+3864292196):(l=a[v],l=l*u&ms|l*g&Ks,l=l<<15|l>>>17,l=l*f&ms|l*y&Ks,d^=l,d=d<<13|d>>>19,d=d*5+3864292196);switch(o=0,n){case 3:o^=e[i*4+2]<<16;case 2:o^=e[i*4+1]<<8;case 1:o^=e[i*4],o=o*u&ms|o*g&Ks,o=o<<15|o>>>17,o=o*f&ms|o*y&Ks,i&1?h^=o:d^=o}this.h1=h,this.h2=d}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&ms|t*36045&Ks,e=e*4283543511&ms|((e<<16|t>>>16)*2950163797&ms)>>>16,t^=e>>>1,t=t*444984403&ms|t*60499&Ks,e=e*3301882366&ms|((e<<16|t>>>16)*3120437893&ms)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const xu=Object.freeze({map:null,hash:"",transfer:void 0});var Sr,Cr,ge,fd,Mg;class Cf{constructor(){m(this,fd);m(this,Sr,!1);m(this,Cr,null);m(this,ge,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const s=r(this,ge).get(t);return s===void 0?e:Object.assign(e,s)}getRawValue(t){return r(this,ge).get(t)}remove(t){if(r(this,ge).delete(t),r(this,ge).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const e of r(this,ge).values())if(e instanceof kt)return;this.onAnnotationEditor(null)}}setValue(t,e){const s=r(this,ge).get(t);let i=!1;if(s!==void 0)for(const[n,a]of Object.entries(e))s[n]!==a&&(i=!0,s[n]=a);else i=!0,r(this,ge).set(t,e);i&&b(this,fd,Mg).call(this),e instanceof kt&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(e.constructor._type)}has(t){return r(this,ge).has(t)}get size(){return r(this,ge).size}resetModified(){r(this,Sr)&&(p(this,Sr,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Lg(this)}get serializable(){if(r(this,ge).size===0)return xu;const t=new Map,e=new Ig,s=[],i=Object.create(null);let n=!1;for(const[a,o]of r(this,ge)){const l=o instanceof kt?o.serialize(!1,i):o;l&&(t.set(a,l),e.update(`${a}:${JSON.stringify(l)}`),n||(n=!!l.bitmap))}if(n)for(const a of t.values())a.bitmap&&s.push(a.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:s}:xu}get editorStats(){let t=null;const e=new Map;for(const s of r(this,ge).values()){if(!(s instanceof kt))continue;const i=s.telemetryFinalData;if(!i)continue;const{type:n}=i;e.has(n)||e.set(n,Object.getPrototypeOf(s).constructor),t||(t=Object.create(null));const a=t[n]||(t[n]=new Map);for(const[o,l]of Object.entries(i)){if(o==="type")continue;let h=a.get(o);h||(h=new Map,a.set(o,h));const d=h.get(l)??0;h.set(l,d+1)}}for(const[s,i]of e)t[s]=i.computeTelemetryFinalData(t[s]);return t}resetModifiedIds(){p(this,Cr,null)}get modifiedIds(){if(r(this,Cr))return r(this,Cr);const t=[];for(const e of r(this,ge).values())!(e instanceof kt)||!e.annotationElementId||!e.serialize()||t.push(e.annotationElementId);return p(this,Cr,{ids:new Set(t),hash:t.join(",")})}[Symbol.iterator](){return r(this,ge).entries()}}Sr=new WeakMap,Cr=new WeakMap,ge=new WeakMap,fd=new WeakSet,Mg=function(){r(this,Sr)||(p(this,Sr,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var ic;class Lg extends Cf{constructor(e){super();m(this,ic);const{map:s,hash:i,transfer:n}=e.serializable,a=structuredClone(s,n?{transfer:n}:null);p(this,ic,{map:a,hash:i,transfer:n})}get print(){xt("Should not call PrintAnnotationStorage.print")}get serializable(){return r(this,ic)}get modifiedIds(){return it(this,"modifiedIds",{ids:new Set,hash:""})}}ic=new WeakMap;var Qa;class Y0{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){m(this,Qa,new Set);this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),r(this,Qa).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:s}){if(!(!t||r(this,Qa).has(t.loadedName))){if(Zt(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:i,src:n,style:a}=t,o=new FontFace(i,n,a);this.addNativeFontFace(o);try{await o.load(),r(this,Qa).add(i),s==null||s(t)}catch{Z(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}xt("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){const s=t.createNativeFontFace();if(s){this.addNativeFontFace(s);try{await s.loaded}catch(i){throw Z(`Failed to load font '${s.family}': '${i}'.`),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(s=>{const i=this._queueLoadingCallback(s);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){var e;const t=!!((e=this._document)!=null&&e.fonts);return it(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){return it(this,"isSyncFontLoadingSupported",Be||ue.platform.isFirefox)}_queueLoadingCallback(t){function e(){for(Zt(!i.done,"completeRequest() cannot be called twice."),i.done=!0;s.length>0&&s[0].done;){const n=s.shift();setTimeout(n.callback,0)}}const{loadingRequests:s}=this,i={done:!1,complete:e,callback:t};return s.push(i),i}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return it(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function s(S,C){return S.charCodeAt(C)<<24|S.charCodeAt(C+1)<<16|S.charCodeAt(C+2)<<8|S.charCodeAt(C+3)&255}function i(S,C,R,T){const k=S.substring(0,C),I=S.substring(C+R);return k+T+I}let n,a;const o=this._document.createElement("canvas");o.width=1,o.height=1;const l=o.getContext("2d");let h=0;function d(S,C){if(++h>30){Z("Load test font never loaded."),C();return}if(l.font="30px "+S,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){C();return}setTimeout(d.bind(null,S,C))}const u=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=i(f,976,u.length,u);const y=16,v=1482184792;let w=s(f,y);for(n=0,a=u.length-3;n<a;n+=4)w=w-v+s(u,n)|0;n<u.length&&(w=w-v+s(u+"XXX",n)|0),f=i(f,y,4,O0(w));const A=`url(data:font/opentype;base64,${btoa(f)});`,x=`@font-face {font-family:"${u}";src:${A}}`;this.insertRule(x);const _=this._document.createElement("div");_.style.visibility="hidden",_.style.width=_.style.height="10px",_.style.position="absolute",_.style.top=_.style.left="0px";for(const S of[t.loadedName,u]){const C=this._document.createElement("span");C.textContent="Hi",C.style.fontFamily=S,_.append(C)}this._document.body.append(_),d(u,()=>{_.remove(),e.complete()})}}Qa=new WeakMap;class K0{constructor(t,e=null){this.compiledGlyphs=Object.create(null);for(const s in t)this[s]=t[s];this._inspectFont=e}createNativeFontFace(){var e;if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const s={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(s.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,s)}return(e=this._inspectFont)==null||e.call(this,this),t}createFontFaceRule(){var s;if(!this.data||this.disableFontFace)return null;const t=`url(data:${this.mimetype};base64,${Jp(this.data)});`;let e;if(!this.cssFontInfo)e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${i}src:${t}}`}return(s=this._inspectFont)==null||s.call(this,this,t),e}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];const s=this.loadedName+"_path_"+e;let i;try{i=t.get(s)}catch(a){Z(`getPathGenerator - ignoring character: "${a}".`)}const n=new Path2D(i||"");return this.fontExtraProperties||t.delete(s),this.compiledGlyphs[e]=n}}function J0(c){if(c instanceof URL)return c.href;if(typeof c=="string"){if(Be)return c;const t=URL.parse(c,window.location);if(t)return t.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function Z0(c){if(Be&&typeof Buffer<"u"&&c instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(c instanceof Uint8Array&&c.byteLength===c.buffer.byteLength)return c;if(typeof c=="string")return oh(c);if(c instanceof ArrayBuffer||ArrayBuffer.isView(c)||typeof c=="object"&&!isNaN(c==null?void 0:c.length))return new Uint8Array(c);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function bh(c){if(typeof c!="string")return null;if(c.endsWith("/"))return c;throw new Error(`Invalid factory url: "${c}" must include trailing slash.`)}const Eu=c=>typeof c=="object"&&Number.isInteger(c==null?void 0:c.num)&&c.num>=0&&Number.isInteger(c==null?void 0:c.gen)&&c.gen>=0,Q0=c=>typeof c=="object"&&typeof(c==null?void 0:c.name)=="string",Dg=$0.bind(null,Eu,Q0);var Li,pd;class ty{constructor(){m(this,Li,new Map);m(this,pd,Promise.resolve())}postMessage(t,e){const s={data:structuredClone(t,e?{transfer:e}:null)};r(this,pd).then(()=>{for(const[i]of r(this,Li))i.call(this,s)})}addEventListener(t,e,s=null){let i=null;if((s==null?void 0:s.signal)instanceof AbortSignal){const{signal:n}=s;if(n.aborted){Z("LoopbackPort - cannot use an `aborted` signal.");return}const a=()=>this.removeEventListener(t,e);i=()=>n.removeEventListener("abort",a),n.addEventListener("abort",a)}r(this,Li).set(e,i)}removeEventListener(t,e){const s=r(this,Li).get(e);s==null||s(),r(this,Li).delete(e)}terminate(){for(const[,t]of r(this,Li))t==null||t();r(this,Li).clear()}}Li=new WeakMap,pd=new WeakMap;const yh={DATA:1,ERROR:2},Jt={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function np(){}function Ge(c){if(c instanceof sn||c instanceof Qh||c instanceof tp||c instanceof Cl||c instanceof Xd)return c;switch(c instanceof Error||typeof c=="object"&&c!==null||xt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),c.name){case"AbortException":return new sn(c.message);case"InvalidPDFException":return new Qh(c.message);case"PasswordException":return new tp(c.message,c.code);case"ResponseException":return new Cl(c.message,c.status,c.missing);case"UnknownErrorException":return new Xd(c.message,c.details)}return new Xd(c.message,c.toString())}var to,Ts,Ng,Fg,Og,Ih;class cl{constructor(t,e,s){m(this,Ts);m(this,to,new AbortController);this.sourceName=t,this.targetName=e,this.comObj=s,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),s.addEventListener("message",b(this,Ts,Ng).bind(this),{signal:r(this,to).signal})}on(t,e){const s=this.actionHandler;if(s[t])throw new Error(`There is already an actionName called "${t}"`);s[t]=e}send(t,e,s){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},s)}sendWithPromise(t,e,s){const i=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[i]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:i,data:e},s)}catch(a){n.reject(a)}return n.promise}sendWithStream(t,e,s,i){const n=this.streamId++,a=this.sourceName,o=this.targetName,l=this.comObj;return new ReadableStream({start:h=>{const d=Promise.withResolvers();return this.streamControllers[n]={controller:h,startCall:d,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:a,targetName:o,action:t,streamId:n,data:e,desiredSize:h.desiredSize},i),d.promise},pull:h=>{const d=Promise.withResolvers();return this.streamControllers[n].pullCall=d,l.postMessage({sourceName:a,targetName:o,stream:Jt.PULL,streamId:n,desiredSize:h.desiredSize}),d.promise},cancel:h=>{Zt(h instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[n].cancelCall=d,this.streamControllers[n].isClosed=!0,l.postMessage({sourceName:a,targetName:o,stream:Jt.CANCEL,streamId:n,reason:Ge(h)}),d.promise}},s)}destroy(){var t;(t=r(this,to))==null||t.abort(),p(this,to,null)}}to=new WeakMap,Ts=new WeakSet,Ng=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){b(this,Ts,Og).call(this,t);return}if(t.callback){const s=t.callbackId,i=this.callbackCapabilities[s];if(!i)throw new Error(`Cannot resolve callback ${s}`);if(delete this.callbackCapabilities[s],t.callback===yh.DATA)i.resolve(t.data);else if(t.callback===yh.ERROR)i.reject(Ge(t.reason));else throw new Error("Unexpected callback case");return}const e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const s=this.sourceName,i=t.sourceName,n=this.comObj;Promise.try(e,t.data).then(function(a){n.postMessage({sourceName:s,targetName:i,callback:yh.DATA,callbackId:t.callbackId,data:a})},function(a){n.postMessage({sourceName:s,targetName:i,callback:yh.ERROR,callbackId:t.callbackId,reason:Ge(a)})});return}if(t.streamId){b(this,Ts,Fg).call(this,t);return}e(t.data)},Fg=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,a=this,o=this.actionHandler[t.action],l={enqueue(h,d=1,u){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),n.postMessage({sourceName:s,targetName:i,stream:Jt.ENQUEUE,streamId:e,chunk:h},u)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:Jt.CLOSE,streamId:e}),delete a.streamSinks[e])},error(h){Zt(h instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:Jt.ERROR,streamId:e,reason:Ge(h)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[e]=l,Promise.try(o,t.data,l).then(function(){n.postMessage({sourceName:s,targetName:i,stream:Jt.START_COMPLETE,streamId:e,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:Jt.START_COMPLETE,streamId:e,reason:Ge(h)})})},Og=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,a=this.streamControllers[e],o=this.streamSinks[e];switch(t.stream){case Jt.START_COMPLETE:t.success?a.startCall.resolve():a.startCall.reject(Ge(t.reason));break;case Jt.PULL_COMPLETE:t.success?a.pullCall.resolve():a.pullCall.reject(Ge(t.reason));break;case Jt.PULL:if(!o){n.postMessage({sourceName:s,targetName:i,stream:Jt.PULL_COMPLETE,streamId:e,success:!0});break}o.desiredSize<=0&&t.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=t.desiredSize,Promise.try(o.onPull||np).then(function(){n.postMessage({sourceName:s,targetName:i,stream:Jt.PULL_COMPLETE,streamId:e,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:Jt.PULL_COMPLETE,streamId:e,reason:Ge(h)})});break;case Jt.ENQUEUE:if(Zt(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case Jt.CLOSE:if(Zt(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),b(this,Ts,Ih).call(this,a,e);break;case Jt.ERROR:Zt(a,"error should have stream controller"),a.controller.error(Ge(t.reason)),b(this,Ts,Ih).call(this,a,e);break;case Jt.CANCEL_COMPLETE:t.success?a.cancelCall.resolve():a.cancelCall.reject(Ge(t.reason)),b(this,Ts,Ih).call(this,a,e);break;case Jt.CANCEL:if(!o)break;const l=Ge(t.reason);Promise.try(o.onCancel||np,l).then(function(){n.postMessage({sourceName:s,targetName:i,stream:Jt.CANCEL_COMPLETE,streamId:e,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:Jt.CANCEL_COMPLETE,streamId:e,reason:Ge(h)})}),o.sinkCapability.reject(l),o.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},Ih=async function(t,e){var s,i,n;await Promise.allSettled([(s=t.startCall)==null?void 0:s.promise,(i=t.pullCall)==null?void 0:i.promise,(n=t.cancelCall)==null?void 0:n.promise]),delete this.streamControllers[e]};var nc;class Bg{constructor({enableHWA:t=!1}){m(this,nc,!1);p(this,nc,t)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const s=this._createCanvas(t,e);return{canvas:s,context:s.getContext("2d",{willReadFrequently:!r(this,nc)})}}reset(t,e,s){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||s<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=s}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){xt("Abstract method `_createCanvas` called.")}}nc=new WeakMap;class ey extends Bg{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){const s=this._document.createElement("canvas");return s.width=t,s.height=e,s}}class jg{constructor({baseUrl:t=null,isCompressed:e=!0}){this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!t)throw new Error("CMap name must be specified.");const e=this.baseUrl+t+(this.isCompressed?".bcmap":"");return this._fetch(e).then(s=>({cMapData:s,isCompressed:this.isCompressed})).catch(s=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}async _fetch(t){xt("Abstract method `_fetch` called.")}}class rp extends jg{async _fetch(t){const e=await Xo(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):oh(e)}}class Hg{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,s,i,n){return"none"}destroy(t=!1){}}var Tr,eo,Di,Ni,Se,Rr,Pr,z,Ee,hl,Ca,Mh,Ta,$g,_u,Ra,dl,ul,Su,fl;class sy extends Hg{constructor({docId:e,ownerDocument:s=globalThis.document}){super();m(this,z);m(this,Tr);m(this,eo);m(this,Di);m(this,Ni);m(this,Se);m(this,Rr);m(this,Pr,0);p(this,Ni,e),p(this,Se,s)}addFilter(e){if(!e)return"none";let s=r(this,z,Ee).get(e);if(s)return s;const[i,n,a]=b(this,z,Mh).call(this,e),o=e.length===1?i:`${i}${n}${a}`;if(s=r(this,z,Ee).get(o),s)return r(this,z,Ee).set(e,s),s;const l=`g_${r(this,Ni)}_transfer_map_${Me(this,Pr)._++}`,h=b(this,z,Ta).call(this,l);r(this,z,Ee).set(e,h),r(this,z,Ee).set(o,h);const d=b(this,z,Ra).call(this,l);return b(this,z,ul).call(this,i,n,a,d),h}addHCMFilter(e,s){var y;const i=`${e}-${s}`,n="base";let a=r(this,z,hl).get(n);if((a==null?void 0:a.key)===i||(a?((y=a.filter)==null||y.remove(),a.key=i,a.url="none",a.filter=null):(a={key:i,url:"none",filter:null},r(this,z,hl).set(n,a)),!e||!s))return a.url;const o=b(this,z,fl).call(this,e);e=W.makeHexColor(...o);const l=b(this,z,fl).call(this,s);if(s=W.makeHexColor(...l),r(this,z,Ca).style.color="",e==="#000000"&&s==="#ffffff"||e===s)return a.url;const h=new Array(256);for(let v=0;v<=255;v++){const w=v/255;h[v]=w<=.03928?w/12.92:((w+.055)/1.055)**2.4}const d=h.join(","),u=`g_${r(this,Ni)}_hcm_filter`,f=a.filter=b(this,z,Ra).call(this,u);b(this,z,ul).call(this,d,d,d,f),b(this,z,_u).call(this,f);const g=(v,w)=>{const A=o[v]/255,x=l[v]/255,_=new Array(w+1);for(let S=0;S<=w;S++)_[S]=A+S/w*(x-A);return _.join(",")};return b(this,z,ul).call(this,g(0,5),g(1,5),g(2,5),f),a.url=b(this,z,Ta).call(this,u),a.url}addAlphaFilter(e){let s=r(this,z,Ee).get(e);if(s)return s;const[i]=b(this,z,Mh).call(this,[e]),n=`alpha_${i}`;if(s=r(this,z,Ee).get(n),s)return r(this,z,Ee).set(e,s),s;const a=`g_${r(this,Ni)}_alpha_map_${Me(this,Pr)._++}`,o=b(this,z,Ta).call(this,a);r(this,z,Ee).set(e,o),r(this,z,Ee).set(n,o);const l=b(this,z,Ra).call(this,a);return b(this,z,Su).call(this,i,l),o}addLuminosityFilter(e){let s=r(this,z,Ee).get(e||"luminosity");if(s)return s;let i,n;if(e?([i]=b(this,z,Mh).call(this,[e]),n=`luminosity_${i}`):n="luminosity",s=r(this,z,Ee).get(n),s)return r(this,z,Ee).set(e,s),s;const a=`g_${r(this,Ni)}_luminosity_map_${Me(this,Pr)._++}`,o=b(this,z,Ta).call(this,a);r(this,z,Ee).set(e,o),r(this,z,Ee).set(n,o);const l=b(this,z,Ra).call(this,a);return b(this,z,$g).call(this,l),e&&b(this,z,Su).call(this,i,l),o}addHighlightHCMFilter(e,s,i,n,a){var x;const o=`${s}-${i}-${n}-${a}`;let l=r(this,z,hl).get(e);if((l==null?void 0:l.key)===o||(l?((x=l.filter)==null||x.remove(),l.key=o,l.url="none",l.filter=null):(l={key:o,url:"none",filter:null},r(this,z,hl).set(e,l)),!s||!i))return l.url;const[h,d]=[s,i].map(b(this,z,fl).bind(this));let u=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),f=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[g,y]=[n,a].map(b(this,z,fl).bind(this));f<u&&([u,f,g,y]=[f,u,y,g]),r(this,z,Ca).style.color="";const v=(_,S,C)=>{const R=new Array(256),T=(f-u)/C,k=_/255,I=(S-_)/(255*C);let D=0;for(let N=0;N<=C;N++){const Y=Math.round(u+N*T),q=k+N*I;for(let H=D;H<=Y;H++)R[H]=q;D=Y+1}for(let N=D;N<256;N++)R[N]=R[D-1];return R.join(",")},w=`g_${r(this,Ni)}_hcm_${e}_filter`,A=l.filter=b(this,z,Ra).call(this,w);return b(this,z,_u).call(this,A),b(this,z,ul).call(this,v(g[0],y[0],5),v(g[1],y[1],5),v(g[2],y[2],5),A),l.url=b(this,z,Ta).call(this,w),l.url}destroy(e=!1){var s,i,n,a;e&&((s=r(this,Rr))!=null&&s.size)||((i=r(this,Di))==null||i.parentNode.parentNode.remove(),p(this,Di,null),(n=r(this,eo))==null||n.clear(),p(this,eo,null),(a=r(this,Rr))==null||a.clear(),p(this,Rr,null),p(this,Pr,0))}}Tr=new WeakMap,eo=new WeakMap,Di=new WeakMap,Ni=new WeakMap,Se=new WeakMap,Rr=new WeakMap,Pr=new WeakMap,z=new WeakSet,Ee=function(){return r(this,eo)||p(this,eo,new Map)},hl=function(){return r(this,Rr)||p(this,Rr,new Map)},Ca=function(){if(!r(this,Di)){const e=r(this,Se).createElement("div"),{style:s}=e;s.visibility="hidden",s.contain="strict",s.width=s.height=0,s.position="absolute",s.top=s.left=0,s.zIndex=-1;const i=r(this,Se).createElementNS(vi,"svg");i.setAttribute("width",0),i.setAttribute("height",0),p(this,Di,r(this,Se).createElementNS(vi,"defs")),e.append(i),i.append(r(this,Di)),r(this,Se).body.append(e)}return r(this,Di)},Mh=function(e){if(e.length===1){const h=e[0],d=new Array(256);for(let f=0;f<256;f++)d[f]=h[f]/255;const u=d.join(",");return[u,u,u]}const[s,i,n]=e,a=new Array(256),o=new Array(256),l=new Array(256);for(let h=0;h<256;h++)a[h]=s[h]/255,o[h]=i[h]/255,l[h]=n[h]/255;return[a.join(","),o.join(","),l.join(",")]},Ta=function(e){if(r(this,Tr)===void 0){p(this,Tr,"");const s=r(this,Se).URL;s!==r(this,Se).baseURI&&(ch(s)?Z('#createUrl: ignore "data:"-URL for performance reasons.'):p(this,Tr,xf(s,"")))}return`url(${r(this,Tr)}#${e})`},$g=function(e){const s=r(this,Se).createElementNS(vi,"feColorMatrix");s.setAttribute("type","matrix"),s.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(s)},_u=function(e){const s=r(this,Se).createElementNS(vi,"feColorMatrix");s.setAttribute("type","matrix"),s.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(s)},Ra=function(e){const s=r(this,Se).createElementNS(vi,"filter");return s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("id",e),r(this,z,Ca).append(s),s},dl=function(e,s,i){const n=r(this,Se).createElementNS(vi,s);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),e.append(n)},ul=function(e,s,i,n){const a=r(this,Se).createElementNS(vi,"feComponentTransfer");n.append(a),b(this,z,dl).call(this,a,"feFuncR",e),b(this,z,dl).call(this,a,"feFuncG",s),b(this,z,dl).call(this,a,"feFuncB",i)},Su=function(e,s){const i=r(this,Se).createElementNS(vi,"feComponentTransfer");s.append(i),b(this,z,dl).call(this,i,"feFuncA",e)},fl=function(e){return r(this,z,Ca).style.color=e,Sf(getComputedStyle(r(this,z,Ca)).getPropertyValue("color"))};class zg{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!t)throw new Error("Font filename must be specified.");const e=`${this.baseUrl}${t}`;return this._fetch(e).catch(s=>{throw new Error(`Unable to load font data at: ${e}`)})}async _fetch(t){xt("Abstract method `_fetch` called.")}}class ap extends zg{async _fetch(t){const e=await Xo(t,"arraybuffer");return new Uint8Array(e)}}class Gg{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!t)throw new Error("Wasm filename must be specified.");const e=`${this.baseUrl}${t}`;return this._fetch(e).catch(s=>{throw new Error(`Unable to load wasm data at: ${e}`)})}async _fetch(t){xt("Abstract method `_fetch` called.")}}class op extends Gg{async _fetch(t){const e=await Xo(t,"arraybuffer");return new Uint8Array(e)}}Be&&Z("Please use the `legacy` build in Node.js environments.");async function Tf(c){const e=await process.getBuiltinModule("fs").promises.readFile(c);return new Uint8Array(e)}class iy extends Hg{}class ny extends Bg{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:Ud&&Ud.tagName.toUpperCase()==="SCRIPT"&&Ud.src||new URL("index.cjs",document.baseURI).href)("@napi-rs/canvas").createCanvas(t,e)}}class ry extends jg{async _fetch(t){return Tf(t)}}class ay extends zg{async _fetch(t){return Tf(t)}}class oy extends Gg{async _fetch(t){return Tf(t)}}const ye={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function Cu(c,t){if(!t)return;const e=t[2]-t[0],s=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],e,s),c.clip(i)}class Rf{isModifyingCurrentTransform(){return!1}getPattern(){xt("Abstract method `getPattern` called.")}}class ly extends Rf{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;this._type==="axial"?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const s of this._colorStops)e.addColorStop(s[0],s[1]);return e}getPattern(t,e,s,i){let n;if(i===ye.STROKE||i===ye.FILL){const a=e.current.getClippedPathBoundingBox(i,jt(t))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,l=Math.ceil(a[3]-a[1])||1,h=e.cachedCanvases.getCanvas("pattern",o,l),d=h.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(-a[0],-a[1]),s=W.transform(s,[1,0,0,1,a[0],a[1]]),d.transform(...e.baseTransform),this.matrix&&d.transform(...this.matrix),Cu(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),n=t.createPattern(h.canvas,"no-repeat");const u=new DOMMatrix(s);n.setTransform(u)}else Cu(t,this._bbox),n=this._createGradient(t);return n}}function Jd(c,t,e,s,i,n,a,o){const l=t.coords,h=t.colors,d=c.data,u=c.width*4;let f;l[e+1]>l[s+1]&&(f=e,e=s,s=f,f=n,n=a,a=f),l[s+1]>l[i+1]&&(f=s,s=i,i=f,f=a,a=o,o=f),l[e+1]>l[s+1]&&(f=e,e=s,s=f,f=n,n=a,a=f);const g=(l[e]+t.offsetX)*t.scaleX,y=(l[e+1]+t.offsetY)*t.scaleY,v=(l[s]+t.offsetX)*t.scaleX,w=(l[s+1]+t.offsetY)*t.scaleY,A=(l[i]+t.offsetX)*t.scaleX,x=(l[i+1]+t.offsetY)*t.scaleY;if(y>=x)return;const _=h[n],S=h[n+1],C=h[n+2],R=h[a],T=h[a+1],k=h[a+2],I=h[o],D=h[o+1],N=h[o+2],Y=Math.round(y),q=Math.round(x);let H,st,F,O,yt,Tt,zt,mt;for(let _t=Y;_t<=q;_t++){if(_t<w){const dt=_t<y?0:(y-_t)/(y-w);H=g-(g-v)*dt,st=_-(_-R)*dt,F=S-(S-T)*dt,O=C-(C-k)*dt}else{let dt;_t>x?dt=1:w===x?dt=0:dt=(w-_t)/(w-x),H=v-(v-A)*dt,st=R-(R-I)*dt,F=T-(T-D)*dt,O=k-(k-N)*dt}let ft;_t<y?ft=0:_t>x?ft=1:ft=(y-_t)/(y-x),yt=g-(g-A)*ft,Tt=_-(_-I)*ft,zt=S-(S-D)*ft,mt=C-(C-N)*ft;const we=Math.round(Math.min(H,yt)),Ae=Math.round(Math.max(H,yt));let te=u*_t+we*4;for(let dt=we;dt<=Ae;dt++)ft=(H-dt)/(H-yt),ft<0?ft=0:ft>1&&(ft=1),d[te++]=st-(st-Tt)*ft|0,d[te++]=F-(F-zt)*ft|0,d[te++]=O-(O-mt)*ft|0,d[te++]=255}}function cy(c,t,e){const s=t.coords,i=t.colors;let n,a;switch(t.type){case"lattice":const o=t.verticesPerRow,l=Math.floor(s.length/o)-1,h=o-1;for(n=0;n<l;n++){let d=n*o;for(let u=0;u<h;u++,d++)Jd(c,e,s[d],s[d+1],s[d+o],i[d],i[d+1],i[d+o]),Jd(c,e,s[d+o+1],s[d+1],s[d+o],i[d+o+1],i[d+1],i[d+o])}break;case"triangles":for(n=0,a=s.length;n<a;n+=3)Jd(c,e,s[n],s[n+1],s[n+2],i[n],i[n+1],i[n+2]);break;default:throw new Error("illegal figure")}}class hy extends Rf{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],this.matrix=null}_createMeshCanvas(t,e,s){const o=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),h=Math.ceil(this._bounds[2])-o,d=Math.ceil(this._bounds[3])-l,u=Math.min(Math.ceil(Math.abs(h*t[0]*1.1)),3e3),f=Math.min(Math.ceil(Math.abs(d*t[1]*1.1)),3e3),g=h/u,y=d/f,v={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-l,scaleX:1/g,scaleY:1/y},w=u+2*2,A=f+2*2,x=s.getCanvas("mesh",w,A),_=x.context,S=_.createImageData(u,f);if(e){const R=S.data;for(let T=0,k=R.length;T<k;T+=4)R[T]=e[0],R[T+1]=e[1],R[T+2]=e[2],R[T+3]=255}for(const R of this._figures)cy(S,R,v);return _.putImageData(S,2,2),{canvas:x.canvas,offsetX:o-2*g,offsetY:l-2*y,scaleX:g,scaleY:y}}isModifyingCurrentTransform(){return!0}getPattern(t,e,s,i){Cu(t,this._bbox);const n=new Float32Array(2);if(i===ye.SHADING)W.singularValueDecompose2dScale(jt(t),n);else if(this.matrix){W.singularValueDecompose2dScale(this.matrix,n);const[o,l]=n;W.singularValueDecompose2dScale(e.baseTransform,n),n[0]*=o,n[1]*=l}else W.singularValueDecompose2dScale(e.baseTransform,n);const a=this._createMeshCanvas(n,i===ye.SHADING?null:this._background,e.cachedCanvases);return i!==ye.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(a.offsetX,a.offsetY),t.scale(a.scaleX,a.scaleY),t.createPattern(a.canvas,"no-repeat")}}class dy extends Rf{getPattern(){return"hotpink"}}function uy(c){switch(c[0]){case"RadialAxial":return new ly(c);case"Mesh":return new hy(c);case"Dummy":return new dy}throw new Error(`Unknown IR type: ${c[0]}`)}const lp={COLORED:1,UNCOLORED:2},gd=class gd{constructor(t,e,s,i){this.color=t[1],this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.ctx=e,this.canvasGraphicsFactory=s,this.baseTransform=i}createPatternCanvas(t){const{bbox:e,operatorList:s,paintType:i,tilingType:n,color:a,canvasGraphicsFactory:o}=this;let{xstep:l,ystep:h}=this;l=Math.abs(l),h=Math.abs(h),Td("TilingType: "+n);const d=e[0],u=e[1],f=e[2],g=e[3],y=f-d,v=g-u,w=new Float32Array(2);W.singularValueDecompose2dScale(this.matrix,w);const[A,x]=w;W.singularValueDecompose2dScale(this.baseTransform,w);const _=A*w[0],S=x*w[1];let C=y,R=v,T=!1,k=!1;const I=Math.ceil(l*_),D=Math.ceil(h*S),N=Math.ceil(y*_),Y=Math.ceil(v*S);I>=N?C=l:T=!0,D>=Y?R=h:k=!0;const q=this.getSizeAndScale(C,this.ctx.canvas.width,_),H=this.getSizeAndScale(R,this.ctx.canvas.height,S),st=t.cachedCanvases.getCanvas("pattern",q.size,H.size),F=st.context,O=o.createCanvasGraphics(F);if(O.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(O,i,a),F.translate(-q.scale*d,-H.scale*u),O.transform(q.scale,0,0,H.scale,0,0),F.save(),this.clipBbox(O,d,u,f,g),O.baseTransform=jt(O.ctx),O.executeOperatorList(s),O.endDrawing(),F.restore(),T||k){const yt=st.canvas;T&&(C=l),k&&(R=h);const Tt=this.getSizeAndScale(C,this.ctx.canvas.width,_),zt=this.getSizeAndScale(R,this.ctx.canvas.height,S),mt=Tt.size,_t=zt.size,ft=t.cachedCanvases.getCanvas("pattern-workaround",mt,_t),we=ft.context,Ae=T?Math.floor(y/l):0,te=k?Math.floor(v/h):0;for(let dt=0;dt<=Ae;dt++)for(let Pe=0;Pe<=te;Pe++)we.drawImage(yt,mt*dt,_t*Pe,mt,_t,0,0,mt,_t);return{canvas:ft.canvas,scaleX:Tt.scale,scaleY:zt.scale,offsetX:d,offsetY:u}}return{canvas:st.canvas,scaleX:q.scale,scaleY:H.scale,offsetX:d,offsetY:u}}getSizeAndScale(t,e,s){const i=Math.max(gd.MAX_PATTERN_SIZE,e);let n=Math.ceil(t*s);return n>=i?n=i:s=n/t,{scale:s,size:n}}clipBbox(t,e,s,i,n){const a=i-e,o=n-s;t.ctx.rect(e,s,a,o),W.axialAlignedBoundingBox([e,s,i,n],jt(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,s){const i=t.ctx,n=t.current;switch(e){case lp.COLORED:const{fillStyle:a,strokeStyle:o}=this.ctx;i.fillStyle=n.fillColor=a,i.strokeStyle=n.strokeColor=o;break;case lp.UNCOLORED:i.fillStyle=i.strokeStyle=s,n.fillColor=n.strokeColor=s;break;default:throw new F0(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,s,i){let n=s;i!==ye.SHADING&&(n=W.transform(n,e.baseTransform),this.matrix&&(n=W.transform(n,this.matrix)));const a=this.createPatternCanvas(e);let o=new DOMMatrix(n);o=o.translate(a.offsetX,a.offsetY),o=o.scale(1/a.scaleX,1/a.scaleY);const l=t.createPattern(a.canvas,"repeat");return l.setTransform(o),l}};L(gd,"MAX_PATTERN_SIZE",3e3);let Tu=gd;function fy({src:c,srcPos:t=0,dest:e,width:s,height:i,nonBlackColor:n=4294967295,inverseDecode:a=!1}){const o=ue.isLittleEndian?4278190080:255,[l,h]=a?[n,o]:[o,n],d=s>>3,u=s&7,f=c.length;e=new Uint32Array(e.buffer);let g=0;for(let y=0;y<i;y++){for(const w=t+d;t<w;t++){const A=t<f?c[t]:255;e[g++]=A&128?h:l,e[g++]=A&64?h:l,e[g++]=A&32?h:l,e[g++]=A&16?h:l,e[g++]=A&8?h:l,e[g++]=A&4?h:l,e[g++]=A&2?h:l,e[g++]=A&1?h:l}if(u===0)continue;const v=t<f?c[t++]:255;for(let w=0;w<u;w++)e[g++]=v&1<<7-w?h:l}return{srcPos:t,destPos:g}}const cp=16,hp=100,py=15,dp=10,Xe=16,Zd=new DOMMatrix,ds=new Float32Array(2),Ma=new Float32Array([1/0,1/0,-1/0,-1/0]);function gy(c,t){if(c._removeMirroring)throw new Error("Context is already forwarding operations.");c.__originalSave=c.save,c.__originalRestore=c.restore,c.__originalRotate=c.rotate,c.__originalScale=c.scale,c.__originalTranslate=c.translate,c.__originalTransform=c.transform,c.__originalSetTransform=c.setTransform,c.__originalResetTransform=c.resetTransform,c.__originalClip=c.clip,c.__originalMoveTo=c.moveTo,c.__originalLineTo=c.lineTo,c.__originalBezierCurveTo=c.bezierCurveTo,c.__originalRect=c.rect,c.__originalClosePath=c.closePath,c.__originalBeginPath=c.beginPath,c._removeMirroring=()=>{c.save=c.__originalSave,c.restore=c.__originalRestore,c.rotate=c.__originalRotate,c.scale=c.__originalScale,c.translate=c.__originalTranslate,c.transform=c.__originalTransform,c.setTransform=c.__originalSetTransform,c.resetTransform=c.__originalResetTransform,c.clip=c.__originalClip,c.moveTo=c.__originalMoveTo,c.lineTo=c.__originalLineTo,c.bezierCurveTo=c.__originalBezierCurveTo,c.rect=c.__originalRect,c.closePath=c.__originalClosePath,c.beginPath=c.__originalBeginPath,delete c._removeMirroring},c.save=function(){t.save(),this.__originalSave()},c.restore=function(){t.restore(),this.__originalRestore()},c.translate=function(e,s){t.translate(e,s),this.__originalTranslate(e,s)},c.scale=function(e,s){t.scale(e,s),this.__originalScale(e,s)},c.transform=function(e,s,i,n,a,o){t.transform(e,s,i,n,a,o),this.__originalTransform(e,s,i,n,a,o)},c.setTransform=function(e,s,i,n,a,o){t.setTransform(e,s,i,n,a,o),this.__originalSetTransform(e,s,i,n,a,o)},c.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},c.rotate=function(e){t.rotate(e),this.__originalRotate(e)},c.clip=function(e){t.clip(e),this.__originalClip(e)},c.moveTo=function(e,s){t.moveTo(e,s),this.__originalMoveTo(e,s)},c.lineTo=function(e,s){t.lineTo(e,s),this.__originalLineTo(e,s)},c.bezierCurveTo=function(e,s,i,n,a,o){t.bezierCurveTo(e,s,i,n,a,o),this.__originalBezierCurveTo(e,s,i,n,a,o)},c.rect=function(e,s,i,n){t.rect(e,s,i,n),this.__originalRect(e,s,i,n)},c.closePath=function(){t.closePath(),this.__originalClosePath()},c.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class my{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,s){let i;return this.cache[t]!==void 0?(i=this.cache[t],this.canvasFactory.reset(i,e,s)):(i=this.canvasFactory.create(e,s),this.cache[t]=i),i}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function vh(c,t,e,s,i,n,a,o,l,h){const[d,u,f,g,y,v]=jt(c);if(u===0&&f===0){const x=a*d+y,_=Math.round(x),S=o*g+v,C=Math.round(S),R=(a+l)*d+y,T=Math.abs(Math.round(R)-_)||1,k=(o+h)*g+v,I=Math.abs(Math.round(k)-C)||1;return c.setTransform(Math.sign(d),0,0,Math.sign(g),_,C),c.drawImage(t,e,s,i,n,0,0,T,I),c.setTransform(d,u,f,g,y,v),[T,I]}if(d===0&&g===0){const x=o*f+y,_=Math.round(x),S=a*u+v,C=Math.round(S),R=(o+h)*f+y,T=Math.abs(Math.round(R)-_)||1,k=(a+l)*u+v,I=Math.abs(Math.round(k)-C)||1;return c.setTransform(0,Math.sign(u),Math.sign(f),0,_,C),c.drawImage(t,e,s,i,n,0,0,I,T),c.setTransform(d,u,f,g,y,v),[I,T]}c.drawImage(t,e,s,i,n,a,o,l,h);const w=Math.hypot(d,u),A=Math.hypot(f,g);return[w*l,A*h]}class up{constructor(t,e){L(this,"alphaIsShape",!1);L(this,"fontSize",0);L(this,"fontSizeScale",1);L(this,"textMatrix",null);L(this,"textMatrixScale",1);L(this,"fontMatrix",nu);L(this,"leading",0);L(this,"x",0);L(this,"y",0);L(this,"lineX",0);L(this,"lineY",0);L(this,"charSpacing",0);L(this,"wordSpacing",0);L(this,"textHScale",1);L(this,"textRenderingMode",xe.FILL);L(this,"textRise",0);L(this,"fillColor","#000000");L(this,"strokeColor","#000000");L(this,"patternFill",!1);L(this,"patternStroke",!1);L(this,"fillAlpha",1);L(this,"strokeAlpha",1);L(this,"lineWidth",1);L(this,"activeSMask",null);L(this,"transferMaps","none");this.clipBox=new Float32Array([0,0,t,e]),this.minMax=Ma.slice()}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t}getPathBoundingBox(t=ye.FILL,e=null){const s=this.minMax.slice();if(t===ye.STROKE){e||xt("Stroke bounding box must include transform."),W.singularValueDecompose2dScale(e,ds);const i=ds[0]*this.lineWidth/2,n=ds[1]*this.lineWidth/2;s[0]-=i,s[1]-=n,s[2]+=i,s[3]+=n}return s}updateClipFromPath(){const t=W.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set(Ma,0)}getClippedPathBoundingBox(t=ye.FILL,e=null){return W.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function fp(c,t){if(t instanceof ImageData){c.putImageData(t,0,0);return}const e=t.height,s=t.width,i=e%Xe,n=(e-i)/Xe,a=i===0?n:n+1,o=c.createImageData(s,Xe);let l=0,h;const d=t.data,u=o.data;let f,g,y,v;if(t.kind===_l.GRAYSCALE_1BPP){const w=d.byteLength,A=new Uint32Array(u.buffer,0,u.byteLength>>2),x=A.length,_=s+7>>3,S=4294967295,C=ue.isLittleEndian?4278190080:255;for(f=0;f<a;f++){for(y=f<n?Xe:i,h=0,g=0;g<y;g++){const R=w-l;let T=0;const k=R>_?s:R*8-7,I=k&-8;let D=0,N=0;for(;T<I;T+=8)N=d[l++],A[h++]=N&128?S:C,A[h++]=N&64?S:C,A[h++]=N&32?S:C,A[h++]=N&16?S:C,A[h++]=N&8?S:C,A[h++]=N&4?S:C,A[h++]=N&2?S:C,A[h++]=N&1?S:C;for(;T<k;T++)D===0&&(N=d[l++],D=128),A[h++]=N&D?S:C,D>>=1}for(;h<x;)A[h++]=0;c.putImageData(o,0,f*Xe)}}else if(t.kind===_l.RGBA_32BPP){for(g=0,v=s*Xe*4,f=0;f<n;f++)u.set(d.subarray(l,l+v)),l+=v,c.putImageData(o,0,g),g+=Xe;f<a&&(v=s*i*4,u.set(d.subarray(l,l+v)),c.putImageData(o,0,g))}else if(t.kind===_l.RGB_24BPP)for(y=Xe,v=s*y,f=0;f<a;f++){for(f>=n&&(y=i,v=s*y),h=0,g=v;g--;)u[h++]=d[l++],u[h++]=d[l++],u[h++]=d[l++],u[h++]=255;c.putImageData(o,0,f*Xe)}else throw new Error(`bad image kind: ${t.kind}`)}function pp(c,t){if(t.bitmap){c.drawImage(t.bitmap,0,0);return}const e=t.height,s=t.width,i=e%Xe,n=(e-i)/Xe,a=i===0?n:n+1,o=c.createImageData(s,Xe);let l=0;const h=t.data,d=o.data;for(let u=0;u<a;u++){const f=u<n?Xe:i;({srcPos:l}=fy({src:h,srcPos:l,dest:d,width:s,height:f,nonBlackColor:0})),c.putImageData(o,0,u*Xe)}}function tl(c,t){const e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of e)c[s]!==void 0&&(t[s]=c[s]);c.setLineDash!==void 0&&(t.setLineDash(c.getLineDash()),t.lineDashOffset=c.lineDashOffset)}function wh(c){c.strokeStyle=c.fillStyle="#000000",c.fillRule="nonzero",c.globalAlpha=1,c.lineWidth=1,c.lineCap="butt",c.lineJoin="miter",c.miterLimit=10,c.globalCompositeOperation="source-over",c.font="10px sans-serif",c.setLineDash!==void 0&&(c.setLineDash([]),c.lineDashOffset=0);const{filter:t}=c;t!=="none"&&t!==""&&(c.filter="none")}function gp(c,t){if(t)return!0;W.singularValueDecompose2dScale(c,ds);const e=Math.fround(qs.pixelRatio*nn.PDF_TO_CSS_UNITS);return ds[0]<=e&&ds[1]<=e}const by=["butt","round","square"],yy=["miter","round","bevel"],vy={},mp={};var Xs,Ru,Pu,ku;const jf=class jf{constructor(t,e,s,i,n,{optionalContentConfig:a,markedContentStack:o=null},l,h){m(this,Xs);this.ctx=t,this.current=new up(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=s,this.canvasFactory=i,this.filterFactory=n,this.groupStack=[],this.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=a,this.cachedCanvases=new my(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=h,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,e=null){return typeof t=="string"?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing({transform:t,viewport:e,transparency:s=!1,background:i=null}){const n=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,n,a),this.ctx.fillStyle=o,s){const l=this.cachedCanvases.getCanvas("transparent",n,a);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...jt(this.compositeCtx))}this.ctx.save(),wh(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=jt(this.ctx)}executeOperatorList(t,e,s,i){const n=t.argsArray,a=t.fnArray;let o=e||0;const l=n.length;if(l===o)return o;const h=l-o>dp&&typeof s=="function",d=h?Date.now()+py:0;let u=0;const f=this.commonObjs,g=this.objs;let y;for(;;){if(i!==void 0&&o===i.nextBreakPoint)return i.breakIt(o,s),o;if(y=a[o],y!==Sl.dependency)this[y].apply(this,n[o]);else for(const v of n[o]){const w=v.startsWith("g_")?f:g;if(!w.has(v))return w.get(v,s),o}if(o++,o===l)return o;if(h&&++u>dp){if(Date.now()>d)return s(),o;u=0}}}endDrawing(){b(this,Xs,Ru).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),b(this,Xs,Pu).call(this)}_scaleImage(t,e){const s=t.width??t.displayWidth,i=t.height??t.displayHeight;let n=Math.max(Math.hypot(e[0],e[1]),1),a=Math.max(Math.hypot(e[2],e[3]),1),o=s,l=i,h="prescale1",d,u;for(;n>2&&o>1||a>2&&l>1;){let f=o,g=l;n>2&&o>1&&(f=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),n/=o/f),a>2&&l>1&&(g=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,a/=l/g),d=this.cachedCanvases.getCanvas(h,f,g),u=d.context,u.clearRect(0,0,f,g),u.drawImage(t,0,0,o,l,0,0,f,g),t=d.canvas,o=f,l=g,h=h==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:o,paintHeight:l}}_createMaskCanvas(t){const e=this.ctx,{width:s,height:i}=t,n=this.current.fillColor,a=this.current.patternFill,o=jt(e);let l,h,d,u;if((t.bitmap||t.data)&&t.count>1){const I=t.bitmap||t.data.buffer;h=JSON.stringify(a?o:[o.slice(0,4),n]),l=this._cachedBitmapsMap.get(I),l||(l=new Map,this._cachedBitmapsMap.set(I,l));const D=l.get(h);if(D&&!a){const N=Math.round(Math.min(o[0],o[2])+o[4]),Y=Math.round(Math.min(o[1],o[3])+o[5]);return{canvas:D,offsetX:N,offsetY:Y}}d=D}d||(u=this.cachedCanvases.getCanvas("maskCanvas",s,i),pp(u.context,t));let f=W.transform(o,[1/s,0,0,-1/i,0,0]);f=W.transform(f,[1,0,0,1,0,-i]);const g=Ma.slice();W.axialAlignedBoundingBox([0,0,s,i],f,g);const[y,v,w,A]=g,x=Math.round(w-y)||1,_=Math.round(A-v)||1,S=this.cachedCanvases.getCanvas("fillCanvas",x,_),C=S.context,R=y,T=v;C.translate(-R,-T),C.transform(...f),d||(d=this._scaleImage(u.canvas,Ys(C)),d=d.img,l&&a&&l.set(h,d)),C.imageSmoothingEnabled=gp(jt(C),t.interpolate),vh(C,d,0,0,d.width,d.height,0,0,s,i),C.globalCompositeOperation="source-in";const k=W.transform(Ys(C),[1,0,0,1,-R,-T]);return C.fillStyle=a?n.getPattern(e,this,k,ye.FILL):n,C.fillRect(0,0,s,i),l&&!a&&(this.cachedCanvases.delete("fillCanvas"),l.set(h,S.canvas)),{canvas:S.canvas,offsetX:Math.round(R),offsetY:Math.round(T)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=by[t]}setLineJoin(t){this.ctx.lineJoin=yy[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const s=this.ctx;s.setLineDash!==void 0&&(s.setLineDash(t),s.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,s]of t)switch(e){case"LW":this.setLineWidth(s);break;case"LC":this.setLineCap(s);break;case"LJ":this.setLineJoin(s);break;case"ML":this.setMiterLimit(s);break;case"D":this.setDash(s[0],s[1]);break;case"RI":this.setRenderingIntent(s);break;case"FL":this.setFlatness(s);break;case"Font":this.setFont(s[0],s[1]);break;case"CA":this.current.strokeAlpha=s;break;case"ca":this.ctx.globalAlpha=this.current.fillAlpha=s;break;case"BM":this.ctx.globalCompositeOperation=s;break;case"SMask":this.current.activeSMask=s?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(s);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,e=this.ctx.canvas.height,s="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(s,t,e);this.suspendedCtx=this.ctx;const n=this.ctx=i.context;n.setTransform(this.suspendedCtx.getTransform()),tl(this.suspendedCtx,n),gy(n,this.suspendedCtx),this.setGState([["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),tl(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,s=this.suspendedCtx;this.composeSMask(s,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,s,i){const n=i[0],a=i[1],o=i[2]-n,l=i[3]-a;o===0||l===0||(this.genericComposeSMask(e.context,s,o,l,e.subtype,e.backdrop,e.transferMap,n,a,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(s.canvas,0,0),t.restore())}genericComposeSMask(t,e,s,i,n,a,o,l,h,d,u){let f=t.canvas,g=l-d,y=h-u;if(a)if(g<0||y<0||g+s>f.width||y+i>f.height){const w=this.cachedCanvases.getCanvas("maskExtension",s,i),A=w.context;A.drawImage(f,-g,-y),A.globalCompositeOperation="destination-atop",A.fillStyle=a,A.fillRect(0,0,s,i),A.globalCompositeOperation="source-over",f=w.canvas,g=y=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const w=new Path2D;w.rect(g,y,s,i),t.clip(w),t.globalCompositeOperation="destination-atop",t.fillStyle=a,t.fillRect(g,y,s,i),t.restore()}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),n==="Alpha"&&o?e.filter=this.filterFactory.addAlphaFilter(o):n==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(o));const v=new Path2D;v.rect(l,h,s,i),e.clip(v),e.globalCompositeOperation="destination-in",e.drawImage(f,g,y,s,i,l,h,s,i),e.restore()}save(){this.inSMaskMode&&tl(this.ctx,this.suspendedCtx),this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){if(this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&tl(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(t,e,s,i,n,a){this.ctx.transform(t,e,s,i,n,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,s){let[i]=e;if(!s){i||(i=e[0]=new Path2D),this[t](i);return}if(!(i instanceof Path2D)){const n=e[0]=new Path2D;for(let a=0,o=i.length;a<o;)switch(i[a++]){case mh.moveTo:n.moveTo(i[a++],i[a++]);break;case mh.lineTo:n.lineTo(i[a++],i[a++]);break;case mh.curveTo:n.bezierCurveTo(i[a++],i[a++],i[a++],i[a++],i[a++],i[a++]);break;case mh.closePath:n.closePath();break;default:Z(`Unrecognized drawing path operator: ${i[a-1]}`);break}i=n}W.axialAlignedBoundingBox(s,jt(this.ctx),this.current.minMax),this[t](i)}closePath(){this.ctx.closePath()}stroke(t,e=!0){const s=this.ctx,i=this.current.strokeColor;if(s.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof i=="object"&&(i!=null&&i.getPattern)){const n=i.isModifyingCurrentTransform()?s.getTransform():null;if(s.save(),s.strokeStyle=i.getPattern(s,this,Ys(s),ye.STROKE),n){const a=new Path2D;a.addPath(t,s.getTransform().invertSelf().multiplySelf(n)),t=a}this.rescaleAndStroke(t,!1),s.restore()}else this.rescaleAndStroke(t,!0);e&&this.consumePath(t,this.current.getClippedPathBoundingBox(ye.STROKE,jt(this.ctx))),s.globalAlpha=this.current.fillAlpha}closeStroke(t){this.stroke(t)}fill(t,e=!0){const s=this.ctx,i=this.current.fillColor,n=this.current.patternFill;let a=!1;if(n){const l=i.isModifyingCurrentTransform()?s.getTransform():null;if(s.save(),s.fillStyle=i.getPattern(s,this,Ys(s),ye.FILL),l){const h=new Path2D;h.addPath(t,s.getTransform().invertSelf().multiplySelf(l)),t=h}a=!0}const o=this.current.getClippedPathBoundingBox();this.contentVisible&&o!==null&&(this.pendingEOFill?(s.fill(t,"evenodd"),this.pendingEOFill=!1):s.fill(t)),a&&s.restore(),e&&this.consumePath(t,o)}eoFill(t){this.pendingEOFill=!0,this.fill(t)}fillStroke(t){this.fill(t,!1),this.stroke(t,!1),this.consumePath(t)}eoFillStroke(t){this.pendingEOFill=!0,this.fillStroke(t)}closeFillStroke(t){this.fillStroke(t)}closeEOFillStroke(t){this.pendingEOFill=!0,this.fillStroke(t)}endPath(t){this.consumePath(t)}rawFillPath(t){this.ctx.fill(t)}clip(){this.pendingClip=vy}eoClip(){this.pendingClip=mp}beginText(){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,e=this.ctx;if(t===void 0)return;const s=new Path2D,i=e.getTransform().invertSelf();for(const{transform:n,x:a,y:o,fontSize:l,path:h}of t)s.addPath(h,new DOMMatrix(n).preMultiplySelf(i).translate(a,o).scale(l,-l));e.clip(s),delete this.pendingTextPaths}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){var d;const s=this.commonObjs.get(t),i=this.current;if(!s)throw new Error(`Can't find font for ${t}`);if(i.fontMatrix=s.fontMatrix||nu,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&Z("Invalid font matrix for font "+t),e<0?(e=-e,i.fontDirection=-1):i.fontDirection=1,this.current.font=s,this.current.fontSize=e,s.isType3Font)return;const n=s.loadedName||"sans-serif",a=((d=s.systemFontInfo)==null?void 0:d.css)||`"${n}", ${s.fallbackName}`;let o="normal";s.black?o="900":s.bold&&(o="bold");const l=s.italic?"italic":"normal";let h=e;e<cp?h=cp:e>hp&&(h=hp),this.current.fontSizeScale=e/h,this.ctx.font=`${l} ${o} ${h}px ${a}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t){const{current:e}=this;e.textMatrix=t,e.textMatrixScale=Math.hypot(t[0],t[1]),e.x=e.lineX=0,e.y=e.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,s,i,n){const a=this.ctx,o=this.current,l=o.font,h=o.textRenderingMode,d=o.fontSize/o.fontSizeScale,u=h&xe.FILL_STROKE_MASK,f=!!(h&xe.ADD_TO_PATH_FLAG),g=o.patternFill&&!l.missingFile,y=o.patternStroke&&!l.missingFile;let v;if((l.disableFontFace||f||g||y)&&(v=l.getPathGenerator(this.commonObjs,t)),l.disableFontFace||g||y){a.save(),a.translate(e,s),a.scale(d,-d);let w;if((u===xe.FILL||u===xe.FILL_STROKE)&&(i?(w=a.getTransform(),a.setTransform(...i),a.fill(b(this,Xs,ku).call(this,v,w,i))):a.fill(v)),u===xe.STROKE||u===xe.FILL_STROKE)if(n){w||(w=a.getTransform()),a.setTransform(...n);const{a:A,b:x,c:_,d:S}=w,C=W.inverseTransform(n),R=W.transform([A,x,_,S,0,0],C);W.singularValueDecompose2dScale(R,ds),a.lineWidth*=Math.max(ds[0],ds[1])/d,a.stroke(b(this,Xs,ku).call(this,v,w,n))}else a.lineWidth/=d,a.stroke(v);a.restore()}else(u===xe.FILL||u===xe.FILL_STROKE)&&a.fillText(t,e,s),(u===xe.STROKE||u===xe.FILL_STROKE)&&a.strokeText(t,e,s);f&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:jt(a),x:e,y:s,fontSize:d,path:v})}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let s=!1;for(let i=3;i<e.length;i+=4)if(e[i]>0&&e[i]<255){s=!0;break}return it(this,"isFontSubpixelAAEnabled",s)}showText(t){const e=this.current,s=e.font;if(s.isType3Font)return this.showType3Text(t);const i=e.fontSize;if(i===0)return;const n=this.ctx,a=e.fontSizeScale,o=e.charSpacing,l=e.wordSpacing,h=e.fontDirection,d=e.textHScale*h,u=t.length,f=s.vertical,g=f?1:-1,y=s.defaultVMetrics,v=i*e.fontMatrix[0],w=e.textRenderingMode===xe.FILL&&!s.disableFontFace&&!e.patternFill;n.save(),e.textMatrix&&n.transform(...e.textMatrix),n.translate(e.x,e.y+e.textRise),h>0?n.scale(d,-1):n.scale(d,1);let A,x;if(e.patternFill){n.save();const T=e.fillColor.getPattern(n,this,Ys(n),ye.FILL);A=jt(n),n.restore(),n.fillStyle=T}if(e.patternStroke){n.save();const T=e.strokeColor.getPattern(n,this,Ys(n),ye.STROKE);x=jt(n),n.restore(),n.strokeStyle=T}let _=e.lineWidth;const S=e.textMatrixScale;if(S===0||_===0){const T=e.textRenderingMode&xe.FILL_STROKE_MASK;(T===xe.STROKE||T===xe.FILL_STROKE)&&(_=this.getSinglePixelWidth())}else _/=S;if(a!==1&&(n.scale(a,a),_/=a),n.lineWidth=_,s.isInvalidPDFjsFont){const T=[];let k=0;for(const I of t)T.push(I.unicode),k+=I.width;n.fillText(T.join(""),0,0),e.x+=k*v*d,n.restore(),this.compose();return}let C=0,R;for(R=0;R<u;++R){const T=t[R];if(typeof T=="number"){C+=g*T*i/1e3;continue}let k=!1;const I=(T.isSpace?l:0)+o,D=T.fontChar,N=T.accent;let Y,q,H=T.width;if(f){const F=T.vmetric||y,O=-(T.vmetric?F[1]:H*.5)*v,yt=F[2]*v;H=F?-F[0]:H,Y=O/a,q=(C+yt)/a}else Y=C/a,q=0;if(s.remeasure&&H>0){const F=n.measureText(D).width*1e3/i*a;if(H<F&&this.isFontSubpixelAAEnabled){const O=H/F;k=!0,n.save(),n.scale(O,1),Y/=O}else H!==F&&(Y+=(H-F)/2e3*i/a)}if(this.contentVisible&&(T.isInFont||s.missingFile)){if(w&&!N)n.fillText(D,Y,q);else if(this.paintChar(D,Y,q,A,x),N){const F=Y+i*N.offset.x/a,O=q-i*N.offset.y/a;this.paintChar(N.fontChar,F,O,A,x)}}const st=f?H*v-I*h:H*v+I*h;C+=st,k&&n.restore()}f?e.y-=C:e.x+=C*d,n.restore(),this.compose()}showType3Text(t){const e=this.ctx,s=this.current,i=s.font,n=s.fontSize,a=s.fontDirection,o=i.vertical?1:-1,l=s.charSpacing,h=s.wordSpacing,d=s.textHScale*a,u=s.fontMatrix||nu,f=t.length,g=s.textRenderingMode===xe.INVISIBLE;let y,v,w,A;if(!(g||n===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),s.textMatrix&&e.transform(...s.textMatrix),e.translate(s.x,s.y+s.textRise),e.scale(d,a),y=0;y<f;++y){if(v=t[y],typeof v=="number"){A=o*v*n/1e3,this.ctx.translate(A,0),s.x+=A*d;continue}const x=(v.isSpace?h:0)+l,_=i.charProcOperatorList[v.operatorListId];_?this.contentVisible&&(this.save(),e.scale(n,n),e.transform(...u),this.executeOperatorList(_),this.restore()):Z(`Type3 character "${v.operatorListId}" is not available.`);const S=[v.width,0];W.applyTransform(S,u),w=S[0]*n+x,e.translate(w,0),s.x+=w*d}e.restore()}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,s,i,n,a){const o=new Path2D;o.rect(s,i,n-s,a-i),this.ctx.clip(o),this.endPath()}getColorN_Pattern(t){let e;if(t[0]==="TilingPattern"){const s=this.baseTransform||jt(this.ctx),i={createCanvasGraphics:n=>new jf(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new Tu(t,this.ctx,i,s)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t){this.ctx.strokeStyle=this.current.strokeColor=t,this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t){this.ctx.fillStyle=this.current.fillColor=t,this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e=null){let s;return this.cachedPatterns.has(t)?s=this.cachedPatterns.get(t):(s=uy(this.getObject(t)),this.cachedPatterns.set(t,s)),e&&(s.matrix=e),s}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const s=this._getPattern(t);e.fillStyle=s.getPattern(e,this,Ys(e),ye.SHADING);const i=Ys(e);if(i){const{width:n,height:a}=e.canvas,o=Ma.slice();W.axialAlignedBoundingBox([0,0,n,a],i,o);const[l,h,d,u]=o;this.ctx.fillRect(l,h,d-l,u-h)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){xt("Should not call beginInlineImage")}beginImageData(){xt("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=jt(this.ctx),e)){W.axialAlignedBoundingBox(e,this.baseTransform,this.current.minMax);const[s,i,n,a]=e,o=new Path2D;o.rect(s,i,n-s,a-i),this.ctx.clip(o),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const e=this.ctx;t.isolated||Td("TODO: Support non-isolated groups."),t.knockout&&Z("Knockout groups not supported.");const s=jt(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let i=Ma.slice();W.axialAlignedBoundingBox(t.bbox,jt(e),i);const n=[0,0,e.canvas.width,e.canvas.height];i=W.intersect(i,n)||[0,0,0,0];const a=Math.floor(i[0]),o=Math.floor(i[1]),l=Math.max(Math.ceil(i[2])-a,1),h=Math.max(Math.ceil(i[3])-o,1);this.current.startNewPathAndClipBox([0,0,l,h]);let d="groupAt"+this.groupLevel;t.smask&&(d+="_smask_"+this.smaskCounter++%2);const u=this.cachedCanvases.getCanvas(d,l,h),f=u.context;f.translate(-a,-o),f.transform(...s);let g=new Path2D;const[y,v,w,A]=t.bbox;if(g.rect(y,v,w-y,A-v),t.matrix){const x=new Path2D;x.addPath(g,new DOMMatrix(t.matrix)),g=x}f.clip(g),t.smask?this.smaskStack.push({canvas:u.canvas,context:f,offsetX:a,offsetY:o,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(a,o),e.save()),tl(e,f),this.ctx=f,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const e=this.ctx,s=this.groupStack.pop();if(this.ctx=s,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const i=jt(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...i);const n=Ma.slice();W.axialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],i,n),this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(t,e,s,i,n){if(b(this,Xs,Ru).call(this),wh(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const a=e[2]-e[0],o=e[3]-e[1];if(n&&this.annotationCanvasMap){s=s.slice(),s[4]-=e[0],s[5]-=e[1],e=e.slice(),e[0]=e[1]=0,e[2]=a,e[3]=o,W.singularValueDecompose2dScale(jt(this.ctx),ds);const{viewportScale:l}=this,h=Math.ceil(a*this.outputScaleX*l),d=Math.ceil(o*this.outputScaleY*l);this.annotationCanvas=this.canvasFactory.create(h,d);const{canvas:u,context:f}=this.annotationCanvas;this.annotationCanvasMap.set(t,u),this.annotationCanvas.savedCtx=this.ctx,this.ctx=f,this.ctx.save(),this.ctx.setTransform(ds[0],0,0,-ds[1],0,o*ds[1]),wh(this.ctx)}else{wh(this.ctx),this.endPath();const l=new Path2D;l.rect(e[0],e[1],a,o),this.ctx.clip(l)}}this.current=new up(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...s),this.transform(...i)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),b(this,Xs,Pu).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const e=t.count;t=this.getObject(t.data,t),t.count=e;const s=this.ctx,i=this._createMaskCanvas(t),n=i.canvas;s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(n,i.offsetX,i.offsetY),s.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,s=0,i=0,n,a){if(!this.contentVisible)return;t=this.getObject(t.data,t);const o=this.ctx;o.save();const l=jt(o);o.transform(e,s,i,n,0,0);const h=this._createMaskCanvas(t);o.setTransform(1,0,0,1,h.offsetX-l[4],h.offsetY-l[5]);for(let d=0,u=a.length;d<u;d+=2){const f=W.transform(l,[e,s,i,n,a[d],a[d+1]]);o.drawImage(h.canvas,f[4],f[5])}o.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,s=this.current.fillColor,i=this.current.patternFill;for(const n of t){const{data:a,width:o,height:l,transform:h}=n,d=this.cachedCanvases.getCanvas("maskCanvas",o,l),u=d.context;u.save();const f=this.getObject(a,n);pp(u,f),u.globalCompositeOperation="source-in",u.fillStyle=i?s.getPattern(u,this,Ys(e),ye.FILL):s,u.fillRect(0,0,o,l),u.restore(),e.save(),e.transform(...h),e.scale(1,-1),vh(e,d.canvas,0,0,o,l,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);if(!e){Z("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e)}paintImageXObjectRepeat(t,e,s,i){if(!this.contentVisible)return;const n=this.getObject(t);if(!n){Z("Dependent image isn't ready yet");return}const a=n.width,o=n.height,l=[];for(let h=0,d=i.length;h<d;h+=2)l.push({transform:[e,0,0,s,i[h],i[h+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(n,l)}applyTransferMapsToCanvas(t){return this.current.transferMaps!=="none"&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return t.bitmap;const{bitmap:e,width:s,height:i}=t,n=this.cachedCanvases.getCanvas("inlineImage",s,i),a=n.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",n.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,s=t.height,i=this.ctx;this.save();const{filter:n}=i;n!=="none"&&n!==""&&(i.filter="none"),i.scale(1/e,-1/s);let a;if(t.bitmap)a=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)a=t;else{const h=this.cachedCanvases.getCanvas("inlineImage",e,s).context;fp(h,t),a=this.applyTransferMapsToCanvas(h)}const o=this._scaleImage(a,Ys(i));i.imageSmoothingEnabled=gp(jt(i),t.interpolate),vh(i,o.img,0,0,o.paintWidth,o.paintHeight,0,-s,e,s),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const s=this.ctx;let i;if(t.bitmap)i=t.bitmap;else{const n=t.width,a=t.height,l=this.cachedCanvases.getCanvas("inlineImage",n,a).context;fp(l,t),i=this.applyTransferMapsToCanvas(l)}for(const n of e)s.save(),s.transform(...n.transform),s.scale(1,-1),vh(s,i,n.x,n.y,n.w,n.h,0,-1,1,1),s.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){t==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(e)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t,e){const s=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const i=this.ctx;this.pendingClip&&(s||(this.pendingClip===mp?i.clip(t,"evenodd"):i.clip(t)),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=jt(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),s=Math.hypot(t[0],t[2]),i=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(s,i)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:e,b:s,c:i,d:n}=this.ctx.getTransform();let a,o;if(s===0&&i===0){const l=Math.abs(e),h=Math.abs(n);if(l===h)if(t===0)a=o=1/l;else{const d=l*t;a=o=d<1?1/d:1}else if(t===0)a=1/l,o=1/h;else{const d=l*t,u=h*t;a=d<1?1/d:1,o=u<1?1/u:1}}else{const l=Math.abs(e*n-s*i),h=Math.hypot(e,s),d=Math.hypot(i,n);if(t===0)a=d/l,o=h/l;else{const u=t*l;a=d>u?d/u:1,o=h>u?h/u:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t,e){const{ctx:s,current:{lineWidth:i}}=this,[n,a]=this.getScaleForStroking();if(n===a){s.lineWidth=(i||1)*n,s.stroke(t);return}const o=s.getLineDash();e&&s.save(),s.scale(n,a),Zd.a=1/n,Zd.d=1/a;const l=new Path2D;if(l.addPath(t,Zd),o.length>0){const h=Math.max(n,a);s.setLineDash(o.map(d=>d/h)),s.lineDashOffset/=h}s.lineWidth=i||1,s.stroke(l),e&&s.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};Xs=new WeakSet,Ru=function(){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)},Pu=function(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}},ku=function(t,e,s){const i=new Path2D;return i.addPath(t,new DOMMatrix(s).invertSelf().multiplySelf(e)),i};let Na=jf;for(const c in Sl)Na.prototype[c]!==void 0&&(Na.prototype[Sl[c]]=Na.prototype[c]);var rc,ac;class Ss{static get workerPort(){return r(this,rc)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");p(this,rc,t)}static get workerSrc(){return r(this,ac)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");p(this,ac,t)}}rc=new WeakMap,ac=new WeakMap,m(Ss,rc,null),m(Ss,ac,"");var so,oc;class wy{constructor({parsedData:t,rawData:e}){m(this,so);m(this,oc);p(this,so,t),p(this,oc,e)}getRaw(){return r(this,oc)}get(t){return r(this,so).get(t)??null}[Symbol.iterator](){return r(this,so).entries()}}so=new WeakMap,oc=new WeakMap;const Pa=Symbol("INTERNAL");var lc,cc,hc,io;class Ay{constructor(t,{name:e,intent:s,usage:i,rbGroups:n}){m(this,lc,!1);m(this,cc,!1);m(this,hc,!1);m(this,io,!0);p(this,lc,!!(t&hs.DISPLAY)),p(this,cc,!!(t&hs.PRINT)),this.name=e,this.intent=s,this.usage=i,this.rbGroups=n}get visible(){if(r(this,hc))return r(this,io);if(!r(this,io))return!1;const{print:t,view:e}=this.usage;return r(this,lc)?(e==null?void 0:e.viewState)!=="OFF":r(this,cc)?(t==null?void 0:t.printState)!=="OFF":!0}_setVisible(t,e,s=!1){t!==Pa&&xt("Internal method `_setVisible` called."),p(this,hc,s),p(this,io,e)}}lc=new WeakMap,cc=new WeakMap,hc=new WeakMap,io=new WeakMap;var Cn,wt,no,ro,dc,Iu;class xy{constructor(t,e=hs.DISPLAY){m(this,dc);m(this,Cn,null);m(this,wt,new Map);m(this,no,null);m(this,ro,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,p(this,ro,t.order);for(const s of t.groups)r(this,wt).set(s.id,new Ay(e,s));if(t.baseState==="OFF")for(const s of r(this,wt).values())s._setVisible(Pa,!1);for(const s of t.on)r(this,wt).get(s)._setVisible(Pa,!0);for(const s of t.off)r(this,wt).get(s)._setVisible(Pa,!1);p(this,no,this.getHash())}}isVisible(t){if(r(this,wt).size===0)return!0;if(!t)return Td("Optional content group not defined."),!0;if(t.type==="OCG")return r(this,wt).has(t.id)?r(this,wt).get(t.id).visible:(Z(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return b(this,dc,Iu).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const e of t.ids){if(!r(this,wt).has(e))return Z(`Optional content group not found: ${e}`),!0;if(r(this,wt).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const e of t.ids){if(!r(this,wt).has(e))return Z(`Optional content group not found: ${e}`),!0;if(!r(this,wt).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const e of t.ids){if(!r(this,wt).has(e))return Z(`Optional content group not found: ${e}`),!0;if(!r(this,wt).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const e of t.ids){if(!r(this,wt).has(e))return Z(`Optional content group not found: ${e}`),!0;if(r(this,wt).get(e).visible)return!1}return!0}return Z(`Unknown optional content policy ${t.policy}.`),!0}return Z(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,s=!0){var n;const i=r(this,wt).get(t);if(!i){Z(`Optional content group not found: ${t}`);return}if(s&&e&&i.rbGroups.length)for(const a of i.rbGroups)for(const o of a)o!==t&&((n=r(this,wt).get(o))==null||n._setVisible(Pa,!1,!0));i._setVisible(Pa,!!e,!0),p(this,Cn,null)}setOCGState({state:t,preserveRB:e}){let s;for(const i of t){switch(i){case"ON":case"OFF":case"Toggle":s=i;continue}const n=r(this,wt).get(i);if(n)switch(s){case"ON":this.setVisibility(i,!0,e);break;case"OFF":this.setVisibility(i,!1,e);break;case"Toggle":this.setVisibility(i,!n.visible,e);break}}p(this,Cn,null)}get hasInitialVisibility(){return r(this,no)===null||this.getHash()===r(this,no)}getOrder(){return r(this,wt).size?r(this,ro)?r(this,ro).slice():[...r(this,wt).keys()]:null}getGroup(t){return r(this,wt).get(t)||null}getHash(){if(r(this,Cn)!==null)return r(this,Cn);const t=new Ig;for(const[e,s]of r(this,wt))t.update(`${e}:${s.visible}`);return p(this,Cn,t.hexdigest())}[Symbol.iterator](){return r(this,wt).entries()}}Cn=new WeakMap,wt=new WeakMap,no=new WeakMap,ro=new WeakMap,dc=new WeakSet,Iu=function(t){const e=t.length;if(e<2)return!0;const s=t[0];for(let i=1;i<e;i++){const n=t[i];let a;if(Array.isArray(n))a=b(this,dc,Iu).call(this,n);else if(r(this,wt).has(n))a=r(this,wt).get(n).visible;else return Z(`Optional content group not found: ${n}`),!0;switch(s){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return s==="And"};class Ey{constructor(t,{disableRange:e=!1,disableStream:s=!1}){Zt(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:i,initialData:n,progressiveDone:a,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=o,(n==null?void 0:n.length)>0){const l=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!s,this._isRangeSupported=!e,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((l,h)=>{this._onReceiveData({begin:l,chunk:h})}),t.addProgressListener((l,h)=>{this._onProgress({loaded:l,total:h})}),t.addProgressiveReadListener(l=>{this._onReceiveData({chunk:l})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:e}){const s=e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;if(t===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(s):this._queuedChunks.push(s);else{const i=this._rangeReaders.some(function(n){return n._begin!==t?!1:(n._enqueue(s),!0)});Zt(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}_onProgress(t){var e,s,i,n;t.total===void 0?(s=(e=this._rangeReaders[0])==null?void 0:e.onProgress)==null||s.call(e,{loaded:t.loaded}):(n=(i=this._fullRequestReader)==null?void 0:i.onProgress)==null||n.call(i,{loaded:t.loaded,total:t.total})}_onProgressiveDone(){var t;(t=this._fullRequestReader)==null||t.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){Zt(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new _y(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new Sy(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeReaders.slice(0))s.cancel(t);this._pdfDataRangeTransport.abort()}}class _y{constructor(t,e,s=!1,i=null){this._stream=t,this._done=s||!1,this._filename=Pd(i)?i:null,this._queuedChunks=e||[],this._loaded=0;for(const n of this._queuedChunks)this._loaded+=n.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Sy{constructor(t,e,s){this._stream=t,this._begin=e,this._end=s,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length===0)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const s of this._requests)s.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function Cy(c){let t=!0,e=s("filename\\*","i").exec(c);if(e){e=e[1];let d=o(e);return d=unescape(d),d=l(d),d=h(d),n(d)}if(e=a(c),e){const d=h(e);return n(d)}if(e=s("filename","i").exec(c),e){e=e[1];let d=o(e);return d=h(d),n(d)}function s(d,u){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',u)}function i(d,u){if(d){if(!/^[\x00-\xFF]+$/.test(u))return u;try{const f=new TextDecoder(d,{fatal:!0}),g=oh(u);u=f.decode(g),t=!1}catch{}}return u}function n(d){return t&&/[\x80-\xff]/.test(d)&&(d=i("utf-8",d),t&&(d=i("iso-8859-1",d))),d}function a(d){const u=[];let f;const g=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=g.exec(d))!==null;){let[,v,w,A]=f;if(v=parseInt(v,10),v in u){if(v===0)break;continue}u[v]=[w,A]}const y=[];for(let v=0;v<u.length&&v in u;++v){let[w,A]=u[v];A=o(A),w&&(A=unescape(A),v===0&&(A=l(A))),y.push(A)}return y.join("")}function o(d){if(d.startsWith('"')){const u=d.slice(1).split('\\"');for(let f=0;f<u.length;++f){const g=u[f].indexOf('"');g!==-1&&(u[f]=u[f].slice(0,g),u.length=f+1),u[f]=u[f].replaceAll(/\\(.)/g,"$1")}d=u.join('"')}return d}function l(d){const u=d.indexOf("'");if(u===-1)return d;const f=d.slice(0,u),y=d.slice(u+1).replace(/^[^']*'/,"");return i(f,y)}function h(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(u,f,g,y){if(g==="q"||g==="Q")return y=y.replaceAll("_"," "),y=y.replaceAll(/=([0-9a-fA-F]{2})/g,function(v,w){return String.fromCharCode(parseInt(w,16))}),i(f,y);try{y=atob(y)}catch{}return i(f,y)})}return""}function Vg(c,t){const e=new Headers;if(!c||!t||typeof t!="object")return e;for(const s in t){const i=t[s];i!==void 0&&e.append(s,i)}return e}function Id(c){var t;return((t=URL.parse(c))==null?void 0:t.origin)??null}function Ug({responseHeaders:c,isHttp:t,rangeChunkSize:e,disableRange:s}){const i={allowRangeRequests:!1,suggestedLength:void 0},n=parseInt(c.get("Content-Length"),10);return!Number.isInteger(n)||(i.suggestedLength=n,n<=2*e)||s||!t||c.get("Accept-Ranges")!=="bytes"||(c.get("Content-Encoding")||"identity")!=="identity"||(i.allowRangeRequests=!0),i}function Wg(c){const t=c.get("Content-Disposition");if(t){let e=Cy(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(Pd(e))return e}return null}function dh(c,t){return new Cl(`Unexpected server response (${c}) while retrieving PDF "${t}".`,c,c===404||c===0&&t.startsWith("file:"))}function qg(c){return c===200||c===206}function Xg(c,t,e){return{method:"GET",headers:c,signal:e.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function Yg(c){return c instanceof Uint8Array?c.buffer:c instanceof ArrayBuffer?c:(Z(`getArrayBuffer - unexpected data format: ${c}`),new Uint8Array(c).buffer)}class Ty{constructor(t){L(this,"_responseOrigin",null);this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=Vg(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}getFullReader(){return Zt(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Ry(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new Py(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class Ry{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange;const s=new Headers(t.headers),i=e.url;fetch(i,Xg(s,this._withCredentials,this._abortController)).then(n=>{if(t._responseOrigin=Id(n.url),!qg(n.status))throw dh(n.status,i);this._reader=n.body.getReader(),this._headersCapability.resolve();const a=n.headers,{allowRangeRequests:o,suggestedLength:l}=Ug({responseHeaders:a,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=l||this._contentLength,this._filename=Wg(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new sn("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;await this._headersCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded,total:this._contentLength}),{value:Yg(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}class Py{constructor(t,e,s){this._stream=t,this._reader=null,this._loaded=0;const i=t.source;this._withCredentials=i.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!i.disableStream,this._abortController=new AbortController;const n=new Headers(t.headers);n.append("Range",`bytes=${e}-${s-1}`);const a=i.url;fetch(a,Xg(n,this._withCredentials,this._abortController)).then(o=>{const l=Id(o.url);if(l!==t._responseOrigin)throw new Error(`Expected range response-origin "${l}" to match "${t._responseOrigin}".`);if(!qg(o.status))throw dh(o.status,a);this._readCapability.resolve(),this._reader=o.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;await this._readCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded}),{value:Yg(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}const Qd=200,tu=206;function ky(c){const t=c.response;return typeof t!="string"?t:oh(t).buffer}class Iy{constructor({url:t,httpHeaders:e,withCredentials:s}){L(this,"_responseOrigin",null);this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=Vg(this.isHttp,e),this.withCredentials=s||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(t){const e=new XMLHttpRequest,s=this.currXhrId++,i=this.pendingRequests[s]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const[n,a]of this.headers)e.setRequestHeader(n,a);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),i.expectedStatus=tu):i.expectedStatus=Qd,e.responseType="arraybuffer",Zt(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>{t.onError(e.status)},e.onreadystatechange=this.onStateChange.bind(this,s),e.onprogress=this.onProgress.bind(this,s),i.onHeadersReceived=t.onHeadersReceived,i.onDone=t.onDone,i.onError=t.onError,i.onProgress=t.onProgress,e.send(null),s}onProgress(t,e){var i;const s=this.pendingRequests[t];s&&((i=s.onProgress)==null||i.call(s,e))}onStateChange(t,e){const s=this.pendingRequests[t];if(!s)return;const i=s.xhr;if(i.readyState>=2&&s.onHeadersReceived&&(s.onHeadersReceived(),delete s.onHeadersReceived),i.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],i.status===0&&this.isHttp){s.onError(i.status);return}const n=i.status||Qd;if(!(n===Qd&&s.expectedStatus===tu)&&n!==s.expectedStatus){s.onError(i.status);return}const o=ky(i);if(n===tu){const l=i.getResponseHeader("Content-Range"),h=/bytes (\d+)-(\d+)\/(\d+)/.exec(l);h?s.onDone({begin:parseInt(h[1],10),chunk:o}):(Z('Missing or invalid "Content-Range" header.'),s.onError(0))}else o?s.onDone({begin:0,chunk:o}):s.onError(i.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class My{constructor(t){this._source=t,this._manager=new Iy(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return Zt(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Ly(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const s=new Dy(this._manager,t,e);return s.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class Ly{constructor(t,e){this._manager=t,this._url=e.url,this._fullRequestId=t.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=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t);this._manager._responseOrigin=Id(e.responseURL);const s=e.getAllResponseHeaders(),i=new Headers(s?s.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(o=>{const[l,...h]=o.split(": ");return[l,h.join(": ")]}):[]),{allowRangeRequests:n,suggestedLength:a}=Ug({responseHeaders:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=a||this._contentLength,this._filename=Wg(i),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=dh(t,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;(e=this.onProgress)==null||e.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(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 t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class Dy{constructor(t,e,s){this._manager=t,this._url=t.url,this._requestId=t.request({begin:e,end:s,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(){var e;const t=Id((e=this._manager.getRequestXhr(this._requestId))==null?void 0:e.responseURL);t!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${t}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){var t;(t=this.onClosed)==null||t.call(this,this)}_onDone(t){const e=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0;for(const s of this._requests)s.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError??(this._storedError=dh(t,this._url));for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){var e;this.isStreamingSupported||(e=this.onProgress)==null||e.call(this,{loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const Ny=/^[a-z][a-z0-9\-+.]+:/i;function Fy(c){if(Ny.test(c))return new URL(c);const t=process.getBuiltinModule("url");return new URL(t.pathToFileURL(c))}class Oy{constructor(t){this.source=t,this.url=Fy(t.url),Zt(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}getFullReader(){return Zt(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new By(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new jy(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class By{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const s=process.getBuiltinModule("fs");s.promises.lstat(this._url).then(i=>{this._contentLength=i.size,this._setReadableStream(s.createReadStream(this._url)),this._headersCapability.resolve()},i=>{i.code==="ENOENT"&&(i=dh(0,this._url.href)),this._storedError=i,this._headersCapability.reject(i)})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new sn("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class jy{constructor(t,e,s){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const i=t.source;this._isStreamingSupported=!i.disableStream;const n=process.getBuiltinModule("fs");this._setReadableStream(n.createReadStream(this._url,{start:e,end:s-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const el=Symbol("INITIAL_DATA");var Qe,uc,Mu;class Kg{constructor(){m(this,uc);m(this,Qe,Object.create(null))}get(t,e=null){if(e){const i=b(this,uc,Mu).call(this,t);return i.promise.then(()=>e(i.data)),null}const s=r(this,Qe)[t];if(!s||s.data===el)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return s.data}has(t){const e=r(this,Qe)[t];return!!e&&e.data!==el}delete(t){const e=r(this,Qe)[t];return!e||e.data===el?!1:(delete r(this,Qe)[t],!0)}resolve(t,e=null){const s=b(this,uc,Mu).call(this,t);s.data=e,s.resolve()}clear(){var t;for(const e in r(this,Qe)){const{data:s}=r(this,Qe)[e];(t=s==null?void 0:s.bitmap)==null||t.close()}p(this,Qe,Object.create(null))}*[Symbol.iterator](){for(const t in r(this,Qe)){const{data:e}=r(this,Qe)[t];e!==el&&(yield[t,e])}}}Qe=new WeakMap,uc=new WeakSet,Mu=function(t){var e;return(e=r(this,Qe))[t]||(e[t]={...Promise.withResolvers(),data:el})};const Hy=1e5,bp=30;var Pp,Tn,We,fc,pc,kr,Fi,gc,mc,Ir,ao,oo,Rn,lo,bc,co,Mr,yc,vc,$t,ho,Lr,wc,Pn,uo,rn,Jg,Zg,Lu,fs,Lh,Du,Qg,tm;let Rl=($t=class{constructor({textContentSource:t,container:e,viewport:s}){m(this,rn);m(this,Tn,Promise.withResolvers());m(this,We,null);m(this,fc,!1);m(this,pc,!!((Pp=globalThis.FontInspector)!=null&&Pp.enabled));m(this,kr,null);m(this,Fi,null);m(this,gc,0);m(this,mc,0);m(this,Ir,null);m(this,ao,null);m(this,oo,0);m(this,Rn,0);m(this,lo,Object.create(null));m(this,bc,[]);m(this,co,null);m(this,Mr,[]);m(this,yc,new WeakMap);m(this,vc,null);var l;if(t instanceof ReadableStream)p(this,co,t);else if(typeof t=="object")p(this,co,new ReadableStream({start(h){h.enqueue(t),h.close()}}));else throw new Error('No "textContentSource" parameter specified.');p(this,We,p(this,ao,e)),p(this,Rn,s.scale*qs.pixelRatio),p(this,oo,s.rotation),p(this,Fi,{div:null,properties:null,ctx:null});const{pageWidth:i,pageHeight:n,pageX:a,pageY:o}=s.rawDims;p(this,vc,[1,0,0,-1,-a,o+n]),p(this,mc,i),p(this,gc,n),b(l=$t,fs,Qg).call(l),Xn(e,s),r(this,Tn).promise.finally(()=>{r($t,uo).delete(this),p(this,Fi,null),p(this,lo,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=ue.platform;return it(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){const t=()=>{r(this,Ir).read().then(({value:e,done:s})=>{if(s){r(this,Tn).resolve();return}r(this,kr)??p(this,kr,e.lang),Object.assign(r(this,lo),e.styles),b(this,rn,Jg).call(this,e.items),t()},r(this,Tn).reject)};return p(this,Ir,r(this,co).getReader()),r($t,uo).add(this),t(),r(this,Tn).promise}update({viewport:t,onBefore:e=null}){var n;const s=t.scale*qs.pixelRatio,i=t.rotation;if(i!==r(this,oo)&&(e==null||e(),p(this,oo,i),Xn(r(this,ao),{rotation:i})),s!==r(this,Rn)){e==null||e(),p(this,Rn,s);const a={div:null,properties:null,ctx:b(n=$t,fs,Lh).call(n,r(this,kr))};for(const o of r(this,Mr))a.properties=r(this,yc).get(o),a.div=o,b(this,rn,Lu).call(this,a)}}cancel(){var e;const t=new sn("TextLayer task cancelled.");(e=r(this,Ir))==null||e.cancel(t).catch(()=>{}),p(this,Ir,null),r(this,Tn).reject(t)}get textDivs(){return r(this,Mr)}get textContentItemsStr(){return r(this,bc)}static cleanup(){if(!(r(this,uo).size>0)){r(this,ho).clear();for(const{canvas:t}of r(this,Lr).values())t.remove();r(this,Lr).clear()}}},Tn=new WeakMap,We=new WeakMap,fc=new WeakMap,pc=new WeakMap,kr=new WeakMap,Fi=new WeakMap,gc=new WeakMap,mc=new WeakMap,Ir=new WeakMap,ao=new WeakMap,oo=new WeakMap,Rn=new WeakMap,lo=new WeakMap,bc=new WeakMap,co=new WeakMap,Mr=new WeakMap,yc=new WeakMap,vc=new WeakMap,ho=new WeakMap,Lr=new WeakMap,wc=new WeakMap,Pn=new WeakMap,uo=new WeakMap,rn=new WeakSet,Jg=function(t){var i,n;if(r(this,fc))return;(n=r(this,Fi)).ctx??(n.ctx=b(i=$t,fs,Lh).call(i,r(this,kr)));const e=r(this,Mr),s=r(this,bc);for(const a of t){if(e.length>Hy){Z("Ignoring additional textDivs for performance reasons."),p(this,fc,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const o=r(this,We);p(this,We,document.createElement("span")),r(this,We).classList.add("markedContent"),a.id!==null&&r(this,We).setAttribute("id",`${a.id}`),o.append(r(this,We))}else a.type==="endMarkedContent"&&p(this,We,r(this,We).parentNode);continue}s.push(a.str),b(this,rn,Zg).call(this,a)}},Zg=function(t){var v;const e=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};r(this,Mr).push(e);const i=W.transform(r(this,vc),t.transform);let n=Math.atan2(i[1],i[0]);const a=r(this,lo)[t.fontName];a.vertical&&(n+=Math.PI/2);let o=r(this,pc)&&a.fontSubstitution||a.fontFamily;o=$t.fontFamilyMap.get(o)||o;const l=Math.hypot(i[2],i[3]),h=l*b(v=$t,fs,tm).call(v,o,a,r(this,kr));let d,u;n===0?(d=i[4],u=i[5]-h):(d=i[4]+h*Math.sin(n),u=i[5]-h*Math.cos(n));const f="calc(var(--total-scale-factor) *",g=e.style;r(this,We)===r(this,ao)?(g.left=`${(100*d/r(this,mc)).toFixed(2)}%`,g.top=`${(100*u/r(this,gc)).toFixed(2)}%`):(g.left=`${f}${d.toFixed(2)}px)`,g.top=`${f}${u.toFixed(2)}px)`),g.fontSize=`${f}${(r($t,Pn)*l).toFixed(2)}px)`,g.fontFamily=o,s.fontSize=l,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,r(this,pc)&&(e.dataset.fontName=a.fontSubstitutionLoadedName||t.fontName),n!==0&&(s.angle=n*(180/Math.PI));let y=!1;if(t.str.length>1)y=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const w=Math.abs(t.transform[0]),A=Math.abs(t.transform[3]);w!==A&&Math.max(w,A)/Math.min(w,A)>1.5&&(y=!0)}if(y&&(s.canvasWidth=a.vertical?t.height:t.width),r(this,yc).set(e,s),r(this,Fi).div=e,r(this,Fi).properties=s,b(this,rn,Lu).call(this,r(this,Fi)),s.hasText&&r(this,We).append(e),s.hasEOL){const w=document.createElement("br");w.setAttribute("role","presentation"),r(this,We).append(w)}},Lu=function(t){var o;const{div:e,properties:s,ctx:i}=t,{style:n}=e;let a="";if(r($t,Pn)>1&&(a=`scale(${1/r($t,Pn)})`),s.canvasWidth!==0&&s.hasText){const{fontFamily:l}=n,{canvasWidth:h,fontSize:d}=s;b(o=$t,fs,Du).call(o,i,d*r(this,Rn),l);const{width:u}=i.measureText(e.textContent);u>0&&(a=`scaleX(${h*r(this,Rn)/u}) ${a}`)}s.angle!==0&&(a=`rotate(${s.angle}deg) ${a}`),a.length>0&&(n.transform=a)},fs=new WeakSet,Lh=function(t=null){let e=r(this,Lr).get(t||(t=""));if(!e){const s=document.createElement("canvas");s.className="hiddenCanvasElement",s.lang=t,document.body.append(s),e=s.getContext("2d",{alpha:!1,willReadFrequently:!0}),r(this,Lr).set(t,e),r(this,wc).set(e,{size:0,family:""})}return e},Du=function(t,e,s){const i=r(this,wc).get(t);e===i.size&&s===i.family||(t.font=`${e}px ${s}`,i.size=e,i.family=s)},Qg=function(){if(r(this,Pn)!==null)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),p(this,Pn,t.getBoundingClientRect().height),t.remove()},tm=function(t,e,s){const i=r(this,ho).get(t);if(i)return i;const n=b(this,fs,Lh).call(this,s);n.canvas.width=n.canvas.height=bp,b(this,fs,Du).call(this,n,bp,t);const a=n.measureText(""),o=a.fontBoundingBoxAscent,l=Math.abs(a.fontBoundingBoxDescent);n.canvas.width=n.canvas.height=0;let h=.8;return o?h=o/(o+l):(ue.platform.isFirefox&&Z("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?h=e.ascent:e.descent&&(h=1+e.descent)),r(this,ho).set(t,h),h},m($t,fs),m($t,ho,new Map),m($t,Lr,new Map),m($t,wc,new WeakMap),m($t,Pn,null),m($t,uo,new Set),$t);class Pl{static textContent(t){const e=[],s={items:e,styles:Object.create(null)};function i(n){var l;if(!n)return;let a=null;const o=n.name;if(o==="#text")a=n.value;else if(Pl.shouldBuildText(o))(l=n==null?void 0:n.attributes)!=null&&l.textContent?a=n.attributes.textContent:n.value&&(a=n.value);else return;if(a!==null&&e.push({str:a}),!!n.children)for(const h of n.children)i(h)}return i(t),s}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const $y=100;function Pf(c={}){typeof c=="string"||c instanceof URL?c={url:c}:(c instanceof ArrayBuffer||ArrayBuffer.isView(c))&&(c={data:c});const t=new Nu,{docId:e}=t,s=c.url?J0(c.url):null,i=c.data?Z0(c.data):null,n=c.httpHeaders||null,a=c.withCredentials===!0,o=c.password??null,l=c.range instanceof kf?c.range:null,h=Number.isInteger(c.rangeChunkSize)&&c.rangeChunkSize>0?c.rangeChunkSize:2**16;let d=c.worker instanceof Uo?c.worker:null;const u=c.verbosity,f=typeof c.docBaseUrl=="string"&&!ch(c.docBaseUrl)?c.docBaseUrl:null,g=bh(c.cMapUrl),y=c.cMapPacked!==!1,v=c.CMapReaderFactory||(Be?ry:rp),w=bh(c.iccUrl),A=bh(c.standardFontDataUrl),x=c.StandardFontDataFactory||(Be?ay:ap),_=bh(c.wasmUrl),S=c.WasmFactory||(Be?oy:op),C=c.stopAtErrors!==!0,R=Number.isInteger(c.maxImageSize)&&c.maxImageSize>-1?c.maxImageSize:-1,T=c.isEvalSupported!==!1,k=typeof c.isOffscreenCanvasSupported=="boolean"?c.isOffscreenCanvasSupported:!Be,I=typeof c.isImageDecoderSupported=="boolean"?c.isImageDecoderSupported:!Be&&(ue.platform.isFirefox||!globalThis.chrome),D=Number.isInteger(c.canvasMaxAreaInBytes)?c.canvasMaxAreaInBytes:-1,N=typeof c.disableFontFace=="boolean"?c.disableFontFace:Be,Y=c.fontExtraProperties===!0,q=c.enableXfa===!0,H=c.ownerDocument||globalThis.document,st=c.disableRange===!0,F=c.disableStream===!0,O=c.disableAutoFetch===!0,yt=c.pdfBug===!0,Tt=c.CanvasFactory||(Be?ny:ey),zt=c.FilterFactory||(Be?iy:sy),mt=c.enableHWA===!0,_t=c.useWasm!==!1,ft=l?l.length:c.length??NaN,we=typeof c.useSystemFonts=="boolean"?c.useSystemFonts:!Be&&!N,Ae=typeof c.useWorkerFetch=="boolean"?c.useWorkerFetch:!!(v===rp&&x===ap&&S===op&&g&&A&&_&&nl(g,document.baseURI)&&nl(A,document.baseURI)&&nl(_,document.baseURI)),te=null;L0(u);const dt={canvasFactory:new Tt({ownerDocument:H,enableHWA:mt}),filterFactory:new zt({docId:e,ownerDocument:H}),cMapReaderFactory:Ae?null:new v({baseUrl:g,isCompressed:y}),standardFontDataFactory:Ae?null:new x({baseUrl:A}),wasmFactory:Ae?null:new S({baseUrl:_})};d||(d=Uo.create({verbosity:u,port:Ss.workerPort}),t._worker=d);const Pe={docId:e,apiVersion:"5.3.93",data:i,password:o,disableAutoFetch:O,rangeChunkSize:h,length:ft,docBaseUrl:f,enableXfa:q,evaluatorOptions:{maxImageSize:R,disableFontFace:N,ignoreErrors:C,isEvalSupported:T,isOffscreenCanvasSupported:k,isImageDecoderSupported:I,canvasMaxAreaInBytes:D,fontExtraProperties:Y,useSystemFonts:we,useWasm:_t,useWorkerFetch:Ae,cMapUrl:g,iccUrl:w,standardFontDataUrl:A,wasmUrl:_}},ke={ownerDocument:H,pdfBug:yt,styleElement:te,loadingParams:{disableAutoFetch:O,enableXfa:q}};return d.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const vt=d.messageHandler.sendWithPromise("GetDocRequest",Pe,i?[i.buffer]:null);let Ps;if(l)Ps=new Ey(l,{disableRange:st,disableStream:F});else if(!i){if(!s)throw new Error("getDocument - no `url` parameter provided.");const ps=nl(s)?Ty:Be?Oy:My;Ps=new ps({url:s,length:ft,httpHeaders:n,withCredentials:a,rangeChunkSize:h,disableRange:st,disableStream:F})}return vt.then(ps=>{if(t.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const ot=new cl(e,ps,d.port),Rt=new Vy(ot,t,Ps,ke,dt);t._transport=Rt,ot.send("Ready",null)})}).catch(t._capability.reject),t}var md;const bd=class bd{constructor(){L(this,"_capability",Promise.withResolvers());L(this,"_transport",null);L(this,"_worker",null);L(this,"docId",`d${Me(bd,md)._++}`);L(this,"destroyed",!1);L(this,"onPassword",null);L(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var t,e,s,i;this.destroyed=!0;try{(t=this._worker)!=null&&t.port&&(this._worker._pendingDestroy=!0),await((e=this._transport)==null?void 0:e.destroy())}catch(n){throw(s=this._worker)!=null&&s.port&&delete this._worker._pendingDestroy,n}this._transport=null,(i=this._worker)==null||i.destroy(),this._worker=null}async getData(){return this._transport.getData()}};md=new WeakMap,m(bd,md,0);let Nu=bd;var Dr,Ac,xc,Ec,_c,kp;let kf=(kp=class{constructor(t,e,s=!1,i=null){m(this,Dr,Promise.withResolvers());m(this,Ac,[]);m(this,xc,[]);m(this,Ec,[]);m(this,_c,[]);this.length=t,this.initialData=e,this.progressiveDone=s,this.contentDispositionFilename=i}addRangeListener(t){r(this,_c).push(t)}addProgressListener(t){r(this,Ec).push(t)}addProgressiveReadListener(t){r(this,xc).push(t)}addProgressiveDoneListener(t){r(this,Ac).push(t)}onDataRange(t,e){for(const s of r(this,_c))s(t,e)}onDataProgress(t,e){r(this,Dr).promise.then(()=>{for(const s of r(this,Ec))s(t,e)})}onDataProgressiveRead(t){r(this,Dr).promise.then(()=>{for(const e of r(this,xc))e(t)})}onDataProgressiveDone(){r(this,Dr).promise.then(()=>{for(const t of r(this,Ac))t()})}transportReady(){r(this,Dr).resolve()}requestDataRange(t,e){xt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},Dr=new WeakMap,Ac=new WeakMap,xc=new WeakMap,Ec=new WeakMap,_c=new WeakMap,kp);class zy{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return it(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var Oi,Nr,pl;class Gy{constructor(t,e,s,i=!1){m(this,Nr);m(this,Oi,!1);this._pageIndex=t,this._pageInfo=e,this._transport=s,this._stats=i?new sp:null,this._pdfBug=i,this.commonObjs=s.commonObjs,this.objs=new Kg,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:s=0,offsetY:i=0,dontFlip:n=!1}={}){return new lh({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}getAnnotations({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return it(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return((t=this._transport._htmlForXfa)==null?void 0:t.children[this._pageIndex])||null}render({canvasContext:t,viewport:e,intent:s="display",annotationMode:i=gi.ENABLE,transform:n=null,background:a=null,optionalContentConfigPromise:o=null,annotationCanvasMap:l=null,pageColors:h=null,printAnnotationStorage:d=null,isEditing:u=!1}){var S,C;(S=this._stats)==null||S.time("Overall");const f=this._transport.getRenderingIntent(s,i,d,u),{renderingIntent:g,cacheKey:y}=f;p(this,Oi,!1),o||(o=this._transport.getOptionalContentConfig(g));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 w=!!(g&hs.PRINT);v.displayReadyCapability||(v.displayReadyCapability=Promise.withResolvers(),v.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(C=this._stats)==null||C.time("Page Request"),this._pumpOperatorList(f));const A=R=>{var T;v.renderTasks.delete(x),w&&p(this,Oi,!0),b(this,Nr,pl).call(this),R?(x.capability.reject(R),this._abortOperatorList({intentState:v,reason:R instanceof Error?R:new Error(R)})):x.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(T=globalThis.Stats)!=null&&T.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},x=new Fu({callback:A,params:{canvasContext:t,viewport:e,transform:n,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:v.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!w,pdfBug:this._pdfBug,pageColors:h});(v.renderTasks||(v.renderTasks=new Set)).add(x);const _=x.task;return Promise.all([v.displayReadyCapability.promise,o]).then(([R,T])=>{var k;if(this.destroyed){A();return}if((k=this._stats)==null||k.time("Rendering"),!(T.renderingIntent&g))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");x.initializeGraphics({transparency:R,optionalContentConfig:T}),x.operatorListChanged()}).catch(A),_}getOperatorList({intent:t="display",annotationMode:e=gi.ENABLE,printAnnotationStorage:s=null,isEditing:i=!1}={}){var h;function n(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}const a=this._transport.getRenderingIntent(t,e,s,i,!0);let o=this._intentStates.get(a.cacheKey);o||(o=Object.create(null),this._intentStates.set(a.cacheKey,o));let l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=n,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(l),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(h=this._stats)==null||h.time("Page Request"),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(i){return i.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(s=>Pl.textContent(s));const e=this.streamTextContent(t);return new Promise(function(s,i){function n(){a.read().then(function({value:l,done:h}){if(h){s(o);return}o.lang??(o.lang=l.lang),Object.assign(o.styles,l.styles),o.items.push(...l.items),n()},i)}const a=e.getReader(),o={items:[],styles:Object.create(null),lang:null};n()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const s of e.renderTasks)t.push(s.completed),s.cancel();return this.objs.clear(),p(this,Oi,!1),Promise.all(t)}cleanup(t=!1){p(this,Oi,!0);const e=b(this,Nr,pl).call(this);return t&&e&&this._stats&&(this._stats=new sp),e}_startRenderPage(t,e){var i,n;const s=this._intentStates.get(e);s&&((i=this._stats)==null||i.timeEnd("Page Request"),(n=s.displayReadyCapability)==null||n.resolve(t))}_renderPageChunk(t,e){for(let s=0,i=t.length;s<i;s++)e.operatorList.fnArray.push(t.fnArray[s]),e.operatorList.argsArray.push(t.argsArray[s]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const s of e.renderTasks)s.operatorListChanged();t.lastChunk&&b(this,Nr,pl).call(this)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:s,modifiedIds:i}){const{map:n,transfer:a}=s,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:n,modifiedIds:i},a).getReader(),h=this._intentStates.get(e);h.streamReader=l;const d=()=>{l.read().then(({value:u,done:f})=>{if(f){h.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(u,h),d())},u=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const f of h.renderTasks)f.operatorListChanged();b(this,Nr,pl).call(this)}if(h.displayReadyCapability)h.displayReadyCapability.reject(u);else if(h.opListReadCapability)h.opListReadCapability.reject(u);else throw u}})};d()}_abortOperatorList({intentState:t,reason:e,force:s=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!s){if(t.renderTasks.size>0)return;if(e instanceof Rd){let i=$y;e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i);return}}if(t.streamReader.cancel(new sn(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[i,n]of this._intentStates)if(n===t){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}}Oi=new WeakMap,Nr=new WeakSet,pl=function(){if(!r(this,Oi)||this.destroyed)return!1;for(const{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),p(this,Oi,!1),!0};var kn,Os,Bi,Fr,yd,Or,Br,He,Dh,em,sm,gl,fo,Nh;const Dt=class Dt{constructor({name:t=null,port:e=null,verbosity:s=D0()}={}){m(this,He);m(this,kn,Promise.withResolvers());m(this,Os,null);m(this,Bi,null);m(this,Fr,null);if(this.name=t,this.destroyed=!1,this.verbosity=s,e){if(r(Dt,Br).has(e))throw new Error("Cannot use more than one PDFWorker per port.");r(Dt,Br).set(e,this),b(this,He,em).call(this,e)}else b(this,He,sm).call(this)}get promise(){return r(this,kn).promise}get port(){return r(this,Bi)}get messageHandler(){return r(this,Os)}destroy(){var t,e;this.destroyed=!0,(t=r(this,Fr))==null||t.terminate(),p(this,Fr,null),r(Dt,Br).delete(r(this,Bi)),p(this,Bi,null),(e=r(this,Os))==null||e.destroy(),p(this,Os,null)}static create(t){const e=r(this,Br).get(t==null?void 0:t.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new Dt(t)}static get workerSrc(){if(Ss.workerSrc)return Ss.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return it(this,"_setupFakeWorkerGlobal",(async()=>r(this,fo,Nh)?r(this,fo,Nh):(await import(this.workerSrc)).WorkerMessageHandler)())}};kn=new WeakMap,Os=new WeakMap,Bi=new WeakMap,Fr=new WeakMap,yd=new WeakMap,Or=new WeakMap,Br=new WeakMap,He=new WeakSet,Dh=function(){r(this,kn).resolve(),r(this,Os).send("configure",{verbosity:this.verbosity})},em=function(t){p(this,Bi,t),p(this,Os,new cl("main","worker",t)),r(this,Os).on("ready",()=>{}),b(this,He,Dh).call(this)},sm=function(){if(r(Dt,Or)||r(Dt,fo,Nh)){b(this,He,gl).call(this);return}let{workerSrc:t}=Dt;try{Dt._isSameOrigin(window.location,t)||(t=Dt._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),s=new cl("main","worker",e),i=()=>{n.abort(),s.destroy(),e.terminate(),this.destroyed?r(this,kn).reject(new Error("Worker was destroyed")):b(this,He,gl).call(this)},n=new AbortController;e.addEventListener("error",()=>{r(this,Fr)||i()},{signal:n.signal}),s.on("test",o=>{if(n.abort(),this.destroyed||!o){i();return}p(this,Os,s),p(this,Bi,e),p(this,Fr,e),b(this,He,Dh).call(this)}),s.on("ready",o=>{if(n.abort(),this.destroyed){i();return}try{a()}catch{b(this,He,gl).call(this)}});const a=()=>{const o=new Uint8Array;s.send("test",o,[o.buffer])};a();return}catch{Td("The worker has been disabled.")}b(this,He,gl).call(this)},gl=function(){r(Dt,Or)||(Z("Setting up fake worker."),p(Dt,Or,!0)),Dt._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){r(this,kn).reject(new Error("Worker was destroyed"));return}const e=new ty;p(this,Bi,e);const s=`fake${Me(Dt,yd)._++}`,i=new cl(s+"_worker",s,e);t.setup(i,e),p(this,Os,new cl(s,s+"_worker",e)),b(this,He,Dh).call(this)}).catch(t=>{r(this,kn).reject(new Error(`Setting up fake worker failed: "${t.message}".`))})},fo=new WeakSet,Nh=function(){var t;try{return((t=globalThis.pdfjsWorker)==null?void 0:t.WorkerMessageHandler)||null}catch{return null}},m(Dt,fo),m(Dt,yd,0),m(Dt,Or,!1),m(Dt,Br,new WeakMap),Be&&(p(Dt,Or,!0),Ss.workerSrc||(Ss.workerSrc="./pdf.worker.mjs")),Dt._isSameOrigin=(t,e)=>{const s=URL.parse(t);if(!(s!=null&&s.origin)||s.origin==="null")return!1;const i=new URL(e,s);return s.origin===i.origin},Dt._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},Dt.fromPort=t=>{if(G0("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!(t!=null&&t.port))throw new Error("PDFWorker.fromPort - invalid method signature.");return Dt.create(t)};let Uo=Dt;var ji,oi,po,go,Hi,jr,ml;class Vy{constructor(t,e,s,i,n){m(this,jr);m(this,ji,new Map);m(this,oi,new Map);m(this,po,new Map);m(this,go,new Map);m(this,Hi,null);this.messageHandler=t,this.loadingTask=e,this.commonObjs=new Kg,this.fontLoader=new Y0({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.wasmFactory=n.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=s,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return it(this,"annotationStorage",new Cf)}getRenderingIntent(t,e=gi.ENABLE,s=null,i=!1,n=!1){let a=hs.DISPLAY,o=xu;switch(t){case"any":a=hs.ANY;break;case"display":break;case"print":a=hs.PRINT;break;default:Z(`getRenderingIntent - invalid intent: ${t}`)}const l=a&hs.PRINT&&s instanceof Lg?s:this.annotationStorage;switch(e){case gi.DISABLE:a+=hs.ANNOTATIONS_DISABLE;break;case gi.ENABLE:break;case gi.ENABLE_FORMS:a+=hs.ANNOTATIONS_FORMS;break;case gi.ENABLE_STORAGE:a+=hs.ANNOTATIONS_STORAGE,o=l.serializable;break;default:Z(`getRenderingIntent - invalid annotationMode: ${e}`)}i&&(a+=hs.IS_EDITING),n&&(a+=hs.OPLIST);const{ids:h,hash:d}=l.modifiedIds,u=[a,o.hash,d];return{renderingIntent:a,cacheKey:u.join("_"),annotationStorageSerializable:o,modifiedIds:h}}destroy(){var s;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(s=r(this,Hi))==null||s.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const i of r(this,oi).values())t.push(i._destroy());r(this,oi).clear(),r(this,po).clear(),r(this,go).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{var i,n;this.commonObjs.clear(),this.fontLoader.clear(),r(this,ji).clear(),this.filterFactory.destroy(),Rl.cleanup(),(i=this._networkStream)==null||i.cancelAllRequests(new sn("Worker was terminated.")),(n=this.messageHandler)==null||n.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(s,i)=>{Zt(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=n=>{this._lastProgress={loaded:n.loaded,total:n.total}},i.onPull=()=>{this._fullReader.read().then(function({value:n,done:a}){if(a){i.close();return}Zt(n instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(n),1,[n])}).catch(n=>{i.error(n)})},i.onCancel=n=>{this._fullReader.cancel(n),i.ready.catch(a=>{if(!this.destroyed)throw a})}}),t.on("ReaderHeadersReady",async s=>{var o;await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:n,contentLength:a}=this._fullReader;return(!i||!n)&&(this._lastProgress&&((o=e.onProgress)==null||o.call(e,this._lastProgress)),this._fullReader.onProgress=l=>{var h;(h=e.onProgress)==null||h.call(e,{loaded:l.loaded,total:l.total})}),{isStreamingSupported:i,isRangeSupported:n,contentLength:a}}),t.on("GetRangeReader",(s,i)=>{Zt(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(s.begin,s.end);if(!n){i.close();return}i.onPull=()=>{n.read().then(function({value:a,done:o}){if(o){i.close();return}Zt(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{i.error(a)})},i.onCancel=a=>{n.cancel(a),i.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("GetDoc",({pdfInfo:s})=>{this._numPages=s.numPages,this._htmlForXfa=s.htmlForXfa,delete s.htmlForXfa,e._capability.resolve(new zy(s,this))}),t.on("DocException",s=>{e._capability.reject(Ge(s))}),t.on("PasswordRequest",s=>{p(this,Hi,Promise.withResolvers());try{if(!e.onPassword)throw Ge(s);const i=n=>{n instanceof Error?r(this,Hi).reject(n):r(this,Hi).resolve({password:n})};e.onPassword(i,s.code)}catch(i){r(this,Hi).reject(i)}return r(this,Hi).promise}),t.on("DataLoaded",s=>{var i;(i=e.onProgress)==null||i.call(e,{loaded:s.length,total:s.length}),this.downloadInfoCapability.resolve(s)}),t.on("StartRenderPage",s=>{if(this.destroyed)return;r(this,oi).get(s.pageIndex)._startRenderPage(s.transparency,s.cacheKey)}),t.on("commonobj",([s,i,n])=>{var a;if(this.destroyed||this.commonObjs.has(s))return null;switch(i){case"Font":if("error"in n){const d=n.error;Z(`Error during font loading: ${d}`),this.commonObjs.resolve(s,d);break}const o=this._params.pdfBug&&((a=globalThis.FontInspector)!=null&&a.enabled)?(d,u)=>globalThis.FontInspector.fontAdded(d,u):null,l=new K0(n,o);this.fontLoader.bind(l).catch(()=>t.sendWithPromise("FontFallback",{id:s})).finally(()=>{!l.fontExtraProperties&&l.data&&(l.data=null),this.commonObjs.resolve(s,l)});break;case"CopyLocalImage":const{imageRef:h}=n;Zt(h,"The imageRef must be defined.");for(const d of r(this,oi).values())for(const[,u]of d.objs)if((u==null?void 0:u.ref)===h)return u.dataLen?(this.commonObjs.resolve(s,structuredClone(u)),u.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(s,n);break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([s,i,n,a])=>{var l;if(this.destroyed)return;const o=r(this,oi).get(i);if(!o.objs.has(s)){if(o._intentStates.size===0){(l=a==null?void 0:a.bitmap)==null||l.close();return}switch(n){case"Image":case"Pattern":o.objs.resolve(s,a);break;default:throw new Error(`Got unknown object type ${n}`)}}}),t.on("DocProgress",s=>{var i;this.destroyed||(i=e.onProgress)==null||i.call(e,{loaded:s.loaded,total:s.total})}),t.on("FetchBinaryData",async s=>{if(this.destroyed)throw new Error("Worker was destroyed.");const i=this[s.type];if(!i)throw new Error(`${s.type} not initialized, see the \`useWorkerFetch\` parameter.`);return i.fetch(s)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var s;this.annotationStorage.size<=0&&Z("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:((s=this._fullReader)==null?void 0:s.filename)??null},e).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,s=r(this,po).get(e);if(s)return s;const i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(n=>{if(this.destroyed)throw new Error("Transport destroyed");n.refStr&&r(this,go).set(n.refStr,t);const a=new Gy(e,n,this,this._params.pdfBug);return r(this,oi).set(e,a),a});return r(this,po).set(e,i),i}getPageIndex(t){return Eu(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return b(this,jr,ml).call(this,"GetFieldObjects")}hasJSActions(){return b(this,jr,ml).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return b(this,jr,ml).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return b(this,jr,ml).call(this,"GetOptionalContentConfig").then(e=>new xy(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=r(this,ji).get(t);if(e)return e;const s=this.messageHandler.sendWithPromise(t,null).then(i=>{var n,a;return{info:i[0],metadata:i[1]?new wy(i[1]):null,contentDispositionFilename:((n=this._fullReader)==null?void 0:n.filename)??null,contentLength:((a=this._fullReader)==null?void 0:a.contentLength)??null}});return r(this,ji).set(t,s),s}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of r(this,oi).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),r(this,ji).clear(),this.filterFactory.destroy(!0),Rl.cleanup()}}cachedPageNumber(t){if(!Eu(t))return null;const e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return r(this,go).get(e)??null}}ji=new WeakMap,oi=new WeakMap,po=new WeakMap,go=new WeakMap,Hi=new WeakMap,jr=new WeakSet,ml=function(t,e=null){const s=r(this,ji).get(t);if(s)return s;const i=this.messageHandler.sendWithPromise(t,e);return r(this,ji).set(t,i),i};var In;class Uy{constructor(t){m(this,In,null);L(this,"onContinue",null);L(this,"onError",null);p(this,In,t)}get promise(){return r(this,In).capability.promise}cancel(t=0){r(this,In).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=r(this,In).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=r(this,In);return t.form||t.canvas&&(e==null?void 0:e.size)>0}}In=new WeakMap;var Mn,Hr;const ar=class ar{constructor({callback:t,params:e,objs:s,commonObjs:i,annotationCanvasMap:n,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:h,useRequestAnimationFrame:d=!1,pdfBug:u=!1,pageColors:f=null}){m(this,Mn,null);this.callback=t,this.params=e,this.objs=s,this.commonObjs=i,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=h,this._pdfBug=u,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 Uy(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){var o,l;if(this.cancelled)return;if(this._canvas){if(r(ar,Hr).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.");r(ar,Hr).add(this._canvas)}this._pdfBug&&((o=globalThis.StepperManager)!=null&&o.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:s,viewport:i,transform:n,background:a}=this.params;this.gfx=new Na(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:n,viewport:i,transparency:t,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,(l=this.graphicsReadyCallback)==null||l.call(this)}cancel(t=null,e=0){var s,i,n;this.running=!1,this.cancelled=!0,(s=this.gfx)==null||s.endDrawing(),r(this,Mn)&&(window.cancelAnimationFrame(r(this,Mn)),p(this,Mn,null)),r(ar,Hr).delete(this._canvas),t||(t=new Rd(`Rendering cancelled, page ${this._pageIndex+1}`,e)),this.callback(t),(n=(i=this.task).onError)==null||n.call(i,t)}operatorListChanged(){var t;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(t=this.stepper)==null||t.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?p(this,Mn,window.requestAnimationFrame(()=>{p(this,Mn,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),r(ar,Hr).delete(this._canvas),this.callback())))}};Mn=new WeakMap,Hr=new WeakMap,m(ar,Hr,new WeakSet);let Fu=ar;const If="5.3.93",im="cbeef3233";function yp(c){return Math.floor(Math.max(0,Math.min(1,c))*255).toString(16).padStart(2,"0")}function sl(c){return Math.max(0,Math.min(255,255*c))}class vp{static CMYK_G([t,e,s,i]){return["G",1-Math.min(1,.3*t+.59*s+.11*e+i)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=sl(t),[t,t,t]}static G_HTML([t]){const e=yp(t);return`#${e}${e}${e}`}static RGB_G([t,e,s]){return["G",.3*t+.59*e+.11*s]}static RGB_rgb(t){return t.map(sl)}static RGB_HTML(t){return`#${t.map(yp).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,s,i]){return["RGB",1-Math.min(1,t+i),1-Math.min(1,s+i),1-Math.min(1,e+i)]}static CMYK_rgb([t,e,s,i]){return[sl(1-Math.min(1,t+i)),sl(1-Math.min(1,s+i)),sl(1-Math.min(1,e+i))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,s]){const i=1-t,n=1-e,a=1-s,o=Math.min(i,n,a);return["CMYK",i,n,a,o]}}class Wy{create(t,e,s=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),s||(i.setAttribute("width",`${t}px`),i.setAttribute("height",`${e}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${t} ${e}`),i}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){xt("Abstract method `_createSVG` called.")}}class kl extends Wy{_createSVG(t){return document.createElementNS(vi,t)}}class Mf{static setupStorage(t,e,s,i,n){const a=i.getValue(e,{value:null});switch(s.name){case"textarea":if(a.value!==null&&(t.textContent=a.value),n==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})});break;case"input":if(s.attributes.type==="radio"||s.attributes.type==="checkbox"){if(a.value===s.attributes.xfaOn?t.setAttribute("checked",!0):a.value===s.attributes.xfaOff&&t.removeAttribute("checked"),n==="print")break;t.addEventListener("change",o=>{i.setValue(e,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&t.setAttribute("value",a.value),n==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})})}break;case"select":if(a.value!==null){t.setAttribute("value",a.value);for(const o of s.children)o.attributes.value===a.value?o.attributes.selected=!0:o.attributes.hasOwnProperty("selected")&&delete o.attributes.selected}t.addEventListener("input",o=>{const l=o.target.options,h=l.selectedIndex===-1?"":l[l.selectedIndex].value;i.setValue(e,{value:h})});break}}static setAttributes({html:t,element:e,storage:s=null,intent:i,linkService:n}){const{attributes:a}=e,o=t instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${i}`);for(const[l,h]of Object.entries(a))if(h!=null)switch(l){case"class":h.length&&t.setAttribute(l,h.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",h);break;case"style":Object.assign(t.style,h);break;case"textContent":t.textContent=h;break;default:(!o||l!=="href"&&l!=="newWindow")&&t.setAttribute(l,h)}o&&n.addLinkAttributes(t,a.href,a.newWindow),s&&a.dataId&&this.setupStorage(t,a.dataId,e,s)}static render(t){var u,f;const e=t.annotationStorage,s=t.linkService,i=t.xfaHtml,n=t.intent||"display",a=document.createElement(i.name);i.attributes&&this.setAttributes({html:a,element:i,intent:n,linkService:s});const o=n!=="richText",l=t.div;if(l.append(a),t.viewport){const g=`matrix(${t.viewport.transform.join(",")})`;l.style.transform=g}o&&l.setAttribute("class","xfaLayer xfaFont");const h=[];if(i.children.length===0){if(i.value){const g=document.createTextNode(i.value);a.append(g),o&&Pl.shouldBuildText(i.name)&&h.push(g)}return{textDivs:h}}const d=[[i,-1,a]];for(;d.length>0;){const[g,y,v]=d.at(-1);if(y+1===g.children.length){d.pop();continue}const w=g.children[++d.at(-1)[1]];if(w===null)continue;const{name:A}=w;if(A==="#text"){const _=document.createTextNode(w.value);h.push(_),v.append(_);continue}const x=(u=w==null?void 0:w.attributes)!=null&&u.xmlns?document.createElementNS(w.attributes.xmlns,A):document.createElement(A);if(v.append(x),w.attributes&&this.setAttributes({html:x,element:w,storage:e,intent:n,linkService:s}),((f=w.children)==null?void 0:f.length)>0)d.push([w,-1,x]);else if(w.value){const _=document.createTextNode(w.value);o&&Pl.shouldBuildText(A)&&h.push(_),x.append(_)}}for(const g of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))g.setAttribute("readOnly",!0);return{textDivs:h}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}const qy=9,ma=new WeakSet;class wp{static create(t){switch(t.data.annotationType){case Vt.LINK:return new nm(t);case Vt.TEXT:return new Xy(t);case Vt.WIDGET:switch(t.data.fieldType){case"Tx":return new Yy(t);case"Btn":return t.data.radioButton?new om(t):t.data.checkBox?new Jy(t):new Zy(t);case"Ch":return new Qy(t);case"Sig":return new Ky(t)}return new wa(t);case Vt.POPUP:return new Bu(t);case Vt.FREETEXT:return new um(t);case Vt.LINE:return new ev(t);case Vt.SQUARE:return new sv(t);case Vt.CIRCLE:return new iv(t);case Vt.POLYLINE:return new fm(t);case Vt.CARET:return new rv(t);case Vt.INK:return new Lf(t);case Vt.POLYGON:return new nv(t);case Vt.HIGHLIGHT:return new pm(t);case Vt.UNDERLINE:return new av(t);case Vt.SQUIGGLY:return new ov(t);case Vt.STRIKEOUT:return new lv(t);case Vt.STAMP:return new gm(t);case Vt.FILEATTACHMENT:return new cv(t);default:return new Xt(t)}}}var $r,mo,bo,Sc,Ou;const Hf=class Hf{constructor(t,{isRenderable:e=!1,ignoreBorder:s=!1,createQuadrilaterals:i=!1}={}){m(this,Sc);m(this,$r,null);m(this,mo,!1);m(this,bo,null);this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(s)),i&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!!(t!=null&&t.str||e!=null&&e.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Hf._hasPopupData(this.data)}updateEdited(t){var s;if(!this.container)return;r(this,$r)||p(this,$r,{rect:this.data.rect.slice(0)});const{rect:e}=t;e&&b(this,Sc,Ou).call(this,e),(s=r(this,bo))==null||s.popup.updateEdited(t)}resetEdited(){var t;r(this,$r)&&(b(this,Sc,Ou).call(this,r(this,$r).rect),(t=r(this,bo))==null||t.popup.resetEdited(),p(this,$r,null))}_createContainer(t){const{data:e,parent:{page:s,viewport:i}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",e.id),this instanceof wa||(n.tabIndex=0);const{style:a}=n;if(a.zIndex=this.parent.zIndex++,e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof Bu){const{rotation:v}=e;return!e.hasOwnCanvas&&v!==0&&this.setRotation(v,n),n}const{width:o,height:l}=this;if(!t&&e.borderStyle.width>0){a.borderWidth=`${e.borderStyle.width}px`;const v=e.borderStyle.horizontalCornerRadius,w=e.borderStyle.verticalCornerRadius;if(v>0||w>0){const x=`calc(${v}px * var(--total-scale-factor)) / calc(${w}px * var(--total-scale-factor))`;a.borderRadius=x}else if(this instanceof om){const x=`calc(${o}px * var(--total-scale-factor)) / calc(${l}px * var(--total-scale-factor))`;a.borderRadius=x}switch(e.borderStyle.style){case Sa.SOLID:a.borderStyle="solid";break;case Sa.DASHED:a.borderStyle="dashed";break;case Sa.BEVELED:Z("Unimplemented border style: beveled");break;case Sa.INSET:Z("Unimplemented border style: inset");break;case Sa.UNDERLINE:a.borderBottomStyle="solid";break}const A=e.borderColor||null;A?(p(this,mo,!0),a.borderColor=W.makeHexColor(A[0]|0,A[1]|0,A[2]|0)):a.borderWidth=0}const h=W.normalizeRect([e.rect[0],s.view[3]-e.rect[1]+s.view[1],e.rect[2],s.view[3]-e.rect[3]+s.view[1]]),{pageWidth:d,pageHeight:u,pageX:f,pageY:g}=i.rawDims;a.left=`${100*(h[0]-f)/d}%`,a.top=`${100*(h[1]-g)/u}%`;const{rotation:y}=e;return e.hasOwnCanvas||y===0?(a.width=`${100*o/d}%`,a.height=`${100*l/u}%`):this.setRotation(y,n),n}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:s,pageHeight:i}=this.parent.viewport.rawDims;let{width:n,height:a}=this;t%180!==0&&([n,a]=[a,n]),e.style.width=`${100*n/s}%`,e.style.height=`${100*a/i}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(e,s,i)=>{const n=i.detail[e],a=n[0],o=n.slice(1);i.target.style[s]=vp[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[s]:vp[`${a}_rgb`](o)})};return it(this,"_commonActions",{display:e=>{const{display:s}=e.detail,i=s%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:s===1||s===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:s}=e.detail;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:s,noView:s})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:e=>{const s=e.detail.rotation;this.setRotation(s),this.annotationStorage.setValue(this.data.id,{rotation:s})}})}_dispatchEventFromSandbox(t,e){const s=this._commonActions;for(const i of Object.keys(e.detail)){const n=t[i]||s[i];n==null||n(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const s=this._commonActions;for(const[i,n]of Object.entries(e)){const a=s[i];if(a){const o={detail:{[i]:n},target:t};a(o),delete e[i]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,s,i,n]=this.data.rect.map(v=>Math.fround(v));if(t.length===8){const[v,w,A,x]=t.subarray(2,6);if(i===v&&n===w&&e===A&&s===x)return}const{style:a}=this.container;let o;if(r(this,mo)){const{borderColor:v,borderWidth:w}=a;a.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="${v}" stroke-width="${w}">`],this.container.classList.add("hasBorder")}const l=i-e,h=n-s,{svgFactory:d}=this,u=d.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0),u.role="none";const f=d.createElement("defs");u.append(f);const g=d.createElement("clipPath"),y=`clippath_${this.data.id}`;g.setAttribute("id",y),g.setAttribute("clipPathUnits","objectBoundingBox"),f.append(g);for(let v=2,w=t.length;v<w;v+=8){const A=t[v],x=t[v+1],_=t[v+2],S=t[v+3],C=d.createElement("rect"),R=(_-e)/l,T=(n-x)/h,k=(A-_)/l,I=(x-S)/h;C.setAttribute("x",R),C.setAttribute("y",T),C.setAttribute("width",k),C.setAttribute("height",I),g.append(C),o==null||o.push(`<rect vector-effect="non-scaling-stroke" x="${R}" y="${T}" width="${k}" height="${I}"/>`)}r(this,mo)&&(o.push("</g></svg>')"),a.backgroundImage=o.join("")),this.container.append(u),this.container.style.clipPath=`url(#${y})`}_createPopup(){const{data:t}=this,e=p(this,bo,new Bu({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation,noRotate:!0},parent:this.parent,elements:[this]}));this.parent.div.append(e.render())}render(){xt("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const s=[];if(this._fieldObjects){const i=this._fieldObjects[t];if(i)for(const{page:n,id:a,exportValues:o}of i){if(n===-1||a===e)continue;const l=typeof o=="string"?o:null,h=document.querySelector(`[data-element-id="${a}"]`);if(h&&!ma.has(h)){Z(`_getElementsByName - element not allowed: ${a}`);continue}s.push({id:a,exportValue:l,domElement:h})}return s}for(const i of document.getElementsByName(t)){const{exportValue:n}=i,a=i.getAttribute("data-element-id");a!==e&&ma.has(i)&&s.push({id:a,exportValue:n,domElement:i})}return s}show(){var t;this.container&&(this.container.hidden=!1),(t=this.popup)==null||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),(t=this.popup)==null||t.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{var s;(s=this.linkService.eventBus)==null||s.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}};$r=new WeakMap,mo=new WeakMap,bo=new WeakMap,Sc=new WeakSet,Ou=function(t){const{container:{style:e},data:{rect:s,rotation:i},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:a,pageX:o,pageY:l}}}}=this;s==null||s.splice(0,4,...t),e.left=`${100*(t[0]-o)/n}%`,e.top=`${100*(a-t[3]+l)/a}%`,i===0?(e.width=`${100*(t[2]-t[0])/n}%`,e.height=`${100*(t[3]-t[1])/a}%`):this.setRotation(i)};let Xt=Hf;var us,sr,rm,am;class nm extends Xt{constructor(e,s=null){super(e,{isRenderable:!0,ignoreBorder:!!(s!=null&&s.ignoreBorder),createQuadrilaterals:!0});m(this,us);this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:s}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let n=!1;return e.url?(s.addLinkAttributes(i,e.url,e.newWindow),n=!0):e.action?(this._bindNamedAction(i,e.action),n=!0):e.attachment?(b(this,us,rm).call(this,i,e.attachment,e.attachmentDest),n=!0):e.setOCGState?(b(this,us,am).call(this,i,e.setOCGState),n=!0):e.dest?(this._bindLink(i,e.dest),n=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,e),n=!0),e.resetForm?(this._bindResetFormAction(i,e.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(i),this.container}_bindLink(e,s){e.href=this.linkService.getDestinationHash(s),e.onclick=()=>(s&&this.linkService.goToDestination(s),!1),(s||s==="")&&b(this,us,sr).call(this)}_bindNamedAction(e,s){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(s),!1),b(this,us,sr).call(this)}_bindJSAction(e,s){e.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(s.actions)){const a=i.get(n);a&&(e[a]=()=>{var o;return(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s.id,name:n}}),!1})}e.onclick||(e.onclick=()=>!1),b(this,us,sr).call(this)}_bindResetFormAction(e,s){const i=e.onclick;if(i||(e.href=this.linkService.getAnchorUrl("")),b(this,us,sr).call(this),!this._fieldObjects){Z('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(e.onclick=()=>!1);return}e.onclick=()=>{var u;i==null||i();const{fields:n,refs:a,include:o}=s,l=[];if(n.length!==0||a.length!==0){const f=new Set(a);for(const g of n){const y=this._fieldObjects[g]||[];for(const{id:v}of y)f.add(v)}for(const g of Object.values(this._fieldObjects))for(const y of g)f.has(y.id)===o&&l.push(y)}else for(const f of Object.values(this._fieldObjects))l.push(...f);const h=this.annotationStorage,d=[];for(const f of l){const{id:g}=f;switch(d.push(g),f.type){case"text":{const v=f.defaultValue||"";h.setValue(g,{value:v});break}case"checkbox":case"radiobutton":{const v=f.defaultValue===f.exportValues;h.setValue(g,{value:v});break}case"combobox":case"listbox":{const v=f.defaultValue||"";h.setValue(g,{value:v});break}default:continue}const y=document.querySelector(`[data-element-id="${g}"]`);if(y){if(!ma.has(y)){Z(`_bindResetFormAction - element not allowed: ${g}`);continue}}else continue;y.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((u=this.linkService.eventBus)==null||u.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:d,name:"ResetForm"}})),!1}}}us=new WeakSet,sr=function(){this.container.setAttribute("data-internal-link","")},rm=function(e,s,i=null){e.href=this.linkService.getAnchorUrl(""),s.description&&(e.title=s.description),e.onclick=()=>{var n;return(n=this.downloadManager)==null||n.openOrDownloadData(s.content,s.filename,i),!1},b(this,us,sr).call(this)},am=function(e,s){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(s),!1),b(this,us,sr).call(this)};class Xy extends Xt{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class wa extends Xt{render(){return this.container}showElementAndHideCanvas(t){var e;this.data.hasOwnCanvas&&(((e=t.previousSibling)==null?void 0:e.nodeName)==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return ue.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,s,i,n){s.includes("mouse")?t.addEventListener(s,a=>{var o;(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):t.addEventListener(s,a=>{var o;if(s==="blur"){if(!e.focused||!a.relatedTarget)return;e.focused=!1}else if(s==="focus"){if(e.focused)return;e.focused=!0}n&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(a)}}))})}_setEventListeners(t,e,s,i){var n,a,o;for(const[l,h]of s)(h==="Action"||(n=this.data.actions)!=null&&n[h])&&((h==="Focus"||h==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,l,h,i),h==="Focus"&&!((a=this.data.actions)!=null&&a.Blur)?this._setEventListener(t,e,"blur","Blur",null):h==="Blur"&&!((o=this.data.actions)!=null&&o.Focus)&&this._setEventListener(t,e,"focus","Focus",null))}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":W.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||qy,n=t.style;let a;const o=2,l=h=>Math.round(10*h)/10;if(this.data.multiLine){const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o),d=Math.round(h/(qd*i))||1,u=h/d;a=Math.min(i,l(u/qd))}else{const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o);a=Math.min(i,l(h/qd))}n.fontSize=`calc(${a}px * var(--total-scale-factor))`,n.color=W.makeHexColor(s[0],s[1],s[2]),this.data.textAlignment!==null&&(n.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class Yy extends wa{constructor(t){const e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,s,i){const n=this.annotationStorage;for(const a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=s),n.setValue(a.id,{[i]:s})}render(){var i,n;const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let s=null;if(this.renderForms){const a=t.getValue(e,{value:this.data.fieldValue});let o=a.value||"";const l=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;l&&o.length>l&&(o=o.slice(0,l));let h=a.formattedValue||((i=this.data.textContent)==null?void 0:i.join(`
32
+ `))||null;h&&this.data.comb&&(h=h.replaceAll(/\s+/g,""));const d={userValue:o,formattedValue:h,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=h??o,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type=this.data.password?"password":"text",s.setAttribute("value",h??o),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(s.hidden=!0),ma.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=0;const u=this.data.dateFormat||this.data.timeFormat;u&&(s.title=u),this._setRequired(s,this.data.required),l&&(s.maxLength=l),s.addEventListener("input",g=>{t.setValue(e,{value:g.target.value}),this.setPropertyOnSiblings(s,"value",g.target.value,"value"),d.formattedValue=null}),s.addEventListener("resetform",g=>{const y=this.data.defaultFieldValue??"";s.value=d.userValue=y,d.formattedValue=null});let f=g=>{const{formattedValue:y}=d;y!=null&&(g.target.value=y),g.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",y=>{var w;if(d.focused)return;const{target:v}=y;d.userValue&&(v.value=d.userValue),d.lastCommittedValue=v.value,d.commitKey=1,(w=this.data.actions)!=null&&w.Focus||(d.focused=!0)}),s.addEventListener("updatefromsandbox",y=>{this.showElementAndHideCanvas(y.target);const v={value(w){d.userValue=w.detail.value??"",t.setValue(e,{value:d.userValue.toString()}),w.target.value=d.userValue},formattedValue(w){const{formattedValue:A}=w.detail;d.formattedValue=A,A!=null&&w.target!==document.activeElement&&(w.target.value=A),t.setValue(e,{formattedValue:A})},selRange(w){w.target.setSelectionRange(...w.detail.selRange)},charLimit:w=>{var S;const{charLimit:A}=w.detail,{target:x}=w;if(A===0){x.removeAttribute("maxLength");return}x.setAttribute("maxLength",A);let _=d.userValue;!_||_.length<=A||(_=_.slice(0,A),x.value=d.userValue=_,t.setValue(e,{value:_}),(S=this.linkService.eventBus)==null||S.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:_,willCommit:!0,commitKey:1,selStart:x.selectionStart,selEnd:x.selectionEnd}}))}};this._dispatchEventFromSandbox(v,y)}),s.addEventListener("keydown",y=>{var A;d.commitKey=1;let v=-1;if(y.key==="Escape"?v=0:y.key==="Enter"&&!this.data.multiLine?v=2:y.key==="Tab"&&(d.commitKey=3),v===-1)return;const{value:w}=y.target;d.lastCommittedValue!==w&&(d.lastCommittedValue=w,d.userValue=w,(A=this.linkService.eventBus)==null||A.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:w,willCommit:!0,commitKey:v,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}))});const g=f;f=null,s.addEventListener("blur",y=>{var w,A;if(!d.focused||!y.relatedTarget)return;(w=this.data.actions)!=null&&w.Blur||(d.focused=!1);const{value:v}=y.target;d.userValue=v,d.lastCommittedValue!==v&&((A=this.linkService.eventBus)==null||A.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:v,willCommit:!0,commitKey:d.commitKey,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}})),g(y)}),(n=this.data.actions)!=null&&n.Keystroke&&s.addEventListener("beforeinput",y=>{var R;d.lastCommittedValue=null;const{data:v,target:w}=y,{value:A,selectionStart:x,selectionEnd:_}=w;let S=x,C=_;switch(y.inputType){case"deleteWordBackward":{const T=A.substring(0,x).match(/\w*[^\w]*$/);T&&(S-=T[0].length);break}case"deleteWordForward":{const T=A.substring(x).match(/^[^\w]*\w*/);T&&(C+=T[0].length);break}case"deleteContentBackward":x===_&&(S-=1);break;case"deleteContentForward":x===_&&(C+=1);break}y.preventDefault(),(R=this.linkService.eventBus)==null||R.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:A,change:v||"",willCommit:!1,selStart:S,selEnd:C}})}),this._setEventListeners(s,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],y=>y.target.value)}if(f&&s.addEventListener("blur",f),this.data.comb){const y=(this.data.rect[2]-this.data.rect[0])/l;s.classList.add("comb"),s.style.letterSpacing=`calc(${y}px * var(--total-scale-factor) - 1ch)`}}else s=document.createElement("div"),s.textContent=this.data.fieldValue,s.style.verticalAlign="middle",s.style.display="table-cell",this.data.hasOwnCanvas&&(s.hidden=!0);return this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Ky extends wa{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class Jy extends wa{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.exportValue===e.fieldValue}).value;typeof i=="string"&&(i=i!=="Off",t.setValue(s,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const n=document.createElement("input");return ma.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=0,n.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const h of this._getElementsByName(o,s)){const d=l&&h.exportValue===e.exportValue;h.domElement&&(h.domElement.checked=d),t.setValue(h.id,{value:d})}t.setValue(s,{value:l})}),n.addEventListener("resetform",a=>{const o=e.defaultFieldValue||"Off";a.target.checked=o===e.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",a=>{const o={value(l){l.target.checked=l.detail.value!=="Off",t.setValue(s,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,a)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class om extends wa{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.fieldValue===e.buttonValue}).value;if(typeof i=="string"&&(i=i!==e.buttonValue,t.setValue(s,{value:i})),i)for(const a of this._getElementsByName(e.fieldName,s))t.setValue(a.id,{value:!1});const n=document.createElement("input");if(ma.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.tabIndex=0,n.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const h of this._getElementsByName(o,s))t.setValue(h.id,{value:!1});t.setValue(s,{value:l})}),n.addEventListener("resetform",a=>{const o=e.defaultFieldValue;a.target.checked=o!=null&&o===e.buttonValue}),this.enableScripting&&this.hasJSActions){const a=e.buttonValue;n.addEventListener("updatefromsandbox",o=>{const l={value:h=>{const d=a===h.detail.value;for(const u of this._getElementsByName(h.target.name)){const f=d&&u.id===s;u.domElement&&(u.domElement.checked=f),t.setValue(u.id,{value:f})}}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(n,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(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Zy extends nm{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",s=>{this._dispatchEventFromSandbox({},s)})),t}}class Qy extends wa{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,s=t.getValue(e,{value:this.data.fieldValue}),i=document.createElement("select");ma.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=0;let n=this.data.combo&&this.data.options.length>0;this.data.combo||(i.size=this.data.options.length,this.data.multiSelect&&(i.multiple=!0)),i.addEventListener("resetform",d=>{const u=this.data.defaultFieldValue;for(const f of i.options)f.selected=f.value===u});for(const d of this.data.options){const u=document.createElement("option");u.textContent=d.displayValue,u.value=d.exportValue,s.value.includes(d.exportValue)&&(u.setAttribute("selected",!0),n=!1),i.append(u)}let a=null;if(n){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),i.prepend(d),a=()=>{d.remove(),i.removeEventListener("input",a),a=null},i.addEventListener("input",a)}const o=d=>{const u=d?"value":"textContent",{options:f,multiple:g}=i;return g?Array.prototype.filter.call(f,y=>y.selected).map(y=>y[u]):f.selectedIndex===-1?null:f[f.selectedIndex][u]};let l=o(!1);const h=d=>{const u=d.target.options;return Array.prototype.map.call(u,f=>({displayValue:f.textContent,exportValue:f.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",d=>{const u={value(f){a==null||a();const g=f.detail.value,y=new Set(Array.isArray(g)?g:[g]);for(const v of i.options)v.selected=y.has(v.value);t.setValue(e,{value:o(!0)}),l=o(!1)},multipleSelection(f){i.multiple=!0},remove(f){const g=i.options,y=f.detail.remove;g[y].selected=!1,i.remove(y),g.length>0&&Array.prototype.findIndex.call(g,w=>w.selected)===-1&&(g[0].selected=!0),t.setValue(e,{value:o(!0),items:h(f)}),l=o(!1)},clear(f){for(;i.length!==0;)i.remove(0);t.setValue(e,{value:null,items:[]}),l=o(!1)},insert(f){const{index:g,displayValue:y,exportValue:v}=f.detail.insert,w=i.children[g],A=document.createElement("option");A.textContent=y,A.value=v,w?w.before(A):i.append(A),t.setValue(e,{value:o(!0),items:h(f)}),l=o(!1)},items(f){const{items:g}=f.detail;for(;i.length!==0;)i.remove(0);for(const y of g){const{displayValue:v,exportValue:w}=y,A=document.createElement("option");A.textContent=v,A.value=w,i.append(A)}i.options.length>0&&(i.options[0].selected=!0),t.setValue(e,{value:o(!0),items:h(f)}),l=o(!1)},indices(f){const g=new Set(f.detail.indices);for(const y of f.target.options)y.selected=g.has(y.index);t.setValue(e,{value:o(!0)}),l=o(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(u,d)}),i.addEventListener("input",d=>{var g;const u=o(!0),f=o(!1);t.setValue(e,{value:u}),d.preventDefault(),(g=this.linkService.eventBus)==null||g.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:l,change:f,changeEx:u,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(i,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],d=>d.target.value)):i.addEventListener("input",function(d){t.setValue(e,{value:o(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Bu extends Xt{constructor(t){const{data:e,elements:s}=t;super(t,{isRenderable:Xt._hasPopupData(e)}),this.elements=s,this.popup=null}render(){const{container:t}=this;t.classList.add("popupAnnotation"),t.role="comment";const e=this.popup=new tv({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),s=[];for(const i of this.elements)i.popup=e,i.container.ariaHasPopup="dialog",s.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",s.map(i=>`${_f}${i}`).join(",")),this.container}}var yo,vd,wd,vo,wo,Ht,$i,zr,Cc,Tc,Ao,zi,Bs,Gi,Rc,Vi,Pc,Gr,Vr,Et,Fh,ju,lm,cm,hm,dm,Oh,Bh,Hu;class tv{constructor({container:t,color:e,elements:s,titleObj:i,modificationDate:n,contentsObj:a,richText:o,parent:l,rect:h,parentRect:d,open:u}){m(this,Et);m(this,yo,b(this,Et,hm).bind(this));m(this,vd,b(this,Et,Hu).bind(this));m(this,wd,b(this,Et,Bh).bind(this));m(this,vo,b(this,Et,Oh).bind(this));m(this,wo,null);m(this,Ht,null);m(this,$i,null);m(this,zr,null);m(this,Cc,null);m(this,Tc,null);m(this,Ao,null);m(this,zi,!1);m(this,Bs,null);m(this,Gi,null);m(this,Rc,null);m(this,Vi,null);m(this,Pc,null);m(this,Gr,null);m(this,Vr,!1);var f;p(this,Ht,t),p(this,Pc,i),p(this,$i,a),p(this,Vi,o),p(this,Tc,l),p(this,wo,e),p(this,Rc,h),p(this,Ao,d),p(this,Cc,s),p(this,zr,kd.toDateObject(n)),this.trigger=s.flatMap(g=>g.getElementsToTriggerPopup());for(const g of this.trigger)g.addEventListener("click",r(this,vo)),g.addEventListener("mouseenter",r(this,wd)),g.addEventListener("mouseleave",r(this,vd)),g.classList.add("popupTriggerArea");for(const g of s)(f=g.container)==null||f.addEventListener("keydown",r(this,yo));r(this,Ht).hidden=!0,u&&b(this,Et,Oh).call(this)}render(){if(r(this,Bs))return;const t=p(this,Bs,document.createElement("div"));if(t.className="popup",r(this,wo)){const n=t.style.outlineColor=W.makeHexColor(...r(this,wo));t.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`}const e=document.createElement("span");e.className="header";const s=document.createElement("h1");if(e.append(s),{dir:s.dir,str:s.textContent}=r(this,Pc),t.append(e),r(this,zr)){const n=document.createElement("time");n.classList.add("popupDate"),n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:r(this,zr).valueOf()})),n.dateTime=r(this,zr).toISOString(),e.append(n)}const i=r(this,Et,Fh);if(i)Mf.render({xfaHtml:i,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const n=this._formatContents(r(this,$i));t.append(n)}r(this,Ht).append(t)}_formatContents({str:t,dir:e}){const s=document.createElement("p");s.classList.add("popupContent"),s.dir=e;const i=t.split(/(?:\r\n?|\n)/);for(let n=0,a=i.length;n<a;++n){const o=i[n];s.append(document.createTextNode(o)),n<a-1&&s.append(document.createElement("br"))}return s}updateEdited({rect:t,popupContent:e}){var s;r(this,Gr)||p(this,Gr,{contentsObj:r(this,$i),richText:r(this,Vi)}),t&&p(this,Gi,null),e&&(p(this,Vi,b(this,Et,cm).call(this,e)),p(this,$i,null)),(s=r(this,Bs))==null||s.remove(),p(this,Bs,null)}resetEdited(){var t;r(this,Gr)&&({contentsObj:Me(this,$i)._,richText:Me(this,Vi)._}=r(this,Gr),p(this,Gr,null),(t=r(this,Bs))==null||t.remove(),p(this,Bs,null),p(this,Gi,null))}forceHide(){p(this,Vr,this.isVisible),r(this,Vr)&&(r(this,Ht).hidden=!0)}maybeShow(){r(this,Vr)&&(r(this,Bs)||b(this,Et,Bh).call(this),p(this,Vr,!1),r(this,Ht).hidden=!1)}get isVisible(){return r(this,Ht).hidden===!1}}yo=new WeakMap,vd=new WeakMap,wd=new WeakMap,vo=new WeakMap,wo=new WeakMap,Ht=new WeakMap,$i=new WeakMap,zr=new WeakMap,Cc=new WeakMap,Tc=new WeakMap,Ao=new WeakMap,zi=new WeakMap,Bs=new WeakMap,Gi=new WeakMap,Rc=new WeakMap,Vi=new WeakMap,Pc=new WeakMap,Gr=new WeakMap,Vr=new WeakMap,Et=new WeakSet,Fh=function(){const t=r(this,Vi),e=r(this,$i);return t!=null&&t.str&&(!(e!=null&&e.str)||e.str===t.str)&&r(this,Vi).html||null},ju=function(){var t,e,s;return((s=(e=(t=r(this,Et,Fh))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.fontSize)||0},lm=function(){var t,e,s;return((s=(e=(t=r(this,Et,Fh))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.color)||null},cm=function(t){const e=[],s={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},i={style:{color:r(this,Et,lm),fontSize:r(this,Et,ju)?`calc(${r(this,Et,ju)}px * var(--total-scale-factor))`:""}};for(const n of t.split(`
33
+ `))e.push({name:"span",value:n,attributes:i});return s},hm=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&r(this,zi))&&b(this,Et,Oh).call(this)},dm=function(){if(r(this,Gi)!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:s,pageX:i,pageY:n}}}=r(this,Tc);let a=!!r(this,Ao),o=a?r(this,Ao):r(this,Rc);for(const y of r(this,Cc))if(!o||W.intersect(y.data.rect,o)!==null){o=y.data.rect,a=!0;break}const l=W.normalizeRect([o[0],t[3]-o[1]+t[1],o[2],t[3]-o[3]+t[1]]),d=a?o[2]-o[0]+5:0,u=l[0]+d,f=l[1];p(this,Gi,[100*(u-i)/e,100*(f-n)/s]);const{style:g}=r(this,Ht);g.left=`${r(this,Gi)[0]}%`,g.top=`${r(this,Gi)[1]}%`},Oh=function(){p(this,zi,!r(this,zi)),r(this,zi)?(b(this,Et,Bh).call(this),r(this,Ht).addEventListener("click",r(this,vo)),r(this,Ht).addEventListener("keydown",r(this,yo))):(b(this,Et,Hu).call(this),r(this,Ht).removeEventListener("click",r(this,vo)),r(this,Ht).removeEventListener("keydown",r(this,yo)))},Bh=function(){r(this,Bs)||this.render(),this.isVisible?r(this,zi)&&r(this,Ht).classList.add("focused"):(b(this,Et,dm).call(this),r(this,Ht).hidden=!1,r(this,Ht).style.zIndex=parseInt(r(this,Ht).style.zIndex)+1e3)},Hu=function(){r(this,Ht).classList.remove("focused"),!(r(this,zi)||!this.isVisible)&&(r(this,Ht).hidden=!0,r(this,Ht).style.zIndex=parseInt(r(this,Ht).style.zIndex)-1e3)};class um extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=J.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const s=document.createElement("span");s.textContent=e,t.append(s)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var kc;class ev extends Xt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,kc,null)}render(){this.container.classList.add("lineAnnotation");const{data:e,width:s,height:i}=this,n=this.svgFactory.create(s,i,!0),a=p(this,kc,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),n.append(a),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,kc)}addHighlightArea(){this.container.classList.add("highlightArea")}}kc=new WeakMap;var Ic;class sv extends Xt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,Ic,null)}render(){this.container.classList.add("squareAnnotation");const{data:e,width:s,height:i}=this,n=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=p(this,Ic,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",s-a),o.setAttribute("height",i-a),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),n.append(o),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,Ic)}addHighlightArea(){this.container.classList.add("highlightArea")}}Ic=new WeakMap;var Mc;class iv extends Xt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,Mc,null)}render(){this.container.classList.add("circleAnnotation");const{data:e,width:s,height:i}=this,n=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=p(this,Mc,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",s/2),o.setAttribute("cy",i/2),o.setAttribute("rx",s/2-a/2),o.setAttribute("ry",i/2-a/2),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),n.append(o),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,Mc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Mc=new WeakMap;var Lc;class fm extends Xt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,Lc,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:s,borderStyle:i,popupRef:n},width:a,height:o}=this;if(!s)return this.container;const l=this.svgFactory.create(a,o,!0);let h=[];for(let u=0,f=s.length;u<f;u+=2){const g=s[u]-e[0],y=e[3]-s[u+1];h.push(`${g},${y}`)}h=h.join(" ");const d=p(this,Lc,this.svgFactory.createElement(this.svgElementName));return d.setAttribute("points",h),d.setAttribute("stroke-width",i.width||1),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),l.append(d),this.container.append(l),!n&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,Lc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Lc=new WeakMap;class nv extends fm{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class rv extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var Dc,Ur,Nc,$u;class Lf extends Xt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,Nc);m(this,Dc,null);m(this,Ur,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?J.HIGHLIGHT:J.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,rotation:s,inkLists:i,borderStyle:n,popupRef:a}}=this,{transform:o,width:l,height:h}=b(this,Nc,$u).call(this,s,e),d=this.svgFactory.create(l,h,!0),u=p(this,Dc,this.svgFactory.createElement("svg:g"));d.append(u),u.setAttribute("stroke-width",n.width||1),u.setAttribute("stroke-linecap","round"),u.setAttribute("stroke-linejoin","round"),u.setAttribute("stroke-miterlimit",10),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),u.setAttribute("transform",o);for(let f=0,g=i.length;f<g;f++){const y=this.svgFactory.createElement(this.svgElementName);r(this,Ur).push(y),y.setAttribute("points",i[f].join(",")),u.append(y)}return!a&&this.hasPopupData&&this._createPopup(),this.container.append(d),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);const{thickness:s,points:i,rect:n}=e,a=r(this,Dc);if(s>=0&&a.setAttribute("stroke-width",s||1),i)for(let o=0,l=r(this,Ur).length;o<l;o++)r(this,Ur)[o].setAttribute("points",i[o].join(","));if(n){const{transform:o,width:l,height:h}=b(this,Nc,$u).call(this,this.data.rotation,n);a.parentElement.setAttribute("viewBox",`0 0 ${l} ${h}`),a.setAttribute("transform",o)}}getElementsToTriggerPopup(){return r(this,Ur)}addHighlightArea(){this.container.classList.add("highlightArea")}}Dc=new WeakMap,Ur=new WeakMap,Nc=new WeakSet,$u=function(e,s){switch(e){case 90:return{transform:`rotate(90) translate(${-s[0]},${s[1]}) scale(1,-1)`,width:s[3]-s[1],height:s[2]-s[0]};case 180:return{transform:`rotate(180) translate(${-s[2]},${s[1]}) scale(1,-1)`,width:s[2]-s[0],height:s[3]-s[1]};case 270:return{transform:`rotate(270) translate(${-s[2]},${s[3]}) scale(1,-1)`,width:s[3]-s[1],height:s[2]-s[0]};default:return{transform:`translate(${-s[0]},${s[3]}) scale(1,-1)`,width:s[2]-s[0],height:s[3]-s[1]}}};class pm extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=J.HIGHLIGHT}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){const s=document.createElement("mark");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class av extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),t){const s=document.createElement("u");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class ov extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),t){const s=document.createElement("u");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class lv extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),t){const s=document.createElement("s");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class gm extends Xt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=J.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var Fc,Oc,zu;class cv extends Xt{constructor(e){var i;super(e,{isRenderable:!0});m(this,Oc);m(this,Fc,null);const{file:s}=this.data;this.filename=s.filename,this.content=s.content,(i=this.linkService.eventBus)==null||i.dispatch("fileattachmentannotation",{source:this,...s})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:s}=this;let i;s.hasAppearance||s.fillAlpha===0?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(s.name)?"paperclip":"pushpin"}.svg`,s.fillAlpha&&s.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(s.fillAlpha*100)}%);`)),i.addEventListener("dblclick",b(this,Oc,zu).bind(this)),p(this,Fc,i);const{isMac:n}=ue.platform;return e.addEventListener("keydown",a=>{a.key==="Enter"&&(n?a.metaKey:a.ctrlKey)&&b(this,Oc,zu).call(this)}),!s.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),e.append(i),e}getElementsToTriggerPopup(){return r(this,Fc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Fc=new WeakMap,Oc=new WeakSet,zu=function(){var e;(e=this.downloadManager)==null||e.openOrDownloadData(this.content,this.filename)};var Bc,Wr,Ln,jc,Zn,Gu,Vu,xo;let Df=(xo=class{constructor({div:t,accessibilityManager:e,annotationCanvasMap:s,annotationEditorUIManager:i,page:n,viewport:a,structTreeLayer:o}){m(this,Zn);m(this,Bc,null);m(this,Wr,null);m(this,Ln,new Map);m(this,jc,null);this.div=t,p(this,Bc,e),p(this,Wr,s),p(this,jc,o||null),this.page=n,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=i}hasEditableAnnotations(){return r(this,Ln).size>0}async render(t){var a;const{annotations:e}=t,s=this.div;Xn(s,this.viewport);const i=new Map,n={data:null,layer:s,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new kl,annotationStorage:t.annotationStorage||new Cf,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const o of e){if(o.noHTML)continue;const l=o.annotationType===Vt.POPUP;if(l){const u=i.get(o.id);if(!u)continue;n.elements=u}else if(o.rect[2]===o.rect[0]||o.rect[3]===o.rect[1])continue;n.data=o;const h=wp.create(n);if(!h.isRenderable)continue;if(!l&&o.popupRef){const u=i.get(o.popupRef);u?u.push(h):i.set(o.popupRef,[h])}const d=h.render();o.hidden&&(d.style.visibility="hidden"),await b(this,Zn,Gu).call(this,d,o.id,n.elements),h._isEditable&&(r(this,Ln).set(h.data.id,h),(a=this._annotationEditorUIManager)==null||a.renderAnnotationElement(h))}b(this,Zn,Vu).call(this)}async addLinkAnnotations(t,e){const s={data:null,layer:this.div,linkService:e,svgFactory:new kl,parent:this};for(const i of t){i.borderStyle||(i.borderStyle=xo._defaultBorderStyle),s.data=i;const n=wp.create(s);if(!n.isRenderable)continue;const a=n.render();await b(this,Zn,Gu).call(this,a,i.id,null)}}update({viewport:t}){const e=this.div;this.viewport=t,Xn(e,{rotation:t.rotation}),b(this,Zn,Vu).call(this),e.hidden=!1}getEditableAnnotations(){return Array.from(r(this,Ln).values())}getEditableAnnotation(t){return r(this,Ln).get(t)}static get _defaultBorderStyle(){return it(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Sa.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},Bc=new WeakMap,Wr=new WeakMap,Ln=new WeakMap,jc=new WeakMap,Zn=new WeakSet,Gu=async function(t,e,s){var o,l;const i=t.firstChild||t,n=i.id=`${_f}${e}`,a=await((o=r(this,jc))==null?void 0:o.getAriaAttributes(n));if(a)for(const[h,d]of a)i.setAttribute(h,d);s?s.at(-1).container.after(t):(this.div.append(t),(l=r(this,Bc))==null||l.moveElementInDOM(this.div,t,i,!1))},Vu=function(){var e;if(!r(this,Wr))return;const t=this.div;for(const[s,i]of r(this,Wr)){const n=t.querySelector(`[data-annotation-id="${s}"]`);if(!n)continue;i.className="annotationContent";const{firstChild:a}=n;a?a.nodeName==="CANVAS"?a.replaceWith(i):a.classList.contains("annotationContent")?a.after(i):a.before(i):n.append(i);const o=r(this,Ln).get(s);o&&(o._hasNoCanvas?((e=this._annotationEditorUIManager)==null||e.setMissingCanvas(s,n.id,i),o._hasNoCanvas=!1):o.canvas=i)}r(this,Wr).clear()},xo);const Ah=/\r\n?|\n/g;var js,ts,Hc,qr,es,Qt,mm,bm,ym,jh,en,Hh,$h,vm,Wu,wm;const Pt=class Pt extends kt{constructor(e){super({...e,name:"freeTextEditor"});m(this,Qt);m(this,js);m(this,ts,"");m(this,Hc,`${this.id}-editor`);m(this,qr,null);m(this,es);p(this,js,e.color||Pt._defaultColor||kt._defaultLineColor),p(this,es,e.fontSize||Pt._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static get _keyboardManager(){const e=Pt.prototype,s=a=>a.isEmpty(),i=Yn.TRANSLATE_SMALL,n=Yn.TRANSLATE_BIG;return it(this,"_keyboardManager",new hh([[["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:[-i,0],checker:s}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-n,0],checker:s}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[i,0],checker:s}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[n,0],checker:s}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:s}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:s}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,i],checker:s}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,n],checker:s}]]))}static initialize(e,s){kt.initialize(e,s);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,s){switch(e){case rt.FREETEXT_SIZE:Pt._defaultFontSize=s;break;case rt.FREETEXT_COLOR:Pt._defaultColor=s;break}}updateParams(e,s){switch(e){case rt.FREETEXT_SIZE:b(this,Qt,mm).call(this,s);break;case rt.FREETEXT_COLOR:b(this,Qt,bm).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[rt.FREETEXT_SIZE,Pt._defaultFontSize],[rt.FREETEXT_COLOR,Pt._defaultColor||kt._defaultLineColor]]}get propertiesToUpdate(){return[[rt.FREETEXT_SIZE,r(this,es)],[rt.FREETEXT_COLOR,r(this,js)]]}_translateEmpty(e,s){this._uiManager.translateSelectedEditors(e,s,!0)}getInitialTranslation(){const e=this.parentScale;return[-Pt._internalPadding*e,-(Pt._internalPadding+r(this,es))*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"),p(this,qr,new AbortController);const e=this._uiManager.combinedSignal(r(this,qr));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(){var e;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",r(this,Hc)),this._isDraggable=!0,(e=r(this,qr))==null||e.abort(),p(this,qr,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){var s;this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),(s=this._initialOptions)!=null&&s.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const e=r(this,ts),s=p(this,ts,b(this,Qt,ym).call(this).trimEnd());if(e===s)return;const i=n=>{if(p(this,ts,n),!n){this.remove();return}b(this,Qt,$h).call(this),this._uiManager.rebuild(this),b(this,Qt,jh).call(this)};this.addCommands({cmd:()=>{i(s)},undo:()=>{i(e)},mustExec:!1}),b(this,Qt,jh).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){Pt._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,s;(this._isCopy||this.annotationElementId)&&(e=this.x,s=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",r(this,Hc)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${r(this,es)}px * var(--total-scale-factor))`,i.color=r(this,js),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[n,a]=this.parentDimensions;if(this.annotationElementId){const{position:o}=this._initialData;let[l,h]=this.getInitialTranslation();[l,h]=this.pageTranslationToScreen(l,h);const[d,u]=this.pageDimensions,[f,g]=this.pageTranslation;let y,v;switch(this.rotation){case 0:y=e+(o[0]-f)/d,v=s+this.height-(o[1]-g)/u;break;case 90:y=e+(o[0]-f)/d,v=s-(o[1]-g)/u,[l,h]=[h,-l];break;case 180:y=e-this.width+(o[0]-f)/d,v=s-(o[1]-g)/u,[l,h]=[-l,-h];break;case 270:y=e+(o[0]-f-this.height*u)/d,v=s+(o[1]-g-this.width*d)/u,[l,h]=[-h,l];break}this.setAt(y*n,v*a,l,h)}else this._moveAfterPaste(e,s);b(this,Qt,$h).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var y,v,w;const s=e.clipboardData||window.clipboardData,{types:i}=s;if(i.length===1&&i[0]==="text/plain")return;e.preventDefault();const n=b(y=Pt,en,Wu).call(y,s.getData("text")||"").replaceAll(Ah,`
34
+ `);if(!n)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const o=a.getRangeAt(0);if(!n.includes(`
35
+ `)){o.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),a.collapseToStart();return}const{startContainer:l,startOffset:h}=o,d=[],u=[];if(l.nodeType===Node.TEXT_NODE){const A=l.parentElement;if(u.push(l.nodeValue.slice(h).replaceAll(Ah,"")),A!==this.editorDiv){let x=d;for(const _ of this.editorDiv.childNodes){if(_===A){x=u;continue}x.push(b(v=Pt,en,Hh).call(v,_))}}d.push(l.nodeValue.slice(0,h).replaceAll(Ah,""))}else if(l===this.editorDiv){let A=d,x=0;for(const _ of this.editorDiv.childNodes)x++===h&&(A=u),A.push(b(w=Pt,en,Hh).call(w,_))}p(this,ts,`${d.join(`
36
+ `)}${n}${u.join(`
37
+ `)}`),b(this,Qt,$h).call(this);const f=new Range;let g=Math.sumPrecise(d.map(A=>A.length));for(const{firstChild:A}of this.editorDiv.childNodes)if(A.nodeType===Node.TEXT_NODE){const x=A.nodeValue.length;if(g<=x){f.setStart(A,g),f.setEnd(A,g);break}g-=x}a.removeAllRanges(),a.addRange(f)}get contentDiv(){return this.editorDiv}static async deserialize(e,s,i){var o;let n=null;if(e instanceof um){const{data:{defaultAppearanceData:{fontSize:l,fontColor:h},rect:d,rotation:u,id:f,popupRef:g},textContent:y,textPosition:v,parent:{page:{pageNumber:w}}}=e;if(!y||y.length===0)return null;n=e={annotationType:J.FREETEXT,color:Array.from(h),fontSize:l,value:y.join(`
38
+ `),position:v,pageIndex:w-1,rect:d.slice(0),rotation:u,annotationElementId:f,id:f,deleted:!1,popupRef:g}}const a=await super.deserialize(e,s,i);return p(a,es,e.fontSize),p(a,js,W.makeHexColor(...e.color)),p(a,ts,b(o=Pt,en,Wu).call(o,e.value)),a._initialData=n,a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s=Pt._internalPadding*this.parentScale,i=this.getRect(s,s),n=kt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:r(this,js)),a={annotationType:J.FREETEXT,color:n,fontSize:r(this,es),value:b(this,Qt,vm).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?(a.isCopy=!0,a):this.annotationElementId&&!b(this,Qt,wm).call(this,a)?null:(a.id=this.annotationElementId,a)}renderAnnotationElement(e){const s=super.renderAnnotationElement(e);if(this.deleted)return s;const{style:i}=s;i.fontSize=`calc(${r(this,es)}px * var(--total-scale-factor))`,i.color=r(this,js),s.replaceChildren();for(const a of r(this,ts).split(`
39
+ `)){const o=document.createElement("div");o.append(a?document.createTextNode(a):document.createElement("br")),s.append(o)}const n=Pt._internalPadding*this.parentScale;return e.updateEdited({rect:this.getRect(n,n),popupContent:r(this,ts)}),s}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};js=new WeakMap,ts=new WeakMap,Hc=new WeakMap,qr=new WeakMap,es=new WeakMap,Qt=new WeakSet,mm=function(e){const s=n=>{this.editorDiv.style.fontSize=`calc(${n}px * var(--total-scale-factor))`,this.translate(0,-(n-r(this,es))*this.parentScale),p(this,es,n),b(this,Qt,jh).call(this)},i=r(this,es);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:rt.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},bm=function(e){const s=n=>{p(this,js,this.editorDiv.style.color=n)},i=r(this,js);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:rt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},ym=function(){var i;const e=[];this.editorDiv.normalize();let s=null;for(const n of this.editorDiv.childNodes)(s==null?void 0:s.nodeType)===Node.TEXT_NODE&&n.nodeName==="BR"||(e.push(b(i=Pt,en,Hh).call(i,n)),s=n);return e.join(`
40
+ `)},jh=function(){const[e,s]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:n,div:a}=this,o=a.style.display,l=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",n.div.append(this.div),i=a.getBoundingClientRect(),a.remove(),a.style.display=o,a.classList.toggle("hidden",l)}this.rotation%180===this.parentRotation%180?(this.width=i.width/e,this.height=i.height/s):(this.width=i.height/e,this.height=i.width/s),this.fixAndSetPosition()},en=new WeakSet,Hh=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Ah,"")},$h=function(){if(this.editorDiv.replaceChildren(),!!r(this,ts))for(const e of r(this,ts).split(`
41
+ `)){const s=document.createElement("div");s.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(s)}},vm=function(){return r(this,ts).replaceAll(" "," ")},Wu=function(e){return e.replaceAll(" "," ")},wm=function(e){const{value:s,fontSize:i,color:n,pageIndex:a}=this._initialData;return this._hasBeenMoved||e.value!==s||e.fontSize!==i||e.color.some((o,l)=>o!==n[l])||e.pageIndex!==a},m(Pt,en),L(Pt,"_freeTextDefaultContent",""),L(Pt,"_internalPadding",0),L(Pt,"_defaultColor",null),L(Pt,"_defaultFontSize",10),L(Pt,"_type","freetext"),L(Pt,"_editorType",J.FREETEXT);let Uu=Pt;class G{toSVGPath(){xt("Abstract method `toSVGPath` must be implemented.")}get box(){xt("Abstract getter `box` must be implemented.")}serialize(t,e){xt("Abstract method `serialize` must be implemented.")}static _rescale(t,e,s,i,n,a){a||(a=new Float32Array(t.length));for(let o=0,l=t.length;o<l;o+=2)a[o]=e+t[o]*i,a[o+1]=s+t[o+1]*n;return a}static _rescaleAndSwap(t,e,s,i,n,a){a||(a=new Float32Array(t.length));for(let o=0,l=t.length;o<l;o+=2)a[o]=e+t[o+1]*i,a[o+1]=s+t[o]*n;return a}static _translate(t,e,s,i){i||(i=new Float32Array(t.length));for(let n=0,a=t.length;n<a;n+=2)i[n]=e+t[n],i[n+1]=s+t[n+1];return i}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,e,s,i,n){switch(n){case 90:return[1-e/s,t/i];case 180:return[1-t/s,1-e/i];case 270:return[e/s,1-t/i];default:return[t/s,e/i]}}static _normalizePagePoint(t,e,s){switch(s){case 90:return[1-e,t];case 180:return[1-t,1-e];case 270:return[e,1-t];default:return[t,e]}}static createBezierPoints(t,e,s,i,n,a){return[(t+5*s)/6,(e+5*i)/6,(5*s+n)/6,(5*i+a)/6,(s+n)/2,(i+a)/2]}}L(G,"PRECISION",1e-4);var ss,Hs,Eo,_o,li,et,Xr,Yr,$c,zc,So,Co,Dn,Gc,Ad,xd,ne,bl,Am,xm,Em,_m,Sm,Cm;const Ei=class Ei{constructor({x:t,y:e},s,i,n,a,o=0){m(this,ne);m(this,ss);m(this,Hs,[]);m(this,Eo);m(this,_o);m(this,li,[]);m(this,et,new Float32Array(18));m(this,Xr);m(this,Yr);m(this,$c);m(this,zc);m(this,So);m(this,Co);m(this,Dn,[]);p(this,ss,s),p(this,Co,n*i),p(this,_o,a),r(this,et).set([NaN,NaN,NaN,NaN,t,e],6),p(this,Eo,o),p(this,zc,r(Ei,Gc)*i),p(this,$c,r(Ei,xd)*i),p(this,So,i),r(this,Dn).push(t,e)}isEmpty(){return isNaN(r(this,et)[8])}add({x:t,y:e}){var I;p(this,Xr,t),p(this,Yr,e);const[s,i,n,a]=r(this,ss);let[o,l,h,d]=r(this,et).subarray(8,12);const u=t-h,f=e-d,g=Math.hypot(u,f);if(g<r(this,$c))return!1;const y=g-r(this,zc),v=y/g,w=v*u,A=v*f;let x=o,_=l;o=h,l=d,h+=w,d+=A,(I=r(this,Dn))==null||I.push(t,e);const S=-A/y,C=w/y,R=S*r(this,Co),T=C*r(this,Co);return r(this,et).set(r(this,et).subarray(2,8),0),r(this,et).set([h+R,d+T],4),r(this,et).set(r(this,et).subarray(14,18),12),r(this,et).set([h-R,d-T],16),isNaN(r(this,et)[6])?(r(this,li).length===0&&(r(this,et).set([o+R,l+T],2),r(this,li).push(NaN,NaN,NaN,NaN,(o+R-s)/n,(l+T-i)/a),r(this,et).set([o-R,l-T],14),r(this,Hs).push(NaN,NaN,NaN,NaN,(o-R-s)/n,(l-T-i)/a)),r(this,et).set([x,_,o,l,h,d],6),!this.isEmpty()):(r(this,et).set([x,_,o,l,h,d],6),Math.abs(Math.atan2(_-l,x-o)-Math.atan2(A,w))<Math.PI/2?([o,l,h,d]=r(this,et).subarray(2,6),r(this,li).push(NaN,NaN,NaN,NaN,((o+h)/2-s)/n,((l+d)/2-i)/a),[o,l,x,_]=r(this,et).subarray(14,18),r(this,Hs).push(NaN,NaN,NaN,NaN,((x+o)/2-s)/n,((_+l)/2-i)/a),!0):([x,_,o,l,h,d]=r(this,et).subarray(0,6),r(this,li).push(((x+5*o)/6-s)/n,((_+5*l)/6-i)/a,((5*o+h)/6-s)/n,((5*l+d)/6-i)/a,((o+h)/2-s)/n,((l+d)/2-i)/a),[h,d,o,l,x,_]=r(this,et).subarray(12,18),r(this,Hs).push(((x+5*o)/6-s)/n,((_+5*l)/6-i)/a,((5*o+h)/6-s)/n,((5*l+d)/6-i)/a,((o+h)/2-s)/n,((l+d)/2-i)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const t=r(this,li),e=r(this,Hs);if(isNaN(r(this,et)[6])&&!this.isEmpty())return b(this,ne,Am).call(this);const s=[];s.push(`M${t[4]} ${t[5]}`);for(let i=6;i<t.length;i+=6)isNaN(t[i])?s.push(`L${t[i+4]} ${t[i+5]}`):s.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);b(this,ne,Em).call(this,s);for(let i=e.length-6;i>=6;i-=6)isNaN(e[i])?s.push(`L${e[i+4]} ${e[i+5]}`):s.push(`C${e[i]} ${e[i+1]} ${e[i+2]} ${e[i+3]} ${e[i+4]} ${e[i+5]}`);return b(this,ne,xm).call(this,s),s.join(" ")}newFreeDrawOutline(t,e,s,i,n,a){return new Tm(t,e,s,i,n,a)}getOutlines(){var u;const t=r(this,li),e=r(this,Hs),s=r(this,et),[i,n,a,o]=r(this,ss),l=new Float32Array((((u=r(this,Dn))==null?void 0:u.length)??0)+2);for(let f=0,g=l.length-2;f<g;f+=2)l[f]=(r(this,Dn)[f]-i)/a,l[f+1]=(r(this,Dn)[f+1]-n)/o;if(l[l.length-2]=(r(this,Xr)-i)/a,l[l.length-1]=(r(this,Yr)-n)/o,isNaN(s[6])&&!this.isEmpty())return b(this,ne,_m).call(this,l);const h=new Float32Array(r(this,li).length+24+r(this,Hs).length);let d=t.length;for(let f=0;f<d;f+=2){if(isNaN(t[f])){h[f]=h[f+1]=NaN;continue}h[f]=t[f],h[f+1]=t[f+1]}d=b(this,ne,Cm).call(this,h,d);for(let f=e.length-6;f>=6;f-=6)for(let g=0;g<6;g+=2){if(isNaN(e[f+g])){h[d]=h[d+1]=NaN,d+=2;continue}h[d]=e[f+g],h[d+1]=e[f+g+1],d+=2}return b(this,ne,Sm).call(this,h,d),this.newFreeDrawOutline(h,l,r(this,ss),r(this,So),r(this,Eo),r(this,_o))}};ss=new WeakMap,Hs=new WeakMap,Eo=new WeakMap,_o=new WeakMap,li=new WeakMap,et=new WeakMap,Xr=new WeakMap,Yr=new WeakMap,$c=new WeakMap,zc=new WeakMap,So=new WeakMap,Co=new WeakMap,Dn=new WeakMap,Gc=new WeakMap,Ad=new WeakMap,xd=new WeakMap,ne=new WeakSet,bl=function(){const t=r(this,et).subarray(4,6),e=r(this,et).subarray(16,18),[s,i,n,a]=r(this,ss);return[(r(this,Xr)+(t[0]-e[0])/2-s)/n,(r(this,Yr)+(t[1]-e[1])/2-i)/a,(r(this,Xr)+(e[0]-t[0])/2-s)/n,(r(this,Yr)+(e[1]-t[1])/2-i)/a]},Am=function(){const[t,e,s,i]=r(this,ss),[n,a,o,l]=b(this,ne,bl).call(this);return`M${(r(this,et)[2]-t)/s} ${(r(this,et)[3]-e)/i} L${(r(this,et)[4]-t)/s} ${(r(this,et)[5]-e)/i} L${n} ${a} L${o} ${l} L${(r(this,et)[16]-t)/s} ${(r(this,et)[17]-e)/i} L${(r(this,et)[14]-t)/s} ${(r(this,et)[15]-e)/i} Z`},xm=function(t){const e=r(this,Hs);t.push(`L${e[4]} ${e[5]} Z`)},Em=function(t){const[e,s,i,n]=r(this,ss),a=r(this,et).subarray(4,6),o=r(this,et).subarray(16,18),[l,h,d,u]=b(this,ne,bl).call(this);t.push(`L${(a[0]-e)/i} ${(a[1]-s)/n} L${l} ${h} L${d} ${u} L${(o[0]-e)/i} ${(o[1]-s)/n}`)},_m=function(t){const e=r(this,et),[s,i,n,a]=r(this,ss),[o,l,h,d]=b(this,ne,bl).call(this),u=new Float32Array(36);return u.set([NaN,NaN,NaN,NaN,(e[2]-s)/n,(e[3]-i)/a,NaN,NaN,NaN,NaN,(e[4]-s)/n,(e[5]-i)/a,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,(e[16]-s)/n,(e[17]-i)/a,NaN,NaN,NaN,NaN,(e[14]-s)/n,(e[15]-i)/a],0),this.newFreeDrawOutline(u,t,r(this,ss),r(this,So),r(this,Eo),r(this,_o))},Sm=function(t,e){const s=r(this,Hs);return t.set([NaN,NaN,NaN,NaN,s[4],s[5]],e),e+=6},Cm=function(t,e){const s=r(this,et).subarray(4,6),i=r(this,et).subarray(16,18),[n,a,o,l]=r(this,ss),[h,d,u,f]=b(this,ne,bl).call(this);return t.set([NaN,NaN,NaN,NaN,(s[0]-n)/o,(s[1]-a)/l,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,u,f,NaN,NaN,NaN,NaN,(i[0]-n)/o,(i[1]-a)/l],e),e+=24},m(Ei,Gc,8),m(Ei,Ad,2),m(Ei,xd,r(Ei,Gc)+r(Ei,Ad));let sd=Ei;var To,Kr,Ui,Vc,is,Uc,Wt,Ed,Rm;class Tm extends G{constructor(e,s,i,n,a,o){super();m(this,Ed);m(this,To);m(this,Kr,new Float32Array(4));m(this,Ui);m(this,Vc);m(this,is);m(this,Uc);m(this,Wt);p(this,Wt,e),p(this,is,s),p(this,To,i),p(this,Uc,n),p(this,Ui,a),p(this,Vc,o),this.lastPoint=[NaN,NaN],b(this,Ed,Rm).call(this,o);const[l,h,d,u]=r(this,Kr);for(let f=0,g=e.length;f<g;f+=2)e[f]=(e[f]-l)/d,e[f+1]=(e[f+1]-h)/u;for(let f=0,g=s.length;f<g;f+=2)s[f]=(s[f]-l)/d,s[f+1]=(s[f+1]-h)/u}toSVGPath(){const e=[`M${r(this,Wt)[4]} ${r(this,Wt)[5]}`];for(let s=6,i=r(this,Wt).length;s<i;s+=6){if(isNaN(r(this,Wt)[s])){e.push(`L${r(this,Wt)[s+4]} ${r(this,Wt)[s+5]}`);continue}e.push(`C${r(this,Wt)[s]} ${r(this,Wt)[s+1]} ${r(this,Wt)[s+2]} ${r(this,Wt)[s+3]} ${r(this,Wt)[s+4]} ${r(this,Wt)[s+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,s,i,n],a){const o=i-e,l=n-s;let h,d;switch(a){case 0:h=G._rescale(r(this,Wt),e,n,o,-l),d=G._rescale(r(this,is),e,n,o,-l);break;case 90:h=G._rescaleAndSwap(r(this,Wt),e,s,o,l),d=G._rescaleAndSwap(r(this,is),e,s,o,l);break;case 180:h=G._rescale(r(this,Wt),i,s,-o,l),d=G._rescale(r(this,is),i,s,-o,l);break;case 270:h=G._rescaleAndSwap(r(this,Wt),i,n,-o,-l),d=G._rescaleAndSwap(r(this,is),i,n,-o,-l);break}return{outline:Array.from(h),points:[Array.from(d)]}}get box(){return r(this,Kr)}newOutliner(e,s,i,n,a,o=0){return new sd(e,s,i,n,a,o)}getNewOutline(e,s){const[i,n,a,o]=r(this,Kr),[l,h,d,u]=r(this,To),f=a*d,g=o*u,y=i*d+l,v=n*u+h,w=this.newOutliner({x:r(this,is)[0]*f+y,y:r(this,is)[1]*g+v},r(this,To),r(this,Uc),e,r(this,Vc),s??r(this,Ui));for(let A=2;A<r(this,is).length;A+=2)w.add({x:r(this,is)[A]*f+y,y:r(this,is)[A+1]*g+v});return w.getOutlines()}}To=new WeakMap,Kr=new WeakMap,Ui=new WeakMap,Vc=new WeakMap,is=new WeakMap,Uc=new WeakMap,Wt=new WeakMap,Ed=new WeakSet,Rm=function(e){const s=r(this,Wt);let i=s[4],n=s[5];const a=[i,n,i,n];let o=i,l=n;const h=e?Math.max:Math.min;for(let u=6,f=s.length;u<f;u+=6){const g=s[u+4],y=s[u+5];if(isNaN(s[u]))W.pointBoundingBox(g,y,a),l<y?(o=g,l=y):l===y&&(o=h(o,g));else{const v=[1/0,1/0,-1/0,-1/0];W.bezierBoundingBox(i,n,...s.slice(u,u+6),v),W.rectBoundingBox(...v,a),l<v[3]?(o=v[2],l=v[3]):l===v[3]&&(o=h(o,v[2]))}i=g,n=y}const d=r(this,Kr);d[0]=a[0]-r(this,Ui),d[1]=a[1]-r(this,Ui),d[2]=a[2]-a[0]+2*r(this,Ui),d[3]=a[3]-a[1]+2*r(this,Ui),this.lastPoint=[o,l]};var Wc,qc,Nn,$s,$e,Pm,zh,km,Im,Xu;class qu{constructor(t,e=0,s=0,i=!0){m(this,$e);m(this,Wc);m(this,qc);m(this,Nn,[]);m(this,$s,[]);const n=[1/0,1/0,-1/0,-1/0],a=10**-4;for(const{x:g,y,width:v,height:w}of t){const A=Math.floor((g-e)/a)*a,x=Math.ceil((g+v+e)/a)*a,_=Math.floor((y-e)/a)*a,S=Math.ceil((y+w+e)/a)*a,C=[A,_,S,!0],R=[x,_,S,!1];r(this,Nn).push(C,R),W.rectBoundingBox(A,_,x,S,n)}const o=n[2]-n[0]+2*s,l=n[3]-n[1]+2*s,h=n[0]-s,d=n[1]-s,u=r(this,Nn).at(i?-1:-2),f=[u[0],u[2]];for(const g of r(this,Nn)){const[y,v,w]=g;g[0]=(y-h)/o,g[1]=(v-d)/l,g[2]=(w-d)/l}p(this,Wc,new Float32Array([h,d,o,l])),p(this,qc,f)}getOutlines(){r(this,Nn).sort((e,s)=>e[0]-s[0]||e[1]-s[1]||e[2]-s[2]);const t=[];for(const e of r(this,Nn))e[3]?(t.push(...b(this,$e,Xu).call(this,e)),b(this,$e,km).call(this,e)):(b(this,$e,Im).call(this,e),t.push(...b(this,$e,Xu).call(this,e)));return b(this,$e,Pm).call(this,t)}}Wc=new WeakMap,qc=new WeakMap,Nn=new WeakMap,$s=new WeakMap,$e=new WeakSet,Pm=function(t){const e=[],s=new Set;for(const a of t){const[o,l,h]=a;e.push([o,l,a],[o,h,a])}e.sort((a,o)=>a[1]-o[1]||a[0]-o[0]);for(let a=0,o=e.length;a<o;a+=2){const l=e[a][2],h=e[a+1][2];l.push(h),h.push(l),s.add(l),s.add(h)}const i=[];let n;for(;s.size>0;){const a=s.values().next().value;let[o,l,h,d,u]=a;s.delete(a);let f=o,g=l;for(n=[o,h],i.push(n);;){let y;if(s.has(d))y=d;else if(s.has(u))y=u;else break;s.delete(y),[o,l,h,d,u]=y,f!==o&&(n.push(f,g,o,g===l?l:h),f=o),g=g===l?h:l}n.push(f,g)}return new hv(i,r(this,Wc),r(this,qc))},zh=function(t){const e=r(this,$s);let s=0,i=e.length-1;for(;s<=i;){const n=s+i>>1,a=e[n][0];if(a===t)return n;a<t?s=n+1:i=n-1}return i+1},km=function([,t,e]){const s=b(this,$e,zh).call(this,t);r(this,$s).splice(s,0,[t,e])},Im=function([,t,e]){const s=b(this,$e,zh).call(this,t);for(let i=s;i<r(this,$s).length;i++){const[n,a]=r(this,$s)[i];if(n!==t)break;if(n===t&&a===e){r(this,$s).splice(i,1);return}}for(let i=s-1;i>=0;i--){const[n,a]=r(this,$s)[i];if(n!==t)break;if(n===t&&a===e){r(this,$s).splice(i,1);return}}},Xu=function(t){const[e,s,i]=t,n=[[e,s,i]],a=b(this,$e,zh).call(this,i);for(let o=0;o<a;o++){const[l,h]=r(this,$s)[o];for(let d=0,u=n.length;d<u;d++){const[,f,g]=n[d];if(!(h<=f||g<=l)){if(f>=l){if(g>h)n[d][1]=h;else{if(u===1)return[];n.splice(d,1),d--,u--}continue}n[d][2]=l,g>h&&n.push([e,h,g])}}}return n};var Xc,Ro;class hv extends G{constructor(e,s,i){super();m(this,Xc);m(this,Ro);p(this,Ro,e),p(this,Xc,s),this.lastPoint=i}toSVGPath(){const e=[];for(const s of r(this,Ro)){let[i,n]=s;e.push(`M${i} ${n}`);for(let a=2;a<s.length;a+=2){const o=s[a],l=s[a+1];o===i?(e.push(`V${l}`),n=l):l===n&&(e.push(`H${o}`),i=o)}e.push("Z")}return e.join(" ")}serialize([e,s,i,n],a){const o=[],l=i-e,h=n-s;for(const d of r(this,Ro)){const u=new Array(d.length);for(let f=0;f<d.length;f+=2)u[f]=e+d[f]*l,u[f+1]=n-d[f+1]*h;o.push(u)}return o}get box(){return r(this,Xc)}get classNamesForOutlining(){return["highlightOutline"]}}Xc=new WeakMap,Ro=new WeakMap;class Yu extends sd{newFreeDrawOutline(t,e,s,i,n,a){return new dv(t,e,s,i,n,a)}}class dv extends Tm{newOutliner(t,e,s,i,n,a=0){return new Yu(t,e,s,i,n,a)}}var ns,Jr,Po,ie,Yc,ko,Wi,Kc,Fn,zs,Io,Jc,At,Ku,Ju,Zu,ir,Mm,hn;const Ve=class Ve{constructor({editor:t=null,uiManager:e=null}){m(this,At);m(this,ns,null);m(this,Jr,null);m(this,Po);m(this,ie,null);m(this,Yc,!1);m(this,ko,!1);m(this,Wi,null);m(this,Kc);m(this,Fn,null);m(this,zs,null);m(this,Io);var s,i;t?(p(this,ko,!1),p(this,Io,rt.HIGHLIGHT_COLOR),p(this,Wi,t)):(p(this,ko,!0),p(this,Io,rt.HIGHLIGHT_DEFAULT_COLOR)),p(this,zs,(t==null?void 0:t._uiManager)||e),p(this,Kc,r(this,zs)._eventBus),p(this,Po,((s=t==null?void 0:t.color)==null?void 0:s.toUpperCase())||((i=r(this,zs))==null?void 0:i.highlightColors.values().next().value)||"#FFFF98"),r(Ve,Jc)||p(Ve,Jc,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"}))}static get _keyboardManager(){return it(this,"_keyboardManager",new hh([[["Escape","mac+Escape"],Ve.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Ve.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Ve.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Ve.prototype._moveToPrevious],[["Home","mac+Home"],Ve.prototype._moveToBeginning],[["End","mac+End"],Ve.prototype._moveToEnd]]))}renderButton(){const t=p(this,ns,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",r(this,Wi)&&(t.ariaControls=`${r(this,Wi).id}_colorpicker_dropdown`);const e=r(this,zs)._signal;t.addEventListener("click",b(this,At,ir).bind(this),{signal:e}),t.addEventListener("keydown",b(this,At,Zu).bind(this),{signal:e});const s=p(this,Jr,document.createElement("span"));return s.className="swatch",s.ariaHidden="true",s.style.backgroundColor=r(this,Po),t.append(s),t}renderMainDropdown(){const t=p(this,ie,b(this,At,Ku).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===r(this,ns)){b(this,At,ir).call(this,t);return}const e=t.target.getAttribute("data-color");e&&b(this,At,Ju).call(this,e,t)}_moveToNext(t){var e,s;if(!r(this,At,hn)){b(this,At,ir).call(this,t);return}if(t.target===r(this,ns)){(e=r(this,ie).firstChild)==null||e.focus();return}(s=t.target.nextSibling)==null||s.focus()}_moveToPrevious(t){var e,s;if(t.target===((e=r(this,ie))==null?void 0:e.firstChild)||t.target===r(this,ns)){r(this,At,hn)&&this._hideDropdownFromKeyboard();return}r(this,At,hn)||b(this,At,ir).call(this,t),(s=t.target.previousSibling)==null||s.focus()}_moveToBeginning(t){var e;if(!r(this,At,hn)){b(this,At,ir).call(this,t);return}(e=r(this,ie).firstChild)==null||e.focus()}_moveToEnd(t){var e;if(!r(this,At,hn)){b(this,At,ir).call(this,t);return}(e=r(this,ie).lastChild)==null||e.focus()}hideDropdown(){var t,e;(t=r(this,ie))==null||t.classList.add("hidden"),r(this,ns).ariaExpanded="false",(e=r(this,Fn))==null||e.abort(),p(this,Fn,null)}_hideDropdownFromKeyboard(){var t;if(!r(this,ko)){if(!r(this,At,hn)){(t=r(this,Wi))==null||t.unselect();return}this.hideDropdown(),r(this,ns).focus({preventScroll:!0,focusVisible:r(this,Yc)})}}updateColor(t){if(r(this,Jr)&&(r(this,Jr).style.backgroundColor=t),!r(this,ie))return;const e=r(this,zs).highlightColors.values();for(const s of r(this,ie).children)s.ariaSelected=e.next().value===t.toUpperCase()}destroy(){var t,e;(t=r(this,ns))==null||t.remove(),p(this,ns,null),p(this,Jr,null),(e=r(this,ie))==null||e.remove(),p(this,ie,null)}};ns=new WeakMap,Jr=new WeakMap,Po=new WeakMap,ie=new WeakMap,Yc=new WeakMap,ko=new WeakMap,Wi=new WeakMap,Kc=new WeakMap,Fn=new WeakMap,zs=new WeakMap,Io=new WeakMap,Jc=new WeakMap,At=new WeakSet,Ku=function(){const t=document.createElement("div"),e=r(this,zs)._signal;t.addEventListener("contextmenu",Rs,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),r(this,Wi)&&(t.id=`${r(this,Wi).id}_colorpicker_dropdown`);for(const[s,i]of r(this,zs).highlightColors){const n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",i),n.title=s,n.setAttribute("data-l10n-id",r(Ve,Jc)[s]);const a=document.createElement("span");n.append(a),a.className="swatch",a.style.backgroundColor=i,n.ariaSelected=i===r(this,Po),n.addEventListener("click",b(this,At,Ju).bind(this,i),{signal:e}),t.append(n)}return t.addEventListener("keydown",b(this,At,Zu).bind(this),{signal:e}),t},Ju=function(t,e){e.stopPropagation(),r(this,Kc).dispatch("switchannotationeditorparams",{source:this,type:r(this,Io),value:t})},Zu=function(t){Ve._keyboardManager.exec(this,t)},ir=function(t){if(r(this,At,hn)){this.hideDropdown();return}if(p(this,Yc,t.detail===0),r(this,Fn)||(p(this,Fn,new AbortController),window.addEventListener("pointerdown",b(this,At,Mm).bind(this),{signal:r(this,zs).combinedSignal(r(this,Fn))})),r(this,ns).ariaExpanded="true",r(this,ie)){r(this,ie).classList.remove("hidden");return}const e=p(this,ie,b(this,At,Ku).call(this));r(this,ns).append(e)},Mm=function(t){var e;(e=r(this,ie))!=null&&e.contains(t.target)||this.hideDropdown()},hn=function(){return r(this,ie)&&!r(this,ie).classList.contains("hidden")},m(Ve,Jc,null);let Il=Ve;var Mo,Zc,qi,Zr,Qc,qe,th,eh,Qr,As,rs,me,Lo,Xi,Ce,Do,xs,sh,Q,Qu,Gh,Lm,Dm,Nm,tf,nr,Cs,ka,Fm,Vh,yl,Om,Bm,jm,Hm,$m;const ut=class ut extends kt{constructor(e){super({...e,name:"highlightEditor"});m(this,Q);m(this,Mo,null);m(this,Zc,0);m(this,qi);m(this,Zr,null);m(this,Qc,null);m(this,qe,null);m(this,th,null);m(this,eh,0);m(this,Qr,null);m(this,As,null);m(this,rs,null);m(this,me,!1);m(this,Lo,null);m(this,Xi);m(this,Ce,null);m(this,Do,"");m(this,xs);m(this,sh,"");this.color=e.color||ut._defaultColor,p(this,xs,e.thickness||ut._defaultThickness),p(this,Xi,e.opacity||ut._defaultOpacity),p(this,qi,e.boxes||null),p(this,sh,e.methodOfCreation||""),p(this,Do,e.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",e.highlightId>-1?(p(this,me,!0),b(this,Q,Gh).call(this,e),b(this,Q,nr).call(this)):r(this,qi)&&(p(this,Mo,e.anchorNode),p(this,Zc,e.anchorOffset),p(this,th,e.focusNode),p(this,eh,e.focusOffset),b(this,Q,Qu).call(this),b(this,Q,nr).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){const e=ut.prototype;return it(this,"_keyboardManager",new hh([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:r(this,me)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:r(this,xs),methodOfCreation:r(this,sh)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,s){var i;kt.initialize(e,s),ut._defaultColor||(ut._defaultColor=((i=s.highlightColors)==null?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(e,s){switch(e){case rt.HIGHLIGHT_DEFAULT_COLOR:ut._defaultColor=s;break;case rt.HIGHLIGHT_THICKNESS:ut._defaultThickness=s;break}}translateInPage(e,s){}get toolbarPosition(){return r(this,Lo)}updateParams(e,s){switch(e){case rt.HIGHLIGHT_COLOR:b(this,Q,Lm).call(this,s);break;case rt.HIGHLIGHT_THICKNESS:b(this,Q,Dm).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[rt.HIGHLIGHT_DEFAULT_COLOR,ut._defaultColor],[rt.HIGHLIGHT_THICKNESS,ut._defaultThickness]]}get propertiesToUpdate(){return[[rt.HIGHLIGHT_COLOR,this.color||ut._defaultColor],[rt.HIGHLIGHT_THICKNESS,r(this,xs)||ut._defaultThickness],[rt.HIGHLIGHT_FREE,r(this,me)]]}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",p(this,Qc,new Il({editor:this}))]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(b(this,Q,yl).call(this))}getBaseTranslation(){return[0,0]}getRect(e,s){return super.getRect(e,s,b(this,Q,yl).call(this))}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){b(this,Q,tf).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,Q,nr).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var i;let s=!1;this.parent&&!e?b(this,Q,tf).call(this):e&&(b(this,Q,nr).call(this,e),s=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(e),this.show(this._isVisible),s&&this.select()}rotate(e){var n,a,o;const{drawLayer:s}=this.parent;let i;r(this,me)?(e=(e-this.rotation+360)%360,i=b(n=ut,Cs,ka).call(n,r(this,As).box,e)):i=b(a=ut,Cs,ka).call(a,[this.x,this.y,this.width,this.height],e),s.updateProperties(r(this,rs),{bbox:i,root:{"data-main-rotation":e}}),s.updateProperties(r(this,Ce),{bbox:b(o=ut,Cs,ka).call(o,r(this,qe).box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;const e=super.render();r(this,Do)&&(e.setAttribute("aria-label",r(this,Do)),e.setAttribute("role","mark")),r(this,me)?e.classList.add("free"):this.div.addEventListener("keydown",b(this,Q,Fm).bind(this),{signal:this._uiManager._signal});const s=p(this,Qr,document.createElement("div"));e.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",s.style.clipPath=r(this,Zr);const[i,n]=this.parentDimensions;return this.setDims(this.width*i,this.height*n),og(this,r(this,Qr),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){var e;this.isSelected||(e=this.parent)==null||e.drawLayer.updateProperties(r(this,Ce),{rootClass:{hovered:!0}})}pointerleave(){var e;this.isSelected||(e=this.parent)==null||e.drawLayer.updateProperties(r(this,Ce),{rootClass:{hovered:!1}})}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:b(this,Q,Vh).call(this,!0);break;case 1:case 3:b(this,Q,Vh).call(this,!1);break}}select(){var e;super.select(),r(this,Ce)&&((e=this.parent)==null||e.drawLayer.updateProperties(r(this,Ce),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var e;super.unselect(),r(this,Ce)&&((e=this.parent)==null||e.drawLayer.updateProperties(r(this,Ce),{rootClass:{selected:!1}}),r(this,me)||b(this,Q,Vh).call(this,!1))}get _mustFixPosition(){return!r(this,me)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(r(this,rs),{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(r(this,Ce),{rootClass:{hidden:!e}}))}static startHighlighting(e,s,{target:i,x:n,y:a}){const{x:o,y:l,width:h,height:d}=i.getBoundingClientRect(),u=new AbortController,f=e.combinedSignal(u),g=y=>{u.abort(),b(this,Cs,Hm).call(this,e,y)};window.addEventListener("blur",g,{signal:f}),window.addEventListener("pointerup",g,{signal:f}),window.addEventListener("pointerdown",qt,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",Rs,{signal:f}),i.addEventListener("pointermove",b(this,Cs,jm).bind(this,e),{signal:f}),this._freeHighlight=new Yu({x:n,y:a},[o,l,h,d],e.scale,this._defaultThickness/2,s,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static async deserialize(e,s,i){var v,w,A,x;let n=null;if(e instanceof pm){const{data:{quadPoints:_,rect:S,rotation:C,id:R,color:T,opacity:k,popupRef:I},parent:{page:{pageNumber:D}}}=e;n=e={annotationType:J.HIGHLIGHT,color:Array.from(T),opacity:k,quadPoints:_,boxes:null,pageIndex:D-1,rect:S.slice(0),rotation:C,annotationElementId:R,id:R,deleted:!1,popupRef:I}}else if(e instanceof Lf){const{data:{inkLists:_,rect:S,rotation:C,id:R,color:T,borderStyle:{rawWidth:k},popupRef:I},parent:{page:{pageNumber:D}}}=e;n=e={annotationType:J.HIGHLIGHT,color:Array.from(T),thickness:k,inkLists:_,boxes:null,pageIndex:D-1,rect:S.slice(0),rotation:C,annotationElementId:R,id:R,deleted:!1,popupRef:I}}const{color:a,quadPoints:o,inkLists:l,opacity:h}=e,d=await super.deserialize(e,s,i);d.color=W.makeHexColor(...a),p(d,Xi,h||1),l&&p(d,xs,e.thickness),d._initialData=n;const[u,f]=d.pageDimensions,[g,y]=d.pageTranslation;if(o){const _=p(d,qi,[]);for(let S=0;S<o.length;S+=8)_.push({x:(o[S]-g)/u,y:1-(o[S+1]-y)/f,width:(o[S+2]-o[S])/u,height:(o[S+1]-o[S+5])/f});b(v=d,Q,Qu).call(v),b(w=d,Q,nr).call(w),d.rotate(d.rotation)}else if(l){p(d,me,!0);const _=l[0],S={x:_[0]-g,y:f-(_[1]-y)},C=new Yu(S,[0,0,u,f],1,r(d,xs)/2,!0,.001);for(let k=0,I=_.length;k<I;k+=2)S.x=_[k]-g,S.y=f-(_[k+1]-y),C.add(S);const{id:R,clipPathId:T}=s.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:d.color,"fill-opacity":d._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:C.toSVGPath()}},!0,!0);b(A=d,Q,Gh).call(A,{highlightOutlines:C.getOutlines(),highlightId:R,clipPathId:T}),b(x=d,Q,nr).call(x),d.rotate(d.parentRotation)}return d}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const s=this.getRect(0,0),i=kt._colorManager.convert(this.color),n={annotationType:J.HIGHLIGHT,color:i,opacity:r(this,Xi),thickness:r(this,xs),quadPoints:b(this,Q,Om).call(this),outlines:b(this,Q,Bm).call(this,s),pageIndex:this.pageIndex,rect:s,rotation:b(this,Q,yl).call(this),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!b(this,Q,$m).call(this,n)?null:(n.id=this.annotationElementId,n)}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};Mo=new WeakMap,Zc=new WeakMap,qi=new WeakMap,Zr=new WeakMap,Qc=new WeakMap,qe=new WeakMap,th=new WeakMap,eh=new WeakMap,Qr=new WeakMap,As=new WeakMap,rs=new WeakMap,me=new WeakMap,Lo=new WeakMap,Xi=new WeakMap,Ce=new WeakMap,Do=new WeakMap,xs=new WeakMap,sh=new WeakMap,Q=new WeakSet,Qu=function(){const e=new qu(r(this,qi),.001);p(this,As,e.getOutlines()),[this.x,this.y,this.width,this.height]=r(this,As).box;const s=new qu(r(this,qi),.0025,.001,this._uiManager.direction==="ltr");p(this,qe,s.getOutlines());const{lastPoint:i}=r(this,qe);p(this,Lo,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])},Gh=function({highlightOutlines:e,highlightId:s,clipPathId:i}){var u,f;if(p(this,As,e),p(this,qe,e.getNewOutline(r(this,xs)/2+1.5,.0025)),s>=0)p(this,rs,s),p(this,Zr,i),this.parent.drawLayer.finalizeDraw(s,{bbox:e.box,path:{d:e.toSVGPath()}}),p(this,Ce,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:r(this,qe).box,path:{d:r(this,qe).toSVGPath()}},!0));else if(this.parent){const g=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(r(this,rs),{bbox:b(u=ut,Cs,ka).call(u,r(this,As).box,(g-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(r(this,Ce),{bbox:b(f=ut,Cs,ka).call(f,r(this,qe).box,g),path:{d:r(this,qe).toSVGPath()}})}const[a,o,l,h]=e.box;switch(this.rotation){case 0:this.x=a,this.y=o,this.width=l,this.height=h;break;case 90:{const[g,y]=this.parentDimensions;this.x=o,this.y=1-a,this.width=l*y/g,this.height=h*g/y;break}case 180:this.x=1-a,this.y=1-o,this.width=l,this.height=h;break;case 270:{const[g,y]=this.parentDimensions;this.x=1-o,this.y=a,this.width=l*y/g,this.height=h*g/y;break}}const{lastPoint:d}=r(this,qe);p(this,Lo,[(d[0]-a)/l,(d[1]-o)/h])},Lm=function(e){const s=(a,o)=>{var l,h;this.color=a,p(this,Xi,o),(l=this.parent)==null||l.drawLayer.updateProperties(r(this,rs),{root:{fill:a,"fill-opacity":o}}),(h=r(this,Qc))==null||h.updateColor(a)},i=this.color,n=r(this,Xi);this.addCommands({cmd:s.bind(this,e,ut._defaultOpacity),undo:s.bind(this,i,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:rt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(e)},!0)},Dm=function(e){const s=r(this,xs),i=n=>{p(this,xs,n),b(this,Q,Nm).call(this,n)};this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:rt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},Nm=function(e){if(!r(this,me))return;b(this,Q,Gh).call(this,{highlightOutlines:r(this,As).getNewOutline(e/2)}),this.fixAndSetPosition();const[s,i]=this.parentDimensions;this.setDims(this.width*s,this.height*i)},tf=function(){r(this,rs)===null||!this.parent||(this.parent.drawLayer.remove(r(this,rs)),p(this,rs,null),this.parent.drawLayer.remove(r(this,Ce)),p(this,Ce,null))},nr=function(e=this.parent){r(this,rs)===null&&({id:Me(this,rs)._,clipPathId:Me(this,Zr)._}=e.drawLayer.draw({bbox:r(this,As).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":r(this,Xi)},rootClass:{highlight:!0,free:r(this,me)},path:{d:r(this,As).toSVGPath()}},!1,!0),p(this,Ce,e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:r(this,me)},bbox:r(this,qe).box,path:{d:r(this,qe).toSVGPath()}},r(this,me))),r(this,Qr)&&(r(this,Qr).style.clipPath=r(this,Zr)))},Cs=new WeakSet,ka=function([e,s,i,n],a){switch(a){case 90:return[1-s-n,e,n,i];case 180:return[1-e-i,1-s-n,i,n];case 270:return[s,1-e-i,n,i]}return[e,s,i,n]},Fm=function(e){ut._keyboardManager.exec(this,e)},Vh=function(e){if(!r(this,Mo))return;const s=window.getSelection();e?s.setPosition(r(this,Mo),r(this,Zc)):s.setPosition(r(this,th),r(this,eh))},yl=function(){return r(this,me)?this.rotation:0},Om=function(){if(r(this,me))return null;const[e,s]=this.pageDimensions,[i,n]=this.pageTranslation,a=r(this,qi),o=new Float32Array(a.length*8);let l=0;for(const{x:h,y:d,width:u,height:f}of a){const g=h*e+i,y=(1-d)*s+n;o[l]=o[l+4]=g,o[l+1]=o[l+3]=y,o[l+2]=o[l+6]=g+u*e,o[l+5]=o[l+7]=y-f*s,l+=8}return o},Bm=function(e){return r(this,As).serialize(e,b(this,Q,yl).call(this))},jm=function(e,s){this._freeHighlight.add(s)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},Hm=function(e,s){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(s,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},$m=function(e){const{color:s}=this._initialData;return e.color.some((i,n)=>i!==s[n])},m(ut,Cs),L(ut,"_defaultColor",null),L(ut,"_defaultOpacity",1),L(ut,"_defaultThickness",12),L(ut,"_type","highlight"),L(ut,"_editorType",J.HIGHLIGHT),L(ut,"_freeHighlightId",-1),L(ut,"_freeHighlight",null),L(ut,"_freeHighlightClipId","");let id=ut;var ta;class zm{constructor(){m(this,ta,Object.create(null))}updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(const[e,s]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,s)}updateSVGProperty(t,e){r(this,ta)[t]=e}toSVGProperties(){const t=r(this,ta);return p(this,ta,Object.create(null)),{root:t}}reset(){p(this,ta,Object.create(null))}updateAll(t=this){this.updateProperties(t)}clone(){xt("Not implemented")}}ta=new WeakMap;var as,No,oe,ea,sa,On,Bn,jn,ia,ct,ef,sf,nf,vl,Gm,Uh,wl,Ia;const V=class V extends kt{constructor(e){super(e);m(this,ct);m(this,as,null);m(this,No);L(this,"_drawId",null);p(this,No,e.mustBeCommitted||!1),this._addOutlines(e)}_addOutlines(e){e.drawOutlines&&(b(this,ct,ef).call(this,e),b(this,ct,vl).call(this))}static _mergeSVGProperties(e,s){const i=new Set(Object.keys(e));for(const[n,a]of Object.entries(s))i.has(n)?Object.assign(e[n],a):e[n]=a;return e}static getDefaultDrawingOptions(e){xt("Not implemented")}static get typesMap(){xt("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,s){const i=this.typesMap.get(e);i&&this._defaultDrawingOptions.updateProperty(i,s),this._currentParent&&(r(V,oe).updateProperty(i,s),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,s){const i=this.constructor.typesMap.get(e);i&&this._updateProperty(e,i,s)}static get defaultPropertiesToUpdate(){const e=[],s=this._defaultDrawingOptions;for(const[i,n]of this.typesMap)e.push([i,s[n]]);return e}get propertiesToUpdate(){const e=[],{_drawingOptions:s}=this;for(const[i,n]of this.constructor.typesMap)e.push([i,s[n]]);return e}_updateProperty(e,s,i){const n=this._drawingOptions,a=n[s],o=l=>{var d;n.updateProperty(s,l);const h=r(this,as).updateProperty(s,l);h&&b(this,ct,wl).call(this,h),(d=this.parent)==null||d.drawLayer.updateProperties(this._drawId,n.toSVGProperties())};this.addCommands({cmd:o.bind(this,i),undo:o.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,V._mergeSVGProperties(r(this,as).getPathResizingSVGProperties(b(this,ct,Uh).call(this)),{bbox:b(this,ct,Ia).call(this)}))}_onResized(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,V._mergeSVGProperties(r(this,as).getPathResizedSVGProperties(b(this,ct,Uh).call(this)),{bbox:b(this,ct,Ia).call(this)}))}_onTranslating(e,s){var i;(i=this.parent)==null||i.drawLayer.updateProperties(this._drawId,{bbox:b(this,ct,Ia).call(this)})}_onTranslated(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,V._mergeSVGProperties(r(this,as).getPathTranslatedSVGProperties(b(this,ct,Uh).call(this),this.parentDimensions),{bbox:b(this,ct,Ia).call(this)}))}_onStartDragging(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,r(this,No)&&(p(this,No,!1),this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){b(this,ct,nf).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,ct,vl).call(this),b(this,ct,wl).call(this,r(this,as).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var i;let s=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),b(this,ct,nf).call(this)):e&&(this._uiManager.addShouldRescale(this),b(this,ct,vl).call(this,e),s=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(e),s&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,V._mergeSVGProperties({bbox:b(this,ct,Ia).call(this)},r(this,as).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&b(this,ct,wl).call(this,r(this,as).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,s;this._isCopy&&(e=this.x,s=this.y);const i=super.render();i.classList.add("draw");const n=document.createElement("div");i.append(n),n.setAttribute("aria-hidden","true"),n.className="internal";const[a,o]=this.parentDimensions;return this.setDims(this.width*a,this.height*o),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,s),i}static createDrawerInstance(e,s,i,n,a){xt("Not implemented")}static startDrawing(e,s,i,n){var w;const{target:a,offsetX:o,offsetY:l,pointerId:h,pointerType:d}=n;if(r(V,Bn)&&r(V,Bn)!==d)return;const{viewport:{rotation:u}}=e,{width:f,height:g}=a.getBoundingClientRect(),y=p(V,ea,new AbortController),v=e.combinedSignal(y);if(r(V,On)||p(V,On,h),r(V,Bn)??p(V,Bn,d),window.addEventListener("pointerup",A=>{var x;r(V,On)===A.pointerId?this._endDraw(A):(x=r(V,jn))==null||x.delete(A.pointerId)},{signal:v}),window.addEventListener("pointercancel",A=>{var x;r(V,On)===A.pointerId?this._currentParent.endDrawingSession():(x=r(V,jn))==null||x.delete(A.pointerId)},{signal:v}),window.addEventListener("pointerdown",A=>{r(V,Bn)===A.pointerType&&((r(V,jn)||p(V,jn,new Set)).add(A.pointerId),r(V,oe).isCancellable()&&(r(V,oe).removeLastElement(),r(V,oe).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:v}),window.addEventListener("contextmenu",Rs,{signal:v}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:v}),a.addEventListener("touchmove",A=>{A.timeStamp===r(V,ia)&&qt(A)},{signal:v}),e.toggleDrawing(),(w=s._editorUndoBar)==null||w.hide(),r(V,oe)){e.drawLayer.updateProperties(this._currentDrawId,r(V,oe).startNew(o,l,f,g,u));return}s.updateUIForDefaultProperties(this),p(V,oe,this.createDrawerInstance(o,l,f,g,u)),p(V,sa,this.getDefaultDrawingOptions()),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(r(V,sa).toSVGProperties(),r(V,oe).defaultSVGProperties),!0,!1)}static _drawMove(e){var a;if(p(V,ia,-1),!r(V,oe))return;const{offsetX:s,offsetY:i,pointerId:n}=e;if(r(V,On)===n){if(((a=r(V,jn))==null?void 0:a.size)>=1){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,r(V,oe).add(s,i)),p(V,ia,e.timeStamp),qt(e)}}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,p(V,oe,null),p(V,sa,null),p(V,Bn,null),p(V,ia,NaN)),r(V,ea)&&(r(V,ea).abort(),p(V,ea,null),p(V,On,NaN),p(V,jn,null))}static _endDraw(e){const s=this._currentParent;if(s){if(s.toggleDrawing(!0),this._cleanup(!1),(e==null?void 0:e.target)===s.div&&s.drawLayer.updateProperties(this._currentDrawId,r(V,oe).end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){const i=r(V,oe),n=this._currentDrawId,a=i.getLastElement();s.addCommands({cmd:()=>{s.drawLayer.updateProperties(n,i.setLastElement(a))},undo:()=>{s.drawLayer.updateProperties(n,i.removeLastElement())},mustExec:!1,type:rt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){const s=this._currentParent;if(!s)return null;if(s.toggleDrawing(!0),s.cleanUndoStack(rt.DRAW_STEP),!r(V,oe).isEmpty()){const{pageDimensions:[i,n],scale:a}=s,o=s.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:r(V,oe).getOutlines(i*a,n*a,a,this._INNER_MARGIN),drawingOptions:r(V,sa),mustBeCommitted:!e});return this._cleanup(!0),o}return s.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,s,i,n,a,o){xt("Not implemented")}static async deserialize(e,s,i){var u,f;const{rawDims:{pageWidth:n,pageHeight:a,pageX:o,pageY:l}}=s.viewport,h=this.deserializeDraw(o,l,n,a,this._INNER_MARGIN,e),d=await super.deserialize(e,s,i);return d.createDrawingOptions(e),b(u=d,ct,ef).call(u,{drawOutlines:h}),b(f=d,ct,vl).call(f),d.onScaleChanging(),d.rotate(),d}serializeDraw(e){const[s,i]=this.pageTranslation,[n,a]=this.pageDimensions;return r(this,as).serialize([s,i,n,a],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};as=new WeakMap,No=new WeakMap,oe=new WeakMap,ea=new WeakMap,sa=new WeakMap,On=new WeakMap,Bn=new WeakMap,jn=new WeakMap,ia=new WeakMap,ct=new WeakSet,ef=function({drawOutlines:e,drawId:s,drawingOptions:i}){p(this,as,e),this._drawingOptions||(this._drawingOptions=i),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),s>=0?(this._drawId=s,this.parent.drawLayer.finalizeDraw(s,e.defaultProperties)):this._drawId=b(this,ct,sf).call(this,e,this.parent),b(this,ct,wl).call(this,e.box)},sf=function(e,s){const{id:i}=s.drawLayer.draw(V._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return i},nf=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},vl=function(e=this.parent){if(!(this._drawId!==null&&this.parent===e)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=b(this,ct,sf).call(this,r(this,as),e)}},Gm=function([e,s,i,n]){const{parentDimensions:[a,o],rotation:l}=this;switch(l){case 90:return[s,1-e,i*(o/a),n*(a/o)];case 180:return[1-e,1-s,i,n];case 270:return[1-s,e,i*(o/a),n*(a/o)];default:return[e,s,i,n]}},Uh=function(){const{x:e,y:s,width:i,height:n,parentDimensions:[a,o],rotation:l}=this;switch(l){case 90:return[1-s,e,i*(a/o),n*(o/a)];case 180:return[1-e,1-s,i,n];case 270:return[s,1-e,i*(a/o),n*(o/a)];default:return[e,s,i,n]}},wl=function(e){if([this.x,this.y,this.width,this.height]=b(this,ct,Gm).call(this,e),this.div){this.fixAndSetPosition();const[s,i]=this.parentDimensions;this.setDims(this.width*s,this.height*i)}this._onResized()},Ia=function(){const{x:e,y:s,width:i,height:n,rotation:a,parentRotation:o,parentDimensions:[l,h]}=this;switch((a*4+o)/90){case 1:return[1-s-n,e,n,i];case 2:return[1-e-i,1-s-n,i,n];case 3:return[s,1-e-i,n,i];case 4:return[e,s-i*(l/h),n*(h/l),i*(l/h)];case 5:return[1-s,e,i*(l/h),n*(h/l)];case 6:return[1-e-n*(h/l),1-s,n*(h/l),i*(l/h)];case 7:return[s-i*(l/h),1-e-n*(h/l),i*(l/h),n*(h/l)];case 8:return[e-i,s-n,i,n];case 9:return[1-s,e-i,n,i];case 10:return[1-e,1-s,i,n];case 11:return[s-n,1-e,n,i];case 12:return[e-n*(h/l),s,n*(h/l),i*(l/h)];case 13:return[1-s-i*(l/h),e-n*(h/l),i*(l/h),n*(h/l)];case 14:return[1-e,1-s-i*(l/h),n*(h/l),i*(l/h)];case 15:return[s,1-e,i*(l/h),n*(h/l)];default:return[e,s,i,n]}},L(V,"_currentDrawId",-1),L(V,"_currentParent",null),m(V,oe,null),m(V,ea,null),m(V,sa,null),m(V,On,NaN),m(V,Bn,null),m(V,jn,null),m(V,ia,NaN),L(V,"_INNER_MARGIN",3);let nd=V;var ci,le,ce,na,Fo,Ne,be,Es,ra,aa,oa,Oo,Wh;class uv{constructor(t,e,s,i,n,a){m(this,Oo);m(this,ci,new Float64Array(6));m(this,le);m(this,ce);m(this,na);m(this,Fo);m(this,Ne);m(this,be,"");m(this,Es,0);m(this,ra,new uh);m(this,aa);m(this,oa);p(this,aa,s),p(this,oa,i),p(this,na,n),p(this,Fo,a),[t,e]=b(this,Oo,Wh).call(this,t,e);const o=p(this,le,[NaN,NaN,NaN,NaN,t,e]);p(this,Ne,[t,e]),p(this,ce,[{line:o,points:r(this,Ne)}]),r(this,ci).set(o,0)}updateProperty(t,e){t==="stroke-width"&&p(this,Fo,e)}isEmpty(){return!r(this,ce)||r(this,ce).length===0}isCancellable(){return r(this,Ne).length<=10}add(t,e){[t,e]=b(this,Oo,Wh).call(this,t,e);const[s,i,n,a]=r(this,ci).subarray(2,6),o=t-n,l=e-a;return Math.hypot(r(this,aa)*o,r(this,oa)*l)<=2?null:(r(this,Ne).push(t,e),isNaN(s)?(r(this,ci).set([n,a,t,e],2),r(this,le).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN(r(this,ci)[0])&&r(this,le).splice(6,6),r(this,ci).set([s,i,n,a,t,e],0),r(this,le).push(...G.createBezierPoints(s,i,n,a,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){const s=this.add(t,e);return s||(r(this,Ne).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,s,i,n){p(this,aa,s),p(this,oa,i),p(this,na,n),[t,e]=b(this,Oo,Wh).call(this,t,e);const a=p(this,le,[NaN,NaN,NaN,NaN,t,e]);p(this,Ne,[t,e]);const o=r(this,ce).at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),r(this,ce).push({line:a,points:r(this,Ne)}),r(this,ci).set(a,0),p(this,Es,0),this.toSVGPath(),null}getLastElement(){return r(this,ce).at(-1)}setLastElement(t){return r(this,ce)?(r(this,ce).push(t),p(this,le,t.line),p(this,Ne,t.points),p(this,Es,0),{path:{d:this.toSVGPath()}}):r(this,ra).setLastElement(t)}removeLastElement(){if(!r(this,ce))return r(this,ra).removeLastElement();r(this,ce).pop(),p(this,be,"");for(let t=0,e=r(this,ce).length;t<e;t++){const{line:s,points:i}=r(this,ce)[t];p(this,le,s),p(this,Ne,i),p(this,Es,0),this.toSVGPath()}return{path:{d:r(this,be)}}}toSVGPath(){const t=G.svgRound(r(this,le)[4]),e=G.svgRound(r(this,le)[5]);if(r(this,Ne).length===2)return p(this,be,`${r(this,be)} M ${t} ${e} Z`),r(this,be);if(r(this,Ne).length<=6){const i=r(this,be).lastIndexOf("M");p(this,be,`${r(this,be).slice(0,i)} M ${t} ${e}`),p(this,Es,6)}if(r(this,Ne).length===4){const i=G.svgRound(r(this,le)[10]),n=G.svgRound(r(this,le)[11]);return p(this,be,`${r(this,be)} L ${i} ${n}`),p(this,Es,12),r(this,be)}const s=[];r(this,Es)===0&&(s.push(`M ${t} ${e}`),p(this,Es,6));for(let i=r(this,Es),n=r(this,le).length;i<n;i+=6){const[a,o,l,h,d,u]=r(this,le).slice(i,i+6).map(G.svgRound);s.push(`C${a} ${o} ${l} ${h} ${d} ${u}`)}return p(this,be,r(this,be)+s.join(" ")),p(this,Es,r(this,le).length),r(this,be)}getOutlines(t,e,s,i){const n=r(this,ce).at(-1);return n.line=new Float32Array(n.line),n.points=new Float32Array(n.points),r(this,ra).build(r(this,ce),t,e,s,r(this,na),r(this,Fo),i),p(this,ci,null),p(this,le,null),p(this,ce,null),p(this,be,null),r(this,ra)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}ci=new WeakMap,le=new WeakMap,ce=new WeakMap,na=new WeakMap,Fo=new WeakMap,Ne=new WeakMap,be=new WeakMap,Es=new WeakMap,ra=new WeakMap,aa=new WeakMap,oa=new WeakMap,Oo=new WeakSet,Wh=function(t,e){return G._normalizePoint(t,e,r(this,aa),r(this,oa),r(this,na))};var Fe,ih,nh,os,hi,di,Bo,jo,la,ve,Ai,Vm,Um,Wm;class uh extends G{constructor(){super(...arguments);m(this,ve);m(this,Fe);m(this,ih,0);m(this,nh);m(this,os);m(this,hi);m(this,di);m(this,Bo);m(this,jo);m(this,la)}build(e,s,i,n,a,o,l){p(this,hi,s),p(this,di,i),p(this,Bo,n),p(this,jo,a),p(this,la,o),p(this,nh,l??0),p(this,os,e),b(this,ve,Um).call(this)}get thickness(){return r(this,la)}setLastElement(e){return r(this,os).push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return r(this,os).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const e=[];for(const{line:s}of r(this,os)){if(e.push(`M${G.svgRound(s[4])} ${G.svgRound(s[5])}`),s.length===6){e.push("Z");continue}if(s.length===12&&isNaN(s[6])){e.push(`L${G.svgRound(s[10])} ${G.svgRound(s[11])}`);continue}for(let i=6,n=s.length;i<n;i+=6){const[a,o,l,h,d,u]=s.subarray(i,i+6).map(G.svgRound);e.push(`C${a} ${o} ${l} ${h} ${d} ${u}`)}}return e.join("")}serialize([e,s,i,n],a){const o=[],l=[],[h,d,u,f]=b(this,ve,Vm).call(this);let g,y,v,w,A,x,_,S,C;switch(r(this,jo)){case 0:C=G._rescale,g=e,y=s+n,v=i,w=-n,A=e+h*i,x=s+(1-d-f)*n,_=e+(h+u)*i,S=s+(1-d)*n;break;case 90:C=G._rescaleAndSwap,g=e,y=s,v=i,w=n,A=e+d*i,x=s+h*n,_=e+(d+f)*i,S=s+(h+u)*n;break;case 180:C=G._rescale,g=e+i,y=s,v=-i,w=n,A=e+(1-h-u)*i,x=s+d*n,_=e+(1-h)*i,S=s+(d+f)*n;break;case 270:C=G._rescaleAndSwap,g=e+i,y=s+n,v=-i,w=-n,A=e+(1-d-f)*i,x=s+(1-h-u)*n,_=e+(1-d)*i,S=s+(1-h)*n;break}for(const{line:R,points:T}of r(this,os))o.push(C(R,g,y,v,w,a?new Array(R.length):null)),l.push(C(T,g,y,v,w,a?new Array(T.length):null));return{lines:o,points:l,rect:[A,x,_,S]}}static deserialize(e,s,i,n,a,{paths:{lines:o,points:l},rotation:h,thickness:d}){const u=[];let f,g,y,v,w;switch(h){case 0:w=G._rescale,f=-e/i,g=s/n+1,y=1/i,v=-1/n;break;case 90:w=G._rescaleAndSwap,f=-s/n,g=-e/i,y=1/n,v=1/i;break;case 180:w=G._rescale,f=e/i+1,g=-s/n,y=-1/i,v=1/n;break;case 270:w=G._rescaleAndSwap,f=s/n+1,g=e/i+1,y=-1/n,v=-1/i;break}if(!o){o=[];for(const x of l){const _=x.length;if(_===2){o.push(new Float32Array([NaN,NaN,NaN,NaN,x[0],x[1]]));continue}if(_===4){o.push(new Float32Array([NaN,NaN,NaN,NaN,x[0],x[1],NaN,NaN,NaN,NaN,x[2],x[3]]));continue}const S=new Float32Array(3*(_-2));o.push(S);let[C,R,T,k]=x.subarray(0,4);S.set([NaN,NaN,NaN,NaN,C,R],0);for(let I=4;I<_;I+=2){const D=x[I],N=x[I+1];S.set(G.createBezierPoints(C,R,T,k,D,N),(I-2)*3),[C,R,T,k]=[T,k,D,N]}}}for(let x=0,_=o.length;x<_;x++)u.push({line:w(o[x].map(S=>S??NaN),f,g,y,v),points:w(l[x].map(S=>S??NaN),f,g,y,v)});const A=new this.prototype.constructor;return A.build(u,i,n,1,h,d,a),A}get box(){return r(this,Fe)}updateProperty(e,s){return e==="stroke-width"?b(this,ve,Wm).call(this,s):null}updateParentDimensions([e,s],i){const[n,a]=b(this,ve,Ai).call(this);p(this,hi,e),p(this,di,s),p(this,Bo,i);const[o,l]=b(this,ve,Ai).call(this),h=o-n,d=l-a,u=r(this,Fe);return u[0]-=h,u[1]-=d,u[2]+=2*h,u[3]+=2*d,u}updateRotation(e){return p(this,ih,e),{path:{transform:this.rotationTransform}}}get viewBox(){return r(this,Fe).map(G.svgRound).join(" ")}get defaultProperties(){const[e,s]=r(this,Fe);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${G.svgRound(e)} ${G.svgRound(s)}`}}}get rotationTransform(){const[,,e,s]=r(this,Fe);let i=0,n=0,a=0,o=0,l=0,h=0;switch(r(this,ih)){case 90:n=s/e,a=-e/s,l=e;break;case 180:i=-1,o=-1,l=e,h=s;break;case 270:n=-s/e,a=e/s,h=s;break;default:return""}return`matrix(${i} ${n} ${a} ${o} ${G.svgRound(l)} ${G.svgRound(h)})`}getPathResizingSVGProperties([e,s,i,n]){const[a,o]=b(this,ve,Ai).call(this),[l,h,d,u]=r(this,Fe);if(Math.abs(d-a)<=G.PRECISION||Math.abs(u-o)<=G.PRECISION){const w=e+i/2-(l+d/2),A=s+n/2-(h+u/2);return{path:{"transform-origin":`${G.svgRound(e)} ${G.svgRound(s)}`,transform:`${this.rotationTransform} translate(${w} ${A})`}}}const f=(i-2*a)/(d-2*a),g=(n-2*o)/(u-2*o),y=d/i,v=u/n;return{path:{"transform-origin":`${G.svgRound(l)} ${G.svgRound(h)}`,transform:`${this.rotationTransform} scale(${y} ${v}) translate(${G.svgRound(a)} ${G.svgRound(o)}) scale(${f} ${g}) translate(${G.svgRound(-a)} ${G.svgRound(-o)})`}}}getPathResizedSVGProperties([e,s,i,n]){const[a,o]=b(this,ve,Ai).call(this),l=r(this,Fe),[h,d,u,f]=l;if(l[0]=e,l[1]=s,l[2]=i,l[3]=n,Math.abs(u-a)<=G.PRECISION||Math.abs(f-o)<=G.PRECISION){const A=e+i/2-(h+u/2),x=s+n/2-(d+f/2);for(const{line:_,points:S}of r(this,os))G._translate(_,A,x,_),G._translate(S,A,x,S);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${G.svgRound(e)} ${G.svgRound(s)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const g=(i-2*a)/(u-2*a),y=(n-2*o)/(f-2*o),v=-g*(h+a)+e+a,w=-y*(d+o)+s+o;if(g!==1||y!==1||v!==0||w!==0)for(const{line:A,points:x}of r(this,os))G._rescale(A,v,w,g,y,A),G._rescale(x,v,w,g,y,x);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${G.svgRound(e)} ${G.svgRound(s)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,s],i){const[n,a]=i,o=r(this,Fe),l=e-o[0],h=s-o[1];if(r(this,hi)===n&&r(this,di)===a)for(const{line:d,points:u}of r(this,os))G._translate(d,l,h,d),G._translate(u,l,h,u);else{const d=r(this,hi)/n,u=r(this,di)/a;p(this,hi,n),p(this,di,a);for(const{line:f,points:g}of r(this,os))G._rescale(f,l,h,d,u,f),G._rescale(g,l,h,d,u,g);o[2]*=d,o[3]*=u}return o[0]=e,o[1]=s,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${G.svgRound(e)} ${G.svgRound(s)}`}}}get defaultSVGProperties(){const e=r(this,Fe);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${G.svgRound(e[0])} ${G.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}}Fe=new WeakMap,ih=new WeakMap,nh=new WeakMap,os=new WeakMap,hi=new WeakMap,di=new WeakMap,Bo=new WeakMap,jo=new WeakMap,la=new WeakMap,ve=new WeakSet,Ai=function(e=r(this,la)){const s=r(this,nh)+e/2*r(this,Bo);return r(this,jo)%180===0?[s/r(this,hi),s/r(this,di)]:[s/r(this,di),s/r(this,hi)]},Vm=function(){const[e,s,i,n]=r(this,Fe),[a,o]=b(this,ve,Ai).call(this,0);return[e+a,s+o,i-2*a,n-2*o]},Um=function(){const e=p(this,Fe,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:n}of r(this,os)){if(n.length<=12){for(let l=4,h=n.length;l<h;l+=6)W.pointBoundingBox(n[l],n[l+1],e);continue}let a=n[4],o=n[5];for(let l=6,h=n.length;l<h;l+=6){const[d,u,f,g,y,v]=n.subarray(l,l+6);W.bezierBoundingBox(a,o,d,u,f,g,y,v,e),a=y,o=v}}const[s,i]=b(this,ve,Ai).call(this);e[0]=Te(e[0]-s,0,1),e[1]=Te(e[1]-i,0,1),e[2]=Te(e[2]+s,0,1),e[3]=Te(e[3]+i,0,1),e[2]-=e[0],e[3]-=e[1]},Wm=function(e){const[s,i]=b(this,ve,Ai).call(this);p(this,la,e);const[n,a]=b(this,ve,Ai).call(this),[o,l]=[n-s,a-i],h=r(this,Fe);return h[0]-=o,h[1]-=l,h[2]+=2*o,h[3]+=2*l,h};class Md extends zm{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:kt._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){t==="stroke-width"&&(e??(e=this["stroke-width"]),e*=this._viewParameters.realScale),super.updateSVGProperty(t,e)}clone(){const t=new Md(this._viewParameters);return t.updateAll(this),t}}var _d,qm;const Da=class Da extends nd{constructor(e){super({...e,name:"inkEditor"});m(this,_d);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,s){kt.initialize(e,s),this._defaultDrawingOptions=new Md(s.viewParameters)}static getDefaultDrawingOptions(e){const s=this._defaultDrawingOptions.clone();return s.updateProperties(e),s}static get supportMultipleDrawings(){return!0}static get typesMap(){return it(this,"typesMap",new Map([[rt.INK_THICKNESS,"stroke-width"],[rt.INK_COLOR,"stroke"],[rt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,s,i,n,a){return new uv(e,s,i,n,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,s,i,n,a,o){return uh.deserialize(e,s,i,n,a,o)}static async deserialize(e,s,i){let n=null;if(e instanceof Lf){const{data:{inkLists:o,rect:l,rotation:h,id:d,color:u,opacity:f,borderStyle:{rawWidth:g},popupRef:y},parent:{page:{pageNumber:v}}}=e;n=e={annotationType:J.INK,color:Array.from(u),thickness:g,opacity:f,paths:{points:o},boxes:null,pageIndex:v-1,rect:l.slice(0),rotation:h,annotationElementId:d,id:d,deleted:!1,popupRef:y}}const a=await super.deserialize(e,s,i);return a._initialData=n,a}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:e,_drawingOptions:s,parent:i}=this;s.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(e,s.toSVGProperties())}static onScaleChangingWhenDrawing(){const e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:s,opacity:i}){this._drawingOptions=Da.getDefaultDrawingOptions({stroke:W.makeHexColor(...e),"stroke-width":s,"stroke-opacity":i})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:s,points:i,rect:n}=this.serializeDraw(e),{_drawingOptions:{stroke:a,"stroke-opacity":o,"stroke-width":l}}=this,h={annotationType:J.INK,color:kt._colorManager.convert(a),opacity:o,thickness:l,paths:{lines:s,points:i},pageIndex:this.pageIndex,rect:n,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?(h.isCopy=!0,h):this.annotationElementId&&!b(this,_d,qm).call(this,h)?null:(h.id=this.annotationElementId,h)}renderAnnotationElement(e){const{points:s,rect:i}=this.serializeDraw(!1);return e.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:s}),null}};_d=new WeakSet,qm=function(e){const{color:s,thickness:i,opacity:n,pageIndex:a}=this._initialData;return this._hasBeenMoved||this._hasBeenResized||e.color.some((o,l)=>o!==s[l])||e.thickness!==i||e.opacity!==n||e.pageIndex!==a},L(Da,"_type","ink"),L(Da,"_editorType",J.INK),L(Da,"_defaultDrawingOptions",null);let rf=Da;class af extends uh{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}}const xh=8,il=3;var ca,gt,of,Gs,Xm,Ym,lf,qh,Km,Jm,Zm,cf,hf,Qm;class mi{static extractContoursFromText(t,{fontFamily:e,fontStyle:s,fontWeight:i},n,a,o,l){let h=new OffscreenCanvas(1,1),d=h.getContext("2d",{alpha:!1});const u=200,f=d.font=`${s} ${i} ${u}px ${e}`,{actualBoundingBoxLeft:g,actualBoundingBoxRight:y,actualBoundingBoxAscent:v,actualBoundingBoxDescent:w,fontBoundingBoxAscent:A,fontBoundingBoxDescent:x,width:_}=d.measureText(t),S=1.5,C=Math.ceil(Math.max(Math.abs(g)+Math.abs(y)||0,_)*S),R=Math.ceil(Math.max(Math.abs(v)+Math.abs(w)||u,Math.abs(A)+Math.abs(x)||u)*S);h=new OffscreenCanvas(C,R),d=h.getContext("2d",{alpha:!0,willReadFrequently:!0}),d.font=f,d.filter="grayscale(1)",d.fillStyle="white",d.fillRect(0,0,C,R),d.fillStyle="black",d.fillText(t,C*(S-1)/2,R*(3-S)/2);const T=b(this,gt,cf).call(this,d.getImageData(0,0,C,R).data),k=b(this,gt,Zm).call(this,T),I=b(this,gt,hf).call(this,k),D=b(this,gt,lf).call(this,T,C,R,I);return this.processDrawnLines({lines:{curves:D,width:C,height:R},pageWidth:n,pageHeight:a,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(t,e,s,i,n){const[a,o,l]=b(this,gt,Qm).call(this,t),[h,d]=b(this,gt,Jm).call(this,a,o,l,Math.hypot(o,l)*r(this,ca).sigmaSFactor,r(this,ca).sigmaR,r(this,ca).kernelSize),u=b(this,gt,hf).call(this,d),f=b(this,gt,lf).call(this,h,o,l,u);return this.processDrawnLines({lines:{curves:f,width:o,height:l},pageWidth:e,pageHeight:s,rotation:i,innerMargin:n,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:s,rotation:i,innerMargin:n,mustSmooth:a,areContours:o}){i%180!==0&&([e,s]=[s,e]);const{curves:l,width:h,height:d}=t,u=t.thickness??0,f=[],g=Math.min(e/h,s/d),y=g/e,v=g/s,w=[];for(const{points:x}of l){const _=a?b(this,gt,Km).call(this,x):x;if(!_)continue;w.push(_);const S=_.length,C=new Float32Array(S),R=new Float32Array(3*(S===2?2:S-2));if(f.push({line:R,points:C}),S===2){C[0]=_[0]*y,C[1]=_[1]*v,R.set([NaN,NaN,NaN,NaN,C[0],C[1]],0);continue}let[T,k,I,D]=_;T*=y,k*=v,I*=y,D*=v,C.set([T,k,I,D],0),R.set([NaN,NaN,NaN,NaN,T,k],0);for(let N=4;N<S;N+=2){const Y=C[N]=_[N]*y,q=C[N+1]=_[N+1]*v;R.set(G.createBezierPoints(T,k,I,D,Y,q),(N-2)*3),[T,k,I,D]=[I,D,Y,q]}}if(f.length===0)return null;const A=o?new af:new uh;return A.build(f,e,s,1,i,o?0:u,n),{outline:A,newCurves:w,areContours:o,thickness:u,width:h,height:d}}static async compressSignature({outlines:t,areContours:e,thickness:s,width:i,height:n}){let a=1/0,o=-1/0,l=0;for(const _ of t){l+=_.length;for(let S=2,C=_.length;S<C;S++){const R=_[S]-_[S-2];a=Math.min(a,R),o=Math.max(o,R)}}let h;a>=-128&&o<=127?h=Int8Array:a>=-32768&&o<=32767?h=Int16Array:h=Int32Array;const d=t.length,u=xh+il*d,f=new Uint32Array(u);let g=0;f[g++]=u*Uint32Array.BYTES_PER_ELEMENT+(l-2*d)*h.BYTES_PER_ELEMENT,f[g++]=0,f[g++]=i,f[g++]=n,f[g++]=e?0:1,f[g++]=Math.max(0,Math.floor(s??0)),f[g++]=d,f[g++]=h.BYTES_PER_ELEMENT;for(const _ of t)f[g++]=_.length-2,f[g++]=_[0],f[g++]=_[1];const y=new CompressionStream("deflate-raw"),v=y.writable.getWriter();await v.ready,v.write(f);const w=h.prototype.constructor;for(const _ of t){const S=new w(_.length-2);for(let C=2,R=_.length;C<R;C++)S[C-2]=_[C]-_[C-2];v.write(S)}v.close();const A=await new Response(y.readable).arrayBuffer(),x=new Uint8Array(A);return Jp(x)}static async decompressSignature(t){try{const e=z0(t),{readable:s,writable:i}=new DecompressionStream("deflate-raw"),n=i.getWriter();await n.ready,n.write(e).then(async()=>{await n.ready,await n.close()}).catch(()=>{});let a=null,o=0;for await(const _ of s)a||(a=new Uint8Array(new Uint32Array(_.buffer,0,4)[0])),a.set(_,o),o+=_.length;const l=new Uint32Array(a.buffer,0,a.length>>2),h=l[1];if(h!==0)throw new Error(`Invalid version: ${h}`);const d=l[2],u=l[3],f=l[4]===0,g=l[5],y=l[6],v=l[7],w=[],A=(xh+il*y)*Uint32Array.BYTES_PER_ELEMENT;let x;switch(v){case Int8Array.BYTES_PER_ELEMENT:x=new Int8Array(a.buffer,A);break;case Int16Array.BYTES_PER_ELEMENT:x=new Int16Array(a.buffer,A);break;case Int32Array.BYTES_PER_ELEMENT:x=new Int32Array(a.buffer,A);break}o=0;for(let _=0;_<y;_++){const S=l[il*_+xh],C=new Float32Array(S+2);w.push(C);for(let R=0;R<il-1;R++)C[R]=l[il*_+xh+R+1];for(let R=0;R<S;R++)C[R+2]=C[R]+x[o++]}return{areContours:f,thickness:g,outlines:w,width:d,height:u}}catch(e){return Z(`decompressSignature: ${e}`),null}}}ca=new WeakMap,gt=new WeakSet,of=function(t,e,s,i){return s-=t,i-=e,s===0?i>0?0:4:s===1?i+6:2-i},Gs=new WeakMap,Xm=function(t,e,s,i,n,a,o){const l=b(this,gt,of).call(this,s,i,n,a);for(let h=0;h<8;h++){const d=(-h+l-o+16)%8,u=r(this,Gs)[2*d],f=r(this,Gs)[2*d+1];if(t[(s+u)*e+(i+f)]!==0)return d}return-1},Ym=function(t,e,s,i,n,a,o){const l=b(this,gt,of).call(this,s,i,n,a);for(let h=0;h<8;h++){const d=(h+l+o+16)%8,u=r(this,Gs)[2*d],f=r(this,Gs)[2*d+1];if(t[(s+u)*e+(i+f)]!==0)return d}return-1},lf=function(t,e,s,i){const n=t.length,a=new Int32Array(n);for(let d=0;d<n;d++)a[d]=t[d]<=i?1:0;for(let d=1;d<s-1;d++)a[d*e]=a[d*e+e-1]=0;for(let d=0;d<e;d++)a[d]=a[e*s-1-d]=0;let o=1,l;const h=[];for(let d=1;d<s-1;d++){l=1;for(let u=1;u<e-1;u++){const f=d*e+u,g=a[f];if(g===0)continue;let y=d,v=u;if(g===1&&a[f-1]===0)o+=1,v-=1;else if(g>=1&&a[f+1]===0)o+=1,v+=1,g>1&&(l=g);else{g!==1&&(l=Math.abs(g));continue}const w=[u,d],A=v===u+1,x={isHole:A,points:w,id:o,parent:0};h.push(x);let _;for(const N of h)if(N.id===l){_=N;break}_?_.isHole?x.parent=A?_.parent:l:x.parent=A?l:_.parent:x.parent=A?l:0;const S=b(this,gt,Xm).call(this,a,e,d,u,y,v,0);if(S===-1){a[f]=-o,a[f]!==1&&(l=Math.abs(a[f]));continue}let C=r(this,Gs)[2*S],R=r(this,Gs)[2*S+1];const T=d+C,k=u+R;y=T,v=k;let I=d,D=u;for(;;){const N=b(this,gt,Ym).call(this,a,e,I,D,y,v,1);C=r(this,Gs)[2*N],R=r(this,Gs)[2*N+1];const Y=I+C,q=D+R;w.push(q,Y);const H=I*e+D;if(a[H+1]===0?a[H]=-o:a[H]===1&&(a[H]=o),Y===d&&q===u&&I===T&&D===k){a[f]!==1&&(l=Math.abs(a[f]));break}else y=I,v=D,I=Y,D=q}}}return h},qh=function(t,e,s,i){if(s-e<=4){for(let T=e;T<s-2;T+=2)i.push(t[T],t[T+1]);return}const n=t[e],a=t[e+1],o=t[s-4]-n,l=t[s-3]-a,h=Math.hypot(o,l),d=o/h,u=l/h,f=d*a-u*n,g=l/o,y=1/h,v=Math.atan(g),w=Math.cos(v),A=Math.sin(v),x=y*(Math.abs(w)+Math.abs(A)),_=y*(1-x+x**2),S=Math.max(Math.atan(Math.abs(A+w)*_),Math.atan(Math.abs(A-w)*_));let C=0,R=e;for(let T=e+2;T<s-2;T+=2){const k=Math.abs(f-d*t[T+1]+u*t[T]);k>C&&(R=T,C=k)}C>(h*S)**2?(b(this,gt,qh).call(this,t,e,R+2,i),b(this,gt,qh).call(this,t,R,s,i)):i.push(n,a)},Km=function(t){const e=[],s=t.length;return b(this,gt,qh).call(this,t,0,s,e),e.push(t[s-2],t[s-1]),e.length<=4?null:e},Jm=function(t,e,s,i,n,a){const o=new Float32Array(a**2),l=-2*i**2,h=a>>1;for(let v=0;v<a;v++){const w=(v-h)**2;for(let A=0;A<a;A++)o[v*a+A]=Math.exp((w+(A-h)**2)/l)}const d=new Float32Array(256),u=-2*n**2;for(let v=0;v<256;v++)d[v]=Math.exp(v**2/u);const f=t.length,g=new Uint8Array(f),y=new Uint32Array(256);for(let v=0;v<s;v++)for(let w=0;w<e;w++){const A=v*e+w,x=t[A];let _=0,S=0;for(let R=0;R<a;R++){const T=v+R-h;if(!(T<0||T>=s))for(let k=0;k<a;k++){const I=w+k-h;if(I<0||I>=e)continue;const D=t[T*e+I],N=o[R*a+k]*d[Math.abs(D-x)];_+=D*N,S+=N}}const C=g[A]=Math.round(_/S);y[C]++}return[g,y]},Zm=function(t){const e=new Uint32Array(256);for(const s of t)e[s]++;return e},cf=function(t){const e=t.length,s=new Uint8ClampedArray(e>>2);let i=-1/0,n=1/0;for(let o=0,l=s.length;o<l;o++){if(t[(o<<2)+3]===0){i=s[o]=255;continue}const d=s[o]=t[o<<2];d>i&&(i=d),d<n&&(n=d)}const a=255/(i-n);for(let o=0;o<e;o++)s[o]=(s[o]-n)*a;return s},hf=function(t){let e,s=-1/0,i=-1/0;const n=t.findIndex(l=>l!==0);let a=n,o=n;for(e=n;e<256;e++){const l=t[e];l>s&&(e-a>i&&(i=e-a,o=e-1),s=l,a=e)}for(e=o-1;e>=0&&!(t[e]>t[e+1]);e--);return e},Qm=function(t){const e=t,{width:s,height:i}=t,{maxDim:n}=r(this,ca);let a=s,o=i;if(s>n||i>n){let f=s,g=i,y=Math.log2(Math.max(s,i)/n);const v=Math.floor(y);y=y===v?v-1:v;for(let A=0;A<y;A++){a=Math.ceil(f/2),o=Math.ceil(g/2);const x=new OffscreenCanvas(a,o);x.getContext("2d").drawImage(t,0,0,f,g,0,0,a,o),f=a,g=o,t!==e&&t.close(),t=x.transferToImageBitmap()}const w=Math.min(n/a,n/o);a=Math.round(a*w),o=Math.round(o*w)}const h=new OffscreenCanvas(a,o).getContext("2d",{willReadFrequently:!0});h.filter="grayscale(1)",h.drawImage(t,0,0,t.width,t.height,0,0,a,o);const d=h.getImageData(0,0,a,o).data;return[b(this,gt,cf).call(this,d),a,o]},m(mi,gt),m(mi,ca,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),m(mi,Gs,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));class Nf extends zm{constructor(){super(),super.updateProperties({fill:kt._defaultLineColor,"stroke-width":0})}clone(){const t=new Nf;return t.updateAll(this),t}}class Ff extends Md{constructor(t){super(t),super.updateProperties({stroke:kt._defaultLineColor,"stroke-width":1})}clone(){const t=new Ff(this._viewParameters);return t.updateAll(this),t}}var Hn,ui,$n,ha;const Ye=class Ye extends nd{constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"});m(this,Hn,!1);m(this,ui,null);m(this,$n,null);m(this,ha,null);this._willKeepAspectRatio=!0,p(this,$n,e.signatureData||null),p(this,ui,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,s){kt.initialize(e,s),this._defaultDrawingOptions=new Nf,this._defaultDrawnSignatureOptions=new Ff(s.viewParameters)}static getDefaultDrawingOptions(e){const s=this._defaultDrawingOptions.clone();return s.updateProperties(e),s}static get supportMultipleDrawings(){return!1}static get typesMap(){return it(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!r(this,ui)}}static computeTelemetryFinalData(e){const s=e.get("hasDescription");return{hasAltText:s.get(!0)??0,hasNoAltText:s.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let e,s;const{_isCopy:i}=this;if(i&&(this._isCopy=!1,e=this.x,s=this.y),super.render(),this._drawId===null)if(r(this,$n)){const{lines:n,mustSmooth:a,areContours:o,description:l,uuid:h,heightInPage:d}=r(this,$n),{rawDims:{pageWidth:u,pageHeight:f},rotation:g}=this.parent.viewport,y=mi.processDrawnLines({lines:n,pageWidth:u,pageHeight:f,rotation:g,innerMargin:Ye._INNER_MARGIN,mustSmooth:a,areContours:o});this.addSignature(y,d,l,h)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);return i&&(this._isCopy=!0,this._moveAfterPaste(e,s)),this.div}setUuid(e){p(this,ha,e),this.addEditToolbar()}getUuid(){return r(this,ha)}get description(){return r(this,ui)}set description(e){p(this,ui,e),super.addEditToolbar().then(s=>{s==null||s.updateEditSignatureButton(e)})}getSignaturePreview(){const{newCurves:e,areContours:s,thickness:i,width:n,height:a}=r(this,$n),o=Math.max(n,a),l=mi.processDrawnLines({lines:{curves:e.map(h=>({points:h})),thickness:i,width:n,height:a},pageWidth:o,pageHeight:o,rotation:0,innerMargin:0,mustSmooth:!1,areContours:s});return{areContours:s,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,s,i,n){const{x:a,y:o}=this,{outline:l}=p(this,$n,e);p(this,Hn,l instanceof af),this.description=i,this.div.setAttribute("data-l10n-args",JSON.stringify({description:i}));let h;r(this,Hn)?h=Ye.getDefaultDrawingOptions():(h=Ye._defaultDrawnSignatureOptions.clone(),h.updateProperties({"stroke-width":l.thickness})),this._addOutlines({drawOutlines:l,drawingOptions:h});const[d,u]=this.parentDimensions,[,f]=this.pageDimensions;let g=s/f;g=g>=1?.5:g,this.width*=g/this.height,this.width>=1&&(g*=.9/this.width,this.width=.9),this.height=g,this.setDims(d*this.width,u*this.height),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(n),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!n,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(e){const{rawDims:{pageWidth:s,pageHeight:i},rotation:n}=this.parent.viewport;return mi.process(e,s,i,n,Ye._INNER_MARGIN)}getFromText(e,s){const{rawDims:{pageWidth:i,pageHeight:n},rotation:a}=this.parent.viewport;return mi.extractContoursFromText(e,s,i,n,a,Ye._INNER_MARGIN)}getDrawnSignature(e){const{rawDims:{pageWidth:s,pageHeight:i},rotation:n}=this.parent.viewport;return mi.processDrawnLines({lines:e,pageWidth:s,pageHeight:i,rotation:n,innerMargin:Ye._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:s}){e?this._drawingOptions=Ye.getDefaultDrawingOptions():(this._drawingOptions=Ye._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":s}))}serialize(e=!1){if(this.isEmpty())return null;const{lines:s,points:i,rect:n}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":a}}=this,o={annotationType:J.SIGNATURE,isSignature:!0,areContours:r(this,Hn),color:[0,0,0],thickness:r(this,Hn)?0:a,pageIndex:this.pageIndex,rect:n,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?(o.paths={lines:s,points:i},o.uuid=r(this,ha),o.isCopy=!0):o.lines=s,r(this,ui)&&(o.accessibilityData={type:"Figure",alt:r(this,ui)}),o}static deserializeDraw(e,s,i,n,a,o){return o.areContours?af.deserialize(e,s,i,n,a,o):uh.deserialize(e,s,i,n,a,o)}static async deserialize(e,s,i){var a;const n=await super.deserialize(e,s,i);return p(n,Hn,e.areContours),p(n,ui,((a=e.accessibilityData)==null?void 0:a.alt)||""),p(n,ha,e.uuid),n}};Hn=new WeakMap,ui=new WeakMap,$n=new WeakMap,ha=new WeakMap,L(Ye,"_type","signature"),L(Ye,"_editorType",J.SIGNATURE),L(Ye,"_defaultDrawingOptions",null);let df=Ye;var Ft,he,zn,Yi,Gn,Ho,Ki,da,fi,ls,$o,ht,Al,xl,Xh,Yh,Kh,ff,Jh,tb;class uf extends kt{constructor(e){super({...e,name:"stampEditor"});m(this,ht);m(this,Ft,null);m(this,he,null);m(this,zn,null);m(this,Yi,null);m(this,Gn,null);m(this,Ho,"");m(this,Ki,null);m(this,da,!1);m(this,fi,null);m(this,ls,!1);m(this,$o,!1);p(this,Yi,e.bitmapUrl),p(this,Gn,e.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,s){kt.initialize(e,s)}static isHandlingMimeForPasting(e){return td.includes(e)}static paste(e,s){s.pasteEditor({mode:J.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var e;return{type:"stamp",hasAltText:!!((e=this.altTextData)!=null&&e.altText)}}static computeTelemetryFinalData(e){const s=e.get("hasAltText");return{hasAltText:s.get(!0)??0,hasNoAltText:s.get(!1)??0}}async mlGuessAltText(e=null,s=!0){if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:n,width:a,height:o}=e||this.copyCanvas(null,null,!0).imageData,l=await i.guess({name:"altText",request:{data:n,width:a,height:o,channels:n.length/(a*o)}});if(!l)throw new Error("No response from the AI service.");if(l.error)throw new Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw new Error("No valid response from the AI service.");const h=l.output;return await this.setGuessedAltText(h),s&&!this.hasAltTextData()&&(this.altTextData={alt:h,decorative:!1}),h}remove(){var e;r(this,he)&&(p(this,Ft,null),this._uiManager.imageManager.deleteId(r(this,he)),(e=r(this,Ki))==null||e.remove(),p(this,Ki,null),r(this,fi)&&(clearTimeout(r(this,fi)),p(this,fi,null))),super.remove()}rebuild(){if(!this.parent){r(this,he)&&b(this,ht,Xh).call(this);return}super.rebuild(),this.div!==null&&(r(this,he)&&r(this,Ki)===null&&b(this,ht,Xh).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(r(this,zn)||r(this,Ft)||r(this,Yi)||r(this,Gn)||r(this,he)||r(this,da))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,s;return this._isCopy&&(e=this.x,s=this.y),super.render(),this.div.hidden=!0,this.createAltText(),r(this,da)||(r(this,Ft)?b(this,ht,Yh).call(this):b(this,ht,Xh).call(this)),this._isCopy&&this._moveAfterPaste(e,s),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,s){const{id:i,bitmap:n}=this._uiManager.imageManager.getFromCanvas(e,s);s.remove(),i&&this._uiManager.imageManager.isValidId(i)&&(p(this,he,i),n&&p(this,Ft,n),p(this,da,!1),b(this,ht,Yh).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;r(this,fi)!==null&&clearTimeout(r(this,fi)),p(this,fi,setTimeout(()=>{p(this,fi,null),b(this,ht,ff).call(this)},200))}copyCanvas(e,s,i=!1){var g;e||(e=224);const{width:n,height:a}=r(this,Ft),o=new qs;let l=r(this,Ft),h=n,d=a,u=null;if(s){if(n>s||a>s){const k=Math.min(s/n,s/a);h=Math.floor(n*k),d=Math.floor(a*k)}u=document.createElement("canvas");const y=u.width=Math.ceil(h*o.sx),v=u.height=Math.ceil(d*o.sy);r(this,ls)||(l=b(this,ht,Kh).call(this,y,v));const w=u.getContext("2d");w.filter=this._uiManager.hcmFilter;let A="white",x="#cfcfd8";this._uiManager.hcmFilter!=="none"?x="black":(g=window.matchMedia)!=null&&g.call(window,"(prefers-color-scheme: dark)").matches&&(A="#8f8f9d",x="#42414d");const _=15,S=_*o.sx,C=_*o.sy,R=new OffscreenCanvas(S*2,C*2),T=R.getContext("2d");T.fillStyle=A,T.fillRect(0,0,S*2,C*2),T.fillStyle=x,T.fillRect(0,0,S,C),T.fillRect(S,C,S,C),w.fillStyle=w.createPattern(R,"repeat"),w.fillRect(0,0,y,v),w.drawImage(l,0,0,l.width,l.height,0,0,y,v)}let f=null;if(i){let y,v;if(o.symmetric&&l.width<e&&l.height<e)y=l.width,v=l.height;else if(l=r(this,Ft),n>e||a>e){const x=Math.min(e/n,e/a);y=Math.floor(n*x),v=Math.floor(a*x),r(this,ls)||(l=b(this,ht,Kh).call(this,y,v))}const A=new OffscreenCanvas(y,v).getContext("2d",{willReadFrequently:!0});A.drawImage(l,0,0,l.width,l.height,0,0,y,v),f={width:y,height:v,data:A.getImageData(0,0,y,v).data}}return{canvas:u,width:h,height:d,imageData:f}}static async deserialize(e,s,i){var w;let n=null,a=!1;if(e instanceof gm){const{data:{rect:A,rotation:x,id:_,structParent:S,popupRef:C},container:R,parent:{page:{pageNumber:T}},canvas:k}=e;let I,D;k?(delete e.canvas,{id:I,bitmap:D}=i.imageManager.getFromCanvas(R.id,k),k.remove()):(a=!0,e._hasNoCanvas=!0);const N=((w=await s._structTree.getAriaAttributes(`${_f}${_}`))==null?void 0:w.get("aria-label"))||"";n=e={annotationType:J.STAMP,bitmapId:I,bitmap:D,pageIndex:T-1,rect:A.slice(0),rotation:x,annotationElementId:_,id:_,deleted:!1,accessibilityData:{decorative:!1,altText:N},isSvg:!1,structParent:S,popupRef:C}}const o=await super.deserialize(e,s,i),{rect:l,bitmap:h,bitmapUrl:d,bitmapId:u,isSvg:f,accessibilityData:g}=e;a?(i.addMissingCanvas(e.id,o),p(o,da,!0)):u&&i.imageManager.isValidId(u)?(p(o,he,u),h&&p(o,Ft,h)):p(o,Yi,d),p(o,ls,f);const[y,v]=o.pageDimensions;return o.width=(l[2]-l[0])/y,o.height=(l[3]-l[1])/v,g&&(o.altTextData=g),o._initialData=n,p(o,$o,!!n),o}serialize(e=!1,s=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i={annotationType:J.STAMP,bitmapId:r(this,he),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:r(this,ls),structTreeParentId:this._structTreeParentId};if(e)return i.bitmapUrl=b(this,ht,Jh).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;const{decorative:n,altText:a}=this.serializeAltText(!1);if(!n&&a&&(i.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const l=b(this,ht,tb).call(this,i);if(l.isSame)return null;l.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1}if(i.id=this.annotationElementId,s===null)return i;s.stamps||(s.stamps=new Map);const o=r(this,ls)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!s.stamps.has(r(this,he)))s.stamps.set(r(this,he),{area:o,serialized:i}),i.bitmap=b(this,ht,Jh).call(this,!1);else if(r(this,ls)){const l=s.stamps.get(r(this,he));o>l.area&&(l.area=o,l.serialized.bitmap.close(),l.serialized.bitmap=b(this,ht,Jh).call(this,!1))}return i}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}}Ft=new WeakMap,he=new WeakMap,zn=new WeakMap,Yi=new WeakMap,Gn=new WeakMap,Ho=new WeakMap,Ki=new WeakMap,da=new WeakMap,fi=new WeakMap,ls=new WeakMap,$o=new WeakMap,ht=new WeakSet,Al=function(e,s=!1){if(!e){this.remove();return}p(this,Ft,e.bitmap),s||(p(this,he,e.id),p(this,ls,e.isSvg)),e.file&&p(this,Ho,e.file.name),b(this,ht,Yh).call(this)},xl=function(){if(p(this,zn,null),this._uiManager.enableWaiting(!1),!!r(this,Ki)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&r(this,Ft)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&r(this,Ft)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},Xh=function(){if(r(this,he)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(r(this,he)).then(i=>b(this,ht,Al).call(this,i,!0)).finally(()=>b(this,ht,xl).call(this));return}if(r(this,Yi)){const i=r(this,Yi);p(this,Yi,null),this._uiManager.enableWaiting(!0),p(this,zn,this._uiManager.imageManager.getFromUrl(i).then(n=>b(this,ht,Al).call(this,n)).finally(()=>b(this,ht,xl).call(this)));return}if(r(this,Gn)){const i=r(this,Gn);p(this,Gn,null),this._uiManager.enableWaiting(!0),p(this,zn,this._uiManager.imageManager.getFromFile(i).then(n=>b(this,ht,Al).call(this,n)).finally(()=>b(this,ht,xl).call(this)));return}const e=document.createElement("input");e.type="file",e.accept=td.join(",");const s=this._uiManager._signal;p(this,zn,new Promise(i=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const n=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),b(this,ht,Al).call(this,n)}i()},{signal:s}),e.addEventListener("cancel",()=>{this.remove(),i()},{signal:s})}).finally(()=>b(this,ht,xl).call(this))),e.click()},Yh=function(){var u;const{div:e}=this;let{width:s,height:i}=r(this,Ft);const[n,a]=this.pageDimensions,o=.75;if(this.width)s=this.width*n,i=this.height*a;else if(s>o*n||i>o*a){const f=Math.min(o*n/s,o*a/i);s*=f,i*=f}const[l,h]=this.parentDimensions;this.setDims(s*l/n,i*h/a),this._uiManager.enableWaiting(!1);const d=p(this,Ki,document.createElement("canvas"));d.setAttribute("role","img"),this.addContainer(d),this.width=s/n,this.height=i/a,(u=this._initialOptions)!=null&&u.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),b(this,ht,ff).call(this),r(this,$o)||(this.parent.addUndoableEditor(this),p(this,$o,!0)),this._reportTelemetry({action:"inserted_image"}),r(this,Ho)&&this.div.setAttribute("aria-description",r(this,Ho)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},Kh=function(e,s){const{width:i,height:n}=r(this,Ft);let a=i,o=n,l=r(this,Ft);for(;a>2*e||o>2*s;){const h=a,d=o;a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),o>2*s&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2));const u=new OffscreenCanvas(a,o);u.getContext("2d").drawImage(l,0,0,h,d,0,0,a,o),l=u.transferToImageBitmap()}return l},ff=function(){const[e,s]=this.parentDimensions,{width:i,height:n}=this,a=new qs,o=Math.ceil(i*e*a.sx),l=Math.ceil(n*s*a.sy),h=r(this,Ki);if(!h||h.width===o&&h.height===l)return;h.width=o,h.height=l;const d=r(this,ls)?r(this,Ft):b(this,ht,Kh).call(this,o,l),u=h.getContext("2d");u.filter=this._uiManager.hcmFilter,u.drawImage(d,0,0,d.width,d.height,0,0,o,l)},Jh=function(e){if(e){if(r(this,ls)){const n=this._uiManager.imageManager.getSvgUrl(r(this,he));if(n)return n}const s=document.createElement("canvas");return{width:s.width,height:s.height}=r(this,Ft),s.getContext("2d").drawImage(r(this,Ft),0,0),s.toDataURL()}if(r(this,ls)){const[s,i]=this.pageDimensions,n=Math.round(this.width*s*nn.PDF_TO_CSS_UNITS),a=Math.round(this.height*i*nn.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(n,a);return o.getContext("2d").drawImage(r(this,Ft),0,0,r(this,Ft).width,r(this,Ft).height,0,0,n,a),o.transferToImageBitmap()}return structuredClone(r(this,Ft))},tb=function(e){var o;const{pageIndex:s,accessibilityData:{altText:i}}=this._initialData,n=e.pageIndex===s,a=(((o=e.accessibilityData)==null?void 0:o.alt)||"")===i;return{isSame:!this._hasBeenMoved&&!this._hasBeenResized&&n&&a,isSameAltText:a}},L(uf,"_type","stamp"),L(uf,"_editorType",J.STAMP);var ua,zo,pi,Vn,Ji,cs,Un,Go,fa,Vs,Zi,de,Qi,Wn,Vo,U,qn,Ot,eb,Js,pf,gf,Zh;const Ls=class Ls{constructor({uiManager:t,pageIndex:e,div:s,structTreeLayer:i,accessibilityManager:n,annotationLayer:a,drawLayer:o,textLayer:l,viewport:h,l10n:d}){m(this,Ot);m(this,ua);m(this,zo,!1);m(this,pi,null);m(this,Vn,null);m(this,Ji,null);m(this,cs,new Map);m(this,Un,!1);m(this,Go,!1);m(this,fa,!1);m(this,Vs,null);m(this,Zi,null);m(this,de,null);m(this,Qi,null);m(this,Wn,null);m(this,Vo,-1);m(this,U);const u=[...r(Ls,qn).values()];if(!Ls._initialized){Ls._initialized=!0;for(const f of u)f.initialize(d,t)}t.registerEditorTypes(u),p(this,U,t),this.pageIndex=e,this.div=s,p(this,ua,n),p(this,pi,a),this.viewport=h,p(this,de,l),this.drawLayer=o,this._structTree=i,r(this,U).addLayer(this)}get isEmpty(){return r(this,cs).size===0}get isInvisible(){return this.isEmpty&&r(this,U).getMode()===J.NONE}updateToolbar(t){r(this,U).updateToolbar(t)}updateMode(t=r(this,U).getMode()){switch(b(this,Ot,Zh).call(this),t){case J.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case J.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case J.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;for(const s of r(Ls,qn).values())e.toggle(`${s._type}Editing`,t===s._editorType);this.div.hidden=!1}hasTextLayer(t){var e;return t===((e=r(this,de))==null?void 0:e.div)}setEditingState(t){r(this,U).setEditingState(t)}addCommands(t){r(this,U).addCommands(t)}cleanUndoStack(t){r(this,U).cleanUndoStack(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){var e;(e=r(this,pi))==null||e.div.classList.toggle("disabled",!t)}async enable(){var s;p(this,fa,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),(s=r(this,Wn))==null||s.abort(),p(this,Wn,null);const t=new Set;for(const i of r(this,cs).values())i.enableEditing(),i.show(!0),i.annotationElementId&&(r(this,U).removeChangedExistingAnnotation(i),t.add(i.annotationElementId));if(!r(this,pi)){p(this,fa,!1);return}const e=r(this,pi).getEditableAnnotations();for(const i of e){if(i.hide(),r(this,U).isDeletedAnnotationElement(i.data.id)||t.has(i.data.id))continue;const n=await this.deserialize(i);n&&(this.addOrRebuild(n),n.enableEditing())}p(this,fa,!1)}disable(){var i;if(p(this,Go,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),r(this,de)&&!r(this,Wn)){p(this,Wn,new AbortController);const n=r(this,U).combinedSignal(r(this,Wn));r(this,de).div.addEventListener("pointerdown",a=>{const{clientX:l,clientY:h,timeStamp:d}=a,u=r(this,Vo);if(d-u>500){p(this,Vo,d);return}p(this,Vo,-1);const{classList:f}=this.div;f.toggle("getElements",!0);const g=document.elementsFromPoint(l,h);if(f.toggle("getElements",!1),!this.div.contains(g[0]))return;let y;const v=new RegExp(`^${Wp}[0-9]+$`);for(const A of g)if(v.test(A.id)){y=A.id;break}if(!y)return;const w=r(this,cs).get(y);(w==null?void 0:w.annotationElementId)===null&&(a.stopPropagation(),a.preventDefault(),w.dblclick())},{signal:n,capture:!0})}const t=new Map,e=new Map;for(const n of r(this,cs).values())if(n.disableEditing(),!!n.annotationElementId){if(n.serialize()!==null){t.set(n.annotationElementId,n);continue}else e.set(n.annotationElementId,n);(i=this.getEditableAnnotation(n.annotationElementId))==null||i.show(),n.remove()}if(r(this,pi)){const n=r(this,pi).getEditableAnnotations();for(const a of n){const{id:o}=a.data;if(r(this,U).isDeletedAnnotationElement(o))continue;let l=e.get(o);if(l){l.resetAnnotationElement(a),l.show(!1),a.show();continue}l=t.get(o),l&&(r(this,U).addChangedExistingAnnotation(l),l.renderAnnotationElement(a)&&l.show(!1)),a.show()}}b(this,Ot,Zh).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const n of r(Ls,qn).values())s.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),p(this,Go,!1)}getEditableAnnotation(t){var e;return((e=r(this,pi))==null?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){r(this,U).getActive()!==t&&r(this,U).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,(t=r(this,de))!=null&&t.div&&!r(this,Qi)){p(this,Qi,new AbortController);const e=r(this,U).combinedSignal(r(this,Qi));r(this,de).div.addEventListener("pointerdown",b(this,Ot,eb).bind(this),{signal:e}),r(this,de).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,(t=r(this,de))!=null&&t.div&&r(this,Qi)&&(r(this,Qi).abort(),p(this,Qi,null),r(this,de).div.classList.remove("highlighting"))}enableClick(){if(r(this,Vn))return;p(this,Vn,new AbortController);const t=r(this,U).combinedSignal(r(this,Vn));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});const e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){var t;(t=r(this,Vn))==null||t.abort(),p(this,Vn,null)}attach(t){r(this,cs).set(t.id,t);const{annotationElementId:e}=t;e&&r(this,U).isDeletedAnnotationElement(e)&&r(this,U).removeDeletedAnnotationElement(t)}detach(t){var e;r(this,cs).delete(t.id),(e=r(this,ua))==null||e.removePointerInTextLayer(t.contentDiv),!r(this,Go)&&t.annotationElementId&&r(this,U).addDeletedAnnotationElement(t)}remove(t){this.detach(t),r(this,U).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(r(this,U).addDeletedAnnotationElement(t.annotationElementId),kt.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),(e=t.parent)==null||e.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(!(t.parent===this&&t.isAttachedToDOM)){if(this.changeParent(t),r(this,U).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!r(this,fa)),r(this,U).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var s;if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!r(this,Ji)&&(t._focusEventsAllowed=!1,p(this,Ji,setTimeout(()=>{p(this,Ji,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:r(this,U)._signal}),e.focus())},0))),t._structTreeParentId=(s=r(this,ua))==null?void 0:s.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){const e=()=>t._uiManager.rebuild(t),s=()=>{t.remove()};this.addCommands({cmd:e,undo:s,mustExec:!1})}getNextId(){return r(this,U).getId()}combinedSignal(t){return r(this,U).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return(t=r(this,Ot,Js))==null?void 0:t.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await r(this,U).updateMode(t.mode);const{offsetX:s,offsetY:i}=b(this,Ot,gf).call(this),n=this.getNextId(),a=b(this,Ot,pf).call(this,{parent:this,id:n,x:s,y:i,uiManager:r(this,U),isCentered:!0,...e});a&&this.add(a)}async deserialize(t){var e;return await((e=r(Ls,qn).get(t.annotationType??t.annotationEditorType))==null?void 0:e.deserialize(t,this,r(this,U)))||null}createAndAddNewEditor(t,e,s={}){const i=this.getNextId(),n=b(this,Ot,pf).call(this,{parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:r(this,U),isCentered:e,...s});return n&&this.add(n),n}addNewEditor(t={}){this.createAndAddNewEditor(b(this,Ot,gf).call(this),!0,t)}setSelected(t){r(this,U).setSelected(t)}toggleSelected(t){r(this,U).toggleSelected(t)}unselect(t){r(this,U).unselect(t)}pointerup(t){var i;const{isMac:e}=ue.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div||!r(this,Un)||(p(this,Un,!1),(i=r(this,Ot,Js))!=null&&i.isDrawer&&r(this,Ot,Js).supportMultipleDrawings))return;if(!r(this,zo)){p(this,zo,!0);return}const s=r(this,U).getMode();if(s===J.STAMP||s===J.SIGNATURE){r(this,U).unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){var i;if(r(this,U).getMode()===J.HIGHLIGHT&&this.enableTextSelection(),r(this,Un)){p(this,Un,!1);return}const{isMac:e}=ue.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;if(p(this,Un,!0),(i=r(this,Ot,Js))!=null&&i.isDrawer){this.startDrawingSession(t);return}const s=r(this,U).getActive();p(this,zo,!s||s.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),r(this,Vs)){r(this,Ot,Js).startDrawing(this,r(this,U),!1,t);return}r(this,U).setCurrentDrawingSession(this),p(this,Vs,new AbortController);const e=r(this,U).combinedSignal(r(this,Vs));this.div.addEventListener("blur",({relatedTarget:s})=>{s&&!this.div.contains(s)&&(p(this,Zi,null),this.commitOrRemove())},{signal:e}),r(this,Ot,Js).startDrawing(this,r(this,U),!1,t)}pause(t){if(t){const{activeElement:e}=document;this.div.contains(e)&&p(this,Zi,e);return}r(this,Zi)&&setTimeout(()=>{var e;(e=r(this,Zi))==null||e.focus(),p(this,Zi,null)},0)}endDrawingSession(t=!1){return r(this,Vs)?(r(this,U).setCurrentDrawingSession(null),r(this,Vs).abort(),p(this,Vs,null),p(this,Zi,null),r(this,Ot,Js).endDrawing(t)):null}findNewParent(t,e,s){const i=r(this,U).findParent(e,s);return i===null||i===this?!1:(i.changeParent(t),!0)}commitOrRemove(){return r(this,Vs)?(this.endDrawingSession(),!0):!1}onScaleChanging(){r(this,Vs)&&r(this,Ot,Js).onScaleChangingWhenDrawing(this)}destroy(){var t,e;this.commitOrRemove(),((t=r(this,U).getActive())==null?void 0:t.parent)===this&&(r(this,U).commitOrRemove(),r(this,U).setActiveEditor(null)),r(this,Ji)&&(clearTimeout(r(this,Ji)),p(this,Ji,null));for(const s of r(this,cs).values())(e=r(this,ua))==null||e.removePointerInTextLayer(s.contentDiv),s.setParent(null),s.isAttachedToDOM=!1,s.div.remove();this.div=null,r(this,cs).clear(),r(this,U).removeLayer(this)}render({viewport:t}){this.viewport=t,Xn(this.div,t);for(const e of r(this,U).getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){r(this,U).commitOrRemove(),b(this,Ot,Zh).call(this);const e=this.viewport.rotation,s=t.rotation;if(this.viewport=t,Xn(this.div,{rotation:s}),e!==s)for(const i of r(this,cs).values())i.rotate(s)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return r(this,U).viewParameters.realScale}};ua=new WeakMap,zo=new WeakMap,pi=new WeakMap,Vn=new WeakMap,Ji=new WeakMap,cs=new WeakMap,Un=new WeakMap,Go=new WeakMap,fa=new WeakMap,Vs=new WeakMap,Zi=new WeakMap,de=new WeakMap,Qi=new WeakMap,Wn=new WeakMap,Vo=new WeakMap,U=new WeakMap,qn=new WeakMap,Ot=new WeakSet,eb=function(t){r(this,U).unselectAll();const{target:e}=t;if(e===r(this,de).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&r(this,de).div.contains(e)){const{isMac:s}=ue.platform;if(t.button!==0||t.ctrlKey&&s)return;r(this,U).showAllEditors("highlight",!0,!0),r(this,de).div.classList.add("free"),this.toggleDrawing(),id.startHighlighting(this,r(this,U).direction==="ltr",{target:r(this,de).div,x:t.x,y:t.y}),r(this,de).div.addEventListener("pointerup",()=>{r(this,de).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:r(this,U)._signal}),t.preventDefault()}},Js=function(){return r(Ls,qn).get(r(this,U).getMode())},pf=function(t){const e=r(this,Ot,Js);return e?new e.prototype.constructor(t):null},gf=function(){const{x:t,y:e,width:s,height:i}=this.div.getBoundingClientRect(),n=Math.max(0,t),a=Math.max(0,e),o=Math.min(window.innerWidth,t+s),l=Math.min(window.innerHeight,e+i),h=(n+o)/2-t,d=(a+l)/2-e,[u,f]=this.viewport.rotation%180===0?[h,d]:[d,h];return{offsetX:u,offsetY:f}},Zh=function(){for(const t of r(this,cs).values())t.isEmpty()&&t.remove()},L(Ls,"_initialized",!1),m(Ls,qn,new Map([Uu,rf,uf,id,df].map(t=>[t._editorType,t])));let rd=Ls;var Us,Oe,pa,rh,Sd,sb,bi,mf,ib,bf;const ee=class ee{constructor({pageIndex:t}){m(this,bi);m(this,Us,null);m(this,Oe,new Map);m(this,pa,new Map);this.pageIndex=t}setParent(t){if(!r(this,Us)){p(this,Us,t);return}if(r(this,Us)!==t){if(r(this,Oe).size>0)for(const e of r(this,Oe).values())e.remove(),t.append(e);p(this,Us,t)}}static get _svgFactory(){return it(this,"_svgFactory",new kl)}draw(t,e=!1,s=!1){const i=Me(ee,rh)._++,n=b(this,bi,mf).call(this),a=ee._svgFactory.createElement("defs");n.append(a);const o=ee._svgFactory.createElement("path");a.append(o);const l=`path_p${this.pageIndex}_${i}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),e&&r(this,pa).set(i,o);const h=s?b(this,bi,ib).call(this,a,l):null,d=ee._svgFactory.createElement("use");return n.append(d),d.setAttribute("href",`#${l}`),this.updateProperties(n,t),r(this,Oe).set(i,n),{id:i,clipPathId:`url(#${h})`}}drawOutline(t,e){const s=Me(ee,rh)._++,i=b(this,bi,mf).call(this),n=ee._svgFactory.createElement("defs");i.append(n);const a=ee._svgFactory.createElement("path");n.append(a);const o=`path_p${this.pageIndex}_${s}`;a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke");let l;if(e){const u=ee._svgFactory.createElement("mask");n.append(u),l=`mask_p${this.pageIndex}_${s}`,u.setAttribute("id",l),u.setAttribute("maskUnits","objectBoundingBox");const f=ee._svgFactory.createElement("rect");u.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");const g=ee._svgFactory.createElement("use");u.append(g),g.setAttribute("href",`#${o}`),g.setAttribute("stroke","none"),g.setAttribute("fill","black"),g.setAttribute("fill-rule","nonzero"),g.classList.add("mask")}const h=ee._svgFactory.createElement("use");i.append(h),h.setAttribute("href",`#${o}`),l&&h.setAttribute("mask",`url(#${l})`);const d=h.cloneNode();return i.append(d),h.classList.add("mainOutline"),d.classList.add("secondaryOutline"),this.updateProperties(i,t),r(this,Oe).set(s,i),s}finalizeDraw(t,e){r(this,pa).delete(t),this.updateProperties(t,e)}updateProperties(t,e){var l;if(!e)return;const{root:s,bbox:i,rootClass:n,path:a}=e,o=typeof t=="number"?r(this,Oe).get(t):t;if(o){if(s&&b(this,bi,bf).call(this,o,s),i&&b(l=ee,Sd,sb).call(l,o,i),n){const{classList:h}=o;for(const[d,u]of Object.entries(n))h.toggle(d,u)}if(a){const d=o.firstChild.firstChild;b(this,bi,bf).call(this,d,a)}}}updateParent(t,e){if(e===this)return;const s=r(this,Oe).get(t);s&&(r(e,Us).append(s),r(this,Oe).delete(t),r(e,Oe).set(t,s))}remove(t){r(this,pa).delete(t),r(this,Us)!==null&&(r(this,Oe).get(t).remove(),r(this,Oe).delete(t))}destroy(){p(this,Us,null);for(const t of r(this,Oe).values())t.remove();r(this,Oe).clear(),r(this,pa).clear()}};Us=new WeakMap,Oe=new WeakMap,pa=new WeakMap,rh=new WeakMap,Sd=new WeakSet,sb=function(t,[e,s,i,n]){const{style:a}=t;a.top=`${100*s}%`,a.left=`${100*e}%`,a.width=`${100*i}%`,a.height=`${100*n}%`},bi=new WeakSet,mf=function(){const t=ee._svgFactory.create(1,1,!0);return r(this,Us).append(t),t.setAttribute("aria-hidden",!0),t},ib=function(t,e){const s=ee._svgFactory.createElement("clipPath");t.append(s);const i=`clip_${e}`;s.setAttribute("id",i),s.setAttribute("clipPathUnits","objectBoundingBox");const n=ee._svgFactory.createElement("use");return s.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),i},bf=function(t,e){for(const[s,i]of Object.entries(e))i===null?t.removeAttribute(s):t.setAttribute(s,i)},m(ee,Sd),m(ee,rh,0);let ad=ee;globalThis._pdfjsTestingUtils={HighlightOutliner:qu};globalThis.pdfjsLib={AbortException:sn,AnnotationEditorLayer:rd,AnnotationEditorParamsType:rt,AnnotationEditorType:J,AnnotationEditorUIManager:Yn,AnnotationLayer:Df,AnnotationMode:gi,AnnotationType:Vt,build:im,ColorPicker:Il,createValidAbsoluteUrl:Af,DOMSVGFactory:kl,DrawLayer:ad,FeatureTest:ue,fetchData:Xo,getDocument:Pf,getFilenameFromUrl:Zp,getPdfFilenameFromUrl:Qp,getUuid:Ef,getXfaPageViewport:tg,GlobalWorkerOptions:Ss,ImageKind:_l,InvalidPDFException:Qh,isDataScheme:ch,isPdfFile:Pd,isValidExplicitDest:Dg,MathClamp:Te,noContextMenu:Rs,normalizeUnicode:Kp,OPS:Sl,OutputScale:qs,PasswordResponses:Xp,PDFDataRangeTransport:kf,PDFDateString:kd,PDFWorker:Uo,PermissionFlag:qp,PixelsPerInch:nn,RenderingCancelledException:Rd,ResponseException:Cl,setLayerDimensions:Xn,shadow:it,SignatureExtractor:mi,stopEvent:qt,SupportedImageMimeTypes:td,TextLayer:Rl,TouchManager:Tl,updateUrlHash:xf,Util:W,VerbosityLevel:ah,version:If,XfaLayer:Mf};const fv=Object.freeze(Object.defineProperty({__proto__:null,AbortException:sn,AnnotationEditorLayer:rd,AnnotationEditorParamsType:rt,AnnotationEditorType:J,AnnotationEditorUIManager:Yn,AnnotationLayer:Df,AnnotationMode:gi,AnnotationType:Vt,ColorPicker:Il,DOMSVGFactory:kl,DrawLayer:ad,FeatureTest:ue,GlobalWorkerOptions:Ss,ImageKind:_l,InvalidPDFException:Qh,MathClamp:Te,OPS:Sl,OutputScale:qs,PDFDataRangeTransport:kf,PDFDateString:kd,PDFWorker:Uo,PasswordResponses:Xp,PermissionFlag:qp,PixelsPerInch:nn,RenderingCancelledException:Rd,ResponseException:Cl,SignatureExtractor:mi,SupportedImageMimeTypes:td,TextLayer:Rl,TouchManager:Tl,Util:W,VerbosityLevel:ah,XfaLayer:Mf,build:im,createValidAbsoluteUrl:Af,fetchData:Xo,getDocument:Pf,getFilenameFromUrl:Zp,getPdfFilenameFromUrl:Qp,getUuid:Ef,getXfaPageViewport:tg,isDataScheme:ch,isPdfFile:Pd,isValidExplicitDest:Dg,noContextMenu:Rs,normalizeUnicode:Kp,setLayerDimensions:Xn,shadow:it,stopEvent:qt,updateUrlHash:xf,version:If},Symbol.toStringTag,{value:"Module"}));function nb(c){var t,e,s="";if(typeof c=="string"||typeof c=="number")s+=c;else if(typeof c=="object")if(Array.isArray(c)){var i=c.length;for(t=0;t<i;t++)c[t]&&(e=nb(c[t]))&&(s&&(s+=" "),s+=e)}else for(e in c)c[e]&&(s&&(s+=" "),s+=e);return s}function Ld(){for(var c,t,e=0,s="",i=arguments.length;e<i;e++)(c=arguments[e])&&(t=nb(c))&&(s&&(s+=" "),s+=t);return s}var Ap=Object.prototype.hasOwnProperty;function xp(c,t,e){for(e of c.keys())if(Fa(e,t))return e}function Fa(c,t){var e,s,i;if(c===t)return!0;if(c&&t&&(e=c.constructor)===t.constructor){if(e===Date)return c.getTime()===t.getTime();if(e===RegExp)return c.toString()===t.toString();if(e===Array){if((s=c.length)===t.length)for(;s--&&Fa(c[s],t[s]););return s===-1}if(e===Set){if(c.size!==t.size)return!1;for(s of c)if(i=s,i&&typeof i=="object"&&(i=xp(t,i),!i)||!t.has(i))return!1;return!0}if(e===Map){if(c.size!==t.size)return!1;for(s of c)if(i=s[0],i&&typeof i=="object"&&(i=xp(t,i),!i)||!Fa(s[1],t.get(i)))return!1;return!0}if(e===ArrayBuffer)c=new Uint8Array(c),t=new Uint8Array(t);else if(e===DataView){if((s=c.byteLength)===t.byteLength)for(;s--&&c.getInt8(s)===t.getInt8(s););return s===-1}if(ArrayBuffer.isView(c)){if((s=c.byteLength)===t.byteLength)for(;s--&&c[s]===t[s];);return s===-1}if(!e||typeof c=="object"){s=0;for(e in c)if(Ap.call(c,e)&&++s&&!Ap.call(t,e)||!(e in t)||!Fa(c[e],t[e]))return!1;return Object.keys(t).length===s}}return c!==c&&t!==t}function fh(c){let t=!1;return{promise:new Promise((s,i)=>{c.then(n=>!t&&s(n)).catch(n=>!t&&i(n))}),cancel(){t=!0}}}const pv=["onCopy","onCut","onPaste"],gv=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],mv=["onFocus","onBlur"],bv=["onInput","onInvalid","onReset","onSubmit"],yv=["onLoad","onError"],vv=["onKeyDown","onKeyPress","onKeyUp"],wv=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],Av=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],xv=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],Ev=["onSelect"],_v=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],Sv=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],Cv=["onScroll"],Tv=["onWheel"],Rv=["onAnimationStart","onAnimationEnd","onAnimationIteration"],Pv=["onTransitionEnd"],kv=["onToggle"],Iv=["onChange"],Mv=[...pv,...gv,...mv,...bv,...yv,...vv,...wv,...Av,...xv,...Ev,..._v,...Sv,...Cv,...Tv,...Rv,...Pv,...Iv,...kv];function rb(c,t){const e={};for(const s of Mv){const i=c[s];i&&(t?e[s]=n=>i(n,t(s)):e[s]=i)}return e}var Lv=process.env.NODE_ENV==="production",eu="Invariant failed";function Ct(c,t){if(!c){if(Lv)throw new Error(eu);var e=typeof t=="function"?t():t,s=e?"".concat(eu,": ").concat(e):eu;throw new Error(s)}}var Dv=process.env.NODE_ENV!=="production",ab=function(){};if(Dv){var Nv=function(t,e){var s=arguments.length;e=new Array(s>1?s-1:0);for(var i=1;i<s;i++)e[i-1]=arguments[i];var n=0,a="Warning: "+t.replace(/%s/g,function(){return e[n++]});typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}};ab=function(c,t,e){var s=arguments.length;e=new Array(s>2?s-2:0);for(var i=2;i<s;i++)e[i-2]=arguments[i];if(t===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");c||Nv.apply(null,[t].concat(e))}}var Fv=ab;const Re=jb(Fv),ob=B.createContext(null),Ov="noopener noreferrer nofollow";class Bv{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(t){this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setExternalLinkRel(t){this.externalLinkRel=t}setExternalLinkTarget(t){this.externalLinkTarget=t}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return Ct(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(t){Ct(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}goToDestination(t){return new Promise(e=>{Ct(this.pdfDocument,"PDF document not loaded."),Ct(t,"Destination is not specified."),typeof t=="string"?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(e=>{Ct(Array.isArray(e),`"${e}" is not a valid destination array.`);const s=e[0];new Promise(i=>{Ct(this.pdfDocument,"PDF document not loaded."),s instanceof Object?this.pdfDocument.getPageIndex(s).then(n=>{i(n)}).catch(()=>{Ct(!1,`"${s}" is not a valid page reference.`)}):typeof s=="number"?i(s):Ct(!1,`"${s}" is not a valid destination reference.`)}).then(i=>{const n=i+1;Ct(this.pdfViewer,"PDF viewer is not initialized."),Ct(n>=1&&n<=this.pagesCount,`"${n}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:e,pageIndex:i,pageNumber:n})})})}navigateTo(t){this.goToDestination(t)}goToPage(t){const e=t-1;Ct(this.pdfViewer,"PDF viewer is not initialized."),Ct(t>=1&&t<=this.pagesCount,`"${t}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}addLinkAttributes(t,e,s){t.href=e,t.rel=this.externalLinkRel||Ov,t.target=s?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}function Oa({children:c,type:t}){return P.jsx("div",{className:`react-pdf__message react-pdf__message--${t}`,children:c})}const Ep={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};function jv(c,t){switch(t.type){case"RESOLVE":return{value:t.value,error:void 0};case"REJECT":return{value:!1,error:t.error};case"RESET":return{value:void 0,error:void 0};default:return c}}function Wo(){return B.useReducer(jv,{value:void 0,error:void 0})}const Dd=typeof window<"u",lb=Dd&&window.location.protocol==="file:";function Hv(c){return typeof c<"u"}function tr(c){return Hv(c)&&c!==null}function $v(c){return typeof c=="string"}function zv(c){return c instanceof ArrayBuffer}function Gv(c){return Ct(Dd,"isBlob can only be used in a browser environment"),c instanceof Blob}function yf(c){return $v(c)&&/^data:/.test(c)}function _p(c){Ct(yf(c),"Invalid data URI.");const[t="",e=""]=c.split(",");return t.split(";").indexOf("base64")!==-1?atob(e):unescape(e)}function Vv(){return Dd&&window.devicePixelRatio||1}const cb="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function Sp(){Re(!lb,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${cb}`)}function Uv(){Re(!lb,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${cb}`)}function ba(c){c!=null&&c.cancel&&c.cancel()}function vf(c,t){return Object.defineProperty(c,"width",{get(){return this.view[2]*t},configurable:!0}),Object.defineProperty(c,"height",{get(){return this.view[3]*t},configurable:!0}),Object.defineProperty(c,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(c,"originalHeight",{get(){return this.view[3]},configurable:!0}),c}function Wv(c){return c.name==="RenderingCancelledException"}function qv(c){return new Promise((t,e)=>{const s=new FileReader;s.onload=()=>{if(!s.result)return e(new Error("Error while reading a file."));t(s.result)},s.onerror=i=>{if(!i.target)return e(new Error("Error while reading a file."));const{error:n}=i.target;if(!n)return e(new Error("Error while reading a file."));switch(n.code){case n.NOT_FOUND_ERR:return e(new Error("Error while reading a file: File not found."));case n.SECURITY_ERR:return e(new Error("Error while reading a file: Security error."));case n.ABORT_ERR:return e(new Error("Error while reading a file: Aborted."));default:return e(new Error("Error while reading a file."))}},s.readAsArrayBuffer(c)})}const{PDFDataRangeTransport:Xv}=fv,Yv=(c,t)=>{switch(t){case Ep.NEED_PASSWORD:{const e=prompt("Enter the password to open this PDF file.");c(e);break}case Ep.INCORRECT_PASSWORD:{const e=prompt("Invalid password. Please try again.");c(e);break}}};function Cp(c){return typeof c=="object"&&c!==null&&("data"in c||"range"in c||"url"in c)}const Kv=B.forwardRef(function({children:t,className:e,error:s="Failed to load PDF file.",externalLinkRel:i,externalLinkTarget:n,file:a,inputRef:o,imageResourcesPath:l,loading:h="Loading PDF…",noData:d="No PDF file specified.",onItemClick:u,onLoadError:f,onLoadProgress:g,onLoadSuccess:y,onPassword:v=Yv,onSourceError:w,onSourceSuccess:A,options:x,renderMode:_,rotate:S,scale:C,...R},T){const[k,I]=Wo(),{value:D,error:N}=k,[Y,q]=Wo(),{value:H,error:st}=Y,F=B.useRef(new Bv),O=B.useRef([]),yt=B.useRef(void 0),Tt=B.useRef(void 0);a&&a!==yt.current&&Cp(a)&&(Re(!Fa(a,yt.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),yt.current=a),x&&x!==Tt.current&&(Re(!Fa(x,Tt.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),Tt.current=x);const zt=B.useRef({scrollPageIntoView:ot=>{const{dest:Rt,pageNumber:It,pageIndex:Mt=It-1}=ot;if(u){u({dest:Rt,pageIndex:Mt,pageNumber:It});return}const yi=O.current[Mt];if(yi){yi.scrollIntoView();return}Re(!1,`An internal link leading to page ${It} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});B.useImperativeHandle(T,()=>({linkService:F,pages:O,viewer:zt}),[]);function mt(){A&&A()}function _t(){N&&(Re(!1,N.toString()),w&&w(N))}function ft(){I({type:"RESET"})}B.useEffect(ft,[a,I]);const we=B.useCallback(async()=>{if(!a)return null;if(typeof a=="string")return yf(a)?{data:_p(a)}:(Sp(),{url:a});if(a instanceof Xv)return{range:a};if(zv(a))return{data:a};if(Dd&&Gv(a))return{data:await qv(a)};if(Ct(typeof a=="object","Invalid parameter in file, need either Uint8Array, string or a parameter object"),Ct(Cp(a),"Invalid parameter object: need either .data, .range or .url"),"url"in a&&typeof a.url=="string"){if(yf(a.url)){const{url:ot,...Rt}=a;return{data:_p(ot),...Rt}}Sp()}return a},[a]);B.useEffect(()=>{const ot=fh(we());return ot.promise.then(Rt=>{I({type:"RESOLVE",value:Rt})}).catch(Rt=>{I({type:"REJECT",error:Rt})}),()=>{ba(ot)}},[we,I]),B.useEffect(()=>{if(!(typeof D>"u")){if(D===!1){_t();return}mt()}},[D]);function Ae(){H&&(y&&y(H),O.current=new Array(H.numPages),F.current.setDocument(H))}function te(){st&&(Re(!1,st.toString()),f&&f(st))}B.useEffect(function(){q({type:"RESET"})},[q,D]),B.useEffect(function(){if(!D)return;const Rt=x?{...D,...x}:D,It=Pf(Rt);g&&(It.onProgress=g),v&&(It.onPassword=v);const Mt=It,yi=Mt.promise.then(an=>{q({type:"RESOLVE",value:an})}).catch(an=>{Mt.destroyed||q({type:"REJECT",error:an})});return()=>{yi.finally(()=>Mt.destroy())}},[x,q,D]),B.useEffect(()=>{if(!(typeof H>"u")){if(H===!1){te();return}Ae()}},[H]),B.useEffect(function(){F.current.setViewer(zt.current),F.current.setExternalLinkRel(i),F.current.setExternalLinkTarget(n)},[i,n]);const dt=B.useCallback((ot,Rt)=>{O.current[ot]=Rt},[]),Pe=B.useCallback(ot=>{delete O.current[ot]},[]),ke=B.useMemo(()=>({imageResourcesPath:l,linkService:F.current,onItemClick:u,pdf:H,registerPage:dt,renderMode:_,rotate:S,scale:C,unregisterPage:Pe}),[l,u,H,dt,_,S,C,Pe]),vt=B.useMemo(()=>rb(R,()=>H),[R,H]);function Ps(){function ot(It){return!!(It!=null&&It.pdf)}if(!ot(ke))throw new Error("pdf is undefined");const Rt=typeof t=="function"?t(ke):t;return P.jsx(ob.Provider,{value:ke,children:Rt})}function ps(){return a?H==null?P.jsx(Oa,{type:"loading",children:typeof h=="function"?h():h}):H===!1?P.jsx(Oa,{type:"error",children:typeof s=="function"?s():s}):Ps():P.jsx(Oa,{type:"no-data",children:typeof d=="function"?d():d})}return P.jsx("div",{className:Ld("react-pdf__Document",e),ref:o,...vt,children:ps()})});function hb(){return B.useContext(ob)}function db(){for(var c=[],t=0;t<arguments.length;t++)c[t]=arguments[t];var e=c.filter(Boolean);if(e.length<=1){var s=e[0];return s||null}return function(n){for(var a=0,o=e;a<o.length;a++){var l=o[a];typeof l=="function"?l(n):l&&(l.current=n)}}}const ub=B.createContext(null);function Nd(){return B.useContext(ub)}function Jv(){const c=hb(),t=Nd();Ct(t,"Unable to find Page context.");const e={...c,...t},{imageResourcesPath:s,linkService:i,onGetAnnotationsError:n,onGetAnnotationsSuccess:a,onRenderAnnotationLayerError:o,onRenderAnnotationLayerSuccess:l,page:h,pdf:d,renderForms:u,rotate:f,scale:g=1}=e;Ct(d,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),Ct(h,"Attempted to load page annotations, but no page was specified."),Ct(i,"Attempted to load page annotations, but no linkService was specified.");const[y,v]=Wo(),{value:w,error:A}=y,x=B.useRef(null);Re(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function _(){w&&a&&a(w)}function S(){A&&(Re(!1,A.toString()),n&&n(A))}B.useEffect(function(){v({type:"RESET"})},[v,h]),B.useEffect(function(){if(!h)return;const I=fh(h.getAnnotations()),D=I;return I.promise.then(N=>{v({type:"RESOLVE",value:N})}).catch(N=>{v({type:"REJECT",error:N})}),()=>{ba(D)}},[v,h]),B.useEffect(()=>{if(w!==void 0){if(w===!1){S();return}_()}},[w]);function C(){l&&l()}function R(k){Re(!1,`${k}`),o&&o(k)}const T=B.useMemo(()=>h.getViewport({scale:g,rotation:f}),[h,f,g]);return B.useEffect(function(){if(!d||!h||!i||!w)return;const{current:I}=x;if(!I)return;const D=T.clone({dontFlip:!0}),N={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:I,l10n:null,page:h,structTreeLayer:null,viewport:D},Y={annotations:w,annotationStorage:d.annotationStorage,div:I,imageResourcesPath:s,linkService:i,page:h,renderForms:u,viewport:D};I.innerHTML="";try{new Df(N).render(Y),C()}catch(q){R(q)}return()=>{}},[w,s,i,h,d,u,T]),P.jsx("div",{className:Ld("react-pdf__Page__annotations","annotationLayer"),ref:x})}const fb={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},Zv=/^H(\d+)$/;function Qv(c){return c in fb}function Fd(c){return"children"in c}function pb(c){return Fd(c)?c.children.length===1&&0 in c.children&&"id"in c.children[0]:!1}function tw(c){const t={};if(Fd(c)){const{role:e}=c,s=e.match(Zv);if(s)t.role="heading",t["aria-level"]=Number(s[1]);else if(Qv(e)){const i=fb[e];i&&(t.role=i)}}return t}function gb(c){const t={};if(Fd(c)){if(c.alt!==void 0&&(t["aria-label"]=c.alt),c.lang!==void 0&&(t.lang=c.lang),pb(c)){const[e]=c.children;if(e){const s=gb(e);return{...t,...s}}}}else"id"in c&&(t["aria-owns"]=c.id);return t}function ew(c){return c?{...tw(c),...gb(c)}:null}function mb({className:c,node:t}){const e=B.useMemo(()=>ew(t),[t]),s=B.useMemo(()=>!Fd(t)||pb(t)?null:t.children.map((i,n)=>P.jsx(mb,{node:i},n)),[t]);return P.jsx("span",{className:c,...e,children:s})}function sw(){const c=Nd();Ct(c,"Unable to find Page context.");const{onGetStructTreeError:t,onGetStructTreeSuccess:e}=c,[s,i]=Wo(),{value:n,error:a}=s,{customTextRenderer:o,page:l}=c;function h(){n&&e&&e(n)}function d(){a&&(Re(!1,a.toString()),t&&t(a))}return B.useEffect(function(){i({type:"RESET"})},[i,l]),B.useEffect(function(){if(o||!l)return;const f=fh(l.getStructTree()),g=f;return f.promise.then(y=>{i({type:"RESOLVE",value:y})}).catch(y=>{i({type:"REJECT",error:y})}),()=>ba(g)},[o,l,i]),B.useEffect(()=>{if(n!==void 0){if(n===!1){d();return}h()}},[n]),n?P.jsx(mb,{className:"react-pdf__Page__structTree structTree",node:n}):null}const Tp=gi;function iw(c){const t=Nd();Ct(t,"Unable to find Page context.");const e={...t,...c},{_className:s,canvasBackground:i,devicePixelRatio:n=Vv(),onRenderError:a,onRenderSuccess:o,page:l,renderForms:h,renderTextLayer:d,rotate:u,scale:f}=e,{canvasRef:g}=c;Ct(l,"Attempted to render page canvas, but no page was specified.");const y=B.useRef(null);function v(){l&&o&&o(vf(l,f))}function w(S){Wv(S)||(Re(!1,S.toString()),a&&a(S))}const A=B.useMemo(()=>l.getViewport({scale:f*n,rotation:u}),[n,l,u,f]),x=B.useMemo(()=>l.getViewport({scale:f,rotation:u}),[l,u,f]);B.useEffect(function(){if(!l)return;l.cleanup();const{current:C}=y;if(!C)return;C.width=A.width,C.height=A.height,C.style.width=`${Math.floor(x.width)}px`,C.style.height=`${Math.floor(x.height)}px`,C.style.visibility="hidden";const R={annotationMode:h?Tp.ENABLE_FORMS:Tp.ENABLE,canvasContext:C.getContext("2d",{alpha:!1}),viewport:A};i&&(R.background=i);const T=l.render(R),k=T;return T.promise.then(()=>{C.style.visibility="",v()}).catch(w),()=>ba(k)},[i,l,h,A,x]);const _=B.useCallback(()=>{const{current:S}=y;S&&(S.width=0,S.height=0)},[]);return B.useEffect(()=>_,[_]),P.jsx("canvas",{className:`${s}__canvas`,dir:"ltr",ref:db(g,y),style:{display:"block",userSelect:"none"},children:d?P.jsx(sw,{}):null})}function nw(c){return"str"in c}function rw(){const c=Nd();Ct(c,"Unable to find Page context.");const{customTextRenderer:t,onGetTextError:e,onGetTextSuccess:s,onRenderTextLayerError:i,onRenderTextLayerSuccess:n,page:a,pageIndex:o,pageNumber:l,rotate:h,scale:d}=c;Ct(a,"Attempted to load page text content, but no page was specified.");const[u,f]=Wo(),{value:g,error:y}=u,v=B.useRef(null);Re(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function w(){g&&s&&s(g)}function A(){y&&(Re(!1,y.toString()),e&&e(y))}B.useEffect(function(){f({type:"RESET"})},[a,f]),B.useEffect(function(){if(!a)return;const k=fh(a.getTextContent()),I=k;return k.promise.then(D=>{f({type:"RESOLVE",value:D})}).catch(D=>{f({type:"REJECT",error:D})}),()=>ba(I)},[a,f]),B.useEffect(()=>{if(g!==void 0){if(g===!1){A();return}w()}},[g]);const x=B.useCallback(()=>{n&&n()},[n]),_=B.useCallback(T=>{Re(!1,T.toString()),i&&i(T)},[i]);function S(){const T=v.current;T&&T.classList.add("selecting")}function C(){const T=v.current;T&&T.classList.remove("selecting")}const R=B.useMemo(()=>a.getViewport({scale:d,rotation:h}),[a,h,d]);return B.useLayoutEffect(function(){if(!a||!g)return;const{current:k}=v;if(!k)return;k.innerHTML="";const I=a.streamTextContent({includeMarkedContent:!0}),D={container:k,textContentSource:I,viewport:R},N=new Rl(D),Y=N;return N.render().then(()=>{const q=document.createElement("div");q.className="endOfContent",k.append(q);const H=k.querySelectorAll('[role="presentation"]');if(t){let st=0;g.items.forEach((F,O)=>{if(!nw(F))return;const yt=H[st];if(!yt)return;const Tt=t({pageIndex:o,pageNumber:l,itemIndex:O,...F});yt.innerHTML=Tt,st+=F.str&&F.hasEOL?2:1})}x()}).catch(_),()=>ba(Y)},[t,_,x,a,o,l,g,R]),P.jsx("div",{className:Ld("react-pdf__Page__textContent","textLayer"),onMouseUp:C,onMouseDown:S,ref:v})}const Rp=1;function aw(c){const e={...hb(),...c},{_className:s="react-pdf__Page",_enableRegisterUnregisterPage:i=!0,canvasBackground:n,canvasRef:a,children:o,className:l,customRenderer:h,customTextRenderer:d,devicePixelRatio:u,error:f="Failed to load the page.",height:g,inputRef:y,loading:v="Loading page…",noData:w="No page specified.",onGetAnnotationsError:A,onGetAnnotationsSuccess:x,onGetStructTreeError:_,onGetStructTreeSuccess:S,onGetTextError:C,onGetTextSuccess:R,onLoadError:T,onLoadSuccess:k,onRenderAnnotationLayerError:I,onRenderAnnotationLayerSuccess:D,onRenderError:N,onRenderSuccess:Y,onRenderTextLayerError:q,onRenderTextLayerSuccess:H,pageIndex:st,pageNumber:F,pdf:O,registerPage:yt,renderAnnotationLayer:Tt=!0,renderForms:zt=!1,renderMode:mt="canvas",renderTextLayer:_t=!0,rotate:ft,scale:we=Rp,unregisterPage:Ae,width:te,...dt}=e,[Pe,ke]=Wo(),{value:vt,error:Ps}=Pe,ps=B.useRef(null);Ct(O,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");const ot=tr(F)?F-1:st??null,Rt=F??(tr(st)?st+1:null),It=ft??(vt?vt.rotate:null),Mt=B.useMemo(()=>{if(!vt)return null;let ks=1;const ln=we??Rp;if(te||g){const Is=vt.getViewport({scale:1,rotation:It});te?ks=te/Is.width:g&&(ks=g/Is.height)}return ln*ks},[g,vt,It,we,te]);B.useEffect(function(){return()=>{tr(ot)&&i&&Ae&&Ae(ot)}},[i,O,ot,Ae]);function yi(){if(k){if(!vt||!Mt)return;k(vf(vt,Mt))}if(i&&yt){if(!tr(ot)||!ps.current)return;yt(ot,ps.current)}}function an(){Ps&&(Re(!1,Ps.toString()),T&&T(Ps))}B.useEffect(function(){ke({type:"RESET"})},[ke,O,ot]),B.useEffect(function(){if(!O||!Rt)return;const ln=fh(O.getPage(Rt)),Is=ln;return ln.promise.then(xa=>{ke({type:"RESOLVE",value:xa})}).catch(xa=>{ke({type:"REJECT",error:xa})}),()=>ba(Is)},[ke,O,Rt]),B.useEffect(()=>{if(vt!==void 0){if(vt===!1){an();return}yi()}},[vt,Mt]);const on=B.useMemo(()=>tr(ot)&&Rt&&tr(It)&&tr(Mt)?{_className:s,canvasBackground:n,customTextRenderer:d,devicePixelRatio:u,onGetAnnotationsError:A,onGetAnnotationsSuccess:x,onGetStructTreeError:_,onGetStructTreeSuccess:S,onGetTextError:C,onGetTextSuccess:R,onRenderAnnotationLayerError:I,onRenderAnnotationLayerSuccess:D,onRenderError:N,onRenderSuccess:Y,onRenderTextLayerError:q,onRenderTextLayerSuccess:H,page:vt,pageIndex:ot,pageNumber:Rt,renderForms:zt,renderTextLayer:_t,rotate:It,scale:Mt}:null,[s,n,d,u,A,x,_,S,C,R,I,D,N,Y,q,H,vt,ot,Rt,zt,_t,It,Mt]),Od=B.useMemo(()=>rb(dt,()=>vt&&(Mt?vf(vt,Mt):void 0)),[dt,vt,Mt]),Aa=`${ot}@${Mt}/${It}`;function Yo(){switch(mt){case"custom":return Ct(h,'renderMode was set to "custom", but no customRenderer was passed.'),P.jsx(h,{},`${Aa}_custom`);case"none":return null;case"canvas":default:return P.jsx(iw,{canvasRef:a},`${Aa}_canvas`)}}function Bd(){return _t?P.jsx(rw,{},`${Aa}_text`):null}function jd(){return Tt?P.jsx(Jv,{},`${Aa}_annotations`):null}function ph(){function ks(Is){return!!(Is!=null&&Is.page)}if(!ks(on))throw new Error("page is undefined");const ln=typeof o=="function"?o(on):o;return P.jsxs(ub.Provider,{value:on,children:[Yo(),Bd(),jd(),ln]})}function gh(){return Rt?O===null||vt===void 0||vt===null?P.jsx(Oa,{type:"loading",children:typeof v=="function"?v():v}):O===!1||vt===!1?P.jsx(Oa,{type:"error",children:typeof f=="function"?f():f}):ph():P.jsx(Oa,{type:"no-data",children:typeof w=="function"?w():w})}return P.jsx("div",{className:Ld(s,l),"data-page-number":Rt,ref:db(y,ps),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":`${Mt}`,"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:n||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"},...Od,children:gh()})}Uv();Ss.workerSrc="pdf.worker.mjs";Ss.workerSrc=`//unpkg.com/pdfjs-dist@${If}/build/pdf.worker.min.mjs`;const ow=({onClose:c,src:t,title:e="PDF Viewer",className:s})=>{const[i,n]=zp(),[a,o]=Gp(),[{currentPage:l,totalPages:h},d]=Up(),[{pan:u,isDragging:f},g]=Vp(),y=P.jsx(lt.IconButton,{variant:"text",color:"gray",children:P.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:P.jsx($p,{className:"size-4"})})});return P.jsxs("div",{className:ga("shadow rounded-t-lg flex flex-col h-full",s),children:[P.jsx(Hp.Header,{onClose:c,right:y,children:e}),P.jsxs("div",{className:"grid grow h-full overflow-hidden",children:[P.jsx("div",{className:ga("col-start-1 row-start-1 bg-gray-200 h-full overflow-hidden select-none p-8",f?"cursor-grabbing":"cursor-grab"),onMouseDown:g.handleMouseDown,onMouseMove:g.handleMouseMove,onMouseUp:g.handleMouseUp,onMouseLeave:g.handleMouseUp,style:{userSelect:"none"},children:P.jsx("div",{style:{transform:`translate(${u.x}px, ${u.y}px)`,transition:f?"none":"transform 0.1s",pointerEvents:"none"},children:P.jsx(Kv,{file:t,onLoadSuccess:({numPages:v})=>{d.setTotalPages(v)},scale:i/100,rotate:a,children:P.jsx(aw,{pageNumber:l,renderTextLayer:!0,renderAnnotationLayer:!0})})})}),P.jsxs("div",{className:"col-start-1 row-start-1 self-end p-4 flex gap-2 justify-between w-full z-10",children:[P.jsxs(lt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:n.zoomOut,children:P.jsx(_s.Icon,{icon:"lucide:minus"})}),P.jsx(lt.Tooltip,{content:"Click to reset zoom and pan",children:P.jsxs("button",{className:"!bg-white text-center cursor-pointer w-[60px]",onClick:()=>{n.reset(),g.reset()},children:[i,"%"]})}),P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:n.zoomIn,children:P.jsx(_s.Icon,{icon:"lucide:plus"})})]}),P.jsxs(lt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:o.rotateClockwise,children:P.jsx(_s.Icon,{icon:"lucide:iteration-cw"})}),P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:o.rotateCounterClockwise,children:P.jsx(_s.Icon,{icon:"lucide:iteration-ccw"})})]}),P.jsxs(lt.ButtonGroup,{className:"divide-x-0 ",children:[P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:d.prevPage,disabled:l===1,children:P.jsx(_s.Icon,{icon:"lucide:chevron-left"})}),P.jsx("input",{className:"bg-white pl-4 flex items-center w-[50px] text-center focus:outline-none w-[60px]",value:l,onChange:v=>{const w=parseInt(v.target.value);isNaN(w)||d.goToPage(w)},type:"number",min:"1",max:h}),P.jsxs("div",{className:"flex items-center bg-white px-2",children:["of ",h]}),P.jsx(lt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:d.nextPage,disabled:l===h,children:P.jsx(_s.Icon,{icon:"lucide:chevron-right"})})]})]})]})]})},lw=({...c})=>P.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",...c,children:[P.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.16699 7.7334C4.91574 7.73357 6.33301 9.1516 6.33301 10.9004C6.33283 12.3905 5.30337 13.6386 3.91699 13.9756V15.25C3.91685 15.664 3.58098 15.9998 3.16699 16C2.75287 16 2.41713 15.6641 2.41699 15.25V13.9756C1.0303 13.6387 0.000177983 12.3906 0 10.9004C0 9.15149 1.41809 7.7334 3.16699 7.7334ZM3.16699 9.2334C2.24652 9.2334 1.5 9.97992 1.5 10.9004C1.50021 11.8207 2.24665 12.5664 3.16699 12.5664C4.08719 12.5662 4.8328 11.8206 4.83301 10.9004C4.83301 9.98002 4.08732 9.23357 3.16699 9.2334Z",fill:"currentColor"}),P.jsx("path",{d:"M11.8662 9.66699C12.2804 9.66699 12.6162 10.0028 12.6162 10.417V15.25C12.616 15.6641 12.2803 16 11.8662 16C11.4523 15.9998 11.1164 15.6639 11.1162 15.25V10.417C11.1162 10.0029 11.4522 9.66722 11.8662 9.66699Z",fill:"currentColor"}),P.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.8662 0C12.2804 0 12.6162 0.335786 12.6162 0.75V2.02344C14.0032 2.36025 15.0332 3.60999 15.0332 5.10059C15.0329 6.84904 13.6157 8.26633 11.8672 8.2666C10.1185 8.2666 8.70052 6.84921 8.7002 5.10059C8.7002 3.6104 9.7297 2.36066 11.1162 2.02344V0.75C11.1162 0.335929 11.4522 0.000230806 11.8662 0ZM11.8672 3.43359C10.9467 3.43359 10.2002 4.18011 10.2002 5.10059C10.2005 6.02078 10.9469 6.7666 11.8672 6.7666C12.7872 6.76633 13.5329 6.02062 13.5332 5.10059C13.5332 4.18028 12.7874 3.43387 11.8672 3.43359Z",fill:"currentColor"}),P.jsx("path",{d:"M3.16699 0C3.58107 0.000164881 3.91699 0.335888 3.91699 0.75V5.58301C3.91699 5.99712 3.58107 6.33284 3.16699 6.33301C2.75278 6.33301 2.41699 5.99722 2.41699 5.58301V0.75C2.41699 0.335786 2.75278 0 3.16699 0Z",fill:"currentColor"})]}),cw=()=>P.jsxs(lt.Tabs,{className:"w-[800px]",children:[P.jsxs(lt.TabsHeader,{children:[P.jsx(lt.Tab,{value:"chats",children:"Chats"}),P.jsx(lt.Tab,{value:"issues",children:"Issues"}),P.jsx("button",{className:"cursor-pointer mb-2 ml-auto rounded p-1 hover:bg-gray-100",children:P.jsx(lw,{className:"size-4"})})]}),P.jsxs(lt.TabsBody,{children:[P.jsx(lt.TabPanel,{value:"chats",children:"ChatsPanel"}),P.jsx(lt.TabPanel,{value:"issues",children:"IssuesPanel"})]})]});exports.HelloWorld=zb;exports.ImageViewer=M0;exports.InputPrompt=A0;exports.PdfViewer=ow;exports.Sidebar=P0;exports.TabsContainer=cw;exports.materialTheme=Bb;exports.tailwindTheme=Ob;