med-notes/reader/dist/assets/index-BQU9HZLS.js
2025-04-05 21:32:01 +00:00

87 lines
544 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var Qw=Object.defineProperty;var G1=b=>{throw TypeError(b)};var Zw=(b,e,i)=>e in b?Qw(b,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):b[e]=i;var bt=(b,e,i)=>Zw(b,typeof e!="symbol"?e+"":e,i),a0=(b,e,i)=>e.has(b)||G1("Cannot "+i);var c=(b,e,i)=>(a0(b,e,"read from private field"),i?i.call(b):e.get(b)),w=(b,e,i)=>e.has(b)?G1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(b):e.set(b,i),S=(b,e,i,n)=>(a0(b,e,"write to private field"),n?n.call(b,i):e.set(b,i),i),_=(b,e,i)=>(a0(b,e,"access private method"),i);var li=(b,e,i,n)=>({set _(l){S(b,e,l,i)},get _(){return c(b,e,n)}});(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))n(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function i(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(l){if(l.ep)return;l.ep=!0;const o=i(l);fetch(l.href,o)}})();var l0={exports:{}},Cu={};/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var X1;function Ww(){if(X1)return Cu;X1=1;var b=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function i(n,l,o){var u=null;if(o!==void 0&&(u=""+o),l.key!==void 0&&(u=""+l.key),"key"in l){o={};for(var d in l)d!=="key"&&(o[d]=l[d])}else o=l;return l=o.ref,{$$typeof:b,type:n,key:u,ref:l!==void 0?l:null,props:o}}return Cu.Fragment=e,Cu.jsx=i,Cu.jsxs=i,Cu}var Y1;function $w(){return Y1||(Y1=1,l0.exports=Ww()),l0.exports}var st=$w(),r0={exports:{}},_t={};/**
* @license React
* react.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var V1;function Jw(){if(V1)return _t;V1=1;var b=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),v=Symbol.iterator;function y(D){return D===null||typeof D!="object"?null:(D=v&&D[v]||D["@@iterator"],typeof D=="function"?D:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,C={};function L(D,V,$){this.props=D,this.context=V,this.refs=C,this.updater=$||E}L.prototype.isReactComponent={},L.prototype.setState=function(D,V){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,V,"setState")},L.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function M(){}M.prototype=L.prototype;function H(D,V,$){this.props=D,this.context=V,this.refs=C,this.updater=$||E}var F=H.prototype=new M;F.constructor=H,x(F,L.prototype),F.isPureReactComponent=!0;var I=Array.isArray,j={H:null,A:null,T:null,S:null,V:null},q=Object.prototype.hasOwnProperty;function Q(D,V,$,Z,ot,Mt){return $=Mt.ref,{$$typeof:b,type:D,key:V,ref:$!==void 0?$:null,props:Mt}}function J(D,V){return Q(D.type,V,void 0,void 0,void 0,D.props)}function at(D){return typeof D=="object"&&D!==null&&D.$$typeof===b}function yt(D){var V={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function($){return V[$]})}var lt=/\/+/g;function pt(D,V){return typeof D=="object"&&D!==null&&D.key!=null?yt(""+D.key):V.toString(36)}function wt(){}function Ot(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(wt,wt):(D.status="pending",D.then(function(V){D.status==="pending"&&(D.status="fulfilled",D.value=V)},function(V){D.status==="pending"&&(D.status="rejected",D.reason=V)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function mt(D,V,$,Z,ot){var Mt=typeof D;(Mt==="undefined"||Mt==="boolean")&&(D=null);var rt=!1;if(D===null)rt=!0;else switch(Mt){case"bigint":case"string":case"number":rt=!0;break;case"object":switch(D.$$typeof){case b:case e:rt=!0;break;case m:return rt=D._init,mt(rt(D._payload),V,$,Z,ot)}}if(rt)return ot=ot(D),rt=Z===""?"."+pt(D,0):Z,I(ot)?($="",rt!=null&&($=rt.replace(lt,"$&/")+"/"),mt(ot,V,$,"",function(Yi){return Yi})):ot!=null&&(at(ot)&&(ot=J(ot,$+(ot.key==null||D&&D.key===ot.key?"":(""+ot.key).replace(lt,"$&/")+"/")+rt)),V.push(ot)),1;rt=0;var Rt=Z===""?".":Z+":";if(I(D))for(var jt=0;jt<D.length;jt++)Z=D[jt],Mt=Rt+pt(Z,jt),rt+=mt(Z,V,$,Mt,ot);else if(jt=y(D),typeof jt=="function")for(D=jt.call(D),jt=0;!(Z=D.next()).done;)Z=Z.value,Mt=Rt+pt(Z,jt++),rt+=mt(Z,V,$,Mt,ot);else if(Mt==="object"){if(typeof D.then=="function")return mt(Ot(D),V,$,Z,ot);throw V=String(D),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return rt}function P(D,V,$){if(D==null)return D;var Z=[],ot=0;return mt(D,Z,"","",function(Mt){return V.call($,Mt,ot++)}),Z}function X(D){if(D._status===-1){var V=D._result;V=V(),V.then(function($){(D._status===0||D._status===-1)&&(D._status=1,D._result=$)},function($){(D._status===0||D._status===-1)&&(D._status=2,D._result=$)}),D._status===-1&&(D._status=0,D._result=V)}if(D._status===1)return D._result.default;throw D._result}var W=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)};function zt(){}return _t.Children={map:P,forEach:function(D,V,$){P(D,function(){V.apply(this,arguments)},$)},count:function(D){var V=0;return P(D,function(){V++}),V},toArray:function(D){return P(D,function(V){return V})||[]},only:function(D){if(!at(D))throw Error("React.Children.only expected to receive a single React element child.");return D}},_t.Component=L,_t.Fragment=i,_t.Profiler=l,_t.PureComponent=H,_t.StrictMode=n,_t.Suspense=f,_t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,_t.__COMPILER_RUNTIME={__proto__:null,c:function(D){return j.H.useMemoCache(D)}},_t.cache=function(D){return function(){return D.apply(null,arguments)}},_t.cloneElement=function(D,V,$){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var Z=x({},D.props),ot=D.key,Mt=void 0;if(V!=null)for(rt in V.ref!==void 0&&(Mt=void 0),V.key!==void 0&&(ot=""+V.key),V)!q.call(V,rt)||rt==="key"||rt==="__self"||rt==="__source"||rt==="ref"&&V.ref===void 0||(Z[rt]=V[rt]);var rt=arguments.length-2;if(rt===1)Z.children=$;else if(1<rt){for(var Rt=Array(rt),jt=0;jt<rt;jt++)Rt[jt]=arguments[jt+2];Z.children=Rt}return Q(D.type,ot,void 0,void 0,Mt,Z)},_t.createContext=function(D){return D={$$typeof:u,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:o,_context:D},D},_t.createElement=function(D,V,$){var Z,ot={},Mt=null;if(V!=null)for(Z in V.key!==void 0&&(Mt=""+V.key),V)q.call(V,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(ot[Z]=V[Z]);var rt=arguments.length-2;if(rt===1)ot.children=$;else if(1<rt){for(var Rt=Array(rt),jt=0;jt<rt;jt++)Rt[jt]=arguments[jt+2];ot.children=Rt}if(D&&D.defaultProps)for(Z in rt=D.defaultProps,rt)ot[Z]===void 0&&(ot[Z]=rt[Z]);return Q(D,Mt,void 0,void 0,null,ot)},_t.createRef=function(){return{current:null}},_t.forwardRef=function(D){return{$$typeof:d,render:D}},_t.isValidElement=at,_t.lazy=function(D){return{$$typeof:m,_payload:{_status:-1,_result:D},_init:X}},_t.memo=function(D,V){return{$$typeof:g,type:D,compare:V===void 0?null:V}},_t.startTransition=function(D){var V=j.T,$={};j.T=$;try{var Z=D(),ot=j.S;ot!==null&&ot($,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(zt,W)}catch(Mt){W(Mt)}finally{j.T=V}},_t.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},_t.use=function(D){return j.H.use(D)},_t.useActionState=function(D,V,$){return j.H.useActionState(D,V,$)},_t.useCallback=function(D,V){return j.H.useCallback(D,V)},_t.useContext=function(D){return j.H.useContext(D)},_t.useDebugValue=function(){},_t.useDeferredValue=function(D,V){return j.H.useDeferredValue(D,V)},_t.useEffect=function(D,V,$){var Z=j.H;if(typeof $=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return Z.useEffect(D,V)},_t.useId=function(){return j.H.useId()},_t.useImperativeHandle=function(D,V,$){return j.H.useImperativeHandle(D,V,$)},_t.useInsertionEffect=function(D,V){return j.H.useInsertionEffect(D,V)},_t.useLayoutEffect=function(D,V){return j.H.useLayoutEffect(D,V)},_t.useMemo=function(D,V){return j.H.useMemo(D,V)},_t.useOptimistic=function(D,V){return j.H.useOptimistic(D,V)},_t.useReducer=function(D,V,$){return j.H.useReducer(D,V,$)},_t.useRef=function(D){return j.H.useRef(D)},_t.useState=function(D){return j.H.useState(D)},_t.useSyncExternalStore=function(D,V,$){return j.H.useSyncExternalStore(D,V,$)},_t.useTransition=function(){return j.H.useTransition()},_t.version="19.1.0",_t}var K1;function zb(){return K1||(K1=1,r0.exports=Jw()),r0.exports}var nn=zb(),o0={exports:{}},Mu={},c0={exports:{}},u0={};/**
* @license React
* scheduler.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Q1;function tx(){return Q1||(Q1=1,function(b){function e(P,X){var W=P.length;P.push(X);t:for(;0<W;){var zt=W-1>>>1,D=P[zt];if(0<l(D,X))P[zt]=X,P[W]=D,W=zt;else break t}}function i(P){return P.length===0?null:P[0]}function n(P){if(P.length===0)return null;var X=P[0],W=P.pop();if(W!==X){P[0]=W;t:for(var zt=0,D=P.length,V=D>>>1;zt<V;){var $=2*(zt+1)-1,Z=P[$],ot=$+1,Mt=P[ot];if(0>l(Z,W))ot<D&&0>l(Mt,Z)?(P[zt]=Mt,P[ot]=W,zt=ot):(P[zt]=Z,P[$]=W,zt=$);else if(ot<D&&0>l(Mt,W))P[zt]=Mt,P[ot]=W,zt=ot;else break t}}return X}function l(P,X){var W=P.sortIndex-X.sortIndex;return W!==0?W:P.id-X.id}if(b.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;b.unstable_now=function(){return o.now()}}else{var u=Date,d=u.now();b.unstable_now=function(){return u.now()-d}}var f=[],g=[],m=1,v=null,y=3,E=!1,x=!1,C=!1,L=!1,M=typeof setTimeout=="function"?setTimeout:null,H=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function I(P){for(var X=i(g);X!==null;){if(X.callback===null)n(g);else if(X.startTime<=P)n(g),X.sortIndex=X.expirationTime,e(f,X);else break;X=i(g)}}function j(P){if(C=!1,I(P),!x)if(i(f)!==null)x=!0,q||(q=!0,pt());else{var X=i(g);X!==null&&mt(j,X.startTime-P)}}var q=!1,Q=-1,J=5,at=-1;function yt(){return L?!0:!(b.unstable_now()-at<J)}function lt(){if(L=!1,q){var P=b.unstable_now();at=P;var X=!0;try{t:{x=!1,C&&(C=!1,H(Q),Q=-1),E=!0;var W=y;try{e:{for(I(P),v=i(f);v!==null&&!(v.expirationTime>P&&yt());){var zt=v.callback;if(typeof zt=="function"){v.callback=null,y=v.priorityLevel;var D=zt(v.expirationTime<=P);if(P=b.unstable_now(),typeof D=="function"){v.callback=D,I(P),X=!0;break e}v===i(f)&&n(f),I(P)}else n(f);v=i(f)}if(v!==null)X=!0;else{var V=i(g);V!==null&&mt(j,V.startTime-P),X=!1}}break t}finally{v=null,y=W,E=!1}X=void 0}}finally{X?pt():q=!1}}}var pt;if(typeof F=="function")pt=function(){F(lt)};else if(typeof MessageChannel<"u"){var wt=new MessageChannel,Ot=wt.port2;wt.port1.onmessage=lt,pt=function(){Ot.postMessage(null)}}else pt=function(){M(lt,0)};function mt(P,X){Q=M(function(){P(b.unstable_now())},X)}b.unstable_IdlePriority=5,b.unstable_ImmediatePriority=1,b.unstable_LowPriority=4,b.unstable_NormalPriority=3,b.unstable_Profiling=null,b.unstable_UserBlockingPriority=2,b.unstable_cancelCallback=function(P){P.callback=null},b.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<P?Math.floor(1e3/P):5},b.unstable_getCurrentPriorityLevel=function(){return y},b.unstable_next=function(P){switch(y){case 1:case 2:case 3:var X=3;break;default:X=y}var W=y;y=X;try{return P()}finally{y=W}},b.unstable_requestPaint=function(){L=!0},b.unstable_runWithPriority=function(P,X){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var W=y;y=P;try{return X()}finally{y=W}},b.unstable_scheduleCallback=function(P,X,W){var zt=b.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?zt+W:zt):W=zt,P){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=W+D,P={id:m++,callback:X,priorityLevel:P,startTime:W,expirationTime:D,sortIndex:-1},W>zt?(P.sortIndex=W,e(g,P),i(f)===null&&P===i(g)&&(C?(H(Q),Q=-1):C=!0,mt(j,W-zt))):(P.sortIndex=D,e(f,P),x||E||(x=!0,q||(q=!0,pt()))),P},b.unstable_shouldYield=yt,b.unstable_wrapCallback=function(P){var X=y;return function(){var W=y;y=X;try{return P.apply(this,arguments)}finally{y=W}}}}(u0)),u0}var Z1;function ex(){return Z1||(Z1=1,c0.exports=tx()),c0.exports}var h0={exports:{}},We={};/**
* @license React
* react-dom.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var W1;function ix(){if(W1)return We;W1=1;var b=zb();function e(f){var g="https://react.dev/errors/"+f;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)g+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+f+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var n={d:{f:i,r:function(){throw Error(e(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},l=Symbol.for("react.portal");function o(f,g,m){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:v==null?null:""+v,children:f,containerInfo:g,implementation:m}}var u=b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,g){if(f==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return We.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,We.createPortal=function(f,g){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(e(299));return o(f,g,null,m)},We.flushSync=function(f){var g=u.T,m=n.p;try{if(u.T=null,n.p=2,f)return f()}finally{u.T=g,n.p=m,n.d.f()}},We.preconnect=function(f,g){typeof f=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,n.d.C(f,g))},We.prefetchDNS=function(f){typeof f=="string"&&n.d.D(f)},We.preinit=function(f,g){if(typeof f=="string"&&g&&typeof g.as=="string"){var m=g.as,v=d(m,g.crossOrigin),y=typeof g.integrity=="string"?g.integrity:void 0,E=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;m==="style"?n.d.S(f,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:v,integrity:y,fetchPriority:E}):m==="script"&&n.d.X(f,{crossOrigin:v,integrity:y,fetchPriority:E,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},We.preinitModule=function(f,g){if(typeof f=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var m=d(g.as,g.crossOrigin);n.d.M(f,{crossOrigin:m,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&n.d.M(f)},We.preload=function(f,g){if(typeof f=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var m=g.as,v=d(m,g.crossOrigin);n.d.L(f,m,{crossOrigin:v,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},We.preloadModule=function(f,g){if(typeof f=="string")if(g){var m=d(g.as,g.crossOrigin);n.d.m(f,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:m,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else n.d.m(f)},We.requestFormReset=function(f){n.d.r(f)},We.unstable_batchedUpdates=function(f,g){return f(g)},We.useFormState=function(f,g,m){return u.H.useFormState(f,g,m)},We.useFormStatus=function(){return u.H.useHostTransitionStatus()},We.version="19.1.0",We}var $1;function sx(){if($1)return h0.exports;$1=1;function b(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(b)}catch(e){console.error(e)}}return b(),h0.exports=ix(),h0.exports}/**
* @license React
* react-dom-client.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var J1;function nx(){if(J1)return Mu;J1=1;var b=ex(),e=zb(),i=sx();function n(t){var s="https://react.dev/errors/"+t;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function o(t){var s=t,a=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(a=s.return),t=s.return;while(t)}return s.tag===3?a:null}function u(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function d(t){if(o(t)!==t)throw Error(n(188))}function f(t){var s=t.alternate;if(!s){if(s=o(t),s===null)throw Error(n(188));return s!==t?null:t}for(var a=t,r=s;;){var h=a.return;if(h===null)break;var p=h.alternate;if(p===null){if(r=h.return,r!==null){a=r;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===a)return d(h),t;if(p===r)return d(h),s;p=p.sibling}throw Error(n(188))}if(a.return!==r.return)a=h,r=p;else{for(var A=!1,T=h.child;T;){if(T===a){A=!0,a=h,r=p;break}if(T===r){A=!0,r=h,a=p;break}T=T.sibling}if(!A){for(T=p.child;T;){if(T===a){A=!0,a=p,r=h;break}if(T===r){A=!0,r=p,a=h;break}T=T.sibling}if(!A)throw Error(n(189))}}if(a.alternate!==r)throw Error(n(190))}if(a.tag!==3)throw Error(n(188));return a.stateNode.current===a?t:s}function g(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t;for(t=t.child;t!==null;){if(s=g(t),s!==null)return s;t=t.sibling}return null}var m=Object.assign,v=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),M=Symbol.for("react.provider"),H=Symbol.for("react.consumer"),F=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),at=Symbol.for("react.activity"),yt=Symbol.for("react.memo_cache_sentinel"),lt=Symbol.iterator;function pt(t){return t===null||typeof t!="object"?null:(t=lt&&t[lt]||t["@@iterator"],typeof t=="function"?t:null)}var wt=Symbol.for("react.client.reference");function Ot(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===wt?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case x:return"Fragment";case L:return"Profiler";case C:return"StrictMode";case j:return"Suspense";case q:return"SuspenseList";case at:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case E:return"Portal";case F:return(t.displayName||"Context")+".Provider";case H:return(t._context.displayName||"Context")+".Consumer";case I:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Q:return s=t.displayName||null,s!==null?s:Ot(t.type)||"Memo";case J:s=t._payload,t=t._init;try{return Ot(t(s))}catch{}}return null}var mt=Array.isArray,P=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},zt=[],D=-1;function V(t){return{current:t}}function $(t){0>D||(t.current=zt[D],zt[D]=null,D--)}function Z(t,s){D++,zt[D]=t.current,t.current=s}var ot=V(null),Mt=V(null),rt=V(null),Rt=V(null);function jt(t,s){switch(Z(rt,s),Z(Mt,t),Z(ot,null),s.nodeType){case 9:case 11:t=(t=s.documentElement)&&(t=t.namespaceURI)?v1(t):0;break;default:if(t=s.tagName,s=s.namespaceURI)s=v1(s),t=y1(s,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}$(ot),Z(ot,t)}function Yi(){$(ot),$(Mt),$(rt)}function Rc(t){t.memoizedState!==null&&Z(Rt,t);var s=ot.current,a=y1(s,t.type);s!==a&&(Z(Mt,t),Z(ot,a))}function bd(t){Mt.current===t&&($(ot),$(Mt)),Rt.current===t&&($(Rt),_u._currentValue=W)}var Xg=Object.prototype.hasOwnProperty,Yg=b.unstable_scheduleCallback,Vg=b.unstable_cancelCallback,CE=b.unstable_shouldYield,ME=b.unstable_requestPaint,Ls=b.unstable_now,RE=b.unstable_getCurrentPriorityLevel,$b=b.unstable_ImmediatePriority,Jb=b.unstable_UserBlockingPriority,vd=b.unstable_NormalPriority,DE=b.unstable_LowPriority,tv=b.unstable_IdlePriority,LE=b.log,OE=b.unstable_setDisableYieldValue,Dc=null,wi=null;function ea(t){if(typeof LE=="function"&&OE(t),wi&&typeof wi.setStrictMode=="function")try{wi.setStrictMode(Dc,t)}catch{}}var xi=Math.clz32?Math.clz32:zE,NE=Math.log,kE=Math.LN2;function zE(t){return t>>>=0,t===0?32:31-(NE(t)/kE|0)|0}var yd=256,Ad=4194304;function ll(t){var s=t&42;if(s!==0)return s;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Sd(t,s,a){var r=t.pendingLanes;if(r===0)return 0;var h=0,p=t.suspendedLanes,A=t.pingedLanes;t=t.warmLanes;var T=r&134217727;return T!==0?(r=T&~p,r!==0?h=ll(r):(A&=T,A!==0?h=ll(A):a||(a=T&~t,a!==0&&(h=ll(a))))):(T=r&~p,T!==0?h=ll(T):A!==0?h=ll(A):a||(a=r&~t,a!==0&&(h=ll(a)))),h===0?0:s!==0&&s!==h&&(s&p)===0&&(p=h&-h,a=s&-s,p>=a||p===32&&(a&4194048)!==0)?s:h}function Lc(t,s){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&s)===0}function HE(t,s){switch(t){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ev(){var t=yd;return yd<<=1,(yd&4194048)===0&&(yd=256),t}function iv(){var t=Ad;return Ad<<=1,(Ad&62914560)===0&&(Ad=4194304),t}function Kg(t){for(var s=[],a=0;31>a;a++)s.push(t);return s}function Oc(t,s){t.pendingLanes|=s,s!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function FE(t,s,a,r,h,p){var A=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var T=t.entanglements,R=t.expirationTimes,z=t.hiddenUpdates;for(a=A&~a;0<a;){var G=31-xi(a),K=1<<G;T[G]=0,R[G]=-1;var U=z[G];if(U!==null)for(z[G]=null,G=0;G<U.length;G++){var B=U[G];B!==null&&(B.lane&=-536870913)}a&=~K}r!==0&&sv(t,r,0),p!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=p&~(A&~s))}function sv(t,s,a){t.pendingLanes|=s,t.suspendedLanes&=~s;var r=31-xi(s);t.entangledLanes|=s,t.entanglements[r]=t.entanglements[r]|1073741824|a&4194090}function nv(t,s){var a=t.entangledLanes|=s;for(t=t.entanglements;a;){var r=31-xi(a),h=1<<r;h&s|t[r]&s&&(t[r]|=s),a&=~h}}function Qg(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Zg(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function av(){var t=X.p;return t!==0?t:(t=window.event,t===void 0?32:U1(t.type))}function UE(t,s){var a=X.p;try{return X.p=t,s()}finally{X.p=a}}var ia=Math.random().toString(36).slice(2),Qe="__reactFiber$"+ia,fi="__reactProps$"+ia,kr="__reactContainer$"+ia,Wg="__reactEvents$"+ia,BE="__reactListeners$"+ia,PE="__reactHandles$"+ia,lv="__reactResources$"+ia,Nc="__reactMarker$"+ia;function $g(t){delete t[Qe],delete t[fi],delete t[Wg],delete t[BE],delete t[PE]}function zr(t){var s=t[Qe];if(s)return s;for(var a=t.parentNode;a;){if(s=a[kr]||a[Qe]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(t=E1(t);t!==null;){if(a=t[Qe])return a;t=E1(t)}return s}t=a,a=t.parentNode}return null}function Hr(t){if(t=t[Qe]||t[kr]){var s=t.tag;if(s===5||s===6||s===13||s===26||s===27||s===3)return t}return null}function kc(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t.stateNode;throw Error(n(33))}function Fr(t){var s=t[lv];return s||(s=t[lv]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Oe(t){t[Nc]=!0}var rv=new Set,ov={};function rl(t,s){Ur(t,s),Ur(t+"Capture",s)}function Ur(t,s){for(ov[t]=s,t=0;t<s.length;t++)rv.add(s[t])}var IE=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),cv={},uv={};function jE(t){return Xg.call(uv,t)?!0:Xg.call(cv,t)?!1:IE.test(t)?uv[t]=!0:(cv[t]=!0,!1)}function _d(t,s,a){if(jE(s))if(a===null)t.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(s);return;case"boolean":var r=s.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){t.removeAttribute(s);return}}t.setAttribute(s,""+a)}}function Ed(t,s,a){if(a===null)t.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttribute(s,""+a)}}function an(t,s,a,r){if(r===null)t.removeAttribute(a);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(s,a,""+r)}}var Jg,hv;function Br(t){if(Jg===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);Jg=s&&s[1]||"",hv=-1<a.stack.indexOf(`
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Jg+t+hv}var tp=!1;function ep(t,s){if(!t||tp)return"";tp=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(s){var K=function(){throw Error()};if(Object.defineProperty(K.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(K,[])}catch(B){var U=B}Reflect.construct(t,[],K)}else{try{K.call()}catch(B){U=B}t.call(K.prototype)}}else{try{throw Error()}catch(B){U=B}(K=t())&&typeof K.catch=="function"&&K.catch(function(){})}}catch(B){if(B&&U&&typeof B.stack=="string")return[B.stack,U.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=r.DetermineComponentFrameRoot(),A=p[0],T=p[1];if(A&&T){var R=A.split(`
`),z=T.split(`
`);for(h=r=0;r<R.length&&!R[r].includes("DetermineComponentFrameRoot");)r++;for(;h<z.length&&!z[h].includes("DetermineComponentFrameRoot");)h++;if(r===R.length||h===z.length)for(r=R.length-1,h=z.length-1;1<=r&&0<=h&&R[r]!==z[h];)h--;for(;1<=r&&0<=h;r--,h--)if(R[r]!==z[h]){if(r!==1||h!==1)do if(r--,h--,0>h||R[r]!==z[h]){var G=`
`+R[r].replace(" at new "," at ");return t.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",t.displayName)),G}while(1<=r&&0<=h);break}}}finally{tp=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?Br(a):""}function qE(t){switch(t.tag){case 26:case 27:case 5:return Br(t.type);case 16:return Br("Lazy");case 13:return Br("Suspense");case 19:return Br("SuspenseList");case 0:case 15:return ep(t.type,!1);case 11:return ep(t.type.render,!1);case 1:return ep(t.type,!0);case 31:return Br("Activity");default:return""}}function dv(t){try{var s="";do s+=qE(t),t=t.return;while(t);return s}catch(a){return`
Error generating stack: `+a.message+`
`+a.stack}}function Vi(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function fv(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function GE(t){var s=fv(t)?"checked":"value",a=Object.getOwnPropertyDescriptor(t.constructor.prototype,s),r=""+t[s];if(!t.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var h=a.get,p=a.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return h.call(this)},set:function(A){r=""+A,p.call(this,A)}}),Object.defineProperty(t,s,{enumerable:a.enumerable}),{getValue:function(){return r},setValue:function(A){r=""+A},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function Td(t){t._valueTracker||(t._valueTracker=GE(t))}function gv(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var a=s.getValue(),r="";return t&&(r=fv(t)?t.checked?"true":"false":t.value),t=r,t!==a?(s.setValue(t),!0):!1}function wd(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var XE=/[\n"\\]/g;function Ki(t){return t.replace(XE,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function ip(t,s,a,r,h,p,A,T){t.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?t.type=A:t.removeAttribute("type"),s!=null?A==="number"?(s===0&&t.value===""||t.value!=s)&&(t.value=""+Vi(s)):t.value!==""+Vi(s)&&(t.value=""+Vi(s)):A!=="submit"&&A!=="reset"||t.removeAttribute("value"),s!=null?sp(t,A,Vi(s)):a!=null?sp(t,A,Vi(a)):r!=null&&t.removeAttribute("value"),h==null&&p!=null&&(t.defaultChecked=!!p),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?t.name=""+Vi(T):t.removeAttribute("name")}function pv(t,s,a,r,h,p,A,T){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),s!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||s!=null))return;a=a!=null?""+Vi(a):"",s=s!=null?""+Vi(s):a,T||s===t.value||(t.value=s),t.defaultValue=s}r=r??h,r=typeof r!="function"&&typeof r!="symbol"&&!!r,t.checked=T?t.checked:!!r,t.defaultChecked=!!r,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(t.name=A)}function sp(t,s,a){s==="number"&&wd(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Pr(t,s,a,r){if(t=t.options,s){s={};for(var h=0;h<a.length;h++)s["$"+a[h]]=!0;for(a=0;a<t.length;a++)h=s.hasOwnProperty("$"+t[a].value),t[a].selected!==h&&(t[a].selected=h),h&&r&&(t[a].defaultSelected=!0)}else{for(a=""+Vi(a),s=null,h=0;h<t.length;h++){if(t[h].value===a){t[h].selected=!0,r&&(t[h].defaultSelected=!0);return}s!==null||t[h].disabled||(s=t[h])}s!==null&&(s.selected=!0)}}function mv(t,s,a){if(s!=null&&(s=""+Vi(s),s!==t.value&&(t.value=s),a==null)){t.defaultValue!==s&&(t.defaultValue=s);return}t.defaultValue=a!=null?""+Vi(a):""}function bv(t,s,a,r){if(s==null){if(r!=null){if(a!=null)throw Error(n(92));if(mt(r)){if(1<r.length)throw Error(n(93));r=r[0]}a=r}a==null&&(a=""),s=a}a=Vi(s),t.defaultValue=a,r=t.textContent,r===a&&r!==""&&r!==null&&(t.value=r)}function Ir(t,s){if(s){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=s;return}}t.textContent=s}var YE=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function vv(t,s,a){var r=s.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?r?t.setProperty(s,""):s==="float"?t.cssFloat="":t[s]="":r?t.setProperty(s,a):typeof a!="number"||a===0||YE.has(s)?s==="float"?t.cssFloat=a:t[s]=(""+a).trim():t[s]=a+"px"}function yv(t,s,a){if(s!=null&&typeof s!="object")throw Error(n(62));if(t=t.style,a!=null){for(var r in a)!a.hasOwnProperty(r)||s!=null&&s.hasOwnProperty(r)||(r.indexOf("--")===0?t.setProperty(r,""):r==="float"?t.cssFloat="":t[r]="");for(var h in s)r=s[h],s.hasOwnProperty(h)&&a[h]!==r&&vv(t,h,r)}else for(var p in s)s.hasOwnProperty(p)&&vv(t,p,s[p])}function np(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var VE=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),KE=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function xd(t){return KE.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}var ap=null;function lp(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var jr=null,qr=null;function Av(t){var s=Hr(t);if(s&&(t=s.stateNode)){var a=t[fi]||null;t:switch(t=s.stateNode,s.type){case"input":if(ip(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),s=a.name,a.type==="radio"&&s!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Ki(""+s)+'"][type="radio"]'),s=0;s<a.length;s++){var r=a[s];if(r!==t&&r.form===t.form){var h=r[fi]||null;if(!h)throw Error(n(90));ip(r,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(s=0;s<a.length;s++)r=a[s],r.form===t.form&&gv(r)}break t;case"textarea":mv(t,a.value,a.defaultValue);break t;case"select":s=a.value,s!=null&&Pr(t,!!a.multiple,s,!1)}}}var rp=!1;function Sv(t,s,a){if(rp)return t(s,a);rp=!0;try{var r=t(s);return r}finally{if(rp=!1,(jr!==null||qr!==null)&&(df(),jr&&(s=jr,t=qr,qr=jr=null,Av(s),t)))for(s=0;s<t.length;s++)Av(t[s])}}function zc(t,s){var a=t.stateNode;if(a===null)return null;var r=a[fi]||null;if(r===null)return null;a=r[s];t:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break t;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(n(231,s,typeof a));return a}var ln=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),op=!1;if(ln)try{var Hc={};Object.defineProperty(Hc,"passive",{get:function(){op=!0}}),window.addEventListener("test",Hc,Hc),window.removeEventListener("test",Hc,Hc)}catch{op=!1}var sa=null,cp=null,Cd=null;function _v(){if(Cd)return Cd;var t,s=cp,a=s.length,r,h="value"in sa?sa.value:sa.textContent,p=h.length;for(t=0;t<a&&s[t]===h[t];t++);var A=a-t;for(r=1;r<=A&&s[a-r]===h[p-r];r++);return Cd=h.slice(t,1<r?1-r:void 0)}function Md(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function Rd(){return!0}function Ev(){return!1}function gi(t){function s(a,r,h,p,A){this._reactName=a,this._targetInst=h,this.type=r,this.nativeEvent=p,this.target=A,this.currentTarget=null;for(var T in t)t.hasOwnProperty(T)&&(a=t[T],this[T]=a?a(p):p[T]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Rd:Ev,this.isPropagationStopped=Ev,this}return m(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Rd)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Rd)},persist:function(){},isPersistent:Rd}),s}var ol={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dd=gi(ol),Fc=m({},ol,{view:0,detail:0}),QE=gi(Fc),up,hp,Uc,Ld=m({},Fc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fp,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Uc&&(Uc&&t.type==="mousemove"?(up=t.screenX-Uc.screenX,hp=t.screenY-Uc.screenY):hp=up=0,Uc=t),up)},movementY:function(t){return"movementY"in t?t.movementY:hp}}),Tv=gi(Ld),ZE=m({},Ld,{dataTransfer:0}),WE=gi(ZE),$E=m({},Fc,{relatedTarget:0}),dp=gi($E),JE=m({},ol,{animationName:0,elapsedTime:0,pseudoElement:0}),tT=gi(JE),eT=m({},ol,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),iT=gi(eT),sT=m({},ol,{data:0}),wv=gi(sT),nT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},aT={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},lT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function rT(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=lT[t])?!!s[t]:!1}function fp(){return rT}var oT=m({},Fc,{key:function(t){if(t.key){var s=nT[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=Md(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?aT[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fp,charCode:function(t){return t.type==="keypress"?Md(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Md(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),cT=gi(oT),uT=m({},Ld,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),xv=gi(uT),hT=m({},Fc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fp}),dT=gi(hT),fT=m({},ol,{propertyName:0,elapsedTime:0,pseudoElement:0}),gT=gi(fT),pT=m({},Ld,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),mT=gi(pT),bT=m({},ol,{newState:0,oldState:0}),vT=gi(bT),yT=[9,13,27,32],gp=ln&&"CompositionEvent"in window,Bc=null;ln&&"documentMode"in document&&(Bc=document.documentMode);var AT=ln&&"TextEvent"in window&&!Bc,Cv=ln&&(!gp||Bc&&8<Bc&&11>=Bc),Mv=" ",Rv=!1;function Dv(t,s){switch(t){case"keyup":return yT.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lv(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Gr=!1;function ST(t,s){switch(t){case"compositionend":return Lv(s);case"keypress":return s.which!==32?null:(Rv=!0,Mv);case"textInput":return t=s.data,t===Mv&&Rv?null:t;default:return null}}function _T(t,s){if(Gr)return t==="compositionend"||!gp&&Dv(t,s)?(t=_v(),Cd=cp=sa=null,Gr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Cv&&s.locale!=="ko"?null:s.data;default:return null}}var ET={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Ov(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!ET[t.type]:s==="textarea"}function Nv(t,s,a,r){jr?qr?qr.push(r):qr=[r]:jr=r,s=vf(s,"onChange"),0<s.length&&(a=new Dd("onChange","change",null,a,r),t.push({event:a,listeners:s}))}var Pc=null,Ic=null;function TT(t){f1(t,0)}function Od(t){var s=kc(t);if(gv(s))return t}function kv(t,s){if(t==="change")return s}var zv=!1;if(ln){var pp;if(ln){var mp="oninput"in document;if(!mp){var Hv=document.createElement("div");Hv.setAttribute("oninput","return;"),mp=typeof Hv.oninput=="function"}pp=mp}else pp=!1;zv=pp&&(!document.documentMode||9<document.documentMode)}function Fv(){Pc&&(Pc.detachEvent("onpropertychange",Uv),Ic=Pc=null)}function Uv(t){if(t.propertyName==="value"&&Od(Ic)){var s=[];Nv(s,Ic,t,lp(t)),Sv(TT,s)}}function wT(t,s,a){t==="focusin"?(Fv(),Pc=s,Ic=a,Pc.attachEvent("onpropertychange",Uv)):t==="focusout"&&Fv()}function xT(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Od(Ic)}function CT(t,s){if(t==="click")return Od(s)}function MT(t,s){if(t==="input"||t==="change")return Od(s)}function RT(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var Ci=typeof Object.is=="function"?Object.is:RT;function jc(t,s){if(Ci(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var a=Object.keys(t),r=Object.keys(s);if(a.length!==r.length)return!1;for(r=0;r<a.length;r++){var h=a[r];if(!Xg.call(s,h)||!Ci(t[h],s[h]))return!1}return!0}function Bv(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Pv(t,s){var a=Bv(t);t=0;for(var r;a;){if(a.nodeType===3){if(r=t+a.textContent.length,t<=s&&r>=s)return{node:a,offset:s-t};t=r}t:{for(;a;){if(a.nextSibling){a=a.nextSibling;break t}a=a.parentNode}a=void 0}a=Bv(a)}}function Iv(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Iv(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function jv(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var s=wd(t.document);s instanceof t.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)t=s.contentWindow;else break;s=wd(t.document)}return s}function bp(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}var DT=ln&&"documentMode"in document&&11>=document.documentMode,Xr=null,vp=null,qc=null,yp=!1;function qv(t,s,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;yp||Xr==null||Xr!==wd(r)||(r=Xr,"selectionStart"in r&&bp(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),qc&&jc(qc,r)||(qc=r,r=vf(vp,"onSelect"),0<r.length&&(s=new Dd("onSelect","select",null,s,a),t.push({event:s,listeners:r}),s.target=Xr)))}function cl(t,s){var a={};return a[t.toLowerCase()]=s.toLowerCase(),a["Webkit"+t]="webkit"+s,a["Moz"+t]="moz"+s,a}var Yr={animationend:cl("Animation","AnimationEnd"),animationiteration:cl("Animation","AnimationIteration"),animationstart:cl("Animation","AnimationStart"),transitionrun:cl("Transition","TransitionRun"),transitionstart:cl("Transition","TransitionStart"),transitioncancel:cl("Transition","TransitionCancel"),transitionend:cl("Transition","TransitionEnd")},Ap={},Gv={};ln&&(Gv=document.createElement("div").style,"AnimationEvent"in window||(delete Yr.animationend.animation,delete Yr.animationiteration.animation,delete Yr.animationstart.animation),"TransitionEvent"in window||delete Yr.transitionend.transition);function ul(t){if(Ap[t])return Ap[t];if(!Yr[t])return t;var s=Yr[t],a;for(a in s)if(s.hasOwnProperty(a)&&a in Gv)return Ap[t]=s[a];return t}var Xv=ul("animationend"),Yv=ul("animationiteration"),Vv=ul("animationstart"),LT=ul("transitionrun"),OT=ul("transitionstart"),NT=ul("transitioncancel"),Kv=ul("transitionend"),Qv=new Map,Sp="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Sp.push("scrollEnd");function ds(t,s){Qv.set(t,s),rl(s,[t])}var Zv=new WeakMap;function Qi(t,s){if(typeof t=="object"&&t!==null){var a=Zv.get(t);return a!==void 0?a:(s={value:t,source:s,stack:dv(s)},Zv.set(t,s),s)}return{value:t,source:s,stack:dv(s)}}var Zi=[],Vr=0,_p=0;function Nd(){for(var t=Vr,s=_p=Vr=0;s<t;){var a=Zi[s];Zi[s++]=null;var r=Zi[s];Zi[s++]=null;var h=Zi[s];Zi[s++]=null;var p=Zi[s];if(Zi[s++]=null,r!==null&&h!==null){var A=r.pending;A===null?h.next=h:(h.next=A.next,A.next=h),r.pending=h}p!==0&&Wv(a,h,p)}}function kd(t,s,a,r){Zi[Vr++]=t,Zi[Vr++]=s,Zi[Vr++]=a,Zi[Vr++]=r,_p|=r,t.lanes|=r,t=t.alternate,t!==null&&(t.lanes|=r)}function Ep(t,s,a,r){return kd(t,s,a,r),zd(t)}function Kr(t,s){return kd(t,null,null,s),zd(t)}function Wv(t,s,a){t.lanes|=a;var r=t.alternate;r!==null&&(r.lanes|=a);for(var h=!1,p=t.return;p!==null;)p.childLanes|=a,r=p.alternate,r!==null&&(r.childLanes|=a),p.tag===22&&(t=p.stateNode,t===null||t._visibility&1||(h=!0)),t=p,p=p.return;return t.tag===3?(p=t.stateNode,h&&s!==null&&(h=31-xi(a),t=p.hiddenUpdates,r=t[h],r===null?t[h]=[s]:r.push(s),s.lane=a|536870912),p):null}function zd(t){if(50<gu)throw gu=0,Rm=null,Error(n(185));for(var s=t.return;s!==null;)t=s,s=t.return;return t.tag===3?t.stateNode:null}var Qr={};function kT(t,s,a,r){this.tag=t,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mi(t,s,a,r){return new kT(t,s,a,r)}function Tp(t){return t=t.prototype,!(!t||!t.isReactComponent)}function rn(t,s){var a=t.alternate;return a===null?(a=Mi(t.tag,s,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=s,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,s=t.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function $v(t,s){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=s,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,s=a.dependencies,t.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),t}function Hd(t,s,a,r,h,p){var A=0;if(r=t,typeof t=="function")Tp(t)&&(A=1);else if(typeof t=="string")A=Hw(t,a,ot.current)?26:t==="html"||t==="head"||t==="body"?27:5;else t:switch(t){case at:return t=Mi(31,a,s,h),t.elementType=at,t.lanes=p,t;case x:return hl(a.children,h,p,s);case C:A=8,h|=24;break;case L:return t=Mi(12,a,s,h|2),t.elementType=L,t.lanes=p,t;case j:return t=Mi(13,a,s,h),t.elementType=j,t.lanes=p,t;case q:return t=Mi(19,a,s,h),t.elementType=q,t.lanes=p,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case M:case F:A=10;break t;case H:A=9;break t;case I:A=11;break t;case Q:A=14;break t;case J:A=16,r=null;break t}A=29,a=Error(n(130,t===null?"null":typeof t,"")),r=null}return s=Mi(A,a,s,h),s.elementType=t,s.type=r,s.lanes=p,s}function hl(t,s,a,r){return t=Mi(7,t,r,s),t.lanes=a,t}function wp(t,s,a){return t=Mi(6,t,null,s),t.lanes=a,t}function xp(t,s,a){return s=Mi(4,t.children!==null?t.children:[],t.key,s),s.lanes=a,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}var Zr=[],Wr=0,Fd=null,Ud=0,Wi=[],$i=0,dl=null,on=1,cn="";function fl(t,s){Zr[Wr++]=Ud,Zr[Wr++]=Fd,Fd=t,Ud=s}function Jv(t,s,a){Wi[$i++]=on,Wi[$i++]=cn,Wi[$i++]=dl,dl=t;var r=on;t=cn;var h=32-xi(r)-1;r&=~(1<<h),a+=1;var p=32-xi(s)+h;if(30<p){var A=h-h%5;p=(r&(1<<A)-1).toString(32),r>>=A,h-=A,on=1<<32-xi(s)+h|a<<h|r,cn=p+t}else on=1<<p|a<<h|r,cn=t}function Cp(t){t.return!==null&&(fl(t,1),Jv(t,1,0))}function Mp(t){for(;t===Fd;)Fd=Zr[--Wr],Zr[Wr]=null,Ud=Zr[--Wr],Zr[Wr]=null;for(;t===dl;)dl=Wi[--$i],Wi[$i]=null,cn=Wi[--$i],Wi[$i]=null,on=Wi[--$i],Wi[$i]=null}var ai=null,he=null,Pt=!1,gl=null,Os=!1,Rp=Error(n(519));function pl(t){var s=Error(n(418,""));throw Yc(Qi(s,t)),Rp}function ty(t){var s=t.stateNode,a=t.type,r=t.memoizedProps;switch(s[Qe]=t,s[fi]=r,a){case"dialog":kt("cancel",s),kt("close",s);break;case"iframe":case"object":case"embed":kt("load",s);break;case"video":case"audio":for(a=0;a<mu.length;a++)kt(mu[a],s);break;case"source":kt("error",s);break;case"img":case"image":case"link":kt("error",s),kt("load",s);break;case"details":kt("toggle",s);break;case"input":kt("invalid",s),pv(s,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0),Td(s);break;case"select":kt("invalid",s);break;case"textarea":kt("invalid",s),bv(s,r.value,r.defaultValue,r.children),Td(s)}a=r.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||s.textContent===""+a||r.suppressHydrationWarning===!0||b1(s.textContent,a)?(r.popover!=null&&(kt("beforetoggle",s),kt("toggle",s)),r.onScroll!=null&&kt("scroll",s),r.onScrollEnd!=null&&kt("scrollend",s),r.onClick!=null&&(s.onclick=yf),s=!0):s=!1,s||pl(t)}function ey(t){for(ai=t.return;ai;)switch(ai.tag){case 5:case 13:Os=!1;return;case 27:case 3:Os=!0;return;default:ai=ai.return}}function Gc(t){if(t!==ai)return!1;if(!Pt)return ey(t),Pt=!0,!1;var s=t.tag,a;if((a=s!==3&&s!==27)&&((a=s===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||Xm(t.type,t.memoizedProps)),a=!a),a&&he&&pl(t),ey(t),s===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(n(317));t:{for(t=t.nextSibling,s=0;t;){if(t.nodeType===8)if(a=t.data,a==="/$"){if(s===0){he=gs(t.nextSibling);break t}s--}else a!=="$"&&a!=="$!"&&a!=="$?"||s++;t=t.nextSibling}he=null}}else s===27?(s=he,ya(t.type)?(t=Qm,Qm=null,he=t):he=s):he=ai?gs(t.stateNode.nextSibling):null;return!0}function Xc(){he=ai=null,Pt=!1}function iy(){var t=gl;return t!==null&&(bi===null?bi=t:bi.push.apply(bi,t),gl=null),t}function Yc(t){gl===null?gl=[t]:gl.push(t)}var Dp=V(null),ml=null,un=null;function na(t,s,a){Z(Dp,s._currentValue),s._currentValue=a}function hn(t){t._currentValue=Dp.current,$(Dp)}function Lp(t,s,a){for(;t!==null;){var r=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,r!==null&&(r.childLanes|=s)):r!==null&&(r.childLanes&s)!==s&&(r.childLanes|=s),t===a)break;t=t.return}}function Op(t,s,a,r){var h=t.child;for(h!==null&&(h.return=t);h!==null;){var p=h.dependencies;if(p!==null){var A=h.child;p=p.firstContext;t:for(;p!==null;){var T=p;p=h;for(var R=0;R<s.length;R++)if(T.context===s[R]){p.lanes|=a,T=p.alternate,T!==null&&(T.lanes|=a),Lp(p.return,a,t),r||(A=null);break t}p=T.next}}else if(h.tag===18){if(A=h.return,A===null)throw Error(n(341));A.lanes|=a,p=A.alternate,p!==null&&(p.lanes|=a),Lp(A,a,t),A=null}else A=h.child;if(A!==null)A.return=h;else for(A=h;A!==null;){if(A===t){A=null;break}if(h=A.sibling,h!==null){h.return=A.return,A=h;break}A=A.return}h=A}}function Vc(t,s,a,r){t=null;for(var h=s,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var A=h.alternate;if(A===null)throw Error(n(387));if(A=A.memoizedProps,A!==null){var T=h.type;Ci(h.pendingProps.value,A.value)||(t!==null?t.push(T):t=[T])}}else if(h===Rt.current){if(A=h.alternate,A===null)throw Error(n(387));A.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(_u):t=[_u])}h=h.return}t!==null&&Op(s,t,a,r),s.flags|=262144}function Bd(t){for(t=t.firstContext;t!==null;){if(!Ci(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function bl(t){ml=t,un=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Ze(t){return sy(ml,t)}function Pd(t,s){return ml===null&&bl(t),sy(t,s)}function sy(t,s){var a=s._currentValue;if(s={context:s,memoizedValue:a,next:null},un===null){if(t===null)throw Error(n(308));un=s,t.dependencies={lanes:0,firstContext:s},t.flags|=524288}else un=un.next=s;return a}var zT=typeof AbortController<"u"?AbortController:function(){var t=[],s=this.signal={aborted:!1,addEventListener:function(a,r){t.push(r)}};this.abort=function(){s.aborted=!0,t.forEach(function(a){return a()})}},HT=b.unstable_scheduleCallback,FT=b.unstable_NormalPriority,Ee={$$typeof:F,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Np(){return{controller:new zT,data:new Map,refCount:0}}function Kc(t){t.refCount--,t.refCount===0&&HT(FT,function(){t.controller.abort()})}var Qc=null,kp=0,$r=0,Jr=null;function UT(t,s){if(Qc===null){var a=Qc=[];kp=0,$r=Hm(),Jr={status:"pending",value:void 0,then:function(r){a.push(r)}}}return kp++,s.then(ny,ny),s}function ny(){if(--kp===0&&Qc!==null){Jr!==null&&(Jr.status="fulfilled");var t=Qc;Qc=null,$r=0,Jr=null;for(var s=0;s<t.length;s++)(0,t[s])()}}function BT(t,s){var a=[],r={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return t.then(function(){r.status="fulfilled",r.value=s;for(var h=0;h<a.length;h++)(0,a[h])(s)},function(h){for(r.status="rejected",r.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),r}var ay=P.S;P.S=function(t,s){typeof s=="object"&&s!==null&&typeof s.then=="function"&&UT(t,s),ay!==null&&ay(t,s)};var vl=V(null);function zp(){var t=vl.current;return t!==null?t:ee.pooledCache}function Id(t,s){s===null?Z(vl,vl.current):Z(vl,s.pool)}function ly(){var t=zp();return t===null?null:{parent:Ee._currentValue,pool:t}}var Zc=Error(n(460)),ry=Error(n(474)),jd=Error(n(542)),Hp={then:function(){}};function oy(t){return t=t.status,t==="fulfilled"||t==="rejected"}function qd(){}function cy(t,s,a){switch(a=t[a],a===void 0?t.push(s):a!==s&&(s.then(qd,qd),s=a),s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,hy(t),t;default:if(typeof s.status=="string")s.then(qd,qd);else{if(t=ee,t!==null&&100<t.shellSuspendCounter)throw Error(n(482));t=s,t.status="pending",t.then(function(r){if(s.status==="pending"){var h=s;h.status="fulfilled",h.value=r}},function(r){if(s.status==="pending"){var h=s;h.status="rejected",h.reason=r}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,hy(t),t}throw Wc=s,Zc}}var Wc=null;function uy(){if(Wc===null)throw Error(n(459));var t=Wc;return Wc=null,t}function hy(t){if(t===Zc||t===jd)throw Error(n(483))}var aa=!1;function Fp(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Up(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function la(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function ra(t,s,a){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,(Gt&2)!==0){var h=r.pending;return h===null?s.next=s:(s.next=h.next,h.next=s),r.pending=s,s=zd(t),Wv(t,null,a),s}return kd(t,r,s,a),zd(t)}function $c(t,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194048)!==0)){var r=s.lanes;r&=t.pendingLanes,a|=r,s.lanes=a,nv(t,a)}}function Bp(t,s){var a=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var h=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var A={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?h=p=A:p=p.next=A,a=a.next}while(a!==null);p===null?h=p=s:p=p.next=s}else h=p=s;a={baseState:r.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:r.shared,callbacks:r.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=s:t.next=s,a.lastBaseUpdate=s}var Pp=!1;function Jc(){if(Pp){var t=Jr;if(t!==null)throw t}}function tu(t,s,a,r){Pp=!1;var h=t.updateQueue;aa=!1;var p=h.firstBaseUpdate,A=h.lastBaseUpdate,T=h.shared.pending;if(T!==null){h.shared.pending=null;var R=T,z=R.next;R.next=null,A===null?p=z:A.next=z,A=R;var G=t.alternate;G!==null&&(G=G.updateQueue,T=G.lastBaseUpdate,T!==A&&(T===null?G.firstBaseUpdate=z:T.next=z,G.lastBaseUpdate=R))}if(p!==null){var K=h.baseState;A=0,G=z=R=null,T=p;do{var U=T.lane&-536870913,B=U!==T.lane;if(B?(Ut&U)===U:(r&U)===U){U!==0&&U===$r&&(Pp=!0),G!==null&&(G=G.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});t:{var gt=t,dt=T;U=s;var Wt=a;switch(dt.tag){case 1:if(gt=dt.payload,typeof gt=="function"){K=gt.call(Wt,K,U);break t}K=gt;break t;case 3:gt.flags=gt.flags&-65537|128;case 0:if(gt=dt.payload,U=typeof gt=="function"?gt.call(Wt,K,U):gt,U==null)break t;K=m({},K,U);break t;case 2:aa=!0}}U=T.callback,U!==null&&(t.flags|=64,B&&(t.flags|=8192),B=h.callbacks,B===null?h.callbacks=[U]:B.push(U))}else B={lane:U,tag:T.tag,payload:T.payload,callback:T.callback,next:null},G===null?(z=G=B,R=K):G=G.next=B,A|=U;if(T=T.next,T===null){if(T=h.shared.pending,T===null)break;B=T,T=B.next,B.next=null,h.lastBaseUpdate=B,h.shared.pending=null}}while(!0);G===null&&(R=K),h.baseState=R,h.firstBaseUpdate=z,h.lastBaseUpdate=G,p===null&&(h.shared.lanes=0),pa|=A,t.lanes=A,t.memoizedState=K}}function dy(t,s){if(typeof t!="function")throw Error(n(191,t));t.call(s)}function fy(t,s){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)dy(a[t],s)}var to=V(null),Gd=V(0);function gy(t,s){t=vn,Z(Gd,t),Z(to,s),vn=t|s.baseLanes}function Ip(){Z(Gd,vn),Z(to,to.current)}function jp(){vn=Gd.current,$(to),$(Gd)}var oa=0,xt=null,Qt=null,ve=null,Xd=!1,eo=!1,yl=!1,Yd=0,eu=0,io=null,PT=0;function ge(){throw Error(n(321))}function qp(t,s){if(s===null)return!1;for(var a=0;a<s.length&&a<t.length;a++)if(!Ci(t[a],s[a]))return!1;return!0}function Gp(t,s,a,r,h,p){return oa=p,xt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,P.H=t===null||t.memoizedState===null?Wy:$y,yl=!1,p=a(r,h),yl=!1,eo&&(p=my(s,a,r,h)),py(t),p}function py(t){P.H=$d;var s=Qt!==null&&Qt.next!==null;if(oa=0,ve=Qt=xt=null,Xd=!1,eu=0,io=null,s)throw Error(n(300));t===null||Ne||(t=t.dependencies,t!==null&&Bd(t)&&(Ne=!0))}function my(t,s,a,r){xt=t;var h=0;do{if(eo&&(io=null),eu=0,eo=!1,25<=h)throw Error(n(301));if(h+=1,ve=Qt=null,t.updateQueue!=null){var p=t.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}P.H=VT,p=s(a,r)}while(eo);return p}function IT(){var t=P.H,s=t.useState()[0];return s=typeof s.then=="function"?iu(s):s,t=t.useState()[0],(Qt!==null?Qt.memoizedState:null)!==t&&(xt.flags|=1024),s}function Xp(){var t=Yd!==0;return Yd=0,t}function Yp(t,s,a){s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~a}function Vp(t){if(Xd){for(t=t.memoizedState;t!==null;){var s=t.queue;s!==null&&(s.pending=null),t=t.next}Xd=!1}oa=0,ve=Qt=xt=null,eo=!1,eu=Yd=0,io=null}function pi(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ve===null?xt.memoizedState=ve=t:ve=ve.next=t,ve}function ye(){if(Qt===null){var t=xt.alternate;t=t!==null?t.memoizedState:null}else t=Qt.next;var s=ve===null?xt.memoizedState:ve.next;if(s!==null)ve=s,Qt=t;else{if(t===null)throw xt.alternate===null?Error(n(467)):Error(n(310));Qt=t,t={memoizedState:Qt.memoizedState,baseState:Qt.baseState,baseQueue:Qt.baseQueue,queue:Qt.queue,next:null},ve===null?xt.memoizedState=ve=t:ve=ve.next=t}return ve}function Kp(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function iu(t){var s=eu;return eu+=1,io===null&&(io=[]),t=cy(io,t,s),s=xt,(ve===null?s.memoizedState:ve.next)===null&&(s=s.alternate,P.H=s===null||s.memoizedState===null?Wy:$y),t}function Vd(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return iu(t);if(t.$$typeof===F)return Ze(t)}throw Error(n(438,String(t)))}function Qp(t){var s=null,a=xt.updateQueue;if(a!==null&&(s=a.memoCache),s==null){var r=xt.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(s={data:r.data.map(function(h){return h.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),a===null&&(a=Kp(),xt.updateQueue=a),a.memoCache=s,a=s.data[s.index],a===void 0)for(a=s.data[s.index]=Array(t),r=0;r<t;r++)a[r]=yt;return s.index++,a}function dn(t,s){return typeof s=="function"?s(t):s}function Kd(t){var s=ye();return Zp(s,Qt,t)}function Zp(t,s,a){var r=t.queue;if(r===null)throw Error(n(311));r.lastRenderedReducer=a;var h=t.baseQueue,p=r.pending;if(p!==null){if(h!==null){var A=h.next;h.next=p.next,p.next=A}s.baseQueue=h=p,r.pending=null}if(p=t.baseState,h===null)t.memoizedState=p;else{s=h.next;var T=A=null,R=null,z=s,G=!1;do{var K=z.lane&-536870913;if(K!==z.lane?(Ut&K)===K:(oa&K)===K){var U=z.revertLane;if(U===0)R!==null&&(R=R.next={lane:0,revertLane:0,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null}),K===$r&&(G=!0);else if((oa&U)===U){z=z.next,U===$r&&(G=!0);continue}else K={lane:0,revertLane:z.revertLane,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},R===null?(T=R=K,A=p):R=R.next=K,xt.lanes|=U,pa|=U;K=z.action,yl&&a(p,K),p=z.hasEagerState?z.eagerState:a(p,K)}else U={lane:K,revertLane:z.revertLane,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},R===null?(T=R=U,A=p):R=R.next=U,xt.lanes|=K,pa|=K;z=z.next}while(z!==null&&z!==s);if(R===null?A=p:R.next=T,!Ci(p,t.memoizedState)&&(Ne=!0,G&&(a=Jr,a!==null)))throw a;t.memoizedState=p,t.baseState=A,t.baseQueue=R,r.lastRenderedState=p}return h===null&&(r.lanes=0),[t.memoizedState,r.dispatch]}function Wp(t){var s=ye(),a=s.queue;if(a===null)throw Error(n(311));a.lastRenderedReducer=t;var r=a.dispatch,h=a.pending,p=s.memoizedState;if(h!==null){a.pending=null;var A=h=h.next;do p=t(p,A.action),A=A.next;while(A!==h);Ci(p,s.memoizedState)||(Ne=!0),s.memoizedState=p,s.baseQueue===null&&(s.baseState=p),a.lastRenderedState=p}return[p,r]}function by(t,s,a){var r=xt,h=ye(),p=Pt;if(p){if(a===void 0)throw Error(n(407));a=a()}else a=s();var A=!Ci((Qt||h).memoizedState,a);A&&(h.memoizedState=a,Ne=!0),h=h.queue;var T=Ay.bind(null,r,h,t);if(su(2048,8,T,[t]),h.getSnapshot!==s||A||ve!==null&&ve.memoizedState.tag&1){if(r.flags|=2048,so(9,Qd(),yy.bind(null,r,h,a,s),null),ee===null)throw Error(n(349));p||(oa&124)!==0||vy(r,s,a)}return a}function vy(t,s,a){t.flags|=16384,t={getSnapshot:s,value:a},s=xt.updateQueue,s===null?(s=Kp(),xt.updateQueue=s,s.stores=[t]):(a=s.stores,a===null?s.stores=[t]:a.push(t))}function yy(t,s,a,r){s.value=a,s.getSnapshot=r,Sy(s)&&_y(t)}function Ay(t,s,a){return a(function(){Sy(s)&&_y(t)})}function Sy(t){var s=t.getSnapshot;t=t.value;try{var a=s();return!Ci(t,a)}catch{return!0}}function _y(t){var s=Kr(t,2);s!==null&&Ni(s,t,2)}function $p(t){var s=pi();if(typeof t=="function"){var a=t;if(t=a(),yl){ea(!0);try{a()}finally{ea(!1)}}}return s.memoizedState=s.baseState=t,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:dn,lastRenderedState:t},s}function Ey(t,s,a,r){return t.baseState=a,Zp(t,Qt,typeof r=="function"?r:dn)}function jT(t,s,a,r,h){if(Wd(t))throw Error(n(485));if(t=s.action,t!==null){var p={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(A){p.listeners.push(A)}};P.T!==null?a(!0):p.isTransition=!1,r(p),a=s.pending,a===null?(p.next=s.pending=p,Ty(s,p)):(p.next=a.next,s.pending=a.next=p)}}function Ty(t,s){var a=s.action,r=s.payload,h=t.state;if(s.isTransition){var p=P.T,A={};P.T=A;try{var T=a(h,r),R=P.S;R!==null&&R(A,T),wy(t,s,T)}catch(z){Jp(t,s,z)}finally{P.T=p}}else try{p=a(h,r),wy(t,s,p)}catch(z){Jp(t,s,z)}}function wy(t,s,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){xy(t,s,r)},function(r){return Jp(t,s,r)}):xy(t,s,a)}function xy(t,s,a){s.status="fulfilled",s.value=a,Cy(s),t.state=a,s=t.pending,s!==null&&(a=s.next,a===s?t.pending=null:(a=a.next,s.next=a,Ty(t,a)))}function Jp(t,s,a){var r=t.pending;if(t.pending=null,r!==null){r=r.next;do s.status="rejected",s.reason=a,Cy(s),s=s.next;while(s!==r)}t.action=null}function Cy(t){t=t.listeners;for(var s=0;s<t.length;s++)(0,t[s])()}function My(t,s){return s}function Ry(t,s){if(Pt){var a=ee.formState;if(a!==null){t:{var r=xt;if(Pt){if(he){e:{for(var h=he,p=Os;h.nodeType!==8;){if(!p){h=null;break e}if(h=gs(h.nextSibling),h===null){h=null;break e}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){he=gs(h.nextSibling),r=h.data==="F!";break t}}pl(r)}r=!1}r&&(s=a[0])}}return a=pi(),a.memoizedState=a.baseState=s,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:My,lastRenderedState:s},a.queue=r,a=Ky.bind(null,xt,r),r.dispatch=a,r=$p(!1),p=nm.bind(null,xt,!1,r.queue),r=pi(),h={state:s,dispatch:null,action:t,pending:null},r.queue=h,a=jT.bind(null,xt,h,p,a),h.dispatch=a,r.memoizedState=t,[s,a,!1]}function Dy(t){var s=ye();return Ly(s,Qt,t)}function Ly(t,s,a){if(s=Zp(t,s,My)[0],t=Kd(dn)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var r=iu(s)}catch(A){throw A===Zc?jd:A}else r=s;s=ye();var h=s.queue,p=h.dispatch;return a!==s.memoizedState&&(xt.flags|=2048,so(9,Qd(),qT.bind(null,h,a),null)),[r,p,t]}function qT(t,s){t.action=s}function Oy(t){var s=ye(),a=Qt;if(a!==null)return Ly(s,a,t);ye(),s=s.memoizedState,a=ye();var r=a.queue.dispatch;return a.memoizedState=t,[s,r,!1]}function so(t,s,a,r){return t={tag:t,create:a,deps:r,inst:s,next:null},s=xt.updateQueue,s===null&&(s=Kp(),xt.updateQueue=s),a=s.lastEffect,a===null?s.lastEffect=t.next=t:(r=a.next,a.next=t,t.next=r,s.lastEffect=t),t}function Qd(){return{destroy:void 0,resource:void 0}}function Ny(){return ye().memoizedState}function Zd(t,s,a,r){var h=pi();r=r===void 0?null:r,xt.flags|=t,h.memoizedState=so(1|s,Qd(),a,r)}function su(t,s,a,r){var h=ye();r=r===void 0?null:r;var p=h.memoizedState.inst;Qt!==null&&r!==null&&qp(r,Qt.memoizedState.deps)?h.memoizedState=so(s,p,a,r):(xt.flags|=t,h.memoizedState=so(1|s,p,a,r))}function ky(t,s){Zd(8390656,8,t,s)}function zy(t,s){su(2048,8,t,s)}function Hy(t,s){return su(4,2,t,s)}function Fy(t,s){return su(4,4,t,s)}function Uy(t,s){if(typeof s=="function"){t=t();var a=s(t);return function(){typeof a=="function"?a():s(null)}}if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function By(t,s,a){a=a!=null?a.concat([t]):null,su(4,4,Uy.bind(null,s,t),a)}function tm(){}function Py(t,s){var a=ye();s=s===void 0?null:s;var r=a.memoizedState;return s!==null&&qp(s,r[1])?r[0]:(a.memoizedState=[t,s],t)}function Iy(t,s){var a=ye();s=s===void 0?null:s;var r=a.memoizedState;if(s!==null&&qp(s,r[1]))return r[0];if(r=t(),yl){ea(!0);try{t()}finally{ea(!1)}}return a.memoizedState=[r,s],r}function em(t,s,a){return a===void 0||(oa&1073741824)!==0?t.memoizedState=s:(t.memoizedState=a,t=GA(),xt.lanes|=t,pa|=t,a)}function jy(t,s,a,r){return Ci(a,s)?a:to.current!==null?(t=em(t,a,r),Ci(t,s)||(Ne=!0),t):(oa&42)===0?(Ne=!0,t.memoizedState=a):(t=GA(),xt.lanes|=t,pa|=t,s)}function qy(t,s,a,r,h){var p=X.p;X.p=p!==0&&8>p?p:8;var A=P.T,T={};P.T=T,nm(t,!1,s,a);try{var R=h(),z=P.S;if(z!==null&&z(T,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var G=BT(R,r);nu(t,s,G,Oi(t))}else nu(t,s,r,Oi(t))}catch(K){nu(t,s,{then:function(){},status:"rejected",reason:K},Oi())}finally{X.p=p,P.T=A}}function GT(){}function im(t,s,a,r){if(t.tag!==5)throw Error(n(476));var h=Gy(t).queue;qy(t,h,s,W,a===null?GT:function(){return Xy(t),a(r)})}function Gy(t){var s=t.memoizedState;if(s!==null)return s;s={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:dn,lastRenderedState:W},next:null};var a={};return s.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:dn,lastRenderedState:a},next:null},t.memoizedState=s,t=t.alternate,t!==null&&(t.memoizedState=s),s}function Xy(t){var s=Gy(t).next.queue;nu(t,s,{},Oi())}function sm(){return Ze(_u)}function Yy(){return ye().memoizedState}function Vy(){return ye().memoizedState}function XT(t){for(var s=t.return;s!==null;){switch(s.tag){case 24:case 3:var a=Oi();t=la(a);var r=ra(s,t,a);r!==null&&(Ni(r,s,a),$c(r,s,a)),s={cache:Np()},t.payload=s;return}s=s.return}}function YT(t,s,a){var r=Oi();a={lane:r,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null},Wd(t)?Qy(s,a):(a=Ep(t,s,a,r),a!==null&&(Ni(a,t,r),Zy(a,s,r)))}function Ky(t,s,a){var r=Oi();nu(t,s,a,r)}function nu(t,s,a,r){var h={lane:r,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null};if(Wd(t))Qy(s,h);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=s.lastRenderedReducer,p!==null))try{var A=s.lastRenderedState,T=p(A,a);if(h.hasEagerState=!0,h.eagerState=T,Ci(T,A))return kd(t,s,h,0),ee===null&&Nd(),!1}catch{}finally{}if(a=Ep(t,s,h,r),a!==null)return Ni(a,t,r),Zy(a,s,r),!0}return!1}function nm(t,s,a,r){if(r={lane:2,revertLane:Hm(),action:r,hasEagerState:!1,eagerState:null,next:null},Wd(t)){if(s)throw Error(n(479))}else s=Ep(t,a,r,2),s!==null&&Ni(s,t,2)}function Wd(t){var s=t.alternate;return t===xt||s!==null&&s===xt}function Qy(t,s){eo=Xd=!0;var a=t.pending;a===null?s.next=s:(s.next=a.next,a.next=s),t.pending=s}function Zy(t,s,a){if((a&4194048)!==0){var r=s.lanes;r&=t.pendingLanes,a|=r,s.lanes=a,nv(t,a)}}var $d={readContext:Ze,use:Vd,useCallback:ge,useContext:ge,useEffect:ge,useImperativeHandle:ge,useLayoutEffect:ge,useInsertionEffect:ge,useMemo:ge,useReducer:ge,useRef:ge,useState:ge,useDebugValue:ge,useDeferredValue:ge,useTransition:ge,useSyncExternalStore:ge,useId:ge,useHostTransitionStatus:ge,useFormState:ge,useActionState:ge,useOptimistic:ge,useMemoCache:ge,useCacheRefresh:ge},Wy={readContext:Ze,use:Vd,useCallback:function(t,s){return pi().memoizedState=[t,s===void 0?null:s],t},useContext:Ze,useEffect:ky,useImperativeHandle:function(t,s,a){a=a!=null?a.concat([t]):null,Zd(4194308,4,Uy.bind(null,s,t),a)},useLayoutEffect:function(t,s){return Zd(4194308,4,t,s)},useInsertionEffect:function(t,s){Zd(4,2,t,s)},useMemo:function(t,s){var a=pi();s=s===void 0?null:s;var r=t();if(yl){ea(!0);try{t()}finally{ea(!1)}}return a.memoizedState=[r,s],r},useReducer:function(t,s,a){var r=pi();if(a!==void 0){var h=a(s);if(yl){ea(!0);try{a(s)}finally{ea(!1)}}}else h=s;return r.memoizedState=r.baseState=h,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:h},r.queue=t,t=t.dispatch=YT.bind(null,xt,t),[r.memoizedState,t]},useRef:function(t){var s=pi();return t={current:t},s.memoizedState=t},useState:function(t){t=$p(t);var s=t.queue,a=Ky.bind(null,xt,s);return s.dispatch=a,[t.memoizedState,a]},useDebugValue:tm,useDeferredValue:function(t,s){var a=pi();return em(a,t,s)},useTransition:function(){var t=$p(!1);return t=qy.bind(null,xt,t.queue,!0,!1),pi().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,s,a){var r=xt,h=pi();if(Pt){if(a===void 0)throw Error(n(407));a=a()}else{if(a=s(),ee===null)throw Error(n(349));(Ut&124)!==0||vy(r,s,a)}h.memoizedState=a;var p={value:a,getSnapshot:s};return h.queue=p,ky(Ay.bind(null,r,p,t),[t]),r.flags|=2048,so(9,Qd(),yy.bind(null,r,p,a,s),null),a},useId:function(){var t=pi(),s=ee.identifierPrefix;if(Pt){var a=cn,r=on;a=(r&~(1<<32-xi(r)-1)).toString(32)+a,s="«"+s+"R"+a,a=Yd++,0<a&&(s+="H"+a.toString(32)),s+="»"}else a=PT++,s="«"+s+"r"+a.toString(32)+"»";return t.memoizedState=s},useHostTransitionStatus:sm,useFormState:Ry,useActionState:Ry,useOptimistic:function(t){var s=pi();s.memoizedState=s.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=a,s=nm.bind(null,xt,!0,a),a.dispatch=s,[t,s]},useMemoCache:Qp,useCacheRefresh:function(){return pi().memoizedState=XT.bind(null,xt)}},$y={readContext:Ze,use:Vd,useCallback:Py,useContext:Ze,useEffect:zy,useImperativeHandle:By,useInsertionEffect:Hy,useLayoutEffect:Fy,useMemo:Iy,useReducer:Kd,useRef:Ny,useState:function(){return Kd(dn)},useDebugValue:tm,useDeferredValue:function(t,s){var a=ye();return jy(a,Qt.memoizedState,t,s)},useTransition:function(){var t=Kd(dn)[0],s=ye().memoizedState;return[typeof t=="boolean"?t:iu(t),s]},useSyncExternalStore:by,useId:Yy,useHostTransitionStatus:sm,useFormState:Dy,useActionState:Dy,useOptimistic:function(t,s){var a=ye();return Ey(a,Qt,t,s)},useMemoCache:Qp,useCacheRefresh:Vy},VT={readContext:Ze,use:Vd,useCallback:Py,useContext:Ze,useEffect:zy,useImperativeHandle:By,useInsertionEffect:Hy,useLayoutEffect:Fy,useMemo:Iy,useReducer:Wp,useRef:Ny,useState:function(){return Wp(dn)},useDebugValue:tm,useDeferredValue:function(t,s){var a=ye();return Qt===null?em(a,t,s):jy(a,Qt.memoizedState,t,s)},useTransition:function(){var t=Wp(dn)[0],s=ye().memoizedState;return[typeof t=="boolean"?t:iu(t),s]},useSyncExternalStore:by,useId:Yy,useHostTransitionStatus:sm,useFormState:Oy,useActionState:Oy,useOptimistic:function(t,s){var a=ye();return Qt!==null?Ey(a,Qt,t,s):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:Qp,useCacheRefresh:Vy},no=null,au=0;function Jd(t){var s=au;return au+=1,no===null&&(no=[]),cy(no,t,s)}function lu(t,s){s=s.props.ref,t.ref=s!==void 0?s:null}function tf(t,s){throw s.$$typeof===v?Error(n(525)):(t=Object.prototype.toString.call(s),Error(n(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t)))}function Jy(t){var s=t._init;return s(t._payload)}function tA(t){function s(N,O){if(t){var k=N.deletions;k===null?(N.deletions=[O],N.flags|=16):k.push(O)}}function a(N,O){if(!t)return null;for(;O!==null;)s(N,O),O=O.sibling;return null}function r(N){for(var O=new Map;N!==null;)N.key!==null?O.set(N.key,N):O.set(N.index,N),N=N.sibling;return O}function h(N,O){return N=rn(N,O),N.index=0,N.sibling=null,N}function p(N,O,k){return N.index=k,t?(k=N.alternate,k!==null?(k=k.index,k<O?(N.flags|=67108866,O):k):(N.flags|=67108866,O)):(N.flags|=1048576,O)}function A(N){return t&&N.alternate===null&&(N.flags|=67108866),N}function T(N,O,k,Y){return O===null||O.tag!==6?(O=wp(k,N.mode,Y),O.return=N,O):(O=h(O,k),O.return=N,O)}function R(N,O,k,Y){var nt=k.type;return nt===x?G(N,O,k.props.children,Y,k.key):O!==null&&(O.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===J&&Jy(nt)===O.type)?(O=h(O,k.props),lu(O,k),O.return=N,O):(O=Hd(k.type,k.key,k.props,null,N.mode,Y),lu(O,k),O.return=N,O)}function z(N,O,k,Y){return O===null||O.tag!==4||O.stateNode.containerInfo!==k.containerInfo||O.stateNode.implementation!==k.implementation?(O=xp(k,N.mode,Y),O.return=N,O):(O=h(O,k.children||[]),O.return=N,O)}function G(N,O,k,Y,nt){return O===null||O.tag!==7?(O=hl(k,N.mode,Y,nt),O.return=N,O):(O=h(O,k),O.return=N,O)}function K(N,O,k){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=wp(""+O,N.mode,k),O.return=N,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case y:return k=Hd(O.type,O.key,O.props,null,N.mode,k),lu(k,O),k.return=N,k;case E:return O=xp(O,N.mode,k),O.return=N,O;case J:var Y=O._init;return O=Y(O._payload),K(N,O,k)}if(mt(O)||pt(O))return O=hl(O,N.mode,k,null),O.return=N,O;if(typeof O.then=="function")return K(N,Jd(O),k);if(O.$$typeof===F)return K(N,Pd(N,O),k);tf(N,O)}return null}function U(N,O,k,Y){var nt=O!==null?O.key:null;if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return nt!==null?null:T(N,O,""+k,Y);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case y:return k.key===nt?R(N,O,k,Y):null;case E:return k.key===nt?z(N,O,k,Y):null;case J:return nt=k._init,k=nt(k._payload),U(N,O,k,Y)}if(mt(k)||pt(k))return nt!==null?null:G(N,O,k,Y,null);if(typeof k.then=="function")return U(N,O,Jd(k),Y);if(k.$$typeof===F)return U(N,O,Pd(N,k),Y);tf(N,k)}return null}function B(N,O,k,Y,nt){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return N=N.get(k)||null,T(O,N,""+Y,nt);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case y:return N=N.get(Y.key===null?k:Y.key)||null,R(O,N,Y,nt);case E:return N=N.get(Y.key===null?k:Y.key)||null,z(O,N,Y,nt);case J:var Dt=Y._init;return Y=Dt(Y._payload),B(N,O,k,Y,nt)}if(mt(Y)||pt(Y))return N=N.get(k)||null,G(O,N,Y,nt,null);if(typeof Y.then=="function")return B(N,O,k,Jd(Y),nt);if(Y.$$typeof===F)return B(N,O,k,Pd(O,Y),nt);tf(O,Y)}return null}function gt(N,O,k,Y){for(var nt=null,Dt=null,ut=O,ft=O=0,ze=null;ut!==null&&ft<k.length;ft++){ut.index>ft?(ze=ut,ut=null):ze=ut.sibling;var Bt=U(N,ut,k[ft],Y);if(Bt===null){ut===null&&(ut=ze);break}t&&ut&&Bt.alternate===null&&s(N,ut),O=p(Bt,O,ft),Dt===null?nt=Bt:Dt.sibling=Bt,Dt=Bt,ut=ze}if(ft===k.length)return a(N,ut),Pt&&fl(N,ft),nt;if(ut===null){for(;ft<k.length;ft++)ut=K(N,k[ft],Y),ut!==null&&(O=p(ut,O,ft),Dt===null?nt=ut:Dt.sibling=ut,Dt=ut);return Pt&&fl(N,ft),nt}for(ut=r(ut);ft<k.length;ft++)ze=B(ut,N,ft,k[ft],Y),ze!==null&&(t&&ze.alternate!==null&&ut.delete(ze.key===null?ft:ze.key),O=p(ze,O,ft),Dt===null?nt=ze:Dt.sibling=ze,Dt=ze);return t&&ut.forEach(function(Ta){return s(N,Ta)}),Pt&&fl(N,ft),nt}function dt(N,O,k,Y){if(k==null)throw Error(n(151));for(var nt=null,Dt=null,ut=O,ft=O=0,ze=null,Bt=k.next();ut!==null&&!Bt.done;ft++,Bt=k.next()){ut.index>ft?(ze=ut,ut=null):ze=ut.sibling;var Ta=U(N,ut,Bt.value,Y);if(Ta===null){ut===null&&(ut=ze);break}t&&ut&&Ta.alternate===null&&s(N,ut),O=p(Ta,O,ft),Dt===null?nt=Ta:Dt.sibling=Ta,Dt=Ta,ut=ze}if(Bt.done)return a(N,ut),Pt&&fl(N,ft),nt;if(ut===null){for(;!Bt.done;ft++,Bt=k.next())Bt=K(N,Bt.value,Y),Bt!==null&&(O=p(Bt,O,ft),Dt===null?nt=Bt:Dt.sibling=Bt,Dt=Bt);return Pt&&fl(N,ft),nt}for(ut=r(ut);!Bt.done;ft++,Bt=k.next())Bt=B(ut,N,ft,Bt.value,Y),Bt!==null&&(t&&Bt.alternate!==null&&ut.delete(Bt.key===null?ft:Bt.key),O=p(Bt,O,ft),Dt===null?nt=Bt:Dt.sibling=Bt,Dt=Bt);return t&&ut.forEach(function(Kw){return s(N,Kw)}),Pt&&fl(N,ft),nt}function Wt(N,O,k,Y){if(typeof k=="object"&&k!==null&&k.type===x&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case y:t:{for(var nt=k.key;O!==null;){if(O.key===nt){if(nt=k.type,nt===x){if(O.tag===7){a(N,O.sibling),Y=h(O,k.props.children),Y.return=N,N=Y;break t}}else if(O.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===J&&Jy(nt)===O.type){a(N,O.sibling),Y=h(O,k.props),lu(Y,k),Y.return=N,N=Y;break t}a(N,O);break}else s(N,O);O=O.sibling}k.type===x?(Y=hl(k.props.children,N.mode,Y,k.key),Y.return=N,N=Y):(Y=Hd(k.type,k.key,k.props,null,N.mode,Y),lu(Y,k),Y.return=N,N=Y)}return A(N);case E:t:{for(nt=k.key;O!==null;){if(O.key===nt)if(O.tag===4&&O.stateNode.containerInfo===k.containerInfo&&O.stateNode.implementation===k.implementation){a(N,O.sibling),Y=h(O,k.children||[]),Y.return=N,N=Y;break t}else{a(N,O);break}else s(N,O);O=O.sibling}Y=xp(k,N.mode,Y),Y.return=N,N=Y}return A(N);case J:return nt=k._init,k=nt(k._payload),Wt(N,O,k,Y)}if(mt(k))return gt(N,O,k,Y);if(pt(k)){if(nt=pt(k),typeof nt!="function")throw Error(n(150));return k=nt.call(k),dt(N,O,k,Y)}if(typeof k.then=="function")return Wt(N,O,Jd(k),Y);if(k.$$typeof===F)return Wt(N,O,Pd(N,k),Y);tf(N,k)}return typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint"?(k=""+k,O!==null&&O.tag===6?(a(N,O.sibling),Y=h(O,k),Y.return=N,N=Y):(a(N,O),Y=wp(k,N.mode,Y),Y.return=N,N=Y),A(N)):a(N,O)}return function(N,O,k,Y){try{au=0;var nt=Wt(N,O,k,Y);return no=null,nt}catch(ut){if(ut===Zc||ut===jd)throw ut;var Dt=Mi(29,ut,null,N.mode);return Dt.lanes=Y,Dt.return=N,Dt}finally{}}}var ao=tA(!0),eA=tA(!1),Ji=V(null),Ns=null;function ca(t){var s=t.alternate;Z(Te,Te.current&1),Z(Ji,t),Ns===null&&(s===null||to.current!==null||s.memoizedState!==null)&&(Ns=t)}function iA(t){if(t.tag===22){if(Z(Te,Te.current),Z(Ji,t),Ns===null){var s=t.alternate;s!==null&&s.memoizedState!==null&&(Ns=t)}}else ua()}function ua(){Z(Te,Te.current),Z(Ji,Ji.current)}function fn(t){$(Ji),Ns===t&&(Ns=null),$(Te)}var Te=V(0);function ef(t){for(var s=t;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||Km(a)))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}function am(t,s,a,r){s=t.memoizedState,a=a(r,s),a=a==null?s:m({},s,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var lm={enqueueSetState:function(t,s,a){t=t._reactInternals;var r=Oi(),h=la(r);h.payload=s,a!=null&&(h.callback=a),s=ra(t,h,r),s!==null&&(Ni(s,t,r),$c(s,t,r))},enqueueReplaceState:function(t,s,a){t=t._reactInternals;var r=Oi(),h=la(r);h.tag=1,h.payload=s,a!=null&&(h.callback=a),s=ra(t,h,r),s!==null&&(Ni(s,t,r),$c(s,t,r))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var a=Oi(),r=la(a);r.tag=2,s!=null&&(r.callback=s),s=ra(t,r,a),s!==null&&(Ni(s,t,a),$c(s,t,a))}};function sA(t,s,a,r,h,p,A){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,p,A):s.prototype&&s.prototype.isPureReactComponent?!jc(a,r)||!jc(h,p):!0}function nA(t,s,a,r){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,r),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,r),s.state!==t&&lm.enqueueReplaceState(s,s.state,null)}function Al(t,s){var a=s;if("ref"in s){a={};for(var r in s)r!=="ref"&&(a[r]=s[r])}if(t=t.defaultProps){a===s&&(a=m({},a));for(var h in t)a[h]===void 0&&(a[h]=t[h])}return a}var sf=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)};function aA(t){sf(t)}function lA(t){console.error(t)}function rA(t){sf(t)}function nf(t,s){try{var a=t.onUncaughtError;a(s.value,{componentStack:s.stack})}catch(r){setTimeout(function(){throw r})}}function oA(t,s,a){try{var r=t.onCaughtError;r(a.value,{componentStack:a.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function rm(t,s,a){return a=la(a),a.tag=3,a.payload={element:null},a.callback=function(){nf(t,s)},a}function cA(t){return t=la(t),t.tag=3,t}function uA(t,s,a,r){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=r.value;t.payload=function(){return h(p)},t.callback=function(){oA(s,a,r)}}var A=a.stateNode;A!==null&&typeof A.componentDidCatch=="function"&&(t.callback=function(){oA(s,a,r),typeof h!="function"&&(ma===null?ma=new Set([this]):ma.add(this));var T=r.stack;this.componentDidCatch(r.value,{componentStack:T!==null?T:""})})}function KT(t,s,a,r,h){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(s=a.alternate,s!==null&&Vc(s,a,h,!0),a=Ji.current,a!==null){switch(a.tag){case 13:return Ns===null?Lm():a.alternate===null&&de===0&&(de=3),a.flags&=-257,a.flags|=65536,a.lanes=h,r===Hp?a.flags|=16384:(s=a.updateQueue,s===null?a.updateQueue=new Set([r]):s.add(r),Nm(t,r,h)),!1;case 22:return a.flags|=65536,r===Hp?a.flags|=16384:(s=a.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([r])},a.updateQueue=s):(a=s.retryQueue,a===null?s.retryQueue=new Set([r]):a.add(r)),Nm(t,r,h)),!1}throw Error(n(435,a.tag))}return Nm(t,r,h),Lm(),!1}if(Pt)return s=Ji.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=h,r!==Rp&&(t=Error(n(422),{cause:r}),Yc(Qi(t,a)))):(r!==Rp&&(s=Error(n(423),{cause:r}),Yc(Qi(s,a))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,r=Qi(r,a),h=rm(t.stateNode,r,h),Bp(t,h),de!==4&&(de=2)),!1;var p=Error(n(520),{cause:r});if(p=Qi(p,a),fu===null?fu=[p]:fu.push(p),de!==4&&(de=2),s===null)return!0;r=Qi(r,a),a=s;do{switch(a.tag){case 3:return a.flags|=65536,t=h&-h,a.lanes|=t,t=rm(a.stateNode,r,t),Bp(a,t),!1;case 1:if(s=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(ma===null||!ma.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=cA(h),uA(h,t,a,r),Bp(a,h),!1}a=a.return}while(a!==null);return!1}var hA=Error(n(461)),Ne=!1;function Ie(t,s,a,r){s.child=t===null?eA(s,null,a,r):ao(s,t.child,a,r)}function dA(t,s,a,r,h){a=a.render;var p=s.ref;if("ref"in r){var A={};for(var T in r)T!=="ref"&&(A[T]=r[T])}else A=r;return bl(s),r=Gp(t,s,a,A,p,h),T=Xp(),t!==null&&!Ne?(Yp(t,s,h),gn(t,s,h)):(Pt&&T&&Cp(s),s.flags|=1,Ie(t,s,r,h),s.child)}function fA(t,s,a,r,h){if(t===null){var p=a.type;return typeof p=="function"&&!Tp(p)&&p.defaultProps===void 0&&a.compare===null?(s.tag=15,s.type=p,gA(t,s,p,r,h)):(t=Hd(a.type,null,r,s,s.mode,h),t.ref=s.ref,t.return=s,s.child=t)}if(p=t.child,!pm(t,h)){var A=p.memoizedProps;if(a=a.compare,a=a!==null?a:jc,a(A,r)&&t.ref===s.ref)return gn(t,s,h)}return s.flags|=1,t=rn(p,r),t.ref=s.ref,t.return=s,s.child=t}function gA(t,s,a,r,h){if(t!==null){var p=t.memoizedProps;if(jc(p,r)&&t.ref===s.ref)if(Ne=!1,s.pendingProps=r=p,pm(t,h))(t.flags&131072)!==0&&(Ne=!0);else return s.lanes=t.lanes,gn(t,s,h)}return om(t,s,a,r,h)}function pA(t,s,a){var r=s.pendingProps,h=r.children,p=t!==null?t.memoizedState:null;if(r.mode==="hidden"){if((s.flags&128)!==0){if(r=p!==null?p.baseLanes|a:a,t!==null){for(h=s.child=t.child,p=0;h!==null;)p=p|h.lanes|h.childLanes,h=h.sibling;s.childLanes=p&~r}else s.childLanes=0,s.child=null;return mA(t,s,r,a)}if((a&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},t!==null&&Id(s,p!==null?p.cachePool:null),p!==null?gy(s,p):Ip(),iA(s);else return s.lanes=s.childLanes=536870912,mA(t,s,p!==null?p.baseLanes|a:a,a)}else p!==null?(Id(s,p.cachePool),gy(s,p),ua(),s.memoizedState=null):(t!==null&&Id(s,null),Ip(),ua());return Ie(t,s,h,a),s.child}function mA(t,s,a,r){var h=zp();return h=h===null?null:{parent:Ee._currentValue,pool:h},s.memoizedState={baseLanes:a,cachePool:h},t!==null&&Id(s,null),Ip(),iA(s),t!==null&&Vc(t,s,r,!0),null}function af(t,s){var a=s.ref;if(a===null)t!==null&&t.ref!==null&&(s.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(n(284));(t===null||t.ref!==a)&&(s.flags|=4194816)}}function om(t,s,a,r,h){return bl(s),a=Gp(t,s,a,r,void 0,h),r=Xp(),t!==null&&!Ne?(Yp(t,s,h),gn(t,s,h)):(Pt&&r&&Cp(s),s.flags|=1,Ie(t,s,a,h),s.child)}function bA(t,s,a,r,h,p){return bl(s),s.updateQueue=null,a=my(s,r,a,h),py(t),r=Xp(),t!==null&&!Ne?(Yp(t,s,p),gn(t,s,p)):(Pt&&r&&Cp(s),s.flags|=1,Ie(t,s,a,p),s.child)}function vA(t,s,a,r,h){if(bl(s),s.stateNode===null){var p=Qr,A=a.contextType;typeof A=="object"&&A!==null&&(p=Ze(A)),p=new a(r,p),s.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=lm,s.stateNode=p,p._reactInternals=s,p=s.stateNode,p.props=r,p.state=s.memoizedState,p.refs={},Fp(s),A=a.contextType,p.context=typeof A=="object"&&A!==null?Ze(A):Qr,p.state=s.memoizedState,A=a.getDerivedStateFromProps,typeof A=="function"&&(am(s,a,A,r),p.state=s.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(A=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),A!==p.state&&lm.enqueueReplaceState(p,p.state,null),tu(s,r,p,h),Jc(),p.state=s.memoizedState),typeof p.componentDidMount=="function"&&(s.flags|=4194308),r=!0}else if(t===null){p=s.stateNode;var T=s.memoizedProps,R=Al(a,T);p.props=R;var z=p.context,G=a.contextType;A=Qr,typeof G=="object"&&G!==null&&(A=Ze(G));var K=a.getDerivedStateFromProps;G=typeof K=="function"||typeof p.getSnapshotBeforeUpdate=="function",T=s.pendingProps!==T,G||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(T||z!==A)&&nA(s,p,r,A),aa=!1;var U=s.memoizedState;p.state=U,tu(s,r,p,h),Jc(),z=s.memoizedState,T||U!==z||aa?(typeof K=="function"&&(am(s,a,K,r),z=s.memoizedState),(R=aa||sA(s,a,R,r,U,z,A))?(G||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(s.flags|=4194308)):(typeof p.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=r,s.memoizedState=z),p.props=r,p.state=z,p.context=A,r=R):(typeof p.componentDidMount=="function"&&(s.flags|=4194308),r=!1)}else{p=s.stateNode,Up(t,s),A=s.memoizedProps,G=Al(a,A),p.props=G,K=s.pendingProps,U=p.context,z=a.contextType,R=Qr,typeof z=="object"&&z!==null&&(R=Ze(z)),T=a.getDerivedStateFromProps,(z=typeof T=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(A!==K||U!==R)&&nA(s,p,r,R),aa=!1,U=s.memoizedState,p.state=U,tu(s,r,p,h),Jc();var B=s.memoizedState;A!==K||U!==B||aa||t!==null&&t.dependencies!==null&&Bd(t.dependencies)?(typeof T=="function"&&(am(s,a,T,r),B=s.memoizedState),(G=aa||sA(s,a,G,r,U,B,R)||t!==null&&t.dependencies!==null&&Bd(t.dependencies))?(z||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(r,B,R),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(r,B,R)),typeof p.componentDidUpdate=="function"&&(s.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof p.componentDidUpdate!="function"||A===t.memoizedProps&&U===t.memoizedState||(s.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||A===t.memoizedProps&&U===t.memoizedState||(s.flags|=1024),s.memoizedProps=r,s.memoizedState=B),p.props=r,p.state=B,p.context=R,r=G):(typeof p.componentDidUpdate!="function"||A===t.memoizedProps&&U===t.memoizedState||(s.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||A===t.memoizedProps&&U===t.memoizedState||(s.flags|=1024),r=!1)}return p=r,af(t,s),r=(s.flags&128)!==0,p||r?(p=s.stateNode,a=r&&typeof a.getDerivedStateFromError!="function"?null:p.render(),s.flags|=1,t!==null&&r?(s.child=ao(s,t.child,null,h),s.child=ao(s,null,a,h)):Ie(t,s,a,h),s.memoizedState=p.state,t=s.child):t=gn(t,s,h),t}function yA(t,s,a,r){return Xc(),s.flags|=256,Ie(t,s,a,r),s.child}var cm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function um(t){return{baseLanes:t,cachePool:ly()}}function hm(t,s,a){return t=t!==null?t.childLanes&~a:0,s&&(t|=ts),t}function AA(t,s,a){var r=s.pendingProps,h=!1,p=(s.flags&128)!==0,A;if((A=p)||(A=t!==null&&t.memoizedState===null?!1:(Te.current&2)!==0),A&&(h=!0,s.flags&=-129),A=(s.flags&32)!==0,s.flags&=-33,t===null){if(Pt){if(h?ca(s):ua(),Pt){var T=he,R;if(R=T){t:{for(R=T,T=Os;R.nodeType!==8;){if(!T){T=null;break t}if(R=gs(R.nextSibling),R===null){T=null;break t}}T=R}T!==null?(s.memoizedState={dehydrated:T,treeContext:dl!==null?{id:on,overflow:cn}:null,retryLane:536870912,hydrationErrors:null},R=Mi(18,null,null,0),R.stateNode=T,R.return=s,s.child=R,ai=s,he=null,R=!0):R=!1}R||pl(s)}if(T=s.memoizedState,T!==null&&(T=T.dehydrated,T!==null))return Km(T)?s.lanes=32:s.lanes=536870912,null;fn(s)}return T=r.children,r=r.fallback,h?(ua(),h=s.mode,T=lf({mode:"hidden",children:T},h),r=hl(r,h,a,null),T.return=s,r.return=s,T.sibling=r,s.child=T,h=s.child,h.memoizedState=um(a),h.childLanes=hm(t,A,a),s.memoizedState=cm,r):(ca(s),dm(s,T))}if(R=t.memoizedState,R!==null&&(T=R.dehydrated,T!==null)){if(p)s.flags&256?(ca(s),s.flags&=-257,s=fm(t,s,a)):s.memoizedState!==null?(ua(),s.child=t.child,s.flags|=128,s=null):(ua(),h=r.fallback,T=s.mode,r=lf({mode:"visible",children:r.children},T),h=hl(h,T,a,null),h.flags|=2,r.return=s,h.return=s,r.sibling=h,s.child=r,ao(s,t.child,null,a),r=s.child,r.memoizedState=um(a),r.childLanes=hm(t,A,a),s.memoizedState=cm,s=h);else if(ca(s),Km(T)){if(A=T.nextSibling&&T.nextSibling.dataset,A)var z=A.dgst;A=z,r=Error(n(419)),r.stack="",r.digest=A,Yc({value:r,source:null,stack:null}),s=fm(t,s,a)}else if(Ne||Vc(t,s,a,!1),A=(a&t.childLanes)!==0,Ne||A){if(A=ee,A!==null&&(r=a&-a,r=(r&42)!==0?1:Qg(r),r=(r&(A.suspendedLanes|a))!==0?0:r,r!==0&&r!==R.retryLane))throw R.retryLane=r,Kr(t,r),Ni(A,t,r),hA;T.data==="$?"||Lm(),s=fm(t,s,a)}else T.data==="$?"?(s.flags|=192,s.child=t.child,s=null):(t=R.treeContext,he=gs(T.nextSibling),ai=s,Pt=!0,gl=null,Os=!1,t!==null&&(Wi[$i++]=on,Wi[$i++]=cn,Wi[$i++]=dl,on=t.id,cn=t.overflow,dl=s),s=dm(s,r.children),s.flags|=4096);return s}return h?(ua(),h=r.fallback,T=s.mode,R=t.child,z=R.sibling,r=rn(R,{mode:"hidden",children:r.children}),r.subtreeFlags=R.subtreeFlags&65011712,z!==null?h=rn(z,h):(h=hl(h,T,a,null),h.flags|=2),h.return=s,r.return=s,r.sibling=h,s.child=r,r=h,h=s.child,T=t.child.memoizedState,T===null?T=um(a):(R=T.cachePool,R!==null?(z=Ee._currentValue,R=R.parent!==z?{parent:z,pool:z}:R):R=ly(),T={baseLanes:T.baseLanes|a,cachePool:R}),h.memoizedState=T,h.childLanes=hm(t,A,a),s.memoizedState=cm,r):(ca(s),a=t.child,t=a.sibling,a=rn(a,{mode:"visible",children:r.children}),a.return=s,a.sibling=null,t!==null&&(A=s.deletions,A===null?(s.deletions=[t],s.flags|=16):A.push(t)),s.child=a,s.memoizedState=null,a)}function dm(t,s){return s=lf({mode:"visible",children:s},t.mode),s.return=t,t.child=s}function lf(t,s){return t=Mi(22,t,null,s),t.lanes=0,t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},t}function fm(t,s,a){return ao(s,t.child,null,a),t=dm(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function SA(t,s,a){t.lanes|=s;var r=t.alternate;r!==null&&(r.lanes|=s),Lp(t.return,s,a)}function gm(t,s,a,r,h){var p=t.memoizedState;p===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:r,tail:a,tailMode:h}:(p.isBackwards=s,p.rendering=null,p.renderingStartTime=0,p.last=r,p.tail=a,p.tailMode=h)}function _A(t,s,a){var r=s.pendingProps,h=r.revealOrder,p=r.tail;if(Ie(t,s,r.children,a),r=Te.current,(r&2)!==0)r=r&1|2,s.flags|=128;else{if(t!==null&&(t.flags&128)!==0)t:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&SA(t,a,s);else if(t.tag===19)SA(t,a,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break t;for(;t.sibling===null;){if(t.return===null||t.return===s)break t;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}switch(Z(Te,r),h){case"forwards":for(a=s.child,h=null;a!==null;)t=a.alternate,t!==null&&ef(t)===null&&(h=a),a=a.sibling;a=h,a===null?(h=s.child,s.child=null):(h=a.sibling,a.sibling=null),gm(s,!1,h,a,p);break;case"backwards":for(a=null,h=s.child,s.child=null;h!==null;){if(t=h.alternate,t!==null&&ef(t)===null){s.child=h;break}t=h.sibling,h.sibling=a,a=h,h=t}gm(s,!0,a,null,p);break;case"together":gm(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function gn(t,s,a){if(t!==null&&(s.dependencies=t.dependencies),pa|=s.lanes,(a&s.childLanes)===0)if(t!==null){if(Vc(t,s,a,!1),(a&s.childLanes)===0)return null}else return null;if(t!==null&&s.child!==t.child)throw Error(n(153));if(s.child!==null){for(t=s.child,a=rn(t,t.pendingProps),s.child=a,a.return=s;t.sibling!==null;)t=t.sibling,a=a.sibling=rn(t,t.pendingProps),a.return=s;a.sibling=null}return s.child}function pm(t,s){return(t.lanes&s)!==0?!0:(t=t.dependencies,!!(t!==null&&Bd(t)))}function QT(t,s,a){switch(s.tag){case 3:jt(s,s.stateNode.containerInfo),na(s,Ee,t.memoizedState.cache),Xc();break;case 27:case 5:Rc(s);break;case 4:jt(s,s.stateNode.containerInfo);break;case 10:na(s,s.type,s.memoizedProps.value);break;case 13:var r=s.memoizedState;if(r!==null)return r.dehydrated!==null?(ca(s),s.flags|=128,null):(a&s.child.childLanes)!==0?AA(t,s,a):(ca(s),t=gn(t,s,a),t!==null?t.sibling:null);ca(s);break;case 19:var h=(t.flags&128)!==0;if(r=(a&s.childLanes)!==0,r||(Vc(t,s,a,!1),r=(a&s.childLanes)!==0),h){if(r)return _A(t,s,a);s.flags|=128}if(h=s.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),Z(Te,Te.current),r)break;return null;case 22:case 23:return s.lanes=0,pA(t,s,a);case 24:na(s,Ee,t.memoizedState.cache)}return gn(t,s,a)}function EA(t,s,a){if(t!==null)if(t.memoizedProps!==s.pendingProps)Ne=!0;else{if(!pm(t,a)&&(s.flags&128)===0)return Ne=!1,QT(t,s,a);Ne=(t.flags&131072)!==0}else Ne=!1,Pt&&(s.flags&1048576)!==0&&Jv(s,Ud,s.index);switch(s.lanes=0,s.tag){case 16:t:{t=s.pendingProps;var r=s.elementType,h=r._init;if(r=h(r._payload),s.type=r,typeof r=="function")Tp(r)?(t=Al(r,t),s.tag=1,s=vA(null,s,r,t,a)):(s.tag=0,s=om(null,s,r,t,a));else{if(r!=null){if(h=r.$$typeof,h===I){s.tag=11,s=dA(null,s,r,t,a);break t}else if(h===Q){s.tag=14,s=fA(null,s,r,t,a);break t}}throw s=Ot(r)||r,Error(n(306,s,""))}}return s;case 0:return om(t,s,s.type,s.pendingProps,a);case 1:return r=s.type,h=Al(r,s.pendingProps),vA(t,s,r,h,a);case 3:t:{if(jt(s,s.stateNode.containerInfo),t===null)throw Error(n(387));r=s.pendingProps;var p=s.memoizedState;h=p.element,Up(t,s),tu(s,r,null,a);var A=s.memoizedState;if(r=A.cache,na(s,Ee,r),r!==p.cache&&Op(s,[Ee],a,!0),Jc(),r=A.element,p.isDehydrated)if(p={element:r,isDehydrated:!1,cache:A.cache},s.updateQueue.baseState=p,s.memoizedState=p,s.flags&256){s=yA(t,s,r,a);break t}else if(r!==h){h=Qi(Error(n(424)),s),Yc(h),s=yA(t,s,r,a);break t}else{switch(t=s.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(he=gs(t.firstChild),ai=s,Pt=!0,gl=null,Os=!0,a=eA(s,null,r,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Xc(),r===h){s=gn(t,s,a);break t}Ie(t,s,r,a)}s=s.child}return s;case 26:return af(t,s),t===null?(a=C1(s.type,null,s.pendingProps,null))?s.memoizedState=a:Pt||(a=s.type,t=s.pendingProps,r=Af(rt.current).createElement(a),r[Qe]=s,r[fi]=t,qe(r,a,t),Oe(r),s.stateNode=r):s.memoizedState=C1(s.type,t.memoizedProps,s.pendingProps,t.memoizedState),null;case 27:return Rc(s),t===null&&Pt&&(r=s.stateNode=T1(s.type,s.pendingProps,rt.current),ai=s,Os=!0,h=he,ya(s.type)?(Qm=h,he=gs(r.firstChild)):he=h),Ie(t,s,s.pendingProps.children,a),af(t,s),t===null&&(s.flags|=4194304),s.child;case 5:return t===null&&Pt&&((h=r=he)&&(r=Ew(r,s.type,s.pendingProps,Os),r!==null?(s.stateNode=r,ai=s,he=gs(r.firstChild),Os=!1,h=!0):h=!1),h||pl(s)),Rc(s),h=s.type,p=s.pendingProps,A=t!==null?t.memoizedProps:null,r=p.children,Xm(h,p)?r=null:A!==null&&Xm(h,A)&&(s.flags|=32),s.memoizedState!==null&&(h=Gp(t,s,IT,null,null,a),_u._currentValue=h),af(t,s),Ie(t,s,r,a),s.child;case 6:return t===null&&Pt&&((t=a=he)&&(a=Tw(a,s.pendingProps,Os),a!==null?(s.stateNode=a,ai=s,he=null,t=!0):t=!1),t||pl(s)),null;case 13:return AA(t,s,a);case 4:return jt(s,s.stateNode.containerInfo),r=s.pendingProps,t===null?s.child=ao(s,null,r,a):Ie(t,s,r,a),s.child;case 11:return dA(t,s,s.type,s.pendingProps,a);case 7:return Ie(t,s,s.pendingProps,a),s.child;case 8:return Ie(t,s,s.pendingProps.children,a),s.child;case 12:return Ie(t,s,s.pendingProps.children,a),s.child;case 10:return r=s.pendingProps,na(s,s.type,r.value),Ie(t,s,r.children,a),s.child;case 9:return h=s.type._context,r=s.pendingProps.children,bl(s),h=Ze(h),r=r(h),s.flags|=1,Ie(t,s,r,a),s.child;case 14:return fA(t,s,s.type,s.pendingProps,a);case 15:return gA(t,s,s.type,s.pendingProps,a);case 19:return _A(t,s,a);case 31:return r=s.pendingProps,a=s.mode,r={mode:r.mode,children:r.children},t===null?(a=lf(r,a),a.ref=s.ref,s.child=a,a.return=s,s=a):(a=rn(t.child,r),a.ref=s.ref,s.child=a,a.return=s,s=a),s;case 22:return pA(t,s,a);case 24:return bl(s),r=Ze(Ee),t===null?(h=zp(),h===null&&(h=ee,p=Np(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),s.memoizedState={parent:r,cache:h},Fp(s),na(s,Ee,h)):((t.lanes&a)!==0&&(Up(t,s),tu(s,null,null,a),Jc()),h=t.memoizedState,p=s.memoizedState,h.parent!==r?(h={parent:r,cache:r},s.memoizedState=h,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=h),na(s,Ee,r)):(r=p.cache,na(s,Ee,r),r!==h.cache&&Op(s,[Ee],a,!0))),Ie(t,s,s.pendingProps.children,a),s.child;case 29:throw s.pendingProps}throw Error(n(156,s.tag))}function pn(t){t.flags|=4}function TA(t,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!O1(s)){if(s=Ji.current,s!==null&&((Ut&4194048)===Ut?Ns!==null:(Ut&62914560)!==Ut&&(Ut&536870912)===0||s!==Ns))throw Wc=Hp,ry;t.flags|=8192}}function rf(t,s){s!==null&&(t.flags|=4),t.flags&16384&&(s=t.tag!==22?iv():536870912,t.lanes|=s,co|=s)}function ru(t,s){if(!Pt)switch(t.tailMode){case"hidden":s=t.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var r=null;a!==null;)a.alternate!==null&&(r=a),a=a.sibling;r===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function le(t){var s=t.alternate!==null&&t.alternate.child===t.child,a=0,r=0;if(s)for(var h=t.child;h!==null;)a|=h.lanes|h.childLanes,r|=h.subtreeFlags&65011712,r|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)a|=h.lanes|h.childLanes,r|=h.subtreeFlags,r|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=r,t.childLanes=a,s}function ZT(t,s,a){var r=s.pendingProps;switch(Mp(s),s.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return le(s),null;case 1:return le(s),null;case 3:return a=s.stateNode,r=null,t!==null&&(r=t.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),hn(Ee),Yi(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(Gc(s)?pn(s):t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,iy())),le(s),null;case 26:return a=s.memoizedState,t===null?(pn(s),a!==null?(le(s),TA(s,a)):(le(s),s.flags&=-16777217)):a?a!==t.memoizedState?(pn(s),le(s),TA(s,a)):(le(s),s.flags&=-16777217):(t.memoizedProps!==r&&pn(s),le(s),s.flags&=-16777217),null;case 27:bd(s),a=rt.current;var h=s.type;if(t!==null&&s.stateNode!=null)t.memoizedProps!==r&&pn(s);else{if(!r){if(s.stateNode===null)throw Error(n(166));return le(s),null}t=ot.current,Gc(s)?ty(s):(t=T1(h,r,a),s.stateNode=t,pn(s))}return le(s),null;case 5:if(bd(s),a=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==r&&pn(s);else{if(!r){if(s.stateNode===null)throw Error(n(166));return le(s),null}if(t=ot.current,Gc(s))ty(s);else{switch(h=Af(rt.current),t){case 1:t=h.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:t=h.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":t=h.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":t=h.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":t=h.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild);break;case"select":t=typeof r.is=="string"?h.createElement("select",{is:r.is}):h.createElement("select"),r.multiple?t.multiple=!0:r.size&&(t.size=r.size);break;default:t=typeof r.is=="string"?h.createElement(a,{is:r.is}):h.createElement(a)}}t[Qe]=s,t[fi]=r;t:for(h=s.child;h!==null;){if(h.tag===5||h.tag===6)t.appendChild(h.stateNode);else if(h.tag!==4&&h.tag!==27&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===s)break t;for(;h.sibling===null;){if(h.return===null||h.return===s)break t;h=h.return}h.sibling.return=h.return,h=h.sibling}s.stateNode=t;t:switch(qe(t,a,r),a){case"button":case"input":case"select":case"textarea":t=!!r.autoFocus;break t;case"img":t=!0;break t;default:t=!1}t&&pn(s)}}return le(s),s.flags&=-16777217,null;case 6:if(t&&s.stateNode!=null)t.memoizedProps!==r&&pn(s);else{if(typeof r!="string"&&s.stateNode===null)throw Error(n(166));if(t=rt.current,Gc(s)){if(t=s.stateNode,a=s.memoizedProps,r=null,h=ai,h!==null)switch(h.tag){case 27:case 5:r=h.memoizedProps}t[Qe]=s,t=!!(t.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||b1(t.nodeValue,a)),t||pl(s)}else t=Af(t).createTextNode(r),t[Qe]=s,s.stateNode=t}return le(s),null;case 13:if(r=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=Gc(s),r!==null&&r.dehydrated!==null){if(t===null){if(!h)throw Error(n(318));if(h=s.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(n(317));h[Qe]=s}else Xc(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;le(s),h=!1}else h=iy(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return s.flags&256?(fn(s),s):(fn(s),null)}if(fn(s),(s.flags&128)!==0)return s.lanes=a,s;if(a=r!==null,t=t!==null&&t.memoizedState!==null,a){r=s.child,h=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(h=r.alternate.memoizedState.cachePool.pool);var p=null;r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(p=r.memoizedState.cachePool.pool),p!==h&&(r.flags|=2048)}return a!==t&&a&&(s.child.flags|=8192),rf(s,s.updateQueue),le(s),null;case 4:return Yi(),t===null&&Pm(s.stateNode.containerInfo),le(s),null;case 10:return hn(s.type),le(s),null;case 19:if($(Te),h=s.memoizedState,h===null)return le(s),null;if(r=(s.flags&128)!==0,p=h.rendering,p===null)if(r)ru(h,!1);else{if(de!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(p=ef(t),p!==null){for(s.flags|=128,ru(h,!1),t=p.updateQueue,s.updateQueue=t,rf(s,t),s.subtreeFlags=0,t=a,a=s.child;a!==null;)$v(a,t),a=a.sibling;return Z(Te,Te.current&1|2),s.child}t=t.sibling}h.tail!==null&&Ls()>uf&&(s.flags|=128,r=!0,ru(h,!1),s.lanes=4194304)}else{if(!r)if(t=ef(p),t!==null){if(s.flags|=128,r=!0,t=t.updateQueue,s.updateQueue=t,rf(s,t),ru(h,!0),h.tail===null&&h.tailMode==="hidden"&&!p.alternate&&!Pt)return le(s),null}else 2*Ls()-h.renderingStartTime>uf&&a!==536870912&&(s.flags|=128,r=!0,ru(h,!1),s.lanes=4194304);h.isBackwards?(p.sibling=s.child,s.child=p):(t=h.last,t!==null?t.sibling=p:s.child=p,h.last=p)}return h.tail!==null?(s=h.tail,h.rendering=s,h.tail=s.sibling,h.renderingStartTime=Ls(),s.sibling=null,t=Te.current,Z(Te,r?t&1|2:t&1),s):(le(s),null);case 22:case 23:return fn(s),jp(),r=s.memoizedState!==null,t!==null?t.memoizedState!==null!==r&&(s.flags|=8192):r&&(s.flags|=8192),r?(a&536870912)!==0&&(s.flags&128)===0&&(le(s),s.subtreeFlags&6&&(s.flags|=8192)):le(s),a=s.updateQueue,a!==null&&rf(s,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==a&&(s.flags|=2048),t!==null&&$(vl),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),s.memoizedState.cache!==a&&(s.flags|=2048),hn(Ee),le(s),null;case 25:return null;case 30:return null}throw Error(n(156,s.tag))}function WT(t,s){switch(Mp(s),s.tag){case 1:return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return hn(Ee),Yi(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 26:case 27:case 5:return bd(s),null;case 13:if(fn(s),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(n(340));Xc()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return $(Te),null;case 4:return Yi(),null;case 10:return hn(s.type),null;case 22:case 23:return fn(s),jp(),t!==null&&$(vl),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 24:return hn(Ee),null;case 25:return null;default:return null}}function wA(t,s){switch(Mp(s),s.tag){case 3:hn(Ee),Yi();break;case 26:case 27:case 5:bd(s);break;case 4:Yi();break;case 13:fn(s);break;case 19:$(Te);break;case 10:hn(s.type);break;case 22:case 23:fn(s),jp(),t!==null&&$(vl);break;case 24:hn(Ee)}}function ou(t,s){try{var a=s.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var h=r.next;a=h;do{if((a.tag&t)===t){r=void 0;var p=a.create,A=a.inst;r=p(),A.destroy=r}a=a.next}while(a!==h)}}catch(T){te(s,s.return,T)}}function ha(t,s,a){try{var r=s.updateQueue,h=r!==null?r.lastEffect:null;if(h!==null){var p=h.next;r=p;do{if((r.tag&t)===t){var A=r.inst,T=A.destroy;if(T!==void 0){A.destroy=void 0,h=s;var R=a,z=T;try{z()}catch(G){te(h,R,G)}}}r=r.next}while(r!==p)}}catch(G){te(s,s.return,G)}}function xA(t){var s=t.updateQueue;if(s!==null){var a=t.stateNode;try{fy(s,a)}catch(r){te(t,t.return,r)}}}function CA(t,s,a){a.props=Al(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(r){te(t,s,r)}}function cu(t,s){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var r=t.stateNode;break;case 30:r=t.stateNode;break;default:r=t.stateNode}typeof a=="function"?t.refCleanup=a(r):a.current=r}}catch(h){te(t,s,h)}}function ks(t,s){var a=t.ref,r=t.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(h){te(t,s,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(h){te(t,s,h)}else a.current=null}function MA(t){var s=t.type,a=t.memoizedProps,r=t.stateNode;try{t:switch(s){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break t;case"img":a.src?r.src=a.src:a.srcSet&&(r.srcset=a.srcSet)}}catch(h){te(t,t.return,h)}}function mm(t,s,a){try{var r=t.stateNode;vw(r,t.type,a,s),r[fi]=s}catch(h){te(t,t.return,h)}}function RA(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ya(t.type)||t.tag===4}function bm(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||RA(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ya(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function vm(t,s,a){var r=t.tag;if(r===5||r===6)t=t.stateNode,s?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,s):(s=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,s.appendChild(t),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=yf));else if(r!==4&&(r===27&&ya(t.type)&&(a=t.stateNode,s=null),t=t.child,t!==null))for(vm(t,s,a),t=t.sibling;t!==null;)vm(t,s,a),t=t.sibling}function of(t,s,a){var r=t.tag;if(r===5||r===6)t=t.stateNode,s?a.insertBefore(t,s):a.appendChild(t);else if(r!==4&&(r===27&&ya(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(of(t,s,a),t=t.sibling;t!==null;)of(t,s,a),t=t.sibling}function DA(t){var s=t.stateNode,a=t.memoizedProps;try{for(var r=t.type,h=s.attributes;h.length;)s.removeAttributeNode(h[0]);qe(s,r,a),s[Qe]=t,s[fi]=a}catch(p){te(t,t.return,p)}}var mn=!1,pe=!1,ym=!1,LA=typeof WeakSet=="function"?WeakSet:Set,ke=null;function $T(t,s){if(t=t.containerInfo,qm=xf,t=jv(t),bp(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else t:{a=(a=t.ownerDocument)&&a.defaultView||window;var r=a.getSelection&&a.getSelection();if(r&&r.rangeCount!==0){a=r.anchorNode;var h=r.anchorOffset,p=r.focusNode;r=r.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break t}var A=0,T=-1,R=-1,z=0,G=0,K=t,U=null;e:for(;;){for(var B;K!==a||h!==0&&K.nodeType!==3||(T=A+h),K!==p||r!==0&&K.nodeType!==3||(R=A+r),K.nodeType===3&&(A+=K.nodeValue.length),(B=K.firstChild)!==null;)U=K,K=B;for(;;){if(K===t)break e;if(U===a&&++z===h&&(T=A),U===p&&++G===r&&(R=A),(B=K.nextSibling)!==null)break;K=U,U=K.parentNode}K=B}a=T===-1||R===-1?null:{start:T,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(Gm={focusedElem:t,selectionRange:a},xf=!1,ke=s;ke!==null;)if(s=ke,t=s.child,(s.subtreeFlags&1024)!==0&&t!==null)t.return=s,ke=t;else for(;ke!==null;){switch(s=ke,p=s.alternate,t=s.flags,s.tag){case 0:break;case 11:case 15:break;case 1:if((t&1024)!==0&&p!==null){t=void 0,a=s,h=p.memoizedProps,p=p.memoizedState,r=a.stateNode;try{var gt=Al(a.type,h,a.elementType===a.type);t=r.getSnapshotBeforeUpdate(gt,p),r.__reactInternalSnapshotBeforeUpdate=t}catch(dt){te(a,a.return,dt)}}break;case 3:if((t&1024)!==0){if(t=s.stateNode.containerInfo,a=t.nodeType,a===9)Vm(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Vm(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(n(163))}if(t=s.sibling,t!==null){t.return=s.return,ke=t;break}ke=s.return}}function OA(t,s,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:da(t,a),r&4&&ou(5,a);break;case 1:if(da(t,a),r&4)if(t=a.stateNode,s===null)try{t.componentDidMount()}catch(A){te(a,a.return,A)}else{var h=Al(a.type,s.memoizedProps);s=s.memoizedState;try{t.componentDidUpdate(h,s,t.__reactInternalSnapshotBeforeUpdate)}catch(A){te(a,a.return,A)}}r&64&&xA(a),r&512&&cu(a,a.return);break;case 3:if(da(t,a),r&64&&(t=a.updateQueue,t!==null)){if(s=null,a.child!==null)switch(a.child.tag){case 27:case 5:s=a.child.stateNode;break;case 1:s=a.child.stateNode}try{fy(t,s)}catch(A){te(a,a.return,A)}}break;case 27:s===null&&r&4&&DA(a);case 26:case 5:da(t,a),s===null&&r&4&&MA(a),r&512&&cu(a,a.return);break;case 12:da(t,a);break;case 13:da(t,a),r&4&&zA(t,a),r&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=rw.bind(null,a),ww(t,a))));break;case 22:if(r=a.memoizedState!==null||mn,!r){s=s!==null&&s.memoizedState!==null||pe,h=mn;var p=pe;mn=r,(pe=s)&&!p?fa(t,a,(a.subtreeFlags&8772)!==0):da(t,a),mn=h,pe=p}break;case 30:break;default:da(t,a)}}function NA(t){var s=t.alternate;s!==null&&(t.alternate=null,NA(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&$g(s)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var ne=null,mi=!1;function bn(t,s,a){for(a=a.child;a!==null;)kA(t,s,a),a=a.sibling}function kA(t,s,a){if(wi&&typeof wi.onCommitFiberUnmount=="function")try{wi.onCommitFiberUnmount(Dc,a)}catch{}switch(a.tag){case 26:pe||ks(a,s),bn(t,s,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:pe||ks(a,s);var r=ne,h=mi;ya(a.type)&&(ne=a.stateNode,mi=!1),bn(t,s,a),vu(a.stateNode),ne=r,mi=h;break;case 5:pe||ks(a,s);case 6:if(r=ne,h=mi,ne=null,bn(t,s,a),ne=r,mi=h,ne!==null)if(mi)try{(ne.nodeType===9?ne.body:ne.nodeName==="HTML"?ne.ownerDocument.body:ne).removeChild(a.stateNode)}catch(p){te(a,s,p)}else try{ne.removeChild(a.stateNode)}catch(p){te(a,s,p)}break;case 18:ne!==null&&(mi?(t=ne,_1(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),xu(t)):_1(ne,a.stateNode));break;case 4:r=ne,h=mi,ne=a.stateNode.containerInfo,mi=!0,bn(t,s,a),ne=r,mi=h;break;case 0:case 11:case 14:case 15:pe||ha(2,a,s),pe||ha(4,a,s),bn(t,s,a);break;case 1:pe||(ks(a,s),r=a.stateNode,typeof r.componentWillUnmount=="function"&&CA(a,s,r)),bn(t,s,a);break;case 21:bn(t,s,a);break;case 22:pe=(r=pe)||a.memoizedState!==null,bn(t,s,a),pe=r;break;default:bn(t,s,a)}}function zA(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{xu(t)}catch(a){te(s,s.return,a)}}function JT(t){switch(t.tag){case 13:case 19:var s=t.stateNode;return s===null&&(s=t.stateNode=new LA),s;case 22:return t=t.stateNode,s=t._retryCache,s===null&&(s=t._retryCache=new LA),s;default:throw Error(n(435,t.tag))}}function Am(t,s){var a=JT(t);s.forEach(function(r){var h=ow.bind(null,t,r);a.has(r)||(a.add(r),r.then(h,h))})}function Ri(t,s){var a=s.deletions;if(a!==null)for(var r=0;r<a.length;r++){var h=a[r],p=t,A=s,T=A;t:for(;T!==null;){switch(T.tag){case 27:if(ya(T.type)){ne=T.stateNode,mi=!1;break t}break;case 5:ne=T.stateNode,mi=!1;break t;case 3:case 4:ne=T.stateNode.containerInfo,mi=!0;break t}T=T.return}if(ne===null)throw Error(n(160));kA(p,A,h),ne=null,mi=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(s.subtreeFlags&13878)for(s=s.child;s!==null;)HA(s,t),s=s.sibling}var fs=null;function HA(t,s){var a=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Ri(s,t),Di(t),r&4&&(ha(3,t,t.return),ou(3,t),ha(5,t,t.return));break;case 1:Ri(s,t),Di(t),r&512&&(pe||a===null||ks(a,a.return)),r&64&&mn&&(t=t.updateQueue,t!==null&&(r=t.callbacks,r!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?r:a.concat(r))));break;case 26:var h=fs;if(Ri(s,t),Di(t),r&512&&(pe||a===null||ks(a,a.return)),r&4){var p=a!==null?a.memoizedState:null;if(r=t.memoizedState,a===null)if(r===null)if(t.stateNode===null){t:{r=t.type,a=t.memoizedProps,h=h.ownerDocument||h;e:switch(r){case"title":p=h.getElementsByTagName("title")[0],(!p||p[Nc]||p[Qe]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(r),h.head.insertBefore(p,h.querySelector("head > title"))),qe(p,r,a),p[Qe]=t,Oe(p),r=p;break t;case"link":var A=D1("link","href",h).get(r+(a.href||""));if(A){for(var T=0;T<A.length;T++)if(p=A[T],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){A.splice(T,1);break e}}p=h.createElement(r),qe(p,r,a),h.head.appendChild(p);break;case"meta":if(A=D1("meta","content",h).get(r+(a.content||""))){for(T=0;T<A.length;T++)if(p=A[T],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){A.splice(T,1);break e}}p=h.createElement(r),qe(p,r,a),h.head.appendChild(p);break;default:throw Error(n(468,r))}p[Qe]=t,Oe(p),r=p}t.stateNode=r}else L1(h,t.type,t.stateNode);else t.stateNode=R1(h,r,t.memoizedProps);else p!==r?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,r===null?L1(h,t.type,t.stateNode):R1(h,r,t.memoizedProps)):r===null&&t.stateNode!==null&&mm(t,t.memoizedProps,a.memoizedProps)}break;case 27:Ri(s,t),Di(t),r&512&&(pe||a===null||ks(a,a.return)),a!==null&&r&4&&mm(t,t.memoizedProps,a.memoizedProps);break;case 5:if(Ri(s,t),Di(t),r&512&&(pe||a===null||ks(a,a.return)),t.flags&32){h=t.stateNode;try{Ir(h,"")}catch(B){te(t,t.return,B)}}r&4&&t.stateNode!=null&&(h=t.memoizedProps,mm(t,h,a!==null?a.memoizedProps:h)),r&1024&&(ym=!0);break;case 6:if(Ri(s,t),Di(t),r&4){if(t.stateNode===null)throw Error(n(162));r=t.memoizedProps,a=t.stateNode;try{a.nodeValue=r}catch(B){te(t,t.return,B)}}break;case 3:if(Ef=null,h=fs,fs=Sf(s.containerInfo),Ri(s,t),fs=h,Di(t),r&4&&a!==null&&a.memoizedState.isDehydrated)try{xu(s.containerInfo)}catch(B){te(t,t.return,B)}ym&&(ym=!1,FA(t));break;case 4:r=fs,fs=Sf(t.stateNode.containerInfo),Ri(s,t),Di(t),fs=r;break;case 12:Ri(s,t),Di(t);break;case 13:Ri(s,t),Di(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(xm=Ls()),r&4&&(r=t.updateQueue,r!==null&&(t.updateQueue=null,Am(t,r)));break;case 22:h=t.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,z=mn,G=pe;if(mn=z||h,pe=G||R,Ri(s,t),pe=G,mn=z,Di(t),r&8192)t:for(s=t.stateNode,s._visibility=h?s._visibility&-2:s._visibility|1,h&&(a===null||R||mn||pe||Sl(t)),a=null,s=t;;){if(s.tag===5||s.tag===26){if(a===null){R=a=s;try{if(p=R.stateNode,h)A=p.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none";else{T=R.stateNode;var K=R.memoizedProps.style,U=K!=null&&K.hasOwnProperty("display")?K.display:null;T.style.display=U==null||typeof U=="boolean"?"":(""+U).trim()}}catch(B){te(R,R.return,B)}}}else if(s.tag===6){if(a===null){R=s;try{R.stateNode.nodeValue=h?"":R.memoizedProps}catch(B){te(R,R.return,B)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===t)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break t;for(;s.sibling===null;){if(s.return===null||s.return===t)break t;a===s&&(a=null),s=s.return}a===s&&(a=null),s.sibling.return=s.return,s=s.sibling}r&4&&(r=t.updateQueue,r!==null&&(a=r.retryQueue,a!==null&&(r.retryQueue=null,Am(t,a))));break;case 19:Ri(s,t),Di(t),r&4&&(r=t.updateQueue,r!==null&&(t.updateQueue=null,Am(t,r)));break;case 30:break;case 21:break;default:Ri(s,t),Di(t)}}function Di(t){var s=t.flags;if(s&2){try{for(var a,r=t.return;r!==null;){if(RA(r)){a=r;break}r=r.return}if(a==null)throw Error(n(160));switch(a.tag){case 27:var h=a.stateNode,p=bm(t);of(t,p,h);break;case 5:var A=a.stateNode;a.flags&32&&(Ir(A,""),a.flags&=-33);var T=bm(t);of(t,T,A);break;case 3:case 4:var R=a.stateNode.containerInfo,z=bm(t);vm(t,z,R);break;default:throw Error(n(161))}}catch(G){te(t,t.return,G)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function FA(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var s=t;FA(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),t=t.sibling}}function da(t,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)OA(t,s.alternate,s),s=s.sibling}function Sl(t){for(t=t.child;t!==null;){var s=t;switch(s.tag){case 0:case 11:case 14:case 15:ha(4,s,s.return),Sl(s);break;case 1:ks(s,s.return);var a=s.stateNode;typeof a.componentWillUnmount=="function"&&CA(s,s.return,a),Sl(s);break;case 27:vu(s.stateNode);case 26:case 5:ks(s,s.return),Sl(s);break;case 22:s.memoizedState===null&&Sl(s);break;case 30:Sl(s);break;default:Sl(s)}t=t.sibling}}function fa(t,s,a){for(a=a&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var r=s.alternate,h=t,p=s,A=p.flags;switch(p.tag){case 0:case 11:case 15:fa(h,p,a),ou(4,p);break;case 1:if(fa(h,p,a),r=p,h=r.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(z){te(r,r.return,z)}if(r=p,h=r.updateQueue,h!==null){var T=r.stateNode;try{var R=h.shared.hiddenCallbacks;if(R!==null)for(h.shared.hiddenCallbacks=null,h=0;h<R.length;h++)dy(R[h],T)}catch(z){te(r,r.return,z)}}a&&A&64&&xA(p),cu(p,p.return);break;case 27:DA(p);case 26:case 5:fa(h,p,a),a&&r===null&&A&4&&MA(p),cu(p,p.return);break;case 12:fa(h,p,a);break;case 13:fa(h,p,a),a&&A&4&&zA(h,p);break;case 22:p.memoizedState===null&&fa(h,p,a),cu(p,p.return);break;case 30:break;default:fa(h,p,a)}s=s.sibling}}function Sm(t,s){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(t=s.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&Kc(a))}function _m(t,s){t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&Kc(t))}function zs(t,s,a,r){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)UA(t,s,a,r),s=s.sibling}function UA(t,s,a,r){var h=s.flags;switch(s.tag){case 0:case 11:case 15:zs(t,s,a,r),h&2048&&ou(9,s);break;case 1:zs(t,s,a,r);break;case 3:zs(t,s,a,r),h&2048&&(t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&Kc(t)));break;case 12:if(h&2048){zs(t,s,a,r),t=s.stateNode;try{var p=s.memoizedProps,A=p.id,T=p.onPostCommit;typeof T=="function"&&T(A,s.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(R){te(s,s.return,R)}}else zs(t,s,a,r);break;case 13:zs(t,s,a,r);break;case 23:break;case 22:p=s.stateNode,A=s.alternate,s.memoizedState!==null?p._visibility&2?zs(t,s,a,r):uu(t,s):p._visibility&2?zs(t,s,a,r):(p._visibility|=2,lo(t,s,a,r,(s.subtreeFlags&10256)!==0)),h&2048&&Sm(A,s);break;case 24:zs(t,s,a,r),h&2048&&_m(s.alternate,s);break;default:zs(t,s,a,r)}}function lo(t,s,a,r,h){for(h=h&&(s.subtreeFlags&10256)!==0,s=s.child;s!==null;){var p=t,A=s,T=a,R=r,z=A.flags;switch(A.tag){case 0:case 11:case 15:lo(p,A,T,R,h),ou(8,A);break;case 23:break;case 22:var G=A.stateNode;A.memoizedState!==null?G._visibility&2?lo(p,A,T,R,h):uu(p,A):(G._visibility|=2,lo(p,A,T,R,h)),h&&z&2048&&Sm(A.alternate,A);break;case 24:lo(p,A,T,R,h),h&&z&2048&&_m(A.alternate,A);break;default:lo(p,A,T,R,h)}s=s.sibling}}function uu(t,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var a=t,r=s,h=r.flags;switch(r.tag){case 22:uu(a,r),h&2048&&Sm(r.alternate,r);break;case 24:uu(a,r),h&2048&&_m(r.alternate,r);break;default:uu(a,r)}s=s.sibling}}var hu=8192;function ro(t){if(t.subtreeFlags&hu)for(t=t.child;t!==null;)BA(t),t=t.sibling}function BA(t){switch(t.tag){case 26:ro(t),t.flags&hu&&t.memoizedState!==null&&Uw(fs,t.memoizedState,t.memoizedProps);break;case 5:ro(t);break;case 3:case 4:var s=fs;fs=Sf(t.stateNode.containerInfo),ro(t),fs=s;break;case 22:t.memoizedState===null&&(s=t.alternate,s!==null&&s.memoizedState!==null?(s=hu,hu=16777216,ro(t),hu=s):ro(t));break;default:ro(t)}}function PA(t){var s=t.alternate;if(s!==null&&(t=s.child,t!==null)){s.child=null;do s=t.sibling,t.sibling=null,t=s;while(t!==null)}}function du(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var r=s[a];ke=r,jA(r,t)}PA(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)IA(t),t=t.sibling}function IA(t){switch(t.tag){case 0:case 11:case 15:du(t),t.flags&2048&&ha(9,t,t.return);break;case 3:du(t);break;case 12:du(t);break;case 22:var s=t.stateNode;t.memoizedState!==null&&s._visibility&2&&(t.return===null||t.return.tag!==13)?(s._visibility&=-3,cf(t)):du(t);break;default:du(t)}}function cf(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var r=s[a];ke=r,jA(r,t)}PA(t)}for(t=t.child;t!==null;){switch(s=t,s.tag){case 0:case 11:case 15:ha(8,s,s.return),cf(s);break;case 22:a=s.stateNode,a._visibility&2&&(a._visibility&=-3,cf(s));break;default:cf(s)}t=t.sibling}}function jA(t,s){for(;ke!==null;){var a=ke;switch(a.tag){case 0:case 11:case 15:ha(8,a,s);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var r=a.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Kc(a.memoizedState.cache)}if(r=a.child,r!==null)r.return=a,ke=r;else t:for(a=t;ke!==null;){r=ke;var h=r.sibling,p=r.return;if(NA(r),r===a){ke=null;break t}if(h!==null){h.return=p,ke=h;break t}ke=p}}}var tw={getCacheForType:function(t){var s=Ze(Ee),a=s.data.get(t);return a===void 0&&(a=t(),s.data.set(t,a)),a}},ew=typeof WeakMap=="function"?WeakMap:Map,Gt=0,ee=null,Nt=null,Ut=0,Xt=0,Li=null,ga=!1,oo=!1,Em=!1,vn=0,de=0,pa=0,_l=0,Tm=0,ts=0,co=0,fu=null,bi=null,wm=!1,xm=0,uf=1/0,hf=null,ma=null,je=0,ba=null,uo=null,ho=0,Cm=0,Mm=null,qA=null,gu=0,Rm=null;function Oi(){if((Gt&2)!==0&&Ut!==0)return Ut&-Ut;if(P.T!==null){var t=$r;return t!==0?t:Hm()}return av()}function GA(){ts===0&&(ts=(Ut&536870912)===0||Pt?ev():536870912);var t=Ji.current;return t!==null&&(t.flags|=32),ts}function Ni(t,s,a){(t===ee&&(Xt===2||Xt===9)||t.cancelPendingCommit!==null)&&(fo(t,0),va(t,Ut,ts,!1)),Oc(t,a),((Gt&2)===0||t!==ee)&&(t===ee&&((Gt&2)===0&&(_l|=a),de===4&&va(t,Ut,ts,!1)),Hs(t))}function XA(t,s,a){if((Gt&6)!==0)throw Error(n(327));var r=!a&&(s&124)===0&&(s&t.expiredLanes)===0||Lc(t,s),h=r?nw(t,s):Om(t,s,!0),p=r;do{if(h===0){oo&&!r&&va(t,s,0,!1);break}else{if(a=t.current.alternate,p&&!iw(a)){h=Om(t,s,!1),p=!1;continue}if(h===2){if(p=s,t.errorRecoveryDisabledLanes&p)var A=0;else A=t.pendingLanes&-536870913,A=A!==0?A:A&536870912?536870912:0;if(A!==0){s=A;t:{var T=t;h=fu;var R=T.current.memoizedState.isDehydrated;if(R&&(fo(T,A).flags|=256),A=Om(T,A,!1),A!==2){if(Em&&!R){T.errorRecoveryDisabledLanes|=p,_l|=p,h=4;break t}p=bi,bi=h,p!==null&&(bi===null?bi=p:bi.push.apply(bi,p))}h=A}if(p=!1,h!==2)continue}}if(h===1){fo(t,0),va(t,s,0,!0);break}t:{switch(r=t,p=h,p){case 0:case 1:throw Error(n(345));case 4:if((s&4194048)!==s)break;case 6:va(r,s,ts,!ga);break t;case 2:bi=null;break;case 3:case 5:break;default:throw Error(n(329))}if((s&62914560)===s&&(h=xm+300-Ls(),10<h)){if(va(r,s,ts,!ga),Sd(r,0,!0)!==0)break t;r.timeoutHandle=A1(YA.bind(null,r,a,bi,hf,wm,s,ts,_l,co,ga,p,2,-0,0),h);break t}YA(r,a,bi,hf,wm,s,ts,_l,co,ga,p,0,-0,0)}}break}while(!0);Hs(t)}function YA(t,s,a,r,h,p,A,T,R,z,G,K,U,B){if(t.timeoutHandle=-1,K=s.subtreeFlags,(K&8192||(K&16785408)===16785408)&&(Su={stylesheets:null,count:0,unsuspend:Fw},BA(s),K=Bw(),K!==null)){t.cancelPendingCommit=K(JA.bind(null,t,s,p,a,r,h,A,T,R,G,1,U,B)),va(t,p,A,!z);return}JA(t,s,p,a,r,h,A,T,R)}function iw(t){for(var s=t;;){var a=s.tag;if((a===0||a===11||a===15)&&s.flags&16384&&(a=s.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var r=0;r<a.length;r++){var h=a[r],p=h.getSnapshot;h=h.value;try{if(!Ci(p(),h))return!1}catch{return!1}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function va(t,s,a,r){s&=~Tm,s&=~_l,t.suspendedLanes|=s,t.pingedLanes&=~s,r&&(t.warmLanes|=s),r=t.expirationTimes;for(var h=s;0<h;){var p=31-xi(h),A=1<<p;r[p]=-1,h&=~A}a!==0&&sv(t,a,s)}function df(){return(Gt&6)===0?(pu(0),!1):!0}function Dm(){if(Nt!==null){if(Xt===0)var t=Nt.return;else t=Nt,un=ml=null,Vp(t),no=null,au=0,t=Nt;for(;t!==null;)wA(t.alternate,t),t=t.return;Nt=null}}function fo(t,s){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,Aw(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Dm(),ee=t,Nt=a=rn(t.current,null),Ut=s,Xt=0,Li=null,ga=!1,oo=Lc(t,s),Em=!1,co=ts=Tm=_l=pa=de=0,bi=fu=null,wm=!1,(s&8)!==0&&(s|=s&32);var r=t.entangledLanes;if(r!==0)for(t=t.entanglements,r&=s;0<r;){var h=31-xi(r),p=1<<h;s|=t[h],r&=~p}return vn=s,Nd(),a}function VA(t,s){xt=null,P.H=$d,s===Zc||s===jd?(s=uy(),Xt=3):s===ry?(s=uy(),Xt=4):Xt=s===hA?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Li=s,Nt===null&&(de=1,nf(t,Qi(s,t.current)))}function KA(){var t=P.H;return P.H=$d,t===null?$d:t}function QA(){var t=P.A;return P.A=tw,t}function Lm(){de=4,ga||(Ut&4194048)!==Ut&&Ji.current!==null||(oo=!0),(pa&134217727)===0&&(_l&134217727)===0||ee===null||va(ee,Ut,ts,!1)}function Om(t,s,a){var r=Gt;Gt|=2;var h=KA(),p=QA();(ee!==t||Ut!==s)&&(hf=null,fo(t,s)),s=!1;var A=de;t:do try{if(Xt!==0&&Nt!==null){var T=Nt,R=Li;switch(Xt){case 8:Dm(),A=6;break t;case 3:case 2:case 9:case 6:Ji.current===null&&(s=!0);var z=Xt;if(Xt=0,Li=null,go(t,T,R,z),a&&oo){A=0;break t}break;default:z=Xt,Xt=0,Li=null,go(t,T,R,z)}}sw(),A=de;break}catch(G){VA(t,G)}while(!0);return s&&t.shellSuspendCounter++,un=ml=null,Gt=r,P.H=h,P.A=p,Nt===null&&(ee=null,Ut=0,Nd()),A}function sw(){for(;Nt!==null;)ZA(Nt)}function nw(t,s){var a=Gt;Gt|=2;var r=KA(),h=QA();ee!==t||Ut!==s?(hf=null,uf=Ls()+500,fo(t,s)):oo=Lc(t,s);t:do try{if(Xt!==0&&Nt!==null){s=Nt;var p=Li;e:switch(Xt){case 1:Xt=0,Li=null,go(t,s,p,1);break;case 2:case 9:if(oy(p)){Xt=0,Li=null,WA(s);break}s=function(){Xt!==2&&Xt!==9||ee!==t||(Xt=7),Hs(t)},p.then(s,s);break t;case 3:Xt=7;break t;case 4:Xt=5;break t;case 7:oy(p)?(Xt=0,Li=null,WA(s)):(Xt=0,Li=null,go(t,s,p,7));break;case 5:var A=null;switch(Nt.tag){case 26:A=Nt.memoizedState;case 5:case 27:var T=Nt;if(!A||O1(A)){Xt=0,Li=null;var R=T.sibling;if(R!==null)Nt=R;else{var z=T.return;z!==null?(Nt=z,ff(z)):Nt=null}break e}}Xt=0,Li=null,go(t,s,p,5);break;case 6:Xt=0,Li=null,go(t,s,p,6);break;case 8:Dm(),de=6;break t;default:throw Error(n(462))}}aw();break}catch(G){VA(t,G)}while(!0);return un=ml=null,P.H=r,P.A=h,Gt=a,Nt!==null?0:(ee=null,Ut=0,Nd(),de)}function aw(){for(;Nt!==null&&!CE();)ZA(Nt)}function ZA(t){var s=EA(t.alternate,t,vn);t.memoizedProps=t.pendingProps,s===null?ff(t):Nt=s}function WA(t){var s=t,a=s.alternate;switch(s.tag){case 15:case 0:s=bA(a,s,s.pendingProps,s.type,void 0,Ut);break;case 11:s=bA(a,s,s.pendingProps,s.type.render,s.ref,Ut);break;case 5:Vp(s);default:wA(a,s),s=Nt=$v(s,vn),s=EA(a,s,vn)}t.memoizedProps=t.pendingProps,s===null?ff(t):Nt=s}function go(t,s,a,r){un=ml=null,Vp(s),no=null,au=0;var h=s.return;try{if(KT(t,h,s,a,Ut)){de=1,nf(t,Qi(a,t.current)),Nt=null;return}}catch(p){if(h!==null)throw Nt=h,p;de=1,nf(t,Qi(a,t.current)),Nt=null;return}s.flags&32768?(Pt||r===1?t=!0:oo||(Ut&536870912)!==0?t=!1:(ga=t=!0,(r===2||r===9||r===3||r===6)&&(r=Ji.current,r!==null&&r.tag===13&&(r.flags|=16384))),$A(s,t)):ff(s)}function ff(t){var s=t;do{if((s.flags&32768)!==0){$A(s,ga);return}t=s.return;var a=ZT(s.alternate,s,vn);if(a!==null){Nt=a;return}if(s=s.sibling,s!==null){Nt=s;return}Nt=s=t}while(s!==null);de===0&&(de=5)}function $A(t,s){do{var a=WT(t.alternate,t);if(a!==null){a.flags&=32767,Nt=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!s&&(t=t.sibling,t!==null)){Nt=t;return}Nt=t=a}while(t!==null);de=6,Nt=null}function JA(t,s,a,r,h,p,A,T,R){t.cancelPendingCommit=null;do gf();while(je!==0);if((Gt&6)!==0)throw Error(n(327));if(s!==null){if(s===t.current)throw Error(n(177));if(p=s.lanes|s.childLanes,p|=_p,FE(t,a,p,A,T,R),t===ee&&(Nt=ee=null,Ut=0),uo=s,ba=t,ho=a,Cm=p,Mm=h,qA=r,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,cw(vd,function(){return n1(),null})):(t.callbackNode=null,t.callbackPriority=0),r=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||r){r=P.T,P.T=null,h=X.p,X.p=2,A=Gt,Gt|=4;try{$T(t,s,a)}finally{Gt=A,X.p=h,P.T=r}}je=1,t1(),e1(),i1()}}function t1(){if(je===1){je=0;var t=ba,s=uo,a=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||a){a=P.T,P.T=null;var r=X.p;X.p=2;var h=Gt;Gt|=4;try{HA(s,t);var p=Gm,A=jv(t.containerInfo),T=p.focusedElem,R=p.selectionRange;if(A!==T&&T&&T.ownerDocument&&Iv(T.ownerDocument.documentElement,T)){if(R!==null&&bp(T)){var z=R.start,G=R.end;if(G===void 0&&(G=z),"selectionStart"in T)T.selectionStart=z,T.selectionEnd=Math.min(G,T.value.length);else{var K=T.ownerDocument||document,U=K&&K.defaultView||window;if(U.getSelection){var B=U.getSelection(),gt=T.textContent.length,dt=Math.min(R.start,gt),Wt=R.end===void 0?dt:Math.min(R.end,gt);!B.extend&&dt>Wt&&(A=Wt,Wt=dt,dt=A);var N=Pv(T,dt),O=Pv(T,Wt);if(N&&O&&(B.rangeCount!==1||B.anchorNode!==N.node||B.anchorOffset!==N.offset||B.focusNode!==O.node||B.focusOffset!==O.offset)){var k=K.createRange();k.setStart(N.node,N.offset),B.removeAllRanges(),dt>Wt?(B.addRange(k),B.extend(O.node,O.offset)):(k.setEnd(O.node,O.offset),B.addRange(k))}}}}for(K=[],B=T;B=B.parentNode;)B.nodeType===1&&K.push({element:B,left:B.scrollLeft,top:B.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<K.length;T++){var Y=K[T];Y.element.scrollLeft=Y.left,Y.element.scrollTop=Y.top}}xf=!!qm,Gm=qm=null}finally{Gt=h,X.p=r,P.T=a}}t.current=s,je=2}}function e1(){if(je===2){je=0;var t=ba,s=uo,a=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||a){a=P.T,P.T=null;var r=X.p;X.p=2;var h=Gt;Gt|=4;try{OA(t,s.alternate,s)}finally{Gt=h,X.p=r,P.T=a}}je=3}}function i1(){if(je===4||je===3){je=0,ME();var t=ba,s=uo,a=ho,r=qA;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?je=5:(je=0,uo=ba=null,s1(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(ma=null),Zg(a),s=s.stateNode,wi&&typeof wi.onCommitFiberRoot=="function")try{wi.onCommitFiberRoot(Dc,s,void 0,(s.current.flags&128)===128)}catch{}if(r!==null){s=P.T,h=X.p,X.p=2,P.T=null;try{for(var p=t.onRecoverableError,A=0;A<r.length;A++){var T=r[A];p(T.value,{componentStack:T.stack})}}finally{P.T=s,X.p=h}}(ho&3)!==0&&gf(),Hs(t),h=t.pendingLanes,(a&4194090)!==0&&(h&42)!==0?t===Rm?gu++:(gu=0,Rm=t):gu=0,pu(0)}}function s1(t,s){(t.pooledCacheLanes&=s)===0&&(s=t.pooledCache,s!=null&&(t.pooledCache=null,Kc(s)))}function gf(t){return t1(),e1(),i1(),n1()}function n1(){if(je!==5)return!1;var t=ba,s=Cm;Cm=0;var a=Zg(ho),r=P.T,h=X.p;try{X.p=32>a?32:a,P.T=null,a=Mm,Mm=null;var p=ba,A=ho;if(je=0,uo=ba=null,ho=0,(Gt&6)!==0)throw Error(n(331));var T=Gt;if(Gt|=4,IA(p.current),UA(p,p.current,A,a),Gt=T,pu(0,!1),wi&&typeof wi.onPostCommitFiberRoot=="function")try{wi.onPostCommitFiberRoot(Dc,p)}catch{}return!0}finally{X.p=h,P.T=r,s1(t,s)}}function a1(t,s,a){s=Qi(a,s),s=rm(t.stateNode,s,2),t=ra(t,s,2),t!==null&&(Oc(t,2),Hs(t))}function te(t,s,a){if(t.tag===3)a1(t,t,a);else for(;s!==null;){if(s.tag===3){a1(s,t,a);break}else if(s.tag===1){var r=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ma===null||!ma.has(r))){t=Qi(a,t),a=cA(2),r=ra(s,a,2),r!==null&&(uA(a,r,s,t),Oc(r,2),Hs(r));break}}s=s.return}}function Nm(t,s,a){var r=t.pingCache;if(r===null){r=t.pingCache=new ew;var h=new Set;r.set(s,h)}else h=r.get(s),h===void 0&&(h=new Set,r.set(s,h));h.has(a)||(Em=!0,h.add(a),t=lw.bind(null,t,s,a),s.then(t,t))}function lw(t,s,a){var r=t.pingCache;r!==null&&r.delete(s),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,ee===t&&(Ut&a)===a&&(de===4||de===3&&(Ut&62914560)===Ut&&300>Ls()-xm?(Gt&2)===0&&fo(t,0):Tm|=a,co===Ut&&(co=0)),Hs(t)}function l1(t,s){s===0&&(s=iv()),t=Kr(t,s),t!==null&&(Oc(t,s),Hs(t))}function rw(t){var s=t.memoizedState,a=0;s!==null&&(a=s.retryLane),l1(t,a)}function ow(t,s){var a=0;switch(t.tag){case 13:var r=t.stateNode,h=t.memoizedState;h!==null&&(a=h.retryLane);break;case 19:r=t.stateNode;break;case 22:r=t.stateNode._retryCache;break;default:throw Error(n(314))}r!==null&&r.delete(s),l1(t,a)}function cw(t,s){return Yg(t,s)}var pf=null,po=null,km=!1,mf=!1,zm=!1,El=0;function Hs(t){t!==po&&t.next===null&&(po===null?pf=po=t:po=po.next=t),mf=!0,km||(km=!0,hw())}function pu(t,s){if(!zm&&mf){zm=!0;do for(var a=!1,r=pf;r!==null;){if(t!==0){var h=r.pendingLanes;if(h===0)var p=0;else{var A=r.suspendedLanes,T=r.pingedLanes;p=(1<<31-xi(42|t)+1)-1,p&=h&~(A&~T),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,u1(r,p))}else p=Ut,p=Sd(r,r===ee?p:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(p&3)===0||Lc(r,p)||(a=!0,u1(r,p));r=r.next}while(a);zm=!1}}function uw(){r1()}function r1(){mf=km=!1;var t=0;El!==0&&(yw()&&(t=El),El=0);for(var s=Ls(),a=null,r=pf;r!==null;){var h=r.next,p=o1(r,s);p===0?(r.next=null,a===null?pf=h:a.next=h,h===null&&(po=a)):(a=r,(t!==0||(p&3)!==0)&&(mf=!0)),r=h}pu(t)}function o1(t,s){for(var a=t.suspendedLanes,r=t.pingedLanes,h=t.expirationTimes,p=t.pendingLanes&-62914561;0<p;){var A=31-xi(p),T=1<<A,R=h[A];R===-1?((T&a)===0||(T&r)!==0)&&(h[A]=HE(T,s)):R<=s&&(t.expiredLanes|=T),p&=~T}if(s=ee,a=Ut,a=Sd(t,t===s?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),r=t.callbackNode,a===0||t===s&&(Xt===2||Xt===9)||t.cancelPendingCommit!==null)return r!==null&&r!==null&&Vg(r),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Lc(t,a)){if(s=a&-a,s===t.callbackPriority)return s;switch(r!==null&&Vg(r),Zg(a)){case 2:case 8:a=Jb;break;case 32:a=vd;break;case 268435456:a=tv;break;default:a=vd}return r=c1.bind(null,t),a=Yg(a,r),t.callbackPriority=s,t.callbackNode=a,s}return r!==null&&r!==null&&Vg(r),t.callbackPriority=2,t.callbackNode=null,2}function c1(t,s){if(je!==0&&je!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(gf()&&t.callbackNode!==a)return null;var r=Ut;return r=Sd(t,t===ee?r:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),r===0?null:(XA(t,r,s),o1(t,Ls()),t.callbackNode!=null&&t.callbackNode===a?c1.bind(null,t):null)}function u1(t,s){if(gf())return null;XA(t,s,!0)}function hw(){Sw(function(){(Gt&6)!==0?Yg($b,uw):r1()})}function Hm(){return El===0&&(El=ev()),El}function h1(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:xd(""+t)}function d1(t,s){var a=s.ownerDocument.createElement("input");return a.name=s.name,a.value=s.value,t.id&&a.setAttribute("form",t.id),s.parentNode.insertBefore(a,s),t=new FormData(t),a.parentNode.removeChild(a),t}function dw(t,s,a,r,h){if(s==="submit"&&a&&a.stateNode===h){var p=h1((h[fi]||null).action),A=r.submitter;A&&(s=(s=A[fi]||null)?h1(s.formAction):A.getAttribute("formAction"),s!==null&&(p=s,A=null));var T=new Dd("action","action",null,r,h);t.push({event:T,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(El!==0){var R=A?d1(h,A):new FormData(h);im(a,{pending:!0,data:R,method:h.method,action:p},null,R)}}else typeof p=="function"&&(T.preventDefault(),R=A?d1(h,A):new FormData(h),im(a,{pending:!0,data:R,method:h.method,action:p},p,R))},currentTarget:h}]})}}for(var Fm=0;Fm<Sp.length;Fm++){var Um=Sp[Fm],fw=Um.toLowerCase(),gw=Um[0].toUpperCase()+Um.slice(1);ds(fw,"on"+gw)}ds(Xv,"onAnimationEnd"),ds(Yv,"onAnimationIteration"),ds(Vv,"onAnimationStart"),ds("dblclick","onDoubleClick"),ds("focusin","onFocus"),ds("focusout","onBlur"),ds(LT,"onTransitionRun"),ds(OT,"onTransitionStart"),ds(NT,"onTransitionCancel"),ds(Kv,"onTransitionEnd"),Ur("onMouseEnter",["mouseout","mouseover"]),Ur("onMouseLeave",["mouseout","mouseover"]),Ur("onPointerEnter",["pointerout","pointerover"]),Ur("onPointerLeave",["pointerout","pointerover"]),rl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),rl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),rl("onBeforeInput",["compositionend","keypress","textInput","paste"]),rl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),rl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),rl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var mu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),pw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(mu));function f1(t,s){s=(s&4)!==0;for(var a=0;a<t.length;a++){var r=t[a],h=r.event;r=r.listeners;t:{var p=void 0;if(s)for(var A=r.length-1;0<=A;A--){var T=r[A],R=T.instance,z=T.currentTarget;if(T=T.listener,R!==p&&h.isPropagationStopped())break t;p=T,h.currentTarget=z;try{p(h)}catch(G){sf(G)}h.currentTarget=null,p=R}else for(A=0;A<r.length;A++){if(T=r[A],R=T.instance,z=T.currentTarget,T=T.listener,R!==p&&h.isPropagationStopped())break t;p=T,h.currentTarget=z;try{p(h)}catch(G){sf(G)}h.currentTarget=null,p=R}}}}function kt(t,s){var a=s[Wg];a===void 0&&(a=s[Wg]=new Set);var r=t+"__bubble";a.has(r)||(g1(s,t,2,!1),a.add(r))}function Bm(t,s,a){var r=0;s&&(r|=4),g1(a,t,r,s)}var bf="_reactListening"+Math.random().toString(36).slice(2);function Pm(t){if(!t[bf]){t[bf]=!0,rv.forEach(function(a){a!=="selectionchange"&&(pw.has(a)||Bm(a,!1,t),Bm(a,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[bf]||(s[bf]=!0,Bm("selectionchange",!1,s))}}function g1(t,s,a,r){switch(U1(s)){case 2:var h=jw;break;case 8:h=qw;break;default:h=t0}a=h.bind(null,s,a,t),h=void 0,!op||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(h=!0),r?h!==void 0?t.addEventListener(s,a,{capture:!0,passive:h}):t.addEventListener(s,a,!0):h!==void 0?t.addEventListener(s,a,{passive:h}):t.addEventListener(s,a,!1)}function Im(t,s,a,r,h){var p=r;if((s&1)===0&&(s&2)===0&&r!==null)t:for(;;){if(r===null)return;var A=r.tag;if(A===3||A===4){var T=r.stateNode.containerInfo;if(T===h)break;if(A===4)for(A=r.return;A!==null;){var R=A.tag;if((R===3||R===4)&&A.stateNode.containerInfo===h)return;A=A.return}for(;T!==null;){if(A=zr(T),A===null)return;if(R=A.tag,R===5||R===6||R===26||R===27){r=p=A;continue t}T=T.parentNode}}r=r.return}Sv(function(){var z=p,G=lp(a),K=[];t:{var U=Qv.get(t);if(U!==void 0){var B=Dd,gt=t;switch(t){case"keypress":if(Md(a)===0)break t;case"keydown":case"keyup":B=cT;break;case"focusin":gt="focus",B=dp;break;case"focusout":gt="blur",B=dp;break;case"beforeblur":case"afterblur":B=dp;break;case"click":if(a.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":B=Tv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":B=WE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":B=dT;break;case Xv:case Yv:case Vv:B=tT;break;case Kv:B=gT;break;case"scroll":case"scrollend":B=QE;break;case"wheel":B=mT;break;case"copy":case"cut":case"paste":B=iT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":B=xv;break;case"toggle":case"beforetoggle":B=vT}var dt=(s&4)!==0,Wt=!dt&&(t==="scroll"||t==="scrollend"),N=dt?U!==null?U+"Capture":null:U;dt=[];for(var O=z,k;O!==null;){var Y=O;if(k=Y.stateNode,Y=Y.tag,Y!==5&&Y!==26&&Y!==27||k===null||N===null||(Y=zc(O,N),Y!=null&&dt.push(bu(O,Y,k))),Wt)break;O=O.return}0<dt.length&&(U=new B(U,gt,null,a,G),K.push({event:U,listeners:dt}))}}if((s&7)===0){t:{if(U=t==="mouseover"||t==="pointerover",B=t==="mouseout"||t==="pointerout",U&&a!==ap&&(gt=a.relatedTarget||a.fromElement)&&(zr(gt)||gt[kr]))break t;if((B||U)&&(U=G.window===G?G:(U=G.ownerDocument)?U.defaultView||U.parentWindow:window,B?(gt=a.relatedTarget||a.toElement,B=z,gt=gt?zr(gt):null,gt!==null&&(Wt=o(gt),dt=gt.tag,gt!==Wt||dt!==5&&dt!==27&&dt!==6)&&(gt=null)):(B=null,gt=z),B!==gt)){if(dt=Tv,Y="onMouseLeave",N="onMouseEnter",O="mouse",(t==="pointerout"||t==="pointerover")&&(dt=xv,Y="onPointerLeave",N="onPointerEnter",O="pointer"),Wt=B==null?U:kc(B),k=gt==null?U:kc(gt),U=new dt(Y,O+"leave",B,a,G),U.target=Wt,U.relatedTarget=k,Y=null,zr(G)===z&&(dt=new dt(N,O+"enter",gt,a,G),dt.target=k,dt.relatedTarget=Wt,Y=dt),Wt=Y,B&&gt)e:{for(dt=B,N=gt,O=0,k=dt;k;k=mo(k))O++;for(k=0,Y=N;Y;Y=mo(Y))k++;for(;0<O-k;)dt=mo(dt),O--;for(;0<k-O;)N=mo(N),k--;for(;O--;){if(dt===N||N!==null&&dt===N.alternate)break e;dt=mo(dt),N=mo(N)}dt=null}else dt=null;B!==null&&p1(K,U,B,dt,!1),gt!==null&&Wt!==null&&p1(K,Wt,gt,dt,!0)}}t:{if(U=z?kc(z):window,B=U.nodeName&&U.nodeName.toLowerCase(),B==="select"||B==="input"&&U.type==="file")var nt=kv;else if(Ov(U))if(zv)nt=MT;else{nt=xT;var Dt=wT}else B=U.nodeName,!B||B.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?z&&np(z.elementType)&&(nt=kv):nt=CT;if(nt&&(nt=nt(t,z))){Nv(K,nt,a,G);break t}Dt&&Dt(t,U,z),t==="focusout"&&z&&U.type==="number"&&z.memoizedProps.value!=null&&sp(U,"number",U.value)}switch(Dt=z?kc(z):window,t){case"focusin":(Ov(Dt)||Dt.contentEditable==="true")&&(Xr=Dt,vp=z,qc=null);break;case"focusout":qc=vp=Xr=null;break;case"mousedown":yp=!0;break;case"contextmenu":case"mouseup":case"dragend":yp=!1,qv(K,a,G);break;case"selectionchange":if(DT)break;case"keydown":case"keyup":qv(K,a,G)}var ut;if(gp)t:{switch(t){case"compositionstart":var ft="onCompositionStart";break t;case"compositionend":ft="onCompositionEnd";break t;case"compositionupdate":ft="onCompositionUpdate";break t}ft=void 0}else Gr?Dv(t,a)&&(ft="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(ft="onCompositionStart");ft&&(Cv&&a.locale!=="ko"&&(Gr||ft!=="onCompositionStart"?ft==="onCompositionEnd"&&Gr&&(ut=_v()):(sa=G,cp="value"in sa?sa.value:sa.textContent,Gr=!0)),Dt=vf(z,ft),0<Dt.length&&(ft=new wv(ft,t,null,a,G),K.push({event:ft,listeners:Dt}),ut?ft.data=ut:(ut=Lv(a),ut!==null&&(ft.data=ut)))),(ut=AT?ST(t,a):_T(t,a))&&(ft=vf(z,"onBeforeInput"),0<ft.length&&(Dt=new wv("onBeforeInput","beforeinput",null,a,G),K.push({event:Dt,listeners:ft}),Dt.data=ut)),dw(K,t,z,a,G)}f1(K,s)})}function bu(t,s,a){return{instance:t,listener:s,currentTarget:a}}function vf(t,s){for(var a=s+"Capture",r=[];t!==null;){var h=t,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=zc(t,a),h!=null&&r.unshift(bu(t,h,p)),h=zc(t,s),h!=null&&r.push(bu(t,h,p))),t.tag===3)return r;t=t.return}return[]}function mo(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function p1(t,s,a,r,h){for(var p=s._reactName,A=[];a!==null&&a!==r;){var T=a,R=T.alternate,z=T.stateNode;if(T=T.tag,R!==null&&R===r)break;T!==5&&T!==26&&T!==27||z===null||(R=z,h?(z=zc(a,p),z!=null&&A.unshift(bu(a,z,R))):h||(z=zc(a,p),z!=null&&A.push(bu(a,z,R)))),a=a.return}A.length!==0&&t.push({event:s,listeners:A})}var mw=/\r\n?/g,bw=/\u0000|\uFFFD/g;function m1(t){return(typeof t=="string"?t:""+t).replace(mw,`
`).replace(bw,"")}function b1(t,s){return s=m1(s),m1(t)===s}function yf(){}function Zt(t,s,a,r,h,p){switch(a){case"children":typeof r=="string"?s==="body"||s==="textarea"&&r===""||Ir(t,r):(typeof r=="number"||typeof r=="bigint")&&s!=="body"&&Ir(t,""+r);break;case"className":Ed(t,"class",r);break;case"tabIndex":Ed(t,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":Ed(t,a,r);break;case"style":yv(t,r,p);break;case"data":if(s!=="object"){Ed(t,"data",r);break}case"src":case"href":if(r===""&&(s!=="a"||a!=="href")){t.removeAttribute(a);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){t.removeAttribute(a);break}r=xd(""+r),t.setAttribute(a,r);break;case"action":case"formAction":if(typeof r=="function"){t.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(a==="formAction"?(s!=="input"&&Zt(t,s,"name",h.name,h,null),Zt(t,s,"formEncType",h.formEncType,h,null),Zt(t,s,"formMethod",h.formMethod,h,null),Zt(t,s,"formTarget",h.formTarget,h,null)):(Zt(t,s,"encType",h.encType,h,null),Zt(t,s,"method",h.method,h,null),Zt(t,s,"target",h.target,h,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){t.removeAttribute(a);break}r=xd(""+r),t.setAttribute(a,r);break;case"onClick":r!=null&&(t.onclick=yf);break;case"onScroll":r!=null&&kt("scroll",t);break;case"onScrollEnd":r!=null&&kt("scrollend",t);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(n(61));if(a=r.__html,a!=null){if(h.children!=null)throw Error(n(60));t.innerHTML=a}}break;case"multiple":t.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":t.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){t.removeAttribute("xlink:href");break}a=xd(""+r),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?t.setAttribute(a,""+r):t.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&typeof r!="function"&&typeof r!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":r===!0?t.setAttribute(a,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?t.setAttribute(a,r):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?t.setAttribute(a,r):t.removeAttribute(a);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?t.removeAttribute(a):t.setAttribute(a,r);break;case"popover":kt("beforetoggle",t),kt("toggle",t),_d(t,"popover",r);break;case"xlinkActuate":an(t,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":an(t,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":an(t,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":an(t,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":an(t,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":an(t,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":an(t,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":an(t,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":an(t,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":_d(t,"is",r);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=VE.get(a)||a,_d(t,a,r))}}function jm(t,s,a,r,h,p){switch(a){case"style":yv(t,r,p);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(n(61));if(a=r.__html,a!=null){if(h.children!=null)throw Error(n(60));t.innerHTML=a}}break;case"children":typeof r=="string"?Ir(t,r):(typeof r=="number"||typeof r=="bigint")&&Ir(t,""+r);break;case"onScroll":r!=null&&kt("scroll",t);break;case"onScrollEnd":r!=null&&kt("scrollend",t);break;case"onClick":r!=null&&(t.onclick=yf);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ov.hasOwnProperty(a))t:{if(a[0]==="o"&&a[1]==="n"&&(h=a.endsWith("Capture"),s=a.slice(2,h?a.length-7:void 0),p=t[fi]||null,p=p!=null?p[a]:null,typeof p=="function"&&t.removeEventListener(s,p,h),typeof r=="function")){typeof p!="function"&&p!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(s,r,h);break t}a in t?t[a]=r:r===!0?t.setAttribute(a,""):_d(t,a,r)}}}function qe(t,s,a){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":kt("error",t),kt("load",t);var r=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var A=a[p];if(A!=null)switch(p){case"src":r=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,s));default:Zt(t,s,p,A,a,null)}}h&&Zt(t,s,"srcSet",a.srcSet,a,null),r&&Zt(t,s,"src",a.src,a,null);return;case"input":kt("invalid",t);var T=p=A=h=null,R=null,z=null;for(r in a)if(a.hasOwnProperty(r)){var G=a[r];if(G!=null)switch(r){case"name":h=G;break;case"type":A=G;break;case"checked":R=G;break;case"defaultChecked":z=G;break;case"value":p=G;break;case"defaultValue":T=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(n(137,s));break;default:Zt(t,s,r,G,a,null)}}pv(t,p,T,R,z,A,h,!1),Td(t);return;case"select":kt("invalid",t),r=A=p=null;for(h in a)if(a.hasOwnProperty(h)&&(T=a[h],T!=null))switch(h){case"value":p=T;break;case"defaultValue":A=T;break;case"multiple":r=T;default:Zt(t,s,h,T,a,null)}s=p,a=A,t.multiple=!!r,s!=null?Pr(t,!!r,s,!1):a!=null&&Pr(t,!!r,a,!0);return;case"textarea":kt("invalid",t),p=h=r=null;for(A in a)if(a.hasOwnProperty(A)&&(T=a[A],T!=null))switch(A){case"value":r=T;break;case"defaultValue":h=T;break;case"children":p=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(n(91));break;default:Zt(t,s,A,T,a,null)}bv(t,r,h,p),Td(t);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(r=a[R],r!=null))switch(R){case"selected":t.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:Zt(t,s,R,r,a,null)}return;case"dialog":kt("beforetoggle",t),kt("toggle",t),kt("cancel",t),kt("close",t);break;case"iframe":case"object":kt("load",t);break;case"video":case"audio":for(r=0;r<mu.length;r++)kt(mu[r],t);break;case"image":kt("error",t),kt("load",t);break;case"details":kt("toggle",t);break;case"embed":case"source":case"link":kt("error",t),kt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(z in a)if(a.hasOwnProperty(z)&&(r=a[z],r!=null))switch(z){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,s));default:Zt(t,s,z,r,a,null)}return;default:if(np(s)){for(G in a)a.hasOwnProperty(G)&&(r=a[G],r!==void 0&&jm(t,s,G,r,a,void 0));return}}for(T in a)a.hasOwnProperty(T)&&(r=a[T],r!=null&&Zt(t,s,T,r,a,null))}function vw(t,s,a,r){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,A=null,T=null,R=null,z=null,G=null;for(B in a){var K=a[B];if(a.hasOwnProperty(B)&&K!=null)switch(B){case"checked":break;case"value":break;case"defaultValue":R=K;default:r.hasOwnProperty(B)||Zt(t,s,B,null,r,K)}}for(var U in r){var B=r[U];if(K=a[U],r.hasOwnProperty(U)&&(B!=null||K!=null))switch(U){case"type":p=B;break;case"name":h=B;break;case"checked":z=B;break;case"defaultChecked":G=B;break;case"value":A=B;break;case"defaultValue":T=B;break;case"children":case"dangerouslySetInnerHTML":if(B!=null)throw Error(n(137,s));break;default:B!==K&&Zt(t,s,U,B,r,K)}}ip(t,A,T,R,z,G,p,h);return;case"select":B=A=T=U=null;for(p in a)if(R=a[p],a.hasOwnProperty(p)&&R!=null)switch(p){case"value":break;case"multiple":B=R;default:r.hasOwnProperty(p)||Zt(t,s,p,null,r,R)}for(h in r)if(p=r[h],R=a[h],r.hasOwnProperty(h)&&(p!=null||R!=null))switch(h){case"value":U=p;break;case"defaultValue":T=p;break;case"multiple":A=p;default:p!==R&&Zt(t,s,h,p,r,R)}s=T,a=A,r=B,U!=null?Pr(t,!!a,U,!1):!!r!=!!a&&(s!=null?Pr(t,!!a,s,!0):Pr(t,!!a,a?[]:"",!1));return;case"textarea":B=U=null;for(T in a)if(h=a[T],a.hasOwnProperty(T)&&h!=null&&!r.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:Zt(t,s,T,null,r,h)}for(A in r)if(h=r[A],p=a[A],r.hasOwnProperty(A)&&(h!=null||p!=null))switch(A){case"value":U=h;break;case"defaultValue":B=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(n(91));break;default:h!==p&&Zt(t,s,A,h,r,p)}mv(t,U,B);return;case"option":for(var gt in a)if(U=a[gt],a.hasOwnProperty(gt)&&U!=null&&!r.hasOwnProperty(gt))switch(gt){case"selected":t.selected=!1;break;default:Zt(t,s,gt,null,r,U)}for(R in r)if(U=r[R],B=a[R],r.hasOwnProperty(R)&&U!==B&&(U!=null||B!=null))switch(R){case"selected":t.selected=U&&typeof U!="function"&&typeof U!="symbol";break;default:Zt(t,s,R,U,r,B)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var dt in a)U=a[dt],a.hasOwnProperty(dt)&&U!=null&&!r.hasOwnProperty(dt)&&Zt(t,s,dt,null,r,U);for(z in r)if(U=r[z],B=a[z],r.hasOwnProperty(z)&&U!==B&&(U!=null||B!=null))switch(z){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(n(137,s));break;default:Zt(t,s,z,U,r,B)}return;default:if(np(s)){for(var Wt in a)U=a[Wt],a.hasOwnProperty(Wt)&&U!==void 0&&!r.hasOwnProperty(Wt)&&jm(t,s,Wt,void 0,r,U);for(G in r)U=r[G],B=a[G],!r.hasOwnProperty(G)||U===B||U===void 0&&B===void 0||jm(t,s,G,U,r,B);return}}for(var N in a)U=a[N],a.hasOwnProperty(N)&&U!=null&&!r.hasOwnProperty(N)&&Zt(t,s,N,null,r,U);for(K in r)U=r[K],B=a[K],!r.hasOwnProperty(K)||U===B||U==null&&B==null||Zt(t,s,K,U,r,B)}var qm=null,Gm=null;function Af(t){return t.nodeType===9?t:t.ownerDocument}function v1(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function y1(t,s){if(t===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&s==="foreignObject"?0:t}function Xm(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Ym=null;function yw(){var t=window.event;return t&&t.type==="popstate"?t===Ym?!1:(Ym=t,!0):(Ym=null,!1)}var A1=typeof setTimeout=="function"?setTimeout:void 0,Aw=typeof clearTimeout=="function"?clearTimeout:void 0,S1=typeof Promise=="function"?Promise:void 0,Sw=typeof queueMicrotask=="function"?queueMicrotask:typeof S1<"u"?function(t){return S1.resolve(null).then(t).catch(_w)}:A1;function _w(t){setTimeout(function(){throw t})}function ya(t){return t==="head"}function _1(t,s){var a=s,r=0,h=0;do{var p=a.nextSibling;if(t.removeChild(a),p&&p.nodeType===8)if(a=p.data,a==="/$"){if(0<r&&8>r){a=r;var A=t.ownerDocument;if(a&1&&vu(A.documentElement),a&2&&vu(A.body),a&4)for(a=A.head,vu(a),A=a.firstChild;A;){var T=A.nextSibling,R=A.nodeName;A[Nc]||R==="SCRIPT"||R==="STYLE"||R==="LINK"&&A.rel.toLowerCase()==="stylesheet"||a.removeChild(A),A=T}}if(h===0){t.removeChild(p),xu(s);return}h--}else a==="$"||a==="$?"||a==="$!"?h++:r=a.charCodeAt(0)-48;else r=0;a=p}while(a);xu(s)}function Vm(t){var s=t.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var a=s;switch(s=s.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Vm(a),$g(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function Ew(t,s,a,r){for(;t.nodeType===1;){var h=a;if(t.nodeName.toLowerCase()!==s.toLowerCase()){if(!r&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(r){if(!t[Nc])switch(s){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(p=t.getAttribute("rel"),p==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(p!==h.rel||t.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||t.getAttribute("title")!==(h.title==null?null:h.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(p=t.getAttribute("src"),(p!==(h.src==null?null:h.src)||t.getAttribute("type")!==(h.type==null?null:h.type)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(s==="input"&&t.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&t.getAttribute("name")===p)return t}else return t;if(t=gs(t.nextSibling),t===null)break}return null}function Tw(t,s,a){if(s==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=gs(t.nextSibling),t===null))return null;return t}function Km(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState==="complete"}function ww(t,s){var a=t.ownerDocument;if(t.data!=="$?"||a.readyState==="complete")s();else{var r=function(){s(),a.removeEventListener("DOMContentLoaded",r)};a.addEventListener("DOMContentLoaded",r),t._reactRetry=r}}function gs(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?"||s==="F!"||s==="F")break;if(s==="/$")return null}}return t}var Qm=null;function E1(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"){if(s===0)return t;s--}else a==="/$"&&s++}t=t.previousSibling}return null}function T1(t,s,a){switch(s=Af(a),t){case"html":if(t=s.documentElement,!t)throw Error(n(452));return t;case"head":if(t=s.head,!t)throw Error(n(453));return t;case"body":if(t=s.body,!t)throw Error(n(454));return t;default:throw Error(n(451))}}function vu(t){for(var s=t.attributes;s.length;)t.removeAttributeNode(s[0]);$g(t)}var es=new Map,w1=new Set;function Sf(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var yn=X.d;X.d={f:xw,r:Cw,D:Mw,C:Rw,L:Dw,m:Lw,X:Nw,S:Ow,M:kw};function xw(){var t=yn.f(),s=df();return t||s}function Cw(t){var s=Hr(t);s!==null&&s.tag===5&&s.type==="form"?Xy(s):yn.r(t)}var bo=typeof document>"u"?null:document;function x1(t,s,a){var r=bo;if(r&&typeof s=="string"&&s){var h=Ki(s);h='link[rel="'+t+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),w1.has(h)||(w1.add(h),t={rel:t,crossOrigin:a,href:s},r.querySelector(h)===null&&(s=r.createElement("link"),qe(s,"link",t),Oe(s),r.head.appendChild(s)))}}function Mw(t){yn.D(t),x1("dns-prefetch",t,null)}function Rw(t,s){yn.C(t,s),x1("preconnect",t,s)}function Dw(t,s,a){yn.L(t,s,a);var r=bo;if(r&&t&&s){var h='link[rel="preload"][as="'+Ki(s)+'"]';s==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+Ki(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+Ki(a.imageSizes)+'"]')):h+='[href="'+Ki(t)+'"]';var p=h;switch(s){case"style":p=vo(t);break;case"script":p=yo(t)}es.has(p)||(t=m({rel:"preload",href:s==="image"&&a&&a.imageSrcSet?void 0:t,as:s},a),es.set(p,t),r.querySelector(h)!==null||s==="style"&&r.querySelector(yu(p))||s==="script"&&r.querySelector(Au(p))||(s=r.createElement("link"),qe(s,"link",t),Oe(s),r.head.appendChild(s)))}}function Lw(t,s){yn.m(t,s);var a=bo;if(a&&t){var r=s&&typeof s.as=="string"?s.as:"script",h='link[rel="modulepreload"][as="'+Ki(r)+'"][href="'+Ki(t)+'"]',p=h;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=yo(t)}if(!es.has(p)&&(t=m({rel:"modulepreload",href:t},s),es.set(p,t),a.querySelector(h)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Au(p)))return}r=a.createElement("link"),qe(r,"link",t),Oe(r),a.head.appendChild(r)}}}function Ow(t,s,a){yn.S(t,s,a);var r=bo;if(r&&t){var h=Fr(r).hoistableStyles,p=vo(t);s=s||"default";var A=h.get(p);if(!A){var T={loading:0,preload:null};if(A=r.querySelector(yu(p)))T.loading=5;else{t=m({rel:"stylesheet",href:t,"data-precedence":s},a),(a=es.get(p))&&Zm(t,a);var R=A=r.createElement("link");Oe(R),qe(R,"link",t),R._p=new Promise(function(z,G){R.onload=z,R.onerror=G}),R.addEventListener("load",function(){T.loading|=1}),R.addEventListener("error",function(){T.loading|=2}),T.loading|=4,_f(A,s,r)}A={type:"stylesheet",instance:A,count:1,state:T},h.set(p,A)}}}function Nw(t,s){yn.X(t,s);var a=bo;if(a&&t){var r=Fr(a).hoistableScripts,h=yo(t),p=r.get(h);p||(p=a.querySelector(Au(h)),p||(t=m({src:t,async:!0},s),(s=es.get(h))&&Wm(t,s),p=a.createElement("script"),Oe(p),qe(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},r.set(h,p))}}function kw(t,s){yn.M(t,s);var a=bo;if(a&&t){var r=Fr(a).hoistableScripts,h=yo(t),p=r.get(h);p||(p=a.querySelector(Au(h)),p||(t=m({src:t,async:!0,type:"module"},s),(s=es.get(h))&&Wm(t,s),p=a.createElement("script"),Oe(p),qe(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},r.set(h,p))}}function C1(t,s,a,r){var h=(h=rt.current)?Sf(h):null;if(!h)throw Error(n(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(s=vo(a.href),a=Fr(h).hoistableStyles,r=a.get(s),r||(r={type:"style",instance:null,count:0,state:null},a.set(s,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=vo(a.href);var p=Fr(h).hoistableStyles,A=p.get(t);if(A||(h=h.ownerDocument||h,A={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(t,A),(p=h.querySelector(yu(t)))&&!p._p&&(A.instance=p,A.state.loading=5),es.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},es.set(t,a),p||zw(h,t,a,A.state))),s&&r===null)throw Error(n(528,""));return A}if(s&&r!==null)throw Error(n(529,""));return null;case"script":return s=a.async,a=a.src,typeof a=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=yo(a),a=Fr(h).hoistableScripts,r=a.get(s),r||(r={type:"script",instance:null,count:0,state:null},a.set(s,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,t))}}function vo(t){return'href="'+Ki(t)+'"'}function yu(t){return'link[rel="stylesheet"]['+t+"]"}function M1(t){return m({},t,{"data-precedence":t.precedence,precedence:null})}function zw(t,s,a,r){t.querySelector('link[rel="preload"][as="style"]['+s+"]")?r.loading=1:(s=t.createElement("link"),r.preload=s,s.addEventListener("load",function(){return r.loading|=1}),s.addEventListener("error",function(){return r.loading|=2}),qe(s,"link",a),Oe(s),t.head.appendChild(s))}function yo(t){return'[src="'+Ki(t)+'"]'}function Au(t){return"script[async]"+t}function R1(t,s,a){if(s.count++,s.instance===null)switch(s.type){case"style":var r=t.querySelector('style[data-href~="'+Ki(a.href)+'"]');if(r)return s.instance=r,Oe(r),r;var h=m({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(t.ownerDocument||t).createElement("style"),Oe(r),qe(r,"style",h),_f(r,a.precedence,t),s.instance=r;case"stylesheet":h=vo(a.href);var p=t.querySelector(yu(h));if(p)return s.state.loading|=4,s.instance=p,Oe(p),p;r=M1(a),(h=es.get(h))&&Zm(r,h),p=(t.ownerDocument||t).createElement("link"),Oe(p);var A=p;return A._p=new Promise(function(T,R){A.onload=T,A.onerror=R}),qe(p,"link",r),s.state.loading|=4,_f(p,a.precedence,t),s.instance=p;case"script":return p=yo(a.src),(h=t.querySelector(Au(p)))?(s.instance=h,Oe(h),h):(r=a,(h=es.get(p))&&(r=m({},a),Wm(r,h)),t=t.ownerDocument||t,h=t.createElement("script"),Oe(h),qe(h,"link",r),t.head.appendChild(h),s.instance=h);case"void":return null;default:throw Error(n(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(r=s.instance,s.state.loading|=4,_f(r,a.precedence,t));return s.instance}function _f(t,s,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=r.length?r[r.length-1]:null,p=h,A=0;A<r.length;A++){var T=r[A];if(T.dataset.precedence===s)p=T;else if(p!==h)break}p?p.parentNode.insertBefore(t,p.nextSibling):(s=a.nodeType===9?a.head:a,s.insertBefore(t,s.firstChild))}function Zm(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.title==null&&(t.title=s.title)}function Wm(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.integrity==null&&(t.integrity=s.integrity)}var Ef=null;function D1(t,s,a){if(Ef===null){var r=new Map,h=Ef=new Map;h.set(a,r)}else h=Ef,r=h.get(a),r||(r=new Map,h.set(a,r));if(r.has(t))return r;for(r.set(t,null),a=a.getElementsByTagName(t),h=0;h<a.length;h++){var p=a[h];if(!(p[Nc]||p[Qe]||t==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var A=p.getAttribute(s)||"";A=t+A;var T=r.get(A);T?T.push(p):r.set(A,[p])}}return r}function L1(t,s,a){t=t.ownerDocument||t,t.head.insertBefore(a,s==="title"?t.querySelector("head > title"):null)}function Hw(t,s,a){if(a===1||s.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return t=s.disabled,typeof s.precedence=="string"&&t==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function O1(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}var Su=null;function Fw(){}function Uw(t,s,a){if(Su===null)throw Error(n(475));var r=Su;if(s.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var h=vo(a.href),p=t.querySelector(yu(h));if(p){t=p._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(r.count++,r=Tf.bind(r),t.then(r,r)),s.state.loading|=4,s.instance=p,Oe(p);return}p=t.ownerDocument||t,a=M1(a),(h=es.get(h))&&Zm(a,h),p=p.createElement("link"),Oe(p);var A=p;A._p=new Promise(function(T,R){A.onload=T,A.onerror=R}),qe(p,"link",a),s.instance=p}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(s,t),(t=s.state.preload)&&(s.state.loading&3)===0&&(r.count++,s=Tf.bind(r),t.addEventListener("load",s),t.addEventListener("error",s))}}function Bw(){if(Su===null)throw Error(n(475));var t=Su;return t.stylesheets&&t.count===0&&$m(t,t.stylesheets),0<t.count?function(s){var a=setTimeout(function(){if(t.stylesheets&&$m(t,t.stylesheets),t.unsuspend){var r=t.unsuspend;t.unsuspend=null,r()}},6e4);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(a)}}:null}function Tf(){if(this.count--,this.count===0){if(this.stylesheets)$m(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var wf=null;function $m(t,s){t.stylesheets=null,t.unsuspend!==null&&(t.count++,wf=new Map,s.forEach(Pw,t),wf=null,Tf.call(t))}function Pw(t,s){if(!(s.state.loading&4)){var a=wf.get(t);if(a)var r=a.get(null);else{a=new Map,wf.set(t,a);for(var h=t.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var A=h[p];(A.nodeName==="LINK"||A.getAttribute("media")!=="not all")&&(a.set(A.dataset.precedence,A),r=A)}r&&a.set(null,r)}h=s.instance,A=h.getAttribute("data-precedence"),p=a.get(A)||r,p===r&&a.set(null,h),a.set(A,h),this.count++,r=Tf.bind(this),h.addEventListener("load",r),h.addEventListener("error",r),p?p.parentNode.insertBefore(h,p.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(h,t.firstChild)),s.state.loading|=4}}var _u={$$typeof:F,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function Iw(t,s,a,r,h,p,A,T){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Kg(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Kg(0),this.hiddenUpdates=Kg(null),this.identifierPrefix=r,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=A,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.incompleteTransitions=new Map}function N1(t,s,a,r,h,p,A,T,R,z,G,K){return t=new Iw(t,s,a,A,T,R,z,K),s=1,p===!0&&(s|=24),p=Mi(3,null,null,s),t.current=p,p.stateNode=t,s=Np(),s.refCount++,t.pooledCache=s,s.refCount++,p.memoizedState={element:r,isDehydrated:a,cache:s},Fp(p),t}function k1(t){return t?(t=Qr,t):Qr}function z1(t,s,a,r,h,p){h=k1(h),r.context===null?r.context=h:r.pendingContext=h,r=la(s),r.payload={element:a},p=p===void 0?null:p,p!==null&&(r.callback=p),a=ra(t,r,s),a!==null&&(Ni(a,t,s),$c(a,t,s))}function H1(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<s?a:s}}function Jm(t,s){H1(t,s),(t=t.alternate)&&H1(t,s)}function F1(t){if(t.tag===13){var s=Kr(t,67108864);s!==null&&Ni(s,t,67108864),Jm(t,67108864)}}var xf=!0;function jw(t,s,a,r){var h=P.T;P.T=null;var p=X.p;try{X.p=2,t0(t,s,a,r)}finally{X.p=p,P.T=h}}function qw(t,s,a,r){var h=P.T;P.T=null;var p=X.p;try{X.p=8,t0(t,s,a,r)}finally{X.p=p,P.T=h}}function t0(t,s,a,r){if(xf){var h=e0(r);if(h===null)Im(t,s,r,Cf,a),B1(t,r);else if(Xw(h,t,s,a,r))r.stopPropagation();else if(B1(t,r),s&4&&-1<Gw.indexOf(t)){for(;h!==null;){var p=Hr(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var A=ll(p.pendingLanes);if(A!==0){var T=p;for(T.pendingLanes|=2,T.entangledLanes|=2;A;){var R=1<<31-xi(A);T.entanglements[1]|=R,A&=~R}Hs(p),(Gt&6)===0&&(uf=Ls()+500,pu(0))}}break;case 13:T=Kr(p,2),T!==null&&Ni(T,p,2),df(),Jm(p,2)}if(p=e0(r),p===null&&Im(t,s,r,Cf,a),p===h)break;h=p}h!==null&&r.stopPropagation()}else Im(t,s,r,null,a)}}function e0(t){return t=lp(t),i0(t)}var Cf=null;function i0(t){if(Cf=null,t=zr(t),t!==null){var s=o(t);if(s===null)t=null;else{var a=s.tag;if(a===13){if(t=u(s),t!==null)return t;t=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null)}}return Cf=t,null}function U1(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(RE()){case $b:return 2;case Jb:return 8;case vd:case DE:return 32;case tv:return 268435456;default:return 32}default:return 32}}var s0=!1,Aa=null,Sa=null,_a=null,Eu=new Map,Tu=new Map,Ea=[],Gw="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function B1(t,s){switch(t){case"focusin":case"focusout":Aa=null;break;case"dragenter":case"dragleave":Sa=null;break;case"mouseover":case"mouseout":_a=null;break;case"pointerover":case"pointerout":Eu.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Tu.delete(s.pointerId)}}function wu(t,s,a,r,h,p){return t===null||t.nativeEvent!==p?(t={blockedOn:s,domEventName:a,eventSystemFlags:r,nativeEvent:p,targetContainers:[h]},s!==null&&(s=Hr(s),s!==null&&F1(s)),t):(t.eventSystemFlags|=r,s=t.targetContainers,h!==null&&s.indexOf(h)===-1&&s.push(h),t)}function Xw(t,s,a,r,h){switch(s){case"focusin":return Aa=wu(Aa,t,s,a,r,h),!0;case"dragenter":return Sa=wu(Sa,t,s,a,r,h),!0;case"mouseover":return _a=wu(_a,t,s,a,r,h),!0;case"pointerover":var p=h.pointerId;return Eu.set(p,wu(Eu.get(p)||null,t,s,a,r,h)),!0;case"gotpointercapture":return p=h.pointerId,Tu.set(p,wu(Tu.get(p)||null,t,s,a,r,h)),!0}return!1}function P1(t){var s=zr(t.target);if(s!==null){var a=o(s);if(a!==null){if(s=a.tag,s===13){if(s=u(a),s!==null){t.blockedOn=s,UE(t.priority,function(){if(a.tag===13){var r=Oi();r=Qg(r);var h=Kr(a,r);h!==null&&Ni(h,a,r),Jm(a,r)}});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Mf(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var a=e0(t.nativeEvent);if(a===null){a=t.nativeEvent;var r=new a.constructor(a.type,a);ap=r,a.target.dispatchEvent(r),ap=null}else return s=Hr(a),s!==null&&F1(s),t.blockedOn=a,!1;s.shift()}return!0}function I1(t,s,a){Mf(t)&&a.delete(s)}function Yw(){s0=!1,Aa!==null&&Mf(Aa)&&(Aa=null),Sa!==null&&Mf(Sa)&&(Sa=null),_a!==null&&Mf(_a)&&(_a=null),Eu.forEach(I1),Tu.forEach(I1)}function Rf(t,s){t.blockedOn===s&&(t.blockedOn=null,s0||(s0=!0,b.unstable_scheduleCallback(b.unstable_NormalPriority,Yw)))}var Df=null;function j1(t){Df!==t&&(Df=t,b.unstable_scheduleCallback(b.unstable_NormalPriority,function(){Df===t&&(Df=null);for(var s=0;s<t.length;s+=3){var a=t[s],r=t[s+1],h=t[s+2];if(typeof r!="function"){if(i0(r||a)===null)continue;break}var p=Hr(a);p!==null&&(t.splice(s,3),s-=3,im(p,{pending:!0,data:h,method:a.method,action:r},r,h))}}))}function xu(t){function s(R){return Rf(R,t)}Aa!==null&&Rf(Aa,t),Sa!==null&&Rf(Sa,t),_a!==null&&Rf(_a,t),Eu.forEach(s),Tu.forEach(s);for(var a=0;a<Ea.length;a++){var r=Ea[a];r.blockedOn===t&&(r.blockedOn=null)}for(;0<Ea.length&&(a=Ea[0],a.blockedOn===null);)P1(a),a.blockedOn===null&&Ea.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(r=0;r<a.length;r+=3){var h=a[r],p=a[r+1],A=h[fi]||null;if(typeof p=="function")A||j1(a);else if(A){var T=null;if(p&&p.hasAttribute("formAction")){if(h=p,A=p[fi]||null)T=A.formAction;else if(i0(h)!==null)continue}else T=A.action;typeof T=="function"?a[r+1]=T:(a.splice(r,3),r-=3),j1(a)}}}function n0(t){this._internalRoot=t}Lf.prototype.render=n0.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(n(409));var a=s.current,r=Oi();z1(a,r,t,s,null,null)},Lf.prototype.unmount=n0.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;z1(t.current,2,null,t,null,null),df(),s[kr]=null}};function Lf(t){this._internalRoot=t}Lf.prototype.unstable_scheduleHydration=function(t){if(t){var s=av();t={blockedOn:null,target:t,priority:s};for(var a=0;a<Ea.length&&s!==0&&s<Ea[a].priority;a++);Ea.splice(a,0,t),a===0&&P1(t)}};var q1=e.version;if(q1!=="19.1.0")throw Error(n(527,q1,"19.1.0"));X.findDOMNode=function(t){var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(n(188)):(t=Object.keys(t).join(","),Error(n(268,t)));return t=f(s),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var Vw={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Of=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Of.isDisabled&&Of.supportsFiber)try{Dc=Of.inject(Vw),wi=Of}catch{}}return Mu.createRoot=function(t,s){if(!l(t))throw Error(n(299));var a=!1,r="",h=aA,p=lA,A=rA,T=null;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(r=s.identifierPrefix),s.onUncaughtError!==void 0&&(h=s.onUncaughtError),s.onCaughtError!==void 0&&(p=s.onCaughtError),s.onRecoverableError!==void 0&&(A=s.onRecoverableError),s.unstable_transitionCallbacks!==void 0&&(T=s.unstable_transitionCallbacks)),s=N1(t,1,!1,null,null,a,r,h,p,A,T,null),t[kr]=s.current,Pm(t),new n0(s)},Mu.hydrateRoot=function(t,s,a){if(!l(t))throw Error(n(299));var r=!1,h="",p=aA,A=lA,T=rA,R=null,z=null;return a!=null&&(a.unstable_strictMode===!0&&(r=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(A=a.onCaughtError),a.onRecoverableError!==void 0&&(T=a.onRecoverableError),a.unstable_transitionCallbacks!==void 0&&(R=a.unstable_transitionCallbacks),a.formState!==void 0&&(z=a.formState)),s=N1(t,1,!0,s,a??null,r,h,p,A,T,R,z),s.context=k1(null),a=s.current,r=Oi(),r=Qg(r),h=la(r),h.callback=null,ra(a,h,r),a=r,s.current.lanes=a,Oc(s,a),Hs(s),t[kr]=s.current,Pm(t),new Lf(s)},Mu.version="19.1.0",Mu}var tS;function ax(){if(tS)return o0.exports;tS=1;function b(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(b)}catch(e){console.error(e)}}return b(),o0.exports=nx(),o0.exports}var lx=ax();const rx="modulepreload",ox=function(b){return"/"+b},eS={},Nf=function(e,i,n){let l=Promise.resolve();if(i&&i.length>0){document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),d=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));l=Promise.allSettled(i.map(f=>{if(f=ox(f),f in eS)return;eS[f]=!0;const g=f.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const v=document.createElement("link");if(v.rel=g?"stylesheet":rx,g||(v.as="script"),v.crossOrigin="",v.href=f,d&&v.setAttribute("nonce",d),document.head.appendChild(v),g)return new Promise((y,E)=>{v.addEventListener("load",y),v.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return l.then(u=>{for(const d of u||[])d.status==="rejected"&&o(d.reason);return e().catch(o)})};var Ku={};Ku.d=(b,e)=>{for(var i in e)Ku.o(e,i)&&!Ku.o(b,i)&&Object.defineProperty(b,i,{enumerable:!0,get:e[i]})};Ku.o=(b,e)=>Object.prototype.hasOwnProperty.call(b,e);var At=globalThis.pdfjsLib={};Ku.d(At,{AbortException:()=>Or,AnnotationEditorLayer:()=>Mb,AnnotationEditorParamsType:()=>vt,AnnotationEditorType:()=>Et,AnnotationEditorUIManager:()=>Cr,AnnotationLayer:()=>lM,AnnotationMode:()=>Ca,ColorPicker:()=>vg,DOMSVGFactory:()=>Vb,DrawLayer:()=>Ob,FeatureTest:()=>ui,GlobalWorkerOptions:()=>Qn,ImageKind:()=>Bf,InvalidPDFException:()=>TS,MissingPDFException:()=>Lr,OPS:()=>ms,OutputScale:()=>_0,PDFDataRangeTransport:()=>A_,PDFDateString:()=>Pb,PDFWorker:()=>Do,PasswordResponses:()=>dx,PermissionFlag:()=>hx,PixelsPerInch:()=>el,RenderingCancelledException:()=>Ub,TextLayer:()=>Wu,UnexpectedResponseException:()=>Pg,Util:()=>ct,VerbosityLevel:()=>Fg,XfaLayer:()=>__,build:()=>PC,createValidAbsoluteUrl:()=>mx,fetchData:()=>jg,getDocument:()=>LC,getFilenameFromUrl:()=>wx,getPdfFilenameFromUrl:()=>xx,getXfaPageViewport:()=>Cx,isDataScheme:()=>qg,isPdfFile:()=>Bb,noContextMenu:()=>hs,normalizeUnicode:()=>_x,setLayerDimensions:()=>xr,shadow:()=>Ft,version:()=>BC});const ni=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),ES=[1,0,0,1,0,0],v0=[.001,0,0,.001,0,0],cx=1e7,d0=1.35,qi={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Ca={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},ux="pdfjs_internal_editor_",Et={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},vt={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},hx={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},$e={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Bf={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},we={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,WIDGET:20},Ru={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Fg={ERRORS:0,WARNINGS:1,INFOS:5},ms={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},dx={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Ug=Fg.WARNINGS;function fx(b){Number.isInteger(b)&&(Ug=b)}function gx(){return Ug}function Bg(b){Ug>=Fg.INFOS&&console.log(`Info: ${b}`)}function Ct(b){Ug>=Fg.WARNINGS&&console.log(`Warning: ${b}`)}function se(b){throw new Error(b)}function De(b,e){b||se(e)}function px(b){switch(b==null?void 0:b.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function mx(b,e=null,i=null){if(!b)return null;try{if(i&&typeof b=="string"){if(i.addDefaultProtocol&&b.startsWith("www.")){const l=b.match(/\./g);(l==null?void 0:l.length)>=2&&(b=`http://${b}`)}if(i.tryConvertEncoding)try{b=Sx(b)}catch{}}const n=e?new URL(b,e):new URL(b);if(px(n))return n}catch{}return null}function Ft(b,e,i,n=!1){return Object.defineProperty(b,e,{value:i,enumerable:!n,configurable:!0,writable:!1}),i}const al=function(){function e(i,n){this.message=i,this.name=n}return e.prototype=new Error,e.constructor=e,e}();class y0 extends al{constructor(e,i){super(e,"PasswordException"),this.code=i}}class A0 extends al{constructor(e,i){super(e,"UnknownErrorException"),this.details=i}}class TS extends al{constructor(e){super(e,"InvalidPDFException")}}class Lr extends al{constructor(e){super(e,"MissingPDFException")}}class Pg extends al{constructor(e,i){super(e,"UnexpectedResponseException"),this.status=i}}class bx extends al{constructor(e){super(e,"FormatError")}}class Or extends al{constructor(e){super(e,"AbortException")}}function wS(b){(typeof b!="object"||(b==null?void 0:b.length)===void 0)&&se("Invalid argument for bytesToString");const e=b.length,i=8192;if(e<i)return String.fromCharCode.apply(null,b);const n=[];for(let l=0;l<e;l+=i){const o=Math.min(l+i,e),u=b.subarray(l,o);n.push(String.fromCharCode.apply(null,u))}return n.join("")}function Ig(b){typeof b!="string"&&se("Invalid argument for stringToBytes");const e=b.length,i=new Uint8Array(e);for(let n=0;n<e;++n)i[n]=b.charCodeAt(n)&255;return i}function vx(b){return String.fromCharCode(b>>24&255,b>>16&255,b>>8&255,b&255)}function Hb(b){const e=Object.create(null);for(const[i,n]of b)e[i]=n;return e}function yx(){const b=new Uint8Array(4);return b[0]=1,new Uint32Array(b.buffer,0,1)[0]===1}function Ax(){try{return new Function(""),!0}catch{return!1}}class ui{static get isLittleEndian(){return Ft(this,"isLittleEndian",yx())}static get isEvalSupported(){return Ft(this,"isEvalSupported",Ax())}static get isOffscreenCanvasSupported(){return Ft(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?Ft(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:typeof(navigator==null?void 0:navigator.userAgent)=="string"&&navigator.userAgent.includes("Firefox")}):Ft(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var e,i;return Ft(this,"isCSSRoundSupported",(i=(e=globalThis.CSS)==null?void 0:e.supports)==null?void 0:i.call(e,"width: round(1.5px, 1px)"))}}const f0=Array.from(Array(256).keys(),b=>b.toString(16).padStart(2,"0"));var Wn,Pf,S0;class ct{static makeHexColor(e,i,n){return`#${f0[e]}${f0[i]}${f0[n]}`}static scaleMinMax(e,i){let n;e[0]?(e[0]<0&&(n=i[0],i[0]=i[2],i[2]=n),i[0]*=e[0],i[2]*=e[0],e[3]<0&&(n=i[1],i[1]=i[3],i[3]=n),i[1]*=e[3],i[3]*=e[3]):(n=i[0],i[0]=i[1],i[1]=n,n=i[2],i[2]=i[3],i[3]=n,e[1]<0&&(n=i[1],i[1]=i[3],i[3]=n),i[1]*=e[1],i[3]*=e[1],e[2]<0&&(n=i[0],i[0]=i[2],i[2]=n),i[0]*=e[2],i[2]*=e[2]),i[0]+=e[4],i[1]+=e[5],i[2]+=e[4],i[3]+=e[5]}static transform(e,i){return[e[0]*i[0]+e[2]*i[1],e[1]*i[0]+e[3]*i[1],e[0]*i[2]+e[2]*i[3],e[1]*i[2]+e[3]*i[3],e[0]*i[4]+e[2]*i[5]+e[4],e[1]*i[4]+e[3]*i[5]+e[5]]}static applyTransform(e,i){const n=e[0]*i[0]+e[1]*i[2]+i[4],l=e[0]*i[1]+e[1]*i[3]+i[5];return[n,l]}static applyInverseTransform(e,i){const n=i[0]*i[3]-i[1]*i[2],l=(e[0]*i[3]-e[1]*i[2]+i[2]*i[5]-i[4]*i[3])/n,o=(-e[0]*i[1]+e[1]*i[0]+i[4]*i[1]-i[5]*i[0])/n;return[l,o]}static getAxialAlignedBoundingBox(e,i){const n=this.applyTransform(e,i),l=this.applyTransform(e.slice(2,4),i),o=this.applyTransform([e[0],e[3]],i),u=this.applyTransform([e[2],e[1]],i);return[Math.min(n[0],l[0],o[0],u[0]),Math.min(n[1],l[1],o[1],u[1]),Math.max(n[0],l[0],o[0],u[0]),Math.max(n[1],l[1],o[1],u[1])]}static inverseTransform(e){const i=e[0]*e[3]-e[1]*e[2];return[e[3]/i,-e[1]/i,-e[2]/i,e[0]/i,(e[2]*e[5]-e[4]*e[3])/i,(e[4]*e[1]-e[5]*e[0])/i]}static singularValueDecompose2dScale(e){const i=[e[0],e[2],e[1],e[3]],n=e[0]*i[0]+e[1]*i[2],l=e[0]*i[1]+e[1]*i[3],o=e[2]*i[0]+e[3]*i[2],u=e[2]*i[1]+e[3]*i[3],d=(n+u)/2,f=Math.sqrt((n+u)**2-4*(n*u-o*l))/2,g=d+f||1,m=d-f||1;return[Math.sqrt(g),Math.sqrt(m)]}static normalizeRect(e){const i=e.slice(0);return e[0]>e[2]&&(i[0]=e[2],i[2]=e[0]),e[1]>e[3]&&(i[1]=e[3],i[3]=e[1]),i}static intersect(e,i){const n=Math.max(Math.min(e[0],e[2]),Math.min(i[0],i[2])),l=Math.min(Math.max(e[0],e[2]),Math.max(i[0],i[2]));if(n>l)return null;const o=Math.max(Math.min(e[1],e[3]),Math.min(i[1],i[3])),u=Math.min(Math.max(e[1],e[3]),Math.max(i[1],i[3]));return o>u?null:[n,o,l,u]}static bezierBoundingBox(e,i,n,l,o,u,d,f,g){return g?(g[0]=Math.min(g[0],e,d),g[1]=Math.min(g[1],i,f),g[2]=Math.max(g[2],e,d),g[3]=Math.max(g[3],i,f)):g=[Math.min(e,d),Math.min(i,f),Math.max(e,d),Math.max(i,f)],_(this,Wn,S0).call(this,e,n,o,d,i,l,u,f,3*(-e+3*(n-o)+d),6*(e-2*n+o),3*(n-e),g),_(this,Wn,S0).call(this,e,n,o,d,i,l,u,f,3*(-i+3*(l-u)+f),6*(i-2*l+u),3*(l-i),g),g}}Wn=new WeakSet,Pf=function(e,i,n,l,o,u,d,f,g,m){if(g<=0||g>=1)return;const v=1-g,y=g*g,E=y*g,x=v*(v*(v*e+3*g*i)+3*y*n)+E*l,C=v*(v*(v*o+3*g*u)+3*y*d)+E*f;m[0]=Math.min(m[0],x),m[1]=Math.min(m[1],C),m[2]=Math.max(m[2],x),m[3]=Math.max(m[3],C)},S0=function(e,i,n,l,o,u,d,f,g,m,v,y){if(Math.abs(g)<1e-12){Math.abs(m)>=1e-12&&_(this,Wn,Pf).call(this,e,i,n,l,o,u,d,f,-v/m,y);return}const E=m**2-4*v*g;if(E<0)return;const x=Math.sqrt(E),C=2*g;_(this,Wn,Pf).call(this,e,i,n,l,o,u,d,f,(-m+x)/C,y),_(this,Wn,Pf).call(this,e,i,n,l,o,u,d,f,(-m-x)/C,y)},w(ct,Wn);function Sx(b){return decodeURIComponent(escape(b))}let g0=null,iS=null;function _x(b){return g0||(g0=/([\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,iS=new Map([["ſt","ſt"]])),b.replaceAll(g0,(e,i,n)=>i?i.normalize("NFKC"):iS.get(n))}function Ex(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const b=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(b);else for(let e=0;e<32;e++)b[e]=Math.floor(Math.random()*255);return wS(b)}const Fb="pdfjs_internal_id_",An={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8};function Tx(b){return Uint8Array.prototype.toBase64?b.toBase64():btoa(wS(b))}const _n="http://www.w3.org/2000/svg",Ml=class Ml{};bt(Ml,"CSS",96),bt(Ml,"PDF",72),bt(Ml,"PDF_TO_CSS_UNITS",Ml.CSS/Ml.PDF);let el=Ml;async function jg(b,e="text"){if(Ou(b,document.baseURI)){const i=await fetch(b);if(!i.ok)throw new Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise((i,n)=>{const l=new XMLHttpRequest;l.open("GET",b,!0),l.responseType=e,l.onreadystatechange=()=>{if(l.readyState===XMLHttpRequest.DONE){if(l.status===200||l.status===0){switch(e){case"arraybuffer":case"blob":case"json":i(l.response);return}i(l.responseText);return}n(new Error(l.statusText))}},l.send(null)})}class gd{constructor({viewBox:e,scale:i,rotation:n,offsetX:l=0,offsetY:o=0,dontFlip:u=!1}){this.viewBox=e,this.scale=i,this.rotation=n,this.offsetX=l,this.offsetY=o;const d=(e[2]+e[0])/2,f=(e[3]+e[1])/2;let g,m,v,y;switch(n%=360,n<0&&(n+=360),n){case 180:g=-1,m=0,v=0,y=1;break;case 90:g=0,m=1,v=1,y=0;break;case 270:g=0,m=-1,v=-1,y=0;break;case 0:g=1,m=0,v=0,y=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}u&&(v=-v,y=-y);let E,x,C,L;g===0?(E=Math.abs(f-e[1])*i+l,x=Math.abs(d-e[0])*i+o,C=(e[3]-e[1])*i,L=(e[2]-e[0])*i):(E=Math.abs(d-e[0])*i+l,x=Math.abs(f-e[1])*i+o,C=(e[2]-e[0])*i,L=(e[3]-e[1])*i),this.transform=[g*i,m*i,v*i,y*i,E-g*i*d-v*i*f,x-m*i*d-y*i*f],this.width=C,this.height=L}get rawDims(){const{viewBox:e}=this;return Ft(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:i=this.rotation,offsetX:n=this.offsetX,offsetY:l=this.offsetY,dontFlip:o=!1}={}){return new gd({viewBox:this.viewBox.slice(),scale:e,rotation:i,offsetX:n,offsetY:l,dontFlip:o})}convertToViewportPoint(e,i){return ct.applyTransform([e,i],this.transform)}convertToViewportRectangle(e){const i=ct.applyTransform([e[0],e[1]],this.transform),n=ct.applyTransform([e[2],e[3]],this.transform);return[i[0],i[1],n[0],n[1]]}convertToPdfPoint(e,i){return ct.applyInverseTransform([e,i],this.transform)}}class Ub extends al{constructor(e,i=0){super(e,"RenderingCancelledException"),this.extraDelay=i}}function qg(b){const e=b.length;let i=0;for(;i<e&&b[i].trim()==="";)i++;return b.substring(i,i+5).toLowerCase()==="data:"}function Bb(b){return typeof b=="string"&&/\.pdf$/i.test(b)}function wx(b){return[b]=b.split(/[#?]/,1),b.substring(b.lastIndexOf("/")+1)}function xx(b,e="document.pdf"){if(typeof b!="string")return e;if(qg(b))return Ct('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const i=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,n=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,l=i.exec(b);let o=n.exec(l[1])||n.exec(l[2])||n.exec(l[3]);if(o&&(o=o[0],o.includes("%")))try{o=n.exec(decodeURIComponent(o))[0]}catch{}return o||e}class sS{constructor(){bt(this,"started",Object.create(null));bt(this,"times",[])}time(e){e in this.started&&Ct(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||Ct(`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 i=0;for(const{name:n}of this.times)i=Math.max(n.length,i);for(const{name:n,start:l,end:o}of this.times)e.push(`${n.padEnd(i)} ${o-l}ms
`);return e.join("")}}function Ou(b,e){try{const{protocol:i}=e?new URL(b,e):new URL(b);return i==="http:"||i==="https:"}catch{return!1}}function hs(b){b.preventDefault()}function nS(b){console.log("Deprecated API usage: "+b)}var Ju;class Pb{static toDateObject(e){if(!e||typeof e!="string")return null;c(this,Ju)||S(this,Ju,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const i=c(this,Ju).exec(e);if(!i)return null;const n=parseInt(i[1],10);let l=parseInt(i[2],10);l=l>=1&&l<=12?l-1:0;let o=parseInt(i[3],10);o=o>=1&&o<=31?o:1;let u=parseInt(i[4],10);u=u>=0&&u<=23?u:0;let d=parseInt(i[5],10);d=d>=0&&d<=59?d:0;let f=parseInt(i[6],10);f=f>=0&&f<=59?f:0;const g=i[7]||"Z";let m=parseInt(i[8],10);m=m>=0&&m<=23?m:0;let v=parseInt(i[9],10)||0;return v=v>=0&&v<=59?v:0,g==="-"?(u+=m,d+=v):g==="+"&&(u-=m,d-=v),new Date(Date.UTC(n,l,o,u,d,f))}}Ju=new WeakMap,w(Pb,Ju);function Cx(b,{scale:e=1,rotation:i=0}){const{width:n,height:l}=b.attributes.style,o=[0,0,parseInt(n),parseInt(l)];return new gd({viewBox:o,scale:e,rotation:i})}function Ib(b){if(b.startsWith("#")){const e=parseInt(b.slice(1),16);return[(e&16711680)>>16,(e&65280)>>8,e&255]}return b.startsWith("rgb(")?b.slice(4,-1).split(",").map(e=>parseInt(e)):b.startsWith("rgba(")?b.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):(Ct(`Not a valid color format: "${b}"`),[0,0,0])}function Mx(b){const e=document.createElement("span");e.style.visibility="hidden",document.body.append(e);for(const i of b.keys()){e.style.color=i;const n=window.getComputedStyle(e).color;b.set(i,Ib(n))}e.remove()}function ue(b){const{a:e,b:i,c:n,d:l,e:o,f:u}=b.getTransform();return[e,i,n,l,o,u]}function Sn(b){const{a:e,b:i,c:n,d:l,e:o,f:u}=b.getTransform().invertSelf();return[e,i,n,l,o,u]}function xr(b,e,i=!1,n=!0){if(e instanceof gd){const{pageWidth:l,pageHeight:o}=e.rawDims,{style:u}=b,d=ui.isCSSRoundSupported,f=`var(--scale-factor) * ${l}px`,g=`var(--scale-factor) * ${o}px`,m=d?`round(down, ${f}, var(--scale-round-x, 1px))`:`calc(${f})`,v=d?`round(down, ${g}, var(--scale-round-y, 1px))`:`calc(${g})`;!i||e.rotation%180===0?(u.width=m,u.height=v):(u.width=v,u.height=m)}n&&b.setAttribute("data-main-rotation",e.rotation)}class _0{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}}var Ma,Dl,bs,Ll,th,eh,Ag,xS,hi,CS,MS,If,RS,T0;const En=class En{constructor(e){w(this,hi);w(this,Ma,null);w(this,Dl,null);w(this,bs);w(this,Ll,null);w(this,th,null);S(this,bs,e),c(En,eh)||S(En,eh,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"}))}render(){const e=S(this,Ma,document.createElement("div"));e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const i=c(this,bs)._uiManager._signal;e.addEventListener("contextmenu",hs,{signal:i}),e.addEventListener("pointerdown",_(En,Ag,xS),{signal:i});const n=S(this,Ll,document.createElement("div"));n.className="buttons",e.append(n);const l=c(this,bs).toolbarPosition;if(l){const{style:o}=e,u=c(this,bs)._uiManager.direction==="ltr"?1-l[0]:l[0];o.insetInlineEnd=`${100*u}%`,o.top=`calc(${100*l[1]}% + var(--editor-toolbar-vert-offset))`}return _(this,hi,RS).call(this),e}get div(){return c(this,Ma)}hide(){var e;c(this,Ma).classList.add("hidden"),(e=c(this,Dl))==null||e.hideDropdown()}show(){var e;c(this,Ma).classList.remove("hidden"),(e=c(this,th))==null||e.shown()}async addAltText(e){const i=await e.render();_(this,hi,If).call(this,i),c(this,Ll).prepend(i,c(this,hi,T0)),S(this,th,e)}addColorPicker(e){S(this,Dl,e);const i=e.renderButton();_(this,hi,If).call(this,i),c(this,Ll).prepend(i,c(this,hi,T0))}remove(){var e;c(this,Ma).remove(),(e=c(this,Dl))==null||e.destroy(),S(this,Dl,null)}};Ma=new WeakMap,Dl=new WeakMap,bs=new WeakMap,Ll=new WeakMap,th=new WeakMap,eh=new WeakMap,Ag=new WeakSet,xS=function(e){e.stopPropagation()},hi=new WeakSet,CS=function(e){c(this,bs)._focusEventsAllowed=!1,e.preventDefault(),e.stopPropagation()},MS=function(e){c(this,bs)._focusEventsAllowed=!0,e.preventDefault(),e.stopPropagation()},If=function(e){const i=c(this,bs)._uiManager._signal;e.addEventListener("focusin",_(this,hi,CS).bind(this),{capture:!0,signal:i}),e.addEventListener("focusout",_(this,hi,MS).bind(this),{capture:!0,signal:i}),e.addEventListener("contextmenu",hs,{signal:i})},RS=function(){const{editorType:e,_uiManager:i}=c(this,bs),n=document.createElement("button");n.className="delete",n.tabIndex=0,n.setAttribute("data-l10n-id",c(En,eh)[e]),_(this,hi,If).call(this,n),n.addEventListener("click",l=>{i.delete()},{signal:i._signal}),c(this,Ll).append(n)},T0=function(){const e=document.createElement("div");return e.className="divider",e},w(En,Ag),w(En,eh,null);let E0=En;var ih,Ol,Nl,sl,DS,LS,OS;class Rx{constructor(e){w(this,sl);w(this,ih,null);w(this,Ol,null);w(this,Nl);S(this,Nl,e)}show(e,i,n){const[l,o]=_(this,sl,LS).call(this,i,n),{style:u}=c(this,Ol)||S(this,Ol,_(this,sl,DS).call(this));e.append(c(this,Ol)),u.insetInlineEnd=`${100*l}%`,u.top=`calc(${100*o}% + var(--editor-toolbar-vert-offset))`}hide(){c(this,Ol).remove()}}ih=new WeakMap,Ol=new WeakMap,Nl=new WeakMap,sl=new WeakSet,DS=function(){const e=S(this,Ol,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",hs,{signal:c(this,Nl)._signal});const i=S(this,ih,document.createElement("div"));return i.className="buttons",e.append(i),_(this,sl,OS).call(this),e},LS=function(e,i){let n=0,l=0;for(const o of e){const u=o.y+o.height;if(u<n)continue;const d=o.x+(i?o.width:0);if(u>n){l=d,n=u;continue}i?d>l&&(l=d):d<l&&(l=d)}return[i?1-l:l,n]},OS=function(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const i=document.createElement("span");e.append(i),i.className="visuallyHidden",i.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const n=c(this,Nl)._signal;e.addEventListener("contextmenu",hs,{signal:n}),e.addEventListener("click",()=>{c(this,Nl).highlightSelection("floating_button")},{signal:n}),c(this,ih).append(e)};function pg(b,e,i){for(const n of i)e.addEventListener(n,b[n].bind(b))}function Dx(b){return Math.round(Math.min(255,Math.max(1,255*b))).toString(16).padStart(2,"0")}var Sg;class Lx{constructor(){w(this,Sg,0)}get id(){return`${ux}${li(this,Sg)._++}`}}Sg=new WeakMap;var Lo,sh,ti,Oo,jf;const Qb=class Qb{constructor(){w(this,Oo);w(this,Lo,Ex());w(this,sh,0);w(this,ti,null)}static get _isSVGFittingCanvas(){const e='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',n=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),l=new Image;l.src=e;const o=l.decode().then(()=>(n.drawImage(l,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return Ft(this,"_isSVGFittingCanvas",o)}async getFromFile(e){const{lastModified:i,name:n,size:l,type:o}=e;return _(this,Oo,jf).call(this,`${i}_${n}_${l}_${o}`,e)}async getFromUrl(e){return _(this,Oo,jf).call(this,e,e)}async getFromBlob(e,i){const n=await i;return _(this,Oo,jf).call(this,e,n)}async getFromId(e){c(this,ti)||S(this,ti,new Map);const i=c(this,ti).get(e);if(!i)return null;if(i.bitmap)return i.refCounter+=1,i;if(i.file)return this.getFromFile(i.file);if(i.blobPromise){const{blobPromise:n}=i;return delete i.blobPromise,this.getFromBlob(i.id,n)}return this.getFromUrl(i.url)}getFromCanvas(e,i){c(this,ti)||S(this,ti,new Map);let n=c(this,ti).get(e);if(n!=null&&n.bitmap)return n.refCounter+=1,n;const l=new OffscreenCanvas(i.width,i.height);return l.getContext("2d").drawImage(i,0,0),n={bitmap:l.transferToImageBitmap(),id:`image_${c(this,Lo)}_${li(this,sh)._++}`,refCounter:1,isSvg:!1},c(this,ti).set(e,n),c(this,ti).set(n.id,n),n}getSvgUrl(e){const i=c(this,ti).get(e);return i!=null&&i.isSvg?i.svgUrl:null}deleteId(e){var l;c(this,ti)||S(this,ti,new Map);const i=c(this,ti).get(e);if(!i||(i.refCounter-=1,i.refCounter!==0))return;const{bitmap:n}=i;if(!i.url&&!i.file){const o=new OffscreenCanvas(n.width,n.height);o.getContext("bitmaprenderer").transferFromImageBitmap(n),i.blobPromise=o.convertToBlob()}(l=n.close)==null||l.call(n),i.bitmap=null}isValidId(e){return e.startsWith(`image_${c(this,Lo)}_`)}};Lo=new WeakMap,sh=new WeakMap,ti=new WeakMap,Oo=new WeakSet,jf=async function(e,i){c(this,ti)||S(this,ti,new Map);let n=c(this,ti).get(e);if(n===null)return null;if(n!=null&&n.bitmap)return n.refCounter+=1,n;try{n||(n={bitmap:null,id:`image_${c(this,Lo)}_${li(this,sh)._++}`,refCounter:0,isSvg:!1});let l;if(typeof i=="string"?(n.url=i,l=await jg(i,"blob")):i instanceof File?l=n.file=i:i instanceof Blob&&(l=i),l.type==="image/svg+xml"){const o=Qb._isSVGFittingCanvas,u=new FileReader,d=new Image,f=new Promise((g,m)=>{d.onload=()=>{n.bitmap=d,n.isSvg=!0,g()},u.onload=async()=>{const v=n.svgUrl=u.result;d.src=await o?`${v}#svgView(preserveAspectRatio(none))`:v},d.onerror=u.onerror=m});u.readAsDataURL(l),await f}else n.bitmap=await createImageBitmap(l);n.refCounter=1}catch(l){console.error(l),n=null}return c(this,ti).set(e,n),n&&c(this,ti).set(n.id,n),n};let w0=Qb;var He,Ra,nh,Fe;class Ox{constructor(e=128){w(this,He,[]);w(this,Ra,!1);w(this,nh);w(this,Fe,-1);S(this,nh,e)}add({cmd:e,undo:i,post:n,mustExec:l,type:o=NaN,overwriteIfSameType:u=!1,keepUndo:d=!1}){if(l&&e(),c(this,Ra))return;const f={cmd:e,undo:i,post:n,type:o};if(c(this,Fe)===-1){c(this,He).length>0&&(c(this,He).length=0),S(this,Fe,0),c(this,He).push(f);return}if(u&&c(this,He)[c(this,Fe)].type===o){d&&(f.undo=c(this,He)[c(this,Fe)].undo),c(this,He)[c(this,Fe)]=f;return}const g=c(this,Fe)+1;g===c(this,nh)?c(this,He).splice(0,1):(S(this,Fe,g),g<c(this,He).length&&c(this,He).splice(g)),c(this,He).push(f)}undo(){if(c(this,Fe)===-1)return;S(this,Ra,!0);const{undo:e,post:i}=c(this,He)[c(this,Fe)];e(),i==null||i(),S(this,Ra,!1),S(this,Fe,c(this,Fe)-1)}redo(){if(c(this,Fe)<c(this,He).length-1){S(this,Fe,c(this,Fe)+1),S(this,Ra,!0);const{cmd:e,post:i}=c(this,He)[c(this,Fe)];e(),i==null||i(),S(this,Ra,!1)}}hasSomethingToUndo(){return c(this,Fe)!==-1}hasSomethingToRedo(){return c(this,Fe)<c(this,He).length-1}destroy(){S(this,He,null)}}He=new WeakMap,Ra=new WeakMap,nh=new WeakMap,Fe=new WeakMap;var _g,NS;class pd{constructor(e){w(this,_g);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:i}=ui.platform;for(const[n,l,o={}]of e)for(const u of n){const d=u.startsWith("mac+");i&&d?(this.callbacks.set(u.slice(4),{callback:l,options:o}),this.allKeys.add(u.split("+").at(-1))):!i&&!d&&(this.callbacks.set(u,{callback:l,options:o}),this.allKeys.add(u.split("+").at(-1)))}}exec(e,i){if(!this.allKeys.has(i.key))return;const n=this.callbacks.get(_(this,_g,NS).call(this,i));if(!n)return;const{callback:l,options:{bubbles:o=!1,args:u=[],checker:d=null}}=n;d&&!d(e,i)||(l.bind(e,...u,i)(),o||(i.stopPropagation(),i.preventDefault()))}}_g=new WeakSet,NS=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 i=this.buffer.join("+");return this.buffer.length=0,i};const Eg=class Eg{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return Mx(e),Ft(this,"_colors",e)}convert(e){const i=Ib(e);if(!window.matchMedia("(forced-colors: active)").matches)return i;for(const[n,l]of this._colors)if(l.every((o,u)=>o===i[u]))return Eg._colorsMapping.get(n);return i}getHexCode(e){const i=this._colors.get(e);return i?ct.makeHexColor(...i):e}};bt(Eg,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let x0=Eg;var No,zi,Ce,Xe,ko,wn,zo,vs,Da,Ho,kl,Bs,ys,zl,ah,lh,Fo,rh,Ps,La,Uo,Oa,Is,Tg,Na,oh,ka,Hl,ch,uh,Ue,Yt,xn,Fl,hh,dh,za,js,Cn,fh,ss,et,qf,C0,kS,zS,Gf,HS,FS,US,M0,BS,R0,D0,PS,ri,wa,IS,jS,L0,qS,Nu,O0;const Mo=class Mo{constructor(e,i,n,l,o,u,d,f,g,m,v){w(this,et);w(this,No,new AbortController);w(this,zi,null);w(this,Ce,new Map);w(this,Xe,new Map);w(this,ko,null);w(this,wn,null);w(this,zo,null);w(this,vs,new Ox);w(this,Da,null);w(this,Ho,0);w(this,kl,new Set);w(this,Bs,null);w(this,ys,null);w(this,zl,new Set);w(this,ah,!1);w(this,lh,!1);w(this,Fo,!1);w(this,rh,null);w(this,Ps,null);w(this,La,null);w(this,Uo,null);w(this,Oa,!1);w(this,Is,null);w(this,Tg,new Lx);w(this,Na,!1);w(this,oh,!1);w(this,ka,null);w(this,Hl,null);w(this,ch,null);w(this,uh,null);w(this,Ue,Et.NONE);w(this,Yt,new Set);w(this,xn,null);w(this,Fl,null);w(this,hh,null);w(this,dh,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});w(this,za,[0,0]);w(this,js,null);w(this,Cn,null);w(this,fh,null);w(this,ss,null);const y=this._signal=c(this,No).signal;S(this,Cn,e),S(this,fh,i),S(this,ko,n),this._eventBus=l,l._on("editingaction",this.onEditingAction.bind(this),{signal:y}),l._on("pagechanging",this.onPageChanging.bind(this),{signal:y}),l._on("scalechanging",this.onScaleChanging.bind(this),{signal:y}),l._on("rotationchanging",this.onRotationChanging.bind(this),{signal:y}),l._on("setpreference",this.onSetPreference.bind(this),{signal:y}),l._on("switchannotationeditorparams",E=>this.updateParams(E.type,E.value),{signal:y}),_(this,et,HS).call(this),_(this,et,PS).call(this),_(this,et,M0).call(this),S(this,wn,o.annotationStorage),S(this,rh,o.filterFactory),S(this,Fl,u),S(this,Uo,d||null),S(this,ah,f),S(this,lh,g),S(this,Fo,m),S(this,uh,v||null),this.viewParameters={realScale:el.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}static get _keyboardManager(){const e=Mo.prototype,i=u=>c(u,Cn).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&u.hasSomethingToControl(),n=(u,{target:d})=>{if(d instanceof HTMLInputElement){const{type:f}=d;return f!=="text"&&f!=="number"}return!0},l=this.TRANSLATE_SMALL,o=this.TRANSLATE_BIG;return Ft(this,"_keyboardManager",new pd([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],e.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:n}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:n}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(u,{target:d})=>!(d instanceof HTMLButtonElement)&&c(u,Cn).contains(d)&&!u.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(u,{target:d})=>!(d instanceof HTMLButtonElement)&&c(u,Cn).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-l,0],checker:i}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-o,0],checker:i}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[l,0],checker:i}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[o,0],checker:i}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-l],checker:i}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-o],checker:i}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,l],checker:i}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,o],checker:i}]]))}destroy(){var e,i,n,l;(e=c(this,ss))==null||e.resolve(),S(this,ss,null),(i=c(this,No))==null||i.abort(),S(this,No,null),this._signal=null;for(const o of c(this,Xe).values())o.destroy();c(this,Xe).clear(),c(this,Ce).clear(),c(this,zl).clear(),S(this,zi,null),c(this,Yt).clear(),c(this,vs).destroy(),(n=c(this,ko))==null||n.destroy(),(l=c(this,Is))==null||l.hide(),S(this,Is,null),c(this,Ps)&&(clearTimeout(c(this,Ps)),S(this,Ps,null)),c(this,js)&&(clearTimeout(c(this,js)),S(this,js,null))}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return c(this,uh)}get useNewAltTextFlow(){return c(this,lh)}get useNewAltTextWhenAddingImage(){return c(this,Fo)}get hcmFilter(){return Ft(this,"hcmFilter",c(this,Fl)?c(this,rh).addHCMFilter(c(this,Fl).foreground,c(this,Fl).background):"none")}get direction(){return Ft(this,"direction",getComputedStyle(c(this,Cn)).direction)}get highlightColors(){return Ft(this,"highlightColors",c(this,Uo)?new Map(c(this,Uo).split(",").map(e=>e.split("=").map(i=>i.trim()))):null)}get highlightColorNames(){return Ft(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}setMainHighlightColorPicker(e){S(this,ch,e)}editAltText(e,i=!1){var n;(n=c(this,ko))==null||n.editAltText(this,e,i)}switchToMode(e,i){this._eventBus.on("annotationeditormodechanged",i,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,i){this._eventBus.dispatch("setpreference",{source:this,name:e,value:i})}onSetPreference({name:e,value:i}){switch(e){case"enableNewAltTextWhenAddingImage":S(this,Fo,i);break}}onPageChanging({pageNumber:e}){S(this,Ho,e-1)}focusMainContainer(){c(this,Cn).focus()}findParent(e,i){for(const n of c(this,Xe).values()){const{x:l,y:o,width:u,height:d}=n.div.getBoundingClientRect();if(e>=l&&e<=l+u&&i>=o&&i<=o+d)return n}return null}disableUserSelect(e=!1){c(this,fh).classList.toggle("noUserSelect",e)}addShouldRescale(e){c(this,zl).add(e)}removeShouldRescale(e){c(this,zl).delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*el.PDF_TO_CSS_UNITS;for(const i of c(this,zl))i.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e=""){const i=document.getSelection();if(!i||i.isCollapsed)return;const{anchorNode:n,anchorOffset:l,focusNode:o,focusOffset:u}=i,d=i.toString(),g=_(this,et,qf).call(this,i).closest(".textLayer"),m=this.getSelectionBoxes(g);if(!m)return;i.empty();const v=_(this,et,C0).call(this,g),y=c(this,Ue)===Et.NONE,E=()=>{v==null||v.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:m,anchorNode:n,anchorOffset:l,focusNode:o,focusOffset:u,text:d}),y&&this.showAllEditors("highlight",!0,!0)};if(y){this.switchToMode(Et.HIGHLIGHT,E);return}E()}addToAnnotationStorage(e){!e.isEmpty()&&c(this,wn)&&!c(this,wn).has(e.id)&&c(this,wn).setValue(e.id,e)}blur(){if(this.isShiftKeyDown=!1,c(this,Oa)&&(S(this,Oa,!1),_(this,et,Gf).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const i of c(this,Yt))if(i.div.contains(e)){S(this,Hl,[i,e]),i._focusEventsAllowed=!1;break}}focus(){if(!c(this,Hl))return;const[e,i]=c(this,Hl);S(this,Hl,null),i.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),i.focus()}addEditListeners(){_(this,et,M0).call(this),_(this,et,R0).call(this)}removeEditListeners(){_(this,et,BS).call(this),_(this,et,D0).call(this)}dragOver(e){for(const{type:i}of e.dataTransfer.items)for(const n of c(this,ys))if(n.isHandlingMimeForPasting(i)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const i of e.dataTransfer.items)for(const n of c(this,ys))if(n.isHandlingMimeForPasting(i.type)){n.paste(i,this.currentLayer),e.preventDefault();return}}copy(e){var n;if(e.preventDefault(),(n=c(this,zi))==null||n.commitOrRemove(),!this.hasSelection)return;const i=[];for(const l of c(this,Yt)){const o=l.serialize(!0);o&&i.push(o)}i.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(i))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:i}=e;for(const o of i.items)for(const u of c(this,ys))if(u.isHandlingMimeForPasting(o.type)){u.paste(o,this.currentLayer);return}let n=i.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(o){Ct(`paste: "${o.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();const l=this.currentLayer;try{const o=[];for(const f of n){const g=await l.deserialize(f);if(!g)return;o.push(g)}const u=()=>{for(const f of o)_(this,et,L0).call(this,f);_(this,et,O0).call(this,o)},d=()=>{for(const f of o)f.remove()};this.addCommands({cmd:u,undo:d,mustExec:!0})}catch(o){Ct(`paste: "${o.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),c(this,Ue)!==Et.NONE&&!this.isEditorHandlingKeyboard&&Mo._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,c(this,Oa)&&(S(this,Oa,!1),_(this,et,Gf).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?(_(this,et,FS).call(this),_(this,et,R0).call(this),_(this,et,ri).call(this,{isEditing:c(this,Ue)!==Et.NONE,isEmpty:_(this,et,Nu).call(this),hasSomethingToUndo:c(this,vs).hasSomethingToUndo(),hasSomethingToRedo:c(this,vs).hasSomethingToRedo(),hasSelectedEditor:!1})):(_(this,et,US).call(this),_(this,et,D0).call(this),_(this,et,ri).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!c(this,ys)){S(this,ys,e);for(const i of c(this,ys))_(this,et,wa).call(this,i.defaultPropertiesToUpdate)}}getId(){return c(this,Tg).id}get currentLayer(){return c(this,Xe).get(c(this,Ho))}getLayer(e){return c(this,Xe).get(e)}get currentPageIndex(){return c(this,Ho)}addLayer(e){c(this,Xe).set(e.pageIndex,e),c(this,Na)?e.enable():e.disable()}removeLayer(e){c(this,Xe).delete(e.pageIndex)}async updateMode(e,i=null,n=!1){if(c(this,Ue)!==e&&!(c(this,ss)&&(await c(this,ss).promise,!c(this,ss)))){if(S(this,ss,Promise.withResolvers()),S(this,Ue,e),e===Et.NONE){this.setEditingState(!1),_(this,et,jS).call(this),c(this,ss).resolve();return}this.setEditingState(!0),await _(this,et,IS).call(this),this.unselectAll();for(const l of c(this,Xe).values())l.updateMode(e);if(!i){n&&this.addNewEditorFromKeyboard(),c(this,ss).resolve();return}for(const l of c(this,Ce).values())l.annotationElementId===i?(this.setSelected(l),l.enterInEditMode()):l.unselect();c(this,ss).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e!==c(this,Ue)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,i){var n;if(c(this,ys)){switch(e){case vt.CREATE:this.currentLayer.addNewEditor();return;case vt.HIGHLIGHT_DEFAULT_COLOR:(n=c(this,ch))==null||n.updateColor(i);break;case vt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(c(this,hh)||S(this,hh,new Map)).set(e,i),this.showAllEditors("highlight",i);break}for(const l of c(this,Yt))l.updateParams(e,i);for(const l of c(this,ys))l.updateDefaultParams(e,i)}}showAllEditors(e,i,n=!1){var o;for(const u of c(this,Ce).values())u.editorType===e&&u.show(i);(((o=c(this,hh))==null?void 0:o.get(vt.HIGHLIGHT_SHOW_ALL))??!0)!==i&&_(this,et,wa).call(this,[[vt.HIGHLIGHT_SHOW_ALL,i]])}enableWaiting(e=!1){if(c(this,oh)!==e){S(this,oh,e);for(const i of c(this,Xe).values())e?i.disableClick():i.enableClick(),i.div.classList.toggle("waiting",e)}}getEditors(e){const i=[];for(const n of c(this,Ce).values())n.pageIndex===e&&i.push(n);return i}getEditor(e){return c(this,Ce).get(e)}addEditor(e){c(this,Ce).set(e.id,e)}removeEditor(e){var i;e.div.contains(document.activeElement)&&(c(this,Ps)&&clearTimeout(c(this,Ps)),S(this,Ps,setTimeout(()=>{this.focusMainContainer(),S(this,Ps,null)},0))),c(this,Ce).delete(e.id),this.unselect(e),(!e.annotationElementId||!c(this,kl).has(e.annotationElementId))&&((i=c(this,wn))==null||i.remove(e.id))}addDeletedAnnotationElement(e){c(this,kl).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return c(this,kl).has(e)}removeDeletedAnnotationElement(e){c(this,kl).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){c(this,zi)!==e&&(S(this,zi,e),e&&_(this,et,wa).call(this,e.propertiesToUpdate))}updateUI(e){c(this,et,qS)===e&&_(this,et,wa).call(this,e.propertiesToUpdate)}toggleSelected(e){if(c(this,Yt).has(e)){c(this,Yt).delete(e),e.unselect(),_(this,et,ri).call(this,{hasSelectedEditor:this.hasSelection});return}c(this,Yt).add(e),e.select(),_(this,et,wa).call(this,e.propertiesToUpdate),_(this,et,ri).call(this,{hasSelectedEditor:!0})}setSelected(e){for(const i of c(this,Yt))i!==e&&i.unselect();c(this,Yt).clear(),c(this,Yt).add(e),e.select(),_(this,et,wa).call(this,e.propertiesToUpdate),_(this,et,ri).call(this,{hasSelectedEditor:!0})}isSelected(e){return c(this,Yt).has(e)}get firstSelectedEditor(){return c(this,Yt).values().next().value}unselect(e){e.unselect(),c(this,Yt).delete(e),_(this,et,ri).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return c(this,Yt).size!==0}get isEnterHandled(){return c(this,Yt).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){c(this,vs).undo(),_(this,et,ri).call(this,{hasSomethingToUndo:c(this,vs).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:_(this,et,Nu).call(this)})}redo(){c(this,vs).redo(),_(this,et,ri).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:c(this,vs).hasSomethingToRedo(),isEmpty:_(this,et,Nu).call(this)})}addCommands(e){c(this,vs).add(e),_(this,et,ri).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:_(this,et,Nu).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const e=[...c(this,Yt)],i=()=>{for(const l of e)l.remove()},n=()=>{for(const l of e)_(this,et,L0).call(this,l)};this.addCommands({cmd:i,undo:n,mustExec:!0})}commitOrRemove(){var e;(e=c(this,zi))==null||e.commitOrRemove()}hasSomethingToControl(){return c(this,zi)||this.hasSelection}selectAll(){for(const e of c(this,Yt))e.commit();_(this,et,O0).call(this,c(this,Ce).values())}unselectAll(){if(!(c(this,zi)&&(c(this,zi).commitOrRemove(),c(this,Ue)!==Et.NONE))&&this.hasSelection){for(const e of c(this,Yt))e.unselect();c(this,Yt).clear(),_(this,et,ri).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,i,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;c(this,za)[0]+=e,c(this,za)[1]+=i;const[l,o]=c(this,za),u=[...c(this,Yt)],d=1e3;c(this,js)&&clearTimeout(c(this,js)),S(this,js,setTimeout(()=>{S(this,js,null),c(this,za)[0]=c(this,za)[1]=0,this.addCommands({cmd:()=>{for(const f of u)c(this,Ce).has(f.id)&&f.translateInPage(l,o)},undo:()=>{for(const f of u)c(this,Ce).has(f.id)&&f.translateInPage(-l,-o)},mustExec:!1})},d));for(const f of u)f.translateInPage(e,i)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),S(this,Bs,new Map);for(const e of c(this,Yt))c(this,Bs).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!c(this,Bs))return!1;this.disableUserSelect(!1);const e=c(this,Bs);S(this,Bs,null);let i=!1;for(const[{x:l,y:o,pageIndex:u},d]of e)d.newX=l,d.newY=o,d.newPageIndex=u,i||(i=l!==d.savedX||o!==d.savedY||u!==d.savedPageIndex);if(!i)return!1;const n=(l,o,u,d)=>{if(c(this,Ce).has(l.id)){const f=c(this,Xe).get(d);f?l._setParentAndPosition(f,o,u):(l.pageIndex=d,l.x=o,l.y=u)}};return this.addCommands({cmd:()=>{for(const[l,{newX:o,newY:u,newPageIndex:d}]of e)n(l,o,u,d)},undo:()=>{for(const[l,{savedX:o,savedY:u,savedPageIndex:d}]of e)n(l,o,u,d)},mustExec:!0}),!0}dragSelectedEditors(e,i){if(c(this,Bs))for(const n of c(this,Bs).keys())n.drag(e,i)}rebuild(e){if(e.parent===null){const i=this.getLayer(e.pageIndex);i?(i.changeParent(e),i.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())||c(this,Yt).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return c(this,zi)===e}getActive(){return c(this,zi)}getMode(){return c(this,Ue)}get imageManager(){return Ft(this,"imageManager",new w0)}getSelectionBoxes(e){if(!e)return null;const i=document.getSelection();for(let g=0,m=i.rangeCount;g<m;g++)if(!e.contains(i.getRangeAt(g).commonAncestorContainer))return null;const{x:n,y:l,width:o,height:u}=e.getBoundingClientRect();let d;switch(e.getAttribute("data-main-rotation")){case"90":d=(g,m,v,y)=>({x:(m-l)/u,y:1-(g+v-n)/o,width:y/u,height:v/o});break;case"180":d=(g,m,v,y)=>({x:1-(g+v-n)/o,y:1-(m+y-l)/u,width:v/o,height:y/u});break;case"270":d=(g,m,v,y)=>({x:1-(m+y-l)/u,y:(g-n)/o,width:y/u,height:v/o});break;default:d=(g,m,v,y)=>({x:(g-n)/o,y:(m-l)/u,width:v/o,height:y/u});break}const f=[];for(let g=0,m=i.rangeCount;g<m;g++){const v=i.getRangeAt(g);if(!v.collapsed)for(const{x:y,y:E,width:x,height:C}of v.getClientRects())x===0||C===0||f.push(d(y,E,x,C))}return f.length===0?null:f}addChangedExistingAnnotation({annotationElementId:e,id:i}){(c(this,zo)||S(this,zo,new Map)).set(e,i)}removeChangedExistingAnnotation({annotationElementId:e}){var i;(i=c(this,zo))==null||i.delete(e)}renderAnnotationElement(e){var l;const i=(l=c(this,zo))==null?void 0:l.get(e.data.id);if(!i)return;const n=c(this,wn).getRawValue(i);n&&(c(this,Ue)===Et.NONE&&!n.hasBeenModified||n.renderAnnotationElement(e))}};No=new WeakMap,zi=new WeakMap,Ce=new WeakMap,Xe=new WeakMap,ko=new WeakMap,wn=new WeakMap,zo=new WeakMap,vs=new WeakMap,Da=new WeakMap,Ho=new WeakMap,kl=new WeakMap,Bs=new WeakMap,ys=new WeakMap,zl=new WeakMap,ah=new WeakMap,lh=new WeakMap,Fo=new WeakMap,rh=new WeakMap,Ps=new WeakMap,La=new WeakMap,Uo=new WeakMap,Oa=new WeakMap,Is=new WeakMap,Tg=new WeakMap,Na=new WeakMap,oh=new WeakMap,ka=new WeakMap,Hl=new WeakMap,ch=new WeakMap,uh=new WeakMap,Ue=new WeakMap,Yt=new WeakMap,xn=new WeakMap,Fl=new WeakMap,hh=new WeakMap,dh=new WeakMap,za=new WeakMap,js=new WeakMap,Cn=new WeakMap,fh=new WeakMap,ss=new WeakMap,et=new WeakSet,qf=function({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e},C0=function(e){const{currentLayer:i}=this;if(i.hasTextLayer(e))return i;for(const n of c(this,Xe).values())if(n.hasTextLayer(e))return n;return null},kS=function(){const e=document.getSelection();if(!e||e.isCollapsed)return;const n=_(this,et,qf).call(this,e).closest(".textLayer"),l=this.getSelectionBoxes(n);l&&(c(this,Is)||S(this,Is,new Rx(this)),c(this,Is).show(n,l,this.direction==="ltr"))},zS=function(){var o,u,d;const e=document.getSelection();if(!e||e.isCollapsed){c(this,xn)&&((o=c(this,Is))==null||o.hide(),S(this,xn,null),_(this,et,ri).call(this,{hasSelectedText:!1}));return}const{anchorNode:i}=e;if(i===c(this,xn))return;const l=_(this,et,qf).call(this,e).closest(".textLayer");if(!l){c(this,xn)&&((u=c(this,Is))==null||u.hide(),S(this,xn,null),_(this,et,ri).call(this,{hasSelectedText:!1}));return}if((d=c(this,Is))==null||d.hide(),S(this,xn,i),_(this,et,ri).call(this,{hasSelectedText:!0}),!(c(this,Ue)!==Et.HIGHLIGHT&&c(this,Ue)!==Et.NONE)&&(c(this,Ue)===Et.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),S(this,Oa,this.isShiftKeyDown),!this.isShiftKeyDown)){const f=c(this,Ue)===Et.HIGHLIGHT?_(this,et,C0).call(this,l):null;f==null||f.toggleDrawing();const g=new AbortController,m=this.combinedSignal(g),v=y=>{y.type==="pointerup"&&y.button!==0||(g.abort(),f==null||f.toggleDrawing(!0),y.type==="pointerup"&&_(this,et,Gf).call(this,"main_toolbar"))};window.addEventListener("pointerup",v,{signal:m}),window.addEventListener("blur",v,{signal:m})}},Gf=function(e=""){c(this,Ue)===Et.HIGHLIGHT?this.highlightSelection(e):c(this,ah)&&_(this,et,kS).call(this)},HS=function(){document.addEventListener("selectionchange",_(this,et,zS).bind(this),{signal:this._signal})},FS=function(){if(c(this,La))return;S(this,La,new AbortController);const e=this.combinedSignal(c(this,La));window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})},US=function(){var e;(e=c(this,La))==null||e.abort(),S(this,La,null)},M0=function(){if(c(this,ka))return;S(this,ka,new AbortController);const e=this.combinedSignal(c(this,ka));window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})},BS=function(){var e;(e=c(this,ka))==null||e.abort(),S(this,ka,null)},R0=function(){if(c(this,Da))return;S(this,Da,new AbortController);const e=this.combinedSignal(c(this,Da));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=c(this,Da))==null||e.abort(),S(this,Da,null)},PS=function(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})},ri=function(e){Object.entries(e).some(([n,l])=>c(this,dh)[n]!==l)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(c(this,dh),e)}),c(this,Ue)===Et.HIGHLIGHT&&e.hasSelectedEditor===!1&&_(this,et,wa).call(this,[[vt.HIGHLIGHT_FREE,!0]]))},wa=function(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})},IS=async function(){if(!c(this,Na)){S(this,Na,!0);const e=[];for(const i of c(this,Xe).values())e.push(i.enable());await Promise.all(e);for(const i of c(this,Ce).values())i.enable()}},jS=function(){if(this.unselectAll(),c(this,Na)){S(this,Na,!1);for(const e of c(this,Xe).values())e.disable();for(const e of c(this,Ce).values())e.disable()}},L0=function(e){const i=c(this,Xe).get(e.pageIndex);i?i.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))},qS=function(){let e=null;for(e of c(this,Yt));return e},Nu=function(){if(c(this,Ce).size===0)return!0;if(c(this,Ce).size===1)for(const e of c(this,Ce).values())return e.isEmpty();return!1},O0=function(e){for(const i of c(this,Yt))i.unselect();c(this,Yt).clear();for(const i of e)i.isEmpty()||(c(this,Yt).add(i),i.select());_(this,et,ri).call(this,{hasSelectedEditor:this.hasSelection})},bt(Mo,"TRANSLATE_SMALL",1),bt(Mo,"TRANSLATE_BIG",10);let Cr=Mo;var Be,qs,As,Bo,Gs,Hi,Po,Xs,Ai,Mn,Ul,Ys,Ha,Ds,ku,Xf;const oi=class oi{constructor(e){w(this,Ds);w(this,Be,null);w(this,qs,!1);w(this,As,null);w(this,Bo,null);w(this,Gs,null);w(this,Hi,null);w(this,Po,!1);w(this,Xs,null);w(this,Ai,null);w(this,Mn,null);w(this,Ul,null);w(this,Ys,!1);S(this,Ai,e),S(this,Ys,e._uiManager.useNewAltTextFlow),c(oi,Ha)||S(oi,Ha,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){oi._l10n??(oi._l10n=e)}async render(){const e=S(this,As,document.createElement("button"));e.className="altText",e.tabIndex="0";const i=S(this,Bo,document.createElement("span"));e.append(i),c(this,Ys)?(e.classList.add("new"),e.setAttribute("data-l10n-id",c(oi,Ha).missing),i.setAttribute("data-l10n-id",c(oi,Ha)["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),i.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const n=c(this,Ai)._uiManager._signal;e.addEventListener("contextmenu",hs,{signal:n}),e.addEventListener("pointerdown",o=>o.stopPropagation(),{signal:n});const l=o=>{o.preventDefault(),c(this,Ai)._uiManager.editAltText(c(this,Ai)),c(this,Ys)&&c(this,Ai)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:c(this,Ds,ku)}})};return e.addEventListener("click",l,{capture:!0,signal:n}),e.addEventListener("keydown",o=>{o.target===e&&o.key==="Enter"&&(S(this,Po,!0),l(o))},{signal:n}),await _(this,Ds,Xf).call(this),e}finish(){c(this,As)&&(c(this,As).focus({focusVisible:c(this,Po)}),S(this,Po,!1))}isEmpty(){return c(this,Ys)?c(this,Be)===null:!c(this,Be)&&!c(this,qs)}hasData(){return c(this,Ys)?c(this,Be)!==null||!!c(this,Mn):this.isEmpty()}get guessedText(){return c(this,Mn)}async setGuessedText(e){c(this,Be)===null&&(S(this,Mn,e),S(this,Ul,await oi._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e})),_(this,Ds,Xf).call(this))}toggleAltTextBadge(e=!1){var i;if(!c(this,Ys)||c(this,Be)){(i=c(this,Xs))==null||i.remove(),S(this,Xs,null);return}if(!c(this,Xs)){const n=S(this,Xs,document.createElement("div"));n.className="noAltTextBadge",c(this,Ai).div.append(n)}c(this,Xs).classList.toggle("hidden",!e)}serialize(e){let i=c(this,Be);return!e&&c(this,Mn)===i&&(i=c(this,Ul)),{altText:i,decorative:c(this,qs),guessedText:c(this,Mn),textWithDisclaimer:c(this,Ul)}}get data(){return{altText:c(this,Be),decorative:c(this,qs)}}set data({altText:e,decorative:i,guessedText:n,textWithDisclaimer:l,cancel:o=!1}){n&&(S(this,Mn,n),S(this,Ul,l)),!(c(this,Be)===e&&c(this,qs)===i)&&(o||(S(this,Be,e),S(this,qs,i)),_(this,Ds,Xf).call(this))}toggle(e=!1){c(this,As)&&(!e&&c(this,Hi)&&(clearTimeout(c(this,Hi)),S(this,Hi,null)),c(this,As).disabled=!e)}shown(){c(this,Ai)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:c(this,Ds,ku)}})}destroy(){var e,i;(e=c(this,As))==null||e.remove(),S(this,As,null),S(this,Bo,null),S(this,Gs,null),(i=c(this,Xs))==null||i.remove(),S(this,Xs,null)}};Be=new WeakMap,qs=new WeakMap,As=new WeakMap,Bo=new WeakMap,Gs=new WeakMap,Hi=new WeakMap,Po=new WeakMap,Xs=new WeakMap,Ai=new WeakMap,Mn=new WeakMap,Ul=new WeakMap,Ys=new WeakMap,Ha=new WeakMap,Ds=new WeakSet,ku=function(){return c(this,Be)&&"added"||c(this,Be)===null&&this.guessedText&&"review"||"missing"},Xf=async function(){var l,o,u;const e=c(this,As);if(!e)return;if(c(this,Ys)){if(e.classList.toggle("done",!!c(this,Be)),e.setAttribute("data-l10n-id",c(oi,Ha)[c(this,Ds,ku)]),(l=c(this,Bo))==null||l.setAttribute("data-l10n-id",c(oi,Ha)[`${c(this,Ds,ku)}-label`]),!c(this,Be)){(o=c(this,Gs))==null||o.remove();return}}else{if(!c(this,Be)&&!c(this,qs)){e.classList.remove("done"),(u=c(this,Gs))==null||u.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let i=c(this,Gs);if(!i){S(this,Gs,i=document.createElement("span")),i.className="tooltip",i.setAttribute("role","tooltip"),i.id=`alt-text-tooltip-${c(this,Ai).id}`;const d=100,f=c(this,Ai)._uiManager._signal;f.addEventListener("abort",()=>{clearTimeout(c(this,Hi)),S(this,Hi,null)},{once:!0}),e.addEventListener("mouseenter",()=>{S(this,Hi,setTimeout(()=>{S(this,Hi,null),c(this,Gs).classList.add("show"),c(this,Ai)._reportTelemetry({action:"alt_text_tooltip"})},d))},{signal:f}),e.addEventListener("mouseleave",()=>{var g;c(this,Hi)&&(clearTimeout(c(this,Hi)),S(this,Hi,null)),(g=c(this,Gs))==null||g.classList.remove("show")},{signal:f})}c(this,qs)?i.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(i.removeAttribute("data-l10n-id"),i.textContent=c(this,Be)),i.parentNode||e.append(i);const n=c(this,Ai).getImageForAltText();n==null||n.setAttribute("aria-describedby",i.id)},w(oi,Ha,null),bt(oi,"_l10n",null);let mg=oi;var Bl,Ss,oe,Io,Pl,Ye,Il,Fa,gh,jl,Ua,ph,ql,Rn,Vs,jo,qo,ns,mh,wg,Tt,N0,bh,k0,z0,GS,XS,H0,F0,U0,YS,B0,VS,KS,QS,P0,zu;const qt=class qt{constructor(e){w(this,Tt);w(this,Bl,null);w(this,Ss,null);w(this,oe,null);w(this,Io,!1);w(this,Pl,!1);w(this,Ye,null);w(this,Il,null);w(this,Fa,null);w(this,gh,"");w(this,jl,!1);w(this,Ua,null);w(this,ph,!1);w(this,ql,!1);w(this,Rn,!1);w(this,Vs,null);w(this,jo,0);w(this,qo,0);w(this,ns,null);bt(this,"_editToolbar",null);bt(this,"_initialOptions",Object.create(null));bt(this,"_initialData",null);bt(this,"_isVisible",!0);bt(this,"_uiManager",null);bt(this,"_focusEventsAllowed",!0);w(this,mh,!1);w(this,wg,qt._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;const{rotation:i,rawDims:{pageWidth:n,pageHeight:l,pageX:o,pageY:u}}=this.parent.viewport;this.rotation=i,this.pageRotation=(360+i-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,l],this.pageTranslation=[o,u];const[d,f]=this.parentDimensions;this.x=e.x/d,this.y=e.y/f,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=qt.prototype._resizeWithKeyboard,i=Cr.TRANSLATE_SMALL,n=Cr.TRANSLATE_BIG;return Ft(this,"_resizerKeyboardManager",new pd([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-i,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[i,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-i]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,i]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,n]}],[["Escape","mac+Escape"],qt.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return Ft(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const i=new Nx({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});i.annotationElementId=e.annotationElementId,i.deleted=!0,i._uiManager.addToAnnotationStorage(i)}static initialize(e,i){if(qt._l10n??(qt._l10n=e),qt._l10nResizer||(qt._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"})),qt._borderLineWidth!==-1)return;const n=getComputedStyle(document.documentElement);qt._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,i){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,i){se("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return c(this,mh)}set _isDraggable(e){var i;S(this,mh,e),(i=this.div)==null||i.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,i]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*i/(e*2),this.y+=this.width*e/(i*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*i/(e*2),this.y-=this.width*e/(i*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=c(this,wg)}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):_(this,Tt,zu).call(this),this.parent=e}focusin(e){this._focusEventsAllowed&&(c(this,jl)?S(this,jl,!1):this.parent.setSelected(this))}focusout(e){var n;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const i=e.relatedTarget;i!=null&&i.closest(`#${this.id}`)||(e.preventDefault(),(n=this.parent)!=null&&n.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,i,n,l){const[o,u]=this.parentDimensions;[n,l]=this.screenToPageTranslation(n,l),this.x=(e+n)/o,this.y=(i+l)/u,this.fixAndSetPosition()}translate(e,i){_(this,Tt,N0).call(this,this.parentDimensions,e,i)}translateInPage(e,i){c(this,Ua)||S(this,Ua,[this.x,this.y]),_(this,Tt,N0).call(this,this.pageDimensions,e,i),this.div.scrollIntoView({block:"nearest"})}drag(e,i){c(this,Ua)||S(this,Ua,[this.x,this.y]);const[n,l]=this.parentDimensions;if(this.x+=e/n,this.y+=i/l,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:g,y:m}=this.div.getBoundingClientRect();this.parent.findNewParent(this,g,m)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:o,y:u}=this;const[d,f]=this.getBaseTranslation();o+=d,u+=f,this.div.style.left=`${(100*o).toFixed(2)}%`,this.div.style.top=`${(100*u).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!c(this,Ua)&&(c(this,Ua)[0]!==this.x||c(this,Ua)[1]!==this.y)}getBaseTranslation(){const[e,i]=this.parentDimensions,{_borderLineWidth:n}=qt,l=n/e,o=n/i;switch(this.rotation){case 90:return[-l,o];case 180:return[l,o];case 270:return[l,-o];default:return[-l,-o]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const[i,n]=this.pageDimensions;let{x:l,y:o,width:u,height:d}=this;if(u*=i,d*=n,l*=i,o*=n,this._mustFixPosition)switch(e){case 0:l=Math.max(0,Math.min(i-u,l)),o=Math.max(0,Math.min(n-d,o));break;case 90:l=Math.max(0,Math.min(i-d,l)),o=Math.min(n,Math.max(u,o));break;case 180:l=Math.min(i,Math.max(u,l)),o=Math.min(n,Math.max(d,o));break;case 270:l=Math.min(i,Math.max(d,l)),o=Math.max(0,Math.min(n-u,o));break}this.x=l/=i,this.y=o/=n;const[f,g]=this.getBaseTranslation();l+=f,o+=g;const{style:m}=this.div;m.left=`${(100*l).toFixed(2)}%`,m.top=`${(100*o).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,i){var n;return _(n=qt,bh,k0).call(n,e,i,this.parentRotation)}pageTranslationToScreen(e,i){var n;return _(n=qt,bh,k0).call(n,e,i,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:[i,n]}=this;return[i*e,n*e]}setDims(e,i){const[n,l]=this.parentDimensions;this.div.style.width=`${(100*e/n).toFixed(2)}%`,c(this,Pl)||(this.div.style.height=`${(100*i/l).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:i,width:n}=e,l=n.endsWith("%"),o=!c(this,Pl)&&i.endsWith("%");if(l&&o)return;const[u,d]=this.parentDimensions;l||(e.width=`${(100*parseFloat(n)/u).toFixed(2)}%`),!c(this,Pl)&&!o&&(e.height=`${(100*parseFloat(i)/d).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}altTextFinish(){var e;(e=c(this,oe))==null||e.finish()}async addEditToolbar(){return this._editToolbar||c(this,ql)?this._editToolbar:(this._editToolbar=new E0(this),this.div.append(this._editToolbar.render()),c(this,oe)&&await this._editToolbar.addAltText(c(this,oe)),this._editToolbar)}removeEditToolbar(){var e;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(e=c(this,oe))==null||e.destroy())}addContainer(e){var n;const i=(n=this._editToolbar)==null?void 0:n.div;i?i.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){c(this,oe)||(mg.initialize(qt._l10n),S(this,oe,new mg(this)),c(this,Bl)&&(c(this,oe).data=c(this,Bl),S(this,Bl,null)),await this.addEditToolbar())}get altTextData(){var e;return(e=c(this,oe))==null?void 0:e.data}set altTextData(e){c(this,oe)&&(c(this,oe).data=e)}get guessedAltText(){var e;return(e=c(this,oe))==null?void 0:e.guessedText}async setGuessedAltText(e){var i;await((i=c(this,oe))==null?void 0:i.setGuessedText(e))}serializeAltText(e){var i;return(i=c(this,oe))==null?void 0:i.serialize(e)}hasAltText(){return!!c(this,oe)&&!c(this,oe).isEmpty()}hasAltTextData(){var e;return((e=c(this,oe))==null?void 0:e.hasData())??!1}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=c(this,Io)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),_(this,Tt,B0).call(this);const[e,i]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*i/e).toFixed(2)}%`,this.div.style.maxHeight=`${(100*e/i).toFixed(2)}%`);const[n,l]=this.getInitialTranslation();return this.translate(n,l),pg(this,this.div,["pointerdown"]),this.div}pointerdown(e){const{isMac:i}=ui.platform;if(e.button!==0||e.ctrlKey&&i){e.preventDefault();return}if(S(this,jl,!0),this._isDraggable){_(this,Tt,YS).call(this,e);return}_(this,Tt,U0).call(this,e)}get isSelected(){return this._uiManager.isSelected(this)}moveInDOM(){c(this,Vs)&&clearTimeout(c(this,Vs)),S(this,Vs,setTimeout(()=>{var e;S(this,Vs,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,i,n){e.changeParent(this),this.x=i,this.y=n,this.fixAndSetPosition()}getRect(e,i,n=this.rotation){const l=this.parentScale,[o,u]=this.pageDimensions,[d,f]=this.pageTranslation,g=e/l,m=i/l,v=this.x*o,y=this.y*u,E=this.width*o,x=this.height*u;switch(n){case 0:return[v+g+d,u-y-m-x+f,v+g+E+d,u-y-m+f];case 90:return[v+m+d,u-y+g+f,v+m+x+d,u-y+g+E+f];case 180:return[v-g-E+d,u-y+m+f,v-g+d,u-y+m+x+f];case 270:return[v-m-x+d,u-y-g-E+f,v-m+d,u-y-g+f];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,i){const[n,l,o,u]=e,d=o-n,f=u-l;switch(this.rotation){case 0:return[n,i-u,d,f];case 90:return[n,i-l,f,d];case 180:return[o,i-l,d,f];case 270:return[o,i-u,f,d];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){S(this,ql,!0)}disableEditMode(){S(this,ql,!1)}isInEditMode(){return c(this,ql)}shouldGetKeyboardEvents(){return c(this,Rn)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){_(this,Tt,B0).call(this)}rotate(e){}serializeDeleted(){var e;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((e=this._initialData)==null?void 0:e.popupRef)||""}}serialize(e=!1,i=null){se("An editor must be serializable")}static async deserialize(e,i,n){const l=new this.prototype.constructor({parent:i,id:i.getNextId(),uiManager:n});l.rotation=e.rotation,S(l,Bl,e.accessibilityData);const[o,u]=l.pageDimensions,[d,f,g,m]=l.getRectInCurrentCoords(e.rect,u);return l.x=d/o,l.y=f/u,l.width=g/o,l.height=m/u,l}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e;if((e=c(this,Fa))==null||e.abort(),S(this,Fa,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),c(this,Vs)&&(clearTimeout(c(this,Vs)),S(this,Vs,null)),_(this,Tt,zu).call(this),this.removeEditToolbar(),c(this,ns)){for(const i of c(this,ns).values())clearTimeout(i);S(this,ns,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(_(this,Tt,GS).call(this),c(this,Ye).classList.remove("hidden"),pg(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),S(this,Il,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const i=c(this,Ye).children;if(!c(this,Ss)){S(this,Ss,Array.from(i));const u=_(this,Tt,VS).bind(this),d=_(this,Tt,KS).bind(this),f=this._uiManager._signal;for(const g of c(this,Ss)){const m=g.getAttribute("data-resizer-name");g.setAttribute("role","spinbutton"),g.addEventListener("keydown",u,{signal:f}),g.addEventListener("blur",d,{signal:f}),g.addEventListener("focus",_(this,Tt,QS).bind(this,m),{signal:f}),g.setAttribute("data-l10n-id",qt._l10nResizer[m])}}const n=c(this,Ss)[0];let l=0;for(const u of i){if(u===n)break;l++}const o=(360-this.rotation+this.parentRotation)%360/90*(c(this,Ss).length/4);if(o!==l){if(o<l)for(let d=0;d<l-o;d++)c(this,Ye).append(c(this,Ye).firstChild);else if(o>l)for(let d=0;d<o-l;d++)c(this,Ye).firstChild.before(c(this,Ye).lastChild);let u=0;for(const d of i){const g=c(this,Ss)[u++].getAttribute("data-resizer-name");d.setAttribute("data-l10n-id",qt._l10nResizer[g])}}_(this,Tt,P0).call(this,0),S(this,Rn,!0),c(this,Ye).firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,i){c(this,Rn)&&_(this,Tt,F0).call(this,c(this,gh),{movementX:e,movementY:i})}_stopResizingWithKeyboard(){_(this,Tt,zu).call(this),this.div.focus()}select(){var e,i,n;if(this.makeResizable(),(e=this.div)==null||e.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var l,o;(l=this.div)!=null&&l.classList.contains("selectedEditor")&&((o=this._editToolbar)==null||o.show())});return}(i=this._editToolbar)==null||i.show(),(n=c(this,oe))==null||n.toggleAltTextBadge(!1)}unselect(){var e,i,n,l,o;(e=c(this,Ye))==null||e.classList.add("hidden"),(i=this.div)==null||i.classList.remove("selectedEditor"),(n=this.div)!=null&&n.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(l=this._editToolbar)==null||l.hide(),(o=c(this,oe))==null||o.toggleAltTextBadge(!0)}updateParams(e,i){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return c(this,ph)}set isEditing(e){S(this,ph,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,i){S(this,Pl,!0);const n=e/i,{style:l}=this.div;l.aspectRatio=n,l.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,i=!1){if(i){c(this,ns)||S(this,ns,new Map);const{action:n}=e;let l=c(this,ns).get(n);l&&clearTimeout(l),l=setTimeout(()=>{this._reportTelemetry(e),c(this,ns).delete(n),c(this,ns).size===0&&S(this,ns,null)},qt._telemetryTimeout),c(this,ns).set(n,l);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),S(this,Io,!1)}disable(){this.div&&(this.div.tabIndex=-1),S(this,Io,!0)}renderAnnotationElement(e){let i=e.container.querySelector(".annotationContent");if(!i)i=document.createElement("div"),i.classList.add("annotationContent",this.editorType),e.container.prepend(i);else if(i.nodeName==="CANVAS"){const n=i;i=document.createElement("div"),i.classList.add("annotationContent",this.editorType),n.before(i)}return i}resetAnnotationElement(e){const{firstChild:i}=e.container;(i==null?void 0:i.nodeName)==="DIV"&&i.classList.contains("annotationContent")&&i.remove()}};Bl=new WeakMap,Ss=new WeakMap,oe=new WeakMap,Io=new WeakMap,Pl=new WeakMap,Ye=new WeakMap,Il=new WeakMap,Fa=new WeakMap,gh=new WeakMap,jl=new WeakMap,Ua=new WeakMap,ph=new WeakMap,ql=new WeakMap,Rn=new WeakMap,Vs=new WeakMap,jo=new WeakMap,qo=new WeakMap,ns=new WeakMap,mh=new WeakMap,wg=new WeakMap,Tt=new WeakSet,N0=function([e,i],n,l){[n,l]=this.screenToPageTranslation(n,l),this.x+=n/e,this.y+=l/i,this.fixAndSetPosition()},bh=new WeakSet,k0=function(e,i,n){switch(n){case 90:return[i,-e];case 180:return[-e,-i];case 270:return[-i,e];default:return[e,i]}},z0=function(e){switch(e){case 90:{const[i,n]=this.pageDimensions;return[0,-i/n,n/i,0]}case 180:return[-1,0,0,-1];case 270:{const[i,n]=this.pageDimensions;return[0,i/n,-n/i,0]}default:return[1,0,0,1]}},GS=function(){if(c(this,Ye))return;S(this,Ye,document.createElement("div")),c(this,Ye).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],i=this._uiManager._signal;for(const n of e){const l=document.createElement("div");c(this,Ye).append(l),l.classList.add("resizer",n),l.setAttribute("data-resizer-name",n),l.addEventListener("pointerdown",_(this,Tt,XS).bind(this,n),{signal:i}),l.addEventListener("contextmenu",hs,{signal:i}),l.tabIndex=-1}this.div.prepend(c(this,Ye))},XS=function(e,i){var x;i.preventDefault();const{isMac:n}=ui.platform;if(i.button!==0||i.ctrlKey&&n)return;(x=c(this,oe))==null||x.toggle(!1);const l=this._isDraggable;this._isDraggable=!1;const o=new AbortController,u=this._uiManager.combinedSignal(o);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",_(this,Tt,F0).bind(this,e),{passive:!0,capture:!0,signal:u}),window.addEventListener("contextmenu",hs,{signal:u});const d=this.x,f=this.y,g=this.width,m=this.height,v=this.parent.div.style.cursor,y=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(i.target).cursor;const E=()=>{var C;o.abort(),this.parent.togglePointerEvents(!0),(C=c(this,oe))==null||C.toggle(!0),this._isDraggable=l,this.parent.div.style.cursor=v,this.div.style.cursor=y,_(this,Tt,H0).call(this,d,f,g,m)};window.addEventListener("pointerup",E,{signal:u}),window.addEventListener("blur",E,{signal:u})},H0=function(e,i,n,l){const o=this.x,u=this.y,d=this.width,f=this.height;o===e&&u===i&&d===n&&f===l||this.addCommands({cmd:()=>{this.width=d,this.height=f,this.x=o,this.y=u;const[g,m]=this.parentDimensions;this.setDims(g*d,m*f),this.fixAndSetPosition()},undo:()=>{this.width=n,this.height=l,this.x=e,this.y=i;const[g,m]=this.parentDimensions;this.setDims(g*n,m*l),this.fixAndSetPosition()},mustExec:!0})},F0=function(e,i){const[n,l]=this.parentDimensions,o=this.x,u=this.y,d=this.width,f=this.height,g=qt.MIN_SIZE/n,m=qt.MIN_SIZE/l,v=X=>Math.round(X*1e4)/1e4,y=_(this,Tt,z0).call(this,this.rotation),E=(X,W)=>[y[0]*X+y[2]*W,y[1]*X+y[3]*W],x=_(this,Tt,z0).call(this,360-this.rotation),C=(X,W)=>[x[0]*X+x[2]*W,x[1]*X+x[3]*W];let L,M,H=!1,F=!1;switch(e){case"topLeft":H=!0,L=(X,W)=>[0,0],M=(X,W)=>[X,W];break;case"topMiddle":L=(X,W)=>[X/2,0],M=(X,W)=>[X/2,W];break;case"topRight":H=!0,L=(X,W)=>[X,0],M=(X,W)=>[0,W];break;case"middleRight":F=!0,L=(X,W)=>[X,W/2],M=(X,W)=>[0,W/2];break;case"bottomRight":H=!0,L=(X,W)=>[X,W],M=(X,W)=>[0,0];break;case"bottomMiddle":L=(X,W)=>[X/2,W],M=(X,W)=>[X/2,0];break;case"bottomLeft":H=!0,L=(X,W)=>[0,W],M=(X,W)=>[X,0];break;case"middleLeft":F=!0,L=(X,W)=>[0,W/2],M=(X,W)=>[X,W/2];break}const I=L(d,f),j=M(d,f);let q=E(...j);const Q=v(o+q[0]),J=v(u+q[1]);let at=1,yt=1,[lt,pt]=this.screenToPageTranslation(i.movementX,i.movementY);if([lt,pt]=C(lt/n,pt/l),H){const X=Math.hypot(d,f);at=yt=Math.max(Math.min(Math.hypot(j[0]-I[0]-lt,j[1]-I[1]-pt)/X,1/d,1/f),g/d,m/f)}else F?at=Math.max(g,Math.min(1,Math.abs(j[0]-I[0]-lt)))/d:yt=Math.max(m,Math.min(1,Math.abs(j[1]-I[1]-pt)))/f;const wt=v(d*at),Ot=v(f*yt);q=E(...M(wt,Ot));const mt=Q-q[0],P=J-q[1];this.width=wt,this.height=Ot,this.x=mt,this.y=P,this.setDims(n*wt,l*Ot),this.fixAndSetPosition()},U0=function(e){const{isMac:i}=ui.platform;e.ctrlKey&&!i||e.shiftKey||e.metaKey&&i?this.parent.toggleSelected(this):this.parent.setSelected(this)},YS=function(e){const{isSelected:i}=this;this._uiManager.setUpDragSession();const n=new AbortController,l=this._uiManager.combinedSignal(n);if(i){this.div.classList.add("moving"),S(this,jo,e.clientX),S(this,qo,e.clientY);const u=d=>{const{clientX:f,clientY:g}=d,[m,v]=this.screenToPageTranslation(f-c(this,jo),g-c(this,qo));S(this,jo,f),S(this,qo,g),this._uiManager.dragSelectedEditors(m,v)};window.addEventListener("pointermove",u,{passive:!0,capture:!0,signal:l})}const o=()=>{n.abort(),i&&this.div.classList.remove("moving"),S(this,jl,!1),this._uiManager.endDragSession()||_(this,Tt,U0).call(this,e)};window.addEventListener("pointerup",o,{signal:l}),window.addEventListener("blur",o,{signal:l})},B0=function(){if(c(this,Fa)||!this.div)return;S(this,Fa,new AbortController);const e=this._uiManager.combinedSignal(c(this,Fa));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})},VS=function(e){qt._resizerKeyboardManager.exec(this,e)},KS=function(e){var i;c(this,Rn)&&((i=e.relatedTarget)==null?void 0:i.parentNode)!==c(this,Ye)&&_(this,Tt,zu).call(this)},QS=function(e){S(this,gh,c(this,Rn)?e:"")},P0=function(e){if(c(this,Ss))for(const i of c(this,Ss))i.tabIndex=e},zu=function(){if(S(this,Rn,!1),_(this,Tt,P0).call(this,-1),c(this,Il)){const{savedX:e,savedY:i,savedWidth:n,savedHeight:l}=c(this,Il);_(this,Tt,H0).call(this,e,i,n,l),S(this,Il,null)}},w(qt,bh),bt(qt,"_l10n",null),bt(qt,"_l10nResizer",null),bt(qt,"_borderLineWidth",-1),bt(qt,"_colorManager",new x0),bt(qt,"_zIndex",1),bt(qt,"_telemetryTimeout",1e3);let Kt=qt;class Nx extends Kt{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const aS=3285377520,is=4294901760,Fs=65535;class ZS{constructor(e){this.h1=e?e&4294967295:aS,this.h2=e?e&4294967295:aS}update(e){let i,n;if(typeof e=="string"){i=new Uint8Array(e.length*2),n=0;for(let C=0,L=e.length;C<L;C++){const M=e.charCodeAt(C);M<=255?i[n++]=M:(i[n++]=M>>>8,i[n++]=M&255)}}else if(ArrayBuffer.isView(e))i=e.slice(),n=i.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const l=n>>2,o=n-l*4,u=new Uint32Array(i.buffer,0,l);let d=0,f=0,g=this.h1,m=this.h2;const v=3432918353,y=461845907,E=v&Fs,x=y&Fs;for(let C=0;C<l;C++)C&1?(d=u[C],d=d*v&is|d*E&Fs,d=d<<15|d>>>17,d=d*y&is|d*x&Fs,g^=d,g=g<<13|g>>>19,g=g*5+3864292196):(f=u[C],f=f*v&is|f*E&Fs,f=f<<15|f>>>17,f=f*y&is|f*x&Fs,m^=f,m=m<<13|m>>>19,m=m*5+3864292196);switch(d=0,o){case 3:d^=i[l*4+2]<<16;case 2:d^=i[l*4+1]<<8;case 1:d^=i[l*4],d=d*v&is|d*E&Fs,d=d<<15|d>>>17,d=d*y&is|d*x&Fs,l&1?g^=d:m^=d}this.h1=g,this.h2=m}hexdigest(){let e=this.h1,i=this.h2;return e^=i>>>1,e=e*3981806797&is|e*36045&Fs,i=i*4283543511&is|((i<<16|e>>>16)*2950163797&is)>>>16,e^=i>>>1,e=e*444984403&is|e*60499&Fs,i=i*3301882366&is|((i<<16|e>>>16)*3120437893&is)>>>16,e^=i>>>1,(e>>>0).toString(16).padStart(8,"0")+(i>>>0).toString(16).padStart(8,"0")}}const I0=Object.freeze({map:null,hash:"",transfer:void 0});var Gl,Xl,Pe,xg,WS;class jb{constructor(){w(this,xg);w(this,Gl,!1);w(this,Xl,null);w(this,Pe,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,i){const n=c(this,Pe).get(e);return n===void 0?i:Object.assign(i,n)}getRawValue(e){return c(this,Pe).get(e)}remove(e){if(c(this,Pe).delete(e),c(this,Pe).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const i of c(this,Pe).values())if(i instanceof Kt)return;this.onAnnotationEditor(null)}}setValue(e,i){const n=c(this,Pe).get(e);let l=!1;if(n!==void 0)for(const[o,u]of Object.entries(i))n[o]!==u&&(l=!0,n[o]=u);else l=!0,c(this,Pe).set(e,i);l&&_(this,xg,WS).call(this),i instanceof Kt&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(i.constructor._type)}has(e){return c(this,Pe).has(e)}getAll(){return c(this,Pe).size>0?Hb(c(this,Pe)):null}setAll(e){for(const[i,n]of Object.entries(e))this.setValue(i,n)}get size(){return c(this,Pe).size}resetModified(){c(this,Gl)&&(S(this,Gl,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new $S(this)}get serializable(){if(c(this,Pe).size===0)return I0;const e=new Map,i=new ZS,n=[],l=Object.create(null);let o=!1;for(const[u,d]of c(this,Pe)){const f=d instanceof Kt?d.serialize(!1,l):d;f&&(e.set(u,f),i.update(`${u}:${JSON.stringify(f)}`),o||(o=!!f.bitmap))}if(o)for(const u of e.values())u.bitmap&&n.push(u.bitmap);return e.size>0?{map:e,hash:i.hexdigest(),transfer:n}:I0}get editorStats(){let e=null;const i=new Map;for(const n of c(this,Pe).values()){if(!(n instanceof Kt))continue;const l=n.telemetryFinalData;if(!l)continue;const{type:o}=l;i.has(o)||i.set(o,Object.getPrototypeOf(n).constructor),e||(e=Object.create(null));const u=e[o]||(e[o]=new Map);for(const[d,f]of Object.entries(l)){if(d==="type")continue;let g=u.get(d);g||(g=new Map,u.set(d,g));const m=g.get(f)??0;g.set(f,m+1)}}for(const[n,l]of i)e[n]=l.computeTelemetryFinalData(e[n]);return e}resetModifiedIds(){S(this,Xl,null)}get modifiedIds(){if(c(this,Xl))return c(this,Xl);const e=[];for(const i of c(this,Pe).values())!(i instanceof Kt)||!i.annotationElementId||!i.serialize()||e.push(i.annotationElementId);return S(this,Xl,{ids:new Set(e),hash:e.join(",")})}}Gl=new WeakMap,Xl=new WeakMap,Pe=new WeakMap,xg=new WeakSet,WS=function(){c(this,Gl)||(S(this,Gl,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var vh;class $S extends jb{constructor(i){super();w(this,vh);const{map:n,hash:l,transfer:o}=i.serializable,u=structuredClone(n,o?{transfer:o}:null);S(this,vh,{map:u,hash:l,transfer:o})}get print(){se("Should not call PrintAnnotationStorage.print")}get serializable(){return c(this,vh)}get modifiedIds(){return Ft(this,"modifiedIds",{ids:new Set,hash:""})}}vh=new WeakMap;var Go;class kx{constructor({ownerDocument:e=globalThis.document,styleElement:i=null}){w(this,Go,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 i=this.styleElement.sheet;i.insertRule(e,i.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),c(this,Go).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,_inspectFont:i}){if(!(!e||c(this,Go).has(e.loadedName))){if(De(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:n,src:l,style:o}=e,u=new FontFace(n,l,o);this.addNativeFontFace(u);try{await u.load(),c(this,Go).add(n),i==null||i(e)}catch{Ct(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(u)}return}se("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){const n=e.createNativeFontFace();if(n){this.addNativeFontFace(n);try{await n.loaded}catch(l){throw Ct(`Failed to load font '${n.family}': '${l}'.`),e.disableFontFace=!0,l}}return}const i=e.createFontFaceRule();if(i){if(this.insertRule(i),this.isSyncFontLoadingSupported)return;await new Promise(n=>{const l=this._queueLoadingCallback(n);this._prepareFontLoadEvent(e,l)})}}get isFontLoadingAPISupported(){var i;const e=!!((i=this._document)!=null&&i.fonts);return Ft(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){let e=!1;return(ni||typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.userAgent)=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),Ft(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){function i(){for(De(!l.done,"completeRequest() cannot be called twice."),l.done=!0;n.length>0&&n[0].done;){const o=n.shift();setTimeout(o.callback,0)}}const{loadingRequests:n}=this,l={done:!1,complete:i,callback:e};return n.push(l),l}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Ft(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,i){function n(I,j){return I.charCodeAt(j)<<24|I.charCodeAt(j+1)<<16|I.charCodeAt(j+2)<<8|I.charCodeAt(j+3)&255}function l(I,j,q,Q){const J=I.substring(0,j),at=I.substring(j+q);return J+Q+at}let o,u;const d=this._document.createElement("canvas");d.width=1,d.height=1;const f=d.getContext("2d");let g=0;function m(I,j){if(++g>30){Ct("Load test font never loaded."),j();return}if(f.font="30px "+I,f.fillText(".",0,20),f.getImageData(0,0,1,1).data[3]>0){j();return}setTimeout(m.bind(null,I,j))}const v=`lt${Date.now()}${this.loadTestFontId++}`;let y=this._loadTestFont;y=l(y,976,v.length,v);const x=16,C=1482184792;let L=n(y,x);for(o=0,u=v.length-3;o<u;o+=4)L=L-C+n(v,o)|0;o<v.length&&(L=L-C+n(v+"XXX",o)|0),y=l(y,x,4,vx(L));const M=`url(data:font/opentype;base64,${btoa(y)});`,H=`@font-face {font-family:"${v}";src:${M}}`;this.insertRule(H);const F=this._document.createElement("div");F.style.visibility="hidden",F.style.width=F.style.height="10px",F.style.position="absolute",F.style.top=F.style.left="0px";for(const I of[e.loadedName,v]){const j=this._document.createElement("span");j.textContent="Hi",j.style.fontFamily=I,F.append(j)}this._document.body.append(F),m(v,()=>{F.remove(),i.complete()})}}Go=new WeakMap;class zx{constructor(e,{disableFontFace:i=!1,inspectFont:n=null}){this.compiledGlyphs=Object.create(null);for(const l in e)this[l]=e[l];this.disableFontFace=i===!0,this._inspectFont=n}createNativeFontFace(){var i;if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const n={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(n.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,n)}return(i=this._inspectFont)==null||i.call(this,this),e}createFontFaceRule(){var n;if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${Tx(this.data)});`;let i;if(!this.cssFontInfo)i=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let l=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(l+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),i=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${l}src:${e}}`}return(n=this._inspectFont)==null||n.call(this,this,e),i}getPathGenerator(e,i){if(this.compiledGlyphs[i]!==void 0)return this.compiledGlyphs[i];let n;try{n=e.get(this.loadedName+"_path_"+i)}catch(o){Ct(`getPathGenerator - ignoring character: "${o}".`)}if(!Array.isArray(n)||n.length===0)return this.compiledGlyphs[i]=function(o,u){};const l=[];for(let o=0,u=n.length;o<u;)switch(n[o++]){case An.BEZIER_CURVE_TO:{const[d,f,g,m,v,y]=n.slice(o,o+6);l.push(E=>E.bezierCurveTo(d,f,g,m,v,y)),o+=6}break;case An.MOVE_TO:{const[d,f]=n.slice(o,o+2);l.push(g=>g.moveTo(d,f)),o+=2}break;case An.LINE_TO:{const[d,f]=n.slice(o,o+2);l.push(g=>g.lineTo(d,f)),o+=2}break;case An.QUADRATIC_CURVE_TO:{const[d,f,g,m]=n.slice(o,o+4);l.push(v=>v.quadraticCurveTo(d,f,g,m)),o+=4}break;case An.RESTORE:l.push(d=>d.restore());break;case An.SAVE:l.push(d=>d.save());break;case An.SCALE:De(l.length===2,"Scale command is only valid at the third position.");break;case An.TRANSFORM:{const[d,f,g,m,v,y]=n.slice(o,o+6);l.push(E=>E.transform(d,f,g,m,v,y)),o+=6}break;case An.TRANSLATE:{const[d,f]=n.slice(o,o+2);l.push(g=>g.translate(d,f)),o+=2}break}return this.compiledGlyphs[i]=function(u,d){l[0](u),l[1](u),u.scale(d,-d);for(let f=2,g=l.length;f<g;f++)l[f](u)}}}var yh;class JS{constructor({enableHWA:e=!1}){w(this,yh,!1);S(this,yh,e)}create(e,i){if(e<=0||i<=0)throw new Error("Invalid canvas size");const n=this._createCanvas(e,i);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!c(this,yh)})}}reset(e,i,n){if(!e.canvas)throw new Error("Canvas is not specified");if(i<=0||n<=0)throw new Error("Invalid canvas size");e.canvas.width=i,e.canvas.height=n}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,i){se("Abstract method `_createCanvas` called.")}}yh=new WeakMap;class Hx extends JS{constructor({ownerDocument:e=globalThis.document,enableHWA:i=!1}){super({enableHWA:i}),this._document=e}_createCanvas(e,i){const n=this._document.createElement("canvas");return n.width=e,n.height=i,n}}class t_{constructor({baseUrl:e=null,isCompressed:i=!0}){this.baseUrl=e,this.isCompressed=i}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 i=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(i).then(n=>({cMapData:n,isCompressed:this.isCompressed})).catch(n=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${i}`)})}async _fetch(e){se("Abstract method `_fetch` called.")}}class e_ extends t_{async _fetch(e){const i=await jg(e,this.isCompressed?"arraybuffer":"text");return i instanceof ArrayBuffer?new Uint8Array(i):Ig(i)}}class i_{addFilter(e){return"none"}addHCMFilter(e,i){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,i,n,l,o){return"none"}destroy(e=!1){}}var Yl,Vl,Ks,Dn,ei,Cg,Kl,it,Je,Ao,So,Yf,_o,s_,j0,Eo,Hu,Fu,q0,Uu;class Fx extends i_{constructor({docId:i,ownerDocument:n=globalThis.document}){super();w(this,it);w(this,Yl);w(this,Vl);w(this,Ks);w(this,Dn);w(this,ei);w(this,Cg);w(this,Kl,0);S(this,Dn,i),S(this,ei,n)}addFilter(i){if(!i)return"none";let n=c(this,it,Je).get(i);if(n)return n;const[l,o,u]=_(this,it,Yf).call(this,i),d=i.length===1?l:`${l}${o}${u}`;if(n=c(this,it,Je).get(d),n)return c(this,it,Je).set(i,n),n;const f=`g_${c(this,Dn)}_transfer_map_${li(this,Kl)._++}`,g=_(this,it,_o).call(this,f);c(this,it,Je).set(i,g),c(this,it,Je).set(d,g);const m=_(this,it,Eo).call(this,f);return _(this,it,Fu).call(this,l,o,u,m),g}addHCMFilter(i,n){var x;const l=`${i}-${n}`,o="base";let u=c(this,it,Ao).get(o);if((u==null?void 0:u.key)===l||(u?((x=u.filter)==null||x.remove(),u.key=l,u.url="none",u.filter=null):(u={key:l,url:"none",filter:null},c(this,it,Ao).set(o,u)),!i||!n))return u.url;const d=_(this,it,Uu).call(this,i);i=ct.makeHexColor(...d);const f=_(this,it,Uu).call(this,n);if(n=ct.makeHexColor(...f),c(this,it,So).style.color="",i==="#000000"&&n==="#ffffff"||i===n)return u.url;const g=new Array(256);for(let C=0;C<=255;C++){const L=C/255;g[C]=L<=.03928?L/12.92:((L+.055)/1.055)**2.4}const m=g.join(","),v=`g_${c(this,Dn)}_hcm_filter`,y=u.filter=_(this,it,Eo).call(this,v);_(this,it,Fu).call(this,m,m,m,y),_(this,it,j0).call(this,y);const E=(C,L)=>{const M=d[C]/255,H=f[C]/255,F=new Array(L+1);for(let I=0;I<=L;I++)F[I]=M+I/L*(H-M);return F.join(",")};return _(this,it,Fu).call(this,E(0,5),E(1,5),E(2,5),y),u.url=_(this,it,_o).call(this,v),u.url}addAlphaFilter(i){let n=c(this,it,Je).get(i);if(n)return n;const[l]=_(this,it,Yf).call(this,[i]),o=`alpha_${l}`;if(n=c(this,it,Je).get(o),n)return c(this,it,Je).set(i,n),n;const u=`g_${c(this,Dn)}_alpha_map_${li(this,Kl)._++}`,d=_(this,it,_o).call(this,u);c(this,it,Je).set(i,d),c(this,it,Je).set(o,d);const f=_(this,it,Eo).call(this,u);return _(this,it,q0).call(this,l,f),d}addLuminosityFilter(i){let n=c(this,it,Je).get(i||"luminosity");if(n)return n;let l,o;if(i?([l]=_(this,it,Yf).call(this,[i]),o=`luminosity_${l}`):o="luminosity",n=c(this,it,Je).get(o),n)return c(this,it,Je).set(i,n),n;const u=`g_${c(this,Dn)}_luminosity_map_${li(this,Kl)._++}`,d=_(this,it,_o).call(this,u);c(this,it,Je).set(i,d),c(this,it,Je).set(o,d);const f=_(this,it,Eo).call(this,u);return _(this,it,s_).call(this,f),i&&_(this,it,q0).call(this,l,f),d}addHighlightHCMFilter(i,n,l,o,u){var H;const d=`${n}-${l}-${o}-${u}`;let f=c(this,it,Ao).get(i);if((f==null?void 0:f.key)===d||(f?((H=f.filter)==null||H.remove(),f.key=d,f.url="none",f.filter=null):(f={key:d,url:"none",filter:null},c(this,it,Ao).set(i,f)),!n||!l))return f.url;const[g,m]=[n,l].map(_(this,it,Uu).bind(this));let v=Math.round(.2126*g[0]+.7152*g[1]+.0722*g[2]),y=Math.round(.2126*m[0]+.7152*m[1]+.0722*m[2]),[E,x]=[o,u].map(_(this,it,Uu).bind(this));y<v&&([v,y,E,x]=[y,v,x,E]),c(this,it,So).style.color="";const C=(F,I,j)=>{const q=new Array(256),Q=(y-v)/j,J=F/255,at=(I-F)/(255*j);let yt=0;for(let lt=0;lt<=j;lt++){const pt=Math.round(v+lt*Q),wt=J+lt*at;for(let Ot=yt;Ot<=pt;Ot++)q[Ot]=wt;yt=pt+1}for(let lt=yt;lt<256;lt++)q[lt]=q[yt-1];return q.join(",")},L=`g_${c(this,Dn)}_hcm_${i}_filter`,M=f.filter=_(this,it,Eo).call(this,L);return _(this,it,j0).call(this,M),_(this,it,Fu).call(this,C(E[0],x[0],5),C(E[1],x[1],5),C(E[2],x[2],5),M),f.url=_(this,it,_o).call(this,L),f.url}destroy(i=!1){i&&c(this,it,Ao).size!==0||(c(this,Ks)&&(c(this,Ks).parentNode.parentNode.remove(),S(this,Ks,null)),c(this,Vl)&&(c(this,Vl).clear(),S(this,Vl,null)),S(this,Kl,0))}}Yl=new WeakMap,Vl=new WeakMap,Ks=new WeakMap,Dn=new WeakMap,ei=new WeakMap,Cg=new WeakMap,Kl=new WeakMap,it=new WeakSet,Je=function(){return c(this,Vl)||S(this,Vl,new Map)},Ao=function(){return c(this,Cg)||S(this,Cg,new Map)},So=function(){if(!c(this,Ks)){const i=c(this,ei).createElement("div"),{style:n}=i;n.visibility="hidden",n.contain="strict",n.width=n.height=0,n.position="absolute",n.top=n.left=0,n.zIndex=-1;const l=c(this,ei).createElementNS(_n,"svg");l.setAttribute("width",0),l.setAttribute("height",0),S(this,Ks,c(this,ei).createElementNS(_n,"defs")),i.append(l),l.append(c(this,Ks)),c(this,ei).body.append(i)}return c(this,Ks)},Yf=function(i){if(i.length===1){const g=i[0],m=new Array(256);for(let y=0;y<256;y++)m[y]=g[y]/255;const v=m.join(",");return[v,v,v]}const[n,l,o]=i,u=new Array(256),d=new Array(256),f=new Array(256);for(let g=0;g<256;g++)u[g]=n[g]/255,d[g]=l[g]/255,f[g]=o[g]/255;return[u.join(","),d.join(","),f.join(",")]},_o=function(i){if(c(this,Yl)===void 0){S(this,Yl,"");const n=c(this,ei).URL;n!==c(this,ei).baseURI&&(qg(n)?Ct('#createUrl: ignore "data:"-URL for performance reasons.'):S(this,Yl,n.split("#",1)[0]))}return`url(${c(this,Yl)}#${i})`},s_=function(i){const n=c(this,ei).createElementNS(_n,"feColorMatrix");n.setAttribute("type","matrix"),n.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"),i.append(n)},j0=function(i){const n=c(this,ei).createElementNS(_n,"feColorMatrix");n.setAttribute("type","matrix"),n.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"),i.append(n)},Eo=function(i){const n=c(this,ei).createElementNS(_n,"filter");return n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("id",i),c(this,it,So).append(n),n},Hu=function(i,n,l){const o=c(this,ei).createElementNS(_n,n);o.setAttribute("type","discrete"),o.setAttribute("tableValues",l),i.append(o)},Fu=function(i,n,l,o){const u=c(this,ei).createElementNS(_n,"feComponentTransfer");o.append(u),_(this,it,Hu).call(this,u,"feFuncR",i),_(this,it,Hu).call(this,u,"feFuncG",n),_(this,it,Hu).call(this,u,"feFuncB",l)},q0=function(i,n){const l=c(this,ei).createElementNS(_n,"feComponentTransfer");n.append(l),_(this,it,Hu).call(this,l,"feFuncA",i)},Uu=function(i){return c(this,it,So).style.color=i,Ib(getComputedStyle(c(this,it,So)).getPropertyValue("color"))};class n_{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 i=`${this.baseUrl}${e}`;return this._fetch(i).catch(n=>{throw new Error(`Unable to load font data at: ${i}`)})}async _fetch(e){se("Abstract method `_fetch` called.")}}class a_ extends n_{async _fetch(e){const i=await jg(e,"arraybuffer");return new Uint8Array(i)}}if(ni){var G0=Promise.withResolvers(),Qu=null;(async()=>{const e=await Nf(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),i=await Nf(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),n=await Nf(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),l=await Nf(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]);let o,u;return new Map(Object.entries({fs:e,http:i,https:n,url:l,canvas:o,path2d:u}))})().then(e=>{Qu=e,G0.resolve()},e=>{Ct(`loadPackages: ${e}`),Qu=new Map,G0.resolve()})}class il{static get promise(){return G0.promise}static get(e){return Qu==null?void 0:Qu.get(e)}}async function l_(b){const i=await il.get("fs").promises.readFile(b);return new Uint8Array(i)}class Ux extends i_{}class Bx extends JS{_createCanvas(e,i){return il.get("canvas").createCanvas(e,i)}}class Px extends t_{async _fetch(e){return l_(e)}}class Ix extends n_{async _fetch(e){return l_(e)}}const ci={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function X0(b,e){if(!e)return;const i=e[2]-e[0],n=e[3]-e[1],l=new Path2D;l.rect(e[0],e[1],i,n),b.clip(l)}class qb{getPattern(){se("Abstract method `getPattern` called.")}}class jx extends qb{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 i;this._type==="axial"?i=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(i=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const n of this._colorStops)i.addColorStop(n[0],n[1]);return i}getPattern(e,i,n,l){let o;if(l===ci.STROKE||l===ci.FILL){const u=i.current.getClippedPathBoundingBox(l,ue(e))||[0,0,0,0],d=Math.ceil(u[2]-u[0])||1,f=Math.ceil(u[3]-u[1])||1,g=i.cachedCanvases.getCanvas("pattern",d,f),m=g.context;m.clearRect(0,0,m.canvas.width,m.canvas.height),m.beginPath(),m.rect(0,0,m.canvas.width,m.canvas.height),m.translate(-u[0],-u[1]),n=ct.transform(n,[1,0,0,1,u[0],u[1]]),m.transform(...i.baseTransform),this.matrix&&m.transform(...this.matrix),X0(m,this._bbox),m.fillStyle=this._createGradient(m),m.fill(),o=e.createPattern(g.canvas,"no-repeat");const v=new DOMMatrix(n);o.setTransform(v)}else X0(e,this._bbox),o=this._createGradient(e);return o}}function p0(b,e,i,n,l,o,u,d){const f=e.coords,g=e.colors,m=b.data,v=b.width*4;let y;f[i+1]>f[n+1]&&(y=i,i=n,n=y,y=o,o=u,u=y),f[n+1]>f[l+1]&&(y=n,n=l,l=y,y=u,u=d,d=y),f[i+1]>f[n+1]&&(y=i,i=n,n=y,y=o,o=u,u=y);const E=(f[i]+e.offsetX)*e.scaleX,x=(f[i+1]+e.offsetY)*e.scaleY,C=(f[n]+e.offsetX)*e.scaleX,L=(f[n+1]+e.offsetY)*e.scaleY,M=(f[l]+e.offsetX)*e.scaleX,H=(f[l+1]+e.offsetY)*e.scaleY;if(x>=H)return;const F=g[o],I=g[o+1],j=g[o+2],q=g[u],Q=g[u+1],J=g[u+2],at=g[d],yt=g[d+1],lt=g[d+2],pt=Math.round(x),wt=Math.round(H);let Ot,mt,P,X,W,zt,D,V;for(let $=pt;$<=wt;$++){if($<L){const Rt=$<x?0:(x-$)/(x-L);Ot=E-(E-C)*Rt,mt=F-(F-q)*Rt,P=I-(I-Q)*Rt,X=j-(j-J)*Rt}else{let Rt;$>H?Rt=1:L===H?Rt=0:Rt=(L-$)/(L-H),Ot=C-(C-M)*Rt,mt=q-(q-at)*Rt,P=Q-(Q-yt)*Rt,X=J-(J-lt)*Rt}let Z;$<x?Z=0:$>H?Z=1:Z=(x-$)/(x-H),W=E-(E-M)*Z,zt=F-(F-at)*Z,D=I-(I-yt)*Z,V=j-(j-lt)*Z;const ot=Math.round(Math.min(Ot,W)),Mt=Math.round(Math.max(Ot,W));let rt=v*$+ot*4;for(let Rt=ot;Rt<=Mt;Rt++)Z=(Ot-Rt)/(Ot-W),Z<0?Z=0:Z>1&&(Z=1),m[rt++]=mt-(mt-zt)*Z|0,m[rt++]=P-(P-D)*Z|0,m[rt++]=X-(X-V)*Z|0,m[rt++]=255}}function qx(b,e,i){const n=e.coords,l=e.colors;let o,u;switch(e.type){case"lattice":const d=e.verticesPerRow,f=Math.floor(n.length/d)-1,g=d-1;for(o=0;o<f;o++){let m=o*d;for(let v=0;v<g;v++,m++)p0(b,i,n[m],n[m+1],n[m+d],l[m],l[m+1],l[m+d]),p0(b,i,n[m+d+1],n[m+1],n[m+d],l[m+d+1],l[m+1],l[m+d])}break;case"triangles":for(o=0,u=n.length;o<u;o+=3)p0(b,i,n[o],n[o+1],n[o+2],l[o],l[o+1],l[o+2]);break;default:throw new Error("illegal figure")}}class Gx extends qb{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,i,n){const d=Math.floor(this._bounds[0]),f=Math.floor(this._bounds[1]),g=Math.ceil(this._bounds[2])-d,m=Math.ceil(this._bounds[3])-f,v=Math.min(Math.ceil(Math.abs(g*e[0]*1.1)),3e3),y=Math.min(Math.ceil(Math.abs(m*e[1]*1.1)),3e3),E=g/v,x=m/y,C={coords:this._coords,colors:this._colors,offsetX:-d,offsetY:-f,scaleX:1/E,scaleY:1/x},L=v+2*2,M=y+2*2,H=n.getCanvas("mesh",L,M),F=H.context,I=F.createImageData(v,y);if(i){const q=I.data;for(let Q=0,J=q.length;Q<J;Q+=4)q[Q]=i[0],q[Q+1]=i[1],q[Q+2]=i[2],q[Q+3]=255}for(const q of this._figures)qx(I,q,C);return F.putImageData(I,2,2),{canvas:H.canvas,offsetX:d-2*E,offsetY:f-2*x,scaleX:E,scaleY:x}}getPattern(e,i,n,l){X0(e,this._bbox);let o;if(l===ci.SHADING)o=ct.singularValueDecompose2dScale(ue(e));else if(o=ct.singularValueDecompose2dScale(i.baseTransform),this.matrix){const d=ct.singularValueDecompose2dScale(this.matrix);o=[o[0]*d[0],o[1]*d[1]]}const u=this._createMeshCanvas(o,l===ci.SHADING?null:this._background,i.cachedCanvases);return l!==ci.SHADING&&(e.setTransform(...i.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(u.offsetX,u.offsetY),e.scale(u.scaleX,u.scaleY),e.createPattern(u.canvas,"no-repeat")}}class Xx extends qb{getPattern(){return"hotpink"}}function Yx(b){switch(b[0]){case"RadialAxial":return new jx(b);case"Mesh":return new Gx(b);case"Dummy":return new Xx}throw new Error(`Unknown IR type: ${b[0]}`)}const lS={COLORED:1,UNCOLORED:2},Mg=class Mg{constructor(e,i,n,l,o){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.color=i,this.ctx=n,this.canvasGraphicsFactory=l,this.baseTransform=o}createPatternCanvas(e){const{bbox:i,operatorList:n,paintType:l,tilingType:o,color:u,canvasGraphicsFactory:d}=this;let{xstep:f,ystep:g}=this;f=Math.abs(f),g=Math.abs(g),Bg("TilingType: "+o);const m=i[0],v=i[1],y=i[2],E=i[3],x=y-m,C=E-v,L=ct.singularValueDecompose2dScale(this.matrix),M=ct.singularValueDecompose2dScale(this.baseTransform),H=L[0]*M[0],F=L[1]*M[1];let I=x,j=C,q=!1,Q=!1;const J=Math.ceil(f*H),at=Math.ceil(g*F),yt=Math.ceil(x*H),lt=Math.ceil(C*F);J>=yt?I=f:q=!0,at>=lt?j=g:Q=!0;const pt=this.getSizeAndScale(I,this.ctx.canvas.width,H),wt=this.getSizeAndScale(j,this.ctx.canvas.height,F),Ot=e.cachedCanvases.getCanvas("pattern",pt.size,wt.size),mt=Ot.context,P=d.createCanvasGraphics(mt);if(P.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(P,l,u),mt.translate(-pt.scale*m,-wt.scale*v),P.transform(pt.scale,0,0,wt.scale,0,0),mt.save(),this.clipBbox(P,m,v,y,E),P.baseTransform=ue(P.ctx),P.executeOperatorList(n),P.endDrawing(),mt.restore(),q||Q){const X=Ot.canvas;q&&(I=f),Q&&(j=g);const W=this.getSizeAndScale(I,this.ctx.canvas.width,H),zt=this.getSizeAndScale(j,this.ctx.canvas.height,F),D=W.size,V=zt.size,$=e.cachedCanvases.getCanvas("pattern-workaround",D,V),Z=$.context,ot=q?Math.floor(x/f):0,Mt=Q?Math.floor(C/g):0;for(let rt=0;rt<=ot;rt++)for(let Rt=0;Rt<=Mt;Rt++)Z.drawImage(X,D*rt,V*Rt,D,V,0,0,D,V);return{canvas:$.canvas,scaleX:W.scale,scaleY:zt.scale,offsetX:m,offsetY:v}}return{canvas:Ot.canvas,scaleX:pt.scale,scaleY:wt.scale,offsetX:m,offsetY:v}}getSizeAndScale(e,i,n){const l=Math.max(Mg.MAX_PATTERN_SIZE,i);let o=Math.ceil(e*n);return o>=l?o=l:n=o/e,{scale:n,size:o}}clipBbox(e,i,n,l,o){const u=l-i,d=o-n;e.ctx.rect(i,n,u,d),e.current.updateRectMinMax(ue(e.ctx),[i,n,l,o]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,i,n){const l=e.ctx,o=e.current;switch(i){case lS.COLORED:const u=this.ctx;l.fillStyle=u.fillStyle,l.strokeStyle=u.strokeStyle,o.fillColor=u.fillStyle,o.strokeColor=u.strokeStyle;break;case lS.UNCOLORED:const d=ct.makeHexColor(n[0],n[1],n[2]);l.fillStyle=d,l.strokeStyle=d,o.fillColor=d,o.strokeColor=d;break;default:throw new bx(`Unsupported paint type: ${i}`)}}getPattern(e,i,n,l){let o=n;l!==ci.SHADING&&(o=ct.transform(o,i.baseTransform),this.matrix&&(o=ct.transform(o,this.matrix)));const u=this.createPatternCanvas(i);let d=new DOMMatrix(o);d=d.translate(u.offsetX,u.offsetY),d=d.scale(1/u.scaleX,1/u.scaleY);const f=e.createPattern(u.canvas,"repeat");return f.setTransform(d),f}};bt(Mg,"MAX_PATTERN_SIZE",3e3);let Y0=Mg;function Vx({src:b,srcPos:e=0,dest:i,width:n,height:l,nonBlackColor:o=4294967295,inverseDecode:u=!1}){const d=ui.isLittleEndian?4278190080:255,[f,g]=u?[o,d]:[d,o],m=n>>3,v=n&7,y=b.length;i=new Uint32Array(i.buffer);let E=0;for(let x=0;x<l;x++){for(const L=e+m;e<L;e++){const M=e<y?b[e]:255;i[E++]=M&128?g:f,i[E++]=M&64?g:f,i[E++]=M&32?g:f,i[E++]=M&16?g:f,i[E++]=M&8?g:f,i[E++]=M&4?g:f,i[E++]=M&2?g:f,i[E++]=M&1?g:f}if(v===0)continue;const C=e<y?b[e++]:255;for(let L=0;L<v;L++)i[E++]=C&1<<7-L?g:f}return{srcPos:e,destPos:E}}const rS=16,oS=100,Kx=15,cS=10,uS=1e3,Ei=16;function Qx(b,e){if(b._removeMirroring)throw new Error("Context is already forwarding operations.");b.__originalSave=b.save,b.__originalRestore=b.restore,b.__originalRotate=b.rotate,b.__originalScale=b.scale,b.__originalTranslate=b.translate,b.__originalTransform=b.transform,b.__originalSetTransform=b.setTransform,b.__originalResetTransform=b.resetTransform,b.__originalClip=b.clip,b.__originalMoveTo=b.moveTo,b.__originalLineTo=b.lineTo,b.__originalBezierCurveTo=b.bezierCurveTo,b.__originalRect=b.rect,b.__originalClosePath=b.closePath,b.__originalBeginPath=b.beginPath,b._removeMirroring=()=>{b.save=b.__originalSave,b.restore=b.__originalRestore,b.rotate=b.__originalRotate,b.scale=b.__originalScale,b.translate=b.__originalTranslate,b.transform=b.__originalTransform,b.setTransform=b.__originalSetTransform,b.resetTransform=b.__originalResetTransform,b.clip=b.__originalClip,b.moveTo=b.__originalMoveTo,b.lineTo=b.__originalLineTo,b.bezierCurveTo=b.__originalBezierCurveTo,b.rect=b.__originalRect,b.closePath=b.__originalClosePath,b.beginPath=b.__originalBeginPath,delete b._removeMirroring},b.save=function(){e.save(),this.__originalSave()},b.restore=function(){e.restore(),this.__originalRestore()},b.translate=function(n,l){e.translate(n,l),this.__originalTranslate(n,l)},b.scale=function(n,l){e.scale(n,l),this.__originalScale(n,l)},b.transform=function(n,l,o,u,d,f){e.transform(n,l,o,u,d,f),this.__originalTransform(n,l,o,u,d,f)},b.setTransform=function(n,l,o,u,d,f){e.setTransform(n,l,o,u,d,f),this.__originalSetTransform(n,l,o,u,d,f)},b.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},b.rotate=function(n){e.rotate(n),this.__originalRotate(n)},b.clip=function(n){e.clip(n),this.__originalClip(n)},b.moveTo=function(i,n){e.moveTo(i,n),this.__originalMoveTo(i,n)},b.lineTo=function(i,n){e.lineTo(i,n),this.__originalLineTo(i,n)},b.bezierCurveTo=function(i,n,l,o,u,d){e.bezierCurveTo(i,n,l,o,u,d),this.__originalBezierCurveTo(i,n,l,o,u,d)},b.rect=function(i,n,l,o){e.rect(i,n,l,o),this.__originalRect(i,n,l,o)},b.closePath=function(){e.closePath(),this.__originalClosePath()},b.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class Zx{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,i,n){let l;return this.cache[e]!==void 0?(l=this.cache[e],this.canvasFactory.reset(l,i,n)):(l=this.canvasFactory.create(i,n),this.cache[e]=l),l}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const i=this.cache[e];this.canvasFactory.destroy(i),delete this.cache[e]}}}function kf(b,e,i,n,l,o,u,d,f,g){const[m,v,y,E,x,C]=ue(b);if(v===0&&y===0){const H=u*m+x,F=Math.round(H),I=d*E+C,j=Math.round(I),q=(u+f)*m+x,Q=Math.abs(Math.round(q)-F)||1,J=(d+g)*E+C,at=Math.abs(Math.round(J)-j)||1;return b.setTransform(Math.sign(m),0,0,Math.sign(E),F,j),b.drawImage(e,i,n,l,o,0,0,Q,at),b.setTransform(m,v,y,E,x,C),[Q,at]}if(m===0&&E===0){const H=d*y+x,F=Math.round(H),I=u*v+C,j=Math.round(I),q=(d+g)*y+x,Q=Math.abs(Math.round(q)-F)||1,J=(u+f)*v+C,at=Math.abs(Math.round(J)-j)||1;return b.setTransform(0,Math.sign(v),Math.sign(y),0,F,j),b.drawImage(e,i,n,l,o,0,0,at,Q),b.setTransform(m,v,y,E,x,C),[at,Q]}b.drawImage(e,i,n,l,o,u,d,f,g);const L=Math.hypot(m,v),M=Math.hypot(y,E);return[L*f,M*g]}function Wx(b){const{width:e,height:i}=b;if(e>uS||i>uS)return null;const n=1e3,l=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),o=e+1;let u=new Uint8Array(o*(i+1)),d,f,g;const m=e+7&-8;let v=new Uint8Array(m*i),y=0;for(const M of b.data){let H=128;for(;H>0;)v[y++]=M&H?0:255,H>>=1}let E=0;for(y=0,v[y]!==0&&(u[0]=1,++E),f=1;f<e;f++)v[y]!==v[y+1]&&(u[f]=v[y]?2:1,++E),y++;for(v[y]!==0&&(u[f]=2,++E),d=1;d<i;d++){y=d*m,g=d*o,v[y-m]!==v[y]&&(u[g]=v[y]?1:8,++E);let M=(v[y]?4:0)+(v[y-m]?8:0);for(f=1;f<e;f++)M=(M>>2)+(v[y+1]?4:0)+(v[y-m+1]?8:0),l[M]&&(u[g+f]=l[M],++E),y++;if(v[y-m]!==v[y]&&(u[g+f]=v[y]?2:4,++E),E>n)return null}for(y=m*(i-1),g=d*o,v[y]!==0&&(u[g]=8,++E),f=1;f<e;f++)v[y]!==v[y+1]&&(u[g+f]=v[y]?4:8,++E),y++;if(v[y]!==0&&(u[g+f]=4,++E),E>n)return null;const x=new Int32Array([0,o,-1,0,-o,0,0,0,1]),C=new Path2D;for(d=0;E&&d<=i;d++){let M=d*o;const H=M+e;for(;M<H&&!u[M];)M++;if(M===H)continue;C.moveTo(M%o,d);const F=M;let I=u[M];do{const j=x[I];do M+=j;while(!u[M]);const q=u[M];q!==5&&q!==10?(I=q,u[M]=0):(I=q&51*I>>4,u[M]&=I>>2|I<<2),C.lineTo(M%o,M/o|0),u[M]||--E}while(F!==M);--d}return v=null,u=null,function(M){M.save(),M.scale(1/e,-1/i),M.translate(0,-i),M.fill(C),M.beginPath(),M.restore()}}class hS{constructor(e,i){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=ES,this.textMatrixScale=1,this.fontMatrix=v0,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=$e.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,e,i])}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,i){this.x=e,this.y=i}updatePathMinMax(e,i,n){[i,n]=ct.applyTransform([i,n],e),this.minX=Math.min(this.minX,i),this.minY=Math.min(this.minY,n),this.maxX=Math.max(this.maxX,i),this.maxY=Math.max(this.maxY,n)}updateRectMinMax(e,i){const n=ct.applyTransform(i,e),l=ct.applyTransform(i.slice(2),e),o=ct.applyTransform([i[0],i[3]],e),u=ct.applyTransform([i[2],i[1]],e);this.minX=Math.min(this.minX,n[0],l[0],o[0],u[0]),this.minY=Math.min(this.minY,n[1],l[1],o[1],u[1]),this.maxX=Math.max(this.maxX,n[0],l[0],o[0],u[0]),this.maxY=Math.max(this.maxY,n[1],l[1],o[1],u[1])}updateScalingPathMinMax(e,i){ct.scaleMinMax(e,i),this.minX=Math.min(this.minX,i[0]),this.minY=Math.min(this.minY,i[1]),this.maxX=Math.max(this.maxX,i[2]),this.maxY=Math.max(this.maxY,i[3])}updateCurvePathMinMax(e,i,n,l,o,u,d,f,g,m){const v=ct.bezierBoundingBox(i,n,l,o,u,d,f,g,m);m||this.updateRectMinMax(e,v)}getPathBoundingBox(e=ci.FILL,i=null){const n=[this.minX,this.minY,this.maxX,this.maxY];if(e===ci.STROKE){i||se("Stroke bounding box must include transform.");const l=ct.singularValueDecompose2dScale(i),o=l[0]*this.lineWidth/2,u=l[1]*this.lineWidth/2;n[0]-=o,n[1]-=u,n[2]+=o,n[3]+=u}return n}updateClipFromPath(){const e=ct.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(e=ci.FILL,i=null){return ct.intersect(this.clipBox,this.getPathBoundingBox(e,i))}}function dS(b,e){if(typeof ImageData<"u"&&e instanceof ImageData){b.putImageData(e,0,0);return}const i=e.height,n=e.width,l=i%Ei,o=(i-l)/Ei,u=l===0?o:o+1,d=b.createImageData(n,Ei);let f=0,g;const m=e.data,v=d.data;let y,E,x,C;if(e.kind===Bf.GRAYSCALE_1BPP){const L=m.byteLength,M=new Uint32Array(v.buffer,0,v.byteLength>>2),H=M.length,F=n+7>>3,I=4294967295,j=ui.isLittleEndian?4278190080:255;for(y=0;y<u;y++){for(x=y<o?Ei:l,g=0,E=0;E<x;E++){const q=L-f;let Q=0;const J=q>F?n:q*8-7,at=J&-8;let yt=0,lt=0;for(;Q<at;Q+=8)lt=m[f++],M[g++]=lt&128?I:j,M[g++]=lt&64?I:j,M[g++]=lt&32?I:j,M[g++]=lt&16?I:j,M[g++]=lt&8?I:j,M[g++]=lt&4?I:j,M[g++]=lt&2?I:j,M[g++]=lt&1?I:j;for(;Q<J;Q++)yt===0&&(lt=m[f++],yt=128),M[g++]=lt&yt?I:j,yt>>=1}for(;g<H;)M[g++]=0;b.putImageData(d,0,y*Ei)}}else if(e.kind===Bf.RGBA_32BPP){for(E=0,C=n*Ei*4,y=0;y<o;y++)v.set(m.subarray(f,f+C)),f+=C,b.putImageData(d,0,E),E+=Ei;y<u&&(C=n*l*4,v.set(m.subarray(f,f+C)),b.putImageData(d,0,E))}else if(e.kind===Bf.RGB_24BPP)for(x=Ei,C=n*x,y=0;y<u;y++){for(y>=o&&(x=l,C=n*x),g=0,E=C;E--;)v[g++]=m[f++],v[g++]=m[f++],v[g++]=m[f++],v[g++]=255;b.putImageData(d,0,y*Ei)}else throw new Error(`bad image kind: ${e.kind}`)}function fS(b,e){if(e.bitmap){b.drawImage(e.bitmap,0,0);return}const i=e.height,n=e.width,l=i%Ei,o=(i-l)/Ei,u=l===0?o:o+1,d=b.createImageData(n,Ei);let f=0;const g=e.data,m=d.data;for(let v=0;v<u;v++){const y=v<o?Ei:l;({srcPos:f}=Vx({src:g,srcPos:f,dest:m,width:n,height:y,nonBlackColor:0})),b.putImageData(d,0,v*Ei)}}function Du(b,e){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of i)b[n]!==void 0&&(e[n]=b[n]);b.setLineDash!==void 0&&(e.setLineDash(b.getLineDash()),e.lineDashOffset=b.lineDashOffset)}function zf(b){if(b.strokeStyle=b.fillStyle="#000000",b.fillRule="nonzero",b.globalAlpha=1,b.lineWidth=1,b.lineCap="butt",b.lineJoin="miter",b.miterLimit=10,b.globalCompositeOperation="source-over",b.font="10px sans-serif",b.setLineDash!==void 0&&(b.setLineDash([]),b.lineDashOffset=0),!ni){const{filter:e}=b;e!=="none"&&e!==""&&(b.filter="none")}}function gS(b,e){if(e)return!0;const i=ct.singularValueDecompose2dScale(b);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);const n=Math.fround((globalThis.devicePixelRatio||1)*el.PDF_TO_CSS_UNITS);return i[0]<=n&&i[1]<=n}const $x=["butt","round","square"],Jx=["miter","round","bevel"],tC={},pS={};var nl,V0,K0;const Zb=class Zb{constructor(e,i,n,l,o,{optionalContentConfig:u,markedContentStack:d=null},f,g){w(this,nl);this.ctx=e,this.current=new hS(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=i,this.objs=n,this.canvasFactory=l,this.filterFactory=o,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=d||[],this.optionalContentConfig=u,this.cachedCanvases=new Zx(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=f,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=g,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,i=null){return typeof e=="string"?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):i}beginDrawing({transform:e,viewport:i,transparency:n=!1,background:l=null}){const o=this.ctx.canvas.width,u=this.ctx.canvas.height,d=this.ctx.fillStyle;if(this.ctx.fillStyle=l||"#ffffff",this.ctx.fillRect(0,0,o,u),this.ctx.fillStyle=d,n){const f=this.cachedCanvases.getCanvas("transparent",o,u);this.compositeCtx=this.ctx,this.transparentCanvas=f.canvas,this.ctx=f.context,this.ctx.save(),this.ctx.transform(...ue(this.compositeCtx))}this.ctx.save(),zf(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...i.transform),this.viewportScale=i.scale,this.baseTransform=ue(this.ctx)}executeOperatorList(e,i,n,l){const o=e.argsArray,u=e.fnArray;let d=i||0;const f=o.length;if(f===d)return d;const g=f-d>cS&&typeof n=="function",m=g?Date.now()+Kx:0;let v=0;const y=this.commonObjs,E=this.objs;let x;for(;;){if(l!==void 0&&d===l.nextBreakPoint)return l.breakIt(d,n),d;if(x=u[d],x!==ms.dependency)this[x].apply(this,o[d]);else for(const C of o[d]){const L=C.startsWith("g_")?y:E;if(!L.has(C))return L.get(C,n),d}if(d++,d===f)return d;if(g&&++v>cS){if(Date.now()>m)return n(),d;v=0}}}endDrawing(){_(this,nl,V0).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const i of e.values())typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement&&(i.width=i.height=0);e.clear()}this._cachedBitmapsMap.clear(),_(this,nl,K0).call(this)}_scaleImage(e,i){const n=e.width??e.displayWidth,l=e.height??e.displayHeight;let o=Math.max(Math.hypot(i[0],i[1]),1),u=Math.max(Math.hypot(i[2],i[3]),1),d=n,f=l,g="prescale1",m,v;for(;o>2&&d>1||u>2&&f>1;){let y=d,E=f;o>2&&d>1&&(y=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d/2),o/=d/y),u>2&&f>1&&(E=f>=16384?Math.floor(f/2)-1||1:Math.ceil(f)/2,u/=f/E),m=this.cachedCanvases.getCanvas(g,y,E),v=m.context,v.clearRect(0,0,y,E),v.drawImage(e,0,0,d,f,0,0,y,E),e=m.canvas,d=y,f=E,g=g==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:d,paintHeight:f}}_createMaskCanvas(e){const i=this.ctx,{width:n,height:l}=e,o=this.current.fillColor,u=this.current.patternFill,d=ue(i);let f,g,m,v;if((e.bitmap||e.data)&&e.count>1){const J=e.bitmap||e.data.buffer;g=JSON.stringify(u?d:[d.slice(0,4),o]),f=this._cachedBitmapsMap.get(J),f||(f=new Map,this._cachedBitmapsMap.set(J,f));const at=f.get(g);if(at&&!u){const yt=Math.round(Math.min(d[0],d[2])+d[4]),lt=Math.round(Math.min(d[1],d[3])+d[5]);return{canvas:at,offsetX:yt,offsetY:lt}}m=at}m||(v=this.cachedCanvases.getCanvas("maskCanvas",n,l),fS(v.context,e));let y=ct.transform(d,[1/n,0,0,-1/l,0,0]);y=ct.transform(y,[1,0,0,1,0,-l]);const[E,x,C,L]=ct.getAxialAlignedBoundingBox([0,0,n,l],y),M=Math.round(C-E)||1,H=Math.round(L-x)||1,F=this.cachedCanvases.getCanvas("fillCanvas",M,H),I=F.context,j=E,q=x;I.translate(-j,-q),I.transform(...y),m||(m=this._scaleImage(v.canvas,Sn(I)),m=m.img,f&&u&&f.set(g,m)),I.imageSmoothingEnabled=gS(ue(I),e.interpolate),kf(I,m,0,0,m.width,m.height,0,0,n,l),I.globalCompositeOperation="source-in";const Q=ct.transform(Sn(I),[1,0,0,1,-j,-q]);return I.fillStyle=u?o.getPattern(i,this,Q,ci.FILL):o,I.fillRect(0,0,n,l),f&&!u&&(this.cachedCanvases.delete("fillCanvas"),f.set(g,F.canvas)),{canvas:F.canvas,offsetX:Math.round(j),offsetY:Math.round(q)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=$x[e]}setLineJoin(e){this.ctx.lineJoin=Jx[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,i){const n=this.ctx;n.setLineDash!==void 0&&(n.setLineDash(e),n.lineDashOffset=i)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[i,n]of e)switch(i){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n[0],n[1]);break;case"CA":this.current.strokeAlpha=n;break;case"ca":this.current.fillAlpha=n,this.ctx.globalAlpha=n;break;case"BM":this.ctx.globalCompositeOperation=n;break;case"SMask":this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n);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,i=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,l=this.cachedCanvases.getCanvas(n,e,i);this.suspendedCtx=this.ctx,this.ctx=l.context;const o=this.ctx;o.setTransform(...ue(this.suspendedCtx)),Du(this.suspendedCtx,o),Qx(o,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Du(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 i=this.current.activeSMask,n=this.suspendedCtx;this.composeSMask(n,i,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,i,n,l){const o=l[0],u=l[1],d=l[2]-o,f=l[3]-u;d===0||f===0||(this.genericComposeSMask(i.context,n,d,f,i.subtype,i.backdrop,i.transferMap,o,u,i.offsetX,i.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,0,0),e.restore())}genericComposeSMask(e,i,n,l,o,u,d,f,g,m,v){let y=e.canvas,E=f-m,x=g-v;if(u){const L=ct.makeHexColor(...u);if(E<0||x<0||E+n>y.width||x+l>y.height){const M=this.cachedCanvases.getCanvas("maskExtension",n,l),H=M.context;H.drawImage(y,-E,-x),H.globalCompositeOperation="destination-atop",H.fillStyle=L,H.fillRect(0,0,n,l),H.globalCompositeOperation="source-over",y=M.canvas,E=x=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const M=new Path2D;M.rect(E,x,n,l),e.clip(M),e.globalCompositeOperation="destination-atop",e.fillStyle=L,e.fillRect(E,x,n,l),e.restore()}}i.save(),i.globalAlpha=1,i.setTransform(1,0,0,1,0,0),o==="Alpha"&&d?i.filter=this.filterFactory.addAlphaFilter(d):o==="Luminosity"&&(i.filter=this.filterFactory.addLuminosityFilter(d));const C=new Path2D;C.rect(f,g,n,l),i.clip(C),i.globalCompositeOperation="destination-in",i.drawImage(y,E,x,n,l,f,g,n,l),i.restore()}save(){this.inSMaskMode?(Du(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),Du(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,i,n,l,o,u){this.ctx.transform(e,i,n,l,o,u),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,i,n){const l=this.ctx,o=this.current;let u=o.x,d=o.y,f,g;const m=ue(l),v=m[0]===0&&m[3]===0||m[1]===0&&m[2]===0,y=v?n.slice(0):null;for(let E=0,x=0,C=e.length;E<C;E++)switch(e[E]|0){case ms.rectangle:u=i[x++],d=i[x++];const L=i[x++],M=i[x++],H=u+L,F=d+M;l.moveTo(u,d),L===0||M===0?l.lineTo(H,F):(l.lineTo(H,d),l.lineTo(H,F),l.lineTo(u,F)),v||o.updateRectMinMax(m,[u,d,H,F]),l.closePath();break;case ms.moveTo:u=i[x++],d=i[x++],l.moveTo(u,d),v||o.updatePathMinMax(m,u,d);break;case ms.lineTo:u=i[x++],d=i[x++],l.lineTo(u,d),v||o.updatePathMinMax(m,u,d);break;case ms.curveTo:f=u,g=d,u=i[x+4],d=i[x+5],l.bezierCurveTo(i[x],i[x+1],i[x+2],i[x+3],u,d),o.updateCurvePathMinMax(m,f,g,i[x],i[x+1],i[x+2],i[x+3],u,d,y),x+=6;break;case ms.curveTo2:f=u,g=d,l.bezierCurveTo(u,d,i[x],i[x+1],i[x+2],i[x+3]),o.updateCurvePathMinMax(m,f,g,u,d,i[x],i[x+1],i[x+2],i[x+3],y),u=i[x+2],d=i[x+3],x+=4;break;case ms.curveTo3:f=u,g=d,u=i[x+2],d=i[x+3],l.bezierCurveTo(i[x],i[x+1],u,d,u,d),o.updateCurvePathMinMax(m,f,g,i[x],i[x+1],u,d,u,d,y),x+=4;break;case ms.closePath:l.closePath();break}v&&o.updateScalingPathMinMax(m,y),o.setCurrentPoint(u,d)}closePath(){this.ctx.closePath()}stroke(e=!0){const i=this.ctx,n=this.current.strokeColor;i.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof n=="object"&&(n!=null&&n.getPattern)?(i.save(),i.strokeStyle=n.getPattern(i,this,Sn(i),ci.STROKE),this.rescaleAndStroke(!1),i.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),i.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e=!0){const i=this.ctx,n=this.current.fillColor,l=this.current.patternFill;let o=!1;l&&(i.save(),i.fillStyle=n.getPattern(i,this,Sn(i),ci.FILL),o=!0);const u=this.current.getClippedPathBoundingBox();this.contentVisible&&u!==null&&(this.pendingEOFill?(i.fill("evenodd"),this.pendingEOFill=!1):i.fill()),o&&i.restore(),e&&this.consumePath(u)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=tC}eoClip(){this.pendingClip=pS}beginText(){this.current.textMatrix=ES,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,i=this.ctx;if(e===void 0){i.beginPath();return}i.save(),i.beginPath();for(const n of e)i.setTransform(...n.transform),i.translate(n.x,n.y),n.addToPath(i,n.fontSize);i.restore(),i.clip(),i.beginPath(),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,i){var m;const n=this.commonObjs.get(e),l=this.current;if(!n)throw new Error(`Can't find font for ${e}`);if(l.fontMatrix=n.fontMatrix||v0,(l.fontMatrix[0]===0||l.fontMatrix[3]===0)&&Ct("Invalid font matrix for font "+e),i<0?(i=-i,l.fontDirection=-1):l.fontDirection=1,this.current.font=n,this.current.fontSize=i,n.isType3Font)return;const o=n.loadedName||"sans-serif",u=((m=n.systemFontInfo)==null?void 0:m.css)||`"${o}", ${n.fallbackName}`;let d="normal";n.black?d="900":n.bold&&(d="bold");const f=n.italic?"italic":"normal";let g=i;i<rS?g=rS:i>oS&&(g=oS),this.current.fontSizeScale=i/g,this.ctx.font=`${f} ${d} ${g}px ${u}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,i){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=i}setLeadingMoveText(e,i){this.setLeading(-i),this.moveText(e,i)}setTextMatrix(e,i,n,l,o,u){this.current.textMatrix=[e,i,n,l,o,u],this.current.textMatrixScale=Math.hypot(e,i),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,i,n,l){const o=this.ctx,u=this.current,d=u.font,f=u.textRenderingMode,g=u.fontSize/u.fontSizeScale,m=f&$e.FILL_STROKE_MASK,v=!!(f&$e.ADD_TO_PATH_FLAG),y=u.patternFill&&!d.missingFile;let E;(d.disableFontFace||v||y)&&(E=d.getPathGenerator(this.commonObjs,e)),d.disableFontFace||y?(o.save(),o.translate(i,n),o.beginPath(),E(o,g),l&&o.setTransform(...l),(m===$e.FILL||m===$e.FILL_STROKE)&&o.fill(),(m===$e.STROKE||m===$e.FILL_STROKE)&&o.stroke(),o.restore()):((m===$e.FILL||m===$e.FILL_STROKE)&&o.fillText(e,i,n),(m===$e.STROKE||m===$e.FILL_STROKE)&&o.strokeText(e,i,n)),v&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:ue(o),x:i,y:n,fontSize:g,addToPath:E})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const i=e.getImageData(0,0,10,10).data;let n=!1;for(let l=3;l<i.length;l+=4)if(i[l]>0&&i[l]<255){n=!0;break}return Ft(this,"isFontSubpixelAAEnabled",n)}showText(e){const i=this.current,n=i.font;if(n.isType3Font)return this.showType3Text(e);const l=i.fontSize;if(l===0)return;const o=this.ctx,u=i.fontSizeScale,d=i.charSpacing,f=i.wordSpacing,g=i.fontDirection,m=i.textHScale*g,v=e.length,y=n.vertical,E=y?1:-1,x=n.defaultVMetrics,C=l*i.fontMatrix[0],L=i.textRenderingMode===$e.FILL&&!n.disableFontFace&&!i.patternFill;o.save(),o.transform(...i.textMatrix),o.translate(i.x,i.y+i.textRise),g>0?o.scale(m,-1):o.scale(m,1);let M;if(i.patternFill){o.save();const q=i.fillColor.getPattern(o,this,Sn(o),ci.FILL);M=ue(o),o.restore(),o.fillStyle=q}let H=i.lineWidth;const F=i.textMatrixScale;if(F===0||H===0){const q=i.textRenderingMode&$e.FILL_STROKE_MASK;(q===$e.STROKE||q===$e.FILL_STROKE)&&(H=this.getSinglePixelWidth())}else H/=F;if(u!==1&&(o.scale(u,u),H/=u),o.lineWidth=H,n.isInvalidPDFjsFont){const q=[];let Q=0;for(const J of e)q.push(J.unicode),Q+=J.width;o.fillText(q.join(""),0,0),i.x+=Q*C*m,o.restore(),this.compose();return}let I=0,j;for(j=0;j<v;++j){const q=e[j];if(typeof q=="number"){I+=E*q*l/1e3;continue}let Q=!1;const J=(q.isSpace?f:0)+d,at=q.fontChar,yt=q.accent;let lt,pt,wt=q.width;if(y){const mt=q.vmetric||x,P=-(q.vmetric?mt[1]:wt*.5)*C,X=mt[2]*C;wt=mt?-mt[0]:wt,lt=P/u,pt=(I+X)/u}else lt=I/u,pt=0;if(n.remeasure&&wt>0){const mt=o.measureText(at).width*1e3/l*u;if(wt<mt&&this.isFontSubpixelAAEnabled){const P=wt/mt;Q=!0,o.save(),o.scale(P,1),lt/=P}else wt!==mt&&(lt+=(wt-mt)/2e3*l/u)}if(this.contentVisible&&(q.isInFont||n.missingFile)){if(L&&!yt)o.fillText(at,lt,pt);else if(this.paintChar(at,lt,pt,M),yt){const mt=lt+l*yt.offset.x/u,P=pt-l*yt.offset.y/u;this.paintChar(yt.fontChar,mt,P,M)}}const Ot=y?wt*C-J*g:wt*C+J*g;I+=Ot,Q&&o.restore()}y?i.y-=I:i.x+=I*m,o.restore(),this.compose()}showType3Text(e){const i=this.ctx,n=this.current,l=n.font,o=n.fontSize,u=n.fontDirection,d=l.vertical?1:-1,f=n.charSpacing,g=n.wordSpacing,m=n.textHScale*u,v=n.fontMatrix||v0,y=e.length,E=n.textRenderingMode===$e.INVISIBLE;let x,C,L,M;if(!(E||o===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,i.save(),i.transform(...n.textMatrix),i.translate(n.x,n.y),i.scale(m,u),x=0;x<y;++x){if(C=e[x],typeof C=="number"){M=d*C*o/1e3,this.ctx.translate(M,0),n.x+=M*m;continue}const H=(C.isSpace?g:0)+f,F=l.charProcOperatorList[C.operatorListId];if(!F){Ct(`Type3 character "${C.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=C,this.save(),i.scale(o,o),i.transform(...v),this.executeOperatorList(F),this.restore()),L=ct.applyTransform([C.width,0],v)[0]*o+H,i.translate(L,0),n.x+=L*m}i.restore(),this.processingType3=null}}setCharWidth(e,i){}setCharWidthAndBounds(e,i,n,l,o,u){this.ctx.rect(n,l,o-n,u-l),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let i;if(e[0]==="TilingPattern"){const n=e[1],l=this.baseTransform||ue(this.ctx),o={createCanvasGraphics:u=>new Zb(u,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};i=new Y0(e,n,this.ctx,o,l)}else i=this._getPattern(e[1],e[2]);return i}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,i,n){this.ctx.strokeStyle=this.current.strokeColor=ct.makeHexColor(e,i,n)}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(e,i,n){this.ctx.fillStyle=this.current.fillColor=ct.makeHexColor(e,i,n),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,i=null){let n;return this.cachedPatterns.has(e)?n=this.cachedPatterns.get(e):(n=Yx(this.getObject(e)),this.cachedPatterns.set(e,n)),i&&(n.matrix=i),n}shadingFill(e){if(!this.contentVisible)return;const i=this.ctx;this.save();const n=this._getPattern(e);i.fillStyle=n.getPattern(i,this,Sn(i),ci.SHADING);const l=Sn(i);if(l){const{width:o,height:u}=i.canvas,[d,f,g,m]=ct.getAxialAlignedBoundingBox([0,0,o,u],l);this.ctx.fillRect(d,f,g-d,m-f)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){se("Should not call beginInlineImage")}beginImageData(){se("Should not call beginImageData")}paintFormXObjectBegin(e,i){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=ue(this.ctx),i)){const n=i[2]-i[0],l=i[3]-i[1];this.ctx.rect(i[0],i[1],n,l),this.current.updateRectMinMax(ue(this.ctx),i),this.clip(),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 i=this.ctx;e.isolated||Bg("TODO: Support non-isolated groups."),e.knockout&&Ct("Knockout groups not supported.");const n=ue(i);if(e.matrix&&i.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let l=ct.getAxialAlignedBoundingBox(e.bbox,ue(i));const o=[0,0,i.canvas.width,i.canvas.height];l=ct.intersect(l,o)||[0,0,0,0];const u=Math.floor(l[0]),d=Math.floor(l[1]),f=Math.max(Math.ceil(l[2])-u,1),g=Math.max(Math.ceil(l[3])-d,1);this.current.startNewPathAndClipBox([0,0,f,g]);let m="groupAt"+this.groupLevel;e.smask&&(m+="_smask_"+this.smaskCounter++%2);const v=this.cachedCanvases.getCanvas(m,f,g),y=v.context;y.translate(-u,-d),y.transform(...n),e.smask?this.smaskStack.push({canvas:v.canvas,context:y,offsetX:u,offsetY:d,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(i.setTransform(1,0,0,1,0,0),i.translate(u,d),i.save()),Du(i,y),this.ctx=y,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(i),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const i=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const l=ue(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...l);const o=ct.getAxialAlignedBoundingBox([0,0,i.canvas.width,i.canvas.height],l);this.ctx.drawImage(i.canvas,0,0),this.ctx.restore(),this.compose(o)}}beginAnnotation(e,i,n,l,o){if(_(this,nl,V0).call(this),zf(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),i){const u=i[2]-i[0],d=i[3]-i[1];if(o&&this.annotationCanvasMap){n=n.slice(),n[4]-=i[0],n[5]-=i[1],i=i.slice(),i[0]=i[1]=0,i[2]=u,i[3]=d;const[f,g]=ct.singularValueDecompose2dScale(ue(this.ctx)),{viewportScale:m}=this,v=Math.ceil(u*this.outputScaleX*m),y=Math.ceil(d*this.outputScaleY*m);this.annotationCanvas=this.canvasFactory.create(v,y);const{canvas:E,context:x}=this.annotationCanvas;this.annotationCanvasMap.set(e,E),this.annotationCanvas.savedCtx=this.ctx,this.ctx=x,this.ctx.save(),this.ctx.setTransform(f,0,0,-g,0,d*g),zf(this.ctx)}else zf(this.ctx),this.endPath(),this.ctx.rect(i[0],i[1],u,d),this.ctx.clip(),this.ctx.beginPath()}this.current=new hS(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...l)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),_(this,nl,K0).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const i=e.count;e=this.getObject(e.data,e),e.count=i;const n=this.ctx,l=this.processingType3;if(l&&(l.compiled===void 0&&(l.compiled=Wx(e)),l.compiled)){l.compiled(n);return}const o=this._createMaskCanvas(e),u=o.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(u,o.offsetX,o.offsetY),n.restore(),this.compose()}paintImageMaskXObjectRepeat(e,i,n=0,l=0,o,u){if(!this.contentVisible)return;e=this.getObject(e.data,e);const d=this.ctx;d.save();const f=ue(d);d.transform(i,n,l,o,0,0);const g=this._createMaskCanvas(e);d.setTransform(1,0,0,1,g.offsetX-f[4],g.offsetY-f[5]);for(let m=0,v=u.length;m<v;m+=2){const y=ct.transform(f,[i,n,l,o,u[m],u[m+1]]),[E,x]=ct.applyTransform([0,0],y);d.drawImage(g.canvas,E,x)}d.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const i=this.ctx,n=this.current.fillColor,l=this.current.patternFill;for(const o of e){const{data:u,width:d,height:f,transform:g}=o,m=this.cachedCanvases.getCanvas("maskCanvas",d,f),v=m.context;v.save();const y=this.getObject(u,o);fS(v,y),v.globalCompositeOperation="source-in",v.fillStyle=l?n.getPattern(v,this,Sn(i),ci.FILL):n,v.fillRect(0,0,d,f),v.restore(),i.save(),i.transform(...g),i.scale(1,-1),kf(i,m.canvas,0,0,d,f,0,-1,1,1),i.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const i=this.getObject(e);if(!i){Ct("Dependent image isn't ready yet");return}this.paintInlineImageXObject(i)}paintImageXObjectRepeat(e,i,n,l){if(!this.contentVisible)return;const o=this.getObject(e);if(!o){Ct("Dependent image isn't ready yet");return}const u=o.width,d=o.height,f=[];for(let g=0,m=l.length;g<m;g+=2)f.push({transform:[i,0,0,n,l[g],l[g+1]],x:0,y:0,w:u,h:d});this.paintInlineImageXObjectGroup(o,f)}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:i,width:n,height:l}=e,o=this.cachedCanvases.getCanvas("inlineImage",n,l),u=o.context;return u.filter=this.current.transferMaps,u.drawImage(i,0,0),u.filter="none",o.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const i=e.width,n=e.height,l=this.ctx;if(this.save(),!ni){const{filter:d}=l;d!=="none"&&d!==""&&(l.filter="none")}l.scale(1/i,-1/n);let o;if(e.bitmap)o=this.applyTransferMapsToBitmap(e);else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)o=e;else{const f=this.cachedCanvases.getCanvas("inlineImage",i,n).context;dS(f,e),o=this.applyTransferMapsToCanvas(f)}const u=this._scaleImage(o,Sn(l));l.imageSmoothingEnabled=gS(ue(l),e.interpolate),kf(l,u.img,0,0,u.paintWidth,u.paintHeight,0,-n,i,n),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,i){if(!this.contentVisible)return;const n=this.ctx;let l;if(e.bitmap)l=e.bitmap;else{const o=e.width,u=e.height,f=this.cachedCanvases.getCanvas("inlineImage",o,u).context;dS(f,e),l=this.applyTransferMapsToCanvas(f)}for(const o of i)n.save(),n.transform(...o.transform),n.scale(1,-1),kf(n,l,o.x,o.y,o.w,o.h,0,-1,1,1),n.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,i){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,i){e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(i)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){const i=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const n=this.ctx;this.pendingClip&&(i||(this.pendingClip===pS?n.clip("evenodd"):n.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),n.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=ue(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const i=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),l=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(n,l)/i}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:i,b:n,c:l,d:o}=this.ctx.getTransform();let u,d;if(n===0&&l===0){const f=Math.abs(i),g=Math.abs(o);if(f===g)if(e===0)u=d=1/f;else{const m=f*e;u=d=m<1?1/m:1}else if(e===0)u=1/f,d=1/g;else{const m=f*e,v=g*e;u=m<1?1/m:1,d=v<1?1/v:1}}else{const f=Math.abs(i*o-n*l),g=Math.hypot(i,n),m=Math.hypot(l,o);if(e===0)u=m/f,d=g/f;else{const v=e*f;u=m>v?m/v:1,d=g>v?g/v:1}}this._cachedScaleForStroking[0]=u,this._cachedScaleForStroking[1]=d}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:i}=this,{lineWidth:n}=this.current,[l,o]=this.getScaleForStroking();if(i.lineWidth=n||1,l===1&&o===1){i.stroke();return}const u=i.getLineDash();if(e&&i.save(),i.scale(l,o),u.length>0){const d=Math.max(l,o);i.setLineDash(u.map(f=>f/d)),i.lineDashOffset/=d}i.stroke(),e&&i.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};nl=new WeakSet,V0=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)},K0=function(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const i=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=i}}};let Ro=Zb;for(const b in ms)Ro.prototype[b]!==void 0&&(Ro.prototype[ms[b]]=Ro.prototype[b]);var Ah,Sh;class Qn{static get workerPort(){return c(this,Ah)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");S(this,Ah,e)}static get workerSrc(){return c(this,Sh)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");S(this,Sh,e)}}Ah=new WeakMap,Sh=new WeakMap,w(Qn,Ah,null),w(Qn,Sh,"");const Hf={DATA:1,ERROR:2},Ae={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function ki(b){switch(b instanceof Error||typeof b=="object"&&b!==null||se('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),b.name){case"AbortException":return new Or(b.message);case"MissingPDFException":return new Lr(b.message);case"PasswordException":return new y0(b.message,b.code);case"UnexpectedResponseException":return new Pg(b.message,b.status);case"UnknownErrorException":return new A0(b.message,b.details);default:return new A0(b.message,b.toString())}}var Xo,us,r_,o_,c_,Vf;class Bu{constructor(e,i,n){w(this,us);w(this,Xo,new AbortController);this.sourceName=e,this.targetName=i,this.comObj=n,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),n.addEventListener("message",_(this,us,r_).bind(this),{signal:c(this,Xo).signal})}on(e,i){const n=this.actionHandler;if(n[e])throw new Error(`There is already an actionName called "${e}"`);n[e]=i}send(e,i,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:i},n)}sendWithPromise(e,i,n){const l=this.callbackId++,o=Promise.withResolvers();this.callbackCapabilities[l]=o;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:l,data:i},n)}catch(u){o.reject(u)}return o.promise}sendWithStream(e,i,n,l){const o=this.streamId++,u=this.sourceName,d=this.targetName,f=this.comObj;return new ReadableStream({start:g=>{const m=Promise.withResolvers();return this.streamControllers[o]={controller:g,startCall:m,pullCall:null,cancelCall:null,isClosed:!1},f.postMessage({sourceName:u,targetName:d,action:e,streamId:o,data:i,desiredSize:g.desiredSize},l),m.promise},pull:g=>{const m=Promise.withResolvers();return this.streamControllers[o].pullCall=m,f.postMessage({sourceName:u,targetName:d,stream:Ae.PULL,streamId:o,desiredSize:g.desiredSize}),m.promise},cancel:g=>{De(g instanceof Error,"cancel must have a valid reason");const m=Promise.withResolvers();return this.streamControllers[o].cancelCall=m,this.streamControllers[o].isClosed=!0,f.postMessage({sourceName:u,targetName:d,stream:Ae.CANCEL,streamId:o,reason:ki(g)}),m.promise}},n)}destroy(){var e;(e=c(this,Xo))==null||e.abort(),S(this,Xo,null)}}Xo=new WeakMap,us=new WeakSet,r_=function({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){_(this,us,c_).call(this,e);return}if(e.callback){const n=e.callbackId,l=this.callbackCapabilities[n];if(!l)throw new Error(`Cannot resolve callback ${n}`);if(delete this.callbackCapabilities[n],e.callback===Hf.DATA)l.resolve(e.data);else if(e.callback===Hf.ERROR)l.reject(ki(e.reason));else throw new Error("Unexpected callback case");return}const i=this.actionHandler[e.action];if(!i)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const n=this.sourceName,l=e.sourceName,o=this.comObj;new Promise(function(u){u(i(e.data))}).then(function(u){o.postMessage({sourceName:n,targetName:l,callback:Hf.DATA,callbackId:e.callbackId,data:u})},function(u){o.postMessage({sourceName:n,targetName:l,callback:Hf.ERROR,callbackId:e.callbackId,reason:ki(u)})});return}if(e.streamId){_(this,us,o_).call(this,e);return}i(e.data)},o_=function(e){const i=e.streamId,n=this.sourceName,l=e.sourceName,o=this.comObj,u=this,d=this.actionHandler[e.action],f={enqueue(g,m=1,v){if(this.isCancelled)return;const y=this.desiredSize;this.desiredSize-=m,y>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),o.postMessage({sourceName:n,targetName:l,stream:Ae.ENQUEUE,streamId:i,chunk:g},v)},close(){this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:n,targetName:l,stream:Ae.CLOSE,streamId:i}),delete u.streamSinks[i])},error(g){De(g instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,o.postMessage({sourceName:n,targetName:l,stream:Ae.ERROR,streamId:i,reason:ki(g)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};f.sinkCapability.resolve(),f.ready=f.sinkCapability.promise,this.streamSinks[i]=f,new Promise(function(g){g(d(e.data,f))}).then(function(){o.postMessage({sourceName:n,targetName:l,stream:Ae.START_COMPLETE,streamId:i,success:!0})},function(g){o.postMessage({sourceName:n,targetName:l,stream:Ae.START_COMPLETE,streamId:i,reason:ki(g)})})},c_=function(e){const i=e.streamId,n=this.sourceName,l=e.sourceName,o=this.comObj,u=this.streamControllers[i],d=this.streamSinks[i];switch(e.stream){case Ae.START_COMPLETE:e.success?u.startCall.resolve():u.startCall.reject(ki(e.reason));break;case Ae.PULL_COMPLETE:e.success?u.pullCall.resolve():u.pullCall.reject(ki(e.reason));break;case Ae.PULL:if(!d){o.postMessage({sourceName:n,targetName:l,stream:Ae.PULL_COMPLETE,streamId:i,success:!0});break}d.desiredSize<=0&&e.desiredSize>0&&d.sinkCapability.resolve(),d.desiredSize=e.desiredSize,new Promise(function(f){var g;f((g=d.onPull)==null?void 0:g.call(d))}).then(function(){o.postMessage({sourceName:n,targetName:l,stream:Ae.PULL_COMPLETE,streamId:i,success:!0})},function(f){o.postMessage({sourceName:n,targetName:l,stream:Ae.PULL_COMPLETE,streamId:i,reason:ki(f)})});break;case Ae.ENQUEUE:if(De(u,"enqueue should have stream controller"),u.isClosed)break;u.controller.enqueue(e.chunk);break;case Ae.CLOSE:if(De(u,"close should have stream controller"),u.isClosed)break;u.isClosed=!0,u.controller.close(),_(this,us,Vf).call(this,u,i);break;case Ae.ERROR:De(u,"error should have stream controller"),u.controller.error(ki(e.reason)),_(this,us,Vf).call(this,u,i);break;case Ae.CANCEL_COMPLETE:e.success?u.cancelCall.resolve():u.cancelCall.reject(ki(e.reason)),_(this,us,Vf).call(this,u,i);break;case Ae.CANCEL:if(!d)break;new Promise(function(f){var g;f((g=d.onCancel)==null?void 0:g.call(d,ki(e.reason)))}).then(function(){o.postMessage({sourceName:n,targetName:l,stream:Ae.CANCEL_COMPLETE,streamId:i,success:!0})},function(f){o.postMessage({sourceName:n,targetName:l,stream:Ae.CANCEL_COMPLETE,streamId:i,reason:ki(f)})}),d.sinkCapability.reject(ki(e.reason)),d.isCancelled=!0,delete this.streamSinks[i];break;default:throw new Error("Unexpected stream case")}},Vf=async function(e,i){var n,l,o;await Promise.allSettled([(n=e.startCall)==null?void 0:n.promise,(l=e.pullCall)==null?void 0:l.promise,(o=e.cancelCall)==null?void 0:o.promise]),delete this.streamControllers[i]};var Ql,_h;class eC{constructor({parsedData:e,rawData:i}){w(this,Ql);w(this,_h);S(this,Ql,e),S(this,_h,i)}getRaw(){return c(this,_h)}get(e){return c(this,Ql).get(e)??null}getAll(){return Hb(c(this,Ql))}has(e){return c(this,Ql).has(e)}}Ql=new WeakMap,_h=new WeakMap;const To=Symbol("INTERNAL");var Eh,Th,wh,Yo;class iC{constructor(e,{name:i,intent:n,usage:l,rbGroups:o}){w(this,Eh,!1);w(this,Th,!1);w(this,wh,!1);w(this,Yo,!0);S(this,Eh,!!(e&qi.DISPLAY)),S(this,Th,!!(e&qi.PRINT)),this.name=i,this.intent=n,this.usage=l,this.rbGroups=o}get visible(){if(c(this,wh))return c(this,Yo);if(!c(this,Yo))return!1;const{print:e,view:i}=this.usage;return c(this,Eh)?(i==null?void 0:i.viewState)!=="OFF":c(this,Th)?(e==null?void 0:e.printState)!=="OFF":!0}_setVisible(e,i,n=!1){e!==To&&se("Internal method `_setVisible` called."),S(this,wh,n),S(this,Yo,i)}}Eh=new WeakMap,Th=new WeakMap,wh=new WeakMap,Yo=new WeakMap;var Ba,Vt,Vo,Ko,xh,Q0;class sC{constructor(e,i=qi.DISPLAY){w(this,xh);w(this,Ba,null);w(this,Vt,new Map);w(this,Vo,null);w(this,Ko,null);if(this.renderingIntent=i,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,S(this,Ko,e.order);for(const n of e.groups)c(this,Vt).set(n.id,new iC(i,n));if(e.baseState==="OFF")for(const n of c(this,Vt).values())n._setVisible(To,!1);for(const n of e.on)c(this,Vt).get(n)._setVisible(To,!0);for(const n of e.off)c(this,Vt).get(n)._setVisible(To,!1);S(this,Vo,this.getHash())}}isVisible(e){if(c(this,Vt).size===0)return!0;if(!e)return Bg("Optional content group not defined."),!0;if(e.type==="OCG")return c(this,Vt).has(e.id)?c(this,Vt).get(e.id).visible:(Ct(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return _(this,xh,Q0).call(this,e.expression);if(!e.policy||e.policy==="AnyOn"){for(const i of e.ids){if(!c(this,Vt).has(i))return Ct(`Optional content group not found: ${i}`),!0;if(c(this,Vt).get(i).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const i of e.ids){if(!c(this,Vt).has(i))return Ct(`Optional content group not found: ${i}`),!0;if(!c(this,Vt).get(i).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const i of e.ids){if(!c(this,Vt).has(i))return Ct(`Optional content group not found: ${i}`),!0;if(!c(this,Vt).get(i).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const i of e.ids){if(!c(this,Vt).has(i))return Ct(`Optional content group not found: ${i}`),!0;if(c(this,Vt).get(i).visible)return!1}return!0}return Ct(`Unknown optional content policy ${e.policy}.`),!0}return Ct(`Unknown group type ${e.type}.`),!0}setVisibility(e,i=!0,n=!0){var o;const l=c(this,Vt).get(e);if(!l){Ct(`Optional content group not found: ${e}`);return}if(n&&i&&l.rbGroups.length)for(const u of l.rbGroups)for(const d of u)d!==e&&((o=c(this,Vt).get(d))==null||o._setVisible(To,!1,!0));l._setVisible(To,!!i,!0),S(this,Ba,null)}setOCGState({state:e,preserveRB:i}){let n;for(const l of e){switch(l){case"ON":case"OFF":case"Toggle":n=l;continue}const o=c(this,Vt).get(l);if(o)switch(n){case"ON":this.setVisibility(l,!0,i);break;case"OFF":this.setVisibility(l,!1,i);break;case"Toggle":this.setVisibility(l,!o.visible,i);break}}S(this,Ba,null)}get hasInitialVisibility(){return c(this,Vo)===null||this.getHash()===c(this,Vo)}getOrder(){return c(this,Vt).size?c(this,Ko)?c(this,Ko).slice():[...c(this,Vt).keys()]:null}getGroups(){return c(this,Vt).size>0?Hb(c(this,Vt)):null}getGroup(e){return c(this,Vt).get(e)||null}getHash(){if(c(this,Ba)!==null)return c(this,Ba);const e=new ZS;for(const[i,n]of c(this,Vt))e.update(`${i}:${n.visible}`);return S(this,Ba,e.hexdigest())}}Ba=new WeakMap,Vt=new WeakMap,Vo=new WeakMap,Ko=new WeakMap,xh=new WeakSet,Q0=function(e){const i=e.length;if(i<2)return!0;const n=e[0];for(let l=1;l<i;l++){const o=e[l];let u;if(Array.isArray(o))u=_(this,xh,Q0).call(this,o);else if(c(this,Vt).has(o))u=c(this,Vt).get(o).visible;else return Ct(`Optional content group not found: ${o}`),!0;switch(n){case"And":if(!u)return!1;break;case"Or":if(u)return!0;break;case"Not":return!u;default:return!0}}return n==="And"};class nC{constructor(e,{disableRange:i=!1,disableStream:n=!1}){De(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:l,initialData:o,progressiveDone:u,contentDispositionFilename:d}=e;if(this._queuedChunks=[],this._progressiveDone=u,this._contentDispositionFilename=d,(o==null?void 0:o.length)>0){const f=o instanceof Uint8Array&&o.byteLength===o.buffer.byteLength?o.buffer:new Uint8Array(o).buffer;this._queuedChunks.push(f)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!n,this._isRangeSupported=!i,this._contentLength=l,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener((f,g)=>{this._onReceiveData({begin:f,chunk:g})}),e.addProgressListener((f,g)=>{this._onProgress({loaded:f,total:g})}),e.addProgressiveReadListener(f=>{this._onReceiveData({chunk:f})}),e.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),e.transportReady()}_onReceiveData({begin:e,chunk:i}){const n=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{const l=this._rangeReaders.some(function(o){return o._begin!==e?!1:(o._enqueue(n),!0)});De(l,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}_onProgress(e){var i,n,l,o;e.total===void 0?(n=(i=this._rangeReaders[0])==null?void 0:i.onProgress)==null||n.call(i,{loaded:e.loaded}):(o=(l=this._fullRequestReader)==null?void 0:l.onProgress)==null||o.call(l,{loaded:e.loaded,total:e.total})}_onProgressiveDone(){var e;(e=this._fullRequestReader)==null||e.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const i=this._rangeReaders.indexOf(e);i>=0&&this._rangeReaders.splice(i,1)}getFullReader(){De(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new aC(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,i){if(i<=this._progressiveDataLength)return null;const n=new lC(this,e,i);return this._pdfDataRangeTransport.requestDataRange(e,i),this._rangeReaders.push(n),n}cancelAllRequests(e){var i;(i=this._fullRequestReader)==null||i.cancel(e);for(const n of this._rangeReaders.slice(0))n.cancel(e);this._pdfDataRangeTransport.abort()}}class aC{constructor(e,i,n=!1,l=null){this._stream=e,this._done=n||!1,this._filename=Bb(l)?l:null,this._queuedChunks=i||[],this._loaded=0;for(const o of this._queuedChunks)this._loaded+=o.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 i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class lC{constructor(e,i,n){this._stream=e,this._begin=i,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length===0)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const i=this._queuedChunk;return this._queuedChunk=null,{value:i,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 i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function rC(b){let e=!0,i=n("filename\\*","i").exec(b);if(i){i=i[1];let m=d(i);return m=unescape(m),m=f(m),m=g(m),o(m)}if(i=u(b),i){const m=g(i);return o(m)}if(i=n("filename","i").exec(b),i){i=i[1];let m=d(i);return m=g(m),o(m)}function n(m,v){return new RegExp("(?:^|;)\\s*"+m+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',v)}function l(m,v){if(m){if(!/^[\x00-\xFF]+$/.test(v))return v;try{const y=new TextDecoder(m,{fatal:!0}),E=Ig(v);v=y.decode(E),e=!1}catch{}}return v}function o(m){return e&&/[\x80-\xff]/.test(m)&&(m=l("utf-8",m),e&&(m=l("iso-8859-1",m))),m}function u(m){const v=[];let y;const E=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(y=E.exec(m))!==null;){let[,C,L,M]=y;if(C=parseInt(C,10),C in v){if(C===0)break;continue}v[C]=[L,M]}const x=[];for(let C=0;C<v.length&&C in v;++C){let[L,M]=v[C];M=d(M),L&&(M=unescape(M),C===0&&(M=f(M))),x.push(M)}return x.join("")}function d(m){if(m.startsWith('"')){const v=m.slice(1).split('\\"');for(let y=0;y<v.length;++y){const E=v[y].indexOf('"');E!==-1&&(v[y]=v[y].slice(0,E),v.length=y+1),v[y]=v[y].replaceAll(/\\(.)/g,"$1")}m=v.join('"')}return m}function f(m){const v=m.indexOf("'");if(v===-1)return m;const y=m.slice(0,v),x=m.slice(v+1).replace(/^[^']*'/,"");return l(y,x)}function g(m){return!m.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(m)?m:m.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(v,y,E,x){if(E==="q"||E==="Q")return x=x.replaceAll("_"," "),x=x.replaceAll(/=([0-9a-fA-F]{2})/g,function(C,L){return String.fromCharCode(parseInt(L,16))}),l(y,x);try{x=atob(x)}catch{}return l(y,x)})}return""}function Gb(b,e){const i=new Headers;if(!b||!e||typeof e!="object")return i;for(const n in e){const l=e[n];l!==void 0&&i.append(n,l)}return i}function Xb({responseHeaders:b,isHttp:e,rangeChunkSize:i,disableRange:n}){const l={allowRangeRequests:!1,suggestedLength:void 0},o=parseInt(b.get("Content-Length"),10);return!Number.isInteger(o)||(l.suggestedLength=o,o<=2*i)||n||!e||b.get("Accept-Ranges")!=="bytes"||(b.get("Content-Encoding")||"identity")!=="identity"||(l.allowRangeRequests=!0),l}function Yb(b){const e=b.get("Content-Disposition");if(e){let i=rC(e);if(i.includes("%"))try{i=decodeURIComponent(i)}catch{}if(Bb(i))return i}return null}function Gg(b,e){return b===404||b===0&&e.startsWith("file:")?new Lr('Missing PDF "'+e+'".'):new Pg(`Unexpected server response (${b}) while retrieving PDF "${e}".`,b)}function u_(b){return b===200||b===206}function h_(b,e,i){return{method:"GET",headers:b,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function d_(b){return b instanceof Uint8Array?b.buffer:b instanceof ArrayBuffer?b:(Ct(`getArrayBuffer - unexpected data format: ${b}`),new Uint8Array(b).buffer)}class mS{constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=Gb(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 De(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new oC(this),this._fullRequestReader}getRangeReader(e,i){if(i<=this._progressiveDataLength)return null;const n=new cC(this,e,i);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){var i;(i=this._fullRequestReader)==null||i.cancel(e);for(const n of this._rangeRequestReaders.slice(0))n.cancel(e)}}class oC{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const i=e.source;this._withCredentials=i.withCredentials||!1,this._contentLength=i.length,this._headersCapability=Promise.withResolvers(),this._disableRange=i.disableRange||!1,this._rangeChunkSize=i.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!i.disableStream,this._isRangeSupported=!i.disableRange;const n=new Headers(e.headers),l=i.url;fetch(l,h_(n,this._withCredentials,this._abortController)).then(o=>{if(!u_(o.status))throw Gg(o.status,l);this._reader=o.body.getReader(),this._headersCapability.resolve();const u=o.headers,{allowRangeRequests:d,suggestedLength:f}=Xb({responseHeaders:u,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=d,this._contentLength=f||this._contentLength,this._filename=Yb(u),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Or("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 n;await this._headersCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,(n=this.onProgress)==null||n.call(this,{loaded:this._loaded,total:this._contentLength}),{value:d_(e),done:!1})}cancel(e){var i;(i=this._reader)==null||i.cancel(e),this._abortController.abort()}}class cC{constructor(e,i,n){this._stream=e,this._reader=null,this._loaded=0;const l=e.source;this._withCredentials=l.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!l.disableStream,this._abortController=new AbortController;const o=new Headers(e.headers);o.append("Range",`bytes=${i}-${n-1}`);const u=l.url;fetch(u,h_(o,this._withCredentials,this._abortController)).then(d=>{if(!u_(d.status))throw Gg(d.status,u);this._readCapability.resolve(),this._reader=d.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var n;await this._readCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,(n=this.onProgress)==null||n.call(this,{loaded:this._loaded}),{value:d_(e),done:!1})}cancel(e){var i;(i=this._reader)==null||i.cancel(e),this._abortController.abort()}}const m0=200,b0=206;function uC(b){const e=b.response;return typeof e!="string"?e:Ig(e).buffer}class hC{constructor({url:e,httpHeaders:i,withCredentials:n}){this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=Gb(this.isHttp,i),this.withCredentials=n||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(e,i,n){const l={begin:e,end:i};for(const o in n)l[o]=n[o];return this.request(l)}requestFull(e){return this.request(e)}request(e){const i=new XMLHttpRequest,n=this.currXhrId++,l=this.pendingRequests[n]={xhr:i};i.open("GET",this.url),i.withCredentials=this.withCredentials;for(const[o,u]of this.headers)i.setRequestHeader(o,u);return this.isHttp&&"begin"in e&&"end"in e?(i.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),l.expectedStatus=b0):l.expectedStatus=m0,i.responseType="arraybuffer",e.onError&&(i.onerror=function(o){e.onError(i.status)}),i.onreadystatechange=this.onStateChange.bind(this,n),i.onprogress=this.onProgress.bind(this,n),l.onHeadersReceived=e.onHeadersReceived,l.onDone=e.onDone,l.onError=e.onError,l.onProgress=e.onProgress,i.send(null),n}onProgress(e,i){var l;const n=this.pendingRequests[e];n&&((l=n.onProgress)==null||l.call(n,i))}onStateChange(e,i){var f,g,m;const n=this.pendingRequests[e];if(!n)return;const l=n.xhr;if(l.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),l.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],l.status===0&&this.isHttp){(f=n.onError)==null||f.call(n,l.status);return}const o=l.status||m0;if(!(o===m0&&n.expectedStatus===b0)&&o!==n.expectedStatus){(g=n.onError)==null||g.call(n,l.status);return}const d=uC(l);if(o===b0){const v=l.getResponseHeader("Content-Range"),y=/bytes (\d+)-(\d+)\/(\d+)/.exec(v);n.onDone({begin:parseInt(y[1],10),chunk:d})}else d?n.onDone({begin:0,chunk:d}):(m=n.onError)==null||m.call(n,l.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const i=this.pendingRequests[e].xhr;delete this.pendingRequests[e],i.abort()}}class dC{constructor(e){this._source=e,this._manager=new hC(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const i=this._rangeRequestReaders.indexOf(e);i>=0&&this._rangeRequestReaders.splice(i,1)}getFullReader(){return De(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new fC(this._manager,this._source),this._fullRequestReader}getRangeReader(e,i){const n=new gC(this._manager,e,i);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(e){var i;(i=this._fullRequestReader)==null||i.cancel(e);for(const n of this._rangeRequestReaders.slice(0))n.cancel(e)}}class fC{constructor(e,i){this._manager=e;const n={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=i.url,this._fullRequestId=e.requestFull(n),this._headersCapability=Promise.withResolvers(),this._disableRange=i.disableRange||!1,this._contentLength=i.length,this._rangeChunkSize=i.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,i=this._manager.getRequestXhr(e),n=new Headers(i.getAllResponseHeaders().trim().split(/[\r\n]+/).map(u=>{const[d,...f]=u.split(": ");return[d,f.join(": ")]})),{allowRangeRequests:l,suggestedLength:o}=Xb({responseHeaders:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});l&&(this._isRangeSupported=!0),this._contentLength=o||this._contentLength,this._filename=Yb(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 i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=Gg(e,this._url),this._headersCapability.reject(this._storedError);for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){var i;(i=this.onProgress)==null||i.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(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 i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class gC{constructor(e,i,n){this._manager=e;const l={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._requestId=e.requestRange(i,n,l),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var e;(e=this.onClosed)==null||e.call(this,this)}_onDone(e){const i=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:i,done:!1}):this._queuedChunk=i,this._done=!0;for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError=Gg(e,this._url);for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){var i;this.isStreamingSupported||(i=this.onProgress)==null||i.call(this,{loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const i=this._queuedChunk;return this._queuedChunk=null,{value:i,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 i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const pC=/^[a-z][a-z0-9\-+.]+:/i;function mC(b){if(pC.test(b))return new URL(b);const e=il.get("url");return new URL(e.pathToFileURL(b))}function f_(b,e,i){return b.protocol==="http:"?il.get("http").request(b,{headers:e},i):il.get("https").request(b,{headers:e},i)}class bC{constructor(e){this.source=e,this.url=mC(e.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.headers=Gb(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 De(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new AC(this):new vC(this),this._fullRequestReader}getRangeReader(e,i){if(i<=this._progressiveDataLength)return null;const n=this.isFsUrl?new SC(this,e,i):new yC(this,e,i);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){var i;(i=this._fullRequestReader)==null||i.cancel(e);for(const n of this._rangeRequestReaders.slice(0))n.cancel(e)}}class g_{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const i=e.source;this._contentLength=i.length,this._loaded=0,this._filename=null,this._disableRange=i.disableRange||!1,this._rangeChunkSize=i.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!i.disableStream,this._isRangeSupported=!i.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var n;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,(n=this.onProgress)==null||n.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",i=>{this._error(i)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new Or("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class p_{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const i=e.source;this._isStreamingSupported=!i.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var n;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,(n=this.onProgress)==null||n.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",i=>{this._error(i)}),this._storedError&&this._readableStream.destroy(this._storedError)}}class vC extends g_{constructor(e){super(e);const i=Object.fromEntries(e.headers),n=l=>{if(l.statusCode===404){const f=new Lr(`Missing PDF "${this._url}".`);this._storedError=f,this._headersCapability.reject(f);return}this._headersCapability.resolve(),this._setReadableStream(l);const o=new Headers(this._readableStream.headers),{allowRangeRequests:u,suggestedLength:d}=Xb({responseHeaders:o,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=u,this._contentLength=d||this._contentLength,this._filename=Yb(o)};this._request=f_(this._url,i,n),this._request.on("error",l=>{this._storedError=l,this._headersCapability.reject(l)}),this._request.end()}}class yC extends p_{constructor(e,i,n){super(e);const l=Object.fromEntries(e.headers);l.Range=`bytes=${i}-${n-1}`;const o=u=>{if(u.statusCode===404){const d=new Lr(`Missing PDF "${this._url}".`);this._storedError=d;return}this._setReadableStream(u)};this._request=f_(this._url,l,o),this._request.on("error",u=>{this._storedError=u}),this._request.end()}}class AC extends g_{constructor(e){super(e);const i=il.get("fs");i.promises.lstat(this._url).then(n=>{this._contentLength=n.size,this._setReadableStream(i.createReadStream(this._url)),this._headersCapability.resolve()},n=>{n.code==="ENOENT"&&(n=new Lr(`Missing PDF "${this._url}".`)),this._storedError=n,this._headersCapability.reject(n)})}}class SC extends p_{constructor(e,i,n){super(e);const l=il.get("fs");this._setReadableStream(l.createReadStream(this._url,{start:i,end:n-1}))}}const _C=1e5,vi=30,EC=.8;var _S,Pa,Si,Ch,Mh,Zl,Ln,Rh,Dh,Wl,Qo,Zo,Ia,Wo,Lh,$o,$l,Oh,Nh,Jl,tr,kh,ja,Jo,Jn,m_,b_,Z0,Xi,Kf,W0,v_,y_;const xe=class xe{constructor({textContentSource:e,container:i,viewport:n}){w(this,Jn);w(this,Pa,Promise.withResolvers());w(this,Si,null);w(this,Ch,!1);w(this,Mh,!!((_S=globalThis.FontInspector)!=null&&_S.enabled));w(this,Zl,null);w(this,Ln,null);w(this,Rh,0);w(this,Dh,0);w(this,Wl,null);w(this,Qo,null);w(this,Zo,0);w(this,Ia,0);w(this,Wo,Object.create(null));w(this,Lh,[]);w(this,$o,null);w(this,$l,[]);w(this,Oh,new WeakMap);w(this,Nh,null);var f;if(e instanceof ReadableStream)S(this,$o,e);else if(typeof e=="object")S(this,$o,new ReadableStream({start(g){g.enqueue(e),g.close()}}));else throw new Error('No "textContentSource" parameter specified.');S(this,Si,S(this,Qo,i)),S(this,Ia,n.scale*(globalThis.devicePixelRatio||1)),S(this,Zo,n.rotation),S(this,Ln,{div:null,properties:null,ctx:null});const{pageWidth:l,pageHeight:o,pageX:u,pageY:d}=n.rawDims;S(this,Nh,[1,0,0,-1,-u,d+o]),S(this,Dh,l),S(this,Rh,o),_(f=xe,Xi,v_).call(f),xr(i,n),c(this,Pa).promise.finally(()=>{c(xe,Jo).delete(this),S(this,Ln,null),S(this,Wo,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:i}=ui.platform;return Ft(this,"fontFamilyMap",new Map([["sans-serif",`${e&&i?"Calibri, ":""}sans-serif`],["monospace",`${e&&i?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{c(this,Wl).read().then(({value:i,done:n})=>{if(n){c(this,Pa).resolve();return}c(this,Zl)??S(this,Zl,i.lang),Object.assign(c(this,Wo),i.styles),_(this,Jn,m_).call(this,i.items),e()},c(this,Pa).reject)};return S(this,Wl,c(this,$o).getReader()),c(xe,Jo).add(this),e(),c(this,Pa).promise}update({viewport:e,onBefore:i=null}){var o;const n=e.scale*(globalThis.devicePixelRatio||1),l=e.rotation;if(l!==c(this,Zo)&&(i==null||i(),S(this,Zo,l),xr(c(this,Qo),{rotation:l})),n!==c(this,Ia)){i==null||i(),S(this,Ia,n);const u={div:null,properties:null,ctx:_(o=xe,Xi,Kf).call(o,c(this,Zl))};for(const d of c(this,$l))u.properties=c(this,Oh).get(d),u.div=d,_(this,Jn,Z0).call(this,u)}}cancel(){var i;const e=new Or("TextLayer task cancelled.");(i=c(this,Wl))==null||i.cancel(e).catch(()=>{}),S(this,Wl,null),c(this,Pa).reject(e)}get textDivs(){return c(this,$l)}get textContentItemsStr(){return c(this,Lh)}static cleanup(){if(!(c(this,Jo).size>0)){c(this,Jl).clear();for(const{canvas:e}of c(this,tr).values())e.remove();c(this,tr).clear()}}};Pa=new WeakMap,Si=new WeakMap,Ch=new WeakMap,Mh=new WeakMap,Zl=new WeakMap,Ln=new WeakMap,Rh=new WeakMap,Dh=new WeakMap,Wl=new WeakMap,Qo=new WeakMap,Zo=new WeakMap,Ia=new WeakMap,Wo=new WeakMap,Lh=new WeakMap,$o=new WeakMap,$l=new WeakMap,Oh=new WeakMap,Nh=new WeakMap,Jl=new WeakMap,tr=new WeakMap,kh=new WeakMap,ja=new WeakMap,Jo=new WeakMap,Jn=new WeakSet,m_=function(e){var l,o;if(c(this,Ch))return;(o=c(this,Ln)).ctx??(o.ctx=_(l=xe,Xi,Kf).call(l,c(this,Zl)));const i=c(this,$l),n=c(this,Lh);for(const u of e){if(i.length>_C){Ct("Ignoring additional textDivs for performance reasons."),S(this,Ch,!0);return}if(u.str===void 0){if(u.type==="beginMarkedContentProps"||u.type==="beginMarkedContent"){const d=c(this,Si);S(this,Si,document.createElement("span")),c(this,Si).classList.add("markedContent"),u.id!==null&&c(this,Si).setAttribute("id",`${u.id}`),d.append(c(this,Si))}else u.type==="endMarkedContent"&&S(this,Si,c(this,Si).parentNode);continue}n.push(u.str),_(this,Jn,b_).call(this,u)}},b_=function(e){var C;const i=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};c(this,$l).push(i);const l=ct.transform(c(this,Nh),e.transform);let o=Math.atan2(l[1],l[0]);const u=c(this,Wo)[e.fontName];u.vertical&&(o+=Math.PI/2);let d=c(this,Mh)&&u.fontSubstitution||u.fontFamily;d=xe.fontFamilyMap.get(d)||d;const f=Math.hypot(l[2],l[3]),g=f*_(C=xe,Xi,y_).call(C,d,c(this,Zl));let m,v;o===0?(m=l[4],v=l[5]-g):(m=l[4]+g*Math.sin(o),v=l[5]-g*Math.cos(o));const y="calc(var(--scale-factor)*",E=i.style;c(this,Si)===c(this,Qo)?(E.left=`${(100*m/c(this,Dh)).toFixed(2)}%`,E.top=`${(100*v/c(this,Rh)).toFixed(2)}%`):(E.left=`${y}${m.toFixed(2)}px)`,E.top=`${y}${v.toFixed(2)}px)`),E.fontSize=`${y}${(c(xe,ja)*f).toFixed(2)}px)`,E.fontFamily=d,n.fontSize=f,i.setAttribute("role","presentation"),i.textContent=e.str,i.dir=e.dir,c(this,Mh)&&(i.dataset.fontName=u.fontSubstitutionLoadedName||e.fontName),o!==0&&(n.angle=o*(180/Math.PI));let x=!1;if(e.str.length>1)x=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const L=Math.abs(e.transform[0]),M=Math.abs(e.transform[3]);L!==M&&Math.max(L,M)/Math.min(L,M)>1.5&&(x=!0)}if(x&&(n.canvasWidth=u.vertical?e.height:e.width),c(this,Oh).set(i,n),c(this,Ln).div=i,c(this,Ln).properties=n,_(this,Jn,Z0).call(this,c(this,Ln)),n.hasText&&c(this,Si).append(i),n.hasEOL){const L=document.createElement("br");L.setAttribute("role","presentation"),c(this,Si).append(L)}},Z0=function(e){var d;const{div:i,properties:n,ctx:l}=e,{style:o}=i;let u="";if(c(xe,ja)>1&&(u=`scale(${1/c(xe,ja)})`),n.canvasWidth!==0&&n.hasText){const{fontFamily:f}=o,{canvasWidth:g,fontSize:m}=n;_(d=xe,Xi,W0).call(d,l,m*c(this,Ia),f);const{width:v}=l.measureText(i.textContent);v>0&&(u=`scaleX(${g*c(this,Ia)/v}) ${u}`)}n.angle!==0&&(u=`rotate(${n.angle}deg) ${u}`),u.length>0&&(o.transform=u)},Xi=new WeakSet,Kf=function(e=null){let i=c(this,tr).get(e||(e=""));if(!i){const n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=e,document.body.append(n),i=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),c(this,tr).set(e,i),c(this,kh).set(i,{size:0,family:""})}return i},W0=function(e,i,n){const l=c(this,kh).get(e);i===l.size&&n===l.family||(e.font=`${i}px ${n}`,l.size=i,l.family=n)},v_=function(){if(c(this,ja)!==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),S(this,ja,e.getBoundingClientRect().height),e.remove()},y_=function(e,i){const n=c(this,Jl).get(e);if(n)return n;const l=_(this,Xi,Kf).call(this,i);l.canvas.width=l.canvas.height=vi,_(this,Xi,W0).call(this,l,vi,e);const o=l.measureText("");let u=o.fontBoundingBoxAscent,d=Math.abs(o.fontBoundingBoxDescent);if(u){const m=u/(u+d);return c(this,Jl).set(e,m),l.canvas.width=l.canvas.height=0,m}l.strokeStyle="red",l.clearRect(0,0,vi,vi),l.strokeText("g",0,0);let f=l.getImageData(0,0,vi,vi).data;d=0;for(let m=f.length-1-3;m>=0;m-=4)if(f[m]>0){d=Math.ceil(m/4/vi);break}l.clearRect(0,0,vi,vi),l.strokeText("A",0,vi),f=l.getImageData(0,0,vi,vi).data,u=0;for(let m=0,v=f.length;m<v;m+=4)if(f[m]>0){u=vi-Math.floor(m/4/vi);break}l.canvas.width=l.canvas.height=0;const g=u?u/(u+d):EC;return c(this,Jl).set(e,g),g},w(xe,Xi),w(xe,Jl,new Map),w(xe,tr,new Map),w(xe,kh,new WeakMap),w(xe,ja,null),w(xe,Jo,new Set);let Wu=xe;class $u{static textContent(e){const i=[],n={items:i,styles:Object.create(null)};function l(o){var f;if(!o)return;let u=null;const d=o.name;if(d==="#text")u=o.value;else if($u.shouldBuildText(d))(f=o==null?void 0:o.attributes)!=null&&f.textContent?u=o.attributes.textContent:o.value&&(u=o.value);else return;if(u!==null&&i.push({str:u}),!!o.children)for(const g of o.children)l(g)}return l(e),n}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}const TC=65536,wC=100,xC=5e3,CC=ni?Bx:Hx,MC=ni?Px:e_,RC=ni?Ux:Fx,DC=ni?Ix:a_;function LC(b={}){typeof b=="string"||b instanceof URL?b={url:b}:(b instanceof ArrayBuffer||ArrayBuffer.isView(b))&&(b={data:b});const e=new $0,{docId:i}=e,n=b.url?OC(b.url):null,l=b.data?NC(b.data):null,o=b.httpHeaders||null,u=b.withCredentials===!0,d=b.password??null,f=b.range instanceof A_?b.range:null,g=Number.isInteger(b.rangeChunkSize)&&b.rangeChunkSize>0?b.rangeChunkSize:TC;let m=b.worker instanceof Do?b.worker:null;const v=b.verbosity,y=typeof b.docBaseUrl=="string"&&!qg(b.docBaseUrl)?b.docBaseUrl:null,E=typeof b.cMapUrl=="string"?b.cMapUrl:null,x=b.cMapPacked!==!1,C=b.CMapReaderFactory||MC,L=typeof b.standardFontDataUrl=="string"?b.standardFontDataUrl:null,M=b.StandardFontDataFactory||DC,H=b.stopAtErrors!==!0,F=Number.isInteger(b.maxImageSize)&&b.maxImageSize>-1?b.maxImageSize:-1,I=b.isEvalSupported!==!1,j=typeof b.isOffscreenCanvasSupported=="boolean"?b.isOffscreenCanvasSupported:!ni,q=typeof b.isChrome=="boolean"?b.isChrome:!ui.platform.isFirefox&&typeof window<"u"&&!!(window!=null&&window.chrome),Q=Number.isInteger(b.canvasMaxAreaInBytes)?b.canvasMaxAreaInBytes:-1,J=typeof b.disableFontFace=="boolean"?b.disableFontFace:ni,at=b.fontExtraProperties===!0,yt=b.enableXfa===!0,lt=b.ownerDocument||globalThis.document,pt=b.disableRange===!0,wt=b.disableStream===!0,Ot=b.disableAutoFetch===!0,mt=b.pdfBug===!0,P=b.CanvasFactory||CC,X=b.FilterFactory||RC,W=b.enableHWA===!0,zt=f?f.length:b.length??NaN,D=typeof b.useSystemFonts=="boolean"?b.useSystemFonts:!ni&&!J,V=typeof b.useWorkerFetch=="boolean"?b.useWorkerFetch:C===e_&&M===a_&&E&&L&&Ou(E,document.baseURI)&&Ou(L,document.baseURI);b.canvasFactory&&nS("`canvasFactory`-instance option, please use `CanvasFactory` instead."),b.filterFactory&&nS("`filterFactory`-instance option, please use `FilterFactory` instead.");const $=null;fx(v);const Z={canvasFactory:new P({ownerDocument:lt,enableHWA:W}),filterFactory:new X({docId:i,ownerDocument:lt}),cMapReaderFactory:V?null:new C({baseUrl:E,isCompressed:x}),standardFontDataFactory:V?null:new M({baseUrl:L})};if(!m){const rt={verbosity:v,port:Qn.workerPort};m=rt.port?Do.fromPort(rt):new Do(rt),e._worker=m}const ot={docId:i,apiVersion:"4.8.69",data:l,password:d,disableAutoFetch:Ot,rangeChunkSize:g,length:zt,docBaseUrl:y,enableXfa:yt,evaluatorOptions:{maxImageSize:F,disableFontFace:J,ignoreErrors:H,isEvalSupported:I,isOffscreenCanvasSupported:j,isChrome:q,canvasMaxAreaInBytes:Q,fontExtraProperties:at,useSystemFonts:D,cMapUrl:V?E:null,standardFontDataUrl:V?L:null}},Mt={disableFontFace:J,fontExtraProperties:at,ownerDocument:lt,pdfBug:mt,styleElement:$,loadingParams:{disableAutoFetch:Ot,enableXfa:yt}};return m.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(m.destroyed)throw new Error("Worker was destroyed");const rt=m.messageHandler.sendWithPromise("GetDocRequest",ot,l?[l.buffer]:null);let Rt;if(f)Rt=new nC(f,{disableRange:pt,disableStream:wt});else if(!l){if(!n)throw new Error("getDocument - no `url` parameter provided.");let jt;ni?jt=typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype&&Ou(n)?mS:bC:jt=Ou(n)?mS:dC,Rt=new jt({url:n,length:zt,httpHeaders:o,withCredentials:u,rangeChunkSize:g,disableRange:pt,disableStream:wt})}return rt.then(jt=>{if(e.destroyed)throw new Error("Loading aborted");if(m.destroyed)throw new Error("Worker was destroyed");const Yi=new Bu(i,jt,m.port),Rc=new FC(Yi,e,Rt,Mt,Z);e._transport=Rc,Yi.send("Ready",null)})}).catch(e._capability.reject),e}function OC(b){if(b instanceof URL)return b.href;try{return new URL(b,window.location).href}catch{if(ni&&typeof b=="string")return b}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function NC(b){if(ni&&typeof Buffer<"u"&&b instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(b instanceof Uint8Array&&b.byteLength===b.buffer.byteLength)return b;if(typeof b=="string")return Ig(b);if(b instanceof ArrayBuffer||ArrayBuffer.isView(b)||typeof b=="object"&&!isNaN(b==null?void 0:b.length))return new Uint8Array(b);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function bS(b){return typeof b=="object"&&Number.isInteger(b==null?void 0:b.num)&&b.num>=0&&Number.isInteger(b==null?void 0:b.gen)&&b.gen>=0}var Rg;const Dg=class Dg{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${li(Dg,Rg)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var e,i,n;this.destroyed=!0;try{(e=this._worker)!=null&&e.port&&(this._worker._pendingDestroy=!0),await((i=this._transport)==null?void 0:i.destroy())}catch(l){throw(n=this._worker)!=null&&n.port&&delete this._worker._pendingDestroy,l}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};Rg=new WeakMap,w(Dg,Rg,0);let $0=Dg;class A_{constructor(e,i,n=!1,l=null){this.length=e,this.initialData=i,this.progressiveDone=n,this.contentDispositionFilename=l,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,i){for(const n of this._rangeListeners)n(e,i)}onDataProgress(e,i){this._readyCapability.promise.then(()=>{for(const n of this._progressListeners)n(e,i)})}onDataProgressiveRead(e){this._readyCapability.promise.then(()=>{for(const i of this._progressiveReadListeners)i(e)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const e of this._progressiveDoneListeners)e()})}transportReady(){this._readyCapability.resolve()}requestDataRange(e,i){se("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class kC{constructor(e,i){this._pdfInfo=e,this._transport=i}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 Ft(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:i}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(i)}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 qa,On,os,wo,Qf;class zC{constructor(e,i,n,l=!1){w(this,os);w(this,qa,null);w(this,On,!1);this._pageIndex=e,this._pageInfo=i,this._transport=n,this._stats=l?new sS:null,this._pdfBug=l,this.commonObjs=n.commonObjs,this.objs=new S_,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:i=this.rotate,offsetX:n=0,offsetY:l=0,dontFlip:o=!1}={}){return new gd({viewBox:this.view,scale:e,rotation:i,offsetX:n,offsetY:l,dontFlip:o})}getAnnotations({intent:e="display"}={}){const{renderingIntent:i}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,i)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Ft(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:i,intent:n="display",annotationMode:l=Ca.ENABLE,transform:o=null,background:u=null,optionalContentConfigPromise:d=null,annotationCanvasMap:f=null,pageColors:g=null,printAnnotationStorage:m=null,isEditing:v=!1}){var I,j;(I=this._stats)==null||I.time("Overall");const y=this._transport.getRenderingIntent(n,l,m,v),{renderingIntent:E,cacheKey:x}=y;S(this,On,!1),_(this,os,Qf).call(this),d||(d=this._transport.getOptionalContentConfig(E));let C=this._intentStates.get(x);C||(C=Object.create(null),this._intentStates.set(x,C)),C.streamReaderCancelTimeout&&(clearTimeout(C.streamReaderCancelTimeout),C.streamReaderCancelTimeout=null);const L=!!(E&qi.PRINT);C.displayReadyCapability||(C.displayReadyCapability=Promise.withResolvers(),C.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(j=this._stats)==null||j.time("Page Request"),this._pumpOperatorList(y));const M=q=>{var Q;C.renderTasks.delete(H),(this._maybeCleanupAfterRender||L)&&S(this,On,!0),_(this,os,wo).call(this,!L),q?(H.capability.reject(q),this._abortOperatorList({intentState:C,reason:q instanceof Error?q:new Error(q)})):H.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(Q=globalThis.Stats)!=null&&Q.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},H=new tb({callback:M,params:{canvasContext:e,viewport:i,transform:o,background:u},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:f,operatorList:C.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!L,pdfBug:this._pdfBug,pageColors:g});(C.renderTasks||(C.renderTasks=new Set)).add(H);const F=H.task;return Promise.all([C.displayReadyCapability.promise,d]).then(([q,Q])=>{var J;if(this.destroyed){M();return}if((J=this._stats)==null||J.time("Rendering"),!(Q.renderingIntent&E))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");H.initializeGraphics({transparency:q,optionalContentConfig:Q}),H.operatorListChanged()}).catch(M),F}getOperatorList({intent:e="display",annotationMode:i=Ca.ENABLE,printAnnotationStorage:n=null,isEditing:l=!1}={}){var g;function o(){d.operatorList.lastChunk&&(d.opListReadCapability.resolve(d.operatorList),d.renderTasks.delete(f))}const u=this._transport.getRenderingIntent(e,i,n,l,!0);let d=this._intentStates.get(u.cacheKey);d||(d=Object.create(null),this._intentStates.set(u.cacheKey,d));let f;return d.opListReadCapability||(f=Object.create(null),f.operatorListChanged=o,d.opListReadCapability=Promise.withResolvers(),(d.renderTasks||(d.renderTasks=new Set)).add(f),d.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(g=this._stats)==null||g.time("Page Request"),this._pumpOperatorList(u)),d.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:i=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:i===!0},{highWaterMark:100,size(l){return l.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(n=>$u.textContent(n));const i=this.streamTextContent(e);return new Promise(function(n,l){function o(){u.read().then(function({value:f,done:g}){if(g){n(d);return}d.lang??(d.lang=f.lang),Object.assign(d.styles,f.styles),d.items.push(...f.items),o()},l)}const u=i.getReader(),d={items:[],styles:Object.create(null),lang:null};o()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const i of this._intentStates.values())if(this._abortOperatorList({intentState:i,reason:new Error("Page was destroyed."),force:!0}),!i.opListReadCapability)for(const n of i.renderTasks)e.push(n.completed),n.cancel();return this.objs.clear(),S(this,On,!1),_(this,os,Qf).call(this),Promise.all(e)}cleanup(e=!1){S(this,On,!0);const i=_(this,os,wo).call(this,!1);return e&&i&&this._stats&&(this._stats=new sS),i}_startRenderPage(e,i){var l,o;const n=this._intentStates.get(i);n&&((l=this._stats)==null||l.timeEnd("Page Request"),(o=n.displayReadyCapability)==null||o.resolve(e))}_renderPageChunk(e,i){for(let n=0,l=e.length;n<l;n++)i.operatorList.fnArray.push(e.fnArray[n]),i.operatorList.argsArray.push(e.argsArray[n]);i.operatorList.lastChunk=e.lastChunk,i.operatorList.separateAnnots=e.separateAnnots;for(const n of i.renderTasks)n.operatorListChanged();e.lastChunk&&_(this,os,wo).call(this,!0)}_pumpOperatorList({renderingIntent:e,cacheKey:i,annotationStorageSerializable:n,modifiedIds:l}){const{map:o,transfer:u}=n,f=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:o,modifiedIds:l},u).getReader(),g=this._intentStates.get(i);g.streamReader=f;const m=()=>{f.read().then(({value:v,done:y})=>{if(y){g.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(v,g),m())},v=>{if(g.streamReader=null,!this._transport.destroyed){if(g.operatorList){g.operatorList.lastChunk=!0;for(const y of g.renderTasks)y.operatorListChanged();_(this,os,wo).call(this,!0)}if(g.displayReadyCapability)g.displayReadyCapability.reject(v);else if(g.opListReadCapability)g.opListReadCapability.reject(v);else throw v}})};m()}_abortOperatorList({intentState:e,reason:i,force:n=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!n){if(e.renderTasks.size>0)return;if(i instanceof Ub){let l=wC;i.extraDelay>0&&i.extraDelay<1e3&&(l+=i.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:i,force:!0})},l);return}}if(e.streamReader.cancel(new Or(i.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[l,o]of this._intentStates)if(o===e){this._intentStates.delete(l);break}this.cleanup()}}}get stats(){return this._stats}}qa=new WeakMap,On=new WeakMap,os=new WeakSet,wo=function(e=!1){if(_(this,os,Qf).call(this),!c(this,On)||this.destroyed)return!1;if(e)return S(this,qa,setTimeout(()=>{S(this,qa,null),_(this,os,wo).call(this,!1)},xC)),!1;for(const{renderTasks:i,operatorList:n}of this._intentStates.values())if(i.size>0||!n.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),S(this,On,!1),!0},Qf=function(){c(this,qa)&&(clearTimeout(c(this,qa)),S(this,qa,null))};var Nn,Lg;class HC{constructor(){w(this,Nn,new Map);w(this,Lg,Promise.resolve())}postMessage(e,i){const n={data:structuredClone(e,i?{transfer:i}:null)};c(this,Lg).then(()=>{for(const[l]of c(this,Nn))l.call(this,n)})}addEventListener(e,i,n=null){let l=null;if((n==null?void 0:n.signal)instanceof AbortSignal){const{signal:o}=n;if(o.aborted){Ct("LoopbackPort - cannot use an `aborted` signal.");return}const u=()=>this.removeEventListener(e,i);l=()=>o.removeEventListener("abort",u),o.addEventListener("abort",u)}c(this,Nn).set(i,l)}removeEventListener(e,i){const n=c(this,Nn).get(i);n==null||n(),c(this,Nn).delete(i)}terminate(){for(const[,e]of c(this,Nn))e==null||e();c(this,Nn).clear()}}Nn=new WeakMap,Lg=new WeakMap;var Og,er,ir,tc,Zf,ec,Wf;const ae=class ae{constructor({name:e=null,port:i=null,verbosity:n=gx()}={}){w(this,tc);var l;if(this.name=e,this.destroyed=!1,this.verbosity=n,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,i){if((l=c(ae,ir))!=null&&l.has(i))throw new Error("Cannot use more than one PDFWorker per port.");(c(ae,ir)||S(ae,ir,new WeakMap)).set(i,this),this._initializeFromPort(i);return}this._initialize()}get promise(){return ni?Promise.all([il.promise,this._readyCapability.promise]):this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new Bu("main","worker",e),this._messageHandler.on("ready",function(){}),_(this,tc,Zf).call(this)}_initialize(){if(c(ae,er)||c(ae,ec,Wf)){this._setupFakeWorker();return}let{workerSrc:e}=ae;try{ae._isSameOrigin(window.location.href,e)||(e=ae._createCDNWrapper(new URL(e,window.location).href));const i=new Worker(e,{type:"module"}),n=new Bu("main","worker",i),l=()=>{o.abort(),n.destroy(),i.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},o=new AbortController;i.addEventListener("error",()=>{this._webWorker||l()},{signal:o.signal}),n.on("test",d=>{if(o.abort(),this.destroyed||!d){l();return}this._messageHandler=n,this._port=i,this._webWorker=i,_(this,tc,Zf).call(this)}),n.on("ready",d=>{if(o.abort(),this.destroyed){l();return}try{u()}catch{this._setupFakeWorker()}});const u=()=>{const d=new Uint8Array;n.send("test",d,[d.buffer])};u();return}catch{Bg("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){c(ae,er)||(Ct("Setting up fake worker."),S(ae,er,!0)),ae._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const i=new HC;this._port=i;const n=`fake${li(ae,Og)._++}`,l=new Bu(n+"_worker",n,i);e.setup(l,i),this._messageHandler=new Bu(n,n+"_worker",i),_(this,tc,Zf).call(this)}).catch(e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){var e;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),(e=c(ae,ir))==null||e.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(e){var n;if(!(e!=null&&e.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const i=(n=c(this,ir))==null?void 0:n.get(e.port);if(i){if(i._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return i}return new ae(e)}static get workerSrc(){if(Qn.workerSrc)return Qn.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Ft(this,"_setupFakeWorkerGlobal",(async()=>c(this,ec,Wf)?c(this,ec,Wf):(await import(this.workerSrc)).WorkerMessageHandler)())}};Og=new WeakMap,er=new WeakMap,ir=new WeakMap,tc=new WeakSet,Zf=function(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})},ec=new WeakSet,Wf=function(){var e;try{return((e=globalThis.pdfjsWorker)==null?void 0:e.WorkerMessageHandler)||null}catch{return null}},w(ae,ec),w(ae,Og,0),w(ae,er,!1),w(ae,ir),ni&&(S(ae,er,!0),Qn.workerSrc||(Qn.workerSrc="./pdf.worker.mjs")),ae._isSameOrigin=(e,i)=>{let n;try{if(n=new URL(e),!n.origin||n.origin==="null")return!1}catch{return!1}const l=new URL(i,n);return n.origin===l.origin},ae._createCDNWrapper=e=>{const i=`await import("${e}");`;return URL.createObjectURL(new Blob([i],{type:"text/javascript"}))};let Do=ae;var kn,Qs,ic,sc,Zs,sr,Pu;class FC{constructor(e,i,n,l,o){w(this,sr);w(this,kn,new Map);w(this,Qs,new Map);w(this,ic,new Map);w(this,sc,new Map);w(this,Zs,null);this.messageHandler=e,this.loadingTask=i,this.commonObjs=new S_,this.fontLoader=new kx({ownerDocument:l.ownerDocument,styleElement:l.styleElement}),this.loadingParams=l.loadingParams,this._params=l,this.canvasFactory=o.canvasFactory,this.filterFactory=o.filterFactory,this.cMapReaderFactory=o.cMapReaderFactory,this.standardFontDataFactory=o.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return Ft(this,"annotationStorage",new jb)}getRenderingIntent(e,i=Ca.ENABLE,n=null,l=!1,o=!1){let u=qi.DISPLAY,d=I0;switch(e){case"any":u=qi.ANY;break;case"display":break;case"print":u=qi.PRINT;break;default:Ct(`getRenderingIntent - invalid intent: ${e}`)}const f=u&qi.PRINT&&n instanceof $S?n:this.annotationStorage;switch(i){case Ca.DISABLE:u+=qi.ANNOTATIONS_DISABLE;break;case Ca.ENABLE:break;case Ca.ENABLE_FORMS:u+=qi.ANNOTATIONS_FORMS;break;case Ca.ENABLE_STORAGE:u+=qi.ANNOTATIONS_STORAGE,d=f.serializable;break;default:Ct(`getRenderingIntent - invalid annotationMode: ${i}`)}l&&(u+=qi.IS_EDITING),o&&(u+=qi.OPLIST);const{ids:g,hash:m}=f.modifiedIds,v=[u,d.hash,m];return{renderingIntent:u,cacheKey:v.join("_"),annotationStorageSerializable:d,modifiedIds:g}}destroy(){var n;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(n=c(this,Zs))==null||n.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const l of c(this,Qs).values())e.push(l._destroy());c(this,Qs).clear(),c(this,ic).clear(),c(this,sc).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const i=this.messageHandler.sendWithPromise("Terminate",null);return e.push(i),Promise.all(e).then(()=>{var l;this.commonObjs.clear(),this.fontLoader.clear(),c(this,kn).clear(),this.filterFactory.destroy(),Wu.cleanup(),(l=this._networkStream)==null||l.cancelAllRequests(new Or("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:i}=this;e.on("GetReader",(n,l)=>{De(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=o=>{this._lastProgress={loaded:o.loaded,total:o.total}},l.onPull=()=>{this._fullReader.read().then(function({value:o,done:u}){if(u){l.close();return}De(o instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),l.enqueue(new Uint8Array(o),1,[o])}).catch(o=>{l.error(o)})},l.onCancel=o=>{this._fullReader.cancel(o),l.ready.catch(u=>{if(!this.destroyed)throw u})}}),e.on("ReaderHeadersReady",async n=>{var d;await this._fullReader.headersReady;const{isStreamingSupported:l,isRangeSupported:o,contentLength:u}=this._fullReader;return(!l||!o)&&(this._lastProgress&&((d=i.onProgress)==null||d.call(i,this._lastProgress)),this._fullReader.onProgress=f=>{var g;(g=i.onProgress)==null||g.call(i,{loaded:f.loaded,total:f.total})}),{isStreamingSupported:l,isRangeSupported:o,contentLength:u}}),e.on("GetRangeReader",(n,l)=>{De(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const o=this._networkStream.getRangeReader(n.begin,n.end);if(!o){l.close();return}l.onPull=()=>{o.read().then(function({value:u,done:d}){if(d){l.close();return}De(u instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),l.enqueue(new Uint8Array(u),1,[u])}).catch(u=>{l.error(u)})},l.onCancel=u=>{o.cancel(u),l.ready.catch(d=>{if(!this.destroyed)throw d})}}),e.on("GetDoc",({pdfInfo:n})=>{this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,i._capability.resolve(new kC(n,this))}),e.on("DocException",function(n){let l;switch(n.name){case"PasswordException":l=new y0(n.message,n.code);break;case"InvalidPDFException":l=new TS(n.message);break;case"MissingPDFException":l=new Lr(n.message);break;case"UnexpectedResponseException":l=new Pg(n.message,n.status);break;case"UnknownErrorException":l=new A0(n.message,n.details);break;default:se("DocException - expected a valid Error.")}i._capability.reject(l)}),e.on("PasswordRequest",n=>{if(S(this,Zs,Promise.withResolvers()),i.onPassword){const l=o=>{o instanceof Error?c(this,Zs).reject(o):c(this,Zs).resolve({password:o})};try{i.onPassword(l,n.code)}catch(o){c(this,Zs).reject(o)}}else c(this,Zs).reject(new y0(n.message,n.code));return c(this,Zs).promise}),e.on("DataLoaded",n=>{var l;(l=i.onProgress)==null||l.call(i,{loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),e.on("StartRenderPage",n=>{if(this.destroyed)return;c(this,Qs).get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),e.on("commonobj",([n,l,o])=>{var u;if(this.destroyed||this.commonObjs.has(n))return null;switch(l){case"Font":const{disableFontFace:d,fontExtraProperties:f,pdfBug:g}=this._params;if("error"in o){const E=o.error;Ct(`Error during font loading: ${E}`),this.commonObjs.resolve(n,E);break}const m=g&&((u=globalThis.FontInspector)!=null&&u.enabled)?(E,x)=>globalThis.FontInspector.fontAdded(E,x):null,v=new zx(o,{disableFontFace:d,inspectFont:m});this.fontLoader.bind(v).catch(()=>e.sendWithPromise("FontFallback",{id:n})).finally(()=>{!f&&v.data&&(v.data=null),this.commonObjs.resolve(n,v)});break;case"CopyLocalImage":const{imageRef:y}=o;De(y,"The imageRef must be defined.");for(const E of c(this,Qs).values())for(const[,x]of E.objs)if((x==null?void 0:x.ref)===y)return x.dataLen?(this.commonObjs.resolve(n,structuredClone(x)),x.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,o);break;default:throw new Error(`Got unknown common object type ${l}`)}return null}),e.on("obj",([n,l,o,u])=>{var f;if(this.destroyed)return;const d=c(this,Qs).get(l);if(!d.objs.has(n)){if(d._intentStates.size===0){(f=u==null?void 0:u.bitmap)==null||f.close();return}switch(o){case"Image":d.objs.resolve(n,u),(u==null?void 0:u.dataLen)>cx&&(d._maybeCleanupAfterRender=!0);break;case"Pattern":d.objs.resolve(n,u);break;default:throw new Error(`Got unknown object type ${o}`)}}}),e.on("DocProgress",n=>{var l;this.destroyed||(l=i.onProgress)==null||l.call(i,{loaded:n.loaded,total:n.total})}),e.on("FetchBuiltInCMap",async n=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(n)}),e.on("FetchStandardFontData",async n=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(n)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var n;this.annotationStorage.size<=0&&Ct("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:i}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:((n=this._fullReader)==null?void 0:n.filename)??null},i).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const i=e-1,n=c(this,ic).get(i);if(n)return n;const l=this.messageHandler.sendWithPromise("GetPage",{pageIndex:i}).then(o=>{if(this.destroyed)throw new Error("Transport destroyed");o.refStr&&c(this,sc).set(o.refStr,e);const u=new zC(i,o,this,this._params.pdfBug);return c(this,Qs).set(i,u),u});return c(this,ic).set(i,l),l}getPageIndex(e){return bS(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,i){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:i})}getFieldObjects(){return _(this,sr,Pu).call(this,"GetFieldObjects")}hasJSActions(){return _(this,sr,Pu).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 _(this,sr,Pu).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 _(this,sr,Pu).call(this,"GetOptionalContentConfig").then(i=>new sC(i,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",i=c(this,kn).get(e);if(i)return i;const n=this.messageHandler.sendWithPromise(e,null).then(l=>{var o,u;return{info:l[0],metadata:l[1]?new eC(l[1]):null,contentDispositionFilename:((o=this._fullReader)==null?void 0:o.filename)??null,contentLength:((u=this._fullReader)==null?void 0:u.contentLength)??null}});return c(this,kn).set(e,n),n}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const i of c(this,Qs).values())if(!i.cleanup())throw new Error(`startCleanup: Page ${i.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),c(this,kn).clear(),this.filterFactory.destroy(!0),Wu.cleanup()}}cachedPageNumber(e){if(!bS(e))return null;const i=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return c(this,sc).get(i)??null}}kn=new WeakMap,Qs=new WeakMap,ic=new WeakMap,sc=new WeakMap,Zs=new WeakMap,sr=new WeakSet,Pu=function(e,i=null){const n=c(this,kn).get(e);if(n)return n;const l=this.messageHandler.sendWithPromise(e,i);return c(this,kn).set(e,l),l};const Ff=Symbol("INITIAL_DATA");var _s,zh,J0;class S_{constructor(){w(this,zh);w(this,_s,Object.create(null))}get(e,i=null){if(i){const l=_(this,zh,J0).call(this,e);return l.promise.then(()=>i(l.data)),null}const n=c(this,_s)[e];if(!n||n.data===Ff)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){const i=c(this,_s)[e];return!!i&&i.data!==Ff}resolve(e,i=null){const n=_(this,zh,J0).call(this,e);n.data=i,n.resolve()}clear(){var e;for(const i in c(this,_s)){const{data:n}=c(this,_s)[i];(e=n==null?void 0:n.bitmap)==null||e.close()}S(this,_s,Object.create(null))}*[Symbol.iterator](){for(const e in c(this,_s)){const{data:i}=c(this,_s)[e];i!==Ff&&(yield[e,i])}}}_s=new WeakMap,zh=new WeakSet,J0=function(e){var i;return(i=c(this,_s))[e]||(i[e]={...Promise.withResolvers(),data:Ff})};var Ga;class UC{constructor(e){w(this,Ga,null);S(this,Ga,e),this.onContinue=null}get promise(){return c(this,Ga).capability.promise}cancel(e=0){c(this,Ga).cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=c(this,Ga).operatorList;if(!e)return!1;const{annotationCanvasMap:i}=c(this,Ga);return e.form||e.canvas&&(i==null?void 0:i.size)>0}}Ga=new WeakMap;var Xa,nr;const Rl=class Rl{constructor({callback:e,params:i,objs:n,commonObjs:l,annotationCanvasMap:o,operatorList:u,pageIndex:d,canvasFactory:f,filterFactory:g,useRequestAnimationFrame:m=!1,pdfBug:v=!1,pageColors:y=null}){w(this,Xa,null);this.callback=e,this.params=i,this.objs=n,this.commonObjs=l,this.annotationCanvasMap=o,this.operatorListIdx=null,this.operatorList=u,this._pageIndex=d,this.canvasFactory=f,this.filterFactory=g,this._pdfBug=v,this.pageColors=y,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=m===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new UC(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=i.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:i}){var d,f;if(this.cancelled)return;if(this._canvas){if(c(Rl,nr).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.");c(Rl,nr).add(this._canvas)}this._pdfBug&&((d=globalThis.StepperManager)!=null&&d.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:n,viewport:l,transform:o,background:u}=this.params;this.gfx=new Ro(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:i},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:o,viewport:l,transparency:e,background:u}),this.operatorListIdx=0,this.graphicsReady=!0,(f=this.graphicsReadyCallback)==null||f.call(this)}cancel(e=null,i=0){var n;this.running=!1,this.cancelled=!0,(n=this.gfx)==null||n.endDrawing(),c(this,Xa)&&(window.cancelAnimationFrame(c(this,Xa)),S(this,Xa,null)),c(Rl,nr).delete(this._canvas),this.callback(e||new Ub(`Rendering cancelled, page ${this._pageIndex+1}`,i))}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?S(this,Xa,window.requestAnimationFrame(()=>{S(this,Xa,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(),c(Rl,nr).delete(this._canvas),this.callback())))}};Xa=new WeakMap,nr=new WeakMap,w(Rl,nr,new WeakSet);let tb=Rl;const BC="4.8.69",PC="3634dab10";function vS(b){return Math.floor(Math.max(0,Math.min(1,b))*255).toString(16).padStart(2,"0")}function Lu(b){return Math.max(0,Math.min(255,255*b))}class yS{static CMYK_G([e,i,n,l]){return["G",1-Math.min(1,.3*e+.59*n+.11*i+l)]}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=Lu(e),[e,e,e]}static G_HTML([e]){const i=vS(e);return`#${i}${i}${i}`}static RGB_G([e,i,n]){return["G",.3*e+.59*i+.11*n]}static RGB_rgb(e){return e.map(Lu)}static RGB_HTML(e){return`#${e.map(vS).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,i,n,l]){return["RGB",1-Math.min(1,e+l),1-Math.min(1,n+l),1-Math.min(1,i+l)]}static CMYK_rgb([e,i,n,l]){return[Lu(1-Math.min(1,e+l)),Lu(1-Math.min(1,n+l)),Lu(1-Math.min(1,i+l))]}static CMYK_HTML(e){const i=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(i)}static RGB_CMYK([e,i,n]){const l=1-e,o=1-i,u=1-n,d=Math.min(l,o,u);return["CMYK",l,o,u,d]}}class IC{create(e,i,n=!1){if(e<=0||i<=0)throw new Error("Invalid SVG dimensions");const l=this._createSVG("svg:svg");return l.setAttribute("version","1.1"),n||(l.setAttribute("width",`${e}px`),l.setAttribute("height",`${i}px`)),l.setAttribute("preserveAspectRatio","none"),l.setAttribute("viewBox",`0 0 ${e} ${i}`),l}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){se("Abstract method `_createSVG` called.")}}class Vb extends IC{_createSVG(e){return document.createElementNS(_n,e)}}class __{static setupStorage(e,i,n,l,o){const u=l.getValue(i,{value:null});switch(n.name){case"textarea":if(u.value!==null&&(e.textContent=u.value),o==="print")break;e.addEventListener("input",d=>{l.setValue(i,{value:d.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(u.value===n.attributes.xfaOn?e.setAttribute("checked",!0):u.value===n.attributes.xfaOff&&e.removeAttribute("checked"),o==="print")break;e.addEventListener("change",d=>{l.setValue(i,{value:d.target.checked?d.target.getAttribute("xfaOn"):d.target.getAttribute("xfaOff")})})}else{if(u.value!==null&&e.setAttribute("value",u.value),o==="print")break;e.addEventListener("input",d=>{l.setValue(i,{value:d.target.value})})}break;case"select":if(u.value!==null){e.setAttribute("value",u.value);for(const d of n.children)d.attributes.value===u.value?d.attributes.selected=!0:d.attributes.hasOwnProperty("selected")&&delete d.attributes.selected}e.addEventListener("input",d=>{const f=d.target.options,g=f.selectedIndex===-1?"":f[f.selectedIndex].value;l.setValue(i,{value:g})});break}}static setAttributes({html:e,element:i,storage:n=null,intent:l,linkService:o}){const{attributes:u}=i,d=e instanceof HTMLAnchorElement;u.type==="radio"&&(u.name=`${u.name}-${l}`);for(const[f,g]of Object.entries(u))if(g!=null)switch(f){case"class":g.length&&e.setAttribute(f,g.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",g);break;case"style":Object.assign(e.style,g);break;case"textContent":e.textContent=g;break;default:(!d||f!=="href"&&f!=="newWindow")&&e.setAttribute(f,g)}d&&o.addLinkAttributes(e,u.href,u.newWindow),n&&u.dataId&&this.setupStorage(e,u.dataId,i,n)}static render(e){var v,y;const i=e.annotationStorage,n=e.linkService,l=e.xfaHtml,o=e.intent||"display",u=document.createElement(l.name);l.attributes&&this.setAttributes({html:u,element:l,intent:o,linkService:n});const d=o!=="richText",f=e.div;if(f.append(u),e.viewport){const E=`matrix(${e.viewport.transform.join(",")})`;f.style.transform=E}d&&f.setAttribute("class","xfaLayer xfaFont");const g=[];if(l.children.length===0){if(l.value){const E=document.createTextNode(l.value);u.append(E),d&&$u.shouldBuildText(l.name)&&g.push(E)}return{textDivs:g}}const m=[[l,-1,u]];for(;m.length>0;){const[E,x,C]=m.at(-1);if(x+1===E.children.length){m.pop();continue}const L=E.children[++m.at(-1)[1]];if(L===null)continue;const{name:M}=L;if(M==="#text"){const F=document.createTextNode(L.value);g.push(F),C.append(F);continue}const H=(v=L==null?void 0:L.attributes)!=null&&v.xmlns?document.createElementNS(L.attributes.xmlns,M):document.createElement(M);if(C.append(H),L.attributes&&this.setAttributes({html:H,element:L,storage:i,intent:o,linkService:n}),((y=L.children)==null?void 0:y.length)>0)m.push([L,-1,H]);else if(L.value){const F=document.createTextNode(L.value);d&&$u.shouldBuildText(M)&&g.push(F),H.append(F)}}for(const E of f.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))E.setAttribute("readOnly",!0);return{textDivs:g}}static update(e){const i=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=i,e.div.hidden=!1}}const md=1e3,jC=9,Mr=new WeakSet;function Zn(b){return{width:b[2]-b[0],height:b[3]-b[1]}}class qC{static create(e){switch(e.data.annotationType){case we.LINK:return new E_(e);case we.TEXT:return new GC(e);case we.WIDGET:switch(e.data.fieldType){case"Tx":return new XC(e);case"Btn":return e.data.radioButton?new x_(e):e.data.checkBox?new VC(e):new KC(e);case"Ch":return new QC(e);case"Sig":return new YC(e)}return new Nr(e);case we.POPUP:return new ib(e);case we.FREETEXT:return new L_(e);case we.LINE:return new WC(e);case we.SQUARE:return new $C(e);case we.CIRCLE:return new JC(e);case we.POLYLINE:return new O_(e);case we.CARET:return new eM(e);case we.INK:return new Kb(e);case we.POLYGON:return new tM(e);case we.HIGHLIGHT:return new N_(e);case we.UNDERLINE:return new iM(e);case we.SQUIGGLY:return new sM(e);case we.STRIKEOUT:return new nM(e);case we.STAMP:return new k_(e);case we.FILEATTACHMENT:return new aM(e);default:return new be(e)}}}var ar,nc,ac,Hh,eb;const Wb=class Wb{constructor(e,{isRenderable:i=!1,ignoreBorder:n=!1,createQuadrilaterals:l=!1}={}){w(this,Hh);w(this,ar,null);w(this,nc,!1);w(this,ac,null);this.isRenderable=i,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,i&&(this.container=this._createContainer(n)),l&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:i,richText:n}){return!!(e!=null&&e.str||i!=null&&i.str||n!=null&&n.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Wb._hasPopupData(this.data)}updateEdited(e){var n;if(!this.container)return;c(this,ar)||S(this,ar,{rect:this.data.rect.slice(0)});const{rect:i}=e;i&&_(this,Hh,eb).call(this,i),(n=c(this,ac))==null||n.popup.updateEdited(e)}resetEdited(){var e;c(this,ar)&&(_(this,Hh,eb).call(this,c(this,ar).rect),(e=c(this,ac))==null||e.popup.resetEdited(),S(this,ar,null))}_createContainer(e){const{data:i,parent:{page:n,viewport:l}}=this,o=document.createElement("section");o.setAttribute("data-annotation-id",i.id),this instanceof Nr||(o.tabIndex=md);const{style:u}=o;if(u.zIndex=this.parent.zIndex++,i.alternativeText&&(o.title=i.alternativeText),i.noRotate&&o.classList.add("norotate"),!i.rect||this instanceof ib){const{rotation:C}=i;return!i.hasOwnCanvas&&C!==0&&this.setRotation(C,o),o}const{width:d,height:f}=Zn(i.rect);if(!e&&i.borderStyle.width>0){u.borderWidth=`${i.borderStyle.width}px`;const C=i.borderStyle.horizontalCornerRadius,L=i.borderStyle.verticalCornerRadius;if(C>0||L>0){const H=`calc(${C}px * var(--scale-factor)) / calc(${L}px * var(--scale-factor))`;u.borderRadius=H}else if(this instanceof x_){const H=`calc(${d}px * var(--scale-factor)) / calc(${f}px * var(--scale-factor))`;u.borderRadius=H}switch(i.borderStyle.style){case Ru.SOLID:u.borderStyle="solid";break;case Ru.DASHED:u.borderStyle="dashed";break;case Ru.BEVELED:Ct("Unimplemented border style: beveled");break;case Ru.INSET:Ct("Unimplemented border style: inset");break;case Ru.UNDERLINE:u.borderBottomStyle="solid";break}const M=i.borderColor||null;M?(S(this,nc,!0),u.borderColor=ct.makeHexColor(M[0]|0,M[1]|0,M[2]|0)):u.borderWidth=0}const g=ct.normalizeRect([i.rect[0],n.view[3]-i.rect[1]+n.view[1],i.rect[2],n.view[3]-i.rect[3]+n.view[1]]),{pageWidth:m,pageHeight:v,pageX:y,pageY:E}=l.rawDims;u.left=`${100*(g[0]-y)/m}%`,u.top=`${100*(g[1]-E)/v}%`;const{rotation:x}=i;return i.hasOwnCanvas||x===0?(u.width=`${100*d/m}%`,u.height=`${100*f/v}%`):this.setRotation(x,o),o}setRotation(e,i=this.container){if(!this.data.rect)return;const{pageWidth:n,pageHeight:l}=this.parent.viewport.rawDims,{width:o,height:u}=Zn(this.data.rect);let d,f;e%180===0?(d=100*o/n,f=100*u/l):(d=100*u/n,f=100*o/l),i.style.width=`${d}%`,i.style.height=`${f}%`,i.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(i,n,l)=>{const o=l.detail[i],u=o[0],d=o.slice(1);l.target.style[n]=yS[`${u}_HTML`](d),this.annotationStorage.setValue(this.data.id,{[n]:yS[`${u}_rgb`](d)})};return Ft(this,"_commonActions",{display:i=>{const{display:n}=i.detail,l=n%2===1;this.container.style.visibility=l?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:l,noPrint:n===1||n===2})},print:i=>{this.annotationStorage.setValue(this.data.id,{noPrint:!i.detail.print})},hidden:i=>{const{hidden:n}=i.detail;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:n,noView:n})},focus:i=>{setTimeout(()=>i.target.focus({preventScroll:!1}),0)},userName:i=>{i.target.title=i.detail.userName},readonly:i=>{i.target.disabled=i.detail.readonly},required:i=>{this._setRequired(i.target,i.detail.required)},bgColor:i=>{e("bgColor","backgroundColor",i)},fillColor:i=>{e("fillColor","backgroundColor",i)},fgColor:i=>{e("fgColor","color",i)},textColor:i=>{e("textColor","color",i)},borderColor:i=>{e("borderColor","borderColor",i)},strokeColor:i=>{e("strokeColor","borderColor",i)},rotation:i=>{const n=i.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(e,i){const n=this._commonActions;for(const l of Object.keys(i.detail)){const o=e[l]||n[l];o==null||o(i)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const i=this.annotationStorage.getRawValue(this.data.id);if(!i)return;const n=this._commonActions;for(const[l,o]of Object.entries(i)){const u=n[l];if(u){const d={detail:{[l]:o},target:e};u(d),delete i[l]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[i,n,l,o]=this.data.rect.map(C=>Math.fround(C));if(e.length===8){const[C,L,M,H]=e.subarray(2,6);if(l===C&&o===L&&i===M&&n===H)return}const{style:u}=this.container;let d;if(c(this,nc)){const{borderColor:C,borderWidth:L}=u;u.borderWidth=0,d=["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="${C}" stroke-width="${L}">`],this.container.classList.add("hasBorder")}const f=l-i,g=o-n,{svgFactory:m}=this,v=m.createElement("svg");v.classList.add("quadrilateralsContainer"),v.setAttribute("width",0),v.setAttribute("height",0);const y=m.createElement("defs");v.append(y);const E=m.createElement("clipPath"),x=`clippath_${this.data.id}`;E.setAttribute("id",x),E.setAttribute("clipPathUnits","objectBoundingBox"),y.append(E);for(let C=2,L=e.length;C<L;C+=8){const M=e[C],H=e[C+1],F=e[C+2],I=e[C+3],j=m.createElement("rect"),q=(F-i)/f,Q=(o-H)/g,J=(M-F)/f,at=(H-I)/g;j.setAttribute("x",q),j.setAttribute("y",Q),j.setAttribute("width",J),j.setAttribute("height",at),E.append(j),d==null||d.push(`<rect vector-effect="non-scaling-stroke" x="${q}" y="${Q}" width="${J}" height="${at}"/>`)}c(this,nc)&&(d.push("</g></svg>')"),u.backgroundImage=d.join("")),this.container.append(v),this.container.style.clipPath=`url(#${x})`}_createPopup(){const{data:e}=this,i=S(this,ac,new ib({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},parent:this.parent,elements:[this]}));this.parent.div.append(i.render())}render(){se("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,i=null){const n=[];if(this._fieldObjects){const l=this._fieldObjects[e];if(l)for(const{page:o,id:u,exportValues:d}of l){if(o===-1||u===i)continue;const f=typeof d=="string"?d:null,g=document.querySelector(`[data-element-id="${u}"]`);if(g&&!Mr.has(g)){Ct(`_getElementsByName - element not allowed: ${u}`);continue}n.push({id:u,exportValue:f,domElement:g})}return n}for(const l of document.getElementsByName(e)){const{exportValue:o}=l,u=l.getAttribute("data-element-id");u!==i&&Mr.has(l)&&n.push({id:u,exportValue:o,domElement:l})}return n}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 i of e)i.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:i}}=this;this.container.addEventListener("dblclick",()=>{var n;(n=this.linkService.eventBus)==null||n.dispatch("switchannotationeditormode",{source:this,mode:e,editId:i})})}};ar=new WeakMap,nc=new WeakMap,ac=new WeakMap,Hh=new WeakSet,eb=function(e){const{container:{style:i},data:{rect:n,rotation:l},parent:{viewport:{rawDims:{pageWidth:o,pageHeight:u,pageX:d,pageY:f}}}}=this;n==null||n.splice(0,4,...e);const{width:g,height:m}=Zn(e);i.left=`${100*(e[0]-d)/o}%`,i.top=`${100*(u-e[3]+f)/u}%`,l===0?(i.width=`${100*g/o}%`,i.height=`${100*m/u}%`):this.setRotation(l)};let be=Wb;var Gi,Tl,T_,w_;class E_ extends be{constructor(i,n=null){super(i,{isRenderable:!0,ignoreBorder:!!(n!=null&&n.ignoreBorder),createQuadrilaterals:!0});w(this,Gi);this.isTooltipOnly=i.data.isTooltipOnly}render(){const{data:i,linkService:n}=this,l=document.createElement("a");l.setAttribute("data-element-id",i.id);let o=!1;return i.url?(n.addLinkAttributes(l,i.url,i.newWindow),o=!0):i.action?(this._bindNamedAction(l,i.action),o=!0):i.attachment?(_(this,Gi,T_).call(this,l,i.attachment,i.attachmentDest),o=!0):i.setOCGState?(_(this,Gi,w_).call(this,l,i.setOCGState),o=!0):i.dest?(this._bindLink(l,i.dest),o=!0):(i.actions&&(i.actions.Action||i.actions["Mouse Up"]||i.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(l,i),o=!0),i.resetForm?(this._bindResetFormAction(l,i.resetForm),o=!0):this.isTooltipOnly&&!o&&(this._bindLink(l,""),o=!0)),this.container.classList.add("linkAnnotation"),o&&this.container.append(l),this.container}_bindLink(i,n){i.href=this.linkService.getDestinationHash(n),i.onclick=()=>(n&&this.linkService.goToDestination(n),!1),(n||n==="")&&_(this,Gi,Tl).call(this)}_bindNamedAction(i,n){i.href=this.linkService.getAnchorUrl(""),i.onclick=()=>(this.linkService.executeNamedAction(n),!1),_(this,Gi,Tl).call(this)}_bindJSAction(i,n){i.href=this.linkService.getAnchorUrl("");const l=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const o of Object.keys(n.actions)){const u=l.get(o);u&&(i[u]=()=>{var d;return(d=this.linkService.eventBus)==null||d.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n.id,name:o}}),!1})}i.onclick||(i.onclick=()=>!1),_(this,Gi,Tl).call(this)}_bindResetFormAction(i,n){const l=i.onclick;if(l||(i.href=this.linkService.getAnchorUrl("")),_(this,Gi,Tl).call(this),!this._fieldObjects){Ct('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),l||(i.onclick=()=>!1);return}i.onclick=()=>{var v;l==null||l();const{fields:o,refs:u,include:d}=n,f=[];if(o.length!==0||u.length!==0){const y=new Set(u);for(const E of o){const x=this._fieldObjects[E]||[];for(const{id:C}of x)y.add(C)}for(const E of Object.values(this._fieldObjects))for(const x of E)y.has(x.id)===d&&f.push(x)}else for(const y of Object.values(this._fieldObjects))f.push(...y);const g=this.annotationStorage,m=[];for(const y of f){const{id:E}=y;switch(m.push(E),y.type){case"text":{const C=y.defaultValue||"";g.setValue(E,{value:C});break}case"checkbox":case"radiobutton":{const C=y.defaultValue===y.exportValues;g.setValue(E,{value:C});break}case"combobox":case"listbox":{const C=y.defaultValue||"";g.setValue(E,{value:C});break}default:continue}const x=document.querySelector(`[data-element-id="${E}"]`);if(x){if(!Mr.has(x)){Ct(`_bindResetFormAction - element not allowed: ${E}`);continue}}else continue;x.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((v=this.linkService.eventBus)==null||v.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:m,name:"ResetForm"}})),!1}}}Gi=new WeakSet,Tl=function(){this.container.setAttribute("data-internal-link","")},T_=function(i,n,l=null){i.href=this.linkService.getAnchorUrl(""),n.description&&(i.title=n.description),i.onclick=()=>{var o;return(o=this.downloadManager)==null||o.openOrDownloadData(n.content,n.filename,l),!1},_(this,Gi,Tl).call(this)},w_=function(i,n){i.href=this.linkService.getAnchorUrl(""),i.onclick=()=>(this.linkService.executeSetOCGState(n),!1),_(this,Gi,Tl).call(this)};class GC extends be{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 Nr extends be{render(){return this.container}showElementAndHideCanvas(e){var i;this.data.hasOwnCanvas&&(((i=e.previousSibling)==null?void 0:i.nodeName)==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return ui.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,i,n,l,o){n.includes("mouse")?e.addEventListener(n,u=>{var d;(d=this.linkService.eventBus)==null||d.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:l,value:o(u),shift:u.shiftKey,modifier:this._getKeyModifier(u)}})}):e.addEventListener(n,u=>{var d;if(n==="blur"){if(!i.focused||!u.relatedTarget)return;i.focused=!1}else if(n==="focus"){if(i.focused)return;i.focused=!0}o&&((d=this.linkService.eventBus)==null||d.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:l,value:o(u)}}))})}_setEventListeners(e,i,n,l){var o,u,d;for(const[f,g]of n)(g==="Action"||(o=this.data.actions)!=null&&o[g])&&((g==="Focus"||g==="Blur")&&(i||(i={focused:!1})),this._setEventListener(e,i,f,g,l),g==="Focus"&&!((u=this.data.actions)!=null&&u.Blur)?this._setEventListener(e,i,"blur","Blur",null):g==="Blur"&&!((d=this.data.actions)!=null&&d.Focus)&&this._setEventListener(e,i,"focus","Focus",null))}_setBackgroundColor(e){const i=this.data.backgroundColor||null;e.style.backgroundColor=i===null?"transparent":ct.makeHexColor(i[0],i[1],i[2])}_setTextStyle(e){const i=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,l=this.data.defaultAppearanceData.fontSize||jC,o=e.style;let u;const d=2,f=g=>Math.round(10*g)/10;if(this.data.multiLine){const g=Math.abs(this.data.rect[3]-this.data.rect[1]-d),m=Math.round(g/(d0*l))||1,v=g/m;u=Math.min(l,f(v/d0))}else{const g=Math.abs(this.data.rect[3]-this.data.rect[1]-d);u=Math.min(l,f(g/d0))}o.fontSize=`calc(${u}px * var(--scale-factor))`,o.color=ct.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(o.textAlign=i[this.data.textAlignment])}_setRequired(e,i){i?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",i)}}class XC extends Nr{constructor(e){const i=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:i})}setPropertyOnSiblings(e,i,n,l){const o=this.annotationStorage;for(const u of this._getElementsByName(e.name,e.id))u.domElement&&(u.domElement[i]=n),o.setValue(u.id,{[l]:n})}render(){var l,o;const e=this.annotationStorage,i=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const u=e.getValue(i,{value:this.data.fieldValue});let d=u.value||"";const f=e.getValue(i,{charLimit:this.data.maxLen}).charLimit;f&&d.length>f&&(d=d.slice(0,f));let g=u.formattedValue||((l=this.data.textContent)==null?void 0:l.join(`
`))||null;g&&this.data.comb&&(g=g.replaceAll(/\s+/g,""));const m={userValue:d,formattedValue:g,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=g??d,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type="text",n.setAttribute("value",g??d),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),Mr.add(n),n.setAttribute("data-element-id",i),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=md,this._setRequired(n,this.data.required),f&&(n.maxLength=f),n.addEventListener("input",y=>{e.setValue(i,{value:y.target.value}),this.setPropertyOnSiblings(n,"value",y.target.value,"value"),m.formattedValue=null}),n.addEventListener("resetform",y=>{const E=this.data.defaultFieldValue??"";n.value=m.userValue=E,m.formattedValue=null});let v=y=>{const{formattedValue:E}=m;E!=null&&(y.target.value=E),y.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",E=>{var C;if(m.focused)return;const{target:x}=E;m.userValue&&(x.value=m.userValue),m.lastCommittedValue=x.value,m.commitKey=1,(C=this.data.actions)!=null&&C.Focus||(m.focused=!0)}),n.addEventListener("updatefromsandbox",E=>{this.showElementAndHideCanvas(E.target);const x={value(C){m.userValue=C.detail.value??"",e.setValue(i,{value:m.userValue.toString()}),C.target.value=m.userValue},formattedValue(C){const{formattedValue:L}=C.detail;m.formattedValue=L,L!=null&&C.target!==document.activeElement&&(C.target.value=L),e.setValue(i,{formattedValue:L})},selRange(C){C.target.setSelectionRange(...C.detail.selRange)},charLimit:C=>{var F;const{charLimit:L}=C.detail,{target:M}=C;if(L===0){M.removeAttribute("maxLength");return}M.setAttribute("maxLength",L);let H=m.userValue;!H||H.length<=L||(H=H.slice(0,L),M.value=m.userValue=H,e.setValue(i,{value:H}),(F=this.linkService.eventBus)==null||F.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:"Keystroke",value:H,willCommit:!0,commitKey:1,selStart:M.selectionStart,selEnd:M.selectionEnd}}))}};this._dispatchEventFromSandbox(x,E)}),n.addEventListener("keydown",E=>{var L;m.commitKey=1;let x=-1;if(E.key==="Escape"?x=0:E.key==="Enter"&&!this.data.multiLine?x=2:E.key==="Tab"&&(m.commitKey=3),x===-1)return;const{value:C}=E.target;m.lastCommittedValue!==C&&(m.lastCommittedValue=C,m.userValue=C,(L=this.linkService.eventBus)==null||L.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:"Keystroke",value:C,willCommit:!0,commitKey:x,selStart:E.target.selectionStart,selEnd:E.target.selectionEnd}}))});const y=v;v=null,n.addEventListener("blur",E=>{var C,L;if(!m.focused||!E.relatedTarget)return;(C=this.data.actions)!=null&&C.Blur||(m.focused=!1);const{value:x}=E.target;m.userValue=x,m.lastCommittedValue!==x&&((L=this.linkService.eventBus)==null||L.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:"Keystroke",value:x,willCommit:!0,commitKey:m.commitKey,selStart:E.target.selectionStart,selEnd:E.target.selectionEnd}})),y(E)}),(o=this.data.actions)!=null&&o.Keystroke&&n.addEventListener("beforeinput",E=>{var j;m.lastCommittedValue=null;const{data:x,target:C}=E,{value:L,selectionStart:M,selectionEnd:H}=C;let F=M,I=H;switch(E.inputType){case"deleteWordBackward":{const q=L.substring(0,M).match(/\w*[^\w]*$/);q&&(F-=q[0].length);break}case"deleteWordForward":{const q=L.substring(M).match(/^[^\w]*\w*/);q&&(I+=q[0].length);break}case"deleteContentBackward":M===H&&(F-=1);break;case"deleteContentForward":M===H&&(I+=1);break}E.preventDefault(),(j=this.linkService.eventBus)==null||j.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:"Keystroke",value:L,change:x||"",willCommit:!1,selStart:F,selEnd:I}})}),this._setEventListeners(n,m,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],E=>E.target.value)}if(v&&n.addEventListener("blur",v),this.data.comb){const E=(this.data.rect[2]-this.data.rect[0])/f;n.classList.add("comb"),n.style.letterSpacing=`calc(${E}px * var(--scale-factor) - 1ch)`}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell",this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class YC extends Nr{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class VC extends Nr{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,i=this.data,n=i.id;let l=e.getValue(n,{value:i.exportValue===i.fieldValue}).value;typeof l=="string"&&(l=l!=="Off",e.setValue(n,{value:l})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const o=document.createElement("input");return Mr.add(o),o.setAttribute("data-element-id",n),o.disabled=i.readOnly,this._setRequired(o,this.data.required),o.type="checkbox",o.name=i.fieldName,l&&o.setAttribute("checked",!0),o.setAttribute("exportValue",i.exportValue),o.tabIndex=md,o.addEventListener("change",u=>{const{name:d,checked:f}=u.target;for(const g of this._getElementsByName(d,n)){const m=f&&g.exportValue===i.exportValue;g.domElement&&(g.domElement.checked=m),e.setValue(g.id,{value:m})}e.setValue(n,{value:f})}),o.addEventListener("resetform",u=>{const d=i.defaultFieldValue||"Off";u.target.checked=d===i.exportValue}),this.enableScripting&&this.hasJSActions&&(o.addEventListener("updatefromsandbox",u=>{const d={value(f){f.target.checked=f.detail.value!=="Off",e.setValue(n,{value:f.target.checked})}};this._dispatchEventFromSandbox(d,u)}),this._setEventListeners(o,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],u=>u.target.checked)),this._setBackgroundColor(o),this._setDefaultPropertiesFromJS(o),this.container.append(o),this.container}}class x_ extends Nr{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,i=this.data,n=i.id;let l=e.getValue(n,{value:i.fieldValue===i.buttonValue}).value;if(typeof l=="string"&&(l=l!==i.buttonValue,e.setValue(n,{value:l})),l)for(const u of this._getElementsByName(i.fieldName,n))e.setValue(u.id,{value:!1});const o=document.createElement("input");if(Mr.add(o),o.setAttribute("data-element-id",n),o.disabled=i.readOnly,this._setRequired(o,this.data.required),o.type="radio",o.name=i.fieldName,l&&o.setAttribute("checked",!0),o.tabIndex=md,o.addEventListener("change",u=>{const{name:d,checked:f}=u.target;for(const g of this._getElementsByName(d,n))e.setValue(g.id,{value:!1});e.setValue(n,{value:f})}),o.addEventListener("resetform",u=>{const d=i.defaultFieldValue;u.target.checked=d!=null&&d===i.buttonValue}),this.enableScripting&&this.hasJSActions){const u=i.buttonValue;o.addEventListener("updatefromsandbox",d=>{const f={value:g=>{const m=u===g.detail.value;for(const v of this._getElementsByName(g.target.name)){const y=m&&v.id===n;v.domElement&&(v.domElement.checked=y),e.setValue(v.id,{value:y})}}};this._dispatchEventFromSandbox(f,d)}),this._setEventListeners(o,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],d=>d.target.checked)}return this._setBackgroundColor(o),this._setDefaultPropertiesFromJS(o),this.container.append(o),this.container}}class KC extends E_{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const i=e.lastChild;return this.enableScripting&&this.hasJSActions&&i&&(this._setDefaultPropertiesFromJS(i),i.addEventListener("updatefromsandbox",n=>{this._dispatchEventFromSandbox({},n)})),e}}class QC extends Nr{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,i=this.data.id,n=e.getValue(i,{value:this.data.fieldValue}),l=document.createElement("select");Mr.add(l),l.setAttribute("data-element-id",i),l.disabled=this.data.readOnly,this._setRequired(l,this.data.required),l.name=this.data.fieldName,l.tabIndex=md;let o=this.data.combo&&this.data.options.length>0;this.data.combo||(l.size=this.data.options.length,this.data.multiSelect&&(l.multiple=!0)),l.addEventListener("resetform",m=>{const v=this.data.defaultFieldValue;for(const y of l.options)y.selected=y.value===v});for(const m of this.data.options){const v=document.createElement("option");v.textContent=m.displayValue,v.value=m.exportValue,n.value.includes(m.exportValue)&&(v.setAttribute("selected",!0),o=!1),l.append(v)}let u=null;if(o){const m=document.createElement("option");m.value=" ",m.setAttribute("hidden",!0),m.setAttribute("selected",!0),l.prepend(m),u=()=>{m.remove(),l.removeEventListener("input",u),u=null},l.addEventListener("input",u)}const d=m=>{const v=m?"value":"textContent",{options:y,multiple:E}=l;return E?Array.prototype.filter.call(y,x=>x.selected).map(x=>x[v]):y.selectedIndex===-1?null:y[y.selectedIndex][v]};let f=d(!1);const g=m=>{const v=m.target.options;return Array.prototype.map.call(v,y=>({displayValue:y.textContent,exportValue:y.value}))};return this.enableScripting&&this.hasJSActions?(l.addEventListener("updatefromsandbox",m=>{const v={value(y){u==null||u();const E=y.detail.value,x=new Set(Array.isArray(E)?E:[E]);for(const C of l.options)C.selected=x.has(C.value);e.setValue(i,{value:d(!0)}),f=d(!1)},multipleSelection(y){l.multiple=!0},remove(y){const E=l.options,x=y.detail.remove;E[x].selected=!1,l.remove(x),E.length>0&&Array.prototype.findIndex.call(E,L=>L.selected)===-1&&(E[0].selected=!0),e.setValue(i,{value:d(!0),items:g(y)}),f=d(!1)},clear(y){for(;l.length!==0;)l.remove(0);e.setValue(i,{value:null,items:[]}),f=d(!1)},insert(y){const{index:E,displayValue:x,exportValue:C}=y.detail.insert,L=l.children[E],M=document.createElement("option");M.textContent=x,M.value=C,L?L.before(M):l.append(M),e.setValue(i,{value:d(!0),items:g(y)}),f=d(!1)},items(y){const{items:E}=y.detail;for(;l.length!==0;)l.remove(0);for(const x of E){const{displayValue:C,exportValue:L}=x,M=document.createElement("option");M.textContent=C,M.value=L,l.append(M)}l.options.length>0&&(l.options[0].selected=!0),e.setValue(i,{value:d(!0),items:g(y)}),f=d(!1)},indices(y){const E=new Set(y.detail.indices);for(const x of y.target.options)x.selected=E.has(x.index);e.setValue(i,{value:d(!0)}),f=d(!1)},editable(y){y.target.disabled=!y.detail.editable}};this._dispatchEventFromSandbox(v,m)}),l.addEventListener("input",m=>{var E;const v=d(!0),y=d(!1);e.setValue(i,{value:v}),m.preventDefault(),(E=this.linkService.eventBus)==null||E.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:"Keystroke",value:f,change:y,changeEx:v,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(l,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],m=>m.target.value)):l.addEventListener("input",function(m){e.setValue(i,{value:d(!0)})}),this.data.combo&&this._setTextStyle(l),this._setBackgroundColor(l),this._setDefaultPropertiesFromJS(l),this.container.append(l),this.container}}class ib extends be{constructor(e){const{data:i,elements:n}=e;super(e,{isRenderable:be._hasPopupData(i)}),this.elements=n,this.popup=null}render(){this.container.classList.add("popupAnnotation");const e=this.popup=new ZC({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}),i=[];for(const n of this.elements)n.popup=e,n.container.ariaHasPopup="dialog",i.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(n=>`${Fb}${n}`).join(",")),this.container}}var lc,Ng,kg,rc,lr,fe,zn,oc,Fh,Uh,cc,Hn,Es,Fn,Bh,Un,Ph,rr,or,Jt,$f,sb,C_,M_,R_,D_,Jf,tg,nb;class ZC{constructor({container:e,color:i,elements:n,titleObj:l,modificationDate:o,contentsObj:u,richText:d,parent:f,rect:g,parentRect:m,open:v}){w(this,Jt);w(this,lc,_(this,Jt,R_).bind(this));w(this,Ng,_(this,Jt,nb).bind(this));w(this,kg,_(this,Jt,tg).bind(this));w(this,rc,_(this,Jt,Jf).bind(this));w(this,lr,null);w(this,fe,null);w(this,zn,null);w(this,oc,null);w(this,Fh,null);w(this,Uh,null);w(this,cc,null);w(this,Hn,!1);w(this,Es,null);w(this,Fn,null);w(this,Bh,null);w(this,Un,null);w(this,Ph,null);w(this,rr,null);w(this,or,!1);var y;S(this,fe,e),S(this,Ph,l),S(this,zn,u),S(this,Un,d),S(this,Uh,f),S(this,lr,i),S(this,Bh,g),S(this,cc,m),S(this,Fh,n),S(this,oc,Pb.toDateObject(o)),this.trigger=n.flatMap(E=>E.getElementsToTriggerPopup());for(const E of this.trigger)E.addEventListener("click",c(this,rc)),E.addEventListener("mouseenter",c(this,kg)),E.addEventListener("mouseleave",c(this,Ng)),E.classList.add("popupTriggerArea");for(const E of n)(y=E.container)==null||y.addEventListener("keydown",c(this,lc));c(this,fe).hidden=!0,v&&_(this,Jt,Jf).call(this)}render(){if(c(this,Es))return;const e=S(this,Es,document.createElement("div"));if(e.className="popup",c(this,lr)){const o=e.style.outlineColor=ct.makeHexColor(...c(this,lr));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?e.style.backgroundColor=`color-mix(in srgb, ${o} 30%, white)`:e.style.backgroundColor=ct.makeHexColor(...c(this,lr).map(d=>Math.floor(.7*(255-d)+d)))}const i=document.createElement("span");i.className="header";const n=document.createElement("h1");if(i.append(n),{dir:n.dir,str:n.textContent}=c(this,Ph),e.append(i),c(this,oc)){const o=document.createElement("span");o.classList.add("popupDate"),o.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),o.setAttribute("data-l10n-args",JSON.stringify({dateObj:c(this,oc).valueOf()})),i.append(o)}const l=c(this,Jt,$f);if(l)__.render({xfaHtml:l,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const o=this._formatContents(c(this,zn));e.append(o)}c(this,fe).append(e)}_formatContents({str:e,dir:i}){const n=document.createElement("p");n.classList.add("popupContent"),n.dir=i;const l=e.split(/(?:\r\n?|\n)/);for(let o=0,u=l.length;o<u;++o){const d=l[o];n.append(document.createTextNode(d)),o<u-1&&n.append(document.createElement("br"))}return n}updateEdited({rect:e,popupContent:i}){var n;c(this,rr)||S(this,rr,{contentsObj:c(this,zn),richText:c(this,Un)}),e&&S(this,Fn,null),i&&(S(this,Un,_(this,Jt,M_).call(this,i)),S(this,zn,null)),(n=c(this,Es))==null||n.remove(),S(this,Es,null)}resetEdited(){var e;c(this,rr)&&({contentsObj:li(this,zn)._,richText:li(this,Un)._}=c(this,rr),S(this,rr,null),(e=c(this,Es))==null||e.remove(),S(this,Es,null),S(this,Fn,null))}forceHide(){S(this,or,this.isVisible),c(this,or)&&(c(this,fe).hidden=!0)}maybeShow(){c(this,or)&&(c(this,Es)||_(this,Jt,tg).call(this),S(this,or,!1),c(this,fe).hidden=!1)}get isVisible(){return c(this,fe).hidden===!1}}lc=new WeakMap,Ng=new WeakMap,kg=new WeakMap,rc=new WeakMap,lr=new WeakMap,fe=new WeakMap,zn=new WeakMap,oc=new WeakMap,Fh=new WeakMap,Uh=new WeakMap,cc=new WeakMap,Hn=new WeakMap,Es=new WeakMap,Fn=new WeakMap,Bh=new WeakMap,Un=new WeakMap,Ph=new WeakMap,rr=new WeakMap,or=new WeakMap,Jt=new WeakSet,$f=function(){const e=c(this,Un),i=c(this,zn);return e!=null&&e.str&&(!(i!=null&&i.str)||i.str===e.str)&&c(this,Un).html||null},sb=function(){var e,i,n;return((n=(i=(e=c(this,Jt,$f))==null?void 0:e.attributes)==null?void 0:i.style)==null?void 0:n.fontSize)||0},C_=function(){var e,i,n;return((n=(i=(e=c(this,Jt,$f))==null?void 0:e.attributes)==null?void 0:i.style)==null?void 0:n.color)||null},M_=function(e){const i=[],n={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:i}]}},l={style:{color:c(this,Jt,C_),fontSize:c(this,Jt,sb)?`calc(${c(this,Jt,sb)}px * var(--scale-factor))`:""}};for(const o of e.split(`
`))i.push({name:"span",value:o,attributes:l});return n},R_=function(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&c(this,Hn))&&_(this,Jt,Jf).call(this)},D_=function(){if(c(this,Fn)!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:i,pageHeight:n,pageX:l,pageY:o}}}=c(this,Uh);let u=!!c(this,cc),d=u?c(this,cc):c(this,Bh);for(const x of c(this,Fh))if(!d||ct.intersect(x.data.rect,d)!==null){d=x.data.rect,u=!0;break}const f=ct.normalizeRect([d[0],e[3]-d[1]+e[1],d[2],e[3]-d[3]+e[1]]),m=u?d[2]-d[0]+5:0,v=f[0]+m,y=f[1];S(this,Fn,[100*(v-l)/i,100*(y-o)/n]);const{style:E}=c(this,fe);E.left=`${c(this,Fn)[0]}%`,E.top=`${c(this,Fn)[1]}%`},Jf=function(){S(this,Hn,!c(this,Hn)),c(this,Hn)?(_(this,Jt,tg).call(this),c(this,fe).addEventListener("click",c(this,rc)),c(this,fe).addEventListener("keydown",c(this,lc))):(_(this,Jt,nb).call(this),c(this,fe).removeEventListener("click",c(this,rc)),c(this,fe).removeEventListener("keydown",c(this,lc)))},tg=function(){c(this,Es)||this.render(),this.isVisible?c(this,Hn)&&c(this,fe).classList.add("focused"):(_(this,Jt,D_).call(this),c(this,fe).hidden=!1,c(this,fe).style.zIndex=parseInt(c(this,fe).style.zIndex)+1e3)},nb=function(){c(this,fe).classList.remove("focused"),!(c(this,Hn)||!this.isVisible)&&(c(this,fe).hidden=!0,c(this,fe).style.zIndex=parseInt(c(this,fe).style.zIndex)-1e3)};class L_ extends be{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=Et.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 i of this.textContent){const n=document.createElement("span");n.textContent=i,e.append(n)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var Ih;class WC extends be{constructor(i){super(i,{isRenderable:!0,ignoreBorder:!0});w(this,Ih,null)}render(){this.container.classList.add("lineAnnotation");const i=this.data,{width:n,height:l}=Zn(i.rect),o=this.svgFactory.create(n,l,!0),u=S(this,Ih,this.svgFactory.createElement("svg:line"));return u.setAttribute("x1",i.rect[2]-i.lineCoordinates[0]),u.setAttribute("y1",i.rect[3]-i.lineCoordinates[1]),u.setAttribute("x2",i.rect[2]-i.lineCoordinates[2]),u.setAttribute("y2",i.rect[3]-i.lineCoordinates[3]),u.setAttribute("stroke-width",i.borderStyle.width||1),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),o.append(u),this.container.append(o),!i.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return c(this,Ih)}addHighlightArea(){this.container.classList.add("highlightArea")}}Ih=new WeakMap;var jh;class $C extends be{constructor(i){super(i,{isRenderable:!0,ignoreBorder:!0});w(this,jh,null)}render(){this.container.classList.add("squareAnnotation");const i=this.data,{width:n,height:l}=Zn(i.rect),o=this.svgFactory.create(n,l,!0),u=i.borderStyle.width,d=S(this,jh,this.svgFactory.createElement("svg:rect"));return d.setAttribute("x",u/2),d.setAttribute("y",u/2),d.setAttribute("width",n-u),d.setAttribute("height",l-u),d.setAttribute("stroke-width",u||1),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),o.append(d),this.container.append(o),!i.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return c(this,jh)}addHighlightArea(){this.container.classList.add("highlightArea")}}jh=new WeakMap;var qh;class JC extends be{constructor(i){super(i,{isRenderable:!0,ignoreBorder:!0});w(this,qh,null)}render(){this.container.classList.add("circleAnnotation");const i=this.data,{width:n,height:l}=Zn(i.rect),o=this.svgFactory.create(n,l,!0),u=i.borderStyle.width,d=S(this,qh,this.svgFactory.createElement("svg:ellipse"));return d.setAttribute("cx",n/2),d.setAttribute("cy",l/2),d.setAttribute("rx",n/2-u/2),d.setAttribute("ry",l/2-u/2),d.setAttribute("stroke-width",u||1),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),o.append(d),this.container.append(o),!i.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return c(this,qh)}addHighlightArea(){this.container.classList.add("highlightArea")}}qh=new WeakMap;var Gh;class O_ extends be{constructor(i){super(i,{isRenderable:!0,ignoreBorder:!0});w(this,Gh,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:i,vertices:n,borderStyle:l,popupRef:o}}=this;if(!n)return this.container;const{width:u,height:d}=Zn(i),f=this.svgFactory.create(u,d,!0);let g=[];for(let v=0,y=n.length;v<y;v+=2){const E=n[v]-i[0],x=i[3]-n[v+1];g.push(`${E},${x}`)}g=g.join(" ");const m=S(this,Gh,this.svgFactory.createElement(this.svgElementName));return m.setAttribute("points",g),m.setAttribute("stroke-width",l.width||1),m.setAttribute("stroke","transparent"),m.setAttribute("fill","transparent"),f.append(m),this.container.append(f),!o&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return c(this,Gh)}addHighlightArea(){this.container.classList.add("highlightArea")}}Gh=new WeakMap;class tM extends O_{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class eM extends be{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 Xh;class Kb extends be{constructor(i){super(i,{isRenderable:!0,ignoreBorder:!0});w(this,Xh,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?Et.HIGHLIGHT:Et.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:i,inkLists:n,borderStyle:l,popupRef:o}}=this,{width:u,height:d}=Zn(i),f=this.svgFactory.create(u,d,!0);for(const g of n){let m=[];for(let y=0,E=g.length;y<E;y+=2){const x=g[y]-i[0],C=i[3]-g[y+1];m.push(`${x},${C}`)}m=m.join(" ");const v=this.svgFactory.createElement(this.svgElementName);c(this,Xh).push(v),v.setAttribute("points",m),v.setAttribute("stroke-width",l.width||1),v.setAttribute("stroke","transparent"),v.setAttribute("fill","transparent"),f.append(v)}return!o&&this.hasPopupData&&this._createPopup(),this.container.append(f),this._editOnDoubleClick(),this.container}getElementsToTriggerPopup(){return c(this,Xh)}addHighlightArea(){this.container.classList.add("highlightArea")}}Xh=new WeakMap;class N_ extends be{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Et.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class iM extends be{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class sM extends be{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class nM extends be{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class k_ extends be{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Et.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 Yh,Vh,ab;class aM extends be{constructor(i){var l;super(i,{isRenderable:!0});w(this,Vh);w(this,Yh,null);const{file:n}=this.data;this.filename=n.filename,this.content=n.content,(l=this.linkService.eventBus)==null||l.dispatch("fileattachmentannotation",{source:this,...n})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:i,data:n}=this;let l;n.hasAppearance||n.fillAlpha===0?l=document.createElement("div"):(l=document.createElement("img"),l.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(n.name)?"paperclip":"pushpin"}.svg`,n.fillAlpha&&n.fillAlpha<1&&(l.style=`filter: opacity(${Math.round(n.fillAlpha*100)}%);`)),l.addEventListener("dblclick",_(this,Vh,ab).bind(this)),S(this,Yh,l);const{isMac:o}=ui.platform;return i.addEventListener("keydown",u=>{u.key==="Enter"&&(o?u.metaKey:u.ctrlKey)&&_(this,Vh,ab).call(this)}),!n.popupRef&&this.hasPopupData?this._createPopup():l.classList.add("popupTriggerArea"),i.append(l),i}getElementsToTriggerPopup(){return c(this,Yh)}addHighlightArea(){this.container.classList.add("highlightArea")}}Yh=new WeakMap,Vh=new WeakSet,ab=function(){var i;(i=this.downloadManager)==null||i.openOrDownloadData(this.content,this.filename)};var Kh,cr,ur,Qh,Rr,z_,lb;class lM{constructor({div:e,accessibilityManager:i,annotationCanvasMap:n,annotationEditorUIManager:l,page:o,viewport:u,structTreeLayer:d}){w(this,Rr);w(this,Kh,null);w(this,cr,null);w(this,ur,new Map);w(this,Qh,null);this.div=e,S(this,Kh,i),S(this,cr,n),S(this,Qh,d||null),this.page=o,this.viewport=u,this.zIndex=0,this._annotationEditorUIManager=l}hasEditableAnnotations(){return c(this,ur).size>0}async render(e){var u;const{annotations:i}=e,n=this.div;xr(n,this.viewport);const l=new Map,o={data:null,layer:n,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new Vb,annotationStorage:e.annotationStorage||new jb,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const d of i){if(d.noHTML)continue;const f=d.annotationType===we.POPUP;if(f){const v=l.get(d.id);if(!v)continue;o.elements=v}else{const{width:v,height:y}=Zn(d.rect);if(v<=0||y<=0)continue}o.data=d;const g=qC.create(o);if(!g.isRenderable)continue;if(!f&&d.popupRef){const v=l.get(d.popupRef);v?v.push(g):l.set(d.popupRef,[g])}const m=g.render();d.hidden&&(m.style.visibility="hidden"),await _(this,Rr,z_).call(this,m,d.id),g._isEditable&&(c(this,ur).set(g.data.id,g),(u=this._annotationEditorUIManager)==null||u.renderAnnotationElement(g))}_(this,Rr,lb).call(this)}update({viewport:e}){const i=this.div;this.viewport=e,xr(i,{rotation:e.rotation}),_(this,Rr,lb).call(this),i.hidden=!1}getEditableAnnotations(){return Array.from(c(this,ur).values())}getEditableAnnotation(e){return c(this,ur).get(e)}}Kh=new WeakMap,cr=new WeakMap,ur=new WeakMap,Qh=new WeakMap,Rr=new WeakSet,z_=async function(e,i){var u,d;const n=e.firstChild||e,l=n.id=`${Fb}${i}`,o=await((u=c(this,Qh))==null?void 0:u.getAriaAttributes(l));if(o)for(const[f,g]of o)n.setAttribute(f,g);this.div.append(e),(d=c(this,Kh))==null||d.moveElementInDOM(this.div,e,n,!1)},lb=function(){if(!c(this,cr))return;const e=this.div;for(const[i,n]of c(this,cr)){const l=e.querySelector(`[data-annotation-id="${i}"]`);if(!l)continue;n.className="annotationContent";const{firstChild:o}=l;o?o.nodeName==="CANVAS"?o.replaceWith(n):o.classList.contains("annotationContent")?o.after(n):o.before(n):l.append(n)}c(this,cr).clear()};const Uf=/\r\n?|\n/g;var Ts,Fi,Zh,hr,Ui,_e,H_,F_,U_,eg,$n,ig,sg,B_,ob,P_;const ie=class ie extends Kt{constructor(i){super({...i,name:"freeTextEditor"});w(this,_e);w(this,Ts);w(this,Fi,"");w(this,Zh,`${this.id}-editor`);w(this,hr,null);w(this,Ui);S(this,Ts,i.color||ie._defaultColor||Kt._defaultLineColor),S(this,Ui,i.fontSize||ie._defaultFontSize)}static get _keyboardManager(){const i=ie.prototype,n=u=>u.isEmpty(),l=Cr.TRANSLATE_SMALL,o=Cr.TRANSLATE_BIG;return Ft(this,"_keyboardManager",new pd([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],i.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],i.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],i._translateEmpty,{args:[-l,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],i._translateEmpty,{args:[-o,0],checker:n}],[["ArrowRight","mac+ArrowRight"],i._translateEmpty,{args:[l,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],i._translateEmpty,{args:[o,0],checker:n}],[["ArrowUp","mac+ArrowUp"],i._translateEmpty,{args:[0,-l],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],i._translateEmpty,{args:[0,-o],checker:n}],[["ArrowDown","mac+ArrowDown"],i._translateEmpty,{args:[0,l],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],i._translateEmpty,{args:[0,o],checker:n}]]))}static initialize(i,n){Kt.initialize(i,n);const l=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(l.getPropertyValue("--freetext-padding"))}static updateDefaultParams(i,n){switch(i){case vt.FREETEXT_SIZE:ie._defaultFontSize=n;break;case vt.FREETEXT_COLOR:ie._defaultColor=n;break}}updateParams(i,n){switch(i){case vt.FREETEXT_SIZE:_(this,_e,H_).call(this,n);break;case vt.FREETEXT_COLOR:_(this,_e,F_).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[vt.FREETEXT_SIZE,ie._defaultFontSize],[vt.FREETEXT_COLOR,ie._defaultColor||Kt._defaultLineColor]]}get propertiesToUpdate(){return[[vt.FREETEXT_SIZE,c(this,Ui)],[vt.FREETEXT_COLOR,c(this,Ts)]]}_translateEmpty(i,n){this._uiManager.translateSelectedEditors(i,n,!0)}getInitialTranslation(){const i=this.parentScale;return[-ie._internalPadding*i,-(ie._internalPadding+c(this,Ui))*i]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(Et.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),S(this,hr,new AbortController);const i=this._uiManager.combinedSignal(c(this,hr));this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:i}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:i}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:i}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:i}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:i})}disableEditMode(){var i;this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",c(this,Zh)),this._isDraggable=!0,(i=c(this,hr))==null||i.abort(),S(this,hr,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(i){this._focusEventsAllowed&&(super.focusin(i),i.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var i;this.width||(this.enableEditMode(),this.editorDiv.focus(),(i=this._initialOptions)!=null&&i.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 i=c(this,Fi),n=S(this,Fi,_(this,_e,U_).call(this).trimEnd());if(i===n)return;const l=o=>{if(S(this,Fi,o),!o){this.remove();return}_(this,_e,sg).call(this),this._uiManager.rebuild(this),_(this,_e,eg).call(this)};this.addCommands({cmd:()=>{l(n)},undo:()=>{l(i)},mustExec:!1}),_(this,_e,eg).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(i){this.enterInEditMode()}keydown(i){i.target===this.div&&i.key==="Enter"&&(this.enterInEditMode(),i.preventDefault())}editorDivKeydown(i){ie._keyboardManager.exec(this,i)}editorDivFocus(i){this.isEditing=!0}editorDivBlur(i){this.isEditing=!1}editorDivInput(i){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let i,n;this.width&&(i=this.x,n=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",c(this,Zh)),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:l}=this.editorDiv;if(l.fontSize=`calc(${c(this,Ui)}px * var(--scale-factor))`,l.color=c(this,Ts),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),pg(this,this.div,["dblclick","keydown"]),this.width){const[o,u]=this.parentDimensions;if(this.annotationElementId){const{position:d}=this._initialData;let[f,g]=this.getInitialTranslation();[f,g]=this.pageTranslationToScreen(f,g);const[m,v]=this.pageDimensions,[y,E]=this.pageTranslation;let x,C;switch(this.rotation){case 0:x=i+(d[0]-y)/m,C=n+this.height-(d[1]-E)/v;break;case 90:x=i+(d[0]-y)/m,C=n-(d[1]-E)/v,[f,g]=[g,-f];break;case 180:x=i-this.width+(d[0]-y)/m,C=n-(d[1]-E)/v,[f,g]=[-f,-g];break;case 270:x=i+(d[0]-y-this.height*v)/m,C=n+(d[1]-E-this.width*m)/v,[f,g]=[-g,f];break}this.setAt(x*o,C*u,f,g)}else this.setAt(i*o,n*u,this.width*o,this.height*u);_(this,_e,sg).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(i){var x,C,L;const n=i.clipboardData||window.clipboardData,{types:l}=n;if(l.length===1&&l[0]==="text/plain")return;i.preventDefault();const o=_(x=ie,$n,ob).call(x,n.getData("text")||"").replaceAll(Uf,`
`);if(!o)return;const u=window.getSelection();if(!u.rangeCount)return;this.editorDiv.normalize(),u.deleteFromDocument();const d=u.getRangeAt(0);if(!o.includes(`
`)){d.insertNode(document.createTextNode(o)),this.editorDiv.normalize(),u.collapseToStart();return}const{startContainer:f,startOffset:g}=d,m=[],v=[];if(f.nodeType===Node.TEXT_NODE){const M=f.parentElement;if(v.push(f.nodeValue.slice(g).replaceAll(Uf,"")),M!==this.editorDiv){let H=m;for(const F of this.editorDiv.childNodes){if(F===M){H=v;continue}H.push(_(C=ie,$n,ig).call(C,F))}}m.push(f.nodeValue.slice(0,g).replaceAll(Uf,""))}else if(f===this.editorDiv){let M=m,H=0;for(const F of this.editorDiv.childNodes)H++===g&&(M=v),M.push(_(L=ie,$n,ig).call(L,F))}S(this,Fi,`${m.join(`
`)}${o}${v.join(`
`)}`),_(this,_e,sg).call(this);const y=new Range;let E=m.reduce((M,H)=>M+H.length,0);for(const{firstChild:M}of this.editorDiv.childNodes)if(M.nodeType===Node.TEXT_NODE){const H=M.nodeValue.length;if(E<=H){y.setStart(M,E),y.setEnd(M,E);break}E-=H}u.removeAllRanges(),u.addRange(y)}get contentDiv(){return this.editorDiv}static async deserialize(i,n,l){var d;let o=null;if(i instanceof L_){const{data:{defaultAppearanceData:{fontSize:f,fontColor:g},rect:m,rotation:v,id:y,popupRef:E},textContent:x,textPosition:C,parent:{page:{pageNumber:L}}}=i;if(!x||x.length===0)return null;o=i={annotationType:Et.FREETEXT,color:Array.from(g),fontSize:f,value:x.join(`
`),position:C,pageIndex:L-1,rect:m.slice(0),rotation:v,id:y,deleted:!1,popupRef:E}}const u=await super.deserialize(i,n,l);return S(u,Ui,i.fontSize),S(u,Ts,ct.makeHexColor(...i.color)),S(u,Fi,_(d=ie,$n,ob).call(d,i.value)),u.annotationElementId=i.id||null,u._initialData=o,u}serialize(i=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const n=ie._internalPadding*this.parentScale,l=this.getRect(n,n),o=Kt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:c(this,Ts)),u={annotationType:Et.FREETEXT,color:o,fontSize:c(this,Ui),value:_(this,_e,B_).call(this),pageIndex:this.pageIndex,rect:l,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return i?u:this.annotationElementId&&!_(this,_e,P_).call(this,u)?null:(u.id=this.annotationElementId,u)}renderAnnotationElement(i){const n=super.renderAnnotationElement(i);if(this.deleted)return n;const{style:l}=n;l.fontSize=`calc(${c(this,Ui)}px * var(--scale-factor))`,l.color=c(this,Ts),n.replaceChildren();for(const u of c(this,Fi).split(`
`)){const d=document.createElement("div");d.append(u?document.createTextNode(u):document.createElement("br")),n.append(d)}const o=ie._internalPadding*this.parentScale;return i.updateEdited({rect:this.getRect(o,o),popupContent:c(this,Fi)}),n}resetAnnotationElement(i){super.resetAnnotationElement(i),i.resetEdited()}};Ts=new WeakMap,Fi=new WeakMap,Zh=new WeakMap,hr=new WeakMap,Ui=new WeakMap,_e=new WeakSet,H_=function(i){const n=o=>{this.editorDiv.style.fontSize=`calc(${o}px * var(--scale-factor))`,this.translate(0,-(o-c(this,Ui))*this.parentScale),S(this,Ui,o),_(this,_e,eg).call(this)},l=c(this,Ui);this.addCommands({cmd:n.bind(this,i),undo:n.bind(this,l),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:vt.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},F_=function(i){const n=o=>{S(this,Ts,this.editorDiv.style.color=o)},l=c(this,Ts);this.addCommands({cmd:n.bind(this,i),undo:n.bind(this,l),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:vt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},U_=function(){var l;const i=[];this.editorDiv.normalize();let n=null;for(const o of this.editorDiv.childNodes)(n==null?void 0:n.nodeType)===Node.TEXT_NODE&&o.nodeName==="BR"||(i.push(_(l=ie,$n,ig).call(l,o)),n=o);return i.join(`
`)},eg=function(){const[i,n]=this.parentDimensions;let l;if(this.isAttachedToDOM)l=this.div.getBoundingClientRect();else{const{currentLayer:o,div:u}=this,d=u.style.display,f=u.classList.contains("hidden");u.classList.remove("hidden"),u.style.display="hidden",o.div.append(this.div),l=u.getBoundingClientRect(),u.remove(),u.style.display=d,u.classList.toggle("hidden",f)}this.rotation%180===this.parentRotation%180?(this.width=l.width/i,this.height=l.height/n):(this.width=l.height/i,this.height=l.width/n),this.fixAndSetPosition()},$n=new WeakSet,ig=function(i){return(i.nodeType===Node.TEXT_NODE?i.nodeValue:i.innerText).replaceAll(Uf,"")},sg=function(){if(this.editorDiv.replaceChildren(),!!c(this,Fi))for(const i of c(this,Fi).split(`
`)){const n=document.createElement("div");n.append(i?document.createTextNode(i):document.createElement("br")),this.editorDiv.append(n)}},B_=function(){return c(this,Fi).replaceAll(" "," ")},ob=function(i){return i.replaceAll(" "," ")},P_=function(i){const{value:n,fontSize:l,color:o,pageIndex:u}=this._initialData;return this._hasBeenMoved||i.value!==n||i.fontSize!==l||i.color.some((d,f)=>d!==o[f])||i.pageIndex!==u},w(ie,$n),bt(ie,"_freeTextDefaultContent",""),bt(ie,"_internalPadding",0),bt(ie,"_defaultColor",null),bt(ie,"_defaultFontSize",10),bt(ie,"_type","freetext"),bt(ie,"_editorType",Et.FREETEXT);let rb=ie;class I_{toSVGPath(){se("Abstract method `toSVGPath` must be implemented.")}get box(){se("Abstract getter `box` must be implemented.")}serialize(e,i){se("Abstract method `serialize` must be implemented.")}get classNamesForDrawing(){se("Abstract getter `classNamesForDrawing` must be implemented.")}get classNamesForOutlining(){se("Abstract getter `classNamesForOutlining` must be implemented.")}get mustRemoveSelfIntersections(){return!1}}var Bi,ws,uc,hc,Ws,Lt,dr,fr,Wh,$h,dc,fc,Ya,Jh,zg,Hg,Le,Iu,j_,q_,G_,X_,Y_,V_;const Tn=class Tn{constructor({x:e,y:i},n,l,o,u,d=0){w(this,Le);w(this,Bi);w(this,ws,[]);w(this,uc);w(this,hc);w(this,Ws,[]);w(this,Lt,new Float64Array(18));w(this,dr);w(this,fr);w(this,Wh);w(this,$h);w(this,dc);w(this,fc);w(this,Ya,[]);S(this,Bi,n),S(this,fc,o*l),S(this,hc,u),c(this,Lt).set([NaN,NaN,NaN,NaN,e,i],6),S(this,uc,d),S(this,$h,c(Tn,Jh)*l),S(this,Wh,c(Tn,Hg)*l),S(this,dc,l),c(this,Ya).push(e,i)}isEmpty(){return isNaN(c(this,Lt)[8])}add({x:e,y:i}){var at;S(this,dr,e),S(this,fr,i);const[n,l,o,u]=c(this,Bi);let[d,f,g,m]=c(this,Lt).subarray(8,12);const v=e-g,y=i-m,E=Math.hypot(v,y);if(E<c(this,Wh))return!1;const x=E-c(this,$h),C=x/E,L=C*v,M=C*y;let H=d,F=f;d=g,f=m,g+=L,m+=M,(at=c(this,Ya))==null||at.push(e,i);const I=-M/x,j=L/x,q=I*c(this,fc),Q=j*c(this,fc);return c(this,Lt).set(c(this,Lt).subarray(2,8),0),c(this,Lt).set([g+q,m+Q],4),c(this,Lt).set(c(this,Lt).subarray(14,18),12),c(this,Lt).set([g-q,m-Q],16),isNaN(c(this,Lt)[6])?(c(this,Ws).length===0&&(c(this,Lt).set([d+q,f+Q],2),c(this,Ws).push(NaN,NaN,NaN,NaN,(d+q-n)/o,(f+Q-l)/u),c(this,Lt).set([d-q,f-Q],14),c(this,ws).push(NaN,NaN,NaN,NaN,(d-q-n)/o,(f-Q-l)/u)),c(this,Lt).set([H,F,d,f,g,m],6),!this.isEmpty()):(c(this,Lt).set([H,F,d,f,g,m],6),Math.abs(Math.atan2(F-f,H-d)-Math.atan2(M,L))<Math.PI/2?([d,f,g,m]=c(this,Lt).subarray(2,6),c(this,Ws).push(NaN,NaN,NaN,NaN,((d+g)/2-n)/o,((f+m)/2-l)/u),[d,f,H,F]=c(this,Lt).subarray(14,18),c(this,ws).push(NaN,NaN,NaN,NaN,((H+d)/2-n)/o,((F+f)/2-l)/u),!0):([H,F,d,f,g,m]=c(this,Lt).subarray(0,6),c(this,Ws).push(((H+5*d)/6-n)/o,((F+5*f)/6-l)/u,((5*d+g)/6-n)/o,((5*f+m)/6-l)/u,((d+g)/2-n)/o,((f+m)/2-l)/u),[g,m,d,f,H,F]=c(this,Lt).subarray(12,18),c(this,ws).push(((H+5*d)/6-n)/o,((F+5*f)/6-l)/u,((5*d+g)/6-n)/o,((5*f+m)/6-l)/u,((d+g)/2-n)/o,((f+m)/2-l)/u),!0))}toSVGPath(){if(this.isEmpty())return"";const e=c(this,Ws),i=c(this,ws);if(isNaN(c(this,Lt)[6])&&!this.isEmpty())return _(this,Le,j_).call(this);const n=[];n.push(`M${e[4]} ${e[5]}`);for(let l=6;l<e.length;l+=6)isNaN(e[l])?n.push(`L${e[l+4]} ${e[l+5]}`):n.push(`C${e[l]} ${e[l+1]} ${e[l+2]} ${e[l+3]} ${e[l+4]} ${e[l+5]}`);_(this,Le,G_).call(this,n);for(let l=i.length-6;l>=6;l-=6)isNaN(i[l])?n.push(`L${i[l+4]} ${i[l+5]}`):n.push(`C${i[l]} ${i[l+1]} ${i[l+2]} ${i[l+3]} ${i[l+4]} ${i[l+5]}`);return _(this,Le,q_).call(this,n),n.join(" ")}newFreeDrawOutline(e,i,n,l,o,u){return new K_(e,i,n,l,o,u)}getOutlines(){var v;const e=c(this,Ws),i=c(this,ws),n=c(this,Lt),[l,o,u,d]=c(this,Bi),f=new Float64Array((((v=c(this,Ya))==null?void 0:v.length)??0)+2);for(let y=0,E=f.length-2;y<E;y+=2)f[y]=(c(this,Ya)[y]-l)/u,f[y+1]=(c(this,Ya)[y+1]-o)/d;if(f[f.length-2]=(c(this,dr)-l)/u,f[f.length-1]=(c(this,fr)-o)/d,isNaN(n[6])&&!this.isEmpty())return _(this,Le,X_).call(this,f);const g=new Float64Array(c(this,Ws).length+24+c(this,ws).length);let m=e.length;for(let y=0;y<m;y+=2){if(isNaN(e[y])){g[y]=g[y+1]=NaN;continue}g[y]=e[y],g[y+1]=e[y+1]}m=_(this,Le,V_).call(this,g,m);for(let y=i.length-6;y>=6;y-=6)for(let E=0;E<6;E+=2){if(isNaN(i[y+E])){g[m]=g[m+1]=NaN,m+=2;continue}g[m]=i[y+E],g[m+1]=i[y+E+1],m+=2}return _(this,Le,Y_).call(this,g,m),this.newFreeDrawOutline(g,f,c(this,Bi),c(this,dc),c(this,uc),c(this,hc))}};Bi=new WeakMap,ws=new WeakMap,uc=new WeakMap,hc=new WeakMap,Ws=new WeakMap,Lt=new WeakMap,dr=new WeakMap,fr=new WeakMap,Wh=new WeakMap,$h=new WeakMap,dc=new WeakMap,fc=new WeakMap,Ya=new WeakMap,Jh=new WeakMap,zg=new WeakMap,Hg=new WeakMap,Le=new WeakSet,Iu=function(){const e=c(this,Lt).subarray(4,6),i=c(this,Lt).subarray(16,18),[n,l,o,u]=c(this,Bi);return[(c(this,dr)+(e[0]-i[0])/2-n)/o,(c(this,fr)+(e[1]-i[1])/2-l)/u,(c(this,dr)+(i[0]-e[0])/2-n)/o,(c(this,fr)+(i[1]-e[1])/2-l)/u]},j_=function(){const[e,i,n,l]=c(this,Bi),[o,u,d,f]=_(this,Le,Iu).call(this);return`M${(c(this,Lt)[2]-e)/n} ${(c(this,Lt)[3]-i)/l} L${(c(this,Lt)[4]-e)/n} ${(c(this,Lt)[5]-i)/l} L${o} ${u} L${d} ${f} L${(c(this,Lt)[16]-e)/n} ${(c(this,Lt)[17]-i)/l} L${(c(this,Lt)[14]-e)/n} ${(c(this,Lt)[15]-i)/l} Z`},q_=function(e){const i=c(this,ws);e.push(`L${i[4]} ${i[5]} Z`)},G_=function(e){const[i,n,l,o]=c(this,Bi),u=c(this,Lt).subarray(4,6),d=c(this,Lt).subarray(16,18),[f,g,m,v]=_(this,Le,Iu).call(this);e.push(`L${(u[0]-i)/l} ${(u[1]-n)/o} L${f} ${g} L${m} ${v} L${(d[0]-i)/l} ${(d[1]-n)/o}`)},X_=function(e){const i=c(this,Lt),[n,l,o,u]=c(this,Bi),[d,f,g,m]=_(this,Le,Iu).call(this),v=new Float64Array(36);return v.set([NaN,NaN,NaN,NaN,(i[2]-n)/o,(i[3]-l)/u,NaN,NaN,NaN,NaN,(i[4]-n)/o,(i[5]-l)/u,NaN,NaN,NaN,NaN,d,f,NaN,NaN,NaN,NaN,g,m,NaN,NaN,NaN,NaN,(i[16]-n)/o,(i[17]-l)/u,NaN,NaN,NaN,NaN,(i[14]-n)/o,(i[15]-l)/u],0),this.newFreeDrawOutline(v,e,c(this,Bi),c(this,dc),c(this,uc),c(this,hc))},Y_=function(e,i){const n=c(this,ws);return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],i),i+=6},V_=function(e,i){const n=c(this,Lt).subarray(4,6),l=c(this,Lt).subarray(16,18),[o,u,d,f]=c(this,Bi),[g,m,v,y]=_(this,Le,Iu).call(this);return e.set([NaN,NaN,NaN,NaN,(n[0]-o)/d,(n[1]-u)/f,NaN,NaN,NaN,NaN,g,m,NaN,NaN,NaN,NaN,v,y,NaN,NaN,NaN,NaN,(l[0]-o)/d,(l[1]-u)/f],i),i+=24},w(Tn,Jh,8),w(Tn,zg,2),w(Tn,Hg,c(Tn,Jh)+c(Tn,zg));let bg=Tn;var gc,gr,Bn,td,Pi,ed,me,Ti,ju,qu,Q_;class K_ extends I_{constructor(i,n,l,o,u,d){super();w(this,Ti);w(this,gc);w(this,gr,null);w(this,Bn);w(this,td);w(this,Pi);w(this,ed);w(this,me);S(this,me,i),S(this,Pi,n),S(this,gc,l),S(this,ed,o),S(this,Bn,u),S(this,td,d),_(this,Ti,Q_).call(this,d);const{x:f,y:g,width:m,height:v}=c(this,gr);for(let y=0,E=i.length;y<E;y+=2)i[y]=(i[y]-f)/m,i[y+1]=(i[y+1]-g)/v;for(let y=0,E=n.length;y<E;y+=2)n[y]=(n[y]-f)/m,n[y+1]=(n[y+1]-g)/v}toSVGPath(){const i=[`M${c(this,me)[4]} ${c(this,me)[5]}`];for(let n=6,l=c(this,me).length;n<l;n+=6){if(isNaN(c(this,me)[n])){i.push(`L${c(this,me)[n+4]} ${c(this,me)[n+5]}`);continue}i.push(`C${c(this,me)[n]} ${c(this,me)[n+1]} ${c(this,me)[n+2]} ${c(this,me)[n+3]} ${c(this,me)[n+4]} ${c(this,me)[n+5]}`)}return i.push("Z"),i.join(" ")}serialize([i,n,l,o],u){const d=l-i,f=o-n;let g,m;switch(u){case 0:g=_(this,Ti,ju).call(this,c(this,me),i,o,d,-f),m=_(this,Ti,ju).call(this,c(this,Pi),i,o,d,-f);break;case 90:g=_(this,Ti,qu).call(this,c(this,me),i,n,d,f),m=_(this,Ti,qu).call(this,c(this,Pi),i,n,d,f);break;case 180:g=_(this,Ti,ju).call(this,c(this,me),l,n,-d,f),m=_(this,Ti,ju).call(this,c(this,Pi),l,n,-d,f);break;case 270:g=_(this,Ti,qu).call(this,c(this,me),l,o,-d,-f),m=_(this,Ti,qu).call(this,c(this,Pi),l,o,-d,-f);break}return{outline:Array.from(g),points:[Array.from(m)]}}get box(){return c(this,gr)}newOutliner(i,n,l,o,u,d=0){return new bg(i,n,l,o,u,d)}getNewOutline(i,n){const{x:l,y:o,width:u,height:d}=c(this,gr),[f,g,m,v]=c(this,gc),y=u*m,E=d*v,x=l*m+f,C=o*v+g,L=this.newOutliner({x:c(this,Pi)[0]*y+x,y:c(this,Pi)[1]*E+C},c(this,gc),c(this,ed),i,c(this,td),n??c(this,Bn));for(let M=2;M<c(this,Pi).length;M+=2)L.add({x:c(this,Pi)[M]*y+x,y:c(this,Pi)[M+1]*E+C});return L.getOutlines()}get mustRemoveSelfIntersections(){return!0}}gc=new WeakMap,gr=new WeakMap,Bn=new WeakMap,td=new WeakMap,Pi=new WeakMap,ed=new WeakMap,me=new WeakMap,Ti=new WeakSet,ju=function(i,n,l,o,u){const d=new Float64Array(i.length);for(let f=0,g=i.length;f<g;f+=2)d[f]=n+i[f]*o,d[f+1]=l+i[f+1]*u;return d},qu=function(i,n,l,o,u){const d=new Float64Array(i.length);for(let f=0,g=i.length;f<g;f+=2)d[f]=n+i[f+1]*o,d[f+1]=l+i[f]*u;return d},Q_=function(i){const n=c(this,me);let l=n[4],o=n[5],u=l,d=o,f=l,g=o,m=l,v=o;const y=i?Math.max:Math.min;for(let M=6,H=n.length;M<H;M+=6){if(isNaN(n[M]))u=Math.min(u,n[M+4]),d=Math.min(d,n[M+5]),f=Math.max(f,n[M+4]),g=Math.max(g,n[M+5]),v<n[M+5]?(m=n[M+4],v=n[M+5]):v===n[M+5]&&(m=y(m,n[M+4]));else{const F=ct.bezierBoundingBox(l,o,...n.slice(M,M+6));u=Math.min(u,F[0]),d=Math.min(d,F[1]),f=Math.max(f,F[2]),g=Math.max(g,F[3]),v<F[3]?(m=F[2],v=F[3]):v===F[3]&&(m=y(m,F[2]))}l=n[M+4],o=n[M+5]}const E=u-c(this,Bn),x=d-c(this,Bn),C=f-u+2*c(this,Bn),L=g-d+2*c(this,Bn);S(this,gr,{x:E,y:x,width:C,height:L,lastPoint:[m,v]})};var id,Va,xs,di,Z_,ng,W_,$_,cb;class AS{constructor(e,i=0,n=0,l=!0){w(this,di);w(this,id);w(this,Va,[]);w(this,xs,[]);let o=1/0,u=-1/0,d=1/0,f=-1/0;const g=10**-4;for(const{x:L,y:M,width:H,height:F}of e){const I=Math.floor((L-i)/g)*g,j=Math.ceil((L+H+i)/g)*g,q=Math.floor((M-i)/g)*g,Q=Math.ceil((M+F+i)/g)*g,J=[I,q,Q,!0],at=[j,q,Q,!1];c(this,Va).push(J,at),o=Math.min(o,I),u=Math.max(u,j),d=Math.min(d,q),f=Math.max(f,Q)}const m=u-o+2*n,v=f-d+2*n,y=o-n,E=d-n,x=c(this,Va).at(l?-1:-2),C=[x[0],x[2]];for(const L of c(this,Va)){const[M,H,F]=L;L[0]=(M-y)/m,L[1]=(H-E)/v,L[2]=(F-E)/v}S(this,id,{x:y,y:E,width:m,height:v,lastPoint:C})}getOutlines(){c(this,Va).sort((i,n)=>i[0]-n[0]||i[1]-n[1]||i[2]-n[2]);const e=[];for(const i of c(this,Va))i[3]?(e.push(..._(this,di,cb).call(this,i)),_(this,di,W_).call(this,i)):(_(this,di,$_).call(this,i),e.push(..._(this,di,cb).call(this,i)));return _(this,di,Z_).call(this,e)}}id=new WeakMap,Va=new WeakMap,xs=new WeakMap,di=new WeakSet,Z_=function(e){const i=[],n=new Set;for(const u of e){const[d,f,g]=u;i.push([d,f,u],[d,g,u])}i.sort((u,d)=>u[1]-d[1]||u[0]-d[0]);for(let u=0,d=i.length;u<d;u+=2){const f=i[u][2],g=i[u+1][2];f.push(g),g.push(f),n.add(f),n.add(g)}const l=[];let o;for(;n.size>0;){const u=n.values().next().value;let[d,f,g,m,v]=u;n.delete(u);let y=d,E=f;for(o=[d,g],l.push(o);;){let x;if(n.has(m))x=m;else if(n.has(v))x=v;else break;n.delete(x),[d,f,g,m,v]=x,y!==d&&(o.push(y,E,d,E===f?f:g),y=d),E=E===f?g:f}o.push(y,E)}return new rM(l,c(this,id))},ng=function(e){const i=c(this,xs);let n=0,l=i.length-1;for(;n<=l;){const o=n+l>>1,u=i[o][0];if(u===e)return o;u<e?n=o+1:l=o-1}return l+1},W_=function([,e,i]){const n=_(this,di,ng).call(this,e);c(this,xs).splice(n,0,[e,i])},$_=function([,e,i]){const n=_(this,di,ng).call(this,e);for(let l=n;l<c(this,xs).length;l++){const[o,u]=c(this,xs)[l];if(o!==e)break;if(o===e&&u===i){c(this,xs).splice(l,1);return}}for(let l=n-1;l>=0;l--){const[o,u]=c(this,xs)[l];if(o!==e)break;if(o===e&&u===i){c(this,xs).splice(l,1);return}}},cb=function(e){const[i,n,l]=e,o=[[i,n,l]],u=_(this,di,ng).call(this,l);for(let d=0;d<u;d++){const[f,g]=c(this,xs)[d];for(let m=0,v=o.length;m<v;m++){const[,y,E]=o[m];if(!(g<=y||E<=f)){if(y>=f){if(E>g)o[m][1]=g;else{if(v===1)return[];o.splice(m,1),m--,v--}continue}o[m][2]=f,E>g&&o.push([i,g,E])}}}return o};var sd,pc;class rM extends I_{constructor(i,n){super();w(this,sd);w(this,pc);S(this,pc,i),S(this,sd,n)}toSVGPath(){const i=[];for(const n of c(this,pc)){let[l,o]=n;i.push(`M${l} ${o}`);for(let u=2;u<n.length;u+=2){const d=n[u],f=n[u+1];d===l?(i.push(`V${f}`),o=f):f===o&&(i.push(`H${d}`),l=d)}i.push("Z")}return i.join(" ")}serialize([i,n,l,o],u){const d=[],f=l-i,g=o-n;for(const m of c(this,pc)){const v=new Array(m.length);for(let y=0;y<m.length;y+=2)v[y]=i+m[y]*f,v[y+1]=o-m[y+1]*g;d.push(v)}return d}get box(){return c(this,sd)}get classNamesForDrawing(){return["highlight"]}get classNamesForOutlining(){return["highlightOutline"]}}sd=new WeakMap,pc=new WeakMap;class ub extends bg{newFreeDrawOutline(e,i,n,l,o,u){return new oM(e,i,n,l,o,u)}get classNamesForDrawing(){return["highlight","free"]}}class oM extends K_{get classNamesForDrawing(){return["highlight","free"]}get classNamesForOutlining(){return["highlightOutline","free"]}newOutliner(e,i,n,l,o,u=0){return new ub(e,i,n,l,o,u)}}var Cs,pr,mc,Me,nd,bc,ad,ld,Ka,Ms,vc,rd,$t,hb,db,fb,wl,J_,xa;const yi=class yi{constructor({editor:e=null,uiManager:i=null}){w(this,$t);w(this,Cs,null);w(this,pr,null);w(this,mc);w(this,Me,null);w(this,nd,!1);w(this,bc,!1);w(this,ad,null);w(this,ld);w(this,Ka,null);w(this,Ms,null);w(this,vc);var n;e?(S(this,bc,!1),S(this,vc,vt.HIGHLIGHT_COLOR),S(this,ad,e)):(S(this,bc,!0),S(this,vc,vt.HIGHLIGHT_DEFAULT_COLOR)),S(this,Ms,(e==null?void 0:e._uiManager)||i),S(this,ld,c(this,Ms)._eventBus),S(this,mc,(e==null?void 0:e.color)||((n=c(this,Ms))==null?void 0:n.highlightColors.values().next().value)||"#FFFF98"),c(yi,rd)||S(yi,rd,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return Ft(this,"_keyboardManager",new pd([[["Escape","mac+Escape"],yi.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],yi.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],yi.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],yi.prototype._moveToPrevious],[["Home","mac+Home"],yi.prototype._moveToBeginning],[["End","mac+End"],yi.prototype._moveToEnd]]))}renderButton(){const e=S(this,Cs,document.createElement("button"));e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.setAttribute("aria-haspopup",!0);const i=c(this,Ms)._signal;e.addEventListener("click",_(this,$t,wl).bind(this),{signal:i}),e.addEventListener("keydown",_(this,$t,fb).bind(this),{signal:i});const n=S(this,pr,document.createElement("span"));return n.className="swatch",n.setAttribute("aria-hidden",!0),n.style.backgroundColor=c(this,mc),e.append(n),e}renderMainDropdown(){const e=S(this,Me,_(this,$t,hb).call(this));return e.setAttribute("aria-orientation","horizontal"),e.setAttribute("aria-labelledby","highlightColorPickerLabel"),e}_colorSelectFromKeyboard(e){if(e.target===c(this,Cs)){_(this,$t,wl).call(this,e);return}const i=e.target.getAttribute("data-color");i&&_(this,$t,db).call(this,i,e)}_moveToNext(e){var i,n;if(!c(this,$t,xa)){_(this,$t,wl).call(this,e);return}if(e.target===c(this,Cs)){(i=c(this,Me).firstChild)==null||i.focus();return}(n=e.target.nextSibling)==null||n.focus()}_moveToPrevious(e){var i,n;if(e.target===((i=c(this,Me))==null?void 0:i.firstChild)||e.target===c(this,Cs)){c(this,$t,xa)&&this._hideDropdownFromKeyboard();return}c(this,$t,xa)||_(this,$t,wl).call(this,e),(n=e.target.previousSibling)==null||n.focus()}_moveToBeginning(e){var i;if(!c(this,$t,xa)){_(this,$t,wl).call(this,e);return}(i=c(this,Me).firstChild)==null||i.focus()}_moveToEnd(e){var i;if(!c(this,$t,xa)){_(this,$t,wl).call(this,e);return}(i=c(this,Me).lastChild)==null||i.focus()}hideDropdown(){var e,i;(e=c(this,Me))==null||e.classList.add("hidden"),(i=c(this,Ka))==null||i.abort(),S(this,Ka,null)}_hideDropdownFromKeyboard(){var e;if(!c(this,bc)){if(!c(this,$t,xa)){(e=c(this,ad))==null||e.unselect();return}this.hideDropdown(),c(this,Cs).focus({preventScroll:!0,focusVisible:c(this,nd)})}}updateColor(e){if(c(this,pr)&&(c(this,pr).style.backgroundColor=e),!c(this,Me))return;const i=c(this,Ms).highlightColors.values();for(const n of c(this,Me).children)n.setAttribute("aria-selected",i.next().value===e)}destroy(){var e,i;(e=c(this,Cs))==null||e.remove(),S(this,Cs,null),S(this,pr,null),(i=c(this,Me))==null||i.remove(),S(this,Me,null)}};Cs=new WeakMap,pr=new WeakMap,mc=new WeakMap,Me=new WeakMap,nd=new WeakMap,bc=new WeakMap,ad=new WeakMap,ld=new WeakMap,Ka=new WeakMap,Ms=new WeakMap,vc=new WeakMap,rd=new WeakMap,$t=new WeakSet,hb=function(){const e=document.createElement("div"),i=c(this,Ms)._signal;e.addEventListener("contextmenu",hs,{signal:i}),e.className="dropdown",e.role="listbox",e.setAttribute("aria-multiselectable",!1),e.setAttribute("aria-orientation","vertical"),e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[n,l]of c(this,Ms).highlightColors){const o=document.createElement("button");o.tabIndex="0",o.role="option",o.setAttribute("data-color",l),o.title=n,o.setAttribute("data-l10n-id",c(yi,rd)[n]);const u=document.createElement("span");o.append(u),u.className="swatch",u.style.backgroundColor=l,o.setAttribute("aria-selected",l===c(this,mc)),o.addEventListener("click",_(this,$t,db).bind(this,l),{signal:i}),e.append(o)}return e.addEventListener("keydown",_(this,$t,fb).bind(this),{signal:i}),e},db=function(e,i){i.stopPropagation(),c(this,ld).dispatch("switchannotationeditorparams",{source:this,type:c(this,vc),value:e})},fb=function(e){yi._keyboardManager.exec(this,e)},wl=function(e){if(c(this,$t,xa)){this.hideDropdown();return}if(S(this,nd,e.detail===0),c(this,Ka)||(S(this,Ka,new AbortController),window.addEventListener("pointerdown",_(this,$t,J_).bind(this),{signal:c(this,Ms).combinedSignal(c(this,Ka))})),c(this,Me)){c(this,Me).classList.remove("hidden");return}const i=S(this,Me,_(this,$t,hb).call(this));c(this,Cs).append(i)},J_=function(e){var i;(i=c(this,Me))!=null&&i.contains(e.target)||this.hideDropdown()},xa=function(){return c(this,Me)&&!c(this,Me).classList.contains("hidden")},w(yi,rd,null);let vg=yi;var yc,od,Pn,mr,Ac,as,cd,ud,br,Rs,ii,_i,Sc,In,Re,_c,ls,hd,St,gb,ag,tE,eE,iE,pb,xl,cs,xo,sE,lg,Gu,nE,aE,lE,rE,oE;const It=class It extends Kt{constructor(i){super({...i,name:"highlightEditor"});w(this,St);w(this,yc,null);w(this,od,0);w(this,Pn);w(this,mr,null);w(this,Ac,null);w(this,as,null);w(this,cd,null);w(this,ud,0);w(this,br,null);w(this,Rs,null);w(this,ii,null);w(this,_i,!1);w(this,Sc,null);w(this,In);w(this,Re,null);w(this,_c,"");w(this,ls);w(this,hd,"");this.color=i.color||It._defaultColor,S(this,ls,i.thickness||It._defaultThickness),S(this,In,i.opacity||It._defaultOpacity),S(this,Pn,i.boxes||null),S(this,hd,i.methodOfCreation||""),S(this,_c,i.text||""),this._isDraggable=!1,i.highlightId>-1?(S(this,_i,!0),_(this,St,ag).call(this,i),_(this,St,xl).call(this)):c(this,Pn)&&(S(this,yc,i.anchorNode),S(this,od,i.anchorOffset),S(this,cd,i.focusNode),S(this,ud,i.focusOffset),_(this,St,gb).call(this),_(this,St,xl).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const i=It.prototype;return Ft(this,"_keyboardManager",new pd([[["ArrowLeft","mac+ArrowLeft"],i._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],i._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],i._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],i._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:c(this,_i)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:c(this,ls),methodOfCreation:c(this,hd)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(i){return{numberOfColors:i.get("color").size}}static initialize(i,n){var l;Kt.initialize(i,n),It._defaultColor||(It._defaultColor=((l=n.highlightColors)==null?void 0:l.values().next().value)||"#fff066")}static updateDefaultParams(i,n){switch(i){case vt.HIGHLIGHT_DEFAULT_COLOR:It._defaultColor=n;break;case vt.HIGHLIGHT_THICKNESS:It._defaultThickness=n;break}}translateInPage(i,n){}get toolbarPosition(){return c(this,Sc)}updateParams(i,n){switch(i){case vt.HIGHLIGHT_COLOR:_(this,St,tE).call(this,n);break;case vt.HIGHLIGHT_THICKNESS:_(this,St,eE).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[vt.HIGHLIGHT_DEFAULT_COLOR,It._defaultColor],[vt.HIGHLIGHT_THICKNESS,It._defaultThickness]]}get propertiesToUpdate(){return[[vt.HIGHLIGHT_COLOR,this.color||It._defaultColor],[vt.HIGHLIGHT_THICKNESS,c(this,ls)||It._defaultThickness],[vt.HIGHLIGHT_FREE,c(this,_i)]]}async addEditToolbar(){const i=await super.addEditToolbar();return i?(this._uiManager.highlightColors&&(S(this,Ac,new vg({editor:this})),i.addColorPicker(c(this,Ac))),i):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(_(this,St,Gu).call(this))}getBaseTranslation(){return[0,0]}getRect(i,n){return super.getRect(i,n,_(this,St,Gu).call(this))}onceAdded(){this.annotationElementId||this.parent.addUndoableEditor(this),this.div.focus()}remove(){_(this,St,pb).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(_(this,St,xl).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(i){var l;let n=!1;this.parent&&!i?_(this,St,pb).call(this):i&&(_(this,St,xl).call(this,i),n=!this.parent&&((l=this.div)==null?void 0:l.classList.contains("selectedEditor"))),super.setParent(i),this.show(this._isVisible),n&&this.select()}rotate(i){var o,u,d;const{drawLayer:n}=this.parent;let l;c(this,_i)?(i=(i-this.rotation+360)%360,l=_(o=It,cs,xo).call(o,c(this,Rs).box,i)):l=_(u=It,cs,xo).call(u,this,i),n.rotate(c(this,ii),i),n.rotate(c(this,Re),i),n.updateBox(c(this,ii),l),n.updateBox(c(this,Re),_(d=It,cs,xo).call(d,c(this,as).box,i))}render(){if(this.div)return this.div;const i=super.render();c(this,_c)&&(i.setAttribute("aria-label",c(this,_c)),i.setAttribute("role","mark")),c(this,_i)?i.classList.add("free"):this.div.addEventListener("keydown",_(this,St,sE).bind(this),{signal:this._uiManager._signal});const n=S(this,br,document.createElement("div"));i.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",n.style.clipPath=c(this,mr);const[l,o]=this.parentDimensions;return this.setDims(this.width*l,this.height*o),pg(this,c(this,br),["pointerover","pointerleave"]),this.enableEditing(),i}pointerover(){this.isSelected||this.parent.drawLayer.addClass(c(this,Re),"hovered")}pointerleave(){this.isSelected||this.parent.drawLayer.removeClass(c(this,Re),"hovered")}_moveCaret(i){switch(this.parent.unselect(this),i){case 0:case 2:_(this,St,lg).call(this,!0);break;case 1:case 3:_(this,St,lg).call(this,!1);break}}select(){var i,n;super.select(),c(this,Re)&&((i=this.parent)==null||i.drawLayer.removeClass(c(this,Re),"hovered"),(n=this.parent)==null||n.drawLayer.addClass(c(this,Re),"selected"))}unselect(){var i;super.unselect(),c(this,Re)&&((i=this.parent)==null||i.drawLayer.removeClass(c(this,Re),"selected"),c(this,_i)||_(this,St,lg).call(this,!1))}get _mustFixPosition(){return!c(this,_i)}show(i=this._isVisible){super.show(i),this.parent&&(this.parent.drawLayer.show(c(this,ii),i),this.parent.drawLayer.show(c(this,Re),i))}static startHighlighting(i,n,{target:l,x:o,y:u}){const{x:d,y:f,width:g,height:m}=l.getBoundingClientRect(),v=new AbortController,y=i.combinedSignal(v),E=C=>{C.preventDefault(),C.stopPropagation()},x=C=>{v.abort(),_(this,cs,rE).call(this,i,C)};window.addEventListener("blur",x,{signal:y}),window.addEventListener("pointerup",x,{signal:y}),window.addEventListener("pointerdown",E,{capture:!0,passive:!1,signal:y}),window.addEventListener("contextmenu",hs,{signal:y}),l.addEventListener("pointermove",_(this,cs,lE).bind(this,i),{signal:y}),this._freeHighlight=new ub({x:o,y:u},[d,f,g,m],i.scale,this._defaultThickness/2,n,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=i.drawLayer.draw(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static async deserialize(i,n,l){var C,L,M,H;let o=null;if(i instanceof N_){const{data:{quadPoints:F,rect:I,rotation:j,id:q,color:Q,opacity:J,popupRef:at},parent:{page:{pageNumber:yt}}}=i;o=i={annotationType:Et.HIGHLIGHT,color:Array.from(Q),opacity:J,quadPoints:F,boxes:null,pageIndex:yt-1,rect:I.slice(0),rotation:j,id:q,deleted:!1,popupRef:at}}else if(i instanceof Kb){const{data:{inkLists:F,rect:I,rotation:j,id:q,color:Q,borderStyle:{rawWidth:J},popupRef:at},parent:{page:{pageNumber:yt}}}=i;o=i={annotationType:Et.HIGHLIGHT,color:Array.from(Q),thickness:J,inkLists:F,boxes:null,pageIndex:yt-1,rect:I.slice(0),rotation:j,id:q,deleted:!1,popupRef:at}}const{color:u,quadPoints:d,inkLists:f,opacity:g}=i,m=await super.deserialize(i,n,l);m.color=ct.makeHexColor(...u),S(m,In,g||1),f&&S(m,ls,i.thickness),m.annotationElementId=i.id||null,m._initialData=o;const[v,y]=m.pageDimensions,[E,x]=m.pageTranslation;if(d){const F=S(m,Pn,[]);for(let I=0;I<d.length;I+=8)F.push({x:(d[I]-E)/v,y:1-(d[I+1]-x)/y,width:(d[I+2]-d[I])/v,height:(d[I+1]-d[I+5])/y});_(C=m,St,gb).call(C),_(L=m,St,xl).call(L),m.rotate(m.rotation)}else if(f){S(m,_i,!0);const F=f[0],I={x:F[0]-E,y:y-(F[1]-x)},j=new ub(I,[0,0,v,y],1,c(m,ls)/2,!0,.001);for(let J=0,at=F.length;J<at;J+=2)I.x=F[J]-E,I.y=y-(F[J+1]-x),j.add(I);const{id:q,clipPathId:Q}=n.drawLayer.draw(j,m.color,m._defaultOpacity,!0);_(M=m,St,ag).call(M,{highlightOutlines:j.getOutlines(),highlightId:q,clipPathId:Q}),_(H=m,St,xl).call(H)}return m}serialize(i=!1){if(this.isEmpty()||i)return null;if(this.deleted)return this.serializeDeleted();const n=this.getRect(0,0),l=Kt._colorManager.convert(this.color),o={annotationType:Et.HIGHLIGHT,color:l,opacity:c(this,In),thickness:c(this,ls),quadPoints:_(this,St,nE).call(this),outlines:_(this,St,aE).call(this,n),pageIndex:this.pageIndex,rect:n,rotation:_(this,St,Gu).call(this),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!_(this,St,oE).call(this,o)?null:(o.id=this.annotationElementId,o)}renderAnnotationElement(i){return i.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};yc=new WeakMap,od=new WeakMap,Pn=new WeakMap,mr=new WeakMap,Ac=new WeakMap,as=new WeakMap,cd=new WeakMap,ud=new WeakMap,br=new WeakMap,Rs=new WeakMap,ii=new WeakMap,_i=new WeakMap,Sc=new WeakMap,In=new WeakMap,Re=new WeakMap,_c=new WeakMap,ls=new WeakMap,hd=new WeakMap,St=new WeakSet,gb=function(){const i=new AS(c(this,Pn),.001);S(this,Rs,i.getOutlines()),{x:this.x,y:this.y,width:this.width,height:this.height}=c(this,Rs).box;const n=new AS(c(this,Pn),.0025,.001,this._uiManager.direction==="ltr");S(this,as,n.getOutlines());const{lastPoint:l}=c(this,as).box;S(this,Sc,[(l[0]-this.x)/this.width,(l[1]-this.y)/this.height])},ag=function({highlightOutlines:i,highlightId:n,clipPathId:l}){var v,y;if(S(this,Rs,i),S(this,as,i.getNewOutline(c(this,ls)/2+1.5,.0025)),n>=0)S(this,ii,n),S(this,mr,l),this.parent.drawLayer.finalizeLine(n,i),S(this,Re,this.parent.drawLayer.drawOutline(c(this,as)));else if(this.parent){const E=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(c(this,ii),i),this.parent.drawLayer.updateBox(c(this,ii),_(v=It,cs,xo).call(v,c(this,Rs).box,(E-this.rotation+360)%360)),this.parent.drawLayer.updateLine(c(this,Re),c(this,as)),this.parent.drawLayer.updateBox(c(this,Re),_(y=It,cs,xo).call(y,c(this,as).box,E))}const{x:u,y:d,width:f,height:g}=i.box;switch(this.rotation){case 0:this.x=u,this.y=d,this.width=f,this.height=g;break;case 90:{const[E,x]=this.parentDimensions;this.x=d,this.y=1-u,this.width=f*x/E,this.height=g*E/x;break}case 180:this.x=1-u,this.y=1-d,this.width=f,this.height=g;break;case 270:{const[E,x]=this.parentDimensions;this.x=1-d,this.y=u,this.width=f*x/E,this.height=g*E/x;break}}const{lastPoint:m}=c(this,as).box;S(this,Sc,[(m[0]-u)/f,(m[1]-d)/g])},tE=function(i){const n=(u,d)=>{var f,g,m;this.color=u,(f=this.parent)==null||f.drawLayer.changeColor(c(this,ii),u),(g=c(this,Ac))==null||g.updateColor(u),S(this,In,d),(m=this.parent)==null||m.drawLayer.changeOpacity(c(this,ii),d)},l=this.color,o=c(this,In);this.addCommands({cmd:n.bind(this,i,It._defaultOpacity),undo:n.bind(this,l,o),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:vt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(i)},!0)},eE=function(i){const n=c(this,ls),l=o=>{S(this,ls,o),_(this,St,iE).call(this,o)};this.addCommands({cmd:l.bind(this,i),undo:l.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:vt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:i},!0)},iE=function(i){if(!c(this,_i))return;_(this,St,ag).call(this,{highlightOutlines:c(this,Rs).getNewOutline(i/2)}),this.fixAndSetPosition();const[n,l]=this.parentDimensions;this.setDims(this.width*n,this.height*l)},pb=function(){c(this,ii)===null||!this.parent||(this.parent.drawLayer.remove(c(this,ii)),S(this,ii,null),this.parent.drawLayer.remove(c(this,Re)),S(this,Re,null))},xl=function(i=this.parent){c(this,ii)===null&&({id:li(this,ii)._,clipPathId:li(this,mr)._}=i.drawLayer.draw(c(this,Rs),this.color,c(this,In)),S(this,Re,i.drawLayer.drawOutline(c(this,as))),c(this,br)&&(c(this,br).style.clipPath=c(this,mr)))},cs=new WeakSet,xo=function({x:i,y:n,width:l,height:o},u){switch(u){case 90:return{x:1-n-o,y:i,width:o,height:l};case 180:return{x:1-i-l,y:1-n-o,width:l,height:o};case 270:return{x:n,y:1-i-l,width:o,height:l}}return{x:i,y:n,width:l,height:o}},sE=function(i){It._keyboardManager.exec(this,i)},lg=function(i){if(!c(this,yc))return;const n=window.getSelection();i?n.setPosition(c(this,yc),c(this,od)):n.setPosition(c(this,cd),c(this,ud))},Gu=function(){return c(this,_i)?this.rotation:0},nE=function(){if(c(this,_i))return null;const[i,n]=this.pageDimensions,[l,o]=this.pageTranslation,u=c(this,Pn),d=new Float32Array(u.length*8);let f=0;for(const{x:g,y:m,width:v,height:y}of u){const E=g*i+l,x=(1-m-y)*n+o;d[f]=d[f+4]=E,d[f+1]=d[f+3]=x,d[f+2]=d[f+6]=E+v*i,d[f+5]=d[f+7]=x+y*n,f+=8}return d},aE=function(i){return c(this,Rs).serialize(i,_(this,St,Gu).call(this))},lE=function(i,n){this._freeHighlight.add(n)&&i.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)},rE=function(i,n){this._freeHighlight.isEmpty()?i.drawLayer.remove(this._freeHighlightId):i.createAndAddNewEditor(n,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},oE=function(i){const{color:n}=this._initialData;return i.color.some((l,o)=>l!==n[o])},w(It,cs),bt(It,"_defaultColor",null),bt(It,"_defaultOpacity",1),bt(It,"_defaultThickness",12),bt(It,"_type","highlight"),bt(It,"_editorType",Et.HIGHLIGHT),bt(It,"_freeHighlightId",-1),bt(It,"_freeHighlight",null),bt(It,"_freeHighlightClipId","");let yg=It;var vr,yr,$s,jn,rs,Ar,Sr,_r,qn,Ec,Er,Tr,Qa,tt,cE,uE,hE,dE,bb,fE,vb,gE,pE,mE,bE,vE,Cl,yb,Ab,Sb,rg,og,Co,_b,cg,ta,yE,Eb,AE,SE,Tb,ug,Xu;const re=class re extends Kt{constructor(i){super({...i,name:"inkEditor"});w(this,tt);w(this,vr,0);w(this,yr,0);w(this,$s,null);w(this,jn,new Path2D);w(this,rs,!1);w(this,Ar,null);w(this,Sr,!1);w(this,_r,!1);w(this,qn,null);w(this,Ec,null);w(this,Er,0);w(this,Tr,0);w(this,Qa,null);this.color=i.color||null,this.thickness=i.thickness||null,this.opacity=i.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(i,n){Kt.initialize(i,n)}static updateDefaultParams(i,n){switch(i){case vt.INK_THICKNESS:re._defaultThickness=n;break;case vt.INK_COLOR:re._defaultColor=n;break;case vt.INK_OPACITY:re._defaultOpacity=n/100;break}}updateParams(i,n){switch(i){case vt.INK_THICKNESS:_(this,tt,cE).call(this,n);break;case vt.INK_COLOR:_(this,tt,uE).call(this,n);break;case vt.INK_OPACITY:_(this,tt,hE).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[vt.INK_THICKNESS,re._defaultThickness],[vt.INK_COLOR,re._defaultColor||Kt._defaultLineColor],[vt.INK_OPACITY,Math.round(re._defaultOpacity*100)]]}get propertiesToUpdate(){return[[vt.INK_THICKNESS,this.thickness||re._defaultThickness],[vt.INK_COLOR,this.color||re._defaultColor||Kt._defaultLineColor],[vt.INK_OPACITY,Math.round(100*(this.opacity??re._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(_(this,tt,rg).call(this),_(this,tt,og).call(this)),this.isAttachedToDOM||(this.parent.add(this),_(this,tt,Co).call(this)),_(this,tt,Xu).call(this)))}remove(){var i;this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,c(this,$s)&&(clearTimeout(c(this,$s)),S(this,$s,null)),(i=c(this,qn))==null||i.disconnect(),S(this,qn,null),super.remove())}setParent(i){!this.parent&&i?this._uiManager.removeShouldRescale(this):this.parent&&i===null&&this._uiManager.addShouldRescale(this),super.setParent(i)}onScaleChanging(){const[i,n]=this.parentDimensions,l=this.width*i,o=this.height*n;this.setDimensions(l,o)}enableEditMode(){c(this,rs)||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,_(this,tt,yb).call(this))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),_(this,tt,Ab).call(this))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){c(this,rs)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),S(this,rs,!0),this.div.classList.add("disabled"),_(this,tt,Xu).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(i){this._focusEventsAllowed&&(super.focusin(i),this.enableEditMode())}canvasPointerdown(i){i.button!==0||!this.isInEditMode()||c(this,rs)||(this.setInForeground(),i.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),_(this,tt,fE).call(this,i.offsetX,i.offsetY))}canvasPointermove(i){i.preventDefault(),_(this,tt,vb).call(this,i.offsetX,i.offsetY)}canvasPointerup(i){i.preventDefault(),_(this,tt,Sb).call(this,i)}canvasPointerleave(i){_(this,tt,Sb).call(this,i)}get isResizable(){return!this.isEmpty()&&c(this,rs)}render(){if(this.div)return this.div;let i,n;this.width&&(i=this.x,n=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[l,o,u,d]=_(this,tt,dE).call(this);if(this.setAt(l,o,0,0),this.setDims(u,d),_(this,tt,rg).call(this),this.width){const[f,g]=this.parentDimensions;this.setAspectRatio(this.width*f,this.height*g),this.setAt(i*f,n*g,this.width*f,this.height*g),S(this,_r,!0),_(this,tt,Co).call(this),this.setDims(this.width*f,this.height*g),_(this,tt,Cl).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return _(this,tt,og).call(this),this.div}setDimensions(i,n){const l=Math.round(i),o=Math.round(n);if(c(this,Er)===l&&c(this,Tr)===o)return;S(this,Er,l),S(this,Tr,o),this.canvas.style.visibility="hidden";const[u,d]=this.parentDimensions;this.width=i/u,this.height=n/d,this.fixAndSetPosition(),c(this,rs)&&_(this,tt,_b).call(this,i,n),_(this,tt,Co).call(this),_(this,tt,Cl).call(this),this.canvas.style.visibility="visible",this.fixDims()}static async deserialize(i,n,l){var L,M,H;if(i instanceof Kb)return null;const o=await super.deserialize(i,n,l);o.thickness=i.thickness,o.color=ct.makeHexColor(...i.color),o.opacity=i.opacity;const[u,d]=o.pageDimensions,f=o.width*u,g=o.height*d,m=o.parentScale,v=i.thickness/2;S(o,rs,!0),S(o,Er,Math.round(f)),S(o,Tr,Math.round(g));const{paths:y,rect:E,rotation:x}=i;for(let{bezier:F}of y){F=_(L=re,ta,AE).call(L,F,E,x);const I=[];o.paths.push(I);let j=m*(F[0]-v),q=m*(F[1]-v);for(let J=2,at=F.length;J<at;J+=6){const yt=m*(F[J]-v),lt=m*(F[J+1]-v),pt=m*(F[J+2]-v),wt=m*(F[J+3]-v),Ot=m*(F[J+4]-v),mt=m*(F[J+5]-v);I.push([[j,q],[yt,lt],[pt,wt],[Ot,mt]]),j=Ot,q=mt}const Q=_(this,ta,yE).call(this,I);o.bezierPath2D.push(Q)}const C=_(M=o,tt,Tb).call(M);return S(o,yr,Math.max(Kt.MIN_SIZE,C[2]-C[0])),S(o,vr,Math.max(Kt.MIN_SIZE,C[3]-C[1])),_(H=o,tt,_b).call(H,f,g),o}serialize(){if(this.isEmpty())return null;const i=this.getRect(0,0),n=Kt._colorManager.convert(this.ctx.strokeStyle);return{annotationType:Et.INK,color:n,thickness:this.thickness,opacity:this.opacity,paths:_(this,tt,SE).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,i),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}};vr=new WeakMap,yr=new WeakMap,$s=new WeakMap,jn=new WeakMap,rs=new WeakMap,Ar=new WeakMap,Sr=new WeakMap,_r=new WeakMap,qn=new WeakMap,Ec=new WeakMap,Er=new WeakMap,Tr=new WeakMap,Qa=new WeakMap,tt=new WeakSet,cE=function(i){const n=o=>{this.thickness=o,_(this,tt,Xu).call(this)},l=this.thickness;this.addCommands({cmd:n.bind(this,i),undo:n.bind(this,l),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:vt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},uE=function(i){const n=o=>{this.color=o,_(this,tt,Cl).call(this)},l=this.color;this.addCommands({cmd:n.bind(this,i),undo:n.bind(this,l),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:vt.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},hE=function(i){const n=o=>{this.opacity=o,_(this,tt,Cl).call(this)};i/=100;const l=this.opacity;this.addCommands({cmd:n.bind(this,i),undo:n.bind(this,l),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:vt.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},dE=function(){const{parentRotation:i,parentDimensions:[n,l]}=this;switch(i){case 90:return[0,l,l,n];case 180:return[n,l,n,l];case 270:return[n,0,l,n];default:return[0,0,n,l]}},bb=function(){const{ctx:i,color:n,opacity:l,thickness:o,parentScale:u,scaleFactor:d}=this;i.lineWidth=o*u/d,i.lineCap="round",i.lineJoin="round",i.miterLimit=10,i.strokeStyle=`${n}${Dx(l)}`},fE=function(i,n){this.canvas.addEventListener("contextmenu",hs,{signal:this._uiManager._signal}),_(this,tt,Ab).call(this),S(this,Ar,new AbortController);const l=this._uiManager.combinedSignal(c(this,Ar));this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:l}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:l}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:l}),this.isEditing=!0,c(this,_r)||(S(this,_r,!0),_(this,tt,Co).call(this),this.thickness||(this.thickness=re._defaultThickness),this.color||(this.color=re._defaultColor||Kt._defaultLineColor),this.opacity??(this.opacity=re._defaultOpacity)),this.currentPath.push([i,n]),S(this,Sr,!1),_(this,tt,bb).call(this),S(this,Qa,()=>{_(this,tt,mE).call(this),c(this,Qa)&&window.requestAnimationFrame(c(this,Qa))}),window.requestAnimationFrame(c(this,Qa))},vb=function(i,n){const[l,o]=this.currentPath.at(-1);if(this.currentPath.length>1&&i===l&&n===o)return;const u=this.currentPath;let d=c(this,jn);if(u.push([i,n]),S(this,Sr,!0),u.length<=2){d.moveTo(...u[0]),d.lineTo(i,n);return}u.length===3&&(S(this,jn,d=new Path2D),d.moveTo(...u[0])),_(this,tt,bE).call(this,d,...u.at(-3),...u.at(-2),i,n)},gE=function(){if(this.currentPath.length===0)return;const i=this.currentPath.at(-1);c(this,jn).lineTo(...i)},pE=function(i,n){S(this,Qa,null),i=Math.min(Math.max(i,0),this.canvas.width),n=Math.min(Math.max(n,0),this.canvas.height),_(this,tt,vb).call(this,i,n),_(this,tt,gE).call(this);let l;if(this.currentPath.length!==1)l=_(this,tt,vE).call(this);else{const g=[i,n];l=[[g,g.slice(),g.slice(),g]]}const o=c(this,jn),u=this.currentPath;this.currentPath=[],S(this,jn,new Path2D);const d=()=>{this.allRawPaths.push(u),this.paths.push(l),this.bezierPath2D.push(o),this._uiManager.rebuild(this)},f=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(_(this,tt,rg).call(this),_(this,tt,og).call(this)),_(this,tt,Xu).call(this))};this.addCommands({cmd:d,undo:f,mustExec:!0})},mE=function(){if(!c(this,Sr))return;S(this,Sr,!1);const i=Math.ceil(this.thickness*this.parentScale),n=this.currentPath.slice(-3),l=n.map(d=>d[0]),o=n.map(d=>d[1]);Math.min(...l)-i,Math.max(...l)+i,Math.min(...o)-i,Math.max(...o)+i;const{ctx:u}=this;u.save(),u.clearRect(0,0,this.canvas.width,this.canvas.height);for(const d of this.bezierPath2D)u.stroke(d);u.stroke(c(this,jn)),u.restore()},bE=function(i,n,l,o,u,d,f){const g=(n+o)/2,m=(l+u)/2,v=(o+d)/2,y=(u+f)/2;i.bezierCurveTo(g+2*(o-g)/3,m+2*(u-m)/3,v+2*(o-v)/3,y+2*(u-y)/3,v,y)},vE=function(){const i=this.currentPath;if(i.length<=2)return[[i[0],i[0],i.at(-1),i.at(-1)]];const n=[];let l,[o,u]=i[0];for(l=1;l<i.length-2;l++){const[E,x]=i[l],[C,L]=i[l+1],M=(E+C)/2,H=(x+L)/2,F=[o+2*(E-o)/3,u+2*(x-u)/3],I=[M+2*(E-M)/3,H+2*(x-H)/3];n.push([[o,u],F,I,[M,H]]),[o,u]=[M,H]}const[d,f]=i[l],[g,m]=i[l+1],v=[o+2*(d-o)/3,u+2*(f-u)/3],y=[g+2*(d-g)/3,m+2*(f-m)/3];return n.push([[o,u],v,y,[g,m]]),n},Cl=function(){if(this.isEmpty()){_(this,tt,cg).call(this);return}_(this,tt,bb).call(this);const{canvas:i,ctx:n}=this;n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,i.width,i.height),_(this,tt,cg).call(this);for(const l of this.bezierPath2D)n.stroke(l)},yb=function(){if(c(this,Ec))return;S(this,Ec,new AbortController);const i=this._uiManager.combinedSignal(c(this,Ec));this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:i})},Ab=function(){var i;(i=this.pointerdownAC)==null||i.abort(),this.pointerdownAC=null},Sb=function(i){var n;(n=c(this,Ar))==null||n.abort(),S(this,Ar,null),_(this,tt,yb).call(this),c(this,$s)&&clearTimeout(c(this,$s)),S(this,$s,setTimeout(()=>{S(this,$s,null),this.canvas.removeEventListener("contextmenu",hs)},10)),_(this,tt,pE).call(this,i.offsetX,i.offsetY),this.addToAnnotationStorage(),this.setInBackground()},rg=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},og=function(){S(this,qn,new ResizeObserver(i=>{const n=i[0].contentRect;n.width&&n.height&&this.setDimensions(n.width,n.height)})),c(this,qn).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var i;(i=c(this,qn))==null||i.disconnect(),S(this,qn,null)},{once:!0})},Co=function(){if(!c(this,_r))return;const[i,n]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*i),this.canvas.height=Math.ceil(this.height*n),_(this,tt,cg).call(this)},_b=function(i,n){const l=_(this,tt,ug).call(this),o=(i-l)/c(this,yr),u=(n-l)/c(this,vr);this.scaleFactor=Math.min(o,u)},cg=function(){const i=_(this,tt,ug).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+i,this.translationY*this.scaleFactor+i)},ta=new WeakSet,yE=function(i){const n=new Path2D;for(let l=0,o=i.length;l<o;l++){const[u,d,f,g]=i[l];l===0&&n.moveTo(...u),n.bezierCurveTo(d[0],d[1],f[0],f[1],g[0],g[1])}return n},Eb=function(i,n,l){const[o,u,d,f]=n;switch(l){case 0:for(let g=0,m=i.length;g<m;g+=2)i[g]+=o,i[g+1]=f-i[g+1];break;case 90:for(let g=0,m=i.length;g<m;g+=2){const v=i[g];i[g]=i[g+1]+o,i[g+1]=v+u}break;case 180:for(let g=0,m=i.length;g<m;g+=2)i[g]=d-i[g],i[g+1]+=u;break;case 270:for(let g=0,m=i.length;g<m;g+=2){const v=i[g];i[g]=d-i[g+1],i[g+1]=f-v}break;default:throw new Error("Invalid rotation")}return i},AE=function(i,n,l){const[o,u,d,f]=n;switch(l){case 0:for(let g=0,m=i.length;g<m;g+=2)i[g]-=o,i[g+1]=f-i[g+1];break;case 90:for(let g=0,m=i.length;g<m;g+=2){const v=i[g];i[g]=i[g+1]-u,i[g+1]=v-o}break;case 180:for(let g=0,m=i.length;g<m;g+=2)i[g]=d-i[g],i[g+1]-=u;break;case 270:for(let g=0,m=i.length;g<m;g+=2){const v=i[g];i[g]=f-i[g+1],i[g+1]=d-v}break;default:throw new Error("Invalid rotation")}return i},SE=function(i,n,l,o){var m,v;const u=[],d=this.thickness/2,f=i*n+d,g=i*l+d;for(const y of this.paths){const E=[],x=[];for(let C=0,L=y.length;C<L;C++){const[M,H,F,I]=y[C];if(M[0]===I[0]&&M[1]===I[1]&&L===1){const wt=i*M[0]+f,Ot=i*M[1]+g;E.push(wt,Ot),x.push(wt,Ot);break}const j=i*M[0]+f,q=i*M[1]+g,Q=i*H[0]+f,J=i*H[1]+g,at=i*F[0]+f,yt=i*F[1]+g,lt=i*I[0]+f,pt=i*I[1]+g;C===0&&(E.push(j,q),x.push(j,q)),E.push(Q,J,at,yt,lt,pt),x.push(Q,J),C===L-1&&x.push(lt,pt)}u.push({bezier:_(m=re,ta,Eb).call(m,E,o,this.rotation),points:_(v=re,ta,Eb).call(v,x,o,this.rotation)})}return u},Tb=function(){let i=1/0,n=-1/0,l=1/0,o=-1/0;for(const u of this.paths)for(const[d,f,g,m]of u){const v=ct.bezierBoundingBox(...d,...f,...g,...m);i=Math.min(i,v[0]),l=Math.min(l,v[1]),n=Math.max(n,v[2]),o=Math.max(o,v[3])}return[i,l,n,o]},ug=function(){return c(this,rs)?Math.ceil(this.thickness*this.parentScale):0},Xu=function(i=!1){if(this.isEmpty())return;if(!c(this,rs)){_(this,tt,Cl).call(this);return}const n=_(this,tt,Tb).call(this),l=_(this,tt,ug).call(this);S(this,yr,Math.max(Kt.MIN_SIZE,n[2]-n[0])),S(this,vr,Math.max(Kt.MIN_SIZE,n[3]-n[1]));const o=Math.ceil(l+c(this,yr)*this.scaleFactor),u=Math.ceil(l+c(this,vr)*this.scaleFactor),[d,f]=this.parentDimensions;this.width=o/d,this.height=u/f,this.setAspectRatio(o,u);const g=this.translationX,m=this.translationY;this.translationX=-n[0],this.translationY=-n[1],_(this,tt,Co).call(this),_(this,tt,Cl).call(this),S(this,Er,o),S(this,Tr,u),this.setDims(o,u);const v=i?l/this.scaleFactor/2:0;this.translate(g-this.translationX-v,m-this.translationY-v)},w(re,ta),bt(re,"_defaultColor",null),bt(re,"_defaultOpacity",1),bt(re,"_defaultThickness",1),bt(re,"_type","ink"),bt(re,"_editorType",Et.INK);let mb=re;var ce,Ve,Za,Gn,Wa,Tc,Js,Xn,tn,Ii,wc,Ht,Yu,Vu,hg,xb,_E,dg,Cb,fg,EE,TE;const Zu=class Zu extends Kt{constructor(i){super({...i,name:"stampEditor"});w(this,Ht);w(this,ce,null);w(this,Ve,null);w(this,Za,null);w(this,Gn,null);w(this,Wa,null);w(this,Tc,"");w(this,Js,null);w(this,Xn,null);w(this,tn,null);w(this,Ii,!1);w(this,wc,!1);S(this,Gn,i.bitmapUrl),S(this,Wa,i.bitmapFile)}static initialize(i,n){Kt.initialize(i,n)}static get supportedTypes(){return Ft(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(n=>`image/${n}`))}static get supportedTypesStr(){return Ft(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(i){return this.supportedTypes.includes(i)}static paste(i,n){n.pasteEditor(Et.STAMP,{bitmapFile:i.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var i;return{type:"stamp",hasAltText:!!((i=this.altTextData)!=null&&i.altText)}}static computeTelemetryFinalData(i){const n=i.get("hasAltText");return{hasAltText:n.get(!0)??0,hasNoAltText:n.get(!1)??0}}async mlGuessAltText(i=null,n=!0){if(this.hasAltTextData())return null;const{mlManager:l}=this._uiManager;if(!l)throw new Error("No ML.");if(!await l.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:o,width:u,height:d}=i||this.copyCanvas(null,null,!0).imageData,f=await l.guess({name:"altText",request:{data:o,width:u,height:d,channels:o.length/(u*d)}});if(!f)throw new Error("No response from the AI service.");if(f.error)throw new Error("Error from the AI service.");if(f.cancel)return null;if(!f.output)throw new Error("No valid response from the AI service.");const g=f.output;return await this.setGuessedAltText(g),n&&!this.hasAltTextData()&&(this.altTextData={alt:g,decorative:!1}),g}remove(){var i,n;c(this,Ve)&&(S(this,ce,null),this._uiManager.imageManager.deleteId(c(this,Ve)),(i=c(this,Js))==null||i.remove(),S(this,Js,null),(n=c(this,Xn))==null||n.disconnect(),S(this,Xn,null),c(this,tn)&&(clearTimeout(c(this,tn)),S(this,tn,null))),super.remove()}rebuild(){if(!this.parent){c(this,Ve)&&_(this,Ht,hg).call(this);return}super.rebuild(),this.div!==null&&(c(this,Ve)&&c(this,Js)===null&&_(this,Ht,hg).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(c(this,Za)||c(this,ce)||c(this,Gn)||c(this,Wa)||c(this,Ve))}get isResizable(){return!0}render(){if(this.div)return this.div;let i,n;if(this.width&&(i=this.x,n=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),c(this,ce)?_(this,Ht,xb).call(this):_(this,Ht,hg).call(this),this.width&&!this.annotationElementId){const[l,o]=this.parentDimensions;this.setAt(i*l,n*o,this.width*l,this.height*o)}return this.div}copyCanvas(i,n,l=!1){var E;i||(i=224);const{width:o,height:u}=c(this,ce),d=new _0;let f=c(this,ce),g=o,m=u,v=null;if(n){if(o>n||u>n){const J=Math.min(n/o,n/u);g=Math.floor(o*J),m=Math.floor(u*J)}v=document.createElement("canvas");const x=v.width=Math.ceil(g*d.sx),C=v.height=Math.ceil(m*d.sy);c(this,Ii)||(f=_(this,Ht,dg).call(this,x,C));const L=v.getContext("2d");L.filter=this._uiManager.hcmFilter;let M="white",H="#cfcfd8";this._uiManager.hcmFilter!=="none"?H="black":(E=window.matchMedia)!=null&&E.call(window,"(prefers-color-scheme: dark)").matches&&(M="#8f8f9d",H="#42414d");const F=15,I=F*d.sx,j=F*d.sy,q=new OffscreenCanvas(I*2,j*2),Q=q.getContext("2d");Q.fillStyle=M,Q.fillRect(0,0,I*2,j*2),Q.fillStyle=H,Q.fillRect(0,0,I,j),Q.fillRect(I,j,I,j),L.fillStyle=L.createPattern(q,"repeat"),L.fillRect(0,0,x,C),L.drawImage(f,0,0,f.width,f.height,0,0,x,C)}let y=null;if(l){let x,C;if(d.symmetric&&f.width<i&&f.height<i)x=f.width,C=f.height;else if(f=c(this,ce),o>i||u>i){const H=Math.min(i/o,i/u);x=Math.floor(o*H),C=Math.floor(u*H),c(this,Ii)||(f=_(this,Ht,dg).call(this,x,C))}const M=new OffscreenCanvas(x,C).getContext("2d",{willReadFrequently:!0});M.drawImage(f,0,0,f.width,f.height,0,0,x,C),y={width:x,height:C,data:M.getImageData(0,0,x,C).data}}return{canvas:v,width:g,height:m,imageData:y}}getImageForAltText(){return c(this,Js)}static async deserialize(i,n,l){var C;let o=null;if(i instanceof k_){const{data:{rect:L,rotation:M,id:H,structParent:F,popupRef:I},container:j,parent:{page:{pageNumber:q}}}=i,Q=j.querySelector("canvas"),J=l.imageManager.getFromCanvas(j.id,Q);Q.remove();const at=((C=await n._structTree.getAriaAttributes(`${Fb}${H}`))==null?void 0:C.get("aria-label"))||"";o=i={annotationType:Et.STAMP,bitmapId:J.id,bitmap:J.bitmap,pageIndex:q-1,rect:L.slice(0),rotation:M,id:H,deleted:!1,accessibilityData:{decorative:!1,altText:at},isSvg:!1,structParent:F,popupRef:I}}const u=await super.deserialize(i,n,l),{rect:d,bitmap:f,bitmapUrl:g,bitmapId:m,isSvg:v,accessibilityData:y}=i;m&&l.imageManager.isValidId(m)?(S(u,Ve,m),f&&S(u,ce,f)):S(u,Gn,g),S(u,Ii,v);const[E,x]=u.pageDimensions;return u.width=(d[2]-d[0])/E,u.height=(d[3]-d[1])/x,u.annotationElementId=i.id||null,y&&(u.altTextData=y),u._initialData=o,S(u,wc,!!o),u}serialize(i=!1,n=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const l={annotationType:Et.STAMP,bitmapId:c(this,Ve),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:c(this,Ii),structTreeParentId:this._structTreeParentId};if(i)return l.bitmapUrl=_(this,Ht,fg).call(this,!0),l.accessibilityData=this.serializeAltText(!0),l;const{decorative:o,altText:u}=this.serializeAltText(!1);if(!o&&u&&(l.accessibilityData={type:"Figure",alt:u}),this.annotationElementId){const f=_(this,Ht,TE).call(this,l);if(f.isSame)return null;f.isSameAltText?delete l.accessibilityData:l.accessibilityData.structParent=this._initialData.structParent??-1}if(l.id=this.annotationElementId,n===null)return l;n.stamps||(n.stamps=new Map);const d=c(this,Ii)?(l.rect[2]-l.rect[0])*(l.rect[3]-l.rect[1]):null;if(!n.stamps.has(c(this,Ve)))n.stamps.set(c(this,Ve),{area:d,serialized:l}),l.bitmap=_(this,Ht,fg).call(this,!1);else if(c(this,Ii)){const f=n.stamps.get(c(this,Ve));d>f.area&&(f.area=d,f.serialized.bitmap.close(),f.serialized.bitmap=_(this,Ht,fg).call(this,!1))}return l}renderAnnotationElement(i){return i.updateEdited({rect:this.getRect(0,0)}),null}};ce=new WeakMap,Ve=new WeakMap,Za=new WeakMap,Gn=new WeakMap,Wa=new WeakMap,Tc=new WeakMap,Js=new WeakMap,Xn=new WeakMap,tn=new WeakMap,Ii=new WeakMap,wc=new WeakMap,Ht=new WeakSet,Yu=function(i,n=!1){if(!i){this.remove();return}S(this,ce,i.bitmap),n||(S(this,Ve,i.id),S(this,Ii,i.isSvg)),i.file&&S(this,Tc,i.file.name),_(this,Ht,xb).call(this)},Vu=function(){if(S(this,Za,null),this._uiManager.enableWaiting(!1),!!c(this,Js)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&c(this,ce)){this._editToolbar.hide(),this._uiManager.editAltText(this,!0);return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&c(this,ce)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},hg=function(){if(c(this,Ve)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(c(this,Ve)).then(l=>_(this,Ht,Yu).call(this,l,!0)).finally(()=>_(this,Ht,Vu).call(this));return}if(c(this,Gn)){const l=c(this,Gn);S(this,Gn,null),this._uiManager.enableWaiting(!0),S(this,Za,this._uiManager.imageManager.getFromUrl(l).then(o=>_(this,Ht,Yu).call(this,o)).finally(()=>_(this,Ht,Vu).call(this)));return}if(c(this,Wa)){const l=c(this,Wa);S(this,Wa,null),this._uiManager.enableWaiting(!0),S(this,Za,this._uiManager.imageManager.getFromFile(l).then(o=>_(this,Ht,Yu).call(this,o)).finally(()=>_(this,Ht,Vu).call(this)));return}const i=document.createElement("input");i.type="file",i.accept=Zu.supportedTypesStr;const n=this._uiManager._signal;S(this,Za,new Promise(l=>{i.addEventListener("change",async()=>{if(!i.files||i.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const o=await this._uiManager.imageManager.getFromFile(i.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),_(this,Ht,Yu).call(this,o)}l()},{signal:n}),i.addEventListener("cancel",()=>{this.remove(),l()},{signal:n})}).finally(()=>_(this,Ht,Vu).call(this))),i.click()},xb=function(){const{div:i}=this;let{width:n,height:l}=c(this,ce);const[o,u]=this.pageDimensions,d=.75;if(this.width)n=this.width*o,l=this.height*u;else if(n>d*o||l>d*u){const v=Math.min(d*o/n,d*u/l);n*=v,l*=v}const[f,g]=this.parentDimensions;this.setDims(n*f/o,l*g/u),this._uiManager.enableWaiting(!1);const m=S(this,Js,document.createElement("canvas"));m.setAttribute("role","img"),this.addContainer(m),(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(i.hidden=!1),_(this,Ht,Cb).call(this,n,l),_(this,Ht,EE).call(this),c(this,wc)||(this.parent.addUndoableEditor(this),S(this,wc,!0)),this._reportTelemetry({action:"inserted_image"}),c(this,Tc)&&m.setAttribute("aria-label",c(this,Tc))},_E=function(i,n){var d;const[l,o]=this.parentDimensions;this.width=i/l,this.height=n/o,(d=this._initialOptions)!=null&&d.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,c(this,tn)!==null&&clearTimeout(c(this,tn)),S(this,tn,setTimeout(()=>{S(this,tn,null),_(this,Ht,Cb).call(this,i,n)},200))},dg=function(i,n){const{width:l,height:o}=c(this,ce);let u=l,d=o,f=c(this,ce);for(;u>2*i||d>2*n;){const g=u,m=d;u>2*i&&(u=u>=16384?Math.floor(u/2)-1:Math.ceil(u/2)),d>2*n&&(d=d>=16384?Math.floor(d/2)-1:Math.ceil(d/2));const v=new OffscreenCanvas(u,d);v.getContext("2d").drawImage(f,0,0,g,m,0,0,u,d),f=v.transferToImageBitmap()}return f},Cb=function(i,n){const l=new _0,o=Math.ceil(i*l.sx),u=Math.ceil(n*l.sy),d=c(this,Js);if(!d||d.width===o&&d.height===u)return;d.width=o,d.height=u;const f=c(this,Ii)?c(this,ce):_(this,Ht,dg).call(this,o,u),g=d.getContext("2d");g.filter=this._uiManager.hcmFilter,g.drawImage(f,0,0,f.width,f.height,0,0,o,u)},fg=function(i){if(i){if(c(this,Ii)){const o=this._uiManager.imageManager.getSvgUrl(c(this,Ve));if(o)return o}const n=document.createElement("canvas");return{width:n.width,height:n.height}=c(this,ce),n.getContext("2d").drawImage(c(this,ce),0,0),n.toDataURL()}if(c(this,Ii)){const[n,l]=this.pageDimensions,o=Math.round(this.width*n*el.PDF_TO_CSS_UNITS),u=Math.round(this.height*l*el.PDF_TO_CSS_UNITS),d=new OffscreenCanvas(o,u);return d.getContext("2d").drawImage(c(this,ce),0,0,c(this,ce).width,c(this,ce).height,0,0,o,u),d.transferToImageBitmap()}return structuredClone(c(this,ce))},EE=function(){this._uiManager._signal&&(S(this,Xn,new ResizeObserver(i=>{const n=i[0].contentRect;n.width&&n.height&&_(this,Ht,_E).call(this,n.width,n.height)})),c(this,Xn).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var i;(i=c(this,Xn))==null||i.disconnect(),S(this,Xn,null)},{once:!0}))},TE=function(i){var g;const{rect:n,pageIndex:l,accessibilityData:{altText:o}}=this._initialData,u=i.rect.every((m,v)=>Math.abs(m-n[v])<1),d=i.pageIndex===l,f=(((g=i.accessibilityData)==null?void 0:g.alt)||"")===o;return{isSame:u&&d&&f,isSameAltText:f}},bt(Zu,"_type","stamp"),bt(Zu,"_editorType",Et.STAMP);let wb=Zu;var wr,xc,en,$a,Yn,ji,Ja,Cc,Mc,si,Vn,ht,tl,Ke,wE,Rb,Db,Lb,gg;const ps=class ps{constructor({uiManager:e,pageIndex:i,div:n,structTreeLayer:l,accessibilityManager:o,annotationLayer:u,drawLayer:d,textLayer:f,viewport:g,l10n:m}){w(this,Ke);w(this,wr);w(this,xc,!1);w(this,en,null);w(this,$a,null);w(this,Yn,null);w(this,ji,new Map);w(this,Ja,!1);w(this,Cc,!1);w(this,Mc,!1);w(this,si,null);w(this,Vn,null);w(this,ht);const v=[...c(ps,tl).values()];if(!ps._initialized){ps._initialized=!0;for(const y of v)y.initialize(m,e)}e.registerEditorTypes(v),S(this,ht,e),this.pageIndex=i,this.div=n,S(this,wr,o),S(this,en,u),this.viewport=g,S(this,si,f),this.drawLayer=d,this._structTree=l,c(this,ht).addLayer(this)}get isEmpty(){return c(this,ji).size===0}get isInvisible(){return this.isEmpty&&c(this,ht).getMode()===Et.NONE}updateToolbar(e){c(this,ht).updateToolbar(e)}updateMode(e=c(this,ht).getMode()){switch(_(this,Ke,gg).call(this),e){case Et.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Et.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case Et.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:i}=this.div;for(const n of c(ps,tl).values())i.toggle(`${n._type}Editing`,e===n._editorType);this.div.hidden=!1}hasTextLayer(e){var i;return e===((i=c(this,si))==null?void 0:i.div)}addInkEditorIfNeeded(e){if(c(this,ht).getMode()!==Et.INK)return;if(!e){for(const n of c(this,ji).values())if(n.isEmpty()){n.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(e){c(this,ht).setEditingState(e)}addCommands(e){c(this,ht).addCommands(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var i;(i=c(this,en))==null||i.div.classList.toggle("disabled",!e)}async enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const e=new Set;for(const n of c(this,ji).values())n.enableEditing(),n.show(!0),n.annotationElementId&&(c(this,ht).removeChangedExistingAnnotation(n),e.add(n.annotationElementId));if(!c(this,en))return;const i=c(this,en).getEditableAnnotations();for(const n of i){if(n.hide(),c(this,ht).isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;const l=await this.deserialize(n);l&&(this.addOrRebuild(l),l.enableEditing())}}disable(){var l;S(this,Mc,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const e=new Map,i=new Map;for(const o of c(this,ji).values())if(o.disableEditing(),!!o.annotationElementId){if(o.serialize()!==null){e.set(o.annotationElementId,o);continue}else i.set(o.annotationElementId,o);(l=this.getEditableAnnotation(o.annotationElementId))==null||l.show(),o.remove()}if(c(this,en)){const o=c(this,en).getEditableAnnotations();for(const u of o){const{id:d}=u.data;if(c(this,ht).isDeletedAnnotationElement(d))continue;let f=i.get(d);if(f){f.resetAnnotationElement(u),f.show(!1),u.show();continue}f=e.get(d),f&&(c(this,ht).addChangedExistingAnnotation(f),f.renderAnnotationElement(u)&&f.show(!1)),u.show()}}_(this,Ke,gg).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:n}=this.div;for(const o of c(ps,tl).values())n.remove(`${o._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),S(this,Mc,!1)}getEditableAnnotation(e){var i;return((i=c(this,en))==null?void 0:i.getEditableAnnotation(e))||null}setActiveEditor(e){c(this,ht).getActive()!==e&&c(this,ht).setActiveEditor(e)}enableTextSelection(){var e;if(this.div.tabIndex=-1,(e=c(this,si))!=null&&e.div&&!c(this,Vn)){S(this,Vn,new AbortController);const i=c(this,ht).combinedSignal(c(this,Vn));c(this,si).div.addEventListener("pointerdown",_(this,Ke,wE).bind(this),{signal:i}),c(this,si).div.classList.add("highlighting")}}disableTextSelection(){var e;this.div.tabIndex=0,(e=c(this,si))!=null&&e.div&&c(this,Vn)&&(c(this,Vn).abort(),S(this,Vn,null),c(this,si).div.classList.remove("highlighting"))}enableClick(){if(c(this,$a))return;S(this,$a,new AbortController);const e=c(this,ht).combinedSignal(c(this,$a));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:e})}disableClick(){var e;(e=c(this,$a))==null||e.abort(),S(this,$a,null)}attach(e){c(this,ji).set(e.id,e);const{annotationElementId:i}=e;i&&c(this,ht).isDeletedAnnotationElement(i)&&c(this,ht).removeDeletedAnnotationElement(e)}detach(e){var i;c(this,ji).delete(e.id),(i=c(this,wr))==null||i.removePointerInTextLayer(e.contentDiv),!c(this,Mc)&&e.annotationElementId&&c(this,ht).addDeletedAnnotationElement(e)}remove(e){this.detach(e),c(this,ht).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1,c(this,Cc)||this.addInkEditorIfNeeded(!1)}changeParent(e){var i;e.parent!==this&&(e.parent&&e.annotationElementId&&(c(this,ht).addDeletedAnnotationElement(e.annotationElementId),Kt.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(i=e.parent)==null||i.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),c(this,ht).addEditor(e),this.attach(e),!e.isAttachedToDOM){const i=e.render();this.div.append(i),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(),c(this,ht).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var n;if(!e.isAttachedToDOM)return;const{activeElement:i}=document;e.div.contains(i)&&!c(this,Yn)&&(e._focusEventsAllowed=!1,S(this,Yn,setTimeout(()=>{S(this,Yn,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:c(this,ht)._signal}),i.focus())},0))),e._structTreeParentId=(n=c(this,wr))==null?void 0:n.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(e.parent=this),e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){const i=()=>e._uiManager.rebuild(e),n=()=>{e.remove()};this.addCommands({cmd:i,undo:n,mustExec:!1})}getNextId(){return c(this,ht).getId()}combinedSignal(e){return c(this,ht).combinedSignal(e)}canCreateNewEmptyEditor(){var e;return(e=c(this,Ke,Rb))==null?void 0:e.canCreateNewEmptyEditor()}pasteEditor(e,i){c(this,ht).updateToolbar(e),c(this,ht).updateMode(e);const{offsetX:n,offsetY:l}=_(this,Ke,Lb).call(this),o=this.getNextId(),u=_(this,Ke,Db).call(this,{parent:this,id:o,x:n,y:l,uiManager:c(this,ht),isCentered:!0,...i});u&&this.add(u)}async deserialize(e){var i;return await((i=c(ps,tl).get(e.annotationType??e.annotationEditorType))==null?void 0:i.deserialize(e,this,c(this,ht)))||null}createAndAddNewEditor(e,i,n={}){const l=this.getNextId(),o=_(this,Ke,Db).call(this,{parent:this,id:l,x:e.offsetX,y:e.offsetY,uiManager:c(this,ht),isCentered:i,...n});return o&&this.add(o),o}addNewEditor(){this.createAndAddNewEditor(_(this,Ke,Lb).call(this),!0)}setSelected(e){c(this,ht).setSelected(e)}toggleSelected(e){c(this,ht).toggleSelected(e)}unselect(e){c(this,ht).unselect(e)}pointerup(e){const{isMac:i}=ui.platform;if(!(e.button!==0||e.ctrlKey&&i)&&e.target===this.div&&c(this,Ja)){if(S(this,Ja,!1),!c(this,xc)){S(this,xc,!0);return}if(c(this,ht).getMode()===Et.STAMP){c(this,ht).unselectAll();return}this.createAndAddNewEditor(e,!1)}}pointerdown(e){if(c(this,ht).getMode()===Et.HIGHLIGHT&&this.enableTextSelection(),c(this,Ja)){S(this,Ja,!1);return}const{isMac:i}=ui.platform;if(e.button!==0||e.ctrlKey&&i||e.target!==this.div)return;S(this,Ja,!0);const n=c(this,ht).getActive();S(this,xc,!n||n.isEmpty())}findNewParent(e,i,n){const l=c(this,ht).findParent(i,n);return l===null||l===this?!1:(l.changeParent(e),!0)}destroy(){var e,i;((e=c(this,ht).getActive())==null?void 0:e.parent)===this&&(c(this,ht).commitOrRemove(),c(this,ht).setActiveEditor(null)),c(this,Yn)&&(clearTimeout(c(this,Yn)),S(this,Yn,null));for(const n of c(this,ji).values())(i=c(this,wr))==null||i.removePointerInTextLayer(n.contentDiv),n.setParent(null),n.isAttachedToDOM=!1,n.div.remove();this.div=null,c(this,ji).clear(),c(this,ht).removeLayer(this)}render({viewport:e}){this.viewport=e,xr(this.div,e);for(const i of c(this,ht).getEditors(this.pageIndex))this.add(i),i.rebuild();this.updateMode()}update({viewport:e}){c(this,ht).commitOrRemove(),_(this,Ke,gg).call(this);const i=this.viewport.rotation,n=e.rotation;if(this.viewport=e,xr(this.div,{rotation:n}),i!==n)for(const l of c(this,ji).values())l.rotate(n);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:e,pageHeight:i}=this.viewport.rawDims;return[e,i]}get scale(){return c(this,ht).viewParameters.realScale}};wr=new WeakMap,xc=new WeakMap,en=new WeakMap,$a=new WeakMap,Yn=new WeakMap,ji=new WeakMap,Ja=new WeakMap,Cc=new WeakMap,Mc=new WeakMap,si=new WeakMap,Vn=new WeakMap,ht=new WeakMap,tl=new WeakMap,Ke=new WeakSet,wE=function(e){c(this,ht).unselectAll();const{target:i}=e;if(i===c(this,si).div||(i.getAttribute("role")==="img"||i.classList.contains("endOfContent"))&&c(this,si).div.contains(i)){const{isMac:n}=ui.platform;if(e.button!==0||e.ctrlKey&&n)return;c(this,ht).showAllEditors("highlight",!0,!0),c(this,si).div.classList.add("free"),this.toggleDrawing(),yg.startHighlighting(this,c(this,ht).direction==="ltr",{target:c(this,si).div,x:e.x,y:e.y}),c(this,si).div.addEventListener("pointerup",()=>{c(this,si).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:c(this,ht)._signal}),e.preventDefault()}},Rb=function(){return c(ps,tl).get(c(this,ht).getMode())},Db=function(e){const i=c(this,Ke,Rb);return i?new i.prototype.constructor(e):null},Lb=function(){const{x:e,y:i,width:n,height:l}=this.div.getBoundingClientRect(),o=Math.max(0,e),u=Math.max(0,i),d=Math.min(window.innerWidth,e+n),f=Math.min(window.innerHeight,i+l),g=(o+d)/2-e,m=(u+f)/2-i,[v,y]=this.viewport.rotation%180===0?[g,m]:[m,g];return{offsetX:v,offsetY:y}},gg=function(){S(this,Cc,!0);for(const e of c(this,ji).values())e.isEmpty()&&e.remove();S(this,Cc,!1)},bt(ps,"_initialized",!1),w(ps,tl,new Map([rb,mb,wb,yg].map(e=>[e._editorType,e])));let Mb=ps;var sn,dd,Se,Kn,fd,Nb,Dr,kb,xE;const Ge=class Ge{constructor({pageIndex:e}){w(this,Dr);w(this,sn,null);w(this,dd,0);w(this,Se,new Map);w(this,Kn,new Map);this.pageIndex=e}setParent(e){if(!c(this,sn)){S(this,sn,e);return}if(c(this,sn)!==e){if(c(this,Se).size>0)for(const i of c(this,Se).values())i.remove(),e.append(i);S(this,sn,e)}}static get _svgFactory(){return Ft(this,"_svgFactory",new Vb)}draw(e,i,n,l=!1){const o=li(this,dd)._++,u=_(this,Dr,kb).call(this,e.box);u.classList.add(...e.classNamesForDrawing);const d=Ge._svgFactory.createElement("defs");u.append(d);const f=Ge._svgFactory.createElement("path");d.append(f);const g=`path_p${this.pageIndex}_${o}`;f.setAttribute("id",g),f.setAttribute("d",e.toSVGPath()),l&&c(this,Kn).set(o,f);const m=_(this,Dr,xE).call(this,d,g),v=Ge._svgFactory.createElement("use");return u.append(v),u.setAttribute("fill",i),u.setAttribute("fill-opacity",n),v.setAttribute("href",`#${g}`),c(this,Se).set(o,u),{id:o,clipPathId:`url(#${m})`}}drawOutline(e){const i=li(this,dd)._++,n=_(this,Dr,kb).call(this,e.box);n.classList.add(...e.classNamesForOutlining);const l=Ge._svgFactory.createElement("defs");n.append(l);const o=Ge._svgFactory.createElement("path");l.append(o);const u=`path_p${this.pageIndex}_${i}`;o.setAttribute("id",u),o.setAttribute("d",e.toSVGPath()),o.setAttribute("vector-effect","non-scaling-stroke");let d;if(e.mustRemoveSelfIntersections){const m=Ge._svgFactory.createElement("mask");l.append(m),d=`mask_p${this.pageIndex}_${i}`,m.setAttribute("id",d),m.setAttribute("maskUnits","objectBoundingBox");const v=Ge._svgFactory.createElement("rect");m.append(v),v.setAttribute("width","1"),v.setAttribute("height","1"),v.setAttribute("fill","white");const y=Ge._svgFactory.createElement("use");m.append(y),y.setAttribute("href",`#${u}`),y.setAttribute("stroke","none"),y.setAttribute("fill","black"),y.setAttribute("fill-rule","nonzero"),y.classList.add("mask")}const f=Ge._svgFactory.createElement("use");n.append(f),f.setAttribute("href",`#${u}`),d&&f.setAttribute("mask",`url(#${d})`);const g=f.cloneNode();return n.append(g),f.classList.add("mainOutline"),g.classList.add("secondaryOutline"),c(this,Se).set(i,n),i}finalizeLine(e,i){const n=c(this,Kn).get(e);c(this,Kn).delete(e),this.updateBox(e,i.box),n.setAttribute("d",i.toSVGPath())}updateLine(e,i){c(this,Se).get(e).firstChild.firstChild.setAttribute("d",i.toSVGPath())}updatePath(e,i){c(this,Kn).get(e).setAttribute("d",i.toSVGPath())}updateBox(e,i){var n;_(n=Ge,fd,Nb).call(n,c(this,Se).get(e),i)}show(e,i){c(this,Se).get(e).classList.toggle("hidden",!i)}rotate(e,i){c(this,Se).get(e).setAttribute("data-main-rotation",i)}changeColor(e,i){c(this,Se).get(e).setAttribute("fill",i)}changeOpacity(e,i){c(this,Se).get(e).setAttribute("fill-opacity",i)}addClass(e,i){c(this,Se).get(e).classList.add(i)}removeClass(e,i){c(this,Se).get(e).classList.remove(i)}getSVGRoot(e){return c(this,Se).get(e)}remove(e){c(this,Kn).delete(e),c(this,sn)!==null&&(c(this,Se).get(e).remove(),c(this,Se).delete(e))}destroy(){S(this,sn,null);for(const e of c(this,Se).values())e.remove();c(this,Se).clear(),c(this,Kn).clear()}};sn=new WeakMap,dd=new WeakMap,Se=new WeakMap,Kn=new WeakMap,fd=new WeakSet,Nb=function(e,{x:i=0,y:n=0,width:l=1,height:o=1}={}){const{style:u}=e;u.top=`${100*n}%`,u.left=`${100*i}%`,u.width=`${100*l}%`,u.height=`${100*o}%`},Dr=new WeakSet,kb=function(e){var n;const i=Ge._svgFactory.create(1,1,!0);return c(this,sn).append(i),i.setAttribute("aria-hidden",!0),_(n=Ge,fd,Nb).call(n,i,e),i},xE=function(e,i){const n=Ge._svgFactory.createElement("clipPath");e.append(n);const l=`clip_${i}`;n.setAttribute("id",l),n.setAttribute("clipPathUnits","objectBoundingBox");const o=Ge._svgFactory.createElement("use");return n.append(o),o.setAttribute("href",`#${i}`),o.classList.add("clip"),l},w(Ge,fd);let Ob=Ge;At.AbortException;At.AnnotationEditorLayer;At.AnnotationEditorParamsType;At.AnnotationEditorType;At.AnnotationEditorUIManager;At.AnnotationLayer;At.AnnotationMode;At.ColorPicker;At.DOMSVGFactory;At.DrawLayer;At.FeatureTest;var cM=At.GlobalWorkerOptions;At.ImageKind;At.InvalidPDFException;At.MissingPDFException;At.OPS;At.OutputScale;At.PDFDataRangeTransport;At.PDFDateString;At.PDFWorker;At.PasswordResponses;At.PermissionFlag;At.PixelsPerInch;At.RenderingCancelledException;At.TextLayer;At.UnexpectedResponseException;At.Util;At.VerbosityLevel;At.XfaLayer;At.build;At.createValidAbsoluteUrl;At.fetchData;At.getDocument;At.getFilenameFromUrl;At.getPdfFilenameFromUrl;At.getXfaPageViewport;At.isDataScheme;At.isPdfFile;At.noContextMenu;At.normalizeUnicode;At.setLayerDimensions;At.shadow;var uM=At.version;function hM({className:b}){return st.jsxs("svg",{className:b,xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"inherit",children:[st.jsx("path",{d:"M0 0h24v24H0V0z",fill:"none"}),st.jsx("path",{d:"M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"})]})}function dM({className:b}){return st.jsxs("svg",{className:b,xmlns:"http://www.w3.org/2000/svg",enableBackground:"new 0 0 24 24",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"inherit",children:[st.jsx("g",{children:st.jsx("rect",{fill:"none",height:"24",width:"24"})}),st.jsxs("g",{children:[st.jsx("g",{}),st.jsxs("g",{children:[st.jsx("path",{d:"M21,5c-1.11-0.35-2.33-0.5-3.5-0.5c-1.95,0-4.05,0.4-5.5,1.5c-1.45-1.1-3.55-1.5-5.5-1.5S2.45,4.9,1,6v14.65 c0,0.25,0.25,0.5,0.5,0.5c0.1,0,0.15-0.05,0.25-0.05C3.1,20.45,5.05,20,6.5,20c1.95,0,4.05,0.4,5.5,1.5c1.35-0.85,3.8-1.5,5.5-1.5 c1.65,0,3.35,0.3,4.75,1.05c0.1,0.05,0.15,0.05,0.25,0.05c0.25,0,0.5-0.25,0.5-0.5V6C22.4,5.55,21.75,5.25,21,5z M21,18.5 c-1.1-0.35-2.3-0.5-3.5-0.5c-1.7,0-4.15,0.65-5.5,1.5V8c1.35-0.85,3.8-1.5,5.5-1.5c1.2,0,2.4,0.15,3.5,0.5V18.5z"}),st.jsxs("g",{children:[st.jsx("path",{d:"M17.5,10.5c0.88,0,1.73,0.09,2.5,0.26V9.24C19.21,9.09,18.36,9,17.5,9c-1.7,0-3.24,0.29-4.5,0.83v1.66 C14.13,10.85,15.7,10.5,17.5,10.5z"}),st.jsx("path",{d:"M13,12.49v1.66c1.13-0.64,2.7-0.99,4.5-0.99c0.88,0,1.73,0.09,2.5,0.26V11.9c-0.79-0.15-1.64-0.24-2.5-0.24 C15.8,11.66,14.26,11.96,13,12.49z"}),st.jsx("path",{d:"M17.5,14.33c-1.7,0-3.24,0.29-4.5,0.83v1.66c1.13-0.64,2.7-0.99,4.5-0.99c0.88,0,1.73,0.09,2.5,0.26v-1.52 C19.21,14.41,18.36,14.33,17.5,14.33z"})]})]})]})]})}function fM({className:b}){return st.jsxs("svg",{className:b,xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"inherit",children:[st.jsx("path",{d:"M0 0h24v24H0V0z",fill:"none"}),st.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"})]})}function gM({className:b}){return st.jsxs("svg",{className:b,xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"inherit",children:[st.jsx("path",{d:"M0 0h24v24H0V0z",fill:"none"}),st.jsx("path",{d:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z"})]})}const pM=[{id:"T001",title:"Предмет и задачи на вътрешната медицина. Раздели на вътрешните болести",files:["f001.html"]},{id:"T002",title:"Тумори на белия дроб",files:["f002.html"]},{id:"T003",title:"Белодробен тромбоемболизъм",files:["f003.html","f096.html"]},{id:"T004",title:"Плеврити",files:["f004.html","f097.html"]},{id:"T005",title:"Белодробна туберколоза-етиология, патогенеза, и клинична картина. Първична и вторична ТБК. Лечение и профилактика на туберкулоза",files:["f005.html","f098.html"]},{id:"T006",title:"Дихателна недостатъчност",files:["f006.html"]},{id:"T007",title:"Основни симптоми и синдроми при заболявания на ССС Физикални и специални методи на изследване на ССС",files:["f007.html","f031.html"]},{id:"T008",title:"Болест и здраве. Етилогия и патогенеза на болестите. Периоди на болестта",files:["f008.html"]},{id:"T009",title:"Болести на надбъбречните жлези: Хиперкортицизъм. Хипокортицизъм",files:["f009.html","f047.html"]},{id:"T010",title:"Агония. Клинична смърт. Биологична смърт",files:["f010.html"]},{id:"T011",title:"Физикални методи на изследване на стомашно-чревния тракт",files:["f011.html"]},{id:"T012",title:"Основни симптоми и синдроми при заболявания на отделителната система. Функционално изследване на ОС",files:["f012.html"]},{id:"T013",title:"Основни класически методи на изследване във вътрешната медицина-анамнеза. Физикални методи на изследване на болните –оглед, палпация, перкусия, аускултация. Специални методи на изследване на пациентите",files:["f013.html"]},{id:"T014",title:"Деформираща артроза ОСТЕОАРТРОЗА",files:["f014.html"]},{id:"T015",title:"Сегашно състояние-обективен статус на болния. Клинична диагноза и прогноза. Проследяване на болния-декурзус",files:["f015.html"]},{id:"T016",title:"Изследване на ДС. Основни симптоми и синдроми на заболявания на ДС. Физиклани и спциални методи на изследване",files:["f016.html"]},{id:"T017",title:"Остър и хроничен бронхит. Белодробен емфизем. ХОББ",files:["f017.html","f057.html"]},{id:"T018",title:"Пневмонии: класификация, клиника, лечение",files:["f018.html","f075.html"]},{id:"T019",title:"Бронхиектазии. Белодробен абцес",files:["f019.html"]},{id:"T020",title:"Хипертонична болест- рискови фактори;патогенеза;клиника, лечение",files:["f020.html","f035.html"]},{id:"T021",title:"Изследване на стомашно-чревния тракт. Анемнеза. Основни симптоми и синдроми при заболявания на стомашно-чревния тракт",files:["f021.html","f054.html"]},{id:"T022",title:"Пиелонефрити",files:["f022.html","f074.html"]},{id:"T023",title:"Хемолитични анемии вследствие на вътре и извънеритроцитни фактори, вродени и придобити",files:["f023.html","f084.html"]},{id:"T024",title:"Хеморагични диатези хемофилия, есенциална тромбоцитопения, капиляротоксикоза",files:["f024.html","f091.html"]},{id:"T025",title:"Бластна левкоза. Хронична миелолевкоза",files:["f025.html","f087.html"]},{id:"T026",title:"Нехочкинови и хочкинови лимфоми",files:["f026.html","f089.html"]},{id:"T027",title:"Остри екзогенни интоксикации. Общи принципи и правила в лечението на острите екзогенни отравяния. Поведение на медицинската сестра и грижи за болния с остро отравяне",files:["f027.html","f093.html"]},{id:"T028",title:"Алергия. Алергични заболявания. Анафилактичен шок. Поведение на медицинската сестра при спешни алергични състояния",files:["f028.html","f094.html"]},{id:"T029",title:"Основни класически методи на изследване във вътрешната медицина-анамнеза. Физикални методи за изледване на болните-оглед, палпация, перкусия, аускултация. Сегашно състояние-обективен статус на болния. Клинична диагноза и прогноза. Проследяване на болния-Декурзус",files:["f029.html"]},{id:"T030",title:"Дихателна недостатъчност- остра и хронична. Етиология, степени, клиника",files:["f030.html"]},{id:"T031",title:"Ревматизъм",files:["f032.html","f034.html"]},{id:"T032",title:"Ендокардити, перикардити",files:["f033.html","f039.html"]},{id:"T033",title:"Остра периферна сърдечно-съдова недостатъчност. Кардиологичен шок",files:["f036.html"]},{id:"T034",title:"Лечение на СН и поведение на м. с",files:["f037.html"]},{id:"T035",title:"Ритъмни нарушения на сърдечната дейност. Проводни нарушения на сърдечната дейност",files:["f038.html","f044.html"]},{id:"T036",title:"ИБС: етиология, рискови фактори, патофизиология. Стенокардия",files:["f040.html","f045.html"]},{id:"T037",title:"Изследване на ДС. Основни симптоми и синдроми при заболявания на ДС. Физикални и специаални методи на изследване на ДС",files:["f041.html"]},{id:"T038",title:"ИБС: етиология, рискови фактори, патофизиология. Инфаркт на миокарда",files:["f042.html","f046.html"]},{id:"T039",title:"Болести на хипофизата- Акромегалия ;Безвкусен диабет",files:["f043.html","f048.html"]},{id:"T040",title:"Захарен диабет-етиология, патогенеза, класификация, клиника. Диабетна кетоацидоза и хипокликемична кома. Поведение на МС при диабетно болен в кома",files:["f049.html"]},{id:"T041",title:"Болести на щитовидната жлеза: Тиреотоксикоза. Микседем. Ендемична гуша",files:["f050.html"]},{id:"T042",title:"Захарен диабет късни усложнения. Захарен диабет- диета и медикаментозно лечение",files:["f051.html","f056.html"]},{id:"T043",title:"Затлъстяване. Подагра",files:["f052.html","f053.html"]},{id:"T044",title:"Физикални и специални методи на изследване на стомашно-чревния тракт",files:["f055.html"]},{id:"T045",title:"Гастрити. ГЕРБ",files:["f058.html","f061.html"]},{id:"T046",title:"Язвена болест. Рак на стомаха",files:["f059.html","f063.html"]},{id:"T047",title:"Ентерити и колити. Рак на дебелото черво",files:["f060.html","f065.html"]},{id:"T048",title:"Основни симптоми и синдроми при заболяване на черния дроб и жлъчните пътища. Жълтеница, портална хипертония, асцит. Анамнеза, физикални и специални методи за изследване на черния дроб и жлъчните пътища",files:["f062.html"]},{id:"T049",title:"Хронични хепатити. Чернодробна цироза",files:["f064.html","f071.html"]},{id:"T050",title:"Холелитиаза. Холецистити",files:["f066.html","f073.html"]},{id:"T051",title:"Основни симптоми и синдроми при заболяване на черния дроб и жлъчните пътища. Анамнеза, физикални и специални методи за изледване на черния дроб и жлъчните пътища",files:["f067.html","f068.html"]},{id:"T052",title:"Остър и хроничен гломерулонефрит",files:["f069.html","f070.html"]},{id:"T053",title:"Нефролитиаза",files:["f072.html","f077.html"]},{id:"T054",title:"Остра бъбречна и хронична бъбречна недостатъчност",files:["f076.html"]},{id:"T055",title:"Балканска ендемична нефропатия. Бъбречна поликистозна болест. Бъбречна туберкулоза",files:["f078.html","f082.html"]},{id:"T056",title:"Ревмтоиден артрит",files:["f079.html","f085.html"]},{id:"T057",title:"Деформираща артроза",files:["f080.html","f081.html"]},{id:"T058",title:"Желязодефицитни анемии",files:["f083.html","f088.html"]},{id:"T059",title:"Витамин В 12 дефицитни анемии",files:["f086.html","f090.html"]},{id:"T060",title:"Бронхоектазии. Белодробен абцес",files:["f092.html"]},{id:"T061",title:"Tумори на белия дроб",files:["f095.html"]}],Us=pM.map(b=>({...b,version:0}));cM.workerSrc=`//unpkg.com/pdfjs-dist@${uM}/build/pdf.worker.min.mjs`;function mM({selectedIndex:b,onChange:e}){const i=nn.useRef([]);return nn.useLayoutEffect(()=>{var n;b!==null&&((n=i.current)==null||n[Math.max(b-3,0)].scrollIntoView())},[b]),st.jsx(st.Fragment,{children:st.jsxs("div",{className:"flex-1 relative overflow-y-scroll",children:[Us.map((n,l)=>st.jsxs("div",{ref:o=>{i.current[l]=o},onClick:()=>e(l),className:`flex px-2 py-1 rounded-md cursor-pointer border-l-4 ${b===l?"bg-blue-100 border-blue-500":"border-transparent hover:bg-gray-100"}`,children:[st.jsx("div",{className:`w-6 flex-shrink-0 flex font-medium justify-end ${b===l?"text-blue-600":"text-blue-800"}`,children:l+1}),st.jsx("span",{className:"ml-2",children:st.jsx("span",{className:`leading-5 ${b===l?"font-medium":"font-normal"}`,children:n.title})})]},n.id)),b!==null&&st.jsx("div",{className:"sticky bottom-0 p-2 w-full flex flex-col",children:st.jsxs("div",{className:"w-full flex justify-between items-center gap-2",children:[st.jsxs("button",{className:"w-full p-2 bg-blue-600 hover:bg-blue-700 cursor-pointer truncate rounded-md text-sm text-white text-center shadow-md transition-colors",onClick:()=>e(b),children:[st.jsx("span",{children:"Продължи четенето:"}),st.jsx("br",{}),st.jsx("span",{className:"font-medium",children:Us[b].title})]}),st.jsx("button",{className:"px-3 py-3 bg-teal-500 hover:bg-teal-300 cursor-pointer rounded-full flex items-center justify-center shadow-md transition-colors",onClick:()=>{var n;(n=i.current)==null||n[Math.max(b-3,0)].scrollIntoView({behavior:"smooth"})},children:st.jsx(hM,{className:"h-5 w-5"})})]})})]})})}function SS({children:b,title:e}){return st.jsxs("div",{className:"max-w-xl mx-auto h-full relative flex flex-col",children:[st.jsx("div",{className:"w-full p-4 font-medium text-large text-white bg-blue-600",children:st.jsx("span",{className:"line-clamp-2",children:e})}),b]})}function bM(){const[b,e]=nn.useState(!0),[i,n]=nn.useState(null),[l,o]=nn.useState(Array.from({length:Us.length},()=>0));function u(d){n(d),e(!1)}return b?st.jsx(SS,{title:"Конспект за Държавен Изпит",children:st.jsx(mM,{selectedIndex:i,onChange:u})}):st.jsxs(SS,{title:`${i+1}: ${Us[i].title}`,children:[st.jsxs("div",{className:"flex-1 overflow-y-scroll",children:[st.jsx(vM,{file:Us[i].files[l[i]]},Us[i].files[l[i]]),st.jsxs("div",{className:"absolute bottom-14 flex justify-between p-2 w-full z-999",children:[st.jsx("button",{className:"cursor-pointer p-2 rounded-full bg-blue-600 text-white",onClick:()=>{e(!0)},children:st.jsx(dM,{className:"fill-gray-100"})}),st.jsx("div",{className:"flex space-x-1",children:Us[i].files.map((d,f)=>st.jsxs("button",{className:`flex-1 cursor-pointer px-2 py-1 rounded-md text-xs whitespace-nowrap ${l[i]===f?"bg-blue-100 text-blue-800 font-medium":"bg-gray-100 hover:bg-gray-200"}`,onClick:()=>{o(g=>{const m=[...g];return m[i]=f,m})},children:["Version ",f+1]},d))})]})]}),st.jsx("div",{className:"w-full flex flex-col space-y-2",children:st.jsxs("div",{className:"flex bg-gray-100 border-t border-blue-200 text-center",children:[i===0?st.jsx("div",{className:"flex-1 border-r border-blue-200"}):st.jsxs("div",{onClick:()=>n(d=>d-1),className:"border-r border-blue-200 w-1/2 flex-1 p-4 hover:bg-blue-200 cursor-pointer flex align-center justify-start",children:[st.jsx(fM,{}),st.jsxs("span",{className:"ml-2 truncate w-full ",children:[i,": ",Us[i-1].title]})]}),i===Us.length-1?st.jsx("div",{className:"flex-1"}):st.jsxs("div",{onClick:()=>n(d=>d+1),className:"flex-1 p-4 hover:bg-blue-200 w-1/2 cursor-pointer flex align-center justify-end",children:[st.jsxs("span",{className:"mr-2 w-full truncate",children:[i+2,": ",Us[i+1].title]}),st.jsx(gM,{})]})]})})]})}function vM({file:b}){const[e,i]=nn.useState(null),[n,l]=nn.useState(!0),[o,u]=nn.useState(null);return nn.useEffect(()=>{(async()=>{try{l(!0);const f=await fetch(`/files_html/${b}`);if(!f.ok)throw new Error(`Failed to load file: ${f.status}`);let g=await f.text();g=`
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap">
<style>
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
line-height: 1.5;
color: #333;
padding: 20px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
padding-bottom: 56px;
}
pre, code {
font-family: 'SF Mono', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}
</style>
</head>
<body>
${g}
</body>
</html>
`,i(g),u(null)}catch(f){console.error("Error loading file:",f),u(f.message)}finally{l(!1)}})()},[b]),o?st.jsxs("div",{className:"text-red-500 p-4 border border-red-300 rounded",children:["Error: ",o]}):n?st.jsx("div",{className:"p-4 flex justify-center items-center h-40",children:st.jsx("div",{className:"animate-pulse",children:"Loading..."})}):st.jsx("div",{className:"w-full h-full border border-gray-300 rounded overflow-hidden",children:st.jsx("iframe",{srcDoc:e,title:`File: ${b}`,className:"w-full h-full border-0",allow:"fullscreen"},b)})}lx.createRoot(document.getElementById("root")).render(st.jsx(nn.StrictMode,{children:st.jsx(bM,{})}));"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/service-worker.js").then(b=>{console.log("SW registered:",b)}).catch(b=>{console.log("SW registration failed:",b)})});