@lateralus-ai/shipping-ui 1.4.8 → 1.4.9
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 +1 -1
- package/dist/index.esm.js +108 -102
- package/package.json +1 -1
- package/src/components/PdfViewer/ImageViewer.tsx +4 -2
package/dist/index.cjs
CHANGED
|
@@ -27,7 +27,7 @@ Check the top-level render call using <`+He+">.")}return Re}}function jn(Q,Re){{
|
|
|
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} />`,tu,_s,Qg,_s),Un[_s+tu]=!0}}return Q===r?Zi(Ut):mn(Ut),Ut}}function Wr(Q,Re,He){return sn(Q,Re,He,!0)}function ui(Q,Re,He){return sn(Q,Re,He,!1)}var Uc=ui,Es=Wr;Wc.Fragment=r,Wc.jsx=Uc,Wc.jsxs=Es}()),Wc}process.env.NODE_ENV==="production"?r0.exports=NE():r0.exports=ME();var ve=r0.exports;const LE=()=>ve.jsx("div",{className:"bg-red-800 text-white p-2",children:"Hello world"});function OE(){for(var i=0,e,t,r="";i<arguments.length;)(e=arguments[i++])&&(t=U2(e))&&(r&&(r+=" "),r+=t);return r}function U2(i){if(typeof i=="string")return i;for(var e,t="",r=0;r<i.length;r++)i[r]&&(e=U2(i[r]))&&(t&&(t+=" "),t+=e);return t}var Db="-";function FE(i){var e=zE(i);function t(n){var s=n.split(Db);return s[0]===""&&s.length!==1&&s.shift(),H2(s,e)||BE(n)}function r(n){return i.conflictingClassGroups[n]||[]}return{getClassGroupId:t,getConflictingClassGroupIds:r}}function H2(i,e){var a;if(i.length===0)return e.classGroupId;var t=i[0],r=e.nextPart.get(t),n=r?H2(i.slice(1),r):void 0;if(n)return n;if(e.validators.length!==0){var s=i.join(Db);return(a=e.validators.find(function(o){var l=o.validator;return l(s)}))==null?void 0:a.classGroupId}}var Gv=/^\[(.+)\]$/;function BE(i){if(Gv.test(i)){var e=Gv.exec(i)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}}function zE(i){var e=i.theme,t=i.prefix,r={nextPart:new Map,validators:[]},n=UE(Object.entries(i.classGroups),t);return n.forEach(function(s){var a=s[0],o=s[1];n0(o,r,a,e)}),r}function n0(i,e,t,r){i.forEach(function(n){if(typeof n=="string"){var s=n===""?e:Wv(e,n);s.classGroupId=t;return}if(typeof n=="function"){if(jE(n)){n0(n(r),e,t,r);return}e.validators.push({validator:n,classGroupId:t});return}Object.entries(n).forEach(function(a){var o=a[0],l=a[1];n0(l,Wv(e,o),t,r)})})}function Wv(i,e){var t=i;return e.split(Db).forEach(function(r){t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t}function jE(i){return i.isThemeGetter}function UE(i,e){return e?i.map(function(t){var r=t[0],n=t[1],s=n.map(function(a){return typeof a=="string"?e+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(function(o){var l=o[0],c=o[1];return[e+l,c]})):a});return[r,s]}):i}function HE(i){if(i<1)return{get:function(){},set:function(){}};var e=0,t=new Map,r=new Map;function n(s,a){t.set(s,a),e++,e>i&&(e=0,r=t,t=new Map)}return{get:function(a){var o=t.get(a);if(o!==void 0)return o;if((o=r.get(a))!==void 0)return n(a,o),o},set:function(a,o){t.has(a)?t.set(a,o):n(a,o)}}}var $2="!";function $E(i){var e=i.separator||":";return function(r){for(var n=0,s=[],a=0,o=0;o<r.length;o++){var l=r[o];n===0&&l===e[0]&&(e.length===1||r.slice(o,o+e.length)===e)&&(s.push(r.slice(a,o)),a=o+e.length),l==="["?n++:l==="]"&&n--}var c=s.length===0?r:r.substring(a),h=c.startsWith($2),d=h?c.substring(1):c;return{modifiers:s,hasImportantModifier:h,baseClassName:d}}}function VE(i){if(i.length<=1)return i;var e=[],t=[];return i.forEach(function(r){var n=r[0]==="[";n?(e.push.apply(e,t.sort().concat([r])),t=[]):t.push(r)}),e.push.apply(e,t.sort()),e}function qE(i){return{cache:HE(i.cacheSize),splitModifiers:$E(i),...FE(i)}}var GE=/\s+/;function WE(i,e){var t=e.splitModifiers,r=e.getClassGroupId,n=e.getConflictingClassGroupIds,s=new Set;return i.trim().split(GE).map(function(a){var o=t(a),l=o.modifiers,c=o.hasImportantModifier,h=o.baseClassName,d=r(h);if(!d)return{isTailwindClass:!1,originalClassName:a};var p=VE(l).join(":"),g=c?p+$2:p;return{isTailwindClass:!0,modifierId:g,classGroupId:d,originalClassName:a}}).reverse().filter(function(a){if(!a.isTailwindClass)return!0;var o=a.modifierId,l=a.classGroupId,c=o+l;return s.has(c)?!1:(s.add(c),n(l).forEach(function(h){return s.add(o+h)}),!0)}).reverse().map(function(a){return a.originalClassName}).join(" ")}function XE(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];var r,n,s,a=o;function o(c){var h=e[0],d=e.slice(1),p=d.reduce(function(g,y){return y(g)},h());return r=qE(p),n=r.cache.get,s=r.cache.set,a=l,l(c)}function l(c){var h=n(c);if(h)return h;var d=WE(c,r);return s(c,d),d}return function(){return a(OE.apply(null,arguments))}}function sr(i){var e=function(r){return r[i]||[]};return e.isThemeGetter=!0,e}var V2=/^\[(?:([a-z-]+):)?(.+)\]$/i,YE=/^\d+\/\d+$/,ZE=new Set(["px","full","screen"]),KE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,QE=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh)/,JE=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function Di(i){return Sh(i)||ZE.has(i)||YE.test(i)||Co(i)}function Co(i){return Gl(i,"length",i_)}function e_(i){return Gl(i,"size",q2)}function t_(i){return Gl(i,"position",q2)}function r_(i){return Gl(i,"url",s_)}function hm(i){return Gl(i,"number",Sh)}function Sh(i){return!Number.isNaN(Number(i))}function Xc(i){return Xv(i)||Gl(i,"number",Xv)}function Sr(i){return V2.test(i)}function Yc(){return!0}function ma(i){return KE.test(i)}function n_(i){return Gl(i,"",a_)}function Gl(i,e,t){var r=V2.exec(i);return r?r[1]?r[1]===e:t(r[2]):!1}function i_(i){return QE.test(i)}function q2(){return!1}function s_(i){return i.startsWith("url(")}function Xv(i){return Number.isInteger(Number(i))}function a_(i){return JE.test(i)}function o_(){var i=sr("colors"),e=sr("spacing"),t=sr("blur"),r=sr("brightness"),n=sr("borderColor"),s=sr("borderRadius"),a=sr("borderSpacing"),o=sr("borderWidth"),l=sr("contrast"),c=sr("grayscale"),h=sr("hueRotate"),d=sr("invert"),p=sr("gap"),g=sr("gradientColorStops"),y=sr("inset"),b=sr("margin"),w=sr("opacity"),v=sr("padding"),A=sr("saturate"),E=sr("scale"),_=sr("sepia"),C=sr("skew"),I=sr("space"),k=sr("translate"),D=function(){return["auto","contain","none"]},R=function(){return["auto","hidden","clip","visible","scroll"]},z=function(){return["auto",e]},q=function(){return["",Di]},O=function(){return["auto",Sh,Sr]},X=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},S=function(){return["solid","dashed","dotted","double","none"]},J=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},Y=function(){return["start","end","center","between","around","evenly"]},W=function(){return["","0",Sr]},fe=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},K=function(){return[Sh,hm]},be=function(){return[Sh,Sr]};return{cacheSize:500,theme:{colors:[Yc],spacing:[Di],blur:["none","",ma,Co],brightness:K(),borderColor:[i],borderRadius:["none","","full",ma,Co],borderSpacing:[e],borderWidth:q(),contrast:K(),grayscale:W(),hueRotate:be(),invert:W(),gap:[e],gradientColorStops:[i],inset:z(),margin:z(),opacity:K(),padding:[e],saturate:K(),scale:K(),sepia:W(),skew:be(),space:[e],translate:[e]},classGroups:{aspect:[{aspect:["auto","square","video",Sr]}],container:["container"],columns:[{columns:[ma]}],"break-after":[{"break-after":fe()}],"break-before":[{"break-before":fe()}],"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(X(),[Sr])}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],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",Xc]}],basis:[{basis:[e]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Sr]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",Xc]}],"grid-cols":[{"grid-cols":[Yc]}],"col-start-end":[{col:["auto",{span:[Xc]},Sr]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[Yc]}],"row-start-end":[{row:["auto",{span:[Xc]},Sr]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Sr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Sr]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:Y()}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:[].concat(Y(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(Y(),["baseline","stretch"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[I]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[I]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",e]}],"min-w":[{"min-w":["min","max","fit",Di]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[ma]},ma,Co]}],h:[{h:[e,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",Di]}],"max-h":[{"max-h":[e,"min","max","fit"]}],"font-size":[{text:["base",ma,Co]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",hm]}],"font-family":[{font:[Yc]}],"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",Co]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Di]}],"list-style-type":[{list:["none","disc","decimal",Sr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[i]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[i]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(S(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",Di]}],"underline-offset":[{"underline-offset":["auto",Di]}],"text-decoration-color":[{decoration:[i]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:[e]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Co]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap"]}],break:[{break:["normal","words","all","keep"]}],content:[{content:["none",Sr]}],"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(X(),[t_])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",e_]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},r_]}],"bg-color":[{bg:[i]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"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(S(),["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:S()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:[""].concat(S())}],"outline-offset":[{"outline-offset":[Di]}],"outline-w":[{outline:[Di]}],"outline-color":[{outline:[i]}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[i]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[Di]}],"ring-offset-color":[{"ring-offset":[i]}],shadow:[{shadow:["","inner","none",ma,n_]}],"shadow-color":[{shadow:[Yc]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":J()}],"bg-blend":[{"bg-blend":J()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",ma,Sr]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[d]}],saturate:[{saturate:[A]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[A]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"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",Sr]}],duration:[{duration:be()}],ease:[{ease:["linear","in","out","in-out",Sr]}],delay:[{delay:be()}],animate:[{animate:["none","spin","ping","pulse","bounce",Sr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[Xc,Sr]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"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",Sr]}],accent:[{accent:["auto",i]}],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",Sr]}],"caret-color":[{caret:[i]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":[e]}],"scroll-mx":[{"scroll-mx":[e]}],"scroll-my":[{"scroll-my":[e]}],"scroll-mt":[{"scroll-mt":[e]}],"scroll-mr":[{"scroll-mr":[e]}],"scroll-mb":[{"scroll-mb":[e]}],"scroll-ml":[{"scroll-ml":[e]}],"scroll-p":[{"scroll-p":[e]}],"scroll-px":[{"scroll-px":[e]}],"scroll-py":[{"scroll-py":[e]}],"scroll-pt":[{"scroll-pt":[e]}],"scroll-pr":[{"scroll-pr":[e]}],"scroll-pb":[{"scroll-pb":[e]}],"scroll-pl":[{"scroll-pl":[e]}],"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",Sr]}],fill:[{fill:[i,"none"]}],"stroke-w":[{stroke:[Di,hm]}],stroke:[{stroke:[i,"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 l_=XE(o_);function G2(i){var e,t,r="";if(typeof i=="string"||typeof i=="number")r+=i;else if(typeof i=="object")if(Array.isArray(i))for(e=0;e<i.length;e++)i[e]&&(t=G2(i[e]))&&(r&&(r+=" "),r+=t);else for(e in i)i[e]&&(r&&(r+=" "),r+=e);return r}function u_(){for(var i,e,t=0,r="";t<arguments.length;)(i=arguments[t++])&&(e=G2(i))&&(r&&(r+=" "),r+=e);return r}function so(...i){return l_(u_(i))}function c_({className:i="",size:e="1em"}){return ve.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:i,children:[ve.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"}),ve.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 h_({className:i="",size:e="1em"}){return ve.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:i,children:ve.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 d_=({tooltipContent:i="Send message",className:e,...t})=>{const[r,n]=Pe.useState(!1);return ve.jsx(Mt.Tooltip,{content:i,children:ve.jsx(Mt.IconButton,{variant:"text",color:"gray",className:so(e,"hover:rounded-lg hover:bg-gray-100"),type:"submit",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),...t,children:r?ve.jsx(h_,{className:"size-6 "}):ve.jsx(c_,{className:"size-6 "})})})},W2=({onSubmit:i=()=>{},...e})=>ve.jsx(PE,{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:t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),i())},...e}),f_=({bottom:i,right:e,top:t,textArea:r=ve.jsx(W2,{}),...n})=>ve.jsxs("div",{className:"border gap-2 rounded-lg bg-white shadow-[0px_2px_2px_0px_#0000000A,0px_8px_8px_-8px_#0000000A] border-gray-100",...n,children:[t,ve.jsxs("div",{className:"flex gap-2 p-4 rounded-lg bg-white",children:[ve.jsxs("div",{className:"grow flex flex-col items-start justify-center",children:[r,i]}),ve.jsx("div",{className:"shrink flex items-end justify-end",children:e})]})]}),p_=Object.freeze(Object.defineProperty({__proto__:null,Container:f_,SubmitButton:d_,Textarea:W2},Symbol.toStringTag,{value:"Module"})),Wl=Pe.createContext(void 0),X2=({children:i,isCollapsed:e,onSwitchLayout:t})=>{const[r,n]=Pe.useState(!1),[s,a]=Pe.useState(!1),o=e!==void 0?e:r,l=c=>{const h=c??!o;e===void 0&&n(h),t==null||t(h)};return ve.jsx(Wl.Provider,{value:{isCollapsed:o,toggleCollapsed:l,isHovered:s,setIsHovered:a},children:i})},Y2=({className:i,children:e,...t})=>{const{isCollapsed:r,isHovered:n,setIsHovered:s}=Pe.useContext(Wl);return ve.jsx("div",{className:so(i,r&&"shadow-lg rounded-lg",r&&!n?"w-auto":"w-[280px]","bg-gray-50 p-2 flex flex-col justify-between items-center rounded-tr-lg rounded-br-lg"),onMouseEnter:()=>r&&s(!0),onMouseLeave:()=>r&&s(!1),...t,children:e})},Z2=({className:i,children:e,...t})=>{const{isCollapsed:r,setIsHovered:n}=Pe.useContext(Wl);return ve.jsx("div",{className:so(i,r&&"!hidden","p-2 flex flex-col gap-2 items-center rounded-tl-lg rounded-bl-lg w-16"),onMouseEnter:()=>r&&n(!0),onMouseLeave:()=>r&&n(!1),...t,children:e})},g_=({className:i,children:e,isCollapsed:t,sideContainer:r,sideClassName:n,onSwitchLayout:s,...a})=>ve.jsxs(X2,{isCollapsed:t,onSwitchLayout:s,children:[r&&ve.jsx(Z2,{className:n,children:r}),ve.jsx(Y2,{className:i,...a,children:e})]}),m_=({icon:i,children:e,...t})=>{const{isCollapsed:r,isHovered:n}=Pe.useContext(Wl);return ve.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",...t,children:[i," ",(!r||n)&&e]})};function b_(i){return ve.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i,children:ve.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 v_(i){return ve.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i,children:ve.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 y_=()=>{const{isCollapsed:i,isHovered:e,toggleCollapsed:t}=Pe.useContext(Wl);return i&&!e?null:ve.jsx(Mt.IconButton,{variant:"text",color:"gray",onClick:()=>t(),children:i?ve.jsx(b_,{className:"size-4"}):ve.jsx(v_,{className:"size-4"})})},w_=({children:i,className:e,icon:t,isActive:r,trailing:n,...s})=>{const{isCollapsed:a,isHovered:o}=Pe.useContext(Wl);return ve.jsxs("div",{className:so(r?"!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",e),...s,children:[ve.jsxs("div",{className:"flex items-center gap-2",children:[t,(!a||o)&&i]}),(!a||o)&&n]})},x_=({children:i,className:e,isActive:t,trailing:r,icon:n,...s})=>{const{isCollapsed:a,isHovered:o}=Pe.useContext(Wl);return ve.jsxs("div",{className:so(t?"!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",e),...s,children:[ve.jsxs("div",{className:"flex items-center gap-2 overflow-auto",children:[(!a||o)&&n," ",(!a||o)&&i]}),(!a||o)&&r]})},A_=Object.freeze(Object.defineProperty({__proto__:null,Button:m_,Container:Y2,Item:w_,Layout:g_,Provider:X2,SecondaryItem:x_,SideContainer:Z2,ToggleCollapseButton:y_},Symbol.toStringTag,{value:"Module"})),E_=i=>ve.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i,children:ve.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"})}),__=({onClose:i,right:e,children:t})=>ve.jsxs("div",{className:"bg-gray-50 flex gap-2 items-center px-2 py-3 rounded-t-xl",children:[ve.jsx("div",{className:"grow text-subheader-em",children:t}),ve.jsxs("div",{className:"flex items-center gap-4",children:[e,ve.jsx(Mt.IconButton,{variant:"text",size:"sm",color:"gray",className:"rounded-full",onClick:i,children:ve.jsx(E_,{className:"size-4 text-gray-600"})})]})]}),K2={Header:__},Q2=i=>ve.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i,children:ve.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"})}),J2=(i=100,e=50,t=990,r=10)=>{const[n,s]=Pe.useState(i);return[n,{...{zoomIn:()=>s(l=>Math.min(l+r,t)),zoomOut:()=>s(l=>Math.max(l-r,e)),reset:()=>s(i),zoomToValue:l=>s(Math.max(e,Math.min(l,t)))},handleWheel:l=>{l.preventDefault();const c=l.deltaY>0?-r:r;s(h=>Math.max(e,Math.min(h+c,t)))}}]},e1=()=>{const[i,e]=Pe.useState(0);return[i,{rotateClockwise:()=>e(r=>(r+90)%360),rotateCounterClockwise:()=>e(r=>(r-90+360)%360)}]},t1=()=>{const[i,e]=Pe.useState({x:0,y:0}),[t,r]=Pe.useState(!1),[n,s]=Pe.useState({x:0,y:0});return[{pan:i,isDragging:t},{handleMouseDown:h=>{r(!0),s({x:h.clientX-i.x,y:h.clientY-i.y})},handleMouseMove:h=>{t&&e({x:h.clientX-n.x,y:h.clientY-n.y})},handleMouseUp:()=>{r(!1)},reset:()=>e({x:0,y:0})}]},r1=(i=0)=>{const[e,t]=Pe.useState(1),[r,n]=Pe.useState(i),s={nextPage:Pe.useCallback(()=>{t(a=>a<r?a+1:a)},[r]),prevPage:Pe.useCallback(()=>{t(a=>Math.max(a-1,1))},[]),goToPage:Pe.useCallback(a=>{t(()=>Math.max(1,Math.min(a,r)))},[r]),setTotalPages:Pe.useCallback(a=>{n(a),t(o=>Math.min(o,a))},[])};return[{currentPage:e,totalPages:r},s]},C_=({className:i,canvasClassName:e,onClose:t,totalPages:r,getImageSrc:n,documentUrl:s,title:a="PDF Viewer"})=>{const[o,l]=J2(),[c,h]=e1(),[{pan:d,isDragging:p},g]=t1(),[{currentPage:y},b]=r1(r),[w,v]=Pe.useState(()=>{const E=n(y);return typeof E=="string"?E:""});Pe.useEffect(()=>{let E=!0;return(async()=>{const C=n(y),I=await Promise.resolve(C);E&&v(I)})(),()=>{E=!1}},[y,n]);const A=ve.jsx(Mt.IconButton,{variant:"text",color:"gray",children:ve.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",children:ve.jsx(Q2,{className:"size-4"})})});return ve.jsxs("div",{className:so("shadow rounded-t-lg flex flex-col h-full",i),children:[ve.jsx(K2.Header,{onClose:t,right:A,children:a}),ve.jsx("div",{className:"flex flex-col h-full justify-between",children:ve.jsxs("div",{className:"grid relative h-full",children:[ve.jsx("div",{className:`${e} 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:ve.jsx("div",{style:{transform:`translate(${d.x}px, ${d.y}px)`,cursor:p?"grabbing":"grab",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},onMouseDown:g.handleMouseDown,children:ve.jsx("div",{style:{transform:`scale(${o/100}) rotate(${c}deg)`,transformOrigin:"center",transition:p?"none":"transform 0.3s ease"},children:w?ve.jsx("img",{src:w,style:{userSelect:"none",pointerEvents:"none"}}):null})})}),ve.jsxs("div",{className:"col-start-1 row-start-1 self-end p-4 flex gap-2 justify-between w-full z-10",children:[ve.jsxs(Mt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[ve.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:l.zoomOut,children:ve.jsx(vi.Icon,{icon:"lucide:minus"})}),ve.jsx(Mt.Tooltip,{content:"Click to reset zoom and pan",children:ve.jsxs("button",{className:"!bg-white text-center cursor-pointer w-[60px]",onClick:()=>{l.reset(),g.reset()},children:[o,"%"]})}),ve.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:l.zoomIn,children:ve.jsx(vi.Icon,{icon:"lucide:plus"})})]}),ve.jsxs(Mt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[ve.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:h.rotateClockwise,children:ve.jsx(vi.Icon,{icon:"lucide:iteration-cw"})}),ve.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:h.rotateCounterClockwise,children:ve.jsx(vi.Icon,{icon:"lucide:iteration-ccw"})})]}),ve.jsxs(Mt.ButtonGroup,{className:"divide-x-0 ",children:[ve.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:b.prevPage,disabled:y===1,children:ve.jsx(vi.Icon,{icon:"lucide:chevron-left"})}),ve.jsx("input",{className:"bg-white pl-4 flex items-center w-[50px] text-center focus:outline-none w-[60px]",value:y,onChange:E=>{const _=parseInt(E.target.value);isNaN(_)||b.goToPage(_)},type:"number",min:"1",max:r}),ve.jsxs("div",{className:"flex items-center bg-white px-2",children:["of ",r]}),ve.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:b.nextPage,disabled:y===r,children:ve.jsx(vi.Icon,{icon:"lucide:chevron-right"})})]})]})]})})]})},_n=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),i0=[.001,0,0,.001,0,0],dm=1.35,ii={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},vs={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},n1="pdfjs_internal_editor_",ot={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,SIGNATURE:101},kt={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},i1={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},on={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Th={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},wr={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},au={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Cf={ERRORS:0,WARNINGS:1,INFOS:5},Ph={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},Jf={moveTo:0,lineTo:1,curveTo:2,closePath:3},s1={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Sg=Cf.WARNINGS;function S_(i){Number.isInteger(i)&&(Sg=i)}function T_(){return Sg}function Tg(i){Sg>=Cf.INFOS&&console.log(`Info: ${i}`)}function ut(i){Sg>=Cf.WARNINGS&&console.log(`Warning: ${i}`)}function Wt(i){throw new Error(i)}function Dr(i,e){i||Wt(e)}function k_(i){switch(i==null?void 0:i.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Pb(i,e=null,t=null){if(!i)return null;if(t&&typeof i=="string"){if(t.addDefaultProtocol&&i.startsWith("www.")){const n=i.match(/\./g);(n==null?void 0:n.length)>=2&&(i=`http://${i}`)}if(t.tryConvertEncoding)try{i=N_(i)}catch{}}const r=e?URL.parse(i,e):URL.parse(i);return k_(r)?r:null}function Rb(i,e,t=!1){const r=URL.parse(i);return r?(r.hash=e,r.href):t&&Pb(i,"http://example.com")?i.split("#",1)[0]+`${e?`#${e}`:""}`:""}function Ct(i,e,t,r=!1){return Object.defineProperty(i,e,{value:t,enumerable:!r,configurable:!0,writable:!1}),t}const Xl=function(){function e(t,r){this.message=t,this.name=r}return e.prototype=new Error,e.constructor=e,e}();class Yv extends Xl{constructor(e,t){super(e,"PasswordException"),this.code=t}}class fm extends Xl{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class Xp extends Xl{constructor(e){super(e,"InvalidPDFException")}}class Rh extends Xl{constructor(e,t,r){super(e,"ResponseException"),this.status=t,this.missing=r}}class D_ extends Xl{constructor(e){super(e,"FormatError")}}class ha extends Xl{constructor(e){super(e,"AbortException")}}function a1(i){(typeof i!="object"||(i==null?void 0:i.length)===void 0)&&Wt("Invalid argument for bytesToString");const e=i.length,t=8192;if(e<t)return String.fromCharCode.apply(null,i);const r=[];for(let n=0;n<e;n+=t){const s=Math.min(n+t,e),a=i.subarray(n,s);r.push(String.fromCharCode.apply(null,a))}return r.join("")}function Sf(i){typeof i!="string"&&Wt("Invalid argument for stringToBytes");const e=i.length,t=new Uint8Array(e);for(let r=0;r<e;++r)t[r]=i.charCodeAt(r)&255;return t}function P_(i){return String.fromCharCode(i>>24&255,i>>16&255,i>>8&255,i&255)}function R_(){const i=new Uint8Array(4);return i[0]=1,new Uint32Array(i.buffer,0,1)[0]===1}function I_(){try{return new Function(""),!0}catch{return!1}}class Gr{static get isLittleEndian(){return Ct(this,"isLittleEndian",R_())}static get isEvalSupported(){return Ct(this,"isEvalSupported",I_())}static get isOffscreenCanvasSupported(){return Ct(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Ct(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:e,userAgent:t}=navigator;return Ct(this,"platform",{isAndroid:t.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:t.includes("Firefox")})}static get isCSSRoundSupported(){var e,t;return Ct(this,"isCSSRoundSupported",(t=(e=globalThis.CSS)==null?void 0:e.supports)==null?void 0:t.call(e,"width: round(1.5px, 1px)"))}}const pm=Array.from(Array(256).keys(),i=>i.toString(16).padStart(2,"0"));var ua,gp,s0;class Qe{static makeHexColor(e,t,r){return`#${pm[e]}${pm[t]}${pm[r]}`}static scaleMinMax(e,t){let r;e[0]?(e[0]<0&&(r=t[0],t[0]=t[2],t[2]=r),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(r=t[1],t[1]=t[3],t[3]=r),t[1]*=e[3],t[3]*=e[3]):(r=t[0],t[0]=t[1],t[1]=r,r=t[2],t[2]=t[3],t[3]=r,e[1]<0&&(r=t[1],t[1]=t[3],t[3]=r),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(r=t[0],t[0]=t[2],t[2]=r),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t,r=0){const n=e[r],s=e[r+1];e[r]=n*t[0]+s*t[2]+t[4],e[r+1]=n*t[1]+s*t[3]+t[5]}static applyTransformToBezier(e,t,r=0){const n=t[0],s=t[1],a=t[2],o=t[3],l=t[4],c=t[5];for(let h=0;h<6;h+=2){const d=e[r+h],p=e[r+h+1];e[r+h]=d*n+p*a+l,e[r+h+1]=d*s+p*o+c}}static applyInverseTransform(e,t){const r=e[0],n=e[1],s=t[0]*t[3]-t[1]*t[2];e[0]=(r*t[3]-n*t[2]+t[2]*t[5]-t[4]*t[3])/s,e[1]=(-r*t[1]+n*t[0]+t[4]*t[1]-t[5]*t[0])/s}static axialAlignedBoundingBox(e,t,r){const n=t[0],s=t[1],a=t[2],o=t[3],l=t[4],c=t[5],h=e[0],d=e[1],p=e[2],g=e[3];let y=n*h+l,b=y,w=n*p+l,v=w,A=o*d+c,E=A,_=o*g+c,C=_;if(s!==0||a!==0){const I=s*h,k=s*p,D=a*d,R=a*g;y+=D,v+=D,w+=R,b+=R,A+=I,C+=I,_+=k,E+=k}r[0]=Math.min(r[0],y,w,b,v),r[1]=Math.min(r[1],A,_,E,C),r[2]=Math.max(r[2],y,w,b,v),r[3]=Math.max(r[3],A,_,E,C)}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){const r=e[0],n=e[1],s=e[2],a=e[3],o=r**2+n**2,l=r*s+n*a,c=s**2+a**2,h=(o+c)/2,d=Math.sqrt(h**2-(o*c-l**2));t[0]=Math.sqrt(h+d||1),t[1]=Math.sqrt(h-d||1)}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const r=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),n=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(r>n)return null;const s=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return s>a?null:[r,s,n,a]}static pointBoundingBox(e,t,r){r[0]=Math.min(r[0],e),r[1]=Math.min(r[1],t),r[2]=Math.max(r[2],e),r[3]=Math.max(r[3],t)}static rectBoundingBox(e,t,r,n,s){s[0]=Math.min(s[0],e,r),s[1]=Math.min(s[1],t,n),s[2]=Math.max(s[2],e,r),s[3]=Math.max(s[3],t,n)}static bezierBoundingBox(e,t,r,n,s,a,o,l,c){c[0]=Math.min(c[0],e,o),c[1]=Math.min(c[1],t,l),c[2]=Math.max(c[2],e,o),c[3]=Math.max(c[3],t,l),L(this,ua,s0).call(this,e,r,s,o,t,n,a,l,3*(-e+3*(r-s)+o),6*(e-2*r+s),3*(r-e),c),L(this,ua,s0).call(this,e,r,s,o,t,n,a,l,3*(-t+3*(n-a)+l),6*(t-2*n+a),3*(n-t),c)}}ua=new WeakSet,gp=function(e,t,r,n,s,a,o,l,c,h){if(c<=0||c>=1)return;const d=1-c,p=c*c,g=p*c,y=d*(d*(d*e+3*c*t)+3*p*r)+g*n,b=d*(d*(d*s+3*c*a)+3*p*o)+g*l;h[0]=Math.min(h[0],y),h[1]=Math.min(h[1],b),h[2]=Math.max(h[2],y),h[3]=Math.max(h[3],b)},s0=function(e,t,r,n,s,a,o,l,c,h,d,p){if(Math.abs(c)<1e-12){Math.abs(h)>=1e-12&&L(this,ua,gp).call(this,e,t,r,n,s,a,o,l,-d/h,p);return}const g=h**2-4*d*c;if(g<0)return;const y=Math.sqrt(g),b=2*c;L(this,ua,gp).call(this,e,t,r,n,s,a,o,l,(-h+y)/b,p),L(this,ua,gp).call(this,e,t,r,n,s,a,o,l,(-h-y)/b,p)},N(Qe,ua);function N_(i){return decodeURIComponent(escape(i))}let gm=null,Zv=null;function o1(i){return gm||(gm=/([\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,Zv=new Map([["ſt","ſt"]])),i.replaceAll(gm,(e,t,r)=>t?t.normalize("NFKC"):Zv.get(r))}function Ib(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const i=new Uint8Array(32);return crypto.getRandomValues(i),a1(i)}const Nb="pdfjs_internal_id_";function M_(i,e,t){if(!Array.isArray(t)||t.length<2)return!1;const[r,n,...s]=t;if(!i(r)&&!Number.isInteger(r)||!e(n))return!1;const a=s.length;let o=!0;switch(n.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 s)if(!(typeof l=="number"||o&&l===null))return!1;return!0}function dn(i,e,t){return Math.min(Math.max(i,e),t)}function l1(i){return Uint8Array.prototype.toBase64?i.toBase64():btoa(a1(i))}function L_(i){return Uint8Array.fromBase64?Uint8Array.fromBase64(i):Sf(atob(i))}typeof Promise.try!="function"&&(Promise.try=function(i,...e){return new Promise(t=>{t(i(...e))})});typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(i){return i.reduce((e,t)=>e+t,0)});const Ts="http://www.w3.org/2000/svg",Do=class Do{};Ie(Do,"CSS",96),Ie(Do,"PDF",72),Ie(Do,"PDF_TO_CSS_UNITS",Do.CSS/Do.PDF);let da=Do;async function Mc(i,e="text"){if(ah(i,document.baseURI)){const t=await fetch(i);if(!t.ok)throw new Error(t.statusText);switch(e){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"json":return t.json()}return t.text()}return new Promise((t,r)=>{const n=new XMLHttpRequest;n.open("GET",i,!0),n.responseType=e,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE){if(n.status===200||n.status===0){switch(e){case"arraybuffer":case"blob":case"json":t(n.response);return}t(n.responseText);return}r(new Error(n.statusText))}},n.send(null)})}class Tf{constructor({viewBox:e,userUnit:t,scale:r,rotation:n,offsetX:s=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=e,this.userUnit=t,this.scale=r,this.rotation=n,this.offsetX=s,this.offsetY=a,r*=t;const l=(e[2]+e[0])/2,c=(e[3]+e[1])/2;let h,d,p,g;switch(n%=360,n<0&&(n+=360),n){case 180:h=-1,d=0,p=0,g=1;break;case 90:h=0,d=1,p=1,g=0;break;case 270:h=0,d=-1,p=-1,g=0;break;case 0:h=1,d=0,p=0,g=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(p=-p,g=-g);let y,b,w,v;h===0?(y=Math.abs(c-e[1])*r+s,b=Math.abs(l-e[0])*r+a,w=(e[3]-e[1])*r,v=(e[2]-e[0])*r):(y=Math.abs(l-e[0])*r+s,b=Math.abs(c-e[1])*r+a,w=(e[2]-e[0])*r,v=(e[3]-e[1])*r),this.transform=[h*r,d*r,p*r,g*r,y-h*r*l-p*r*c,b-d*r*l-g*r*c],this.width=w,this.height=v}get rawDims(){const e=this.viewBox;return Ct(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:r=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}={}){return new Tf({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:t,offsetX:r,offsetY:n,dontFlip:s})}convertToViewportPoint(e,t){const r=[e,t];return Qe.applyTransform(r,this.transform),r}convertToViewportRectangle(e){const t=[e[0],e[1]];Qe.applyTransform(t,this.transform);const r=[e[2],e[3]];return Qe.applyTransform(r,this.transform),[t[0],t[1],r[0],r[1]]}convertToPdfPoint(e,t){const r=[e,t];return Qe.applyInverseTransform(r,this.transform),r}}class kg extends Xl{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function kf(i){const e=i.length;let t=0;for(;t<e&&i[t].trim()==="";)t++;return i.substring(t,t+5).toLowerCase()==="data:"}function Dg(i){return typeof i=="string"&&/\.pdf$/i.test(i)}function u1(i){return[i]=i.split(/[#?]/,1),i.substring(i.lastIndexOf("/")+1)}function c1(i,e="document.pdf"){if(typeof i!="string")return e;if(kf(i))return ut('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const r=(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}}}}})(i);if(!r)return e;const n=o=>{try{let l=decodeURIComponent(o);return l.includes("/")?(l=l.split("/").at(-1),l.test(/^\.pdf$/i)?l:o):l}catch{return o}},s=/\.pdf$/i,a=r.pathname.split("/").at(-1);if(s.test(a))return n(a);if(r.searchParams.size>0){const o=Array.from(r.searchParams.values()).reverse();for(const c of o)if(s.test(c))return n(c);const l=Array.from(r.searchParams.keys()).reverse();for(const c of l)if(s.test(c))return n(c)}if(r.hash){const l=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(r.hash);if(l)return n(l[0])}return e}class Kv{constructor(){Ie(this,"started",Object.create(null));Ie(this,"times",[])}time(e){e in this.started&&ut(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||ut(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const{name:r}of this.times)t=Math.max(r.length,t);for(const{name:r,start:n,end:s}of this.times)e.push(`${r.padEnd(t)} ${s-n}ms
|
|
30
|
+
<%s key={someKey} {...props} />`,tu,_s,Qg,_s),Un[_s+tu]=!0}}return Q===r?Zi(Ut):mn(Ut),Ut}}function Wr(Q,Re,He){return sn(Q,Re,He,!0)}function ui(Q,Re,He){return sn(Q,Re,He,!1)}var Uc=ui,Es=Wr;Wc.Fragment=r,Wc.jsx=Uc,Wc.jsxs=Es}()),Wc}process.env.NODE_ENV==="production"?r0.exports=NE():r0.exports=ME();var ve=r0.exports;const LE=()=>ve.jsx("div",{className:"bg-red-800 text-white p-2",children:"Hello world"});function OE(){for(var i=0,e,t,r="";i<arguments.length;)(e=arguments[i++])&&(t=U2(e))&&(r&&(r+=" "),r+=t);return r}function U2(i){if(typeof i=="string")return i;for(var e,t="",r=0;r<i.length;r++)i[r]&&(e=U2(i[r]))&&(t&&(t+=" "),t+=e);return t}var Db="-";function FE(i){var e=zE(i);function t(n){var s=n.split(Db);return s[0]===""&&s.length!==1&&s.shift(),H2(s,e)||BE(n)}function r(n){return i.conflictingClassGroups[n]||[]}return{getClassGroupId:t,getConflictingClassGroupIds:r}}function H2(i,e){var a;if(i.length===0)return e.classGroupId;var t=i[0],r=e.nextPart.get(t),n=r?H2(i.slice(1),r):void 0;if(n)return n;if(e.validators.length!==0){var s=i.join(Db);return(a=e.validators.find(function(o){var l=o.validator;return l(s)}))==null?void 0:a.classGroupId}}var Gv=/^\[(.+)\]$/;function BE(i){if(Gv.test(i)){var e=Gv.exec(i)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}}function zE(i){var e=i.theme,t=i.prefix,r={nextPart:new Map,validators:[]},n=UE(Object.entries(i.classGroups),t);return n.forEach(function(s){var a=s[0],o=s[1];n0(o,r,a,e)}),r}function n0(i,e,t,r){i.forEach(function(n){if(typeof n=="string"){var s=n===""?e:Wv(e,n);s.classGroupId=t;return}if(typeof n=="function"){if(jE(n)){n0(n(r),e,t,r);return}e.validators.push({validator:n,classGroupId:t});return}Object.entries(n).forEach(function(a){var o=a[0],l=a[1];n0(l,Wv(e,o),t,r)})})}function Wv(i,e){var t=i;return e.split(Db).forEach(function(r){t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t}function jE(i){return i.isThemeGetter}function UE(i,e){return e?i.map(function(t){var r=t[0],n=t[1],s=n.map(function(a){return typeof a=="string"?e+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(function(o){var l=o[0],c=o[1];return[e+l,c]})):a});return[r,s]}):i}function HE(i){if(i<1)return{get:function(){},set:function(){}};var e=0,t=new Map,r=new Map;function n(s,a){t.set(s,a),e++,e>i&&(e=0,r=t,t=new Map)}return{get:function(a){var o=t.get(a);if(o!==void 0)return o;if((o=r.get(a))!==void 0)return n(a,o),o},set:function(a,o){t.has(a)?t.set(a,o):n(a,o)}}}var $2="!";function $E(i){var e=i.separator||":";return function(r){for(var n=0,s=[],a=0,o=0;o<r.length;o++){var l=r[o];n===0&&l===e[0]&&(e.length===1||r.slice(o,o+e.length)===e)&&(s.push(r.slice(a,o)),a=o+e.length),l==="["?n++:l==="]"&&n--}var c=s.length===0?r:r.substring(a),h=c.startsWith($2),d=h?c.substring(1):c;return{modifiers:s,hasImportantModifier:h,baseClassName:d}}}function VE(i){if(i.length<=1)return i;var e=[],t=[];return i.forEach(function(r){var n=r[0]==="[";n?(e.push.apply(e,t.sort().concat([r])),t=[]):t.push(r)}),e.push.apply(e,t.sort()),e}function qE(i){return{cache:HE(i.cacheSize),splitModifiers:$E(i),...FE(i)}}var GE=/\s+/;function WE(i,e){var t=e.splitModifiers,r=e.getClassGroupId,n=e.getConflictingClassGroupIds,s=new Set;return i.trim().split(GE).map(function(a){var o=t(a),l=o.modifiers,c=o.hasImportantModifier,h=o.baseClassName,d=r(h);if(!d)return{isTailwindClass:!1,originalClassName:a};var p=VE(l).join(":"),g=c?p+$2:p;return{isTailwindClass:!0,modifierId:g,classGroupId:d,originalClassName:a}}).reverse().filter(function(a){if(!a.isTailwindClass)return!0;var o=a.modifierId,l=a.classGroupId,c=o+l;return s.has(c)?!1:(s.add(c),n(l).forEach(function(h){return s.add(o+h)}),!0)}).reverse().map(function(a){return a.originalClassName}).join(" ")}function XE(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];var r,n,s,a=o;function o(c){var h=e[0],d=e.slice(1),p=d.reduce(function(g,y){return y(g)},h());return r=qE(p),n=r.cache.get,s=r.cache.set,a=l,l(c)}function l(c){var h=n(c);if(h)return h;var d=WE(c,r);return s(c,d),d}return function(){return a(OE.apply(null,arguments))}}function sr(i){var e=function(r){return r[i]||[]};return e.isThemeGetter=!0,e}var V2=/^\[(?:([a-z-]+):)?(.+)\]$/i,YE=/^\d+\/\d+$/,ZE=new Set(["px","full","screen"]),KE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,QE=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh)/,JE=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function Di(i){return Sh(i)||ZE.has(i)||YE.test(i)||Co(i)}function Co(i){return Gl(i,"length",i_)}function e_(i){return Gl(i,"size",q2)}function t_(i){return Gl(i,"position",q2)}function r_(i){return Gl(i,"url",s_)}function hm(i){return Gl(i,"number",Sh)}function Sh(i){return!Number.isNaN(Number(i))}function Xc(i){return Xv(i)||Gl(i,"number",Xv)}function Sr(i){return V2.test(i)}function Yc(){return!0}function ma(i){return KE.test(i)}function n_(i){return Gl(i,"",a_)}function Gl(i,e,t){var r=V2.exec(i);return r?r[1]?r[1]===e:t(r[2]):!1}function i_(i){return QE.test(i)}function q2(){return!1}function s_(i){return i.startsWith("url(")}function Xv(i){return Number.isInteger(Number(i))}function a_(i){return JE.test(i)}function o_(){var i=sr("colors"),e=sr("spacing"),t=sr("blur"),r=sr("brightness"),n=sr("borderColor"),s=sr("borderRadius"),a=sr("borderSpacing"),o=sr("borderWidth"),l=sr("contrast"),c=sr("grayscale"),h=sr("hueRotate"),d=sr("invert"),p=sr("gap"),g=sr("gradientColorStops"),y=sr("inset"),b=sr("margin"),w=sr("opacity"),v=sr("padding"),A=sr("saturate"),E=sr("scale"),_=sr("sepia"),C=sr("skew"),I=sr("space"),k=sr("translate"),D=function(){return["auto","contain","none"]},R=function(){return["auto","hidden","clip","visible","scroll"]},z=function(){return["auto",e]},q=function(){return["",Di]},O=function(){return["auto",Sh,Sr]},X=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},S=function(){return["solid","dashed","dotted","double","none"]},J=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},Y=function(){return["start","end","center","between","around","evenly"]},W=function(){return["","0",Sr]},fe=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},K=function(){return[Sh,hm]},be=function(){return[Sh,Sr]};return{cacheSize:500,theme:{colors:[Yc],spacing:[Di],blur:["none","",ma,Co],brightness:K(),borderColor:[i],borderRadius:["none","","full",ma,Co],borderSpacing:[e],borderWidth:q(),contrast:K(),grayscale:W(),hueRotate:be(),invert:W(),gap:[e],gradientColorStops:[i],inset:z(),margin:z(),opacity:K(),padding:[e],saturate:K(),scale:K(),sepia:W(),skew:be(),space:[e],translate:[e]},classGroups:{aspect:[{aspect:["auto","square","video",Sr]}],container:["container"],columns:[{columns:[ma]}],"break-after":[{"break-after":fe()}],"break-before":[{"break-before":fe()}],"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(X(),[Sr])}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],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",Xc]}],basis:[{basis:[e]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Sr]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",Xc]}],"grid-cols":[{"grid-cols":[Yc]}],"col-start-end":[{col:["auto",{span:[Xc]},Sr]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[Yc]}],"row-start-end":[{row:["auto",{span:[Xc]},Sr]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Sr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Sr]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:Y()}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:[].concat(Y(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(Y(),["baseline","stretch"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[I]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[I]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",e]}],"min-w":[{"min-w":["min","max","fit",Di]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[ma]},ma,Co]}],h:[{h:[e,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",Di]}],"max-h":[{"max-h":[e,"min","max","fit"]}],"font-size":[{text:["base",ma,Co]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",hm]}],"font-family":[{font:[Yc]}],"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",Co]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Di]}],"list-style-type":[{list:["none","disc","decimal",Sr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[i]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[i]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(S(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",Di]}],"underline-offset":[{"underline-offset":["auto",Di]}],"text-decoration-color":[{decoration:[i]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:[e]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Co]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap"]}],break:[{break:["normal","words","all","keep"]}],content:[{content:["none",Sr]}],"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(X(),[t_])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",e_]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},r_]}],"bg-color":[{bg:[i]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"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(S(),["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:S()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:[""].concat(S())}],"outline-offset":[{"outline-offset":[Di]}],"outline-w":[{outline:[Di]}],"outline-color":[{outline:[i]}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[i]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[Di]}],"ring-offset-color":[{"ring-offset":[i]}],shadow:[{shadow:["","inner","none",ma,n_]}],"shadow-color":[{shadow:[Yc]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":J()}],"bg-blend":[{"bg-blend":J()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",ma,Sr]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[d]}],saturate:[{saturate:[A]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[A]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"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",Sr]}],duration:[{duration:be()}],ease:[{ease:["linear","in","out","in-out",Sr]}],delay:[{delay:be()}],animate:[{animate:["none","spin","ping","pulse","bounce",Sr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[Xc,Sr]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"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",Sr]}],accent:[{accent:["auto",i]}],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",Sr]}],"caret-color":[{caret:[i]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":[e]}],"scroll-mx":[{"scroll-mx":[e]}],"scroll-my":[{"scroll-my":[e]}],"scroll-mt":[{"scroll-mt":[e]}],"scroll-mr":[{"scroll-mr":[e]}],"scroll-mb":[{"scroll-mb":[e]}],"scroll-ml":[{"scroll-ml":[e]}],"scroll-p":[{"scroll-p":[e]}],"scroll-px":[{"scroll-px":[e]}],"scroll-py":[{"scroll-py":[e]}],"scroll-pt":[{"scroll-pt":[e]}],"scroll-pr":[{"scroll-pr":[e]}],"scroll-pb":[{"scroll-pb":[e]}],"scroll-pl":[{"scroll-pl":[e]}],"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",Sr]}],fill:[{fill:[i,"none"]}],"stroke-w":[{stroke:[Di,hm]}],stroke:[{stroke:[i,"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 l_=XE(o_);function G2(i){var e,t,r="";if(typeof i=="string"||typeof i=="number")r+=i;else if(typeof i=="object")if(Array.isArray(i))for(e=0;e<i.length;e++)i[e]&&(t=G2(i[e]))&&(r&&(r+=" "),r+=t);else for(e in i)i[e]&&(r&&(r+=" "),r+=e);return r}function u_(){for(var i,e,t=0,r="";t<arguments.length;)(i=arguments[t++])&&(e=G2(i))&&(r&&(r+=" "),r+=e);return r}function so(...i){return l_(u_(i))}function c_({className:i="",size:e="1em"}){return ve.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:i,children:[ve.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"}),ve.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 h_({className:i="",size:e="1em"}){return ve.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:i,children:ve.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 d_=({tooltipContent:i="Send message",className:e,...t})=>{const[r,n]=Pe.useState(!1);return ve.jsx(Mt.Tooltip,{content:i,children:ve.jsx(Mt.IconButton,{variant:"text",color:"gray",className:so(e,"hover:rounded-lg hover:bg-gray-100"),type:"submit",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),...t,children:r?ve.jsx(h_,{className:"size-6 "}):ve.jsx(c_,{className:"size-6 "})})})},W2=({onSubmit:i=()=>{},...e})=>ve.jsx(PE,{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:t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),i())},...e}),f_=({bottom:i,right:e,top:t,textArea:r=ve.jsx(W2,{}),...n})=>ve.jsxs("div",{className:"border gap-2 rounded-lg bg-white shadow-[0px_2px_2px_0px_#0000000A,0px_8px_8px_-8px_#0000000A] border-gray-100",...n,children:[t,ve.jsxs("div",{className:"flex gap-2 p-4 rounded-lg bg-white",children:[ve.jsxs("div",{className:"grow flex flex-col items-start justify-center",children:[r,i]}),ve.jsx("div",{className:"shrink flex items-end justify-end",children:e})]})]}),p_=Object.freeze(Object.defineProperty({__proto__:null,Container:f_,SubmitButton:d_,Textarea:W2},Symbol.toStringTag,{value:"Module"})),Wl=Pe.createContext(void 0),X2=({children:i,isCollapsed:e,onSwitchLayout:t})=>{const[r,n]=Pe.useState(!1),[s,a]=Pe.useState(!1),o=e!==void 0?e:r,l=c=>{const h=c??!o;e===void 0&&n(h),t==null||t(h)};return ve.jsx(Wl.Provider,{value:{isCollapsed:o,toggleCollapsed:l,isHovered:s,setIsHovered:a},children:i})},Y2=({className:i,children:e,...t})=>{const{isCollapsed:r,isHovered:n,setIsHovered:s}=Pe.useContext(Wl);return ve.jsx("div",{className:so(i,r&&"shadow-lg rounded-lg",r&&!n?"w-auto":"w-[280px]","bg-gray-50 p-2 flex flex-col justify-between items-center rounded-tr-lg rounded-br-lg"),onMouseEnter:()=>r&&s(!0),onMouseLeave:()=>r&&s(!1),...t,children:e})},Z2=({className:i,children:e,...t})=>{const{isCollapsed:r,setIsHovered:n}=Pe.useContext(Wl);return ve.jsx("div",{className:so(i,r&&"!hidden","p-2 flex flex-col gap-2 items-center rounded-tl-lg rounded-bl-lg w-16"),onMouseEnter:()=>r&&n(!0),onMouseLeave:()=>r&&n(!1),...t,children:e})},g_=({className:i,children:e,isCollapsed:t,sideContainer:r,sideClassName:n,onSwitchLayout:s,...a})=>ve.jsxs(X2,{isCollapsed:t,onSwitchLayout:s,children:[r&&ve.jsx(Z2,{className:n,children:r}),ve.jsx(Y2,{className:i,...a,children:e})]}),m_=({icon:i,children:e,...t})=>{const{isCollapsed:r,isHovered:n}=Pe.useContext(Wl);return ve.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",...t,children:[i," ",(!r||n)&&e]})};function b_(i){return ve.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i,children:ve.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 v_(i){return ve.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i,children:ve.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 y_=()=>{const{isCollapsed:i,isHovered:e,toggleCollapsed:t}=Pe.useContext(Wl);return i&&!e?null:ve.jsx(Mt.IconButton,{variant:"text",color:"gray",onClick:()=>t(),children:i?ve.jsx(b_,{className:"size-4"}):ve.jsx(v_,{className:"size-4"})})},w_=({children:i,className:e,icon:t,isActive:r,trailing:n,...s})=>{const{isCollapsed:a,isHovered:o}=Pe.useContext(Wl);return ve.jsxs("div",{className:so(r?"!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",e),...s,children:[ve.jsxs("div",{className:"flex items-center gap-2",children:[t,(!a||o)&&i]}),(!a||o)&&n]})},x_=({children:i,className:e,isActive:t,trailing:r,icon:n,...s})=>{const{isCollapsed:a,isHovered:o}=Pe.useContext(Wl);return ve.jsxs("div",{className:so(t?"!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",e),...s,children:[ve.jsxs("div",{className:"flex items-center gap-2 overflow-auto",children:[(!a||o)&&n," ",(!a||o)&&i]}),(!a||o)&&r]})},A_=Object.freeze(Object.defineProperty({__proto__:null,Button:m_,Container:Y2,Item:w_,Layout:g_,Provider:X2,SecondaryItem:x_,SideContainer:Z2,ToggleCollapseButton:y_},Symbol.toStringTag,{value:"Module"})),E_=i=>ve.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i,children:ve.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"})}),__=({onClose:i,right:e,children:t})=>ve.jsxs("div",{className:"bg-gray-50 flex gap-2 items-center px-2 py-3 rounded-t-xl",children:[ve.jsx("div",{className:"grow text-subheader-em",children:t}),ve.jsxs("div",{className:"flex items-center gap-4",children:[e,ve.jsx(Mt.IconButton,{variant:"text",size:"sm",color:"gray",className:"rounded-full",onClick:i,children:ve.jsx(E_,{className:"size-4 text-gray-600"})})]})]}),K2={Header:__},Q2=i=>ve.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i,children:ve.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"})}),J2=(i=100,e=50,t=990,r=10)=>{const[n,s]=Pe.useState(i);return[n,{...{zoomIn:()=>s(l=>Math.min(l+r,t)),zoomOut:()=>s(l=>Math.max(l-r,e)),reset:()=>s(i),zoomToValue:l=>s(Math.max(e,Math.min(l,t)))},handleWheel:l=>{l.preventDefault();const c=l.deltaY>0?-r:r;s(h=>Math.max(e,Math.min(h+c,t)))}}]},e1=()=>{const[i,e]=Pe.useState(0);return[i,{rotateClockwise:()=>e(r=>(r+90)%360),rotateCounterClockwise:()=>e(r=>(r-90+360)%360)}]},t1=()=>{const[i,e]=Pe.useState({x:0,y:0}),[t,r]=Pe.useState(!1),[n,s]=Pe.useState({x:0,y:0});return[{pan:i,isDragging:t},{handleMouseDown:h=>{r(!0),s({x:h.clientX-i.x,y:h.clientY-i.y})},handleMouseMove:h=>{t&&e({x:h.clientX-n.x,y:h.clientY-n.y})},handleMouseUp:()=>{r(!1)},reset:()=>e({x:0,y:0})}]},r1=(i=0)=>{const[e,t]=Pe.useState(1),[r,n]=Pe.useState(i),s={nextPage:Pe.useCallback(()=>{t(a=>a<r?a+1:a)},[r]),prevPage:Pe.useCallback(()=>{t(a=>Math.max(a-1,1))},[]),goToPage:Pe.useCallback(a=>{t(()=>Math.max(1,Math.min(a,r)))},[r]),setTotalPages:Pe.useCallback(a=>{n(a),t(o=>Math.min(o,a))},[])};return[{currentPage:e,totalPages:r},s]},C_=({className:i,canvasClassName:e,onClose:t,totalPages:r,getImageSrc:n,documentUrl:s,title:a="PDF Viewer"})=>{const[o,l]=J2(),[c,h]=e1(),[{pan:d,isDragging:p},g]=t1(),[{currentPage:y},b]=r1(r),[w,v]=Pe.useState(()=>{const E=n(y);return typeof E=="string"?E:""});Pe.useEffect(()=>{let E=!0;return(async()=>{const C=n(y),I=await Promise.resolve(C);E&&v(I)})(),()=>{E=!1}},[y,n]);const A=ve.jsx(Mt.IconButton,{variant:"text",color:"gray",children:ve.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",children:ve.jsx(Q2,{className:"size-4"})})});return ve.jsxs("div",{className:so("shadow rounded-t-lg flex flex-col h-full",i),children:[ve.jsx(K2.Header,{onClose:t,right:A,children:a}),ve.jsx("div",{className:"flex flex-col h-full justify-between",children:ve.jsxs("div",{className:"grid relative h-full",children:[ve.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:ve.jsx("div",{style:{transform:`translate(${d.x}px, ${d.y}px)`,cursor:p?"grabbing":"grab",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},onMouseDown:g.handleMouseDown,children:ve.jsx("div",{style:{transform:`scale(${o/100}) rotate(${c}deg)`,transformOrigin:"center",transition:p?"none":"transform 0.3s ease"},children:w?ve.jsx("img",{src:w,style:{userSelect:"none",pointerEvents:"none"}}):null})})}),ve.jsxs("div",{className:`${e} col-start-1 row-start-1 self-end p-4 flex gap-2 justify-between w-full z-10`,children:[ve.jsxs(Mt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[ve.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:l.zoomOut,children:ve.jsx(vi.Icon,{icon:"lucide:minus"})}),ve.jsx(Mt.Tooltip,{content:"Click to reset zoom and pan",children:ve.jsxs("button",{className:"!bg-white text-center cursor-pointer w-[60px]",onClick:()=>{l.reset(),g.reset()},children:[o,"%"]})}),ve.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:l.zoomIn,children:ve.jsx(vi.Icon,{icon:"lucide:plus"})})]}),ve.jsxs(Mt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[ve.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:h.rotateClockwise,children:ve.jsx(vi.Icon,{icon:"lucide:iteration-cw"})}),ve.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:h.rotateCounterClockwise,children:ve.jsx(vi.Icon,{icon:"lucide:iteration-ccw"})})]}),ve.jsxs(Mt.ButtonGroup,{className:"divide-x-0 ",children:[ve.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:b.prevPage,disabled:y===1,children:ve.jsx(vi.Icon,{icon:"lucide:chevron-left"})}),ve.jsx("input",{className:"bg-white pl-4 flex items-center w-[50px] text-center focus:outline-none w-[60px]",value:y,onChange:E=>{const _=parseInt(E.target.value);isNaN(_)||b.goToPage(_)},type:"number",min:"1",max:r}),ve.jsxs("div",{className:"flex items-center bg-white px-2",children:["of ",r]}),ve.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:b.nextPage,disabled:y===r,children:ve.jsx(vi.Icon,{icon:"lucide:chevron-right"})})]})]})]})})]})},_n=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),i0=[.001,0,0,.001,0,0],dm=1.35,ii={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},vs={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},n1="pdfjs_internal_editor_",ot={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,SIGNATURE:101},kt={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},i1={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},on={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Th={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},wr={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},au={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Cf={ERRORS:0,WARNINGS:1,INFOS:5},Ph={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},Jf={moveTo:0,lineTo:1,curveTo:2,closePath:3},s1={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Sg=Cf.WARNINGS;function S_(i){Number.isInteger(i)&&(Sg=i)}function T_(){return Sg}function Tg(i){Sg>=Cf.INFOS&&console.log(`Info: ${i}`)}function ut(i){Sg>=Cf.WARNINGS&&console.log(`Warning: ${i}`)}function Wt(i){throw new Error(i)}function Dr(i,e){i||Wt(e)}function k_(i){switch(i==null?void 0:i.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Pb(i,e=null,t=null){if(!i)return null;if(t&&typeof i=="string"){if(t.addDefaultProtocol&&i.startsWith("www.")){const n=i.match(/\./g);(n==null?void 0:n.length)>=2&&(i=`http://${i}`)}if(t.tryConvertEncoding)try{i=N_(i)}catch{}}const r=e?URL.parse(i,e):URL.parse(i);return k_(r)?r:null}function Rb(i,e,t=!1){const r=URL.parse(i);return r?(r.hash=e,r.href):t&&Pb(i,"http://example.com")?i.split("#",1)[0]+`${e?`#${e}`:""}`:""}function Ct(i,e,t,r=!1){return Object.defineProperty(i,e,{value:t,enumerable:!r,configurable:!0,writable:!1}),t}const Xl=function(){function e(t,r){this.message=t,this.name=r}return e.prototype=new Error,e.constructor=e,e}();class Yv extends Xl{constructor(e,t){super(e,"PasswordException"),this.code=t}}class fm extends Xl{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class Xp extends Xl{constructor(e){super(e,"InvalidPDFException")}}class Rh extends Xl{constructor(e,t,r){super(e,"ResponseException"),this.status=t,this.missing=r}}class D_ extends Xl{constructor(e){super(e,"FormatError")}}class ha extends Xl{constructor(e){super(e,"AbortException")}}function a1(i){(typeof i!="object"||(i==null?void 0:i.length)===void 0)&&Wt("Invalid argument for bytesToString");const e=i.length,t=8192;if(e<t)return String.fromCharCode.apply(null,i);const r=[];for(let n=0;n<e;n+=t){const s=Math.min(n+t,e),a=i.subarray(n,s);r.push(String.fromCharCode.apply(null,a))}return r.join("")}function Sf(i){typeof i!="string"&&Wt("Invalid argument for stringToBytes");const e=i.length,t=new Uint8Array(e);for(let r=0;r<e;++r)t[r]=i.charCodeAt(r)&255;return t}function P_(i){return String.fromCharCode(i>>24&255,i>>16&255,i>>8&255,i&255)}function R_(){const i=new Uint8Array(4);return i[0]=1,new Uint32Array(i.buffer,0,1)[0]===1}function I_(){try{return new Function(""),!0}catch{return!1}}class Gr{static get isLittleEndian(){return Ct(this,"isLittleEndian",R_())}static get isEvalSupported(){return Ct(this,"isEvalSupported",I_())}static get isOffscreenCanvasSupported(){return Ct(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Ct(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:e,userAgent:t}=navigator;return Ct(this,"platform",{isAndroid:t.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:t.includes("Firefox")})}static get isCSSRoundSupported(){var e,t;return Ct(this,"isCSSRoundSupported",(t=(e=globalThis.CSS)==null?void 0:e.supports)==null?void 0:t.call(e,"width: round(1.5px, 1px)"))}}const pm=Array.from(Array(256).keys(),i=>i.toString(16).padStart(2,"0"));var ua,gp,s0;class Qe{static makeHexColor(e,t,r){return`#${pm[e]}${pm[t]}${pm[r]}`}static scaleMinMax(e,t){let r;e[0]?(e[0]<0&&(r=t[0],t[0]=t[2],t[2]=r),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(r=t[1],t[1]=t[3],t[3]=r),t[1]*=e[3],t[3]*=e[3]):(r=t[0],t[0]=t[1],t[1]=r,r=t[2],t[2]=t[3],t[3]=r,e[1]<0&&(r=t[1],t[1]=t[3],t[3]=r),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(r=t[0],t[0]=t[2],t[2]=r),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t,r=0){const n=e[r],s=e[r+1];e[r]=n*t[0]+s*t[2]+t[4],e[r+1]=n*t[1]+s*t[3]+t[5]}static applyTransformToBezier(e,t,r=0){const n=t[0],s=t[1],a=t[2],o=t[3],l=t[4],c=t[5];for(let h=0;h<6;h+=2){const d=e[r+h],p=e[r+h+1];e[r+h]=d*n+p*a+l,e[r+h+1]=d*s+p*o+c}}static applyInverseTransform(e,t){const r=e[0],n=e[1],s=t[0]*t[3]-t[1]*t[2];e[0]=(r*t[3]-n*t[2]+t[2]*t[5]-t[4]*t[3])/s,e[1]=(-r*t[1]+n*t[0]+t[4]*t[1]-t[5]*t[0])/s}static axialAlignedBoundingBox(e,t,r){const n=t[0],s=t[1],a=t[2],o=t[3],l=t[4],c=t[5],h=e[0],d=e[1],p=e[2],g=e[3];let y=n*h+l,b=y,w=n*p+l,v=w,A=o*d+c,E=A,_=o*g+c,C=_;if(s!==0||a!==0){const I=s*h,k=s*p,D=a*d,R=a*g;y+=D,v+=D,w+=R,b+=R,A+=I,C+=I,_+=k,E+=k}r[0]=Math.min(r[0],y,w,b,v),r[1]=Math.min(r[1],A,_,E,C),r[2]=Math.max(r[2],y,w,b,v),r[3]=Math.max(r[3],A,_,E,C)}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){const r=e[0],n=e[1],s=e[2],a=e[3],o=r**2+n**2,l=r*s+n*a,c=s**2+a**2,h=(o+c)/2,d=Math.sqrt(h**2-(o*c-l**2));t[0]=Math.sqrt(h+d||1),t[1]=Math.sqrt(h-d||1)}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const r=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),n=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(r>n)return null;const s=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return s>a?null:[r,s,n,a]}static pointBoundingBox(e,t,r){r[0]=Math.min(r[0],e),r[1]=Math.min(r[1],t),r[2]=Math.max(r[2],e),r[3]=Math.max(r[3],t)}static rectBoundingBox(e,t,r,n,s){s[0]=Math.min(s[0],e,r),s[1]=Math.min(s[1],t,n),s[2]=Math.max(s[2],e,r),s[3]=Math.max(s[3],t,n)}static bezierBoundingBox(e,t,r,n,s,a,o,l,c){c[0]=Math.min(c[0],e,o),c[1]=Math.min(c[1],t,l),c[2]=Math.max(c[2],e,o),c[3]=Math.max(c[3],t,l),L(this,ua,s0).call(this,e,r,s,o,t,n,a,l,3*(-e+3*(r-s)+o),6*(e-2*r+s),3*(r-e),c),L(this,ua,s0).call(this,e,r,s,o,t,n,a,l,3*(-t+3*(n-a)+l),6*(t-2*n+a),3*(n-t),c)}}ua=new WeakSet,gp=function(e,t,r,n,s,a,o,l,c,h){if(c<=0||c>=1)return;const d=1-c,p=c*c,g=p*c,y=d*(d*(d*e+3*c*t)+3*p*r)+g*n,b=d*(d*(d*s+3*c*a)+3*p*o)+g*l;h[0]=Math.min(h[0],y),h[1]=Math.min(h[1],b),h[2]=Math.max(h[2],y),h[3]=Math.max(h[3],b)},s0=function(e,t,r,n,s,a,o,l,c,h,d,p){if(Math.abs(c)<1e-12){Math.abs(h)>=1e-12&&L(this,ua,gp).call(this,e,t,r,n,s,a,o,l,-d/h,p);return}const g=h**2-4*d*c;if(g<0)return;const y=Math.sqrt(g),b=2*c;L(this,ua,gp).call(this,e,t,r,n,s,a,o,l,(-h+y)/b,p),L(this,ua,gp).call(this,e,t,r,n,s,a,o,l,(-h-y)/b,p)},N(Qe,ua);function N_(i){return decodeURIComponent(escape(i))}let gm=null,Zv=null;function o1(i){return gm||(gm=/([\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,Zv=new Map([["ſt","ſt"]])),i.replaceAll(gm,(e,t,r)=>t?t.normalize("NFKC"):Zv.get(r))}function Ib(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const i=new Uint8Array(32);return crypto.getRandomValues(i),a1(i)}const Nb="pdfjs_internal_id_";function M_(i,e,t){if(!Array.isArray(t)||t.length<2)return!1;const[r,n,...s]=t;if(!i(r)&&!Number.isInteger(r)||!e(n))return!1;const a=s.length;let o=!0;switch(n.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 s)if(!(typeof l=="number"||o&&l===null))return!1;return!0}function dn(i,e,t){return Math.min(Math.max(i,e),t)}function l1(i){return Uint8Array.prototype.toBase64?i.toBase64():btoa(a1(i))}function L_(i){return Uint8Array.fromBase64?Uint8Array.fromBase64(i):Sf(atob(i))}typeof Promise.try!="function"&&(Promise.try=function(i,...e){return new Promise(t=>{t(i(...e))})});typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(i){return i.reduce((e,t)=>e+t,0)});const Ts="http://www.w3.org/2000/svg",Do=class Do{};Ie(Do,"CSS",96),Ie(Do,"PDF",72),Ie(Do,"PDF_TO_CSS_UNITS",Do.CSS/Do.PDF);let da=Do;async function Mc(i,e="text"){if(ah(i,document.baseURI)){const t=await fetch(i);if(!t.ok)throw new Error(t.statusText);switch(e){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"json":return t.json()}return t.text()}return new Promise((t,r)=>{const n=new XMLHttpRequest;n.open("GET",i,!0),n.responseType=e,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE){if(n.status===200||n.status===0){switch(e){case"arraybuffer":case"blob":case"json":t(n.response);return}t(n.responseText);return}r(new Error(n.statusText))}},n.send(null)})}class Tf{constructor({viewBox:e,userUnit:t,scale:r,rotation:n,offsetX:s=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=e,this.userUnit=t,this.scale=r,this.rotation=n,this.offsetX=s,this.offsetY=a,r*=t;const l=(e[2]+e[0])/2,c=(e[3]+e[1])/2;let h,d,p,g;switch(n%=360,n<0&&(n+=360),n){case 180:h=-1,d=0,p=0,g=1;break;case 90:h=0,d=1,p=1,g=0;break;case 270:h=0,d=-1,p=-1,g=0;break;case 0:h=1,d=0,p=0,g=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(p=-p,g=-g);let y,b,w,v;h===0?(y=Math.abs(c-e[1])*r+s,b=Math.abs(l-e[0])*r+a,w=(e[3]-e[1])*r,v=(e[2]-e[0])*r):(y=Math.abs(l-e[0])*r+s,b=Math.abs(c-e[1])*r+a,w=(e[2]-e[0])*r,v=(e[3]-e[1])*r),this.transform=[h*r,d*r,p*r,g*r,y-h*r*l-p*r*c,b-d*r*l-g*r*c],this.width=w,this.height=v}get rawDims(){const e=this.viewBox;return Ct(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:r=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}={}){return new Tf({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:t,offsetX:r,offsetY:n,dontFlip:s})}convertToViewportPoint(e,t){const r=[e,t];return Qe.applyTransform(r,this.transform),r}convertToViewportRectangle(e){const t=[e[0],e[1]];Qe.applyTransform(t,this.transform);const r=[e[2],e[3]];return Qe.applyTransform(r,this.transform),[t[0],t[1],r[0],r[1]]}convertToPdfPoint(e,t){const r=[e,t];return Qe.applyInverseTransform(r,this.transform),r}}class kg extends Xl{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function kf(i){const e=i.length;let t=0;for(;t<e&&i[t].trim()==="";)t++;return i.substring(t,t+5).toLowerCase()==="data:"}function Dg(i){return typeof i=="string"&&/\.pdf$/i.test(i)}function u1(i){return[i]=i.split(/[#?]/,1),i.substring(i.lastIndexOf("/")+1)}function c1(i,e="document.pdf"){if(typeof i!="string")return e;if(kf(i))return ut('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const r=(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}}}}})(i);if(!r)return e;const n=o=>{try{let l=decodeURIComponent(o);return l.includes("/")?(l=l.split("/").at(-1),l.test(/^\.pdf$/i)?l:o):l}catch{return o}},s=/\.pdf$/i,a=r.pathname.split("/").at(-1);if(s.test(a))return n(a);if(r.searchParams.size>0){const o=Array.from(r.searchParams.values()).reverse();for(const c of o)if(s.test(c))return n(c);const l=Array.from(r.searchParams.keys()).reverse();for(const c of l)if(s.test(c))return n(c)}if(r.hash){const l=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(r.hash);if(l)return n(l[0])}return e}class Kv{constructor(){Ie(this,"started",Object.create(null));Ie(this,"times",[])}time(e){e in this.started&&ut(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||ut(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const{name:r}of this.times)t=Math.max(r.length,t);for(const{name:r,start:n,end:s}of this.times)e.push(`${r.padEnd(t)} ${s-n}ms
|
|
31
31
|
`);return e.join("")}}function ah(i,e){const t=e?URL.parse(i,e):URL.parse(i);return(t==null?void 0:t.protocol)==="http:"||(t==null?void 0:t.protocol)==="https:"}function Ei(i){i.preventDefault()}function _r(i){i.preventDefault(),i.stopPropagation()}function O_(i){console.log("Deprecated API usage: "+i)}var Zh;class Pg{static toDateObject(e){if(!e||typeof e!="string")return null;u(this,Zh)||T(this,Zh,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const t=u(this,Zh).exec(e);if(!t)return null;const r=parseInt(t[1],10);let n=parseInt(t[2],10);n=n>=1&&n<=12?n-1:0;let s=parseInt(t[3],10);s=s>=1&&s<=31?s:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(t[6],10);l=l>=0&&l<=59?l:0;const c=t[7]||"Z";let h=parseInt(t[8],10);h=h>=0&&h<=23?h:0;let d=parseInt(t[9],10)||0;return d=d>=0&&d<=59?d:0,c==="-"?(a+=h,o+=d):c==="+"&&(a-=h,o-=d),new Date(Date.UTC(r,n,s,a,o,l))}}Zh=new WeakMap,N(Pg,Zh);function h1(i,{scale:e=1,rotation:t=0}){const{width:r,height:n}=i.attributes.style,s=[0,0,parseInt(r),parseInt(n)];return new Tf({viewBox:s,userUnit:1,scale:e,rotation:t})}function Mb(i){if(i.startsWith("#")){const e=parseInt(i.slice(1),16);return[(e&16711680)>>16,(e&65280)>>8,e&255]}return i.startsWith("rgb(")?i.slice(4,-1).split(",").map(e=>parseInt(e)):i.startsWith("rgba(")?i.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):(ut(`Not a valid color format: "${i}"`),[0,0,0])}function F_(i){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const t of i.keys()){e.style.color=t;const r=window.getComputedStyle(e).color;i.set(t,Mb(r))}e.remove()}function hr(i){const{a:e,b:t,c:r,d:n,e:s,f:a}=i.getTransform();return[e,t,r,n,s,a]}function Ki(i){const{a:e,b:t,c:r,d:n,e:s,f:a}=i.getTransform().invertSelf();return[e,t,r,n,s,a]}function ao(i,e,t=!1,r=!0){if(e instanceof Tf){const{pageWidth:n,pageHeight:s}=e.rawDims,{style:a}=i,o=Gr.isCSSRoundSupported,l=`var(--total-scale-factor) * ${n}px`,c=`var(--total-scale-factor) * ${s}px`,h=o?`round(down, ${l}, var(--scale-round-x))`:`calc(${l})`,d=o?`round(down, ${c}, var(--scale-round-y))`:`calc(${c})`;!t||e.rotation%180===0?(a.width=h,a.height=d):(a.width=d,a.height=h)}r&&i.setAttribute("data-main-rotation",e.rotation)}class Wi{constructor(){const{pixelRatio:e}=Wi;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(e,t,r,n,s=-1){let a=1/0,o=1/0,l=1/0;r=Wi.capPixels(r,s),r>0&&(a=Math.sqrt(r/(e*t))),n!==-1&&(o=n/e,l=n/t);const c=Math.min(a,o,l);return this.sx>c||this.sy>c?(this.sx=c,this.sy=c,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){const r=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+t/100));return e>0?Math.min(e,r):r}return e}}const Yp=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];var xa,Io,hi,Aa,Kh,Au,Qh,ag,d1,Sn,f1,p1,oh,mp;const Ps=class Ps{constructor(e){N(this,Sn);N(this,xa,null);N(this,Io,null);N(this,hi);N(this,Aa,null);N(this,Kh,null);N(this,Au,null);T(this,hi,e),u(Ps,Qh)||T(Ps,Qh,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))}render(){const e=T(this,xa,document.createElement("div"));e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const t=u(this,hi)._uiManager._signal;e.addEventListener("contextmenu",Ei,{signal:t}),e.addEventListener("pointerdown",L(Ps,ag,d1),{signal:t});const r=T(this,Aa,document.createElement("div"));r.className="buttons",e.append(r);const n=u(this,hi).toolbarPosition;if(n){const{style:s}=e,a=u(this,hi)._uiManager.direction==="ltr"?1-n[0]:n[0];s.insetInlineEnd=`${100*a}%`,s.top=`calc(${100*n[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return u(this,xa)}hide(){var e;u(this,xa).classList.add("hidden"),(e=u(this,Io))==null||e.hideDropdown()}show(){var e;u(this,xa).classList.remove("hidden"),(e=u(this,Kh))==null||e.shown()}addDeleteButton(){const{editorType:e,_uiManager:t}=u(this,hi),r=document.createElement("button");r.className="delete",r.tabIndex=0,r.setAttribute("data-l10n-id",u(Ps,Qh)[e]),L(this,Sn,oh).call(this,r),r.addEventListener("click",n=>{t.delete()},{signal:t._signal}),u(this,Aa).append(r)}async addAltText(e){const t=await e.render();L(this,Sn,oh).call(this,t),u(this,Aa).append(t,u(this,Sn,mp)),T(this,Kh,e)}addColorPicker(e){T(this,Io,e);const t=e.renderButton();L(this,Sn,oh).call(this,t),u(this,Aa).append(t,u(this,Sn,mp))}async addEditSignatureButton(e){const t=T(this,Au,await e.renderEditButton(u(this,hi)));L(this,Sn,oh).call(this,t),u(this,Aa).append(t,u(this,Sn,mp))}async addButton(e,t){switch(e){case"colorPicker":this.addColorPicker(t);break;case"altText":await this.addAltText(t);break;case"editSignature":await this.addEditSignatureButton(t);break;case"delete":this.addDeleteButton();break}}updateEditSignatureButton(e){u(this,Au)&&(u(this,Au).title=e)}remove(){var e;u(this,xa).remove(),(e=u(this,Io))==null||e.destroy(),T(this,Io,null)}};xa=new WeakMap,Io=new WeakMap,hi=new WeakMap,Aa=new WeakMap,Kh=new WeakMap,Au=new WeakMap,Qh=new WeakMap,ag=new WeakSet,d1=function(e){e.stopPropagation()},Sn=new WeakSet,f1=function(e){u(this,hi)._focusEventsAllowed=!1,_r(e)},p1=function(e){u(this,hi)._focusEventsAllowed=!0,_r(e)},oh=function(e){const t=u(this,hi)._uiManager._signal;e.addEventListener("focusin",L(this,Sn,f1).bind(this),{capture:!0,signal:t}),e.addEventListener("focusout",L(this,Sn,p1).bind(this),{capture:!0,signal:t}),e.addEventListener("contextmenu",Ei,{signal:t})},mp=function(){const e=document.createElement("div");return e.className="divider",e},N(Ps,ag),N(Ps,Qh,null);let a0=Ps;var Jh,No,Mo,fo,g1,m1,b1;class B_{constructor(e){N(this,fo);N(this,Jh,null);N(this,No,null);N(this,Mo);T(this,Mo,e)}show(e,t,r){const[n,s]=L(this,fo,m1).call(this,t,r),{style:a}=u(this,No)||T(this,No,L(this,fo,g1).call(this));e.append(u(this,No)),a.insetInlineEnd=`${100*n}%`,a.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){u(this,No).remove()}}Jh=new WeakMap,No=new WeakMap,Mo=new WeakMap,fo=new WeakSet,g1=function(){const e=T(this,No,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",Ei,{signal:u(this,Mo)._signal});const t=T(this,Jh,document.createElement("div"));return t.className="buttons",e.append(t),L(this,fo,b1).call(this),e},m1=function(e,t){let r=0,n=0;for(const s of e){const a=s.y+s.height;if(a<r)continue;const o=s.x+(t?s.width:0);if(a>r){n=o,r=a;continue}t?o>n&&(n=o):o<n&&(n=o)}return[t?1-n:n,r]},b1=function(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const t=document.createElement("span");e.append(t),t.className="visuallyHidden",t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const r=u(this,Mo)._signal;e.addEventListener("contextmenu",Ei,{signal:r}),e.addEventListener("click",()=>{u(this,Mo).highlightSelection("floating_button")},{signal:r}),u(this,Jh).append(e)};function v1(i,e,t){for(const r of t)e.addEventListener(r,i[r].bind(i))}var og;class z_{constructor(){N(this,og,0)}get id(){return`${n1}${bn(this,og)._++}`}}og=new WeakMap;var Eu,ed,un,_u,bp;const bv=class bv{constructor(){N(this,_u);N(this,Eu,Ib());N(this,ed,0);N(this,un,null)}static get _isSVGFittingCanvas(){const e='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',r=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),n=new Image;n.src=e;const s=n.decode().then(()=>(r.drawImage(n,0,0,1,1,0,0,1,3),new Uint32Array(r.getImageData(0,0,1,1).data.buffer)[0]===0));return Ct(this,"_isSVGFittingCanvas",s)}async getFromFile(e){const{lastModified:t,name:r,size:n,type:s}=e;return L(this,_u,bp).call(this,`${t}_${r}_${n}_${s}`,e)}async getFromUrl(e){return L(this,_u,bp).call(this,e,e)}async getFromBlob(e,t){const r=await t;return L(this,_u,bp).call(this,e,r)}async getFromId(e){u(this,un)||T(this,un,new Map);const t=u(this,un).get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){const{blobPromise:r}=t;return delete t.blobPromise,this.getFromBlob(t.id,r)}return this.getFromUrl(t.url)}getFromCanvas(e,t){u(this,un)||T(this,un,new Map);let r=u(this,un).get(e);if(r!=null&&r.bitmap)return r.refCounter+=1,r;const n=new OffscreenCanvas(t.width,t.height);return n.getContext("2d").drawImage(t,0,0),r={bitmap:n.transferToImageBitmap(),id:`image_${u(this,Eu)}_${bn(this,ed)._++}`,refCounter:1,isSvg:!1},u(this,un).set(e,r),u(this,un).set(r.id,r),r}getSvgUrl(e){const t=u(this,un).get(e);return t!=null&&t.isSvg?t.svgUrl:null}deleteId(e){var n;u(this,un)||T(this,un,new Map);const t=u(this,un).get(e);if(!t||(t.refCounter-=1,t.refCounter!==0))return;const{bitmap:r}=t;if(!t.url&&!t.file){const s=new OffscreenCanvas(r.width,r.height);s.getContext("bitmaprenderer").transferFromImageBitmap(r),t.blobPromise=s.convertToBlob()}(n=r.close)==null||n.call(r),t.bitmap=null}isValidId(e){return e.startsWith(`image_${u(this,Eu)}_`)}};Eu=new WeakMap,ed=new WeakMap,un=new WeakMap,_u=new WeakSet,bp=async function(e,t){u(this,un)||T(this,un,new Map);let r=u(this,un).get(e);if(r===null)return null;if(r!=null&&r.bitmap)return r.refCounter+=1,r;try{r||(r={bitmap:null,id:`image_${u(this,Eu)}_${bn(this,ed)._++}`,refCounter:0,isSvg:!1});let n;if(typeof t=="string"?(r.url=t,n=await Mc(t,"blob")):t instanceof File?n=r.file=t:t instanceof Blob&&(n=t),n.type==="image/svg+xml"){const s=bv._isSVGFittingCanvas,a=new FileReader,o=new Image,l=new Promise((c,h)=>{o.onload=()=>{r.bitmap=o,r.isSvg=!0,c()},a.onload=async()=>{const d=r.svgUrl=a.result;o.src=await s?`${d}#svgView(preserveAspectRatio(none))`:d},o.onerror=a.onerror=h});a.readAsDataURL(n),await l}else r.bitmap=await createImageBitmap(n);r.refCounter=1}catch(n){ut(n),r=null}return u(this,un).set(e,r),r&&u(this,un).set(r.id,r),r};let o0=bv;var xr,Ea,td,cr;class j_{constructor(e=128){N(this,xr,[]);N(this,Ea,!1);N(this,td);N(this,cr,-1);T(this,td,e)}add({cmd:e,undo:t,post:r,mustExec:n,type:s=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(n&&e(),u(this,Ea))return;const l={cmd:e,undo:t,post:r,type:s};if(u(this,cr)===-1){u(this,xr).length>0&&(u(this,xr).length=0),T(this,cr,0),u(this,xr).push(l);return}if(a&&u(this,xr)[u(this,cr)].type===s){o&&(l.undo=u(this,xr)[u(this,cr)].undo),u(this,xr)[u(this,cr)]=l;return}const c=u(this,cr)+1;c===u(this,td)?u(this,xr).splice(0,1):(T(this,cr,c),c<u(this,xr).length&&u(this,xr).splice(c)),u(this,xr).push(l)}undo(){if(u(this,cr)===-1)return;T(this,Ea,!0);const{undo:e,post:t}=u(this,xr)[u(this,cr)];e(),t==null||t(),T(this,Ea,!1),T(this,cr,u(this,cr)-1)}redo(){if(u(this,cr)<u(this,xr).length-1){T(this,cr,u(this,cr)+1),T(this,Ea,!0);const{cmd:e,post:t}=u(this,xr)[u(this,cr)];e(),t==null||t(),T(this,Ea,!1)}}hasSomethingToUndo(){return u(this,cr)!==-1}hasSomethingToRedo(){return u(this,cr)<u(this,xr).length-1}cleanType(e){if(u(this,cr)!==-1){for(let t=u(this,cr);t>=0;t--)if(u(this,xr)[t].type!==e){u(this,xr).splice(t+1,u(this,cr)-t),T(this,cr,t);return}u(this,xr).length=0,T(this,cr,-1)}}destroy(){T(this,xr,null)}}xr=new WeakMap,Ea=new WeakMap,td=new WeakMap,cr=new WeakMap;var lg,y1;class Df{constructor(e){N(this,lg);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=Gr.platform;for(const[r,n,s={}]of e)for(const a of r){const o=a.startsWith("mac+");t&&o?(this.callbacks.set(a.slice(4),{callback:n,options:s}),this.allKeys.add(a.split("+").at(-1))):!t&&!o&&(this.callbacks.set(a,{callback:n,options:s}),this.allKeys.add(a.split("+").at(-1)))}}exec(e,t){if(!this.allKeys.has(t.key))return;const r=this.callbacks.get(L(this,lg,y1).call(this,t));if(!r)return;const{callback:n,options:{bubbles:s=!1,args:a=[],checker:o=null}}=r;o&&!o(e,t)||(n.bind(e,...a,t)(),s||_r(t))}}lg=new WeakSet,y1=function(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const t=this.buffer.join("+");return this.buffer.length=0,t};const ug=class ug{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return F_(e),Ct(this,"_colors",e)}convert(e){const t=Mb(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[r,n]of this._colors)if(n.every((s,a)=>s===t[a]))return ug._colorsMapping.get(r);return t}getHexCode(e){const t=this._colors.get(e);return t?Qe.makeHexColor(...t):e}};Ie(ug,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let l0=ug;var Cu,Vn,Ir,Yr,Su,Is,Tu,di,_a,Ca,ku,Lo,ts,Ni,Oo,rd,nd,Du,id,rs,Sa,Pu,Ta,ns,cg,ka,sd,Da,Fo,Bo,Pa,ad,zr,Ht,Ns,Ra,zo,od,ld,Ia,is,Ms,ud,cd,fi,ze,vp,u0,w1,x1,yp,A1,E1,_1,c0,C1,h0,d0,S1,yn,ks,T1,k1,f0,D1,lh,p0;const mu=class mu{constructor(e,t,r,n,s,a,o,l,c,h,d,p,g,y,b){N(this,ze);N(this,Cu,new AbortController);N(this,Vn,null);N(this,Ir,new Map);N(this,Yr,new Map);N(this,Su,null);N(this,Is,null);N(this,Tu,null);N(this,di,new j_);N(this,_a,null);N(this,Ca,null);N(this,ku,0);N(this,Lo,new Set);N(this,ts,null);N(this,Ni,null);N(this,Oo,new Set);Ie(this,"_editorUndoBar",null);N(this,rd,!1);N(this,nd,!1);N(this,Du,!1);N(this,id,null);N(this,rs,null);N(this,Sa,null);N(this,Pu,null);N(this,Ta,!1);N(this,ns,null);N(this,cg,new z_);N(this,ka,!1);N(this,sd,!1);N(this,Da,null);N(this,Fo,null);N(this,Bo,null);N(this,Pa,null);N(this,ad,null);N(this,zr,ot.NONE);N(this,Ht,new Set);N(this,Ns,null);N(this,Ra,null);N(this,zo,null);N(this,od,null);N(this,ld,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});N(this,Ia,[0,0]);N(this,is,null);N(this,Ms,null);N(this,ud,null);N(this,cd,null);N(this,fi,null);const w=this._signal=u(this,Cu).signal;T(this,Ms,e),T(this,ud,t),T(this,cd,r),T(this,Su,n),T(this,Ra,s),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",v=>this.updateParams(v.type,v.value),{signal:w}),L(this,ze,A1).call(this),L(this,ze,S1).call(this),L(this,ze,c0).call(this),T(this,Is,o.annotationStorage),T(this,id,o.filterFactory),T(this,zo,l),T(this,Pu,c||null),T(this,rd,h),T(this,nd,d),T(this,Du,p),T(this,ad,g||null),this.viewParameters={realScale:da.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=y||null,this._supportsPinchToZoom=b!==!1}static get _keyboardManager(){const e=mu.prototype,t=a=>u(a,Ms).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),r=(a,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},n=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return Ct(this,"_keyboardManager",new Df([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:r}],[["ctrl+z","mac+meta+z"],e.undo,{checker:r}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:r}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:r}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&u(a,Ms).contains(o)&&!a.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&u(a,Ms).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-n,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-s,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[n,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[s,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-n],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-s],checker:t}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,n],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,s],checker:t}]]))}destroy(){var e,t,r,n,s,a,o,l;(e=u(this,fi))==null||e.resolve(),T(this,fi,null),(t=u(this,Cu))==null||t.abort(),T(this,Cu,null),this._signal=null;for(const c of u(this,Yr).values())c.destroy();u(this,Yr).clear(),u(this,Ir).clear(),u(this,Oo).clear(),(r=u(this,Pa))==null||r.clear(),T(this,Vn,null),u(this,Ht).clear(),u(this,di).destroy(),(n=u(this,Su))==null||n.destroy(),(s=u(this,Ra))==null||s.destroy(),(a=u(this,ns))==null||a.hide(),T(this,ns,null),(o=u(this,Bo))==null||o.destroy(),T(this,Bo,null),u(this,rs)&&(clearTimeout(u(this,rs)),T(this,rs,null)),u(this,is)&&(clearTimeout(u(this,is)),T(this,is,null)),(l=this._editorUndoBar)==null||l.destroy()}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return u(this,ad)}get useNewAltTextFlow(){return u(this,nd)}get useNewAltTextWhenAddingImage(){return u(this,Du)}get hcmFilter(){return Ct(this,"hcmFilter",u(this,zo)?u(this,id).addHCMFilter(u(this,zo).foreground,u(this,zo).background):"none")}get direction(){return Ct(this,"direction",getComputedStyle(u(this,Ms)).direction)}get highlightColors(){return Ct(this,"highlightColors",u(this,Pu)?new Map(u(this,Pu).split(",").map(e=>(e=e.split("=").map(t=>t.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColorNames(){return Ct(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),T(this,Ca,e)}setMainHighlightColorPicker(e){T(this,Bo,e)}editAltText(e,t=!1){var r;(r=u(this,Su))==null||r.editAltText(this,e,t)}getSignature(e){var t;(t=u(this,Ra))==null||t.getSignature({uiManager:this,editor:e})}get signatureManager(){return u(this,Ra)}switchToMode(e,t){this._eventBus.on("annotationeditormodechanged",t,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch("setpreference",{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){switch(e){case"enableNewAltTextWhenAddingImage":T(this,Du,t);break}}onPageChanging({pageNumber:e}){T(this,ku,e-1)}focusMainContainer(){u(this,Ms).focus()}findParent(e,t){for(const r of u(this,Yr).values()){const{x:n,y:s,width:a,height:o}=r.div.getBoundingClientRect();if(e>=n&&e<=n+a&&t>=s&&t<=s+o)return r}return null}disableUserSelect(e=!1){u(this,ud).classList.toggle("noUserSelect",e)}addShouldRescale(e){u(this,Oo).add(e)}removeShouldRescale(e){u(this,Oo).delete(e)}onScaleChanging({scale:e}){var t;this.commitOrRemove(),this.viewParameters.realScale=e*da.PDF_TO_CSS_UNITS;for(const r of u(this,Oo))r.onScaleChanging();(t=u(this,Ca))==null||t.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e=""){const t=document.getSelection();if(!t||t.isCollapsed)return;const{anchorNode:r,anchorOffset:n,focusNode:s,focusOffset:a}=t,o=t.toString(),c=L(this,ze,vp).call(this,t).closest(".textLayer"),h=this.getSelectionBoxes(c);if(!h)return;t.empty();const d=L(this,ze,u0).call(this,c),p=u(this,zr)===ot.NONE,g=()=>{d==null||d.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:h,anchorNode:r,anchorOffset:n,focusNode:s,focusOffset:a,text:o}),p&&this.showAllEditors("highlight",!0,!0)};if(p){this.switchToMode(ot.HIGHLIGHT,g);return}g()}addToAnnotationStorage(e){!e.isEmpty()&&u(this,Is)&&!u(this,Is).has(e.id)&&u(this,Is).setValue(e.id,e)}a11yAlert(e,t=null){const r=u(this,cd);r&&(r.setAttribute("data-l10n-id",e),t?r.setAttribute("data-l10n-args",JSON.stringify(t)):r.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,u(this,Ta)&&(T(this,Ta,!1),L(this,ze,yp).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const t of u(this,Ht))if(t.div.contains(e)){T(this,Fo,[t,e]),t._focusEventsAllowed=!1;break}}focus(){if(!u(this,Fo))return;const[e,t]=u(this,Fo);T(this,Fo,null),t.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}addEditListeners(){L(this,ze,c0).call(this),L(this,ze,h0).call(this)}removeEditListeners(){L(this,ze,C1).call(this),L(this,ze,d0).call(this)}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const r of u(this,Ni))if(r.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const t of e.dataTransfer.items)for(const r of u(this,Ni))if(r.isHandlingMimeForPasting(t.type)){r.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){var r;if(e.preventDefault(),(r=u(this,Vn))==null||r.commitOrRemove(),!this.hasSelection)return;const t=[];for(const n of u(this,Ht)){const s=n.serialize(!0);s&&t.push(s)}t.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:t}=e;for(const s of t.items)for(const a of u(this,Ni))if(a.isHandlingMimeForPasting(s.type)){a.paste(s,this.currentLayer);return}let r=t.getData("application/pdfjs");if(!r)return;try{r=JSON.parse(r)}catch(s){ut(`paste: "${s.message}".`);return}if(!Array.isArray(r))return;this.unselectAll();const n=this.currentLayer;try{const s=[];for(const l of r){const c=await n.deserialize(l);if(!c)return;s.push(c)}const a=()=>{for(const l of s)L(this,ze,f0).call(this,l);L(this,ze,p0).call(this,s)},o=()=>{for(const l of s)l.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(s){ut(`paste: "${s.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),u(this,zr)!==ot.NONE&&!this.isEditorHandlingKeyboard&&mu._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,u(this,Ta)&&(T(this,Ta,!1),L(this,ze,yp).call(this,"main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(e){e?(L(this,ze,E1).call(this),L(this,ze,h0).call(this),L(this,ze,yn).call(this,{isEditing:u(this,zr)!==ot.NONE,isEmpty:L(this,ze,lh).call(this),hasSomethingToUndo:u(this,di).hasSomethingToUndo(),hasSomethingToRedo:u(this,di).hasSomethingToRedo(),hasSelectedEditor:!1})):(L(this,ze,_1).call(this),L(this,ze,d0).call(this),L(this,ze,yn).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!u(this,Ni)){T(this,Ni,e);for(const t of u(this,Ni))L(this,ze,ks).call(this,t.defaultPropertiesToUpdate)}}getId(){return u(this,cg).id}get currentLayer(){return u(this,Yr).get(u(this,ku))}getLayer(e){return u(this,Yr).get(e)}get currentPageIndex(){return u(this,ku)}addLayer(e){u(this,Yr).set(e.pageIndex,e),u(this,ka)?e.enable():e.disable()}removeLayer(e){u(this,Yr).delete(e.pageIndex)}async updateMode(e,t=null,r=!1,n=!1){var s,a,o;if(u(this,zr)!==e&&!(u(this,fi)&&(await u(this,fi).promise,!u(this,fi)))){if(T(this,fi,Promise.withResolvers()),(s=u(this,Ca))==null||s.commitOrRemove(),T(this,zr,e),e===ot.NONE){this.setEditingState(!1),L(this,ze,k1).call(this),(a=this._editorUndoBar)==null||a.hide(),u(this,fi).resolve();return}e===ot.SIGNATURE&&await((o=u(this,Ra))==null?void 0:o.loadSignatures()),this.setEditingState(!0),await L(this,ze,T1).call(this),this.unselectAll();for(const l of u(this,Yr).values())l.updateMode(e);if(!t){r&&this.addNewEditorFromKeyboard(),u(this,fi).resolve();return}for(const l of u(this,Ir).values())l.annotationElementId===t||l.id===t?(this.setSelected(l),n&&l.enterInEditMode()):l.unselect();u(this,fi).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==u(this,zr)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,t){var r;if(u(this,Ni)){switch(e){case kt.CREATE:this.currentLayer.addNewEditor(t);return;case kt.HIGHLIGHT_DEFAULT_COLOR:(r=u(this,Bo))==null||r.updateColor(t);break;case kt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(u(this,od)||T(this,od,new Map)).set(e,t),this.showAllEditors("highlight",t);break}for(const n of u(this,Ht))n.updateParams(e,t);for(const n of u(this,Ni))n.updateDefaultParams(e,t)}}showAllEditors(e,t,r=!1){var s;for(const a of u(this,Ir).values())a.editorType===e&&a.show(t);(((s=u(this,od))==null?void 0:s.get(kt.HIGHLIGHT_SHOW_ALL))??!0)!==t&&L(this,ze,ks).call(this,[[kt.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(u(this,sd)!==e){T(this,sd,e);for(const t of u(this,Yr).values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}getEditors(e){const t=[];for(const r of u(this,Ir).values())r.pageIndex===e&&t.push(r);return t}getEditor(e){return u(this,Ir).get(e)}addEditor(e){u(this,Ir).set(e.id,e)}removeEditor(e){var t,r;e.div.contains(document.activeElement)&&(u(this,rs)&&clearTimeout(u(this,rs)),T(this,rs,setTimeout(()=>{this.focusMainContainer(),T(this,rs,null)},0))),u(this,Ir).delete(e.id),e.annotationElementId&&((t=u(this,Pa))==null||t.delete(e.annotationElementId)),this.unselect(e),(!e.annotationElementId||!u(this,Lo).has(e.annotationElementId))&&((r=u(this,Is))==null||r.remove(e.id))}addDeletedAnnotationElement(e){u(this,Lo).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return u(this,Lo).has(e)}removeDeletedAnnotationElement(e){u(this,Lo).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){u(this,Vn)!==e&&(T(this,Vn,e),e&&L(this,ze,ks).call(this,e.propertiesToUpdate))}updateUI(e){u(this,ze,D1)===e&&L(this,ze,ks).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){L(this,ze,ks).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(u(this,Ht).has(e)){u(this,Ht).delete(e),e.unselect(),L(this,ze,yn).call(this,{hasSelectedEditor:this.hasSelection});return}u(this,Ht).add(e),e.select(),L(this,ze,ks).call(this,e.propertiesToUpdate),L(this,ze,yn).call(this,{hasSelectedEditor:!0})}setSelected(e){var t;this.updateToolbar({mode:e.mode,editId:e.id}),(t=u(this,Ca))==null||t.commitOrRemove();for(const r of u(this,Ht))r!==e&&r.unselect();u(this,Ht).clear(),u(this,Ht).add(e),e.select(),L(this,ze,ks).call(this,e.propertiesToUpdate),L(this,ze,yn).call(this,{hasSelectedEditor:!0})}isSelected(e){return u(this,Ht).has(e)}get firstSelectedEditor(){return u(this,Ht).values().next().value}unselect(e){e.unselect(),u(this,Ht).delete(e),L(this,ze,yn).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return u(this,Ht).size!==0}get isEnterHandled(){return u(this,Ht).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var e;u(this,di).undo(),L(this,ze,yn).call(this,{hasSomethingToUndo:u(this,di).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:L(this,ze,lh).call(this)}),(e=this._editorUndoBar)==null||e.hide()}redo(){u(this,di).redo(),L(this,ze,yn).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:u(this,di).hasSomethingToRedo(),isEmpty:L(this,ze,lh).call(this)})}addCommands(e){u(this,di).add(e),L(this,ze,yn).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:L(this,ze,lh).call(this)})}cleanUndoStack(e){u(this,di).cleanType(e)}delete(){var s;this.commitOrRemove();const e=(s=this.currentLayer)==null?void 0:s.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const t=e?[e]:[...u(this,Ht)],r=()=>{var a;(a=this._editorUndoBar)==null||a.show(n,t.length===1?t[0].editorType:t.length);for(const o of t)o.remove()},n=()=>{for(const a of t)L(this,ze,f0).call(this,a)};this.addCommands({cmd:r,undo:n,mustExec:!0})}commitOrRemove(){var e;(e=u(this,Vn))==null||e.commitOrRemove()}hasSomethingToControl(){return u(this,Vn)||this.hasSelection}selectAll(){for(const e of u(this,Ht))e.commit();L(this,ze,p0).call(this,u(this,Ir).values())}unselectAll(){var e;if(!(u(this,Vn)&&(u(this,Vn).commitOrRemove(),u(this,zr)!==ot.NONE))&&!((e=u(this,Ca))!=null&&e.commitOrRemove())&&this.hasSelection){for(const t of u(this,Ht))t.unselect();u(this,Ht).clear(),L(this,ze,yn).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,t,r=!1){if(r||this.commitOrRemove(),!this.hasSelection)return;u(this,Ia)[0]+=e,u(this,Ia)[1]+=t;const[n,s]=u(this,Ia),a=[...u(this,Ht)],o=1e3;u(this,is)&&clearTimeout(u(this,is)),T(this,is,setTimeout(()=>{T(this,is,null),u(this,Ia)[0]=u(this,Ia)[1]=0,this.addCommands({cmd:()=>{for(const l of a)u(this,Ir).has(l.id)&&(l.translateInPage(n,s),l.translationDone())},undo:()=>{for(const l of a)u(this,Ir).has(l.id)&&(l.translateInPage(-n,-s),l.translationDone())},mustExec:!1})},o));for(const l of a)l.translateInPage(e,t),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),T(this,ts,new Map);for(const e of u(this,Ht))u(this,ts).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!u(this,ts))return!1;this.disableUserSelect(!1);const e=u(this,ts);T(this,ts,null);let t=!1;for(const[{x:n,y:s,pageIndex:a},o]of e)o.newX=n,o.newY=s,o.newPageIndex=a,t||(t=n!==o.savedX||s!==o.savedY||a!==o.savedPageIndex);if(!t)return!1;const r=(n,s,a,o)=>{if(u(this,Ir).has(n.id)){const l=u(this,Yr).get(o);l?n._setParentAndPosition(l,s,a):(n.pageIndex=o,n.x=s,n.y=a)}};return this.addCommands({cmd:()=>{for(const[n,{newX:s,newY:a,newPageIndex:o}]of e)r(n,s,a,o)},undo:()=>{for(const[n,{savedX:s,savedY:a,savedPageIndex:o}]of e)r(n,s,a,o)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(u(this,ts))for(const r of u(this,ts).keys())r.drag(e,t)}rebuild(e){if(e.parent===null){const t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||u(this,Ht).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return u(this,Vn)===e}getActive(){return u(this,Vn)}getMode(){return u(this,zr)}get imageManager(){return Ct(this,"imageManager",new o0)}getSelectionBoxes(e){if(!e)return null;const t=document.getSelection();for(let c=0,h=t.rangeCount;c<h;c++)if(!e.contains(t.getRangeAt(c).commonAncestorContainer))return null;const{x:r,y:n,width:s,height:a}=e.getBoundingClientRect();let o;switch(e.getAttribute("data-main-rotation")){case"90":o=(c,h,d,p)=>({x:(h-n)/a,y:1-(c+d-r)/s,width:p/a,height:d/s});break;case"180":o=(c,h,d,p)=>({x:1-(c+d-r)/s,y:1-(h+p-n)/a,width:d/s,height:p/a});break;case"270":o=(c,h,d,p)=>({x:1-(h+p-n)/a,y:(c-r)/s,width:p/a,height:d/s});break;default:o=(c,h,d,p)=>({x:(c-r)/s,y:(h-n)/a,width:d/s,height:p/a});break}const l=[];for(let c=0,h=t.rangeCount;c<h;c++){const d=t.getRangeAt(c);if(!d.collapsed)for(const{x:p,y:g,width:y,height:b}of d.getClientRects())y===0||b===0||l.push(o(p,g,y,b))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:e,id:t}){(u(this,Tu)||T(this,Tu,new Map)).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){var t;(t=u(this,Tu))==null||t.delete(e)}renderAnnotationElement(e){var n;const t=(n=u(this,Tu))==null?void 0:n.get(e.data.id);if(!t)return;const r=u(this,Is).getRawValue(t);r&&(u(this,zr)===ot.NONE&&!r.hasBeenModified||r.renderAnnotationElement(e))}setMissingCanvas(e,t,r){var s;const n=(s=u(this,Pa))==null?void 0:s.get(e);n&&(n.setCanvas(t,r),u(this,Pa).delete(e))}addMissingCanvas(e,t){(u(this,Pa)||T(this,Pa,new Map)).set(e,t)}};Cu=new WeakMap,Vn=new WeakMap,Ir=new WeakMap,Yr=new WeakMap,Su=new WeakMap,Is=new WeakMap,Tu=new WeakMap,di=new WeakMap,_a=new WeakMap,Ca=new WeakMap,ku=new WeakMap,Lo=new WeakMap,ts=new WeakMap,Ni=new WeakMap,Oo=new WeakMap,rd=new WeakMap,nd=new WeakMap,Du=new WeakMap,id=new WeakMap,rs=new WeakMap,Sa=new WeakMap,Pu=new WeakMap,Ta=new WeakMap,ns=new WeakMap,cg=new WeakMap,ka=new WeakMap,sd=new WeakMap,Da=new WeakMap,Fo=new WeakMap,Bo=new WeakMap,Pa=new WeakMap,ad=new WeakMap,zr=new WeakMap,Ht=new WeakMap,Ns=new WeakMap,Ra=new WeakMap,zo=new WeakMap,od=new WeakMap,ld=new WeakMap,Ia=new WeakMap,is=new WeakMap,Ms=new WeakMap,ud=new WeakMap,cd=new WeakMap,fi=new WeakMap,ze=new WeakSet,vp=function({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e},u0=function(e){const{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(const r of u(this,Yr).values())if(r.hasTextLayer(e))return r;return null},w1=function(){const e=document.getSelection();if(!e||e.isCollapsed)return;const r=L(this,ze,vp).call(this,e).closest(".textLayer"),n=this.getSelectionBoxes(r);n&&(u(this,ns)||T(this,ns,new B_(this)),u(this,ns).show(r,n,this.direction==="ltr"))},x1=function(){var s,a,o;const e=document.getSelection();if(!e||e.isCollapsed){u(this,Ns)&&((s=u(this,ns))==null||s.hide(),T(this,Ns,null),L(this,ze,yn).call(this,{hasSelectedText:!1}));return}const{anchorNode:t}=e;if(t===u(this,Ns))return;const n=L(this,ze,vp).call(this,e).closest(".textLayer");if(!n){u(this,Ns)&&((a=u(this,ns))==null||a.hide(),T(this,Ns,null),L(this,ze,yn).call(this,{hasSelectedText:!1}));return}if((o=u(this,ns))==null||o.hide(),T(this,Ns,t),L(this,ze,yn).call(this,{hasSelectedText:!0}),!(u(this,zr)!==ot.HIGHLIGHT&&u(this,zr)!==ot.NONE)&&(u(this,zr)===ot.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),T(this,Ta,this.isShiftKeyDown),!this.isShiftKeyDown)){const l=u(this,zr)===ot.HIGHLIGHT?L(this,ze,u0).call(this,n):null;l==null||l.toggleDrawing();const c=new AbortController,h=this.combinedSignal(c),d=p=>{p.type==="pointerup"&&p.button!==0||(c.abort(),l==null||l.toggleDrawing(!0),p.type==="pointerup"&&L(this,ze,yp).call(this,"main_toolbar"))};window.addEventListener("pointerup",d,{signal:h}),window.addEventListener("blur",d,{signal:h})}},yp=function(e=""){u(this,zr)===ot.HIGHLIGHT?this.highlightSelection(e):u(this,rd)&&L(this,ze,w1).call(this)},A1=function(){document.addEventListener("selectionchange",L(this,ze,x1).bind(this),{signal:this._signal})},E1=function(){if(u(this,Sa))return;T(this,Sa,new AbortController);const e=this.combinedSignal(u(this,Sa));window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})},_1=function(){var e;(e=u(this,Sa))==null||e.abort(),T(this,Sa,null)},c0=function(){if(u(this,Da))return;T(this,Da,new AbortController);const e=this.combinedSignal(u(this,Da));window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})},C1=function(){var e;(e=u(this,Da))==null||e.abort(),T(this,Da,null)},h0=function(){if(u(this,_a))return;T(this,_a,new AbortController);const e=this.combinedSignal(u(this,_a));document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})},d0=function(){var e;(e=u(this,_a))==null||e.abort(),T(this,_a,null)},S1=function(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})},yn=function(e){Object.entries(e).some(([r,n])=>u(this,ld)[r]!==n)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(u(this,ld),e)}),u(this,zr)===ot.HIGHLIGHT&&e.hasSelectedEditor===!1&&L(this,ze,ks).call(this,[[kt.HIGHLIGHT_FREE,!0]]))},ks=function(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})},T1=async function(){if(!u(this,ka)){T(this,ka,!0);const e=[];for(const t of u(this,Yr).values())e.push(t.enable());await Promise.all(e);for(const t of u(this,Ir).values())t.enable()}},k1=function(){if(this.unselectAll(),u(this,ka)){T(this,ka,!1);for(const e of u(this,Yr).values())e.disable();for(const e of u(this,Ir).values())e.disable()}},f0=function(e){const t=u(this,Yr).get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))},D1=function(){let e=null;for(e of u(this,Ht));return e},lh=function(){if(u(this,Ir).size===0)return!0;if(u(this,Ir).size===1)for(const e of u(this,Ir).values())return e.isEmpty();return!1},p0=function(e){for(const t of u(this,Ht))t.unselect();u(this,Ht).clear();for(const t of e)t.isEmpty()||(u(this,Ht).add(t),t.select());L(this,ze,yn).call(this,{hasSelectedEditor:this.hasSelection})},Ie(mu,"TRANSLATE_SMALL",1),Ie(mu,"TRANSLATE_BIG",10);let oo=mu;var jr,ss,Mi,Ru,as,qn,Iu,os,Rn,Ls,jo,ls,Na,Gi,uh,wp;const wn=class wn{constructor(e){N(this,Gi);N(this,jr,null);N(this,ss,!1);N(this,Mi,null);N(this,Ru,null);N(this,as,null);N(this,qn,null);N(this,Iu,!1);N(this,os,null);N(this,Rn,null);N(this,Ls,null);N(this,jo,null);N(this,ls,!1);T(this,Rn,e),T(this,ls,e._uiManager.useNewAltTextFlow),u(wn,Na)||T(wn,Na,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(e){wn._l10n??(wn._l10n=e)}async render(){const e=T(this,Mi,document.createElement("button"));e.className="altText",e.tabIndex="0";const t=T(this,Ru,document.createElement("span"));e.append(t),u(this,ls)?(e.classList.add("new"),e.setAttribute("data-l10n-id",u(wn,Na).missing),t.setAttribute("data-l10n-id",u(wn,Na)["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const r=u(this,Rn)._uiManager._signal;e.addEventListener("contextmenu",Ei,{signal:r}),e.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:r});const n=s=>{s.preventDefault(),u(this,Rn)._uiManager.editAltText(u(this,Rn)),u(this,ls)&&u(this,Rn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:u(this,Gi,uh)}})};return e.addEventListener("click",n,{capture:!0,signal:r}),e.addEventListener("keydown",s=>{s.target===e&&s.key==="Enter"&&(T(this,Iu,!0),n(s))},{signal:r}),await L(this,Gi,wp).call(this),e}finish(){u(this,Mi)&&(u(this,Mi).focus({focusVisible:u(this,Iu)}),T(this,Iu,!1))}isEmpty(){return u(this,ls)?u(this,jr)===null:!u(this,jr)&&!u(this,ss)}hasData(){return u(this,ls)?u(this,jr)!==null||!!u(this,Ls):this.isEmpty()}get guessedText(){return u(this,Ls)}async setGuessedText(e){u(this,jr)===null&&(T(this,Ls,e),T(this,jo,await wn._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e})),L(this,Gi,wp).call(this))}toggleAltTextBadge(e=!1){var t;if(!u(this,ls)||u(this,jr)){(t=u(this,os))==null||t.remove(),T(this,os,null);return}if(!u(this,os)){const r=T(this,os,document.createElement("div"));r.className="noAltTextBadge",u(this,Rn).div.append(r)}u(this,os).classList.toggle("hidden",!e)}serialize(e){let t=u(this,jr);return!e&&u(this,Ls)===t&&(t=u(this,jo)),{altText:t,decorative:u(this,ss),guessedText:u(this,Ls),textWithDisclaimer:u(this,jo)}}get data(){return{altText:u(this,jr),decorative:u(this,ss)}}set data({altText:e,decorative:t,guessedText:r,textWithDisclaimer:n,cancel:s=!1}){r&&(T(this,Ls,r),T(this,jo,n)),!(u(this,jr)===e&&u(this,ss)===t)&&(s||(T(this,jr,e),T(this,ss,t)),L(this,Gi,wp).call(this))}toggle(e=!1){u(this,Mi)&&(!e&&u(this,qn)&&(clearTimeout(u(this,qn)),T(this,qn,null)),u(this,Mi).disabled=!e)}shown(){u(this,Rn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:u(this,Gi,uh)}})}destroy(){var e,t;(e=u(this,Mi))==null||e.remove(),T(this,Mi,null),T(this,Ru,null),T(this,as,null),(t=u(this,os))==null||t.remove(),T(this,os,null)}};jr=new WeakMap,ss=new WeakMap,Mi=new WeakMap,Ru=new WeakMap,as=new WeakMap,qn=new WeakMap,Iu=new WeakMap,os=new WeakMap,Rn=new WeakMap,Ls=new WeakMap,jo=new WeakMap,ls=new WeakMap,Na=new WeakMap,Gi=new WeakSet,uh=function(){return u(this,jr)&&"added"||u(this,jr)===null&&this.guessedText&&"review"||"missing"},wp=async function(){var n,s,a;const e=u(this,Mi);if(!e)return;if(u(this,ls)){if(e.classList.toggle("done",!!u(this,jr)),e.setAttribute("data-l10n-id",u(wn,Na)[u(this,Gi,uh)]),(n=u(this,Ru))==null||n.setAttribute("data-l10n-id",u(wn,Na)[`${u(this,Gi,uh)}-label`]),!u(this,jr)){(s=u(this,as))==null||s.remove();return}}else{if(!u(this,jr)&&!u(this,ss)){e.classList.remove("done"),(a=u(this,as))==null||a.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let t=u(this,as);if(!t){T(this,as,t=document.createElement("span")),t.className="tooltip",t.setAttribute("role","tooltip"),t.id=`alt-text-tooltip-${u(this,Rn).id}`;const o=100,l=u(this,Rn)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(u(this,qn)),T(this,qn,null)},{once:!0}),e.addEventListener("mouseenter",()=>{T(this,qn,setTimeout(()=>{T(this,qn,null),u(this,as).classList.add("show"),u(this,Rn)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:l}),e.addEventListener("mouseleave",()=>{var c;u(this,qn)&&(clearTimeout(u(this,qn)),T(this,qn,null)),(c=u(this,as))==null||c.classList.remove("show")},{signal:l})}u(this,ss)?t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(t.removeAttribute("data-l10n-id"),t.textContent=u(this,jr)),t.parentNode||e.append(t);const r=u(this,Rn).getElementForAltText();r==null||r.setAttribute("aria-describedby",t.id)},N(wn,Na,null),Ie(wn,"_l10n",null);let Zp=wn;var Nu,Uo,hd,dd,fd,pd,gd,Os,Ho,Fs,$o,Bs,po,P1,R1,I1;const vv=class vv{constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:r=null,onPinchStart:n=null,onPinching:s=null,onPinchEnd:a=null,signal:o}){N(this,po);N(this,Nu);N(this,Uo,!1);N(this,hd,null);N(this,dd);N(this,fd);N(this,pd);N(this,gd);N(this,Os,null);N(this,Ho);N(this,Fs,null);N(this,$o);N(this,Bs,null);T(this,Nu,e),T(this,hd,r),T(this,dd,t),T(this,fd,n),T(this,pd,s),T(this,gd,a),T(this,$o,new AbortController),T(this,Ho,AbortSignal.any([o,u(this,$o).signal])),e.addEventListener("touchstart",L(this,po,P1).bind(this),{passive:!1,signal:u(this,Ho)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Wi.pixelRatio}destroy(){var e,t;(e=u(this,$o))==null||e.abort(),T(this,$o,null),(t=u(this,Os))==null||t.abort(),T(this,Os,null)}};Nu=new WeakMap,Uo=new WeakMap,hd=new WeakMap,dd=new WeakMap,fd=new WeakMap,pd=new WeakMap,gd=new WeakMap,Os=new WeakMap,Ho=new WeakMap,Fs=new WeakMap,$o=new WeakMap,Bs=new WeakMap,po=new WeakSet,P1=function(e){var n,s,a;if((n=u(this,dd))!=null&&n.call(this))return;if(e.touches.length===1){if(u(this,Os))return;const o=T(this,Os,new AbortController),l=AbortSignal.any([u(this,Ho),o.signal]),c=u(this,Nu),h={capture:!0,signal:l,passive:!1},d=p=>{var g;p.pointerType==="touch"&&((g=u(this,Os))==null||g.abort(),T(this,Os,null))};c.addEventListener("pointerdown",p=>{p.pointerType==="touch"&&(_r(p),d(p))},h),c.addEventListener("pointerup",d,h),c.addEventListener("pointercancel",d,h);return}if(!u(this,Bs)){T(this,Bs,new AbortController);const o=AbortSignal.any([u(this,Ho),u(this,Bs).signal]),l=u(this,Nu),c={signal:o,capture:!1,passive:!1};l.addEventListener("touchmove",L(this,po,R1).bind(this),c);const h=L(this,po,I1).bind(this);l.addEventListener("touchend",h,c),l.addEventListener("touchcancel",h,c),c.capture=!0,l.addEventListener("pointerdown",_r,c),l.addEventListener("pointermove",_r,c),l.addEventListener("pointercancel",_r,c),l.addEventListener("pointerup",_r,c),(s=u(this,fd))==null||s.call(this)}if(_r(e),e.touches.length!==2||(a=u(this,hd))!=null&&a.call(this)){T(this,Fs,null);return}let[t,r]=e.touches;t.identifier>r.identifier&&([t,r]=[r,t]),T(this,Fs,{touch0X:t.screenX,touch0Y:t.screenY,touch1X:r.screenX,touch1Y:r.screenY})},R1=function(e){var _;if(!u(this,Fs)||e.touches.length!==2)return;_r(e);let[t,r]=e.touches;t.identifier>r.identifier&&([t,r]=[r,t]);const{screenX:n,screenY:s}=t,{screenX:a,screenY:o}=r,l=u(this,Fs),{touch0X:c,touch0Y:h,touch1X:d,touch1Y:p}=l,g=d-c,y=p-h,b=a-n,w=o-s,v=Math.hypot(b,w)||1,A=Math.hypot(g,y)||1;if(!u(this,Uo)&&Math.abs(A-v)<=vv.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=n,l.touch0Y=s,l.touch1X=a,l.touch1Y=o,!u(this,Uo)){T(this,Uo,!0);return}const E=[(n+a)/2,(s+o)/2];(_=u(this,pd))==null||_.call(this,E,A,v)},I1=function(e){var t;e.touches.length>=2||(u(this,Bs)&&(u(this,Bs).abort(),T(this,Bs,null),(t=u(this,gd))==null||t.call(this)),u(this,Fs)&&(_r(e),T(this,Fs,null),T(this,Uo,!1)))};let Ih=vv;var Vo,Li,or,Mu,Ma,md,qo,Zr,Go,zs,La,bd,Wo,Gn,vd,Xo,js,us,Lu,Ou,pi,Yo,yd,hg,tt,g0,wd,m0,xp,N1,M1,b0,Ap,v0,L1,O1,F1,y0,B1,w0,z1,j1,U1,x0,ch;const vt=class vt{constructor(e){N(this,tt);N(this,Vo,null);N(this,Li,null);N(this,or,null);N(this,Mu,!1);N(this,Ma,null);N(this,md,"");N(this,qo,!1);N(this,Zr,null);N(this,Go,null);N(this,zs,null);N(this,La,null);N(this,bd,"");N(this,Wo,!1);N(this,Gn,null);N(this,vd,!1);N(this,Xo,!1);N(this,js,!1);N(this,us,null);N(this,Lu,0);N(this,Ou,0);N(this,pi,null);N(this,Yo,null);Ie(this,"isSelected",!1);Ie(this,"_isCopy",!1);Ie(this,"_editToolbar",null);Ie(this,"_initialOptions",Object.create(null));Ie(this,"_initialData",null);Ie(this,"_isVisible",!0);Ie(this,"_uiManager",null);Ie(this,"_focusEventsAllowed",!0);N(this,yd,!1);N(this,hg,vt._zIndex++);this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null,this.annotationElementId=e.annotationElementId||null;const{rotation:t,rawDims:{pageWidth:r,pageHeight:n,pageX:s,pageY:a}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[r,n],this.pageTranslation=[s,a];const[o,l]=this.parentDimensions;this.x=e.x/o,this.y=e.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=vt.prototype._resizeWithKeyboard,t=oo.TRANSLATE_SMALL,r=oo.TRANSLATE_BIG;return Ct(this,"_resizerKeyboardManager",new Df([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-r,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[r,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-r]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,r]}],[["Escape","mac+Escape"],vt.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 Ct(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new U_({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,t){if(vt._l10n??(vt._l10n=e),vt._l10nResizer||(vt._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"})),vt._borderLineWidth!==-1)return;const r=getComputedStyle(document.documentElement);vt._borderLineWidth=parseFloat(r.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){Wt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return u(this,yd)}set _isDraggable(e){var t;T(this,yd,e),(t=this.div)==null||t.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=u(this,hg)}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):L(this,tt,ch).call(this),this.parent=e}focusin(e){this._focusEventsAllowed&&(u(this,Wo)?T(this,Wo,!1):this.parent.setSelected(this))}focusout(e){var r;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const t=e.relatedTarget;t!=null&&t.closest(`#${this.id}`)||(e.preventDefault(),(r=this.parent)!=null&&r.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,r,n){const[s,a]=this.parentDimensions;[r,n]=this.screenToPageTranslation(r,n),this.x=(e+r)/s,this.y=(t+n)/a,this.fixAndSetPosition()}_moveAfterPaste(e,t){const[r,n]=this.parentDimensions;this.setAt(e*r,t*n,this.width*r,this.height*n),this._onTranslated()}translate(e,t){L(this,tt,g0).call(this,this.parentDimensions,e,t)}translateInPage(e,t){u(this,Gn)||T(this,Gn,[this.x,this.y,this.width,this.height]),L(this,tt,g0).call(this,this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){u(this,Gn)||T(this,Gn,[this.x,this.y,this.width,this.height]);const{div:r,parentDimensions:[n,s]}=this;if(this.x+=e/n,this.y+=t/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:d,y:p}=this.div.getBoundingClientRect();this.parent.findNewParent(this,d,p)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this;const[l,c]=this.getBaseTranslation();a+=l,o+=c;const{style:h}=r;h.left=`${(100*a).toFixed(2)}%`,h.top=`${(100*o).toFixed(2)}%`,this._onTranslating(a,o),r.scrollIntoView({block:"nearest"})}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!u(this,Gn)&&(u(this,Gn)[0]!==this.x||u(this,Gn)[1]!==this.y)}get _hasBeenResized(){return!!u(this,Gn)&&(u(this,Gn)[2]!==this.width||u(this,Gn)[3]!==this.height)}getBaseTranslation(){const[e,t]=this.parentDimensions,{_borderLineWidth:r}=vt,n=r/e,s=r/t;switch(this.rotation){case 90:return[-n,s];case 180:return[n,s];case 270:return[n,-s];default:return[-n,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:t},pageDimensions:[r,n]}=this;let{x:s,y:a,width:o,height:l}=this;if(o*=r,l*=n,s*=r,a*=n,this._mustFixPosition)switch(e){case 0:s=dn(s,0,r-o),a=dn(a,0,n-l);break;case 90:s=dn(s,0,r-l),a=dn(a,o,n);break;case 180:s=dn(s,o,r),a=dn(a,l,n);break;case 270:s=dn(s,l,r),a=dn(a,0,n-o);break}this.x=s/=r,this.y=a/=n;const[c,h]=this.getBaseTranslation();s+=c,a+=h,t.left=`${(100*s).toFixed(2)}%`,t.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,t){var r;return L(r=vt,wd,m0).call(r,e,t,this.parentRotation)}pageTranslationToScreen(e,t){var r;return L(r=vt,wd,m0).call(r,e,t,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[t,r]}=this;return[t*e,r*e]}setDims(e,t){const[r,n]=this.parentDimensions,{style:s}=this.div;s.width=`${(100*e/r).toFixed(2)}%`,u(this,qo)||(s.height=`${(100*t/n).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:t,width:r}=e,n=r.endsWith("%"),s=!u(this,qo)&&t.endsWith("%");if(n&&s)return;const[a,o]=this.parentDimensions;n||(e.width=`${(100*parseFloat(r)/a).toFixed(2)}%`),!u(this,qo)&&!s&&(e.height=`${(100*parseFloat(t)/o).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}_onResized(){}static _round(e){return Math.round(e*1e4)/1e4}_onResizing(){}altTextFinish(){var e;(e=u(this,or))==null||e.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||u(this,Xo))return this._editToolbar;this._editToolbar=new a0(this),this.div.append(this._editToolbar.render());const{toolbarButtons:e}=this;if(e)for(const[t,r]of e)await this._editToolbar.addButton(t,r);return this._editToolbar.addButton("delete"),this._editToolbar}removeEditToolbar(){var e;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(e=u(this,or))==null||e.destroy())}addContainer(e){var r;const t=(r=this._editToolbar)==null?void 0:r.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return u(this,or)||(Zp.initialize(vt._l10n),T(this,or,new Zp(this)),u(this,Vo)&&(u(this,or).data=u(this,Vo),T(this,Vo,null))),u(this,or)}get altTextData(){var e;return(e=u(this,or))==null?void 0:e.data}set altTextData(e){u(this,or)&&(u(this,or).data=e)}get guessedAltText(){var e;return(e=u(this,or))==null?void 0:e.guessedText}async setGuessedAltText(e){var t;await((t=u(this,or))==null?void 0:t.setGuessedText(e))}serializeAltText(e){var t;return(t=u(this,or))==null?void 0:t.serialize(e)}hasAltText(){return!!u(this,or)&&!u(this,or).isEmpty()}hasAltTextData(){var e;return((e=u(this,or))==null?void 0:e.hasData())??!1}render(){var a;const e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=u(this,Mu)?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),L(this,tt,w0).call(this);const[t,r]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth=`${(100*r/t).toFixed(2)}%`,e.style.maxHeight=`${(100*t/r).toFixed(2)}%`);const[n,s]=this.getInitialTranslation();return this.translate(n,s),v1(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(u(this,Yo)||T(this,Yo,new Ih({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:L(this,tt,L1).bind(this),onPinching:L(this,tt,O1).bind(this),onPinchEnd:L(this,tt,F1).bind(this),signal:this._uiManager._signal}))),(a=this._uiManager._editorUndoBar)==null||a.hide(),e}pointerdown(e){const{isMac:t}=Gr.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(T(this,Wo,!0),this._isDraggable){L(this,tt,B1).call(this,e);return}L(this,tt,y0).call(this,e)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){u(this,us)&&clearTimeout(u(this,us)),T(this,us,setTimeout(()=>{var e;T(this,us,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,t,r){e.changeParent(this),this.x=t,this.y=r,this.fixAndSetPosition(),this._onTranslated()}getRect(e,t,r=this.rotation){const n=this.parentScale,[s,a]=this.pageDimensions,[o,l]=this.pageTranslation,c=e/n,h=t/n,d=this.x*s,p=this.y*a,g=this.width*s,y=this.height*a;switch(r){case 0:return[d+c+o,a-p-h-y+l,d+c+g+o,a-p-h+l];case 90:return[d+h+o,a-p+c+l,d+h+y+o,a-p+c+g+l];case 180:return[d-c-g+o,a-p+h+l,d-c+o,a-p+h+y+l];case 270:return[d-h-y+o,a-p-c-g+l,d-h+o,a-p-c+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[r,n,s,a]=e,o=s-r,l=a-n;switch(this.rotation){case 0:return[r,t-a,o,l];case 90:return[r,t-n,l,o];case 180:return[s,t-n,o,l];case 270:return[s,t-a,l,o];default:throw new Error("Invalid rotation")}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),T(this,Xo,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),T(this,Xo,!1),!0):!1}isInEditMode(){return u(this,Xo)}shouldGetKeyboardEvents(){return u(this,js)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:t,bottom:r,right:n}=this.getClientDimensions(),{innerHeight:s,innerWidth:a}=window;return t<a&&n>0&&e<s&&r>0}rebuild(){L(this,tt,w0).call(this)}rotate(e){}resize(){}serializeDeleted(){var e;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((e=this._initialData)==null?void 0:e.popupRef)||""}}serialize(e=!1,t=null){Wt("An editor must be serializable")}static async deserialize(e,t,r){const n=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:r,annotationElementId:e.annotationElementId});n.rotation=e.rotation,T(n,Vo,e.accessibilityData),n._isCopy=e.isCopy||!1;const[s,a]=n.pageDimensions,[o,l,c,h]=n.getRectInCurrentCoords(e.rect,a);return n.x=o/s,n.y=l/a,n.width=c/s,n.height=h/a,n}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e,t;if((e=u(this,La))==null||e.abort(),T(this,La,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),u(this,us)&&(clearTimeout(u(this,us)),T(this,us,null)),L(this,tt,ch).call(this),this.removeEditToolbar(),u(this,pi)){for(const r of u(this,pi).values())clearTimeout(r);T(this,pi,null)}this.parent=null,(t=u(this,Yo))==null||t.destroy(),T(this,Yo,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(L(this,tt,N1).call(this),u(this,Zr).classList.remove("hidden"))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),T(this,zs,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const t=u(this,Zr).children;if(!u(this,Li)){T(this,Li,Array.from(t));const a=L(this,tt,z1).bind(this),o=L(this,tt,j1).bind(this),l=this._uiManager._signal;for(const c of u(this,Li)){const h=c.getAttribute("data-resizer-name");c.setAttribute("role","spinbutton"),c.addEventListener("keydown",a,{signal:l}),c.addEventListener("blur",o,{signal:l}),c.addEventListener("focus",L(this,tt,U1).bind(this,h),{signal:l}),c.setAttribute("data-l10n-id",vt._l10nResizer[h])}}const r=u(this,Li)[0];let n=0;for(const a of t){if(a===r)break;n++}const s=(360-this.rotation+this.parentRotation)%360/90*(u(this,Li).length/4);if(s!==n){if(s<n)for(let o=0;o<n-s;o++)u(this,Zr).append(u(this,Zr).firstChild);else if(s>n)for(let o=0;o<s-n;o++)u(this,Zr).firstChild.before(u(this,Zr).lastChild);let a=0;for(const o of t){const c=u(this,Li)[a++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",vt._l10nResizer[c])}}L(this,tt,x0).call(this,0),T(this,js,!0),u(this,Zr).firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,t){u(this,js)&&L(this,tt,v0).call(this,u(this,bd),{deltaX:e,deltaY:t,fromKeyboard:!0})}_stopResizingWithKeyboard(){L(this,tt,ch).call(this),this.div.focus()}select(){var e,t,r;if(!(this.isSelected&&this._editToolbar)){if(this.isSelected=!0,this.makeResizable(),(e=this.div)==null||e.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var n,s;(n=this.div)!=null&&n.classList.contains("selectedEditor")&&((s=this._editToolbar)==null||s.show())});return}(t=this._editToolbar)==null||t.show(),(r=u(this,or))==null||r.toggleAltTextBadge(!1)}}unselect(){var e,t,r,n,s;this.isSelected&&(this.isSelected=!1,(e=u(this,Zr))==null||e.classList.add("hidden"),(t=this.div)==null||t.classList.remove("selectedEditor"),(r=this.div)!=null&&r.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(n=this._editToolbar)==null||n.hide(),(s=u(this,or))==null||s.toggleAltTextBadge(!0))}updateParams(e,t){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id})}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return u(this,vd)}set isEditing(e){T(this,vd,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,t){T(this,qo,!0);const r=e/t,{style:n}=this.div;n.aspectRatio=r,n.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,t=!1){if(t){u(this,pi)||T(this,pi,new Map);const{action:r}=e;let n=u(this,pi).get(r);n&&clearTimeout(n),n=setTimeout(()=>{this._reportTelemetry(e),u(this,pi).delete(r),u(this,pi).size===0&&T(this,pi,null)},vt._telemetryTimeout),u(this,pi).set(r,n);return}e.type||(e.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),T(this,Mu,!1)}disable(){this.div&&(this.div.tabIndex=-1),T(this,Mu,!0)}renderAnnotationElement(e){let t=e.container.querySelector(".annotationContent");if(!t)t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.container.prepend(t);else if(t.nodeName==="CANVAS"){const r=t;t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),r.before(t)}return t}resetAnnotationElement(e){const{firstChild:t}=e.container;(t==null?void 0:t.nodeName)==="DIV"&&t.classList.contains("annotationContent")&&t.remove()}};Vo=new WeakMap,Li=new WeakMap,or=new WeakMap,Mu=new WeakMap,Ma=new WeakMap,md=new WeakMap,qo=new WeakMap,Zr=new WeakMap,Go=new WeakMap,zs=new WeakMap,La=new WeakMap,bd=new WeakMap,Wo=new WeakMap,Gn=new WeakMap,vd=new WeakMap,Xo=new WeakMap,js=new WeakMap,us=new WeakMap,Lu=new WeakMap,Ou=new WeakMap,pi=new WeakMap,Yo=new WeakMap,yd=new WeakMap,hg=new WeakMap,tt=new WeakSet,g0=function([e,t],r,n){[r,n]=this.screenToPageTranslation(r,n),this.x+=r/e,this.y+=n/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},wd=new WeakSet,m0=function(e,t,r){switch(r){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}},xp=function(e){switch(e){case 90:{const[t,r]=this.pageDimensions;return[0,-t/r,r/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,r]=this.pageDimensions;return[0,t/r,-r/t,0]}default:return[1,0,0,1]}},N1=function(){if(u(this,Zr))return;T(this,Zr,document.createElement("div")),u(this,Zr).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],t=this._uiManager._signal;for(const r of e){const n=document.createElement("div");u(this,Zr).append(n),n.classList.add("resizer",r),n.setAttribute("data-resizer-name",r),n.addEventListener("pointerdown",L(this,tt,M1).bind(this,r),{signal:t}),n.addEventListener("contextmenu",Ei,{signal:t}),n.tabIndex=-1}this.div.prepend(u(this,Zr))},M1=function(e,t){var h;t.preventDefault();const{isMac:r}=Gr.platform;if(t.button!==0||t.ctrlKey&&r)return;(h=u(this,or))==null||h.toggle(!1);const n=this._isDraggable;this._isDraggable=!1,T(this,Go,[t.screenX,t.screenY]);const s=new AbortController,a=this._uiManager.combinedSignal(s);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",L(this,tt,v0).bind(this,e),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",_r,{passive:!1,signal:a}),window.addEventListener("contextmenu",Ei,{signal:a}),T(this,zs,{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(t.target).cursor;const c=()=>{var d;s.abort(),this.parent.togglePointerEvents(!0),(d=u(this,or))==null||d.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=o,this.div.style.cursor=l,L(this,tt,Ap).call(this)};window.addEventListener("pointerup",c,{signal:a}),window.addEventListener("blur",c,{signal:a})},b0=function(e,t,r,n){this.width=r,this.height=n,this.x=e,this.y=t;const[s,a]=this.parentDimensions;this.setDims(s*r,a*n),this.fixAndSetPosition(),this._onResized()},Ap=function(){if(!u(this,zs))return;const{savedX:e,savedY:t,savedWidth:r,savedHeight:n}=u(this,zs);T(this,zs,null);const s=this.x,a=this.y,o=this.width,l=this.height;s===e&&a===t&&o===r&&l===n||this.addCommands({cmd:L(this,tt,b0).bind(this,s,a,o,l),undo:L(this,tt,b0).bind(this,e,t,r,n),mustExec:!0})},v0=function(e,t){const[r,n]=this.parentDimensions,s=this.x,a=this.y,o=this.width,l=this.height,c=vt.MIN_SIZE/r,h=vt.MIN_SIZE/n,d=L(this,tt,xp).call(this,this.rotation),p=(Y,W)=>[d[0]*Y+d[2]*W,d[1]*Y+d[3]*W],g=L(this,tt,xp).call(this,360-this.rotation),y=(Y,W)=>[g[0]*Y+g[2]*W,g[1]*Y+g[3]*W];let b,w,v=!1,A=!1;switch(e){case"topLeft":v=!0,b=(Y,W)=>[0,0],w=(Y,W)=>[Y,W];break;case"topMiddle":b=(Y,W)=>[Y/2,0],w=(Y,W)=>[Y/2,W];break;case"topRight":v=!0,b=(Y,W)=>[Y,0],w=(Y,W)=>[0,W];break;case"middleRight":A=!0,b=(Y,W)=>[Y,W/2],w=(Y,W)=>[0,W/2];break;case"bottomRight":v=!0,b=(Y,W)=>[Y,W],w=(Y,W)=>[0,0];break;case"bottomMiddle":b=(Y,W)=>[Y/2,W],w=(Y,W)=>[Y/2,0];break;case"bottomLeft":v=!0,b=(Y,W)=>[0,W],w=(Y,W)=>[Y,0];break;case"middleLeft":A=!0,b=(Y,W)=>[0,W/2],w=(Y,W)=>[Y,W/2];break}const E=b(o,l),_=w(o,l);let C=p(..._);const I=vt._round(s+C[0]),k=vt._round(a+C[1]);let D=1,R=1,z,q;if(t.fromKeyboard)({deltaX:z,deltaY:q}=t);else{const{screenX:Y,screenY:W}=t,[fe,K]=u(this,Go);[z,q]=this.screenToPageTranslation(Y-fe,W-K),u(this,Go)[0]=Y,u(this,Go)[1]=W}if([z,q]=y(z/r,q/n),v){const Y=Math.hypot(o,l);D=R=Math.max(Math.min(Math.hypot(_[0]-E[0]-z,_[1]-E[1]-q)/Y,1/o,1/l),c/o,h/l)}else A?D=dn(Math.abs(_[0]-E[0]-z),c,1)/o:R=dn(Math.abs(_[1]-E[1]-q),h,1)/l;const O=vt._round(o*D),X=vt._round(l*R);C=p(...w(O,X));const S=I-C[0],J=k-C[1];u(this,Gn)||T(this,Gn,[this.x,this.y,this.width,this.height]),this.width=O,this.height=X,this.x=S,this.y=J,this.setDims(r*O,n*X),this.fixAndSetPosition(),this._onResizing()},L1=function(){var e;T(this,zs,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(e=u(this,or))==null||e.toggle(!1),this.parent.togglePointerEvents(!1)},O1=function(e,t,r){let s=.7*(r/t)+1-.7;if(s===1)return;const a=L(this,tt,xp).call(this,this.rotation),o=(I,k)=>[a[0]*I+a[2]*k,a[1]*I+a[3]*k],[l,c]=this.parentDimensions,h=this.x,d=this.y,p=this.width,g=this.height,y=vt.MIN_SIZE/l,b=vt.MIN_SIZE/c;s=Math.max(Math.min(s,1/p,1/g),y/p,b/g);const w=vt._round(p*s),v=vt._round(g*s);if(w===p&&v===g)return;u(this,Gn)||T(this,Gn,[h,d,p,g]);const A=o(p/2,g/2),E=vt._round(h+A[0]),_=vt._round(d+A[1]),C=o(w/2,v/2);this.x=E-C[0],this.y=_-C[1],this.width=w,this.height=v,this.setDims(l*w,c*v),this.fixAndSetPosition(),this._onResizing()},F1=function(){var e;(e=u(this,or))==null||e.toggle(!0),this.parent.togglePointerEvents(!0),L(this,tt,Ap).call(this)},y0=function(e){const{isMac:t}=Gr.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)},B1=function(e){const{isSelected:t}=this;this._uiManager.setUpDragSession();let r=!1;const n=new AbortController,s=this._uiManager.combinedSignal(n),a={capture:!0,passive:!1,signal:s},o=c=>{n.abort(),T(this,Ma,null),T(this,Wo,!1),this._uiManager.endDragSession()||L(this,tt,y0).call(this,c),r&&this._onStopDragging()};t&&(T(this,Lu,e.clientX),T(this,Ou,e.clientY),T(this,Ma,e.pointerId),T(this,md,e.pointerType),window.addEventListener("pointermove",c=>{r||(r=!0,this._onStartDragging());const{clientX:h,clientY:d,pointerId:p}=c;if(p!==u(this,Ma)){_r(c);return}const[g,y]=this.screenToPageTranslation(h-u(this,Lu),d-u(this,Ou));T(this,Lu,h),T(this,Ou,d),this._uiManager.dragSelectedEditors(g,y)},a),window.addEventListener("touchmove",_r,a),window.addEventListener("pointerdown",c=>{c.pointerType===u(this,md)&&(u(this,Yo)||c.isPrimary)&&o(c),_r(c)},a));const l=c=>{if(!u(this,Ma)||u(this,Ma)===c.pointerId){o(c);return}_r(c)};window.addEventListener("pointerup",l,{signal:s}),window.addEventListener("blur",l,{signal:s})},w0=function(){if(u(this,La)||!this.div)return;T(this,La,new AbortController);const e=this._uiManager.combinedSignal(u(this,La));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})},z1=function(e){vt._resizerKeyboardManager.exec(this,e)},j1=function(e){var t;u(this,js)&&((t=e.relatedTarget)==null?void 0:t.parentNode)!==u(this,Zr)&&L(this,tt,ch).call(this)},U1=function(e){T(this,bd,u(this,js)?e:"")},x0=function(e){if(u(this,Li))for(const t of u(this,Li))t.tabIndex=e},ch=function(){T(this,js,!1),L(this,tt,x0).call(this,-1),L(this,tt,Ap).call(this)},N(vt,wd),Ie(vt,"_l10n",null),Ie(vt,"_l10nResizer",null),Ie(vt,"_borderLineWidth",-1),Ie(vt,"_colorManager",new l0),Ie(vt,"_zIndex",1),Ie(vt,"_telemetryTimeout",1e3);let tr=vt;class U_ extends tr{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const Qv=3285377520,ci=4294901760,Qi=65535;class H1{constructor(e){this.h1=e?e&4294967295:Qv,this.h2=e?e&4294967295:Qv}update(e){let t,r;if(typeof e=="string"){t=new Uint8Array(e.length*2),r=0;for(let b=0,w=e.length;b<w;b++){const v=e.charCodeAt(b);v<=255?t[r++]=v:(t[r++]=v>>>8,t[r++]=v&255)}}else if(ArrayBuffer.isView(e))t=e.slice(),r=t.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const n=r>>2,s=r-n*4,a=new Uint32Array(t.buffer,0,n);let o=0,l=0,c=this.h1,h=this.h2;const d=3432918353,p=461845907,g=d&Qi,y=p&Qi;for(let b=0;b<n;b++)b&1?(o=a[b],o=o*d&ci|o*g&Qi,o=o<<15|o>>>17,o=o*p&ci|o*y&Qi,c^=o,c=c<<13|c>>>19,c=c*5+3864292196):(l=a[b],l=l*d&ci|l*g&Qi,l=l<<15|l>>>17,l=l*p&ci|l*y&Qi,h^=l,h=h<<13|h>>>19,h=h*5+3864292196);switch(o=0,s){case 3:o^=t[n*4+2]<<16;case 2:o^=t[n*4+1]<<8;case 1:o^=t[n*4],o=o*d&ci|o*g&Qi,o=o<<15|o>>>17,o=o*p&ci|o*y&Qi,n&1?c^=o:h^=o}this.h1=c,this.h2=h}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&ci|e*36045&Qi,t=t*4283543511&ci|((t<<16|e>>>16)*2950163797&ci)>>>16,e^=t>>>1,e=e*444984403&ci|e*60499&Qi,t=t*3301882366&ci|((t<<16|e>>>16)*3120437893&ci)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const A0=Object.freeze({map:null,hash:"",transfer:void 0});var Zo,Ko,Kr,dg,$1;class Lb{constructor(){N(this,dg);N(this,Zo,!1);N(this,Ko,null);N(this,Kr,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){const r=u(this,Kr).get(e);return r===void 0?t:Object.assign(t,r)}getRawValue(e){return u(this,Kr).get(e)}remove(e){if(u(this,Kr).delete(e),u(this,Kr).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const t of u(this,Kr).values())if(t instanceof tr)return;this.onAnnotationEditor(null)}}setValue(e,t){const r=u(this,Kr).get(e);let n=!1;if(r!==void 0)for(const[s,a]of Object.entries(t))r[s]!==a&&(n=!0,r[s]=a);else n=!0,u(this,Kr).set(e,t);n&&L(this,dg,$1).call(this),t instanceof tr&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(t.constructor._type)}has(e){return u(this,Kr).has(e)}get size(){return u(this,Kr).size}resetModified(){u(this,Zo)&&(T(this,Zo,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new V1(this)}get serializable(){if(u(this,Kr).size===0)return A0;const e=new Map,t=new H1,r=[],n=Object.create(null);let s=!1;for(const[a,o]of u(this,Kr)){const l=o instanceof tr?o.serialize(!1,n):o;l&&(e.set(a,l),t.update(`${a}:${JSON.stringify(l)}`),s||(s=!!l.bitmap))}if(s)for(const a of e.values())a.bitmap&&r.push(a.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:r}:A0}get editorStats(){let e=null;const t=new Map;for(const r of u(this,Kr).values()){if(!(r instanceof tr))continue;const n=r.telemetryFinalData;if(!n)continue;const{type:s}=n;t.has(s)||t.set(s,Object.getPrototypeOf(r).constructor),e||(e=Object.create(null));const a=e[s]||(e[s]=new Map);for(const[o,l]of Object.entries(n)){if(o==="type")continue;let c=a.get(o);c||(c=new Map,a.set(o,c));const h=c.get(l)??0;c.set(l,h+1)}}for(const[r,n]of t)e[r]=n.computeTelemetryFinalData(e[r]);return e}resetModifiedIds(){T(this,Ko,null)}get modifiedIds(){if(u(this,Ko))return u(this,Ko);const e=[];for(const t of u(this,Kr).values())!(t instanceof tr)||!t.annotationElementId||!t.serialize()||e.push(t.annotationElementId);return T(this,Ko,{ids:new Set(e),hash:e.join(",")})}[Symbol.iterator](){return u(this,Kr).entries()}}Zo=new WeakMap,Ko=new WeakMap,Kr=new WeakMap,dg=new WeakSet,$1=function(){u(this,Zo)||(T(this,Zo,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var xd;class V1 extends Lb{constructor(t){super();N(this,xd);const{map:r,hash:n,transfer:s}=t.serializable,a=structuredClone(r,s?{transfer:s}:null);T(this,xd,{map:a,hash:n,transfer:s})}get print(){Wt("Should not call PrintAnnotationStorage.print")}get serializable(){return u(this,xd)}get modifiedIds(){return Ct(this,"modifiedIds",{ids:new Set,hash:""})}}xd=new WeakMap;var Fu;class H_{constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){N(this,Fu,new Set);this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),u(this,Fu).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:t,_inspectFont:r}){if(!(!e||u(this,Fu).has(e.loadedName))){if(Dr(!t,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:n,src:s,style:a}=e,o=new FontFace(n,s,a);this.addNativeFontFace(o);try{await o.load(),u(this,Fu).add(n),r==null||r(e)}catch{ut(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}Wt("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){const r=e.createNativeFontFace();if(r){this.addNativeFontFace(r);try{await r.loaded}catch(n){throw ut(`Failed to load font '${r.family}': '${n}'.`),e.disableFontFace=!0,n}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(r=>{const n=this._queueLoadingCallback(r);this._prepareFontLoadEvent(e,n)})}}get isFontLoadingAPISupported(){var t;const e=!!((t=this._document)!=null&&t.fonts);return Ct(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return Ct(this,"isSyncFontLoadingSupported",_n||Gr.platform.isFirefox)}_queueLoadingCallback(e){function t(){for(Dr(!n.done,"completeRequest() cannot be called twice."),n.done=!0;r.length>0&&r[0].done;){const s=r.shift();setTimeout(s.callback,0)}}const{loadingRequests:r}=this,n={done:!1,complete:t,callback:e};return r.push(n),n}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Ct(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,t){function r(_,C){return _.charCodeAt(C)<<24|_.charCodeAt(C+1)<<16|_.charCodeAt(C+2)<<8|_.charCodeAt(C+3)&255}function n(_,C,I,k){const D=_.substring(0,C),R=_.substring(C+I);return D+k+R}let s,a;const o=this._document.createElement("canvas");o.width=1,o.height=1;const l=o.getContext("2d");let c=0;function h(_,C){if(++c>30){ut("Load test font never loaded."),C();return}if(l.font="30px "+_,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){C();return}setTimeout(h.bind(null,_,C))}const d=`lt${Date.now()}${this.loadTestFontId++}`;let p=this._loadTestFont;p=n(p,976,d.length,d);const y=16,b=1482184792;let w=r(p,y);for(s=0,a=d.length-3;s<a;s+=4)w=w-b+r(d,s)|0;s<d.length&&(w=w-b+r(d+"XXX",s)|0),p=n(p,y,4,P_(w));const v=`url(data:font/opentype;base64,${btoa(p)});`,A=`@font-face {font-family:"${d}";src:${v}}`;this.insertRule(A);const E=this._document.createElement("div");E.style.visibility="hidden",E.style.width=E.style.height="10px",E.style.position="absolute",E.style.top=E.style.left="0px";for(const _ of[e.loadedName,d]){const C=this._document.createElement("span");C.textContent="Hi",C.style.fontFamily=_,E.append(C)}this._document.body.append(E),h(d,()=>{E.remove(),t.complete()})}}Fu=new WeakMap;class $_{constructor(e,t=null){this.compiledGlyphs=Object.create(null);for(const r in e)this[r]=e[r];this._inspectFont=t}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const r={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(r.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,r)}return(t=this._inspectFont)==null||t.call(this,this),e}createFontFaceRule(){var r;if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${l1(this.data)});`;let t;if(!this.cssFontInfo)t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${n}src:${e}}`}return(r=this._inspectFont)==null||r.call(this,this,e),t}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];const r=this.loadedName+"_path_"+t;let n;try{n=e.get(r)}catch(a){ut(`getPathGenerator - ignoring character: "${a}".`)}const s=new Path2D(n||"");return this.fontExtraProperties||e.delete(r),this.compiledGlyphs[t]=s}}function V_(i){if(i instanceof URL)return i.href;if(typeof i=="string"){if(_n)return i;const e=URL.parse(i,window.location);if(e)return e.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function q_(i){if(_n&&typeof Buffer<"u"&&i instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength)return i;if(typeof i=="string")return Sf(i);if(i instanceof ArrayBuffer||ArrayBuffer.isView(i)||typeof i=="object"&&!isNaN(i==null?void 0:i.length))return new Uint8Array(i);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function ep(i){if(typeof i!="string")return null;if(i.endsWith("/"))return i;throw new Error(`Invalid factory url: "${i}" must include trailing slash.`)}const E0=i=>typeof i=="object"&&Number.isInteger(i==null?void 0:i.num)&&i.num>=0&&Number.isInteger(i==null?void 0:i.gen)&&i.gen>=0,G_=i=>typeof i=="object"&&typeof(i==null?void 0:i.name)=="string",q1=M_.bind(null,E0,G_);var Us,fg;class W_{constructor(){N(this,Us,new Map);N(this,fg,Promise.resolve())}postMessage(e,t){const r={data:structuredClone(e,t?{transfer:t}:null)};u(this,fg).then(()=>{for(const[n]of u(this,Us))n.call(this,r)})}addEventListener(e,t,r=null){let n=null;if((r==null?void 0:r.signal)instanceof AbortSignal){const{signal:s}=r;if(s.aborted){ut("LoopbackPort - cannot use an `aborted` signal.");return}const a=()=>this.removeEventListener(e,t);n=()=>s.removeEventListener("abort",a),s.addEventListener("abort",a)}u(this,Us).set(t,n)}removeEventListener(e,t){const r=u(this,Us).get(t);r==null||r(),u(this,Us).delete(t)}terminate(){for(const[,e]of u(this,Us))e==null||e();u(this,Us).clear()}}Us=new WeakMap,fg=new WeakMap;const tp={DATA:1,ERROR:2},Tr={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Jv(){}function Dn(i){if(i instanceof ha||i instanceof Xp||i instanceof Yv||i instanceof Rh||i instanceof fm)return i;switch(i instanceof Error||typeof i=="object"&&i!==null||Wt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),i.name){case"AbortException":return new ha(i.message);case"InvalidPDFException":return new Xp(i.message);case"PasswordException":return new Yv(i.message,i.code);case"ResponseException":return new Rh(i.message,i.status,i.missing);case"UnknownErrorException":return new fm(i.message,i.details)}return new fm(i.message,i.toString())}var Bu,Ai,G1,W1,X1,Ep;class hh{constructor(e,t,r){N(this,Ai);N(this,Bu,new AbortController);this.sourceName=e,this.targetName=t,this.comObj=r,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),r.addEventListener("message",L(this,Ai,G1).bind(this),{signal:u(this,Bu).signal})}on(e,t){const r=this.actionHandler;if(r[e])throw new Error(`There is already an actionName called "${e}"`);r[e]=t}send(e,t,r){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},r)}sendWithPromise(e,t,r){const n=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[n]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:n,data:t},r)}catch(a){s.reject(a)}return s.promise}sendWithStream(e,t,r,n){const s=this.streamId++,a=this.sourceName,o=this.targetName,l=this.comObj;return new ReadableStream({start:c=>{const h=Promise.withResolvers();return this.streamControllers[s]={controller:c,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:a,targetName:o,action:e,streamId:s,data:t,desiredSize:c.desiredSize},n),h.promise},pull:c=>{const h=Promise.withResolvers();return this.streamControllers[s].pullCall=h,l.postMessage({sourceName:a,targetName:o,stream:Tr.PULL,streamId:s,desiredSize:c.desiredSize}),h.promise},cancel:c=>{Dr(c instanceof Error,"cancel must have a valid reason");const h=Promise.withResolvers();return this.streamControllers[s].cancelCall=h,this.streamControllers[s].isClosed=!0,l.postMessage({sourceName:a,targetName:o,stream:Tr.CANCEL,streamId:s,reason:Dn(c)}),h.promise}},r)}destroy(){var e;(e=u(this,Bu))==null||e.abort(),T(this,Bu,null)}}Bu=new WeakMap,Ai=new WeakSet,G1=function({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){L(this,Ai,X1).call(this,e);return}if(e.callback){const r=e.callbackId,n=this.callbackCapabilities[r];if(!n)throw new Error(`Cannot resolve callback ${r}`);if(delete this.callbackCapabilities[r],e.callback===tp.DATA)n.resolve(e.data);else if(e.callback===tp.ERROR)n.reject(Dn(e.reason));else throw new Error("Unexpected callback case");return}const t=this.actionHandler[e.action];if(!t)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const r=this.sourceName,n=e.sourceName,s=this.comObj;Promise.try(t,e.data).then(function(a){s.postMessage({sourceName:r,targetName:n,callback:tp.DATA,callbackId:e.callbackId,data:a})},function(a){s.postMessage({sourceName:r,targetName:n,callback:tp.ERROR,callbackId:e.callbackId,reason:Dn(a)})});return}if(e.streamId){L(this,Ai,W1).call(this,e);return}t(e.data)},W1=function(e){const t=e.streamId,r=this.sourceName,n=e.sourceName,s=this.comObj,a=this,o=this.actionHandler[e.action],l={enqueue(c,h=1,d){if(this.isCancelled)return;const p=this.desiredSize;this.desiredSize-=h,p>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),s.postMessage({sourceName:r,targetName:n,stream:Tr.ENQUEUE,streamId:t,chunk:c},d)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:r,targetName:n,stream:Tr.CLOSE,streamId:t}),delete a.streamSinks[t])},error(c){Dr(c instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,s.postMessage({sourceName:r,targetName:n,stream:Tr.ERROR,streamId:t,reason:Dn(c)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[t]=l,Promise.try(o,e.data,l).then(function(){s.postMessage({sourceName:r,targetName:n,stream:Tr.START_COMPLETE,streamId:t,success:!0})},function(c){s.postMessage({sourceName:r,targetName:n,stream:Tr.START_COMPLETE,streamId:t,reason:Dn(c)})})},X1=function(e){const t=e.streamId,r=this.sourceName,n=e.sourceName,s=this.comObj,a=this.streamControllers[t],o=this.streamSinks[t];switch(e.stream){case Tr.START_COMPLETE:e.success?a.startCall.resolve():a.startCall.reject(Dn(e.reason));break;case Tr.PULL_COMPLETE:e.success?a.pullCall.resolve():a.pullCall.reject(Dn(e.reason));break;case Tr.PULL:if(!o){s.postMessage({sourceName:r,targetName:n,stream:Tr.PULL_COMPLETE,streamId:t,success:!0});break}o.desiredSize<=0&&e.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=e.desiredSize,Promise.try(o.onPull||Jv).then(function(){s.postMessage({sourceName:r,targetName:n,stream:Tr.PULL_COMPLETE,streamId:t,success:!0})},function(c){s.postMessage({sourceName:r,targetName:n,stream:Tr.PULL_COMPLETE,streamId:t,reason:Dn(c)})});break;case Tr.ENQUEUE:if(Dr(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(e.chunk);break;case Tr.CLOSE:if(Dr(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),L(this,Ai,Ep).call(this,a,t);break;case Tr.ERROR:Dr(a,"error should have stream controller"),a.controller.error(Dn(e.reason)),L(this,Ai,Ep).call(this,a,t);break;case Tr.CANCEL_COMPLETE:e.success?a.cancelCall.resolve():a.cancelCall.reject(Dn(e.reason)),L(this,Ai,Ep).call(this,a,t);break;case Tr.CANCEL:if(!o)break;const l=Dn(e.reason);Promise.try(o.onCancel||Jv,l).then(function(){s.postMessage({sourceName:r,targetName:n,stream:Tr.CANCEL_COMPLETE,streamId:t,success:!0})},function(c){s.postMessage({sourceName:r,targetName:n,stream:Tr.CANCEL_COMPLETE,streamId:t,reason:Dn(c)})}),o.sinkCapability.reject(l),o.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}},Ep=async function(e,t){var r,n,s;await Promise.allSettled([(r=e.startCall)==null?void 0:r.promise,(n=e.pullCall)==null?void 0:n.promise,(s=e.cancelCall)==null?void 0:s.promise]),delete this.streamControllers[t]};var Ad;class Y1{constructor({enableHWA:e=!1}){N(this,Ad,!1);T(this,Ad,e)}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const r=this._createCanvas(e,t);return{canvas:r,context:r.getContext("2d",{willReadFrequently:!u(this,Ad)})}}reset(e,t,r){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||r<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=r}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){Wt("Abstract method `_createCanvas` called.")}}Ad=new WeakMap;class X_ extends Y1{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){const r=this._document.createElement("canvas");return r.width=e,r.height=t,r}}class Z1{constructor({baseUrl:e=null,isCompressed:t=!0}){this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(t).then(r=>({cMapData:r,isCompressed:this.isCompressed})).catch(r=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)})}async _fetch(e){Wt("Abstract method `_fetch` called.")}}class ey extends Z1{async _fetch(e){const t=await Mc(e,this.isCompressed?"arraybuffer":"text");return t instanceof ArrayBuffer?new Uint8Array(t):Sf(t)}}class K1{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,r,n,s){return"none"}destroy(e=!1){}}var Qo,zu,Hs,$s,cn,Jo,el,qe,ln,dh,ou,_p,lu,Q1,_0,uu,fh,ph,C0,gh;class Y_ extends K1{constructor({docId:t,ownerDocument:r=globalThis.document}){super();N(this,qe);N(this,Qo);N(this,zu);N(this,Hs);N(this,$s);N(this,cn);N(this,Jo);N(this,el,0);T(this,$s,t),T(this,cn,r)}addFilter(t){if(!t)return"none";let r=u(this,qe,ln).get(t);if(r)return r;const[n,s,a]=L(this,qe,_p).call(this,t),o=t.length===1?n:`${n}${s}${a}`;if(r=u(this,qe,ln).get(o),r)return u(this,qe,ln).set(t,r),r;const l=`g_${u(this,$s)}_transfer_map_${bn(this,el)._++}`,c=L(this,qe,lu).call(this,l);u(this,qe,ln).set(t,c),u(this,qe,ln).set(o,c);const h=L(this,qe,uu).call(this,l);return L(this,qe,ph).call(this,n,s,a,h),c}addHCMFilter(t,r){var y;const n=`${t}-${r}`,s="base";let a=u(this,qe,dh).get(s);if((a==null?void 0:a.key)===n||(a?((y=a.filter)==null||y.remove(),a.key=n,a.url="none",a.filter=null):(a={key:n,url:"none",filter:null},u(this,qe,dh).set(s,a)),!t||!r))return a.url;const o=L(this,qe,gh).call(this,t);t=Qe.makeHexColor(...o);const l=L(this,qe,gh).call(this,r);if(r=Qe.makeHexColor(...l),u(this,qe,ou).style.color="",t==="#000000"&&r==="#ffffff"||t===r)return a.url;const c=new Array(256);for(let b=0;b<=255;b++){const w=b/255;c[b]=w<=.03928?w/12.92:((w+.055)/1.055)**2.4}const h=c.join(","),d=`g_${u(this,$s)}_hcm_filter`,p=a.filter=L(this,qe,uu).call(this,d);L(this,qe,ph).call(this,h,h,h,p),L(this,qe,_0).call(this,p);const g=(b,w)=>{const v=o[b]/255,A=l[b]/255,E=new Array(w+1);for(let _=0;_<=w;_++)E[_]=v+_/w*(A-v);return E.join(",")};return L(this,qe,ph).call(this,g(0,5),g(1,5),g(2,5),p),a.url=L(this,qe,lu).call(this,d),a.url}addAlphaFilter(t){let r=u(this,qe,ln).get(t);if(r)return r;const[n]=L(this,qe,_p).call(this,[t]),s=`alpha_${n}`;if(r=u(this,qe,ln).get(s),r)return u(this,qe,ln).set(t,r),r;const a=`g_${u(this,$s)}_alpha_map_${bn(this,el)._++}`,o=L(this,qe,lu).call(this,a);u(this,qe,ln).set(t,o),u(this,qe,ln).set(s,o);const l=L(this,qe,uu).call(this,a);return L(this,qe,C0).call(this,n,l),o}addLuminosityFilter(t){let r=u(this,qe,ln).get(t||"luminosity");if(r)return r;let n,s;if(t?([n]=L(this,qe,_p).call(this,[t]),s=`luminosity_${n}`):s="luminosity",r=u(this,qe,ln).get(s),r)return u(this,qe,ln).set(t,r),r;const a=`g_${u(this,$s)}_luminosity_map_${bn(this,el)._++}`,o=L(this,qe,lu).call(this,a);u(this,qe,ln).set(t,o),u(this,qe,ln).set(s,o);const l=L(this,qe,uu).call(this,a);return L(this,qe,Q1).call(this,l),t&&L(this,qe,C0).call(this,n,l),o}addHighlightHCMFilter(t,r,n,s,a){var A;const o=`${r}-${n}-${s}-${a}`;let l=u(this,qe,dh).get(t);if((l==null?void 0:l.key)===o||(l?((A=l.filter)==null||A.remove(),l.key=o,l.url="none",l.filter=null):(l={key:o,url:"none",filter:null},u(this,qe,dh).set(t,l)),!r||!n))return l.url;const[c,h]=[r,n].map(L(this,qe,gh).bind(this));let d=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),p=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[g,y]=[s,a].map(L(this,qe,gh).bind(this));p<d&&([d,p,g,y]=[p,d,y,g]),u(this,qe,ou).style.color="";const b=(E,_,C)=>{const I=new Array(256),k=(p-d)/C,D=E/255,R=(_-E)/(255*C);let z=0;for(let q=0;q<=C;q++){const O=Math.round(d+q*k),X=D+q*R;for(let S=z;S<=O;S++)I[S]=X;z=O+1}for(let q=z;q<256;q++)I[q]=I[z-1];return I.join(",")},w=`g_${u(this,$s)}_hcm_${t}_filter`,v=l.filter=L(this,qe,uu).call(this,w);return L(this,qe,_0).call(this,v),L(this,qe,ph).call(this,b(g[0],y[0],5),b(g[1],y[1],5),b(g[2],y[2],5),v),l.url=L(this,qe,lu).call(this,w),l.url}destroy(t=!1){var r,n,s,a;t&&((r=u(this,Jo))!=null&&r.size)||((n=u(this,Hs))==null||n.parentNode.parentNode.remove(),T(this,Hs,null),(s=u(this,zu))==null||s.clear(),T(this,zu,null),(a=u(this,Jo))==null||a.clear(),T(this,Jo,null),T(this,el,0))}}Qo=new WeakMap,zu=new WeakMap,Hs=new WeakMap,$s=new WeakMap,cn=new WeakMap,Jo=new WeakMap,el=new WeakMap,qe=new WeakSet,ln=function(){return u(this,zu)||T(this,zu,new Map)},dh=function(){return u(this,Jo)||T(this,Jo,new Map)},ou=function(){if(!u(this,Hs)){const t=u(this,cn).createElement("div"),{style:r}=t;r.visibility="hidden",r.contain="strict",r.width=r.height=0,r.position="absolute",r.top=r.left=0,r.zIndex=-1;const n=u(this,cn).createElementNS(Ts,"svg");n.setAttribute("width",0),n.setAttribute("height",0),T(this,Hs,u(this,cn).createElementNS(Ts,"defs")),t.append(n),n.append(u(this,Hs)),u(this,cn).body.append(t)}return u(this,Hs)},_p=function(t){if(t.length===1){const c=t[0],h=new Array(256);for(let p=0;p<256;p++)h[p]=c[p]/255;const d=h.join(",");return[d,d,d]}const[r,n,s]=t,a=new Array(256),o=new Array(256),l=new Array(256);for(let c=0;c<256;c++)a[c]=r[c]/255,o[c]=n[c]/255,l[c]=s[c]/255;return[a.join(","),o.join(","),l.join(",")]},lu=function(t){if(u(this,Qo)===void 0){T(this,Qo,"");const r=u(this,cn).URL;r!==u(this,cn).baseURI&&(kf(r)?ut('#createUrl: ignore "data:"-URL for performance reasons.'):T(this,Qo,Rb(r,"")))}return`url(${u(this,Qo)}#${t})`},Q1=function(t){const r=u(this,cn).createElementNS(Ts,"feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(r)},_0=function(t){const r=u(this,cn).createElementNS(Ts,"feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(r)},uu=function(t){const r=u(this,cn).createElementNS(Ts,"filter");return r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("id",t),u(this,qe,ou).append(r),r},fh=function(t,r,n){const s=u(this,cn).createElementNS(Ts,r);s.setAttribute("type","discrete"),s.setAttribute("tableValues",n),t.append(s)},ph=function(t,r,n,s){const a=u(this,cn).createElementNS(Ts,"feComponentTransfer");s.append(a),L(this,qe,fh).call(this,a,"feFuncR",t),L(this,qe,fh).call(this,a,"feFuncG",r),L(this,qe,fh).call(this,a,"feFuncB",n)},C0=function(t,r){const n=u(this,cn).createElementNS(Ts,"feComponentTransfer");r.append(n),L(this,qe,fh).call(this,n,"feFuncA",t)},gh=function(t){return u(this,qe,ou).style.color=t,Mb(getComputedStyle(u(this,qe,ou)).getPropertyValue("color"))};class J1{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetch(t).catch(r=>{throw new Error(`Unable to load font data at: ${t}`)})}async _fetch(e){Wt("Abstract method `_fetch` called.")}}class ty extends J1{async _fetch(e){const t=await Mc(e,"arraybuffer");return new Uint8Array(t)}}class ew{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!e)throw new Error("Wasm filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetch(t).catch(r=>{throw new Error(`Unable to load wasm data at: ${t}`)})}async _fetch(e){Wt("Abstract method `_fetch` called.")}}class ry extends ew{async _fetch(e){const t=await Mc(e,"arraybuffer");return new Uint8Array(t)}}_n&&ut("Please use the `legacy` build in Node.js environments.");async function Ob(i){const t=await process.getBuiltinModule("fs").promises.readFile(i);return new Uint8Array(t)}class Z_ extends K1{}class K_ extends Y1{_createCanvas(e,t){return process.getBuiltinModule("module").createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:cm&&cm.tagName.toUpperCase()==="SCRIPT"&&cm.src||new URL("index.cjs",document.baseURI).href)("@napi-rs/canvas").createCanvas(e,t)}}class Q_ extends Z1{async _fetch(e){return Ob(e)}}class J_ extends J1{async _fetch(e){return Ob(e)}}class eC extends ew{async _fetch(e){return Ob(e)}}const tn={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function S0(i,e){if(!e)return;const t=e[2]-e[0],r=e[3]-e[1],n=new Path2D;n.rect(e[0],e[1],t,r),i.clip(n)}class Fb{isModifyingCurrentTransform(){return!1}getPattern(){Wt("Abstract method `getPattern` called.")}}class tC extends Fb{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let t;this._type==="axial"?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const r of this._colorStops)t.addColorStop(r[0],r[1]);return t}getPattern(e,t,r,n){let s;if(n===tn.STROKE||n===tn.FILL){const a=t.current.getClippedPathBoundingBox(n,hr(e))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,l=Math.ceil(a[3]-a[1])||1,c=t.cachedCanvases.getCanvas("pattern",o,l),h=c.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-a[0],-a[1]),r=Qe.transform(r,[1,0,0,1,a[0],a[1]]),h.transform(...t.baseTransform),this.matrix&&h.transform(...this.matrix),S0(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),s=e.createPattern(c.canvas,"no-repeat");const d=new DOMMatrix(r);s.setTransform(d)}else S0(e,this._bbox),s=this._createGradient(e);return s}}function mm(i,e,t,r,n,s,a,o){const l=e.coords,c=e.colors,h=i.data,d=i.width*4;let p;l[t+1]>l[r+1]&&(p=t,t=r,r=p,p=s,s=a,a=p),l[r+1]>l[n+1]&&(p=r,r=n,n=p,p=a,a=o,o=p),l[t+1]>l[r+1]&&(p=t,t=r,r=p,p=s,s=a,a=p);const g=(l[t]+e.offsetX)*e.scaleX,y=(l[t+1]+e.offsetY)*e.scaleY,b=(l[r]+e.offsetX)*e.scaleX,w=(l[r+1]+e.offsetY)*e.scaleY,v=(l[n]+e.offsetX)*e.scaleX,A=(l[n+1]+e.offsetY)*e.scaleY;if(y>=A)return;const E=c[s],_=c[s+1],C=c[s+2],I=c[a],k=c[a+1],D=c[a+2],R=c[o],z=c[o+1],q=c[o+2],O=Math.round(y),X=Math.round(A);let S,J,Y,W,fe,K,be,te;for(let j=O;j<=X;j++){if(j<w){const le=j<y?0:(y-j)/(y-w);S=g-(g-b)*le,J=E-(E-I)*le,Y=_-(_-k)*le,W=C-(C-D)*le}else{let le;j>A?le=1:w===A?le=0:le=(w-j)/(w-A),S=b-(b-v)*le,J=I-(I-R)*le,Y=k-(k-z)*le,W=D-(D-q)*le}let ie;j<y?ie=0:j>A?ie=1:ie=(y-j)/(y-A),fe=g-(g-v)*ie,K=E-(E-R)*ie,be=_-(_-z)*ie,te=C-(C-q)*ie;const ae=Math.round(Math.min(S,fe)),H=Math.round(Math.max(S,fe));let se=d*j+ae*4;for(let le=ae;le<=H;le++)ie=(S-le)/(S-fe),ie<0?ie=0:ie>1&&(ie=1),h[se++]=J-(J-K)*ie|0,h[se++]=Y-(Y-be)*ie|0,h[se++]=W-(W-te)*ie|0,h[se++]=255}}function rC(i,e,t){const r=e.coords,n=e.colors;let s,a;switch(e.type){case"lattice":const o=e.verticesPerRow,l=Math.floor(r.length/o)-1,c=o-1;for(s=0;s<l;s++){let h=s*o;for(let d=0;d<c;d++,h++)mm(i,t,r[h],r[h+1],r[h+o],n[h],n[h+1],n[h+o]),mm(i,t,r[h+o+1],r[h+1],r[h+o],n[h+o+1],n[h+1],n[h+o])}break;case"triangles":for(s=0,a=r.length;s<a;s+=3)mm(i,t,r[s],r[s+1],r[s+2],n[s],n[s+1],n[s+2]);break;default:throw new Error("illegal figure")}}class nC extends Fb{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],this.matrix=null}_createMeshCanvas(e,t,r){const o=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),c=Math.ceil(this._bounds[2])-o,h=Math.ceil(this._bounds[3])-l,d=Math.min(Math.ceil(Math.abs(c*e[0]*1.1)),3e3),p=Math.min(Math.ceil(Math.abs(h*e[1]*1.1)),3e3),g=c/d,y=h/p,b={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-l,scaleX:1/g,scaleY:1/y},w=d+2*2,v=p+2*2,A=r.getCanvas("mesh",w,v),E=A.context,_=E.createImageData(d,p);if(t){const I=_.data;for(let k=0,D=I.length;k<D;k+=4)I[k]=t[0],I[k+1]=t[1],I[k+2]=t[2],I[k+3]=255}for(const I of this._figures)rC(_,I,b);return E.putImageData(_,2,2),{canvas:A.canvas,offsetX:o-2*g,offsetY:l-2*y,scaleX:g,scaleY:y}}isModifyingCurrentTransform(){return!0}getPattern(e,t,r,n){S0(e,this._bbox);const s=new Float32Array(2);if(n===tn.SHADING)Qe.singularValueDecompose2dScale(hr(e),s);else if(this.matrix){Qe.singularValueDecompose2dScale(this.matrix,s);const[o,l]=s;Qe.singularValueDecompose2dScale(t.baseTransform,s),s[0]*=o,s[1]*=l}else Qe.singularValueDecompose2dScale(t.baseTransform,s);const a=this._createMeshCanvas(s,n===tn.SHADING?null:this._background,t.cachedCanvases);return n!==tn.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(a.offsetX,a.offsetY),e.scale(a.scaleX,a.scaleY),e.createPattern(a.canvas,"no-repeat")}}class iC extends Fb{getPattern(){return"hotpink"}}function sC(i){switch(i[0]){case"RadialAxial":return new tC(i);case"Mesh":return new nC(i);case"Dummy":return new iC}throw new Error(`Unknown IR type: ${i[0]}`)}const ny={COLORED:1,UNCOLORED:2},pg=class pg{constructor(e,t,r,n){this.color=e[1],this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.ctx=t,this.canvasGraphicsFactory=r,this.baseTransform=n}createPatternCanvas(e){const{bbox:t,operatorList:r,paintType:n,tilingType:s,color:a,canvasGraphicsFactory:o}=this;let{xstep:l,ystep:c}=this;l=Math.abs(l),c=Math.abs(c),Tg("TilingType: "+s);const h=t[0],d=t[1],p=t[2],g=t[3],y=p-h,b=g-d,w=new Float32Array(2);Qe.singularValueDecompose2dScale(this.matrix,w);const[v,A]=w;Qe.singularValueDecompose2dScale(this.baseTransform,w);const E=v*w[0],_=A*w[1];let C=y,I=b,k=!1,D=!1;const R=Math.ceil(l*E),z=Math.ceil(c*_),q=Math.ceil(y*E),O=Math.ceil(b*_);R>=q?C=l:k=!0,z>=O?I=c:D=!0;const X=this.getSizeAndScale(C,this.ctx.canvas.width,E),S=this.getSizeAndScale(I,this.ctx.canvas.height,_),J=e.cachedCanvases.getCanvas("pattern",X.size,S.size),Y=J.context,W=o.createCanvasGraphics(Y);if(W.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(W,n,a),Y.translate(-X.scale*h,-S.scale*d),W.transform(X.scale,0,0,S.scale,0,0),Y.save(),this.clipBbox(W,h,d,p,g),W.baseTransform=hr(W.ctx),W.executeOperatorList(r),W.endDrawing(),Y.restore(),k||D){const fe=J.canvas;k&&(C=l),D&&(I=c);const K=this.getSizeAndScale(C,this.ctx.canvas.width,E),be=this.getSizeAndScale(I,this.ctx.canvas.height,_),te=K.size,j=be.size,ie=e.cachedCanvases.getCanvas("pattern-workaround",te,j),ae=ie.context,H=k?Math.floor(y/l):0,se=D?Math.floor(b/c):0;for(let le=0;le<=H;le++)for(let oe=0;oe<=se;oe++)ae.drawImage(fe,te*le,j*oe,te,j,0,0,te,j);return{canvas:ie.canvas,scaleX:K.scale,scaleY:be.scale,offsetX:h,offsetY:d}}return{canvas:J.canvas,scaleX:X.scale,scaleY:S.scale,offsetX:h,offsetY:d}}getSizeAndScale(e,t,r){const n=Math.max(pg.MAX_PATTERN_SIZE,t);let s=Math.ceil(e*r);return s>=n?s=n:r=s/e,{scale:r,size:s}}clipBbox(e,t,r,n,s){const a=n-t,o=s-r;e.ctx.rect(t,r,a,o),Qe.axialAlignedBoundingBox([t,r,n,s],hr(e.ctx),e.current.minMax),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,r){const n=e.ctx,s=e.current;switch(t){case ny.COLORED:const{fillStyle:a,strokeStyle:o}=this.ctx;n.fillStyle=s.fillColor=a,n.strokeStyle=s.strokeColor=o;break;case ny.UNCOLORED:n.fillStyle=n.strokeStyle=r,s.fillColor=s.strokeColor=r;break;default:throw new D_(`Unsupported paint type: ${t}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,t,r,n){let s=r;n!==tn.SHADING&&(s=Qe.transform(s,t.baseTransform),this.matrix&&(s=Qe.transform(s,this.matrix)));const a=this.createPatternCanvas(t);let o=new DOMMatrix(s);o=o.translate(a.offsetX,a.offsetY),o=o.scale(1/a.scaleX,1/a.scaleY);const l=e.createPattern(a.canvas,"repeat");return l.setTransform(o),l}};Ie(pg,"MAX_PATTERN_SIZE",3e3);let T0=pg;function aC({src:i,srcPos:e=0,dest:t,width:r,height:n,nonBlackColor:s=4294967295,inverseDecode:a=!1}){const o=Gr.isLittleEndian?4278190080:255,[l,c]=a?[s,o]:[o,s],h=r>>3,d=r&7,p=i.length;t=new Uint32Array(t.buffer);let g=0;for(let y=0;y<n;y++){for(const w=e+h;e<w;e++){const v=e<p?i[e]:255;t[g++]=v&128?c:l,t[g++]=v&64?c:l,t[g++]=v&32?c:l,t[g++]=v&16?c:l,t[g++]=v&8?c:l,t[g++]=v&4?c:l,t[g++]=v&2?c:l,t[g++]=v&1?c:l}if(d===0)continue;const b=e<p?i[e++]:255;for(let w=0;w<d;w++)t[g++]=b&1<<7-w?c:l}return{srcPos:e,destPos:g}}const iy=16,sy=100,oC=15,ay=10,Mn=16,bm=new DOMMatrix,si=new Float32Array(2),pu=new Float32Array([1/0,1/0,-1/0,-1/0]);function lC(i,e){if(i._removeMirroring)throw new Error("Context is already forwarding operations.");i.__originalSave=i.save,i.__originalRestore=i.restore,i.__originalRotate=i.rotate,i.__originalScale=i.scale,i.__originalTranslate=i.translate,i.__originalTransform=i.transform,i.__originalSetTransform=i.setTransform,i.__originalResetTransform=i.resetTransform,i.__originalClip=i.clip,i.__originalMoveTo=i.moveTo,i.__originalLineTo=i.lineTo,i.__originalBezierCurveTo=i.bezierCurveTo,i.__originalRect=i.rect,i.__originalClosePath=i.closePath,i.__originalBeginPath=i.beginPath,i._removeMirroring=()=>{i.save=i.__originalSave,i.restore=i.__originalRestore,i.rotate=i.__originalRotate,i.scale=i.__originalScale,i.translate=i.__originalTranslate,i.transform=i.__originalTransform,i.setTransform=i.__originalSetTransform,i.resetTransform=i.__originalResetTransform,i.clip=i.__originalClip,i.moveTo=i.__originalMoveTo,i.lineTo=i.__originalLineTo,i.bezierCurveTo=i.__originalBezierCurveTo,i.rect=i.__originalRect,i.closePath=i.__originalClosePath,i.beginPath=i.__originalBeginPath,delete i._removeMirroring},i.save=function(){e.save(),this.__originalSave()},i.restore=function(){e.restore(),this.__originalRestore()},i.translate=function(t,r){e.translate(t,r),this.__originalTranslate(t,r)},i.scale=function(t,r){e.scale(t,r),this.__originalScale(t,r)},i.transform=function(t,r,n,s,a,o){e.transform(t,r,n,s,a,o),this.__originalTransform(t,r,n,s,a,o)},i.setTransform=function(t,r,n,s,a,o){e.setTransform(t,r,n,s,a,o),this.__originalSetTransform(t,r,n,s,a,o)},i.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},i.rotate=function(t){e.rotate(t),this.__originalRotate(t)},i.clip=function(t){e.clip(t),this.__originalClip(t)},i.moveTo=function(t,r){e.moveTo(t,r),this.__originalMoveTo(t,r)},i.lineTo=function(t,r){e.lineTo(t,r),this.__originalLineTo(t,r)},i.bezierCurveTo=function(t,r,n,s,a,o){e.bezierCurveTo(t,r,n,s,a,o),this.__originalBezierCurveTo(t,r,n,s,a,o)},i.rect=function(t,r,n,s){e.rect(t,r,n,s),this.__originalRect(t,r,n,s)},i.closePath=function(){e.closePath(),this.__originalClosePath()},i.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class uC{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,r){let n;return this.cache[e]!==void 0?(n=this.cache[e],this.canvasFactory.reset(n,t,r)):(n=this.canvasFactory.create(t,r),this.cache[e]=n),n}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}function rp(i,e,t,r,n,s,a,o,l,c){const[h,d,p,g,y,b]=hr(i);if(d===0&&p===0){const A=a*h+y,E=Math.round(A),_=o*g+b,C=Math.round(_),I=(a+l)*h+y,k=Math.abs(Math.round(I)-E)||1,D=(o+c)*g+b,R=Math.abs(Math.round(D)-C)||1;return i.setTransform(Math.sign(h),0,0,Math.sign(g),E,C),i.drawImage(e,t,r,n,s,0,0,k,R),i.setTransform(h,d,p,g,y,b),[k,R]}if(h===0&&g===0){const A=o*p+y,E=Math.round(A),_=a*d+b,C=Math.round(_),I=(o+c)*p+y,k=Math.abs(Math.round(I)-E)||1,D=(a+l)*d+b,R=Math.abs(Math.round(D)-C)||1;return i.setTransform(0,Math.sign(d),Math.sign(p),0,E,C),i.drawImage(e,t,r,n,s,0,0,R,k),i.setTransform(h,d,p,g,y,b),[R,k]}i.drawImage(e,t,r,n,s,a,o,l,c);const w=Math.hypot(h,d),v=Math.hypot(p,g);return[w*l,v*c]}class oy{constructor(e,t){Ie(this,"alphaIsShape",!1);Ie(this,"fontSize",0);Ie(this,"fontSizeScale",1);Ie(this,"textMatrix",null);Ie(this,"textMatrixScale",1);Ie(this,"fontMatrix",i0);Ie(this,"leading",0);Ie(this,"x",0);Ie(this,"y",0);Ie(this,"lineX",0);Ie(this,"lineY",0);Ie(this,"charSpacing",0);Ie(this,"wordSpacing",0);Ie(this,"textHScale",1);Ie(this,"textRenderingMode",on.FILL);Ie(this,"textRise",0);Ie(this,"fillColor","#000000");Ie(this,"strokeColor","#000000");Ie(this,"patternFill",!1);Ie(this,"patternStroke",!1);Ie(this,"fillAlpha",1);Ie(this,"strokeAlpha",1);Ie(this,"lineWidth",1);Ie(this,"activeSMask",null);Ie(this,"transferMaps","none");this.clipBox=new Float32Array([0,0,e,t]),this.minMax=pu.slice()}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e}getPathBoundingBox(e=tn.FILL,t=null){const r=this.minMax.slice();if(e===tn.STROKE){t||Wt("Stroke bounding box must include transform."),Qe.singularValueDecompose2dScale(t,si);const n=si[0]*this.lineWidth/2,s=si[1]*this.lineWidth/2;r[0]-=n,r[1]-=s,r[2]+=n,r[3]+=s}return r}updateClipFromPath(){const e=Qe.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set(pu,0)}getClippedPathBoundingBox(e=tn.FILL,t=null){return Qe.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function ly(i,e){if(e instanceof ImageData){i.putImageData(e,0,0);return}const t=e.height,r=e.width,n=t%Mn,s=(t-n)/Mn,a=n===0?s:s+1,o=i.createImageData(r,Mn);let l=0,c;const h=e.data,d=o.data;let p,g,y,b;if(e.kind===Th.GRAYSCALE_1BPP){const w=h.byteLength,v=new Uint32Array(d.buffer,0,d.byteLength>>2),A=v.length,E=r+7>>3,_=4294967295,C=Gr.isLittleEndian?4278190080:255;for(p=0;p<a;p++){for(y=p<s?Mn:n,c=0,g=0;g<y;g++){const I=w-l;let k=0;const D=I>E?r:I*8-7,R=D&-8;let z=0,q=0;for(;k<R;k+=8)q=h[l++],v[c++]=q&128?_:C,v[c++]=q&64?_:C,v[c++]=q&32?_:C,v[c++]=q&16?_:C,v[c++]=q&8?_:C,v[c++]=q&4?_:C,v[c++]=q&2?_:C,v[c++]=q&1?_:C;for(;k<D;k++)z===0&&(q=h[l++],z=128),v[c++]=q&z?_:C,z>>=1}for(;c<A;)v[c++]=0;i.putImageData(o,0,p*Mn)}}else if(e.kind===Th.RGBA_32BPP){for(g=0,b=r*Mn*4,p=0;p<s;p++)d.set(h.subarray(l,l+b)),l+=b,i.putImageData(o,0,g),g+=Mn;p<a&&(b=r*n*4,d.set(h.subarray(l,l+b)),i.putImageData(o,0,g))}else if(e.kind===Th.RGB_24BPP)for(y=Mn,b=r*y,p=0;p<a;p++){for(p>=s&&(y=n,b=r*y),c=0,g=b;g--;)d[c++]=h[l++],d[c++]=h[l++],d[c++]=h[l++],d[c++]=255;i.putImageData(o,0,p*Mn)}else throw new Error(`bad image kind: ${e.kind}`)}function uy(i,e){if(e.bitmap){i.drawImage(e.bitmap,0,0);return}const t=e.height,r=e.width,n=t%Mn,s=(t-n)/Mn,a=n===0?s:s+1,o=i.createImageData(r,Mn);let l=0;const c=e.data,h=o.data;for(let d=0;d<a;d++){const p=d<s?Mn:n;({srcPos:l}=aC({src:c,srcPos:l,dest:h,width:r,height:p,nonBlackColor:0})),i.putImageData(o,0,d*Mn)}}function Zc(i,e){const t=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const r of t)i[r]!==void 0&&(e[r]=i[r]);i.setLineDash!==void 0&&(e.setLineDash(i.getLineDash()),e.lineDashOffset=i.lineDashOffset)}function np(i){i.strokeStyle=i.fillStyle="#000000",i.fillRule="nonzero",i.globalAlpha=1,i.lineWidth=1,i.lineCap="butt",i.lineJoin="miter",i.miterLimit=10,i.globalCompositeOperation="source-over",i.font="10px sans-serif",i.setLineDash!==void 0&&(i.setLineDash([]),i.lineDashOffset=0);const{filter:e}=i;e!=="none"&&e!==""&&(i.filter="none")}function cy(i,e){if(e)return!0;Qe.singularValueDecompose2dScale(i,si);const t=Math.fround(Wi.pixelRatio*da.PDF_TO_CSS_UNITS);return si[0]<=t&&si[1]<=t}const cC=["butt","round","square"],hC=["miter","round","bevel"],dC={},hy={};var Yi,k0,D0,P0;const yv=class yv{constructor(e,t,r,n,s,{optionalContentConfig:a,markedContentStack:o=null},l,c){N(this,Yi);this.ctx=e,this.current=new oy(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=r,this.canvasFactory=n,this.filterFactory=s,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 uC(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,t=null){return typeof e=="string"?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:r=!1,background:n=null}){const s=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=n||"#ffffff",this.ctx.fillRect(0,0,s,a),this.ctx.fillStyle=o,r){const l=this.cachedCanvases.getCanvas("transparent",s,a);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...hr(this.compositeCtx))}this.ctx.save(),np(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=hr(this.ctx)}executeOperatorList(e,t,r,n){const s=e.argsArray,a=e.fnArray;let o=t||0;const l=s.length;if(l===o)return o;const c=l-o>ay&&typeof r=="function",h=c?Date.now()+oC:0;let d=0;const p=this.commonObjs,g=this.objs;let y;for(;;){if(n!==void 0&&o===n.nextBreakPoint)return n.breakIt(o,r),o;if(y=a[o],y!==Ph.dependency)this[y].apply(this,s[o]);else for(const b of s[o]){const w=b.startsWith("g_")?p:g;if(!w.has(b))return w.get(b,r),o}if(o++,o===l)return o;if(c&&++d>ay){if(Date.now()>h)return r(),o;d=0}}}endDrawing(){L(this,Yi,k0).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),L(this,Yi,D0).call(this)}_scaleImage(e,t){const r=e.width??e.displayWidth,n=e.height??e.displayHeight;let s=Math.max(Math.hypot(t[0],t[1]),1),a=Math.max(Math.hypot(t[2],t[3]),1),o=r,l=n,c="prescale1",h,d;for(;s>2&&o>1||a>2&&l>1;){let p=o,g=l;s>2&&o>1&&(p=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),s/=o/p),a>2&&l>1&&(g=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,a/=l/g),h=this.cachedCanvases.getCanvas(c,p,g),d=h.context,d.clearRect(0,0,p,g),d.drawImage(e,0,0,o,l,0,0,p,g),e=h.canvas,o=p,l=g,c=c==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:o,paintHeight:l}}_createMaskCanvas(e){const t=this.ctx,{width:r,height:n}=e,s=this.current.fillColor,a=this.current.patternFill,o=hr(t);let l,c,h,d;if((e.bitmap||e.data)&&e.count>1){const R=e.bitmap||e.data.buffer;c=JSON.stringify(a?o:[o.slice(0,4),s]),l=this._cachedBitmapsMap.get(R),l||(l=new Map,this._cachedBitmapsMap.set(R,l));const z=l.get(c);if(z&&!a){const q=Math.round(Math.min(o[0],o[2])+o[4]),O=Math.round(Math.min(o[1],o[3])+o[5]);return{canvas:z,offsetX:q,offsetY:O}}h=z}h||(d=this.cachedCanvases.getCanvas("maskCanvas",r,n),uy(d.context,e));let p=Qe.transform(o,[1/r,0,0,-1/n,0,0]);p=Qe.transform(p,[1,0,0,1,0,-n]);const g=pu.slice();Qe.axialAlignedBoundingBox([0,0,r,n],p,g);const[y,b,w,v]=g,A=Math.round(w-y)||1,E=Math.round(v-b)||1,_=this.cachedCanvases.getCanvas("fillCanvas",A,E),C=_.context,I=y,k=b;C.translate(-I,-k),C.transform(...p),h||(h=this._scaleImage(d.canvas,Ki(C)),h=h.img,l&&a&&l.set(c,h)),C.imageSmoothingEnabled=cy(hr(C),e.interpolate),rp(C,h,0,0,h.width,h.height,0,0,r,n),C.globalCompositeOperation="source-in";const D=Qe.transform(Ki(C),[1,0,0,1,-I,-k]);return C.fillStyle=a?s.getPattern(t,this,D,tn.FILL):s,C.fillRect(0,0,r,n),l&&!a&&(this.cachedCanvases.delete("fillCanvas"),l.set(c,_.canvas)),{canvas:_.canvas,offsetX:Math.round(I),offsetY:Math.round(k)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=cC[e]}setLineJoin(e){this.ctx.lineJoin=hC[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const r=this.ctx;r.setLineDash!==void 0&&(r.setLineDash(e),r.lineDashOffset=t)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,r]of e)switch(t){case"LW":this.setLineWidth(r);break;case"LC":this.setLineCap(r);break;case"LJ":this.setLineJoin(r);break;case"ML":this.setMiterLimit(r);break;case"D":this.setDash(r[0],r[1]);break;case"RI":this.setRenderingIntent(r);break;case"FL":this.setFlatness(r);break;case"Font":this.setFont(r[0],r[1]);break;case"CA":this.current.strokeAlpha=r;break;case"ca":this.ctx.globalAlpha=this.current.fillAlpha=r;break;case"BM":this.ctx.globalCompositeOperation=r;break;case"SMask":this.current.activeSMask=r?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(r);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,t=this.ctx.canvas.height,r="smaskGroupAt"+this.groupLevel,n=this.cachedCanvases.getCanvas(r,e,t);this.suspendedCtx=this.ctx;const s=this.ctx=n.context;s.setTransform(this.suspendedCtx.getTransform()),Zc(this.suspendedCtx,s),lC(s,this.suspendedCtx),this.setGState([["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Zc(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,r=this.suspendedCtx;this.composeSMask(r,t,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(e,t,r,n){const s=n[0],a=n[1],o=n[2]-s,l=n[3]-a;o===0||l===0||(this.genericComposeSMask(t.context,r,o,l,t.subtype,t.backdrop,t.transferMap,s,a,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(r.canvas,0,0),e.restore())}genericComposeSMask(e,t,r,n,s,a,o,l,c,h,d){let p=e.canvas,g=l-h,y=c-d;if(a)if(g<0||y<0||g+r>p.width||y+n>p.height){const w=this.cachedCanvases.getCanvas("maskExtension",r,n),v=w.context;v.drawImage(p,-g,-y),v.globalCompositeOperation="destination-atop",v.fillStyle=a,v.fillRect(0,0,r,n),v.globalCompositeOperation="source-over",p=w.canvas,g=y=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const w=new Path2D;w.rect(g,y,r,n),e.clip(w),e.globalCompositeOperation="destination-atop",e.fillStyle=a,e.fillRect(g,y,r,n),e.restore()}t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0),s==="Alpha"&&o?t.filter=this.filterFactory.addAlphaFilter(o):s==="Luminosity"&&(t.filter=this.filterFactory.addLuminosityFilter(o));const b=new Path2D;b.rect(l,c,r,n),t.clip(b),t.globalCompositeOperation="destination-in",t.drawImage(p,g,y,r,n,l,c,r,n),t.restore()}save(){this.inSMaskMode&&Zc(this.ctx,this.suspendedCtx),this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){if(this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&Zc(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,t,r,n,s,a){this.ctx.transform(e,t,r,n,s,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,r){let[n]=t;if(!r){n||(n=t[0]=new Path2D),this[e](n);return}if(!(n instanceof Path2D)){const s=t[0]=new Path2D;for(let a=0,o=n.length;a<o;)switch(n[a++]){case Jf.moveTo:s.moveTo(n[a++],n[a++]);break;case Jf.lineTo:s.lineTo(n[a++],n[a++]);break;case Jf.curveTo:s.bezierCurveTo(n[a++],n[a++],n[a++],n[a++],n[a++],n[a++]);break;case Jf.closePath:s.closePath();break;default:ut(`Unrecognized drawing path operator: ${n[a-1]}`);break}n=s}Qe.axialAlignedBoundingBox(r,hr(this.ctx),this.current.minMax),this[e](n)}closePath(){this.ctx.closePath()}stroke(e,t=!0){const r=this.ctx,n=this.current.strokeColor;if(r.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof n=="object"&&(n!=null&&n.getPattern)){const s=n.isModifyingCurrentTransform()?r.getTransform():null;if(r.save(),r.strokeStyle=n.getPattern(r,this,Ki(r),tn.STROKE),s){const a=new Path2D;a.addPath(e,r.getTransform().invertSelf().multiplySelf(s)),e=a}this.rescaleAndStroke(e,!1),r.restore()}else this.rescaleAndStroke(e,!0);t&&this.consumePath(e,this.current.getClippedPathBoundingBox(tn.STROKE,hr(this.ctx))),r.globalAlpha=this.current.fillAlpha}closeStroke(e){this.stroke(e)}fill(e,t=!0){const r=this.ctx,n=this.current.fillColor,s=this.current.patternFill;let a=!1;if(s){const l=n.isModifyingCurrentTransform()?r.getTransform():null;if(r.save(),r.fillStyle=n.getPattern(r,this,Ki(r),tn.FILL),l){const c=new Path2D;c.addPath(e,r.getTransform().invertSelf().multiplySelf(l)),e=c}a=!0}const o=this.current.getClippedPathBoundingBox();this.contentVisible&&o!==null&&(this.pendingEOFill?(r.fill(e,"evenodd"),this.pendingEOFill=!1):r.fill(e)),a&&r.restore(),t&&this.consumePath(e,o)}eoFill(e){this.pendingEOFill=!0,this.fill(e)}fillStroke(e){this.fill(e,!1),this.stroke(e,!1),this.consumePath(e)}eoFillStroke(e){this.pendingEOFill=!0,this.fillStroke(e)}closeFillStroke(e){this.fillStroke(e)}closeEOFillStroke(e){this.pendingEOFill=!0,this.fillStroke(e)}endPath(e){this.consumePath(e)}rawFillPath(e){this.ctx.fill(e)}clip(){this.pendingClip=dC}eoClip(){this.pendingClip=hy}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 e=this.pendingTextPaths,t=this.ctx;if(e===void 0)return;const r=new Path2D,n=t.getTransform().invertSelf();for(const{transform:s,x:a,y:o,fontSize:l,path:c}of e)r.addPath(c,new DOMMatrix(s).preMultiplySelf(n).translate(a,o).scale(l,-l));t.clip(r),delete this.pendingTextPaths}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){var h;const r=this.commonObjs.get(e),n=this.current;if(!r)throw new Error(`Can't find font for ${e}`);if(n.fontMatrix=r.fontMatrix||i0,(n.fontMatrix[0]===0||n.fontMatrix[3]===0)&&ut("Invalid font matrix for font "+e),t<0?(t=-t,n.fontDirection=-1):n.fontDirection=1,this.current.font=r,this.current.fontSize=t,r.isType3Font)return;const s=r.loadedName||"sans-serif",a=((h=r.systemFontInfo)==null?void 0:h.css)||`"${s}", ${r.fallbackName}`;let o="normal";r.black?o="900":r.bold&&(o="bold");const l=r.italic?"italic":"normal";let c=t;t<iy?c=iy:t>sy&&(c=sy),this.current.fontSizeScale=t/c,this.ctx.font=`${l} ${o} ${c}px ${a}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e){const{current:t}=this;t.textMatrix=e,t.textMatrixScale=Math.hypot(e[0],e[1]),t.x=t.lineX=0,t.y=t.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,r,n,s){const a=this.ctx,o=this.current,l=o.font,c=o.textRenderingMode,h=o.fontSize/o.fontSizeScale,d=c&on.FILL_STROKE_MASK,p=!!(c&on.ADD_TO_PATH_FLAG),g=o.patternFill&&!l.missingFile,y=o.patternStroke&&!l.missingFile;let b;if((l.disableFontFace||p||g||y)&&(b=l.getPathGenerator(this.commonObjs,e)),l.disableFontFace||g||y){a.save(),a.translate(t,r),a.scale(h,-h);let w;if((d===on.FILL||d===on.FILL_STROKE)&&(n?(w=a.getTransform(),a.setTransform(...n),a.fill(L(this,Yi,P0).call(this,b,w,n))):a.fill(b)),d===on.STROKE||d===on.FILL_STROKE)if(s){w||(w=a.getTransform()),a.setTransform(...s);const{a:v,b:A,c:E,d:_}=w,C=Qe.inverseTransform(s),I=Qe.transform([v,A,E,_,0,0],C);Qe.singularValueDecompose2dScale(I,si),a.lineWidth*=Math.max(si[0],si[1])/h,a.stroke(L(this,Yi,P0).call(this,b,w,s))}else a.lineWidth/=h,a.stroke(b);a.restore()}else(d===on.FILL||d===on.FILL_STROKE)&&a.fillText(e,t,r),(d===on.STROKE||d===on.FILL_STROKE)&&a.strokeText(e,t,r);p&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:hr(a),x:t,y:r,fontSize:h,path:b})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let r=!1;for(let n=3;n<t.length;n+=4)if(t[n]>0&&t[n]<255){r=!0;break}return Ct(this,"isFontSubpixelAAEnabled",r)}showText(e){const t=this.current,r=t.font;if(r.isType3Font)return this.showType3Text(e);const n=t.fontSize;if(n===0)return;const s=this.ctx,a=t.fontSizeScale,o=t.charSpacing,l=t.wordSpacing,c=t.fontDirection,h=t.textHScale*c,d=e.length,p=r.vertical,g=p?1:-1,y=r.defaultVMetrics,b=n*t.fontMatrix[0],w=t.textRenderingMode===on.FILL&&!r.disableFontFace&&!t.patternFill;s.save(),t.textMatrix&&s.transform(...t.textMatrix),s.translate(t.x,t.y+t.textRise),c>0?s.scale(h,-1):s.scale(h,1);let v,A;if(t.patternFill){s.save();const k=t.fillColor.getPattern(s,this,Ki(s),tn.FILL);v=hr(s),s.restore(),s.fillStyle=k}if(t.patternStroke){s.save();const k=t.strokeColor.getPattern(s,this,Ki(s),tn.STROKE);A=hr(s),s.restore(),s.strokeStyle=k}let E=t.lineWidth;const _=t.textMatrixScale;if(_===0||E===0){const k=t.textRenderingMode&on.FILL_STROKE_MASK;(k===on.STROKE||k===on.FILL_STROKE)&&(E=this.getSinglePixelWidth())}else E/=_;if(a!==1&&(s.scale(a,a),E/=a),s.lineWidth=E,r.isInvalidPDFjsFont){const k=[];let D=0;for(const R of e)k.push(R.unicode),D+=R.width;s.fillText(k.join(""),0,0),t.x+=D*b*h,s.restore(),this.compose();return}let C=0,I;for(I=0;I<d;++I){const k=e[I];if(typeof k=="number"){C+=g*k*n/1e3;continue}let D=!1;const R=(k.isSpace?l:0)+o,z=k.fontChar,q=k.accent;let O,X,S=k.width;if(p){const Y=k.vmetric||y,W=-(k.vmetric?Y[1]:S*.5)*b,fe=Y[2]*b;S=Y?-Y[0]:S,O=W/a,X=(C+fe)/a}else O=C/a,X=0;if(r.remeasure&&S>0){const Y=s.measureText(z).width*1e3/n*a;if(S<Y&&this.isFontSubpixelAAEnabled){const W=S/Y;D=!0,s.save(),s.scale(W,1),O/=W}else S!==Y&&(O+=(S-Y)/2e3*n/a)}if(this.contentVisible&&(k.isInFont||r.missingFile)){if(w&&!q)s.fillText(z,O,X);else if(this.paintChar(z,O,X,v,A),q){const Y=O+n*q.offset.x/a,W=X-n*q.offset.y/a;this.paintChar(q.fontChar,Y,W,v,A)}}const J=p?S*b-R*c:S*b+R*c;C+=J,D&&s.restore()}p?t.y-=C:t.x+=C*h,s.restore(),this.compose()}showType3Text(e){const t=this.ctx,r=this.current,n=r.font,s=r.fontSize,a=r.fontDirection,o=n.vertical?1:-1,l=r.charSpacing,c=r.wordSpacing,h=r.textHScale*a,d=r.fontMatrix||i0,p=e.length,g=r.textRenderingMode===on.INVISIBLE;let y,b,w,v;if(!(g||s===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),r.textMatrix&&t.transform(...r.textMatrix),t.translate(r.x,r.y+r.textRise),t.scale(h,a),y=0;y<p;++y){if(b=e[y],typeof b=="number"){v=o*b*s/1e3,this.ctx.translate(v,0),r.x+=v*h;continue}const A=(b.isSpace?c:0)+l,E=n.charProcOperatorList[b.operatorListId];E?this.contentVisible&&(this.save(),t.scale(s,s),t.transform(...d),this.executeOperatorList(E),this.restore()):ut(`Type3 character "${b.operatorListId}" is not available.`);const _=[b.width,0];Qe.applyTransform(_,d),w=_[0]*s+A,t.translate(w,0),r.x+=w*h}t.restore()}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,r,n,s,a){const o=new Path2D;o.rect(r,n,s-r,a-n),this.ctx.clip(o),this.endPath()}getColorN_Pattern(e){let t;if(e[0]==="TilingPattern"){const r=this.baseTransform||hr(this.ctx),n={createCanvasGraphics:s=>new yv(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new T0(e,this.ctx,n,r)}else t=this._getPattern(e[1],e[2]);return t}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(e){this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e){this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,t=null){let r;return this.cachedPatterns.has(e)?r=this.cachedPatterns.get(e):(r=sC(this.getObject(e)),this.cachedPatterns.set(e,r)),t&&(r.matrix=t),r}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const r=this._getPattern(e);t.fillStyle=r.getPattern(t,this,Ki(t),tn.SHADING);const n=Ki(t);if(n){const{width:s,height:a}=t.canvas,o=pu.slice();Qe.axialAlignedBoundingBox([0,0,s,a],n,o);const[l,c,h,d]=o;this.ctx.fillRect(l,c,h-l,d-c)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){Wt("Should not call beginInlineImage")}beginImageData(){Wt("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=hr(this.ctx),t)){Qe.axialAlignedBoundingBox(t,this.baseTransform,this.current.minMax);const[r,n,s,a]=t,o=new Path2D;o.rect(r,n,s-r,a-n),this.ctx.clip(o),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;e.isolated||Tg("TODO: Support non-isolated groups."),e.knockout&&ut("Knockout groups not supported.");const r=hr(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let n=pu.slice();Qe.axialAlignedBoundingBox(e.bbox,hr(t),n);const s=[0,0,t.canvas.width,t.canvas.height];n=Qe.intersect(n,s)||[0,0,0,0];const a=Math.floor(n[0]),o=Math.floor(n[1]),l=Math.max(Math.ceil(n[2])-a,1),c=Math.max(Math.ceil(n[3])-o,1);this.current.startNewPathAndClipBox([0,0,l,c]);let h="groupAt"+this.groupLevel;e.smask&&(h+="_smask_"+this.smaskCounter++%2);const d=this.cachedCanvases.getCanvas(h,l,c),p=d.context;p.translate(-a,-o),p.transform(...r);let g=new Path2D;const[y,b,w,v]=e.bbox;if(g.rect(y,b,w-y,v-b),e.matrix){const A=new Path2D;A.addPath(g,new DOMMatrix(e.matrix)),g=A}p.clip(g),e.smask?this.smaskStack.push({canvas:d.canvas,context:p,offsetX:a,offsetY:o,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(a,o),t.save()),Zc(t,p),this.ctx=p,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,r=this.groupStack.pop();if(this.ctx=r,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const n=hr(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...n);const s=pu.slice();Qe.axialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],n,s),this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(s)}}beginAnnotation(e,t,r,n,s){if(L(this,Yi,k0).call(this),np(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),t){const a=t[2]-t[0],o=t[3]-t[1];if(s&&this.annotationCanvasMap){r=r.slice(),r[4]-=t[0],r[5]-=t[1],t=t.slice(),t[0]=t[1]=0,t[2]=a,t[3]=o,Qe.singularValueDecompose2dScale(hr(this.ctx),si);const{viewportScale:l}=this,c=Math.ceil(a*this.outputScaleX*l),h=Math.ceil(o*this.outputScaleY*l);this.annotationCanvas=this.canvasFactory.create(c,h);const{canvas:d,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(e,d),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.save(),this.ctx.setTransform(si[0],0,0,-si[1],0,o*si[1]),np(this.ctx)}else{np(this.ctx),this.endPath();const l=new Path2D;l.rect(t[0],t[1],a,o),this.ctx.clip(l)}}this.current=new oy(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...r),this.transform(...n)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),L(this,Yi,D0).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=e.count;e=this.getObject(e.data,e),e.count=t;const r=this.ctx,n=this._createMaskCanvas(e),s=n.canvas;r.save(),r.setTransform(1,0,0,1,0,0),r.drawImage(s,n.offsetX,n.offsetY),r.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,r=0,n=0,s,a){if(!this.contentVisible)return;e=this.getObject(e.data,e);const o=this.ctx;o.save();const l=hr(o);o.transform(t,r,n,s,0,0);const c=this._createMaskCanvas(e);o.setTransform(1,0,0,1,c.offsetX-l[4],c.offsetY-l[5]);for(let h=0,d=a.length;h<d;h+=2){const p=Qe.transform(l,[t,r,n,s,a[h],a[h+1]]);o.drawImage(c.canvas,p[4],p[5])}o.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,r=this.current.fillColor,n=this.current.patternFill;for(const s of e){const{data:a,width:o,height:l,transform:c}=s,h=this.cachedCanvases.getCanvas("maskCanvas",o,l),d=h.context;d.save();const p=this.getObject(a,s);uy(d,p),d.globalCompositeOperation="source-in",d.fillStyle=n?r.getPattern(d,this,Ki(t),tn.FILL):r,d.fillRect(0,0,o,l),d.restore(),t.save(),t.transform(...c),t.scale(1,-1),rp(t,h.canvas,0,0,o,l,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(e);if(!t){ut("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t)}paintImageXObjectRepeat(e,t,r,n){if(!this.contentVisible)return;const s=this.getObject(e);if(!s){ut("Dependent image isn't ready yet");return}const a=s.width,o=s.height,l=[];for(let c=0,h=n.length;c<h;c+=2)l.push({transform:[t,0,0,r,n[c],n[c+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(s,l)}applyTransferMapsToCanvas(e){return this.current.transferMaps!=="none"&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return e.bitmap;const{bitmap:t,width:r,height:n}=e,s=this.cachedCanvases.getCanvas("inlineImage",r,n),a=s.context;return a.filter=this.current.transferMaps,a.drawImage(t,0,0),a.filter="none",s.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,r=e.height,n=this.ctx;this.save();const{filter:s}=n;s!=="none"&&s!==""&&(n.filter="none"),n.scale(1/t,-1/r);let a;if(e.bitmap)a=this.applyTransferMapsToBitmap(e);else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)a=e;else{const c=this.cachedCanvases.getCanvas("inlineImage",t,r).context;ly(c,e),a=this.applyTransferMapsToCanvas(c)}const o=this._scaleImage(a,Ki(n));n.imageSmoothingEnabled=cy(hr(n),e.interpolate),rp(n,o.img,0,0,o.paintWidth,o.paintHeight,0,-r,t,r),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;const r=this.ctx;let n;if(e.bitmap)n=e.bitmap;else{const s=e.width,a=e.height,l=this.cachedCanvases.getCanvas("inlineImage",s,a).context;ly(l,e),n=this.applyTransferMapsToCanvas(l)}for(const s of t)r.save(),r.transform(...s.transform),r.scale(1,-1),rp(r,n,s.x,s.y,s.w,s.h,0,-1,1,1),r.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e,t){const r=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const n=this.ctx;this.pendingClip&&(r||(this.pendingClip===hy?n.clip(e,"evenodd"):n.clip(e)),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=hr(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),r=Math.hypot(e[0],e[2]),n=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(r,n)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:t,b:r,c:n,d:s}=this.ctx.getTransform();let a,o;if(r===0&&n===0){const l=Math.abs(t),c=Math.abs(s);if(l===c)if(e===0)a=o=1/l;else{const h=l*e;a=o=h<1?1/h:1}else if(e===0)a=1/l,o=1/c;else{const h=l*e,d=c*e;a=h<1?1/h:1,o=d<1?1/d:1}}else{const l=Math.abs(t*s-r*n),c=Math.hypot(t,r),h=Math.hypot(n,s);if(e===0)a=h/l,o=c/l;else{const d=e*l;a=h>d?h/d:1,o=c>d?c/d:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(e,t){const{ctx:r,current:{lineWidth:n}}=this,[s,a]=this.getScaleForStroking();if(s===a){r.lineWidth=(n||1)*s,r.stroke(e);return}const o=r.getLineDash();t&&r.save(),r.scale(s,a),bm.a=1/s,bm.d=1/a;const l=new Path2D;if(l.addPath(e,bm),o.length>0){const c=Math.max(s,a);r.setLineDash(o.map(h=>h/c)),r.lineDashOffset/=c}r.lineWidth=n||1,r.stroke(l),t&&r.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};Yi=new WeakSet,k0=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)},D0=function(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}},P0=function(e,t,r){const n=new Path2D;return n.addPath(e,new DOMMatrix(r).invertSelf().multiplySelf(t)),n};let vu=yv;for(const i in Ph)vu.prototype[i]!==void 0&&(vu.prototype[Ph[i]]=vu.prototype[i]);var Ed,_d;class yi{static get workerPort(){return u(this,Ed)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");T(this,Ed,e)}static get workerSrc(){return u(this,_d)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");T(this,_d,e)}}Ed=new WeakMap,_d=new WeakMap,N(yi,Ed,null),N(yi,_d,"");var ju,Cd;class fC{constructor({parsedData:e,rawData:t}){N(this,ju);N(this,Cd);T(this,ju,e),T(this,Cd,t)}getRaw(){return u(this,Cd)}get(e){return u(this,ju).get(e)??null}[Symbol.iterator](){return u(this,ju).entries()}}ju=new WeakMap,Cd=new WeakMap;const cu=Symbol("INTERNAL");var Sd,Td,kd,Uu;class pC{constructor(e,{name:t,intent:r,usage:n,rbGroups:s}){N(this,Sd,!1);N(this,Td,!1);N(this,kd,!1);N(this,Uu,!0);T(this,Sd,!!(e&ii.DISPLAY)),T(this,Td,!!(e&ii.PRINT)),this.name=t,this.intent=r,this.usage=n,this.rbGroups=s}get visible(){if(u(this,kd))return u(this,Uu);if(!u(this,Uu))return!1;const{print:e,view:t}=this.usage;return u(this,Sd)?(t==null?void 0:t.viewState)!=="OFF":u(this,Td)?(e==null?void 0:e.printState)!=="OFF":!0}_setVisible(e,t,r=!1){e!==cu&&Wt("Internal method `_setVisible` called."),T(this,kd,r),T(this,Uu,t)}}Sd=new WeakMap,Td=new WeakMap,kd=new WeakMap,Uu=new WeakMap;var Oa,qt,Hu,$u,Dd,R0;class gC{constructor(e,t=ii.DISPLAY){N(this,Dd);N(this,Oa,null);N(this,qt,new Map);N(this,Hu,null);N(this,$u,null);if(this.renderingIntent=t,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,T(this,$u,e.order);for(const r of e.groups)u(this,qt).set(r.id,new pC(t,r));if(e.baseState==="OFF")for(const r of u(this,qt).values())r._setVisible(cu,!1);for(const r of e.on)u(this,qt).get(r)._setVisible(cu,!0);for(const r of e.off)u(this,qt).get(r)._setVisible(cu,!1);T(this,Hu,this.getHash())}}isVisible(e){if(u(this,qt).size===0)return!0;if(!e)return Tg("Optional content group not defined."),!0;if(e.type==="OCG")return u(this,qt).has(e.id)?u(this,qt).get(e.id).visible:(ut(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return L(this,Dd,R0).call(this,e.expression);if(!e.policy||e.policy==="AnyOn"){for(const t of e.ids){if(!u(this,qt).has(t))return ut(`Optional content group not found: ${t}`),!0;if(u(this,qt).get(t).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const t of e.ids){if(!u(this,qt).has(t))return ut(`Optional content group not found: ${t}`),!0;if(!u(this,qt).get(t).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const t of e.ids){if(!u(this,qt).has(t))return ut(`Optional content group not found: ${t}`),!0;if(!u(this,qt).get(t).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const t of e.ids){if(!u(this,qt).has(t))return ut(`Optional content group not found: ${t}`),!0;if(u(this,qt).get(t).visible)return!1}return!0}return ut(`Unknown optional content policy ${e.policy}.`),!0}return ut(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,r=!0){var s;const n=u(this,qt).get(e);if(!n){ut(`Optional content group not found: ${e}`);return}if(r&&t&&n.rbGroups.length)for(const a of n.rbGroups)for(const o of a)o!==e&&((s=u(this,qt).get(o))==null||s._setVisible(cu,!1,!0));n._setVisible(cu,!!t,!0),T(this,Oa,null)}setOCGState({state:e,preserveRB:t}){let r;for(const n of e){switch(n){case"ON":case"OFF":case"Toggle":r=n;continue}const s=u(this,qt).get(n);if(s)switch(r){case"ON":this.setVisibility(n,!0,t);break;case"OFF":this.setVisibility(n,!1,t);break;case"Toggle":this.setVisibility(n,!s.visible,t);break}}T(this,Oa,null)}get hasInitialVisibility(){return u(this,Hu)===null||this.getHash()===u(this,Hu)}getOrder(){return u(this,qt).size?u(this,$u)?u(this,$u).slice():[...u(this,qt).keys()]:null}getGroup(e){return u(this,qt).get(e)||null}getHash(){if(u(this,Oa)!==null)return u(this,Oa);const e=new H1;for(const[t,r]of u(this,qt))e.update(`${t}:${r.visible}`);return T(this,Oa,e.hexdigest())}[Symbol.iterator](){return u(this,qt).entries()}}Oa=new WeakMap,qt=new WeakMap,Hu=new WeakMap,$u=new WeakMap,Dd=new WeakSet,R0=function(e){const t=e.length;if(t<2)return!0;const r=e[0];for(let n=1;n<t;n++){const s=e[n];let a;if(Array.isArray(s))a=L(this,Dd,R0).call(this,s);else if(u(this,qt).has(s))a=u(this,qt).get(s).visible;else return ut(`Optional content group not found: ${s}`),!0;switch(r){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return r==="And"};class mC{constructor(e,{disableRange:t=!1,disableStream:r=!1}){Dr(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:n,initialData:s,progressiveDone:a,contentDispositionFilename:o}=e;if(this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=o,(s==null?void 0:s.length)>0){const l=s instanceof Uint8Array&&s.byteLength===s.buffer.byteLength?s.buffer:new Uint8Array(s).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!r,this._isRangeSupported=!t,this._contentLength=n,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener((l,c)=>{this._onReceiveData({begin:l,chunk:c})}),e.addProgressListener((l,c)=>{this._onProgress({loaded:l,total:c})}),e.addProgressiveReadListener(l=>{this._onReceiveData({chunk:l})}),e.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),e.transportReady()}_onReceiveData({begin:e,chunk:t}){const r=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(r):this._queuedChunks.push(r);else{const n=this._rangeReaders.some(function(s){return s._begin!==e?!1:(s._enqueue(r),!0)});Dr(n,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}_onProgress(e){var t,r,n,s;e.total===void 0?(r=(t=this._rangeReaders[0])==null?void 0:t.onProgress)==null||r.call(t,{loaded:e.loaded}):(s=(n=this._fullRequestReader)==null?void 0:n.onProgress)==null||s.call(n,{loaded:e.loaded,total:e.total})}_onProgressiveDone(){var e;(e=this._fullRequestReader)==null||e.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){Dr(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new bC(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const r=new vC(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(r),r}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const r of this._rangeReaders.slice(0))r.cancel(e);this._pdfDataRangeTransport.abort()}}class bC{constructor(e,t,r=!1,n=null){this._stream=e,this._done=r||!1,this._filename=Dg(n)?n:null,this._queuedChunks=t||[],this._loaded=0;for(const s of this._queuedChunks)this._loaded+=s.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class vC{constructor(e,t,r){this._stream=e,this._begin=t,this._end=r,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length===0)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function yC(i){let e=!0,t=r("filename\\*","i").exec(i);if(t){t=t[1];let h=o(t);return h=unescape(h),h=l(h),h=c(h),s(h)}if(t=a(i),t){const h=c(t);return s(h)}if(t=r("filename","i").exec(i),t){t=t[1];let h=o(t);return h=c(h),s(h)}function r(h,d){return new RegExp("(?:^|;)\\s*"+h+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',d)}function n(h,d){if(h){if(!/^[\x00-\xFF]+$/.test(d))return d;try{const p=new TextDecoder(h,{fatal:!0}),g=Sf(d);d=p.decode(g),e=!1}catch{}}return d}function s(h){return e&&/[\x80-\xff]/.test(h)&&(h=n("utf-8",h),e&&(h=n("iso-8859-1",h))),h}function a(h){const d=[];let p;const g=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(p=g.exec(h))!==null;){let[,b,w,v]=p;if(b=parseInt(b,10),b in d){if(b===0)break;continue}d[b]=[w,v]}const y=[];for(let b=0;b<d.length&&b in d;++b){let[w,v]=d[b];v=o(v),w&&(v=unescape(v),b===0&&(v=l(v))),y.push(v)}return y.join("")}function o(h){if(h.startsWith('"')){const d=h.slice(1).split('\\"');for(let p=0;p<d.length;++p){const g=d[p].indexOf('"');g!==-1&&(d[p]=d[p].slice(0,g),d.length=p+1),d[p]=d[p].replaceAll(/\\(.)/g,"$1")}h=d.join('"')}return h}function l(h){const d=h.indexOf("'");if(d===-1)return h;const p=h.slice(0,d),y=h.slice(d+1).replace(/^[^']*'/,"");return n(p,y)}function c(h){return!h.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(h)?h:h.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(d,p,g,y){if(g==="q"||g==="Q")return y=y.replaceAll("_"," "),y=y.replaceAll(/=([0-9a-fA-F]{2})/g,function(b,w){return String.fromCharCode(parseInt(w,16))}),n(p,y);try{y=atob(y)}catch{}return n(p,y)})}return""}function tw(i,e){const t=new Headers;if(!i||!e||typeof e!="object")return t;for(const r in e){const n=e[r];n!==void 0&&t.append(r,n)}return t}function Rg(i){var e;return((e=URL.parse(i))==null?void 0:e.origin)??null}function rw({responseHeaders:i,isHttp:e,rangeChunkSize:t,disableRange:r}){const n={allowRangeRequests:!1,suggestedLength:void 0},s=parseInt(i.get("Content-Length"),10);return!Number.isInteger(s)||(n.suggestedLength=s,s<=2*t)||r||!e||i.get("Accept-Ranges")!=="bytes"||(i.get("Content-Encoding")||"identity")!=="identity"||(n.allowRangeRequests=!0),n}function nw(i){const e=i.get("Content-Disposition");if(e){let t=yC(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(Dg(t))return t}return null}function Pf(i,e){return new Rh(`Unexpected server response (${i}) while retrieving PDF "${e}".`,i,i===404||i===0&&e.startsWith("file:"))}function iw(i){return i===200||i===206}function sw(i,e,t){return{method:"GET",headers:i,signal:t.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function aw(i){return i instanceof Uint8Array?i.buffer:i instanceof ArrayBuffer?i:(ut(`getArrayBuffer - unexpected data format: ${i}`),new Uint8Array(i).buffer)}class wC{constructor(e){Ie(this,"_responseOrigin",null);this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=tw(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return Dr(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new xC(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const r=new AC(this,e,t);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class xC{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange;const r=new Headers(e.headers),n=t.url;fetch(n,sw(r,this._withCredentials,this._abortController)).then(s=>{if(e._responseOrigin=Rg(s.url),!iw(s.status))throw Pf(s.status,n);this._reader=s.body.getReader(),this._headersCapability.resolve();const a=s.headers,{allowRangeRequests:o,suggestedLength:l}=rw({responseHeaders:a,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=l||this._contentLength,this._filename=nw(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new ha("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 r;await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded,total:this._contentLength}),{value:aw(e),done:!1})}cancel(e){var t;(t=this._reader)==null||t.cancel(e),this._abortController.abort()}}class AC{constructor(e,t,r){this._stream=e,this._reader=null,this._loaded=0;const n=e.source;this._withCredentials=n.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!n.disableStream,this._abortController=new AbortController;const s=new Headers(e.headers);s.append("Range",`bytes=${t}-${r-1}`);const a=n.url;fetch(a,sw(s,this._withCredentials,this._abortController)).then(o=>{const l=Rg(o.url);if(l!==e._responseOrigin)throw new Error(`Expected range response-origin "${l}" to match "${e._responseOrigin}".`);if(!iw(o.status))throw Pf(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 r;await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded}),{value:aw(e),done:!1})}cancel(e){var t;(t=this._reader)==null||t.cancel(e),this._abortController.abort()}}const vm=200,ym=206;function EC(i){const e=i.response;return typeof e!="string"?e:Sf(e).buffer}class _C{constructor({url:e,httpHeaders:t,withCredentials:r}){Ie(this,"_responseOrigin",null);this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=tw(this.isHttp,t),this.withCredentials=r||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(e){const t=new XMLHttpRequest,r=this.currXhrId++,n=this.pendingRequests[r]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(const[s,a]of this.headers)t.setRequestHeader(s,a);return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),n.expectedStatus=ym):n.expectedStatus=vm,t.responseType="arraybuffer",Dr(e.onError,"Expected `onError` callback to be provided."),t.onerror=()=>{e.onError(t.status)},t.onreadystatechange=this.onStateChange.bind(this,r),t.onprogress=this.onProgress.bind(this,r),n.onHeadersReceived=e.onHeadersReceived,n.onDone=e.onDone,n.onError=e.onError,n.onProgress=e.onProgress,t.send(null),r}onProgress(e,t){var n;const r=this.pendingRequests[e];r&&((n=r.onProgress)==null||n.call(r,t))}onStateChange(e,t){const r=this.pendingRequests[e];if(!r)return;const n=r.xhr;if(n.readyState>=2&&r.onHeadersReceived&&(r.onHeadersReceived(),delete r.onHeadersReceived),n.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],n.status===0&&this.isHttp){r.onError(n.status);return}const s=n.status||vm;if(!(s===vm&&r.expectedStatus===ym)&&s!==r.expectedStatus){r.onError(n.status);return}const o=EC(n);if(s===ym){const l=n.getResponseHeader("Content-Range"),c=/bytes (\d+)-(\d+)\/(\d+)/.exec(l);c?r.onDone({begin:parseInt(c[1],10),chunk:o}):(ut('Missing or invalid "Content-Range" header.'),r.onError(0))}else o?r.onDone({begin:0,chunk:o}):r.onError(n.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}class CC{constructor(e){this._source=e,this._manager=new _C(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return Dr(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new SC(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const r=new TC(this._manager,e,t);return r.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class SC{constructor(e,t){this._manager=e,this._url=t.url,this._fullRequestId=e.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,t=this._manager.getRequestXhr(e);this._manager._responseOrigin=Rg(t.responseURL);const r=t.getAllResponseHeaders(),n=new Headers(r?r.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(o=>{const[l,...c]=o.split(": ");return[l,c.join(": ")]}):[]),{allowRangeRequests:s,suggestedLength:a}=rw({responseHeaders:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=a||this._contentLength,this._filename=nw(n),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=Pf(e,this._url),this._headersCapability.reject(this._storedError);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){var t;(t=this.onProgress)==null||t.call(this,{loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e);for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class TC{constructor(e,t,r){this._manager=e,this._url=e.url,this._requestId=e.request({begin:t,end:r,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 t;const e=Rg((t=this._manager.getRequestXhr(this._requestId))==null?void 0:t.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){var e;(e=this.onClosed)==null||e.call(this,this)}_onDone(e){const t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError??(this._storedError=Pf(e,this._url));for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){var t;this.isStreamingSupported||(t=this.onProgress)==null||t.call(this,{loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const kC=/^[a-z][a-z0-9\-+.]+:/i;function DC(i){if(kC.test(i))return new URL(i);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(i))}class PC{constructor(e){this.source=e,this.url=DC(e.url),Dr(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return Dr(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new RC(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const r=new IC(this,e,t);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class RC{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const r=process.getBuiltinModule("fs");r.promises.lstat(this._url).then(n=>{this._contentLength=n.size,this._setReadableStream(r.createReadStream(this._url)),this._headersCapability.resolve()},n=>{n.code==="ENOENT"&&(n=Pf(0,this._url.href)),this._storedError=n,this._headersCapability.reject(n)})}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 r;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new ha("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class IC{constructor(e,t,r){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const n=e.source;this._isStreamingSupported=!n.disableStream;const s=process.getBuiltinModule("fs");this._setReadableStream(s.createReadStream(this._url,{start:t,end:r-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var r;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const Kc=Symbol("INITIAL_DATA");var Wn,Pd,I0;class ow{constructor(){N(this,Pd);N(this,Wn,Object.create(null))}get(e,t=null){if(t){const n=L(this,Pd,I0).call(this,e);return n.promise.then(()=>t(n.data)),null}const r=u(this,Wn)[e];if(!r||r.data===Kc)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return r.data}has(e){const t=u(this,Wn)[e];return!!t&&t.data!==Kc}delete(e){const t=u(this,Wn)[e];return!t||t.data===Kc?!1:(delete u(this,Wn)[e],!0)}resolve(e,t=null){const r=L(this,Pd,I0).call(this,e);r.data=t,r.resolve()}clear(){var e;for(const t in u(this,Wn)){const{data:r}=u(this,Wn)[t];(e=r==null?void 0:r.bitmap)==null||e.close()}T(this,Wn,Object.create(null))}*[Symbol.iterator](){for(const e in u(this,Wn)){const{data:t}=u(this,Wn)[e];t!==Kc&&(yield[e,t])}}}Wn=new WeakMap,Pd=new WeakSet,I0=function(e){var t;return(t=u(this,Wn))[e]||(t[e]={...Promise.withResolvers(),data:Kc})};const NC=1e5,dy=30;var z2,Fa,In,Rd,Id,tl,Vs,Nd,Md,rl,Vu,qu,Ba,Gu,Ld,Wu,nl,Od,Fd,mr,Xu,il,Bd,za,Yu,fa,lw,uw,N0,oi,Cp,M0,cw,hw;let Nh=(mr=class{constructor({textContentSource:e,container:t,viewport:r}){N(this,fa);N(this,Fa,Promise.withResolvers());N(this,In,null);N(this,Rd,!1);N(this,Id,!!((z2=globalThis.FontInspector)!=null&&z2.enabled));N(this,tl,null);N(this,Vs,null);N(this,Nd,0);N(this,Md,0);N(this,rl,null);N(this,Vu,null);N(this,qu,0);N(this,Ba,0);N(this,Gu,Object.create(null));N(this,Ld,[]);N(this,Wu,null);N(this,nl,[]);N(this,Od,new WeakMap);N(this,Fd,null);var l;if(e instanceof ReadableStream)T(this,Wu,e);else if(typeof e=="object")T(this,Wu,new ReadableStream({start(c){c.enqueue(e),c.close()}}));else throw new Error('No "textContentSource" parameter specified.');T(this,In,T(this,Vu,t)),T(this,Ba,r.scale*Wi.pixelRatio),T(this,qu,r.rotation),T(this,Vs,{div:null,properties:null,ctx:null});const{pageWidth:n,pageHeight:s,pageX:a,pageY:o}=r.rawDims;T(this,Fd,[1,0,0,-1,-a,o+s]),T(this,Md,n),T(this,Nd,s),L(l=mr,oi,cw).call(l),ao(t,r),u(this,Fa).promise.finally(()=>{u(mr,Yu).delete(this),T(this,Vs,null),T(this,Gu,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:t}=Gr.platform;return Ct(this,"fontFamilyMap",new Map([["sans-serif",`${e&&t?"Calibri, ":""}sans-serif`],["monospace",`${e&&t?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{u(this,rl).read().then(({value:t,done:r})=>{if(r){u(this,Fa).resolve();return}u(this,tl)??T(this,tl,t.lang),Object.assign(u(this,Gu),t.styles),L(this,fa,lw).call(this,t.items),e()},u(this,Fa).reject)};return T(this,rl,u(this,Wu).getReader()),u(mr,Yu).add(this),e(),u(this,Fa).promise}update({viewport:e,onBefore:t=null}){var s;const r=e.scale*Wi.pixelRatio,n=e.rotation;if(n!==u(this,qu)&&(t==null||t(),T(this,qu,n),ao(u(this,Vu),{rotation:n})),r!==u(this,Ba)){t==null||t(),T(this,Ba,r);const a={div:null,properties:null,ctx:L(s=mr,oi,Cp).call(s,u(this,tl))};for(const o of u(this,nl))a.properties=u(this,Od).get(o),a.div=o,L(this,fa,N0).call(this,a)}}cancel(){var t;const e=new ha("TextLayer task cancelled.");(t=u(this,rl))==null||t.cancel(e).catch(()=>{}),T(this,rl,null),u(this,Fa).reject(e)}get textDivs(){return u(this,nl)}get textContentItemsStr(){return u(this,Ld)}static cleanup(){if(!(u(this,Yu).size>0)){u(this,Xu).clear();for(const{canvas:e}of u(this,il).values())e.remove();u(this,il).clear()}}},Fa=new WeakMap,In=new WeakMap,Rd=new WeakMap,Id=new WeakMap,tl=new WeakMap,Vs=new WeakMap,Nd=new WeakMap,Md=new WeakMap,rl=new WeakMap,Vu=new WeakMap,qu=new WeakMap,Ba=new WeakMap,Gu=new WeakMap,Ld=new WeakMap,Wu=new WeakMap,nl=new WeakMap,Od=new WeakMap,Fd=new WeakMap,Xu=new WeakMap,il=new WeakMap,Bd=new WeakMap,za=new WeakMap,Yu=new WeakMap,fa=new WeakSet,lw=function(e){var n,s;if(u(this,Rd))return;(s=u(this,Vs)).ctx??(s.ctx=L(n=mr,oi,Cp).call(n,u(this,tl)));const t=u(this,nl),r=u(this,Ld);for(const a of e){if(t.length>NC){ut("Ignoring additional textDivs for performance reasons."),T(this,Rd,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const o=u(this,In);T(this,In,document.createElement("span")),u(this,In).classList.add("markedContent"),a.id!==null&&u(this,In).setAttribute("id",`${a.id}`),o.append(u(this,In))}else a.type==="endMarkedContent"&&T(this,In,u(this,In).parentNode);continue}r.push(a.str),L(this,fa,uw).call(this,a)}},uw=function(e){var b;const t=document.createElement("span"),r={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};u(this,nl).push(t);const n=Qe.transform(u(this,Fd),e.transform);let s=Math.atan2(n[1],n[0]);const a=u(this,Gu)[e.fontName];a.vertical&&(s+=Math.PI/2);let o=u(this,Id)&&a.fontSubstitution||a.fontFamily;o=mr.fontFamilyMap.get(o)||o;const l=Math.hypot(n[2],n[3]),c=l*L(b=mr,oi,hw).call(b,o,a,u(this,tl));let h,d;s===0?(h=n[4],d=n[5]-c):(h=n[4]+c*Math.sin(s),d=n[5]-c*Math.cos(s));const p="calc(var(--total-scale-factor) *",g=t.style;u(this,In)===u(this,Vu)?(g.left=`${(100*h/u(this,Md)).toFixed(2)}%`,g.top=`${(100*d/u(this,Nd)).toFixed(2)}%`):(g.left=`${p}${h.toFixed(2)}px)`,g.top=`${p}${d.toFixed(2)}px)`),g.fontSize=`${p}${(u(mr,za)*l).toFixed(2)}px)`,g.fontFamily=o,r.fontSize=l,t.setAttribute("role","presentation"),t.textContent=e.str,t.dir=e.dir,u(this,Id)&&(t.dataset.fontName=a.fontSubstitutionLoadedName||e.fontName),s!==0&&(r.angle=s*(180/Math.PI));let y=!1;if(e.str.length>1)y=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const w=Math.abs(e.transform[0]),v=Math.abs(e.transform[3]);w!==v&&Math.max(w,v)/Math.min(w,v)>1.5&&(y=!0)}if(y&&(r.canvasWidth=a.vertical?e.height:e.width),u(this,Od).set(t,r),u(this,Vs).div=t,u(this,Vs).properties=r,L(this,fa,N0).call(this,u(this,Vs)),r.hasText&&u(this,In).append(t),r.hasEOL){const w=document.createElement("br");w.setAttribute("role","presentation"),u(this,In).append(w)}},N0=function(e){var o;const{div:t,properties:r,ctx:n}=e,{style:s}=t;let a="";if(u(mr,za)>1&&(a=`scale(${1/u(mr,za)})`),r.canvasWidth!==0&&r.hasText){const{fontFamily:l}=s,{canvasWidth:c,fontSize:h}=r;L(o=mr,oi,M0).call(o,n,h*u(this,Ba),l);const{width:d}=n.measureText(t.textContent);d>0&&(a=`scaleX(${c*u(this,Ba)/d}) ${a}`)}r.angle!==0&&(a=`rotate(${r.angle}deg) ${a}`),a.length>0&&(s.transform=a)},oi=new WeakSet,Cp=function(e=null){let t=u(this,il).get(e||(e=""));if(!t){const r=document.createElement("canvas");r.className="hiddenCanvasElement",r.lang=e,document.body.append(r),t=r.getContext("2d",{alpha:!1,willReadFrequently:!0}),u(this,il).set(e,t),u(this,Bd).set(t,{size:0,family:""})}return t},M0=function(e,t,r){const n=u(this,Bd).get(e);t===n.size&&r===n.family||(e.font=`${t}px ${r}`,n.size=t,n.family=r)},cw=function(){if(u(this,za)!==null)return;const e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),T(this,za,e.getBoundingClientRect().height),e.remove()},hw=function(e,t,r){const n=u(this,Xu).get(e);if(n)return n;const s=L(this,oi,Cp).call(this,r);s.canvas.width=s.canvas.height=dy,L(this,oi,M0).call(this,s,dy,e);const a=s.measureText(""),o=a.fontBoundingBoxAscent,l=Math.abs(a.fontBoundingBoxDescent);s.canvas.width=s.canvas.height=0;let c=.8;return o?c=o/(o+l):(Gr.platform.isFirefox&&ut("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),t.ascent?c=t.ascent:t.descent&&(c=1+t.descent)),u(this,Xu).set(e,c),c},N(mr,oi),N(mr,Xu,new Map),N(mr,il,new Map),N(mr,Bd,new WeakMap),N(mr,za,null),N(mr,Yu,new Set),mr);class Mh{static textContent(e){const t=[],r={items:t,styles:Object.create(null)};function n(s){var l;if(!s)return;let a=null;const o=s.name;if(o==="#text")a=s.value;else if(Mh.shouldBuildText(o))(l=s==null?void 0:s.attributes)!=null&&l.textContent?a=s.attributes.textContent:s.value&&(a=s.value);else return;if(a!==null&&t.push({str:a}),!!s.children)for(const c of s.children)n(c)}return n(e),r}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}const MC=100;function Bb(i={}){typeof i=="string"||i instanceof URL?i={url:i}:(i instanceof ArrayBuffer||ArrayBuffer.isView(i))&&(i={data:i});const e=new L0,{docId:t}=e,r=i.url?V_(i.url):null,n=i.data?q_(i.data):null,s=i.httpHeaders||null,a=i.withCredentials===!0,o=i.password??null,l=i.range instanceof zb?i.range:null,c=Number.isInteger(i.rangeChunkSize)&&i.rangeChunkSize>0?i.rangeChunkSize:2**16;let h=i.worker instanceof kc?i.worker:null;const d=i.verbosity,p=typeof i.docBaseUrl=="string"&&!kf(i.docBaseUrl)?i.docBaseUrl:null,g=ep(i.cMapUrl),y=i.cMapPacked!==!1,b=i.CMapReaderFactory||(_n?Q_:ey),w=ep(i.iccUrl),v=ep(i.standardFontDataUrl),A=i.StandardFontDataFactory||(_n?J_:ty),E=ep(i.wasmUrl),_=i.WasmFactory||(_n?eC:ry),C=i.stopAtErrors!==!0,I=Number.isInteger(i.maxImageSize)&&i.maxImageSize>-1?i.maxImageSize:-1,k=i.isEvalSupported!==!1,D=typeof i.isOffscreenCanvasSupported=="boolean"?i.isOffscreenCanvasSupported:!_n,R=typeof i.isImageDecoderSupported=="boolean"?i.isImageDecoderSupported:!_n&&(Gr.platform.isFirefox||!globalThis.chrome),z=Number.isInteger(i.canvasMaxAreaInBytes)?i.canvasMaxAreaInBytes:-1,q=typeof i.disableFontFace=="boolean"?i.disableFontFace:_n,O=i.fontExtraProperties===!0,X=i.enableXfa===!0,S=i.ownerDocument||globalThis.document,J=i.disableRange===!0,Y=i.disableStream===!0,W=i.disableAutoFetch===!0,fe=i.pdfBug===!0,K=i.CanvasFactory||(_n?K_:X_),be=i.FilterFactory||(_n?Z_:Y_),te=i.enableHWA===!0,j=i.useWasm!==!1,ie=l?l.length:i.length??NaN,ae=typeof i.useSystemFonts=="boolean"?i.useSystemFonts:!_n&&!q,H=typeof i.useWorkerFetch=="boolean"?i.useWorkerFetch:!!(b===ey&&A===ty&&_===ry&&g&&v&&E&&ah(g,document.baseURI)&&ah(v,document.baseURI)&&ah(E,document.baseURI)),se=null;S_(d);const le={canvasFactory:new K({ownerDocument:S,enableHWA:te}),filterFactory:new be({docId:t,ownerDocument:S}),cMapReaderFactory:H?null:new b({baseUrl:g,isCompressed:y}),standardFontDataFactory:H?null:new A({baseUrl:v}),wasmFactory:H?null:new _({baseUrl:E})};h||(h=kc.create({verbosity:d,port:yi.workerPort}),e._worker=h);const oe={docId:t,apiVersion:"5.3.93",data:n,password:o,disableAutoFetch:W,rangeChunkSize:c,length:ie,docBaseUrl:p,enableXfa:X,evaluatorOptions:{maxImageSize:I,disableFontFace:q,ignoreErrors:C,isEvalSupported:k,isOffscreenCanvasSupported:D,isImageDecoderSupported:R,canvasMaxAreaInBytes:z,fontExtraProperties:O,useSystemFonts:ae,useWasm:j,useWorkerFetch:H,cMapUrl:g,iccUrl:w,standardFontDataUrl:v,wasmUrl:E}},ce={ownerDocument:S,pdfBug:fe,styleElement:se,loadingParams:{disableAutoFetch:W,enableXfa:X}};return h.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const Ae=h.messageHandler.sendWithPromise("GetDocRequest",oe,n?[n.buffer]:null);let Se;if(l)Se=new mC(l,{disableRange:J,disableStream:Y});else if(!n){if(!r)throw new Error("getDocument - no `url` parameter provided.");const Ne=ah(r)?wC:_n?PC:CC;Se=new Ne({url:r,length:ie,httpHeaders:s,withCredentials:a,rangeChunkSize:c,disableRange:J,disableStream:Y})}return Ae.then(Ne=>{if(e.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const Te=new hh(t,Ne,h.port),x=new FC(Te,e,Se,ce,le);e._transport=x,Te.send("Ready",null)})}).catch(e._capability.reject),e}var gg;const mg=class mg{constructor(){Ie(this,"_capability",Promise.withResolvers());Ie(this,"_transport",null);Ie(this,"_worker",null);Ie(this,"docId",`d${bn(mg,gg)._++}`);Ie(this,"destroyed",!1);Ie(this,"onPassword",null);Ie(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var e,t,r,n;this.destroyed=!0;try{(e=this._worker)!=null&&e.port&&(this._worker._pendingDestroy=!0),await((t=this._transport)==null?void 0:t.destroy())}catch(s){throw(r=this._worker)!=null&&r.port&&delete this._worker._pendingDestroy,s}this._transport=null,(n=this._worker)==null||n.destroy(),this._worker=null}async getData(){return this._transport.getData()}};gg=new WeakMap,N(mg,gg,0);let L0=mg;var sl,zd,jd,Ud,Hd,j2;let zb=(j2=class{constructor(e,t,r=!1,n=null){N(this,sl,Promise.withResolvers());N(this,zd,[]);N(this,jd,[]);N(this,Ud,[]);N(this,Hd,[]);this.length=e,this.initialData=t,this.progressiveDone=r,this.contentDispositionFilename=n}addRangeListener(e){u(this,Hd).push(e)}addProgressListener(e){u(this,Ud).push(e)}addProgressiveReadListener(e){u(this,jd).push(e)}addProgressiveDoneListener(e){u(this,zd).push(e)}onDataRange(e,t){for(const r of u(this,Hd))r(e,t)}onDataProgress(e,t){u(this,sl).promise.then(()=>{for(const r of u(this,Ud))r(e,t)})}onDataProgressiveRead(e){u(this,sl).promise.then(()=>{for(const t of u(this,jd))t(e)})}onDataProgressiveDone(){u(this,sl).promise.then(()=>{for(const e of u(this,zd))e()})}transportReady(){u(this,sl).resolve()}requestDataRange(e,t){Wt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},sl=new WeakMap,zd=new WeakMap,jd=new WeakMap,Ud=new WeakMap,Hd=new WeakMap,j2);class LC{constructor(e,t){this._pdfInfo=e,this._transport=t}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 Ct(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var qs,al,mh;class OC{constructor(e,t,r,n=!1){N(this,al);N(this,qs,!1);this._pageIndex=e,this._pageInfo=t,this._transport=r,this._stats=n?new Kv:null,this._pdfBug=n,this.commonObjs=r.commonObjs,this.objs=new ow,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:e,rotation:t=this.rotate,offsetX:r=0,offsetY:n=0,dontFlip:s=!1}={}){return new Tf({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:r,offsetY:n,dontFlip:s})}getAnnotations({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Ct(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var e;return((e=this._transport._htmlForXfa)==null?void 0:e.children[this._pageIndex])||null}render({canvasContext:e,viewport:t,intent:r="display",annotationMode:n=vs.ENABLE,transform:s=null,background:a=null,optionalContentConfigPromise:o=null,annotationCanvasMap:l=null,pageColors:c=null,printAnnotationStorage:h=null,isEditing:d=!1}){var _,C;(_=this._stats)==null||_.time("Overall");const p=this._transport.getRenderingIntent(r,n,h,d),{renderingIntent:g,cacheKey:y}=p;T(this,qs,!1),o||(o=this._transport.getOptionalContentConfig(g));let b=this._intentStates.get(y);b||(b=Object.create(null),this._intentStates.set(y,b)),b.streamReaderCancelTimeout&&(clearTimeout(b.streamReaderCancelTimeout),b.streamReaderCancelTimeout=null);const w=!!(g&ii.PRINT);b.displayReadyCapability||(b.displayReadyCapability=Promise.withResolvers(),b.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(C=this._stats)==null||C.time("Page Request"),this._pumpOperatorList(p));const v=I=>{var k;b.renderTasks.delete(A),w&&T(this,qs,!0),L(this,al,mh).call(this),I?(A.capability.reject(I),this._abortOperatorList({intentState:b,reason:I instanceof Error?I:new Error(I)})):A.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(k=globalThis.Stats)!=null&&k.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},A=new O0({callback:v,params:{canvasContext:e,viewport:t,transform:s,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:b.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!w,pdfBug:this._pdfBug,pageColors:c});(b.renderTasks||(b.renderTasks=new Set)).add(A);const E=A.task;return Promise.all([b.displayReadyCapability.promise,o]).then(([I,k])=>{var D;if(this.destroyed){v();return}if((D=this._stats)==null||D.time("Rendering"),!(k.renderingIntent&g))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");A.initializeGraphics({transparency:I,optionalContentConfig:k}),A.operatorListChanged()}).catch(v),E}getOperatorList({intent:e="display",annotationMode:t=vs.ENABLE,printAnnotationStorage:r=null,isEditing:n=!1}={}){var c;function s(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}const a=this._transport.getRenderingIntent(e,t,r,n,!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=s,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(l),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(c=this._stats)==null||c.time("Page Request"),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:t===!0},{highWaterMark:100,size(n){return n.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(r=>Mh.textContent(r));const t=this.streamTextContent(e);return new Promise(function(r,n){function s(){a.read().then(function({value:l,done:c}){if(c){r(o);return}o.lang??(o.lang=l.lang),Object.assign(o.styles,l.styles),o.items.push(...l.items),s()},n)}const a=t.getReader(),o={items:[],styles:Object.create(null),lang:null};s()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const r of t.renderTasks)e.push(r.completed),r.cancel();return this.objs.clear(),T(this,qs,!1),Promise.all(e)}cleanup(e=!1){T(this,qs,!0);const t=L(this,al,mh).call(this);return e&&t&&this._stats&&(this._stats=new Kv),t}_startRenderPage(e,t){var n,s;const r=this._intentStates.get(t);r&&((n=this._stats)==null||n.timeEnd("Page Request"),(s=r.displayReadyCapability)==null||s.resolve(e))}_renderPageChunk(e,t){for(let r=0,n=e.length;r<n;r++)t.operatorList.fnArray.push(e.fnArray[r]),t.operatorList.argsArray.push(e.argsArray[r]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const r of t.renderTasks)r.operatorListChanged();e.lastChunk&&L(this,al,mh).call(this)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:r,modifiedIds:n}){const{map:s,transfer:a}=r,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:s,modifiedIds:n},a).getReader(),c=this._intentStates.get(t);c.streamReader=l;const h=()=>{l.read().then(({value:d,done:p})=>{if(p){c.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(d,c),h())},d=>{if(c.streamReader=null,!this._transport.destroyed){if(c.operatorList){c.operatorList.lastChunk=!0;for(const p of c.renderTasks)p.operatorListChanged();L(this,al,mh).call(this)}if(c.displayReadyCapability)c.displayReadyCapability.reject(d);else if(c.opListReadCapability)c.opListReadCapability.reject(d);else throw d}})};h()}_abortOperatorList({intentState:e,reason:t,force:r=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!r){if(e.renderTasks.size>0)return;if(t instanceof kg){let n=MC;t.extraDelay>0&&t.extraDelay<1e3&&(n+=t.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})},n);return}}if(e.streamReader.cancel(new ha(t.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[n,s]of this._intentStates)if(s===e){this._intentStates.delete(n);break}this.cleanup()}}}get stats(){return this._stats}}qs=new WeakMap,al=new WeakSet,mh=function(){if(!u(this,qs)||this.destroyed)return!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),T(this,qs,!1),!0};var ja,Oi,Gs,ol,bg,ll,ul,Tn,Sp,dw,fw,bh,Zu,Tp;const ar=class ar{constructor({name:e=null,port:t=null,verbosity:r=T_()}={}){N(this,Tn);N(this,ja,Promise.withResolvers());N(this,Oi,null);N(this,Gs,null);N(this,ol,null);if(this.name=e,this.destroyed=!1,this.verbosity=r,t){if(u(ar,ul).has(t))throw new Error("Cannot use more than one PDFWorker per port.");u(ar,ul).set(t,this),L(this,Tn,dw).call(this,t)}else L(this,Tn,fw).call(this)}get promise(){return u(this,ja).promise}get port(){return u(this,Gs)}get messageHandler(){return u(this,Oi)}destroy(){var e,t;this.destroyed=!0,(e=u(this,ol))==null||e.terminate(),T(this,ol,null),u(ar,ul).delete(u(this,Gs)),T(this,Gs,null),(t=u(this,Oi))==null||t.destroy(),T(this,Oi,null)}static create(e){const t=u(this,ul).get(e==null?void 0:e.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new ar(e)}static get workerSrc(){if(yi.workerSrc)return yi.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Ct(this,"_setupFakeWorkerGlobal",(async()=>u(this,Zu,Tp)?u(this,Zu,Tp):(await import(this.workerSrc)).WorkerMessageHandler)())}};ja=new WeakMap,Oi=new WeakMap,Gs=new WeakMap,ol=new WeakMap,bg=new WeakMap,ll=new WeakMap,ul=new WeakMap,Tn=new WeakSet,Sp=function(){u(this,ja).resolve(),u(this,Oi).send("configure",{verbosity:this.verbosity})},dw=function(e){T(this,Gs,e),T(this,Oi,new hh("main","worker",e)),u(this,Oi).on("ready",()=>{}),L(this,Tn,Sp).call(this)},fw=function(){if(u(ar,ll)||u(ar,Zu,Tp)){L(this,Tn,bh).call(this);return}let{workerSrc:e}=ar;try{ar._isSameOrigin(window.location,e)||(e=ar._createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e,{type:"module"}),r=new hh("main","worker",t),n=()=>{s.abort(),r.destroy(),t.terminate(),this.destroyed?u(this,ja).reject(new Error("Worker was destroyed")):L(this,Tn,bh).call(this)},s=new AbortController;t.addEventListener("error",()=>{u(this,ol)||n()},{signal:s.signal}),r.on("test",o=>{if(s.abort(),this.destroyed||!o){n();return}T(this,Oi,r),T(this,Gs,t),T(this,ol,t),L(this,Tn,Sp).call(this)}),r.on("ready",o=>{if(s.abort(),this.destroyed){n();return}try{a()}catch{L(this,Tn,bh).call(this)}});const a=()=>{const o=new Uint8Array;r.send("test",o,[o.buffer])};a();return}catch{Tg("The worker has been disabled.")}L(this,Tn,bh).call(this)},bh=function(){u(ar,ll)||(ut("Setting up fake worker."),T(ar,ll,!0)),ar._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){u(this,ja).reject(new Error("Worker was destroyed"));return}const t=new W_;T(this,Gs,t);const r=`fake${bn(ar,bg)._++}`,n=new hh(r+"_worker",r,t);e.setup(n,t),T(this,Oi,new hh(r,r+"_worker",t)),L(this,Tn,Sp).call(this)}).catch(e=>{u(this,ja).reject(new Error(`Setting up fake worker failed: "${e.message}".`))})},Zu=new WeakSet,Tp=function(){var e;try{return((e=globalThis.pdfjsWorker)==null?void 0:e.WorkerMessageHandler)||null}catch{return null}},N(ar,Zu),N(ar,bg,0),N(ar,ll,!1),N(ar,ul,new WeakMap),_n&&(T(ar,ll,!0),yi.workerSrc||(yi.workerSrc="./pdf.worker.mjs")),ar._isSameOrigin=(e,t)=>{const r=URL.parse(e);if(!(r!=null&&r.origin)||r.origin==="null")return!1;const n=new URL(t,r);return r.origin===n.origin},ar._createCDNWrapper=e=>{const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))},ar.fromPort=e=>{if(O_("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!(e!=null&&e.port))throw new Error("PDFWorker.fromPort - invalid method signature.");return ar.create(e)};let kc=ar;var Ws,cs,Ku,Qu,Xs,cl,vh;class FC{constructor(e,t,r,n,s){N(this,cl);N(this,Ws,new Map);N(this,cs,new Map);N(this,Ku,new Map);N(this,Qu,new Map);N(this,Xs,null);this.messageHandler=e,this.loadingTask=t,this.commonObjs=new ow,this.fontLoader=new H_({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this.loadingParams=n.loadingParams,this._params=n,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.wasmFactory=s.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=r,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return Ct(this,"annotationStorage",new Lb)}getRenderingIntent(e,t=vs.ENABLE,r=null,n=!1,s=!1){let a=ii.DISPLAY,o=A0;switch(e){case"any":a=ii.ANY;break;case"display":break;case"print":a=ii.PRINT;break;default:ut(`getRenderingIntent - invalid intent: ${e}`)}const l=a&ii.PRINT&&r instanceof V1?r:this.annotationStorage;switch(t){case vs.DISABLE:a+=ii.ANNOTATIONS_DISABLE;break;case vs.ENABLE:break;case vs.ENABLE_FORMS:a+=ii.ANNOTATIONS_FORMS;break;case vs.ENABLE_STORAGE:a+=ii.ANNOTATIONS_STORAGE,o=l.serializable;break;default:ut(`getRenderingIntent - invalid annotationMode: ${t}`)}n&&(a+=ii.IS_EDITING),s&&(a+=ii.OPLIST);const{ids:c,hash:h}=l.modifiedIds,d=[a,o.hash,h];return{renderingIntent:a,cacheKey:d.join("_"),annotationStorageSerializable:o,modifiedIds:c}}destroy(){var r;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(r=u(this,Xs))==null||r.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const n of u(this,cs).values())e.push(n._destroy());u(this,cs).clear(),u(this,Ku).clear(),u(this,Qu).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then(()=>{var n,s;this.commonObjs.clear(),this.fontLoader.clear(),u(this,Ws).clear(),this.filterFactory.destroy(),Nh.cleanup(),(n=this._networkStream)==null||n.cancelAllRequests(new ha("Worker was terminated.")),(s=this.messageHandler)==null||s.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",(r,n)=>{Dr(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=s=>{this._lastProgress={loaded:s.loaded,total:s.total}},n.onPull=()=>{this._fullReader.read().then(function({value:s,done:a}){if(a){n.close();return}Dr(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{n.error(s)})},n.onCancel=s=>{this._fullReader.cancel(s),n.ready.catch(a=>{if(!this.destroyed)throw a})}}),e.on("ReaderHeadersReady",async r=>{var o;await this._fullReader.headersReady;const{isStreamingSupported:n,isRangeSupported:s,contentLength:a}=this._fullReader;return(!n||!s)&&(this._lastProgress&&((o=t.onProgress)==null||o.call(t,this._lastProgress)),this._fullReader.onProgress=l=>{var c;(c=t.onProgress)==null||c.call(t,{loaded:l.loaded,total:l.total})}),{isStreamingSupported:n,isRangeSupported:s,contentLength:a}}),e.on("GetRangeReader",(r,n)=>{Dr(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const s=this._networkStream.getRangeReader(r.begin,r.end);if(!s){n.close();return}n.onPull=()=>{s.read().then(function({value:a,done:o}){if(o){n.close();return}Dr(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{n.error(a)})},n.onCancel=a=>{s.cancel(a),n.ready.catch(o=>{if(!this.destroyed)throw o})}}),e.on("GetDoc",({pdfInfo:r})=>{this._numPages=r.numPages,this._htmlForXfa=r.htmlForXfa,delete r.htmlForXfa,t._capability.resolve(new LC(r,this))}),e.on("DocException",r=>{t._capability.reject(Dn(r))}),e.on("PasswordRequest",r=>{T(this,Xs,Promise.withResolvers());try{if(!t.onPassword)throw Dn(r);const n=s=>{s instanceof Error?u(this,Xs).reject(s):u(this,Xs).resolve({password:s})};t.onPassword(n,r.code)}catch(n){u(this,Xs).reject(n)}return u(this,Xs).promise}),e.on("DataLoaded",r=>{var n;(n=t.onProgress)==null||n.call(t,{loaded:r.length,total:r.length}),this.downloadInfoCapability.resolve(r)}),e.on("StartRenderPage",r=>{if(this.destroyed)return;u(this,cs).get(r.pageIndex)._startRenderPage(r.transparency,r.cacheKey)}),e.on("commonobj",([r,n,s])=>{var a;if(this.destroyed||this.commonObjs.has(r))return null;switch(n){case"Font":if("error"in s){const h=s.error;ut(`Error during font loading: ${h}`),this.commonObjs.resolve(r,h);break}const o=this._params.pdfBug&&((a=globalThis.FontInspector)!=null&&a.enabled)?(h,d)=>globalThis.FontInspector.fontAdded(h,d):null,l=new $_(s,o);this.fontLoader.bind(l).catch(()=>e.sendWithPromise("FontFallback",{id:r})).finally(()=>{!l.fontExtraProperties&&l.data&&(l.data=null),this.commonObjs.resolve(r,l)});break;case"CopyLocalImage":const{imageRef:c}=s;Dr(c,"The imageRef must be defined.");for(const h of u(this,cs).values())for(const[,d]of h.objs)if((d==null?void 0:d.ref)===c)return d.dataLen?(this.commonObjs.resolve(r,structuredClone(d)),d.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(r,s);break;default:throw new Error(`Got unknown common object type ${n}`)}return null}),e.on("obj",([r,n,s,a])=>{var l;if(this.destroyed)return;const o=u(this,cs).get(n);if(!o.objs.has(r)){if(o._intentStates.size===0){(l=a==null?void 0:a.bitmap)==null||l.close();return}switch(s){case"Image":case"Pattern":o.objs.resolve(r,a);break;default:throw new Error(`Got unknown object type ${s}`)}}}),e.on("DocProgress",r=>{var n;this.destroyed||(n=t.onProgress)==null||n.call(t,{loaded:r.loaded,total:r.total})}),e.on("FetchBinaryData",async r=>{if(this.destroyed)throw new Error("Worker was destroyed.");const n=this[r.type];if(!n)throw new Error(`${r.type} not initialized, see the \`useWorkerFetch\` parameter.`);return n.fetch(r)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var r;this.annotationStorage.size<=0&&ut("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:((r=this._fullReader)==null?void 0:r.filename)??null},t).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=e-1,r=u(this,Ku).get(t);if(r)return r;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then(s=>{if(this.destroyed)throw new Error("Transport destroyed");s.refStr&&u(this,Qu).set(s.refStr,e);const a=new OC(t,s,this,this._params.pdfBug);return u(this,cs).set(t,a),a});return u(this,Ku).set(t,n),n}getPageIndex(e){return E0(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getFieldObjects(){return L(this,cl,vh).call(this,"GetFieldObjects")}hasJSActions(){return L(this,cl,vh).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return typeof e!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return L(this,cl,vh).call(this,"GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return L(this,cl,vh).call(this,"GetOptionalContentConfig").then(t=>new gC(t,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",t=u(this,Ws).get(e);if(t)return t;const r=this.messageHandler.sendWithPromise(e,null).then(n=>{var s,a;return{info:n[0],metadata:n[1]?new fC(n[1]):null,contentDispositionFilename:((s=this._fullReader)==null?void 0:s.filename)??null,contentLength:((a=this._fullReader)==null?void 0:a.contentLength)??null}});return u(this,Ws).set(e,r),r}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of u(this,cs).values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),u(this,Ws).clear(),this.filterFactory.destroy(!0),Nh.cleanup()}}cachedPageNumber(e){if(!E0(e))return null;const t=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return u(this,Qu).get(t)??null}}Ws=new WeakMap,cs=new WeakMap,Ku=new WeakMap,Qu=new WeakMap,Xs=new WeakMap,cl=new WeakSet,vh=function(e,t=null){const r=u(this,Ws).get(e);if(r)return r;const n=this.messageHandler.sendWithPromise(e,t);return u(this,Ws).set(e,n),n};var Ua;class BC{constructor(e){N(this,Ua,null);Ie(this,"onContinue",null);Ie(this,"onError",null);T(this,Ua,e)}get promise(){return u(this,Ua).capability.promise}cancel(e=0){u(this,Ua).cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=u(this,Ua).operatorList;if(!e)return!1;const{annotationCanvasMap:t}=u(this,Ua);return e.form||e.canvas&&(t==null?void 0:t.size)>0}}Ua=new WeakMap;var Ha,hl;const Po=class Po{constructor({callback:e,params:t,objs:r,commonObjs:n,annotationCanvasMap:s,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:c,useRequestAnimationFrame:h=!1,pdfBug:d=!1,pageColors:p=null}){N(this,Ha,null);this.callback=e,this.params=t,this.objs=r,this.commonObjs=n,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=c,this._pdfBug=d,this.pageColors=p,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=h===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new BC(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=t.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){var o,l;if(this.cancelled)return;if(this._canvas){if(u(Po,hl).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.");u(Po,hl).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:r,viewport:n,transform:s,background:a}=this.params;this.gfx=new vu(r,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:s,viewport:n,transparency:e,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,(l=this.graphicsReadyCallback)==null||l.call(this)}cancel(e=null,t=0){var r,n,s;this.running=!1,this.cancelled=!0,(r=this.gfx)==null||r.endDrawing(),u(this,Ha)&&(window.cancelAnimationFrame(u(this,Ha)),T(this,Ha,null)),u(Po,hl).delete(this._canvas),e||(e=new kg(`Rendering cancelled, page ${this._pageIndex+1}`,t)),this.callback(e),(s=(n=this.task).onError)==null||s.call(n,e)}operatorListChanged(){var e;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(e=this.stepper)==null||e.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?T(this,Ha,window.requestAnimationFrame(()=>{T(this,Ha,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(),u(Po,hl).delete(this._canvas),this.callback())))}};Ha=new WeakMap,hl=new WeakMap,N(Po,hl,new WeakSet);let O0=Po;const jb="5.3.93",pw="cbeef3233";function fy(i){return Math.floor(Math.max(0,Math.min(1,i))*255).toString(16).padStart(2,"0")}function Qc(i){return Math.max(0,Math.min(255,255*i))}class py{static CMYK_G([e,t,r,n]){return["G",1-Math.min(1,.3*e+.59*r+.11*t+n)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return e=Qc(e),[e,e,e]}static G_HTML([e]){const t=fy(e);return`#${t}${t}${t}`}static RGB_G([e,t,r]){return["G",.3*e+.59*t+.11*r]}static RGB_rgb(e){return e.map(Qc)}static RGB_HTML(e){return`#${e.map(fy).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,r,n]){return["RGB",1-Math.min(1,e+n),1-Math.min(1,r+n),1-Math.min(1,t+n)]}static CMYK_rgb([e,t,r,n]){return[Qc(1-Math.min(1,e+n)),Qc(1-Math.min(1,r+n)),Qc(1-Math.min(1,t+n))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,r]){const n=1-e,s=1-t,a=1-r,o=Math.min(n,s,a);return["CMYK",n,s,a,o]}}class zC{create(e,t,r=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),r||(n.setAttribute("width",`${e}px`),n.setAttribute("height",`${t}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${e} ${t}`),n}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){Wt("Abstract method `_createSVG` called.")}}class Lh extends zC{_createSVG(e){return document.createElementNS(Ts,e)}}class Ub{static setupStorage(e,t,r,n,s){const a=n.getValue(t,{value:null});switch(r.name){case"textarea":if(a.value!==null&&(e.textContent=a.value),s==="print")break;e.addEventListener("input",o=>{n.setValue(t,{value:o.target.value})});break;case"input":if(r.attributes.type==="radio"||r.attributes.type==="checkbox"){if(a.value===r.attributes.xfaOn?e.setAttribute("checked",!0):a.value===r.attributes.xfaOff&&e.removeAttribute("checked"),s==="print")break;e.addEventListener("change",o=>{n.setValue(t,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&e.setAttribute("value",a.value),s==="print")break;e.addEventListener("input",o=>{n.setValue(t,{value:o.target.value})})}break;case"select":if(a.value!==null){e.setAttribute("value",a.value);for(const o of r.children)o.attributes.value===a.value?o.attributes.selected=!0:o.attributes.hasOwnProperty("selected")&&delete o.attributes.selected}e.addEventListener("input",o=>{const l=o.target.options,c=l.selectedIndex===-1?"":l[l.selectedIndex].value;n.setValue(t,{value:c})});break}}static setAttributes({html:e,element:t,storage:r=null,intent:n,linkService:s}){const{attributes:a}=t,o=e instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${n}`);for(const[l,c]of Object.entries(a))if(c!=null)switch(l){case"class":c.length&&e.setAttribute(l,c.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",c);break;case"style":Object.assign(e.style,c);break;case"textContent":e.textContent=c;break;default:(!o||l!=="href"&&l!=="newWindow")&&e.setAttribute(l,c)}o&&s.addLinkAttributes(e,a.href,a.newWindow),r&&a.dataId&&this.setupStorage(e,a.dataId,t,r)}static render(e){var d,p;const t=e.annotationStorage,r=e.linkService,n=e.xfaHtml,s=e.intent||"display",a=document.createElement(n.name);n.attributes&&this.setAttributes({html:a,element:n,intent:s,linkService:r});const o=s!=="richText",l=e.div;if(l.append(a),e.viewport){const g=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=g}o&&l.setAttribute("class","xfaLayer xfaFont");const c=[];if(n.children.length===0){if(n.value){const g=document.createTextNode(n.value);a.append(g),o&&Mh.shouldBuildText(n.name)&&c.push(g)}return{textDivs:c}}const h=[[n,-1,a]];for(;h.length>0;){const[g,y,b]=h.at(-1);if(y+1===g.children.length){h.pop();continue}const w=g.children[++h.at(-1)[1]];if(w===null)continue;const{name:v}=w;if(v==="#text"){const E=document.createTextNode(w.value);c.push(E),b.append(E);continue}const A=(d=w==null?void 0:w.attributes)!=null&&d.xmlns?document.createElementNS(w.attributes.xmlns,v):document.createElement(v);if(b.append(A),w.attributes&&this.setAttributes({html:A,element:w,storage:t,intent:s,linkService:r}),((p=w.children)==null?void 0:p.length)>0)h.push([w,-1,A]);else if(w.value){const E=document.createTextNode(w.value);o&&Mh.shouldBuildText(v)&&c.push(E),A.append(E)}}for(const g of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))g.setAttribute("readOnly",!0);return{textDivs:c}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}const jC=9,Ul=new WeakSet;class gy{static create(e){switch(e.data.annotationType){case wr.LINK:return new gw(e);case wr.TEXT:return new UC(e);case wr.WIDGET:switch(e.data.fieldType){case"Tx":return new HC(e);case"Btn":return e.data.radioButton?new vw(e):e.data.checkBox?new VC(e):new qC(e);case"Ch":return new GC(e);case"Sig":return new $C(e)}return new Yl(e);case wr.POPUP:return new B0(e);case wr.FREETEXT:return new Ew(e);case wr.LINE:return new XC(e);case wr.SQUARE:return new YC(e);case wr.CIRCLE:return new ZC(e);case wr.POLYLINE:return new _w(e);case wr.CARET:return new QC(e);case wr.INK:return new Hb(e);case wr.POLYGON:return new KC(e);case wr.HIGHLIGHT:return new Cw(e);case wr.UNDERLINE:return new JC(e);case wr.SQUIGGLY:return new eS(e);case wr.STRIKEOUT:return new tS(e);case wr.STAMP:return new Sw(e);case wr.FILEATTACHMENT:return new rS(e);default:return new Cr(e)}}}var dl,Ju,ec,$d,F0;const wv=class wv{constructor(e,{isRenderable:t=!1,ignoreBorder:r=!1,createQuadrilaterals:n=!1}={}){N(this,$d);N(this,dl,null);N(this,Ju,!1);N(this,ec,null);this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,t&&(this.container=this._createContainer(r)),n&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:t}){return!!(e!=null&&e.str||t!=null&&t.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return wv._hasPopupData(this.data)}updateEdited(e){var r;if(!this.container)return;u(this,dl)||T(this,dl,{rect:this.data.rect.slice(0)});const{rect:t}=e;t&&L(this,$d,F0).call(this,t),(r=u(this,ec))==null||r.popup.updateEdited(e)}resetEdited(){var e;u(this,dl)&&(L(this,$d,F0).call(this,u(this,dl).rect),(e=u(this,ec))==null||e.popup.resetEdited(),T(this,dl,null))}_createContainer(e){const{data:t,parent:{page:r,viewport:n}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",t.id),this instanceof Yl||(s.tabIndex=0);const{style:a}=s;if(a.zIndex=this.parent.zIndex++,t.alternativeText&&(s.title=t.alternativeText),t.noRotate&&s.classList.add("norotate"),!t.rect||this instanceof B0){const{rotation:b}=t;return!t.hasOwnCanvas&&b!==0&&this.setRotation(b,s),s}const{width:o,height:l}=this;if(!e&&t.borderStyle.width>0){a.borderWidth=`${t.borderStyle.width}px`;const b=t.borderStyle.horizontalCornerRadius,w=t.borderStyle.verticalCornerRadius;if(b>0||w>0){const A=`calc(${b}px * var(--total-scale-factor)) / calc(${w}px * var(--total-scale-factor))`;a.borderRadius=A}else if(this instanceof vw){const A=`calc(${o}px * var(--total-scale-factor)) / calc(${l}px * var(--total-scale-factor))`;a.borderRadius=A}switch(t.borderStyle.style){case au.SOLID:a.borderStyle="solid";break;case au.DASHED:a.borderStyle="dashed";break;case au.BEVELED:ut("Unimplemented border style: beveled");break;case au.INSET:ut("Unimplemented border style: inset");break;case au.UNDERLINE:a.borderBottomStyle="solid";break}const v=t.borderColor||null;v?(T(this,Ju,!0),a.borderColor=Qe.makeHexColor(v[0]|0,v[1]|0,v[2]|0)):a.borderWidth=0}const c=Qe.normalizeRect([t.rect[0],r.view[3]-t.rect[1]+r.view[1],t.rect[2],r.view[3]-t.rect[3]+r.view[1]]),{pageWidth:h,pageHeight:d,pageX:p,pageY:g}=n.rawDims;a.left=`${100*(c[0]-p)/h}%`,a.top=`${100*(c[1]-g)/d}%`;const{rotation:y}=t;return t.hasOwnCanvas||y===0?(a.width=`${100*o/h}%`,a.height=`${100*l/d}%`):this.setRotation(y,s),s}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:r,pageHeight:n}=this.parent.viewport.rawDims;let{width:s,height:a}=this;e%180!==0&&([s,a]=[a,s]),t.style.width=`${100*s/r}%`,t.style.height=`${100*a/n}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(t,r,n)=>{const s=n.detail[t],a=s[0],o=s.slice(1);n.target.style[r]=py[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[r]:py[`${a}_rgb`](o)})};return Ct(this,"_commonActions",{display:t=>{const{display:r}=t.detail,n=r%2===1;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:n,noPrint:r===1||r===2})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:r}=t.detail;this.container.style.visibility=r?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:r,noView:r})},focus:t=>{setTimeout(()=>t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},rotation:t=>{const r=t.detail.rotation;this.setRotation(r),this.annotationStorage.setValue(this.data.id,{rotation:r})}})}_dispatchEventFromSandbox(e,t){const r=this._commonActions;for(const n of Object.keys(t.detail)){const s=e[n]||r[n];s==null||s(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const r=this._commonActions;for(const[n,s]of Object.entries(t)){const a=r[n];if(a){const o={detail:{[n]:s},target:e};a(o),delete t[n]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,r,n,s]=this.data.rect.map(b=>Math.fround(b));if(e.length===8){const[b,w,v,A]=e.subarray(2,6);if(n===b&&s===w&&t===v&&r===A)return}const{style:a}=this.container;let o;if(u(this,Ju)){const{borderColor:b,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="${b}" stroke-width="${w}">`],this.container.classList.add("hasBorder")}const l=n-t,c=s-r,{svgFactory:h}=this,d=h.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0),d.role="none";const p=h.createElement("defs");d.append(p);const g=h.createElement("clipPath"),y=`clippath_${this.data.id}`;g.setAttribute("id",y),g.setAttribute("clipPathUnits","objectBoundingBox"),p.append(g);for(let b=2,w=e.length;b<w;b+=8){const v=e[b],A=e[b+1],E=e[b+2],_=e[b+3],C=h.createElement("rect"),I=(E-t)/l,k=(s-A)/c,D=(v-E)/l,R=(A-_)/c;C.setAttribute("x",I),C.setAttribute("y",k),C.setAttribute("width",D),C.setAttribute("height",R),g.append(C),o==null||o.push(`<rect vector-effect="non-scaling-stroke" x="${I}" y="${k}" width="${D}" height="${R}"/>`)}u(this,Ju)&&(o.push("</g></svg>')"),a.backgroundImage=o.join("")),this.container.append(d),this.container.style.clipPath=`url(#${y})`}_createPopup(){const{data:e}=this,t=T(this,ec,new B0({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation,noRotate:!0},parent:this.parent,elements:[this]}));this.parent.div.append(t.render())}render(){Wt("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const r=[];if(this._fieldObjects){const n=this._fieldObjects[e];if(n)for(const{page:s,id:a,exportValues:o}of n){if(s===-1||a===t)continue;const l=typeof o=="string"?o:null,c=document.querySelector(`[data-element-id="${a}"]`);if(c&&!Ul.has(c)){ut(`_getElementsByName - element not allowed: ${a}`);continue}r.push({id:a,exportValue:l,domElement:c})}return r}for(const n of document.getElementsByName(e)){const{exportValue:s}=n,a=n.getAttribute("data-element-id");a!==t&&Ul.has(n)&&r.push({id:a,exportValue:s,domElement:n})}return r}show(){var e;this.container&&(this.container.hidden=!1),(e=this.popup)==null||e.maybeShow()}hide(){var e;this.container&&(this.container.hidden=!0),(e=this.popup)==null||e.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",()=>{var r;(r=this.linkService.eventBus)==null||r.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}};dl=new WeakMap,Ju=new WeakMap,ec=new WeakMap,$d=new WeakSet,F0=function(e){const{container:{style:t},data:{rect:r,rotation:n},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:a,pageX:o,pageY:l}}}}=this;r==null||r.splice(0,4,...e),t.left=`${100*(e[0]-o)/s}%`,t.top=`${100*(a-e[3]+l)/a}%`,n===0?(t.width=`${100*(e[2]-e[0])/s}%`,t.height=`${100*(e[3]-e[1])/a}%`):this.setRotation(n)};let Cr=wv;var ai,So,mw,bw;class gw extends Cr{constructor(t,r=null){super(t,{isRenderable:!0,ignoreBorder:!!(r!=null&&r.ignoreBorder),createQuadrilaterals:!0});N(this,ai);this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:r}=this,n=document.createElement("a");n.setAttribute("data-element-id",t.id);let s=!1;return t.url?(r.addLinkAttributes(n,t.url,t.newWindow),s=!0):t.action?(this._bindNamedAction(n,t.action),s=!0):t.attachment?(L(this,ai,mw).call(this,n,t.attachment,t.attachmentDest),s=!0):t.setOCGState?(L(this,ai,bw).call(this,n,t.setOCGState),s=!0):t.dest?(this._bindLink(n,t.dest),s=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,t),s=!0),t.resetForm?(this._bindResetFormAction(n,t.resetForm),s=!0):this.isTooltipOnly&&!s&&(this._bindLink(n,""),s=!0)),this.container.classList.add("linkAnnotation"),s&&this.container.append(n),this.container}_bindLink(t,r){t.href=this.linkService.getDestinationHash(r),t.onclick=()=>(r&&this.linkService.goToDestination(r),!1),(r||r==="")&&L(this,ai,So).call(this)}_bindNamedAction(t,r){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(r),!1),L(this,ai,So).call(this)}_bindJSAction(t,r){t.href=this.linkService.getAnchorUrl("");const n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const s of Object.keys(r.actions)){const a=n.get(s);a&&(t[a]=()=>{var o;return(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r.id,name:s}}),!1})}t.onclick||(t.onclick=()=>!1),L(this,ai,So).call(this)}_bindResetFormAction(t,r){const n=t.onclick;if(n||(t.href=this.linkService.getAnchorUrl("")),L(this,ai,So).call(this),!this._fieldObjects){ut('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(t.onclick=()=>!1);return}t.onclick=()=>{var d;n==null||n();const{fields:s,refs:a,include:o}=r,l=[];if(s.length!==0||a.length!==0){const p=new Set(a);for(const g of s){const y=this._fieldObjects[g]||[];for(const{id:b}of y)p.add(b)}for(const g of Object.values(this._fieldObjects))for(const y of g)p.has(y.id)===o&&l.push(y)}else for(const p of Object.values(this._fieldObjects))l.push(...p);const c=this.annotationStorage,h=[];for(const p of l){const{id:g}=p;switch(h.push(g),p.type){case"text":{const b=p.defaultValue||"";c.setValue(g,{value:b});break}case"checkbox":case"radiobutton":{const b=p.defaultValue===p.exportValues;c.setValue(g,{value:b});break}case"combobox":case"listbox":{const b=p.defaultValue||"";c.setValue(g,{value:b});break}default:continue}const y=document.querySelector(`[data-element-id="${g}"]`);if(y){if(!Ul.has(y)){ut(`_bindResetFormAction - element not allowed: ${g}`);continue}}else continue;y.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((d=this.linkService.eventBus)==null||d.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}})),!1}}}ai=new WeakSet,So=function(){this.container.setAttribute("data-internal-link","")},mw=function(t,r,n=null){t.href=this.linkService.getAnchorUrl(""),r.description&&(t.title=r.description),t.onclick=()=>{var s;return(s=this.downloadManager)==null||s.openOrDownloadData(r.content,r.filename,n),!1},L(this,ai,So).call(this)},bw=function(t,r){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(r),!1),L(this,ai,So).call(this)};class UC extends Cr{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class Yl extends Cr{render(){return this.container}showElementAndHideCanvas(e){var t;this.data.hasOwnCanvas&&(((t=e.previousSibling)==null?void 0:t.nodeName)==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return Gr.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,r,n,s){r.includes("mouse")?e.addEventListener(r,a=>{var o;(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):e.addEventListener(r,a=>{var o;if(r==="blur"){if(!t.focused||!a.relatedTarget)return;t.focused=!1}else if(r==="focus"){if(t.focused)return;t.focused=!0}s&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(a)}}))})}_setEventListeners(e,t,r,n){var s,a,o;for(const[l,c]of r)(c==="Action"||(s=this.data.actions)!=null&&s[c])&&((c==="Focus"||c==="Blur")&&(t||(t={focused:!1})),this._setEventListener(e,t,l,c,n),c==="Focus"&&!((a=this.data.actions)!=null&&a.Blur)?this._setEventListener(e,t,"blur","Blur",null):c==="Blur"&&!((o=this.data.actions)!=null&&o.Focus)&&this._setEventListener(e,t,"focus","Focus",null))}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?"transparent":Qe.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const t=["left","center","right"],{fontColor:r}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||jC,s=e.style;let a;const o=2,l=c=>Math.round(10*c)/10;if(this.data.multiLine){const c=Math.abs(this.data.rect[3]-this.data.rect[1]-o),h=Math.round(c/(dm*n))||1,d=c/h;a=Math.min(n,l(d/dm))}else{const c=Math.abs(this.data.rect[3]-this.data.rect[1]-o);a=Math.min(n,l(c/dm))}s.fontSize=`calc(${a}px * var(--total-scale-factor))`,s.color=Qe.makeHexColor(r[0],r[1],r[2]),this.data.textAlignment!==null&&(s.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class HC extends Yl{constructor(e){const t=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:t})}setPropertyOnSiblings(e,t,r,n){const s=this.annotationStorage;for(const a of this._getElementsByName(e.name,e.id))a.domElement&&(a.domElement[t]=r),s.setValue(a.id,{[n]:r})}render(){var n,s;const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let r=null;if(this.renderForms){const a=e.getValue(t,{value:this.data.fieldValue});let o=a.value||"";const l=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;l&&o.length>l&&(o=o.slice(0,l));let c=a.formattedValue||((n=this.data.textContent)==null?void 0:n.join(`
|
|
32
32
|
`))||null;c&&this.data.comb&&(c=c.replaceAll(/\s+/g,""));const h={userValue:o,formattedValue:c,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(r=document.createElement("textarea"),r.textContent=c??o,this.data.doNotScroll&&(r.style.overflowY="hidden")):(r=document.createElement("input"),r.type=this.data.password?"password":"text",r.setAttribute("value",c??o),this.data.doNotScroll&&(r.style.overflowX="hidden")),this.data.hasOwnCanvas&&(r.hidden=!0),Ul.add(r),r.setAttribute("data-element-id",t),r.disabled=this.data.readOnly,r.name=this.data.fieldName,r.tabIndex=0;const d=this.data.dateFormat||this.data.timeFormat;d&&(r.title=d),this._setRequired(r,this.data.required),l&&(r.maxLength=l),r.addEventListener("input",g=>{e.setValue(t,{value:g.target.value}),this.setPropertyOnSiblings(r,"value",g.target.value,"value"),h.formattedValue=null}),r.addEventListener("resetform",g=>{const y=this.data.defaultFieldValue??"";r.value=h.userValue=y,h.formattedValue=null});let p=g=>{const{formattedValue:y}=h;y!=null&&(g.target.value=y),g.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){r.addEventListener("focus",y=>{var w;if(h.focused)return;const{target:b}=y;h.userValue&&(b.value=h.userValue),h.lastCommittedValue=b.value,h.commitKey=1,(w=this.data.actions)!=null&&w.Focus||(h.focused=!0)}),r.addEventListener("updatefromsandbox",y=>{this.showElementAndHideCanvas(y.target);const b={value(w){h.userValue=w.detail.value??"",e.setValue(t,{value:h.userValue.toString()}),w.target.value=h.userValue},formattedValue(w){const{formattedValue:v}=w.detail;h.formattedValue=v,v!=null&&w.target!==document.activeElement&&(w.target.value=v),e.setValue(t,{formattedValue:v})},selRange(w){w.target.setSelectionRange(...w.detail.selRange)},charLimit:w=>{var _;const{charLimit:v}=w.detail,{target:A}=w;if(v===0){A.removeAttribute("maxLength");return}A.setAttribute("maxLength",v);let E=h.userValue;!E||E.length<=v||(E=E.slice(0,v),A.value=h.userValue=E,e.setValue(t,{value:E}),(_=this.linkService.eventBus)==null||_.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:E,willCommit:!0,commitKey:1,selStart:A.selectionStart,selEnd:A.selectionEnd}}))}};this._dispatchEventFromSandbox(b,y)}),r.addEventListener("keydown",y=>{var v;h.commitKey=1;let b=-1;if(y.key==="Escape"?b=0:y.key==="Enter"&&!this.data.multiLine?b=2:y.key==="Tab"&&(h.commitKey=3),b===-1)return;const{value:w}=y.target;h.lastCommittedValue!==w&&(h.lastCommittedValue=w,h.userValue=w,(v=this.linkService.eventBus)==null||v.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:w,willCommit:!0,commitKey:b,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}))});const g=p;p=null,r.addEventListener("blur",y=>{var w,v;if(!h.focused||!y.relatedTarget)return;(w=this.data.actions)!=null&&w.Blur||(h.focused=!1);const{value:b}=y.target;h.userValue=b,h.lastCommittedValue!==b&&((v=this.linkService.eventBus)==null||v.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:b,willCommit:!0,commitKey:h.commitKey,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}})),g(y)}),(s=this.data.actions)!=null&&s.Keystroke&&r.addEventListener("beforeinput",y=>{var I;h.lastCommittedValue=null;const{data:b,target:w}=y,{value:v,selectionStart:A,selectionEnd:E}=w;let _=A,C=E;switch(y.inputType){case"deleteWordBackward":{const k=v.substring(0,A).match(/\w*[^\w]*$/);k&&(_-=k[0].length);break}case"deleteWordForward":{const k=v.substring(A).match(/^[^\w]*\w*/);k&&(C+=k[0].length);break}case"deleteContentBackward":A===E&&(_-=1);break;case"deleteContentForward":A===E&&(C+=1);break}y.preventDefault(),(I=this.linkService.eventBus)==null||I.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:v,change:b||"",willCommit:!1,selStart:_,selEnd:C}})}),this._setEventListeners(r,h,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],y=>y.target.value)}if(p&&r.addEventListener("blur",p),this.data.comb){const y=(this.data.rect[2]-this.data.rect[0])/l;r.classList.add("comb"),r.style.letterSpacing=`calc(${y}px * var(--total-scale-factor) - 1ch)`}}else r=document.createElement("div"),r.textContent=this.data.fieldValue,r.style.verticalAlign="middle",r.style.display="table-cell",this.data.hasOwnCanvas&&(r.hidden=!0);return this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class $C extends Yl{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class VC extends Yl{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,r=t.id;let n=e.getValue(r,{value:t.exportValue===t.fieldValue}).value;typeof n=="string"&&(n=n!=="Off",e.setValue(r,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const s=document.createElement("input");return Ul.add(s),s.setAttribute("data-element-id",r),s.disabled=t.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=t.fieldName,n&&s.setAttribute("checked",!0),s.setAttribute("exportValue",t.exportValue),s.tabIndex=0,s.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const c of this._getElementsByName(o,r)){const h=l&&c.exportValue===t.exportValue;c.domElement&&(c.domElement.checked=h),e.setValue(c.id,{value:h})}e.setValue(r,{value:l})}),s.addEventListener("resetform",a=>{const o=t.defaultFieldValue||"Off";a.target.checked=o===t.exportValue}),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",a=>{const o={value(l){l.target.checked=l.detail.value!=="Off",e.setValue(r,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,a)}),this._setEventListeners(s,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(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class vw extends Yl{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,r=t.id;let n=e.getValue(r,{value:t.fieldValue===t.buttonValue}).value;if(typeof n=="string"&&(n=n!==t.buttonValue,e.setValue(r,{value:n})),n)for(const a of this._getElementsByName(t.fieldName,r))e.setValue(a.id,{value:!1});const s=document.createElement("input");if(Ul.add(s),s.setAttribute("data-element-id",r),s.disabled=t.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=t.fieldName,n&&s.setAttribute("checked",!0),s.tabIndex=0,s.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const c of this._getElementsByName(o,r))e.setValue(c.id,{value:!1});e.setValue(r,{value:l})}),s.addEventListener("resetform",a=>{const o=t.defaultFieldValue;a.target.checked=o!=null&&o===t.buttonValue}),this.enableScripting&&this.hasJSActions){const a=t.buttonValue;s.addEventListener("updatefromsandbox",o=>{const l={value:c=>{const h=a===c.detail.value;for(const d of this._getElementsByName(c.target.name)){const p=h&&d.id===r;d.domElement&&(d.domElement.checked=p),e.setValue(d.id,{value:p})}}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(s,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(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class qC extends gw{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",r=>{this._dispatchEventFromSandbox({},r)})),e}}class GC extends Yl{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,r=e.getValue(t,{value:this.data.fieldValue}),n=document.createElement("select");Ul.add(n),n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=0;let s=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",h=>{const d=this.data.defaultFieldValue;for(const p of n.options)p.selected=p.value===d});for(const h of this.data.options){const d=document.createElement("option");d.textContent=h.displayValue,d.value=h.exportValue,r.value.includes(h.exportValue)&&(d.setAttribute("selected",!0),s=!1),n.append(d)}let a=null;if(s){const h=document.createElement("option");h.value=" ",h.setAttribute("hidden",!0),h.setAttribute("selected",!0),n.prepend(h),a=()=>{h.remove(),n.removeEventListener("input",a),a=null},n.addEventListener("input",a)}const o=h=>{const d=h?"value":"textContent",{options:p,multiple:g}=n;return g?Array.prototype.filter.call(p,y=>y.selected).map(y=>y[d]):p.selectedIndex===-1?null:p[p.selectedIndex][d]};let l=o(!1);const c=h=>{const d=h.target.options;return Array.prototype.map.call(d,p=>({displayValue:p.textContent,exportValue:p.value}))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",h=>{const d={value(p){a==null||a();const g=p.detail.value,y=new Set(Array.isArray(g)?g:[g]);for(const b of n.options)b.selected=y.has(b.value);e.setValue(t,{value:o(!0)}),l=o(!1)},multipleSelection(p){n.multiple=!0},remove(p){const g=n.options,y=p.detail.remove;g[y].selected=!1,n.remove(y),g.length>0&&Array.prototype.findIndex.call(g,w=>w.selected)===-1&&(g[0].selected=!0),e.setValue(t,{value:o(!0),items:c(p)}),l=o(!1)},clear(p){for(;n.length!==0;)n.remove(0);e.setValue(t,{value:null,items:[]}),l=o(!1)},insert(p){const{index:g,displayValue:y,exportValue:b}=p.detail.insert,w=n.children[g],v=document.createElement("option");v.textContent=y,v.value=b,w?w.before(v):n.append(v),e.setValue(t,{value:o(!0),items:c(p)}),l=o(!1)},items(p){const{items:g}=p.detail;for(;n.length!==0;)n.remove(0);for(const y of g){const{displayValue:b,exportValue:w}=y,v=document.createElement("option");v.textContent=b,v.value=w,n.append(v)}n.options.length>0&&(n.options[0].selected=!0),e.setValue(t,{value:o(!0),items:c(p)}),l=o(!1)},indices(p){const g=new Set(p.detail.indices);for(const y of p.target.options)y.selected=g.has(y.index);e.setValue(t,{value:o(!0)}),l=o(!1)},editable(p){p.target.disabled=!p.detail.editable}};this._dispatchEventFromSandbox(d,h)}),n.addEventListener("input",h=>{var g;const d=o(!0),p=o(!1);e.setValue(t,{value:d}),h.preventDefault(),(g=this.linkService.eventBus)==null||g.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:l,change:p,changeEx:d,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],h=>h.target.value)):n.addEventListener("input",function(h){e.setValue(t,{value:o(!0)})}),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class B0 extends Cr{constructor(e){const{data:t,elements:r}=e;super(e,{isRenderable:Cr._hasPopupData(t)}),this.elements=r,this.popup=null}render(){const{container:e}=this;e.classList.add("popupAnnotation"),e.role="comment";const t=this.popup=new WC({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}),r=[];for(const n of this.elements)n.popup=t,n.container.ariaHasPopup="dialog",r.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",r.map(n=>`${Nb}${n}`).join(",")),this.container}}var tc,vg,yg,rc,nc,pr,Ys,fl,Vd,qd,ic,Zs,Fi,Ks,Gd,Qs,Wd,pl,gl,Xt,kp,z0,yw,ww,xw,Aw,Dp,Pp,j0;class WC{constructor({container:e,color:t,elements:r,titleObj:n,modificationDate:s,contentsObj:a,richText:o,parent:l,rect:c,parentRect:h,open:d}){N(this,Xt);N(this,tc,L(this,Xt,xw).bind(this));N(this,vg,L(this,Xt,j0).bind(this));N(this,yg,L(this,Xt,Pp).bind(this));N(this,rc,L(this,Xt,Dp).bind(this));N(this,nc,null);N(this,pr,null);N(this,Ys,null);N(this,fl,null);N(this,Vd,null);N(this,qd,null);N(this,ic,null);N(this,Zs,!1);N(this,Fi,null);N(this,Ks,null);N(this,Gd,null);N(this,Qs,null);N(this,Wd,null);N(this,pl,null);N(this,gl,!1);var p;T(this,pr,e),T(this,Wd,n),T(this,Ys,a),T(this,Qs,o),T(this,qd,l),T(this,nc,t),T(this,Gd,c),T(this,ic,h),T(this,Vd,r),T(this,fl,Pg.toDateObject(s)),this.trigger=r.flatMap(g=>g.getElementsToTriggerPopup());for(const g of this.trigger)g.addEventListener("click",u(this,rc)),g.addEventListener("mouseenter",u(this,yg)),g.addEventListener("mouseleave",u(this,vg)),g.classList.add("popupTriggerArea");for(const g of r)(p=g.container)==null||p.addEventListener("keydown",u(this,tc));u(this,pr).hidden=!0,d&&L(this,Xt,Dp).call(this)}render(){if(u(this,Fi))return;const e=T(this,Fi,document.createElement("div"));if(e.className="popup",u(this,nc)){const s=e.style.outlineColor=Qe.makeHexColor(...u(this,nc));e.style.backgroundColor=`color-mix(in srgb, ${s} 30%, white)`}const t=document.createElement("span");t.className="header";const r=document.createElement("h1");if(t.append(r),{dir:r.dir,str:r.textContent}=u(this,Wd),e.append(t),u(this,fl)){const s=document.createElement("time");s.classList.add("popupDate"),s.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),s.setAttribute("data-l10n-args",JSON.stringify({dateObj:u(this,fl).valueOf()})),s.dateTime=u(this,fl).toISOString(),t.append(s)}const n=u(this,Xt,kp);if(n)Ub.render({xfaHtml:n,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const s=this._formatContents(u(this,Ys));e.append(s)}u(this,pr).append(e)}_formatContents({str:e,dir:t}){const r=document.createElement("p");r.classList.add("popupContent"),r.dir=t;const n=e.split(/(?:\r\n?|\n)/);for(let s=0,a=n.length;s<a;++s){const o=n[s];r.append(document.createTextNode(o)),s<a-1&&r.append(document.createElement("br"))}return r}updateEdited({rect:e,popupContent:t}){var r;u(this,pl)||T(this,pl,{contentsObj:u(this,Ys),richText:u(this,Qs)}),e&&T(this,Ks,null),t&&(T(this,Qs,L(this,Xt,ww).call(this,t)),T(this,Ys,null)),(r=u(this,Fi))==null||r.remove(),T(this,Fi,null)}resetEdited(){var e;u(this,pl)&&({contentsObj:bn(this,Ys)._,richText:bn(this,Qs)._}=u(this,pl),T(this,pl,null),(e=u(this,Fi))==null||e.remove(),T(this,Fi,null),T(this,Ks,null))}forceHide(){T(this,gl,this.isVisible),u(this,gl)&&(u(this,pr).hidden=!0)}maybeShow(){u(this,gl)&&(u(this,Fi)||L(this,Xt,Pp).call(this),T(this,gl,!1),u(this,pr).hidden=!1)}get isVisible(){return u(this,pr).hidden===!1}}tc=new WeakMap,vg=new WeakMap,yg=new WeakMap,rc=new WeakMap,nc=new WeakMap,pr=new WeakMap,Ys=new WeakMap,fl=new WeakMap,Vd=new WeakMap,qd=new WeakMap,ic=new WeakMap,Zs=new WeakMap,Fi=new WeakMap,Ks=new WeakMap,Gd=new WeakMap,Qs=new WeakMap,Wd=new WeakMap,pl=new WeakMap,gl=new WeakMap,Xt=new WeakSet,kp=function(){const e=u(this,Qs),t=u(this,Ys);return e!=null&&e.str&&(!(t!=null&&t.str)||t.str===e.str)&&u(this,Qs).html||null},z0=function(){var e,t,r;return((r=(t=(e=u(this,Xt,kp))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:r.fontSize)||0},yw=function(){var e,t,r;return((r=(t=(e=u(this,Xt,kp))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:r.color)||null},ww=function(e){const t=[],r={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},n={style:{color:u(this,Xt,yw),fontSize:u(this,Xt,z0)?`calc(${u(this,Xt,z0)}px * var(--total-scale-factor))`:""}};for(const s of e.split(`
|
|
33
33
|
`))t.push({name:"span",value:s,attributes:n});return r},xw=function(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&u(this,Zs))&&L(this,Xt,Dp).call(this)},Aw=function(){if(u(this,Ks)!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:r,pageX:n,pageY:s}}}=u(this,qd);let a=!!u(this,ic),o=a?u(this,ic):u(this,Gd);for(const y of u(this,Vd))if(!o||Qe.intersect(y.data.rect,o)!==null){o=y.data.rect,a=!0;break}const l=Qe.normalizeRect([o[0],e[3]-o[1]+e[1],o[2],e[3]-o[3]+e[1]]),h=a?o[2]-o[0]+5:0,d=l[0]+h,p=l[1];T(this,Ks,[100*(d-n)/t,100*(p-s)/r]);const{style:g}=u(this,pr);g.left=`${u(this,Ks)[0]}%`,g.top=`${u(this,Ks)[1]}%`},Dp=function(){T(this,Zs,!u(this,Zs)),u(this,Zs)?(L(this,Xt,Pp).call(this),u(this,pr).addEventListener("click",u(this,rc)),u(this,pr).addEventListener("keydown",u(this,tc))):(L(this,Xt,j0).call(this),u(this,pr).removeEventListener("click",u(this,rc)),u(this,pr).removeEventListener("keydown",u(this,tc)))},Pp=function(){u(this,Fi)||this.render(),this.isVisible?u(this,Zs)&&u(this,pr).classList.add("focused"):(L(this,Xt,Aw).call(this),u(this,pr).hidden=!1,u(this,pr).style.zIndex=parseInt(u(this,pr).style.zIndex)+1e3)},j0=function(){u(this,pr).classList.remove("focused"),!(u(this,Zs)||!this.isVisible)&&(u(this,pr).hidden=!0,u(this,pr).style.zIndex=parseInt(u(this,pr).style.zIndex)-1e3)};class Ew extends Cr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=ot.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const t of this.textContent){const r=document.createElement("span");r.textContent=t,e.append(r)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var Xd;class XC extends Cr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});N(this,Xd,null)}render(){this.container.classList.add("lineAnnotation");const{data:t,width:r,height:n}=this,s=this.svgFactory.create(r,n,!0),a=T(this,Xd,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),a.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),a.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),a.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),a.setAttribute("stroke-width",t.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return u(this,Xd)}addHighlightArea(){this.container.classList.add("highlightArea")}}Xd=new WeakMap;var Yd;class YC extends Cr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});N(this,Yd,null)}render(){this.container.classList.add("squareAnnotation");const{data:t,width:r,height:n}=this,s=this.svgFactory.create(r,n,!0),a=t.borderStyle.width,o=T(this,Yd,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",r-a),o.setAttribute("height",n-a),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),s.append(o),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return u(this,Yd)}addHighlightArea(){this.container.classList.add("highlightArea")}}Yd=new WeakMap;var Zd;class ZC extends Cr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});N(this,Zd,null)}render(){this.container.classList.add("circleAnnotation");const{data:t,width:r,height:n}=this,s=this.svgFactory.create(r,n,!0),a=t.borderStyle.width,o=T(this,Zd,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",r/2),o.setAttribute("cy",n/2),o.setAttribute("rx",r/2-a/2),o.setAttribute("ry",n/2-a/2),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),s.append(o),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return u(this,Zd)}addHighlightArea(){this.container.classList.add("highlightArea")}}Zd=new WeakMap;var Kd;class _w extends Cr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});N(this,Kd,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:r,borderStyle:n,popupRef:s},width:a,height:o}=this;if(!r)return this.container;const l=this.svgFactory.create(a,o,!0);let c=[];for(let d=0,p=r.length;d<p;d+=2){const g=r[d]-t[0],y=t[3]-r[d+1];c.push(`${g},${y}`)}c=c.join(" ");const h=T(this,Kd,this.svgFactory.createElement(this.svgElementName));return h.setAttribute("points",c),h.setAttribute("stroke-width",n.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),l.append(h),this.container.append(l),!s&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return u(this,Kd)}addHighlightArea(){this.container.classList.add("highlightArea")}}Kd=new WeakMap;class KC extends _w{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class QC extends Cr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var Qd,ml,Jd,U0;class Hb extends Cr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});N(this,Jd);N(this,Qd,null);N(this,ml,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?ot.HIGHLIGHT:ot.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,rotation:r,inkLists:n,borderStyle:s,popupRef:a}}=this,{transform:o,width:l,height:c}=L(this,Jd,U0).call(this,r,t),h=this.svgFactory.create(l,c,!0),d=T(this,Qd,this.svgFactory.createElement("svg:g"));h.append(d),d.setAttribute("stroke-width",s.width||1),d.setAttribute("stroke-linecap","round"),d.setAttribute("stroke-linejoin","round"),d.setAttribute("stroke-miterlimit",10),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),d.setAttribute("transform",o);for(let p=0,g=n.length;p<g;p++){const y=this.svgFactory.createElement(this.svgElementName);u(this,ml).push(y),y.setAttribute("points",n[p].join(",")),d.append(y)}return!a&&this.hasPopupData&&this._createPopup(),this.container.append(h),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);const{thickness:r,points:n,rect:s}=t,a=u(this,Qd);if(r>=0&&a.setAttribute("stroke-width",r||1),n)for(let o=0,l=u(this,ml).length;o<l;o++)u(this,ml)[o].setAttribute("points",n[o].join(","));if(s){const{transform:o,width:l,height:c}=L(this,Jd,U0).call(this,this.data.rotation,s);a.parentElement.setAttribute("viewBox",`0 0 ${l} ${c}`),a.setAttribute("transform",o)}}getElementsToTriggerPopup(){return u(this,ml)}addHighlightArea(){this.container.classList.add("highlightArea")}}Qd=new WeakMap,ml=new WeakMap,Jd=new WeakSet,U0=function(t,r){switch(t){case 90:return{transform:`rotate(90) translate(${-r[0]},${r[1]}) scale(1,-1)`,width:r[3]-r[1],height:r[2]-r[0]};case 180:return{transform:`rotate(180) translate(${-r[2]},${r[1]}) scale(1,-1)`,width:r[2]-r[0],height:r[3]-r[1]};case 270:return{transform:`rotate(270) translate(${-r[2]},${r[3]}) scale(1,-1)`,width:r[3]-r[1],height:r[2]-r[0]};default:return{transform:`translate(${-r[0]},${r[3]}) scale(1,-1)`,width:r[2]-r[0],height:r[3]-r[1]}}};class Cw extends Cr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=ot.HIGHLIGHT}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),e){const r=document.createElement("mark");r.classList.add("overlaidText"),r.textContent=e,this.container.append(r)}return this.container}}class JC extends Cr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),e){const r=document.createElement("u");r.classList.add("overlaidText"),r.textContent=e,this.container.append(r)}return this.container}}class eS extends Cr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),e){const r=document.createElement("u");r.classList.add("overlaidText"),r.textContent=e,this.container.append(r)}return this.container}}class tS extends Cr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),e){const r=document.createElement("s");r.classList.add("overlaidText"),r.textContent=e,this.container.append(r)}return this.container}}class Sw extends Cr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=ot.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 ef,tf,H0;class rS extends Cr{constructor(t){var n;super(t,{isRenderable:!0});N(this,tf);N(this,ef,null);const{file:r}=this.data;this.filename=r.filename,this.content=r.content,(n=this.linkService.eventBus)==null||n.dispatch("fileattachmentannotation",{source:this,...r})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:r}=this;let n;r.hasAppearance||r.fillAlpha===0?n=document.createElement("div"):(n=document.createElement("img"),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(r.name)?"paperclip":"pushpin"}.svg`,r.fillAlpha&&r.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(r.fillAlpha*100)}%);`)),n.addEventListener("dblclick",L(this,tf,H0).bind(this)),T(this,ef,n);const{isMac:s}=Gr.platform;return t.addEventListener("keydown",a=>{a.key==="Enter"&&(s?a.metaKey:a.ctrlKey)&&L(this,tf,H0).call(this)}),!r.popupRef&&this.hasPopupData?this._createPopup():n.classList.add("popupTriggerArea"),t.append(n),t}getElementsToTriggerPopup(){return u(this,ef)}addHighlightArea(){this.container.classList.add("highlightArea")}}ef=new WeakMap,tf=new WeakSet,H0=function(){var t;(t=this.downloadManager)==null||t.openOrDownloadData(this.content,this.filename)};var rf,bl,$a,nf,go,$0,V0,sc;let $b=(sc=class{constructor({div:e,accessibilityManager:t,annotationCanvasMap:r,annotationEditorUIManager:n,page:s,viewport:a,structTreeLayer:o}){N(this,go);N(this,rf,null);N(this,bl,null);N(this,$a,new Map);N(this,nf,null);this.div=e,T(this,rf,t),T(this,bl,r),T(this,nf,o||null),this.page=s,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=n}hasEditableAnnotations(){return u(this,$a).size>0}async render(e){var a;const{annotations:t}=e,r=this.div;ao(r,this.viewport);const n=new Map,s={data:null,layer:r,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new Lh,annotationStorage:e.annotationStorage||new Lb,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const o of t){if(o.noHTML)continue;const l=o.annotationType===wr.POPUP;if(l){const d=n.get(o.id);if(!d)continue;s.elements=d}else if(o.rect[2]===o.rect[0]||o.rect[3]===o.rect[1])continue;s.data=o;const c=gy.create(s);if(!c.isRenderable)continue;if(!l&&o.popupRef){const d=n.get(o.popupRef);d?d.push(c):n.set(o.popupRef,[c])}const h=c.render();o.hidden&&(h.style.visibility="hidden"),await L(this,go,$0).call(this,h,o.id,s.elements),c._isEditable&&(u(this,$a).set(c.data.id,c),(a=this._annotationEditorUIManager)==null||a.renderAnnotationElement(c))}L(this,go,V0).call(this)}async addLinkAnnotations(e,t){const r={data:null,layer:this.div,linkService:t,svgFactory:new Lh,parent:this};for(const n of e){n.borderStyle||(n.borderStyle=sc._defaultBorderStyle),r.data=n;const s=gy.create(r);if(!s.isRenderable)continue;const a=s.render();await L(this,go,$0).call(this,a,n.id,null)}}update({viewport:e}){const t=this.div;this.viewport=e,ao(t,{rotation:e.rotation}),L(this,go,V0).call(this),t.hidden=!1}getEditableAnnotations(){return Array.from(u(this,$a).values())}getEditableAnnotation(e){return u(this,$a).get(e)}static get _defaultBorderStyle(){return Ct(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:au.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},rf=new WeakMap,bl=new WeakMap,$a=new WeakMap,nf=new WeakMap,go=new WeakSet,$0=async function(e,t,r){var o,l;const n=e.firstChild||e,s=n.id=`${Nb}${t}`,a=await((o=u(this,nf))==null?void 0:o.getAriaAttributes(s));if(a)for(const[c,h]of a)n.setAttribute(c,h);r?r.at(-1).container.after(e):(this.div.append(e),(l=u(this,rf))==null||l.moveElementInDOM(this.div,e,n,!1))},V0=function(){var t;if(!u(this,bl))return;const e=this.div;for(const[r,n]of u(this,bl)){const s=e.querySelector(`[data-annotation-id="${r}"]`);if(!s)continue;n.className="annotationContent";const{firstChild:a}=s;a?a.nodeName==="CANVAS"?a.replaceWith(n):a.classList.contains("annotationContent")?a.after(n):a.before(n):s.append(n);const o=u(this,$a).get(r);o&&(o._hasNoCanvas?((t=this._annotationEditorUIManager)==null||t.setMissingCanvas(r,s.id,n),o._hasNoCanvas=!1):o.canvas=n)}u(this,bl).clear()},sc);const ip=/\r\n?|\n/g;var Bi,Xn,sf,vl,Yn,Pr,Tw,kw,Dw,Rp,ca,Ip,Np,Pw,G0,Rw;const Jt=class Jt extends tr{constructor(t){super({...t,name:"freeTextEditor"});N(this,Pr);N(this,Bi);N(this,Xn,"");N(this,sf,`${this.id}-editor`);N(this,vl,null);N(this,Yn);T(this,Bi,t.color||Jt._defaultColor||tr._defaultLineColor),T(this,Yn,t.fontSize||Jt._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static get _keyboardManager(){const t=Jt.prototype,r=a=>a.isEmpty(),n=oo.TRANSLATE_SMALL,s=oo.TRANSLATE_BIG;return Ct(this,"_keyboardManager",new Df([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-n,0],checker:r}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-s,0],checker:r}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[n,0],checker:r}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[s,0],checker:r}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-n],checker:r}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-s],checker:r}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,n],checker:r}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,s],checker:r}]]))}static initialize(t,r){tr.initialize(t,r);const n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,r){switch(t){case kt.FREETEXT_SIZE:Jt._defaultFontSize=r;break;case kt.FREETEXT_COLOR:Jt._defaultColor=r;break}}updateParams(t,r){switch(t){case kt.FREETEXT_SIZE:L(this,Pr,Tw).call(this,r);break;case kt.FREETEXT_COLOR:L(this,Pr,kw).call(this,r);break}}static get defaultPropertiesToUpdate(){return[[kt.FREETEXT_SIZE,Jt._defaultFontSize],[kt.FREETEXT_COLOR,Jt._defaultColor||tr._defaultLineColor]]}get propertiesToUpdate(){return[[kt.FREETEXT_SIZE,u(this,Yn)],[kt.FREETEXT_COLOR,u(this,Bi)]]}_translateEmpty(t,r){this._uiManager.translateSelectedEditors(t,r,!0)}getInitialTranslation(){const t=this.parentScale;return[-Jt._internalPadding*t,-(Jt._internalPadding+u(this,Yn))*t]}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"),T(this,vl,new AbortController);const t=this._uiManager.combinedSignal(u(this,vl));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t}),!0}disableEditMode(){var t;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",u(this,sf)),this._isDraggable=!0,(t=u(this,vl))==null||t.abort(),T(this,vl,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(t){var r;this.width||(this.enableEditMode(),t&&this.editorDiv.focus(),(r=this._initialOptions)!=null&&r.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=u(this,Xn),r=T(this,Xn,L(this,Pr,Dw).call(this).trimEnd());if(t===r)return;const n=s=>{if(T(this,Xn,s),!s){this.remove();return}L(this,Pr,Np).call(this),this._uiManager.rebuild(this),L(this,Pr,Rp).call(this)};this.addCommands({cmd:()=>{n(r)},undo:()=>{n(t)},mustExec:!1}),L(this,Pr,Rp).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(t){t.target===this.div&&t.key==="Enter"&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){Jt._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let t,r;(this._isCopy||this.annotationElementId)&&(t=this.x,r=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",u(this,sf)),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:n}=this.editorDiv;if(n.fontSize=`calc(${u(this,Yn)}px * var(--total-scale-factor))`,n.color=u(this,Bi),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[s,a]=this.parentDimensions;if(this.annotationElementId){const{position:o}=this._initialData;let[l,c]=this.getInitialTranslation();[l,c]=this.pageTranslationToScreen(l,c);const[h,d]=this.pageDimensions,[p,g]=this.pageTranslation;let y,b;switch(this.rotation){case 0:y=t+(o[0]-p)/h,b=r+this.height-(o[1]-g)/d;break;case 90:y=t+(o[0]-p)/h,b=r-(o[1]-g)/d,[l,c]=[c,-l];break;case 180:y=t-this.width+(o[0]-p)/h,b=r-(o[1]-g)/d,[l,c]=[-l,-c];break;case 270:y=t+(o[0]-p-this.height*d)/h,b=r+(o[1]-g-this.width*h)/d,[l,c]=[-c,l];break}this.setAt(y*s,b*a,l,c)}else this._moveAfterPaste(t,r);L(this,Pr,Np).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){var y,b,w;const r=t.clipboardData||window.clipboardData,{types:n}=r;if(n.length===1&&n[0]==="text/plain")return;t.preventDefault();const s=L(y=Jt,ca,G0).call(y,r.getData("text")||"").replaceAll(ip,`
|