@3rtools/tyts-mcp 1.16.2 → 1.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,236 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var JF=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function s4(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yy={exports:{}},Zh={};var Wv;function JE(){if(Wv)return Zh;Wv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,s){var l=null;if(s!==void 0&&(l=""+s),i.key!==void 0&&(l=""+i.key),"key"in i){s={};for(var c in i)c!=="key"&&(s[c]=i[c])}else s=i;return i=s.ref,{$$typeof:e,type:r,key:l,ref:i!==void 0?i:null,props:s}}return Zh.Fragment=t,Zh.jsx=n,Zh.jsxs=n,Zh}var Xv;function ZE(){return Xv||(Xv=1,yy.exports=JE()),yy.exports}var A=ZE(),by={exports:{}},Wn={};var Gv;function QE(){if(Gv)return Wn;Gv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function y(Z){return Z===null||typeof Z!="object"?null:(Z=b&&Z[b]||Z["@@iterator"],typeof Z=="function"?Z:null)}var M={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,D={};function L(Z,P,j){this.props=Z,this.context=P,this.refs=D,this.updater=j||M}L.prototype.isReactComponent={},L.prototype.setState=function(Z,P){if(typeof Z!="object"&&typeof Z!="function"&&Z!=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,Z,P,"setState")},L.prototype.forceUpdate=function(Z){this.updater.enqueueForceUpdate(this,Z,"forceUpdate")};function q(){}q.prototype=L.prototype;function $(Z,P,j){this.props=Z,this.context=P,this.refs=D,this.updater=j||M}var Y=$.prototype=new q;Y.constructor=$,E(Y,L.prototype),Y.isPureReactComponent=!0;var ht=Array.isArray;function Mt(){}var vt={H:null,A:null,T:null,S:null},bt=Object.prototype.hasOwnProperty;function rt(Z,P,j){var G=j.ref;return{$$typeof:e,type:Z,key:P,ref:G!==void 0?G:null,props:j}}function Dt(Z,P){return rt(Z.type,P,Z.props)}function Q(Z){return typeof Z=="object"&&Z!==null&&Z.$$typeof===e}function lt(Z){var P={"=":"=0",":":"=2"};return"$"+Z.replace(/[=:]/g,function(j){return P[j]})}var X=/\/+/g;function wt(Z,P){return typeof Z=="object"&&Z!==null&&Z.key!=null?lt(""+Z.key):P.toString(36)}function Tt(Z){switch(Z.status){case"fulfilled":return Z.value;case"rejected":throw Z.reason;default:switch(typeof Z.status=="string"?Z.then(Mt,Mt):(Z.status="pending",Z.then(function(P){Z.status==="pending"&&(Z.status="fulfilled",Z.value=P)},function(P){Z.status==="pending"&&(Z.status="rejected",Z.reason=P)})),Z.status){case"fulfilled":return Z.value;case"rejected":throw Z.reason}}throw Z}function yt(Z,P,j,G,ut){var xt=typeof Z;(xt==="undefined"||xt==="boolean")&&(Z=null);var St=!1;if(Z===null)St=!0;else switch(xt){case"bigint":case"string":case"number":St=!0;break;case"object":switch(Z.$$typeof){case e:case t:St=!0;break;case p:return St=Z._init,yt(St(Z._payload),P,j,G,ut)}}if(St)return ut=ut(Z),St=G===""?"."+wt(Z,0):G,ht(ut)?(j="",St!=null&&(j=St.replace(X,"$&/")+"/"),yt(ut,P,j,"",function(Qt){return Qt})):ut!=null&&(Q(ut)&&(ut=Dt(ut,j+(ut.key==null||Z&&Z.key===ut.key?"":(""+ut.key).replace(X,"$&/")+"/")+St)),P.push(ut)),1;St=0;var Ft=G===""?".":G+":";if(ht(Z))for(var Rt=0;Rt<Z.length;Rt++)G=Z[Rt],xt=Ft+wt(G,Rt),St+=yt(G,P,j,xt,ut);else if(Rt=y(Z),typeof Rt=="function")for(Z=Rt.call(Z),Rt=0;!(G=Z.next()).done;)G=G.value,xt=Ft+wt(G,Rt++),St+=yt(G,P,j,xt,ut);else if(xt==="object"){if(typeof Z.then=="function")return yt(Tt(Z),P,j,G,ut);throw P=String(Z),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(Z).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return St}function J(Z,P,j){if(Z==null)return Z;var G=[],ut=0;return yt(Z,G,"","",function(xt){return P.call(j,xt,ut++)}),G}function ct(Z){if(Z._status===-1){var P=Z._result;P=P(),P.then(function(j){(Z._status===0||Z._status===-1)&&(Z._status=1,Z._result=j)},function(j){(Z._status===0||Z._status===-1)&&(Z._status=2,Z._result=j)}),Z._status===-1&&(Z._status=0,Z._result=P)}if(Z._status===1)return Z._result.default;throw Z._result}var Bt=typeof reportError=="function"?reportError:function(Z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var P=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof Z=="object"&&Z!==null&&typeof Z.message=="string"?String(Z.message):String(Z),error:Z});if(!window.dispatchEvent(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",Z);return}console.error(Z)},te={map:J,forEach:function(Z,P,j){J(Z,function(){P.apply(this,arguments)},j)},count:function(Z){var P=0;return J(Z,function(){P++}),P},toArray:function(Z){return J(Z,function(P){return P})||[]},only:function(Z){if(!Q(Z))throw Error("React.Children.only expected to receive a single React element child.");return Z}};return Wn.Activity=g,Wn.Children=te,Wn.Component=L,Wn.Fragment=n,Wn.Profiler=i,Wn.PureComponent=$,Wn.StrictMode=r,Wn.Suspense=f,Wn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=vt,Wn.__COMPILER_RUNTIME={__proto__:null,c:function(Z){return vt.H.useMemoCache(Z)}},Wn.cache=function(Z){return function(){return Z.apply(null,arguments)}},Wn.cacheSignal=function(){return null},Wn.cloneElement=function(Z,P,j){if(Z==null)throw Error("The argument must be a React element, but you passed "+Z+".");var G=E({},Z.props),ut=Z.key;if(P!=null)for(xt in P.key!==void 0&&(ut=""+P.key),P)!bt.call(P,xt)||xt==="key"||xt==="__self"||xt==="__source"||xt==="ref"&&P.ref===void 0||(G[xt]=P[xt]);var xt=arguments.length-2;if(xt===1)G.children=j;else if(1<xt){for(var St=Array(xt),Ft=0;Ft<xt;Ft++)St[Ft]=arguments[Ft+2];G.children=St}return rt(Z.type,ut,G)},Wn.createContext=function(Z){return Z={$$typeof:l,_currentValue:Z,_currentValue2:Z,_threadCount:0,Provider:null,Consumer:null},Z.Provider=Z,Z.Consumer={$$typeof:s,_context:Z},Z},Wn.createElement=function(Z,P,j){var G,ut={},xt=null;if(P!=null)for(G in P.key!==void 0&&(xt=""+P.key),P)bt.call(P,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(ut[G]=P[G]);var St=arguments.length-2;if(St===1)ut.children=j;else if(1<St){for(var Ft=Array(St),Rt=0;Rt<St;Rt++)Ft[Rt]=arguments[Rt+2];ut.children=Ft}if(Z&&Z.defaultProps)for(G in St=Z.defaultProps,St)ut[G]===void 0&&(ut[G]=St[G]);return rt(Z,xt,ut)},Wn.createRef=function(){return{current:null}},Wn.forwardRef=function(Z){return{$$typeof:c,render:Z}},Wn.isValidElement=Q,Wn.lazy=function(Z){return{$$typeof:p,_payload:{_status:-1,_result:Z},_init:ct}},Wn.memo=function(Z,P){return{$$typeof:d,type:Z,compare:P===void 0?null:P}},Wn.startTransition=function(Z){var P=vt.T,j={};vt.T=j;try{var G=Z(),ut=vt.S;ut!==null&&ut(j,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(Mt,Bt)}catch(xt){Bt(xt)}finally{P!==null&&j.types!==null&&(P.types=j.types),vt.T=P}},Wn.unstable_useCacheRefresh=function(){return vt.H.useCacheRefresh()},Wn.use=function(Z){return vt.H.use(Z)},Wn.useActionState=function(Z,P,j){return vt.H.useActionState(Z,P,j)},Wn.useCallback=function(Z,P){return vt.H.useCallback(Z,P)},Wn.useContext=function(Z){return vt.H.useContext(Z)},Wn.useDebugValue=function(){},Wn.useDeferredValue=function(Z,P){return vt.H.useDeferredValue(Z,P)},Wn.useEffect=function(Z,P){return vt.H.useEffect(Z,P)},Wn.useEffectEvent=function(Z){return vt.H.useEffectEvent(Z)},Wn.useId=function(){return vt.H.useId()},Wn.useImperativeHandle=function(Z,P,j){return vt.H.useImperativeHandle(Z,P,j)},Wn.useInsertionEffect=function(Z,P){return vt.H.useInsertionEffect(Z,P)},Wn.useLayoutEffect=function(Z,P){return vt.H.useLayoutEffect(Z,P)},Wn.useMemo=function(Z,P){return vt.H.useMemo(Z,P)},Wn.useOptimistic=function(Z,P){return vt.H.useOptimistic(Z,P)},Wn.useReducer=function(Z,P,j){return vt.H.useReducer(Z,P,j)},Wn.useRef=function(Z){return vt.H.useRef(Z)},Wn.useState=function(Z){return vt.H.useState(Z)},Wn.useSyncExternalStore=function(Z,P,j){return vt.H.useSyncExternalStore(Z,P,j)},Wn.useTransition=function(){return vt.H.useTransition()},Wn.version="19.2.4",Wn}var Kv;function Qp(){return Kv||(Kv=1,by.exports=QE()),by.exports}var I=Qp();const eu=s4(I);var xy={exports:{}},Qh={},vy={exports:{}},wy={};var Jv;function tT(){return Jv||(Jv=1,(function(e){function t(yt,J){var ct=yt.length;yt.push(J);t:for(;0<ct;){var Bt=ct-1>>>1,te=yt[Bt];if(0<i(te,J))yt[Bt]=J,yt[ct]=te,ct=Bt;else break t}}function n(yt){return yt.length===0?null:yt[0]}function r(yt){if(yt.length===0)return null;var J=yt[0],ct=yt.pop();if(ct!==J){yt[0]=ct;t:for(var Bt=0,te=yt.length,Z=te>>>1;Bt<Z;){var P=2*(Bt+1)-1,j=yt[P],G=P+1,ut=yt[G];if(0>i(j,ct))G<te&&0>i(ut,j)?(yt[Bt]=ut,yt[G]=ct,Bt=G):(yt[Bt]=j,yt[P]=ct,Bt=P);else if(G<te&&0>i(ut,ct))yt[Bt]=ut,yt[G]=ct,Bt=G;else break t}}return J}function i(yt,J){var ct=yt.sortIndex-J.sortIndex;return ct!==0?ct:yt.id-J.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var f=[],d=[],p=1,g=null,b=3,y=!1,M=!1,E=!1,D=!1,L=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;function Y(yt){for(var J=n(d);J!==null;){if(J.callback===null)r(d);else if(J.startTime<=yt)r(d),J.sortIndex=J.expirationTime,t(f,J);else break;J=n(d)}}function ht(yt){if(E=!1,Y(yt),!M)if(n(f)!==null)M=!0,Mt||(Mt=!0,lt());else{var J=n(d);J!==null&&Tt(ht,J.startTime-yt)}}var Mt=!1,vt=-1,bt=5,rt=-1;function Dt(){return D?!0:!(e.unstable_now()-rt<bt)}function Q(){if(D=!1,Mt){var yt=e.unstable_now();rt=yt;var J=!0;try{t:{M=!1,E&&(E=!1,q(vt),vt=-1),y=!0;var ct=b;try{e:{for(Y(yt),g=n(f);g!==null&&!(g.expirationTime>yt&&Dt());){var Bt=g.callback;if(typeof Bt=="function"){g.callback=null,b=g.priorityLevel;var te=Bt(g.expirationTime<=yt);if(yt=e.unstable_now(),typeof te=="function"){g.callback=te,Y(yt),J=!0;break e}g===n(f)&&r(f),Y(yt)}else r(f);g=n(f)}if(g!==null)J=!0;else{var Z=n(d);Z!==null&&Tt(ht,Z.startTime-yt),J=!1}}break t}finally{g=null,b=ct,y=!1}J=void 0}}finally{J?lt():Mt=!1}}}var lt;if(typeof $=="function")lt=function(){$(Q)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,wt=X.port2;X.port1.onmessage=Q,lt=function(){wt.postMessage(null)}}else lt=function(){L(Q,0)};function Tt(yt,J){vt=L(function(){yt(e.unstable_now())},J)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(yt){yt.callback=null},e.unstable_forceFrameRate=function(yt){0>yt||125<yt?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):bt=0<yt?Math.floor(1e3/yt):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(yt){switch(b){case 1:case 2:case 3:var J=3;break;default:J=b}var ct=b;b=J;try{return yt()}finally{b=ct}},e.unstable_requestPaint=function(){D=!0},e.unstable_runWithPriority=function(yt,J){switch(yt){case 1:case 2:case 3:case 4:case 5:break;default:yt=3}var ct=b;b=yt;try{return J()}finally{b=ct}},e.unstable_scheduleCallback=function(yt,J,ct){var Bt=e.unstable_now();switch(typeof ct=="object"&&ct!==null?(ct=ct.delay,ct=typeof ct=="number"&&0<ct?Bt+ct:Bt):ct=Bt,yt){case 1:var te=-1;break;case 2:te=250;break;case 5:te=1073741823;break;case 4:te=1e4;break;default:te=5e3}return te=ct+te,yt={id:p++,callback:J,priorityLevel:yt,startTime:ct,expirationTime:te,sortIndex:-1},ct>Bt?(yt.sortIndex=ct,t(d,yt),n(f)===null&&yt===n(d)&&(E?(q(vt),vt=-1):E=!0,Tt(ht,ct-Bt))):(yt.sortIndex=te,t(f,yt),M||y||(M=!0,Mt||(Mt=!0,lt()))),yt},e.unstable_shouldYield=Dt,e.unstable_wrapCallback=function(yt){var J=b;return function(){var ct=b;b=J;try{return yt.apply(this,arguments)}finally{b=ct}}}})(wy)),wy}var Zv;function eT(){return Zv||(Zv=1,vy.exports=tT()),vy.exports}var Sy={exports:{}},sa={};var Qv;function nT(){if(Qv)return sa;Qv=1;var e=Qp();function t(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(f,d,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:g==null?null:""+g,children:f,containerInfo:d,implementation:p}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(f,d){if(f==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return sa.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,sa.createPortal=function(f,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return s(f,d,null,p)},sa.flushSync=function(f){var d=l.T,p=r.p;try{if(l.T=null,r.p=2,f)return f()}finally{l.T=d,r.p=p,r.d.f()}},sa.preconnect=function(f,d){typeof f=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(f,d))},sa.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},sa.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var p=d.as,g=c(p,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,y=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?r.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:y}):p==="script"&&r.d.X(f,{crossOrigin:g,integrity:b,fetchPriority:y,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},sa.preinitModule=function(f,d){if(typeof f=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=c(d.as,d.crossOrigin);r.d.M(f,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(f)},sa.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,g=c(p,d.crossOrigin);r.d.L(f,p,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},sa.preloadModule=function(f,d){if(typeof f=="string")if(d){var p=c(d.as,d.crossOrigin);r.d.m(f,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(f)},sa.requestFormReset=function(f){r.d.r(f)},sa.unstable_batchedUpdates=function(f,d){return f(d)},sa.useFormState=function(f,d,p){return l.H.useFormState(f,d,p)},sa.useFormStatus=function(){return l.H.useHostTransitionStatus()},sa.version="19.2.4",sa}var tw;function a4(){if(tw)return Sy.exports;tw=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Sy.exports=nT(),Sy.exports}var ew;function rT(){if(ew)return Qh;ew=1;var e=eT(),t=Qp(),n=a4();function r(o){var a="https://react.dev/errors/"+o;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+o+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function s(o){var a=o,u=o;if(o.alternate)for(;a.return;)a=a.return;else{o=a;do a=o,(a.flags&4098)!==0&&(u=a.return),o=a.return;while(o)}return a.tag===3?u:null}function l(o){if(o.tag===13){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function c(o){if(o.tag===31){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function f(o){if(s(o)!==o)throw Error(r(188))}function d(o){var a=o.alternate;if(!a){if(a=s(o),a===null)throw Error(r(188));return a!==o?null:o}for(var u=o,h=a;;){var x=u.return;if(x===null)break;var S=x.alternate;if(S===null){if(h=x.return,h!==null){u=h;continue}break}if(x.child===S.child){for(S=x.child;S;){if(S===u)return f(x),o;if(S===h)return f(x),a;S=S.sibling}throw Error(r(188))}if(u.return!==h.return)u=x,h=S;else{for(var O=!1,et=x.child;et;){if(et===u){O=!0,u=x,h=S;break}if(et===h){O=!0,h=x,u=S;break}et=et.sibling}if(!O){for(et=S.child;et;){if(et===u){O=!0,u=S,h=x;break}if(et===h){O=!0,h=S,u=x;break}et=et.sibling}if(!O)throw Error(r(189))}}if(u.alternate!==h)throw Error(r(190))}if(u.tag!==3)throw Error(r(188));return u.stateNode.current===u?o:a}function p(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o;for(o=o.child;o!==null;){if(a=p(o),a!==null)return a;o=o.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),$=Symbol.for("react.context"),Y=Symbol.for("react.forward_ref"),ht=Symbol.for("react.suspense"),Mt=Symbol.for("react.suspense_list"),vt=Symbol.for("react.memo"),bt=Symbol.for("react.lazy"),rt=Symbol.for("react.activity"),Dt=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function lt(o){return o===null||typeof o!="object"?null:(o=Q&&o[Q]||o["@@iterator"],typeof o=="function"?o:null)}var X=Symbol.for("react.client.reference");function wt(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===X?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case E:return"Fragment";case L:return"Profiler";case D:return"StrictMode";case ht:return"Suspense";case Mt:return"SuspenseList";case rt:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case M:return"Portal";case $:return o.displayName||"Context";case q:return(o._context.displayName||"Context")+".Consumer";case Y:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case vt:return a=o.displayName||null,a!==null?a:wt(o.type)||"Memo";case bt:a=o._payload,o=o._init;try{return wt(o(a))}catch{}}return null}var Tt=Array.isArray,yt=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ct={pending:!1,data:null,method:null,action:null},Bt=[],te=-1;function Z(o){return{current:o}}function P(o){0>te||(o.current=Bt[te],Bt[te]=null,te--)}function j(o,a){te++,Bt[te]=o.current,o.current=a}var G=Z(null),ut=Z(null),xt=Z(null),St=Z(null);function Ft(o,a){switch(j(xt,a),j(ut,o),j(G,null),a.nodeType){case 9:case 11:o=(o=a.documentElement)&&(o=o.namespaceURI)?gv(o):0;break;default:if(o=a.tagName,a=a.namespaceURI)a=gv(a),o=yv(a,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}P(G),j(G,o)}function Rt(){P(G),P(ut),P(xt)}function Qt(o){o.memoizedState!==null&&j(St,o);var a=G.current,u=yv(a,o.type);a!==u&&(j(ut,o),j(G,u))}function ve(o){ut.current===o&&(P(G),P(ut)),St.current===o&&(P(St),Xh._currentValue=ct)}var je,Pe;function Ve(o){if(je===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);je=a&&a[1]||"",Pe=-1<u.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+je+o+Pe}var ft=!1;function Oe(o,a){if(!o||ft)return"";ft=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(ee){var Zt=ee}Reflect.construct(o,[],pe)}else{try{pe.call()}catch(ee){Zt=ee}o.call(pe.prototype)}}else{try{throw Error()}catch(ee){Zt=ee}(pe=o())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(ee){if(ee&&Zt&&typeof ee.stack=="string")return[ee.stack,Zt.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var S=h.DetermineComponentFrameRoot(),O=S[0],et=S[1];if(O&&et){var Ct=O.split(`
4
+ `),Kt=et.split(`
5
+ `);for(x=h=0;h<Ct.length&&!Ct[h].includes("DetermineComponentFrameRoot");)h++;for(;x<Kt.length&&!Kt[x].includes("DetermineComponentFrameRoot");)x++;if(h===Ct.length||x===Kt.length)for(h=Ct.length-1,x=Kt.length-1;1<=h&&0<=x&&Ct[h]!==Kt[x];)x--;for(;1<=h&&0<=x;h--,x--)if(Ct[h]!==Kt[x]){if(h!==1||x!==1)do if(h--,x--,0>x||Ct[h]!==Kt[x]){var ae=`
6
+ `+Ct[h].replace(" at new "," at ");return o.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",o.displayName)),ae}while(1<=h&&0<=x);break}}}finally{ft=!1,Error.prepareStackTrace=u}return(u=o?o.displayName||o.name:"")?Ve(u):""}function In(o,a){switch(o.tag){case 26:case 27:case 5:return Ve(o.type);case 16:return Ve("Lazy");case 13:return o.child!==a&&a!==null?Ve("Suspense Fallback"):Ve("Suspense");case 19:return Ve("SuspenseList");case 0:case 15:return Oe(o.type,!1);case 11:return Oe(o.type.render,!1);case 1:return Oe(o.type,!0);case 31:return Ve("Activity");default:return""}}function fe(o){try{var a="",u=null;do a+=In(o,u),u=o,o=o.return;while(o);return a}catch(h){return`
7
+ Error generating stack: `+h.message+`
8
+ `+h.stack}}var ge=Object.prototype.hasOwnProperty,Te=e.unstable_scheduleCallback,Ne=e.unstable_cancelCallback,_e=e.unstable_shouldYield,Ye=e.unstable_requestPaint,un=e.unstable_now,Fn=e.unstable_getCurrentPriorityLevel,Ue=e.unstable_ImmediatePriority,_n=e.unstable_UserBlockingPriority,dn=e.unstable_NormalPriority,Be=e.unstable_LowPriority,We=e.unstable_IdlePriority,Ie=e.log,kr=e.unstable_setDisableYieldValue,Cn=null,nn=null;function ln(o){if(typeof Ie=="function"&&kr(o),nn&&typeof nn.setStrictMode=="function")try{nn.setStrictMode(Cn,o)}catch{}}var Ln=Math.clz32?Math.clz32:wn,Ke=Math.log,ar=Math.LN2;function wn(o){return o>>>=0,o===0?32:31-(Ke(o)/ar|0)|0}var Sn=256,gr=262144,En=4194304;function en(o){var a=o&42;if(a!==0)return a;switch(o&-o){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:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Kn(o,a,u){var h=o.pendingLanes;if(h===0)return 0;var x=0,S=o.suspendedLanes,O=o.pingedLanes;o=o.warmLanes;var et=h&134217727;return et!==0?(h=et&~S,h!==0?x=en(h):(O&=et,O!==0?x=en(O):u||(u=et&~o,u!==0&&(x=en(u))))):(et=h&~S,et!==0?x=en(et):O!==0?x=en(O):u||(u=h&~o,u!==0&&(x=en(u)))),x===0?0:a!==0&&a!==x&&(a&S)===0&&(S=x&-x,u=a&-a,S>=u||S===32&&(u&4194048)!==0)?a:x}function ws(o,a){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&a)===0}function qi(o,a){switch(o){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 Xt(){var o=En;return En<<=1,(En&62914560)===0&&(En=4194304),o}function Re(o){for(var a=[],u=0;31>u;u++)a.push(o);return a}function Ae(o,a){o.pendingLanes|=a,a!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function De(o,a,u,h,x,S){var O=o.pendingLanes;o.pendingLanes=u,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=u,o.entangledLanes&=u,o.errorRecoveryDisabledLanes&=u,o.shellSuspendCounter=0;var et=o.entanglements,Ct=o.expirationTimes,Kt=o.hiddenUpdates;for(u=O&~u;0<u;){var ae=31-Ln(u),pe=1<<ae;et[ae]=0,Ct[ae]=-1;var Zt=Kt[ae];if(Zt!==null)for(Kt[ae]=null,ae=0;ae<Zt.length;ae++){var ee=Zt[ae];ee!==null&&(ee.lane&=-536870913)}u&=~pe}h!==0&&or(o,h,0),S!==0&&x===0&&o.tag!==0&&(o.suspendedLanes|=S&~(O&~a))}function or(o,a,u){o.pendingLanes|=a,o.suspendedLanes&=~a;var h=31-Ln(a);o.entangledLanes|=a,o.entanglements[h]=o.entanglements[h]|1073741824|u&261930}function Hn(o,a){var u=o.entangledLanes|=a;for(o=o.entanglements;u;){var h=31-Ln(u),x=1<<h;x&a|o[h]&a&&(o[h]|=a),u&=~x}}function lr(o,a){var u=a&-a;return u=(u&42)!==0?1:Wr(u),(u&(o.suspendedLanes|a))!==0?0:u}function Wr(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=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:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function Dr(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function vi(){var o=J.p;return o!==0?o:(o=window.event,o===void 0?32:Fv(o.type))}function Wt(o,a){var u=J.p;try{return J.p=o,a()}finally{J.p=u}}var qr=Math.random().toString(36).slice(2),er="__reactFiber$"+qr,Rn="__reactProps$"+qr,oo="__reactContainer$"+qr,Wo="__reactEvents$"+qr,Us="__reactListeners$"+qr,Ja="__reactHandles$"+qr,Hs="__reactResources$"+qr,Lo="__reactMarker$"+qr;function is(o){delete o[er],delete o[Rn],delete o[Wo],delete o[Us],delete o[Ja]}function qs(o){var a=o[er];if(a)return a;for(var u=o.parentNode;u;){if(a=u[oo]||u[er]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(o=Av(o);o!==null;){if(u=o[er])return u;o=Av(o)}return a}o=u,u=o.parentNode}return null}function pi(o){if(o=o[er]||o[oo]){var a=o.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return o}return null}function Ar(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o.stateNode;throw Error(r(33))}function Aa(o){var a=o[Hs];return a||(a=o[Hs]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Ti(o){o[Lo]=!0}var Wl=new Set,Xo={};function Go(o,a){Ma(o,a),Ma(o+"Capture",a)}function Ma(o,a){for(Xo[o]=a,o=0;o<a.length;o++)Wl.add(a[o])}var Mc=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]*$"),Ca={},Cc={};function jf(o){return ge.call(Cc,o)?!0:ge.call(Ca,o)?!1:Mc.test(o)?Cc[o]=!0:(Ca[o]=!0,!1)}function $s(o,a,u){if(jf(a))if(u===null)o.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":o.removeAttribute(a);return;case"boolean":var h=a.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){o.removeAttribute(a);return}}o.setAttribute(a,""+u)}}function Ea(o,a,u){if(u===null)o.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(a);return}o.setAttribute(a,""+u)}}function Ys(o,a,u,h){if(h===null)o.removeAttribute(u);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(u);return}o.setAttributeNS(a,u,""+h)}}function sr(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Ec(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Ss(o,a,u){var h=Object.getOwnPropertyDescriptor(o.constructor.prototype,a);if(!o.hasOwnProperty(a)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var x=h.get,S=h.set;return Object.defineProperty(o,a,{configurable:!0,get:function(){return x.call(this)},set:function(O){u=""+O,S.call(this,O)}}),Object.defineProperty(o,a,{enumerable:h.enumerable}),{getValue:function(){return u},setValue:function(O){u=""+O},stopTracking:function(){o._valueTracker=null,delete o[a]}}}}function ss(o){if(!o._valueTracker){var a=Ec(o)?"checked":"value";o._valueTracker=Ss(o,a,""+o[a])}}function Ro(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var u=a.getValue(),h="";return o&&(h=Ec(o)?o.checked?"true":"false":o.value),o=h,o!==u?(a.setValue(o),!0):!1}function yo(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var bl=/[\n"\\]/g;function Ni(o){return o.replace(bl,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Qi(o,a,u,h,x,S,O,et){o.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?o.type=O:o.removeAttribute("type"),a!=null?O==="number"?(a===0&&o.value===""||o.value!=a)&&(o.value=""+sr(a)):o.value!==""+sr(a)&&(o.value=""+sr(a)):O!=="submit"&&O!=="reset"||o.removeAttribute("value"),a!=null?Za(o,O,sr(a)):u!=null?Za(o,O,sr(u)):h!=null&&o.removeAttribute("value"),x==null&&S!=null&&(o.defaultChecked=!!S),x!=null&&(o.checked=x&&typeof x!="function"&&typeof x!="symbol"),et!=null&&typeof et!="function"&&typeof et!="symbol"&&typeof et!="boolean"?o.name=""+sr(et):o.removeAttribute("name")}function Tc(o,a,u,h,x,S,O,et){if(S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(o.type=S),a!=null||u!=null){if(!(S!=="submit"&&S!=="reset"||a!=null)){ss(o);return}u=u!=null?""+sr(u):"",a=a!=null?""+sr(a):u,et||a===o.value||(o.value=a),o.defaultValue=a}h=h??x,h=typeof h!="function"&&typeof h!="symbol"&&!!h,o.checked=et?o.checked:!!h,o.defaultChecked=!!h,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(o.name=O),ss(o)}function Za(o,a,u){a==="number"&&yo(o.ownerDocument)===o||o.defaultValue===""+u||(o.defaultValue=""+u)}function _i(o,a,u,h){if(o=o.options,a){a={};for(var x=0;x<u.length;x++)a["$"+u[x]]=!0;for(u=0;u<o.length;u++)x=a.hasOwnProperty("$"+o[u].value),o[u].selected!==x&&(o[u].selected=x),x&&h&&(o[u].defaultSelected=!0)}else{for(u=""+sr(u),a=null,x=0;x<o.length;x++){if(o[x].value===u){o[x].selected=!0,h&&(o[x].defaultSelected=!0);return}a!==null||o[x].disabled||(a=o[x])}a!==null&&(a.selected=!0)}}function as(o,a,u){if(a!=null&&(a=""+sr(a),a!==o.value&&(o.value=a),u==null)){o.defaultValue!==a&&(o.defaultValue=a);return}o.defaultValue=u!=null?""+sr(u):""}function wi(o,a,u,h){if(a==null){if(h!=null){if(u!=null)throw Error(r(92));if(Tt(h)){if(1<h.length)throw Error(r(93));h=h[0]}u=h}u==null&&(u=""),a=u}u=sr(a),o.defaultValue=u,h=o.textContent,h===u&&h!==""&&h!==null&&(o.value=h),ss(o)}function so(o,a){if(a){var u=o.firstChild;if(u&&u===o.lastChild&&u.nodeType===3){u.nodeValue=a;return}}o.textContent=a}var Mr=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 Ko(o,a,u){var h=a.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?h?o.setProperty(a,""):a==="float"?o.cssFloat="":o[a]="":h?o.setProperty(a,u):typeof u!="number"||u===0||Mr.has(a)?a==="float"?o.cssFloat=u:o[a]=(""+u).trim():o[a]=u+"px"}function to(o,a,u){if(a!=null&&typeof a!="object")throw Error(r(62));if(o=o.style,u!=null){for(var h in u)!u.hasOwnProperty(h)||a!=null&&a.hasOwnProperty(h)||(h.indexOf("--")===0?o.setProperty(h,""):h==="float"?o.cssFloat="":o[h]="");for(var x in a)h=a[x],a.hasOwnProperty(x)&&u[x]!==h&&Ko(o,x,h)}else for(var S in a)a.hasOwnProperty(S)&&Ko(o,S,a[S])}function Jo(o){if(o.indexOf("-")===-1)return!1;switch(o){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 Cr=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"]]),xl=/^[\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 ls(o){return xl.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function $i(){}var Jt=null;function iu(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var bo=null,An=null;function Qa(o){var a=pi(o);if(a&&(o=a.stateNode)){var u=o[Rn]||null;t:switch(o=a.stateNode,a.type){case"input":if(Qi(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),a=u.name,u.type==="radio"&&a!=null){for(u=o;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Ni(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var h=u[a];if(h!==o&&h.form===o.form){var x=h[Rn]||null;if(!x)throw Error(r(90));Qi(h,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(a=0;a<u.length;a++)h=u[a],h.form===o.form&&Ro(h)}break t;case"textarea":as(o,u.value,u.defaultValue);break t;case"select":a=u.value,a!=null&&_i(o,!!u.multiple,a,!1)}}}var Nc=!1;function Uu(o,a,u){if(Nc)return o(a,u);Nc=!0;try{var h=o(a);return h}finally{if(Nc=!1,(bo!==null||An!==null)&&(Sm(),bo&&(a=bo,o=An,An=bo=null,Qa(a),o)))for(a=0;a<o.length;a++)Qa(o[a])}}function Xl(o,a){var u=o.stateNode;if(u===null)return null;var h=u[Rn]||null;if(h===null)return null;u=h[a];t:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(o=o.type,h=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!h;break t;default:o=!1}if(o)return null;if(u&&typeof u!="function")throw Error(r(231,a,typeof u));return u}var Vs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ws=!1;if(Vs)try{var Oo={};Object.defineProperty(Oo,"passive",{get:function(){Ws=!0}}),window.addEventListener("test",Oo,Oo),window.removeEventListener("test",Oo,Oo)}catch{Ws=!1}var ks=null,Gl=null,Xs=null;function Kl(){if(Xs)return Xs;var o,a=Gl,u=a.length,h,x="value"in ks?ks.value:ks.textContent,S=x.length;for(o=0;o<u&&a[o]===x[o];o++);var O=u-o;for(h=1;h<=O&&a[u-h]===x[S-h];h++);return Xs=x.slice(o,1<h?1-h:void 0)}function cs(o){var a=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&a===13&&(o=13)):o=a,o===10&&(o=13),32<=o||o===13?o:0}function Jl(){return!0}function tl(){return!1}function qn(o){function a(u,h,x,S,O){this._reactName=u,this._targetInst=x,this.type=h,this.nativeEvent=S,this.target=O,this.currentTarget=null;for(var et in o)o.hasOwnProperty(et)&&(u=o[et],this[et]=u?u(S):S[et]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?Jl:tl,this.isPropagationStopped=tl,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=Jl)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Jl)},persist:function(){},isPersistent:Jl}),a}var As={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},us=qn(As),Gs=g({},As,{view:0,detail:0}),Ta=qn(Gs),Ks,Ms,Js,Zs=g({},Gs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xe,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Js&&(Js&&o.type==="mousemove"?(Ks=o.screenX-Js.screenX,Ms=o.screenY-Js.screenY):Ms=Ks=0,Js=o),Ks)},movementY:function(o){return"movementY"in o?o.movementY:Ms}}),vl=qn(Zs),Cs=g({},Zs,{dataTransfer:0}),Qs=qn(Cs),wl=g({},Gs,{relatedTarget:0}),Sl=qn(wl),Zl=g({},As,{animationName:0,elapsedTime:0,pseudoElement:0}),ma=qn(Zl),Ql=g({},As,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),C=qn(Ql),U=g({},As,{data:0}),pt=qn(U),Et={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},zt={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"},oe={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function me(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=oe[o])?!!a[o]:!1}function Xe(){return me}var on=g({},Gs,{key:function(o){if(o.key){var a=Et[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=cs(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?zt[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xe,charCode:function(o){return o.type==="keypress"?cs(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?cs(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),zn=qn(on),Un=g({},Zs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),cr=qn(Un),Yi=g({},Gs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xe}),Si=qn(Yi),Lr=g({},As,{propertyName:0,elapsedTime:0,pseudoElement:0}),oi=qn(Lr),Di=g({},Zs,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),si=qn(Di),ao=g({},As,{newState:0,oldState:0}),ta=qn(ao),kl=[9,13,27,32],fs=Vs&&"CompositionEvent"in window,ds=null;Vs&&"documentMode"in document&&(ds=document.documentMode);var ga=Vs&&"TextEvent"in window&&!ds,ya=Vs&&(!fs||ds&&8<ds&&11>=ds),Na=" ",Al=!1;function ce(o,a){switch(o){case"keyup":return kl.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ba(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var xo=!1;function On(o,a){switch(o){case"compositionend":return ba(a);case"keypress":return a.which!==32?null:(Al=!0,Na);case"textInput":return o=a.data,o===Na&&Al?null:o;default:return null}}function gn(o,a){if(xo)return o==="compositionend"||!fs&&ce(o,a)?(o=Kl(),Xs=Gl=ks=null,xo=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return ya&&a.locale!=="ko"?null:a.data;default:return null}}var Zo={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 tc(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!Zo[o.type]:a==="textarea"}function ec(o,a,u,h){bo?An?An.push(h):An=[h]:bo=h,a=Nm(a,"onChange"),0<a.length&&(u=new us("onChange","change",null,u,h),o.push({event:u,listeners:a}))}var Er=null,Li=null;function nc(o){uv(o,0)}function xa(o){var a=Ar(o);if(Ro(a))return o}function rc(o,a){if(o==="change")return a}var _a=!1;if(Vs){var Ml;if(Vs){var Vi="oninput"in document;if(!Vi){var Po=document.createElement("div");Po.setAttribute("oninput","return;"),Vi=typeof Po.oninput=="function"}Ml=Vi}else Ml=!1;_a=Ml&&(!document.documentMode||9<document.documentMode)}function Cl(){Er&&(Er.detachEvent("onpropertychange",Da),Li=Er=null)}function Da(o){if(o.propertyName==="value"&&xa(Li)){var a=[];ec(a,Li,o,iu(o)),Uu(nc,a)}}function el(o,a,u){o==="focusin"?(Cl(),Er=a,Li=u,Er.attachEvent("onpropertychange",Da)):o==="focusout"&&Cl()}function ic(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return xa(Li)}function nl(o,a){if(o==="click")return xa(a)}function Ri(o,a){if(o==="input"||o==="change")return xa(a)}function _c(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var Or=typeof Object.is=="function"?Object.is:_c;function jo(o,a){if(Or(o,a))return!0;if(typeof o!="object"||o===null||typeof a!="object"||a===null)return!1;var u=Object.keys(o),h=Object.keys(a);if(u.length!==h.length)return!1;for(h=0;h<u.length;h++){var x=u[h];if(!ge.call(a,x)||!Or(o[x],a[x]))return!1}return!0}function La(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function oc(o,a){var u=La(o);o=0;for(var h;u;){if(u.nodeType===3){if(h=o+u.textContent.length,o<=a&&h>=a)return{node:u,offset:a-o};o=h}t:{for(;u;){if(u.nextSibling){u=u.nextSibling;break t}u=u.parentNode}u=void 0}u=La(u)}}function hs(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?hs(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function eo(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var a=yo(o.document);a instanceof o.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)o=a.contentWindow;else break;a=yo(o.document)}return a}function ea(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a&&(a==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||a==="textarea"||o.contentEditable==="true")}var Qo=Vs&&"documentMode"in document&&11>=document.documentMode,ts=null,na=null,ps=null,xe=!1;function Pr(o,a,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;xe||ts==null||ts!==yo(h)||(h=ts,"selectionStart"in h&&ea(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),ps&&jo(ps,h)||(ps=h,h=Nm(na,"onSelect"),0<h.length&&(a=new us("onSelect","select",null,a,u),o.push({event:a,listeners:h}),a.target=ts)))}function vo(o,a){var u={};return u[o.toLowerCase()]=a.toLowerCase(),u["Webkit"+o]="webkit"+a,u["Moz"+o]="moz"+a,u}var ur={animationend:vo("Animation","AnimationEnd"),animationiteration:vo("Animation","AnimationIteration"),animationstart:vo("Animation","AnimationStart"),transitionrun:vo("Transition","TransitionRun"),transitionstart:vo("Transition","TransitionStart"),transitioncancel:vo("Transition","TransitionCancel"),transitionend:vo("Transition","TransitionEnd")},jr={},ai={};Vs&&(ai=document.createElement("div").style,"AnimationEvent"in window||(delete ur.animationend.animation,delete ur.animationiteration.animation,delete ur.animationstart.animation),"TransitionEvent"in window||delete ur.transitionend.transition);function Qr(o){if(jr[o])return jr[o];if(!ur[o])return o;var a=ur[o],u;for(u in a)if(a.hasOwnProperty(u)&&u in ai)return jr[o]=a[u];return o}var va=Qr("animationend"),Dc=Qr("animationiteration"),sc=Qr("animationstart"),ou=Qr("transitionrun"),If=Qr("transitionstart"),Td=Qr("transitioncancel"),Hu=Qr("transitionend"),El=new Map,Ra="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(" ");Ra.push("scrollEnd");function ra(o,a){El.set(o,a),Go(a,[o])}var Lc=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Es=[],ac=0,su=0;function Rc(){for(var o=ac,a=su=ac=0;a<o;){var u=Es[a];Es[a++]=null;var h=Es[a];Es[a++]=null;var x=Es[a];Es[a++]=null;var S=Es[a];if(Es[a++]=null,h!==null&&x!==null){var O=h.pending;O===null?x.next=x:(x.next=O.next,O.next=x),h.pending=x}S!==0&&Oc(u,x,S)}}function Tl(o,a,u,h){Es[ac++]=o,Es[ac++]=a,Es[ac++]=u,Es[ac++]=h,su|=h,o.lanes|=h,o=o.alternate,o!==null&&(o.lanes|=h)}function au(o,a,u,h){return Tl(o,a,u,h),wo(o)}function Oa(o,a){return Tl(o,null,null,a),wo(o)}function Oc(o,a,u){o.lanes|=u;var h=o.alternate;h!==null&&(h.lanes|=u);for(var x=!1,S=o.return;S!==null;)S.childLanes|=u,h=S.alternate,h!==null&&(h.childLanes|=u),S.tag===22&&(o=S.stateNode,o===null||o._visibility&1||(x=!0)),o=S,S=S.return;return o.tag===3?(S=o.stateNode,x&&a!==null&&(x=31-Ln(u),o=S.hiddenUpdates,h=o[x],h===null?o[x]=[a]:h.push(a),a.lane=u|536870912),S):null}function wo(o){if(50<Uh)throw Uh=0,U1=null,Error(r(185));for(var a=o.return;a!==null;)o=a,a=o.return;return o.tag===3?o.stateNode:null}var So={};function lu(o,a,u,h){this.tag=o,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Io(o,a,u,h){return new lu(o,a,u,h)}function cu(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Ts(o,a){var u=o.alternate;return u===null?(u=Io(o.tag,a,o.key,o.mode),u.elementType=o.elementType,u.type=o.type,u.stateNode=o.stateNode,u.alternate=o,o.alternate=u):(u.pendingProps=a,u.type=o.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=o.flags&65011712,u.childLanes=o.childLanes,u.lanes=o.lanes,u.child=o.child,u.memoizedProps=o.memoizedProps,u.memoizedState=o.memoizedState,u.updateQueue=o.updateQueue,a=o.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=o.sibling,u.index=o.index,u.ref=o.ref,u.refCleanup=o.refCleanup,u}function Pc(o,a){o.flags&=65011714;var u=o.alternate;return u===null?(o.childLanes=0,o.lanes=a,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=u.childLanes,o.lanes=u.lanes,o.child=u.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=u.memoizedProps,o.memoizedState=u.memoizedState,o.updateQueue=u.updateQueue,o.type=u.type,a=u.dependencies,o.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),o}function lc(o,a,u,h,x,S){var O=0;if(h=o,typeof o=="function")cu(o)&&(O=1);else if(typeof o=="string")O=BE(o,u,G.current)?26:o==="html"||o==="head"||o==="body"?27:5;else t:switch(o){case rt:return o=Io(31,u,a,x),o.elementType=rt,o.lanes=S,o;case E:return rl(u.children,x,S,a);case D:O=8,x|=24;break;case L:return o=Io(12,u,a,x|2),o.elementType=L,o.lanes=S,o;case ht:return o=Io(13,u,a,x),o.elementType=ht,o.lanes=S,o;case Mt:return o=Io(19,u,a,x),o.elementType=Mt,o.lanes=S,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case $:O=10;break t;case q:O=9;break t;case Y:O=11;break t;case vt:O=14;break t;case bt:O=16,h=null;break t}O=29,u=Error(r(130,o===null?"null":typeof o,"")),h=null}return a=Io(O,u,a,x),a.elementType=o,a.type=h,a.lanes=S,a}function rl(o,a,u,h){return o=Io(7,o,h,a),o.lanes=u,o}function jc(o,a,u){return o=Io(6,o,null,a),o.lanes=u,o}function uu(o){var a=Io(18,null,null,0);return a.stateNode=o,a}function cc(o,a,u){return a=Io(4,o.children!==null?o.children:[],o.key,a),a.lanes=u,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}var fu=new WeakMap;function Ns(o,a){if(typeof o=="object"&&o!==null){var u=fu.get(o);return u!==void 0?u:(a={value:o,source:a,stack:fe(a)},fu.set(o,a),a)}return{value:o,source:a,stack:fe(a)}}var uc=[],Nl=0,du=null,Ic=0,ia=[],_s=0,il=null,Ds=1,ko="";function ms(o,a){uc[Nl++]=Ic,uc[Nl++]=du,du=o,Ic=a}function zf(o,a,u){ia[_s++]=Ds,ia[_s++]=ko,ia[_s++]=il,il=o;var h=Ds;o=ko;var x=32-Ln(h)-1;h&=~(1<<x),u+=1;var S=32-Ln(a)+x;if(30<S){var O=x-x%5;S=(h&(1<<O)-1).toString(32),h>>=O,x-=O,Ds=1<<32-Ln(a)+x|u<<x|h,ko=S+o}else Ds=1<<S|u<<x|h,ko=o}function qu(o){o.return!==null&&(ms(o,1),zf(o,1,0))}function hu(o){for(;o===du;)du=uc[--Nl],uc[Nl]=null,Ic=uc[--Nl],uc[Nl]=null;for(;o===il;)il=ia[--_s],ia[_s]=null,ko=ia[--_s],ia[_s]=null,Ds=ia[--_s],ia[_s]=null}function Bf(o,a){ia[_s++]=Ds,ia[_s++]=ko,ia[_s++]=il,Ds=a.id,ko=a.overflow,il=o}var Oi=null,Xr=null,Yn=!1,zo=null,mi=!1,oa=Error(r(519));function ol(o){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw gs(Ns(a,o)),oa}function $u(o){var a=o.stateNode,u=o.type,h=o.memoizedProps;switch(a[er]=o,a[Rn]=h,u){case"dialog":pr("cancel",a),pr("close",a);break;case"iframe":case"object":case"embed":pr("load",a);break;case"video":case"audio":for(u=0;u<qh.length;u++)pr(qh[u],a);break;case"source":pr("error",a);break;case"img":case"image":case"link":pr("error",a),pr("load",a);break;case"details":pr("toggle",a);break;case"input":pr("invalid",a),Tc(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":pr("invalid",a);break;case"textarea":pr("invalid",a),wi(a,h.value,h.defaultValue,h.children)}u=h.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||a.textContent===""+u||h.suppressHydrationWarning===!0||pv(a.textContent,u)?(h.popover!=null&&(pr("beforetoggle",a),pr("toggle",a)),h.onScroll!=null&&pr("scroll",a),h.onScrollEnd!=null&&pr("scrollend",a),h.onClick!=null&&(a.onclick=$i),a=!0):a=!1,a||ol(o,!0)}function Pa(o){for(Oi=o.return;Oi;)switch(Oi.tag){case 5:case 31:case 13:mi=!1;return;case 27:case 3:mi=!0;return;default:Oi=Oi.return}}function lo(o){if(o!==Oi)return!1;if(!Yn)return Pa(o),Yn=!0,!1;var a=o.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=o.type,u=!(u!=="form"&&u!=="button")||ny(o.type,o.memoizedProps)),u=!u),u&&Xr&&ol(o),Pa(o),a===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Xr=kv(o)}else if(a===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Xr=kv(o)}else a===27?(a=Xr,ef(o.type)?(o=ay,ay=null,Xr=o):Xr=a):Xr=Oi?Pl(o.stateNode.nextSibling):null;return!0}function es(){Xr=Oi=null,Yn=!1}function zc(){var o=zo;return o!==null&&(Ha===null?Ha=o:Ha.push.apply(Ha,o),zo=null),o}function gs(o){zo===null?zo=[o]:zo.push(o)}var fc=Z(null),sl=null,ja=null;function _l(o,a,u){j(fc,a._currentValue),a._currentValue=u}function Ls(o){o._currentValue=fc.current,P(fc)}function dc(o,a,u){for(;o!==null;){var h=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,h!==null&&(h.childLanes|=a)):h!==null&&(h.childLanes&a)!==a&&(h.childLanes|=a),o===u)break;o=o.return}}function hc(o,a,u,h){var x=o.child;for(x!==null&&(x.return=o);x!==null;){var S=x.dependencies;if(S!==null){var O=x.child;S=S.firstContext;t:for(;S!==null;){var et=S;S=x;for(var Ct=0;Ct<a.length;Ct++)if(et.context===a[Ct]){S.lanes|=u,et=S.alternate,et!==null&&(et.lanes|=u),dc(S.return,u,o),h||(O=null);break t}S=et.next}}else if(x.tag===18){if(O=x.return,O===null)throw Error(r(341));O.lanes|=u,S=O.alternate,S!==null&&(S.lanes|=u),dc(O,u,o),O=null}else O=x.child;if(O!==null)O.return=x;else for(O=x;O!==null;){if(O===o){O=null;break}if(x=O.sibling,x!==null){x.return=O.return,O=x;break}O=O.return}x=O}}function Dl(o,a,u,h){o=null;for(var x=a,S=!1;x!==null;){if(!S){if((x.flags&524288)!==0)S=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var O=x.alternate;if(O===null)throw Error(r(387));if(O=O.memoizedProps,O!==null){var et=x.type;Or(x.pendingProps.value,O.value)||(o!==null?o.push(et):o=[et])}}else if(x===St.current){if(O=x.alternate,O===null)throw Error(r(387));O.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(o!==null?o.push(Xh):o=[Xh])}x=x.return}o!==null&&hc(a,o,u,h),a.flags|=262144}function Yu(o){for(o=o.firstContext;o!==null;){if(!Or(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function Ll(o){sl=o,ja=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function co(o){return pu(sl,o)}function Vu(o,a){return sl===null&&Ll(o),pu(o,a)}function pu(o,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},ja===null){if(o===null)throw Error(r(308));ja=a,o.dependencies={lanes:0,firstContext:a},o.flags|=524288}else ja=ja.next=a;return u}var Bc=typeof AbortController<"u"?AbortController:function(){var o=[],a=this.signal={aborted:!1,addEventListener:function(u,h){o.push(h)}};this.abort=function(){a.aborted=!0,o.forEach(function(u){return u()})}},Ff=e.unstable_scheduleCallback,Uf=e.unstable_NormalPriority,Pi={$$typeof:$,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ia(){return{controller:new Bc,data:new Map,refCount:0}}function Fc(o){o.refCount--,o.refCount===0&&Ff(Uf,function(){o.controller.abort()})}var Uc=null,Hc=0,m=0,v=null;function T(o,a){if(Uc===null){var u=Uc=[];Hc=0,m=W1(),v={status:"pending",value:void 0,then:function(h){u.push(h)}}}return Hc++,a.then(R,R),a}function R(){if(--Hc===0&&Uc!==null){v!==null&&(v.status="fulfilled");var o=Uc;Uc=null,m=0,v=null;for(var a=0;a<o.length;a++)(0,o[a])()}}function H(o,a){var u=[],h={status:"pending",value:null,reason:null,then:function(x){u.push(x)}};return o.then(function(){h.status="fulfilled",h.value=a;for(var x=0;x<u.length;x++)(0,u[x])(a)},function(x){for(h.status="rejected",h.reason=x,x=0;x<u.length;x++)(0,u[x])(void 0)}),h}var V=yt.S;yt.S=function(o,a){zx=un(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&T(o,a),V!==null&&V(o,a)};var K=Z(null);function it(){var o=K.current;return o!==null?o:gi.pooledCache}function at(o,a){a===null?j(K,K.current):j(K,a.pool)}function mt(){var o=it();return o===null?null:{parent:Pi._currentValue,pool:o}}var _t=Error(r(460)),Vt=Error(r(474)),gt=Error(r(542)),Pt={then:function(){}};function qt(o){return o=o.status,o==="fulfilled"||o==="rejected"}function ie(o,a,u){switch(u=o[u],u===void 0?o.push(a):u!==a&&(a.then($i,$i),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,we(o),o;default:if(typeof a.status=="string")a.then($i,$i);else{if(o=gi,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=a,o.status="pending",o.then(function(h){if(a.status==="pending"){var x=a;x.status="fulfilled",x.value=h}},function(h){if(a.status==="pending"){var x=a;x.status="rejected",x.reason=h}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,we(o),o}throw re=a,_t}}function $t(o){try{var a=o._init;return a(o._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(re=u,_t):u}}var re=null;function se(){if(re===null)throw Error(r(459));var o=re;return re=null,o}function we(o){if(o===_t||o===gt)throw Error(r(483))}var he=null,tn=0;function He(o){var a=tn;return tn+=1,he===null&&(he=[]),ie(he,o,a)}function jn(o,a){a=a.props.ref,o.ref=a!==void 0?a:null}function Ze(o,a){throw a.$$typeof===b?Error(r(525)):(o=Object.prototype.toString.call(a),Error(r(31,o==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":o)))}function Bn(o){function a(Ut,Ot){if(o){var Gt=Ut.deletions;Gt===null?(Ut.deletions=[Ot],Ut.flags|=16):Gt.push(Ot)}}function u(Ut,Ot){if(!o)return null;for(;Ot!==null;)a(Ut,Ot),Ot=Ot.sibling;return null}function h(Ut){for(var Ot=new Map;Ut!==null;)Ut.key!==null?Ot.set(Ut.key,Ut):Ot.set(Ut.index,Ut),Ut=Ut.sibling;return Ot}function x(Ut,Ot){return Ut=Ts(Ut,Ot),Ut.index=0,Ut.sibling=null,Ut}function S(Ut,Ot,Gt){return Ut.index=Gt,o?(Gt=Ut.alternate,Gt!==null?(Gt=Gt.index,Gt<Ot?(Ut.flags|=67108866,Ot):Gt):(Ut.flags|=67108866,Ot)):(Ut.flags|=1048576,Ot)}function O(Ut){return o&&Ut.alternate===null&&(Ut.flags|=67108866),Ut}function et(Ut,Ot,Gt,ue){return Ot===null||Ot.tag!==6?(Ot=jc(Gt,Ut.mode,ue),Ot.return=Ut,Ot):(Ot=x(Ot,Gt),Ot.return=Ut,Ot)}function Ct(Ut,Ot,Gt,ue){var Tn=Gt.type;return Tn===E?ae(Ut,Ot,Gt.props.children,ue,Gt.key):Ot!==null&&(Ot.elementType===Tn||typeof Tn=="object"&&Tn!==null&&Tn.$$typeof===bt&&$t(Tn)===Ot.type)?(Ot=x(Ot,Gt.props),jn(Ot,Gt),Ot.return=Ut,Ot):(Ot=lc(Gt.type,Gt.key,Gt.props,null,Ut.mode,ue),jn(Ot,Gt),Ot.return=Ut,Ot)}function Kt(Ut,Ot,Gt,ue){return Ot===null||Ot.tag!==4||Ot.stateNode.containerInfo!==Gt.containerInfo||Ot.stateNode.implementation!==Gt.implementation?(Ot=cc(Gt,Ut.mode,ue),Ot.return=Ut,Ot):(Ot=x(Ot,Gt.children||[]),Ot.return=Ut,Ot)}function ae(Ut,Ot,Gt,ue,Tn){return Ot===null||Ot.tag!==7?(Ot=rl(Gt,Ut.mode,ue,Tn),Ot.return=Ut,Ot):(Ot=x(Ot,Gt),Ot.return=Ut,Ot)}function pe(Ut,Ot,Gt){if(typeof Ot=="string"&&Ot!==""||typeof Ot=="number"||typeof Ot=="bigint")return Ot=jc(""+Ot,Ut.mode,Gt),Ot.return=Ut,Ot;if(typeof Ot=="object"&&Ot!==null){switch(Ot.$$typeof){case y:return Gt=lc(Ot.type,Ot.key,Ot.props,null,Ut.mode,Gt),jn(Gt,Ot),Gt.return=Ut,Gt;case M:return Ot=cc(Ot,Ut.mode,Gt),Ot.return=Ut,Ot;case bt:return Ot=$t(Ot),pe(Ut,Ot,Gt)}if(Tt(Ot)||lt(Ot))return Ot=rl(Ot,Ut.mode,Gt,null),Ot.return=Ut,Ot;if(typeof Ot.then=="function")return pe(Ut,He(Ot),Gt);if(Ot.$$typeof===$)return pe(Ut,Vu(Ut,Ot),Gt);Ze(Ut,Ot)}return null}function Zt(Ut,Ot,Gt,ue){var Tn=Ot!==null?Ot.key:null;if(typeof Gt=="string"&&Gt!==""||typeof Gt=="number"||typeof Gt=="bigint")return Tn!==null?null:et(Ut,Ot,""+Gt,ue);if(typeof Gt=="object"&&Gt!==null){switch(Gt.$$typeof){case y:return Gt.key===Tn?Ct(Ut,Ot,Gt,ue):null;case M:return Gt.key===Tn?Kt(Ut,Ot,Gt,ue):null;case bt:return Gt=$t(Gt),Zt(Ut,Ot,Gt,ue)}if(Tt(Gt)||lt(Gt))return Tn!==null?null:ae(Ut,Ot,Gt,ue,null);if(typeof Gt.then=="function")return Zt(Ut,Ot,He(Gt),ue);if(Gt.$$typeof===$)return Zt(Ut,Ot,Vu(Ut,Gt),ue);Ze(Ut,Gt)}return null}function ee(Ut,Ot,Gt,ue,Tn){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return Ut=Ut.get(Gt)||null,et(Ot,Ut,""+ue,Tn);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case y:return Ut=Ut.get(ue.key===null?Gt:ue.key)||null,Ct(Ot,Ut,ue,Tn);case M:return Ut=Ut.get(ue.key===null?Gt:ue.key)||null,Kt(Ot,Ut,ue,Tn);case bt:return ue=$t(ue),ee(Ut,Ot,Gt,ue,Tn)}if(Tt(ue)||lt(ue))return Ut=Ut.get(Gt)||null,ae(Ot,Ut,ue,Tn,null);if(typeof ue.then=="function")return ee(Ut,Ot,Gt,He(ue),Tn);if(ue.$$typeof===$)return ee(Ut,Ot,Gt,Vu(Ot,ue),Tn);Ze(Ot,ue)}return null}function rn(Ut,Ot,Gt,ue){for(var Tn=null,Fr=null,fn=Ot,tr=Ot=0,wr=null;fn!==null&&tr<Gt.length;tr++){fn.index>tr?(wr=fn,fn=null):wr=fn.sibling;var Ur=Zt(Ut,fn,Gt[tr],ue);if(Ur===null){fn===null&&(fn=wr);break}o&&fn&&Ur.alternate===null&&a(Ut,fn),Ot=S(Ur,Ot,tr),Fr===null?Tn=Ur:Fr.sibling=Ur,Fr=Ur,fn=wr}if(tr===Gt.length)return u(Ut,fn),Yn&&ms(Ut,tr),Tn;if(fn===null){for(;tr<Gt.length;tr++)fn=pe(Ut,Gt[tr],ue),fn!==null&&(Ot=S(fn,Ot,tr),Fr===null?Tn=fn:Fr.sibling=fn,Fr=fn);return Yn&&ms(Ut,tr),Tn}for(fn=h(fn);tr<Gt.length;tr++)wr=ee(fn,Ut,tr,Gt[tr],ue),wr!==null&&(o&&wr.alternate!==null&&fn.delete(wr.key===null?tr:wr.key),Ot=S(wr,Ot,tr),Fr===null?Tn=wr:Fr.sibling=wr,Fr=wr);return o&&fn.forEach(function(af){return a(Ut,af)}),Yn&&ms(Ut,tr),Tn}function Dn(Ut,Ot,Gt,ue){if(Gt==null)throw Error(r(151));for(var Tn=null,Fr=null,fn=Ot,tr=Ot=0,wr=null,Ur=Gt.next();fn!==null&&!Ur.done;tr++,Ur=Gt.next()){fn.index>tr?(wr=fn,fn=null):wr=fn.sibling;var af=Zt(Ut,fn,Ur.value,ue);if(af===null){fn===null&&(fn=wr);break}o&&fn&&af.alternate===null&&a(Ut,fn),Ot=S(af,Ot,tr),Fr===null?Tn=af:Fr.sibling=af,Fr=af,fn=wr}if(Ur.done)return u(Ut,fn),Yn&&ms(Ut,tr),Tn;if(fn===null){for(;!Ur.done;tr++,Ur=Gt.next())Ur=pe(Ut,Ur.value,ue),Ur!==null&&(Ot=S(Ur,Ot,tr),Fr===null?Tn=Ur:Fr.sibling=Ur,Fr=Ur);return Yn&&ms(Ut,tr),Tn}for(fn=h(fn);!Ur.done;tr++,Ur=Gt.next())Ur=ee(fn,Ut,tr,Ur.value,ue),Ur!==null&&(o&&Ur.alternate!==null&&fn.delete(Ur.key===null?tr:Ur.key),Ot=S(Ur,Ot,tr),Fr===null?Tn=Ur:Fr.sibling=Ur,Fr=Ur);return o&&fn.forEach(function(KE){return a(Ut,KE)}),Yn&&ms(Ut,tr),Tn}function fi(Ut,Ot,Gt,ue){if(typeof Gt=="object"&&Gt!==null&&Gt.type===E&&Gt.key===null&&(Gt=Gt.props.children),typeof Gt=="object"&&Gt!==null){switch(Gt.$$typeof){case y:t:{for(var Tn=Gt.key;Ot!==null;){if(Ot.key===Tn){if(Tn=Gt.type,Tn===E){if(Ot.tag===7){u(Ut,Ot.sibling),ue=x(Ot,Gt.props.children),ue.return=Ut,Ut=ue;break t}}else if(Ot.elementType===Tn||typeof Tn=="object"&&Tn!==null&&Tn.$$typeof===bt&&$t(Tn)===Ot.type){u(Ut,Ot.sibling),ue=x(Ot,Gt.props),jn(ue,Gt),ue.return=Ut,Ut=ue;break t}u(Ut,Ot);break}else a(Ut,Ot);Ot=Ot.sibling}Gt.type===E?(ue=rl(Gt.props.children,Ut.mode,ue,Gt.key),ue.return=Ut,Ut=ue):(ue=lc(Gt.type,Gt.key,Gt.props,null,Ut.mode,ue),jn(ue,Gt),ue.return=Ut,Ut=ue)}return O(Ut);case M:t:{for(Tn=Gt.key;Ot!==null;){if(Ot.key===Tn)if(Ot.tag===4&&Ot.stateNode.containerInfo===Gt.containerInfo&&Ot.stateNode.implementation===Gt.implementation){u(Ut,Ot.sibling),ue=x(Ot,Gt.children||[]),ue.return=Ut,Ut=ue;break t}else{u(Ut,Ot);break}else a(Ut,Ot);Ot=Ot.sibling}ue=cc(Gt,Ut.mode,ue),ue.return=Ut,Ut=ue}return O(Ut);case bt:return Gt=$t(Gt),fi(Ut,Ot,Gt,ue)}if(Tt(Gt))return rn(Ut,Ot,Gt,ue);if(lt(Gt)){if(Tn=lt(Gt),typeof Tn!="function")throw Error(r(150));return Gt=Tn.call(Gt),Dn(Ut,Ot,Gt,ue)}if(typeof Gt.then=="function")return fi(Ut,Ot,He(Gt),ue);if(Gt.$$typeof===$)return fi(Ut,Ot,Vu(Ut,Gt),ue);Ze(Ut,Gt)}return typeof Gt=="string"&&Gt!==""||typeof Gt=="number"||typeof Gt=="bigint"?(Gt=""+Gt,Ot!==null&&Ot.tag===6?(u(Ut,Ot.sibling),ue=x(Ot,Gt),ue.return=Ut,Ut=ue):(u(Ut,Ot),ue=jc(Gt,Ut.mode,ue),ue.return=Ut,Ut=ue),O(Ut)):u(Ut,Ot)}return function(Ut,Ot,Gt,ue){try{tn=0;var Tn=fi(Ut,Ot,Gt,ue);return he=null,Tn}catch(fn){if(fn===_t||fn===gt)throw fn;var Fr=Io(29,fn,null,Ut.mode);return Fr.lanes=ue,Fr.return=Ut,Fr}}}var Gr=Bn(!0),cn=Bn(!1),$e=!1;function Le(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function li(o,a){o=o.updateQueue,a.updateQueue===o&&(a.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Mn(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function $n(o,a,u){var h=o.updateQueue;if(h===null)return null;if(h=h.shared,(Vr&2)!==0){var x=h.pending;return x===null?a.next=a:(a.next=x.next,x.next=a),h.pending=a,a=wo(o),Oc(o,null,u),a}return Tl(o,h,a,u),wo(o)}function ir(o,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194048)!==0)){var h=a.lanes;h&=o.pendingLanes,u|=h,a.lanes=u,Hn(o,u)}}function ki(o,a){var u=o.updateQueue,h=o.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var x=null,S=null;if(u=u.firstBaseUpdate,u!==null){do{var O={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};S===null?x=S=O:S=S.next=O,u=u.next}while(u!==null);S===null?x=S=a:S=S.next=a}else x=S=a;u={baseState:h.baseState,firstBaseUpdate:x,lastBaseUpdate:S,shared:h.shared,callbacks:h.callbacks},o.updateQueue=u;return}o=u.lastBaseUpdate,o===null?u.firstBaseUpdate=a:o.next=a,u.lastBaseUpdate=a}var no=!1;function Ir(){if(no){var o=v;if(o!==null)throw o}}function ji(o,a,u,h){no=!1;var x=o.updateQueue;$e=!1;var S=x.firstBaseUpdate,O=x.lastBaseUpdate,et=x.shared.pending;if(et!==null){x.shared.pending=null;var Ct=et,Kt=Ct.next;Ct.next=null,O===null?S=Kt:O.next=Kt,O=Ct;var ae=o.alternate;ae!==null&&(ae=ae.updateQueue,et=ae.lastBaseUpdate,et!==O&&(et===null?ae.firstBaseUpdate=Kt:et.next=Kt,ae.lastBaseUpdate=Ct))}if(S!==null){var pe=x.baseState;O=0,ae=Kt=Ct=null,et=S;do{var Zt=et.lane&-536870913,ee=Zt!==et.lane;if(ee?(vr&Zt)===Zt:(h&Zt)===Zt){Zt!==0&&Zt===m&&(no=!0),ae!==null&&(ae=ae.next={lane:0,tag:et.tag,payload:et.payload,callback:null,next:null});t:{var rn=o,Dn=et;Zt=a;var fi=u;switch(Dn.tag){case 1:if(rn=Dn.payload,typeof rn=="function"){pe=rn.call(fi,pe,Zt);break t}pe=rn;break t;case 3:rn.flags=rn.flags&-65537|128;case 0:if(rn=Dn.payload,Zt=typeof rn=="function"?rn.call(fi,pe,Zt):rn,Zt==null)break t;pe=g({},pe,Zt);break t;case 2:$e=!0}}Zt=et.callback,Zt!==null&&(o.flags|=64,ee&&(o.flags|=8192),ee=x.callbacks,ee===null?x.callbacks=[Zt]:ee.push(Zt))}else ee={lane:Zt,tag:et.tag,payload:et.payload,callback:et.callback,next:null},ae===null?(Kt=ae=ee,Ct=pe):ae=ae.next=ee,O|=Zt;if(et=et.next,et===null){if(et=x.shared.pending,et===null)break;ee=et,et=ee.next,ee.next=null,x.lastBaseUpdate=ee,x.shared.pending=null}}while(!0);ae===null&&(Ct=pe),x.baseState=Ct,x.firstBaseUpdate=Kt,x.lastBaseUpdate=ae,S===null&&(x.shared.lanes=0),Ku|=O,o.lanes=O,o.memoizedState=pe}}function Bo(o,a){if(typeof o!="function")throw Error(r(191,o));o.call(a)}function Wi(o,a){var u=o.callbacks;if(u!==null)for(o.callbacks=null,o=0;o<u.length;o++)Bo(u[o],a)}var Vn=Z(null),fr=Z(0);function Kr(o,a){o=ku,j(fr,o),j(Vn,a),ku=o|a.baseLanes}function yr(){j(fr,ku),j(Vn,Vn.current)}function Ii(){ku=fr.current,P(Vn),P(fr)}var ti=Z(null),br=null;function zi(o){var a=o.alternate;j(dr,dr.current&1),j(ti,o),br===null&&(a===null||Vn.current!==null||a.memoizedState!==null)&&(br=o)}function Tr(o){j(dr,dr.current),j(ti,o),br===null&&(br=o)}function Bi(o){o.tag===22?(j(dr,dr.current),j(ti,o),br===null&&(br=o)):Xi()}function Xi(){j(dr,dr.current),j(ti,ti.current)}function zr(o){P(ti),br===o&&(br=null),P(dr)}var dr=Z(0);function ro(o){for(var a=o;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||oy(u)||sy(u)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Ai=0,yn=null,hn=null,xr=null,Ao=!1,ns=!1,uo=!1,ci=0,Br=0,Rl=null,Wu=0;function Nr(){throw Error(r(321))}function w(o,a){if(a===null)return!1;for(var u=0;u<a.length&&u<o.length;u++)if(!Or(o[u],a[u]))return!1;return!0}function k(o,a,u,h,x,S){return Ai=S,yn=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,yt.H=o===null||o.memoizedState===null?Gb:g1,uo=!1,S=u(h,x),uo=!1,ns&&(S=N(a,u,h,x)),_(o),S}function _(o){yt.H=Lh;var a=hn!==null&&hn.next!==null;if(Ai=0,xr=hn=yn=null,Ao=!1,Br=0,Rl=null,a)throw Error(r(300));o===null||Ho||(o=o.dependencies,o!==null&&Yu(o)&&(Ho=!0))}function N(o,a,u,h){yn=o;var x=0;do{if(ns&&(Rl=null),Br=0,ns=!1,25<=x)throw Error(r(301));if(x+=1,xr=hn=null,o.updateQueue!=null){var S=o.updateQueue;S.lastEffect=null,S.events=null,S.stores=null,S.memoCache!=null&&(S.memoCache.index=0)}yt.H=Kb,S=a(u,h)}while(ns);return S}function z(){var o=yt.H,a=o.useState()[0];return a=typeof a.then=="function"?dt(a):a,o=o.useState()[0],(hn!==null?hn.memoizedState:null)!==o&&(yn.flags|=1024),a}function tt(){var o=ci!==0;return ci=0,o}function nt(o,a,u){a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~u}function F(o){if(Ao){for(o=o.memoizedState;o!==null;){var a=o.queue;a!==null&&(a.pending=null),o=o.next}Ao=!1}Ai=0,xr=hn=yn=null,ns=!1,Br=ci=0,Rl=null}function W(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xr===null?yn.memoizedState=xr=o:xr=xr.next=o,xr}function ot(){if(hn===null){var o=yn.alternate;o=o!==null?o.memoizedState:null}else o=hn.next;var a=xr===null?yn.memoizedState:xr.next;if(a!==null)xr=a,hn=o;else{if(o===null)throw yn.alternate===null?Error(r(467)):Error(r(310));hn=o,o={memoizedState:hn.memoizedState,baseState:hn.baseState,baseQueue:hn.baseQueue,queue:hn.queue,next:null},xr===null?yn.memoizedState=xr=o:xr=xr.next=o}return xr}function st(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function dt(o){var a=Br;return Br+=1,Rl===null&&(Rl=[]),o=ie(Rl,o,a),a=yn,(xr===null?a.memoizedState:xr.next)===null&&(a=a.alternate,yt.H=a===null||a.memoizedState===null?Gb:g1),o}function B(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return dt(o);if(o.$$typeof===$)return co(o)}throw Error(r(438,String(o)))}function Nt(o){var a=null,u=yn.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var h=yn.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(a={data:h.data.map(function(x){return x.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),u===null&&(u=st(),yn.updateQueue=u),u.memoCache=a,u=a.data[a.index],u===void 0)for(u=a.data[a.index]=Array(o),h=0;h<o;h++)u[h]=Dt;return a.index++,u}function It(o,a){return typeof a=="function"?a(o):a}function kt(o){var a=ot();return Lt(a,hn,o)}function Lt(o,a,u){var h=o.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=u;var x=o.baseQueue,S=h.pending;if(S!==null){if(x!==null){var O=x.next;x.next=S.next,S.next=O}a.baseQueue=x=S,h.pending=null}if(S=o.baseState,x===null)o.memoizedState=S;else{a=x.next;var et=O=null,Ct=null,Kt=a,ae=!1;do{var pe=Kt.lane&-536870913;if(pe!==Kt.lane?(vr&pe)===pe:(Ai&pe)===pe){var Zt=Kt.revertLane;if(Zt===0)Ct!==null&&(Ct=Ct.next={lane:0,revertLane:0,gesture:null,action:Kt.action,hasEagerState:Kt.hasEagerState,eagerState:Kt.eagerState,next:null}),pe===m&&(ae=!0);else if((Ai&Zt)===Zt){Kt=Kt.next,Zt===m&&(ae=!0);continue}else pe={lane:0,revertLane:Kt.revertLane,gesture:null,action:Kt.action,hasEagerState:Kt.hasEagerState,eagerState:Kt.eagerState,next:null},Ct===null?(et=Ct=pe,O=S):Ct=Ct.next=pe,yn.lanes|=Zt,Ku|=Zt;pe=Kt.action,uo&&u(S,pe),S=Kt.hasEagerState?Kt.eagerState:u(S,pe)}else Zt={lane:pe,revertLane:Kt.revertLane,gesture:Kt.gesture,action:Kt.action,hasEagerState:Kt.hasEagerState,eagerState:Kt.eagerState,next:null},Ct===null?(et=Ct=Zt,O=S):Ct=Ct.next=Zt,yn.lanes|=pe,Ku|=pe;Kt=Kt.next}while(Kt!==null&&Kt!==a);if(Ct===null?O=S:Ct.next=et,!Or(S,o.memoizedState)&&(Ho=!0,ae&&(u=v,u!==null)))throw u;o.memoizedState=S,o.baseState=O,o.baseQueue=Ct,h.lastRenderedState=S}return x===null&&(h.lanes=0),[o.memoizedState,h.dispatch]}function At(o){var a=ot(),u=a.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=o;var h=u.dispatch,x=u.pending,S=a.memoizedState;if(x!==null){u.pending=null;var O=x=x.next;do S=o(S,O.action),O=O.next;while(O!==x);Or(S,a.memoizedState)||(Ho=!0),a.memoizedState=S,a.baseQueue===null&&(a.baseState=S),u.lastRenderedState=S}return[S,h]}function Ht(o,a,u){var h=yn,x=ot(),S=Yn;if(S){if(u===void 0)throw Error(r(407));u=u()}else u=a();var O=!Or((hn||x).memoizedState,u);if(O&&(x.memoizedState=u,Ho=!0),x=x.queue,Gi(be.bind(null,h,x,o),[o]),x.getSnapshot!==a||O||xr!==null&&xr.memoizedState.tag&1){if(h.flags|=2048,pn(9,{destroy:void 0},de.bind(null,h,x,u,a),null),gi===null)throw Error(r(349));S||(Ai&127)!==0||Yt(h,a,u)}return u}function Yt(o,a,u){o.flags|=16384,o={getSnapshot:a,value:u},a=yn.updateQueue,a===null?(a=st(),yn.updateQueue=a,a.stores=[o]):(u=a.stores,u===null?a.stores=[o]:u.push(o))}function de(o,a,u,h){a.value=u,a.getSnapshot=h,Me(a)&&Je(o)}function be(o,a,u){return u(function(){Me(a)&&Je(o)})}function Me(o){var a=o.getSnapshot;o=o.value;try{var u=a();return!Or(o,u)}catch{return!0}}function Je(o){var a=Oa(o,2);a!==null&&qa(a,o,2)}function kn(o){var a=W();if(typeof o=="function"){var u=o;if(o=u(),uo){ln(!0);try{u()}finally{ln(!1)}}}return a.memoizedState=a.baseState=o,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:It,lastRenderedState:o},a}function ye(o,a,u,h){return o.baseState=u,Lt(o,hn,typeof h=="function"?h:It)}function bn(o,a,u,h,x){if(um(o))throw Error(r(485));if(o=a.action,o!==null){var S={payload:x,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){S.listeners.push(O)}};yt.T!==null?u(!0):S.isTransition=!1,h(S),u=a.pending,u===null?(S.next=a.pending=S,Ce(a,S)):(S.next=u.next,a.pending=u.next=S)}}function Ce(o,a){var u=a.action,h=a.payload,x=o.state;if(a.isTransition){var S=yt.T,O={};yt.T=O;try{var et=u(x,h),Ct=yt.S;Ct!==null&&Ct(O,et),Jn(o,a,et)}catch(Kt){Yr(o,a,Kt)}finally{S!==null&&O.types!==null&&(S.types=O.types),yt.T=S}}else try{S=u(x,h),Jn(o,a,S)}catch(Kt){Yr(o,a,Kt)}}function Jn(o,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(h){$r(o,a,h)},function(h){return Yr(o,a,h)}):$r(o,a,u)}function $r(o,a,u){a.status="fulfilled",a.value=u,Mo(a),o.state=u,a=o.pending,a!==null&&(u=a.next,u===a?o.pending=null:(u=u.next,a.next=u,Ce(o,u)))}function Yr(o,a,u){var h=o.pending;if(o.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=u,Mo(a),a=a.next;while(a!==h)}o.action=null}function Mo(o){o=o.listeners;for(var a=0;a<o.length;a++)(0,o[a])()}function Co(o,a){return a}function jt(o,a){if(Yn){var u=gi.formState;if(u!==null){t:{var h=yn;if(Yn){if(Xr){e:{for(var x=Xr,S=mi;x.nodeType!==8;){if(!S){x=null;break e}if(x=Pl(x.nextSibling),x===null){x=null;break e}}S=x.data,x=S==="F!"||S==="F"?x:null}if(x){Xr=Pl(x.nextSibling),h=x.data==="F!";break t}}ol(h)}h=!1}h&&(a=u[0])}}return u=W(),u.memoizedState=u.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Co,lastRenderedState:a},u.queue=h,u=Vb.bind(null,yn,h),h.dispatch=u,h=kn(!1),S=m1.bind(null,yn,!1,h.queue),h=W(),x={state:a,dispatch:null,action:o,pending:null},h.queue=x,u=bn.bind(null,yn,x,S,u),x.dispatch=u,h.memoizedState=o,[a,u,!1]}function Fe(o){var a=ot();return Se(a,hn,o)}function Se(o,a,u){if(a=Lt(o,a,Co)[0],o=kt(It)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=dt(a)}catch(O){throw O===_t?gt:O}else h=a;a=ot();var x=a.queue,S=x.dispatch;return u!==a.memoizedState&&(yn.flags|=2048,pn(9,{destroy:void 0},ze.bind(null,x,u),null)),[h,S,o]}function ze(o,a){o.action=a}function qe(o){var a=ot(),u=hn;if(u!==null)return Se(a,u,o);ot(),a=a.memoizedState,u=ot();var h=u.queue.dispatch;return u.memoizedState=o,[a,h,!1]}function pn(o,a,u,h){return o={tag:o,create:u,deps:h,inst:a,next:null},a=yn.updateQueue,a===null&&(a=st(),yn.updateQueue=a),u=a.lastEffect,u===null?a.lastEffect=o.next=o:(h=u.next,u.next=o,o.next=h,a.lastEffect=o),o}function Jr(){return ot().memoizedState}function Mi(o,a,u,h){var x=W();yn.flags|=o,x.memoizedState=pn(1|a,{destroy:void 0},u,h===void 0?null:h)}function ei(o,a,u,h){var x=ot();h=h===void 0?null:h;var S=x.memoizedState.inst;hn!==null&&h!==null&&w(h,hn.memoizedState.deps)?x.memoizedState=pn(a,S,u,h):(yn.flags|=o,x.memoizedState=pn(1|a,S,u,h))}function Rs(o,a){Mi(8390656,8,o,a)}function Gi(o,a){ei(2048,8,o,a)}function io(o){yn.flags|=4;var a=yn.updateQueue;if(a===null)a=st(),yn.updateQueue=a,a.events=[o];else{var u=a.events;u===null?a.events=[o]:u.push(o)}}function Ci(o){var a=ot().memoizedState;return io({ref:a,nextImpl:o}),function(){if((Vr&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function Rr(o,a){return ei(4,2,o,a)}function Fo(o,a){return ei(4,4,o,a)}function al(o,a){if(typeof a=="function"){o=o();var u=a(o);return function(){typeof u=="function"?u():a(null)}}if(a!=null)return o=o(),a.current=o,function(){a.current=null}}function Th(o,a,u){u=u!=null?u.concat([o]):null,ei(4,4,al.bind(null,a,o),u)}function Hf(){}function mu(o,a){var u=ot();a=a===void 0?null:a;var h=u.memoizedState;return a!==null&&w(a,h[1])?h[0]:(u.memoizedState=[o,a],o)}function Nd(o,a){var u=ot();a=a===void 0?null:a;var h=u.memoizedState;if(a!==null&&w(a,h[1]))return h[0];if(h=o(),uo){ln(!0);try{o()}finally{ln(!1)}}return u.memoizedState=[h,a],h}function qf(o,a,u){return u===void 0||(Ai&1073741824)!==0&&(vr&261930)===0?o.memoizedState=a:(o.memoizedState=u,o=Fx(),yn.lanes|=o,Ku|=o,u)}function Nh(o,a,u,h){return Or(u,a)?u:Vn.current!==null?(o=qf(o,u,h),Or(o,a)||(Ho=!0),o):(Ai&42)===0||(Ai&1073741824)!==0&&(vr&261930)===0?(Ho=!0,o.memoizedState=u):(o=Fx(),yn.lanes|=o,Ku|=o,a)}function _h(o,a,u,h,x){var S=J.p;J.p=S!==0&&8>S?S:8;var O=yt.T,et={};yt.T=et,m1(o,!1,a,u);try{var Ct=x(),Kt=yt.S;if(Kt!==null&&Kt(et,Ct),Ct!==null&&typeof Ct=="object"&&typeof Ct.then=="function"){var ae=H(Ct,h);Dh(o,a,ae,ul(o))}else Dh(o,a,h,ul(o))}catch(pe){Dh(o,a,{then:function(){},status:"rejected",reason:pe},ul())}finally{J.p=S,O!==null&&et.types!==null&&(O.types=et.types),yt.T=O}}function p1(){}function za(o,a,u,h){if(o.tag!==5)throw Error(r(476));var x=qc(o).queue;_h(o,x,a,ct,u===null?p1:function(){return gu(o),u(h)})}function qc(o){var a=o.memoizedState;if(a!==null)return a;a={memoizedState:ct,baseState:ct,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:It,lastRenderedState:ct},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:It,lastRenderedState:u},next:null},o.memoizedState=a,o=o.alternate,o!==null&&(o.memoizedState=a),a}function gu(o){var a=qc(o);a.next===null&&(a=o.alternate.memoizedState),Dh(o,a.next.queue,{},ul())}function $c(){return co(Xh)}function Uo(){return ot().memoizedState}function Yc(){return ot().memoizedState}function Ol(o){for(var a=o.return;a!==null;){switch(a.tag){case 24:case 3:var u=ul();o=Mn(u);var h=$n(a,o,u);h!==null&&(qa(h,a,u),ir(h,a,u)),a={cache:Ia()},o.payload=a;return}a=a.return}}function W6(o,a,u){var h=ul();u={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},um(o)?Wb(a,u):(u=au(o,a,u,h),u!==null&&(qa(u,o,h),Xb(u,a,h)))}function Vb(o,a,u){var h=ul();Dh(o,a,u,h)}function Dh(o,a,u,h){var x={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(um(o))Wb(a,x);else{var S=o.alternate;if(o.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var O=a.lastRenderedState,et=S(O,u);if(x.hasEagerState=!0,x.eagerState=et,Or(et,O))return Tl(o,a,x,0),gi===null&&Rc(),!1}catch{}if(u=au(o,a,x,h),u!==null)return qa(u,o,h),Xb(u,a,h),!0}return!1}function m1(o,a,u,h){if(h={lane:2,revertLane:W1(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},um(o)){if(a)throw Error(r(479))}else a=au(o,u,h,2),a!==null&&qa(a,o,2)}function um(o){var a=o.alternate;return o===yn||a!==null&&a===yn}function Wb(o,a){ns=Ao=!0;var u=o.pending;u===null?a.next=a:(a.next=u.next,u.next=a),o.pending=a}function Xb(o,a,u){if((u&4194048)!==0){var h=a.lanes;h&=o.pendingLanes,u|=h,a.lanes=u,Hn(o,u)}}var Lh={readContext:co,use:B,useCallback:Nr,useContext:Nr,useEffect:Nr,useImperativeHandle:Nr,useLayoutEffect:Nr,useInsertionEffect:Nr,useMemo:Nr,useReducer:Nr,useRef:Nr,useState:Nr,useDebugValue:Nr,useDeferredValue:Nr,useTransition:Nr,useSyncExternalStore:Nr,useId:Nr,useHostTransitionStatus:Nr,useFormState:Nr,useActionState:Nr,useOptimistic:Nr,useMemoCache:Nr,useCacheRefresh:Nr};Lh.useEffectEvent=Nr;var Gb={readContext:co,use:B,useCallback:function(o,a){return W().memoizedState=[o,a===void 0?null:a],o},useContext:co,useEffect:Rs,useImperativeHandle:function(o,a,u){u=u!=null?u.concat([o]):null,Mi(4194308,4,al.bind(null,a,o),u)},useLayoutEffect:function(o,a){return Mi(4194308,4,o,a)},useInsertionEffect:function(o,a){Mi(4,2,o,a)},useMemo:function(o,a){var u=W();a=a===void 0?null:a;var h=o();if(uo){ln(!0);try{o()}finally{ln(!1)}}return u.memoizedState=[h,a],h},useReducer:function(o,a,u){var h=W();if(u!==void 0){var x=u(a);if(uo){ln(!0);try{u(a)}finally{ln(!1)}}}else x=a;return h.memoizedState=h.baseState=x,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:x},h.queue=o,o=o.dispatch=W6.bind(null,yn,o),[h.memoizedState,o]},useRef:function(o){var a=W();return o={current:o},a.memoizedState=o},useState:function(o){o=kn(o);var a=o.queue,u=Vb.bind(null,yn,a);return a.dispatch=u,[o.memoizedState,u]},useDebugValue:Hf,useDeferredValue:function(o,a){var u=W();return qf(u,o,a)},useTransition:function(){var o=kn(!1);return o=_h.bind(null,yn,o.queue,!0,!1),W().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,a,u){var h=yn,x=W();if(Yn){if(u===void 0)throw Error(r(407));u=u()}else{if(u=a(),gi===null)throw Error(r(349));(vr&127)!==0||Yt(h,a,u)}x.memoizedState=u;var S={value:u,getSnapshot:a};return x.queue=S,Rs(be.bind(null,h,S,o),[o]),h.flags|=2048,pn(9,{destroy:void 0},de.bind(null,h,S,u,a),null),u},useId:function(){var o=W(),a=gi.identifierPrefix;if(Yn){var u=ko,h=Ds;u=(h&~(1<<32-Ln(h)-1)).toString(32)+u,a="_"+a+"R_"+u,u=ci++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=Wu++,a="_"+a+"r_"+u.toString(32)+"_";return o.memoizedState=a},useHostTransitionStatus:$c,useFormState:jt,useActionState:jt,useOptimistic:function(o){var a=W();a.memoizedState=a.baseState=o;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=m1.bind(null,yn,!0,u),u.dispatch=a,[o,a]},useMemoCache:Nt,useCacheRefresh:function(){return W().memoizedState=Ol.bind(null,yn)},useEffectEvent:function(o){var a=W(),u={impl:o};return a.memoizedState=u,function(){if((Vr&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},g1={readContext:co,use:B,useCallback:mu,useContext:co,useEffect:Gi,useImperativeHandle:Th,useInsertionEffect:Rr,useLayoutEffect:Fo,useMemo:Nd,useReducer:kt,useRef:Jr,useState:function(){return kt(It)},useDebugValue:Hf,useDeferredValue:function(o,a){var u=ot();return Nh(u,hn.memoizedState,o,a)},useTransition:function(){var o=kt(It)[0],a=ot().memoizedState;return[typeof o=="boolean"?o:dt(o),a]},useSyncExternalStore:Ht,useId:Uo,useHostTransitionStatus:$c,useFormState:Fe,useActionState:Fe,useOptimistic:function(o,a){var u=ot();return ye(u,hn,o,a)},useMemoCache:Nt,useCacheRefresh:Yc};g1.useEffectEvent=Ci;var Kb={readContext:co,use:B,useCallback:mu,useContext:co,useEffect:Gi,useImperativeHandle:Th,useInsertionEffect:Rr,useLayoutEffect:Fo,useMemo:Nd,useReducer:At,useRef:Jr,useState:function(){return At(It)},useDebugValue:Hf,useDeferredValue:function(o,a){var u=ot();return hn===null?qf(u,o,a):Nh(u,hn.memoizedState,o,a)},useTransition:function(){var o=At(It)[0],a=ot().memoizedState;return[typeof o=="boolean"?o:dt(o),a]},useSyncExternalStore:Ht,useId:Uo,useHostTransitionStatus:$c,useFormState:qe,useActionState:qe,useOptimistic:function(o,a){var u=ot();return hn!==null?ye(u,hn,o,a):(u.baseState=o,[o,u.queue.dispatch])},useMemoCache:Nt,useCacheRefresh:Yc};Kb.useEffectEvent=Ci;function y1(o,a,u,h){a=o.memoizedState,u=u(h,a),u=u==null?a:g({},a,u),o.memoizedState=u,o.lanes===0&&(o.updateQueue.baseState=u)}var b1={enqueueSetState:function(o,a,u){o=o._reactInternals;var h=ul(),x=Mn(h);x.payload=a,u!=null&&(x.callback=u),a=$n(o,x,h),a!==null&&(qa(a,o,h),ir(a,o,h))},enqueueReplaceState:function(o,a,u){o=o._reactInternals;var h=ul(),x=Mn(h);x.tag=1,x.payload=a,u!=null&&(x.callback=u),a=$n(o,x,h),a!==null&&(qa(a,o,h),ir(a,o,h))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var u=ul(),h=Mn(u);h.tag=2,a!=null&&(h.callback=a),a=$n(o,h,u),a!==null&&(qa(a,o,u),ir(a,o,u))}};function Jb(o,a,u,h,x,S,O){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(h,S,O):a.prototype&&a.prototype.isPureReactComponent?!jo(u,h)||!jo(x,S):!0}function Zb(o,a,u,h){o=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,h),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,h),a.state!==o&&b1.enqueueReplaceState(a,a.state,null)}function $f(o,a){var u=a;if("ref"in a){u={};for(var h in a)h!=="ref"&&(u[h]=a[h])}if(o=o.defaultProps){u===a&&(u=g({},u));for(var x in o)u[x]===void 0&&(u[x]=o[x])}return u}function Qb(o){Lc(o)}function tx(o){console.error(o)}function ex(o){Lc(o)}function fm(o,a){try{var u=o.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function nx(o,a,u){try{var h=o.onCaughtError;h(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function x1(o,a,u){return u=Mn(u),u.tag=3,u.payload={element:null},u.callback=function(){fm(o,a)},u}function rx(o){return o=Mn(o),o.tag=3,o}function ix(o,a,u,h){var x=u.type.getDerivedStateFromError;if(typeof x=="function"){var S=h.value;o.payload=function(){return x(S)},o.callback=function(){nx(a,u,h)}}var O=u.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(o.callback=function(){nx(a,u,h),typeof x!="function"&&(Ju===null?Ju=new Set([this]):Ju.add(this));var et=h.stack;this.componentDidCatch(h.value,{componentStack:et!==null?et:""})})}function X6(o,a,u,h,x){if(u.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=u.alternate,a!==null&&Dl(a,u,x,!0),u=ti.current,u!==null){switch(u.tag){case 31:case 13:return br===null?km():u.alternate===null&&fo===0&&(fo=3),u.flags&=-257,u.flags|=65536,u.lanes=x,h===Pt?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([h]):a.add(h),$1(o,h,x)),!1;case 22:return u.flags|=65536,h===Pt?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([h])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([h]):u.add(h)),$1(o,h,x)),!1}throw Error(r(435,u.tag))}return $1(o,h,x),km(),!1}if(Yn)return a=ti.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,h!==oa&&(o=Error(r(422),{cause:h}),gs(Ns(o,u)))):(h!==oa&&(a=Error(r(423),{cause:h}),gs(Ns(a,u))),o=o.current.alternate,o.flags|=65536,x&=-x,o.lanes|=x,h=Ns(h,u),x=x1(o.stateNode,h,x),ki(o,x),fo!==4&&(fo=2)),!1;var S=Error(r(520),{cause:h});if(S=Ns(S,u),Fh===null?Fh=[S]:Fh.push(S),fo!==4&&(fo=2),a===null)return!0;h=Ns(h,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,o=x&-x,u.lanes|=o,o=x1(u.stateNode,h,o),ki(u,o),!1;case 1:if(a=u.type,S=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(Ju===null||!Ju.has(S))))return u.flags|=65536,x&=-x,u.lanes|=x,x=rx(x),ix(x,o,u,h),ki(u,x),!1}u=u.return}while(u!==null);return!1}var v1=Error(r(461)),Ho=!1;function Os(o,a,u,h){a.child=o===null?cn(a,null,u,h):Gr(a,o.child,u,h)}function ox(o,a,u,h,x){u=u.render;var S=a.ref;if("ref"in h){var O={};for(var et in h)et!=="ref"&&(O[et]=h[et])}else O=h;return Ll(a),h=k(o,a,u,O,S,x),et=tt(),o!==null&&!Ho?(nt(o,a,x),yu(o,a,x)):(Yn&&et&&qu(a),a.flags|=1,Os(o,a,h,x),a.child)}function sx(o,a,u,h,x){if(o===null){var S=u.type;return typeof S=="function"&&!cu(S)&&S.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=S,ax(o,a,S,h,x)):(o=lc(u.type,null,h,a,a.mode,x),o.ref=a.ref,o.return=a,a.child=o)}if(S=o.child,!T1(o,x)){var O=S.memoizedProps;if(u=u.compare,u=u!==null?u:jo,u(O,h)&&o.ref===a.ref)return yu(o,a,x)}return a.flags|=1,o=Ts(S,h),o.ref=a.ref,o.return=a,a.child=o}function ax(o,a,u,h,x){if(o!==null){var S=o.memoizedProps;if(jo(S,h)&&o.ref===a.ref)if(Ho=!1,a.pendingProps=h=S,T1(o,x))(o.flags&131072)!==0&&(Ho=!0);else return a.lanes=o.lanes,yu(o,a,x)}return w1(o,a,u,h,x)}function lx(o,a,u,h){var x=h.children,S=o!==null?o.memoizedState:null;if(o===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((a.flags&128)!==0){if(S=S!==null?S.baseLanes|u:u,o!==null){for(h=a.child=o.child,x=0;h!==null;)x=x|h.lanes|h.childLanes,h=h.sibling;h=x&~S}else h=0,a.child=null;return cx(o,a,S,u,h)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},o!==null&&at(a,S!==null?S.cachePool:null),S!==null?Kr(a,S):yr(),Bi(a);else return h=a.lanes=536870912,cx(o,a,S!==null?S.baseLanes|u:u,u,h)}else S!==null?(at(a,S.cachePool),Kr(a,S),Xi(),a.memoizedState=null):(o!==null&&at(a,null),yr(),Xi());return Os(o,a,x,u),a.child}function Rh(o,a){return o!==null&&o.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function cx(o,a,u,h,x){var S=it();return S=S===null?null:{parent:Pi._currentValue,pool:S},a.memoizedState={baseLanes:u,cachePool:S},o!==null&&at(a,null),yr(),Bi(a),o!==null&&Dl(o,a,h,!0),a.childLanes=x,null}function dm(o,a){return a=pm({mode:a.mode,children:a.children},o.mode),a.ref=o.ref,o.child=a,a.return=o,a}function ux(o,a,u){return Gr(a,o.child,null,u),o=dm(a,a.pendingProps),o.flags|=2,zr(a),a.memoizedState=null,o}function G6(o,a,u){var h=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,o===null){if(Yn){if(h.mode==="hidden")return o=dm(a,h),a.lanes=536870912,Rh(null,o);if(Tr(a),(o=Xr)?(o=Sv(o,mi),o=o!==null&&o.data==="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:il!==null?{id:Ds,overflow:ko}:null,retryLane:536870912,hydrationErrors:null},u=uu(o),u.return=a,a.child=u,Oi=a,Xr=null)):o=null,o===null)throw ol(a);return a.lanes=536870912,null}return dm(a,h)}var S=o.memoizedState;if(S!==null){var O=S.dehydrated;if(Tr(a),x)if(a.flags&256)a.flags&=-257,a=ux(o,a,u);else if(a.memoizedState!==null)a.child=o.child,a.flags|=128,a=null;else throw Error(r(558));else if(Ho||Dl(o,a,u,!1),x=(u&o.childLanes)!==0,Ho||x){if(h=gi,h!==null&&(O=lr(h,u),O!==0&&O!==S.retryLane))throw S.retryLane=O,Oa(o,O),qa(h,o,O),v1;km(),a=ux(o,a,u)}else o=S.treeContext,Xr=Pl(O.nextSibling),Oi=a,Yn=!0,zo=null,mi=!1,o!==null&&Bf(a,o),a=dm(a,h),a.flags|=4096;return a}return o=Ts(o.child,{mode:h.mode,children:h.children}),o.ref=a.ref,a.child=o,o.return=a,o}function hm(o,a){var u=a.ref;if(u===null)o!==null&&o.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(r(284));(o===null||o.ref!==u)&&(a.flags|=4194816)}}function w1(o,a,u,h,x){return Ll(a),u=k(o,a,u,h,void 0,x),h=tt(),o!==null&&!Ho?(nt(o,a,x),yu(o,a,x)):(Yn&&h&&qu(a),a.flags|=1,Os(o,a,u,x),a.child)}function fx(o,a,u,h,x,S){return Ll(a),a.updateQueue=null,u=N(a,h,u,x),_(o),h=tt(),o!==null&&!Ho?(nt(o,a,S),yu(o,a,S)):(Yn&&h&&qu(a),a.flags|=1,Os(o,a,u,S),a.child)}function dx(o,a,u,h,x){if(Ll(a),a.stateNode===null){var S=So,O=u.contextType;typeof O=="object"&&O!==null&&(S=co(O)),S=new u(h,S),a.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=b1,a.stateNode=S,S._reactInternals=a,S=a.stateNode,S.props=h,S.state=a.memoizedState,S.refs={},Le(a),O=u.contextType,S.context=typeof O=="object"&&O!==null?co(O):So,S.state=a.memoizedState,O=u.getDerivedStateFromProps,typeof O=="function"&&(y1(a,u,O,h),S.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(O=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),O!==S.state&&b1.enqueueReplaceState(S,S.state,null),ji(a,h,S,x),Ir(),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(o===null){S=a.stateNode;var et=a.memoizedProps,Ct=$f(u,et);S.props=Ct;var Kt=S.context,ae=u.contextType;O=So,typeof ae=="object"&&ae!==null&&(O=co(ae));var pe=u.getDerivedStateFromProps;ae=typeof pe=="function"||typeof S.getSnapshotBeforeUpdate=="function",et=a.pendingProps!==et,ae||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(et||Kt!==O)&&Zb(a,S,h,O),$e=!1;var Zt=a.memoizedState;S.state=Zt,ji(a,h,S,x),Ir(),Kt=a.memoizedState,et||Zt!==Kt||$e?(typeof pe=="function"&&(y1(a,u,pe,h),Kt=a.memoizedState),(Ct=$e||Jb(a,u,Ct,h,Zt,Kt,O))?(ae||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(a.flags|=4194308)):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=Kt),S.props=h,S.state=Kt,S.context=O,h=Ct):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{S=a.stateNode,li(o,a),O=a.memoizedProps,ae=$f(u,O),S.props=ae,pe=a.pendingProps,Zt=S.context,Kt=u.contextType,Ct=So,typeof Kt=="object"&&Kt!==null&&(Ct=co(Kt)),et=u.getDerivedStateFromProps,(Kt=typeof et=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(O!==pe||Zt!==Ct)&&Zb(a,S,h,Ct),$e=!1,Zt=a.memoizedState,S.state=Zt,ji(a,h,S,x),Ir();var ee=a.memoizedState;O!==pe||Zt!==ee||$e||o!==null&&o.dependencies!==null&&Yu(o.dependencies)?(typeof et=="function"&&(y1(a,u,et,h),ee=a.memoizedState),(ae=$e||Jb(a,u,ae,h,Zt,ee,Ct)||o!==null&&o.dependencies!==null&&Yu(o.dependencies))?(Kt||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(h,ee,Ct),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(h,ee,Ct)),typeof S.componentDidUpdate=="function"&&(a.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof S.componentDidUpdate!="function"||O===o.memoizedProps&&Zt===o.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||O===o.memoizedProps&&Zt===o.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=ee),S.props=h,S.state=ee,S.context=Ct,h=ae):(typeof S.componentDidUpdate!="function"||O===o.memoizedProps&&Zt===o.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||O===o.memoizedProps&&Zt===o.memoizedState||(a.flags|=1024),h=!1)}return S=h,hm(o,a),h=(a.flags&128)!==0,S||h?(S=a.stateNode,u=h&&typeof u.getDerivedStateFromError!="function"?null:S.render(),a.flags|=1,o!==null&&h?(a.child=Gr(a,o.child,null,x),a.child=Gr(a,null,u,x)):Os(o,a,u,x),a.memoizedState=S.state,o=a.child):o=yu(o,a,x),o}function hx(o,a,u,h){return es(),a.flags|=256,Os(o,a,u,h),a.child}var S1={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function k1(o){return{baseLanes:o,cachePool:mt()}}function A1(o,a,u){return o=o!==null?o.childLanes&~u:0,a&&(o|=cl),o}function px(o,a,u){var h=a.pendingProps,x=!1,S=(a.flags&128)!==0,O;if((O=S)||(O=o!==null&&o.memoizedState===null?!1:(dr.current&2)!==0),O&&(x=!0,a.flags&=-129),O=(a.flags&32)!==0,a.flags&=-33,o===null){if(Yn){if(x?zi(a):Xi(),(o=Xr)?(o=Sv(o,mi),o=o!==null&&o.data!=="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:il!==null?{id:Ds,overflow:ko}:null,retryLane:536870912,hydrationErrors:null},u=uu(o),u.return=a,a.child=u,Oi=a,Xr=null)):o=null,o===null)throw ol(a);return sy(o)?a.lanes=32:a.lanes=536870912,null}var et=h.children;return h=h.fallback,x?(Xi(),x=a.mode,et=pm({mode:"hidden",children:et},x),h=rl(h,x,u,null),et.return=a,h.return=a,et.sibling=h,a.child=et,h=a.child,h.memoizedState=k1(u),h.childLanes=A1(o,O,u),a.memoizedState=S1,Rh(null,h)):(zi(a),M1(a,et))}var Ct=o.memoizedState;if(Ct!==null&&(et=Ct.dehydrated,et!==null)){if(S)a.flags&256?(zi(a),a.flags&=-257,a=C1(o,a,u)):a.memoizedState!==null?(Xi(),a.child=o.child,a.flags|=128,a=null):(Xi(),et=h.fallback,x=a.mode,h=pm({mode:"visible",children:h.children},x),et=rl(et,x,u,null),et.flags|=2,h.return=a,et.return=a,h.sibling=et,a.child=h,Gr(a,o.child,null,u),h=a.child,h.memoizedState=k1(u),h.childLanes=A1(o,O,u),a.memoizedState=S1,a=Rh(null,h));else if(zi(a),sy(et)){if(O=et.nextSibling&&et.nextSibling.dataset,O)var Kt=O.dgst;O=Kt,h=Error(r(419)),h.stack="",h.digest=O,gs({value:h,source:null,stack:null}),a=C1(o,a,u)}else if(Ho||Dl(o,a,u,!1),O=(u&o.childLanes)!==0,Ho||O){if(O=gi,O!==null&&(h=lr(O,u),h!==0&&h!==Ct.retryLane))throw Ct.retryLane=h,Oa(o,h),qa(O,o,h),v1;oy(et)||km(),a=C1(o,a,u)}else oy(et)?(a.flags|=192,a.child=o.child,a=null):(o=Ct.treeContext,Xr=Pl(et.nextSibling),Oi=a,Yn=!0,zo=null,mi=!1,o!==null&&Bf(a,o),a=M1(a,h.children),a.flags|=4096);return a}return x?(Xi(),et=h.fallback,x=a.mode,Ct=o.child,Kt=Ct.sibling,h=Ts(Ct,{mode:"hidden",children:h.children}),h.subtreeFlags=Ct.subtreeFlags&65011712,Kt!==null?et=Ts(Kt,et):(et=rl(et,x,u,null),et.flags|=2),et.return=a,h.return=a,h.sibling=et,a.child=h,Rh(null,h),h=a.child,et=o.child.memoizedState,et===null?et=k1(u):(x=et.cachePool,x!==null?(Ct=Pi._currentValue,x=x.parent!==Ct?{parent:Ct,pool:Ct}:x):x=mt(),et={baseLanes:et.baseLanes|u,cachePool:x}),h.memoizedState=et,h.childLanes=A1(o,O,u),a.memoizedState=S1,Rh(o.child,h)):(zi(a),u=o.child,o=u.sibling,u=Ts(u,{mode:"visible",children:h.children}),u.return=a,u.sibling=null,o!==null&&(O=a.deletions,O===null?(a.deletions=[o],a.flags|=16):O.push(o)),a.child=u,a.memoizedState=null,u)}function M1(o,a){return a=pm({mode:"visible",children:a},o.mode),a.return=o,o.child=a}function pm(o,a){return o=Io(22,o,null,a),o.lanes=0,o}function C1(o,a,u){return Gr(a,o.child,null,u),o=M1(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function mx(o,a,u){o.lanes|=a;var h=o.alternate;h!==null&&(h.lanes|=a),dc(o.return,a,u)}function E1(o,a,u,h,x,S){var O=o.memoizedState;O===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:u,tailMode:x,treeForkCount:S}:(O.isBackwards=a,O.rendering=null,O.renderingStartTime=0,O.last=h,O.tail=u,O.tailMode=x,O.treeForkCount=S)}function gx(o,a,u){var h=a.pendingProps,x=h.revealOrder,S=h.tail;h=h.children;var O=dr.current,et=(O&2)!==0;if(et?(O=O&1|2,a.flags|=128):O&=1,j(dr,O),Os(o,a,h,u),h=Yn?Ic:0,!et&&o!==null&&(o.flags&128)!==0)t:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&mx(o,u,a);else if(o.tag===19)mx(o,u,a);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break t;for(;o.sibling===null;){if(o.return===null||o.return===a)break t;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(x){case"forwards":for(u=a.child,x=null;u!==null;)o=u.alternate,o!==null&&ro(o)===null&&(x=u),u=u.sibling;u=x,u===null?(x=a.child,a.child=null):(x=u.sibling,u.sibling=null),E1(a,!1,x,u,S,h);break;case"backwards":case"unstable_legacy-backwards":for(u=null,x=a.child,a.child=null;x!==null;){if(o=x.alternate,o!==null&&ro(o)===null){a.child=x;break}o=x.sibling,x.sibling=u,u=x,x=o}E1(a,!0,u,null,S,h);break;case"together":E1(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function yu(o,a,u){if(o!==null&&(a.dependencies=o.dependencies),Ku|=a.lanes,(u&a.childLanes)===0)if(o!==null){if(Dl(o,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(o!==null&&a.child!==o.child)throw Error(r(153));if(a.child!==null){for(o=a.child,u=Ts(o,o.pendingProps),a.child=u,u.return=a;o.sibling!==null;)o=o.sibling,u=u.sibling=Ts(o,o.pendingProps),u.return=a;u.sibling=null}return a.child}function T1(o,a){return(o.lanes&a)!==0?!0:(o=o.dependencies,!!(o!==null&&Yu(o)))}function K6(o,a,u){switch(a.tag){case 3:Ft(a,a.stateNode.containerInfo),_l(a,Pi,o.memoizedState.cache),es();break;case 27:case 5:Qt(a);break;case 4:Ft(a,a.stateNode.containerInfo);break;case 10:_l(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Tr(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(zi(a),a.flags|=128,null):(u&a.child.childLanes)!==0?px(o,a,u):(zi(a),o=yu(o,a,u),o!==null?o.sibling:null);zi(a);break;case 19:var x=(o.flags&128)!==0;if(h=(u&a.childLanes)!==0,h||(Dl(o,a,u,!1),h=(u&a.childLanes)!==0),x){if(h)return gx(o,a,u);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),j(dr,dr.current),h)break;return null;case 22:return a.lanes=0,lx(o,a,u,a.pendingProps);case 24:_l(a,Pi,o.memoizedState.cache)}return yu(o,a,u)}function yx(o,a,u){if(o!==null)if(o.memoizedProps!==a.pendingProps)Ho=!0;else{if(!T1(o,u)&&(a.flags&128)===0)return Ho=!1,K6(o,a,u);Ho=(o.flags&131072)!==0}else Ho=!1,Yn&&(a.flags&1048576)!==0&&zf(a,Ic,a.index);switch(a.lanes=0,a.tag){case 16:t:{var h=a.pendingProps;if(o=$t(a.elementType),a.type=o,typeof o=="function")cu(o)?(h=$f(o,h),a.tag=1,a=dx(null,a,o,h,u)):(a.tag=0,a=w1(null,a,o,h,u));else{if(o!=null){var x=o.$$typeof;if(x===Y){a.tag=11,a=ox(null,a,o,h,u);break t}else if(x===vt){a.tag=14,a=sx(null,a,o,h,u);break t}}throw a=wt(o)||o,Error(r(306,a,""))}}return a;case 0:return w1(o,a,a.type,a.pendingProps,u);case 1:return h=a.type,x=$f(h,a.pendingProps),dx(o,a,h,x,u);case 3:t:{if(Ft(a,a.stateNode.containerInfo),o===null)throw Error(r(387));h=a.pendingProps;var S=a.memoizedState;x=S.element,li(o,a),ji(a,h,null,u);var O=a.memoizedState;if(h=O.cache,_l(a,Pi,h),h!==S.cache&&hc(a,[Pi],u,!0),Ir(),h=O.element,S.isDehydrated)if(S={element:h,isDehydrated:!1,cache:O.cache},a.updateQueue.baseState=S,a.memoizedState=S,a.flags&256){a=hx(o,a,h,u);break t}else if(h!==x){x=Ns(Error(r(424)),a),gs(x),a=hx(o,a,h,u);break t}else for(o=a.stateNode.containerInfo,o.nodeType===9?o=o.body:o=o.nodeName==="HTML"?o.ownerDocument.body:o,Xr=Pl(o.firstChild),Oi=a,Yn=!0,zo=null,mi=!0,u=cn(a,null,h,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(es(),h===x){a=yu(o,a,u);break t}Os(o,a,h,u)}a=a.child}return a;case 26:return hm(o,a),o===null?(u=Tv(a.type,null,a.pendingProps,null))?a.memoizedState=u:Yn||(u=a.type,o=a.pendingProps,h=_m(xt.current).createElement(u),h[er]=a,h[Rn]=o,Ps(h,u,o),Ti(h),a.stateNode=h):a.memoizedState=Tv(a.type,o.memoizedProps,a.pendingProps,o.memoizedState),null;case 27:return Qt(a),o===null&&Yn&&(h=a.stateNode=Mv(a.type,a.pendingProps,xt.current),Oi=a,mi=!0,x=Xr,ef(a.type)?(ay=x,Xr=Pl(h.firstChild)):Xr=x),Os(o,a,a.pendingProps.children,u),hm(o,a),o===null&&(a.flags|=4194304),a.child;case 5:return o===null&&Yn&&((x=h=Xr)&&(h=CE(h,a.type,a.pendingProps,mi),h!==null?(a.stateNode=h,Oi=a,Xr=Pl(h.firstChild),mi=!1,x=!0):x=!1),x||ol(a)),Qt(a),x=a.type,S=a.pendingProps,O=o!==null?o.memoizedProps:null,h=S.children,ny(x,S)?h=null:O!==null&&ny(x,O)&&(a.flags|=32),a.memoizedState!==null&&(x=k(o,a,z,null,null,u),Xh._currentValue=x),hm(o,a),Os(o,a,h,u),a.child;case 6:return o===null&&Yn&&((o=u=Xr)&&(u=EE(u,a.pendingProps,mi),u!==null?(a.stateNode=u,Oi=a,Xr=null,o=!0):o=!1),o||ol(a)),null;case 13:return px(o,a,u);case 4:return Ft(a,a.stateNode.containerInfo),h=a.pendingProps,o===null?a.child=Gr(a,null,h,u):Os(o,a,h,u),a.child;case 11:return ox(o,a,a.type,a.pendingProps,u);case 7:return Os(o,a,a.pendingProps,u),a.child;case 8:return Os(o,a,a.pendingProps.children,u),a.child;case 12:return Os(o,a,a.pendingProps.children,u),a.child;case 10:return h=a.pendingProps,_l(a,a.type,h.value),Os(o,a,h.children,u),a.child;case 9:return x=a.type._context,h=a.pendingProps.children,Ll(a),x=co(x),h=h(x),a.flags|=1,Os(o,a,h,u),a.child;case 14:return sx(o,a,a.type,a.pendingProps,u);case 15:return ax(o,a,a.type,a.pendingProps,u);case 19:return gx(o,a,u);case 31:return G6(o,a,u);case 22:return lx(o,a,u,a.pendingProps);case 24:return Ll(a),h=co(Pi),o===null?(x=it(),x===null&&(x=gi,S=Ia(),x.pooledCache=S,S.refCount++,S!==null&&(x.pooledCacheLanes|=u),x=S),a.memoizedState={parent:h,cache:x},Le(a),_l(a,Pi,x)):((o.lanes&u)!==0&&(li(o,a),ji(a,null,null,u),Ir()),x=o.memoizedState,S=a.memoizedState,x.parent!==h?(x={parent:h,cache:h},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),_l(a,Pi,h)):(h=S.cache,_l(a,Pi,h),h!==x.cache&&hc(a,[Pi],u,!0))),Os(o,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function bu(o){o.flags|=4}function N1(o,a,u,h,x){if((a=(o.mode&32)!==0)&&(a=!1),a){if(o.flags|=16777216,(x&335544128)===x)if(o.stateNode.complete)o.flags|=8192;else if($x())o.flags|=8192;else throw re=Pt,Vt}else o.flags&=-16777217}function bx(o,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!Rv(a))if($x())o.flags|=8192;else throw re=Pt,Vt}function mm(o,a){a!==null&&(o.flags|=4),o.flags&16384&&(a=o.tag!==22?Xt():536870912,o.lanes|=a,Rd|=a)}function Oh(o,a){if(!Yn)switch(o.tailMode){case"hidden":a=o.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?o.tail=null:u.sibling=null;break;case"collapsed":u=o.tail;for(var h=null;u!==null;)u.alternate!==null&&(h=u),u=u.sibling;h===null?a||o.tail===null?o.tail=null:o.tail.sibling=null:h.sibling=null}}function Fi(o){var a=o.alternate!==null&&o.alternate.child===o.child,u=0,h=0;if(a)for(var x=o.child;x!==null;)u|=x.lanes|x.childLanes,h|=x.subtreeFlags&65011712,h|=x.flags&65011712,x.return=o,x=x.sibling;else for(x=o.child;x!==null;)u|=x.lanes|x.childLanes,h|=x.subtreeFlags,h|=x.flags,x.return=o,x=x.sibling;return o.subtreeFlags|=h,o.childLanes=u,a}function J6(o,a,u){var h=a.pendingProps;switch(hu(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fi(a),null;case 1:return Fi(a),null;case 3:return u=a.stateNode,h=null,o!==null&&(h=o.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),Ls(Pi),Rt(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(o===null||o.child===null)&&(lo(a)?bu(a):o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,zc())),Fi(a),null;case 26:var x=a.type,S=a.memoizedState;return o===null?(bu(a),S!==null?(Fi(a),bx(a,S)):(Fi(a),N1(a,x,null,h,u))):S?S!==o.memoizedState?(bu(a),Fi(a),bx(a,S)):(Fi(a),a.flags&=-16777217):(o=o.memoizedProps,o!==h&&bu(a),Fi(a),N1(a,x,o,h,u)),null;case 27:if(ve(a),u=xt.current,x=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==h&&bu(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return Fi(a),null}o=G.current,lo(a)?$u(a):(o=Mv(x,h,u),a.stateNode=o,bu(a))}return Fi(a),null;case 5:if(ve(a),x=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==h&&bu(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return Fi(a),null}if(S=G.current,lo(a))$u(a);else{var O=_m(xt.current);switch(S){case 1:S=O.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:S=O.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":S=O.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":S=O.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":S=O.createElement("div"),S.innerHTML="<script><\/script>",S=S.removeChild(S.firstChild);break;case"select":S=typeof h.is=="string"?O.createElement("select",{is:h.is}):O.createElement("select"),h.multiple?S.multiple=!0:h.size&&(S.size=h.size);break;default:S=typeof h.is=="string"?O.createElement(x,{is:h.is}):O.createElement(x)}}S[er]=a,S[Rn]=h;t:for(O=a.child;O!==null;){if(O.tag===5||O.tag===6)S.appendChild(O.stateNode);else if(O.tag!==4&&O.tag!==27&&O.child!==null){O.child.return=O,O=O.child;continue}if(O===a)break t;for(;O.sibling===null;){if(O.return===null||O.return===a)break t;O=O.return}O.sibling.return=O.return,O=O.sibling}a.stateNode=S;t:switch(Ps(S,x,h),x){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break t;case"img":h=!0;break t;default:h=!1}h&&bu(a)}}return Fi(a),N1(a,a.type,o===null?null:o.memoizedProps,a.pendingProps,u),null;case 6:if(o&&a.stateNode!=null)o.memoizedProps!==h&&bu(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(r(166));if(o=xt.current,lo(a)){if(o=a.stateNode,u=a.memoizedProps,h=null,x=Oi,x!==null)switch(x.tag){case 27:case 5:h=x.memoizedProps}o[er]=a,o=!!(o.nodeValue===u||h!==null&&h.suppressHydrationWarning===!0||pv(o.nodeValue,u)),o||ol(a,!0)}else o=_m(o).createTextNode(h),o[er]=a,a.stateNode=o}return Fi(a),null;case 31:if(u=a.memoizedState,o===null||o.memoizedState!==null){if(h=lo(a),u!==null){if(o===null){if(!h)throw Error(r(318));if(o=a.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[er]=a}else es(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Fi(a),o=!1}else u=zc(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=u),o=!0;if(!o)return a.flags&256?(zr(a),a):(zr(a),null);if((a.flags&128)!==0)throw Error(r(558))}return Fi(a),null;case 13:if(h=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(x=lo(a),h!==null&&h.dehydrated!==null){if(o===null){if(!x)throw Error(r(318));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[er]=a}else es(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Fi(a),x=!1}else x=zc(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(zr(a),a):(zr(a),null)}return zr(a),(a.flags&128)!==0?(a.lanes=u,a):(u=h!==null,o=o!==null&&o.memoizedState!==null,u&&(h=a.child,x=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(x=h.alternate.memoizedState.cachePool.pool),S=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(S=h.memoizedState.cachePool.pool),S!==x&&(h.flags|=2048)),u!==o&&u&&(a.child.flags|=8192),mm(a,a.updateQueue),Fi(a),null);case 4:return Rt(),o===null&&J1(a.stateNode.containerInfo),Fi(a),null;case 10:return Ls(a.type),Fi(a),null;case 19:if(P(dr),h=a.memoizedState,h===null)return Fi(a),null;if(x=(a.flags&128)!==0,S=h.rendering,S===null)if(x)Oh(h,!1);else{if(fo!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(S=ro(o),S!==null){for(a.flags|=128,Oh(h,!1),o=S.updateQueue,a.updateQueue=o,mm(a,o),a.subtreeFlags=0,o=u,u=a.child;u!==null;)Pc(u,o),u=u.sibling;return j(dr,dr.current&1|2),Yn&&ms(a,h.treeForkCount),a.child}o=o.sibling}h.tail!==null&&un()>vm&&(a.flags|=128,x=!0,Oh(h,!1),a.lanes=4194304)}else{if(!x)if(o=ro(S),o!==null){if(a.flags|=128,x=!0,o=o.updateQueue,a.updateQueue=o,mm(a,o),Oh(h,!0),h.tail===null&&h.tailMode==="hidden"&&!S.alternate&&!Yn)return Fi(a),null}else 2*un()-h.renderingStartTime>vm&&u!==536870912&&(a.flags|=128,x=!0,Oh(h,!1),a.lanes=4194304);h.isBackwards?(S.sibling=a.child,a.child=S):(o=h.last,o!==null?o.sibling=S:a.child=S,h.last=S)}return h.tail!==null?(o=h.tail,h.rendering=o,h.tail=o.sibling,h.renderingStartTime=un(),o.sibling=null,u=dr.current,j(dr,x?u&1|2:u&1),Yn&&ms(a,h.treeForkCount),o):(Fi(a),null);case 22:case 23:return zr(a),Ii(),h=a.memoizedState!==null,o!==null?o.memoizedState!==null!==h&&(a.flags|=8192):h&&(a.flags|=8192),h?(u&536870912)!==0&&(a.flags&128)===0&&(Fi(a),a.subtreeFlags&6&&(a.flags|=8192)):Fi(a),u=a.updateQueue,u!==null&&mm(a,u.retryQueue),u=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(u=o.memoizedState.cachePool.pool),h=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),h!==u&&(a.flags|=2048),o!==null&&P(K),null;case 24:return u=null,o!==null&&(u=o.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Ls(Pi),Fi(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function Z6(o,a){switch(hu(a),a.tag){case 1:return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return Ls(Pi),Rt(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 26:case 27:case 5:return ve(a),null;case 31:if(a.memoizedState!==null){if(zr(a),a.alternate===null)throw Error(r(340));es()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 13:if(zr(a),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(r(340));es()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return P(dr),null;case 4:return Rt(),null;case 10:return Ls(a.type),null;case 22:case 23:return zr(a),Ii(),o!==null&&P(K),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 24:return Ls(Pi),null;case 25:return null;default:return null}}function xx(o,a){switch(hu(a),a.tag){case 3:Ls(Pi),Rt();break;case 26:case 27:case 5:ve(a);break;case 4:Rt();break;case 31:a.memoizedState!==null&&zr(a);break;case 13:zr(a);break;case 19:P(dr);break;case 10:Ls(a.type);break;case 22:case 23:zr(a),Ii(),o!==null&&P(K);break;case 24:Ls(Pi)}}function Ph(o,a){try{var u=a.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var x=h.next;u=x;do{if((u.tag&o)===o){h=void 0;var S=u.create,O=u.inst;h=S(),O.destroy=h}u=u.next}while(u!==x)}}catch(et){ri(a,a.return,et)}}function Xu(o,a,u){try{var h=a.updateQueue,x=h!==null?h.lastEffect:null;if(x!==null){var S=x.next;h=S;do{if((h.tag&o)===o){var O=h.inst,et=O.destroy;if(et!==void 0){O.destroy=void 0,x=a;var Ct=u,Kt=et;try{Kt()}catch(ae){ri(x,Ct,ae)}}}h=h.next}while(h!==S)}}catch(ae){ri(a,a.return,ae)}}function vx(o){var a=o.updateQueue;if(a!==null){var u=o.stateNode;try{Wi(a,u)}catch(h){ri(o,o.return,h)}}}function wx(o,a,u){u.props=$f(o.type,o.memoizedProps),u.state=o.memoizedState;try{u.componentWillUnmount()}catch(h){ri(o,a,h)}}function jh(o,a){try{var u=o.ref;if(u!==null){switch(o.tag){case 26:case 27:case 5:var h=o.stateNode;break;case 30:h=o.stateNode;break;default:h=o.stateNode}typeof u=="function"?o.refCleanup=u(h):u.current=h}}catch(x){ri(o,a,x)}}function Vc(o,a){var u=o.ref,h=o.refCleanup;if(u!==null)if(typeof h=="function")try{h()}catch(x){ri(o,a,x)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(x){ri(o,a,x)}else u.current=null}function Sx(o){var a=o.type,u=o.memoizedProps,h=o.stateNode;try{t:switch(a){case"button":case"input":case"select":case"textarea":u.autoFocus&&h.focus();break t;case"img":u.src?h.src=u.src:u.srcSet&&(h.srcset=u.srcSet)}}catch(x){ri(o,o.return,x)}}function _1(o,a,u){try{var h=o.stateNode;vE(h,o.type,u,a),h[Rn]=a}catch(x){ri(o,o.return,x)}}function kx(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&ef(o.type)||o.tag===4}function D1(o){t:for(;;){for(;o.sibling===null;){if(o.return===null||kx(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&ef(o.type)||o.flags&2||o.child===null||o.tag===4)continue t;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function L1(o,a,u){var h=o.tag;if(h===5||h===6)o=o.stateNode,a?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(o,a):(a=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,a.appendChild(o),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=$i));else if(h!==4&&(h===27&&ef(o.type)&&(u=o.stateNode,a=null),o=o.child,o!==null))for(L1(o,a,u),o=o.sibling;o!==null;)L1(o,a,u),o=o.sibling}function gm(o,a,u){var h=o.tag;if(h===5||h===6)o=o.stateNode,a?u.insertBefore(o,a):u.appendChild(o);else if(h!==4&&(h===27&&ef(o.type)&&(u=o.stateNode),o=o.child,o!==null))for(gm(o,a,u),o=o.sibling;o!==null;)gm(o,a,u),o=o.sibling}function Ax(o){var a=o.stateNode,u=o.memoizedProps;try{for(var h=o.type,x=a.attributes;x.length;)a.removeAttributeNode(x[0]);Ps(a,h,u),a[er]=o,a[Rn]=u}catch(S){ri(o,o.return,S)}}var xu=!1,qo=!1,R1=!1,Mx=typeof WeakSet=="function"?WeakSet:Set,ys=null;function Q6(o,a){if(o=o.containerInfo,ty=Im,o=eo(o),ea(o)){if("selectionStart"in o)var u={start:o.selectionStart,end:o.selectionEnd};else t:{u=(u=o.ownerDocument)&&u.defaultView||window;var h=u.getSelection&&u.getSelection();if(h&&h.rangeCount!==0){u=h.anchorNode;var x=h.anchorOffset,S=h.focusNode;h=h.focusOffset;try{u.nodeType,S.nodeType}catch{u=null;break t}var O=0,et=-1,Ct=-1,Kt=0,ae=0,pe=o,Zt=null;e:for(;;){for(var ee;pe!==u||x!==0&&pe.nodeType!==3||(et=O+x),pe!==S||h!==0&&pe.nodeType!==3||(Ct=O+h),pe.nodeType===3&&(O+=pe.nodeValue.length),(ee=pe.firstChild)!==null;)Zt=pe,pe=ee;for(;;){if(pe===o)break e;if(Zt===u&&++Kt===x&&(et=O),Zt===S&&++ae===h&&(Ct=O),(ee=pe.nextSibling)!==null)break;pe=Zt,Zt=pe.parentNode}pe=ee}u=et===-1||Ct===-1?null:{start:et,end:Ct}}else u=null}u=u||{start:0,end:0}}else u=null;for(ey={focusedElem:o,selectionRange:u},Im=!1,ys=a;ys!==null;)if(a=ys,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,ys=o;else for(;ys!==null;){switch(a=ys,S=a.alternate,o=a.flags,a.tag){case 0:if((o&4)!==0&&(o=a.updateQueue,o=o!==null?o.events:null,o!==null))for(u=0;u<o.length;u++)x=o[u],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&S!==null){o=void 0,u=a,x=S.memoizedProps,S=S.memoizedState,h=u.stateNode;try{var rn=$f(u.type,x);o=h.getSnapshotBeforeUpdate(rn,S),h.__reactInternalSnapshotBeforeUpdate=o}catch(Dn){ri(u,u.return,Dn)}}break;case 3:if((o&1024)!==0){if(o=a.stateNode.containerInfo,u=o.nodeType,u===9)iy(o);else if(u===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":iy(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(r(163))}if(o=a.sibling,o!==null){o.return=a.return,ys=o;break}ys=a.return}}function Cx(o,a,u){var h=u.flags;switch(u.tag){case 0:case 11:case 15:wu(o,u),h&4&&Ph(5,u);break;case 1:if(wu(o,u),h&4)if(o=u.stateNode,a===null)try{o.componentDidMount()}catch(O){ri(u,u.return,O)}else{var x=$f(u.type,a.memoizedProps);a=a.memoizedState;try{o.componentDidUpdate(x,a,o.__reactInternalSnapshotBeforeUpdate)}catch(O){ri(u,u.return,O)}}h&64&&vx(u),h&512&&jh(u,u.return);break;case 3:if(wu(o,u),h&64&&(o=u.updateQueue,o!==null)){if(a=null,u.child!==null)switch(u.child.tag){case 27:case 5:a=u.child.stateNode;break;case 1:a=u.child.stateNode}try{Wi(o,a)}catch(O){ri(u,u.return,O)}}break;case 27:a===null&&h&4&&Ax(u);case 26:case 5:wu(o,u),a===null&&h&4&&Sx(u),h&512&&jh(u,u.return);break;case 12:wu(o,u);break;case 31:wu(o,u),h&4&&Nx(o,u);break;case 13:wu(o,u),h&4&&_x(o,u),h&64&&(o=u.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(u=lE.bind(null,u),TE(o,u))));break;case 22:if(h=u.memoizedState!==null||xu,!h){a=a!==null&&a.memoizedState!==null||qo,x=xu;var S=qo;xu=h,(qo=a)&&!S?Su(o,u,(u.subtreeFlags&8772)!==0):wu(o,u),xu=x,qo=S}break;case 30:break;default:wu(o,u)}}function Ex(o){var a=o.alternate;a!==null&&(o.alternate=null,Ex(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&is(a)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var Ki=null,Ba=!1;function vu(o,a,u){for(u=u.child;u!==null;)Tx(o,a,u),u=u.sibling}function Tx(o,a,u){if(nn&&typeof nn.onCommitFiberUnmount=="function")try{nn.onCommitFiberUnmount(Cn,u)}catch{}switch(u.tag){case 26:qo||Vc(u,a),vu(o,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:qo||Vc(u,a);var h=Ki,x=Ba;ef(u.type)&&(Ki=u.stateNode,Ba=!1),vu(o,a,u),Yh(u.stateNode),Ki=h,Ba=x;break;case 5:qo||Vc(u,a);case 6:if(h=Ki,x=Ba,Ki=null,vu(o,a,u),Ki=h,Ba=x,Ki!==null)if(Ba)try{(Ki.nodeType===9?Ki.body:Ki.nodeName==="HTML"?Ki.ownerDocument.body:Ki).removeChild(u.stateNode)}catch(S){ri(u,a,S)}else try{Ki.removeChild(u.stateNode)}catch(S){ri(u,a,S)}break;case 18:Ki!==null&&(Ba?(o=Ki,vv(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,u.stateNode),Ud(o)):vv(Ki,u.stateNode));break;case 4:h=Ki,x=Ba,Ki=u.stateNode.containerInfo,Ba=!0,vu(o,a,u),Ki=h,Ba=x;break;case 0:case 11:case 14:case 15:Xu(2,u,a),qo||Xu(4,u,a),vu(o,a,u);break;case 1:qo||(Vc(u,a),h=u.stateNode,typeof h.componentWillUnmount=="function"&&wx(u,a,h)),vu(o,a,u);break;case 21:vu(o,a,u);break;case 22:qo=(h=qo)||u.memoizedState!==null,vu(o,a,u),qo=h;break;default:vu(o,a,u)}}function Nx(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{Ud(o)}catch(u){ri(a,a.return,u)}}}function _x(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{Ud(o)}catch(u){ri(a,a.return,u)}}function tE(o){switch(o.tag){case 31:case 13:case 19:var a=o.stateNode;return a===null&&(a=o.stateNode=new Mx),a;case 22:return o=o.stateNode,a=o._retryCache,a===null&&(a=o._retryCache=new Mx),a;default:throw Error(r(435,o.tag))}}function ym(o,a){var u=tE(o);a.forEach(function(h){if(!u.has(h)){u.add(h);var x=cE.bind(null,o,h);h.then(x,x)}})}function Fa(o,a){var u=a.deletions;if(u!==null)for(var h=0;h<u.length;h++){var x=u[h],S=o,O=a,et=O;t:for(;et!==null;){switch(et.tag){case 27:if(ef(et.type)){Ki=et.stateNode,Ba=!1;break t}break;case 5:Ki=et.stateNode,Ba=!1;break t;case 3:case 4:Ki=et.stateNode.containerInfo,Ba=!0;break t}et=et.return}if(Ki===null)throw Error(r(160));Tx(S,O,x),Ki=null,Ba=!1,S=x.alternate,S!==null&&(S.return=null),x.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Dx(a,o),a=a.sibling}var pc=null;function Dx(o,a){var u=o.alternate,h=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:Fa(a,o),Ua(o),h&4&&(Xu(3,o,o.return),Ph(3,o),Xu(5,o,o.return));break;case 1:Fa(a,o),Ua(o),h&512&&(qo||u===null||Vc(u,u.return)),h&64&&xu&&(o=o.updateQueue,o!==null&&(h=o.callbacks,h!==null&&(u=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=u===null?h:u.concat(h))));break;case 26:var x=pc;if(Fa(a,o),Ua(o),h&512&&(qo||u===null||Vc(u,u.return)),h&4){var S=u!==null?u.memoizedState:null;if(h=o.memoizedState,u===null)if(h===null)if(o.stateNode===null){t:{h=o.type,u=o.memoizedProps,x=x.ownerDocument||x;e:switch(h){case"title":S=x.getElementsByTagName("title")[0],(!S||S[Lo]||S[er]||S.namespaceURI==="http://www.w3.org/2000/svg"||S.hasAttribute("itemprop"))&&(S=x.createElement(h),x.head.insertBefore(S,x.querySelector("head > title"))),Ps(S,h,u),S[er]=o,Ti(S),h=S;break t;case"link":var O=Dv("link","href",x).get(h+(u.href||""));if(O){for(var et=0;et<O.length;et++)if(S=O[et],S.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&S.getAttribute("rel")===(u.rel==null?null:u.rel)&&S.getAttribute("title")===(u.title==null?null:u.title)&&S.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){O.splice(et,1);break e}}S=x.createElement(h),Ps(S,h,u),x.head.appendChild(S);break;case"meta":if(O=Dv("meta","content",x).get(h+(u.content||""))){for(et=0;et<O.length;et++)if(S=O[et],S.getAttribute("content")===(u.content==null?null:""+u.content)&&S.getAttribute("name")===(u.name==null?null:u.name)&&S.getAttribute("property")===(u.property==null?null:u.property)&&S.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&S.getAttribute("charset")===(u.charSet==null?null:u.charSet)){O.splice(et,1);break e}}S=x.createElement(h),Ps(S,h,u),x.head.appendChild(S);break;default:throw Error(r(468,h))}S[er]=o,Ti(S),h=S}o.stateNode=h}else Lv(x,o.type,o.stateNode);else o.stateNode=_v(x,h,o.memoizedProps);else S!==h?(S===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):S.count--,h===null?Lv(x,o.type,o.stateNode):_v(x,h,o.memoizedProps)):h===null&&o.stateNode!==null&&_1(o,o.memoizedProps,u.memoizedProps)}break;case 27:Fa(a,o),Ua(o),h&512&&(qo||u===null||Vc(u,u.return)),u!==null&&h&4&&_1(o,o.memoizedProps,u.memoizedProps);break;case 5:if(Fa(a,o),Ua(o),h&512&&(qo||u===null||Vc(u,u.return)),o.flags&32){x=o.stateNode;try{so(x,"")}catch(rn){ri(o,o.return,rn)}}h&4&&o.stateNode!=null&&(x=o.memoizedProps,_1(o,x,u!==null?u.memoizedProps:x)),h&1024&&(R1=!0);break;case 6:if(Fa(a,o),Ua(o),h&4){if(o.stateNode===null)throw Error(r(162));h=o.memoizedProps,u=o.stateNode;try{u.nodeValue=h}catch(rn){ri(o,o.return,rn)}}break;case 3:if(Rm=null,x=pc,pc=Dm(a.containerInfo),Fa(a,o),pc=x,Ua(o),h&4&&u!==null&&u.memoizedState.isDehydrated)try{Ud(a.containerInfo)}catch(rn){ri(o,o.return,rn)}R1&&(R1=!1,Lx(o));break;case 4:h=pc,pc=Dm(o.stateNode.containerInfo),Fa(a,o),Ua(o),pc=h;break;case 12:Fa(a,o),Ua(o);break;case 31:Fa(a,o),Ua(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,ym(o,h)));break;case 13:Fa(a,o),Ua(o),o.child.flags&8192&&o.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(xm=un()),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,ym(o,h)));break;case 22:x=o.memoizedState!==null;var Ct=u!==null&&u.memoizedState!==null,Kt=xu,ae=qo;if(xu=Kt||x,qo=ae||Ct,Fa(a,o),qo=ae,xu=Kt,Ua(o),h&8192)t:for(a=o.stateNode,a._visibility=x?a._visibility&-2:a._visibility|1,x&&(u===null||Ct||xu||qo||Yf(o)),u=null,a=o;;){if(a.tag===5||a.tag===26){if(u===null){Ct=u=a;try{if(S=Ct.stateNode,x)O=S.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{et=Ct.stateNode;var pe=Ct.memoizedProps.style,Zt=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;et.style.display=Zt==null||typeof Zt=="boolean"?"":(""+Zt).trim()}}catch(rn){ri(Ct,Ct.return,rn)}}}else if(a.tag===6){if(u===null){Ct=a;try{Ct.stateNode.nodeValue=x?"":Ct.memoizedProps}catch(rn){ri(Ct,Ct.return,rn)}}}else if(a.tag===18){if(u===null){Ct=a;try{var ee=Ct.stateNode;x?wv(ee,!0):wv(Ct.stateNode,!1)}catch(rn){ri(Ct,Ct.return,rn)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===o)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break t;for(;a.sibling===null;){if(a.return===null||a.return===o)break t;u===a&&(u=null),a=a.return}u===a&&(u=null),a.sibling.return=a.return,a=a.sibling}h&4&&(h=o.updateQueue,h!==null&&(u=h.retryQueue,u!==null&&(h.retryQueue=null,ym(o,u))));break;case 19:Fa(a,o),Ua(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,ym(o,h)));break;case 30:break;case 21:break;default:Fa(a,o),Ua(o)}}function Ua(o){var a=o.flags;if(a&2){try{for(var u,h=o.return;h!==null;){if(kx(h)){u=h;break}h=h.return}if(u==null)throw Error(r(160));switch(u.tag){case 27:var x=u.stateNode,S=D1(o);gm(o,S,x);break;case 5:var O=u.stateNode;u.flags&32&&(so(O,""),u.flags&=-33);var et=D1(o);gm(o,et,O);break;case 3:case 4:var Ct=u.stateNode.containerInfo,Kt=D1(o);L1(o,Kt,Ct);break;default:throw Error(r(161))}}catch(ae){ri(o,o.return,ae)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function Lx(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var a=o;Lx(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),o=o.sibling}}function wu(o,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Cx(o,a.alternate,a),a=a.sibling}function Yf(o){for(o=o.child;o!==null;){var a=o;switch(a.tag){case 0:case 11:case 14:case 15:Xu(4,a,a.return),Yf(a);break;case 1:Vc(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&wx(a,a.return,u),Yf(a);break;case 27:Yh(a.stateNode);case 26:case 5:Vc(a,a.return),Yf(a);break;case 22:a.memoizedState===null&&Yf(a);break;case 30:Yf(a);break;default:Yf(a)}o=o.sibling}}function Su(o,a,u){for(u=u&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,x=o,S=a,O=S.flags;switch(S.tag){case 0:case 11:case 15:Su(x,S,u),Ph(4,S);break;case 1:if(Su(x,S,u),h=S,x=h.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(Kt){ri(h,h.return,Kt)}if(h=S,x=h.updateQueue,x!==null){var et=h.stateNode;try{var Ct=x.shared.hiddenCallbacks;if(Ct!==null)for(x.shared.hiddenCallbacks=null,x=0;x<Ct.length;x++)Bo(Ct[x],et)}catch(Kt){ri(h,h.return,Kt)}}u&&O&64&&vx(S),jh(S,S.return);break;case 27:Ax(S);case 26:case 5:Su(x,S,u),u&&h===null&&O&4&&Sx(S),jh(S,S.return);break;case 12:Su(x,S,u);break;case 31:Su(x,S,u),u&&O&4&&Nx(x,S);break;case 13:Su(x,S,u),u&&O&4&&_x(x,S);break;case 22:S.memoizedState===null&&Su(x,S,u),jh(S,S.return);break;case 30:break;default:Su(x,S,u)}a=a.sibling}}function O1(o,a){var u=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(u=o.memoizedState.cachePool.pool),o=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(o=a.memoizedState.cachePool.pool),o!==u&&(o!=null&&o.refCount++,u!=null&&Fc(u))}function P1(o,a){o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&Fc(o))}function mc(o,a,u,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Rx(o,a,u,h),a=a.sibling}function Rx(o,a,u,h){var x=a.flags;switch(a.tag){case 0:case 11:case 15:mc(o,a,u,h),x&2048&&Ph(9,a);break;case 1:mc(o,a,u,h);break;case 3:mc(o,a,u,h),x&2048&&(o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&Fc(o)));break;case 12:if(x&2048){mc(o,a,u,h),o=a.stateNode;try{var S=a.memoizedProps,O=S.id,et=S.onPostCommit;typeof et=="function"&&et(O,a.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(Ct){ri(a,a.return,Ct)}}else mc(o,a,u,h);break;case 31:mc(o,a,u,h);break;case 13:mc(o,a,u,h);break;case 23:break;case 22:S=a.stateNode,O=a.alternate,a.memoizedState!==null?S._visibility&2?mc(o,a,u,h):Ih(o,a):S._visibility&2?mc(o,a,u,h):(S._visibility|=2,_d(o,a,u,h,(a.subtreeFlags&10256)!==0||!1)),x&2048&&O1(O,a);break;case 24:mc(o,a,u,h),x&2048&&P1(a.alternate,a);break;default:mc(o,a,u,h)}}function _d(o,a,u,h,x){for(x=x&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var S=o,O=a,et=u,Ct=h,Kt=O.flags;switch(O.tag){case 0:case 11:case 15:_d(S,O,et,Ct,x),Ph(8,O);break;case 23:break;case 22:var ae=O.stateNode;O.memoizedState!==null?ae._visibility&2?_d(S,O,et,Ct,x):Ih(S,O):(ae._visibility|=2,_d(S,O,et,Ct,x)),x&&Kt&2048&&O1(O.alternate,O);break;case 24:_d(S,O,et,Ct,x),x&&Kt&2048&&P1(O.alternate,O);break;default:_d(S,O,et,Ct,x)}a=a.sibling}}function Ih(o,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var u=o,h=a,x=h.flags;switch(h.tag){case 22:Ih(u,h),x&2048&&O1(h.alternate,h);break;case 24:Ih(u,h),x&2048&&P1(h.alternate,h);break;default:Ih(u,h)}a=a.sibling}}var zh=8192;function Dd(o,a,u){if(o.subtreeFlags&zh)for(o=o.child;o!==null;)Ox(o,a,u),o=o.sibling}function Ox(o,a,u){switch(o.tag){case 26:Dd(o,a,u),o.flags&zh&&o.memoizedState!==null&&FE(u,pc,o.memoizedState,o.memoizedProps);break;case 5:Dd(o,a,u);break;case 3:case 4:var h=pc;pc=Dm(o.stateNode.containerInfo),Dd(o,a,u),pc=h;break;case 22:o.memoizedState===null&&(h=o.alternate,h!==null&&h.memoizedState!==null?(h=zh,zh=16777216,Dd(o,a,u),zh=h):Dd(o,a,u));break;default:Dd(o,a,u)}}function Px(o){var a=o.alternate;if(a!==null&&(o=a.child,o!==null)){a.child=null;do a=o.sibling,o.sibling=null,o=a;while(o!==null)}}function Bh(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var h=a[u];ys=h,Ix(h,o)}Px(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)jx(o),o=o.sibling}function jx(o){switch(o.tag){case 0:case 11:case 15:Bh(o),o.flags&2048&&Xu(9,o,o.return);break;case 3:Bh(o);break;case 12:Bh(o);break;case 22:var a=o.stateNode;o.memoizedState!==null&&a._visibility&2&&(o.return===null||o.return.tag!==13)?(a._visibility&=-3,bm(o)):Bh(o);break;default:Bh(o)}}function bm(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var h=a[u];ys=h,Ix(h,o)}Px(o)}for(o=o.child;o!==null;){switch(a=o,a.tag){case 0:case 11:case 15:Xu(8,a,a.return),bm(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,bm(a));break;default:bm(a)}o=o.sibling}}function Ix(o,a){for(;ys!==null;){var u=ys;switch(u.tag){case 0:case 11:case 15:Xu(8,u,a);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var h=u.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:Fc(u.memoizedState.cache)}if(h=u.child,h!==null)h.return=u,ys=h;else t:for(u=o;ys!==null;){h=ys;var x=h.sibling,S=h.return;if(Ex(h),h===u){ys=null;break t}if(x!==null){x.return=S,ys=x;break t}ys=S}}}var eE={getCacheForType:function(o){var a=co(Pi),u=a.data.get(o);return u===void 0&&(u=o(),a.data.set(o,u)),u},cacheSignal:function(){return co(Pi).controller.signal}},nE=typeof WeakMap=="function"?WeakMap:Map,Vr=0,gi=null,hr=null,vr=0,ni=0,ll=null,Gu=!1,Ld=!1,j1=!1,ku=0,fo=0,Ku=0,Vf=0,I1=0,cl=0,Rd=0,Fh=null,Ha=null,z1=!1,xm=0,zx=0,vm=1/0,wm=null,Ju=null,rs=0,Zu=null,Od=null,Au=0,B1=0,F1=null,Bx=null,Uh=0,U1=null;function ul(){return(Vr&2)!==0&&vr!==0?vr&-vr:yt.T!==null?W1():vi()}function Fx(){if(cl===0)if((vr&536870912)===0||Yn){var o=gr;gr<<=1,(gr&3932160)===0&&(gr=262144),cl=o}else cl=536870912;return o=ti.current,o!==null&&(o.flags|=32),cl}function qa(o,a,u){(o===gi&&(ni===2||ni===9)||o.cancelPendingCommit!==null)&&(Pd(o,0),Qu(o,vr,cl,!1)),Ae(o,u),((Vr&2)===0||o!==gi)&&(o===gi&&((Vr&2)===0&&(Vf|=u),fo===4&&Qu(o,vr,cl,!1)),Wc(o))}function Ux(o,a,u){if((Vr&6)!==0)throw Error(r(327));var h=!u&&(a&127)===0&&(a&o.expiredLanes)===0||ws(o,a),x=h?oE(o,a):q1(o,a,!0),S=h;do{if(x===0){Ld&&!h&&Qu(o,a,0,!1);break}else{if(u=o.current.alternate,S&&!rE(u)){x=q1(o,a,!1),S=!1;continue}if(x===2){if(S=a,o.errorRecoveryDisabledLanes&S)var O=0;else O=o.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){a=O;t:{var et=o;x=Fh;var Ct=et.current.memoizedState.isDehydrated;if(Ct&&(Pd(et,O).flags|=256),O=q1(et,O,!1),O!==2){if(j1&&!Ct){et.errorRecoveryDisabledLanes|=S,Vf|=S,x=4;break t}S=Ha,Ha=x,S!==null&&(Ha===null?Ha=S:Ha.push.apply(Ha,S))}x=O}if(S=!1,x!==2)continue}}if(x===1){Pd(o,0),Qu(o,a,0,!0);break}t:{switch(h=o,S=x,S){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Qu(h,a,cl,!Gu);break t;case 2:Ha=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(x=xm+300-un(),10<x)){if(Qu(h,a,cl,!Gu),Kn(h,0,!0)!==0)break t;Au=a,h.timeoutHandle=bv(Hx.bind(null,h,u,Ha,wm,z1,a,cl,Vf,Rd,Gu,S,"Throttled",-0,0),x);break t}Hx(h,u,Ha,wm,z1,a,cl,Vf,Rd,Gu,S,null,-0,0)}}break}while(!0);Wc(o)}function Hx(o,a,u,h,x,S,O,et,Ct,Kt,ae,pe,Zt,ee){if(o.timeoutHandle=-1,pe=a.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:$i},Ox(a,S,pe);var rn=(S&62914560)===S?xm-un():(S&4194048)===S?zx-un():0;if(rn=UE(pe,rn),rn!==null){Au=S,o.cancelPendingCommit=rn(Kx.bind(null,o,a,S,u,h,x,O,et,Ct,ae,pe,null,Zt,ee)),Qu(o,S,O,!Kt);return}}Kx(o,a,S,u,h,x,O,et,Ct)}function rE(o){for(var a=o;;){var u=a.tag;if((u===0||u===11||u===15)&&a.flags&16384&&(u=a.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var h=0;h<u.length;h++){var x=u[h],S=x.getSnapshot;x=x.value;try{if(!Or(S(),x))return!1}catch{return!1}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Qu(o,a,u,h){a&=~I1,a&=~Vf,o.suspendedLanes|=a,o.pingedLanes&=~a,h&&(o.warmLanes|=a),h=o.expirationTimes;for(var x=a;0<x;){var S=31-Ln(x),O=1<<S;h[S]=-1,x&=~O}u!==0&&or(o,u,a)}function Sm(){return(Vr&6)===0?(Hh(0),!1):!0}function H1(){if(hr!==null){if(ni===0)var o=hr.return;else o=hr,ja=sl=null,F(o),he=null,tn=0,o=hr;for(;o!==null;)xx(o.alternate,o),o=o.return;hr=null}}function Pd(o,a){var u=o.timeoutHandle;u!==-1&&(o.timeoutHandle=-1,kE(u)),u=o.cancelPendingCommit,u!==null&&(o.cancelPendingCommit=null,u()),Au=0,H1(),gi=o,hr=u=Ts(o.current,null),vr=a,ni=0,ll=null,Gu=!1,Ld=ws(o,a),j1=!1,Rd=cl=I1=Vf=Ku=fo=0,Ha=Fh=null,z1=!1,(a&8)!==0&&(a|=a&32);var h=o.entangledLanes;if(h!==0)for(o=o.entanglements,h&=a;0<h;){var x=31-Ln(h),S=1<<x;a|=o[x],h&=~S}return ku=a,Rc(),u}function qx(o,a){yn=null,yt.H=Lh,a===_t||a===gt?(a=se(),ni=3):a===Vt?(a=se(),ni=4):ni=a===v1?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,ll=a,hr===null&&(fo=1,fm(o,Ns(a,o.current)))}function $x(){var o=ti.current;return o===null?!0:(vr&4194048)===vr?br===null:(vr&62914560)===vr||(vr&536870912)!==0?o===br:!1}function Yx(){var o=yt.H;return yt.H=Lh,o===null?Lh:o}function Vx(){var o=yt.A;return yt.A=eE,o}function km(){fo=4,Gu||(vr&4194048)!==vr&&ti.current!==null||(Ld=!0),(Ku&134217727)===0&&(Vf&134217727)===0||gi===null||Qu(gi,vr,cl,!1)}function q1(o,a,u){var h=Vr;Vr|=2;var x=Yx(),S=Vx();(gi!==o||vr!==a)&&(wm=null,Pd(o,a)),a=!1;var O=fo;t:do try{if(ni!==0&&hr!==null){var et=hr,Ct=ll;switch(ni){case 8:H1(),O=6;break t;case 3:case 2:case 9:case 6:ti.current===null&&(a=!0);var Kt=ni;if(ni=0,ll=null,jd(o,et,Ct,Kt),u&&Ld){O=0;break t}break;default:Kt=ni,ni=0,ll=null,jd(o,et,Ct,Kt)}}iE(),O=fo;break}catch(ae){qx(o,ae)}while(!0);return a&&o.shellSuspendCounter++,ja=sl=null,Vr=h,yt.H=x,yt.A=S,hr===null&&(gi=null,vr=0,Rc()),O}function iE(){for(;hr!==null;)Wx(hr)}function oE(o,a){var u=Vr;Vr|=2;var h=Yx(),x=Vx();gi!==o||vr!==a?(wm=null,vm=un()+500,Pd(o,a)):Ld=ws(o,a);t:do try{if(ni!==0&&hr!==null){a=hr;var S=ll;e:switch(ni){case 1:ni=0,ll=null,jd(o,a,S,1);break;case 2:case 9:if(qt(S)){ni=0,ll=null,Xx(a);break}a=function(){ni!==2&&ni!==9||gi!==o||(ni=7),Wc(o)},S.then(a,a);break t;case 3:ni=7;break t;case 4:ni=5;break t;case 7:qt(S)?(ni=0,ll=null,Xx(a)):(ni=0,ll=null,jd(o,a,S,7));break;case 5:var O=null;switch(hr.tag){case 26:O=hr.memoizedState;case 5:case 27:var et=hr;if(O?Rv(O):et.stateNode.complete){ni=0,ll=null;var Ct=et.sibling;if(Ct!==null)hr=Ct;else{var Kt=et.return;Kt!==null?(hr=Kt,Am(Kt)):hr=null}break e}}ni=0,ll=null,jd(o,a,S,5);break;case 6:ni=0,ll=null,jd(o,a,S,6);break;case 8:H1(),fo=6;break t;default:throw Error(r(462))}}sE();break}catch(ae){qx(o,ae)}while(!0);return ja=sl=null,yt.H=h,yt.A=x,Vr=u,hr!==null?0:(gi=null,vr=0,Rc(),fo)}function sE(){for(;hr!==null&&!_e();)Wx(hr)}function Wx(o){var a=yx(o.alternate,o,ku);o.memoizedProps=o.pendingProps,a===null?Am(o):hr=a}function Xx(o){var a=o,u=a.alternate;switch(a.tag){case 15:case 0:a=fx(u,a,a.pendingProps,a.type,void 0,vr);break;case 11:a=fx(u,a,a.pendingProps,a.type.render,a.ref,vr);break;case 5:F(a);default:xx(u,a),a=hr=Pc(a,ku),a=yx(u,a,ku)}o.memoizedProps=o.pendingProps,a===null?Am(o):hr=a}function jd(o,a,u,h){ja=sl=null,F(a),he=null,tn=0;var x=a.return;try{if(X6(o,x,a,u,vr)){fo=1,fm(o,Ns(u,o.current)),hr=null;return}}catch(S){if(x!==null)throw hr=x,S;fo=1,fm(o,Ns(u,o.current)),hr=null;return}a.flags&32768?(Yn||h===1?o=!0:Ld||(vr&536870912)!==0?o=!1:(Gu=o=!0,(h===2||h===9||h===3||h===6)&&(h=ti.current,h!==null&&h.tag===13&&(h.flags|=16384))),Gx(a,o)):Am(a)}function Am(o){var a=o;do{if((a.flags&32768)!==0){Gx(a,Gu);return}o=a.return;var u=J6(a.alternate,a,ku);if(u!==null){hr=u;return}if(a=a.sibling,a!==null){hr=a;return}hr=a=o}while(a!==null);fo===0&&(fo=5)}function Gx(o,a){do{var u=Z6(o.alternate,o);if(u!==null){u.flags&=32767,hr=u;return}if(u=o.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(o=o.sibling,o!==null)){hr=o;return}hr=o=u}while(o!==null);fo=6,hr=null}function Kx(o,a,u,h,x,S,O,et,Ct){o.cancelPendingCommit=null;do Mm();while(rs!==0);if((Vr&6)!==0)throw Error(r(327));if(a!==null){if(a===o.current)throw Error(r(177));if(S=a.lanes|a.childLanes,S|=su,De(o,u,S,O,et,Ct),o===gi&&(hr=gi=null,vr=0),Od=a,Zu=o,Au=u,B1=S,F1=x,Bx=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,uE(dn,function(){return ev(),null})):(o.callbackNode=null,o.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=yt.T,yt.T=null,x=J.p,J.p=2,O=Vr,Vr|=4;try{Q6(o,a,u)}finally{Vr=O,J.p=x,yt.T=h}}rs=1,Jx(),Zx(),Qx()}}function Jx(){if(rs===1){rs=0;var o=Zu,a=Od,u=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||u){u=yt.T,yt.T=null;var h=J.p;J.p=2;var x=Vr;Vr|=4;try{Dx(a,o);var S=ey,O=eo(o.containerInfo),et=S.focusedElem,Ct=S.selectionRange;if(O!==et&&et&&et.ownerDocument&&hs(et.ownerDocument.documentElement,et)){if(Ct!==null&&ea(et)){var Kt=Ct.start,ae=Ct.end;if(ae===void 0&&(ae=Kt),"selectionStart"in et)et.selectionStart=Kt,et.selectionEnd=Math.min(ae,et.value.length);else{var pe=et.ownerDocument||document,Zt=pe&&pe.defaultView||window;if(Zt.getSelection){var ee=Zt.getSelection(),rn=et.textContent.length,Dn=Math.min(Ct.start,rn),fi=Ct.end===void 0?Dn:Math.min(Ct.end,rn);!ee.extend&&Dn>fi&&(O=fi,fi=Dn,Dn=O);var Ut=oc(et,Dn),Ot=oc(et,fi);if(Ut&&Ot&&(ee.rangeCount!==1||ee.anchorNode!==Ut.node||ee.anchorOffset!==Ut.offset||ee.focusNode!==Ot.node||ee.focusOffset!==Ot.offset)){var Gt=pe.createRange();Gt.setStart(Ut.node,Ut.offset),ee.removeAllRanges(),Dn>fi?(ee.addRange(Gt),ee.extend(Ot.node,Ot.offset)):(Gt.setEnd(Ot.node,Ot.offset),ee.addRange(Gt))}}}}for(pe=[],ee=et;ee=ee.parentNode;)ee.nodeType===1&&pe.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof et.focus=="function"&&et.focus(),et=0;et<pe.length;et++){var ue=pe[et];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}Im=!!ty,ey=ty=null}finally{Vr=x,J.p=h,yt.T=u}}o.current=a,rs=2}}function Zx(){if(rs===2){rs=0;var o=Zu,a=Od,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=yt.T,yt.T=null;var h=J.p;J.p=2;var x=Vr;Vr|=4;try{Cx(o,a.alternate,a)}finally{Vr=x,J.p=h,yt.T=u}}rs=3}}function Qx(){if(rs===4||rs===3){rs=0,Ye();var o=Zu,a=Od,u=Au,h=Bx;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?rs=5:(rs=0,Od=Zu=null,tv(o,o.pendingLanes));var x=o.pendingLanes;if(x===0&&(Ju=null),Dr(u),a=a.stateNode,nn&&typeof nn.onCommitFiberRoot=="function")try{nn.onCommitFiberRoot(Cn,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=yt.T,x=J.p,J.p=2,yt.T=null;try{for(var S=o.onRecoverableError,O=0;O<h.length;O++){var et=h[O];S(et.value,{componentStack:et.stack})}}finally{yt.T=a,J.p=x}}(Au&3)!==0&&Mm(),Wc(o),x=o.pendingLanes,(u&261930)!==0&&(x&42)!==0?o===U1?Uh++:(Uh=0,U1=o):Uh=0,Hh(0)}}function tv(o,a){(o.pooledCacheLanes&=a)===0&&(a=o.pooledCache,a!=null&&(o.pooledCache=null,Fc(a)))}function Mm(){return Jx(),Zx(),Qx(),ev()}function ev(){if(rs!==5)return!1;var o=Zu,a=B1;B1=0;var u=Dr(Au),h=yt.T,x=J.p;try{J.p=32>u?32:u,yt.T=null,u=F1,F1=null;var S=Zu,O=Au;if(rs=0,Od=Zu=null,Au=0,(Vr&6)!==0)throw Error(r(331));var et=Vr;if(Vr|=4,jx(S.current),Rx(S,S.current,O,u),Vr=et,Hh(0,!1),nn&&typeof nn.onPostCommitFiberRoot=="function")try{nn.onPostCommitFiberRoot(Cn,S)}catch{}return!0}finally{J.p=x,yt.T=h,tv(o,a)}}function nv(o,a,u){a=Ns(u,a),a=x1(o.stateNode,a,2),o=$n(o,a,2),o!==null&&(Ae(o,2),Wc(o))}function ri(o,a,u){if(o.tag===3)nv(o,o,u);else for(;a!==null;){if(a.tag===3){nv(a,o,u);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Ju===null||!Ju.has(h))){o=Ns(u,o),u=rx(2),h=$n(a,u,2),h!==null&&(ix(u,h,a,o),Ae(h,2),Wc(h));break}}a=a.return}}function $1(o,a,u){var h=o.pingCache;if(h===null){h=o.pingCache=new nE;var x=new Set;h.set(a,x)}else x=h.get(a),x===void 0&&(x=new Set,h.set(a,x));x.has(u)||(j1=!0,x.add(u),o=aE.bind(null,o,a,u),a.then(o,o))}function aE(o,a,u){var h=o.pingCache;h!==null&&h.delete(a),o.pingedLanes|=o.suspendedLanes&u,o.warmLanes&=~u,gi===o&&(vr&u)===u&&(fo===4||fo===3&&(vr&62914560)===vr&&300>un()-xm?(Vr&2)===0&&Pd(o,0):I1|=u,Rd===vr&&(Rd=0)),Wc(o)}function rv(o,a){a===0&&(a=Xt()),o=Oa(o,a),o!==null&&(Ae(o,a),Wc(o))}function lE(o){var a=o.memoizedState,u=0;a!==null&&(u=a.retryLane),rv(o,u)}function cE(o,a){var u=0;switch(o.tag){case 31:case 13:var h=o.stateNode,x=o.memoizedState;x!==null&&(u=x.retryLane);break;case 19:h=o.stateNode;break;case 22:h=o.stateNode._retryCache;break;default:throw Error(r(314))}h!==null&&h.delete(a),rv(o,u)}function uE(o,a){return Te(o,a)}var Cm=null,Id=null,Y1=!1,Em=!1,V1=!1,tf=0;function Wc(o){o!==Id&&o.next===null&&(Id===null?Cm=Id=o:Id=Id.next=o),Em=!0,Y1||(Y1=!0,dE())}function Hh(o,a){if(!V1&&Em){V1=!0;do for(var u=!1,h=Cm;h!==null;){if(o!==0){var x=h.pendingLanes;if(x===0)var S=0;else{var O=h.suspendedLanes,et=h.pingedLanes;S=(1<<31-Ln(42|o)+1)-1,S&=x&~(O&~et),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(u=!0,av(h,S))}else S=vr,S=Kn(h,h===gi?S:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(S&3)===0||ws(h,S)||(u=!0,av(h,S));h=h.next}while(u);V1=!1}}function fE(){iv()}function iv(){Em=Y1=!1;var o=0;tf!==0&&SE()&&(o=tf);for(var a=un(),u=null,h=Cm;h!==null;){var x=h.next,S=ov(h,a);S===0?(h.next=null,u===null?Cm=x:u.next=x,x===null&&(Id=u)):(u=h,(o!==0||(S&3)!==0)&&(Em=!0)),h=x}rs!==0&&rs!==5||Hh(o),tf!==0&&(tf=0)}function ov(o,a){for(var u=o.suspendedLanes,h=o.pingedLanes,x=o.expirationTimes,S=o.pendingLanes&-62914561;0<S;){var O=31-Ln(S),et=1<<O,Ct=x[O];Ct===-1?((et&u)===0||(et&h)!==0)&&(x[O]=qi(et,a)):Ct<=a&&(o.expiredLanes|=et),S&=~et}if(a=gi,u=vr,u=Kn(o,o===a?u:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h=o.callbackNode,u===0||o===a&&(ni===2||ni===9)||o.cancelPendingCommit!==null)return h!==null&&h!==null&&Ne(h),o.callbackNode=null,o.callbackPriority=0;if((u&3)===0||ws(o,u)){if(a=u&-u,a===o.callbackPriority)return a;switch(h!==null&&Ne(h),Dr(u)){case 2:case 8:u=_n;break;case 32:u=dn;break;case 268435456:u=We;break;default:u=dn}return h=sv.bind(null,o),u=Te(u,h),o.callbackPriority=a,o.callbackNode=u,a}return h!==null&&h!==null&&Ne(h),o.callbackPriority=2,o.callbackNode=null,2}function sv(o,a){if(rs!==0&&rs!==5)return o.callbackNode=null,o.callbackPriority=0,null;var u=o.callbackNode;if(Mm()&&o.callbackNode!==u)return null;var h=vr;return h=Kn(o,o===gi?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h===0?null:(Ux(o,h,a),ov(o,un()),o.callbackNode!=null&&o.callbackNode===u?sv.bind(null,o):null)}function av(o,a){if(Mm())return null;Ux(o,a,!0)}function dE(){AE(function(){(Vr&6)!==0?Te(Ue,fE):iv()})}function W1(){if(tf===0){var o=m;o===0&&(o=Sn,Sn<<=1,(Sn&261888)===0&&(Sn=256)),tf=o}return tf}function lv(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:ls(""+o)}function cv(o,a){var u=a.ownerDocument.createElement("input");return u.name=a.name,u.value=a.value,o.id&&u.setAttribute("form",o.id),a.parentNode.insertBefore(u,a),o=new FormData(o),u.parentNode.removeChild(u),o}function hE(o,a,u,h,x){if(a==="submit"&&u&&u.stateNode===x){var S=lv((x[Rn]||null).action),O=h.submitter;O&&(a=(a=O[Rn]||null)?lv(a.formAction):O.getAttribute("formAction"),a!==null&&(S=a,O=null));var et=new us("action","action",null,h,x);o.push({event:et,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(tf!==0){var Ct=O?cv(x,O):new FormData(x);za(u,{pending:!0,data:Ct,method:x.method,action:S},null,Ct)}}else typeof S=="function"&&(et.preventDefault(),Ct=O?cv(x,O):new FormData(x),za(u,{pending:!0,data:Ct,method:x.method,action:S},S,Ct))},currentTarget:x}]})}}for(var X1=0;X1<Ra.length;X1++){var G1=Ra[X1],pE=G1.toLowerCase(),mE=G1[0].toUpperCase()+G1.slice(1);ra(pE,"on"+mE)}ra(va,"onAnimationEnd"),ra(Dc,"onAnimationIteration"),ra(sc,"onAnimationStart"),ra("dblclick","onDoubleClick"),ra("focusin","onFocus"),ra("focusout","onBlur"),ra(ou,"onTransitionRun"),ra(If,"onTransitionStart"),ra(Td,"onTransitionCancel"),ra(Hu,"onTransitionEnd"),Ma("onMouseEnter",["mouseout","mouseover"]),Ma("onMouseLeave",["mouseout","mouseover"]),Ma("onPointerEnter",["pointerout","pointerover"]),Ma("onPointerLeave",["pointerout","pointerover"]),Go("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Go("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Go("onBeforeInput",["compositionend","keypress","textInput","paste"]),Go("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Go("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Go("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qh="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(" "),gE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(qh));function uv(o,a){a=(a&4)!==0;for(var u=0;u<o.length;u++){var h=o[u],x=h.event;h=h.listeners;t:{var S=void 0;if(a)for(var O=h.length-1;0<=O;O--){var et=h[O],Ct=et.instance,Kt=et.currentTarget;if(et=et.listener,Ct!==S&&x.isPropagationStopped())break t;S=et,x.currentTarget=Kt;try{S(x)}catch(ae){Lc(ae)}x.currentTarget=null,S=Ct}else for(O=0;O<h.length;O++){if(et=h[O],Ct=et.instance,Kt=et.currentTarget,et=et.listener,Ct!==S&&x.isPropagationStopped())break t;S=et,x.currentTarget=Kt;try{S(x)}catch(ae){Lc(ae)}x.currentTarget=null,S=Ct}}}}function pr(o,a){var u=a[Wo];u===void 0&&(u=a[Wo]=new Set);var h=o+"__bubble";u.has(h)||(fv(a,o,2,!1),u.add(h))}function K1(o,a,u){var h=0;a&&(h|=4),fv(u,o,h,a)}var Tm="_reactListening"+Math.random().toString(36).slice(2);function J1(o){if(!o[Tm]){o[Tm]=!0,Wl.forEach(function(u){u!=="selectionchange"&&(gE.has(u)||K1(u,!1,o),K1(u,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[Tm]||(a[Tm]=!0,K1("selectionchange",!1,a))}}function fv(o,a,u,h){switch(Fv(a)){case 2:var x=$E;break;case 8:x=YE;break;default:x=dy}u=x.bind(null,a,u,o),x=void 0,!Ws||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(x=!0),h?x!==void 0?o.addEventListener(a,u,{capture:!0,passive:x}):o.addEventListener(a,u,!0):x!==void 0?o.addEventListener(a,u,{passive:x}):o.addEventListener(a,u,!1)}function Z1(o,a,u,h,x){var S=h;if((a&1)===0&&(a&2)===0&&h!==null)t:for(;;){if(h===null)return;var O=h.tag;if(O===3||O===4){var et=h.stateNode.containerInfo;if(et===x)break;if(O===4)for(O=h.return;O!==null;){var Ct=O.tag;if((Ct===3||Ct===4)&&O.stateNode.containerInfo===x)return;O=O.return}for(;et!==null;){if(O=qs(et),O===null)return;if(Ct=O.tag,Ct===5||Ct===6||Ct===26||Ct===27){h=S=O;continue t}et=et.parentNode}}h=h.return}Uu(function(){var Kt=S,ae=iu(u),pe=[];t:{var Zt=El.get(o);if(Zt!==void 0){var ee=us,rn=o;switch(o){case"keypress":if(cs(u)===0)break t;case"keydown":case"keyup":ee=zn;break;case"focusin":rn="focus",ee=Sl;break;case"focusout":rn="blur",ee=Sl;break;case"beforeblur":case"afterblur":ee=Sl;break;case"click":if(u.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ee=vl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ee=Qs;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ee=Si;break;case va:case Dc:case sc:ee=ma;break;case Hu:ee=oi;break;case"scroll":case"scrollend":ee=Ta;break;case"wheel":ee=si;break;case"copy":case"cut":case"paste":ee=C;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ee=cr;break;case"toggle":case"beforetoggle":ee=ta}var Dn=(a&4)!==0,fi=!Dn&&(o==="scroll"||o==="scrollend"),Ut=Dn?Zt!==null?Zt+"Capture":null:Zt;Dn=[];for(var Ot=Kt,Gt;Ot!==null;){var ue=Ot;if(Gt=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||Gt===null||Ut===null||(ue=Xl(Ot,Ut),ue!=null&&Dn.push($h(Ot,ue,Gt))),fi)break;Ot=Ot.return}0<Dn.length&&(Zt=new ee(Zt,rn,null,u,ae),pe.push({event:Zt,listeners:Dn}))}}if((a&7)===0){t:{if(Zt=o==="mouseover"||o==="pointerover",ee=o==="mouseout"||o==="pointerout",Zt&&u!==Jt&&(rn=u.relatedTarget||u.fromElement)&&(qs(rn)||rn[oo]))break t;if((ee||Zt)&&(Zt=ae.window===ae?ae:(Zt=ae.ownerDocument)?Zt.defaultView||Zt.parentWindow:window,ee?(rn=u.relatedTarget||u.toElement,ee=Kt,rn=rn?qs(rn):null,rn!==null&&(fi=s(rn),Dn=rn.tag,rn!==fi||Dn!==5&&Dn!==27&&Dn!==6)&&(rn=null)):(ee=null,rn=Kt),ee!==rn)){if(Dn=vl,ue="onMouseLeave",Ut="onMouseEnter",Ot="mouse",(o==="pointerout"||o==="pointerover")&&(Dn=cr,ue="onPointerLeave",Ut="onPointerEnter",Ot="pointer"),fi=ee==null?Zt:Ar(ee),Gt=rn==null?Zt:Ar(rn),Zt=new Dn(ue,Ot+"leave",ee,u,ae),Zt.target=fi,Zt.relatedTarget=Gt,ue=null,qs(ae)===Kt&&(Dn=new Dn(Ut,Ot+"enter",rn,u,ae),Dn.target=Gt,Dn.relatedTarget=fi,ue=Dn),fi=ue,ee&&rn)e:{for(Dn=yE,Ut=ee,Ot=rn,Gt=0,ue=Ut;ue;ue=Dn(ue))Gt++;ue=0;for(var Tn=Ot;Tn;Tn=Dn(Tn))ue++;for(;0<Gt-ue;)Ut=Dn(Ut),Gt--;for(;0<ue-Gt;)Ot=Dn(Ot),ue--;for(;Gt--;){if(Ut===Ot||Ot!==null&&Ut===Ot.alternate){Dn=Ut;break e}Ut=Dn(Ut),Ot=Dn(Ot)}Dn=null}else Dn=null;ee!==null&&dv(pe,Zt,ee,Dn,!1),rn!==null&&fi!==null&&dv(pe,fi,rn,Dn,!0)}}t:{if(Zt=Kt?Ar(Kt):window,ee=Zt.nodeName&&Zt.nodeName.toLowerCase(),ee==="select"||ee==="input"&&Zt.type==="file")var Fr=rc;else if(tc(Zt))if(_a)Fr=Ri;else{Fr=ic;var fn=el}else ee=Zt.nodeName,!ee||ee.toLowerCase()!=="input"||Zt.type!=="checkbox"&&Zt.type!=="radio"?Kt&&Jo(Kt.elementType)&&(Fr=rc):Fr=nl;if(Fr&&(Fr=Fr(o,Kt))){ec(pe,Fr,u,ae);break t}fn&&fn(o,Zt,Kt),o==="focusout"&&Kt&&Zt.type==="number"&&Kt.memoizedProps.value!=null&&Za(Zt,"number",Zt.value)}switch(fn=Kt?Ar(Kt):window,o){case"focusin":(tc(fn)||fn.contentEditable==="true")&&(ts=fn,na=Kt,ps=null);break;case"focusout":ps=na=ts=null;break;case"mousedown":xe=!0;break;case"contextmenu":case"mouseup":case"dragend":xe=!1,Pr(pe,u,ae);break;case"selectionchange":if(Qo)break;case"keydown":case"keyup":Pr(pe,u,ae)}var tr;if(fs)t:{switch(o){case"compositionstart":var wr="onCompositionStart";break t;case"compositionend":wr="onCompositionEnd";break t;case"compositionupdate":wr="onCompositionUpdate";break t}wr=void 0}else xo?ce(o,u)&&(wr="onCompositionEnd"):o==="keydown"&&u.keyCode===229&&(wr="onCompositionStart");wr&&(ya&&u.locale!=="ko"&&(xo||wr!=="onCompositionStart"?wr==="onCompositionEnd"&&xo&&(tr=Kl()):(ks=ae,Gl="value"in ks?ks.value:ks.textContent,xo=!0)),fn=Nm(Kt,wr),0<fn.length&&(wr=new pt(wr,o,null,u,ae),pe.push({event:wr,listeners:fn}),tr?wr.data=tr:(tr=ba(u),tr!==null&&(wr.data=tr)))),(tr=ga?On(o,u):gn(o,u))&&(wr=Nm(Kt,"onBeforeInput"),0<wr.length&&(fn=new pt("onBeforeInput","beforeinput",null,u,ae),pe.push({event:fn,listeners:wr}),fn.data=tr)),hE(pe,o,Kt,u,ae)}uv(pe,a)})}function $h(o,a,u){return{instance:o,listener:a,currentTarget:u}}function Nm(o,a){for(var u=a+"Capture",h=[];o!==null;){var x=o,S=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||S===null||(x=Xl(o,u),x!=null&&h.unshift($h(o,x,S)),x=Xl(o,a),x!=null&&h.push($h(o,x,S))),o.tag===3)return h;o=o.return}return[]}function yE(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function dv(o,a,u,h,x){for(var S=a._reactName,O=[];u!==null&&u!==h;){var et=u,Ct=et.alternate,Kt=et.stateNode;if(et=et.tag,Ct!==null&&Ct===h)break;et!==5&&et!==26&&et!==27||Kt===null||(Ct=Kt,x?(Kt=Xl(u,S),Kt!=null&&O.unshift($h(u,Kt,Ct))):x||(Kt=Xl(u,S),Kt!=null&&O.push($h(u,Kt,Ct)))),u=u.return}O.length!==0&&o.push({event:a,listeners:O})}var bE=/\r\n?/g,xE=/\u0000|\uFFFD/g;function hv(o){return(typeof o=="string"?o:""+o).replace(bE,`
9
+ `).replace(xE,"")}function pv(o,a){return a=hv(a),hv(o)===a}function ui(o,a,u,h,x,S){switch(u){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||so(o,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&so(o,""+h);break;case"className":Ea(o,"class",h);break;case"tabIndex":Ea(o,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":Ea(o,u,h);break;case"style":to(o,h,S);break;case"data":if(a!=="object"){Ea(o,"data",h);break}case"src":case"href":if(h===""&&(a!=="a"||u!=="href")){o.removeAttribute(u);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){o.removeAttribute(u);break}h=ls(""+h),o.setAttribute(u,h);break;case"action":case"formAction":if(typeof h=="function"){o.setAttribute(u,"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 S=="function"&&(u==="formAction"?(a!=="input"&&ui(o,a,"name",x.name,x,null),ui(o,a,"formEncType",x.formEncType,x,null),ui(o,a,"formMethod",x.formMethod,x,null),ui(o,a,"formTarget",x.formTarget,x,null)):(ui(o,a,"encType",x.encType,x,null),ui(o,a,"method",x.method,x,null),ui(o,a,"target",x.target,x,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){o.removeAttribute(u);break}h=ls(""+h),o.setAttribute(u,h);break;case"onClick":h!=null&&(o.onclick=$i);break;case"onScroll":h!=null&&pr("scroll",o);break;case"onScrollEnd":h!=null&&pr("scrollend",o);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(x.children!=null)throw Error(r(60));o.innerHTML=u}}break;case"multiple":o.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":o.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){o.removeAttribute("xlink:href");break}u=ls(""+h),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,""+h):o.removeAttribute(u);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":h&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,""):o.removeAttribute(u);break;case"capture":case"download":h===!0?o.setAttribute(u,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,h):o.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?o.setAttribute(u,h):o.removeAttribute(u);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?o.removeAttribute(u):o.setAttribute(u,h);break;case"popover":pr("beforetoggle",o),pr("toggle",o),$s(o,"popover",h);break;case"xlinkActuate":Ys(o,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":Ys(o,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":Ys(o,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":Ys(o,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":Ys(o,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":Ys(o,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":Ys(o,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":Ys(o,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":Ys(o,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":$s(o,"is",h);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=Cr.get(u)||u,$s(o,u,h))}}function Q1(o,a,u,h,x,S){switch(u){case"style":to(o,h,S);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(x.children!=null)throw Error(r(60));o.innerHTML=u}}break;case"children":typeof h=="string"?so(o,h):(typeof h=="number"||typeof h=="bigint")&&so(o,""+h);break;case"onScroll":h!=null&&pr("scroll",o);break;case"onScrollEnd":h!=null&&pr("scrollend",o);break;case"onClick":h!=null&&(o.onclick=$i);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xo.hasOwnProperty(u))t:{if(u[0]==="o"&&u[1]==="n"&&(x=u.endsWith("Capture"),a=u.slice(2,x?u.length-7:void 0),S=o[Rn]||null,S=S!=null?S[u]:null,typeof S=="function"&&o.removeEventListener(a,S,x),typeof h=="function")){typeof S!="function"&&S!==null&&(u in o?o[u]=null:o.hasAttribute(u)&&o.removeAttribute(u)),o.addEventListener(a,h,x);break t}u in o?o[u]=h:h===!0?o.setAttribute(u,""):$s(o,u,h)}}}function Ps(o,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":pr("error",o),pr("load",o);var h=!1,x=!1,S;for(S in u)if(u.hasOwnProperty(S)){var O=u[S];if(O!=null)switch(S){case"src":h=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:ui(o,a,S,O,u,null)}}x&&ui(o,a,"srcSet",u.srcSet,u,null),h&&ui(o,a,"src",u.src,u,null);return;case"input":pr("invalid",o);var et=S=O=x=null,Ct=null,Kt=null;for(h in u)if(u.hasOwnProperty(h)){var ae=u[h];if(ae!=null)switch(h){case"name":x=ae;break;case"type":O=ae;break;case"checked":Ct=ae;break;case"defaultChecked":Kt=ae;break;case"value":S=ae;break;case"defaultValue":et=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(r(137,a));break;default:ui(o,a,h,ae,u,null)}}Tc(o,S,et,Ct,Kt,O,x,!1);return;case"select":pr("invalid",o),h=O=S=null;for(x in u)if(u.hasOwnProperty(x)&&(et=u[x],et!=null))switch(x){case"value":S=et;break;case"defaultValue":O=et;break;case"multiple":h=et;default:ui(o,a,x,et,u,null)}a=S,u=O,o.multiple=!!h,a!=null?_i(o,!!h,a,!1):u!=null&&_i(o,!!h,u,!0);return;case"textarea":pr("invalid",o),S=x=h=null;for(O in u)if(u.hasOwnProperty(O)&&(et=u[O],et!=null))switch(O){case"value":h=et;break;case"defaultValue":x=et;break;case"children":S=et;break;case"dangerouslySetInnerHTML":if(et!=null)throw Error(r(91));break;default:ui(o,a,O,et,u,null)}wi(o,h,x,S);return;case"option":for(Ct in u)u.hasOwnProperty(Ct)&&(h=u[Ct],h!=null)&&(Ct==="selected"?o.selected=h&&typeof h!="function"&&typeof h!="symbol":ui(o,a,Ct,h,u,null));return;case"dialog":pr("beforetoggle",o),pr("toggle",o),pr("cancel",o),pr("close",o);break;case"iframe":case"object":pr("load",o);break;case"video":case"audio":for(h=0;h<qh.length;h++)pr(qh[h],o);break;case"image":pr("error",o),pr("load",o);break;case"details":pr("toggle",o);break;case"embed":case"source":case"link":pr("error",o),pr("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Kt in u)if(u.hasOwnProperty(Kt)&&(h=u[Kt],h!=null))switch(Kt){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:ui(o,a,Kt,h,u,null)}return;default:if(Jo(a)){for(ae in u)u.hasOwnProperty(ae)&&(h=u[ae],h!==void 0&&Q1(o,a,ae,h,u,void 0));return}}for(et in u)u.hasOwnProperty(et)&&(h=u[et],h!=null&&ui(o,a,et,h,u,null))}function vE(o,a,u,h){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,S=null,O=null,et=null,Ct=null,Kt=null,ae=null;for(ee in u){var pe=u[ee];if(u.hasOwnProperty(ee)&&pe!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":Ct=pe;default:h.hasOwnProperty(ee)||ui(o,a,ee,null,h,pe)}}for(var Zt in h){var ee=h[Zt];if(pe=u[Zt],h.hasOwnProperty(Zt)&&(ee!=null||pe!=null))switch(Zt){case"type":S=ee;break;case"name":x=ee;break;case"checked":Kt=ee;break;case"defaultChecked":ae=ee;break;case"value":O=ee;break;case"defaultValue":et=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(r(137,a));break;default:ee!==pe&&ui(o,a,Zt,ee,h,pe)}}Qi(o,O,et,Ct,Kt,ae,S,x);return;case"select":ee=O=et=Zt=null;for(S in u)if(Ct=u[S],u.hasOwnProperty(S)&&Ct!=null)switch(S){case"value":break;case"multiple":ee=Ct;default:h.hasOwnProperty(S)||ui(o,a,S,null,h,Ct)}for(x in h)if(S=h[x],Ct=u[x],h.hasOwnProperty(x)&&(S!=null||Ct!=null))switch(x){case"value":Zt=S;break;case"defaultValue":et=S;break;case"multiple":O=S;default:S!==Ct&&ui(o,a,x,S,h,Ct)}a=et,u=O,h=ee,Zt!=null?_i(o,!!u,Zt,!1):!!h!=!!u&&(a!=null?_i(o,!!u,a,!0):_i(o,!!u,u?[]:"",!1));return;case"textarea":ee=Zt=null;for(et in u)if(x=u[et],u.hasOwnProperty(et)&&x!=null&&!h.hasOwnProperty(et))switch(et){case"value":break;case"children":break;default:ui(o,a,et,null,h,x)}for(O in h)if(x=h[O],S=u[O],h.hasOwnProperty(O)&&(x!=null||S!=null))switch(O){case"value":Zt=x;break;case"defaultValue":ee=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:x!==S&&ui(o,a,O,x,h,S)}as(o,Zt,ee);return;case"option":for(var rn in u)Zt=u[rn],u.hasOwnProperty(rn)&&Zt!=null&&!h.hasOwnProperty(rn)&&(rn==="selected"?o.selected=!1:ui(o,a,rn,null,h,Zt));for(Ct in h)Zt=h[Ct],ee=u[Ct],h.hasOwnProperty(Ct)&&Zt!==ee&&(Zt!=null||ee!=null)&&(Ct==="selected"?o.selected=Zt&&typeof Zt!="function"&&typeof Zt!="symbol":ui(o,a,Ct,Zt,h,ee));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 Dn in u)Zt=u[Dn],u.hasOwnProperty(Dn)&&Zt!=null&&!h.hasOwnProperty(Dn)&&ui(o,a,Dn,null,h,Zt);for(Kt in h)if(Zt=h[Kt],ee=u[Kt],h.hasOwnProperty(Kt)&&Zt!==ee&&(Zt!=null||ee!=null))switch(Kt){case"children":case"dangerouslySetInnerHTML":if(Zt!=null)throw Error(r(137,a));break;default:ui(o,a,Kt,Zt,h,ee)}return;default:if(Jo(a)){for(var fi in u)Zt=u[fi],u.hasOwnProperty(fi)&&Zt!==void 0&&!h.hasOwnProperty(fi)&&Q1(o,a,fi,void 0,h,Zt);for(ae in h)Zt=h[ae],ee=u[ae],!h.hasOwnProperty(ae)||Zt===ee||Zt===void 0&&ee===void 0||Q1(o,a,ae,Zt,h,ee);return}}for(var Ut in u)Zt=u[Ut],u.hasOwnProperty(Ut)&&Zt!=null&&!h.hasOwnProperty(Ut)&&ui(o,a,Ut,null,h,Zt);for(pe in h)Zt=h[pe],ee=u[pe],!h.hasOwnProperty(pe)||Zt===ee||Zt==null&&ee==null||ui(o,a,pe,Zt,h,ee)}function mv(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function wE(){if(typeof performance.getEntriesByType=="function"){for(var o=0,a=0,u=performance.getEntriesByType("resource"),h=0;h<u.length;h++){var x=u[h],S=x.transferSize,O=x.initiatorType,et=x.duration;if(S&&et&&mv(O)){for(O=0,et=x.responseEnd,h+=1;h<u.length;h++){var Ct=u[h],Kt=Ct.startTime;if(Kt>et)break;var ae=Ct.transferSize,pe=Ct.initiatorType;ae&&mv(pe)&&(Ct=Ct.responseEnd,O+=ae*(Ct<et?1:(et-Kt)/(Ct-Kt)))}if(--h,a+=8*(S+O)/(x.duration/1e3),o++,10<o)break}}if(0<o)return a/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var ty=null,ey=null;function _m(o){return o.nodeType===9?o:o.ownerDocument}function gv(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function yv(o,a){if(o===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&a==="foreignObject"?0:o}function ny(o,a){return o==="textarea"||o==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var ry=null;function SE(){var o=window.event;return o&&o.type==="popstate"?o===ry?!1:(ry=o,!0):(ry=null,!1)}var bv=typeof setTimeout=="function"?setTimeout:void 0,kE=typeof clearTimeout=="function"?clearTimeout:void 0,xv=typeof Promise=="function"?Promise:void 0,AE=typeof queueMicrotask=="function"?queueMicrotask:typeof xv<"u"?function(o){return xv.resolve(null).then(o).catch(ME)}:bv;function ME(o){setTimeout(function(){throw o})}function ef(o){return o==="head"}function vv(o,a){var u=a,h=0;do{var x=u.nextSibling;if(o.removeChild(u),x&&x.nodeType===8)if(u=x.data,u==="/$"||u==="/&"){if(h===0){o.removeChild(x),Ud(a);return}h--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")h++;else if(u==="html")Yh(o.ownerDocument.documentElement);else if(u==="head"){u=o.ownerDocument.head,Yh(u);for(var S=u.firstChild;S;){var O=S.nextSibling,et=S.nodeName;S[Lo]||et==="SCRIPT"||et==="STYLE"||et==="LINK"&&S.rel.toLowerCase()==="stylesheet"||u.removeChild(S),S=O}}else u==="body"&&Yh(o.ownerDocument.body);u=x}while(u);Ud(a)}function wv(o,a){var u=o;o=0;do{var h=u.nextSibling;if(u.nodeType===1?a?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(a?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),h&&h.nodeType===8)if(u=h.data,u==="/$"){if(o===0)break;o--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||o++;u=h}while(u)}function iy(o){var a=o.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var u=a;switch(a=a.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":iy(u),is(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}o.removeChild(u)}}function CE(o,a,u,h){for(;o.nodeType===1;){var x=u;if(o.nodeName.toLowerCase()!==a.toLowerCase()){if(!h&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(h){if(!o[Lo])switch(a){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(S=o.getAttribute("rel"),S==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(S!==x.rel||o.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||o.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||o.getAttribute("title")!==(x.title==null?null:x.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(S=o.getAttribute("src"),(S!==(x.src==null?null:x.src)||o.getAttribute("type")!==(x.type==null?null:x.type)||o.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&S&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(a==="input"&&o.type==="hidden"){var S=x.name==null?null:""+x.name;if(x.type==="hidden"&&o.getAttribute("name")===S)return o}else return o;if(o=Pl(o.nextSibling),o===null)break}return null}function EE(o,a,u){if(a==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!u||(o=Pl(o.nextSibling),o===null))return null;return o}function Sv(o,a){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!a||(o=Pl(o.nextSibling),o===null))return null;return o}function oy(o){return o.data==="$?"||o.data==="$~"}function sy(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function TE(o,a){var u=o.ownerDocument;if(o.data==="$~")o._reactRetry=a;else if(o.data!=="$?"||u.readyState!=="loading")a();else{var h=function(){a(),u.removeEventListener("DOMContentLoaded",h)};u.addEventListener("DOMContentLoaded",h),o._reactRetry=h}}function Pl(o){for(;o!=null;o=o.nextSibling){var a=o.nodeType;if(a===1||a===3)break;if(a===8){if(a=o.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return o}var ay=null;function kv(o){o=o.nextSibling;for(var a=0;o;){if(o.nodeType===8){var u=o.data;if(u==="/$"||u==="/&"){if(a===0)return Pl(o.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}o=o.nextSibling}return null}function Av(o){o=o.previousSibling;for(var a=0;o;){if(o.nodeType===8){var u=o.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(a===0)return o;a--}else u!=="/$"&&u!=="/&"||a++}o=o.previousSibling}return null}function Mv(o,a,u){switch(a=_m(u),o){case"html":if(o=a.documentElement,!o)throw Error(r(452));return o;case"head":if(o=a.head,!o)throw Error(r(453));return o;case"body":if(o=a.body,!o)throw Error(r(454));return o;default:throw Error(r(451))}}function Yh(o){for(var a=o.attributes;a.length;)o.removeAttributeNode(a[0]);is(o)}var jl=new Map,Cv=new Set;function Dm(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var Mu=J.d;J.d={f:NE,r:_E,D:DE,C:LE,L:RE,m:OE,X:jE,S:PE,M:IE};function NE(){var o=Mu.f(),a=Sm();return o||a}function _E(o){var a=pi(o);a!==null&&a.tag===5&&a.type==="form"?gu(a):Mu.r(o)}var zd=typeof document>"u"?null:document;function Ev(o,a,u){var h=zd;if(h&&typeof a=="string"&&a){var x=Ni(a);x='link[rel="'+o+'"][href="'+x+'"]',typeof u=="string"&&(x+='[crossorigin="'+u+'"]'),Cv.has(x)||(Cv.add(x),o={rel:o,crossOrigin:u,href:a},h.querySelector(x)===null&&(a=h.createElement("link"),Ps(a,"link",o),Ti(a),h.head.appendChild(a)))}}function DE(o){Mu.D(o),Ev("dns-prefetch",o,null)}function LE(o,a){Mu.C(o,a),Ev("preconnect",o,a)}function RE(o,a,u){Mu.L(o,a,u);var h=zd;if(h&&o&&a){var x='link[rel="preload"][as="'+Ni(a)+'"]';a==="image"&&u&&u.imageSrcSet?(x+='[imagesrcset="'+Ni(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(x+='[imagesizes="'+Ni(u.imageSizes)+'"]')):x+='[href="'+Ni(o)+'"]';var S=x;switch(a){case"style":S=Bd(o);break;case"script":S=Fd(o)}jl.has(S)||(o=g({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:o,as:a},u),jl.set(S,o),h.querySelector(x)!==null||a==="style"&&h.querySelector(Vh(S))||a==="script"&&h.querySelector(Wh(S))||(a=h.createElement("link"),Ps(a,"link",o),Ti(a),h.head.appendChild(a)))}}function OE(o,a){Mu.m(o,a);var u=zd;if(u&&o){var h=a&&typeof a.as=="string"?a.as:"script",x='link[rel="modulepreload"][as="'+Ni(h)+'"][href="'+Ni(o)+'"]',S=x;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=Fd(o)}if(!jl.has(S)&&(o=g({rel:"modulepreload",href:o},a),jl.set(S,o),u.querySelector(x)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Wh(S)))return}h=u.createElement("link"),Ps(h,"link",o),Ti(h),u.head.appendChild(h)}}}function PE(o,a,u){Mu.S(o,a,u);var h=zd;if(h&&o){var x=Aa(h).hoistableStyles,S=Bd(o);a=a||"default";var O=x.get(S);if(!O){var et={loading:0,preload:null};if(O=h.querySelector(Vh(S)))et.loading=5;else{o=g({rel:"stylesheet",href:o,"data-precedence":a},u),(u=jl.get(S))&&ly(o,u);var Ct=O=h.createElement("link");Ti(Ct),Ps(Ct,"link",o),Ct._p=new Promise(function(Kt,ae){Ct.onload=Kt,Ct.onerror=ae}),Ct.addEventListener("load",function(){et.loading|=1}),Ct.addEventListener("error",function(){et.loading|=2}),et.loading|=4,Lm(O,a,h)}O={type:"stylesheet",instance:O,count:1,state:et},x.set(S,O)}}}function jE(o,a){Mu.X(o,a);var u=zd;if(u&&o){var h=Aa(u).hoistableScripts,x=Fd(o),S=h.get(x);S||(S=u.querySelector(Wh(x)),S||(o=g({src:o,async:!0},a),(a=jl.get(x))&&cy(o,a),S=u.createElement("script"),Ti(S),Ps(S,"link",o),u.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},h.set(x,S))}}function IE(o,a){Mu.M(o,a);var u=zd;if(u&&o){var h=Aa(u).hoistableScripts,x=Fd(o),S=h.get(x);S||(S=u.querySelector(Wh(x)),S||(o=g({src:o,async:!0,type:"module"},a),(a=jl.get(x))&&cy(o,a),S=u.createElement("script"),Ti(S),Ps(S,"link",o),u.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},h.set(x,S))}}function Tv(o,a,u,h){var x=(x=xt.current)?Dm(x):null;if(!x)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(a=Bd(u.href),u=Aa(x).hoistableStyles,h=u.get(a),h||(h={type:"style",instance:null,count:0,state:null},u.set(a,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){o=Bd(u.href);var S=Aa(x).hoistableStyles,O=S.get(o);if(O||(x=x.ownerDocument||x,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},S.set(o,O),(S=x.querySelector(Vh(o)))&&!S._p&&(O.instance=S,O.state.loading=5),jl.has(o)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},jl.set(o,u),S||zE(x,o,u,O.state))),a&&h===null)throw Error(r(528,""));return O}if(a&&h!==null)throw Error(r(529,""));return null;case"script":return a=u.async,u=u.src,typeof u=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Fd(u),u=Aa(x).hoistableScripts,h=u.get(a),h||(h={type:"script",instance:null,count:0,state:null},u.set(a,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function Bd(o){return'href="'+Ni(o)+'"'}function Vh(o){return'link[rel="stylesheet"]['+o+"]"}function Nv(o){return g({},o,{"data-precedence":o.precedence,precedence:null})}function zE(o,a,u,h){o.querySelector('link[rel="preload"][as="style"]['+a+"]")?h.loading=1:(a=o.createElement("link"),h.preload=a,a.addEventListener("load",function(){return h.loading|=1}),a.addEventListener("error",function(){return h.loading|=2}),Ps(a,"link",u),Ti(a),o.head.appendChild(a))}function Fd(o){return'[src="'+Ni(o)+'"]'}function Wh(o){return"script[async]"+o}function _v(o,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var h=o.querySelector('style[data-href~="'+Ni(u.href)+'"]');if(h)return a.instance=h,Ti(h),h;var x=g({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return h=(o.ownerDocument||o).createElement("style"),Ti(h),Ps(h,"style",x),Lm(h,u.precedence,o),a.instance=h;case"stylesheet":x=Bd(u.href);var S=o.querySelector(Vh(x));if(S)return a.state.loading|=4,a.instance=S,Ti(S),S;h=Nv(u),(x=jl.get(x))&&ly(h,x),S=(o.ownerDocument||o).createElement("link"),Ti(S);var O=S;return O._p=new Promise(function(et,Ct){O.onload=et,O.onerror=Ct}),Ps(S,"link",h),a.state.loading|=4,Lm(S,u.precedence,o),a.instance=S;case"script":return S=Fd(u.src),(x=o.querySelector(Wh(S)))?(a.instance=x,Ti(x),x):(h=u,(x=jl.get(S))&&(h=g({},u),cy(h,x)),o=o.ownerDocument||o,x=o.createElement("script"),Ti(x),Ps(x,"link",h),o.head.appendChild(x),a.instance=x);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(h=a.instance,a.state.loading|=4,Lm(h,u.precedence,o));return a.instance}function Lm(o,a,u){for(var h=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=h.length?h[h.length-1]:null,S=x,O=0;O<h.length;O++){var et=h[O];if(et.dataset.precedence===a)S=et;else if(S!==x)break}S?S.parentNode.insertBefore(o,S.nextSibling):(a=u.nodeType===9?u.head:u,a.insertBefore(o,a.firstChild))}function ly(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.title==null&&(o.title=a.title)}function cy(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.integrity==null&&(o.integrity=a.integrity)}var Rm=null;function Dv(o,a,u){if(Rm===null){var h=new Map,x=Rm=new Map;x.set(u,h)}else x=Rm,h=x.get(u),h||(h=new Map,x.set(u,h));if(h.has(o))return h;for(h.set(o,null),u=u.getElementsByTagName(o),x=0;x<u.length;x++){var S=u[x];if(!(S[Lo]||S[er]||o==="link"&&S.getAttribute("rel")==="stylesheet")&&S.namespaceURI!=="http://www.w3.org/2000/svg"){var O=S.getAttribute(a)||"";O=o+O;var et=h.get(O);et?et.push(S):h.set(O,[S])}}return h}function Lv(o,a,u){o=o.ownerDocument||o,o.head.insertBefore(u,a==="title"?o.querySelector("head > title"):null)}function BE(o,a,u){if(u===1||a.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(o=a.disabled,typeof a.precedence=="string"&&o==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Rv(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function FE(o,a,u,h){if(u.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var x=Bd(h.href),S=a.querySelector(Vh(x));if(S){a=S._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(o.count++,o=Om.bind(o),a.then(o,o)),u.state.loading|=4,u.instance=S,Ti(S);return}S=a.ownerDocument||a,h=Nv(h),(x=jl.get(x))&&ly(h,x),S=S.createElement("link"),Ti(S);var O=S;O._p=new Promise(function(et,Ct){O.onload=et,O.onerror=Ct}),Ps(S,"link",h),u.instance=S}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(u,a),(a=u.state.preload)&&(u.state.loading&3)===0&&(o.count++,u=Om.bind(o),a.addEventListener("load",u),a.addEventListener("error",u))}}var uy=0;function UE(o,a){return o.stylesheets&&o.count===0&&jm(o,o.stylesheets),0<o.count||0<o.imgCount?function(u){var h=setTimeout(function(){if(o.stylesheets&&jm(o,o.stylesheets),o.unsuspend){var S=o.unsuspend;o.unsuspend=null,S()}},6e4+a);0<o.imgBytes&&uy===0&&(uy=62500*wE());var x=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&jm(o,o.stylesheets),o.unsuspend)){var S=o.unsuspend;o.unsuspend=null,S()}},(o.imgBytes>uy?50:800)+a);return o.unsuspend=u,function(){o.unsuspend=null,clearTimeout(h),clearTimeout(x)}}:null}function Om(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)jm(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Pm=null;function jm(o,a){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Pm=new Map,a.forEach(HE,o),Pm=null,Om.call(o))}function HE(o,a){if(!(a.state.loading&4)){var u=Pm.get(o);if(u)var h=u.get(null);else{u=new Map,Pm.set(o,u);for(var x=o.querySelectorAll("link[data-precedence],style[data-precedence]"),S=0;S<x.length;S++){var O=x[S];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(u.set(O.dataset.precedence,O),h=O)}h&&u.set(null,h)}x=a.instance,O=x.getAttribute("data-precedence"),S=u.get(O)||h,S===h&&u.set(null,x),u.set(O,x),this.count++,h=Om.bind(this),x.addEventListener("load",h),x.addEventListener("error",h),S?S.parentNode.insertBefore(x,S.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(x,o.firstChild)),a.state.loading|=4}}var Xh={$$typeof:$,Provider:null,Consumer:null,_currentValue:ct,_currentValue2:ct,_threadCount:0};function qE(o,a,u,h,x,S,O,et,Ct){this.tag=1,this.containerInfo=o,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=Re(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Re(0),this.hiddenUpdates=Re(null),this.identifierPrefix=h,this.onUncaughtError=x,this.onCaughtError=S,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Ct,this.incompleteTransitions=new Map}function Ov(o,a,u,h,x,S,O,et,Ct,Kt,ae,pe){return o=new qE(o,a,u,O,Ct,Kt,ae,pe,et),a=1,S===!0&&(a|=24),S=Io(3,null,null,a),o.current=S,S.stateNode=o,a=Ia(),a.refCount++,o.pooledCache=a,a.refCount++,S.memoizedState={element:h,isDehydrated:u,cache:a},Le(S),o}function Pv(o){return o?(o=So,o):So}function jv(o,a,u,h,x,S){x=Pv(x),h.context===null?h.context=x:h.pendingContext=x,h=Mn(a),h.payload={element:u},S=S===void 0?null:S,S!==null&&(h.callback=S),u=$n(o,h,a),u!==null&&(qa(u,o,a),ir(u,o,a))}function Iv(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var u=o.retryLane;o.retryLane=u!==0&&u<a?u:a}}function fy(o,a){Iv(o,a),(o=o.alternate)&&Iv(o,a)}function zv(o){if(o.tag===13||o.tag===31){var a=Oa(o,67108864);a!==null&&qa(a,o,67108864),fy(o,67108864)}}function Bv(o){if(o.tag===13||o.tag===31){var a=ul();a=Wr(a);var u=Oa(o,a);u!==null&&qa(u,o,a),fy(o,a)}}var Im=!0;function $E(o,a,u,h){var x=yt.T;yt.T=null;var S=J.p;try{J.p=2,dy(o,a,u,h)}finally{J.p=S,yt.T=x}}function YE(o,a,u,h){var x=yt.T;yt.T=null;var S=J.p;try{J.p=8,dy(o,a,u,h)}finally{J.p=S,yt.T=x}}function dy(o,a,u,h){if(Im){var x=hy(h);if(x===null)Z1(o,a,h,zm,u),Uv(o,h);else if(WE(x,o,a,u,h))h.stopPropagation();else if(Uv(o,h),a&4&&-1<VE.indexOf(o)){for(;x!==null;){var S=pi(x);if(S!==null)switch(S.tag){case 3:if(S=S.stateNode,S.current.memoizedState.isDehydrated){var O=en(S.pendingLanes);if(O!==0){var et=S;for(et.pendingLanes|=2,et.entangledLanes|=2;O;){var Ct=1<<31-Ln(O);et.entanglements[1]|=Ct,O&=~Ct}Wc(S),(Vr&6)===0&&(vm=un()+500,Hh(0))}}break;case 31:case 13:et=Oa(S,2),et!==null&&qa(et,S,2),Sm(),fy(S,2)}if(S=hy(h),S===null&&Z1(o,a,h,zm,u),S===x)break;x=S}x!==null&&h.stopPropagation()}else Z1(o,a,h,null,u)}}function hy(o){return o=iu(o),py(o)}var zm=null;function py(o){if(zm=null,o=qs(o),o!==null){var a=s(o);if(a===null)o=null;else{var u=a.tag;if(u===13){if(o=l(a),o!==null)return o;o=null}else if(u===31){if(o=c(a),o!==null)return o;o=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;o=null}else a!==o&&(o=null)}}return zm=o,null}function Fv(o){switch(o){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(Fn()){case Ue:return 2;case _n:return 8;case dn:case Be:return 32;case We:return 268435456;default:return 32}default:return 32}}var my=!1,nf=null,rf=null,of=null,Gh=new Map,Kh=new Map,sf=[],VE="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 Uv(o,a){switch(o){case"focusin":case"focusout":nf=null;break;case"dragenter":case"dragleave":rf=null;break;case"mouseover":case"mouseout":of=null;break;case"pointerover":case"pointerout":Gh.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Kh.delete(a.pointerId)}}function Jh(o,a,u,h,x,S){return o===null||o.nativeEvent!==S?(o={blockedOn:a,domEventName:u,eventSystemFlags:h,nativeEvent:S,targetContainers:[x]},a!==null&&(a=pi(a),a!==null&&zv(a)),o):(o.eventSystemFlags|=h,a=o.targetContainers,x!==null&&a.indexOf(x)===-1&&a.push(x),o)}function WE(o,a,u,h,x){switch(a){case"focusin":return nf=Jh(nf,o,a,u,h,x),!0;case"dragenter":return rf=Jh(rf,o,a,u,h,x),!0;case"mouseover":return of=Jh(of,o,a,u,h,x),!0;case"pointerover":var S=x.pointerId;return Gh.set(S,Jh(Gh.get(S)||null,o,a,u,h,x)),!0;case"gotpointercapture":return S=x.pointerId,Kh.set(S,Jh(Kh.get(S)||null,o,a,u,h,x)),!0}return!1}function Hv(o){var a=qs(o.target);if(a!==null){var u=s(a);if(u!==null){if(a=u.tag,a===13){if(a=l(u),a!==null){o.blockedOn=a,Wt(o.priority,function(){Bv(u)});return}}else if(a===31){if(a=c(u),a!==null){o.blockedOn=a,Wt(o.priority,function(){Bv(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){o.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}o.blockedOn=null}function Bm(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var u=hy(o.nativeEvent);if(u===null){u=o.nativeEvent;var h=new u.constructor(u.type,u);Jt=h,u.target.dispatchEvent(h),Jt=null}else return a=pi(u),a!==null&&zv(a),o.blockedOn=u,!1;a.shift()}return!0}function qv(o,a,u){Bm(o)&&u.delete(a)}function XE(){my=!1,nf!==null&&Bm(nf)&&(nf=null),rf!==null&&Bm(rf)&&(rf=null),of!==null&&Bm(of)&&(of=null),Gh.forEach(qv),Kh.forEach(qv)}function Fm(o,a){o.blockedOn===a&&(o.blockedOn=null,my||(my=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,XE)))}var Um=null;function $v(o){Um!==o&&(Um=o,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Um===o&&(Um=null);for(var a=0;a<o.length;a+=3){var u=o[a],h=o[a+1],x=o[a+2];if(typeof h!="function"){if(py(h||u)===null)continue;break}var S=pi(u);S!==null&&(o.splice(a,3),a-=3,za(S,{pending:!0,data:x,method:u.method,action:h},h,x))}}))}function Ud(o){function a(Ct){return Fm(Ct,o)}nf!==null&&Fm(nf,o),rf!==null&&Fm(rf,o),of!==null&&Fm(of,o),Gh.forEach(a),Kh.forEach(a);for(var u=0;u<sf.length;u++){var h=sf[u];h.blockedOn===o&&(h.blockedOn=null)}for(;0<sf.length&&(u=sf[0],u.blockedOn===null);)Hv(u),u.blockedOn===null&&sf.shift();if(u=(o.ownerDocument||o).$$reactFormReplay,u!=null)for(h=0;h<u.length;h+=3){var x=u[h],S=u[h+1],O=x[Rn]||null;if(typeof S=="function")O||$v(u);else if(O){var et=null;if(S&&S.hasAttribute("formAction")){if(x=S,O=S[Rn]||null)et=O.formAction;else if(py(x)!==null)continue}else et=O.action;typeof et=="function"?u[h+1]=et:(u.splice(h,3),h-=3),$v(u)}}}function Yv(){function o(S){S.canIntercept&&S.info==="react-transition"&&S.intercept({handler:function(){return new Promise(function(O){return x=O})},focusReset:"manual",scroll:"manual"})}function a(){x!==null&&(x(),x=null),h||setTimeout(u,20)}function u(){if(!h&&!navigation.transition){var S=navigation.currentEntry;S&&S.url!=null&&navigation.navigate(S.url,{state:S.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,x=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(u,100),function(){h=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),x!==null&&(x(),x=null)}}}function gy(o){this._internalRoot=o}Hm.prototype.render=gy.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(r(409));var u=a.current,h=ul();jv(u,h,o,a,null,null)},Hm.prototype.unmount=gy.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;jv(o.current,2,null,o,null,null),Sm(),a[oo]=null}};function Hm(o){this._internalRoot=o}Hm.prototype.unstable_scheduleHydration=function(o){if(o){var a=vi();o={blockedOn:null,target:o,priority:a};for(var u=0;u<sf.length&&a!==0&&a<sf[u].priority;u++);sf.splice(u,0,o),u===0&&Hv(o)}};var Vv=t.version;if(Vv!=="19.2.4")throw Error(r(527,Vv,"19.2.4"));J.findDOMNode=function(o){var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=d(a),o=o!==null?p(o):null,o=o===null?null:o.stateNode,o};var GE={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:yt,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var qm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qm.isDisabled&&qm.supportsFiber)try{Cn=qm.inject(GE),nn=qm}catch{}}return Qh.createRoot=function(o,a){if(!i(o))throw Error(r(299));var u=!1,h="",x=Qb,S=tx,O=ex;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(x=a.onUncaughtError),a.onCaughtError!==void 0&&(S=a.onCaughtError),a.onRecoverableError!==void 0&&(O=a.onRecoverableError)),a=Ov(o,1,!1,null,null,u,h,null,x,S,O,Yv),o[oo]=a.current,J1(o),new gy(a)},Qh.hydrateRoot=function(o,a,u){if(!i(o))throw Error(r(299));var h=!1,x="",S=Qb,O=tx,et=ex,Ct=null;return u!=null&&(u.unstable_strictMode===!0&&(h=!0),u.identifierPrefix!==void 0&&(x=u.identifierPrefix),u.onUncaughtError!==void 0&&(S=u.onUncaughtError),u.onCaughtError!==void 0&&(O=u.onCaughtError),u.onRecoverableError!==void 0&&(et=u.onRecoverableError),u.formState!==void 0&&(Ct=u.formState)),a=Ov(o,1,!0,a,u??null,h,x,Ct,S,O,et,Yv),a.context=Pv(null),u=a.current,h=ul(),h=Wr(h),x=Mn(h),x.callback=null,$n(u,x,h),u=h,a.current.lanes=u,Ae(a,u),Wc(a),o[oo]=a.current,J1(o),new Hm(a)},Qh.version="19.2.4",Qh}var nw;function iT(){if(nw)return xy.exports;nw=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),xy.exports=rT(),xy.exports}var oT=iT();const js=[];for(let e=0;e<256;++e)js.push((e+256).toString(16).slice(1));function sT(e,t=0){return(js[e[t+0]]+js[e[t+1]]+js[e[t+2]]+js[e[t+3]]+"-"+js[e[t+4]]+js[e[t+5]]+"-"+js[e[t+6]]+js[e[t+7]]+"-"+js[e[t+8]]+js[e[t+9]]+"-"+js[e[t+10]]+js[e[t+11]]+js[e[t+12]]+js[e[t+13]]+js[e[t+14]]+js[e[t+15]]).toLowerCase()}let ky;const aT=new Uint8Array(16);function lT(){if(!ky){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ky=crypto.getRandomValues.bind(crypto)}return ky(aT)}const cT=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),rw={randomUUID:cT};function uT(e,t,n){e=e||{};const r=e.random??e.rng?.()??lT();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,sT(r)}function fa(e,t,n){return rw.randomUUID&&!e?rw.randomUUID():uT(e)}const fT="modulepreload",dT=function(e,t){return new URL(e,t).href},iw={},Ay=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let d=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};const l=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),f=c?.nonce||c?.getAttribute("nonce");i=d(n.map(p=>{if(p=dT(p,r),p in iw)return;iw[p]=!0;const g=p.endsWith(".css"),b=g?'[rel="stylesheet"]':"";if(r)for(let M=l.length-1;M>=0;M--){const E=l[M];if(E.href===p&&(!g||E.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${p}"]${b}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":fT,g||(y.as="script"),y.crossOrigin="",y.href=p,f&&y.setAttribute("nonce",f),document.head.appendChild(y),g)return new Promise((M,E)=>{y.addEventListener("load",M),y.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${p}`)))})}))}function s(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return i.then(l=>{for(const c of l||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};function ii(e){"@babel/helpers - typeof";return ii=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ii(e)}var Sc=Uint8Array,pl=Uint16Array,W5=Int32Array,X5=new Sc([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),G5=new Sc([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ow=new Sc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l4=function(e,t){for(var n=new pl(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new W5(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return{b:n,r:i}},c4=l4(X5,2),hT=c4.b,z2=c4.r;hT[28]=258,z2[258]=28;var pT=l4(G5,0),sw=pT.r,B2=new pl(32768);for(var Hi=0;Hi<32768;++Hi){var lf=(Hi&43690)>>1|(Hi&21845)<<1;lf=(lf&52428)>>2|(lf&13107)<<2,lf=(lf&61680)>>4|(lf&3855)<<4,B2[Hi]=((lf&65280)>>8|(lf&255)<<8)>>1}var Sp=(function(e,t,n){for(var r=e.length,i=0,s=new pl(t);i<r;++i)e[i]&&++s[e[i]-1];var l=new pl(t);for(i=1;i<t;++i)l[i]=l[i-1]+s[i-1]<<1;var c;if(n){c=new pl(1<<t);var f=15-t;for(i=0;i<r;++i)if(e[i])for(var d=i<<4|e[i],p=t-e[i],g=l[e[i]-1]++<<p,b=g|(1<<p)-1;g<=b;++g)c[B2[g]>>f]=d}else for(c=new pl(r),i=0;i<r;++i)e[i]&&(c[i]=B2[l[e[i]-1]++]>>15-e[i]);return c}),md=new Sc(288);for(var Hi=0;Hi<144;++Hi)md[Hi]=8;for(var Hi=144;Hi<256;++Hi)md[Hi]=9;for(var Hi=256;Hi<280;++Hi)md[Hi]=7;for(var Hi=280;Hi<288;++Hi)md[Hi]=8;var Fg=new Sc(32);for(var Hi=0;Hi<32;++Hi)Fg[Hi]=5;var mT=Sp(md,9,0),gT=Sp(Fg,5,0),u4=function(e){return(e+7)/8|0},yT=function(e,t,n){return(n==null||n>e.length)&&(n=e.length),new Sc(e.subarray(t,n))},Cu=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},tp=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},My=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,s=n.slice();if(!i)return{t:d4,l:0};if(i==1){var l=new Sc(n[0].s+1);return l[n[0].s]=1,{t:l,l:1}}n.sort(function(ht,Mt){return ht.f-Mt.f}),n.push({s:-1,f:25001});var c=n[0],f=n[1],d=0,p=1,g=2;for(n[0]={s:-1,f:c.f+f.f,l:c,r:f};p!=i-1;)c=n[n[d].f<n[g].f?d++:g++],f=n[d!=p&&n[d].f<n[g].f?d++:g++],n[p++]={s:-1,f:c.f+f.f,l:c,r:f};for(var b=s[0].s,r=1;r<i;++r)s[r].s>b&&(b=s[r].s);var y=new pl(b+1),M=F2(n[p-1],y,0);if(M>t){var r=0,E=0,D=M-t,L=1<<D;for(s.sort(function(Mt,vt){return y[vt.s]-y[Mt.s]||Mt.f-vt.f});r<i;++r){var q=s[r].s;if(y[q]>t)E+=L-(1<<M-y[q]),y[q]=t;else break}for(E>>=D;E>0;){var $=s[r].s;y[$]<t?E-=1<<t-y[$]++-1:++r}for(;r>=0&&E;--r){var Y=s[r].s;y[Y]==t&&(--y[Y],++E)}M=t}return{t:new Sc(y),l:M}},F2=function(e,t,n){return e.s==-1?Math.max(F2(e.l,t,n+1),F2(e.r,t,n+1)):t[e.s]=n},aw=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new pl(++t),r=0,i=e[0],s=1,l=function(f){n[r++]=f},c=1;c<=t;++c)if(e[c]==i&&c!=t)++s;else{if(!i&&s>2){for(;s>138;s-=138)l(32754);s>2&&(l(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(l(i),--s;s>6;s-=6)l(8304);s>2&&(l(s-3<<5|8208),s=0)}for(;s--;)l(i);s=1,i=e[c]}return{c:n.subarray(0,r),n:t}},ep=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},f4=function(e,t,n){var r=n.length,i=u4(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var s=0;s<r;++s)e[i+s+4]=n[s];return(i+4+r)*8},lw=function(e,t,n,r,i,s,l,c,f,d,p){Cu(t,p++,n),++i[256];for(var g=My(i,15),b=g.t,y=g.l,M=My(s,15),E=M.t,D=M.l,L=aw(b),q=L.c,$=L.n,Y=aw(E),ht=Y.c,Mt=Y.n,vt=new pl(19),bt=0;bt<q.length;++bt)++vt[q[bt]&31];for(var bt=0;bt<ht.length;++bt)++vt[ht[bt]&31];for(var rt=My(vt,7),Dt=rt.t,Q=rt.l,lt=19;lt>4&&!Dt[ow[lt-1]];--lt);var X=d+5<<3,wt=ep(i,md)+ep(s,Fg)+l,Tt=ep(i,b)+ep(s,E)+l+14+3*lt+ep(vt,Dt)+2*vt[16]+3*vt[17]+7*vt[18];if(f>=0&&X<=wt&&X<=Tt)return f4(t,p,e.subarray(f,f+d));var yt,J,ct,Bt;if(Cu(t,p,1+(Tt<wt)),p+=2,Tt<wt){yt=Sp(b,y,0),J=b,ct=Sp(E,D,0),Bt=E;var te=Sp(Dt,Q,0);Cu(t,p,$-257),Cu(t,p+5,Mt-1),Cu(t,p+10,lt-4),p+=14;for(var bt=0;bt<lt;++bt)Cu(t,p+3*bt,Dt[ow[bt]]);p+=3*lt;for(var Z=[q,ht],P=0;P<2;++P)for(var j=Z[P],bt=0;bt<j.length;++bt){var G=j[bt]&31;Cu(t,p,te[G]),p+=Dt[G],G>15&&(Cu(t,p,j[bt]>>5&127),p+=j[bt]>>12)}}else yt=mT,J=md,ct=gT,Bt=Fg;for(var bt=0;bt<c;++bt){var ut=r[bt];if(ut>255){var G=ut>>18&31;tp(t,p,yt[G+257]),p+=J[G+257],G>7&&(Cu(t,p,ut>>23&31),p+=X5[G]);var xt=ut&31;tp(t,p,ct[xt]),p+=Bt[xt],xt>3&&(tp(t,p,ut>>5&8191),p+=G5[xt])}else tp(t,p,yt[ut]),p+=J[ut]}return tp(t,p,yt[256]),p+J[256]},bT=new W5([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),d4=new Sc(0),xT=function(e,t,n,r,i,s){var l=s.z||e.length,c=new Sc(r+l+5*(1+Math.ceil(l/7e3))+i),f=c.subarray(r,c.length-i),d=s.l,p=(s.r||0)&7;if(t){p&&(f[0]=s.r>>3);for(var g=bT[t-1],b=g>>13,y=g&8191,M=(1<<n)-1,E=s.p||new pl(32768),D=s.h||new pl(M+1),L=Math.ceil(n/3),q=2*L,$=function(Ve){return(e[Ve]^e[Ve+1]<<L^e[Ve+2]<<q)&M},Y=new W5(25e3),ht=new pl(288),Mt=new pl(32),vt=0,bt=0,rt=s.i||0,Dt=0,Q=s.w||0,lt=0;rt+2<l;++rt){var X=$(rt),wt=rt&32767,Tt=D[X];if(E[wt]=Tt,D[X]=wt,Q<=rt){var yt=l-rt;if((vt>7e3||Dt>24576)&&(yt>423||!d)){p=lw(e,f,0,Y,ht,Mt,bt,Dt,lt,rt-lt,p),Dt=vt=bt=0,lt=rt;for(var J=0;J<286;++J)ht[J]=0;for(var J=0;J<30;++J)Mt[J]=0}var ct=2,Bt=0,te=y,Z=wt-Tt&32767;if(yt>2&&X==$(rt-Z))for(var P=Math.min(b,yt)-1,j=Math.min(32767,rt),G=Math.min(258,yt);Z<=j&&--te&&wt!=Tt;){if(e[rt+ct]==e[rt+ct-Z]){for(var ut=0;ut<G&&e[rt+ut]==e[rt+ut-Z];++ut);if(ut>ct){if(ct=ut,Bt=Z,ut>P)break;for(var xt=Math.min(Z,ut-2),St=0,J=0;J<xt;++J){var Ft=rt-Z+J&32767,Rt=E[Ft],Qt=Ft-Rt&32767;Qt>St&&(St=Qt,Tt=Ft)}}}wt=Tt,Tt=E[wt],Z+=wt-Tt&32767}if(Bt){Y[Dt++]=268435456|z2[ct]<<18|sw[Bt];var ve=z2[ct]&31,je=sw[Bt]&31;bt+=X5[ve]+G5[je],++ht[257+ve],++Mt[je],Q=rt+ct,++vt}else Y[Dt++]=e[rt],++ht[e[rt]]}}for(rt=Math.max(rt,Q);rt<l;++rt)Y[Dt++]=e[rt],++ht[e[rt]];p=lw(e,f,d,Y,ht,Mt,bt,Dt,lt,rt-lt,p),d||(s.r=p&7|f[p/8|0]<<3,p-=7,s.h=D,s.p=E,s.i=rt,s.w=Q)}else{for(var rt=s.w||0;rt<l+d;rt+=65535){var Pe=rt+65535;Pe>=l&&(f[p/8|0]=d,Pe=l),p=f4(f,p+1,e.subarray(rt,Pe))}s.i=l}return yT(c,0,r+u4(p)+i)},h4=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,s=n.length|0,l=0;l!=s;){for(var c=Math.min(l+2655,s);l<c;++l)i+=r+=n[l];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},vT=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),l=new Sc(s.length+e.length);l.set(s),l.set(e,s.length),e=l,i.w=s.length}return xT(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},p4=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},wT=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=h4();i.p(t.dictionary),p4(e,2,i.d())}};function U2(e,t){t||(t={});var n=h4();n.p(e);var r=vT(e,t,t.dictionary?6:2,4);return wT(r,t),p4(r,r.length-4,n.d()),r}var ST=typeof TextDecoder<"u"&&new TextDecoder,kT=0;try{ST.decode(d4,{stream:!0}),kT=1}catch{}function AT(e){if(Array.isArray(e))return e}function MT(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,s,l,c=[],f=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(f=(r=s.call(n)).done)&&(c.push(r.value),c.length!==t);f=!0);}catch(p){d=!0,i=p}finally{try{if(!f&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw i}}return c}}function cw(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function CT(e,t){if(e){if(typeof e=="string")return cw(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cw(e,t):void 0}}function ET(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
10
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uw(e,t){return AT(e)||MT(e,t)||CT(e,t)||ET()}function fw(e,t="utf8"){return new TextDecoder(t).decode(e)}const TT=new TextEncoder;function NT(e){return TT.encode(e)}const _T=1024*8,DT=(()=>{const e=new Uint8Array(4),t=new Uint32Array(e.buffer);return!((t[0]=1)&e[0])})(),Cy={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class K5{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(t=_T,n={}){let r=!1;typeof t=="number"?t=new ArrayBuffer(t):(r=!0,this.lastWrittenByte=t.byteLength);const i=n.offset?n.offset>>>0:0,s=t.byteLength-i;let l=i;(ArrayBuffer.isView(t)||t instanceof K5)&&(t.byteLength!==t.buffer.byteLength&&(l=t.byteOffset+i),t=t.buffer),r?this.lastWrittenByte=s:this.lastWrittenByte=0,this.buffer=t,this.length=s,this.byteLength=s,this.byteOffset=l,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,l,s),this._mark=0,this._marks=[]}available(t=1){return this.offset+t<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(t=1){return this.offset+=t,this}back(t=1){return this.offset-=t,this}seek(t){return this.offset=t,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const t=this._marks.pop();if(t===void 0)throw new Error("Mark stack empty");return this.seek(t),this}rewind(){return this.offset=0,this}ensureAvailable(t=1){if(!this.available(t)){const r=(this.offset+t)*2,i=new Uint8Array(r);i.set(new Uint8Array(this.buffer)),this.buffer=i.buffer,this.length=r,this.byteLength=r,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(t=1){return this.readArray(t,"uint8")}readArray(t,n){const r=Cy[n].BYTES_PER_ELEMENT*t,i=this.byteOffset+this.offset,s=this.buffer.slice(i,i+r);if(this.littleEndian===DT&&n!=="uint8"&&n!=="int8"){const c=new Uint8Array(this.buffer.slice(i,i+r));c.reverse();const f=new Cy[n](c.buffer);return this.offset+=r,f.reverse(),f}const l=new Cy[n](s);return this.offset+=r,l}readInt16(){const t=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}readUint16(){const t=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,t}readInt32(){const t=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}readUint32(){const t=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat32(){const t=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat64(){const t=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}readBigInt64(){const t=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,t}readBigUint64(){const t=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,t}readChar(){return String.fromCharCode(this.readInt8())}readChars(t=1){let n="";for(let r=0;r<t;r++)n+=this.readChar();return n}readUtf8(t=1){return fw(this.readBytes(t))}decodeText(t=1,n="utf8"){return fw(this.readBytes(t),n)}writeBoolean(t){return this.writeUint8(t?255:0),this}writeInt8(t){return this.ensureAvailable(1),this._data.setInt8(this.offset++,t),this._updateLastWrittenByte(),this}writeUint8(t){return this.ensureAvailable(1),this._data.setUint8(this.offset++,t),this._updateLastWrittenByte(),this}writeByte(t){return this.writeUint8(t)}writeBytes(t){this.ensureAvailable(t.length);for(let n=0;n<t.length;n++)this._data.setUint8(this.offset++,t[n]);return this._updateLastWrittenByte(),this}writeInt16(t){return this.ensureAvailable(2),this._data.setInt16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(t){return this.ensureAvailable(2),this._data.setUint16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(t){return this.ensureAvailable(4),this._data.setInt32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(t){return this.ensureAvailable(4),this._data.setUint32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(t){return this.ensureAvailable(4),this._data.setFloat32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(t){return this.ensureAvailable(8),this._data.setFloat64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(t){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(t){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(t){return this.writeUint8(t.charCodeAt(0))}writeChars(t){for(let n=0;n<t.length;n++)this.writeUint8(t.charCodeAt(n));return this}writeUtf8(t){return this.writeBytes(NT(t))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}function Ah(e){let t=e.length;for(;--t>=0;)e[t]=0}const LT=3,RT=258,m4=29,OT=256,PT=OT+1+m4,g4=30,jT=512,IT=new Array((PT+2)*2);Ah(IT);const zT=new Array(g4*2);Ah(zT);const BT=new Array(jT);Ah(BT);const FT=new Array(RT-LT+1);Ah(FT);const UT=new Array(m4);Ah(UT);const HT=new Array(g4);Ah(HT);const qT=(e,t,n,r)=>{let i=e&65535|0,s=e>>>16&65535|0,l=0;for(;n!==0;){l=n>2e3?2e3:n,n-=l;do i=i+t[r++]|0,s=s+i|0;while(--l);i%=65521,s%=65521}return i|s<<16|0};var H2=qT;const $T=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},YT=new Uint32Array($T()),VT=(e,t,n,r)=>{const i=YT,s=r+n;e^=-1;for(let l=r;l<s;l++)e=e>>>8^i[(e^t[l])&255];return e^-1};var Xc=VT,q2={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},y4={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const WT=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var XT=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)WT(n,r)&&(e[r]=n[r])}}return e},GT=e=>{let t=0;for(let r=0,i=e.length;r<i;r++)t+=e[r].length;const n=new Uint8Array(t);for(let r=0,i=0,s=e.length;r<s;r++){let l=e[r];n.set(l,i),i+=l.length}return n},b4={assign:XT,flattenChunks:GT};let x4=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{x4=!1}const zp=new Uint8Array(256);for(let e=0;e<256;e++)zp[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;zp[254]=zp[254]=1;var KT=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,s,l=e.length,c=0;for(i=0;i<l;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<l&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),c+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(c),s=0,i=0;s<c;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<l&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[s++]=n:n<2048?(t[s++]=192|n>>>6,t[s++]=128|n&63):n<65536?(t[s++]=224|n>>>12,t[s++]=128|n>>>6&63,t[s++]=128|n&63):(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63,t[s++]=128|n>>>6&63,t[s++]=128|n&63);return t};const JT=(e,t)=>{if(t<65534&&e.subarray&&x4)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n};var ZT=(e,t)=>{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const s=new Array(n*2);for(i=0,r=0;r<n;){let l=e[r++];if(l<128){s[i++]=l;continue}let c=zp[l];if(c>4){s[i++]=65533,r+=c-1;continue}for(l&=c===2?31:c===3?15:7;c>1&&r<n;)l=l<<6|e[r++]&63,c--;if(c>1){s[i++]=65533;continue}l<65536?s[i++]=l:(l-=65536,s[i++]=55296|l>>10&1023,s[i++]=56320|l&1023)}return JT(s,i)},QT=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+zp[e[n]]>t?n:t},$2={string2buf:KT,buf2string:ZT,utf8border:QT};function tN(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var eN=tN;const $m=16209,nN=16191;var rN=function(t,n){let r,i,s,l,c,f,d,p,g,b,y,M,E,D,L,q,$,Y,ht,Mt,vt,bt,rt,Dt;const Q=t.state;r=t.next_in,rt=t.input,i=r+(t.avail_in-5),s=t.next_out,Dt=t.output,l=s-(n-t.avail_out),c=s+(t.avail_out-257),f=Q.dmax,d=Q.wsize,p=Q.whave,g=Q.wnext,b=Q.window,y=Q.hold,M=Q.bits,E=Q.lencode,D=Q.distcode,L=(1<<Q.lenbits)-1,q=(1<<Q.distbits)-1;t:do{M<15&&(y+=rt[r++]<<M,M+=8,y+=rt[r++]<<M,M+=8),$=E[y&L];e:for(;;){if(Y=$>>>24,y>>>=Y,M-=Y,Y=$>>>16&255,Y===0)Dt[s++]=$&65535;else if(Y&16){ht=$&65535,Y&=15,Y&&(M<Y&&(y+=rt[r++]<<M,M+=8),ht+=y&(1<<Y)-1,y>>>=Y,M-=Y),M<15&&(y+=rt[r++]<<M,M+=8,y+=rt[r++]<<M,M+=8),$=D[y&q];n:for(;;){if(Y=$>>>24,y>>>=Y,M-=Y,Y=$>>>16&255,Y&16){if(Mt=$&65535,Y&=15,M<Y&&(y+=rt[r++]<<M,M+=8,M<Y&&(y+=rt[r++]<<M,M+=8)),Mt+=y&(1<<Y)-1,Mt>f){t.msg="invalid distance too far back",Q.mode=$m;break t}if(y>>>=Y,M-=Y,Y=s-l,Mt>Y){if(Y=Mt-Y,Y>p&&Q.sane){t.msg="invalid distance too far back",Q.mode=$m;break t}if(vt=0,bt=b,g===0){if(vt+=d-Y,Y<ht){ht-=Y;do Dt[s++]=b[vt++];while(--Y);vt=s-Mt,bt=Dt}}else if(g<Y){if(vt+=d+g-Y,Y-=g,Y<ht){ht-=Y;do Dt[s++]=b[vt++];while(--Y);if(vt=0,g<ht){Y=g,ht-=Y;do Dt[s++]=b[vt++];while(--Y);vt=s-Mt,bt=Dt}}}else if(vt+=g-Y,Y<ht){ht-=Y;do Dt[s++]=b[vt++];while(--Y);vt=s-Mt,bt=Dt}for(;ht>2;)Dt[s++]=bt[vt++],Dt[s++]=bt[vt++],Dt[s++]=bt[vt++],ht-=3;ht&&(Dt[s++]=bt[vt++],ht>1&&(Dt[s++]=bt[vt++]))}else{vt=s-Mt;do Dt[s++]=Dt[vt++],Dt[s++]=Dt[vt++],Dt[s++]=Dt[vt++],ht-=3;while(ht>2);ht&&(Dt[s++]=Dt[vt++],ht>1&&(Dt[s++]=Dt[vt++]))}}else if((Y&64)===0){$=D[($&65535)+(y&(1<<Y)-1)];continue n}else{t.msg="invalid distance code",Q.mode=$m;break t}break}}else if((Y&64)===0){$=E[($&65535)+(y&(1<<Y)-1)];continue e}else if(Y&32){Q.mode=nN;break t}else{t.msg="invalid literal/length code",Q.mode=$m;break t}break}}while(r<i&&s<c);ht=M>>3,r-=ht,M-=ht<<3,y&=(1<<M)-1,t.next_in=r,t.next_out=s,t.avail_in=r<i?5+(i-r):5-(r-i),t.avail_out=s<c?257+(c-s):257-(s-c),Q.hold=y,Q.bits=M};const Hd=15,dw=852,hw=592,pw=0,Ey=1,mw=2,iN=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),oN=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),sN=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),aN=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),lN=(e,t,n,r,i,s,l,c)=>{const f=c.bits;let d=0,p=0,g=0,b=0,y=0,M=0,E=0,D=0,L=0,q=0,$,Y,ht,Mt,vt,bt=null,rt;const Dt=new Uint16Array(Hd+1),Q=new Uint16Array(Hd+1);let lt=null,X,wt,Tt;for(d=0;d<=Hd;d++)Dt[d]=0;for(p=0;p<r;p++)Dt[t[n+p]]++;for(y=f,b=Hd;b>=1&&Dt[b]===0;b--);if(y>b&&(y=b),b===0)return i[s++]=1<<24|64<<16|0,i[s++]=1<<24|64<<16|0,c.bits=1,0;for(g=1;g<b&&Dt[g]===0;g++);for(y<g&&(y=g),D=1,d=1;d<=Hd;d++)if(D<<=1,D-=Dt[d],D<0)return-1;if(D>0&&(e===pw||b!==1))return-1;for(Q[1]=0,d=1;d<Hd;d++)Q[d+1]=Q[d]+Dt[d];for(p=0;p<r;p++)t[n+p]!==0&&(l[Q[t[n+p]]++]=p);if(e===pw?(bt=lt=l,rt=20):e===Ey?(bt=iN,lt=oN,rt=257):(bt=sN,lt=aN,rt=0),q=0,p=0,d=g,vt=s,M=y,E=0,ht=-1,L=1<<y,Mt=L-1,e===Ey&&L>dw||e===mw&&L>hw)return 1;for(;;){X=d-E,l[p]+1<rt?(wt=0,Tt=l[p]):l[p]>=rt?(wt=lt[l[p]-rt],Tt=bt[l[p]-rt]):(wt=96,Tt=0),$=1<<d-E,Y=1<<M,g=Y;do Y-=$,i[vt+(q>>E)+Y]=X<<24|wt<<16|Tt|0;while(Y!==0);for($=1<<d-1;q&$;)$>>=1;if($!==0?(q&=$-1,q+=$):q=0,p++,--Dt[d]===0){if(d===b)break;d=t[n+l[p]]}if(d>y&&(q&Mt)!==ht){for(E===0&&(E=y),vt+=g,M=d-E,D=1<<M;M+E<b&&(D-=Dt[M+E],!(D<=0));)M++,D<<=1;if(L+=1<<M,e===Ey&&L>dw||e===mw&&L>hw)return 1;ht=q&Mt,i[ht]=y<<24|M<<16|vt-s|0}}return q!==0&&(i[vt+q]=d-E<<24|64<<16|0),c.bits=y,0};var kp=lN;const cN=0,v4=1,w4=2,{Z_FINISH:gw,Z_BLOCK:uN,Z_TREES:Ym,Z_OK:gd,Z_STREAM_END:fN,Z_NEED_DICT:dN,Z_STREAM_ERROR:Vl,Z_DATA_ERROR:S4,Z_MEM_ERROR:k4,Z_BUF_ERROR:hN,Z_DEFLATED:yw}=y4,X0=16180,bw=16181,xw=16182,vw=16183,ww=16184,Sw=16185,kw=16186,Aw=16187,Mw=16188,Cw=16189,Ug=16190,Eu=16191,Ty=16192,Ew=16193,Ny=16194,Tw=16195,Nw=16196,_w=16197,Dw=16198,Vm=16199,Wm=16200,Lw=16201,Rw=16202,Ow=16203,Pw=16204,jw=16205,_y=16206,Iw=16207,zw=16208,Ji=16209,A4=16210,M4=16211,pN=852,mN=592,gN=15,yN=gN,Bw=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function bN(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Ad=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<X0||t.mode>M4?1:0},C4=e=>{if(Ad(e))return Vl;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=X0,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(pN),t.distcode=t.distdyn=new Int32Array(mN),t.sane=1,t.back=-1,gd},E4=e=>{if(Ad(e))return Vl;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,C4(e)},T4=(e,t)=>{let n;if(Ad(e))return Vl;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Vl:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,E4(e))},N4=(e,t)=>{if(!e)return Vl;const n=new bN;e.state=n,n.strm=e,n.window=null,n.mode=X0;const r=T4(e,t);return r!==gd&&(e.state=null),r},xN=e=>N4(e,yN);let Fw=!0,Dy,Ly;const vN=e=>{if(Fw){Dy=new Int32Array(512),Ly=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(kp(v4,e.lens,0,288,Dy,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;kp(w4,e.lens,0,32,Ly,0,e.work,{bits:5}),Fw=!1}e.lencode=Dy,e.lenbits=9,e.distcode=Ly,e.distbits=5},_4=(e,t,n,r)=>{let i;const s=e.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),r>=s.wsize?(s.window.set(t.subarray(n-s.wsize,n),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>r&&(i=r),s.window.set(t.subarray(n-r,n-r+i),s.wnext),r-=i,r?(s.window.set(t.subarray(n-r,n),0),s.wnext=r,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0},wN=(e,t)=>{let n,r,i,s,l,c,f,d,p,g,b,y,M,E,D=0,L,q,$,Y,ht,Mt,vt,bt;const rt=new Uint8Array(4);let Dt,Q;const lt=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ad(e)||!e.output||!e.input&&e.avail_in!==0)return Vl;n=e.state,n.mode===Eu&&(n.mode=Ty),l=e.next_out,i=e.output,f=e.avail_out,s=e.next_in,r=e.input,c=e.avail_in,d=n.hold,p=n.bits,g=c,b=f,bt=gd;t:for(;;)switch(n.mode){case X0:if(n.wrap===0){n.mode=Ty;break}for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(n.wrap&2&&d===35615){n.wbits===0&&(n.wbits=15),n.check=0,rt[0]=d&255,rt[1]=d>>>8&255,n.check=Xc(n.check,rt,2,0),d=0,p=0,n.mode=bw;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((d&255)<<8)+(d>>8))%31){e.msg="incorrect header check",n.mode=Ji;break}if((d&15)!==yw){e.msg="unknown compression method",n.mode=Ji;break}if(d>>>=4,p-=4,vt=(d&15)+8,n.wbits===0&&(n.wbits=vt),vt>15||vt>n.wbits){e.msg="invalid window size",n.mode=Ji;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=d&512?Cw:Eu,d=0,p=0;break;case bw:for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(n.flags=d,(n.flags&255)!==yw){e.msg="unknown compression method",n.mode=Ji;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=Ji;break}n.head&&(n.head.text=d>>8&1),n.flags&512&&n.wrap&4&&(rt[0]=d&255,rt[1]=d>>>8&255,n.check=Xc(n.check,rt,2,0)),d=0,p=0,n.mode=xw;case xw:for(;p<32;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}n.head&&(n.head.time=d),n.flags&512&&n.wrap&4&&(rt[0]=d&255,rt[1]=d>>>8&255,rt[2]=d>>>16&255,rt[3]=d>>>24&255,n.check=Xc(n.check,rt,4,0)),d=0,p=0,n.mode=vw;case vw:for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}n.head&&(n.head.xflags=d&255,n.head.os=d>>8),n.flags&512&&n.wrap&4&&(rt[0]=d&255,rt[1]=d>>>8&255,n.check=Xc(n.check,rt,2,0)),d=0,p=0,n.mode=ww;case ww:if(n.flags&1024){for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}n.length=d,n.head&&(n.head.extra_len=d),n.flags&512&&n.wrap&4&&(rt[0]=d&255,rt[1]=d>>>8&255,n.check=Xc(n.check,rt,2,0)),d=0,p=0}else n.head&&(n.head.extra=null);n.mode=Sw;case Sw:if(n.flags&1024&&(y=n.length,y>c&&(y=c),y&&(n.head&&(vt=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(s,s+y),vt)),n.flags&512&&n.wrap&4&&(n.check=Xc(n.check,r,y,s)),c-=y,s+=y,n.length-=y),n.length))break t;n.length=0,n.mode=kw;case kw:if(n.flags&2048){if(c===0)break t;y=0;do vt=r[s+y++],n.head&&vt&&n.length<65536&&(n.head.name+=String.fromCharCode(vt));while(vt&&y<c);if(n.flags&512&&n.wrap&4&&(n.check=Xc(n.check,r,y,s)),c-=y,s+=y,vt)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=Aw;case Aw:if(n.flags&4096){if(c===0)break t;y=0;do vt=r[s+y++],n.head&&vt&&n.length<65536&&(n.head.comment+=String.fromCharCode(vt));while(vt&&y<c);if(n.flags&512&&n.wrap&4&&(n.check=Xc(n.check,r,y,s)),c-=y,s+=y,vt)break t}else n.head&&(n.head.comment=null);n.mode=Mw;case Mw:if(n.flags&512){for(;p<16;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(n.wrap&4&&d!==(n.check&65535)){e.msg="header crc mismatch",n.mode=Ji;break}d=0,p=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Eu;break;case Cw:for(;p<32;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}e.adler=n.check=Bw(d),d=0,p=0,n.mode=Ug;case Ug:if(n.havedict===0)return e.next_out=l,e.avail_out=f,e.next_in=s,e.avail_in=c,n.hold=d,n.bits=p,dN;e.adler=n.check=1,n.mode=Eu;case Eu:if(t===uN||t===Ym)break t;case Ty:if(n.last){d>>>=p&7,p-=p&7,n.mode=_y;break}for(;p<3;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}switch(n.last=d&1,d>>>=1,p-=1,d&3){case 0:n.mode=Ew;break;case 1:if(vN(n),n.mode=Vm,t===Ym){d>>>=2,p-=2;break t}break;case 2:n.mode=Nw;break;case 3:e.msg="invalid block type",n.mode=Ji}d>>>=2,p-=2;break;case Ew:for(d>>>=p&7,p-=p&7;p<32;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if((d&65535)!==(d>>>16^65535)){e.msg="invalid stored block lengths",n.mode=Ji;break}if(n.length=d&65535,d=0,p=0,n.mode=Ny,t===Ym)break t;case Ny:n.mode=Tw;case Tw:if(y=n.length,y){if(y>c&&(y=c),y>f&&(y=f),y===0)break t;i.set(r.subarray(s,s+y),l),c-=y,s+=y,f-=y,l+=y,n.length-=y;break}n.mode=Eu;break;case Nw:for(;p<14;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(n.nlen=(d&31)+257,d>>>=5,p-=5,n.ndist=(d&31)+1,d>>>=5,p-=5,n.ncode=(d&15)+4,d>>>=4,p-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Ji;break}n.have=0,n.mode=_w;case _w:for(;n.have<n.ncode;){for(;p<3;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}n.lens[lt[n.have++]]=d&7,d>>>=3,p-=3}for(;n.have<19;)n.lens[lt[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,Dt={bits:n.lenbits},bt=kp(cN,n.lens,0,19,n.lencode,0,n.work,Dt),n.lenbits=Dt.bits,bt){e.msg="invalid code lengths set",n.mode=Ji;break}n.have=0,n.mode=Dw;case Dw:for(;n.have<n.nlen+n.ndist;){for(;D=n.lencode[d&(1<<n.lenbits)-1],L=D>>>24,q=D>>>16&255,$=D&65535,!(L<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if($<16)d>>>=L,p-=L,n.lens[n.have++]=$;else{if($===16){for(Q=L+2;p<Q;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(d>>>=L,p-=L,n.have===0){e.msg="invalid bit length repeat",n.mode=Ji;break}vt=n.lens[n.have-1],y=3+(d&3),d>>>=2,p-=2}else if($===17){for(Q=L+3;p<Q;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=L,p-=L,vt=0,y=3+(d&7),d>>>=3,p-=3}else{for(Q=L+7;p<Q;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=L,p-=L,vt=0,y=11+(d&127),d>>>=7,p-=7}if(n.have+y>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Ji;break}for(;y--;)n.lens[n.have++]=vt}}if(n.mode===Ji)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Ji;break}if(n.lenbits=9,Dt={bits:n.lenbits},bt=kp(v4,n.lens,0,n.nlen,n.lencode,0,n.work,Dt),n.lenbits=Dt.bits,bt){e.msg="invalid literal/lengths set",n.mode=Ji;break}if(n.distbits=6,n.distcode=n.distdyn,Dt={bits:n.distbits},bt=kp(w4,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,Dt),n.distbits=Dt.bits,bt){e.msg="invalid distances set",n.mode=Ji;break}if(n.mode=Vm,t===Ym)break t;case Vm:n.mode=Wm;case Wm:if(c>=6&&f>=258){e.next_out=l,e.avail_out=f,e.next_in=s,e.avail_in=c,n.hold=d,n.bits=p,rN(e,b),l=e.next_out,i=e.output,f=e.avail_out,s=e.next_in,r=e.input,c=e.avail_in,d=n.hold,p=n.bits,n.mode===Eu&&(n.back=-1);break}for(n.back=0;D=n.lencode[d&(1<<n.lenbits)-1],L=D>>>24,q=D>>>16&255,$=D&65535,!(L<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(q&&(q&240)===0){for(Y=L,ht=q,Mt=$;D=n.lencode[Mt+((d&(1<<Y+ht)-1)>>Y)],L=D>>>24,q=D>>>16&255,$=D&65535,!(Y+L<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=Y,p-=Y,n.back+=Y}if(d>>>=L,p-=L,n.back+=L,n.length=$,q===0){n.mode=jw;break}if(q&32){n.back=-1,n.mode=Eu;break}if(q&64){e.msg="invalid literal/length code",n.mode=Ji;break}n.extra=q&15,n.mode=Lw;case Lw:if(n.extra){for(Q=n.extra;p<Q;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}n.length+=d&(1<<n.extra)-1,d>>>=n.extra,p-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Rw;case Rw:for(;D=n.distcode[d&(1<<n.distbits)-1],L=D>>>24,q=D>>>16&255,$=D&65535,!(L<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if((q&240)===0){for(Y=L,ht=q,Mt=$;D=n.distcode[Mt+((d&(1<<Y+ht)-1)>>Y)],L=D>>>24,q=D>>>16&255,$=D&65535,!(Y+L<=p);){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}d>>>=Y,p-=Y,n.back+=Y}if(d>>>=L,p-=L,n.back+=L,q&64){e.msg="invalid distance code",n.mode=Ji;break}n.offset=$,n.extra=q&15,n.mode=Ow;case Ow:if(n.extra){for(Q=n.extra;p<Q;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}n.offset+=d&(1<<n.extra)-1,d>>>=n.extra,p-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Ji;break}n.mode=Pw;case Pw:if(f===0)break t;if(y=b-f,n.offset>y){if(y=n.offset-y,y>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Ji;break}y>n.wnext?(y-=n.wnext,M=n.wsize-y):M=n.wnext-y,y>n.length&&(y=n.length),E=n.window}else E=i,M=l-n.offset,y=n.length;y>f&&(y=f),f-=y,n.length-=y;do i[l++]=E[M++];while(--y);n.length===0&&(n.mode=Wm);break;case jw:if(f===0)break t;i[l++]=n.length,f--,n.mode=Wm;break;case _y:if(n.wrap){for(;p<32;){if(c===0)break t;c--,d|=r[s++]<<p,p+=8}if(b-=f,e.total_out+=b,n.total+=b,n.wrap&4&&b&&(e.adler=n.check=n.flags?Xc(n.check,i,b,l-b):H2(n.check,i,b,l-b)),b=f,n.wrap&4&&(n.flags?d:Bw(d))!==n.check){e.msg="incorrect data check",n.mode=Ji;break}d=0,p=0}n.mode=Iw;case Iw:if(n.wrap&&n.flags){for(;p<32;){if(c===0)break t;c--,d+=r[s++]<<p,p+=8}if(n.wrap&4&&d!==(n.total&4294967295)){e.msg="incorrect length check",n.mode=Ji;break}d=0,p=0}n.mode=zw;case zw:bt=fN;break t;case Ji:bt=S4;break t;case A4:return k4;case M4:default:return Vl}return e.next_out=l,e.avail_out=f,e.next_in=s,e.avail_in=c,n.hold=d,n.bits=p,(n.wsize||b!==e.avail_out&&n.mode<Ji&&(n.mode<_y||t!==gw))&&_4(e,e.output,e.next_out,b-e.avail_out),g-=e.avail_in,b-=e.avail_out,e.total_in+=g,e.total_out+=b,n.total+=b,n.wrap&4&&b&&(e.adler=n.check=n.flags?Xc(n.check,i,b,e.next_out-b):H2(n.check,i,b,e.next_out-b)),e.data_type=n.bits+(n.last?64:0)+(n.mode===Eu?128:0)+(n.mode===Vm||n.mode===Ny?256:0),(g===0&&b===0||t===gw)&&bt===gd&&(bt=hN),bt},SN=e=>{if(Ad(e))return Vl;let t=e.state;return t.window&&(t.window=null),e.state=null,gd},kN=(e,t)=>{if(Ad(e))return Vl;const n=e.state;return(n.wrap&2)===0?Vl:(n.head=t,t.done=!1,gd)},AN=(e,t)=>{const n=t.length;let r,i,s;return Ad(e)||(r=e.state,r.wrap!==0&&r.mode!==Ug)?Vl:r.mode===Ug&&(i=1,i=H2(i,t,n,0),i!==r.check)?S4:(s=_4(e,t,n,n),s?(r.mode=A4,k4):(r.havedict=1,gd))};var MN=E4,CN=T4,EN=C4,TN=xN,NN=N4,_N=wN,DN=SN,LN=kN,RN=AN,ON="pako inflate (from Nodeca project)",Ou={inflateReset:MN,inflateReset2:CN,inflateResetKeep:EN,inflateInit:TN,inflateInit2:NN,inflate:_N,inflateEnd:DN,inflateGetHeader:LN,inflateSetDictionary:RN,inflateInfo:ON};function PN(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var jN=PN;const D4=Object.prototype.toString,{Z_NO_FLUSH:IN,Z_FINISH:zN,Z_OK:Bp,Z_STREAM_END:Ry,Z_NEED_DICT:Oy,Z_STREAM_ERROR:BN,Z_DATA_ERROR:Uw,Z_MEM_ERROR:FN}=y4;function tm(e){this.options=b4.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new eN,this.strm.avail_out=0;let n=Ou.inflateInit2(this.strm,t.windowBits);if(n!==Bp)throw new Error(q2[n]);if(this.header=new jN,Ou.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=$2.string2buf(t.dictionary):D4.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Ou.inflateSetDictionary(this.strm,t.dictionary),n!==Bp)))throw new Error(q2[n])}tm.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let s,l,c;if(this.ended)return!1;for(t===~~t?l=t:l=t===!0?zN:IN,D4.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),s=Ou.inflate(n,l),s===Oy&&i&&(s=Ou.inflateSetDictionary(n,i),s===Bp?s=Ou.inflate(n,l):s===Uw&&(s=Oy));n.avail_in>0&&s===Ry&&n.state.wrap>0&&e[n.next_in]!==0;)Ou.inflateReset(n),s=Ou.inflate(n,l);switch(s){case BN:case Uw:case Oy:case FN:return this.onEnd(s),this.ended=!0,!1}if(c=n.avail_out,n.next_out&&(n.avail_out===0||s===Ry))if(this.options.to==="string"){let f=$2.utf8border(n.output,n.next_out),d=n.next_out-f,p=$2.buf2string(n.output,f);n.next_out=d,n.avail_out=r-d,d&&n.output.set(n.output.subarray(f,f+d),0),this.onData(p)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(s===Bp&&c===0)){if(s===Ry)return s=Ou.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};tm.prototype.onData=function(e){this.chunks.push(e)};tm.prototype.onEnd=function(e){e===Bp&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=b4.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function UN(e,t){const n=new tm(t);if(n.push(e),n.err)throw n.msg||q2[n.err];return n.result}var HN=tm,qN=UN,$N={Inflate:HN,inflate:qN};const{Inflate:YN,inflate:VN}=$N;var Hw=YN,WN=VN;const L4=[];for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t&1?t=3988292384^t>>>1:t=t>>>1;L4[e]=t}const qw=4294967295;function XN(e,t,n){let r=e;for(let i=0;i<n;i++)r=L4[(r^t[i])&255]^r>>>8;return r}function GN(e,t){return(XN(qw,e,t)^qw)>>>0}function $w(e,t,n){const r=e.readUint32(),i=GN(new Uint8Array(e.buffer,e.byteOffset+e.offset-t-4,t),t);if(i!==r)throw new Error(`CRC mismatch for chunk ${n}. Expected ${r}, found ${i}`)}function R4(e,t,n){for(let r=0;r<n;r++)t[r]=e[r]}function O4(e,t,n,r){let i=0;for(;i<r;i++)t[i]=e[i];for(;i<n;i++)t[i]=e[i]+t[i-r]&255}function P4(e,t,n,r){let i=0;if(n.length===0)for(;i<r;i++)t[i]=e[i];else for(;i<r;i++)t[i]=e[i]+n[i]&255}function j4(e,t,n,r,i){let s=0;if(n.length===0){for(;s<i;s++)t[s]=e[s];for(;s<r;s++)t[s]=e[s]+(t[s-i]>>1)&255}else{for(;s<i;s++)t[s]=e[s]+(n[s]>>1)&255;for(;s<r;s++)t[s]=e[s]+(t[s-i]+n[s]>>1)&255}}function I4(e,t,n,r,i){let s=0;if(n.length===0){for(;s<i;s++)t[s]=e[s];for(;s<r;s++)t[s]=e[s]+t[s-i]&255}else{for(;s<i;s++)t[s]=e[s]+n[s]&255;for(;s<r;s++)t[s]=e[s]+KN(t[s-i],n[s],n[s-i])&255}}function KN(e,t,n){const r=e+t-n,i=Math.abs(r-e),s=Math.abs(r-t),l=Math.abs(r-n);return i<=s&&i<=l?e:s<=l?t:n}function JN(e,t,n,r,i,s){switch(e){case 0:R4(t,n,i);break;case 1:O4(t,n,i,s);break;case 2:P4(t,n,r,i);break;case 3:j4(t,n,r,i,s);break;case 4:I4(t,n,r,i,s);break;default:throw new Error(`Unsupported filter: ${e}`)}}const ZN=new Uint16Array([255]),QN=new Uint8Array(ZN.buffer),t_=QN[0]===255;function e_(e){const{data:t,width:n,height:r,channels:i,depth:s}=e,l=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],c=Math.ceil(s/8)*i,f=new Uint8Array(r*n*c);let d=0;for(let p=0;p<7;p++){const g=l[p],b=Math.ceil((n-g.x)/g.xStep),y=Math.ceil((r-g.y)/g.yStep);if(b<=0||y<=0)continue;const M=b*c,E=new Uint8Array(M);for(let D=0;D<y;D++){const L=t[d++],q=t.subarray(d,d+M);d+=M;const $=new Uint8Array(M);JN(L,q,$,E,M,c),E.set($);for(let Y=0;Y<b;Y++){const ht=g.x+Y*g.xStep,Mt=g.y+D*g.yStep;if(!(ht>=n||Mt>=r))for(let vt=0;vt<c;vt++)f[(Mt*n+ht)*c+vt]=$[Y*c+vt]}}}if(s===16){const p=new Uint16Array(f.buffer);if(t_)for(let g=0;g<p.length;g++)p[g]=n_(p[g]);return p}else return f}function n_(e){return(e&255)<<8|e>>8&255}const r_=new Uint16Array([255]),i_=new Uint8Array(r_.buffer),o_=i_[0]===255,s_=new Uint8Array(0);function Yw(e){const{data:t,width:n,height:r,channels:i,depth:s}=e,l=Math.ceil(s/8)*i,c=Math.ceil(s/8*i*n),f=new Uint8Array(r*c);let d=s_,p=0,g,b;for(let y=0;y<r;y++){switch(g=t.subarray(p+1,p+1+c),b=f.subarray(y*c,(y+1)*c),t[p]){case 0:R4(g,b,c);break;case 1:O4(g,b,c,l);break;case 2:P4(g,b,d,c);break;case 3:j4(g,b,d,c,l);break;case 4:I4(g,b,d,c,l);break;default:throw new Error(`Unsupported filter: ${t[p]}`)}d=b,p+=c+1}if(s===16){const y=new Uint16Array(f.buffer);if(o_)for(let M=0;M<y.length;M++)y[M]=a_(y[M]);return y}else return f}function a_(e){return(e&255)<<8|e>>8&255}const kg=Uint8Array.of(137,80,78,71,13,10,26,10);function Vw(e){if(!l_(e.readBytes(kg.length)))throw new Error("wrong PNG signature")}function l_(e){if(e.length<kg.length)return!1;for(let t=0;t<kg.length;t++)if(e[t]!==kg[t])return!1;return!0}const c_="tEXt",u_=0,z4=new TextDecoder("latin1");function f_(e){if(h_(e),e.length===0||e.length>79)throw new Error("keyword length must be between 1 and 79")}const d_=/^[\u0000-\u00FF]*$/;function h_(e){if(!d_.test(e))throw new Error("invalid latin1 text")}function p_(e,t,n){const r=B4(t);e[r]=m_(t,n-r.length-1)}function B4(e){for(e.mark();e.readByte()!==u_;);const t=e.offset;e.reset();const n=z4.decode(e.readBytes(t-e.offset-1));return e.skip(1),f_(n),n}function m_(e,t){return z4.decode(e.readBytes(t))}const fl={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},Py={UNKNOWN:-1,DEFLATE:0},Ww={UNKNOWN:-1,ADAPTIVE:0},jy={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},Xm={NONE:0,BACKGROUND:1,PREVIOUS:2},Iy={SOURCE:0,OVER:1};class g_ extends K5{_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;constructor(t,n={}){super(t);const{checkCrc:r=!1}=n;this._checkCrc=r,this._inflator=new Hw,this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=Py.UNKNOWN,this._filterMethod=Ww.UNKNOWN,this._interlaceMethod=jy.UNKNOWN,this._colorType=fl.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(Vw(this);!this._end;){const t=this.readUint32(),n=this.readChars(4);this.decodeChunk(t,n)}return this.decodeImage(),this._png}decodeApng(){for(Vw(this);!this._end;){const t=this.readUint32(),n=this.readChars(4);this.decodeApngChunk(t,n)}return this.decodeApngImage(),this._apng}decodeChunk(t,n){const r=this.offset;switch(n){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(t);break;case"IDAT":this.decodeIDAT(t);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(t);break;case"iCCP":this.decodeiCCP(t);break;case c_:p_(this._png.text,this,t);break;case"pHYs":this.decodepHYs();break;default:this.skip(t);break}if(this.offset-r!==t)throw new Error(`Length mismatch while decoding chunk ${n}`);this._checkCrc?$w(this,t+4,n):this.skip(4)}decodeApngChunk(t,n){const r=this.offset;switch(n!=="fdAT"&&n!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),n){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(t);break;default:this.decodeChunk(t,n),this.offset=r+t;break}if(this.offset-r!==t)throw new Error(`Length mismatch while decoding chunk ${n}`);this._checkCrc?$w(this,t+4,n):this.skip(4)}decodeIHDR(){const t=this._png;t.width=this.readUint32(),t.height=this.readUint32(),t.depth=y_(this.readUint8());const n=this.readUint8();this._colorType=n;let r;switch(n){case fl.GREYSCALE:r=1;break;case fl.TRUECOLOUR:r=3;break;case fl.INDEXED_COLOUR:r=1;break;case fl.GREYSCALE_ALPHA:r=2;break;case fl.TRUECOLOUR_ALPHA:r=4;break;case fl.UNKNOWN:default:throw new Error(`Unknown color type: ${n}`)}if(this._png.channels=r,this._compressionMethod=this.readUint8(),this._compressionMethod!==Py.DEFLATE)throw new Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){const t={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(t)}decodePLTE(t){if(t%3!==0)throw new RangeError(`PLTE field length must be a multiple of 3. Got ${t}`);const n=t/3;this._hasPalette=!0;const r=[];this._palette=r;for(let i=0;i<n;i++)r.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(t){this._writingDataChunks=!0;const n=t,r=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,r,n)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(t)}decodeFDAT(t){this._writingDataChunks=!0;let n=t,r=this.offset+this.byteOffset;if(r+=4,n-=4,this._inflator.push(new Uint8Array(this.buffer,r,n)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(t)}decodetRNS(t){switch(this._colorType){case fl.GREYSCALE:case fl.TRUECOLOUR:{if(t%2!==0)throw new RangeError(`tRNS chunk length must be a multiple of 2. Got ${t}`);if(t/2>this._png.width*this._png.height)throw new Error(`tRNS chunk contains more alpha values than there are pixels (${t/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(t/2);for(let n=0;n<t/2;n++)this._transparency[n]=this.readUint16();break}case fl.INDEXED_COLOUR:{if(t>this._palette.length)throw new Error(`tRNS chunk contains more alpha values than there are palette colors (${t} vs ${this._palette.length})`);let n=0;for(;n<t;n++){const r=this.readByte();this._palette[n].push(r)}for(;n<this._palette.length;n++)this._palette[n].push(255);break}case fl.UNKNOWN:case fl.GREYSCALE_ALPHA:case fl.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(t){const n=B4(this),r=this.readUint8();if(r!==Py.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${r}`);const i=this.readBytes(t-n.length-2);this._png.iccEmbeddedProfile={name:n,profile:WN(i)}}decodepHYs(){const t=this.readUint32(),n=this.readUint32(),r=this.readByte();this._png.resolution={x:t,y:n,unit:r}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let t=0;t<this._numberOfFrames;t++){const n={sequenceNumber:this._frames[t].sequenceNumber,delayNumber:this._frames[t].delayNumber,delayDenominator:this._frames[t].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},r=this._frames.at(t);if(r){if(r.data=Yw({data:r.data,width:r.width,height:r.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),t===0||r.xOffset===0&&r.yOffset===0&&r.width===this._png.width&&r.height===this._png.height)n.data=r.data;else{const i=this._apng.frames.at(t-1);this.disposeFrame(r,i,n),this.addFrameDataToCanvas(n,r)}this._apng.frames.push(n)}}return this._apng}disposeFrame(t,n,r){switch(t.disposeOp){case Xm.NONE:break;case Xm.BACKGROUND:for(let i=0;i<this._png.height;i++)for(let s=0;s<this._png.width;s++){const l=(i*t.width+s)*this._png.channels;for(let c=0;c<this._png.channels;c++)r.data[l+c]=0}break;case Xm.PREVIOUS:r.data.set(n.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(t,n){const r=1<<this._png.depth,i=(s,l)=>{const c=((s+n.yOffset)*this._png.width+n.xOffset+l)*this._png.channels,f=(s*n.width+l)*this._png.channels;return{index:c,frameIndex:f}};switch(n.blendOp){case Iy.SOURCE:for(let s=0;s<n.height;s++)for(let l=0;l<n.width;l++){const{index:c,frameIndex:f}=i(s,l);for(let d=0;d<this._png.channels;d++)t.data[c+d]=n.data[f+d]}break;case Iy.OVER:for(let s=0;s<n.height;s++)for(let l=0;l<n.width;l++){const{index:c,frameIndex:f}=i(s,l);for(let d=0;d<this._png.channels;d++){const p=n.data[f+this._png.channels-1]/r,g=d%(this._png.channels-1)===0?1:n.data[f+d],b=Math.floor(p*g+(1-p)*t.data[c+d]);t.data[c+d]+=b}}break;default:throw new Error("Unknown blendOp")}}decodeImage(){if(this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);const t=this._isAnimated?(this._frames?.at(0)).data:this._inflator.result;if(this._filterMethod!==Ww.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===jy.NO_INTERLACE)this._png.data=Yw({data:t,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===jy.ADAM7)this._png.data=e_({data:t,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw new Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){const t=this._inflator.result,n=this._frames.at(-1);n?n.data=t:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:Xm.NONE,blendOp:Iy.SOURCE,data:t}),this._inflator=new Hw,this._writingDataChunks=!1}}function y_(e){if(e!==1&&e!==2&&e!==4&&e!==8&&e!==16)throw new Error(`invalid bit depth: ${e}`);return e}var Xw;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.METRE=1]="METRE"})(Xw||(Xw={}));function b_(e,t){return new g_(e,t).decode()}var Qn=(function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this})();function zy(){Qn.console&&typeof Qn.console.log=="function"&&Qn.console.log.apply(Qn.console,arguments)}var yi={log:zy,warn:function(e){Qn.console&&(typeof Qn.console.warn=="function"?Qn.console.warn.apply(Qn.console,arguments):zy.call(null,arguments))},error:function(e){Qn.console&&(typeof Qn.console.error=="function"?Qn.console.error.apply(Qn.console,arguments):zy(e))}};function By(e,t,n){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){Kf(r.response,t,n)},r.onerror=function(){yi.error("could not download file")},r.send()}function Gw(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Gm(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var Kf=Qn.saveAs||((typeof window>"u"?"undefined":ii(window))!=="object"||window!==Qn?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(e,t,n){var r=Qn.URL||Qn.webkitURL,i=document.createElement("a");t=t||e.name||"download",i.download=t,i.rel="noopener",typeof e=="string"?(i.href=e,i.origin!==location.origin?Gw(i.href)?By(e,t,n):Gm(i,i.target="_blank"):Gm(i)):(i.href=r.createObjectURL(e),setTimeout(function(){r.revokeObjectURL(i.href)},4e4),setTimeout(function(){Gm(i)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,n){if(t=t||e.name||"download",typeof e=="string")if(Gw(e))By(e,t,n);else{var r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){Gm(r)})}else navigator.msSaveOrOpenBlob((function(i,s){return s===void 0?s={autoBom:!1}:ii(s)!=="object"&&(yi.warn("Deprecated: Expected third argument to be a object"),s={autoBom:!s}),s.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(i.type)?new Blob(["\uFEFF",i],{type:i.type}):i})(e,n),t)}:function(e,t,n,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return By(e,t,n);var i=e.type==="application/octet-stream",s=/constructor/i.test(Qn.HTMLElement)||Qn.safari,l=/CriOS\/[\d]+/.test(navigator.userAgent);if((l||i&&s)&&(typeof FileReader>"u"?"undefined":ii(FileReader))==="object"){var c=new FileReader;c.onloadend=function(){var p=c.result;p=l?p:p.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=p:location=p,r=null},c.readAsDataURL(e)}else{var f=Qn.URL||Qn.webkitURL,d=f.createObjectURL(e);r?r.location=d:location.href=d,r=null,setTimeout(function(){f.revokeObjectURL(d)},4e4)}});function F4(e){var t;e=e||"",this.ok=!1,e.charAt(0)=="#"&&(e=e.substr(1,6)),e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"}[e=(e=e.replace(/ /g,"")).toLowerCase()]||e;for(var n=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(c){return[parseInt(c[1]),parseInt(c[2]),parseInt(c[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(c){return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(c){return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)]}}],r=0;r<n.length;r++){var i=n[r].re,s=n[r].process,l=i.exec(e);l&&(t=s(l),this.r=t[0],this.g=t[1],this.b=t[2],this.ok=!0)}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var c=this.r.toString(16),f=this.g.toString(16),d=this.b.toString(16);return c.length==1&&(c="0"+c),f.length==1&&(f="0"+f),d.length==1&&(d="0"+d),"#"+c+f+d}}var Ag=Qn.atob.bind(Qn),Kw=Qn.btoa.bind(Qn);function Fy(e,t){var n=e[0],r=e[1],i=e[2],s=e[3];n=aa(n,r,i,s,t[0],7,-680876936),s=aa(s,n,r,i,t[1],12,-389564586),i=aa(i,s,n,r,t[2],17,606105819),r=aa(r,i,s,n,t[3],22,-1044525330),n=aa(n,r,i,s,t[4],7,-176418897),s=aa(s,n,r,i,t[5],12,1200080426),i=aa(i,s,n,r,t[6],17,-1473231341),r=aa(r,i,s,n,t[7],22,-45705983),n=aa(n,r,i,s,t[8],7,1770035416),s=aa(s,n,r,i,t[9],12,-1958414417),i=aa(i,s,n,r,t[10],17,-42063),r=aa(r,i,s,n,t[11],22,-1990404162),n=aa(n,r,i,s,t[12],7,1804603682),s=aa(s,n,r,i,t[13],12,-40341101),i=aa(i,s,n,r,t[14],17,-1502002290),n=la(n,r=aa(r,i,s,n,t[15],22,1236535329),i,s,t[1],5,-165796510),s=la(s,n,r,i,t[6],9,-1069501632),i=la(i,s,n,r,t[11],14,643717713),r=la(r,i,s,n,t[0],20,-373897302),n=la(n,r,i,s,t[5],5,-701558691),s=la(s,n,r,i,t[10],9,38016083),i=la(i,s,n,r,t[15],14,-660478335),r=la(r,i,s,n,t[4],20,-405537848),n=la(n,r,i,s,t[9],5,568446438),s=la(s,n,r,i,t[14],9,-1019803690),i=la(i,s,n,r,t[3],14,-187363961),r=la(r,i,s,n,t[8],20,1163531501),n=la(n,r,i,s,t[13],5,-1444681467),s=la(s,n,r,i,t[2],9,-51403784),i=la(i,s,n,r,t[7],14,1735328473),n=ca(n,r=la(r,i,s,n,t[12],20,-1926607734),i,s,t[5],4,-378558),s=ca(s,n,r,i,t[8],11,-2022574463),i=ca(i,s,n,r,t[11],16,1839030562),r=ca(r,i,s,n,t[14],23,-35309556),n=ca(n,r,i,s,t[1],4,-1530992060),s=ca(s,n,r,i,t[4],11,1272893353),i=ca(i,s,n,r,t[7],16,-155497632),r=ca(r,i,s,n,t[10],23,-1094730640),n=ca(n,r,i,s,t[13],4,681279174),s=ca(s,n,r,i,t[0],11,-358537222),i=ca(i,s,n,r,t[3],16,-722521979),r=ca(r,i,s,n,t[6],23,76029189),n=ca(n,r,i,s,t[9],4,-640364487),s=ca(s,n,r,i,t[12],11,-421815835),i=ca(i,s,n,r,t[15],16,530742520),n=ua(n,r=ca(r,i,s,n,t[2],23,-995338651),i,s,t[0],6,-198630844),s=ua(s,n,r,i,t[7],10,1126891415),i=ua(i,s,n,r,t[14],15,-1416354905),r=ua(r,i,s,n,t[5],21,-57434055),n=ua(n,r,i,s,t[12],6,1700485571),s=ua(s,n,r,i,t[3],10,-1894986606),i=ua(i,s,n,r,t[10],15,-1051523),r=ua(r,i,s,n,t[1],21,-2054922799),n=ua(n,r,i,s,t[8],6,1873313359),s=ua(s,n,r,i,t[15],10,-30611744),i=ua(i,s,n,r,t[6],15,-1560198380),r=ua(r,i,s,n,t[13],21,1309151649),n=ua(n,r,i,s,t[4],6,-145523070),s=ua(s,n,r,i,t[11],10,-1120210379),i=ua(i,s,n,r,t[2],15,718787259),r=ua(r,i,s,n,t[9],21,-343485551),e[0]=vf(n,e[0]),e[1]=vf(r,e[1]),e[2]=vf(i,e[2]),e[3]=vf(s,e[3])}function G0(e,t,n,r,i,s){return t=vf(vf(t,e),vf(r,s)),vf(t<<i|t>>>32-i,n)}function aa(e,t,n,r,i,s,l){return G0(t&n|~t&r,e,t,i,s,l)}function la(e,t,n,r,i,s,l){return G0(t&r|n&~r,e,t,i,s,l)}function ca(e,t,n,r,i,s,l){return G0(t^n^r,e,t,i,s,l)}function ua(e,t,n,r,i,s,l){return G0(n^(t|~r),e,t,i,s,l)}function U4(e){var t,n=e.length,r=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=e.length;t+=64)Fy(r,x_(e.substring(t-64,t)));e=e.substring(t-64);var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<e.length;t++)i[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(Fy(r,i),t=0;t<16;t++)i[t]=0;return i[14]=8*n,Fy(r,i),r}function x_(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}var Jw="0123456789abcdef".split("");function v_(e){for(var t="",n=0;n<4;n++)t+=Jw[e>>8*n+4&15]+Jw[e>>8*n&15];return t}function w_(e){return String.fromCharCode(255&e,(65280&e)>>8,(16711680&e)>>16,(4278190080&e)>>24)}function Y2(e){return U4(e).map(w_).join("")}var S_=(function(e){for(var t=0;t<e.length;t++)e[t]=v_(e[t]);return e.join("")})(U4("hello"))!="5d41402abc4b2a76b9719d911017c592";function vf(e,t){if(S_){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}return e+t&4294967295}function V2(e,t){var n,r,i,s;if(e!==n){for(var l=(i=e,s=1+(256/e.length|0),new Array(s+1).join(i)),c=[],f=0;f<256;f++)c[f]=f;var d=0;for(f=0;f<256;f++){var p=c[f];d=(d+p+l.charCodeAt(f))%256,c[f]=c[d],c[d]=p}n=e,r=c}else c=r;var g=t.length,b=0,y=0,M="";for(f=0;f<g;f++)y=(y+(p=c[b=(b+1)%256]))%256,c[b]=c[y],c[y]=p,l=c[(c[b]+c[y])%256],M+=String.fromCharCode(t.charCodeAt(f)^l);return M}var Zw={print:4,modify:8,copy:16,"annot-forms":32};function Kd(e,t,n,r){this.v=1,this.r=2;var i=192;e.forEach(function(c){if(Zw.perm!==void 0)throw new Error("Invalid permission: "+c);i+=Zw[c]}),this.padding="(¿N^NuŠAd\0NVÿú\b..\0¶Ðh>€/\f©þdSiz";var s=(t+this.padding).substr(0,32),l=(n+this.padding).substr(0,32);this.O=this.processOwnerPassword(s,l),this.P=-(1+(255^i)),this.encryptionKey=Y2(s+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(r)).substr(0,5),this.U=V2(this.encryptionKey,this.padding)}function Jd(e){if(/[^\u0000-\u00ff]/.test(e))throw new Error("Invalid PDF Name Object: "+e+", Only accept ASCII characters.");for(var t="",n=e.length,r=0;r<n;r++){var i=e.charCodeAt(r);t+=i<33||i===35||i===37||i===40||i===41||i===47||i===60||i===62||i===91||i===93||i===123||i===125||i>126?"#"+("0"+i.toString(16)).slice(-2):e[r]}return t}function Qw(e){if(ii(e)!=="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var t={};this.subscribe=function(n,r,i){if(i=i||!1,typeof n!="string"||typeof r!="function"||typeof i!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");t.hasOwnProperty(n)||(t[n]={});var s=Math.random().toString(35);return t[n][s]=[r,!!i],s},this.unsubscribe=function(n){for(var r in t)if(t[r][n])return delete t[r][n],Object.keys(t[r]).length===0&&delete t[r],!0;return!1},this.publish=function(n){if(t.hasOwnProperty(n)){var r=Array.prototype.slice.call(arguments,1),i=[];for(var s in t[n]){var l=t[n][s];try{l[0].apply(e,r)}catch(c){Qn.console&&yi.error("jsPDF PubSub Error",c.message,c)}l[1]&&i.push(s)}i.length&&i.forEach(this.unsubscribe)}},this.getTopics=function(){return t}}function Hg(e){if(!(this instanceof Hg))return new Hg(e);var t="opacity,stroke-opacity".split(",");for(var n in e)e.hasOwnProperty(n)&&t.indexOf(n)>=0&&(this[n]=e[n]);this.id="",this.objectNumber=-1}function H4(e,t){this.gState=e,this.matrix=t,this.id="",this.objectNumber=-1}function Jf(e,t,n,r,i){if(!(this instanceof Jf))return new Jf(e,t,n,r,i);this.type=e==="axial"?2:3,this.coords=t,this.colors=n,H4.call(this,r,i)}function rh(e,t,n,r,i){if(!(this instanceof rh))return new rh(e,t,n,r,i);this.boundingBox=e,this.xStep=t,this.yStep=n,this.stream="",this.cloneIndex=0,H4.call(this,r,i)}function xn(e){var t,n=typeof arguments[0]=="string"?arguments[0]:"p",r=arguments[1],i=arguments[2],s=arguments[3],l=[],c=1,f=16,d="S",p=null;ii(e=e||{})==="object"&&(n=e.orientation,r=e.unit||r,i=e.format||i,s=e.compress||e.compressPdf||s,(p=e.encryption||null)!==null&&(p.userPassword=p.userPassword||"",p.ownerPassword=p.ownerPassword||"",p.userPermissions=p.userPermissions||[]),c=typeof e.userUnit=="number"?Math.abs(e.userUnit):1,e.precision!==void 0&&(t=e.precision),e.floatPrecision!==void 0&&(f=e.floatPrecision),d=e.defaultPathOperation||"S"),l=e.filters||(s===!0?["FlateEncode"]:l),r=r||"mm",n=(""+(n||"P")).toLowerCase();var g=e.putOnlyUsedFonts||!1,b={},y={internal:{},__private__:{}};y.__private__.PubSub=Qw;var M="1.3",E=y.__private__.getPdfVersion=function(){return M};y.__private__.setPdfVersion=function(C){M=C};var D={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};y.__private__.getPageFormats=function(){return D};var L=y.__private__.getPageFormat=function(C){return D[C]};i=i||"a4";var q="compat",$="advanced",Y=q;function ht(){this.saveGraphicsState(),ft(new Ae(We,0,0,-We,0,ma()*We).toString()+" cm"),this.setFontSize(this.getFontSize()/We),d="n",Y=$}function Mt(){this.restoreGraphicsState(),d="S",Y=q}var vt=y.__private__.combineFontStyleAndFontWeight=function(C,U){if(C=="bold"&&U=="normal"||C=="bold"&&U==400||C=="normal"&&U=="italic"||C=="bold"&&U=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return U&&(C=U==400||U==="normal"?C==="italic"?"italic":"normal":U!=700&&U!=="bold"||C!=="normal"?(U==700?"bold":U)+""+C:"bold"),C};y.advancedAPI=function(C){var U=Y===q;return U&&ht.call(this),typeof C!="function"||(C(this),U&&Mt.call(this)),this},y.compatAPI=function(C){var U=Y===$;return U&&Mt.call(this),typeof C!="function"||(C(this),U&&ht.call(this)),this},y.isAdvancedAPI=function(){return Y===$};var bt,rt=function(C){if(Y!==$)throw new Error(C+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},Dt=y.roundToPrecision=y.__private__.roundToPrecision=function(C,U){var pt=t||U;if(isNaN(C)||isNaN(pt))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return C.toFixed(pt).replace(/0+$/,"")};bt=y.hpf=y.__private__.hpf=typeof f=="number"?function(C){if(isNaN(C))throw new Error("Invalid argument passed to jsPDF.hpf");return Dt(C,f)}:f==="smart"?function(C){if(isNaN(C))throw new Error("Invalid argument passed to jsPDF.hpf");return Dt(C,C>-1&&C<1?16:5)}:function(C){if(isNaN(C))throw new Error("Invalid argument passed to jsPDF.hpf");return Dt(C,16)};var Q=y.f2=y.__private__.f2=function(C){if(isNaN(C))throw new Error("Invalid argument passed to jsPDF.f2");return Dt(C,2)},lt=y.__private__.f3=function(C){if(isNaN(C))throw new Error("Invalid argument passed to jsPDF.f3");return Dt(C,3)},X=y.scale=y.__private__.scale=function(C){if(isNaN(C))throw new Error("Invalid argument passed to jsPDF.scale");return Y===q?C*We:Y===$?C:void 0},wt=function(C){return X((function(U){return Y===q?ma()-U:Y===$?U:void 0})(C))};y.__private__.setPrecision=y.setPrecision=function(C){typeof parseInt(C,10)=="number"&&(t=parseInt(C,10))};var Tt,yt="00000000000000000000000000000000",J=y.__private__.getFileId=function(){return yt},ct=y.__private__.setFileId=function(C){return yt=C!==void 0&&/^[a-fA-F0-9]{32}$/.test(C)?C.toUpperCase():yt.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),p!==null&&(Qi=new Kd(p.userPermissions,p.userPassword,p.ownerPassword,yt)),yt};y.setFileId=function(C){return ct(C),this},y.getFileId=function(){return J()};var Bt=y.__private__.convertDateToPDFDate=function(C){var U=C.getTimezoneOffset(),pt=U<0?"+":"-",Et=Math.floor(Math.abs(U/60)),zt=Math.abs(U%60),oe=[pt,G(Et),"'",G(zt),"'"].join("");return["D:",C.getFullYear(),G(C.getMonth()+1),G(C.getDate()),G(C.getHours()),G(C.getMinutes()),G(C.getSeconds()),oe].join("")},te=y.__private__.convertPDFDateToDate=function(C){var U=parseInt(C.substr(2,4),10),pt=parseInt(C.substr(6,2),10)-1,Et=parseInt(C.substr(8,2),10),zt=parseInt(C.substr(10,2),10),oe=parseInt(C.substr(12,2),10),me=parseInt(C.substr(14,2),10);return new Date(U,pt,Et,zt,oe,me,0)},Z=y.__private__.setCreationDate=function(C){var U;if(C===void 0&&(C=new Date),C instanceof Date)U=Bt(C);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(C))throw new Error("Invalid argument passed to jsPDF.setCreationDate");U=C}return Tt=U},P=y.__private__.getCreationDate=function(C){var U=Tt;return C==="jsDate"&&(U=te(Tt)),U};y.setCreationDate=function(C){return Z(C),this},y.getCreationDate=function(C){return P(C)};var j,G=y.__private__.padd2=function(C){return("0"+parseInt(C)).slice(-2)},ut=y.__private__.padd2Hex=function(C){return("00"+(C=C.toString())).substr(C.length)},xt=0,St=[],Ft=[],Rt=0,Qt=[],ve=[],je=!1,Pe=Ft;y.__private__.setCustomOutputDestination=function(C){je=!0,Pe=C};var Ve=function(C){je||(Pe=C)};y.__private__.resetCustomOutputDestination=function(){je=!1,Pe=Ft};var ft=y.__private__.out=function(C){return C=C.toString(),Rt+=C.length+1,Pe.push(C),Pe},Oe=y.__private__.write=function(C){return ft(arguments.length===1?C.toString():Array.prototype.join.call(arguments," "))},In=y.__private__.getArrayBuffer=function(C){for(var U=C.length,pt=new ArrayBuffer(U),Et=new Uint8Array(pt);U--;)Et[U]=C.charCodeAt(U);return pt},fe=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];y.__private__.getStandardFonts=function(){return fe};var ge=e.fontSize||16;y.__private__.setFontSize=y.setFontSize=function(C){return ge=Y===$?C/We:C,this};var Te,Ne=y.__private__.getFontSize=y.getFontSize=function(){return Y===q?ge:ge*We},_e=e.R2L||!1;y.__private__.setR2L=y.setR2L=function(C){return _e=C,this},y.__private__.getR2L=y.getR2L=function(){return _e};var Ye,un=y.__private__.setZoomMode=function(C){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(C))Te=C;else if(isNaN(C)){if([void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(C)===-1)throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+C+'" is not recognized.');Te=C}else Te=parseInt(C,10)};y.__private__.getZoomMode=function(){return Te};var Fn,Ue=y.__private__.setPageMode=function(C){if([void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(C)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+C+'" is not recognized.');Ye=C};y.__private__.getPageMode=function(){return Ye};var _n=y.__private__.setLayoutMode=function(C){if([void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(C)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+C+'" is not recognized.');Fn=C};y.__private__.getLayoutMode=function(){return Fn},y.__private__.setDisplayMode=y.setDisplayMode=function(C,U,pt){return un(C),_n(U),Ue(pt),this};var dn={title:"",subject:"",author:"",keywords:"",creator:""};y.__private__.getDocumentProperty=function(C){if(Object.keys(dn).indexOf(C)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return dn[C]},y.__private__.getDocumentProperties=function(){return dn},y.__private__.setDocumentProperties=y.setProperties=y.setDocumentProperties=function(C){for(var U in dn)dn.hasOwnProperty(U)&&C[U]&&(dn[U]=C[U]);return this},y.__private__.setDocumentProperty=function(C,U){if(Object.keys(dn).indexOf(C)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return dn[C]=U};var Be,We,Ie,kr,Cn,nn={},ln={},Ln=[],Ke={},ar={},wn={},Sn={},gr=null,En=0,en=[],Kn=new Qw(y),ws=e.hotfixes||[],qi={},Xt={},Re=[],Ae=function C(U,pt,Et,zt,oe,me){if(!(this instanceof C))return new C(U,pt,Et,zt,oe,me);isNaN(U)&&(U=1),isNaN(pt)&&(pt=0),isNaN(Et)&&(Et=0),isNaN(zt)&&(zt=1),isNaN(oe)&&(oe=0),isNaN(me)&&(me=0),this._matrix=[U,pt,Et,zt,oe,me]};Object.defineProperty(Ae.prototype,"sx",{get:function(){return this._matrix[0]},set:function(C){this._matrix[0]=C}}),Object.defineProperty(Ae.prototype,"shy",{get:function(){return this._matrix[1]},set:function(C){this._matrix[1]=C}}),Object.defineProperty(Ae.prototype,"shx",{get:function(){return this._matrix[2]},set:function(C){this._matrix[2]=C}}),Object.defineProperty(Ae.prototype,"sy",{get:function(){return this._matrix[3]},set:function(C){this._matrix[3]=C}}),Object.defineProperty(Ae.prototype,"tx",{get:function(){return this._matrix[4]},set:function(C){this._matrix[4]=C}}),Object.defineProperty(Ae.prototype,"ty",{get:function(){return this._matrix[5]},set:function(C){this._matrix[5]=C}}),Object.defineProperty(Ae.prototype,"a",{get:function(){return this._matrix[0]},set:function(C){this._matrix[0]=C}}),Object.defineProperty(Ae.prototype,"b",{get:function(){return this._matrix[1]},set:function(C){this._matrix[1]=C}}),Object.defineProperty(Ae.prototype,"c",{get:function(){return this._matrix[2]},set:function(C){this._matrix[2]=C}}),Object.defineProperty(Ae.prototype,"d",{get:function(){return this._matrix[3]},set:function(C){this._matrix[3]=C}}),Object.defineProperty(Ae.prototype,"e",{get:function(){return this._matrix[4]},set:function(C){this._matrix[4]=C}}),Object.defineProperty(Ae.prototype,"f",{get:function(){return this._matrix[5]},set:function(C){this._matrix[5]=C}}),Object.defineProperty(Ae.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(Ae.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(Ae.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(Ae.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),Ae.prototype.join=function(C){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(bt).join(C)},Ae.prototype.multiply=function(C){var U=C.sx*this.sx+C.shy*this.shx,pt=C.sx*this.shy+C.shy*this.sy,Et=C.shx*this.sx+C.sy*this.shx,zt=C.shx*this.shy+C.sy*this.sy,oe=C.tx*this.sx+C.ty*this.shx+this.tx,me=C.tx*this.shy+C.ty*this.sy+this.ty;return new Ae(U,pt,Et,zt,oe,me)},Ae.prototype.decompose=function(){var C=this.sx,U=this.shy,pt=this.shx,Et=this.sy,zt=this.tx,oe=this.ty,me=Math.sqrt(C*C+U*U),Xe=(C/=me)*pt+(U/=me)*Et;pt-=C*Xe,Et-=U*Xe;var on=Math.sqrt(pt*pt+Et*Et);return Xe/=on,C*(Et/=on)<U*(pt/=on)&&(C=-C,U=-U,Xe=-Xe,me=-me),{scale:new Ae(me,0,0,on,0,0),translate:new Ae(1,0,0,1,zt,oe),rotate:new Ae(C,U,-U,C,0,0),skew:new Ae(1,0,Xe,1,0,0)}},Ae.prototype.toString=function(C){return this.join(" ")},Ae.prototype.inversed=function(){var C=this.sx,U=this.shy,pt=this.shx,Et=this.sy,zt=this.tx,oe=this.ty,me=1/(C*Et-U*pt),Xe=Et*me,on=-U*me,zn=-pt*me,Un=C*me;return new Ae(Xe,on,zn,Un,-Xe*zt-zn*oe,-on*zt-Un*oe)},Ae.prototype.applyToPoint=function(C){var U=C.x*this.sx+C.y*this.shx+this.tx,pt=C.x*this.shy+C.y*this.sy+this.ty;return new Ta(U,pt)},Ae.prototype.applyToRectangle=function(C){var U=this.applyToPoint(C),pt=this.applyToPoint(new Ta(C.x+C.w,C.y+C.h));return new Ks(U.x,U.y,pt.x-U.x,pt.y-U.y)},Ae.prototype.clone=function(){var C=this.sx,U=this.shy,pt=this.shx,Et=this.sy,zt=this.tx,oe=this.ty;return new Ae(C,U,pt,Et,zt,oe)},y.Matrix=Ae;var De=y.matrixMult=function(C,U){return U.multiply(C)},or=new Ae(1,0,0,1,0,0);y.unitMatrix=y.identityMatrix=or;var Hn=function(C,U){if(!ar[C]){var pt=(U instanceof Jf?"Sh":"P")+(Object.keys(Ke).length+1).toString(10);U.id=pt,ar[C]=pt,Ke[pt]=U,Kn.publish("addPattern",U)}};y.ShadingPattern=Jf,y.TilingPattern=rh,y.addShadingPattern=function(C,U){return rt("addShadingPattern()"),Hn(C,U),this},y.beginTilingPattern=function(C){rt("beginTilingPattern()"),Js(C.boundingBox[0],C.boundingBox[1],C.boundingBox[2]-C.boundingBox[0],C.boundingBox[3]-C.boundingBox[1],C.matrix)},y.endTilingPattern=function(C,U){rt("endTilingPattern()"),U.stream=ve[j].join(`
11
+ `),Hn(C,U),Kn.publish("endTilingPattern",U),Re.pop().restore()};var lr,Wr=y.__private__.newObject=function(){var C=Dr();return vi(C,!0),C},Dr=y.__private__.newObjectDeferred=function(){return xt++,St[xt]=function(){return Rt},xt},vi=function(C,U){return U=typeof U=="boolean"&&U,St[C]=Rt,U&&ft(C+" 0 obj"),C},Wt=y.__private__.newAdditionalObject=function(){var C={objId:Dr(),content:""};return Qt.push(C),C},qr=Dr(),er=Dr(),Rn=y.__private__.decodeColorString=function(C){var U=C.split(" ");if(U.length!==2||U[1]!=="g"&&U[1]!=="G")U.length!==5||U[4]!=="k"&&U[4]!=="K"||(U=[(1-U[0])*(1-U[3]),(1-U[1])*(1-U[3]),(1-U[2])*(1-U[3]),"r"]);else{var pt=parseFloat(U[0]);U=[pt,pt,pt,"r"]}for(var Et="#",zt=0;zt<3;zt++)Et+=("0"+Math.floor(255*parseFloat(U[zt])).toString(16)).slice(-2);return Et},oo=y.__private__.encodeColorString=function(C){var U;typeof C=="string"&&(C={ch1:C});var pt=C.ch1,Et=C.ch2,zt=C.ch3,oe=C.ch4,me=C.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof pt=="string"&&pt.charAt(0)!=="#"){var Xe=new F4(pt);if(Xe.ok)pt=Xe.toHex();else if(!/^\d*\.?\d*$/.test(pt))throw new Error('Invalid color "'+pt+'" passed to jsPDF.encodeColorString.')}if(typeof pt=="string"&&/^#[0-9A-Fa-f]{3}$/.test(pt)&&(pt="#"+pt[1]+pt[1]+pt[2]+pt[2]+pt[3]+pt[3]),typeof pt=="string"&&/^#[0-9A-Fa-f]{6}$/.test(pt)){var on=parseInt(pt.substr(1),16);pt=on>>16&255,Et=on>>8&255,zt=255&on}if(Et===void 0||oe===void 0&&pt===Et&&Et===zt)U=typeof pt=="string"?pt+" "+me[0]:C.precision===2?Q(pt/255)+" "+me[0]:lt(pt/255)+" "+me[0];else if(oe===void 0||ii(oe)==="object"){if(oe&&!isNaN(oe.a)&&oe.a===0)return["1.","1.","1.",me[1]].join(" ");U=typeof pt=="string"?[pt,Et,zt,me[1]].join(" "):C.precision===2?[Q(pt/255),Q(Et/255),Q(zt/255),me[1]].join(" "):[lt(pt/255),lt(Et/255),lt(zt/255),me[1]].join(" ")}else U=typeof pt=="string"?[pt,Et,zt,oe,me[2]].join(" "):C.precision===2?[Q(pt),Q(Et),Q(zt),Q(oe),me[2]].join(" "):[lt(pt),lt(Et),lt(zt),lt(oe),me[2]].join(" ");return U},Wo=y.__private__.getFilters=function(){return l},Us=y.__private__.putStream=function(C){var U=(C=C||{}).data||"",pt=C.filters||Wo(),Et=C.alreadyAppliedFilters||[],zt=C.addLength1||!1,oe=U.length,me=C.objectId,Xe=function(oi){return oi};if(p!==null&&me===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");p!==null&&(Xe=Qi.encryptor(me,0));var on={};pt===!0&&(pt=["FlateEncode"]);var zn=C.additionalKeyValues||[],Un=(on=xn.API.processDataByFilters!==void 0?xn.API.processDataByFilters(U,pt):{data:U,reverseChain:[]}).reverseChain+(Array.isArray(Et)?Et.join(" "):Et.toString());if(on.data.length!==0&&(zn.push({key:"Length",value:on.data.length}),zt===!0&&zn.push({key:"Length1",value:oe})),Un.length!=0)if(Un.split("/").length-1==1)zn.push({key:"Filter",value:Un});else{zn.push({key:"Filter",value:"["+Un+"]"});for(var cr=0;cr<zn.length;cr+=1)if(zn[cr].key==="DecodeParms"){for(var Yi=[],Si=0;Si<on.reverseChain.split("/").length-1;Si+=1)Yi.push("null");Yi.push(zn[cr].value),zn[cr].value="["+Yi.join(" ")+"]"}}ft("<<");for(var Lr=0;Lr<zn.length;Lr++)ft("/"+zn[Lr].key+" "+zn[Lr].value);ft(">>"),on.data.length!==0&&(ft("stream"),ft(Xe(on.data)),ft("endstream"))},Ja=y.__private__.putPage=function(C){var U=C.number,pt=C.data,Et=C.objId,zt=C.contentsObjId;vi(Et,!0),ft("<</Type /Page"),ft("/Parent "+C.rootDictionaryObjId+" 0 R"),ft("/Resources "+C.resourceDictionaryObjId+" 0 R"),ft("/MediaBox ["+parseFloat(bt(C.mediaBox.bottomLeftX))+" "+parseFloat(bt(C.mediaBox.bottomLeftY))+" "+bt(C.mediaBox.topRightX)+" "+bt(C.mediaBox.topRightY)+"]"),C.cropBox!==null&&ft("/CropBox ["+bt(C.cropBox.bottomLeftX)+" "+bt(C.cropBox.bottomLeftY)+" "+bt(C.cropBox.topRightX)+" "+bt(C.cropBox.topRightY)+"]"),C.bleedBox!==null&&ft("/BleedBox ["+bt(C.bleedBox.bottomLeftX)+" "+bt(C.bleedBox.bottomLeftY)+" "+bt(C.bleedBox.topRightX)+" "+bt(C.bleedBox.topRightY)+"]"),C.trimBox!==null&&ft("/TrimBox ["+bt(C.trimBox.bottomLeftX)+" "+bt(C.trimBox.bottomLeftY)+" "+bt(C.trimBox.topRightX)+" "+bt(C.trimBox.topRightY)+"]"),C.artBox!==null&&ft("/ArtBox ["+bt(C.artBox.bottomLeftX)+" "+bt(C.artBox.bottomLeftY)+" "+bt(C.artBox.topRightX)+" "+bt(C.artBox.topRightY)+"]"),typeof C.userUnit=="number"&&C.userUnit!==1&&ft("/UserUnit "+C.userUnit),Kn.publish("putPage",{objId:Et,pageContext:en[U],pageNumber:U,page:pt}),ft("/Contents "+zt+" 0 R"),ft(">>"),ft("endobj");var oe=pt.join(`
12
+ `);return Y===$&&(oe+=`
13
+ Q`),vi(zt,!0),Us({data:oe,filters:Wo(),objectId:zt}),ft("endobj"),Et},Hs=y.__private__.putPages=function(){var C,U,pt=[];for(C=1;C<=En;C++)en[C].objId=Dr(),en[C].contentsObjId=Dr();for(C=1;C<=En;C++)pt.push(Ja({number:C,data:ve[C],objId:en[C].objId,contentsObjId:en[C].contentsObjId,mediaBox:en[C].mediaBox,cropBox:en[C].cropBox,bleedBox:en[C].bleedBox,trimBox:en[C].trimBox,artBox:en[C].artBox,userUnit:en[C].userUnit,rootDictionaryObjId:qr,resourceDictionaryObjId:er}));vi(qr,!0),ft("<</Type /Pages");var Et="/Kids [";for(U=0;U<En;U++)Et+=pt[U]+" 0 R ";ft(Et+"]"),ft("/Count "+En),ft(">>"),ft("endobj"),Kn.publish("postPutPages")},Lo=function(C){Kn.publish("putFont",{font:C,out:ft,newObject:Wr,putStream:Us}),C.isAlreadyPutted!==!0&&(C.objectNumber=Wr(),ft("<<"),ft("/Type /Font"),ft("/BaseFont /"+Jd(C.postScriptName)),ft("/Subtype /Type1"),typeof C.encoding=="string"&&ft("/Encoding /"+C.encoding),ft("/FirstChar 32"),ft("/LastChar 255"),ft(">>"),ft("endobj"))},is=function(C){C.objectNumber=Wr();var U=[];U.push({key:"Type",value:"/XObject"}),U.push({key:"Subtype",value:"/Form"}),U.push({key:"BBox",value:"["+[bt(C.x),bt(C.y),bt(C.x+C.width),bt(C.y+C.height)].join(" ")+"]"}),U.push({key:"Matrix",value:"["+C.matrix.toString()+"]"});var pt=C.pages[1].join(`
14
+ `);Us({data:pt,additionalKeyValues:U,objectId:C.objectNumber}),ft("endobj")},qs=function(C,U){U||(U=21);var pt=Wr(),Et=(function(me,Xe){var on,zn=[],Un=1/(Xe-1);for(on=0;on<1;on+=Un)zn.push(on);if(zn.push(1),me[0].offset!=0){var cr={offset:0,color:me[0].color};me.unshift(cr)}if(me[me.length-1].offset!=1){var Yi={offset:1,color:me[me.length-1].color};me.push(Yi)}for(var Si="",Lr=0,oi=0;oi<zn.length;oi++){for(on=zn[oi];on>me[Lr+1].offset;)Lr++;var Di=me[Lr].offset,si=(on-Di)/(me[Lr+1].offset-Di),ao=me[Lr].color,ta=me[Lr+1].color;Si+=ut(Math.round((1-si)*ao[0]+si*ta[0]).toString(16))+ut(Math.round((1-si)*ao[1]+si*ta[1]).toString(16))+ut(Math.round((1-si)*ao[2]+si*ta[2]).toString(16))}return Si.trim()})(C.colors,U),zt=[];zt.push({key:"FunctionType",value:"0"}),zt.push({key:"Domain",value:"[0.0 1.0]"}),zt.push({key:"Size",value:"["+U+"]"}),zt.push({key:"BitsPerSample",value:"8"}),zt.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),zt.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),Us({data:Et,additionalKeyValues:zt,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:pt}),ft("endobj"),C.objectNumber=Wr(),ft("<< /ShadingType "+C.type),ft("/ColorSpace /DeviceRGB");var oe="/Coords ["+bt(parseFloat(C.coords[0]))+" "+bt(parseFloat(C.coords[1]))+" ";C.type===2?oe+=bt(parseFloat(C.coords[2]))+" "+bt(parseFloat(C.coords[3])):oe+=bt(parseFloat(C.coords[2]))+" "+bt(parseFloat(C.coords[3]))+" "+bt(parseFloat(C.coords[4]))+" "+bt(parseFloat(C.coords[5])),ft(oe+="]"),C.matrix&&ft("/Matrix ["+C.matrix.toString()+"]"),ft("/Function "+pt+" 0 R"),ft("/Extend [true true]"),ft(">>"),ft("endobj")},pi=function(C,U){var pt=Dr(),Et=Wr();U.push({resourcesOid:pt,objectOid:Et}),C.objectNumber=Et;var zt=[];zt.push({key:"Type",value:"/Pattern"}),zt.push({key:"PatternType",value:"1"}),zt.push({key:"PaintType",value:"1"}),zt.push({key:"TilingType",value:"1"}),zt.push({key:"BBox",value:"["+C.boundingBox.map(bt).join(" ")+"]"}),zt.push({key:"XStep",value:bt(C.xStep)}),zt.push({key:"YStep",value:bt(C.yStep)}),zt.push({key:"Resources",value:pt+" 0 R"}),C.matrix&&zt.push({key:"Matrix",value:"["+C.matrix.toString()+"]"}),Us({data:C.stream,additionalKeyValues:zt,objectId:C.objectNumber}),ft("endobj")},Ar=function(C){for(var U in C.objectNumber=Wr(),ft("<<"),C)switch(U){case"opacity":ft("/ca "+Q(C[U]));break;case"stroke-opacity":ft("/CA "+Q(C[U]))}ft(">>"),ft("endobj")},Aa=function(C){vi(C.resourcesOid,!0),ft("<<"),ft("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),(function(){for(var U in ft("/Font <<"),nn)nn.hasOwnProperty(U)&&(g===!1||g===!0&&b.hasOwnProperty(U))&&ft("/"+U+" "+nn[U].objectNumber+" 0 R");ft(">>")})(),(function(){if(Object.keys(Ke).length>0){for(var U in ft("/Shading <<"),Ke)Ke.hasOwnProperty(U)&&Ke[U]instanceof Jf&&Ke[U].objectNumber>=0&&ft("/"+U+" "+Ke[U].objectNumber+" 0 R");Kn.publish("putShadingPatternDict"),ft(">>")}})(),(function(U){if(Object.keys(Ke).length>0){for(var pt in ft("/Pattern <<"),Ke)Ke.hasOwnProperty(pt)&&Ke[pt]instanceof y.TilingPattern&&Ke[pt].objectNumber>=0&&Ke[pt].objectNumber<U&&ft("/"+pt+" "+Ke[pt].objectNumber+" 0 R");Kn.publish("putTilingPatternDict"),ft(">>")}})(C.objectOid),(function(){if(Object.keys(wn).length>0){var U;for(U in ft("/ExtGState <<"),wn)wn.hasOwnProperty(U)&&wn[U].objectNumber>=0&&ft("/"+U+" "+wn[U].objectNumber+" 0 R");Kn.publish("putGStateDict"),ft(">>")}})(),(function(){for(var U in ft("/XObject <<"),qi)qi.hasOwnProperty(U)&&qi[U].objectNumber>=0&&ft("/"+U+" "+qi[U].objectNumber+" 0 R");Kn.publish("putXobjectDict"),ft(">>")})(),ft(">>"),ft("endobj")},Ti=function(C){ln[C.fontName]=ln[C.fontName]||{},ln[C.fontName][C.fontStyle]=C.id},Wl=function(C,U,pt,Et,zt){var oe={id:"F"+(Object.keys(nn).length+1).toString(10),postScriptName:C,fontName:U,fontStyle:pt,encoding:Et,isStandardFont:zt||!1,metadata:{}};return Kn.publish("addFont",{font:oe,instance:this}),nn[oe.id]=oe,Ti(oe),oe.id},Xo=y.__private__.pdfEscape=y.pdfEscape=function(C,U){return(function(pt,Et){var zt,oe,me,Xe,on,zn,Un,cr,Yi;if(me=(Et=Et||{}).sourceEncoding||"Unicode",on=Et.outputEncoding,(Et.autoencode||on)&&nn[Be].metadata&&nn[Be].metadata[me]&&nn[Be].metadata[me].encoding&&(Xe=nn[Be].metadata[me].encoding,!on&&nn[Be].encoding&&(on=nn[Be].encoding),!on&&Xe.codePages&&(on=Xe.codePages[0]),typeof on=="string"&&(on=Xe[on]),on)){for(Un=!1,zn=[],zt=0,oe=pt.length;zt<oe;zt++)(cr=on[pt.charCodeAt(zt)])?zn.push(String.fromCharCode(cr)):zn.push(pt[zt]),zn[zt].charCodeAt(0)>>8&&(Un=!0);pt=zn.join("")}for(zt=pt.length;Un===void 0&&zt!==0;)pt.charCodeAt(zt-1)>>8&&(Un=!0),zt--;if(!Un)return pt;for(zn=Et.noBOM?[]:[254,255],zt=0,oe=pt.length;zt<oe;zt++){if((Yi=(cr=pt.charCodeAt(zt))>>8)>>8)throw new Error("Character at position "+zt+" of string '"+pt+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");zn.push(Yi),zn.push(cr-(Yi<<8))}return String.fromCharCode.apply(void 0,zn)})(C,U).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Go=y.__private__.beginPage=function(C){ve[++En]=[],en[En]={objId:0,contentsObjId:0,userUnit:Number(c),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(C[0]),topRightY:Number(C[1])}},Ca(En),Ve(ve[j])},Ma=function(C,U){var pt,Et,zt;switch(n=U||n,typeof C=="string"&&(pt=L(C.toLowerCase()),Array.isArray(pt)&&(Et=pt[0],zt=pt[1])),Array.isArray(C)&&(Et=C[0]*We,zt=C[1]*We),isNaN(Et)&&(Et=i[0],zt=i[1]),(Et>14400||zt>14400)&&(yi.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),Et=Math.min(14400,Et),zt=Math.min(14400,zt)),i=[Et,zt],n.substr(0,1)){case"l":zt>Et&&(i=[zt,Et]);break;case"p":Et>zt&&(i=[zt,Et])}Go(i),Nc(An),ft(Xs),As!==0&&ft(As+" J"),us!==0&&ft(us+" j"),Kn.publish("addPage",{pageNumber:En})},Mc=function(C){C>0&&C<=En&&(ve.splice(C,1),en.splice(C,1),En--,j>En&&(j=En),this.setPage(j))},Ca=function(C){C>0&&C<=En&&(j=C)},Cc=y.__private__.getNumberOfPages=y.getNumberOfPages=function(){return ve.length-1},jf=function(C,U,pt){var Et,zt=void 0;return pt=pt||{},C=C!==void 0?C:nn[Be].fontName,U=U!==void 0?U:nn[Be].fontStyle,Et=C.toLowerCase(),ln[Et]!==void 0&&ln[Et][U]!==void 0?zt=ln[Et][U]:ln[C]!==void 0&&ln[C][U]!==void 0?zt=ln[C][U]:pt.disableWarning===!1&&yi.warn("Unable to look up font label for font '"+C+"', '"+U+"'. Refer to getFontList() for available fonts."),zt||pt.noFallback||(zt=ln.times[U])==null&&(zt=ln.times.normal),zt},$s=y.__private__.putInfo=function(){var C=Wr(),U=function(Et){return Et};for(var pt in p!==null&&(U=Qi.encryptor(C,0)),ft("<<"),ft("/Producer ("+Xo(U("jsPDF "+xn.version))+")"),dn)dn.hasOwnProperty(pt)&&dn[pt]&&ft("/"+pt.substr(0,1).toUpperCase()+pt.substr(1)+" ("+Xo(U(dn[pt]))+")");ft("/CreationDate ("+Xo(U(Tt))+")"),ft(">>"),ft("endobj")},Ea=y.__private__.putCatalog=function(C){var U=(C=C||{}).rootDictionaryObjId||qr;switch(Wr(),ft("<<"),ft("/Type /Catalog"),ft("/Pages "+U+" 0 R"),Te||(Te="fullwidth"),Te){case"fullwidth":ft("/OpenAction [3 0 R /FitH null]");break;case"fullheight":ft("/OpenAction [3 0 R /FitV null]");break;case"fullpage":ft("/OpenAction [3 0 R /Fit]");break;case"original":ft("/OpenAction [3 0 R /XYZ null null 1]");break;default:var pt=""+Te;pt.substr(pt.length-1)==="%"&&(Te=parseInt(Te)/100),typeof Te=="number"&&ft("/OpenAction [3 0 R /XYZ null null "+Q(Te)+"]")}switch(Fn||(Fn="continuous"),Fn){case"continuous":ft("/PageLayout /OneColumn");break;case"single":ft("/PageLayout /SinglePage");break;case"two":case"twoleft":ft("/PageLayout /TwoColumnLeft");break;case"tworight":ft("/PageLayout /TwoColumnRight")}Ye&&ft("/PageMode /"+Ye),Kn.publish("putCatalog"),ft(">>"),ft("endobj")},Ys=y.__private__.putTrailer=function(){ft("trailer"),ft("<<"),ft("/Size "+(xt+1)),ft("/Root "+xt+" 0 R"),ft("/Info "+(xt-1)+" 0 R"),p!==null&&ft("/Encrypt "+Qi.oid+" 0 R"),ft("/ID [ <"+yt+"> <"+yt+"> ]"),ft(">>")},sr=y.__private__.putHeader=function(){ft("%PDF-"+M),ft("%ºß¬à")},Ec=y.__private__.putXRef=function(){var C="0000000000";ft("xref"),ft("0 "+(xt+1)),ft("0000000000 65535 f ");for(var U=1;U<=xt;U++)typeof St[U]=="function"?ft((C+St[U]()).slice(-10)+" 00000 n "):St[U]!==void 0?ft((C+St[U]).slice(-10)+" 00000 n "):ft("0000000000 00000 n ")},Ss=y.__private__.buildDocument=function(){var C;xt=0,Rt=0,Ft=[],St=[],Qt=[],qr=Dr(),er=Dr(),Ve(Ft),Kn.publish("buildDocument"),sr(),Hs(),(function(){Kn.publish("putAdditionalObjects");for(var pt=0;pt<Qt.length;pt++){var Et=Qt[pt];vi(Et.objId,!0),ft(Et.content),ft("endobj")}Kn.publish("postPutAdditionalObjects")})(),C=[],(function(){for(var pt in nn)nn.hasOwnProperty(pt)&&(g===!1||g===!0&&b.hasOwnProperty(pt))&&Lo(nn[pt])})(),(function(){var pt;for(pt in wn)wn.hasOwnProperty(pt)&&Ar(wn[pt])})(),(function(){for(var pt in qi)qi.hasOwnProperty(pt)&&is(qi[pt])})(),(function(pt){var Et;for(Et in Ke)Ke.hasOwnProperty(Et)&&(Ke[Et]instanceof Jf?qs(Ke[Et]):Ke[Et]instanceof rh&&pi(Ke[Et],pt))})(C),Kn.publish("putResources"),C.forEach(Aa),Aa({resourcesOid:er,objectOid:Number.MAX_SAFE_INTEGER}),Kn.publish("postPutResources"),p!==null&&(Qi.oid=Wr(),ft("<<"),ft("/Filter /Standard"),ft("/V "+Qi.v),ft("/R "+Qi.r),ft("/U <"+Qi.toHexString(Qi.U)+">"),ft("/O <"+Qi.toHexString(Qi.O)+">"),ft("/P "+Qi.P),ft(">>"),ft("endobj")),$s(),Ea();var U=Rt;return Ec(),Ys(),ft("startxref"),ft(""+U),ft("%%EOF"),Ve(ve[j]),Ft.join(`
15
+ `)},ss=y.__private__.getBlob=function(C){return new Blob([In(C)],{type:"application/pdf"})},Ro=function(C){for(;C.firstChild;)C.removeChild(C.firstChild)},yo=function(C){var U,pt=C.document,Et=pt.documentElement,zt=pt.head,oe=pt.body;return zt||(zt=pt.createElement("head"),Et.appendChild(zt)),oe||(oe=pt.createElement("body"),Et.appendChild(oe)),Ro(zt),Ro(oe),(U=pt.createElement("style")).appendChild(pt.createTextNode("html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;}")),zt.appendChild(U),{document:pt,body:oe}},bl=y.output=y.__private__.output=(lr=function(C,U){switch(typeof(U=U||{})=="string"?U={filename:U}:U.filename=U.filename||"generated.pdf",C){case void 0:return Ss();case"save":y.save(U.filename);break;case"arraybuffer":return In(Ss());case"blob":return ss(Ss());case"bloburi":case"bloburl":if(Qn.URL!==void 0&&typeof Qn.URL.createObjectURL=="function")return Qn.URL&&Qn.URL.createObjectURL(ss(Ss()))||void 0;yi.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var pt="",Et=Ss();try{pt=Kw(Et)}catch{pt=Kw(unescape(encodeURIComponent(Et)))}return"data:application/pdf;filename="+encodeURIComponent(U.filename)+";base64,"+pt;case"pdfobjectnewwindow":case"pdfjsnewwindow":throw new Error("jsPDF viewer output modes are disabled in this build.");case"dataurlnewwindow":if(Object.prototype.toString.call(Qn)!=="[object Window]")throw new Error("The option dataurlnewwindow just works in a browser-environment.");var zt=Qn.open();if(zt!==null){var oe=yo(zt),me=oe.document.createElement("iframe");me.src=this.output("datauristring",U),oe.body.appendChild(me),zt.document.title=U.filename}if(zt||typeof safari>"u")return zt;break;case"datauri":case"dataurl":return Qn.document.location.href=this.output("datauristring",U);default:return null}},lr.foo=function(){try{return lr.apply(this,arguments)}catch(pt){var C=pt.stack||"";~C.indexOf(" at ")&&(C=C.split(" at ")[1]);var U="Error in function "+C.split(`
16
+ `)[0].split("<")[0]+": "+pt.message;if(!Qn.console)throw new Error(U);Qn.console.error(U,pt),Qn.alert&&alert(U)}},lr.foo.bar=lr,lr.foo),Ni=function(C){return Array.isArray(ws)===!0&&ws.indexOf(C)>-1};switch(r){case"pt":We=1;break;case"mm":We=72/25.4;break;case"cm":We=72/2.54;break;case"in":We=72;break;case"px":We=Ni("px_scaling")==1?.75:96/72;break;case"pc":case"em":We=12;break;case"ex":We=6;break;default:if(typeof r!="number")throw new Error("Invalid unit: "+r);We=r}var Qi=null;Z(),ct();var Tc=y.__private__.getPageInfo=y.getPageInfo=function(C){if(isNaN(C)||C%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfo");return{objId:en[C].objId,pageNumber:C,pageContext:en[C]}},Za=y.__private__.getPageInfoByObjId=function(C){if(isNaN(C)||C%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");for(var U in en)if(en[U].objId===C)break;return Tc(U)},_i=y.__private__.getCurrentPageInfo=y.getCurrentPageInfo=function(){return{objId:en[j].objId,pageNumber:j,pageContext:en[j]}};y.addPage=function(){return Ma.apply(this,arguments),this},y.setPage=function(){return Ca.apply(this,arguments),Ve.call(this,ve[j]),this},y.insertPage=function(C){return this.addPage(),this.movePage(j,C),this},y.movePage=function(C,U){var pt,Et;if(C>U){pt=ve[C],Et=en[C];for(var zt=C;zt>U;zt--)ve[zt]=ve[zt-1],en[zt]=en[zt-1];ve[U]=pt,en[U]=Et,this.setPage(U)}else if(C<U){pt=ve[C],Et=en[C];for(var oe=C;oe<U;oe++)ve[oe]=ve[oe+1],en[oe]=en[oe+1];ve[U]=pt,en[U]=Et,this.setPage(U)}return this},y.deletePage=function(){return Mc.apply(this,arguments),this},y.__private__.text=y.text=function(C,U,pt,Et,zt){var oe,me,Xe,on,zn,Un,cr,Yi,Si,Lr=(Et=Et||{}).scope||this;if(typeof C=="number"&&typeof U=="number"&&(typeof pt=="string"||Array.isArray(pt))){var oi=pt;pt=U,U=C,C=oi}if(arguments[3]instanceof Ae==0?(Xe=arguments[4],on=arguments[5],ii(cr=arguments[3])==="object"&&cr!==null||(typeof Xe=="string"&&(on=Xe,Xe=null),typeof cr=="string"&&(on=cr,cr=null),typeof cr=="number"&&(Xe=cr,cr=null),Et={flags:cr,angle:Xe,align:on})):(rt("The transform parameter of text() with a Matrix value"),Si=zt),isNaN(U)||isNaN(pt)||C==null)throw new Error("Invalid arguments passed to jsPDF.text");if(C.length===0)return Lr;var Di,si="",ao=typeof Et.lineHeightFactor=="number"?Et.lineHeightFactor:bo,ta=Lr.internal.scaleFactor;function kl(ur){return ur=ur.split(" ").join(Array(Et.TabLen||9).join(" ")),Xo(ur,cr)}function fs(ur){for(var jr,ai=ur.concat(),Qr=[],va=ai.length;va--;)typeof(jr=ai.shift())=="string"?Qr.push(jr):Array.isArray(ur)&&(jr.length===1||jr[1]===void 0&&jr[2]===void 0)?Qr.push(jr[0]):Qr.push([jr[0],jr[1],jr[2]]);return Qr}function ds(ur,jr){var ai;if(typeof ur=="string")ai=jr(ur)[0];else if(Array.isArray(ur)){for(var Qr,va,Dc=ur.concat(),sc=[],ou=Dc.length;ou--;)typeof(Qr=Dc.shift())=="string"?sc.push(jr(Qr)[0]):Array.isArray(Qr)&&typeof Qr[0]=="string"&&(va=jr(Qr[0],Qr[1],Qr[2]),sc.push([va[0],va[1],va[2]]));ai=sc}return ai}var ga=!1,ya=!0;if(typeof C=="string")ga=!0;else if(Array.isArray(C)){var Na=C.concat();me=[];for(var Al,ce=Na.length;ce--;)(typeof(Al=Na.shift())!="string"||Array.isArray(Al)&&typeof Al[0]!="string")&&(ya=!1);ga=ya}if(ga===!1)throw new Error('Type of text must be string or Array. "'+C+'" is not recognized.');typeof C=="string"&&(C=C.match(/[\r?\n]/)?C.split(/\r\n|\r|\n/g):[C]);var ba=ge/Lr.internal.scaleFactor,xo=ba*(ao-1);switch(Et.baseline){case"bottom":pt-=xo;break;case"top":pt+=ba-xo;break;case"hanging":pt+=ba-2*xo;break;case"middle":pt+=ba/2-xo}if((Un=Et.maxWidth||0)>0&&(typeof C=="string"?C=Lr.splitTextToSize(C,Un):Object.prototype.toString.call(C)==="[object Array]"&&(C=C.reduce(function(ur,jr){return ur.concat(Lr.splitTextToSize(jr,Un))},[]))),oe={text:C,x:U,y:pt,options:Et,mutex:{pdfEscape:Xo,activeFontKey:Be,fonts:nn,activeFontSize:ge}},Kn.publish("preProcessText",oe),C=oe.text,Xe=(Et=oe.options).angle,Si instanceof Ae==0&&Xe&&typeof Xe=="number"){Xe*=Math.PI/180,Et.rotationDirection===0&&(Xe=-Xe),Y===$&&(Xe=-Xe);var On=Math.cos(Xe),gn=Math.sin(Xe);Si=new Ae(On,gn,-gn,On,0,0)}else Xe&&Xe instanceof Ae&&(Si=Xe);Y!==$||Si||(Si=or),(zn=Et.charSpace||tl)!==void 0&&(si+=bt(X(zn))+` Tc
17
+ `,this.setCharSpace(this.getCharSpace()||0)),(Yi=Et.horizontalScale)!==void 0&&(si+=bt(100*Yi)+` Tz
18
+ `),Et.lang;var Zo=-1,tc=Et.renderingMode!==void 0?Et.renderingMode:Et.stroke,ec=Lr.internal.getCurrentPageInfo().pageContext;switch(tc){case 0:case!1:case"fill":Zo=0;break;case 1:case!0:case"stroke":Zo=1;break;case 2:case"fillThenStroke":Zo=2;break;case 3:case"invisible":Zo=3;break;case 4:case"fillAndAddForClipping":Zo=4;break;case 5:case"strokeAndAddPathForClipping":Zo=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":Zo=6;break;case 7:case"addToPathForClipping":Zo=7}var Er=ec.usedRenderingMode!==void 0?ec.usedRenderingMode:-1;Zo!==-1?si+=Zo+` Tr
19
+ `:Er!==-1&&(si+=`0 Tr
20
+ `),Zo!==-1&&(ec.usedRenderingMode=Zo),on=Et.align||"left";var Li,nc=ge*ao,xa=Lr.internal.pageSize.getWidth(),rc=nn[Be];zn=Et.charSpace||tl,Un=Et.maxWidth||0,cr=Object.assign({autoencode:!0,noBOM:!0},Et.flags);var _a=[],Ml=function(ur){return Lr.getStringUnitWidth(ur,{font:rc,charSpace:zn,fontSize:ge,doKerning:!1})*ge/ta};if(Object.prototype.toString.call(C)==="[object Array]"){var Vi;me=fs(C),on!=="left"&&(Li=me.map(Ml));var Po,Cl=0;if(on==="right"){U-=Li[0],C=[],ce=me.length;for(var Da=0;Da<ce;Da++)Da===0?(Po=Ws(U),Vi=Oo(pt)):(Po=X(Cl-Li[Da]),Vi=-nc),C.push([me[Da],Po,Vi]),Cl=Li[Da]}else if(on==="center"){U-=Li[0]/2,C=[],ce=me.length;for(var el=0;el<ce;el++)el===0?(Po=Ws(U),Vi=Oo(pt)):(Po=X((Cl-Li[el])/2),Vi=-nc),C.push([me[el],Po,Vi]),Cl=Li[el]}else if(on==="left"){C=[],ce=me.length;for(var ic=0;ic<ce;ic++)C.push(me[ic])}else if(on==="justify"&&rc.encoding==="Identity-H"){C=[],ce=me.length,Un=Un!==0?Un:xa;for(var nl=0,Ri=0;Ri<ce;Ri++)if(Vi=Ri===0?Oo(pt):-nc,Po=Ri===0?Ws(U):nl,Ri<ce-1){var _c=X((Un-Li[Ri])/(me[Ri].split(" ").length-1)),Or=me[Ri].split(" ");C.push([Or[0]+" ",Po,Vi]),nl=0;for(var jo=1;jo<Or.length;jo++){var La=(Ml(Or[jo-1]+" "+Or[jo])-Ml(Or[jo]))*ta+_c;jo==Or.length-1?C.push([Or[jo],La,0]):C.push([Or[jo]+" ",La,0]),nl-=La}}else C.push([me[Ri],Po,Vi]);C.push(["",nl,0])}else{if(on!=="justify")throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');for(C=[],ce=me.length,Un=Un!==0?Un:xa,Ri=0;Ri<ce;Ri++){Vi=Ri===0?Oo(pt):-nc,Po=Ri===0?Ws(U):0;var oc=me[Ri].split(" ").length-1,hs=oc>0?(Un-Li[Ri])/oc:0;Ri<ce-1?_a.push(bt(X(hs))):_a.push(0),C.push([me[Ri],Po,Vi])}}}(typeof Et.R2L=="boolean"?Et.R2L:_e)===!0&&(C=ds(C,function(ur,jr,ai){return[ur.split("").reverse().join(""),jr,ai]})),oe={text:C,x:U,y:pt,options:Et,mutex:{pdfEscape:Xo,activeFontKey:Be,fonts:nn,activeFontSize:ge}},Kn.publish("postProcessText",oe),C=oe.text,Di=oe.mutex.isHex||!1;var eo=nn[Be].encoding;eo!=="WinAnsiEncoding"&&eo!=="StandardEncoding"||(C=ds(C,function(ur,jr,ai){return[kl(ur),jr,ai]})),me=fs(C),C=[];for(var ea,Qo,ts,na=Array.isArray(me[0])?1:0,ps="",xe=function(ur,jr,ai){var Qr="";return ai instanceof Ae?(ai=typeof Et.angle=="number"?De(ai,new Ae(1,0,0,1,ur,jr)):De(new Ae(1,0,0,1,ur,jr),ai),Y===$&&(ai=De(new Ae(1,0,0,-1,0,0),ai)),Qr=ai.join(" ")+` Tm
21
+ `):Qr=bt(ur)+" "+bt(jr)+` Td
22
+ `,Qr},Pr=0;Pr<me.length;Pr++){switch(ps="",na){case 1:ts=(Di?"<":"(")+me[Pr][0]+(Di?">":")"),ea=parseFloat(me[Pr][1]),Qo=parseFloat(me[Pr][2]);break;case 0:ts=(Di?"<":"(")+me[Pr]+(Di?">":")"),ea=Ws(U),Qo=Oo(pt)}_a!==void 0&&_a[Pr]!==void 0&&(ps=_a[Pr]+` Tw
23
+ `),Pr===0?C.push(ps+xe(ea,Qo,Si)+ts):na===0?C.push(ps+ts):na===1&&C.push(ps+xe(ea,Qo,Si)+ts)}C=na===0?C.join(` Tj
24
+ T* `):C.join(` Tj
25
+ `),C+=` Tj
26
+ `;var vo=`BT
27
+ /`;return vo+=Be+" "+ge+` Tf
28
+ `,vo+=bt(ge*ao)+` TL
29
+ `,vo+=cs+`
30
+ `,vo+=si,vo+=C,ft(vo+="ET"),b[Be]=!0,Lr};var as=y.__private__.clip=y.clip=function(C){return ft(C==="evenodd"?"W*":"W"),this};y.clipEvenOdd=function(){return as("evenodd")},y.__private__.discardPath=y.discardPath=function(){return ft("n"),this};var wi=y.__private__.isValidStyle=function(C){var U=!1;return[void 0,null,"S","D","F","DF","FD","f","f*","B","B*","n"].indexOf(C)!==-1&&(U=!0),U};y.__private__.setDefaultPathOperation=y.setDefaultPathOperation=function(C){return wi(C)&&(d=C),this};var so=y.__private__.getStyle=y.getStyle=function(C){var U=d;switch(C){case"D":case"S":U="S";break;case"F":U="f";break;case"FD":case"DF":U="B";break;case"f":case"f*":case"B":case"B*":U=C}return U},Mr=y.close=function(){return ft("h"),this};y.stroke=function(){return ft("S"),this},y.fill=function(C){return Ko("f",C),this},y.fillEvenOdd=function(C){return Ko("f*",C),this},y.fillStroke=function(C){return Ko("B",C),this},y.fillStrokeEvenOdd=function(C){return Ko("B*",C),this};var Ko=function(C,U){ii(U)==="object"?Cr(U,C):ft(C)},to=function(C){C===null||Y===$&&C===void 0||(C=so(C),ft(C))};function Jo(C,U,pt,Et,zt){var oe=new rh(U||this.boundingBox,pt||this.xStep,Et||this.yStep,this.gState,zt||this.matrix);oe.stream=this.stream;var me=C+"$$"+this.cloneIndex+++"$$";return Hn(me,oe),oe}var Cr=function(C,U){var pt=ar[C.key],Et=Ke[pt];if(Et instanceof Jf)ft("q"),ft(xl(U)),Et.gState&&y.setGState(Et.gState),ft(C.matrix.toString()+" cm"),ft("/"+pt+" sh"),ft("Q");else if(Et instanceof rh){var zt=new Ae(1,0,0,-1,0,ma());C.matrix&&(zt=zt.multiply(C.matrix||or),pt=Jo.call(Et,C.key,C.boundingBox,C.xStep,C.yStep,zt).id),ft("q"),ft("/Pattern cs"),ft("/"+pt+" scn"),Et.gState&&y.setGState(Et.gState),ft(U),ft("Q")}},xl=function(C){switch(C){case"f":case"F":case"n":return"W n";case"f*":return"W* n";case"B":case"S":return"W S";case"B*":return"W* S"}},ls=y.moveTo=function(C,U){return ft(bt(X(C))+" "+bt(wt(U))+" m"),this},$i=y.lineTo=function(C,U){return ft(bt(X(C))+" "+bt(wt(U))+" l"),this},Jt=y.curveTo=function(C,U,pt,Et,zt,oe){return ft([bt(X(C)),bt(wt(U)),bt(X(pt)),bt(wt(Et)),bt(X(zt)),bt(wt(oe)),"c"].join(" ")),this};y.__private__.line=y.line=function(C,U,pt,Et,zt){if(isNaN(C)||isNaN(U)||isNaN(pt)||isNaN(Et)||!wi(zt))throw new Error("Invalid arguments passed to jsPDF.line");return Y===q?this.lines([[pt-C,Et-U]],C,U,[1,1],zt||"S"):this.lines([[pt-C,Et-U]],C,U,[1,1]).stroke()},y.__private__.lines=y.lines=function(C,U,pt,Et,zt,oe){var me,Xe,on,zn,Un,cr,Yi,Si,Lr,oi,Di,si;if(typeof C=="number"&&(si=pt,pt=U,U=C,C=si),Et=Et||[1,1],oe=oe||!1,isNaN(U)||isNaN(pt)||!Array.isArray(C)||!Array.isArray(Et)||!wi(zt)||typeof oe!="boolean")throw new Error("Invalid arguments passed to jsPDF.lines");for(ls(U,pt),me=Et[0],Xe=Et[1],zn=C.length,oi=U,Di=pt,on=0;on<zn;on++)(Un=C[on]).length===2?(oi=Un[0]*me+oi,Di=Un[1]*Xe+Di,$i(oi,Di)):(cr=Un[0]*me+oi,Yi=Un[1]*Xe+Di,Si=Un[2]*me+oi,Lr=Un[3]*Xe+Di,oi=Un[4]*me+oi,Di=Un[5]*Xe+Di,Jt(cr,Yi,Si,Lr,oi,Di));return oe&&Mr(),to(zt),this},y.path=function(C){for(var U=0;U<C.length;U++){var pt=C[U],Et=pt.c;switch(pt.op){case"m":ls(Et[0],Et[1]);break;case"l":$i(Et[0],Et[1]);break;case"c":Jt.apply(this,Et);break;case"h":Mr()}}return this},y.__private__.rect=y.rect=function(C,U,pt,Et,zt){if(isNaN(C)||isNaN(U)||isNaN(pt)||isNaN(Et)||!wi(zt))throw new Error("Invalid arguments passed to jsPDF.rect");return Y===q&&(Et=-Et),ft([bt(X(C)),bt(wt(U)),bt(X(pt)),bt(X(Et)),"re"].join(" ")),to(zt),this},y.__private__.triangle=y.triangle=function(C,U,pt,Et,zt,oe,me){if(isNaN(C)||isNaN(U)||isNaN(pt)||isNaN(Et)||isNaN(zt)||isNaN(oe)||!wi(me))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[pt-C,Et-U],[zt-pt,oe-Et],[C-zt,U-oe]],C,U,[1,1],me,!0),this},y.__private__.roundedRect=y.roundedRect=function(C,U,pt,Et,zt,oe,me){if(isNaN(C)||isNaN(U)||isNaN(pt)||isNaN(Et)||isNaN(zt)||isNaN(oe)||!wi(me))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var Xe=4/3*(Math.SQRT2-1);return zt=Math.min(zt,.5*pt),oe=Math.min(oe,.5*Et),this.lines([[pt-2*zt,0],[zt*Xe,0,zt,oe-oe*Xe,zt,oe],[0,Et-2*oe],[0,oe*Xe,-zt*Xe,oe,-zt,oe],[2*zt-pt,0],[-zt*Xe,0,-zt,-oe*Xe,-zt,-oe],[0,2*oe-Et],[0,-oe*Xe,zt*Xe,-oe,zt,-oe]],C+zt,U,[1,1],me,!0),this},y.__private__.ellipse=y.ellipse=function(C,U,pt,Et,zt){if(isNaN(C)||isNaN(U)||isNaN(pt)||isNaN(Et)||!wi(zt))throw new Error("Invalid arguments passed to jsPDF.ellipse");var oe=4/3*(Math.SQRT2-1)*pt,me=4/3*(Math.SQRT2-1)*Et;return ls(C+pt,U),Jt(C+pt,U-me,C+oe,U-Et,C,U-Et),Jt(C-oe,U-Et,C-pt,U-me,C-pt,U),Jt(C-pt,U+me,C-oe,U+Et,C,U+Et),Jt(C+oe,U+Et,C+pt,U+me,C+pt,U),to(zt),this},y.__private__.circle=y.circle=function(C,U,pt,Et){if(isNaN(C)||isNaN(U)||isNaN(pt)||!wi(Et))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(C,U,pt,pt,Et)},y.setFont=function(C,U,pt){return pt&&(U=vt(U,pt)),Be=jf(C,U,{disableWarning:!1}),this};var iu=y.__private__.getFont=y.getFont=function(){return nn[jf.apply(y,arguments)]};y.__private__.getFontList=y.getFontList=function(){var C,U,pt={};for(C in ln)if(ln.hasOwnProperty(C))for(U in pt[C]=[],ln[C])ln[C].hasOwnProperty(U)&&pt[C].push(U);return pt},y.addFont=function(C,U,pt,Et,zt){var oe=["StandardEncoding","MacRomanEncoding","Identity-H","WinAnsiEncoding"];return arguments[3]&&oe.indexOf(arguments[3])!==-1?zt=arguments[3]:arguments[3]&&oe.indexOf(arguments[3])==-1&&(pt=vt(pt,Et)),Wl.call(this,C,U,pt,zt=zt||"Identity-H")};var bo,An=e.lineWidth||.200025,Qa=y.__private__.getLineWidth=y.getLineWidth=function(){return An},Nc=y.__private__.setLineWidth=y.setLineWidth=function(C){return An=C,ft(bt(X(C))+" w"),this};y.__private__.setLineDash=xn.API.setLineDash=xn.API.setLineDashPattern=function(C,U){if(C=C||[],U=U||0,isNaN(U)||!Array.isArray(C))throw new Error("Invalid arguments passed to jsPDF.setLineDash");return C=C.map(function(pt){return bt(X(pt))}).join(" "),U=bt(X(U)),ft("["+C+"] "+U+" d"),this};var Uu=y.__private__.getLineHeight=y.getLineHeight=function(){return ge*bo};y.__private__.getLineHeight=y.getLineHeight=function(){return ge*bo};var Xl=y.__private__.setLineHeightFactor=y.setLineHeightFactor=function(C){return typeof(C=C||1.15)=="number"&&(bo=C),this},Vs=y.__private__.getLineHeightFactor=y.getLineHeightFactor=function(){return bo};Xl(e.lineHeight);var Ws=y.__private__.getHorizontalCoordinate=function(C){return X(C)},Oo=y.__private__.getVerticalCoordinate=function(C){return Y===$?C:en[j].mediaBox.topRightY-en[j].mediaBox.bottomLeftY-X(C)},ks=y.__private__.getHorizontalCoordinateString=y.getHorizontalCoordinateString=function(C){return bt(Ws(C))},Gl=y.__private__.getVerticalCoordinateString=y.getVerticalCoordinateString=function(C){return bt(Oo(C))},Xs=e.strokeColor||"0 G";y.__private__.getStrokeColor=y.getDrawColor=function(){return Rn(Xs)},y.__private__.setStrokeColor=y.setDrawColor=function(C,U,pt,Et){return Xs=oo({ch1:C,ch2:U,ch3:pt,ch4:Et,pdfColorType:"draw",precision:2}),ft(Xs),this};var Kl=e.fillColor||"0 g";y.__private__.getFillColor=y.getFillColor=function(){return Rn(Kl)},y.__private__.setFillColor=y.setFillColor=function(C,U,pt,Et){return Kl=oo({ch1:C,ch2:U,ch3:pt,ch4:Et,pdfColorType:"fill",precision:2}),ft(Kl),this};var cs=e.textColor||"0 g",Jl=y.__private__.getTextColor=y.getTextColor=function(){return Rn(cs)};y.__private__.setTextColor=y.setTextColor=function(C,U,pt,Et){return cs=oo({ch1:C,ch2:U,ch3:pt,ch4:Et,pdfColorType:"text",precision:3}),this};var tl=e.charSpace,qn=y.__private__.getCharSpace=y.getCharSpace=function(){return parseFloat(tl||0)};y.__private__.setCharSpace=y.setCharSpace=function(C){if(isNaN(C))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return tl=C,this};var As=0;y.CapJoinStyles={0:0,butt:0,but:0,miter:0,1:1,round:1,rounded:1,circle:1,2:2,projecting:2,project:2,square:2,bevel:2},y.__private__.setLineCap=y.setLineCap=function(C){var U=y.CapJoinStyles[C];if(U===void 0)throw new Error("Line cap style of '"+C+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return As=U,ft(U+" J"),this};var us=0;y.__private__.setLineJoin=y.setLineJoin=function(C){var U=y.CapJoinStyles[C];if(U===void 0)throw new Error("Line join style of '"+C+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return us=U,ft(U+" j"),this},y.__private__.setLineMiterLimit=y.__private__.setMiterLimit=y.setLineMiterLimit=y.setMiterLimit=function(C){if(C=C||0,isNaN(C))throw new Error("Invalid argument passed to jsPDF.setLineMiterLimit");return ft(bt(X(C))+" M"),this},y.GState=Hg,y.setGState=function(C){(C=typeof C=="string"?wn[Sn[C]]:Gs(null,C)).equals(gr)||(ft("/"+C.id+" gs"),gr=C)};var Gs=function(C,U){if(!C||!Sn[C]){var pt=!1;for(var Et in wn)if(wn.hasOwnProperty(Et)&&wn[Et].equals(U)){pt=!0;break}if(pt)U=wn[Et];else{var zt="GS"+(Object.keys(wn).length+1).toString(10);wn[zt]=U,U.id=zt}return C&&(Sn[C]=U.id),Kn.publish("addGState",U),U}};y.addGState=function(C,U){return Gs(C,U),this},y.saveGraphicsState=function(){return ft("q"),Ln.push({key:Be,size:ge,color:cs}),this},y.restoreGraphicsState=function(){ft("Q");var C=Ln.pop();return Be=C.key,ge=C.size,cs=C.color,gr=null,this},y.setCurrentTransformationMatrix=function(C){return ft(C.toString()+" cm"),this},y.comment=function(C){return ft("#"+C),this};var Ta=function(C,U){var pt=C||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return pt},set:function(oe){isNaN(oe)||(pt=parseFloat(oe))}});var Et=U||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return Et},set:function(oe){isNaN(oe)||(Et=parseFloat(oe))}});var zt="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return zt},set:function(oe){zt=oe.toString()}}),this},Ks=function(C,U,pt,Et){Ta.call(this,C,U),this.type="rect";var zt=pt||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return zt},set:function(me){isNaN(me)||(zt=parseFloat(me))}});var oe=Et||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return oe},set:function(me){isNaN(me)||(oe=parseFloat(me))}}),this},Ms=function(){this.page=En,this.currentPage=j,this.pages=ve.slice(0),this.pagesContext=en.slice(0),this.x=Ie,this.y=kr,this.matrix=Cn,this.width=vl(j),this.height=Qs(j),this.outputDestination=Pe,this.id="",this.objectNumber=-1};Ms.prototype.restore=function(){En=this.page,j=this.currentPage,en=this.pagesContext,ve=this.pages,Ie=this.x,kr=this.y,Cn=this.matrix,Cs(j,this.width),wl(j,this.height),Pe=this.outputDestination};var Js=function(C,U,pt,Et,zt){Re.push(new Ms),En=j=0,ve=[],Ie=C,kr=U,Cn=zt,Go([pt,Et])};for(var Zs in y.beginFormObject=function(C,U,pt,Et,zt){return Js(C,U,pt,Et,zt),this},y.endFormObject=function(C){return(function(U){if(Xt[U])Re.pop().restore();else{var pt=new Ms,Et="Xo"+(Object.keys(qi).length+1).toString(10);pt.id=Et,Xt[U]=Et,qi[Et]=pt,Kn.publish("addFormObject",pt),Re.pop().restore()}})(C),this},y.doFormObject=function(C,U){var pt=qi[Xt[C]];return ft("q"),ft(U.toString()+" cm"),ft("/"+pt.id+" Do"),ft("Q"),this},y.getFormObject=function(C){var U=qi[Xt[C]];return{x:U.x,y:U.y,width:U.width,height:U.height,matrix:U.matrix}},y.save=function(C,U){return C=C||"generated.pdf",(U=U||{}).returnPromise=U.returnPromise||!1,U.returnPromise===!1?(Kf(ss(Ss()),C),typeof Kf.unload=="function"&&Qn.setTimeout&&setTimeout(Kf.unload,911),this):new Promise(function(pt,Et){try{var zt=Kf(ss(Ss()),C);typeof Kf.unload=="function"&&Qn.setTimeout&&setTimeout(Kf.unload,911),pt(zt)}catch(oe){Et(oe.message)}})},xn.API)xn.API.hasOwnProperty(Zs)&&(Zs==="events"&&xn.API.events.length?(function(C,U){var pt,Et,zt;for(zt=U.length-1;zt!==-1;zt--)pt=U[zt][0],Et=U[zt][1],C.subscribe.apply(C,[pt].concat(typeof Et=="function"?[Et]:Et))})(Kn,xn.API.events):y[Zs]=xn.API[Zs]);function vl(C){return en[C].mediaBox.topRightX-en[C].mediaBox.bottomLeftX}function Cs(C,U){en[C].mediaBox.topRightX=U+en[C].mediaBox.bottomLeftX}function Qs(C){return en[C].mediaBox.topRightY-en[C].mediaBox.bottomLeftY}function wl(C,U){en[C].mediaBox.topRightY=U+en[C].mediaBox.bottomLeftY}var Sl=y.getPageWidth=function(C){return vl(C=C||j)/We},Zl=y.setPageWidth=function(C,U){Cs(C,U*We)},ma=y.getPageHeight=function(C){return Qs(C=C||j)/We},Ql=y.setPageHeight=function(C,U){wl(C,U*We)};return y.internal={pdfEscape:Xo,getStyle:so,getFont:iu,getFontSize:Ne,getCharSpace:qn,getTextColor:Jl,getLineHeight:Uu,getLineHeightFactor:Vs,getLineWidth:Qa,write:Oe,getHorizontalCoordinate:Ws,getVerticalCoordinate:Oo,getCoordinateString:ks,getVerticalCoordinateString:Gl,collections:{},newObject:Wr,newAdditionalObject:Wt,newObjectDeferred:Dr,newObjectDeferredBegin:vi,getFilters:Wo,putStream:Us,events:Kn,scaleFactor:We,pageSize:{getWidth:function(){return Sl(j)},setWidth:function(C){Zl(j,C)},getHeight:function(){return ma(j)},setHeight:function(C){Ql(j,C)}},encryptionOptions:p,encryption:Qi,getEncryptor:function(C){return p!==null?Qi.encryptor(C,0):function(U){return U}},output:bl,getNumberOfPages:Cc,get pages(){return ve},out:ft,f2:Q,f3:lt,getPageInfo:Tc,getPageInfoByObjId:Za,getCurrentPageInfo:_i,getPDFVersion:E,Point:Ta,Rectangle:Ks,Matrix:Ae,hasHotfix:Ni},Object.defineProperty(y.internal.pageSize,"width",{get:function(){return Sl(j)},set:function(C){Zl(j,C)},enumerable:!0,configurable:!0}),Object.defineProperty(y.internal.pageSize,"height",{get:function(){return ma(j)},set:function(C){Ql(j,C)},enumerable:!0,configurable:!0}),(function(C){for(var U=0,pt=fe.length;U<pt;U++){var Et=Wl.call(this,C[U][0],C[U][1],C[U][2],fe[U][3],!0);g===!1&&(b[Et]=!0);var zt=C[U][0].split("-");Ti({id:Et,fontName:zt[0],fontStyle:zt[1]||""})}Kn.publish("addFonts",{fonts:nn,dictionary:ln})}).call(y,fe),Be="F1",Ma(i,n),Kn.publish("initialized"),y}Kd.prototype.lsbFirstWord=function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)},Kd.prototype.toHexString=function(e){return e.split("").map(function(t){return("0"+(255&t.charCodeAt(0)).toString(16)).slice(-2)}).join("")},Kd.prototype.hexToBytes=function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(String.fromCharCode(parseInt(e.substr(n,2),16)));return t.join("")},Kd.prototype.processOwnerPassword=function(e,t){return V2(Y2(t).substr(0,5),e)},Kd.prototype.encryptor=function(e,t){var n=Y2(this.encryptionKey+String.fromCharCode(255&e,e>>8&255,e>>16&255,255&t,t>>8&255)).substr(0,10);return function(r){return V2(n,r)}},Hg.prototype.equals=function(e){var t,n="id,objectNumber,equals";if(!e||ii(e)!==ii(this))return!1;var r=0;for(t in this)if(!(n.indexOf(t)>=0)){if(this.hasOwnProperty(t)&&!e.hasOwnProperty(t)||this[t]!==e[t])return!1;r++}for(t in e)e.hasOwnProperty(t)&&n.indexOf(t)<0&&r--;return r===0},xn.API={events:[]},xn.version="4.2.1";var po=xn.API,J5=1,Md=function(e){return e.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},qd=function(e){return e.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},yd=function(e){return e.toString().replace(/#/g,"#23").replace(/[\s\n\r()<>[\]{}\/%]/g,function(t){var n=t.charCodeAt(0).toString(16).toUpperCase();return"#"+(n.length===1?"0"+n:n)})},Gn=function(e){return e.toFixed(2)},cf=function(e){return e.toFixed(5)};po.__acroform__={};var Ka=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e},tS=function(e){return e*J5},Kc=function(e){var t=new $4,n=an.internal.getHeight(e)||0,r=an.internal.getWidth(e)||0;return t.BBox=[0,0,Number(Gn(r)),Number(Gn(n))],t},k_=po.__acroform__.setBit=function(e,t){if(e=e||0,t=t||0,isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBit");return e|1<<t},A_=po.__acroform__.clearBit=function(e,t){if(e=e||0,t=t||0,isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBit");return e&~(1<<t)},M_=po.__acroform__.getBit=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBit");return e&1<<t?1:0},To=po.__acroform__.getBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return M_(e,t-1)},No=po.__acroform__.setBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return k_(e,t-1)},_o=po.__acroform__.clearBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return A_(e,t-1)},C_=po.__acroform__.calculateCoordinates=function(e,t){var n=t.internal.getHorizontalCoordinate,r=t.internal.getVerticalCoordinate,i=e[0],s=e[1],l=e[2],c=e[3],f={};return f.lowerLeft_X=n(i)||0,f.lowerLeft_Y=r(s+c)||0,f.upperRight_X=n(i+l)||0,f.upperRight_Y=r(s)||0,[Number(Gn(f.lowerLeft_X)),Number(Gn(f.lowerLeft_Y)),Number(Gn(f.upperRight_X)),Number(Gn(f.upperRight_Y))]},E_=function(e){if(e.appearanceStreamContent)return e.appearanceStreamContent;if(e.V||e.DV){var t=[],n=e._V||e.DV,r=W2(e,n),i=e.scope.internal.getFont(e.fontName,e.fontStyle).id;t.push("/Tx BMC"),t.push("q"),t.push("BT"),t.push(e.scope.__private__.encodeColorString(e.color)),t.push("/"+i+" "+Gn(r.fontSize)+" Tf"),t.push("1 0 0 1 0 0 Tm"),t.push(r.text),t.push("ET"),t.push("Q"),t.push("EMC");var s=Kc(e);return s.scope=e.scope,s.stream=t.join(`
31
+ `),s}},W2=function(e,t){var n=e.fontSize===0?e.maxFontSize:e.fontSize,r={text:"",fontSize:""},i=(t=(t=t.substr(0,1)=="("?t.substr(1):t).substr(t.length-1)==")"?t.substr(0,t.length-1):t).split(" ");i=e.multiline?i.map(function(Q){return Q.split(`
32
+ `)}):i.map(function(Q){return[Q]});var s=n,l=an.internal.getHeight(e)||0;l=l<0?-l:l;var c=an.internal.getWidth(e)||0;c=c<0?-c:c;var f=function(Q,lt,X){if(Q+1<i.length){var wt=lt+" "+i[Q+1][0];return Km(wt,e,X).width<=c-4}return!1};s++;t:for(;s>0;){t="",s--;var d,p,g=Km("3",e,s).height,b=e.multiline?l-s:(l-g)/2,y=b+=2,M=0,E=0,D=0;if(s<=0){t=`(...) Tj
33
+ `,t+="% Width of Text: "+Km(t,e,s=12).width+", FieldWidth:"+c+`
34
+ `;break}for(var L="",q=0,$=0;$<i.length;$++)if(i.hasOwnProperty($)){var Y=!1;if(i[$].length!==1&&D!==i[$].length-1){if((g+2)*(q+2)+2>l)continue t;L+=i[$][D],Y=!0,E=$,$--}else{L=(L+=i[$][D]+" ").substr(L.length-1)==" "?L.substr(0,L.length-1):L;var ht=parseInt($),Mt=f(ht,L,s),vt=$>=i.length-1;if(Mt&&!vt){L+=" ",D=0;continue}if(Mt||vt){if(vt)E=ht;else if(e.multiline&&(g+2)*(q+2)+2>l)continue t}else{if(!e.multiline||(g+2)*(q+2)+2>l)continue t;E=ht}}for(var bt="",rt=M;rt<=E;rt++){var Dt=i[rt];if(e.multiline){if(rt===E){bt+=Dt[D]+" ",D=(D+1)%Dt.length;continue}if(rt===M){bt+=Dt[Dt.length-1]+" ";continue}}bt+=Dt[0]+" "}switch(bt=bt.substr(bt.length-1)==" "?bt.substr(0,bt.length-1):bt,p=Km(bt,e,s).width,e.textAlign){case"right":d=c-p-2;break;case"center":d=(c-p)/2;break;default:d=2}t+=Gn(d)+" "+Gn(y)+` Td
35
+ `,t+="("+Md(bt)+`) Tj
36
+ `,t+=-Gn(d)+` 0 Td
37
+ `,y=-(s+2),p=0,M=Y?E:E+1,q++,L=""}break}return r.text=t,r.fontSize=s,r},Km=function(e,t,n){var r=t.scope.internal.getFont(t.fontName,t.fontStyle),i=t.scope.getStringUnitWidth(e,{font:r,fontSize:parseFloat(n),charSpace:0})*parseFloat(n);return{height:t.scope.getStringUnitWidth("3",{font:r,fontSize:parseFloat(n),charSpace:0})*parseFloat(n)*1.5,width:i}},T_={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},N_=function(e,t){var n={type:"reference",object:e};t.internal.getPageInfo(e.page).pageContext.annotations.find(function(r){return r.type===n.type&&r.object===n.object})===void 0&&t.internal.getPageInfo(e.page).pageContext.annotations.push(n)},__=function(e,t){if(t.scope=e,e.internal!==void 0&&(e.internal.acroformPlugin===void 0||e.internal.acroformPlugin.isInitialized===!1)){if(kc.FieldNum=0,e.internal.acroformPlugin=JSON.parse(JSON.stringify(T_)),e.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");J5=e.internal.scaleFactor,e.internal.acroformPlugin.acroFormDictionaryRoot=new Y4,e.internal.acroformPlugin.acroFormDictionaryRoot.scope=e,e.internal.acroformPlugin.acroFormDictionaryRoot._eventID=e.internal.events.subscribe("postPutResources",function(){(function(n){n.internal.events.unsubscribe(n.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete n.internal.acroformPlugin.acroFormDictionaryRoot._eventID,n.internal.acroformPlugin.printedOut=!0})(e)}),e.internal.events.subscribe("buildDocument",function(){(function(n){n.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var r=n.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var i in r)if(r.hasOwnProperty(i)){var s=r[i];s.objId=void 0,s.hasAnnotation&&N_(s,n)}})(e)}),e.internal.events.subscribe("putCatalog",function(){(function(n){if(n.internal.acroformPlugin.acroFormDictionaryRoot===void 0)throw new Error("putCatalogCallback: Root missing.");n.internal.write("/AcroForm "+n.internal.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R")})(e)}),e.internal.events.subscribe("postPutPages",function(n){(function(r,i){var s=!r;for(var l in r||(i.internal.newObjectDeferredBegin(i.internal.acroformPlugin.acroFormDictionaryRoot.objId,!0),i.internal.acroformPlugin.acroFormDictionaryRoot.putStream()),r=r||i.internal.acroformPlugin.acroFormDictionaryRoot.Kids)if(r.hasOwnProperty(l)){var c=r[l],f=[],d=c.Rect;if(c.Rect&&(c.Rect=C_(c.Rect,i)),i.internal.newObjectDeferredBegin(c.objId,!0),c.DA=an.createDefaultAppearanceStream(c),ii(c)==="object"&&typeof c.getKeyValueListForStream=="function"&&(f=c.getKeyValueListForStream()),c.Rect=d,c.hasAppearanceStream&&!c.appearanceStreamContent){var p=E_(c);f.push({key:"AP",value:"<</N "+p+">>"}),i.internal.acroformPlugin.xForms.push(p)}if(c.appearanceStreamContent){var g="";for(var b in c.appearanceStreamContent)if(c.appearanceStreamContent.hasOwnProperty(b)){var y=c.appearanceStreamContent[b];if(g+="/"+b+" ",g+="<<",Object.keys(y).length>=1||Array.isArray(y)){for(var l in y)if(y.hasOwnProperty(l)){var M=y[l];typeof M=="function"&&(M=M.call(i,c)),g+="/"+l+" "+M+" ",i.internal.acroformPlugin.xForms.indexOf(M)>=0||i.internal.acroformPlugin.xForms.push(M)}}else typeof(M=y)=="function"&&(M=M.call(i,c)),g+="/"+l+" "+M,i.internal.acroformPlugin.xForms.indexOf(M)>=0||i.internal.acroformPlugin.xForms.push(M);g+=">>"}f.push({key:"AP",value:`<<
38
+ `+g+">>"})}i.internal.putStream({additionalKeyValues:f,objectId:c.objId}),i.internal.out("endobj")}s&&(function(E,D){for(var L in E)if(E.hasOwnProperty(L)){var q=L,$=E[L];D.internal.newObjectDeferredBegin($.objId,!0),ii($)==="object"&&typeof $.putStream=="function"&&$.putStream(),delete E[q]}})(i.internal.acroformPlugin.xForms,i)})(n,e)}),e.internal.acroformPlugin.isInitialized=!0}},q4=po.__acroform__.arrayToPdfArray=function(e,t,n){var r=function(l){return l};if(Array.isArray(e)){for(var i="[",s=0;s<e.length;s++)switch(s!==0&&(i+=" "),ii(e[s])){case"boolean":case"number":case"object":i+=e[s].toString();break;case"string":e[s].substr(0,1)==="/"?i+="/"+yd(e[s].substr(1)):(t!==void 0&&n&&(r=n.internal.getEncryptor(t)),i+="("+Md(r(e[s].toString()))+")")}return i+"]"}throw new Error("Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray")},Uy=function(e,t,n){var r=function(i){return i};return t!==void 0&&n&&(r=n.internal.getEncryptor(t)),(e=e||"").toString(),"("+Md(r(e))+")"},tu=function(){this._objId=void 0,this._scope=void 0,Object.defineProperty(this,"objId",{get:function(){if(this._objId===void 0){if(this.scope===void 0)return;this._objId=this.scope.internal.newObjectDeferred()}return this._objId},set:function(e){this._objId=e}}),Object.defineProperty(this,"scope",{value:this._scope,writable:!0})};tu.prototype.toString=function(){return this.objId+" 0 R"},tu.prototype.putStream=function(){var e=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:e,objectId:this.objId}),this.scope.internal.out("endobj")},tu.prototype.getKeyValueListForStream=function(){var e=[],t=Object.getOwnPropertyNames(this).filter(function(s){return s!="content"&&s!="appearanceStreamContent"&&s!="scope"&&s!="objId"&&s.substring(0,1)!="_"});for(var n in t)if(Object.getOwnPropertyDescriptor(this,t[n]).configurable===!1){var r=t[n],i=this[r];i&&(Array.isArray(i)?e.push({key:r,value:q4(i,this.objId,this.scope)}):i instanceof tu?(i.scope=this.scope,e.push({key:r,value:i.objId+" 0 R"})):typeof i!="function"&&e.push({key:r,value:i}))}return e};var $4=function(){tu.call(this),Object.defineProperty(this,"Type",{value:"/XObject",configurable:!1,writable:!0}),Object.defineProperty(this,"Subtype",{value:"/Form",configurable:!1,writable:!0}),Object.defineProperty(this,"FormType",{value:1,configurable:!1,writable:!0});var e,t=[];Object.defineProperty(this,"BBox",{configurable:!1,get:function(){return t},set:function(n){t=n}}),Object.defineProperty(this,"Resources",{value:"2 0 R",configurable:!1,writable:!0}),Object.defineProperty(this,"stream",{enumerable:!1,configurable:!0,set:function(n){e=n.trim()},get:function(){return e||null}})};Ka($4,tu);var Y4=function(){tu.call(this);var e,t=[];Object.defineProperty(this,"Kids",{enumerable:!1,configurable:!0,get:function(){return t.length>0?t:void 0}}),Object.defineProperty(this,"Fields",{enumerable:!1,configurable:!1,get:function(){return t}}),Object.defineProperty(this,"DA",{enumerable:!1,configurable:!1,get:function(){if(e){var n=function(r){return r};return this.scope&&(n=this.scope.internal.getEncryptor(this.objId)),"("+Md(n(e))+")"}},set:function(n){e=n}})};Ka(Y4,tu);var kc=function e(){tu.call(this);var t=4;Object.defineProperty(this,"F",{enumerable:!1,configurable:!1,get:function(){return t},set:function(L){if(isNaN(L))throw new Error('Invalid value "'+L+'" for attribute F supplied.');t=L}}),Object.defineProperty(this,"showWhenPrinted",{enumerable:!0,configurable:!0,get:function(){return!!To(t,3)},set:function(L){L?this.F=No(t,3):this.F=_o(t,3)}});var n=0;Object.defineProperty(this,"Ff",{enumerable:!1,configurable:!1,get:function(){return n},set:function(L){if(isNaN(L))throw new Error('Invalid value "'+L+'" for attribute Ff supplied.');n=L}});var r=[];Object.defineProperty(this,"Rect",{enumerable:!1,configurable:!1,get:function(){if(r.length!==0)return r},set:function(L){r=L!==void 0?L:[]}}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[0])?0:r[0]},set:function(L){r[0]=L}}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[1])?0:r[1]},set:function(L){r[1]=L}}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[2])?0:r[2]},set:function(L){r[2]=L}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[3])?0:r[3]},set:function(L){r[3]=L}});var i="";Object.defineProperty(this,"FT",{enumerable:!0,configurable:!1,get:function(){return i},set:function(L){switch(L){case"/Btn":case"/Tx":case"/Ch":case"/Sig":i=L;break;default:throw new Error('Invalid value "'+L+'" for attribute FT supplied.')}}});var s=null;Object.defineProperty(this,"T",{enumerable:!0,configurable:!1,get:function(){if(!s||s.length<1){if(this instanceof qg)return;s="FieldObject"+e.FieldNum++}var L=function(q){return q};return this.scope&&(L=this.scope.internal.getEncryptor(this.objId)),"("+Md(L(s))+")"},set:function(L){s=L.toString()}}),Object.defineProperty(this,"fieldName",{configurable:!0,enumerable:!0,get:function(){return s},set:function(L){s=L}});var l="helvetica";Object.defineProperty(this,"fontName",{enumerable:!0,configurable:!0,get:function(){return l},set:function(L){l=L}});var c="normal";Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,get:function(){return c},set:function(L){c=L}});var f=0;Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,get:function(){return f},set:function(L){f=L}});var d=void 0;Object.defineProperty(this,"maxFontSize",{enumerable:!0,configurable:!0,get:function(){return d===void 0?50/J5:d},set:function(L){d=L}});var p="black";Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,get:function(){return p},set:function(L){p=L}});var g="/F1 0 Tf 0 g";Object.defineProperty(this,"DA",{enumerable:!0,configurable:!1,get:function(){if(!(!g||this instanceof qg||this instanceof ad))return Uy(g,this.objId,this.scope)},set:function(L){L=L.toString(),g=L}});var b=null;Object.defineProperty(this,"DV",{enumerable:!1,configurable:!1,get:function(){if(b)return this instanceof bs==0?Uy(b,this.objId,this.scope):b},set:function(L){L=L.toString(),b=this instanceof bs==0?L.substr(0,1)==="("?qd(L.substr(1,L.length-2)):qd(L):L}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof bs==1?qd(b.substr(1,b.length-1)):b},set:function(L){L=L.toString(),b=this instanceof bs==1?"/"+yd(L):L}});var y=null;Object.defineProperty(this,"_V",{enumerable:!1,configurable:!1,get:function(){if(y)return y},set:function(L){this.V=L}}),Object.defineProperty(this,"V",{enumerable:!1,configurable:!1,get:function(){if(y)return this instanceof bs==0?Uy(y,this.objId,this.scope):y},set:function(L){L=L.toString(),y=this instanceof bs==0?L.substr(0,1)==="("?qd(L.substr(1,L.length-2)):qd(L):L}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof bs==1?qd(y.substr(1,y.length-1)):y},set:function(L){L=L.toString(),y=this instanceof bs==1?"/"+yd(L):L}}),Object.defineProperty(this,"hasAnnotation",{enumerable:!0,configurable:!0,get:function(){return this.Rect}}),Object.defineProperty(this,"Type",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Annot":null}}),Object.defineProperty(this,"Subtype",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Widget":null}});var M,E=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return E},set:function(L){L=!!L,E=L}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(M)return M},set:function(L){M=L}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,1)},set:function(L){L?this.Ff=No(this.Ff,1):this.Ff=_o(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,2)},set:function(L){L?this.Ff=No(this.Ff,2):this.Ff=_o(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,3)},set:function(L){L?this.Ff=No(this.Ff,3):this.Ff=_o(this.Ff,3)}});var D=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(D!==null)return D},set:function(L){if([0,1,2].indexOf(L)===-1)throw new Error('Invalid value "'+L+'" for attribute Q supplied.');D=L}}),Object.defineProperty(this,"textAlign",{get:function(){var L;switch(D){case 0:default:L="left";break;case 1:L="center";break;case 2:L="right"}return L},configurable:!0,enumerable:!0,set:function(L){switch(L){case"right":case 2:D=2;break;case"center":case 1:D=1;break;default:D=0}}})};Ka(kc,tu);var oh=function(){kc.call(this),this.FT="/Ch",this.V="()",this.fontName="zapfdingbats";var e=0;Object.defineProperty(this,"TI",{enumerable:!0,configurable:!1,get:function(){return e},set:function(n){e=n}}),Object.defineProperty(this,"topIndex",{enumerable:!0,configurable:!0,get:function(){return e},set:function(n){e=n}});var t=[];Object.defineProperty(this,"Opt",{enumerable:!0,configurable:!1,get:function(){return q4(t,this.objId,this.scope)},set:function(n){var r,i;i=[],typeof(r=n)=="string"&&(i=(function(s,l,c){c||(c=1);for(var f,d=[];f=l.exec(s);)d.push(f[c]);return d})(r,/\((.*?)\)/g)),t=i}}),this.getOptions=function(){return t},this.setOptions=function(n){t=n,this.sort&&t.sort()},this.addOption=function(n){n=(n=n||"").toString(),t.push(n),this.sort&&t.sort()},this.removeOption=function(n,r){for(r=r||!1,n=(n=n||"").toString();t.indexOf(n)!==-1&&(t.splice(t.indexOf(n),1),r!==!1););},Object.defineProperty(this,"combo",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,18)},set:function(n){n?this.Ff=No(this.Ff,18):this.Ff=_o(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,19)},set:function(n){this.combo===!0&&(n?this.Ff=No(this.Ff,19):this.Ff=_o(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,20)},set:function(n){n?(this.Ff=No(this.Ff,20),t.sort()):this.Ff=_o(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,22)},set:function(n){n?this.Ff=No(this.Ff,22):this.Ff=_o(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,23)},set:function(n){n?this.Ff=No(this.Ff,23):this.Ff=_o(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,27)},set:function(n){n?this.Ff=No(this.Ff,27):this.Ff=_o(this.Ff,27)}}),this.hasAppearanceStream=!1};Ka(oh,kc);var sh=function(){oh.call(this),this.fontName="helvetica",this.combo=!1};Ka(sh,oh);var ah=function(){sh.call(this),this.combo=!0};Ka(ah,sh);var Mg=function(){ah.call(this),this.edit=!0};Ka(Mg,ah);var bs=function(){kc.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,15)},set:function(n){n?this.Ff=No(this.Ff,15):this.Ff=_o(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,16)},set:function(n){n?this.Ff=No(this.Ff,16):this.Ff=_o(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,17)},set:function(n){n?this.Ff=No(this.Ff,17):this.Ff=_o(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,26)},set:function(n){n?this.Ff=No(this.Ff,26):this.Ff=_o(this.Ff,26)}});var e,t={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var n=function(s){return s};if(this.scope&&(n=this.scope.internal.getEncryptor(this.objId)),Object.keys(t).length!==0){var r,i=[];for(r in i.push("<<"),t)i.push("/"+r+" ("+Md(n(t[r]))+")");return i.push(">>"),i.join(`
39
+ `)}},set:function(n){ii(n)==="object"&&(t=n)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return t.CA||""},set:function(n){typeof n=="string"&&(t.CA=n)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return e},set:function(n){var r=n==null?"":n.toString();r.substr(0,1)==="/"&&(r=r.substr(1)),e="/"+yd(r)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return e.substr(1,e.length-1)},set:function(n){e="/"+yd(n)}})};Ka(bs,kc);var Cg=function(){bs.call(this),this.pushButton=!0};Ka(Cg,bs);var lh=function(){bs.call(this),this.radio=!0,this.pushButton=!1;var e=[];Object.defineProperty(this,"Kids",{enumerable:!0,configurable:!1,get:function(){return e},set:function(t){e=t!==void 0?t:[]}})};Ka(lh,bs);var qg=function(){var e,t;kc.call(this),Object.defineProperty(this,"Parent",{enumerable:!1,configurable:!1,get:function(){return e},set:function(i){e=i}}),Object.defineProperty(this,"optionName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(i){t=i}});var n,r={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var i=function(c){return c};this.scope&&(i=this.scope.internal.getEncryptor(this.objId));var s,l=[];for(s in l.push("<<"),r)l.push("/"+s+" ("+Md(i(r[s]))+")");return l.push(">>"),l.join(`
40
+ `)},set:function(i){ii(i)==="object"&&(r=i)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return r.CA||""},set:function(i){typeof i=="string"&&(r.CA=i)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return n},set:function(i){var s=i==null?"":i.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),n="/"+yd(s)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return n.substr(1,n.length-1)},set:function(i){var s=i==null?"":i.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),n="/"+yd(s)}}),this.caption="l",this.appearanceState="Off",this._AppearanceType=an.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};Ka(qg,kc),lh.prototype.setAppearance=function(e){if(!("createAppearanceStream"in e)||!("getCA"in e))throw new Error("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");for(var t in this.Kids)if(this.Kids.hasOwnProperty(t)){var n=this.Kids[t];n.appearanceStreamContent=e.createAppearanceStream(n.optionName),n.caption=e.getCA()}},lh.prototype.createOption=function(e){var t=new qg;return t.Parent=this,t.optionName=e,this.Kids.push(t),D_.call(this.scope,t),t};var Eg=function(){bs.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=an.CheckBox.createAppearanceStream()};Ka(Eg,bs);var ad=function(){kc.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,13)},set:function(t){t?this.Ff=No(this.Ff,13):this.Ff=_o(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,21)},set:function(t){t?this.Ff=No(this.Ff,21):this.Ff=_o(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,23)},set:function(t){t?this.Ff=No(this.Ff,23):this.Ff=_o(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,24)},set:function(t){t?this.Ff=No(this.Ff,24):this.Ff=_o(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,25)},set:function(t){t?this.Ff=No(this.Ff,25):this.Ff=_o(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,26)},set:function(t){t?this.Ff=No(this.Ff,26):this.Ff=_o(this.Ff,26)}});var e=null;Object.defineProperty(this,"MaxLen",{enumerable:!0,configurable:!1,get:function(){return e},set:function(t){e=t}}),Object.defineProperty(this,"maxLength",{enumerable:!0,configurable:!0,get:function(){return e},set:function(t){Number.isInteger(t)&&(e=t)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return this.V||this.DV}})};Ka(ad,kc);var Tg=function(){ad.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!To(this.Ff,14)},set:function(e){e?this.Ff=No(this.Ff,14):this.Ff=_o(this.Ff,14)}}),this.password=!0};Ka(Tg,ad);var an={CheckBox:{createAppearanceStream:function(){return{N:{On:an.CheckBox.YesNormal},D:{On:an.CheckBox.YesPushDown,Off:an.CheckBox.OffPushDown}}},YesPushDown:function(e){var t=Kc(e);t.scope=e.scope;var n=[],r=e.scope.internal.getFont(e.fontName,e.fontStyle).id,i=e.scope.__private__.encodeColorString(e.color),s=W2(e,e.caption);return n.push("0.749023 g"),n.push("0 0 "+Gn(an.internal.getWidth(e))+" "+Gn(an.internal.getHeight(e))+" re"),n.push("f"),n.push("BMC"),n.push("q"),n.push("0 0 1 rg"),n.push("/"+r+" "+Gn(s.fontSize)+" Tf "+i),n.push("BT"),n.push(s.text),n.push("ET"),n.push("Q"),n.push("EMC"),t.stream=n.join(`
41
+ `),t},YesNormal:function(e){var t=Kc(e);t.scope=e.scope;var n=e.scope.internal.getFont(e.fontName,e.fontStyle).id,r=e.scope.__private__.encodeColorString(e.color),i=[],s=an.internal.getHeight(e),l=an.internal.getWidth(e),c=W2(e,e.caption);return i.push("1 g"),i.push("0 0 "+Gn(l)+" "+Gn(s)+" re"),i.push("f"),i.push("q"),i.push("0 0 1 rg"),i.push("0 0 "+Gn(l-1)+" "+Gn(s-1)+" re"),i.push("W"),i.push("n"),i.push("0 g"),i.push("BT"),i.push("/"+n+" "+Gn(c.fontSize)+" Tf "+r),i.push(c.text),i.push("ET"),i.push("Q"),t.stream=i.join(`
42
+ `),t},OffPushDown:function(e){var t=Kc(e);t.scope=e.scope;var n=[];return n.push("0.749023 g"),n.push("0 0 "+Gn(an.internal.getWidth(e))+" "+Gn(an.internal.getHeight(e))+" re"),n.push("f"),t.stream=n.join(`
43
+ `),t}},RadioButton:{Circle:{createAppearanceStream:function(e){var t={D:{Off:an.RadioButton.Circle.OffPushDown},N:{}};return t.N[e]=an.RadioButton.Circle.YesNormal,t.D[e]=an.RadioButton.Circle.YesPushDown,t},getCA:function(){return"l"},YesNormal:function(e){var t=Kc(e);t.scope=e.scope;var n=[],r=an.internal.getWidth(e)<=an.internal.getHeight(e)?an.internal.getWidth(e)/4:an.internal.getHeight(e)/4;r=Number((.9*r).toFixed(5));var i=an.internal.Bezier_C,s=Number((r*i).toFixed(5));return n.push("q"),n.push("1 0 0 1 "+cf(an.internal.getWidth(e)/2)+" "+cf(an.internal.getHeight(e)/2)+" cm"),n.push(r+" 0 m"),n.push(r+" "+s+" "+s+" "+r+" 0 "+r+" c"),n.push("-"+s+" "+r+" -"+r+" "+s+" -"+r+" 0 c"),n.push("-"+r+" -"+s+" -"+s+" -"+r+" 0 -"+r+" c"),n.push(s+" -"+r+" "+r+" -"+s+" "+r+" 0 c"),n.push("f"),n.push("Q"),t.stream=n.join(`
44
+ `),t},YesPushDown:function(e){var t=Kc(e);t.scope=e.scope;var n=[],r=an.internal.getWidth(e)<=an.internal.getHeight(e)?an.internal.getWidth(e)/4:an.internal.getHeight(e)/4;r=Number((.9*r).toFixed(5));var i=Number((2*r).toFixed(5)),s=Number((i*an.internal.Bezier_C).toFixed(5)),l=Number((r*an.internal.Bezier_C).toFixed(5));return n.push("0.749023 g"),n.push("q"),n.push("1 0 0 1 "+cf(an.internal.getWidth(e)/2)+" "+cf(an.internal.getHeight(e)/2)+" cm"),n.push(i+" 0 m"),n.push(i+" "+s+" "+s+" "+i+" 0 "+i+" c"),n.push("-"+s+" "+i+" -"+i+" "+s+" -"+i+" 0 c"),n.push("-"+i+" -"+s+" -"+s+" -"+i+" 0 -"+i+" c"),n.push(s+" -"+i+" "+i+" -"+s+" "+i+" 0 c"),n.push("f"),n.push("Q"),n.push("0 g"),n.push("q"),n.push("1 0 0 1 "+cf(an.internal.getWidth(e)/2)+" "+cf(an.internal.getHeight(e)/2)+" cm"),n.push(r+" 0 m"),n.push(r+" "+l+" "+l+" "+r+" 0 "+r+" c"),n.push("-"+l+" "+r+" -"+r+" "+l+" -"+r+" 0 c"),n.push("-"+r+" -"+l+" -"+l+" -"+r+" 0 -"+r+" c"),n.push(l+" -"+r+" "+r+" -"+l+" "+r+" 0 c"),n.push("f"),n.push("Q"),t.stream=n.join(`
45
+ `),t},OffPushDown:function(e){var t=Kc(e);t.scope=e.scope;var n=[],r=an.internal.getWidth(e)<=an.internal.getHeight(e)?an.internal.getWidth(e)/4:an.internal.getHeight(e)/4;r=Number((.9*r).toFixed(5));var i=Number((2*r).toFixed(5)),s=Number((i*an.internal.Bezier_C).toFixed(5));return n.push("0.749023 g"),n.push("q"),n.push("1 0 0 1 "+cf(an.internal.getWidth(e)/2)+" "+cf(an.internal.getHeight(e)/2)+" cm"),n.push(i+" 0 m"),n.push(i+" "+s+" "+s+" "+i+" 0 "+i+" c"),n.push("-"+s+" "+i+" -"+i+" "+s+" -"+i+" 0 c"),n.push("-"+i+" -"+s+" -"+s+" -"+i+" 0 -"+i+" c"),n.push(s+" -"+i+" "+i+" -"+s+" "+i+" 0 c"),n.push("f"),n.push("Q"),t.stream=n.join(`
46
+ `),t}},Cross:{createAppearanceStream:function(e){var t={D:{Off:an.RadioButton.Cross.OffPushDown},N:{}};return t.N[e]=an.RadioButton.Cross.YesNormal,t.D[e]=an.RadioButton.Cross.YesPushDown,t},getCA:function(){return"8"},YesNormal:function(e){var t=Kc(e);t.scope=e.scope;var n=[],r=an.internal.calculateCross(e);return n.push("q"),n.push("1 1 "+Gn(an.internal.getWidth(e)-2)+" "+Gn(an.internal.getHeight(e)-2)+" re"),n.push("W"),n.push("n"),n.push(Gn(r.x1.x)+" "+Gn(r.x1.y)+" m"),n.push(Gn(r.x2.x)+" "+Gn(r.x2.y)+" l"),n.push(Gn(r.x4.x)+" "+Gn(r.x4.y)+" m"),n.push(Gn(r.x3.x)+" "+Gn(r.x3.y)+" l"),n.push("s"),n.push("Q"),t.stream=n.join(`
47
+ `),t},YesPushDown:function(e){var t=Kc(e);t.scope=e.scope;var n=an.internal.calculateCross(e),r=[];return r.push("0.749023 g"),r.push("0 0 "+Gn(an.internal.getWidth(e))+" "+Gn(an.internal.getHeight(e))+" re"),r.push("f"),r.push("q"),r.push("1 1 "+Gn(an.internal.getWidth(e)-2)+" "+Gn(an.internal.getHeight(e)-2)+" re"),r.push("W"),r.push("n"),r.push(Gn(n.x1.x)+" "+Gn(n.x1.y)+" m"),r.push(Gn(n.x2.x)+" "+Gn(n.x2.y)+" l"),r.push(Gn(n.x4.x)+" "+Gn(n.x4.y)+" m"),r.push(Gn(n.x3.x)+" "+Gn(n.x3.y)+" l"),r.push("s"),r.push("Q"),t.stream=r.join(`
48
+ `),t},OffPushDown:function(e){var t=Kc(e);t.scope=e.scope;var n=[];return n.push("0.749023 g"),n.push("0 0 "+Gn(an.internal.getWidth(e))+" "+Gn(an.internal.getHeight(e))+" re"),n.push("f"),t.stream=n.join(`
49
+ `),t}}},createDefaultAppearanceStream:function(e){var t=e.scope.internal.getFont(e.fontName,e.fontStyle).id,n=e.scope.__private__.encodeColorString(e.color);return"/"+t+" "+e.fontSize+" Tf "+n}};an.internal={Bezier_C:.551915024494,calculateCross:function(e){var t=an.internal.getWidth(e),n=an.internal.getHeight(e),r=Math.min(t,n);return{x1:{x:(t-r)/2,y:(n-r)/2+r},x2:{x:(t-r)/2+r,y:(n-r)/2},x3:{x:(t-r)/2,y:(n-r)/2},x4:{x:(t-r)/2+r,y:(n-r)/2+r}}}},an.internal.getWidth=function(e){var t=0;return ii(e)==="object"&&(t=tS(e.Rect[2])),t},an.internal.getHeight=function(e){var t=0;return ii(e)==="object"&&(t=tS(e.Rect[3])),t};var D_=po.addField=function(e){if(__(this,e),!(e instanceof kc))throw new Error("Invalid argument passed to jsPDF.addField.");var t;return(t=e).scope.internal.acroformPlugin.printedOut&&(t.scope.internal.acroformPlugin.printedOut=!1,t.scope.internal.acroformPlugin.acroFormDictionaryRoot=null),t.scope.internal.acroformPlugin.acroFormDictionaryRoot.Fields.push(t),e.page=e.scope.internal.getCurrentPageInfo().pageNumber,this};po.AcroFormChoiceField=oh,po.AcroFormListBox=sh,po.AcroFormComboBox=ah,po.AcroFormEditBox=Mg,po.AcroFormButton=bs,po.AcroFormPushButton=Cg,po.AcroFormRadioButton=lh,po.AcroFormCheckBox=Eg,po.AcroFormTextField=ad,po.AcroFormPasswordField=Tg,po.AcroFormAppearance=an,po.AcroForm={ChoiceField:oh,ListBox:sh,ComboBox:ah,EditBox:Mg,Button:bs,PushButton:Cg,RadioButton:lh,CheckBox:Eg,TextField:ad,PasswordField:Tg,Appearance:an},xn.AcroForm={ChoiceField:oh,ListBox:sh,ComboBox:ah,EditBox:Mg,Button:bs,PushButton:Cg,RadioButton:lh,CheckBox:Eg,TextField:ad,PasswordField:Tg,Appearance:an};xn.AcroForm;function V4(e){return e.reduce(function(t,n,r){return t[n]=r,t},{})}(function(e){var t="addImage_";e.__addimage__={};var n="UNKNOWN",r={PNG:[[137,80,78,71]],TIFF:[[77,77,0,42],[73,73,42,0]],JPEG:[[255,216,255,224,void 0,void 0,74,70,73,70,0],[255,216,255,225,void 0,void 0,69,120,105,102,0,0],[255,216,255,219],[255,216,255,238]],JPEG2000:[[0,0,0,12,106,80,32,32]],GIF87a:[[71,73,70,56,55,97]],GIF89a:[[71,73,70,56,57,97]],WEBP:[[82,73,70,70,void 0,void 0,void 0,void 0,87,69,66,80]],BMP:[[66,77],[66,65],[67,73],[67,80],[73,67],[80,84]]},i=e.__addimage__.getImageFileTypeByImageData=function(Q,lt){var X,wt,Tt,yt,J,ct=n;if((lt=lt||n)==="RGBA"||Q.data!==void 0&&Q.data instanceof Uint8ClampedArray&&"height"in Q&&"width"in Q)return"RGBA";if(Mt(Q))for(J in r)for(Tt=r[J],X=0;X<Tt.length;X+=1){for(yt=!0,wt=0;wt<Tt[X].length;wt+=1)if(Tt[X][wt]!==void 0&&Tt[X][wt]!==Q[wt]){yt=!1;break}if(yt===!0){ct=J;break}}else for(J in r)for(Tt=r[J],X=0;X<Tt.length;X+=1){for(yt=!0,wt=0;wt<Tt[X].length;wt+=1)if(Tt[X][wt]!==void 0&&Tt[X][wt]!==Q.charCodeAt(wt)){yt=!1;break}if(yt===!0){ct=J;break}}return ct===n&&lt!==n&&(ct=lt),ct},s=function Q(lt){for(var X=this.internal.write,wt=this.internal.putStream,Tt=(0,this.internal.getFilters)();Tt.indexOf("FlateEncode")!==-1;)Tt.splice(Tt.indexOf("FlateEncode"),1);lt.objectId=this.internal.newObject();var yt=[];if(yt.push({key:"Type",value:"/XObject"}),yt.push({key:"Subtype",value:"/Image"}),yt.push({key:"Width",value:lt.width}),yt.push({key:"Height",value:lt.height}),lt.colorSpace===L.INDEXED?yt.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(lt.palette.length/3-1)+" "+("sMask"in lt&&lt.sMask!==void 0?lt.objectId+2:lt.objectId+1)+" 0 R]"}):(yt.push({key:"ColorSpace",value:"/"+lt.colorSpace}),lt.colorSpace===L.DEVICE_CMYK&&yt.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),yt.push({key:"BitsPerComponent",value:lt.bitsPerComponent}),"decodeParameters"in lt&&lt.decodeParameters!==void 0&&yt.push({key:"DecodeParms",value:"<<"+lt.decodeParameters+">>"}),"transparency"in lt&&Array.isArray(lt.transparency)&&lt.transparency.length>0){for(var J="",ct=0,Bt=lt.transparency.length;ct<Bt;ct++)J+=lt.transparency[ct]+" "+lt.transparency[ct]+" ";yt.push({key:"Mask",value:"["+J+"]"})}lt.sMask!==void 0&&yt.push({key:"SMask",value:lt.objectId+1+" 0 R"});var te=lt.filter!==void 0?["/"+lt.filter]:void 0;if(wt({data:lt.data,additionalKeyValues:yt,alreadyAppliedFilters:te,objectId:lt.objectId}),X("endobj"),"sMask"in lt&&lt.sMask!==void 0){var Z,P=(Z=lt.sMaskBitsPerComponent)!==null&&Z!==void 0?Z:lt.bitsPerComponent,j={width:lt.width,height:lt.height,colorSpace:"DeviceGray",bitsPerComponent:P,data:lt.sMask};"filter"in lt&&(j.decodeParameters="/Predictor ".concat(lt.predictor," /Colors 1 /BitsPerComponent ").concat(P," /Columns ").concat(lt.width),j.filter=lt.filter),Q.call(this,j)}if(lt.colorSpace===L.INDEXED){var G=this.internal.newObject();wt({data:bt(new Uint8Array(lt.palette)),objectId:G}),X("endobj")}},l=function(){var Q=this.internal.collections[t+"images"];for(var lt in Q)s.call(this,Q[lt])},c=function(){var Q,lt=this.internal.collections[t+"images"],X=this.internal.write;for(var wt in lt)X("/I"+(Q=lt[wt]).index,Q.objectId,"0","R")},f=function(){this.internal.collections[t+"images"]||(this.internal.collections[t+"images"]={},this.internal.events.subscribe("putResources",l),this.internal.events.subscribe("putXobjectDict",c))},d=function(){var Q=this.internal.collections[t+"images"];return f.call(this),Q},p=function(){return Object.keys(this.internal.collections[t+"images"]).length},g=function(Q){return typeof e["process"+Q.toUpperCase()]=="function"},b=function(Q){return ii(Q)==="object"&&Q.nodeType===1},y=function(Q,lt){if(Q.nodeName==="IMG"&&Q.hasAttribute("src")){var X=""+Q.getAttribute("src");if(X.indexOf("data:image/")===0)return Ag(unescape(X).split("base64,").pop());var wt=e.loadFile(X,!0);if(wt!==void 0)return wt}if(Q.nodeName==="CANVAS"){if(Q.width===0||Q.height===0)throw new Error("Given canvas must have data. Canvas width: "+Q.width+", height: "+Q.height);var Tt;switch(lt){case"PNG":Tt="image/png";break;case"WEBP":Tt="image/webp";break;default:Tt="image/jpeg"}return Ag(Q.toDataURL(Tt,1).split("base64,").pop())}},M=function(Q){var lt=this.internal.collections[t+"images"];if(lt){for(var X in lt)if(Q===lt[X].alias)return lt[X]}},E=function(Q,lt,X){return Q||lt||(Q=-96,lt=-96),Q<0&&(Q=-1*X.width*72/Q/this.internal.scaleFactor),lt<0&&(lt=-1*X.height*72/lt/this.internal.scaleFactor),Q===0&&(Q=lt*X.width/X.height),lt===0&&(lt=Q*X.height/X.width),[Q,lt]},D=function(Q,lt,X,wt,Tt,yt){var J=E.call(this,X,wt,Tt),ct=this.internal.getCoordinateString,Bt=this.internal.getVerticalCoordinateString,te=d.call(this);if(X=J[0],wt=J[1],te[Tt.index]=Tt,yt){yt*=Math.PI/180;var Z=Math.cos(yt),P=Math.sin(yt),j=function(ut){return ut.toFixed(4)},G=[j(Z),j(P),j(-1*P),j(Z),0,0,"cm"]}this.internal.write("q"),yt?(this.internal.write([1,"0","0",1,ct(Q),Bt(lt+wt),"cm"].join(" ")),this.internal.write(G.join(" ")),this.internal.write([ct(X),"0","0",ct(wt),"0","0","cm"].join(" "))):this.internal.write([ct(X),"0","0",ct(wt),ct(Q),Bt(lt+wt),"cm"].join(" ")),this.isAdvancedAPI()&&this.internal.write([1,0,0,-1,0,0,"cm"].join(" ")),this.internal.write("/I"+Tt.index+" Do"),this.internal.write("Q")},L=e.color_spaces={DEVICE_RGB:"DeviceRGB",DEVICE_GRAY:"DeviceGray",DEVICE_CMYK:"DeviceCMYK",CAL_GREY:"CalGray",CAL_RGB:"CalRGB",LAB:"Lab",ICC_BASED:"ICCBased",INDEXED:"Indexed",PATTERN:"Pattern",SEPARATION:"Separation",DEVICE_N:"DeviceN"};e.decode={DCT_DECODE:"DCTDecode",FLATE_DECODE:"FlateDecode",LZW_DECODE:"LZWDecode",JPX_DECODE:"JPXDecode",JBIG2_DECODE:"JBIG2Decode",ASCII85_DECODE:"ASCII85Decode",ASCII_HEX_DECODE:"ASCIIHexDecode",RUN_LENGTH_DECODE:"RunLengthDecode",CCITT_FAX_DECODE:"CCITTFaxDecode"};var q=e.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},$=e.__addimage__.sHashCode=function(Q){var lt,X,wt=0;if(typeof Q=="string")for(X=Q.length,lt=0;lt<X;lt++)wt=(wt<<5)-wt+Q.charCodeAt(lt),wt|=0;else if(Mt(Q))for(X=Q.byteLength/2,lt=0;lt<X;lt++)wt=(wt<<5)-wt+Q[lt],wt|=0;return wt},Y=e.__addimage__.validateStringAsBase64=function(Q){(Q=Q||"").toString().trim();var lt=!0;return Q.length===0&&(lt=!1),Q.length%4!=0&&(lt=!1),/^[A-Za-z0-9+/]+$/.test(Q.substr(0,Q.length-2))===!1&&(lt=!1),/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(Q.substr(-2))===!1&&(lt=!1),lt},ht=e.__addimage__.extractImageFromDataUrl=function(Q){if(Q==null||!(Q=Q.trim()).startsWith("data:"))return null;var lt=Q.indexOf(",");return lt<0?null:Q.substring(0,lt).trim().endsWith("base64")?Q.substring(lt+1):null};e.__addimage__.isArrayBuffer=function(Q){return Q instanceof ArrayBuffer};var Mt=e.__addimage__.isArrayBufferView=function(Q){return Q instanceof Int8Array||Q instanceof Uint8Array||Q instanceof Uint8ClampedArray||Q instanceof Int16Array||Q instanceof Uint16Array||Q instanceof Int32Array||Q instanceof Uint32Array||Q instanceof Float32Array||Q instanceof Float64Array},vt=e.__addimage__.binaryStringToUint8Array=function(Q){for(var lt=Q.length,X=new Uint8Array(lt),wt=0;wt<lt;wt++)X[wt]=Q.charCodeAt(wt);return X},bt=e.__addimage__.arrayBufferToBinaryString=function(Q){for(var lt="",X=Mt(Q)?Q:new Uint8Array(Q),wt=0;wt<X.length;wt+=8192)lt+=String.fromCharCode.apply(null,X.subarray(wt,wt+8192));return lt};e.addImage=function(){var Q,lt,X,wt,Tt,yt,J,ct,Bt;if(typeof arguments[1]=="number"?(lt=n,X=arguments[1],wt=arguments[2],Tt=arguments[3],yt=arguments[4],J=arguments[5],ct=arguments[6],Bt=arguments[7]):(lt=arguments[1],X=arguments[2],wt=arguments[3],Tt=arguments[4],yt=arguments[5],J=arguments[6],ct=arguments[7],Bt=arguments[8]),ii(Q=arguments[0])==="object"&&!b(Q)&&"imageData"in Q){var te=Q;Q=te.imageData,lt=te.format||lt||n,X=te.x||X||0,wt=te.y||wt||0,Tt=te.w||te.width||Tt,yt=te.h||te.height||yt,J=te.alias||J,ct=te.compression||ct,Bt=te.rotation||te.angle||Bt}var Z=this.internal.getFilters();if(ct===void 0&&Z.indexOf("FlateEncode")!==-1&&(ct="SLOW"),isNaN(X)||isNaN(wt))throw new Error("Invalid coordinates passed to jsPDF.addImage");f.call(this);var P=rt.call(this,Q,lt,J,ct);return D.call(this,X,wt,Tt,yt,P,Bt),this};var rt=function(Q,lt,X,wt){var Tt,yt,J;if(typeof Q=="string"&&i(Q)===n){Q=unescape(Q);var ct=Dt(Q,!1);(ct!==""||(ct=e.loadFile(Q,!0))!==void 0)&&(Q=ct)}if(b(Q)&&(Q=y(Q,lt)),lt=i(Q,lt),!g(lt))throw new Error("addImage does not support files of type '"+lt+"', please ensure that a plugin for '"+lt+"' support is added.");if(((J=X)==null||J.length===0)&&(X=(function(Bt){return typeof Bt=="string"||Mt(Bt)?$(Bt):Mt(Bt.data)?$(Bt.data):null})(Q)),(Tt=M.call(this,X))||(Q instanceof Uint8Array||lt==="RGBA"||(yt=Q,Q=vt(Q)),Tt=this["process"+lt.toUpperCase()](Q,p.call(this),X,(function(Bt){return Bt&&typeof Bt=="string"&&(Bt=Bt.toUpperCase()),Bt in e.image_compression?Bt:q.NONE})(wt),yt)),!Tt)throw new Error("An unknown error occurred whilst processing the image.");return Tt},Dt=e.__addimage__.convertBase64ToBinaryString=function(Q,lt){lt=typeof lt!="boolean"||lt;var X,wt="";if(typeof Q=="string"){var Tt;X=(Tt=ht(Q))!==null&&Tt!==void 0?Tt:Q;try{wt=Ag(X)}catch(yt){if(lt)throw Y(X)?new Error("atob-Error in jsPDF.convertBase64ToBinaryString "+yt.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ")}}return wt};e.getImageProperties=function(Q){var lt,X,wt="";if(b(Q)&&(Q=y(Q)),typeof Q=="string"&&i(Q)===n&&((wt=Dt(Q,!1))===""&&(wt=e.loadFile(Q)||""),Q=wt),X=i(Q),!g(X))throw new Error("addImage does not support files of type '"+X+"', please ensure that a plugin for '"+X+"' support is added.");if(Q instanceof Uint8Array||(Q=vt(Q)),!(lt=this["process"+X.toUpperCase()](Q)))throw new Error("An unknown error occurred whilst processing the image");return lt.fileType=X,lt}})(xn.API),(function(e){var t=function(n){if(n!==void 0&&n!="")return!0};xn.API.events.push(["addPage",function(n){this.internal.getPageInfo(n.pageNumber).pageContext.annotations=[]}]),e.events.push(["putPage",function(n){for(var r,i,s,l=this.internal.getCoordinateString,c=this.internal.getVerticalCoordinateString,f=this.internal.getPageInfoByObjId(n.objId),d=n.pageContext.annotations,p=!1,g=0;g<d.length&&!p;g++)switch((r=d[g]).type){case"link":(t(r.options.url)||t(r.options.pageNumber))&&(p=!0);break;case"reference":case"text":case"freetext":p=!0}if(p!=0){this.internal.write("/Annots [");for(var b=0;b<d.length;b++){r=d[b];var y=this.internal.pdfEscape,M=this.internal.getEncryptor(n.objId);switch(r.type){case"reference":this.internal.write(" "+r.object.objId+" 0 R ");break;case"text":var E=this.internal.newAdditionalObject(),D=this.internal.newAdditionalObject(),L=this.internal.getEncryptor(E.objId),q=r.title||"Note";s="<</Type /Annot /Subtype /Text "+(i="/Rect ["+l(r.bounds.x)+" "+c(r.bounds.y+r.bounds.h)+" "+l(r.bounds.x+r.bounds.w)+" "+c(r.bounds.y)+"] ")+"/Contents ("+y(L(r.contents))+")",s+=" /Popup "+D.objId+" 0 R",s+=" /P "+f.objId+" 0 R",s+=" /T ("+y(L(q))+") >>",E.content=s;var $=E.objId+" 0 R";s="<</Type /Annot /Subtype /Popup "+(i="/Rect ["+l(r.bounds.x+30)+" "+c(r.bounds.y+r.bounds.h)+" "+l(r.bounds.x+r.bounds.w+30)+" "+c(r.bounds.y)+"] ")+" /Parent "+$,r.open&&(s+=" /Open true"),s+=" >>",D.content=s,this.internal.write(E.objId,"0 R",D.objId,"0 R");break;case"freetext":i="/Rect ["+l(r.bounds.x)+" "+c(r.bounds.y)+" "+l(r.bounds.x+r.bounds.w)+" "+c(r.bounds.y+r.bounds.h)+"] ";var Y="font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+(r.color||"#000000");s="<</Type /Annot /Subtype /FreeText "+i+"/Contents ("+y(M(r.contents))+")",s+=" /DS("+y(M(Y))+")",s+=" /Border [0 0 0]",s+=" >>",this.internal.write(s);break;case"link":if(r.options.name){var ht=this.annotations._nameMap[r.options.name];r.options.pageNumber=ht.page,r.options.top=ht.y}else r.options.top||(r.options.top=0);if(i="/Rect ["+r.finalBounds.x+" "+r.finalBounds.y+" "+r.finalBounds.w+" "+r.finalBounds.h+"] ",s="",r.options.url)s="<</Type /Annot /Subtype /Link "+i+"/Border [0 0 0] /A <</S /URI /URI ("+y(M(r.options.url))+") >>";else if(r.options.pageNumber)switch(s="<</Type /Annot /Subtype /Link "+i+"/Border [0 0 0] /Dest ["+this.internal.getPageInfo(r.options.pageNumber).objId+" 0 R",r.options.magFactor=r.options.magFactor||"XYZ",r.options.magFactor){case"Fit":s+=" /Fit]";break;case"FitH":s+=" /FitH "+r.options.top+"]";break;case"FitV":r.options.left=r.options.left||0,s+=" /FitV "+r.options.left+"]";break;default:var Mt=c(r.options.top);r.options.left=r.options.left||0,r.options.zoom===void 0&&(r.options.zoom=0),s+=" /XYZ "+r.options.left+" "+Mt+" "+r.options.zoom+"]"}s!=""&&(s+=" >>",this.internal.write(s))}}this.internal.write("]")}}]),e.createAnnotation=function(n){var r=this.internal.getCurrentPageInfo();switch(n.type){case"link":this.link(n.bounds.x,n.bounds.y,n.bounds.w,n.bounds.h,n);break;case"text":case"freetext":r.pageContext.annotations.push(n)}},e.link=function(n,r,i,s,l){var c=this.internal.getCurrentPageInfo(),f=this.internal.getCoordinateString,d=this.internal.getVerticalCoordinateString;c.pageContext.annotations.push({finalBounds:{x:f(n),y:d(r),w:f(n+i),h:d(r+s)},options:l,type:"link"})},e.textWithLink=function(n,r,i,s){var l,c,f=this.getTextWidth(n),d=this.internal.getLineHeight()/this.internal.scaleFactor;if(s.maxWidth!==void 0){c=s.maxWidth;var p=this.splitTextToSize(n,c).length;l=Math.ceil(d*p)}else c=f,l=d;return this.text(n,r,i,s),i+=.2*d,s.align==="center"&&(r-=f/2),s.align==="right"&&(r-=f),this.link(r,i-d,c,l,s),f},e.getTextWidth=function(n){var r=this.internal.getFontSize();return this.getStringUnitWidth(n)*r/this.internal.scaleFactor}})(xn.API),(function(e){var t={1569:[65152],1570:[65153,65154],1571:[65155,65156],1572:[65157,65158],1573:[65159,65160],1574:[65161,65162,65163,65164],1575:[65165,65166],1576:[65167,65168,65169,65170],1577:[65171,65172],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194],1584:[65195,65196],1585:[65197,65198],1586:[65199,65200],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1649:[64336,64337],1655:[64477],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393],1676:[64388,64389],1677:[64386,64387],1678:[64390,64391],1681:[64396,64397],1688:[64394,64395],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421],1729:[64422,64423,64424,64425],1733:[64480,64481],1734:[64473,64474],1735:[64471,64472],1736:[64475,64476],1737:[64482,64483],1739:[64478,64479],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431],1747:[64432,64433]},n={65247:{65154:65269,65156:65271,65160:65273,65166:65275},65248:{65154:65270,65156:65272,65160:65274,65166:65276},65165:{65247:{65248:{65258:65010}}},1617:{1612:64606,1613:64607,1614:64608,1615:64609,1616:64610}},r={1612:64606,1613:64607,1614:64608,1615:64609,1616:64610},i=[1570,1571,1573,1575];e.__arabicParser__={};var s=e.__arabicParser__.isInArabicSubstitutionA=function(E){return t[E.charCodeAt(0)]!==void 0},l=e.__arabicParser__.isArabicLetter=function(E){return typeof E=="string"&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(E)},c=e.__arabicParser__.isArabicEndLetter=function(E){return l(E)&&s(E)&&t[E.charCodeAt(0)].length<=2},f=e.__arabicParser__.isArabicAlfLetter=function(E){return l(E)&&i.indexOf(E.charCodeAt(0))>=0};e.__arabicParser__.arabicLetterHasIsolatedForm=function(E){return l(E)&&s(E)&&t[E.charCodeAt(0)].length>=1};var d=e.__arabicParser__.arabicLetterHasFinalForm=function(E){return l(E)&&s(E)&&t[E.charCodeAt(0)].length>=2};e.__arabicParser__.arabicLetterHasInitialForm=function(E){return l(E)&&s(E)&&t[E.charCodeAt(0)].length>=3};var p=e.__arabicParser__.arabicLetterHasMedialForm=function(E){return l(E)&&s(E)&&t[E.charCodeAt(0)].length==4},g=e.__arabicParser__.resolveLigatures=function(E){var D=0,L=n,q="",$=0;for(D=0;D<E.length;D+=1)L[E.charCodeAt(D)]!==void 0?($++,typeof(L=L[E.charCodeAt(D)])=="number"&&(q+=String.fromCharCode(L),L=n,$=0),D===E.length-1&&(L=n,q+=E.charAt(D-($-1)),D-=$-1,$=0)):(L=n,q+=E.charAt(D-$),D-=$,$=0);return q};e.__arabicParser__.isArabicDiacritic=function(E){return E!==void 0&&r[E.charCodeAt(0)]!==void 0};var b=e.__arabicParser__.getCorrectForm=function(E,D,L){return l(E)?s(E)===!1?-1:!d(E)||!l(D)&&!l(L)||!l(L)&&c(D)||c(E)&&!l(D)||c(E)&&f(D)||c(E)&&c(D)?0:p(E)&&l(D)&&!c(D)&&l(L)&&d(L)?3:c(E)||!l(L)?1:2:-1},y=function(E){var D=0,L=0,q=0,$="",Y="",ht="",Mt=(E=E||"").split("\\s+"),vt=[];for(D=0;D<Mt.length;D+=1){for(vt.push(""),L=0;L<Mt[D].length;L+=1)$=Mt[D][L],Y=Mt[D][L-1],ht=Mt[D][L+1],l($)?(q=b($,Y,ht),vt[D]+=q!==-1?String.fromCharCode(t[$.charCodeAt(0)][q]):$):vt[D]+=$;vt[D]=g(vt[D])}return vt.join(" ")},M=e.__arabicParser__.processArabic=e.processArabic=function(){var E,D=typeof arguments[0]=="string"?arguments[0]:arguments[0].text,L=[];if(Array.isArray(D)){var q=0;for(L=[],q=0;q<D.length;q+=1)Array.isArray(D[q])?L.push([y(D[q][0]),D[q][1],D[q][2]]):L.push([y(D[q])]);E=L}else E=y(D);return typeof arguments[0]=="string"?E:(arguments[0].text=E,arguments[0])};e.events.push(["preProcessText",M])})(xn.API),xn.API.autoPrint=function(e){var t;return(e=e||{}).variant=e.variant||"non-conform",e.variant==="javascript"?this.addJS("print({});"):(this.internal.events.subscribe("postPutResources",function(){t=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /Named"),this.internal.out("/Type /Action"),this.internal.out("/N /Print"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){this.internal.out("/OpenAction "+t+" 0 R")})),this},(function(e){var t=function(){var n=void 0;Object.defineProperty(this,"pdf",{get:function(){return n},set:function(c){n=c}});var r=150;Object.defineProperty(this,"width",{get:function(){return r},set:function(c){r=isNaN(c)||Number.isInteger(c)===!1||c<0?150:c,this.getContext("2d").pageWrapXEnabled&&(this.getContext("2d").pageWrapX=r+1)}});var i=300;Object.defineProperty(this,"height",{get:function(){return i},set:function(c){i=isNaN(c)||Number.isInteger(c)===!1||c<0?300:c,this.getContext("2d").pageWrapYEnabled&&(this.getContext("2d").pageWrapY=i+1)}});var s=[];Object.defineProperty(this,"childNodes",{get:function(){return s},set:function(c){s=c}});var l={};Object.defineProperty(this,"style",{get:function(){return l},set:function(c){l=c}}),Object.defineProperty(this,"parentNode",{})};t.prototype.getContext=function(n,r){var i;if((n=n||"2d")!=="2d")return null;for(i in r)this.pdf.context2d.hasOwnProperty(i)&&(this.pdf.context2d[i]=r[i]);return this.pdf.context2d._canvas=this,this.pdf.context2d},t.prototype.toDataURL=function(){throw new Error("toDataURL is not implemented.")},e.events.push(["initialized",function(){this.canvas=new t,this.canvas.pdf=this}])})(xn.API),(function(e){var t={left:0,top:0,bottom:0,right:0},n=!1,r=function(){this.internal.__cell__===void 0&&(this.internal.__cell__={},this.internal.__cell__.padding=3,this.internal.__cell__.headerFunction=void 0,this.internal.__cell__.margins=Object.assign({},t),this.internal.__cell__.margins.width=this.getPageWidth(),i.call(this))},i=function(){this.internal.__cell__.lastCell=new s,this.internal.__cell__.pages=1},s=function(){var f=arguments[0];Object.defineProperty(this,"x",{enumerable:!0,get:function(){return f},set:function(E){f=E}});var d=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return d},set:function(E){d=E}});var p=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return p},set:function(E){p=E}});var g=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return g},set:function(E){g=E}});var b=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return b},set:function(E){b=E}});var y=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return y},set:function(E){y=E}});var M=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return M},set:function(E){M=E}}),this};s.prototype.clone=function(){return new s(this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align)},s.prototype.toArray=function(){return[this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align]},e.setHeaderFunction=function(f){return r.call(this),this.internal.__cell__.headerFunction=typeof f=="function"?f:void 0,this},e.getTextDimensions=function(f,d){r.call(this);var p=(d=d||{}).fontSize||this.getFontSize(),g=d.font||this.getFont(),b=d.scaleFactor||this.internal.scaleFactor,y=0,M=0,E=0,D=this;if(!Array.isArray(f)&&typeof f!="string"){if(typeof f!="number")throw new Error("getTextDimensions expects text-parameter to be of type String or type Number or an Array of Strings.");f=String(f)}var L=d.maxWidth;L>0?typeof f=="string"?f=this.splitTextToSize(f,L):Object.prototype.toString.call(f)==="[object Array]"&&(f=f.reduce(function($,Y){return $.concat(D.splitTextToSize(Y,L))},[])):f=Array.isArray(f)?f:[f];for(var q=0;q<f.length;q++)y<(E=this.getStringUnitWidth(f[q],{font:g})*p)&&(y=E);return y!==0&&(M=f.length),{w:y/=b,h:Math.max((M*p*this.getLineHeightFactor()-p*(this.getLineHeightFactor()-1))/b,0)}},e.cellAddPage=function(){r.call(this),this.addPage();var f=this.internal.__cell__.margins||t;return this.internal.__cell__.lastCell=new s(f.left,f.top,void 0,void 0),this.internal.__cell__.pages+=1,this};var l=e.cell=function(){var f;f=arguments[0]instanceof s?arguments[0]:new s(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6]),r.call(this);var d=this.internal.__cell__.lastCell,p=this.internal.__cell__.padding,g=this.internal.__cell__.margins||t,b=this.internal.__cell__.tableHeaderRow,y=this.internal.__cell__.printHeaders;return d.lineNumber!==void 0&&(d.lineNumber===f.lineNumber?(f.x=(d.x||0)+(d.width||0),f.y=d.y||0):d.y+d.height+f.height+g.bottom>this.getPageHeight()?(this.cellAddPage(),f.y=g.top,y&&b&&(this.printHeaderRow(f.lineNumber,!0),f.y+=b[0].height)):f.y=d.y+d.height||f.y),f.text[0]!==void 0&&(this.rect(f.x,f.y,f.width,f.height,n===!0?"FD":void 0),f.align==="right"?this.text(f.text,f.x+f.width-p,f.y+p,{align:"right",baseline:"top"}):f.align==="center"?this.text(f.text,f.x+f.width/2,f.y+p,{align:"center",baseline:"top",maxWidth:f.width-p-p}):this.text(f.text,f.x+p,f.y+p,{align:"left",baseline:"top",maxWidth:f.width-p-p})),this.internal.__cell__.lastCell=f,this};e.table=function(f,d,p,g,b){if(r.call(this),!p)throw new Error("No data for PDF table.");var y,M,E,D,L=[],q=[],$=[],Y={},ht={},Mt=[],vt=[],bt=(b=b||{}).autoSize||!1,rt=b.printHeaders!==!1,Dt=b.css&&b.css["font-size"]!==void 0?16*b.css["font-size"]:b.fontSize||12,Q=b.margins||Object.assign({width:this.getPageWidth()},t),lt=typeof b.padding=="number"?b.padding:3,X=b.headerBackgroundColor||"#c8c8c8",wt=b.headerTextColor||"#000";if(i.call(this),this.internal.__cell__.printHeaders=rt,this.internal.__cell__.margins=Q,this.internal.__cell__.table_font_size=Dt,this.internal.__cell__.padding=lt,this.internal.__cell__.headerBackgroundColor=X,this.internal.__cell__.headerTextColor=wt,this.setFontSize(Dt),g==null)q=L=Object.keys(p[0]),$=L.map(function(){return"left"});else if(Array.isArray(g)&&ii(g[0])==="object")for(L=g.map(function(te){return te.name}),q=g.map(function(te){return te.prompt||te.name||""}),$=g.map(function(te){return te.align||"left"}),y=0;y<g.length;y+=1)ht[g[y].name]=.7499990551181103*g[y].width;else Array.isArray(g)&&typeof g[0]=="string"&&(q=L=g,$=L.map(function(){return"left"}));if(bt||Array.isArray(g)&&typeof g[0]=="string")for(y=0;y<L.length;y+=1){for(Y[D=L[y]]=p.map(function(te){return te[D]}),this.setFont(void 0,"bold"),Mt.push(this.getTextDimensions(q[y],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),M=Y[D],this.setFont(void 0,"normal"),E=0;E<M.length;E+=1)Mt.push(this.getTextDimensions(M[E],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);ht[D]=Math.max.apply(null,Mt)+lt+lt,Mt=[]}if(rt){var Tt={};for(y=0;y<L.length;y+=1)Tt[L[y]]={},Tt[L[y]].text=q[y],Tt[L[y]].align=$[y];var yt=c.call(this,Tt,ht);vt=L.map(function(te){return new s(f,d,ht[te],yt,Tt[te].text,void 0,Tt[te].align)}),this.setTableHeaderRow(vt),this.printHeaderRow(1,!1)}var J=g.reduce(function(te,Z){return te[Z.name]=Z.align,te},{});for(y=0;y<p.length;y+=1){"rowStart"in b&&b.rowStart instanceof Function&&b.rowStart({row:y,data:p[y]},this);var ct=c.call(this,p[y],ht);for(E=0;E<L.length;E+=1){var Bt=p[y][L[E]];"cellStart"in b&&b.cellStart instanceof Function&&b.cellStart({row:y,col:E,data:Bt},this),l.call(this,new s(f,d,ht[L[E]],ct,Bt,y+2,J[L[E]]))}}return this.internal.__cell__.table_x=f,this.internal.__cell__.table_y=d,this};var c=function(f,d){var p=this.internal.__cell__.padding,g=this.internal.__cell__.table_font_size,b=this.internal.scaleFactor;return Object.keys(f).map(function(y){var M=f[y];return this.splitTextToSize(M.hasOwnProperty("text")?M.text:M,d[y]-p-p)},this).map(function(y){return this.getLineHeightFactor()*y.length*g/b+p+p},this).reduce(function(y,M){return Math.max(y,M)},0)};e.setTableHeaderRow=function(f){r.call(this),this.internal.__cell__.tableHeaderRow=f},e.printHeaderRow=function(f,d){if(r.call(this),!this.internal.__cell__.tableHeaderRow)throw new Error("Property tableHeaderRow does not exist.");var p;if(n=!0,typeof this.internal.__cell__.headerFunction=="function"){var g=this.internal.__cell__.headerFunction(this,this.internal.__cell__.pages);this.internal.__cell__.lastCell=new s(g[0],g[1],g[2],g[3],void 0,-1)}this.setFont(void 0,"bold");for(var b=[],y=0;y<this.internal.__cell__.tableHeaderRow.length;y+=1){p=this.internal.__cell__.tableHeaderRow[y].clone(),d&&(p.y=this.internal.__cell__.margins.top||0,b.push(p)),p.lineNumber=f;var M=this.getTextColor();this.setTextColor(this.internal.__cell__.headerTextColor),this.setFillColor(this.internal.__cell__.headerBackgroundColor),l.call(this,p),this.setTextColor(M)}b.length>0&&this.setTableHeaderRow(b),this.setFont(void 0,"normal"),n=!1}})(xn.API);var W4={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},X4=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],X2=V4(X4),G4=[100,200,300,400,500,600,700,800,900],L_=V4(G4);function Hy(e){var t=e.family.replace(/"|'/g,"").toLowerCase(),n=(function(s){return W4[s=s||"normal"]?s:"normal"})(e.style),r=(function(s){return s?typeof s=="number"?s>=100&&s<=900&&s%100==0?s:400:/^\d00$/.test(s)?parseInt(s):s==="bold"?700:400:400})(e.weight),i=(function(s){return typeof X2[s=s||"normal"]=="number"?s:"normal"})(e.stretch);return{family:t,style:n,weight:r,stretch:i,src:e.src||[],ref:e.ref||{name:t,style:[i,n,r].join(" ")}}}function eS(e,t,n,r){var i;for(i=n;i>=0&&i<t.length;i+=r)if(e[t[i]])return e[t[i]];for(i=n;i>=0&&i<t.length;i-=r)if(e[t[i]])return e[t[i]]}var R_={"sans-serif":"helvetica",fixed:"courier",monospace:"courier",terminal:"courier",cursive:"times",fantasy:"times",serif:"times"},nS={caption:"times",icon:"times",menu:"times","message-box":"times","small-caption":"times","status-bar":"times"};function rS(e){return[e.stretch,e.style,e.weight,e.family].join(" ")}function iS(e){return e.trimLeft()}function O_(e,t){for(var n=0;n<e.length;){if(e.charAt(n)===t)return[e.substring(0,n),e.substring(n+1)];n+=1}return null}function P_(e){var t=e.match(/^(-[a-z_]|[a-z_])[a-z0-9_-]*/i);return t===null?null:[t[0],e.substring(t[0].length)]}var $d,Jm,oS,sS,aS,qy=["times"];function lS(e,t,n,r,i){var s=4,l=uS;switch(i){case xn.API.image_compression.FAST:s=1,l=cS;break;case xn.API.image_compression.MEDIUM:s=6,l=fS;break;case xn.API.image_compression.SLOW:s=9,l=dS}e=(function(f,d,p,g){for(var b,y=f.length/d,M=new Uint8Array(f.length+y),E=[j_,cS,uS,fS,dS],D=0;D<y;D+=1){var L=D*d,q=f.subarray(L,L+d);if(g)M.set(g(q,p,b),L+D);else{for(var $=E.length,Y=[],ht=0;ht<$;ht+=1)Y[ht]=E[ht](q,p,b);var Mt=z_(Y.concat());M.set(Y[Mt],L+D)}b=q}return M})(e,t,Math.ceil(n*r/8),l);var c=U2(e,{level:s});return xn.API.__addimage__.arrayBufferToBinaryString(c)}function j_(e){var t=Array.apply([],e);return t.unshift(0),t}function cS(e,t){var n=e.length,r=[];r[0]=1;for(var i=0;i<n;i+=1){var s=e[i-t]||0;r[i+1]=e[i]-s+256&255}return r}function uS(e,t,n){var r=e.length,i=[];i[0]=2;for(var s=0;s<r;s+=1){var l=n&&n[s]||0;i[s+1]=e[s]-l+256&255}return i}function fS(e,t,n){var r=e.length,i=[];i[0]=3;for(var s=0;s<r;s+=1){var l=e[s-t]||0,c=n&&n[s]||0;i[s+1]=e[s]+256-(l+c>>>1)&255}return i}function dS(e,t,n){var r=e.length,i=[];i[0]=4;for(var s=0;s<r;s+=1){var l=I_(e[s-t]||0,n&&n[s]||0,n&&n[s-t]||0);i[s+1]=e[s]-l+256&255}return i}function I_(e,t,n){if(e===t&&t===n)return e;var r=Math.abs(t-n),i=Math.abs(e-n),s=Math.abs(e+t-n-n);return r<=i&&r<=s?e:i<=s?t:n}function z_(e){var t=e.map(function(n){return n.reduce(function(r,i){return r+Math.abs(i)},0)});return t.indexOf(Math.min.apply(null,t))}function $y(e,t,n){var r=t*n,i=Math.floor(r/8),s=16-(r-8*i+n),l=(1<<n)-1;return K4(e,i)>>s&l}function hS(e,t,n,r){var i=n*r,s=Math.floor(i/8),l=16-(i-8*s+r),c=(1<<r)-1,f=(t&c)<<l;(function(d,p,g){if(p+1<d.byteLength)d.setUint16(p,g,!1);else{var b=g>>8&255;d.setUint8(p,b)}})(e,s,K4(e,s)&~(c<<l)&65535|f)}function K4(e,t){return t+1<e.byteLength?e.getUint16(t,!1):e.getUint8(t)<<8}function B_(e){var t=0;if(e[t++]!==71||e[t++]!==73||e[t++]!==70||e[t++]!==56||(e[t++]+1&253)!=56||e[t++]!==97)throw new Error("Invalid GIF 87a/89a header.");var n=e[t++]|e[t++]<<8,r=e[t++]|e[t++]<<8,i=e[t++],s=i>>7,l=1<<1+(7&i);e[t++],e[t++];var c=null,f=null;s&&(c=t,f=l,t+=3*l);var d=!0,p=[],g=0,b=null,y=0,M=null;for(this.width=n,this.height=r;d&&t<e.length;)switch(e[t++]){case 33:switch(e[t++]){case 255:if(e[t]!==11||e[t+1]==78&&e[t+2]==69&&e[t+3]==84&&e[t+4]==83&&e[t+5]==67&&e[t+6]==65&&e[t+7]==80&&e[t+8]==69&&e[t+9]==50&&e[t+10]==46&&e[t+11]==48&&e[t+12]==3&&e[t+13]==1&&e[t+16]==0)t+=14,M=e[t++]|e[t++]<<8,t++;else for(t+=12;;){if(!((Q=e[t++])>=0))throw Error("Invalid block size");if(Q===0)break;t+=Q}break;case 249:if(e[t++]!==4||e[t+4]!==0)throw new Error("Invalid graphics extension block.");var E=e[t++];g=e[t++]|e[t++]<<8,b=e[t++],1&E||(b=null),y=E>>2&7,t++;break;case 254:for(;;){if(!((Q=e[t++])>=0))throw Error("Invalid block size");if(Q===0)break;t+=Q}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var D=e[t++]|e[t++]<<8,L=e[t++]|e[t++]<<8,q=e[t++]|e[t++]<<8,$=e[t++]|e[t++]<<8,Y=e[t++],ht=Y>>6&1,Mt=1<<1+(7&Y),vt=c,bt=f,rt=!1;Y>>7&&(rt=!0,vt=t,bt=Mt,t+=3*Mt);var Dt=t;for(t++;;){var Q;if(!((Q=e[t++])>=0))throw Error("Invalid block size");if(Q===0)break;t+=Q}p.push({x:D,y:L,width:q,height:$,has_local_palette:rt,palette_offset:vt,palette_size:bt,data_offset:Dt,data_length:t-Dt,transparent_index:b,interlaced:!!ht,delay:g,disposal:y});break;case 59:d=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return p.length},this.loopCount=function(){return M},this.frameInfo=function(lt){if(lt<0||lt>=p.length)throw new Error("Frame index out of range.");return p[lt]},this.decodeAndBlitFrameBGRA=function(lt,X){var wt=this.frameInfo(lt),Tt=wt.width*wt.height;if(Tt>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var yt=new Uint8Array(Tt);pS(e,wt.data_offset,yt,Tt);var J=wt.palette_offset,ct=wt.transparent_index;ct===null&&(ct=256);var Bt=wt.width,te=n-Bt,Z=Bt,P=4*(wt.y*n+wt.x),j=4*((wt.y+wt.height)*n+wt.x),G=P,ut=4*te;wt.interlaced===!0&&(ut+=4*n*7);for(var xt=8,St=0,Ft=yt.length;St<Ft;++St){var Rt=yt[St];if(Z===0&&(Z=Bt,(G+=ut)>=j&&(ut=4*te+4*n*(xt-1),G=P+(Bt+te)*(xt<<1),xt>>=1)),Rt===ct)G+=4;else{var Qt=e[J+3*Rt],ve=e[J+3*Rt+1],je=e[J+3*Rt+2];X[G++]=je,X[G++]=ve,X[G++]=Qt,X[G++]=255}--Z}},this.decodeAndBlitFrameRGBA=function(lt,X){var wt=this.frameInfo(lt),Tt=wt.width*wt.height;if(Tt>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var yt=new Uint8Array(Tt);pS(e,wt.data_offset,yt,Tt);var J=wt.palette_offset,ct=wt.transparent_index;ct===null&&(ct=256);var Bt=wt.width,te=n-Bt,Z=Bt,P=4*(wt.y*n+wt.x),j=4*((wt.y+wt.height)*n+wt.x),G=P,ut=4*te;wt.interlaced===!0&&(ut+=4*n*7);for(var xt=8,St=0,Ft=yt.length;St<Ft;++St){var Rt=yt[St];if(Z===0&&(Z=Bt,(G+=ut)>=j&&(ut=4*te+4*n*(xt-1),G=P+(Bt+te)*(xt<<1),xt>>=1)),Rt===ct)G+=4;else{var Qt=e[J+3*Rt],ve=e[J+3*Rt+1],je=e[J+3*Rt+2];X[G++]=Qt,X[G++]=ve,X[G++]=je,X[G++]=255}--Z}}}function pS(e,t,n,r){for(var i=e[t++],s=1<<i,l=s+1,c=l+1,f=i+1,d=(1<<f)-1,p=0,g=0,b=0,y=e[t++],M=new Int32Array(4096),E=null;;){for(;p<16&&y!==0;)g|=e[t++]<<p,p+=8,y===1?y=e[t++]:--y;if(p<f)break;var D=g&d;if(g>>=f,p-=f,D!==s){if(D===l)break;for(var L=D<c?D:E,q=0,$=L;$>s;)$=M[$]>>8,++q;var Y=$;if(b+q+(L!==D?1:0)>r)return void yi.log("Warning, gif stream longer than expected.");n[b++]=Y;var ht=b+=q;for(L!==D&&(n[b++]=Y),$=L;q--;)$=M[$],n[--ht]=255&$,$>>=8;E!==null&&c<4096&&(M[c++]=E<<8|Y,c>=d+1&&f<12&&(++f,d=d<<1|1)),E=D}else c=l+1,d=(1<<(f=i+1))-1,E=null}return b!==r&&yi.log("Warning, gif stream shorter than expected."),n}function Yy(e){var t,n,r,i,s,l=Math.floor,c=new Array(64),f=new Array(64),d=new Array(64),p=new Array(64),g=new Array(65535),b=new Array(65535),y=new Array(64),M=new Array(64),E=[],D=0,L=7,q=new Array(64),$=new Array(64),Y=new Array(64),ht=new Array(256),Mt=new Array(2048),vt=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],bt=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],rt=[0,1,2,3,4,5,6,7,8,9,10,11],Dt=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],Q=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],lt=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],X=[0,1,2,3,4,5,6,7,8,9,10,11],wt=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],Tt=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function yt(P,j){for(var G=0,ut=0,xt=new Array,St=1;St<=16;St++){for(var Ft=1;Ft<=P[St];Ft++)xt[j[ut]]=[],xt[j[ut]][0]=G,xt[j[ut]][1]=St,ut++,G++;G*=2}return xt}function J(P){for(var j=P[0],G=P[1]-1;G>=0;)j&1<<G&&(D|=1<<L),G--,--L<0&&(D==255?(ct(255),ct(0)):ct(D),L=7,D=0)}function ct(P){E.push(P)}function Bt(P){ct(P>>8&255),ct(255&P)}function te(P,j,G,ut,xt){for(var St,Ft=xt[0],Rt=xt[240],Qt=(function(ge,Te){var Ne,_e,Ye,un,Fn,Ue,_n,dn,Be,We,Ie=0;for(Be=0;Be<8;++Be){Ne=ge[Ie],_e=ge[Ie+1],Ye=ge[Ie+2],un=ge[Ie+3],Fn=ge[Ie+4],Ue=ge[Ie+5],_n=ge[Ie+6];var kr=Ne+(dn=ge[Ie+7]),Cn=Ne-dn,nn=_e+_n,ln=_e-_n,Ln=Ye+Ue,Ke=Ye-Ue,ar=un+Fn,wn=un-Fn,Sn=kr+ar,gr=kr-ar,En=nn+Ln,en=nn-Ln;ge[Ie]=Sn+En,ge[Ie+4]=Sn-En;var Kn=.707106781*(en+gr);ge[Ie+2]=gr+Kn,ge[Ie+6]=gr-Kn;var ws=.382683433*((Sn=wn+Ke)-(en=ln+Cn)),qi=.5411961*Sn+ws,Xt=1.306562965*en+ws,Re=.707106781*(En=Ke+ln),Ae=Cn+Re,De=Cn-Re;ge[Ie+5]=De+qi,ge[Ie+3]=De-qi,ge[Ie+1]=Ae+Xt,ge[Ie+7]=Ae-Xt,Ie+=8}for(Ie=0,Be=0;Be<8;++Be){Ne=ge[Ie],_e=ge[Ie+8],Ye=ge[Ie+16],un=ge[Ie+24],Fn=ge[Ie+32],Ue=ge[Ie+40],_n=ge[Ie+48];var or=Ne+(dn=ge[Ie+56]),Hn=Ne-dn,lr=_e+_n,Wr=_e-_n,Dr=Ye+Ue,vi=Ye-Ue,Wt=un+Fn,qr=un-Fn,er=or+Wt,Rn=or-Wt,oo=lr+Dr,Wo=lr-Dr;ge[Ie]=er+oo,ge[Ie+32]=er-oo;var Us=.707106781*(Wo+Rn);ge[Ie+16]=Rn+Us,ge[Ie+48]=Rn-Us;var Ja=.382683433*((er=qr+vi)-(Wo=Wr+Hn)),Hs=.5411961*er+Ja,Lo=1.306562965*Wo+Ja,is=.707106781*(oo=vi+Wr),qs=Hn+is,pi=Hn-is;ge[Ie+40]=pi+Hs,ge[Ie+24]=pi-Hs,ge[Ie+8]=qs+Lo,ge[Ie+56]=qs-Lo,Ie++}for(Be=0;Be<64;++Be)We=ge[Be]*Te[Be],y[Be]=We>0?We+.5|0:We-.5|0;return y})(P,j),ve=0;ve<64;++ve)M[vt[ve]]=Qt[ve];var je=M[0]-G;G=M[0],je==0?J(ut[0]):(J(ut[b[St=32767+je]]),J(g[St]));for(var Pe=63;Pe>0&&M[Pe]==0;)Pe--;if(Pe==0)return J(Ft),G;for(var Ve,ft=1;ft<=Pe;){for(var Oe=ft;M[ft]==0&&ft<=Pe;)++ft;var In=ft-Oe;if(In>=16){Ve=In>>4;for(var fe=1;fe<=Ve;++fe)J(Rt);In&=15}St=32767+M[ft],J(xt[(In<<4)+b[St]]),J(g[St]),ft++}return Pe!=63&&J(Ft),G}function Z(P){P=Math.min(Math.max(P,1),100),s!=P&&((function(j){for(var G=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],ut=0;ut<64;ut++){var xt=l((G[ut]*j+50)/100);xt=Math.min(Math.max(xt,1),255),c[vt[ut]]=xt}for(var St=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],Ft=0;Ft<64;Ft++){var Rt=l((St[Ft]*j+50)/100);Rt=Math.min(Math.max(Rt,1),255),f[vt[Ft]]=Rt}for(var Qt=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],ve=0,je=0;je<8;je++)for(var Pe=0;Pe<8;Pe++)d[ve]=1/(c[vt[ve]]*Qt[je]*Qt[Pe]*8),p[ve]=1/(f[vt[ve]]*Qt[je]*Qt[Pe]*8),ve++})(P<50?Math.floor(5e3/P):Math.floor(200-2*P)),s=P)}this.encode=function(P,j){j&&Z(j),E=new Array,D=0,L=7,Bt(65496),Bt(65504),Bt(16),ct(74),ct(70),ct(73),ct(70),ct(0),ct(1),ct(1),ct(0),Bt(1),Bt(1),ct(0),ct(0),(function(){Bt(65499),Bt(132),ct(0);for(var _e=0;_e<64;_e++)ct(c[_e]);ct(1);for(var Ye=0;Ye<64;Ye++)ct(f[Ye])})(),(function(_e,Ye){Bt(65472),Bt(17),ct(8),Bt(Ye),Bt(_e),ct(3),ct(1),ct(17),ct(0),ct(2),ct(17),ct(1),ct(3),ct(17),ct(1)})(P.width,P.height),(function(){Bt(65476),Bt(418),ct(0);for(var _e=0;_e<16;_e++)ct(bt[_e+1]);for(var Ye=0;Ye<=11;Ye++)ct(rt[Ye]);ct(16);for(var un=0;un<16;un++)ct(Dt[un+1]);for(var Fn=0;Fn<=161;Fn++)ct(Q[Fn]);ct(1);for(var Ue=0;Ue<16;Ue++)ct(lt[Ue+1]);for(var _n=0;_n<=11;_n++)ct(X[_n]);ct(17);for(var dn=0;dn<16;dn++)ct(wt[dn+1]);for(var Be=0;Be<=161;Be++)ct(Tt[Be])})(),Bt(65498),Bt(12),ct(3),ct(1),ct(0),ct(2),ct(17),ct(3),ct(17),ct(0),ct(63),ct(0);var G=0,ut=0,xt=0;D=0,L=7,this.encode.displayName="_encode_";for(var St,Ft,Rt,Qt,ve,je,Pe,Ve,ft,Oe=P.data,In=P.width,fe=P.height,ge=4*In,Te=0;Te<fe;){for(St=0;St<ge;){for(ve=ge*Te+St,Pe=-1,Ve=0,ft=0;ft<64;ft++)je=ve+(Ve=ft>>3)*ge+(Pe=4*(7&ft)),Te+Ve>=fe&&(je-=ge*(Te+1+Ve-fe)),St+Pe>=ge&&(je-=St+Pe-ge+4),Ft=Oe[je++],Rt=Oe[je++],Qt=Oe[je++],q[ft]=(Mt[Ft]+Mt[Rt+256|0]+Mt[Qt+512|0]>>16)-128,$[ft]=(Mt[Ft+768|0]+Mt[Rt+1024|0]+Mt[Qt+1280|0]>>16)-128,Y[ft]=(Mt[Ft+1280|0]+Mt[Rt+1536|0]+Mt[Qt+1792|0]>>16)-128;G=te(q,d,G,t,r),ut=te($,p,ut,n,i),xt=te(Y,p,xt,n,i),St+=32}Te+=8}if(L>=0){var Ne=[];Ne[1]=L+1,Ne[0]=(1<<L+1)-1,J(Ne)}return Bt(65497),new Uint8Array(E)},e=e||50,(function(){for(var P=String.fromCharCode,j=0;j<256;j++)ht[j]=P(j)})(),t=yt(bt,rt),n=yt(lt,X),r=yt(Dt,Q),i=yt(wt,Tt),(function(){for(var P=1,j=2,G=1;G<=15;G++){for(var ut=P;ut<j;ut++)b[32767+ut]=G,g[32767+ut]=[],g[32767+ut][1]=G,g[32767+ut][0]=ut;for(var xt=-(j-1);xt<=-P;xt++)b[32767+xt]=G,g[32767+xt]=[],g[32767+xt][1]=G,g[32767+xt][0]=j-1+xt;P<<=1,j<<=1}})(),(function(){for(var P=0;P<256;P++)Mt[P]=19595*P,Mt[P+256|0]=38470*P,Mt[P+512|0]=7471*P+32768,Mt[P+768|0]=-11059*P,Mt[P+1024|0]=-21709*P,Mt[P+1280|0]=32768*P+8421375,Mt[P+1536|0]=-27439*P,Mt[P+1792|0]=-5329*P})(),Z(e)}function gc(e,t){if(this.pos=0,this.buffer=e,this.datav=new DataView(e.buffer),this.is_with_alpha=!!t,this.bottom_up=!0,this.flag=String.fromCharCode(this.buffer[0])+String.fromCharCode(this.buffer[1]),this.pos+=2,["BM","BA","CI","CP","IC","PT"].indexOf(this.flag)===-1)throw new Error("Invalid BMP File");this.parseHeader(),this.parseBGR()}function mS(e){function t(rt){if(!rt)throw Error("assert :P")}function n(rt,Dt,Q){for(var lt=0;4>lt;lt++)if(rt[Dt+lt]!=Q.charCodeAt(lt))return!0;return!1}function r(rt,Dt,Q,lt,X){for(var wt=0;wt<X;wt++)rt[Dt+wt]=Q[lt+wt]}function i(rt,Dt,Q,lt){for(var X=0;X<lt;X++)rt[Dt+X]=Q}function s(rt){return new Int32Array(rt)}function l(rt,Dt){for(var Q=[],lt=0;lt<rt;lt++)Q.push(new Dt);return Q}function c(rt,Dt){var Q=[];return(function lt(X,wt,Tt){for(var yt=Tt[wt],J=0;J<yt&&(X.push(Tt.length>wt+1?[]:new Dt),!(Tt.length<wt+1));J++)lt(X[J],wt+1,Tt)})(Q,0,rt),Q}var f=function(){var rt=this;function Dt(m,v){for(var T=1<<v-1>>>0;m&T;)T>>>=1;return T?(m&T-1)+T:m}function Q(m,v,T,R,H){t(!(R%T));do m[v+(R-=T)]=H;while(0<R)}function lt(m,v,T,R,H){if(t(2328>=H),512>=H)var V=s(512);else if((V=s(H))==null)return 0;return(function(K,it,at,mt,_t,Vt){var gt,Pt,qt=it,ie=1<<at,$t=s(16),re=s(16);for(t(_t!=0),t(mt!=null),t(K!=null),t(0<at),Pt=0;Pt<_t;++Pt){if(15<mt[Pt])return 0;++$t[mt[Pt]]}if($t[0]==_t)return 0;for(re[1]=0,gt=1;15>gt;++gt){if($t[gt]>1<<gt)return 0;re[gt+1]=re[gt]+$t[gt]}for(Pt=0;Pt<_t;++Pt)gt=mt[Pt],0<mt[Pt]&&(Vt[re[gt]++]=Pt);if(re[15]==1)return(mt=new X).g=0,mt.value=Vt[0],Q(K,qt,1,ie,mt),ie;var se,we=-1,he=ie-1,tn=0,He=1,jn=1,Ze=1<<at;for(Pt=0,gt=1,_t=2;gt<=at;++gt,_t<<=1){if(He+=jn<<=1,0>(jn-=$t[gt]))return 0;for(;0<$t[gt];--$t[gt])(mt=new X).g=gt,mt.value=Vt[Pt++],Q(K,qt+tn,_t,Ze,mt),tn=Dt(tn,gt)}for(gt=at+1,_t=2;15>=gt;++gt,_t<<=1){if(He+=jn<<=1,0>(jn-=$t[gt]))return 0;for(;0<$t[gt];--$t[gt]){if(mt=new X,(tn&he)!=we){for(qt+=Ze,se=1<<(we=gt)-at;15>we&&!(0>=(se-=$t[we]));)++we,se<<=1;ie+=Ze=1<<(se=we-at),K[it+(we=tn&he)].g=se+at,K[it+we].value=qt-it-we}mt.g=gt-at,mt.value=Vt[Pt++],Q(K,qt+(tn>>at),_t,Ze,mt),tn=Dt(tn,gt)}}return He!=2*re[15]-1?0:ie})(m,v,T,R,H,V)}function X(){this.value=this.g=0}function wt(){this.value=this.g=0}function Tt(){this.G=l(5,X),this.H=s(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=l(rc,wt)}function yt(m,v,T,R){t(m!=null),t(v!=null),t(2147483648>R),m.Ca=254,m.I=0,m.b=-8,m.Ka=0,m.oa=v,m.pa=T,m.Jd=v,m.Yc=T+R,m.Zc=4<=R?T+R-4+1:T,Ft(m)}function J(m,v){for(var T=0;0<v--;)T|=Qt(m,128)<<v;return T}function ct(m,v){var T=J(m,v);return Rt(m)?-T:T}function Bt(m,v,T,R){var H,V=0;for(t(m!=null),t(v!=null),t(4294967288>R),m.Sb=R,m.Ra=0,m.u=0,m.h=0,4<R&&(R=4),H=0;H<R;++H)V+=v[T+H]<<8*H;m.Ra=V,m.bb=R,m.oa=v,m.pa=T}function te(m){for(;8<=m.u&&m.bb<m.Sb;)m.Ra>>>=8,m.Ra+=m.oa[m.pa+m.bb]<<Vi-8>>>0,++m.bb,m.u-=8;ut(m)&&(m.h=1,m.u=0)}function Z(m,v){if(t(0<=v),!m.h&&v<=Ml){var T=G(m)&_a[v];return m.u+=v,te(m),T}return m.h=1,m.u=0}function P(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function j(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function G(m){return m.Ra>>>(m.u&Vi-1)>>>0}function ut(m){return t(m.bb<=m.Sb),m.h||m.bb==m.Sb&&m.u>Vi}function xt(m,v){m.u=v,m.h=ut(m)}function St(m){m.u>=Po&&(t(m.u>=Po),te(m))}function Ft(m){t(m!=null&&m.oa!=null),m.pa<m.Zc?(m.I=(m.oa[m.pa++]|m.I<<8)>>>0,m.b+=8):(t(m!=null&&m.oa!=null),m.pa<m.Yc?(m.b+=8,m.I=m.oa[m.pa++]|m.I<<8):m.Ka?m.b=0:(m.I<<=8,m.b+=8,m.Ka=1))}function Rt(m){return J(m,1)}function Qt(m,v){var T=m.Ca;0>m.b&&Ft(m);var R=m.b,H=T*v>>>8,V=(m.I>>>R>H)+0;for(V?(T-=H,m.I-=H+1<<R>>>0):T=H+1,R=T,H=0;256<=R;)H+=8,R>>=8;return R=7^H+Cl[R],m.b-=R,m.Ca=(T<<R)-1,V}function ve(m,v,T){m[v+0]=T>>24&255,m[v+1]=T>>16&255,m[v+2]=T>>8&255,m[v+3]=255&T}function je(m,v){return m[v+0]|m[v+1]<<8}function Pe(m,v){return je(m,v)|m[v+2]<<16}function Ve(m,v){return je(m,v)|je(m,v+2)<<16}function ft(m,v){var T=1<<v;return t(m!=null),t(0<v),m.X=s(T),m.X==null?0:(m.Mb=32-v,m.Xa=v,1)}function Oe(m,v){t(m!=null),t(v!=null),t(m.Xa==v.Xa),r(v.X,0,m.X,0,1<<v.Xa)}function In(){this.X=[],this.Xa=this.Mb=0}function fe(m,v,T,R){t(T!=null),t(R!=null);var H=T[0],V=R[0];return H==0&&(H=(m*V+v/2)/v),V==0&&(V=(v*H+m/2)/m),0>=H||0>=V?0:(T[0]=H,R[0]=V,1)}function ge(m,v){return m+(1<<v)-1>>>v}function Te(m,v){return((4278255360&m)+(4278255360&v)>>>0&4278255360)+((16711935&m)+(16711935&v)>>>0&16711935)>>>0}function Ne(m,v){rt[v]=function(T,R,H,V,K,it,at){var mt;for(mt=0;mt<K;++mt){var _t=rt[m](it[at+mt-1],H,V+mt);it[at+mt]=Te(T[R+mt],_t)}}}function _e(){this.ud=this.hd=this.jd=0}function Ye(m,v){return((4278124286&(m^v))>>>1)+(m&v)>>>0}function un(m){return 0<=m&&256>m?m:0>m?0:255<m?255:void 0}function Fn(m,v){return un(m+(m-v+.5>>1))}function Ue(m,v,T){return Math.abs(v-T)-Math.abs(m-T)}function _n(m,v,T,R,H,V,K){for(R=V[K-1],T=0;T<H;++T)V[K+T]=R=Te(m[v+T],R)}function dn(m,v,T,R,H){var V;for(V=0;V<T;++V){var K=m[v+V],it=K>>8&255,at=16711935&(at=(at=16711935&K)+((it<<16)+it));R[H+V]=(4278255360&K)+at>>>0}}function Be(m,v){v.jd=255&m,v.hd=m>>8&255,v.ud=m>>16&255}function We(m,v,T,R,H,V){var K;for(K=0;K<R;++K){var it=v[T+K],at=it>>>8,mt=it,_t=255&(_t=(_t=it>>>16)+((m.jd<<24>>24)*(at<<24>>24)>>>5));mt=255&(mt=(mt+=(m.hd<<24>>24)*(at<<24>>24)>>>5)+((m.ud<<24>>24)*(_t<<24>>24)>>>5)),H[V+K]=(4278255360&it)+(_t<<16)+mt}}function Ie(m,v,T,R,H){rt[v]=function(V,K,it,at,mt,_t,Vt,gt,Pt){for(at=Vt;at<gt;++at)for(Vt=0;Vt<Pt;++Vt)mt[_t++]=H(it[R(V[K++])])},rt[m]=function(V,K,it,at,mt,_t,Vt){var gt=8>>V.b,Pt=V.Ea,qt=V.K[0],ie=V.w;if(8>gt)for(V=(1<<V.b)-1,ie=(1<<gt)-1;K<it;++K){var $t,re=0;for($t=0;$t<Pt;++$t)$t&V||(re=R(at[mt++])),_t[Vt++]=H(qt[re&ie]),re>>=gt}else rt["VP8LMapColor"+T](at,mt,qt,ie,_t,Vt,K,it,Pt)}}function kr(m,v,T,R,H){for(T=v+T;v<T;){var V=m[v++];R[H++]=V>>16&255,R[H++]=V>>8&255,R[H++]=255&V}}function Cn(m,v,T,R,H){for(T=v+T;v<T;){var V=m[v++];R[H++]=V>>16&255,R[H++]=V>>8&255,R[H++]=255&V,R[H++]=V>>24&255}}function nn(m,v,T,R,H){for(T=v+T;v<T;){var V=(K=m[v++])>>16&240|K>>12&15,K=240&K|K>>28&15;R[H++]=V,R[H++]=K}}function ln(m,v,T,R,H){for(T=v+T;v<T;){var V=(K=m[v++])>>16&248|K>>13&7,K=K>>5&224|K>>3&31;R[H++]=V,R[H++]=K}}function Ln(m,v,T,R,H){for(T=v+T;v<T;){var V=m[v++];R[H++]=255&V,R[H++]=V>>8&255,R[H++]=V>>16&255}}function Ke(m,v,T,R,H,V){if(V==0)for(T=v+T;v<T;)ve(R,((V=m[v++])[0]>>24|V[1]>>8&65280|V[2]<<8&16711680|V[3]<<24)>>>0),H+=32;else r(R,H,m,v,T)}function ar(m,v){rt[v][0]=rt[m+"0"],rt[v][1]=rt[m+"1"],rt[v][2]=rt[m+"2"],rt[v][3]=rt[m+"3"],rt[v][4]=rt[m+"4"],rt[v][5]=rt[m+"5"],rt[v][6]=rt[m+"6"],rt[v][7]=rt[m+"7"],rt[v][8]=rt[m+"8"],rt[v][9]=rt[m+"9"],rt[v][10]=rt[m+"10"],rt[v][11]=rt[m+"11"],rt[v][12]=rt[m+"12"],rt[v][13]=rt[m+"13"],rt[v][14]=rt[m+"0"],rt[v][15]=rt[m+"0"]}function wn(m){return m==jc||m==uu||m==cc||m==fu}function Sn(){this.eb=[],this.size=this.A=this.fb=0}function gr(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function En(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new Sn,this.f.kb=new gr,this.sd=null}function en(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function Kn(){this.Id=this.fd=this.Md=this.hb=this.ib=this.da=this.bd=this.cd=this.j=this.v=this.Da=this.Sd=this.ob=0}function ws(m){return alert("todo:WebPSamplerProcessPlane"),m.T}function qi(m,v){var T=m.T,R=v.ba.f.RGBA,H=R.eb,V=R.fb+m.ka*R.A,K=lo[v.ba.S],it=m.y,at=m.O,mt=m.f,_t=m.N,Vt=m.ea,gt=m.W,Pt=v.cc,qt=v.dc,ie=v.Mc,$t=v.Nc,re=m.ka,se=m.ka+m.T,we=m.U,he=we+1>>1;for(re==0?K(it,at,null,null,mt,_t,Vt,gt,mt,_t,Vt,gt,H,V,null,null,we):(K(v.ec,v.fc,it,at,Pt,qt,ie,$t,mt,_t,Vt,gt,H,V-R.A,H,V,we),++T);re+2<se;re+=2)Pt=mt,qt=_t,ie=Vt,$t=gt,_t+=m.Rc,gt+=m.Rc,V+=2*R.A,K(it,(at+=2*m.fa)-m.fa,it,at,Pt,qt,ie,$t,mt,_t,Vt,gt,H,V-R.A,H,V,we);return at+=m.fa,m.j+se<m.o?(r(v.ec,v.fc,it,at,we),r(v.cc,v.dc,mt,_t,he),r(v.Mc,v.Nc,Vt,gt,he),T--):1&se||K(it,at,null,null,mt,_t,Vt,gt,mt,_t,Vt,gt,H,V+R.A,null,null,we),T}function Xt(m,v,T){var R=m.F,H=[m.J];if(R!=null){var V=m.U,K=v.ba.S,it=K==Pc||K==cc;v=v.ba.f.RGBA;var at=[0],mt=m.ka;at[0]=m.T,m.Kb&&(mt==0?--at[0]:(--mt,H[0]-=m.width),m.j+m.ka+m.T==m.o&&(at[0]=m.o-m.j-mt));var _t=v.eb;mt=v.fb+mt*v.A,m=Lc(R,H[0],m.width,V,at,_t,mt+(it?0:3),v.A),t(T==at),m&&wn(K)&&Ra(_t,mt,it,V,at,v.A)}return 0}function Re(m){var v=m.ma,T=v.ba.S,R=11>T,H=T==Io||T==Ts||T==Pc||T==lc||T==12||wn(T);if(v.memory=null,v.Ib=null,v.Jb=null,v.Nd=null,!Li(v.Oa,m,H?11:12))return 0;if(H&&wn(T)&&ta(),m.da)alert("todo:use_scaling");else{if(R){if(v.Ib=ws,m.Kb){if(T=m.U+1>>1,v.memory=s(m.U+2*T),v.memory==null)return 0;v.ec=v.memory,v.fc=0,v.cc=v.ec,v.dc=v.fc+m.U,v.Mc=v.cc,v.Nc=v.dc+T,v.Ib=qi,ta()}}else alert("todo:EmitYUV");H&&(v.Jb=Xt,R&&si())}if(R&&!Ll){for(m=0;256>m;++m)co[m]=89858*(m-128)+dc>>Ls,Bc[m]=-22014*(m-128)+dc,pu[m]=-45773*(m-128),Vu[m]=113618*(m-128)+dc>>Ls;for(m=hc;m<Dl;++m)v=76283*(m-16)+dc>>Ls,Ff[m-hc]=$s(v,255),Uf[m-hc]=$s(v+8>>4,15);Ll=1}return 1}function Ae(m){var v=m.ma,T=m.U,R=m.T;return t(!(1&m.ka)),0>=T||0>=R?0:(T=v.Ib(m,v),v.Jb!=null&&v.Jb(m,v,T),v.Dc+=T,1)}function De(m){m.ma.memory=null}function or(m,v,T,R){return Z(m,8)!=47?0:(v[0]=Z(m,14)+1,T[0]=Z(m,14)+1,R[0]=Z(m,1),Z(m,3)!=0?0:!m.h)}function Hn(m,v){if(4>m)return m+1;var T=m-2>>1;return(2+(1&m)<<T)+Z(v,T)+1}function lr(m,v){return 120<v?v-120:1<=(T=((T=ia[v-1])>>4)*m+(8-(15&T)))?T:1;var T}function Wr(m,v,T){var R=G(T),H=m[v+=255&R].g-8;return 0<H&&(xt(T,T.u+8),R=G(T),v+=m[v].value,v+=R&(1<<H)-1),xt(T,T.u+m[v].g),m[v].value}function Dr(m,v,T){return T.g+=m.g,T.value+=m.value<<v>>>0,t(8>=T.g),m.g}function vi(m,v,T){var R=m.xc;return t((v=R==0?0:m.vc[m.md*(T>>R)+(v>>R)])<m.Wb),m.Ya[v]}function Wt(m,v,T,R){var H=m.ab,V=m.c*v,K=m.C;v=K+v;var it=T,at=R;for(R=m.Ta,T=m.Ua;0<H--;){var mt=m.gc[H],_t=K,Vt=v,gt=it,Pt=at,qt=(at=R,it=T,mt.Ea);switch(t(_t<Vt),t(Vt<=mt.nc),mt.hc){case 2:ic(gt,Pt,(Vt-_t)*qt,at,it);break;case 0:var ie=_t,$t=Vt,re=at,se=it,we=(Ze=mt).Ea;ie==0&&(Da(gt,Pt,null,null,1,re,se),_n(gt,Pt+1,0,0,we-1,re,se+1),Pt+=we,se+=we,++ie);for(var he=1<<Ze.b,tn=he-1,He=ge(we,Ze.b),jn=Ze.K,Ze=Ze.w+(ie>>Ze.b)*He;ie<$t;){var Bn=jn,Gr=Ze,cn=1;for(el(gt,Pt,re,se-we,1,re,se);cn<we;){var $e=(cn&~tn)+he;$e>we&&($e=we),(0,jo[Bn[Gr++]>>8&15])(gt,Pt+ +cn,re,se+cn-we,$e-cn,re,se+cn),cn=$e}Pt+=we,se+=we,++ie&tn||(Ze+=He)}Vt!=mt.nc&&r(at,it-qt,at,it+(Vt-_t-1)*qt,qt);break;case 1:for(qt=gt,$t=Pt,we=(gt=mt.Ea)-(se=gt&~(re=(Pt=1<<mt.b)-1)),ie=ge(gt,mt.b),he=mt.K,mt=mt.w+(_t>>mt.b)*ie;_t<Vt;){for(tn=he,He=mt,jn=new _e,Ze=$t+se,Bn=$t+gt;$t<Ze;)Be(tn[He++],jn),La(jn,qt,$t,Pt,at,it),$t+=Pt,it+=Pt;$t<Bn&&(Be(tn[He++],jn),La(jn,qt,$t,we,at,it),$t+=we,it+=we),++_t&re||(mt+=ie)}break;case 3:if(gt==at&&Pt==it&&0<mt.b){for($t=at,gt=qt=it+(Vt-_t)*qt-(se=(Vt-_t)*ge(mt.Ea,mt.b)),Pt=at,re=it,ie=[],se=(we=se)-1;0<=se;--se)ie[se]=Pt[re+se];for(se=we-1;0<=se;--se)$t[gt+se]=ie[se];nl(mt,_t,Vt,at,qt,at,it)}else nl(mt,_t,Vt,gt,Pt,at,it)}it=R,at=T}at!=T&&r(R,T,it,at,V)}function qr(m,v){var T=m.V,R=m.Ba+m.c*m.C,H=v-m.C;if(t(v<=m.l.o),t(16>=H),0<H){var V=m.l,K=m.Ta,it=m.Ua,at=V.width;if(Wt(m,H,T,R),H=it=[it],t((T=m.C)<(R=v)),t(V.v<V.va),R>V.o&&(R=V.o),T<V.j){var mt=V.j-T;T=V.j,H[0]+=mt*at}if(T>=R?T=0:(H[0]+=4*V.v,V.ka=T-V.j,V.U=V.va-V.v,V.T=R-T,T=1),T){if(it=it[0],11>(T=m.ca).S){var _t=T.f.RGBA,Vt=(R=T.S,H=V.U,V=V.T,mt=_t.eb,_t.A),gt=V;for(_t=_t.fb+m.Ma*_t.A;0<gt--;){var Pt=K,qt=it,ie=H,$t=mt,re=_t;switch(R){case lu:oc(Pt,qt,ie,$t,re);break;case Io:hs(Pt,qt,ie,$t,re);break;case jc:hs(Pt,qt,ie,$t,re),Ra($t,re,0,ie,1,0);break;case cu:Qo(Pt,qt,ie,$t,re);break;case Ts:Ke(Pt,qt,ie,$t,re,1);break;case uu:Ke(Pt,qt,ie,$t,re,1),Ra($t,re,0,ie,1,0);break;case Pc:Ke(Pt,qt,ie,$t,re,0);break;case cc:Ke(Pt,qt,ie,$t,re,0),Ra($t,re,1,ie,1,0);break;case lc:eo(Pt,qt,ie,$t,re);break;case fu:eo(Pt,qt,ie,$t,re),ra($t,re,ie,1,0);break;case rl:ea(Pt,qt,ie,$t,re);break;default:t(0)}it+=at,_t+=Vt}m.Ma+=V}else alert("todo:EmitRescaledRowsYUVA");t(m.Ma<=T.height)}}m.C=v,t(m.C<=m.i)}function er(m){var v;if(0<m.ua)return 0;for(v=0;v<m.Wb;++v){var T=m.Ya[v].G,R=m.Ya[v].H;if(0<T[1][R[1]+0].g||0<T[2][R[2]+0].g||0<T[3][R[3]+0].g)return 0}return 1}function Rn(m,v,T,R,H,V){if(m.Z!=0){var K=m.qd,it=m.rd;for(t(Pa[m.Z]!=null);v<T;++v)Pa[m.Z](K,it,R,H,R,H,V),K=R,it=H,H+=V;m.qd=K,m.rd=it}}function oo(m,v){var T=m.l.ma,R=T.Z==0||T.Z==1?m.l.j:m.C;if(R=m.C<R?R:m.C,t(v<=m.l.o),v>R){var H=m.l.width,V=T.ca,K=T.tb+H*R,it=m.V,at=m.Ba+m.c*R,mt=m.gc;t(m.ab==1),t(mt[0].hc==3),_c(mt[0],R,v,it,at,V,K),Rn(T,R,v,V,K,H)}m.C=m.Ma=v}function Wo(m,v,T,R,H,V,K){var it=m.$/R,at=m.$%R,mt=m.m,_t=m.s,Vt=T+m.$,gt=Vt;H=T+R*H;var Pt=T+R*V,qt=280+_t.ua,ie=m.Pb?it:16777216,$t=0<_t.ua?_t.Wa:null,re=_t.wc,se=Vt<Pt?vi(_t,at,it):null;t(m.C<V),t(Pt<=H);var we=!1;t:for(;;){for(;we||Vt<Pt;){var he=0;if(it>=ie){var tn=Vt-T;t((ie=m).Pb),ie.wd=ie.m,ie.xd=tn,0<ie.s.ua&&Oe(ie.s.Wa,ie.s.vb),ie=it+il}if(at&re||(se=vi(_t,at,it)),t(se!=null),se.Qb&&(v[Vt]=se.qb,we=!0),!we)if(St(mt),se.jc){he=mt,tn=v;var He=Vt,jn=se.pd[G(he)&rc-1];t(se.jc),256>jn.g?(xt(he,he.u+jn.g),tn[He]=jn.value,he=0):(xt(he,he.u+jn.g-256),t(256<=jn.value),he=jn.value),he==0&&(we=!0)}else he=Wr(se.G[0],se.H[0],mt);if(mt.h)break;if(we||256>he){if(!we)if(se.nd)v[Vt]=(se.qb|he<<8)>>>0;else{if(St(mt),we=Wr(se.G[1],se.H[1],mt),St(mt),tn=Wr(se.G[2],se.H[2],mt),He=Wr(se.G[3],se.H[3],mt),mt.h)break;v[Vt]=(He<<24|we<<16|he<<8|tn)>>>0}if(we=!1,++Vt,++at>=R&&(at=0,++it,K!=null&&it<=V&&!(it%16)&&K(m,it),$t!=null))for(;gt<Vt;)he=v[gt++],$t.X[(506832829*he&4294967295)>>>$t.Mb]=he}else if(280>he){if(he=Hn(he-256,mt),tn=Wr(se.G[4],se.H[4],mt),St(mt),tn=lr(R,tn=Hn(tn,mt)),mt.h)break;if(Vt-T<tn||H-Vt<he)break t;for(He=0;He<he;++He)v[Vt+He]=v[Vt+He-tn];for(Vt+=he,at+=he;at>=R;)at-=R,++it,K!=null&&it<=V&&!(it%16)&&K(m,it);if(t(Vt<=H),at&re&&(se=vi(_t,at,it)),$t!=null)for(;gt<Vt;)he=v[gt++],$t.X[(506832829*he&4294967295)>>>$t.Mb]=he}else{if(!(he<qt))break t;for(we=he-280,t($t!=null);gt<Vt;)he=v[gt++],$t.X[(506832829*he&4294967295)>>>$t.Mb]=he;he=Vt,t(!(we>>>(tn=$t).Xa)),v[he]=tn.X[we],we=!0}we||t(mt.h==ut(mt))}if(m.Pb&&mt.h&&Vt<H)t(m.m.h),m.a=5,m.m=m.wd,m.$=m.xd,0<m.s.ua&&Oe(m.s.vb,m.s.Wa);else{if(mt.h)break t;K?.(m,it>V?V:it),m.a=0,m.$=Vt-T}return 1}return m.a=3,0}function Us(m){t(m!=null),m.vc=null,m.yc=null,m.Ya=null;var v=m.Wa;v!=null&&(v.X=null),m.vb=null,t(m!=null)}function Ja(){var m=new Xe;return m==null?null:(m.a=0,m.xb=$u,ar("Predictor","VP8LPredictors"),ar("Predictor","VP8LPredictors_C"),ar("PredictorAdd","VP8LPredictorsAdd"),ar("PredictorAdd","VP8LPredictorsAdd_C"),ic=dn,La=We,oc=kr,hs=Cn,eo=nn,ea=ln,Qo=Ln,rt.VP8LMapColor32b=Ri,rt.VP8LMapColor8b=Or,m)}function Hs(m,v,T,R,H){var V=1,K=[m],it=[v],at=R.m,mt=R.s,_t=null,Vt=0;t:for(;;){if(T)for(;V&&Z(at,1);){var gt=K,Pt=it,qt=R,ie=1,$t=qt.m,re=qt.gc[qt.ab],se=Z($t,2);if(qt.Oc&1<<se)V=0;else{switch(qt.Oc|=1<<se,re.hc=se,re.Ea=gt[0],re.nc=Pt[0],re.K=[null],++qt.ab,t(4>=qt.ab),se){case 0:case 1:re.b=Z($t,3)+2,ie=Hs(ge(re.Ea,re.b),ge(re.nc,re.b),0,qt,re.K),re.K=re.K[0];break;case 3:var we,he=Z($t,8)+1,tn=16<he?0:4<he?1:2<he?2:3;if(gt[0]=ge(re.Ea,tn),re.b=tn,we=ie=Hs(he,1,0,qt,re.K)){var He,jn=he,Ze=re,Bn=1<<(8>>Ze.b),Gr=s(Bn);if(Gr==null)we=0;else{var cn=Ze.K[0],$e=Ze.w;for(Gr[0]=Ze.K[0][0],He=1;He<1*jn;++He)Gr[He]=Te(cn[$e+He],Gr[He-1]);for(;He<4*Bn;++He)Gr[He]=0;Ze.K[0]=null,Ze.K[0]=Gr,we=1}}ie=we;break;case 2:break;default:t(0)}V=ie}}if(K=K[0],it=it[0],V&&Z(at,1)&&!(V=1<=(Vt=Z(at,4))&&11>=Vt)){R.a=3;break t}var Le;if(Le=V)e:{var li,Mn,$n,ir=R,ki=K,no=it,Ir=Vt,ji=T,Bo=ir.m,Wi=ir.s,Vn=[null],fr=1,Kr=0,yr=_s[Ir];n:for(;;){if(ji&&Z(Bo,1)){var Ii=Z(Bo,3)+2,ti=ge(ki,Ii),br=ge(no,Ii),zi=ti*br;if(!Hs(ti,br,0,ir,Vn))break n;for(Vn=Vn[0],Wi.xc=Ii,li=0;li<zi;++li){var Tr=Vn[li]>>8&65535;Vn[li]=Tr,Tr>=fr&&(fr=Tr+1)}}if(Bo.h)break n;for(Mn=0;5>Mn;++Mn){var Bi=Nl[Mn];!Mn&&0<Ir&&(Bi+=1<<Ir),Kr<Bi&&(Kr=Bi)}var Xi=l(fr*yr,X),zr=fr,dr=l(zr,Tt);if(dr==null)var ro=null;else t(65536>=zr),ro=dr;var Ai=s(Kr);if(ro==null||Ai==null||Xi==null){ir.a=1;break n}var yn=Xi;for(li=$n=0;li<fr;++li){var hn=ro[li],xr=hn.G,Ao=hn.H,ns=0,uo=1,ci=0;for(Mn=0;5>Mn;++Mn){Bi=Nl[Mn],xr[Mn]=yn,Ao[Mn]=$n,!Mn&&0<Ir&&(Bi+=1<<Ir);i:{var Br,Rl=Bi,Wu=ir,Nr=Ai,w=yn,k=$n,_=0,N=Wu.m,z=Z(N,1);if(i(Nr,0,0,Rl),z){var tt=Z(N,1)+1,nt=Z(N,1),F=Z(N,nt==0?1:8);Nr[F]=1,tt==2&&(Nr[F=Z(N,8)]=1);var W=1}else{var ot=s(19),st=Z(N,4)+4;if(19<st){Wu.a=3;var dt=0;break i}for(Br=0;Br<st;++Br)ot[Ic[Br]]=Z(N,3);var B=void 0,Nt=void 0,It=Wu,kt=ot,Lt=Rl,At=Nr,Ht=0,Yt=It.m,de=8,be=l(128,X);r:for(;lt(be,0,7,kt,19);){if(Z(Yt,1)){var Me=2+2*Z(Yt,3);if((B=2+Z(Yt,Me))>Lt)break r}else B=Lt;for(Nt=0;Nt<Lt&&B--;){St(Yt);var Je=be[0+(127&G(Yt))];xt(Yt,Yt.u+Je.g);var kn=Je.value;if(16>kn)At[Nt++]=kn,kn!=0&&(de=kn);else{var ye=kn==16,bn=kn-16,Ce=uc[bn],Jn=Z(Yt,Ns[bn])+Ce;if(Nt+Jn>Lt)break r;for(var $r=ye?de:0;0<Jn--;)At[Nt++]=$r}}Ht=1;break r}Ht||(It.a=3),W=Ht}(W=W&&!N.h)&&(_=lt(w,k,8,Nr,Rl)),W&&_!=0?dt=_:(Wu.a=3,dt=0)}if(dt==0)break n;if(uo&&du[Mn]==1&&(uo=yn[$n].g==0),ns+=yn[$n].g,$n+=dt,3>=Mn){var Yr,Mo=Ai[0];for(Yr=1;Yr<Bi;++Yr)Ai[Yr]>Mo&&(Mo=Ai[Yr]);ci+=Mo}}if(hn.nd=uo,hn.Qb=0,uo&&(hn.qb=(xr[3][Ao[3]+0].value<<24|xr[1][Ao[1]+0].value<<16|xr[2][Ao[2]+0].value)>>>0,ns==0&&256>xr[0][Ao[0]+0].value&&(hn.Qb=1,hn.qb+=xr[0][Ao[0]+0].value<<8)),hn.jc=!hn.Qb&&6>ci,hn.jc){var Co,jt=hn;for(Co=0;Co<rc;++Co){var Fe=Co,Se=jt.pd[Fe],ze=jt.G[0][jt.H[0]+Fe];256<=ze.value?(Se.g=ze.g+256,Se.value=ze.value):(Se.g=0,Se.value=0,Fe>>=Dr(ze,8,Se),Fe>>=Dr(jt.G[1][jt.H[1]+Fe],16,Se),Fe>>=Dr(jt.G[2][jt.H[2]+Fe],0,Se),Dr(jt.G[3][jt.H[3]+Fe],24,Se))}}}Wi.vc=Vn,Wi.Wb=fr,Wi.Ya=ro,Wi.yc=Xi,Le=1;break e}Le=0}if(!(V=Le)){R.a=3;break t}if(0<Vt){if(mt.ua=1<<Vt,!ft(mt.Wa,Vt)){R.a=1,V=0;break t}}else mt.ua=0;var qe=R,pn=K,Jr=it,Mi=qe.s,ei=Mi.xc;if(qe.c=pn,qe.i=Jr,Mi.md=ge(pn,ei),Mi.wc=ei==0?-1:(1<<ei)-1,T){R.xb=ol;break t}if((_t=s(K*it))==null){R.a=1,V=0;break t}V=(V=Wo(R,_t,0,K,it,it,null))&&!at.h;break t}return V?(H!=null?H[0]=_t:(t(_t==null),t(T)),R.$=0,T||Us(mt)):Us(mt),V}function Lo(m,v){var T=m.c*m.i,R=T+v+16*v;return t(m.c<=v),m.V=s(R),m.V==null?(m.Ta=null,m.Ua=0,m.a=1,0):(m.Ta=m.V,m.Ua=m.Ba+T+v,1)}function is(m,v){var T=m.C,R=v-T,H=m.V,V=m.Ba+m.c*T;for(t(v<=m.l.o);0<R;){var K=16<R?16:R,it=m.l.ma,at=m.l.width,mt=at*K,_t=it.ca,Vt=it.tb+at*T,gt=m.Ta,Pt=m.Ua;Wt(m,K,H,V),Es(gt,Pt,_t,Vt,mt),Rn(it,T,T+K,_t,Vt,at),R-=K,H+=K*m.c,T+=K}t(T==v),m.C=m.Ma=v}function qs(){this.ub=this.yd=this.td=this.Rb=0}function pi(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function Ar(){this.Fb=this.Bb=this.Cb=0,this.Zb=s(4),this.Lb=s(4)}function Aa(){this.Yb=(function(){var m=[];return(function v(T,R,H){for(var V=H[R],K=0;K<V&&(T.push(H.length>R+1?[]:0),!(H.length<R+1));K++)v(T[K],R+1,H)})(m,0,[3,11]),m})()}function Ti(){this.jb=s(3),this.Wc=c([4,8],Aa),this.Xc=c([4,17],Aa)}function Wl(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new s(4),this.od=new s(4)}function Xo(){this.ld=this.La=this.dd=this.tc=0}function Go(){this.Na=this.la=0}function Ma(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function Mc(){this.ad=s(384),this.Za=0,this.Ob=s(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function Ca(){this.uc=this.M=this.Nb=0,this.wa=Array(new Xo),this.Y=0,this.ya=Array(new Mc),this.aa=0,this.l=new Ea}function Cc(){this.y=s(16),this.f=s(8),this.ea=s(8)}function jf(){this.cb=this.a=0,this.sc="",this.m=new P,this.Od=new qs,this.Kc=new pi,this.ed=new Wl,this.Qa=new Ar,this.Ic=this.$c=this.Aa=0,this.D=new Ca,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=l(8,P),this.ia=0,this.pb=l(4,Ma),this.Pa=new Ti,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new Cc),this.Hd=0,this.rb=Array(new Go),this.sb=0,this.wa=Array(new Xo),this.Y=0,this.oc=[],this.pc=0,this.sa=[],this.ta=0,this.qa=[],this.ra=0,this.Ha=[],this.B=this.R=this.Ia=0,this.Ec=[],this.M=this.ja=this.Vb=this.Fc=0,this.ya=Array(new Mc),this.L=this.aa=0,this.gd=c([4,2],Xo),this.ga=null,this.Fa=[],this.Cc=this.qc=this.P=0,this.Gb=[],this.Uc=0,this.mb=[],this.nb=0,this.rc=[],this.Ga=this.Vc=0}function $s(m,v){return 0>m?0:m>v?v:m}function Ea(){this.T=this.U=this.ka=this.height=this.width=0,this.y=[],this.f=[],this.ea=[],this.Rc=this.fa=this.W=this.N=this.O=0,this.ma="void",this.put="VP8IoPutHook",this.ac="VP8IoSetupHook",this.bc="VP8IoTeardownHook",this.ha=this.Kb=0,this.data=[],this.hb=this.ib=this.da=this.o=this.j=this.va=this.v=this.Da=this.ob=this.w=0,this.F=[],this.J=0}function Ys(){var m=new jf;return m!=null&&(m.a=0,m.sc="OK",m.cb=0,m.Xb=0,ms||(ms=ss)),m}function sr(m,v,T){return m.a==0&&(m.a=v,m.sc=T,m.cb=0),0}function Ec(m,v,T){return 3<=T&&m[v+0]==157&&m[v+1]==1&&m[v+2]==42}function Ss(m,v){if(m==null)return 0;if(m.a=0,m.sc="OK",v==null)return sr(m,2,"null VP8Io passed to VP8GetHeaders()");var T=v.data,R=v.w,H=v.ha;if(4>H)return sr(m,7,"Truncated header.");var V=T[R+0]|T[R+1]<<8|T[R+2]<<16,K=m.Od;if(K.Rb=!(1&V),K.td=V>>1&7,K.yd=V>>4&1,K.ub=V>>5,3<K.td)return sr(m,3,"Incorrect keyframe parameters.");if(!K.yd)return sr(m,4,"Frame not displayable.");R+=3,H-=3;var it=m.Kc;if(K.Rb){if(7>H)return sr(m,7,"cannot parse picture header");if(!Ec(T,R,H))return sr(m,3,"Bad code word");it.c=16383&(T[R+4]<<8|T[R+3]),it.Td=T[R+4]>>6,it.i=16383&(T[R+6]<<8|T[R+5]),it.Ud=T[R+6]>>6,R+=7,H-=7,m.za=it.c+15>>4,m.Ub=it.i+15>>4,v.width=it.c,v.height=it.i,v.Da=0,v.j=0,v.v=0,v.va=v.width,v.o=v.height,v.da=0,v.ib=v.width,v.hb=v.height,v.U=v.width,v.T=v.height,i((V=m.Pa).jb,0,255,V.jb.length),t((V=m.Qa)!=null),V.Cb=0,V.Bb=0,V.Fb=1,i(V.Zb,0,0,V.Zb.length),i(V.Lb,0,0,V.Lb)}if(K.ub>H)return sr(m,7,"bad partition length");yt(V=m.m,T,R,K.ub),R+=K.ub,H-=K.ub,K.Rb&&(it.Ld=Rt(V),it.Kd=Rt(V)),it=m.Qa;var at,mt=m.Pa;if(t(V!=null),t(it!=null),it.Cb=Rt(V),it.Cb){if(it.Bb=Rt(V),Rt(V)){for(it.Fb=Rt(V),at=0;4>at;++at)it.Zb[at]=Rt(V)?ct(V,7):0;for(at=0;4>at;++at)it.Lb[at]=Rt(V)?ct(V,6):0}if(it.Bb)for(at=0;3>at;++at)mt.jb[at]=Rt(V)?J(V,8):255}else it.Bb=0;if(V.Ka)return sr(m,3,"cannot parse segment header");if((it=m.ed).zd=Rt(V),it.Tb=J(V,6),it.wb=J(V,3),it.Pc=Rt(V),it.Pc&&Rt(V)){for(mt=0;4>mt;++mt)Rt(V)&&(it.vd[mt]=ct(V,6));for(mt=0;4>mt;++mt)Rt(V)&&(it.od[mt]=ct(V,6))}if(m.L=it.Tb==0?0:it.zd?1:2,V.Ka)return sr(m,3,"cannot parse filter header");var _t=H;if(H=at=R,R=at+_t,it=_t,m.Xb=(1<<J(m.m,2))-1,_t<3*(mt=m.Xb))T=7;else{for(at+=3*mt,it-=3*mt,_t=0;_t<mt;++_t){var Vt=T[H+0]|T[H+1]<<8|T[H+2]<<16;Vt>it&&(Vt=it),yt(m.Jc[+_t],T,at,Vt),at+=Vt,it-=Vt,H+=3}yt(m.Jc[+mt],T,at,it),T=at<R?0:5}if(T!=0)return sr(m,T,"cannot parse partitions");for(T=J(at=m.m,7),H=Rt(at)?ct(at,4):0,R=Rt(at)?ct(at,4):0,it=Rt(at)?ct(at,4):0,mt=Rt(at)?ct(at,4):0,at=Rt(at)?ct(at,4):0,_t=m.Qa,Vt=0;4>Vt;++Vt){if(_t.Cb){var gt=_t.Zb[Vt];_t.Fb||(gt+=T)}else{if(0<Vt){m.pb[Vt]=m.pb[0];continue}gt=T}var Pt=m.pb[Vt];Pt.Sc[0]=Ds[$s(gt+H,127)],Pt.Sc[1]=ko[$s(gt+0,127)],Pt.Eb[0]=2*Ds[$s(gt+R,127)],Pt.Eb[1]=101581*ko[$s(gt+it,127)]>>16,8>Pt.Eb[1]&&(Pt.Eb[1]=8),Pt.Qc[0]=Ds[$s(gt+mt,117)],Pt.Qc[1]=ko[$s(gt+at,127)],Pt.lc=gt+at}if(!K.Rb)return sr(m,4,"Not a key frame.");for(Rt(V),K=m.Pa,T=0;4>T;++T){for(H=0;8>H;++H)for(R=0;3>R;++R)for(it=0;11>it;++it)mt=Qt(V,Xr[T][H][R][it])?J(V,8):Bf[T][H][R][it],K.Wc[T][H].Yb[R][it]=mt;for(H=0;17>H;++H)K.Xc[T][H]=K.Wc[T][Yn[H]]}return m.kc=Rt(V),m.kc&&(m.Bd=J(V,8)),m.cb=1}function ss(m,v,T,R,H,V,K){var it=v[H].Yb[T];for(T=0;16>H;++H){if(!Qt(m,it[T+0]))return H;for(;!Qt(m,it[T+1]);)if(it=v[++H].Yb[0],T=0,H==16)return 16;var at=v[H+1].Yb;if(Qt(m,it[T+2])){var mt=m,_t=0;if(Qt(mt,(gt=it)[(Vt=T)+3]))if(Qt(mt,gt[Vt+6])){for(it=0,Vt=2*(_t=Qt(mt,gt[Vt+8]))+(gt=Qt(mt,gt[Vt+9+_t])),_t=0,gt=zf[Vt];gt[it];++it)_t+=_t+Qt(mt,gt[it]);_t+=3+(8<<Vt)}else Qt(mt,gt[Vt+7])?(_t=7+2*Qt(mt,165),_t+=Qt(mt,145)):_t=5+Qt(mt,159);else _t=Qt(mt,gt[Vt+4])?3+Qt(mt,gt[Vt+5]):2;it=at[2]}else _t=1,it=at[1];at=K+qu[H],0>(mt=m).b&&Ft(mt);var Vt,gt=mt.b,Pt=(Vt=mt.Ca>>1)-(mt.I>>gt)>>31;--mt.b,mt.Ca+=Pt,mt.Ca|=1,mt.I-=(Vt+1&Pt)<<gt,V[at]=((_t^Pt)-Pt)*R[(0<H)+0]}return 16}function Ro(m){var v=m.rb[m.sb-1];v.la=0,v.Na=0,i(m.zc,0,0,m.zc.length),m.ja=0}function yo(m,v,T,R,H){H=m[v+T+32*R]+(H>>3),m[v+T+32*R]=-256&H?0>H?0:255:H}function bl(m,v,T,R,H,V){yo(m,v,0,T,R+H),yo(m,v,1,T,R+V),yo(m,v,2,T,R-V),yo(m,v,3,T,R-H)}function Ni(m){return(20091*m>>16)+m}function Qi(m,v,T,R){var H,V=0,K=s(16);for(H=0;4>H;++H){var it=m[v+0]+m[v+8],at=m[v+0]-m[v+8],mt=(35468*m[v+4]>>16)-Ni(m[v+12]),_t=Ni(m[v+4])+(35468*m[v+12]>>16);K[V+0]=it+_t,K[V+1]=at+mt,K[V+2]=at-mt,K[V+3]=it-_t,V+=4,v++}for(H=V=0;4>H;++H)it=(m=K[V+0]+4)+K[V+8],at=m-K[V+8],mt=(35468*K[V+4]>>16)-Ni(K[V+12]),yo(T,R,0,0,it+(_t=Ni(K[V+4])+(35468*K[V+12]>>16))),yo(T,R,1,0,at+mt),yo(T,R,2,0,at-mt),yo(T,R,3,0,it-_t),V++,R+=32}function Tc(m,v,T,R){var H=m[v+0]+4,V=35468*m[v+4]>>16,K=Ni(m[v+4]),it=35468*m[v+1]>>16;bl(T,R,0,H+K,m=Ni(m[v+1]),it),bl(T,R,1,H+V,m,it),bl(T,R,2,H-V,m,it),bl(T,R,3,H-K,m,it)}function Za(m,v,T,R,H){Qi(m,v,T,R),H&&Qi(m,v+16,T,R+4)}function _i(m,v,T,R){na(m,v+0,T,R,1),na(m,v+32,T,R+128,1)}function as(m,v,T,R){var H;for(m=m[v+0]+4,H=0;4>H;++H)for(v=0;4>v;++v)yo(T,R,v,H,m)}function wi(m,v,T,R){m[v+0]&&Pr(m,v+0,T,R),m[v+16]&&Pr(m,v+16,T,R+4),m[v+32]&&Pr(m,v+32,T,R+128),m[v+48]&&Pr(m,v+48,T,R+128+4)}function so(m,v,T,R){var H,V=s(16);for(H=0;4>H;++H){var K=m[v+0+H]+m[v+12+H],it=m[v+4+H]+m[v+8+H],at=m[v+4+H]-m[v+8+H],mt=m[v+0+H]-m[v+12+H];V[0+H]=K+it,V[8+H]=K-it,V[4+H]=mt+at,V[12+H]=mt-at}for(H=0;4>H;++H)K=(m=V[0+4*H]+3)+V[3+4*H],it=V[1+4*H]+V[2+4*H],at=V[1+4*H]-V[2+4*H],mt=m-V[3+4*H],T[R+0]=K+it>>3,T[R+16]=mt+at>>3,T[R+32]=K-it>>3,T[R+48]=mt-at>>3,R+=64}function Mr(m,v,T){var R,H=v-32,V=wo,K=255-m[H-1];for(R=0;R<T;++R){var it,at=V,mt=K+m[v-1];for(it=0;it<T;++it)m[v+it]=at[mt+m[H+it]];v+=32}}function Ko(m,v){Mr(m,v,4)}function to(m,v){Mr(m,v,8)}function Jo(m,v){Mr(m,v,16)}function Cr(m,v){var T;for(T=0;16>T;++T)r(m,v+32*T,m,v-32,16)}function xl(m,v){var T;for(T=16;0<T;--T)i(m,v,m[v-1],16),v+=32}function ls(m,v,T){var R;for(R=0;16>R;++R)i(v,T+32*R,m,16)}function $i(m,v){var T,R=16;for(T=0;16>T;++T)R+=m[v-1+32*T]+m[v+T-32];ls(R>>5,m,v)}function Jt(m,v){var T,R=8;for(T=0;16>T;++T)R+=m[v-1+32*T];ls(R>>4,m,v)}function iu(m,v){var T,R=8;for(T=0;16>T;++T)R+=m[v+T-32];ls(R>>4,m,v)}function bo(m,v){ls(128,m,v)}function An(m,v,T){return m+2*v+T+2>>2}function Qa(m,v){var T,R=v-32;for(R=new Uint8Array([An(m[R-1],m[R+0],m[R+1]),An(m[R+0],m[R+1],m[R+2]),An(m[R+1],m[R+2],m[R+3]),An(m[R+2],m[R+3],m[R+4])]),T=0;4>T;++T)r(m,v+32*T,R,0,R.length)}function Nc(m,v){var T=m[v-1],R=m[v-1+32],H=m[v-1+64],V=m[v-1+96];ve(m,v+0,16843009*An(m[v-1-32],T,R)),ve(m,v+32,16843009*An(T,R,H)),ve(m,v+64,16843009*An(R,H,V)),ve(m,v+96,16843009*An(H,V,V))}function Uu(m,v){var T,R=4;for(T=0;4>T;++T)R+=m[v+T-32]+m[v-1+32*T];for(R>>=3,T=0;4>T;++T)i(m,v+32*T,R,4)}function Xl(m,v){var T=m[v-1+0],R=m[v-1+32],H=m[v-1+64],V=m[v-1-32],K=m[v+0-32],it=m[v+1-32],at=m[v+2-32],mt=m[v+3-32];m[v+0+96]=An(R,H,m[v-1+96]),m[v+1+96]=m[v+0+64]=An(T,R,H),m[v+2+96]=m[v+1+64]=m[v+0+32]=An(V,T,R),m[v+3+96]=m[v+2+64]=m[v+1+32]=m[v+0+0]=An(K,V,T),m[v+3+64]=m[v+2+32]=m[v+1+0]=An(it,K,V),m[v+3+32]=m[v+2+0]=An(at,it,K),m[v+3+0]=An(mt,at,it)}function Vs(m,v){var T=m[v+1-32],R=m[v+2-32],H=m[v+3-32],V=m[v+4-32],K=m[v+5-32],it=m[v+6-32],at=m[v+7-32];m[v+0+0]=An(m[v+0-32],T,R),m[v+1+0]=m[v+0+32]=An(T,R,H),m[v+2+0]=m[v+1+32]=m[v+0+64]=An(R,H,V),m[v+3+0]=m[v+2+32]=m[v+1+64]=m[v+0+96]=An(H,V,K),m[v+3+32]=m[v+2+64]=m[v+1+96]=An(V,K,it),m[v+3+64]=m[v+2+96]=An(K,it,at),m[v+3+96]=An(it,at,at)}function Ws(m,v){var T=m[v-1+0],R=m[v-1+32],H=m[v-1+64],V=m[v-1-32],K=m[v+0-32],it=m[v+1-32],at=m[v+2-32],mt=m[v+3-32];m[v+0+0]=m[v+1+64]=V+K+1>>1,m[v+1+0]=m[v+2+64]=K+it+1>>1,m[v+2+0]=m[v+3+64]=it+at+1>>1,m[v+3+0]=at+mt+1>>1,m[v+0+96]=An(H,R,T),m[v+0+64]=An(R,T,V),m[v+0+32]=m[v+1+96]=An(T,V,K),m[v+1+32]=m[v+2+96]=An(V,K,it),m[v+2+32]=m[v+3+96]=An(K,it,at),m[v+3+32]=An(it,at,mt)}function Oo(m,v){var T=m[v+0-32],R=m[v+1-32],H=m[v+2-32],V=m[v+3-32],K=m[v+4-32],it=m[v+5-32],at=m[v+6-32],mt=m[v+7-32];m[v+0+0]=T+R+1>>1,m[v+1+0]=m[v+0+64]=R+H+1>>1,m[v+2+0]=m[v+1+64]=H+V+1>>1,m[v+3+0]=m[v+2+64]=V+K+1>>1,m[v+0+32]=An(T,R,H),m[v+1+32]=m[v+0+96]=An(R,H,V),m[v+2+32]=m[v+1+96]=An(H,V,K),m[v+3+32]=m[v+2+96]=An(V,K,it),m[v+3+64]=An(K,it,at),m[v+3+96]=An(it,at,mt)}function ks(m,v){var T=m[v-1+0],R=m[v-1+32],H=m[v-1+64],V=m[v-1+96];m[v+0+0]=T+R+1>>1,m[v+2+0]=m[v+0+32]=R+H+1>>1,m[v+2+32]=m[v+0+64]=H+V+1>>1,m[v+1+0]=An(T,R,H),m[v+3+0]=m[v+1+32]=An(R,H,V),m[v+3+32]=m[v+1+64]=An(H,V,V),m[v+3+64]=m[v+2+64]=m[v+0+96]=m[v+1+96]=m[v+2+96]=m[v+3+96]=V}function Gl(m,v){var T=m[v-1+0],R=m[v-1+32],H=m[v-1+64],V=m[v-1+96],K=m[v-1-32],it=m[v+0-32],at=m[v+1-32],mt=m[v+2-32];m[v+0+0]=m[v+2+32]=T+K+1>>1,m[v+0+32]=m[v+2+64]=R+T+1>>1,m[v+0+64]=m[v+2+96]=H+R+1>>1,m[v+0+96]=V+H+1>>1,m[v+3+0]=An(it,at,mt),m[v+2+0]=An(K,it,at),m[v+1+0]=m[v+3+32]=An(T,K,it),m[v+1+32]=m[v+3+64]=An(R,T,K),m[v+1+64]=m[v+3+96]=An(H,R,T),m[v+1+96]=An(V,H,R)}function Xs(m,v){var T;for(T=0;8>T;++T)r(m,v+32*T,m,v-32,8)}function Kl(m,v){var T;for(T=0;8>T;++T)i(m,v,m[v-1],8),v+=32}function cs(m,v,T){var R;for(R=0;8>R;++R)i(v,T+32*R,m,8)}function Jl(m,v){var T,R=8;for(T=0;8>T;++T)R+=m[v+T-32]+m[v-1+32*T];cs(R>>4,m,v)}function tl(m,v){var T,R=4;for(T=0;8>T;++T)R+=m[v+T-32];cs(R>>3,m,v)}function qn(m,v){var T,R=4;for(T=0;8>T;++T)R+=m[v-1+32*T];cs(R>>3,m,v)}function As(m,v){cs(128,m,v)}function us(m,v,T){var R=m[v-T],H=m[v+0],V=3*(H-R)+Oa[1020+m[v-2*T]-m[v+T]],K=Oc[112+(V+4>>3)];m[v-T]=wo[255+R+Oc[112+(V+3>>3)]],m[v+0]=wo[255+H-K]}function Gs(m,v,T,R){var H=m[v+0],V=m[v+T];return So[255+m[v-2*T]-m[v-T]]>R||So[255+V-H]>R}function Ta(m,v,T,R){return 4*So[255+m[v-T]-m[v+0]]+So[255+m[v-2*T]-m[v+T]]<=R}function Ks(m,v,T,R,H){var V=m[v-3*T],K=m[v-2*T],it=m[v-T],at=m[v+0],mt=m[v+T],_t=m[v+2*T],Vt=m[v+3*T];return 4*So[255+it-at]+So[255+K-mt]>R?0:So[255+m[v-4*T]-V]<=H&&So[255+V-K]<=H&&So[255+K-it]<=H&&So[255+Vt-_t]<=H&&So[255+_t-mt]<=H&&So[255+mt-at]<=H}function Ms(m,v,T,R){var H=2*R+1;for(R=0;16>R;++R)Ta(m,v+R,T,H)&&us(m,v+R,T)}function Js(m,v,T,R){var H=2*R+1;for(R=0;16>R;++R)Ta(m,v+R*T,1,H)&&us(m,v+R*T,1)}function Zs(m,v,T,R){var H;for(H=3;0<H;--H)Ms(m,v+=4*T,T,R)}function vl(m,v,T,R){var H;for(H=3;0<H;--H)Js(m,v+=4,T,R)}function Cs(m,v,T,R,H,V,K,it){for(V=2*V+1;0<H--;){if(Ks(m,v,T,V,K))if(Gs(m,v,T,it))us(m,v,T);else{var at=m,mt=v,_t=T,Vt=at[mt-2*_t],gt=at[mt-_t],Pt=at[mt+0],qt=at[mt+_t],ie=at[mt+2*_t],$t=27*(se=Oa[1020+3*(Pt-gt)+Oa[1020+Vt-qt]])+63>>7,re=18*se+63>>7,se=9*se+63>>7;at[mt-3*_t]=wo[255+at[mt-3*_t]+se],at[mt-2*_t]=wo[255+Vt+re],at[mt-_t]=wo[255+gt+$t],at[mt+0]=wo[255+Pt-$t],at[mt+_t]=wo[255+qt-re],at[mt+2*_t]=wo[255+ie-se]}v+=R}}function Qs(m,v,T,R,H,V,K,it){for(V=2*V+1;0<H--;){if(Ks(m,v,T,V,K))if(Gs(m,v,T,it))us(m,v,T);else{var at=m,mt=v,_t=T,Vt=at[mt-_t],gt=at[mt+0],Pt=at[mt+_t],qt=Oc[112+(4+(ie=3*(gt-Vt))>>3)],ie=Oc[112+(ie+3>>3)],$t=qt+1>>1;at[mt-2*_t]=wo[255+at[mt-2*_t]+$t],at[mt-_t]=wo[255+Vt+ie],at[mt+0]=wo[255+gt-qt],at[mt+_t]=wo[255+Pt-$t]}v+=R}}function wl(m,v,T,R,H,V){Cs(m,v,T,1,16,R,H,V)}function Sl(m,v,T,R,H,V){Cs(m,v,1,T,16,R,H,V)}function Zl(m,v,T,R,H,V){var K;for(K=3;0<K;--K)Qs(m,v+=4*T,T,1,16,R,H,V)}function ma(m,v,T,R,H,V){var K;for(K=3;0<K;--K)Qs(m,v+=4,1,T,16,R,H,V)}function Ql(m,v,T,R,H,V,K,it){Cs(m,v,H,1,8,V,K,it),Cs(T,R,H,1,8,V,K,it)}function C(m,v,T,R,H,V,K,it){Cs(m,v,1,H,8,V,K,it),Cs(T,R,1,H,8,V,K,it)}function U(m,v,T,R,H,V,K,it){Qs(m,v+4*H,H,1,8,V,K,it),Qs(T,R+4*H,H,1,8,V,K,it)}function pt(m,v,T,R,H,V,K,it){Qs(m,v+4,1,H,8,V,K,it),Qs(T,R+4,1,H,8,V,K,it)}function Et(){this.ba=new En,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new Kn,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function zt(){this.data=[],this.offset=this.kd=this.ha=this.w=0,this.na=[],this.xa=this.gb=this.Ja=this.Sa=this.P=0}function oe(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function me(){this.ua=0,this.Wa=new In,this.vb=new In,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new Tt,this.yc=new X}function Xe(){this.xb=this.a=0,this.l=new Ea,this.ca=new En,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new j,this.Pb=0,this.wd=new j,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new me,this.ab=0,this.gc=l(4,oe),this.Oc=0}function on(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new Ea,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function zn(m,v,T,R,H,V,K){for(m=m==null?0:m[v+0],v=0;v<K;++v)H[V+v]=m+T[R+v]&255,m=H[V+v]}function Un(m,v,T,R,H,V,K){var it;if(m==null)zn(null,null,T,R,H,V,K);else for(it=0;it<K;++it)H[V+it]=m[v+it]+T[R+it]&255}function cr(m,v,T,R,H,V,K){if(m==null)zn(null,null,T,R,H,V,K);else{var it,at=m[v+0],mt=at,_t=at;for(it=0;it<K;++it)mt=_t+(at=m[v+it])-mt,_t=T[R+it]+(-256&mt?0>mt?0:255:mt)&255,mt=at,H[V+it]=_t}}function Yi(m,v,T,R){var H=v.width,V=v.o;if(t(m!=null&&v!=null),0>T||0>=R||T+R>V)return null;if(!m.Cc){if(m.ga==null){var K;if(m.ga=new on,(K=m.ga==null)||(K=v.width*v.o,t(m.Gb.length==0),m.Gb=s(K),m.Uc=0,m.Gb==null?K=0:(m.mb=m.Gb,m.nb=m.Uc,m.rc=null,K=1),K=!K),!K){K=m.ga;var it=m.Fa,at=m.P,mt=m.qc,_t=m.mb,Vt=m.nb,gt=at+1,Pt=mt-1,qt=K.l;if(t(it!=null&&_t!=null&&v!=null),Pa[0]=null,Pa[1]=zn,Pa[2]=Un,Pa[3]=cr,K.ca=_t,K.tb=Vt,K.c=v.width,K.i=v.height,t(0<K.c&&0<K.i),1>=mt)v=0;else if(K.$a=3&it[at+0],K.Z=it[at+0]>>2&3,K.Lc=it[at+0]>>4&3,at=it[at+0]>>6&3,0>K.$a||1<K.$a||4<=K.Z||1<K.Lc||at)v=0;else if(qt.put=Ae,qt.ac=Re,qt.bc=De,qt.ma=K,qt.width=v.width,qt.height=v.height,qt.Da=v.Da,qt.v=v.v,qt.va=v.va,qt.j=v.j,qt.o=v.o,K.$a)t:{t(K.$a==1),v=Ja();e:for(;;){if(v==null){v=0;break t}if(t(K!=null),K.mc=v,v.c=K.c,v.i=K.i,v.l=K.l,v.l.ma=K,v.l.width=K.c,v.l.height=K.i,v.a=0,Bt(v.m,it,gt,Pt),!Hs(K.c,K.i,1,v,null)||(v.ab==1&&v.gc[0].hc==3&&er(v.s)?(K.ic=1,it=v.c*v.i,v.Ta=null,v.Ua=0,v.V=s(it),v.Ba=0,v.V==null?(v.a=1,v=0):v=1):(K.ic=0,v=Lo(v,K.c)),!v))break e;v=1;break t}K.mc=null,v=0}else v=Pt>=K.c*K.i;K=!v}if(K)return null;m.ga.Lc!=1?m.Ga=0:R=V-T}t(m.ga!=null),t(T+R<=V);t:{if(v=(it=m.ga).c,V=it.l.o,it.$a==0){if(gt=m.rc,Pt=m.Vc,qt=m.Fa,at=m.P+1+T*v,mt=m.mb,_t=m.nb+T*v,t(at<=m.P+m.qc),it.Z!=0)for(t(Pa[it.Z]!=null),K=0;K<R;++K)Pa[it.Z](gt,Pt,qt,at,mt,_t,v),gt=mt,Pt=_t,_t+=v,at+=v;else for(K=0;K<R;++K)r(mt,_t,qt,at,v),gt=mt,Pt=_t,_t+=v,at+=v;m.rc=gt,m.Vc=Pt}else{if(t(it.mc!=null),v=T+R,t((K=it.mc)!=null),t(v<=K.i),K.C>=v)v=1;else if(it.ic||si(),it.ic){it=K.V,gt=K.Ba,Pt=K.c;var ie=K.i,$t=(qt=1,at=K.$/Pt,mt=K.$%Pt,_t=K.m,Vt=K.s,K.$),re=Pt*ie,se=Pt*v,we=Vt.wc,he=$t<se?vi(Vt,mt,at):null;t($t<=re),t(v<=ie),t(er(Vt));e:for(;;){for(;!_t.h&&$t<se;){if(mt&we||(he=vi(Vt,mt,at)),t(he!=null),St(_t),256>(ie=Wr(he.G[0],he.H[0],_t)))it[gt+$t]=ie,++$t,++mt>=Pt&&(mt=0,++at<=v&&!(at%16)&&oo(K,at));else{if(!(280>ie)){qt=0;break e}ie=Hn(ie-256,_t);var tn,He=Wr(he.G[4],he.H[4],_t);if(St(_t),!($t>=(He=lr(Pt,He=Hn(He,_t)))&&re-$t>=ie)){qt=0;break e}for(tn=0;tn<ie;++tn)it[gt+$t+tn]=it[gt+$t+tn-He];for($t+=ie,mt+=ie;mt>=Pt;)mt-=Pt,++at<=v&&!(at%16)&&oo(K,at);$t<se&&mt&we&&(he=vi(Vt,mt,at))}t(_t.h==ut(_t))}oo(K,at>v?v:at);break e}!qt||_t.h&&$t<re?(qt=0,K.a=_t.h?5:3):K.$=$t,v=qt}else v=Wo(K,K.V,K.Ba,K.c,K.i,v,is);if(!v){R=0;break t}}T+R>=V&&(m.Cc=1),R=1}if(!R)return null;if(m.Cc&&((R=m.ga)!=null&&(R.mc=null),m.ga=null,0<m.Ga))return alert("todo:WebPDequantizeLevels"),null}return m.nb+T*H}function Si(m,v,T,R,H,V){for(;0<H--;){var K,it=m,at=v+(T?1:0),mt=m,_t=v+(T?0:3);for(K=0;K<R;++K){var Vt=mt[_t+4*K];Vt!=255&&(Vt*=32897,it[at+4*K+0]=it[at+4*K+0]*Vt>>23,it[at+4*K+1]=it[at+4*K+1]*Vt>>23,it[at+4*K+2]=it[at+4*K+2]*Vt>>23)}v+=V}}function Lr(m,v,T,R,H){for(;0<R--;){var V;for(V=0;V<T;++V){var K=m[v+2*V+0],it=15&(mt=m[v+2*V+1]),at=4369*it,mt=(240&mt|mt>>4)*at>>16;m[v+2*V+0]=(240&K|K>>4)*at>>16&240|(15&K|K<<4)*at>>16>>4&15,m[v+2*V+1]=240&mt|it}v+=H}}function oi(m,v,T,R,H,V,K,it){var at,mt,_t=255;for(mt=0;mt<H;++mt){for(at=0;at<R;++at){var Vt=m[v+at];V[K+4*at]=Vt,_t&=Vt}v+=T,K+=it}return _t!=255}function Di(m,v,T,R,H){var V;for(V=0;V<H;++V)T[R+V]=m[v+V]>>8}function si(){Ra=Si,ra=Lr,Lc=oi,Es=Di}function ao(m,v,T){rt[m]=function(R,H,V,K,it,at,mt,_t,Vt,gt,Pt,qt,ie,$t,re,se,we){var he,tn=we-1>>1,He=it[at+0]|mt[_t+0]<<16,jn=Vt[gt+0]|Pt[qt+0]<<16;t(R!=null);var Ze=3*He+jn+131074>>2;for(v(R[H+0],255&Ze,Ze>>16,ie,$t),V!=null&&(Ze=3*jn+He+131074>>2,v(V[K+0],255&Ze,Ze>>16,re,se)),he=1;he<=tn;++he){var Bn=it[at+he]|mt[_t+he]<<16,Gr=Vt[gt+he]|Pt[qt+he]<<16,cn=He+Bn+jn+Gr+524296,$e=cn+2*(Bn+jn)>>3;Ze=$e+He>>1,He=(cn=cn+2*(He+Gr)>>3)+Bn>>1,v(R[H+2*he-1],255&Ze,Ze>>16,ie,$t+(2*he-1)*T),v(R[H+2*he-0],255&He,He>>16,ie,$t+(2*he-0)*T),V!=null&&(Ze=cn+jn>>1,He=$e+Gr>>1,v(V[K+2*he-1],255&Ze,Ze>>16,re,se+(2*he-1)*T),v(V[K+2*he+0],255&He,He>>16,re,se+(2*he+0)*T)),He=Bn,jn=Gr}1&we||(Ze=3*He+jn+131074>>2,v(R[H+we-1],255&Ze,Ze>>16,ie,$t+(we-1)*T),V!=null&&(Ze=3*jn+He+131074>>2,v(V[K+we-1],255&Ze,Ze>>16,re,se+(we-1)*T)))}}function ta(){lo[lu]=es,lo[Io]=gs,lo[cu]=zc,lo[Ts]=fc,lo[Pc]=sl,lo[lc]=ja,lo[rl]=_l,lo[jc]=gs,lo[uu]=fc,lo[cc]=sl,lo[fu]=ja}function kl(m){return m&-16384?0>m?0:255:m>>Yu}function fs(m,v){return kl((19077*m>>8)+(26149*v>>8)-14234)}function ds(m,v,T){return kl((19077*m>>8)-(6419*v>>8)-(13320*T>>8)+8708)}function ga(m,v){return kl((19077*m>>8)+(33050*v>>8)-17685)}function ya(m,v,T,R,H){R[H+0]=fs(m,T),R[H+1]=ds(m,v,T),R[H+2]=ga(m,v)}function Na(m,v,T,R,H){R[H+0]=ga(m,v),R[H+1]=ds(m,v,T),R[H+2]=fs(m,T)}function Al(m,v,T,R,H){var V=ds(m,v,T);v=V<<3&224|ga(m,v)>>3,R[H+0]=248&fs(m,T)|V>>5,R[H+1]=v}function ce(m,v,T,R,H){var V=240&ga(m,v)|15;R[H+0]=240&fs(m,T)|ds(m,v,T)>>4,R[H+1]=V}function ba(m,v,T,R,H){R[H+0]=255,ya(m,v,T,R,H+1)}function xo(m,v,T,R,H){Na(m,v,T,R,H),R[H+3]=255}function On(m,v,T,R,H){ya(m,v,T,R,H),R[H+3]=255}function gn(m,v,T){rt[m]=function(R,H,V,K,it,at,mt,_t,Vt){for(var gt=_t+(-2&Vt)*T;_t!=gt;)v(R[H+0],V[K+0],it[at+0],mt,_t),v(R[H+1],V[K+0],it[at+0],mt,_t+T),H+=2,++K,++at,_t+=2*T;1&Vt&&v(R[H+0],V[K+0],it[at+0],mt,_t)}}function Zo(m,v,T){return T==0?m==0?v==0?6:5:v==0?4:0:T}function tc(m,v,T,R,H){switch(m>>>30){case 3:na(v,T,R,H,0);break;case 2:ps(v,T,R,H);break;case 1:Pr(v,T,R,H)}}function ec(m,v){var T,R,H=v.M,V=v.Nb,K=m.oc,it=m.pc+40,at=m.oc,mt=m.pc+584,_t=m.oc,Vt=m.pc+600;for(T=0;16>T;++T)K[it+32*T-1]=129;for(T=0;8>T;++T)at[mt+32*T-1]=129,_t[Vt+32*T-1]=129;for(0<H?K[it-1-32]=at[mt-1-32]=_t[Vt-1-32]=129:(i(K,it-32-1,127,21),i(at,mt-32-1,127,9),i(_t,Vt-32-1,127,9)),R=0;R<m.za;++R){var gt=v.ya[v.aa+R];if(0<R){for(T=-1;16>T;++T)r(K,it+32*T-4,K,it+32*T+12,4);for(T=-1;8>T;++T)r(at,mt+32*T-4,at,mt+32*T+4,4),r(_t,Vt+32*T-4,_t,Vt+32*T+4,4)}var Pt=m.Gd,qt=m.Hd+R,ie=gt.ad,$t=gt.Hc;if(0<H&&(r(K,it-32,Pt[qt].y,0,16),r(at,mt-32,Pt[qt].f,0,8),r(_t,Vt-32,Pt[qt].ea,0,8)),gt.Za){var re=K,se=it-32+16;for(0<H&&(R>=m.za-1?i(re,se,Pt[qt].y[15],4):r(re,se,Pt[qt+1].y,0,4)),T=0;4>T;T++)re[se+128+T]=re[se+256+T]=re[se+384+T]=re[se+0+T];for(T=0;16>T;++T,$t<<=2)re=K,se=it+Pi[T],mi[gt.Ob[T]](re,se),tc($t,ie,16*+T,re,se)}else if(re=Zo(R,H,gt.Ob[0]),zo[re](K,it),$t!=0)for(T=0;16>T;++T,$t<<=2)tc($t,ie,16*+T,K,it+Pi[T]);for(T=gt.Gc,re=Zo(R,H,gt.Dd),oa[re](at,mt),oa[re](_t,Vt),$t=ie,re=at,se=mt,255&(gt=0|T)&&(170&gt?xe($t,256,re,se):vo($t,256,re,se)),gt=_t,$t=Vt,255&(T>>=8)&&(170&T?xe(ie,320,gt,$t):vo(ie,320,gt,$t)),H<m.Ub-1&&(r(Pt[qt].y,0,K,it+480,16),r(Pt[qt].f,0,at,mt+224,8),r(Pt[qt].ea,0,_t,Vt+224,8)),T=8*V*m.B,Pt=m.sa,qt=m.ta+16*R+16*V*m.R,ie=m.qa,gt=m.ra+8*R+T,$t=m.Ha,re=m.Ia+8*R+T,T=0;16>T;++T)r(Pt,qt+T*m.R,K,it+32*T,16);for(T=0;8>T;++T)r(ie,gt+T*m.B,at,mt+32*T,8),r($t,re+T*m.B,_t,Vt+32*T,8)}}function Er(m,v,T,R,H,V,K,it,at){var mt=[0],_t=[0],Vt=0,gt=at!=null?at.kd:0,Pt=at??new zt;if(m==null||12>T)return 7;Pt.data=m,Pt.w=v,Pt.ha=T,v=[v],T=[T],Pt.gb=[Pt.gb];t:{var qt=v,ie=T,$t=Pt.gb;if(t(m!=null),t(ie!=null),t($t!=null),$t[0]=0,12<=ie[0]&&!n(m,qt[0],"RIFF")){if(n(m,qt[0]+8,"WEBP")){$t=3;break t}var re=Ve(m,qt[0]+4);if(12>re||4294967286<re){$t=3;break t}if(gt&&re>ie[0]-8){$t=7;break t}$t[0]=re,qt[0]+=12,ie[0]-=12}$t=0}if($t!=0)return $t;for(re=0<Pt.gb[0],T=T[0];;){t:{var se=m;ie=v,$t=T;var we=mt,he=_t,tn=qt=[0];if((Ze=Vt=[Vt])[0]=0,8>$t[0])$t=7;else{if(!n(se,ie[0],"VP8X")){if(Ve(se,ie[0]+4)!=10){$t=3;break t}if(18>$t[0]){$t=7;break t}var He=Ve(se,ie[0]+8),jn=1+Pe(se,ie[0]+12);if(2147483648<=jn*(se=1+Pe(se,ie[0]+15))){$t=3;break t}tn!=null&&(tn[0]=He),we!=null&&(we[0]=jn),he!=null&&(he[0]=se),ie[0]+=18,$t[0]-=18,Ze[0]=1}$t=0}}if(Vt=Vt[0],qt=qt[0],$t!=0)return $t;if(ie=!!(2&qt),!re&&Vt)return 3;if(V!=null&&(V[0]=!!(16&qt)),K!=null&&(K[0]=ie),it!=null&&(it[0]=0),K=mt[0],qt=_t[0],Vt&&ie&&at==null){$t=0;break}if(4>T){$t=7;break}if(re&&Vt||!re&&!Vt&&!n(m,v[0],"ALPH")){T=[T],Pt.na=[Pt.na],Pt.P=[Pt.P],Pt.Sa=[Pt.Sa];t:{He=m,$t=v,re=T;var Ze=Pt.gb;we=Pt.na,he=Pt.P,tn=Pt.Sa,jn=22,t(He!=null),t(re!=null),se=$t[0];var Bn=re[0];for(t(we!=null),t(tn!=null),we[0]=null,he[0]=null,tn[0]=0;;){if($t[0]=se,re[0]=Bn,8>Bn){$t=7;break t}var Gr=Ve(He,se+4);if(4294967286<Gr){$t=3;break t}var cn=8+Gr+1&-2;if(jn+=cn,0<Ze&&jn>Ze){$t=3;break t}if(!n(He,se,"VP8 ")||!n(He,se,"VP8L")){$t=0;break t}if(Bn[0]<cn){$t=7;break t}n(He,se,"ALPH")||(we[0]=He,he[0]=se+8,tn[0]=Gr),se+=cn,Bn-=cn}}if(T=T[0],Pt.na=Pt.na[0],Pt.P=Pt.P[0],Pt.Sa=Pt.Sa[0],$t!=0)break}T=[T],Pt.Ja=[Pt.Ja],Pt.xa=[Pt.xa];t:if(Ze=m,$t=v,re=T,we=Pt.gb[0],he=Pt.Ja,tn=Pt.xa,He=$t[0],se=!n(Ze,He,"VP8 "),jn=!n(Ze,He,"VP8L"),t(Ze!=null),t(re!=null),t(he!=null),t(tn!=null),8>re[0])$t=7;else{if(se||jn){if(Ze=Ve(Ze,He+4),12<=we&&Ze>we-12){$t=3;break t}if(gt&&Ze>re[0]-8){$t=7;break t}he[0]=Ze,$t[0]+=8,re[0]-=8,tn[0]=jn}else tn[0]=5<=re[0]&&Ze[He+0]==47&&!(Ze[He+4]>>5),he[0]=re[0];$t=0}if(T=T[0],Pt.Ja=Pt.Ja[0],Pt.xa=Pt.xa[0],v=v[0],$t!=0)break;if(4294967286<Pt.Ja)return 3;if(it==null||ie||(it[0]=Pt.xa?2:1),K=[K],qt=[qt],Pt.xa){if(5>T){$t=7;break}it=K,gt=qt,ie=V,m==null||5>T?m=0:5<=T&&m[v+0]==47&&!(m[v+4]>>5)?(re=[0],Ze=[0],we=[0],Bt(he=new j,m,v,T),or(he,re,Ze,we)?(it!=null&&(it[0]=re[0]),gt!=null&&(gt[0]=Ze[0]),ie!=null&&(ie[0]=we[0]),m=1):m=0):m=0}else{if(10>T){$t=7;break}it=qt,m==null||10>T||!Ec(m,v+3,T-3)?m=0:(gt=m[v+0]|m[v+1]<<8|m[v+2]<<16,ie=16383&(m[v+7]<<8|m[v+6]),m=16383&(m[v+9]<<8|m[v+8]),1&gt||3<(gt>>1&7)||!(gt>>4&1)||gt>>5>=Pt.Ja||!ie||!m?m=0:(K&&(K[0]=ie),it&&(it[0]=m),m=1))}if(!m||(K=K[0],qt=qt[0],Vt&&(mt[0]!=K||_t[0]!=qt)))return 3;at!=null&&(at[0]=Pt,at.offset=v-at.w,t(4294967286>v-at.w),t(at.offset==at.ha-T));break}return $t==0||$t==7&&Vt&&at==null?(V!=null&&(V[0]|=Pt.na!=null&&0<Pt.na.length),R!=null&&(R[0]=K),H!=null&&(H[0]=qt),0):$t}function Li(m,v,T){var R=v.width,H=v.height,V=0,K=0,it=R,at=H;if(v.Da=m!=null&&0<m.Da,v.Da&&(it=m.cd,at=m.bd,V=m.v,K=m.j,11>T||(V&=-2,K&=-2),0>V||0>K||0>=it||0>=at||V+it>R||K+at>H))return 0;if(v.v=V,v.j=K,v.va=V+it,v.o=K+at,v.U=it,v.T=at,v.da=m!=null&&0<m.da,v.da){if(!fe(it,at,T=[m.ib],V=[m.hb]))return 0;v.ib=T[0],v.hb=V[0]}return v.ob=m!=null&&m.ob,v.Kb=m==null||!m.Sd,v.da&&(v.ob=v.ib<3*R/4&&v.hb<3*H/4,v.Kb=0),1}function nc(m){if(m==null)return 2;if(11>m.S){var v=m.f.RGBA;v.fb+=(m.height-1)*v.A,v.A=-v.A}else v=m.f.kb,m=m.height,v.O+=(m-1)*v.fa,v.fa=-v.fa,v.N+=(m-1>>1)*v.Ab,v.Ab=-v.Ab,v.W+=(m-1>>1)*v.Db,v.Db=-v.Db,v.F!=null&&(v.J+=(m-1)*v.lb,v.lb=-v.lb);return 0}function xa(m,v,T,R){if(R==null||0>=m||0>=v)return 2;if(T!=null){if(T.Da){var H=T.cd,V=T.bd,K=-2&T.v,it=-2&T.j;if(0>K||0>it||0>=H||0>=V||K+H>m||it+V>v)return 2;m=H,v=V}if(T.da){if(!fe(m,v,H=[T.ib],V=[T.hb]))return 2;m=H[0],v=V[0]}}R.width=m,R.height=v;t:{var at=R.width,mt=R.height;if(m=R.S,0>=at||0>=mt||!(m>=lu&&13>m))m=2;else{if(0>=R.Rd&&R.sd==null){K=V=H=v=0;var _t=(it=at*Hc[m])*mt;if(11>m||(V=(mt+1)/2*(v=(at+1)/2),m==12&&(K=(H=at)*mt)),(mt=s(_t+2*V+K))==null){m=1;break t}R.sd=mt,11>m?((at=R.f.RGBA).eb=mt,at.fb=0,at.A=it,at.size=_t):((at=R.f.kb).y=mt,at.O=0,at.fa=it,at.Fd=_t,at.f=mt,at.N=0+_t,at.Ab=v,at.Cd=V,at.ea=mt,at.W=0+_t+V,at.Db=v,at.Ed=V,m==12&&(at.F=mt,at.J=0+_t+2*V),at.Tc=K,at.lb=H)}if(v=1,H=R.S,V=R.width,K=R.height,H>=lu&&13>H)if(11>H)m=R.f.RGBA,v&=(it=Math.abs(m.A))*(K-1)+V<=m.size,v&=it>=V*Hc[H],v&=m.eb!=null;else{m=R.f.kb,it=(V+1)/2,_t=(K+1)/2,at=Math.abs(m.fa),mt=Math.abs(m.Ab);var Vt=Math.abs(m.Db),gt=Math.abs(m.lb),Pt=gt*(K-1)+V;v&=at*(K-1)+V<=m.Fd,v&=mt*(_t-1)+it<=m.Cd,v=(v&=Vt*(_t-1)+it<=m.Ed)&at>=V&mt>=it&Vt>=it,v&=m.y!=null,v&=m.f!=null,v&=m.ea!=null,H==12&&(v&=gt>=V,v&=Pt<=m.Tc,v&=m.F!=null)}else v=0;m=v?0:2}}return m!=0||T!=null&&T.fd&&(m=nc(R)),m}var rc=64,_a=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215],Ml=24,Vi=32,Po=8,Cl=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];Ne("Predictor0","PredictorAdd0"),rt.Predictor0=function(){return 4278190080},rt.Predictor1=function(m){return m},rt.Predictor2=function(m,v,T){return v[T+0]},rt.Predictor3=function(m,v,T){return v[T+1]},rt.Predictor4=function(m,v,T){return v[T-1]},rt.Predictor5=function(m,v,T){return Ye(Ye(m,v[T+1]),v[T+0])},rt.Predictor6=function(m,v,T){return Ye(m,v[T-1])},rt.Predictor7=function(m,v,T){return Ye(m,v[T+0])},rt.Predictor8=function(m,v,T){return Ye(v[T-1],v[T+0])},rt.Predictor9=function(m,v,T){return Ye(v[T+0],v[T+1])},rt.Predictor10=function(m,v,T){return Ye(Ye(m,v[T-1]),Ye(v[T+0],v[T+1]))},rt.Predictor11=function(m,v,T){var R=v[T+0];return 0>=Ue(R>>24&255,m>>24&255,(v=v[T-1])>>24&255)+Ue(R>>16&255,m>>16&255,v>>16&255)+Ue(R>>8&255,m>>8&255,v>>8&255)+Ue(255&R,255&m,255&v)?R:m},rt.Predictor12=function(m,v,T){var R=v[T+0];return(un((m>>24&255)+(R>>24&255)-((v=v[T-1])>>24&255))<<24|un((m>>16&255)+(R>>16&255)-(v>>16&255))<<16|un((m>>8&255)+(R>>8&255)-(v>>8&255))<<8|un((255&m)+(255&R)-(255&v)))>>>0},rt.Predictor13=function(m,v,T){var R=v[T-1];return(Fn((m=Ye(m,v[T+0]))>>24&255,R>>24&255)<<24|Fn(m>>16&255,R>>16&255)<<16|Fn(m>>8&255,R>>8&255)<<8|Fn(255&m,255&R))>>>0};var Da=rt.PredictorAdd0;rt.PredictorAdd1=_n,Ne("Predictor2","PredictorAdd2"),Ne("Predictor3","PredictorAdd3"),Ne("Predictor4","PredictorAdd4"),Ne("Predictor5","PredictorAdd5"),Ne("Predictor6","PredictorAdd6"),Ne("Predictor7","PredictorAdd7"),Ne("Predictor8","PredictorAdd8"),Ne("Predictor9","PredictorAdd9"),Ne("Predictor10","PredictorAdd10"),Ne("Predictor11","PredictorAdd11"),Ne("Predictor12","PredictorAdd12"),Ne("Predictor13","PredictorAdd13");var el=rt.PredictorAdd2;Ie("ColorIndexInverseTransform","MapARGB","32b",function(m){return m>>8&255},function(m){return m}),Ie("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",function(m){return m},function(m){return m>>8&255});var ic,nl=rt.ColorIndexInverseTransform,Ri=rt.MapARGB,_c=rt.VP8LColorIndexInverseTransformAlpha,Or=rt.MapAlpha,jo=rt.VP8LPredictorsAdd=[];jo.length=16,(rt.VP8LPredictors=[]).length=16,(rt.VP8LPredictorsAdd_C=[]).length=16,(rt.VP8LPredictors_C=[]).length=16;var La,oc,hs,eo,ea,Qo,ts,na,ps,xe,Pr,vo,ur,jr,ai,Qr,va,Dc,sc,ou,If,Td,Hu,El,Ra,ra,Lc,Es,ac=s(511),su=s(2041),Rc=s(225),Tl=s(767),au=0,Oa=su,Oc=Rc,wo=Tl,So=ac,lu=0,Io=1,cu=2,Ts=3,Pc=4,lc=5,rl=6,jc=7,uu=8,cc=9,fu=10,Ns=[2,3,7],uc=[3,3,11],Nl=[280,256,256,256,40],du=[0,1,1,1,0],Ic=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],ia=[24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112],_s=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],il=8,Ds=[4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157],ko=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284],ms=null,zf=[[173,148,140,0],[176,155,140,135,0],[180,157,141,134,130,0],[254,254,243,230,196,177,153,140,133,130,129,0]],qu=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],hu=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],Bf=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,255,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],Oi=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,1,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],Xr=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,255,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],Yn=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],zo=[],mi=[],oa=[],ol=1,$u=2,Pa=[],lo=[];ao("UpsampleRgbLinePair",ya,3),ao("UpsampleBgrLinePair",Na,3),ao("UpsampleRgbaLinePair",On,4),ao("UpsampleBgraLinePair",xo,4),ao("UpsampleArgbLinePair",ba,4),ao("UpsampleRgba4444LinePair",ce,2),ao("UpsampleRgb565LinePair",Al,2);var es=rt.UpsampleRgbLinePair,zc=rt.UpsampleBgrLinePair,gs=rt.UpsampleRgbaLinePair,fc=rt.UpsampleBgraLinePair,sl=rt.UpsampleArgbLinePair,ja=rt.UpsampleRgba4444LinePair,_l=rt.UpsampleRgb565LinePair,Ls=16,dc=1<<Ls-1,hc=-227,Dl=482,Yu=6,Ll=0,co=s(256),Vu=s(256),pu=s(256),Bc=s(256),Ff=s(Dl-hc),Uf=s(Dl-hc);gn("YuvToRgbRow",ya,3),gn("YuvToBgrRow",Na,3),gn("YuvToRgbaRow",On,4),gn("YuvToBgraRow",xo,4),gn("YuvToArgbRow",ba,4),gn("YuvToRgba4444Row",ce,2),gn("YuvToRgb565Row",Al,2);var Pi=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Ia=[0,2,8],Fc=[8,7,6,4,4,2,2,2,1,1,1,1],Uc=1;this.WebPDecodeRGBA=function(m,v,T,R,H){var V=Io,K=new Et,it=new En;K.ba=it,it.S=V,it.width=[it.width],it.height=[it.height];var at=it.width,mt=it.height,_t=new en;if(_t==null||m==null)var Vt=2;else t(_t!=null),Vt=Er(m,v,T,_t.width,_t.height,_t.Pd,_t.Qd,_t.format,null);if(Vt!=0?at=0:(at!=null&&(at[0]=_t.width[0]),mt!=null&&(mt[0]=_t.height[0]),at=1),at){it.width=it.width[0],it.height=it.height[0],R!=null&&(R[0]=it.width),H!=null&&(H[0]=it.height);t:{if(R=new Ea,(H=new zt).data=m,H.w=v,H.ha=T,H.kd=1,v=[0],t(H!=null),((m=Er(H.data,H.w,H.ha,null,null,null,v,null,H))==0||m==7)&&v[0]&&(m=4),(v=m)==0){if(t(K!=null),R.data=H.data,R.w=H.w+H.offset,R.ha=H.ha-H.offset,R.put=Ae,R.ac=Re,R.bc=De,R.ma=K,H.xa){if((m=Ja())==null){K=1;break t}if((function(gt,Pt){var qt=[0],ie=[0],$t=[0];e:for(;;){if(gt==null)return 0;if(Pt==null)return gt.a=2,0;if(gt.l=Pt,gt.a=0,Bt(gt.m,Pt.data,Pt.w,Pt.ha),!or(gt.m,qt,ie,$t)){gt.a=3;break e}if(gt.xb=$u,Pt.width=qt[0],Pt.height=ie[0],!Hs(qt[0],ie[0],1,gt,null))break e;return 1}return t(gt.a!=0),0})(m,R)){if(R=(v=xa(R.width,R.height,K.Oa,K.ba))==0){e:{R=m;n:for(;;){if(R==null){R=0;break e}if(t(R.s.yc!=null),t(R.s.Ya!=null),t(0<R.s.Wb),t((T=R.l)!=null),t((H=T.ma)!=null),R.xb!=0){if(R.ca=H.ba,R.tb=H.tb,t(R.ca!=null),!Li(H.Oa,T,Ts)){R.a=2;break n}if(!Lo(R,T.width)||T.da)break n;if((T.da||wn(R.ca.S))&&si(),11>R.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),R.ca.f.kb.F!=null&&si()),R.Pb&&0<R.s.ua&&R.s.vb.X==null&&!ft(R.s.vb,R.s.Wa.Xa)){R.a=1;break n}R.xb=0}if(!Wo(R,R.V,R.Ba,R.c,R.i,T.o,qr))break n;H.Dc=R.Ma,R=1;break e}t(R.a!=0),R=0}R=!R}R&&(v=m.a)}else v=m.a}else{if((m=new Ys)==null){K=1;break t}if(m.Fa=H.na,m.P=H.P,m.qc=H.Sa,Ss(m,R)){if((v=xa(R.width,R.height,K.Oa,K.ba))==0){if(m.Aa=0,T=K.Oa,t((H=m)!=null),T!=null){if(0<(at=0>(at=T.Md)?0:100<at?255:255*at/100)){for(mt=_t=0;4>mt;++mt)12>(Vt=H.pb[mt]).lc&&(Vt.ia=at*Fc[0>Vt.lc?0:Vt.lc]>>3),_t|=Vt.ia;_t&&(alert("todo:VP8InitRandom"),H.ia=1)}H.Ga=T.Id,100<H.Ga?H.Ga=100:0>H.Ga&&(H.Ga=0)}(function(gt,Pt){if(gt==null)return 0;if(Pt==null)return sr(gt,2,"NULL VP8Io parameter in VP8Decode().");if(!gt.cb&&!Ss(gt,Pt))return 0;if(t(gt.cb),Pt.ac==null||Pt.ac(Pt)){Pt.ob&&(gt.L=0);var qt=Ia[gt.L];if(gt.L==2?(gt.yb=0,gt.zb=0):(gt.yb=Pt.v-qt>>4,gt.zb=Pt.j-qt>>4,0>gt.yb&&(gt.yb=0),0>gt.zb&&(gt.zb=0)),gt.Va=Pt.o+15+qt>>4,gt.Hb=Pt.va+15+qt>>4,gt.Hb>gt.za&&(gt.Hb=gt.za),gt.Va>gt.Ub&&(gt.Va=gt.Ub),0<gt.L){var ie=gt.ed;for(qt=0;4>qt;++qt){var $t;if(gt.Qa.Cb){var re=gt.Qa.Lb[qt];gt.Qa.Fb||(re+=ie.Tb)}else re=ie.Tb;for($t=0;1>=$t;++$t){var se=gt.gd[qt][$t],we=re;if(ie.Pc&&(we+=ie.vd[0],$t&&(we+=ie.od[0])),0<(we=0>we?0:63<we?63:we)){var he=we;0<ie.wb&&(he=4<ie.wb?he>>2:he>>1)>9-ie.wb&&(he=9-ie.wb),1>he&&(he=1),se.dd=he,se.tc=2*we+he,se.ld=40<=we?2:15<=we?1:0}else se.tc=0;se.La=$t}}}qt=0}else sr(gt,6,"Frame setup failed"),qt=gt.a;if(qt=qt==0){if(qt){gt.$c=0,0<gt.Aa||(gt.Ic=Uc);e:{qt=gt.Ic,ie=4*(he=gt.za);var tn=32*he,He=he+1,jn=0<gt.L?he*(0<gt.Aa?2:1):0,Ze=(gt.Aa==2?2:1)*he;if((se=ie+832+($t=3*(16*qt+Ia[gt.L])/2*tn)+(re=gt.Fa!=null&&0<gt.Fa.length?gt.Kc.c*gt.Kc.i:0))!=se)qt=0;else{if(se>gt.Vb){if(gt.Vb=0,gt.Ec=s(se),gt.Fc=0,gt.Ec==null){qt=sr(gt,1,"no memory during frame initialization.");break e}gt.Vb=se}se=gt.Ec,we=gt.Fc,gt.Ac=se,gt.Bc=we,we+=ie,gt.Gd=l(tn,Cc),gt.Hd=0,gt.rb=l(He+1,Go),gt.sb=1,gt.wa=jn?l(jn,Xo):null,gt.Y=0,gt.D.Nb=0,gt.D.wa=gt.wa,gt.D.Y=gt.Y,0<gt.Aa&&(gt.D.Y+=he),t(!0),gt.oc=se,gt.pc=we,we+=832,gt.ya=l(Ze,Mc),gt.aa=0,gt.D.ya=gt.ya,gt.D.aa=gt.aa,gt.Aa==2&&(gt.D.aa+=he),gt.R=16*he,gt.B=8*he,he=(tn=Ia[gt.L])*gt.R,tn=tn/2*gt.B,gt.sa=se,gt.ta=we+he,gt.qa=gt.sa,gt.ra=gt.ta+16*qt*gt.R+tn,gt.Ha=gt.qa,gt.Ia=gt.ra+8*qt*gt.B+tn,gt.$c=0,we+=$t,gt.mb=re?se:null,gt.nb=re?we:null,t(we+re<=gt.Fc+gt.Vb),Ro(gt),i(gt.Ac,gt.Bc,0,ie),qt=1}}if(qt){if(Pt.ka=0,Pt.y=gt.sa,Pt.O=gt.ta,Pt.f=gt.qa,Pt.N=gt.ra,Pt.ea=gt.Ha,Pt.Vd=gt.Ia,Pt.fa=gt.R,Pt.Rc=gt.B,Pt.F=null,Pt.J=0,!au){for(qt=-255;255>=qt;++qt)ac[255+qt]=0>qt?-qt:qt;for(qt=-1020;1020>=qt;++qt)su[1020+qt]=-128>qt?-128:127<qt?127:qt;for(qt=-112;112>=qt;++qt)Rc[112+qt]=-16>qt?-16:15<qt?15:qt;for(qt=-255;510>=qt;++qt)Tl[255+qt]=0>qt?0:255<qt?255:qt;au=1}ts=so,na=Za,xe=_i,Pr=as,vo=wi,ps=Tc,ur=wl,jr=Sl,ai=Ql,Qr=C,va=Zl,Dc=ma,sc=U,ou=pt,If=Ms,Td=Js,Hu=Zs,El=vl,mi[0]=Uu,mi[1]=Ko,mi[2]=Qa,mi[3]=Nc,mi[4]=Xl,mi[5]=Ws,mi[6]=Vs,mi[7]=Oo,mi[8]=Gl,mi[9]=ks,zo[0]=$i,zo[1]=Jo,zo[2]=Cr,zo[3]=xl,zo[4]=Jt,zo[5]=iu,zo[6]=bo,oa[0]=Jl,oa[1]=to,oa[2]=Xs,oa[3]=Kl,oa[4]=qn,oa[5]=tl,oa[6]=As,qt=1}else qt=0}qt&&(qt=(function(Bn,Gr){for(Bn.M=0;Bn.M<Bn.Va;++Bn.M){var cn,$e=Bn.Jc[Bn.M&Bn.Xb],Le=Bn.m,li=Bn;for(cn=0;cn<li.za;++cn){var Mn=Le,$n=li,ir=$n.Ac,ki=$n.Bc+4*cn,no=$n.zc,Ir=$n.ya[$n.aa+cn];if($n.Qa.Bb?Ir.$b=Qt(Mn,$n.Pa.jb[0])?2+Qt(Mn,$n.Pa.jb[2]):Qt(Mn,$n.Pa.jb[1]):Ir.$b=0,$n.kc&&(Ir.Ad=Qt(Mn,$n.Bd)),Ir.Za=!Qt(Mn,145)+0,Ir.Za){var ji=Ir.Ob,Bo=0;for($n=0;4>$n;++$n){var Wi,Vn=no[0+$n];for(Wi=0;4>Wi;++Wi){Vn=Oi[ir[ki+Wi]][Vn];for(var fr=hu[Qt(Mn,Vn[0])];0<fr;)fr=hu[2*fr+Qt(Mn,Vn[fr])];Vn=-fr,ir[ki+Wi]=Vn}r(ji,Bo,ir,ki,4),Bo+=4,no[0+$n]=Vn}}else Vn=Qt(Mn,156)?Qt(Mn,128)?1:3:Qt(Mn,163)?2:0,Ir.Ob[0]=Vn,i(ir,ki,Vn,4),i(no,0,Vn,4);Ir.Dd=Qt(Mn,142)?Qt(Mn,114)?Qt(Mn,183)?1:3:2:0}if(li.m.Ka)return sr(Bn,7,"Premature end-of-partition0 encountered.");for(;Bn.ja<Bn.za;++Bn.ja){if(li=$e,Mn=(Le=Bn).rb[Le.sb-1],ir=Le.rb[Le.sb+Le.ja],cn=Le.ya[Le.aa+Le.ja],ki=Le.kc?cn.Ad:0)Mn.la=ir.la=0,cn.Za||(Mn.Na=ir.Na=0),cn.Hc=0,cn.Gc=0,cn.ia=0;else{var Kr,yr;if(Mn=ir,ir=li,ki=Le.Pa.Xc,no=Le.ya[Le.aa+Le.ja],Ir=Le.pb[no.$b],$n=no.ad,ji=0,Bo=Le.rb[Le.sb-1],Vn=Wi=0,i($n,ji,0,384),no.Za)var Ii=0,ti=ki[3];else{fr=s(16);var br=Mn.Na+Bo.Na;if(br=ms(ir,ki[1],br,Ir.Eb,0,fr,0),Mn.Na=Bo.Na=(0<br)+0,1<br)ts(fr,0,$n,ji);else{var zi=fr[0]+3>>3;for(fr=0;256>fr;fr+=16)$n[ji+fr]=zi}Ii=1,ti=ki[0]}var Tr=15&Mn.la,Bi=15&Bo.la;for(fr=0;4>fr;++fr){var Xi=1&Bi;for(zi=yr=0;4>zi;++zi)Tr=Tr>>1|(Xi=(br=ms(ir,ti,br=Xi+(1&Tr),Ir.Sc,Ii,$n,ji))>Ii)<<7,yr=yr<<2|(3<br?3:1<br?2:$n[ji+0]!=0),ji+=16;Tr>>=4,Bi=Bi>>1|Xi<<7,Wi=(Wi<<8|yr)>>>0}for(ti=Tr,Ii=Bi>>4,Kr=0;4>Kr;Kr+=2){for(yr=0,Tr=Mn.la>>4+Kr,Bi=Bo.la>>4+Kr,fr=0;2>fr;++fr){for(Xi=1&Bi,zi=0;2>zi;++zi)br=Xi+(1&Tr),Tr=Tr>>1|(Xi=0<(br=ms(ir,ki[2],br,Ir.Qc,0,$n,ji)))<<3,yr=yr<<2|(3<br?3:1<br?2:$n[ji+0]!=0),ji+=16;Tr>>=2,Bi=Bi>>1|Xi<<5}Vn|=yr<<4*Kr,ti|=Tr<<4<<Kr,Ii|=(240&Bi)<<Kr}Mn.la=ti,Bo.la=Ii,no.Hc=Wi,no.Gc=Vn,no.ia=43690&Vn?0:Ir.ia,ki=!(Wi|Vn)}if(0<Le.L&&(Le.wa[Le.Y+Le.ja]=Le.gd[cn.$b][cn.Za],Le.wa[Le.Y+Le.ja].La|=!ki),li.Ka)return sr(Bn,7,"Premature end-of-file encountered.")}if(Ro(Bn),Le=Gr,li=1,cn=($e=Bn).D,Mn=0<$e.L&&$e.M>=$e.zb&&$e.M<=$e.Va,$e.Aa==0)e:{if(cn.M=$e.M,cn.uc=Mn,ec($e,cn),li=1,cn=(yr=$e.D).Nb,Mn=(Vn=Ia[$e.L])*$e.R,ir=Vn/2*$e.B,fr=16*cn*$e.R,zi=8*cn*$e.B,ki=$e.sa,no=$e.ta-Mn+fr,Ir=$e.qa,$n=$e.ra-ir+zi,ji=$e.Ha,Bo=$e.Ia-ir+zi,Bi=(Tr=yr.M)==0,Wi=Tr>=$e.Va-1,$e.Aa==2&&ec($e,yr),yr.uc)for(Xi=(br=$e).D.M,t(br.D.uc),yr=br.yb;yr<br.Hb;++yr){Ii=yr,ti=Xi;var zr=(dr=(ci=br).D).Nb;Kr=ci.R;var dr=dr.wa[dr.Y+Ii],ro=ci.sa,Ai=ci.ta+16*zr*Kr+16*Ii,yn=dr.dd,hn=dr.tc;if(hn!=0)if(t(3<=hn),ci.L==1)0<Ii&&Td(ro,Ai,Kr,hn+4),dr.La&&El(ro,Ai,Kr,hn),0<ti&&If(ro,Ai,Kr,hn+4),dr.La&&Hu(ro,Ai,Kr,hn);else{var xr=ci.B,Ao=ci.qa,ns=ci.ra+8*zr*xr+8*Ii,uo=ci.Ha,ci=ci.Ia+8*zr*xr+8*Ii;zr=dr.ld,0<Ii&&(jr(ro,Ai,Kr,hn+4,yn,zr),Qr(Ao,ns,uo,ci,xr,hn+4,yn,zr)),dr.La&&(Dc(ro,Ai,Kr,hn,yn,zr),ou(Ao,ns,uo,ci,xr,hn,yn,zr)),0<ti&&(ur(ro,Ai,Kr,hn+4,yn,zr),ai(Ao,ns,uo,ci,xr,hn+4,yn,zr)),dr.La&&(va(ro,Ai,Kr,hn,yn,zr),sc(Ao,ns,uo,ci,xr,hn,yn,zr))}}if($e.ia&&alert("todo:DitherRow"),Le.put!=null){if(yr=16*Tr,Tr=16*(Tr+1),Bi?(Le.y=$e.sa,Le.O=$e.ta+fr,Le.f=$e.qa,Le.N=$e.ra+zi,Le.ea=$e.Ha,Le.W=$e.Ia+zi):(yr-=Vn,Le.y=ki,Le.O=no,Le.f=Ir,Le.N=$n,Le.ea=ji,Le.W=Bo),Wi||(Tr-=Vn),Tr>Le.o&&(Tr=Le.o),Le.F=null,Le.J=null,$e.Fa!=null&&0<$e.Fa.length&&yr<Tr&&(Le.J=Yi($e,Le,yr,Tr-yr),Le.F=$e.mb,Le.F==null&&Le.F.length==0)){li=sr($e,3,"Could not decode alpha data.");break e}yr<Le.j&&(Vn=Le.j-yr,yr=Le.j,t(!(1&Vn)),Le.O+=$e.R*Vn,Le.N+=$e.B*(Vn>>1),Le.W+=$e.B*(Vn>>1),Le.F!=null&&(Le.J+=Le.width*Vn)),yr<Tr&&(Le.O+=Le.v,Le.N+=Le.v>>1,Le.W+=Le.v>>1,Le.F!=null&&(Le.J+=Le.v),Le.ka=yr-Le.j,Le.U=Le.va-Le.v,Le.T=Tr-yr,li=Le.put(Le))}cn+1!=$e.Ic||Wi||(r($e.sa,$e.ta-Mn,ki,no+16*$e.R,Mn),r($e.qa,$e.ra-ir,Ir,$n+8*$e.B,ir),r($e.Ha,$e.Ia-ir,ji,Bo+8*$e.B,ir))}if(!li)return sr(Bn,6,"Output aborted.")}return 1})(gt,Pt)),Pt.bc!=null&&Pt.bc(Pt),qt&=1}return qt?(gt.cb=0,qt):0})(m,R)||(v=m.a)}}else v=m.a}v==0&&K.Oa!=null&&K.Oa.fd&&(v=nc(K.ba))}K=v}V=K!=0?null:11>V?it.f.RGBA.eb:it.f.kb.y}else V=null;return V};var Hc=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function d(rt,Dt){for(var Q="",lt=0;lt<4;lt++)Q+=String.fromCharCode(rt[Dt++]);return Q}function p(rt,Dt){return rt[Dt+0]|rt[Dt+1]<<8}function g(rt,Dt){return(rt[Dt+0]|rt[Dt+1]<<8|rt[Dt+2]<<16)>>>0}function b(rt,Dt){return(rt[Dt+0]|rt[Dt+1]<<8|rt[Dt+2]<<16|rt[Dt+3]<<24)>>>0}new f;var y=[0],M=[0],E=[],D=new f,L=e,q=(function(rt,Dt){var Q={},lt=0,X=!1,wt=0,Tt=0;if(Q.frames=[],!(function(P,j){for(var G=0;G<4;G++)if(P[j+G]!="RIFF".charCodeAt(G))return!0;return!1})(rt,Dt)){for(b(rt,Dt+=4),Dt+=8;Dt<rt.length;){var yt=d(rt,Dt),J=b(rt,Dt+=4);Dt+=4;var ct=J+(1&J);switch(yt){case"VP8 ":case"VP8L":Q.frames[lt]===void 0&&(Q.frames[lt]={}),(Z=Q.frames[lt]).src_off=X?Tt:Dt-8,Z.src_size=wt+J+8,lt++,X&&(X=!1,wt=0,Tt=0);break;case"VP8X":(Z=Q.header={}).feature_flags=rt[Dt];var Bt=Dt+4;Z.canvas_width=1+g(rt,Bt),Bt+=3,Z.canvas_height=1+g(rt,Bt),Bt+=3;break;case"ALPH":X=!0,wt=ct+8,Tt=Dt-8;break;case"ANIM":(Z=Q.header).bgcolor=b(rt,Dt),Bt=Dt+4,Z.loop_count=p(rt,Bt),Bt+=2;break;case"ANMF":var te,Z;(Z=Q.frames[lt]={}).offset_x=2*g(rt,Dt),Dt+=3,Z.offset_y=2*g(rt,Dt),Dt+=3,Z.width=1+g(rt,Dt),Dt+=3,Z.height=1+g(rt,Dt),Dt+=3,Z.duration=g(rt,Dt),Dt+=3,te=rt[Dt++],Z.dispose=1&te,Z.blend=te>>1&1}yt!="ANMF"&&(Dt+=ct)}return Q}})(L,0);q.response=L,q.rgbaoutput=!0,q.dataurl=!1;var $=q.header?q.header:null,Y=q.frames?q.frames:null;if($){$.loop_counter=$.loop_count,y=[$.canvas_height],M=[$.canvas_width];for(var ht=0;ht<Y.length&&Y[ht].blend!=0;ht++);}var Mt=Y[0],vt=D.WebPDecodeRGBA(L,Mt.src_off,Mt.src_size,M,y);Mt.rgba=vt,Mt.imgwidth=M[0],Mt.imgheight=y[0];for(var bt=0;bt<M[0]*y[0]*4;bt++)E[bt]=vt[bt];return this.width=M,this.height=y,this.data=E,this}function F_(){var e,t=this.internal.__metadata__.metadata,n=unescape(encodeURIComponent(t));e=this.internal.__metadata__.rawXml?n:'<x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:jspdf="'+this.internal.__metadata__.namespaceUri+'"><jspdf:metadata>'+n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")+"</jspdf:metadata></rdf:Description></rdf:RDF></x:xmpmeta>",this.internal.__metadata__.metadataObjectNumber=this.internal.newObject(),this.internal.write("<< /Type /Metadata /Subtype /XML /Length "+e.length+" >>"),this.internal.write("stream"),this.internal.write(e),this.internal.write("endstream"),this.internal.write("endobj")}function U_(){this.internal.__metadata__.metadataObjectNumber&&this.internal.write("/Metadata "+this.internal.__metadata__.metadataObjectNumber+" 0 R")}(function(e){var t,n,r,i,s,l,c,f,d,p=function(P){return P=P||{},this.isStrokeTransparent=P.isStrokeTransparent||!1,this.strokeOpacity=P.strokeOpacity||1,this.strokeStyle=P.strokeStyle||"#000000",this.fillStyle=P.fillStyle||"#000000",this.isFillTransparent=P.isFillTransparent||!1,this.fillOpacity=P.fillOpacity||1,this.font=P.font||"10px sans-serif",this.textBaseline=P.textBaseline||"alphabetic",this.textAlign=P.textAlign||"left",this.lineWidth=P.lineWidth||1,this.lineJoin=P.lineJoin||"miter",this.lineCap=P.lineCap||"butt",this.path=P.path||[],this.transform=P.transform!==void 0?P.transform.clone():new f,this.globalCompositeOperation=P.globalCompositeOperation||"normal",this.globalAlpha=P.globalAlpha||1,this.clip_path=P.clip_path||[],this.currentPoint=P.currentPoint||new l,this.miterLimit=P.miterLimit||10,this.lastPoint=P.lastPoint||new l,this.lineDashOffset=P.lineDashOffset||0,this.lineDash=P.lineDash||[],this.margin=P.margin||[0,0,0,0],this.prevPageLastElemOffset=P.prevPageLastElemOffset||0,this.ignoreClearRect=typeof P.ignoreClearRect!="boolean"||P.ignoreClearRect,this};e.events.push(["initialized",function(){this.context2d=new g(this),t=this.internal.f2,n=this.internal.getCoordinateString,r=this.internal.getVerticalCoordinateString,i=this.internal.getHorizontalCoordinate,s=this.internal.getVerticalCoordinate,l=this.internal.Point,c=this.internal.Rectangle,f=this.internal.Matrix,d=new p}]);var g=function(P){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var j=P;Object.defineProperty(this,"pdf",{get:function(){return j}});var G=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return G},set:function(ft){G=!!ft}});var ut=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return ut},set:function(ft){ut=!!ft}});var xt=0;Object.defineProperty(this,"posX",{get:function(){return xt},set:function(ft){isNaN(ft)||(xt=ft)}});var St=0;Object.defineProperty(this,"posY",{get:function(){return St},set:function(ft){isNaN(ft)||(St=ft)}}),Object.defineProperty(this,"margin",{get:function(){return d.margin},set:function(ft){var Oe;typeof ft=="number"?Oe=[ft,ft,ft,ft]:((Oe=new Array(4))[0]=ft[0],Oe[1]=ft.length>=2?ft[1]:Oe[0],Oe[2]=ft.length>=3?ft[2]:Oe[0],Oe[3]=ft.length>=4?ft[3]:Oe[1]),d.margin=Oe}});var Ft=!1;Object.defineProperty(this,"autoPaging",{get:function(){return Ft},set:function(ft){Ft=ft}});var Rt=0;Object.defineProperty(this,"lastBreak",{get:function(){return Rt},set:function(ft){Rt=ft}});var Qt=[];Object.defineProperty(this,"pageBreaks",{get:function(){return Qt},set:function(ft){Qt=ft}}),Object.defineProperty(this,"ctx",{get:function(){return d},set:function(ft){ft instanceof p&&(d=ft)}}),Object.defineProperty(this,"path",{get:function(){return d.path},set:function(ft){d.path=ft}});var ve=[];Object.defineProperty(this,"ctxStack",{get:function(){return ve},set:function(ft){ve=ft}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(ft){var Oe;Oe=b(ft),this.ctx.fillStyle=Oe.style,this.ctx.isFillTransparent=Oe.a===0,this.ctx.fillOpacity=Oe.a,this.pdf.setFillColor(Oe.r,Oe.g,Oe.b,{a:Oe.a}),this.pdf.setTextColor(Oe.r,Oe.g,Oe.b,{a:Oe.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(ft){var Oe=b(ft);this.ctx.strokeStyle=Oe.style,this.ctx.isStrokeTransparent=Oe.a===0,this.ctx.strokeOpacity=Oe.a,Oe.a===0?this.pdf.setDrawColor(255,255,255):(Oe.a,this.pdf.setDrawColor(Oe.r,Oe.g,Oe.b))}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(ft){["butt","round","square"].indexOf(ft)!==-1&&(this.ctx.lineCap=ft,this.pdf.setLineCap(ft))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(ft){isNaN(ft)||(this.ctx.lineWidth=ft,this.pdf.setLineWidth(ft))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(ft){["bevel","round","miter"].indexOf(ft)!==-1&&(this.ctx.lineJoin=ft,this.pdf.setLineJoin(ft))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(ft){isNaN(ft)||(this.ctx.miterLimit=ft,this.pdf.setMiterLimit(ft))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(ft){this.ctx.textBaseline=ft}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(ft){["right","end","center","left","start"].indexOf(ft)!==-1&&(this.ctx.textAlign=ft)}});var je=null,Pe=null,Ve=null;Object.defineProperty(this,"fontFaces",{get:function(){return Ve},set:function(ft){je=null,Pe=null,Ve=ft}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(ft){var Oe;if(this.ctx.font=ft,(Oe=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-_,\"\'\sa-z0-9]+?)\s*$/i.exec(ft))!==null){var In=Oe[1];Oe[2];var fe=Oe[3],ge=Oe[4];Oe[5];var Te=Oe[6],Ne=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(ge)[2];ge=Math.floor(Ne==="px"?parseFloat(ge)*this.pdf.internal.scaleFactor:Ne==="em"?parseFloat(ge)*this.pdf.getFontSize():parseFloat(ge)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(ge);var _e=(function(Ie){var kr,Cn,nn=[],ln=Ie.trim();if(ln==="")return qy;if(ln in nS)return[nS[ln]];for(;ln!=="";){switch(Cn=null,kr=(ln=iS(ln)).charAt(0)){case'"':case"'":Cn=O_(ln.substring(1),kr);break;default:Cn=P_(ln)}if(Cn===null||(nn.push(Cn[0]),(ln=iS(Cn[1]))!==""&&ln.charAt(0)!==","))return qy;ln=ln.replace(/^,/,"")}return nn})(Te);if(this.fontFaces){var Ye=(function(Ie,kr){var Cn=Ie.getFontList(),nn=JSON.stringify(Cn);if(je===null||Pe!==nn){var ln=(function(Ln){var Ke=[];return Object.keys(Ln).forEach(function(ar){Ln[ar].forEach(function(wn){var Sn=null;switch(wn){case"bold":Sn={family:ar,weight:"bold"};break;case"italic":Sn={family:ar,style:"italic"};break;case"bolditalic":Sn={family:ar,weight:"bold",style:"italic"};break;case"":case"normal":Sn={family:ar}}Sn!==null&&(Sn.ref={name:ar,style:wn},Ke.push(Sn))})}),Ke})(Cn);je=(function(Ln){for(var Ke={},ar=0;ar<Ln.length;++ar){var wn=Hy(Ln[ar]),Sn=wn.family,gr=wn.stretch,En=wn.style,en=wn.weight;Ke[Sn]=Ke[Sn]||{},Ke[Sn][gr]=Ke[Sn][gr]||{},Ke[Sn][gr][En]=Ke[Sn][gr][En]||{},Ke[Sn][gr][En][en]=wn}return Ke})(ln.concat(kr)),Pe=nn}return je})(this.pdf,this.fontFaces),un=_e.map(function(Ie){return{family:Ie,stretch:"normal",weight:fe,style:In}}),Fn=(function(Ie,kr,Cn){for(var nn=(Cn=Cn||{}).defaultFontFamily||"times",ln=Object.assign({},R_,Cn.genericFontFamilies||{}),Ln=null,Ke=null,ar=0;ar<kr.length;++ar)if(ln[(Ln=Hy(kr[ar])).family]&&(Ln.family=ln[Ln.family]),Ie.hasOwnProperty(Ln.family)){Ke=Ie[Ln.family];break}if(!(Ke=Ke||Ie[nn]))throw new Error("Could not find a font-family for the rule '"+rS(Ln)+"' and default family '"+nn+"'.");if(Ke=(function(wn,Sn){if(Sn[wn])return Sn[wn];var gr=X2[wn],En=gr<=X2.normal?-1:1,en=eS(Sn,X4,gr,En);if(!en)throw new Error("Could not find a matching font-stretch value for "+wn);return en})(Ln.stretch,Ke),Ke=(function(wn,Sn){if(Sn[wn])return Sn[wn];for(var gr=W4[wn],En=0;En<gr.length;++En)if(Sn[gr[En]])return Sn[gr[En]];throw new Error("Could not find a matching font-style for "+wn)})(Ln.style,Ke),!(Ke=(function(wn,Sn){if(Sn[wn])return Sn[wn];if(wn===400&&Sn[500])return Sn[500];if(wn===500&&Sn[400])return Sn[400];var gr=L_[wn],En=eS(Sn,G4,gr,wn<400?-1:1);if(!En)throw new Error("Could not find a matching font-weight for value "+wn);return En})(Ln.weight,Ke)))throw new Error("Failed to resolve a font for the rule '"+rS(Ln)+"'.");return Ke})(Ye,un);this.pdf.setFont(Fn.ref.name,Fn.ref.style)}else{var Ue="";(fe==="bold"||parseInt(fe,10)>=700||In==="bold")&&(Ue="bold"),In==="italic"&&(Ue+="italic"),Ue.length===0&&(Ue="normal");for(var _n="",dn={arial:"Helvetica",Arial:"Helvetica",verdana:"Helvetica",Verdana:"Helvetica",helvetica:"Helvetica",Helvetica:"Helvetica","sans-serif":"Helvetica",fixed:"Courier",monospace:"Courier",terminal:"Courier",cursive:"Times",fantasy:"Times",serif:"Times"},Be=0;Be<_e.length;Be++){if(this.pdf.internal.getFont(_e[Be],Ue,{noFallback:!0,disableWarning:!0})!==void 0){_n=_e[Be];break}if(Ue==="bolditalic"&&this.pdf.internal.getFont(_e[Be],"bold",{noFallback:!0,disableWarning:!0})!==void 0)_n=_e[Be],Ue="bold";else if(this.pdf.internal.getFont(_e[Be],"normal",{noFallback:!0,disableWarning:!0})!==void 0){_n=_e[Be],Ue="normal";break}}if(_n===""){for(var We=0;We<_e.length;We++)if(dn[_e[We]]){_n=dn[_e[We]];break}}_n=_n===""?"Times":_n,this.pdf.setFont(_n,Ue)}}}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(ft){this.ctx.globalCompositeOperation=ft}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(ft){this.ctx.globalAlpha=ft}}),Object.defineProperty(this,"lineDashOffset",{get:function(){return this.ctx.lineDashOffset},set:function(ft){this.ctx.lineDashOffset=ft,Z.call(this)}}),Object.defineProperty(this,"lineDash",{get:function(){return this.ctx.lineDash},set:function(ft){this.ctx.lineDash=ft,Z.call(this)}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(ft){this.ctx.ignoreClearRect=!!ft}})};g.prototype.setLineDash=function(P){this.lineDash=P},g.prototype.getLineDash=function(){return this.lineDash.length%2?this.lineDash.concat(this.lineDash):this.lineDash.slice()},g.prototype.fill=function(){Y.call(this,"fill",!1)},g.prototype.stroke=function(){Y.call(this,"stroke",!1)},g.prototype.beginPath=function(){this.path=[{type:"begin"}]},g.prototype.moveTo=function(P,j){if(isNaN(P)||isNaN(j))throw yi.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.moveTo");var G=this.ctx.transform.applyToPoint(new l(P,j));this.path.push({type:"mt",x:G.x,y:G.y}),this.ctx.lastPoint=new l(P,j)},g.prototype.closePath=function(){var P=new l(0,0),j=0;for(j=this.path.length-1;j!==-1;j--)if(this.path[j].type==="begin"&&ii(this.path[j+1])==="object"&&typeof this.path[j+1].x=="number"){P=new l(this.path[j+1].x,this.path[j+1].y);break}this.path.push({type:"close"}),this.ctx.lastPoint=new l(P.x,P.y)},g.prototype.lineTo=function(P,j){if(isNaN(P)||isNaN(j))throw yi.error("jsPDF.context2d.lineTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.lineTo");var G=this.ctx.transform.applyToPoint(new l(P,j));this.path.push({type:"lt",x:G.x,y:G.y}),this.ctx.lastPoint=new l(G.x,G.y)},g.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),Y.call(this,null,!0)},g.prototype.quadraticCurveTo=function(P,j,G,ut){if(isNaN(G)||isNaN(ut)||isNaN(P)||isNaN(j))throw yi.error("jsPDF.context2d.quadraticCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");var xt=this.ctx.transform.applyToPoint(new l(G,ut)),St=this.ctx.transform.applyToPoint(new l(P,j));this.path.push({type:"qct",x1:St.x,y1:St.y,x:xt.x,y:xt.y}),this.ctx.lastPoint=new l(xt.x,xt.y)},g.prototype.bezierCurveTo=function(P,j,G,ut,xt,St){if(isNaN(xt)||isNaN(St)||isNaN(P)||isNaN(j)||isNaN(G)||isNaN(ut))throw yi.error("jsPDF.context2d.bezierCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");var Ft=this.ctx.transform.applyToPoint(new l(xt,St)),Rt=this.ctx.transform.applyToPoint(new l(P,j)),Qt=this.ctx.transform.applyToPoint(new l(G,ut));this.path.push({type:"bct",x1:Rt.x,y1:Rt.y,x2:Qt.x,y2:Qt.y,x:Ft.x,y:Ft.y}),this.ctx.lastPoint=new l(Ft.x,Ft.y)},g.prototype.arc=function(P,j,G,ut,xt,St){if(isNaN(P)||isNaN(j)||isNaN(G)||isNaN(ut)||isNaN(xt))throw yi.error("jsPDF.context2d.arc: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.arc");if(St=!!St,!this.ctx.transform.isIdentity){var Ft=this.ctx.transform.applyToPoint(new l(P,j));P=Ft.x,j=Ft.y;var Rt=this.ctx.transform.applyToPoint(new l(0,G)),Qt=this.ctx.transform.applyToPoint(new l(0,0));G=Math.sqrt(Math.pow(Rt.x-Qt.x,2)+Math.pow(Rt.y-Qt.y,2))}Math.abs(xt-ut)>=2*Math.PI&&(ut=0,xt=2*Math.PI),this.path.push({type:"arc",x:P,y:j,radius:G,startAngle:ut,endAngle:xt,counterclockwise:St})},g.prototype.arcTo=function(P,j,G,ut,xt){throw new Error("arcTo not implemented.")},g.prototype.rect=function(P,j,G,ut){if(isNaN(P)||isNaN(j)||isNaN(G)||isNaN(ut))throw yi.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(P,j),this.lineTo(P+G,j),this.lineTo(P+G,j+ut),this.lineTo(P,j+ut),this.lineTo(P,j),this.lineTo(P+G,j),this.lineTo(P,j)},g.prototype.fillRect=function(P,j,G,ut){if(isNaN(P)||isNaN(j)||isNaN(G)||isNaN(ut))throw yi.error("jsPDF.context2d.fillRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillRect");if(!y.call(this)){var xt={};this.lineCap!=="butt"&&(xt.lineCap=this.lineCap,this.lineCap="butt"),this.lineJoin!=="miter"&&(xt.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(P,j,G,ut),this.fill(),xt.hasOwnProperty("lineCap")&&(this.lineCap=xt.lineCap),xt.hasOwnProperty("lineJoin")&&(this.lineJoin=xt.lineJoin)}},g.prototype.strokeRect=function(P,j,G,ut){if(isNaN(P)||isNaN(j)||isNaN(G)||isNaN(ut))throw yi.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");M.call(this)||(this.beginPath(),this.rect(P,j,G,ut),this.stroke())},g.prototype.clearRect=function(P,j,G,ut){if(isNaN(P)||isNaN(j)||isNaN(G)||isNaN(ut))throw yi.error("jsPDF.context2d.clearRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(P,j,G,ut))},g.prototype.save=function(P){P=typeof P!="boolean"||P;for(var j=this.pdf.internal.getCurrentPageInfo().pageNumber,G=0;G<this.pdf.internal.getNumberOfPages();G++)this.pdf.setPage(G+1),this.pdf.internal.out("q");if(this.pdf.setPage(j),P){this.ctx.fontSize=this.pdf.internal.getFontSize();var ut=new p(this.ctx);this.ctxStack.push(this.ctx),this.ctx=ut}},g.prototype.restore=function(P){P=typeof P!="boolean"||P;for(var j=this.pdf.internal.getCurrentPageInfo().pageNumber,G=0;G<this.pdf.internal.getNumberOfPages();G++)this.pdf.setPage(G+1),this.pdf.internal.out("Q");this.pdf.setPage(j),P&&this.ctxStack.length!==0&&(this.ctx=this.ctxStack.pop(),this.fillStyle=this.ctx.fillStyle,this.strokeStyle=this.ctx.strokeStyle,this.font=this.ctx.font,this.lineCap=this.ctx.lineCap,this.lineWidth=this.ctx.lineWidth,this.lineJoin=this.ctx.lineJoin,this.lineDash=this.ctx.lineDash,this.lineDashOffset=this.ctx.lineDashOffset)},g.prototype.toDataURL=function(){throw new Error("toDataUrl not implemented.")};var b=function(P){var j,G,ut,xt;if(P.isCanvasGradient===!0&&(P=P.getColor()),!P)return{r:0,g:0,b:0,a:0,style:P};if(/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/.test(P))j=0,G=0,ut=0,xt=0;else{var St=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(P);if(St!==null)j=parseInt(St[1]),G=parseInt(St[2]),ut=parseInt(St[3]),xt=1;else if((St=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(P))!==null)j=parseInt(St[1]),G=parseInt(St[2]),ut=parseInt(St[3]),xt=parseFloat(St[4]);else{if(xt=1,typeof P=="string"&&P.charAt(0)!=="#"){var Ft=new F4(P);P=Ft.ok?Ft.toHex():"#000000"}P.length===4?(j=P.substring(1,2),j+=j,G=P.substring(2,3),G+=G,ut=P.substring(3,4),ut+=ut):(j=P.substring(1,3),G=P.substring(3,5),ut=P.substring(5,7)),j=parseInt(j,16),G=parseInt(G,16),ut=parseInt(ut,16)}}return{r:j,g:G,b:ut,a:xt,style:P}},y=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},M=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};g.prototype.fillText=function(P,j,G,ut){if(isNaN(j)||isNaN(G)||typeof P!="string")throw yi.error("jsPDF.context2d.fillText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillText");if(ut=isNaN(ut)?void 0:ut,!y.call(this)){var xt=ct(this.ctx.transform.rotation),St=this.ctx.transform.scaleX;lt.call(this,{text:P,x:j,y:G,scale:St,angle:xt,align:this.textAlign,maxWidth:ut})}},g.prototype.strokeText=function(P,j,G,ut){if(isNaN(j)||isNaN(G)||typeof P!="string")throw yi.error("jsPDF.context2d.strokeText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeText");if(!M.call(this)){ut=isNaN(ut)?void 0:ut;var xt=ct(this.ctx.transform.rotation),St=this.ctx.transform.scaleX;lt.call(this,{text:P,x:j,y:G,scale:St,renderingMode:"stroke",angle:xt,align:this.textAlign,maxWidth:ut})}},g.prototype.measureText=function(P){if(typeof P!="string")throw yi.error("jsPDF.context2d.measureText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.measureText");var j=this.pdf,G=this.pdf.internal.scaleFactor,ut=j.internal.getFontSize(),xt=j.getStringUnitWidth(P)*ut/j.internal.scaleFactor;return new function(St){var Ft=(St=St||{}).width||0;return Object.defineProperty(this,"width",{get:function(){return Ft}}),this}({width:xt*=Math.round(96*G/72*1e4)/1e4})},g.prototype.scale=function(P,j){if(isNaN(P)||isNaN(j))throw yi.error("jsPDF.context2d.scale: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.scale");var G=new f(P,0,0,j,0,0);this.ctx.transform=this.ctx.transform.multiply(G)},g.prototype.rotate=function(P){if(isNaN(P))throw yi.error("jsPDF.context2d.rotate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rotate");var j=new f(Math.cos(P),Math.sin(P),-Math.sin(P),Math.cos(P),0,0);this.ctx.transform=this.ctx.transform.multiply(j)},g.prototype.translate=function(P,j){if(isNaN(P)||isNaN(j))throw yi.error("jsPDF.context2d.translate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.translate");var G=new f(1,0,0,1,P,j);this.ctx.transform=this.ctx.transform.multiply(G)},g.prototype.transform=function(P,j,G,ut,xt,St){if(isNaN(P)||isNaN(j)||isNaN(G)||isNaN(ut)||isNaN(xt)||isNaN(St))throw yi.error("jsPDF.context2d.transform: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.transform");var Ft=new f(P,j,G,ut,xt,St);this.ctx.transform=this.ctx.transform.multiply(Ft)},g.prototype.setTransform=function(P,j,G,ut,xt,St){P=isNaN(P)?1:P,j=isNaN(j)?0:j,G=isNaN(G)?0:G,ut=isNaN(ut)?1:ut,xt=isNaN(xt)?0:xt,St=isNaN(St)?0:St,this.ctx.transform=new f(P,j,G,ut,xt,St)};var E=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};g.prototype.drawImage=function(P,j,G,ut,xt,St,Ft,Rt,Qt){var ve=this.pdf.getImageProperties(P),je=1,Pe=1,Ve=1,ft=1;ut!==void 0&&Rt!==void 0&&(Ve=Rt/ut,ft=Qt/xt,je=ve.width/ut*Rt/ut,Pe=ve.height/xt*Qt/xt),St===void 0&&(St=j,Ft=G,j=0,G=0),ut!==void 0&&Rt===void 0&&(Rt=ut,Qt=xt),ut===void 0&&Rt===void 0&&(Rt=ve.width,Qt=ve.height);var Oe=this.ctx.transform.decompose(),In=ct(Oe.rotate.shx),fe=new f,ge=(fe=(fe=(fe=fe.multiply(Oe.translate)).multiply(Oe.skew)).multiply(Oe.scale)).applyToRectangle(new c(St-j*Ve,Ft-G*ft,ut*je,xt*Pe));if(this.autoPaging){for(var Te,Ne=D.call(this,ge),_e=[],Ye=0;Ye<Ne.length;Ye+=1)_e.indexOf(Ne[Ye])===-1&&_e.push(Ne[Ye]);$(_e);for(var un=_e[0],Fn=_e[_e.length-1],Ue=un;Ue<Fn+1;Ue++){this.pdf.setPage(Ue);var _n=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],dn=Ue===1?this.posY+this.margin[0]:this.margin[0],Be=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],We=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],Ie=Ue===1?0:Be+(Ue-2)*We;if(this.ctx.clip_path.length!==0){var kr=this.path;Te=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=q(Te,this.posX+this.margin[3],-Ie+dn+this.ctx.prevPageLastElemOffset),ht.call(this,"fill",!0),this.path=kr}var Cn=JSON.parse(JSON.stringify(ge));Cn=q([Cn],this.posX+this.margin[3],-Ie+dn+this.ctx.prevPageLastElemOffset)[0];var nn=(Ue>un||Ue<Fn)&&E.call(this);nn&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],_n,We,null).clip().discardPath()),this.pdf.addImage(P,"JPEG",Cn.x,Cn.y,Cn.w,Cn.h,null,null,In),nn&&this.pdf.restoreGraphicsState()}}else this.pdf.addImage(P,"JPEG",ge.x,ge.y,ge.w,ge.h,null,null,In)};var D=function(P,j,G){var ut=[];j=j||this.pdf.internal.pageSize.width,G=G||this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var xt=this.posY+this.ctx.prevPageLastElemOffset;switch(P.type){default:case"mt":case"lt":ut.push(Math.floor((P.y+xt)/G)+1);break;case"arc":ut.push(Math.floor((P.y+xt-P.radius)/G)+1),ut.push(Math.floor((P.y+xt+P.radius)/G)+1);break;case"qct":var St=Bt(this.ctx.lastPoint.x,this.ctx.lastPoint.y,P.x1,P.y1,P.x,P.y);ut.push(Math.floor((St.y+xt)/G)+1),ut.push(Math.floor((St.y+St.h+xt)/G)+1);break;case"bct":var Ft=te(this.ctx.lastPoint.x,this.ctx.lastPoint.y,P.x1,P.y1,P.x2,P.y2,P.x,P.y);ut.push(Math.floor((Ft.y+xt)/G)+1),ut.push(Math.floor((Ft.y+Ft.h+xt)/G)+1);break;case"rect":ut.push(Math.floor((P.y+xt)/G)+1),ut.push(Math.floor((P.y+P.h+xt)/G)+1)}for(var Rt=0;Rt<ut.length;Rt+=1)for(;this.pdf.internal.getNumberOfPages()<ut[Rt];)L.call(this);return ut},L=function(){var P=this.fillStyle,j=this.strokeStyle,G=this.font,ut=this.lineCap,xt=this.lineWidth,St=this.lineJoin;this.pdf.addPage(),this.fillStyle=P,this.strokeStyle=j,this.font=G,this.lineCap=ut,this.lineWidth=xt,this.lineJoin=St},q=function(P,j,G){for(var ut=0;ut<P.length;ut++)switch(P[ut].type){case"bct":P[ut].x2+=j,P[ut].y2+=G;case"qct":P[ut].x1+=j,P[ut].y1+=G;default:P[ut].x+=j,P[ut].y+=G}return P},$=function(P){return P.sort(function(j,G){return j-G})},Y=function(P,j){var G=this.fillStyle,ut=this.strokeStyle,xt=this.lineCap,St=this.lineWidth,Ft=Math.abs(St*this.ctx.transform.scaleX),Rt=this.lineJoin;if(this.autoPaging){for(var Qt,ve,je=JSON.parse(JSON.stringify(this.path)),Pe=JSON.parse(JSON.stringify(this.path)),Ve=[],ft=0;ft<Pe.length;ft++)if(Pe[ft].x!==void 0)for(var Oe=D.call(this,Pe[ft]),In=0;In<Oe.length;In+=1)Ve.indexOf(Oe[In])===-1&&Ve.push(Oe[In]);for(var fe=0;fe<Ve.length;fe++)for(;this.pdf.internal.getNumberOfPages()<Ve[fe];)L.call(this);$(Ve);for(var ge=Ve[0],Te=Ve[Ve.length-1],Ne=ge;Ne<Te+1;Ne++){this.pdf.setPage(Ne),this.fillStyle=G,this.strokeStyle=ut,this.lineCap=xt,this.lineWidth=Ft,this.lineJoin=Rt;var _e=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Ye=Ne===1?this.posY+this.margin[0]:this.margin[0],un=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Fn=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],Ue=Ne===1?0:un+(Ne-2)*Fn;if(this.ctx.clip_path.length!==0){var _n=this.path;Qt=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=q(Qt,this.posX+this.margin[3],-Ue+Ye+this.ctx.prevPageLastElemOffset),ht.call(this,P,!0),this.path=_n}if(ve=JSON.parse(JSON.stringify(je)),this.path=q(ve,this.posX+this.margin[3],-Ue+Ye+this.ctx.prevPageLastElemOffset),j===!1||Ne===0){var dn=(Ne>ge||Ne<Te)&&E.call(this);dn&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],_e,Fn,null).clip().discardPath()),ht.call(this,P,j),dn&&this.pdf.restoreGraphicsState()}this.lineWidth=St}this.path=je}else this.lineWidth=Ft,ht.call(this,P,j),this.lineWidth=St},ht=function(P,j){if((P!=="stroke"||j||!M.call(this))&&(P==="stroke"||j||!y.call(this))){for(var G,ut,xt=[],St=this.path,Ft=0;Ft<St.length;Ft++){var Rt=St[Ft];switch(Rt.type){case"begin":xt.push({begin:!0});break;case"close":xt.push({close:!0});break;case"mt":xt.push({start:Rt,deltas:[],abs:[]});break;case"lt":var Qt=xt.length;if(St[Ft-1]&&!isNaN(St[Ft-1].x)&&(G=[Rt.x-St[Ft-1].x,Rt.y-St[Ft-1].y],Qt>0)){for(;Qt>=0;Qt--)if(xt[Qt-1].close!==!0&&xt[Qt-1].begin!==!0){xt[Qt-1].deltas.push(G),xt[Qt-1].abs.push(Rt);break}}break;case"bct":G=[Rt.x1-St[Ft-1].x,Rt.y1-St[Ft-1].y,Rt.x2-St[Ft-1].x,Rt.y2-St[Ft-1].y,Rt.x-St[Ft-1].x,Rt.y-St[Ft-1].y],xt[xt.length-1].deltas.push(G);break;case"qct":var ve=St[Ft-1].x+2/3*(Rt.x1-St[Ft-1].x),je=St[Ft-1].y+2/3*(Rt.y1-St[Ft-1].y),Pe=Rt.x+2/3*(Rt.x1-Rt.x),Ve=Rt.y+2/3*(Rt.y1-Rt.y),ft=Rt.x,Oe=Rt.y;G=[ve-St[Ft-1].x,je-St[Ft-1].y,Pe-St[Ft-1].x,Ve-St[Ft-1].y,ft-St[Ft-1].x,Oe-St[Ft-1].y],xt[xt.length-1].deltas.push(G);break;case"arc":xt.push({deltas:[],abs:[],arc:!0}),Array.isArray(xt[xt.length-1].abs)&&xt[xt.length-1].abs.push(Rt)}}ut=j?null:P==="stroke"?"stroke":"fill";for(var In=!1,fe=0;fe<xt.length;fe++)if(xt[fe].arc)for(var ge=xt[fe].abs,Te=0;Te<ge.length;Te++){var Ne=ge[Te];Ne.type==="arc"?bt.call(this,Ne.x,Ne.y,Ne.radius,Ne.startAngle,Ne.endAngle,Ne.counterclockwise,void 0,j,!In):X.call(this,Ne.x,Ne.y),In=!0}else if(xt[fe].close===!0)this.pdf.internal.out("h"),In=!1;else if(xt[fe].begin!==!0){var _e=xt[fe].start.x,Ye=xt[fe].start.y;wt.call(this,xt[fe].deltas,_e,Ye),In=!0}ut&&rt.call(this,ut),j&&Dt.call(this)}},Mt=function(P){var j=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,G=j*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case"bottom":return P-G;case"top":return P+j-G;case"hanging":return P+j-2*G;case"middle":return P+j/2-G;default:return P}},vt=function(P){return P+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};g.prototype.createLinearGradient=function(){var P=function(){};return P.colorStops=[],P.addColorStop=function(j,G){this.colorStops.push([j,G])},P.getColor=function(){return this.colorStops.length===0?"#000000":this.colorStops[0][1]},P.isCanvasGradient=!0,P},g.prototype.createPattern=function(){return this.createLinearGradient()},g.prototype.createRadialGradient=function(){return this.createLinearGradient()};var bt=function(P,j,G,ut,xt,St,Ft,Rt,Qt){for(var ve=yt.call(this,G,ut,xt,St),je=0;je<ve.length;je++){var Pe=ve[je];je===0&&(Qt?Q.call(this,Pe.x1+P,Pe.y1+j):X.call(this,Pe.x1+P,Pe.y1+j)),Tt.call(this,P,j,Pe.x2,Pe.y2,Pe.x3,Pe.y3,Pe.x4,Pe.y4)}Rt?Dt.call(this):rt.call(this,Ft)},rt=function(P){switch(P){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f")}},Dt=function(){this.pdf.clip(),this.pdf.discardPath()},Q=function(P,j){this.pdf.internal.out(n(P)+" "+r(j)+" m")},lt=function(P){var j;switch(P.align){case"right":case"end":j="right";break;case"center":j="center";break;default:j="left"}var G,ut,xt,St=this.pdf.getTextDimensions(P.text),Ft=Mt.call(this,P.y),Rt=vt.call(this,Ft)-St.h,Qt=this.ctx.transform.applyToPoint(new l(P.x,Ft));if(this.autoPaging){var ve=this.ctx.transform.decompose(),je=new f;je=(je=(je=je.multiply(ve.translate)).multiply(ve.skew)).multiply(ve.scale);for(var Pe=this.ctx.transform.applyToRectangle(new c(P.x,Ft,St.w,St.h)),Ve=je.applyToRectangle(new c(P.x,Rt,St.w,St.h)),ft=D.call(this,Ve),Oe=[],In=0;In<ft.length;In+=1)Oe.indexOf(ft[In])===-1&&Oe.push(ft[In]);$(Oe);for(var fe=Oe[0],ge=Oe[Oe.length-1],Te=fe;Te<ge+1;Te++){this.pdf.setPage(Te);var Ne=Te===1?this.posY+this.margin[0]:this.margin[0],_e=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Ye=this.pdf.internal.pageSize.height-this.margin[2],un=Ye-this.margin[0],Fn=this.pdf.internal.pageSize.width-this.margin[1],Ue=Fn-this.margin[3],_n=Te===1?0:_e+(Te-2)*un;if(this.ctx.clip_path.length!==0){var dn=this.path;G=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=q(G,this.posX+this.margin[3],-1*_n+Ne),ht.call(this,"fill",!0),this.path=dn}var Be=q([JSON.parse(JSON.stringify(Ve))],this.posX+this.margin[3],-_n+Ne+this.ctx.prevPageLastElemOffset)[0];P.scale>=.01&&(ut=this.pdf.internal.getFontSize(),this.pdf.setFontSize(ut*P.scale),xt=this.lineWidth,this.lineWidth=xt*P.scale);var We=this.autoPaging!=="text";if(We||Be.y+Be.h<=Ye){if(We||Be.y>=Ne&&Be.x<=Fn){var Ie=We?P.text:this.pdf.splitTextToSize(P.text,P.maxWidth||Fn-Be.x)[0],kr=q([JSON.parse(JSON.stringify(Pe))],this.posX+this.margin[3],-_n+Ne+this.ctx.prevPageLastElemOffset)[0],Cn=We&&(Te>fe||Te<ge)&&E.call(this);Cn&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Ue,un,null).clip().discardPath()),this.pdf.text(Ie,kr.x,kr.y,{angle:P.angle,align:j,renderingMode:P.renderingMode}),Cn&&this.pdf.restoreGraphicsState()}}else Be.y<Ye&&(this.ctx.prevPageLastElemOffset+=Ye-Be.y);P.scale>=.01&&(this.pdf.setFontSize(ut),this.lineWidth=xt)}}else P.scale>=.01&&(ut=this.pdf.internal.getFontSize(),this.pdf.setFontSize(ut*P.scale),xt=this.lineWidth,this.lineWidth=xt*P.scale),this.pdf.text(P.text,Qt.x+this.posX,Qt.y+this.posY,{angle:P.angle,align:j,renderingMode:P.renderingMode,maxWidth:P.maxWidth}),P.scale>=.01&&(this.pdf.setFontSize(ut),this.lineWidth=xt)},X=function(P,j,G,ut){G=G||0,ut=ut||0,this.pdf.internal.out(n(P+G)+" "+r(j+ut)+" l")},wt=function(P,j,G){return this.pdf.lines(P,j,G,null,null)},Tt=function(P,j,G,ut,xt,St,Ft,Rt){this.pdf.internal.out([t(i(G+P)),t(s(ut+j)),t(i(xt+P)),t(s(St+j)),t(i(Ft+P)),t(s(Rt+j)),"c"].join(" "))},yt=function(P,j,G,ut){for(var xt=2*Math.PI,St=Math.PI/2;j>G;)j-=xt;var Ft=Math.abs(G-j);Ft<xt&&ut&&(Ft=xt-Ft);for(var Rt=[],Qt=ut?-1:1,ve=j;Ft>1e-5;){var je=ve+Qt*Math.min(Ft,St);Rt.push(J.call(this,P,ve,je)),Ft-=Math.abs(je-ve),ve=je}return Rt},J=function(P,j,G){var ut=(G-j)/2,xt=P*Math.cos(ut),St=P*Math.sin(ut),Ft=xt,Rt=-St,Qt=Ft*Ft+Rt*Rt,ve=Qt+Ft*xt+Rt*St,je=4/3*(Math.sqrt(2*Qt*ve)-ve)/(Ft*St-Rt*xt),Pe=Ft-je*Rt,Ve=Rt+je*Ft,ft=Pe,Oe=-Ve,In=ut+j,fe=Math.cos(In),ge=Math.sin(In);return{x1:P*Math.cos(j),y1:P*Math.sin(j),x2:Pe*fe-Ve*ge,y2:Pe*ge+Ve*fe,x3:ft*fe-Oe*ge,y3:ft*ge+Oe*fe,x4:P*Math.cos(G),y4:P*Math.sin(G)}},ct=function(P){return 180*P/Math.PI},Bt=function(P,j,G,ut,xt,St){var Ft=P+.5*(G-P),Rt=j+.5*(ut-j),Qt=xt+.5*(G-xt),ve=St+.5*(ut-St),je=Math.min(P,xt,Ft,Qt),Pe=Math.max(P,xt,Ft,Qt),Ve=Math.min(j,St,Rt,ve),ft=Math.max(j,St,Rt,ve);return new c(je,Ve,Pe-je,ft-Ve)},te=function(P,j,G,ut,xt,St,Ft,Rt){var Qt,ve,je,Pe,Ve,ft,Oe,In,fe,ge,Te,Ne,_e,Ye,un=G-P,Fn=ut-j,Ue=xt-G,_n=St-ut,dn=Ft-xt,Be=Rt-St;for(ve=0;ve<41;ve++)fe=(Oe=(je=P+(Qt=ve/40)*un)+Qt*((Ve=G+Qt*Ue)-je))+Qt*(Ve+Qt*(xt+Qt*dn-Ve)-Oe),ge=(In=(Pe=j+Qt*Fn)+Qt*((ft=ut+Qt*_n)-Pe))+Qt*(ft+Qt*(St+Qt*Be-ft)-In),ve==0?(Te=fe,Ne=ge,_e=fe,Ye=ge):(Te=Math.min(Te,fe),Ne=Math.min(Ne,ge),_e=Math.max(_e,fe),Ye=Math.max(Ye,ge));return new c(Math.round(Te),Math.round(Ne),Math.round(_e-Te),Math.round(Ye-Ne))},Z=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var P,j,G=(P=this.ctx.lineDash,j=this.ctx.lineDashOffset,JSON.stringify({lineDash:P,lineDashOffset:j}));this.prevLineDash!==G&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=G)}}})(xn.API),(function(e){var t=function(l){var c,f,d,p,g,b,y,M,E,D;for(f=[],d=0,p=(l+=c="\0\0\0\0".slice(l.length%4||4)).length;p>d;d+=4)(g=(l.charCodeAt(d)<<24)+(l.charCodeAt(d+1)<<16)+(l.charCodeAt(d+2)<<8)+l.charCodeAt(d+3))!==0?(b=(g=((g=((g=((g=(g-(D=g%85))/85)-(E=g%85))/85)-(M=g%85))/85)-(y=g%85))/85)%85,f.push(b+33,y+33,M+33,E+33,D+33)):f.push(122);return(function(L,q){for(var $=q;$>0;$--)L.pop()})(f,c.length),String.fromCharCode.apply(String,f)+"~>"},n=function(l){var c,f,d,p,g,b=String,y="length",M=255,E="charCodeAt",D="slice",L="replace";for(l[D](-2),l=l[D](0,-2)[L](/\s/g,"")[L]("z","!!!!!"),d=[],p=0,g=(l+=c="uuuuu"[D](l[y]%5||5))[y];g>p;p+=5)f=52200625*(l[E](p)-33)+614125*(l[E](p+1)-33)+7225*(l[E](p+2)-33)+85*(l[E](p+3)-33)+(l[E](p+4)-33),d.push(M&f>>24,M&f>>16,M&f>>8,M&f);return(function(q,$){for(var Y=$;Y>0;Y--)q.pop()})(d,c[y]),b.fromCharCode.apply(b,d)},r=function(l){return l.split("").map(function(c){return("0"+c.charCodeAt().toString(16)).slice(-2)}).join("")+">"},i=function(l){var c=new RegExp(/^([0-9A-Fa-f]{2})+$/);if((l=l.replace(/\s/g,"")).indexOf(">")!==-1&&(l=l.substr(0,l.indexOf(">"))),l.length%2&&(l+="0"),c.test(l)===!1)return"";for(var f="",d=0;d<l.length;d+=2)f+=String.fromCharCode("0x"+(l[d]+l[d+1]));return f},s=function(l){for(var c=new Uint8Array(l.length),f=l.length;f--;)c[f]=l.charCodeAt(f);return(c=U2(c)).reduce(function(d,p){return d+String.fromCharCode(p)},"")};e.processDataByFilters=function(l,c){var f=0,d=l||"",p=[];for(typeof(c=c||[])=="string"&&(c=[c]),f=0;f<c.length;f+=1)switch(c[f]){case"ASCII85Decode":case"/ASCII85Decode":d=n(d),p.push("/ASCII85Encode");break;case"ASCII85Encode":case"/ASCII85Encode":d=t(d),p.push("/ASCII85Decode");break;case"ASCIIHexDecode":case"/ASCIIHexDecode":d=i(d),p.push("/ASCIIHexEncode");break;case"ASCIIHexEncode":case"/ASCIIHexEncode":d=r(d),p.push("/ASCIIHexDecode");break;case"FlateEncode":case"/FlateEncode":d=s(d),p.push("/FlateDecode");break;default:throw new Error('The filter: "'+c[f]+'" is not implemented')}return{data:d,reverseChain:p.reverse().join(" ")}}})(xn.API),(function(e){e.loadFile=function(t,n,r){return(function(i,s,l){s=s!==!1,l=typeof l=="function"?l:function(){};var c=void 0;try{c=(function(f,d,p){var g=new XMLHttpRequest,b=0,y=function(M){var E=M.length,D=[],L=String.fromCharCode;for(b=0;b<E;b+=1)D.push(L(255&M.charCodeAt(b)));return D.join("")};if(g.open("GET",f,!d),g.overrideMimeType("text/plain; charset=x-user-defined"),d===!1&&(g.onload=function(){g.status===200?p(y(this.responseText)):p(void 0)}),g.send(null),d&&g.status===200)return y(g.responseText)})(i,s,l)}catch{}return c})(t,n,r)},e.allowFsRead=void 0,e.loadImageFile=e.loadFile})(xn.API),(function(e){function t(){return(Qn.html2canvas?Promise.resolve(Qn.html2canvas):Ay(()=>import("./html2canvas.esm-DXEQVQnt.js"),[],import.meta.url)).catch(function(c){return Promise.reject(new Error("Could not load html2canvas: "+c))}).then(function(c){return c.default?c.default:c})}function n(){return(Qn.DOMPurify?Promise.resolve(Qn.DOMPurify):Ay(()=>import("./purify.es-CEBYger9.js"),[],import.meta.url)).catch(function(c){return Promise.reject(new Error("Could not load dompurify: "+c))}).then(function(c){return c.default?c.default:c})}var r=function(c){var f=ii(c);return f==="undefined"?"undefined":f==="string"||c instanceof String?"string":f==="number"||c instanceof Number?"number":f==="function"||c instanceof Function?"function":c&&c.constructor===Array?"array":c&&c.nodeType===1?"element":f==="object"?"object":"unknown"},i=function(c,f){var d=document.createElement(c);for(var p in f.className&&(d.className=f.className),f.innerHTML&&f.dompurify&&(d.innerHTML=f.dompurify.sanitize(f.innerHTML)),f.style)d.style[p]=f.style[p];return d},s=function c(f,d){for(var p=f.nodeType===3?document.createTextNode(f.nodeValue):f.cloneNode(!1),g=f.firstChild;g;g=g.nextSibling)d!==!0&&g.nodeType===1&&g.nodeName==="SCRIPT"||p.appendChild(c(g,d));return f.nodeType===1&&(f.nodeName==="CANVAS"?(p.width=f.width,p.height=f.height,p.getContext("2d").drawImage(f,0,0)):f.nodeName!=="TEXTAREA"&&f.nodeName!=="SELECT"||(p.value=f.value),p.addEventListener("load",function(){p.scrollTop=f.scrollTop,p.scrollLeft=f.scrollLeft},!0)),p},l=function c(f){var d=Object.assign(c.convert(Promise.resolve()),JSON.parse(JSON.stringify(c.template))),p=c.convert(Promise.resolve(),d);return(p=p.setProgress(1,c,1,[c])).set(f)};(l.prototype=Object.create(Promise.prototype)).constructor=l,l.convert=function(c,f){return c.__proto__=f||l.prototype,c},l.template={prop:{src:null,container:null,overlay:null,canvas:null,img:null,pdf:null,pageSize:null,callback:function(){}},progress:{val:0,state:null,n:0,stack:[]},opt:{filename:"file.pdf",margin:[0,0,0,0],enableLinks:!0,x:0,y:0,html2canvas:{},jsPDF:{},backgroundColor:"transparent"}},l.prototype.from=function(c,f){return this.then(function(){switch(f=f||(function(d){switch(r(d)){case"string":return"string";case"element":return d.nodeName.toLowerCase()==="canvas"?"canvas":"element";default:return"unknown"}})(c),f){case"string":return this.then(n).then(function(d){return this.set({src:i("div",{innerHTML:c,dompurify:d})})});case"element":return this.set({src:c});case"canvas":return this.set({canvas:c});case"img":return this.set({img:c});default:return this.error("Unknown source type.")}})},l.prototype.to=function(c){switch(c){case"container":return this.toContainer();case"canvas":return this.toCanvas();case"img":return this.toImg();case"pdf":return this.toPdf();default:return this.error("Invalid target.")}},l.prototype.toContainer=function(){return this.thenList([function(){return this.prop.src||this.error("Cannot duplicate - no source HTML.")},function(){return this.prop.pageSize||this.setPageSize()}]).then(function(){var c={position:"relative",display:"inline-block",width:(typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?Math.max(this.prop.src.clientWidth,this.prop.src.scrollWidth,this.prop.src.offsetWidth):this.opt.windowWidth)+"px",left:0,right:0,top:0,margin:"auto",backgroundColor:this.opt.backgroundColor},f=s(this.prop.src,this.opt.html2canvas.javascriptEnabled);f.tagName==="BODY"&&(c.height=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)+"px"),this.prop.overlay=i("div",{className:"html2pdf__overlay",style:{position:"fixed",overflow:"hidden",zIndex:1e3,left:"-100000px",right:0,bottom:0,top:0}}),this.prop.container=i("div",{className:"html2pdf__container",style:c}),this.prop.container.appendChild(f),this.prop.container.firstChild.appendChild(i("div",{style:{clear:"both",border:"0 none transparent",margin:0,padding:0,height:0}})),this.prop.container.style.float="none",this.prop.overlay.appendChild(this.prop.container),document.body.appendChild(this.prop.overlay),this.prop.container.firstChild.style.position="relative",this.prop.container.height=Math.max(this.prop.container.firstChild.clientHeight,this.prop.container.firstChild.scrollHeight,this.prop.container.firstChild.offsetHeight)+"px"})},l.prototype.toCanvas=function(){var c=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(c).then(t).then(function(f){var d=Object.assign({},this.opt.html2canvas);return delete d.onrendered,f(this.prop.container,d)}).then(function(f){(this.opt.html2canvas.onrendered||function(){})(f),this.prop.canvas=f,document.body.removeChild(this.prop.overlay)})},l.prototype.toContext2d=function(){var c=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(c).then(t).then(function(f){var d=this.opt.jsPDF,p=this.opt.fontFaces,g=typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?1:this.opt.width/this.opt.windowWidth,b=Object.assign({async:!0,allowTaint:!0,scale:g,scrollX:this.opt.scrollX||0,scrollY:this.opt.scrollY||0,backgroundColor:"#ffffff",imageTimeout:15e3,logging:!0,proxy:null,removeContainer:!0,foreignObjectRendering:!1,useCORS:!1},this.opt.html2canvas);if(delete b.onrendered,d.context2d.autoPaging=this.opt.autoPaging===void 0||this.opt.autoPaging,d.context2d.posX=this.opt.x,d.context2d.posY=this.opt.y,d.context2d.margin=this.opt.margin,d.context2d.fontFaces=p,p)for(var y=0;y<p.length;++y){var M=p[y],E=M.src.find(function(D){return D.format==="truetype"});E&&d.addFont(E.url,M.ref.name,M.ref.style)}return b.windowHeight=b.windowHeight||0,b.windowHeight=b.windowHeight==0?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):b.windowHeight,d.context2d.save(!0),f(this.prop.container,b)}).then(function(f){this.opt.jsPDF.context2d.restore(!0),(this.opt.html2canvas.onrendered||function(){})(f),this.prop.canvas=f,document.body.removeChild(this.prop.overlay)})},l.prototype.toImg=function(){return this.thenList([function(){return this.prop.canvas||this.toCanvas()}]).then(function(){var c=this.prop.canvas.toDataURL("image/"+this.opt.image.type,this.opt.image.quality);this.prop.img=document.createElement("img"),this.prop.img.src=c})},l.prototype.toPdf=function(){return this.thenList([function(){return this.toContext2d()}]).then(function(){this.prop.pdf=this.prop.pdf||this.opt.jsPDF})},l.prototype.output=function(c,f,d){return(d=d||"pdf").toLowerCase()==="img"||d.toLowerCase()==="image"?this.outputImg(c,f):this.outputPdf(c,f)},l.prototype.outputPdf=function(c,f){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){return this.prop.pdf.output(c,f)})},l.prototype.outputImg=function(c){return this.thenList([function(){return this.prop.img||this.toImg()}]).then(function(){switch(c){case void 0:case"img":return this.prop.img;case"datauristring":case"dataurlstring":return this.prop.img.src;case"datauri":case"dataurl":return document.location.href=this.prop.img.src;default:throw'Image output type "'+c+'" is not supported.'}})},l.prototype.save=function(c){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).set(c?{filename:c}:null).then(function(){this.prop.pdf.save(this.opt.filename)})},l.prototype.doCallback=function(){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){this.prop.callback(this.prop.pdf)})},l.prototype.set=function(c){if(r(c)!=="object")return this;var f=Object.keys(c||{}).map(function(d){if(d in l.template.prop)return function(){this.prop[d]=c[d]};switch(d){case"margin":return this.setMargin.bind(this,c.margin);case"jsPDF":return function(){return this.opt.jsPDF=c.jsPDF,this.setPageSize()};case"pageSize":return this.setPageSize.bind(this,c.pageSize);default:return function(){this.opt[d]=c[d]}}},this);return this.then(function(){return this.thenList(f)})},l.prototype.get=function(c,f){return this.then(function(){var d=c in l.template.prop?this.prop[c]:this.opt[c];return f?f(d):d})},l.prototype.setMargin=function(c){return this.then(function(){switch(r(c)){case"number":c=[c,c,c,c];case"array":if(c.length===2&&(c=[c[0],c[1],c[0],c[1]]),c.length===4)break;default:return this.error("Invalid margin array.")}this.opt.margin=c}).then(this.setPageSize)},l.prototype.setPageSize=function(c){function f(d,p){return Math.floor(d*p/72*96)}return this.then(function(){(c=c||xn.getPageSize(this.opt.jsPDF)).hasOwnProperty("inner")||(c.inner={width:c.width-this.opt.margin[1]-this.opt.margin[3],height:c.height-this.opt.margin[0]-this.opt.margin[2]},c.inner.px={width:f(c.inner.width,c.k),height:f(c.inner.height,c.k)},c.inner.ratio=c.inner.height/c.inner.width),this.prop.pageSize=c})},l.prototype.setProgress=function(c,f,d,p){return c!=null&&(this.progress.val=c),f!=null&&(this.progress.state=f),d!=null&&(this.progress.n=d),p!=null&&(this.progress.stack=p),this.progress.ratio=this.progress.val/this.progress.state,this},l.prototype.updateProgress=function(c,f,d,p){return this.setProgress(c?this.progress.val+c:null,f||null,d?this.progress.n+d:null,p?this.progress.stack.concat(p):null)},l.prototype.then=function(c,f){var d=this;return this.thenCore(c,f,function(p,g){return d.updateProgress(null,null,1,[p]),Promise.prototype.then.call(this,function(b){return d.updateProgress(null,p),b}).then(p,g).then(function(b){return d.updateProgress(1),b})})},l.prototype.thenCore=function(c,f,d){d=d||Promise.prototype.then;var p=this;c&&(c=c.bind(p)),f&&(f=f.bind(p));var g=Promise.toString().indexOf("[native code]")!==-1&&Promise.name==="Promise"?p:l.convert(Object.assign({},p),Promise.prototype),b=d.call(g,c,f);return l.convert(b,p.__proto__)},l.prototype.thenExternal=function(c,f){return Promise.prototype.then.call(this,c,f)},l.prototype.thenList=function(c){var f=this;return c.forEach(function(d){f=f.thenCore(d)}),f},l.prototype.catch=function(c){c&&(c=c.bind(this));var f=Promise.prototype.catch.call(this,c);return l.convert(f,this)},l.prototype.catchExternal=function(c){return Promise.prototype.catch.call(this,c)},l.prototype.error=function(c){return this.then(function(){throw new Error(c)})},l.prototype.using=l.prototype.set,l.prototype.saveAs=l.prototype.save,l.prototype.export=l.prototype.output,l.prototype.run=l.prototype.then,xn.getPageSize=function(c,f,d){if(ii(c)==="object"){var p=c;c=p.orientation,f=p.unit||f,d=p.format||d}f=f||"mm",d=d||"a4",c=(""+(c||"P")).toLowerCase();var g,b=(""+d).toLowerCase(),y={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};switch(f){case"pt":g=1;break;case"mm":g=72/25.4;break;case"cm":g=72/2.54;break;case"in":g=72;break;case"px":g=.75;break;case"pc":case"em":g=12;break;case"ex":g=6;break;default:throw"Invalid unit: "+f}var M,E=0,D=0;if(y.hasOwnProperty(b))E=y[b][1]/g,D=y[b][0]/g;else try{E=d[1],D=d[0]}catch{throw new Error("Invalid format: "+d)}if(c==="p"||c==="portrait")c="p",D>E&&(M=D,D=E,E=M);else{if(c!=="l"&&c!=="landscape")throw"Invalid orientation: "+c;c="l",E>D&&(M=D,D=E,E=M)}return{width:D,height:E,unit:f,k:g,orientation:c}},e.html=function(c,f){(f=f||{}).callback=f.callback||function(){},f.html2canvas=f.html2canvas||{},f.html2canvas.canvas=f.html2canvas.canvas||this.canvas,f.jsPDF=f.jsPDF||this,f.fontFaces=f.fontFaces?f.fontFaces.map(Hy):null;var d=new l(f);return f.worker?d:d.from(c).doCallback()}})(xn.API),xn.API.addJS=function(e){var t,n,r=(function(i){for(var s="",l=0;l<i.length;l++){var c=i[l];if(c==="("||c===")"){for(var f=0,d=l-1;d>=0&&i[d]==="\\";d--)f++;s+=f%2==0?"\\"+c:c}else s+=c}return s})(e);return this.internal.events.subscribe("postPutResources",function(){t=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(t+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),n=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+r+")"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){t!==void 0&&n!==void 0&&this.internal.out("/Names <</JavaScript "+t+" 0 R>>")}),this},(function(e){var t;e.events.push(["postPutResources",function(){var n=this,r=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var i=n.outline.render().split(/\r\n/),s=0;s<i.length;s++){var l=i[s],c=r.exec(l);if(c!=null){var f=c[1];n.internal.newObjectDeferredBegin(f,!1)}n.internal.write(l)}if(this.outline.createNamedDestinations){var d=this.internal.pages.length,p=[];for(s=0;s<d;s++){var g=n.internal.newObject();p.push(g);var b=n.internal.getPageInfo(s+1);n.internal.write("<< /D["+b.objId+" 0 R /XYZ null null null]>> endobj")}var y=n.internal.newObject();for(n.internal.write("<< /Names [ "),s=0;s<p.length;s++)n.internal.write("(page_"+(s+1)+")"+p[s]+" 0 R");n.internal.write(" ] >>","endobj"),t=n.internal.newObject(),n.internal.write("<< /Dests "+y+" 0 R"),n.internal.write(">>","endobj")}}]),e.events.push(["putCatalog",function(){var n=this;n.outline.root.children.length>0&&(n.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&n.internal.write("/Names "+t+" 0 R"))}]),e.events.push(["initialized",function(){var n=this;n.outline={createNamedDestinations:!1,root:{children:[]}},n.outline.add=function(r,i,s){var l={title:i,options:s,children:[]};return r==null&&(r=this.root),r.children.push(l),l},n.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=n,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},n.outline.genIds_r=function(r){r.id=n.internal.newObjectDeferred();for(var i=0;i<r.children.length;i++)this.genIds_r(r.children[i])},n.outline.renderRoot=function(r){this.objStart(r),this.line("/Type /Outlines"),r.children.length>0&&(this.line("/First "+this.makeRef(r.children[0])),this.line("/Last "+this.makeRef(r.children[r.children.length-1]))),this.line("/Count "+this.count_r({count:0},r)),this.objEnd()},n.outline.renderItems=function(r){for(var i=this.ctx.pdf.internal.getVerticalCoordinateString,s=0;s<r.children.length;s++){var l=r.children[s];this.objStart(l),this.line("/Title "+this.makeString(l.title)),this.line("/Parent "+this.makeRef(r)),s>0&&this.line("/Prev "+this.makeRef(r.children[s-1])),s<r.children.length-1&&this.line("/Next "+this.makeRef(r.children[s+1])),l.children.length>0&&(this.line("/First "+this.makeRef(l.children[0])),this.line("/Last "+this.makeRef(l.children[l.children.length-1])));var c=this.count=this.count_r({count:0},l);if(c>0&&this.line("/Count "+c),l.options&&l.options.pageNumber){var f=n.internal.getPageInfo(l.options.pageNumber);this.line("/Dest ["+f.objId+" 0 R /XYZ 0 "+i(0)+" 0]")}this.objEnd()}for(var d=0;d<r.children.length;d++)this.renderItems(r.children[d])},n.outline.line=function(r){this.ctx.val+=r+`\r
50
+ `},n.outline.makeRef=function(r){return r.id+" 0 R"},n.outline.makeString=function(r){return"("+n.internal.pdfEscape(r)+")"},n.outline.objStart=function(r){this.ctx.val+=`\r
51
+ `+r.id+` 0 obj\r
52
+ <<\r
53
+ `},n.outline.objEnd=function(){this.ctx.val+=`>> \r
54
+ endobj\r
55
+ `},n.outline.count_r=function(r,i){for(var s=0;s<i.children.length;s++)r.count++,this.count_r(r,i.children[s]);return r.count}}])})(xn.API),(function(e){var t=[192,193,194,195,196,197,198,199];e.processJPEG=function(n,r,i,s,l,c){var f,d=this.decode.DCT_DECODE,p=null;if(typeof n=="string"||this.__addimage__.isArrayBuffer(n)||this.__addimage__.isArrayBufferView(n)){switch(n=l||n,n=this.__addimage__.isArrayBuffer(n)?new Uint8Array(n):n,f=(function(g){for(var b,y=256*g.charCodeAt(4)+g.charCodeAt(5),M=g.length,E={width:0,height:0,numcomponents:1},D=4;D<M;D+=2){if(D+=y,t.indexOf(g.charCodeAt(D+1))!==-1){b=256*g.charCodeAt(D+5)+g.charCodeAt(D+6),E={width:256*g.charCodeAt(D+7)+g.charCodeAt(D+8),height:b,numcomponents:g.charCodeAt(D+9)};break}y=256*g.charCodeAt(D+2)+g.charCodeAt(D+3)}return E})(n=this.__addimage__.isArrayBufferView(n)?this.__addimage__.arrayBufferToBinaryString(n):n),f.numcomponents){case 1:c=this.color_spaces.DEVICE_GRAY;break;case 4:c=this.color_spaces.DEVICE_CMYK;break;case 3:c=this.color_spaces.DEVICE_RGB}p={data:n,width:f.width,height:f.height,colorSpace:c,bitsPerComponent:8,filter:d,index:r,alias:i}}return p}})(xn.API),xn.API.processPNG=function(e,t,n,r){if(this.__addimage__.isArrayBuffer(e)&&(e=new Uint8Array(e)),this.__addimage__.isArrayBufferView(e)){var i,s=b_(e,{checkCrc:!0}),l=s.width,c=s.height,f=s.channels,d=s.palette,p=s.depth;i=d&&f===1?(function(bt){for(var rt=bt.width,Dt=bt.height,Q=bt.data,lt=bt.palette,X=bt.depth,wt=!1,Tt=[],yt=[],J=void 0,ct=!1,Bt=0,te=0;te<lt.length;te++){var Z=uw(lt[te],4),P=Z[0],j=Z[1],G=Z[2],ut=Z[3];Tt.push(P,j,G),ut!=null&&(ut===0?(Bt++,yt.length<1&&yt.push(te)):ut<255&&(ct=!0))}if(ct||Bt>1){wt=!0,yt=void 0;var xt=rt*Dt;J=new Uint8Array(xt);for(var St=new DataView(Q.buffer),Ft=0;Ft<xt;Ft++){var Rt=$y(St,Ft,X),Qt=uw(lt[Rt],4)[3];J[Ft]=Qt}}else Bt===0&&(yt=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:wt?8:void 0,colorBytes:Q,alphaBytes:J,needSMask:wt,palette:Tt,mask:yt}})(s):f===2||f===4?(function(bt){for(var rt=bt.data,Dt=bt.width,Q=bt.height,lt=bt.channels,X=bt.depth,wt=lt===2?"DeviceGray":"DeviceRGB",Tt=lt-1,yt=Dt*Q,J=Tt,ct=yt*J,Bt=1*yt,te=Math.ceil(ct*X/8),Z=Math.ceil(Bt*X/8),P=new Uint8Array(te),j=new Uint8Array(Z),G=new DataView(rt.buffer),ut=new DataView(P.buffer),xt=new DataView(j.buffer),St=!1,Ft=0;Ft<yt;Ft++){for(var Rt=Ft*lt,Qt=0;Qt<J;Qt++)hS(ut,$y(G,Rt+Qt,X),Ft*J+Qt,X);var ve=$y(G,Rt+J,X);ve<(1<<X)-1&&(St=!0),hS(xt,ve,1*Ft,X)}return{colorSpace:wt,colorsPerPixel:Tt,sMaskBitsPerComponent:St?X:void 0,colorBytes:P,alphaBytes:j,needSMask:St}})(s):(function(bt){var rt=bt.data,Dt=bt.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:Dt,colorsPerPixel:Dt==="DeviceGray"?1:3,colorBytes:rt instanceof Uint16Array?(function(Q){for(var lt=Q.length,X=new Uint8Array(2*lt),wt=new DataView(X.buffer,X.byteOffset,X.byteLength),Tt=0;Tt<lt;Tt++)wt.setUint16(2*Tt,Q[Tt],!1);return X})(rt):rt,needSMask:!1}})(s);var g,b,y,M=i,E=M.colorSpace,D=M.colorsPerPixel,L=M.sMaskBitsPerComponent,q=M.colorBytes,$=M.alphaBytes,Y=M.needSMask,ht=M.palette,Mt=M.mask,vt=null;return r!==xn.API.image_compression.NONE&&typeof U2=="function"?(vt=(function(bt){var rt;switch(bt){case xn.API.image_compression.FAST:rt=11;break;case xn.API.image_compression.MEDIUM:rt=13;break;case xn.API.image_compression.SLOW:rt=14;break;default:rt=12}return rt})(r),g=this.decode.FLATE_DECODE,b="/Predictor ".concat(vt," /Colors ").concat(D," /BitsPerComponent ").concat(p," /Columns ").concat(l),e=lS(q,Math.ceil(l*D*p/8),D,p,r),Y&&(y=lS($,Math.ceil(l*L/8),1,L,r))):(g=void 0,b=void 0,e=q,Y&&(y=$)),(this.__addimage__.isArrayBuffer(e)||this.__addimage__.isArrayBufferView(e))&&(e=this.__addimage__.arrayBufferToBinaryString(e)),(y&&this.__addimage__.isArrayBuffer(y)||this.__addimage__.isArrayBufferView(y))&&(y=this.__addimage__.arrayBufferToBinaryString(y)),{alias:n,data:e,index:t,filter:g,decodeParameters:b,transparency:Mt,palette:ht,sMask:y,predictor:vt,width:l,height:c,bitsPerComponent:p,sMaskBitsPerComponent:L,colorSpace:E}}},(function(e){e.processGIF89A=function(t,n,r,i){var s=new B_(t),l=s.width,c=s.height,f=[];s.decodeAndBlitFrameRGBA(0,f);var d={data:f,width:l,height:c},p=new Yy(100).encode(d,100);return e.processJPEG.call(this,p,n,r,i)},e.processGIF87A=e.processGIF89A})(xn.API),gc.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.bitPP===16&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var e=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(e);for(var t=0;t<e;t++){var n=this.datav.getUint8(this.pos++,!0),r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0);this.palette[t]={red:i,green:r,blue:n,quad:s}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},gc.prototype.parseBGR=function(){this.pos=this.offset;var e="bit"+this.bitPP,t=this.width*this.height*4;if(t>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");this.data=new Uint8Array(t);try{this[e]()}catch(n){yi.log("bit decode error:"+n)}},gc.prototype.bit1=function(){var e,t=Math.ceil(this.width/8),n=t%4;for(e=this.height-1;e>=0;e--){for(var r=this.bottom_up?e:this.height-1-e,i=0;i<t;i++)for(var s=this.datav.getUint8(this.pos++,!0),l=r*this.width*4+8*i*4,c=0;c<8&&8*i+c<this.width;c++){var f=this.palette[s>>7-c&1];this.data[l+4*c]=f.blue,this.data[l+4*c+1]=f.green,this.data[l+4*c+2]=f.red,this.data[l+4*c+3]=255}n!==0&&(this.pos+=4-n)}},gc.prototype.bit4=function(){for(var e=Math.ceil(this.width/2),t=e%4,n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,i=0;i<e;i++){var s=this.datav.getUint8(this.pos++,!0),l=r*this.width*4+2*i*4,c=s>>4,f=15&s,d=this.palette[c];if(this.data[l]=d.blue,this.data[l+1]=d.green,this.data[l+2]=d.red,this.data[l+3]=255,2*i+1>=this.width)break;d=this.palette[f],this.data[l+4]=d.blue,this.data[l+4+1]=d.green,this.data[l+4+2]=d.red,this.data[l+4+3]=255}t!==0&&(this.pos+=4-t)}},gc.prototype.bit8=function(){for(var e=this.width%4,t=this.height-1;t>=0;t--){for(var n=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){var i=this.datav.getUint8(this.pos++,!0),s=n*this.width*4+4*r;if(i<this.palette.length){var l=this.palette[i];this.data[s]=l.red,this.data[s+1]=l.green,this.data[s+2]=l.blue,this.data[s+3]=255}else this.data[s]=255,this.data[s+1]=255,this.data[s+2]=255,this.data[s+3]=255}e!==0&&(this.pos+=4-e)}},gc.prototype.bit15=function(){for(var e=this.width%3,t=parseInt("11111",2),n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,i=0;i<this.width;i++){var s=this.datav.getUint16(this.pos,!0);this.pos+=2;var l=(s&t)/t*255|0,c=(s>>5&t)/t*255|0,f=(s>>10&t)/t*255|0,d=s>>15?255:0,p=r*this.width*4+4*i;this.data[p]=f,this.data[p+1]=c,this.data[p+2]=l,this.data[p+3]=d}this.pos+=e}},gc.prototype.bit16=function(){for(var e=this.width%3,t=parseInt("11111",2),n=parseInt("111111",2),r=this.height-1;r>=0;r--){for(var i=this.bottom_up?r:this.height-1-r,s=0;s<this.width;s++){var l=this.datav.getUint16(this.pos,!0);this.pos+=2;var c=(l&t)/t*255|0,f=(l>>5&n)/n*255|0,d=(l>>11)/t*255|0,p=i*this.width*4+4*s;this.data[p]=d,this.data[p+1]=f,this.data[p+2]=c,this.data[p+3]=255}this.pos+=e}},gc.prototype.bit24=function(){for(var e=this.height-1;e>=0;e--){for(var t=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){var r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),l=t*this.width*4+4*n;this.data[l]=s,this.data[l+1]=i,this.data[l+2]=r,this.data[l+3]=255}this.pos+=this.width%4}},gc.prototype.bit32=function(){for(var e=this.height-1;e>=0;e--)for(var t=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){var r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),l=this.datav.getUint8(this.pos++,!0),c=t*this.width*4+4*n;this.data[c]=s,this.data[c+1]=i,this.data[c+2]=r,this.data[c+3]=l}},gc.prototype.getData=function(){return this.data},(function(e){e.processBMP=function(t,n,r,i){var s=new gc(t,!1),l=s.width,c=s.height,f={data:s.getData(),width:l,height:c},d=new Yy(100).encode(f,100);return e.processJPEG.call(this,d,n,r,i)}})(xn.API),mS.prototype.getData=function(){return this.data},(function(e){e.processWEBP=function(t,n,r,i){var s=new mS(t),l=s.width,c=s.height,f={data:s.getData(),width:l,height:c},d=new Yy(100).encode(f,100);return e.processJPEG.call(this,d,n,r,i)}})(xn.API),xn.API.processRGBA=function(e,t,n){for(var r=e.data,i=r.length,s=new Uint8Array(i/4*3),l=new Uint8Array(i/4),c=0,f=0,d=0;d<i;d+=4){var p=r[d],g=r[d+1],b=r[d+2],y=r[d+3];s[c++]=p,s[c++]=g,s[c++]=b,l[f++]=y}var M=this.__addimage__.arrayBufferToBinaryString(s);return{alpha:this.__addimage__.arrayBufferToBinaryString(l),data:M,index:t,alias:n,colorSpace:"DeviceRGB",bitsPerComponent:8,width:e.width,height:e.height}},xn.API.setLanguage=function(e){return this.internal.languageSettings===void 0&&(this.internal.languageSettings={},this.internal.languageSettings.isSubscribed=!1),{af:"Afrikaans",sq:"Albanian",ar:"Arabic (Standard)","ar-DZ":"Arabic (Algeria)","ar-BH":"Arabic (Bahrain)","ar-EG":"Arabic (Egypt)","ar-IQ":"Arabic (Iraq)","ar-JO":"Arabic (Jordan)","ar-KW":"Arabic (Kuwait)","ar-LB":"Arabic (Lebanon)","ar-LY":"Arabic (Libya)","ar-MA":"Arabic (Morocco)","ar-OM":"Arabic (Oman)","ar-QA":"Arabic (Qatar)","ar-SA":"Arabic (Saudi Arabia)","ar-SY":"Arabic (Syria)","ar-TN":"Arabic (Tunisia)","ar-AE":"Arabic (U.A.E.)","ar-YE":"Arabic (Yemen)",an:"Aragonese",hy:"Armenian",as:"Assamese",ast:"Asturian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",zh:"Chinese","zh-HK":"Chinese (Hong Kong)","zh-CN":"Chinese (PRC)","zh-SG":"Chinese (Singapore)","zh-TW":"Chinese (Taiwan)",cv:"Chuvash",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch (Standard)","nl-BE":"Dutch (Belgian)",en:"English","en-AU":"English (Australia)","en-BZ":"English (Belize)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-JM":"English (Jamaica)","en-NZ":"English (New Zealand)","en-PH":"English (Philippines)","en-ZA":"English (South Africa)","en-TT":"English (Trinidad & Tobago)","en-GB":"English (United Kingdom)","en-US":"English (United States)","en-ZW":"English (Zimbabwe)",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fj:"Fijian",fi:"Finnish",fr:"French (Standard)","fr-BE":"French (Belgium)","fr-CA":"French (Canada)","fr-FR":"French (France)","fr-LU":"French (Luxembourg)","fr-MC":"French (Monaco)","fr-CH":"French (Switzerland)",fy:"Frisian",fur:"Friulian",gd:"Gaelic (Scots)","gd-IE":"Gaelic (Irish)",gl:"Galacian",ka:"Georgian",de:"German (Standard)","de-AT":"German (Austria)","de-DE":"German (Germany)","de-LI":"German (Liechtenstein)","de-LU":"German (Luxembourg)","de-CH":"German (Switzerland)",el:"Greek",gu:"Gujurati",ht:"Haitian",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",iu:"Inuktitut",ga:"Irish",it:"Italian (Standard)","it-CH":"Italian (Switzerland)",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ky:"Kirghiz",tlh:"Klingon",ko:"Korean","ko-KP":"Korean (North Korea)","ko-KR":"Korean (South Korea)",la:"Latin",lv:"Latvian",lt:"Lithuanian",lb:"Luxembourgish",mk:"North Macedonia",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",nv:"Navajo",ng:"Ndonga",ne:"Nepali",no:"Norwegian",nb:"Norwegian (Bokmal)",nn:"Norwegian (Nynorsk)",oc:"Occitan",or:"Oriya",om:"Oromo",fa:"Persian","fa-IR":"Persian/Iran",pl:"Polish",pt:"Portuguese","pt-BR":"Portuguese (Brazil)",pa:"Punjabi","pa-IN":"Punjabi (India)","pa-PK":"Punjabi (Pakistan)",qu:"Quechua",rm:"Rhaeto-Romanic",ro:"Romanian","ro-MO":"Romanian (Moldavia)",ru:"Russian","ru-MO":"Russian (Moldavia)",sz:"Sami (Lappish)",sg:"Sango",sa:"Sanskrit",sc:"Sardinian",sd:"Sindhi",si:"Singhalese",sr:"Serbian",sk:"Slovak",sl:"Slovenian",so:"Somani",sb:"Sorbian",es:"Spanish","es-AR":"Spanish (Argentina)","es-BO":"Spanish (Bolivia)","es-CL":"Spanish (Chile)","es-CO":"Spanish (Colombia)","es-CR":"Spanish (Costa Rica)","es-DO":"Spanish (Dominican Republic)","es-EC":"Spanish (Ecuador)","es-SV":"Spanish (El Salvador)","es-GT":"Spanish (Guatemala)","es-HN":"Spanish (Honduras)","es-MX":"Spanish (Mexico)","es-NI":"Spanish (Nicaragua)","es-PA":"Spanish (Panama)","es-PY":"Spanish (Paraguay)","es-PE":"Spanish (Peru)","es-PR":"Spanish (Puerto Rico)","es-ES":"Spanish (Spain)","es-UY":"Spanish (Uruguay)","es-VE":"Spanish (Venezuela)",sx:"Sutu",sw:"Swahili",sv:"Swedish","sv-FI":"Swedish (Finland)","sv-SV":"Swedish (Sweden)",ta:"Tamil",tt:"Tatar",te:"Teluga",th:"Thai",tig:"Tigre",ts:"Tsonga",tn:"Tswana",tr:"Turkish",tk:"Turkmen",uk:"Ukrainian",hsb:"Upper Sorbian",ur:"Urdu",ve:"Venda",vi:"Vietnamese",vo:"Volapuk",wa:"Walloon",cy:"Welsh",xh:"Xhosa",ji:"Yiddish",zu:"Zulu"}[e]!==void 0&&(this.internal.languageSettings.languageCode=e,this.internal.languageSettings.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){this.internal.write("/Lang ("+this.internal.languageSettings.languageCode+")")}),this.internal.languageSettings.isSubscribed=!0)),this},$d=xn.API,Jm=$d.getCharWidthsArray=function(e,t){var n,r,i=(t=t||{}).font||this.internal.getFont(),s=t.fontSize||this.internal.getFontSize(),l=t.charSpace||this.internal.getCharSpace(),c=t.widths?t.widths:i.metadata.Unicode.widths,f=c.fof?c.fof:1,d=t.kerning?t.kerning:i.metadata.Unicode.kerning,p=d.fof?d.fof:1,g=t.doKerning!==!1,b=0,y=e.length,M=0,E=c[0]||f,D=[];for(n=0;n<y;n++)r=e.charCodeAt(n),typeof i.metadata.widthOfString=="function"?D.push((i.metadata.widthOfGlyph(i.metadata.characterToGlyph(r))+l*(1e3/s)||0)/1e3):(b=g&&ii(d[r])==="object"&&!isNaN(parseInt(d[r][M],10))?d[r][M]/p:0,D.push((c[r]||E)/f+b)),M=r;return D},oS=$d.getStringUnitWidth=function(e,t){var n=(t=t||{}).fontSize||this.internal.getFontSize(),r=t.font||this.internal.getFont(),i=t.charSpace||this.internal.getCharSpace();return $d.processArabic&&(e=$d.processArabic(e)),typeof r.metadata.widthOfString=="function"?r.metadata.widthOfString(e,n,i)/n:Jm.apply(this,arguments).reduce(function(s,l){return s+l},0)},sS=function(e,t,n,r){for(var i=[],s=0,l=e.length,c=0;s!==l&&c+t[s]<n;)c+=t[s],s++;i.push(e.slice(0,s));var f=s;for(c=0;s!==l;)c+t[s]>r&&(i.push(e.slice(f,s)),c=0,f=s),c+=t[s],s++;return f!==s&&i.push(e.slice(f,s)),i},aS=function(e,t,n){n||(n={});var r,i,s,l,c,f,d,p=[],g=[p],b=n.textIndent||0,y=0,M=0,E=e.split(" "),D=Jm.apply(this,[" ",n])[0];if(f=n.lineIndent===-1?E[0].length+2:n.lineIndent||0){var L=Array(f).join(" "),q=[];E.map(function(Y){(Y=Y.split(/\s*\n/)).length>1?q=q.concat(Y.map(function(ht,Mt){return(Mt&&ht.length?`
56
+ `:"")+ht})):q.push(Y[0])}),E=q,f=oS.apply(this,[L,n])}for(s=0,l=E.length;s<l;s++){var $=0;if(r=E[s],f&&r[0]==`
57
+ `&&(r=r.substr(1),$=1),b+y+(M=(i=Jm.apply(this,[r,n])).reduce(function(Y,ht){return Y+ht},0))>t||$){if(M>t){for(c=sS.apply(this,[r,i,t-(b+y),t]),p.push(c.shift()),p=[c.pop()];c.length;)g.push([c.shift()]);M=i.slice(r.length-(p[0]?p[0].length:0)).reduce(function(Y,ht){return Y+ht},0)}else p=[r];g.push(p),b=M+f,y=D}else p.push(r),b+=y+M,y=D}return d=f?function(Y,ht){return(ht?L:"")+Y.join(" ")}:function(Y){return Y.join(" ")},g.map(d)},$d.splitTextToSize=function(e,t,n){var r,i=(n=n||{}).fontSize||this.internal.getFontSize(),s=(function(p){if(p.widths&&p.kerning)return{widths:p.widths,kerning:p.kerning};var g=this.internal.getFont(p.fontName,p.fontStyle),b="Unicode";return g.metadata[b]?{widths:g.metadata[b].widths||{0:1},kerning:g.metadata[b].kerning||{}}:{font:g.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,n);r=Array.isArray(e)?e:String(e).split(/\r?\n/);var l=1*this.internal.scaleFactor*t/i;s.textIndent=n.textIndent?1*n.textIndent*this.internal.scaleFactor/i:0,s.lineIndent=n.lineIndent;var c,f,d=[];for(c=0,f=r.length;c<f;c++)d=d.concat(aS.apply(this,[r[c],l,s]));return d},(function(e){e.__fontmetrics__=e.__fontmetrics__||{};for(var t="0123456789abcdef",n="klmnopqrstuvwxyz",r={},i={},s=0;s<16;s++)r[n[s]]=t[s],i[t[s]]=n[s];var l=function(b){return"0x"+parseInt(b,10).toString(16)},c=e.__fontmetrics__.compress=function(b){var y,M,E,D,L=["{"];for(var q in b){if(y=b[q],isNaN(parseInt(q,10))?M="'"+q+"'":(q=parseInt(q,10),M=(M=l(q).slice(2)).slice(0,-1)+i[M.slice(-1)]),typeof y=="number")y<0?(E=l(y).slice(3),D="-"):(E=l(y).slice(2),D=""),E=D+E.slice(0,-1)+i[E.slice(-1)];else{if(ii(y)!=="object")throw new Error("Don't know what to do with value type "+ii(y)+".");E=c(y)}L.push(M+E)}return L.push("}"),L.join("")},f=e.__fontmetrics__.uncompress=function(b){if(typeof b!="string")throw new Error("Invalid argument passed to uncompress.");for(var y,M,E,D,L={},q=1,$=L,Y=[],ht="",Mt="",vt=b.length-1,bt=1;bt<vt;bt+=1)(D=b[bt])=="'"?y?(E=y.join(""),y=void 0):y=[]:y?y.push(D):D=="{"?(Y.push([$,E]),$={},E=void 0):D=="}"?((M=Y.pop())[0][M[1]]=$,E=void 0,$=M[0]):D=="-"?q=-1:E===void 0?r.hasOwnProperty(D)?(ht+=r[D],E=parseInt(ht,16)*q,q=1,ht=""):ht+=D:r.hasOwnProperty(D)?(Mt+=r[D],$[E]=parseInt(Mt,16)*q,q=1,E=void 0,Mt=""):Mt+=D;return L},d={codePages:["WinAnsiEncoding"],WinAnsiEncoding:f("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},p={Unicode:{Courier:d,"Courier-Bold":d,"Courier-BoldOblique":d,"Courier-Oblique":d,Helvetica:d,"Helvetica-Bold":d,"Helvetica-BoldOblique":d,"Helvetica-Oblique":d,"Times-Roman":d,"Times-Bold":d,"Times-BoldItalic":d,"Times-Italic":d}},g={Unicode:{"Courier-Oblique":f("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":f("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":f("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:f("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":f("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":f("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:f("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:f("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":f("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:f("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":f("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":f("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":f("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":f("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};e.events.push(["addFont",function(b){var y=b.font,M=g.Unicode[y.postScriptName];M&&(y.metadata.Unicode={},y.metadata.Unicode.widths=M.widths,y.metadata.Unicode.kerning=M.kerning);var E=p.Unicode[y.postScriptName];E&&(y.metadata.Unicode.encoding=E,y.encoding=E.codePages[0])}])})(xn.API),(function(e){var t=function(n){for(var r=n.length,i=new Uint8Array(r),s=0;s<r;s++)i[s]=n.charCodeAt(s);return i};e.API.events.push(["addFont",function(n){var r=void 0,i=n.font,s=n.instance;if(!i.isStandardFont){if(s===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");if(typeof(r=s.existsFileInVFS(i.postScriptName)===!1?s.loadFile(i.postScriptName):s.getFileFromVFS(i.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");(function(l,c){c=/^\x00\x01\x00\x00/.test(c)?t(c):t(Ag(c)),l.metadata=e.API.TTFFont.open(c),l.metadata.Unicode=l.metadata.Unicode||{encoding:{},kerning:{},widths:[]},l.metadata.glyIdsUsed=[0]})(i,r)}}])})(xn),xn.API.addSvgAsImage=function(e,t,n,r,i,s,l,c){if(isNaN(t)||isNaN(n))throw yi.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(r)||isNaN(i))throw yi.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var f=document.createElement("canvas");f.width=r,f.height=i;var d=f.getContext("2d");d.fillStyle="#fff",d.fillRect(0,0,f.width,f.height);var p={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},g=this;return(Qn.canvg?Promise.resolve(Qn.canvg):Ay(()=>import("./index.es-B2BDgK7g.js"),[],import.meta.url)).catch(function(b){return Promise.reject(new Error("Could not load canvg: "+b))}).then(function(b){return b.default?b.default:b}).then(function(b){return b.fromString(d,e,p)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(b){return b.render(p)}).then(function(){g.addImage(f.toDataURL("image/jpeg",1),t,n,r,i,l,c)})},xn.API.putTotalPages=function(e){var t,n=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(e,"g"),n=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(e,this.internal.getFont()),"g"),n=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var r=1;r<=this.internal.getNumberOfPages();r++)for(var i=0;i<this.internal.pages[r].length;i++)this.internal.pages[r][i]=this.internal.pages[r][i].replace(t,n);return this},xn.API.viewerPreferences=function(e,t){var n;e=e||{},t=t||!1;var r,i,s,l={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},c=Object.keys(l),f=[],d=0,p=0,g=0;function b(M,E){var D,L=!1;for(D=0;D<M.length;D+=1)M[D]===E&&(L=!0);return L}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(l)),this.internal.viewerpreferences.isSubscribed=!1),n=this.internal.viewerpreferences.configuration,e==="reset"||t===!0){var y=c.length;for(g=0;g<y;g+=1)n[c[g]].value=n[c[g]].defaultValue,n[c[g]].explicitSet=!1}if(ii(e)==="object"){for(i in e)if(s=e[i],b(c,i)&&s!==void 0){if(n[i].type==="boolean"&&typeof s=="boolean")n[i].value=s;else if(n[i].type==="name"&&b(n[i].valueSet,s))n[i].value=s;else if(n[i].type==="integer"&&Number.isInteger(s))n[i].value=s;else if(n[i].type==="array"){for(d=0;d<s.length;d+=1)if(r=!0,s[d].length===1&&typeof s[d][0]=="number")f.push(String(s[d]-1));else if(s[d].length>1){for(p=0;p<s[d].length;p+=1)typeof s[d][p]!="number"&&(r=!1);r===!0&&f.push([s[d][0]-1,s[d][1]-1].join(" "))}n[i].value="["+f.join(" ")+"]"}else n[i].value=n[i].defaultValue;n[i].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var M,E=[];for(M in n)n[M].explicitSet===!0&&(n[M].type==="name"?E.push("/"+M+" /"+n[M].value):E.push("/"+M+" "+n[M].value));E.length!==0&&this.internal.write(`/ViewerPreferences
58
+ <<
59
+ `+E.join(`
60
+ `)+`
61
+ >>`)}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=n,this},xn.API.addMetadata=function(e,t){return this.internal.__metadata__===void 0&&(this.internal.__metadata__={metadata:e,namespaceUri:t??"http://jspdf.default.namespaceuri/",rawXml:typeof t=="boolean"&&t},this.internal.events.subscribe("putCatalog",U_),this.internal.events.subscribe("postPutResources",F_)),this},(function(e){var t=e.API,n=t.pdfEscape16=function(s,l){for(var c,f=l.metadata.Unicode.widths,d=["","0","00","000","0000"],p=[""],g=0,b=s.length;g<b;++g){if(c=l.metadata.characterToGlyph(s.charCodeAt(g)),l.metadata.glyIdsUsed.push(c),l.metadata.toUnicode[c]=s.charCodeAt(g),f.indexOf(c)==-1&&(f.push(c),f.push([parseInt(l.metadata.widthOfGlyph(c),10)])),c=="0")return p.join("");c=c.toString(16),p.push(d[4-c.length],c)}return p.join("")},r=function(s){var l,c,f,d,p,g,b;for(p=`/CIDInit /ProcSet findresource begin
62
+ 12 dict begin
63
+ begincmap
64
+ /CIDSystemInfo <<
65
+ /Registry (Adobe)
66
+ /Ordering (UCS)
67
+ /Supplement 0
68
+ >> def
69
+ /CMapName /Adobe-Identity-UCS def
70
+ /CMapType 2 def
71
+ 1 begincodespacerange
72
+ <0000><ffff>
73
+ endcodespacerange`,f=[],g=0,b=(c=Object.keys(s).sort(function(y,M){return y-M})).length;g<b;g++)l=c[g],f.length>=100&&(p+=`
74
+ `+f.length+` beginbfchar
75
+ `+f.join(`
76
+ `)+`
77
+ endbfchar`,f=[]),s[l]!==void 0&&s[l]!==null&&typeof s[l].toString=="function"&&(d=("0000"+s[l].toString(16)).slice(-4),l=("0000"+(+l).toString(16)).slice(-4),f.push("<"+l+"><"+d+">"));return f.length&&(p+=`
78
+ `+f.length+` beginbfchar
79
+ `+f.join(`
80
+ `)+`
81
+ endbfchar
82
+ `),p+`endcmap
83
+ CMapName currentdict /CMap defineresource pop
84
+ end
85
+ end`};t.events.push(["putFont",function(s){(function(l){var c=l.font,f=l.out,d=l.newObject,p=l.putStream;if(c.metadata instanceof e.API.TTFFont&&c.encoding==="Identity-H"){for(var g=c.metadata.Unicode.widths,b=c.metadata.subset.encode(c.metadata.glyIdsUsed,1),y="",M=0;M<b.length;M++)y+=String.fromCharCode(b[M]);var E=d();p({data:y,addLength1:!0,objectId:E}),f("endobj");var D=d();p({data:r(c.metadata.toUnicode),addLength1:!0,objectId:D}),f("endobj");var L=d();f("<<"),f("/Type /FontDescriptor"),f("/FontName /"+Jd(c.fontName)),f("/FontFile2 "+E+" 0 R"),f("/FontBBox "+e.API.PDFObject.convert(c.metadata.bbox)),f("/Flags "+c.metadata.flags),f("/StemV "+c.metadata.stemV),f("/ItalicAngle "+c.metadata.italicAngle),f("/Ascent "+c.metadata.ascender),f("/Descent "+c.metadata.decender),f("/CapHeight "+c.metadata.capHeight),f(">>"),f("endobj");var q=d();f("<<"),f("/Type /Font"),f("/BaseFont /"+Jd(c.fontName)),f("/FontDescriptor "+L+" 0 R"),f("/W "+e.API.PDFObject.convert(g)),f("/CIDToGIDMap /Identity"),f("/DW 1000"),f("/Subtype /CIDFontType2"),f("/CIDSystemInfo"),f("<<"),f("/Supplement 0"),f("/Registry (Adobe)"),f("/Ordering ("+c.encoding+")"),f(">>"),f(">>"),f("endobj"),c.objectNumber=d(),f("<<"),f("/Type /Font"),f("/Subtype /Type0"),f("/ToUnicode "+D+" 0 R"),f("/BaseFont /"+Jd(c.fontName)),f("/Encoding /"+c.encoding),f("/DescendantFonts ["+q+" 0 R]"),f(">>"),f("endobj"),c.isAlreadyPutted=!0}})(s)}]),t.events.push(["putFont",function(s){(function(l){var c=l.font,f=l.out,d=l.newObject,p=l.putStream;if(c.metadata instanceof e.API.TTFFont&&c.encoding==="WinAnsiEncoding"){for(var g=c.metadata.rawData,b="",y=0;y<g.length;y++)b+=String.fromCharCode(g[y]);var M=d();p({data:b,addLength1:!0,objectId:M}),f("endobj");var E=d();p({data:r(c.metadata.toUnicode),addLength1:!0,objectId:E}),f("endobj");var D=d();f("<<"),f("/Descent "+c.metadata.decender),f("/CapHeight "+c.metadata.capHeight),f("/StemV "+c.metadata.stemV),f("/Type /FontDescriptor"),f("/FontFile2 "+M+" 0 R"),f("/Flags 96"),f("/FontBBox "+e.API.PDFObject.convert(c.metadata.bbox)),f("/FontName /"+Jd(c.fontName)),f("/ItalicAngle "+c.metadata.italicAngle),f("/Ascent "+c.metadata.ascender),f(">>"),f("endobj"),c.objectNumber=d();for(var L=0;L<c.metadata.hmtx.widths.length;L++)c.metadata.hmtx.widths[L]=parseInt(c.metadata.hmtx.widths[L]*(1e3/c.metadata.head.unitsPerEm));f("<</Subtype/TrueType/Type/Font/ToUnicode "+E+" 0 R/BaseFont/"+Jd(c.fontName)+"/FontDescriptor "+D+" 0 R/Encoding/"+c.encoding+" /FirstChar 29 /LastChar 255 /Widths "+e.API.PDFObject.convert(c.metadata.hmtx.widths)+">>"),f("endobj"),c.isAlreadyPutted=!0}})(s)}]);var i=function(s){var l,c=s.text||"",f=s.x,d=s.y,p=s.options||{},g=s.mutex||{},b=g.pdfEscape,y=g.activeFontKey,M=g.fonts,E=y,D="",L=0,q="",$=M[E].encoding;if(M[E].encoding!=="Identity-H")return{text:c,x:f,y:d,options:p,mutex:g};for(q=c,E=y,Array.isArray(c)&&(q=c[0]),L=0;L<q.length;L+=1)M[E].metadata.hasOwnProperty("cmap")&&(l=M[E].metadata.cmap.unicode.codeMap[q[L].charCodeAt(0)]),l||q[L].charCodeAt(0)<256&&M[E].metadata.hasOwnProperty("Unicode")?D+=q[L]:D+="";var Y="";return parseInt(E.slice(1))<14||$==="WinAnsiEncoding"?Y=b(D,E).split("").map(function(ht){return ht.charCodeAt(0).toString(16)}).join(""):$==="Identity-H"&&(Y=n(D,M[E])),g.isHex=!0,{text:Y,x:f,y:d,options:p,mutex:g}};t.events.push(["postProcessText",function(s){var l=s.text||"",c=[],f={text:l,x:s.x,y:s.y,options:s.options,mutex:s.mutex};if(Array.isArray(l)){var d=0;for(d=0;d<l.length;d+=1)Array.isArray(l[d])&&l[d].length===3?c.push([i(Object.assign({},f,{text:l[d][0]})).text,l[d][1],l[d][2]]):c.push(i(Object.assign({},f,{text:l[d]})).text);s.text=c}else s.text=i(Object.assign({},f,{text:l})).text}])})(xn),(function(e){var t=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};e.existsFileInVFS=function(n){return t.call(this),this.internal.vFS[n]!==void 0},e.addFileToVFS=function(n,r){return t.call(this),this.internal.vFS[n]=r,this},e.getFileFromVFS=function(n){return t.call(this),this.internal.vFS[n]!==void 0?this.internal.vFS[n]:null}})(xn.API),(function(e){e.__bidiEngine__=e.prototype.__bidiEngine__=function(r){var i,s,l,c,f,d,p,g=t,b=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],y=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],M={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},E={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},D=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],L=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),q=!1,$=0;this.__bidiEngine__={};var Y=function(Q){var lt=Q.charCodeAt(),X=lt>>8,wt=E[X];return wt!==void 0?g[256*wt+(255&lt)]:X===252||X===253?"AL":L.test(X)?"L":X===8?"R":"N"},ht=function(Q){for(var lt,X=0;X<Q.length;X++){if((lt=Y(Q.charAt(X)))==="L")return!1;if(lt==="R")return!0}return!1},Mt=function(Q,lt,X,wt){var Tt,yt,J,ct,Bt=lt[wt];switch(Bt){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":q=!1;break;case"N":case"AN":break;case"EN":q&&(Bt="AN");break;case"AL":q=!0,Bt="R";break;case"WS":case"BN":Bt="N";break;case"CS":wt<1||wt+1>=lt.length||(Tt=X[wt-1])!=="EN"&&Tt!=="AN"||(yt=lt[wt+1])!=="EN"&&yt!=="AN"?Bt="N":q&&(yt="AN"),Bt=yt===Tt?yt:"N";break;case"ES":Bt=(Tt=wt>0?X[wt-1]:"B")==="EN"&&wt+1<lt.length&&lt[wt+1]==="EN"?"EN":"N";break;case"ET":if(wt>0&&X[wt-1]==="EN"){Bt="EN";break}if(q){Bt="N";break}for(J=wt+1,ct=lt.length;J<ct&&lt[J]==="ET";)J++;Bt=J<ct&&lt[J]==="EN"?"EN":"N";break;case"NSM":if(l&&!c){for(ct=lt.length,J=wt+1;J<ct&&lt[J]==="NSM";)J++;if(J<ct){var te=Q[wt],Z=te>=1425&&te<=2303||te===64286;if(Tt=lt[J],Z&&(Tt==="R"||Tt==="AL")){Bt="R";break}}}Bt=wt<1||(Tt=lt[wt-1])==="B"?"N":X[wt-1];break;case"B":q=!1,i=!0,Bt=$;break;case"S":s=!0,Bt="N"}return Bt},vt=function(Q,lt,X){var wt=Q.split("");return X&&bt(wt,X,{hiLevel:$}),wt.reverse(),lt&&lt.reverse(),wt.join("")},bt=function(Q,lt,X){var wt,Tt,yt,J,ct,Bt=-1,te=Q.length,Z=0,P=[],j=$?y:b,G=[];for(q=!1,i=!1,s=!1,Tt=0;Tt<te;Tt++)G[Tt]=Y(Q[Tt]);for(yt=0;yt<te;yt++){if(ct=Z,P[yt]=Mt(Q,G,P,yt),wt=240&(Z=j[ct][M[P[yt]]]),Z&=15,lt[yt]=J=j[Z][5],wt>0)if(wt===16){for(Tt=Bt;Tt<yt;Tt++)lt[Tt]=1;Bt=-1}else Bt=-1;if(j[Z][6])Bt===-1&&(Bt=yt);else if(Bt>-1){for(Tt=Bt;Tt<yt;Tt++)lt[Tt]=J;Bt=-1}G[yt]==="B"&&(lt[yt]=0),X.hiLevel|=J}s&&(function(ut,xt,St){for(var Ft=0;Ft<St;Ft++)if(ut[Ft]==="S"){xt[Ft]=$;for(var Rt=Ft-1;Rt>=0&&ut[Rt]==="WS";Rt--)xt[Rt]=$}})(G,lt,te)},rt=function(Q,lt,X,wt,Tt){if(!(Tt.hiLevel<Q)){if(Q===1&&$===1&&!i)return lt.reverse(),void(X&&X.reverse());for(var yt,J,ct,Bt,te=lt.length,Z=0;Z<te;){if(wt[Z]>=Q){for(ct=Z+1;ct<te&&wt[ct]>=Q;)ct++;for(Bt=Z,J=ct-1;Bt<J;Bt++,J--)yt=lt[Bt],lt[Bt]=lt[J],lt[J]=yt,X&&(yt=X[Bt],X[Bt]=X[J],X[J]=yt);Z=ct}Z++}}},Dt=function(Q,lt,X){var wt=Q.split(""),Tt={hiLevel:$};return X||(X=[]),bt(wt,X,Tt),(function(yt,J,ct){if(ct.hiLevel!==0&&p)for(var Bt,te=0;te<yt.length;te++)J[te]===1&&(Bt=D.indexOf(yt[te]))>=0&&(yt[te]=D[Bt+1])})(wt,X,Tt),rt(2,wt,lt,X,Tt),rt(1,wt,lt,X,Tt),wt.join("")};return this.__bidiEngine__.doBidiReorder=function(Q,lt,X){if((function(Tt,yt){if(yt)for(var J=0;J<Tt.length;J++)yt[J]=J;c===void 0&&(c=ht(Tt)),d===void 0&&(d=ht(Tt))})(Q,lt),l||!f||d)if(l&&f&&c^d)$=c?1:0,Q=vt(Q,lt,X);else if(!l&&f&&d)$=c?1:0,Q=Dt(Q,lt,X),Q=vt(Q,lt);else if(!l||c||f||d){if(l&&!f&&c^d)Q=vt(Q,lt),c?($=0,Q=Dt(Q,lt,X)):($=1,Q=Dt(Q,lt,X),Q=vt(Q,lt));else if(l&&c&&!f&&d)$=1,Q=Dt(Q,lt,X),Q=vt(Q,lt);else if(!l&&!f&&c^d){var wt=p;c?($=1,Q=Dt(Q,lt,X),$=0,p=!1,Q=Dt(Q,lt,X),p=wt):($=0,Q=Dt(Q,lt,X),Q=vt(Q,lt),$=1,p=!1,Q=Dt(Q,lt,X),p=wt,Q=vt(Q,lt))}}else $=0,Q=Dt(Q,lt,X);else $=c?1:0,Q=Dt(Q,lt,X);return Q},this.__bidiEngine__.setOptions=function(Q){Q&&(l=Q.isInputVisual,f=Q.isOutputVisual,c=Q.isInputRtl,d=Q.isOutputRtl,p=Q.isSymmetricSwapping)},this.__bidiEngine__.setOptions(r),this.__bidiEngine__};var t=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],n=new e.__bidiEngine__({isInputVisual:!0});e.API.events.push(["postProcessText",function(r){var i=r.text;r.x,r.y;var s=r.options||{};r.mutex,s.lang;var l=[];if(s.isInputVisual=typeof s.isInputVisual!="boolean"||s.isInputVisual,n.setOptions(s),Object.prototype.toString.call(i)==="[object Array]"){var c=0;for(l=[],c=0;c<i.length;c+=1)Object.prototype.toString.call(i[c])==="[object Array]"?l.push([n.doBidiReorder(i[c][0]),i[c][1],i[c][2]]):l.push([n.doBidiReorder(i[c])]);r.text=l}else r.text=n.doBidiReorder(i);n.setOptions({isInputVisual:!0})}])})(xn),xn.API.TTFFont=(function(){function e(t){var n;if(this.rawData=t,n=this.contents=new Nf(t),this.contents.pos=4,n.readString(4)==="ttcf")throw new Error("TTCF not supported.");n.pos=0,this.parse(),this.subset=new n8(this),this.registerTTF()}return e.open=function(t){return new e(t)},e.prototype.parse=function(){return this.directory=new H_(this.contents),this.head=new $_(this),this.name=new G_(this),this.cmap=new J4(this),this.toUnicode={},this.hhea=new Y_(this),this.maxp=new K_(this),this.hmtx=new J_(this),this.post=new W_(this),this.os2=new V_(this),this.loca=new e8(this),this.glyf=new Z_(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},e.prototype.registerTTF=function(){var t,n,r,i,s;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=(function(){var l,c,f,d;for(d=[],l=0,c=(f=this.bbox).length;l<c;l++)t=f[l],d.push(Math.round(t*this.scaleFactor));return d}).call(this),this.stemV=0,this.post.exists?(r=255&(i=this.post.italic_angle),32768&(n=i>>16)&&(n=-(1+(65535^n))),this.italicAngle=+(n+"."+r)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(s=this.familyClass)===1||s===2||s===3||s===4||s===5||s===7,this.isScript=this.familyClass===10,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),this.italicAngle!==0&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},e.prototype.characterToGlyph=function(t){var n;return((n=this.cmap.unicode)!=null?n.codeMap[t]:void 0)||0},e.prototype.widthOfGlyph=function(t){var n;return n=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(t).advance*n},e.prototype.widthOfString=function(t,n,r){var i,s,l,c;for(l=0,s=0,c=(t=""+t).length;0<=c?s<c:s>c;s=0<=c?++s:--s)i=t.charCodeAt(s),l+=this.widthOfGlyph(this.characterToGlyph(i))+r*(1e3/n)||0;return l*(n/1e3)},e.prototype.lineHeight=function(t,n){var r;return n==null&&(n=!1),r=n?this.lineGap:0,(this.ascender+r-this.decender)/1e3*t},e})();var Ac,Nf=(function(){function e(t){this.data=t??[],this.pos=0,this.length=this.data.length}return e.prototype.readByte=function(){return this.data[this.pos++]},e.prototype.writeByte=function(t){return this.data[this.pos++]=t},e.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},e.prototype.writeUInt32=function(t){return this.writeByte(t>>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(255&t)},e.prototype.readInt32=function(){var t;return(t=this.readUInt32())>=2147483648?t-4294967296:t},e.prototype.writeInt32=function(t){return t<0&&(t+=4294967296),this.writeUInt32(t)},e.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},e.prototype.writeUInt16=function(t){return this.writeByte(t>>8&255),this.writeByte(255&t)},e.prototype.readInt16=function(){var t;return(t=this.readUInt16())>=32768?t-65536:t},e.prototype.writeInt16=function(t){return t<0&&(t+=65536),this.writeUInt16(t)},e.prototype.readString=function(t){var n,r;for(r=[],n=0;0<=t?n<t:n>t;n=0<=t?++n:--n)r[n]=String.fromCharCode(this.readByte());return r.join("")},e.prototype.writeString=function(t){var n,r,i;for(i=[],n=0,r=t.length;0<=r?n<r:n>r;n=0<=r?++n:--n)i.push(this.writeByte(t.charCodeAt(n)));return i},e.prototype.readShort=function(){return this.readInt16()},e.prototype.writeShort=function(t){return this.writeInt16(t)},e.prototype.readLongLong=function(){var t,n,r,i,s,l,c,f;return t=this.readByte(),n=this.readByte(),r=this.readByte(),i=this.readByte(),s=this.readByte(),l=this.readByte(),c=this.readByte(),f=this.readByte(),128&t?-1*(72057594037927940*(255^t)+281474976710656*(255^n)+1099511627776*(255^r)+4294967296*(255^i)+16777216*(255^s)+65536*(255^l)+256*(255^c)+(255^f)+1):72057594037927940*t+281474976710656*n+1099511627776*r+4294967296*i+16777216*s+65536*l+256*c+f},e.prototype.writeLongLong=function(t){var n,r;return n=Math.floor(t/4294967296),r=4294967295&t,this.writeByte(n>>24&255),this.writeByte(n>>16&255),this.writeByte(n>>8&255),this.writeByte(255&n),this.writeByte(r>>24&255),this.writeByte(r>>16&255),this.writeByte(r>>8&255),this.writeByte(255&r)},e.prototype.readInt=function(){return this.readInt32()},e.prototype.writeInt=function(t){return this.writeInt32(t)},e.prototype.read=function(t){var n,r;for(n=[],r=0;0<=t?r<t:r>t;r=0<=t?++r:--r)n.push(this.readByte());return n},e.prototype.write=function(t){var n,r,i,s;for(s=[],r=0,i=t.length;r<i;r++)n=t[r],s.push(this.writeByte(n));return s},e})(),H_=(function(){var e;function t(n){var r,i,s;for(this.scalarType=n.readInt(),this.tableCount=n.readShort(),this.searchRange=n.readShort(),this.entrySelector=n.readShort(),this.rangeShift=n.readShort(),this.tables={},i=0,s=this.tableCount;0<=s?i<s:i>s;i=0<=s?++i:--i)r={tag:n.readString(4),checksum:n.readInt(),offset:n.readInt(),length:n.readInt()},this.tables[r.tag]=r}return t.prototype.encode=function(n){var r,i,s,l,c,f,d,p,g,b,y,M,E;for(E in y=Object.keys(n).length,f=Math.log(2),g=16*Math.floor(Math.log(y)/f),l=Math.floor(g/f),p=16*y-g,(i=new Nf).writeInt(this.scalarType),i.writeShort(y),i.writeShort(g),i.writeShort(l),i.writeShort(p),s=16*y,d=i.pos+s,c=null,M=[],n)for(b=n[E],i.writeString(E),i.writeInt(e(b)),i.writeInt(d),i.writeInt(b.length),M=M.concat(b),E==="head"&&(c=d),d+=b.length;d%4;)M.push(0),d++;return i.write(M),r=2981146554-e(i.data),i.pos=c+8,i.writeUInt32(r),i.data},e=function(n){var r,i,s,l;for(n=Z4.call(n);n.length%4;)n.push(0);for(s=new Nf(n),i=0,r=0,l=n.length;r<l;r=r+=4)i+=s.readUInt32();return 4294967295&i},t})(),q_={}.hasOwnProperty,ru=function(e,t){for(var n in t)q_.call(t,n)&&(e[n]=t[n]);function r(){this.constructor=e}return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};Ac=(function(){function e(t){var n;this.file=t,n=this.file.directory.tables[this.tag],this.exists=!!n,n&&(this.offset=n.offset,this.length=n.length,this.parse(this.file.contents))}return e.prototype.parse=function(){},e.prototype.encode=function(){},e.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},e})();var $_=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ru(e,Ac),e.prototype.tag="head",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.revision=t.readInt(),this.checkSumAdjustment=t.readInt(),this.magicNumber=t.readInt(),this.flags=t.readShort(),this.unitsPerEm=t.readShort(),this.created=t.readLongLong(),this.modified=t.readLongLong(),this.xMin=t.readShort(),this.yMin=t.readShort(),this.xMax=t.readShort(),this.yMax=t.readShort(),this.macStyle=t.readShort(),this.lowestRecPPEM=t.readShort(),this.fontDirectionHint=t.readShort(),this.indexToLocFormat=t.readShort(),this.glyphDataFormat=t.readShort()},e.prototype.encode=function(t){var n;return(n=new Nf).writeInt(this.version),n.writeInt(this.revision),n.writeInt(this.checkSumAdjustment),n.writeInt(this.magicNumber),n.writeShort(this.flags),n.writeShort(this.unitsPerEm),n.writeLongLong(this.created),n.writeLongLong(this.modified),n.writeShort(this.xMin),n.writeShort(this.yMin),n.writeShort(this.xMax),n.writeShort(this.yMax),n.writeShort(this.macStyle),n.writeShort(this.lowestRecPPEM),n.writeShort(this.fontDirectionHint),n.writeShort(t),n.writeShort(this.glyphDataFormat),n.data},e})(),gS=(function(){function e(t,n){var r,i,s,l,c,f,d,p,g,b,y,M,E,D,L,q,$;switch(this.platformID=t.readUInt16(),this.encodingID=t.readShort(),this.offset=n+t.readInt(),g=t.pos,t.pos=this.offset,this.format=t.readUInt16(),this.length=t.readUInt16(),this.language=t.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(f=0;f<256;++f)this.codeMap[f]=t.readByte();break;case 4:for(y=t.readUInt16(),b=y/2,t.pos+=6,s=(function(){var Y,ht;for(ht=[],f=Y=0;0<=b?Y<b:Y>b;f=0<=b?++Y:--Y)ht.push(t.readUInt16());return ht})(),t.pos+=2,E=(function(){var Y,ht;for(ht=[],f=Y=0;0<=b?Y<b:Y>b;f=0<=b?++Y:--Y)ht.push(t.readUInt16());return ht})(),d=(function(){var Y,ht;for(ht=[],f=Y=0;0<=b?Y<b:Y>b;f=0<=b?++Y:--Y)ht.push(t.readUInt16());return ht})(),p=(function(){var Y,ht;for(ht=[],f=Y=0;0<=b?Y<b:Y>b;f=0<=b?++Y:--Y)ht.push(t.readUInt16());return ht})(),i=(this.length-t.pos+this.offset)/2,c=(function(){var Y,ht;for(ht=[],f=Y=0;0<=i?Y<i:Y>i;f=0<=i?++Y:--Y)ht.push(t.readUInt16());return ht})(),f=L=0,$=s.length;L<$;f=++L)for(D=s[f],r=q=M=E[f];M<=D?q<=D:q>=D;r=M<=D?++q:--q)p[f]===0?l=r+d[f]:(l=c[p[f]/2+(r-M)-(b-f)]||0)!==0&&(l+=d[f]),this.codeMap[r]=65535&l}t.pos=g}return e.encode=function(t,n){var r,i,s,l,c,f,d,p,g,b,y,M,E,D,L,q,$,Y,ht,Mt,vt,bt,rt,Dt,Q,lt,X,wt,Tt,yt,J,ct,Bt,te,Z,P,j,G,ut,xt,St,Ft,Rt,Qt,ve,je;switch(wt=new Nf,l=Object.keys(t).sort(function(Pe,Ve){return Pe-Ve}),n){case"macroman":for(E=0,D=(function(){var Pe=[];for(M=0;M<256;++M)Pe.push(0);return Pe})(),q={0:0},s={},Tt=0,Bt=l.length;Tt<Bt;Tt++)q[Rt=t[i=l[Tt]]]==null&&(q[Rt]=++E),s[i]={old:t[i],new:q[t[i]]},D[i]=q[t[i]];return wt.writeUInt16(1),wt.writeUInt16(0),wt.writeUInt32(12),wt.writeUInt16(0),wt.writeUInt16(262),wt.writeUInt16(0),wt.write(D),{charMap:s,subtable:wt.data,maxGlyphID:E+1};case"unicode":for(lt=[],g=[],$=0,q={},r={},L=d=null,yt=0,te=l.length;yt<te;yt++)q[ht=t[i=l[yt]]]==null&&(q[ht]=++$),r[i]={old:ht,new:q[ht]},c=q[ht]-i,L!=null&&c===d||(L&&g.push(L),lt.push(i),d=c),L=i;for(L&&g.push(L),g.push(65535),lt.push(65535),Dt=2*(rt=lt.length),bt=2*Math.pow(Math.log(rt)/Math.LN2,2),b=Math.log(bt/2)/Math.LN2,vt=2*rt-bt,f=[],Mt=[],y=[],M=J=0,Z=lt.length;J<Z;M=++J){if(Q=lt[M],p=g[M],Q===65535){f.push(0),Mt.push(0);break}if(Q-(X=r[Q].new)>=32768)for(f.push(0),Mt.push(2*(y.length+rt-M)),i=ct=Q;Q<=p?ct<=p:ct>=p;i=Q<=p?++ct:--ct)y.push(r[i].new);else f.push(X-Q),Mt.push(0)}for(wt.writeUInt16(3),wt.writeUInt16(1),wt.writeUInt32(12),wt.writeUInt16(4),wt.writeUInt16(16+8*rt+2*y.length),wt.writeUInt16(0),wt.writeUInt16(Dt),wt.writeUInt16(bt),wt.writeUInt16(b),wt.writeUInt16(vt),St=0,P=g.length;St<P;St++)i=g[St],wt.writeUInt16(i);for(wt.writeUInt16(0),Ft=0,j=lt.length;Ft<j;Ft++)i=lt[Ft],wt.writeUInt16(i);for(Qt=0,G=f.length;Qt<G;Qt++)c=f[Qt],wt.writeUInt16(c);for(ve=0,ut=Mt.length;ve<ut;ve++)Y=Mt[ve],wt.writeUInt16(Y);for(je=0,xt=y.length;je<xt;je++)E=y[je],wt.writeUInt16(E);return{charMap:r,subtable:wt.data,maxGlyphID:$+1}}},e})(),J4=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ru(e,Ac),e.prototype.tag="cmap",e.prototype.parse=function(t){var n,r,i;for(t.pos=this.offset,this.version=t.readUInt16(),i=t.readUInt16(),this.tables=[],this.unicode=null,r=0;0<=i?r<i:r>i;r=0<=i?++r:--r)n=new gS(t,this.offset),this.tables.push(n),n.isUnicode&&this.unicode==null&&(this.unicode=n);return!0},e.encode=function(t,n){var r,i;return n==null&&(n="macroman"),r=gS.encode(t,n),(i=new Nf).writeUInt16(0),i.writeUInt16(1),r.table=i.data.concat(r.subtable),r},e})(),Y_=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ru(e,Ac),e.prototype.tag="hhea",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.ascender=t.readShort(),this.decender=t.readShort(),this.lineGap=t.readShort(),this.advanceWidthMax=t.readShort(),this.minLeftSideBearing=t.readShort(),this.minRightSideBearing=t.readShort(),this.xMaxExtent=t.readShort(),this.caretSlopeRise=t.readShort(),this.caretSlopeRun=t.readShort(),this.caretOffset=t.readShort(),t.pos+=8,this.metricDataFormat=t.readShort(),this.numberOfMetrics=t.readUInt16()},e})(),V_=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ru(e,Ac),e.prototype.tag="OS/2",e.prototype.parse=function(t){if(t.pos=this.offset,this.version=t.readUInt16(),this.averageCharWidth=t.readShort(),this.weightClass=t.readUInt16(),this.widthClass=t.readUInt16(),this.type=t.readShort(),this.ySubscriptXSize=t.readShort(),this.ySubscriptYSize=t.readShort(),this.ySubscriptXOffset=t.readShort(),this.ySubscriptYOffset=t.readShort(),this.ySuperscriptXSize=t.readShort(),this.ySuperscriptYSize=t.readShort(),this.ySuperscriptXOffset=t.readShort(),this.ySuperscriptYOffset=t.readShort(),this.yStrikeoutSize=t.readShort(),this.yStrikeoutPosition=t.readShort(),this.familyClass=t.readShort(),this.panose=(function(){var n,r;for(r=[],n=0;n<10;++n)r.push(t.readByte());return r})(),this.charRange=(function(){var n,r;for(r=[],n=0;n<4;++n)r.push(t.readInt());return r})(),this.vendorID=t.readString(4),this.selection=t.readShort(),this.firstCharIndex=t.readShort(),this.lastCharIndex=t.readShort(),this.version>0&&(this.ascent=t.readShort(),this.descent=t.readShort(),this.lineGap=t.readShort(),this.winAscent=t.readShort(),this.winDescent=t.readShort(),this.codePageRange=(function(){var n,r;for(r=[],n=0;n<2;n=++n)r.push(t.readInt());return r})(),this.version>1))return this.xHeight=t.readShort(),this.capHeight=t.readShort(),this.defaultChar=t.readShort(),this.breakChar=t.readShort(),this.maxContext=t.readShort()},e})(),W_=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ru(e,Ac),e.prototype.tag="post",e.prototype.parse=function(t){var n,r,i;switch(t.pos=this.offset,this.format=t.readInt(),this.italicAngle=t.readInt(),this.underlinePosition=t.readShort(),this.underlineThickness=t.readShort(),this.isFixedPitch=t.readInt(),this.minMemType42=t.readInt(),this.maxMemType42=t.readInt(),this.minMemType1=t.readInt(),this.maxMemType1=t.readInt(),this.format){case 65536:case 196608:break;case 131072:var s;for(r=t.readUInt16(),this.glyphNameIndex=[],s=0;0<=r?s<r:s>r;s=0<=r?++s:--s)this.glyphNameIndex.push(t.readUInt16());for(this.names=[],i=[];t.pos<this.offset+this.length;)n=t.readByte(),i.push(this.names.push(t.readString(n)));return i;case 151552:return r=t.readUInt16(),this.offsets=t.read(r);case 262144:return this.map=(function(){var l,c,f;for(f=[],s=l=0,c=this.file.maxp.numGlyphs;0<=c?l<c:l>c;s=0<=c?++l:--l)f.push(t.readUInt32());return f}).call(this)}},e})(),X_=function(e,t){this.raw=e,this.length=e.length,this.platformID=t.platformID,this.encodingID=t.encodingID,this.languageID=t.languageID},G_=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ru(e,Ac),e.prototype.tag="name",e.prototype.parse=function(t){var n,r,i,s,l,c,f,d,p,g,b;for(t.pos=this.offset,t.readShort(),n=t.readShort(),c=t.readShort(),r=[],s=0;0<=n?s<n:s>n;s=0<=n?++s:--s)r.push({platformID:t.readShort(),encodingID:t.readShort(),languageID:t.readShort(),nameID:t.readShort(),length:t.readShort(),offset:this.offset+c+t.readShort()});for(f={},s=p=0,g=r.length;p<g;s=++p)i=r[s],t.pos=i.offset,d=t.readString(i.length),l=new X_(d,i),f[b=i.nameID]==null&&(f[b]=[]),f[i.nameID].push(l);this.strings=f,this.copyright=f[0],this.fontFamily=f[1],this.fontSubfamily=f[2],this.uniqueSubfamily=f[3],this.fontName=f[4],this.version=f[5];try{this.postscriptName=f[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch{this.postscriptName=f[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=f[7],this.manufacturer=f[8],this.designer=f[9],this.description=f[10],this.vendorUrl=f[11],this.designerUrl=f[12],this.license=f[13],this.licenseUrl=f[14],this.preferredFamily=f[15],this.preferredSubfamily=f[17],this.compatibleFull=f[18],this.sampleText=f[19]},e})(),K_=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ru(e,Ac),e.prototype.tag="maxp",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.numGlyphs=t.readUInt16(),this.maxPoints=t.readUInt16(),this.maxContours=t.readUInt16(),this.maxCompositePoints=t.readUInt16(),this.maxComponentContours=t.readUInt16(),this.maxZones=t.readUInt16(),this.maxTwilightPoints=t.readUInt16(),this.maxStorage=t.readUInt16(),this.maxFunctionDefs=t.readUInt16(),this.maxInstructionDefs=t.readUInt16(),this.maxStackElements=t.readUInt16(),this.maxSizeOfInstructions=t.readUInt16(),this.maxComponentElements=t.readUInt16(),this.maxComponentDepth=t.readUInt16()},e})(),J_=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ru(e,Ac),e.prototype.tag="hmtx",e.prototype.parse=function(t){var n,r,i,s,l,c,f;for(t.pos=this.offset,this.metrics=[],n=0,c=this.file.hhea.numberOfMetrics;0<=c?n<c:n>c;n=0<=c?++n:--n)this.metrics.push({advance:t.readUInt16(),lsb:t.readInt16()});for(i=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=(function(){var d,p;for(p=[],n=d=0;0<=i?d<i:d>i;n=0<=i?++d:--d)p.push(t.readInt16());return p})(),this.widths=(function(){var d,p,g,b;for(b=[],d=0,p=(g=this.metrics).length;d<p;d++)s=g[d],b.push(s.advance);return b}).call(this),r=this.widths[this.widths.length-1],f=[],n=l=0;0<=i?l<i:l>i;n=0<=i?++l:--l)f.push(this.widths.push(r));return f},e.prototype.forGlyph=function(t){return t in this.metrics?this.metrics[t]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[t-this.metrics.length]}},e})(),Z4=[].slice,Z_=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ru(e,Ac),e.prototype.tag="glyf",e.prototype.parse=function(){return this.cache={}},e.prototype.glyphFor=function(t){var n,r,i,s,l,c,f,d,p,g;return t in this.cache?this.cache[t]:(s=this.file.loca,n=this.file.contents,r=s.indexOf(t),(i=s.lengthOf(t))===0?this.cache[t]=null:(n.pos=this.offset+r,l=(c=new Nf(n.read(i))).readShort(),d=c.readShort(),g=c.readShort(),f=c.readShort(),p=c.readShort(),this.cache[t]=l===-1?new t8(c,d,g,f,p):new Q_(c,l,d,g,f,p),this.cache[t]))},e.prototype.encode=function(t,n,r){var i,s,l,c,f;for(l=[],s=[],c=0,f=n.length;c<f;c++)i=t[n[c]],s.push(l.length),i&&(l=l.concat(i.encode(r)));return s.push(l.length),{table:l,offsets:s}},e})(),Q_=(function(){function e(t,n,r,i,s,l){this.raw=t,this.numberOfContours=n,this.xMin=r,this.yMin=i,this.xMax=s,this.yMax=l,this.compound=!1}return e.prototype.encode=function(){return this.raw.data},e})(),t8=(function(){function e(t,n,r,i,s){var l,c;for(this.raw=t,this.xMin=n,this.yMin=r,this.xMax=i,this.yMax=s,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],l=this.raw;c=l.readShort(),this.glyphOffsets.push(l.pos),this.glyphIDs.push(l.readUInt16()),32&c;)l.pos+=1&c?4:2,128&c?l.pos+=8:64&c?l.pos+=4:8&c&&(l.pos+=2)}return e.prototype.encode=function(){var t,n,r;for(n=new Nf(Z4.call(this.raw.data)),t=0,r=this.glyphIDs.length;t<r;++t)n.pos=this.glyphOffsets[t];return n.data},e})(),e8=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ru(e,Ac),e.prototype.tag="loca",e.prototype.parse=function(t){var n,r;return t.pos=this.offset,n=this.file.head.indexToLocFormat,this.offsets=n===0?(function(){var i,s;for(s=[],r=0,i=this.length;r<i;r+=2)s.push(2*t.readUInt16());return s}).call(this):(function(){var i,s;for(s=[],r=0,i=this.length;r<i;r+=4)s.push(t.readUInt32());return s}).call(this)},e.prototype.indexOf=function(t){return this.offsets[t]},e.prototype.lengthOf=function(t){return this.offsets[t+1]-this.offsets[t]},e.prototype.encode=function(t,n){for(var r=new Uint32Array(this.offsets.length),i=0,s=0,l=0;l<r.length;++l)if(r[l]=i,s<n.length&&n[s]==l){++s,r[l]=i;var c=this.offsets[l],f=this.offsets[l+1]-c;f>0&&(i+=f)}for(var d=new Array(4*r.length),p=0;p<r.length;++p)d[4*p+3]=255&r[p],d[4*p+2]=(65280&r[p])>>8,d[4*p+1]=(16711680&r[p])>>16,d[4*p]=(4278190080&r[p])>>24;return d},e})(),n8=(function(){function e(t){this.font=t,this.subset={},this.unicodes={},this.next=33}return e.prototype.generateCmap=function(){var t,n,r,i,s;for(n in i=this.font.cmap.tables[0].codeMap,t={},s=this.subset)r=s[n],t[n]=i[r];return t},e.prototype.glyphsFor=function(t){var n,r,i,s,l,c,f;for(i={},l=0,c=t.length;l<c;l++)i[s=t[l]]=this.font.glyf.glyphFor(s);for(s in n=[],i)(r=i[s])!=null&&r.compound&&n.push.apply(n,r.glyphIDs);if(n.length>0)for(s in f=this.glyphsFor(n))r=f[s],i[s]=r;return i},e.prototype.encode=function(t,n){var r,i,s,l,c,f,d,p,g,b,y,M,E,D,L;for(i in r=J4.encode(this.generateCmap(),"unicode"),l=this.glyphsFor(t),y={0:0},L=r.charMap)y[(f=L[i]).old]=f.new;for(M in b=r.maxGlyphID,l)M in y||(y[M]=b++);return p=(function(q){var $,Y;for($ in Y={},q)Y[q[$]]=$;return Y})(y),g=Object.keys(p).sort(function(q,$){return q-$}),E=(function(){var q,$,Y;for(Y=[],q=0,$=g.length;q<$;q++)c=g[q],Y.push(p[c]);return Y})(),s=this.font.glyf.encode(l,E,y),d=this.font.loca.encode(s.offsets,E),D={cmap:this.font.cmap.raw(),glyf:s.table,loca:d,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(n)},this.font.os2.exists&&(D["OS/2"]=this.font.os2.raw()),this.font.directory.encode(D)},e})();xn.API.PDFObject=(function(){var e;function t(){}return e=function(n,r){return(Array(r+1).join("0")+n).slice(-r)},t.convert=function(n){var r,i,s,l;if(Array.isArray(n))return"["+(function(){var c,f,d;for(d=[],c=0,f=n.length;c<f;c++)r=n[c],d.push(t.convert(r));return d})().join(" ")+"]";if(typeof n=="string")return"/"+n;if(n?.isString)return"("+n+")";if(n instanceof Date)return"(D:"+e(n.getUTCFullYear(),4)+e(n.getUTCMonth(),2)+e(n.getUTCDate(),2)+e(n.getUTCHours(),2)+e(n.getUTCMinutes(),2)+e(n.getUTCSeconds(),2)+"Z)";if({}.toString.call(n)==="[object Object]"){for(i in s=["<<"],n)l=n[i],s.push("/"+i+" "+t.convert(l));return s.push(">>"),s.join(`
86
+ `)}return""+n},t})();const r8=new Set(["point","polygon","polyline","rectangle","ellipse","arrow","compass","numbering","image"]);function yS(e){return r8.has(e.anchor.type)}function Zm(e,t){if(e.anchor.type!=="linked")return e.anchor;const{pinId:n}=e.anchor,r=t.find(i=>i.id===n);return!r||r.anchor.type==="linked"?null:r.anchor}function G2(e,t){if(e.anchor.type!=="linked")return e;const{pinId:n}=e.anchor,r=t.find(i=>i.id===n);return r&&r.anchor.type!=="linked"?r:null}function Z5(e,t){return t.filter(n=>n.anchor.type==="linked"&&n.anchor.pinId===e).map(n=>n.id)}function i8(e,t){return new Set([e,...Z5(e,t)])}const o8="1.18.2",Wa=["#FBD710","#F0462F","#FF8D28","#4FD553","#00C0E8","#0088FF","#E246A1","#FFFFFF","#A0522D","#888888","#000000"],s8="small",a8={small:{maxLogicalImageSize:1500,upscaleSmallImagesToLogicalSize:!0,minZoom:.25,maxZoom:20,zoomWheelFactor:1.07,zoomPrecision:3,contourScale:1.25},medium:{maxLogicalImageSize:1800,upscaleSmallImagesToLogicalSize:!0,minZoom:.25,maxZoom:20,zoomWheelFactor:1.08,zoomPrecision:3,contourScale:1.8},large:{maxLogicalImageSize:2400,upscaleSmallImagesToLogicalSize:!0,minZoom:.25,maxZoom:20,zoomWheelFactor:1.1,zoomPrecision:3,contourScale:2.4},xlarge:{maxLogicalImageSize:3200,upscaleSmallImagesToLogicalSize:!0,minZoom:.2,maxZoom:24,zoomWheelFactor:1.12,zoomPrecision:3,contourScale:3}},Mh=a8[s8],K2=Mh.maxLogicalImageSize,Qm=Mh.minZoom,tg=Mh.maxZoom,bS=Mh.zoomWheelFactor,eg=Mh.zoomPrecision,hi=Mh.contourScale,Q5=1/1.25,Q4=hi*Q5,tA=280*hi,J2=100*hi,xS=12*hi,vS=12*hi,hp=3*hi,Ng=1*hi,wS=1*hi,SS=2*hi,kS=1*hi,AS="rgba(0,0,0,0.45)",eA=2.5*hi,Wf=2.5*hi,ml=.25,Bu=4,K0=.25,tb=1,l8=.5,c8=.6,ed="solid",Fp="filled",u8="44",Zf=[5*hi,3*hi],Z2=4*hi,nA=60*hi,Va=20,MS=10,Q2="iso";function ng(e){return e.toString().padStart(2,"0")}function Zd(e=new Date,t=Q2){const n=e.getFullYear(),r=ng(e.getMonth()+1),i=ng(e.getDate()),s=ng(e.getHours()),l=ng(e.getMinutes());return t==="ua_full"?`${i}.${r}.${n} ${s}:${l}`:`${n}-${r}-${i} ${s}:${l}`}const bc="#E63946",rA=3*hi,t5=2*hi,e5=7*hi,iA=0,$g=1.4,f8="image/png,image/jpeg,image/svg+xml,image/webp,image/gif,image/avif,image/bmp",d8=["PNG","JPG","SVG","WebP","GIF","AVIF","BMP"],h8=2,p8=40,m8=4,g8=48,y8="blur",b8=.5,x8=.05,rg=12,Vy=200*hi,uf=16,oA=10*hi,v8=.1,w8="#ffffff",S8="#000000",Wy="<p>Текст</p>",n5=6,k8=5,Yg=1,CS=4,A8=18;function ih(){return typeof navigator>"u"?"Ctrl+V":/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"⌘+V":"Ctrl+V"}const M8=600;function bd(e){return typeof e!="number"||!Number.isFinite(e)?tb:Math.min(Bu,Math.max(ml,e))}function ES(e,t){return bd(e.strokeWidthScale??bd(t))}function J0(e){return bd(e).toFixed(2).replace(/\.?0+$/,"")}function sA(e){const t=1+(bd(e)-1)*l8;return Math.max(c8,t)}function aA(e){return e.type!=="text"}const lA=!1,cA="tyts-app-settings",r5={fontId:"road-ui",strokeWidthScale:tb,calloutPanelCollapsed:!1,showToolTooltips:!0},C8="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif";function E8(e){return`${e==="uaf-sans"&&lA?"'UAF Sans'":"'Road UI'"}, ${C8}`}function T8(e){return e==="road-ui"?e:r5.fontId}function N8(){try{const e=localStorage.getItem(cA);if(!e)return{...r5};const t=JSON.parse(e);return{fontId:T8(t.fontId),strokeWidthScale:bd(t.strokeWidthScale),calloutPanelCollapsed:t.calloutPanelCollapsed===!0,showToolTooltips:t.showToolTooltips!==!1}}catch{}return{...r5}}function np(e){localStorage.setItem(cA,JSON.stringify(e))}function _8(){const[e,t]=I.useState(()=>N8()),n=I.useMemo(()=>E8(e.fontId),[e.fontId]);I.useEffect(()=>{document.documentElement.style.setProperty("--tyts-font-family",n),document.body.style.fontFamily=n},[n]);const r=I.useCallback(f=>{t(d=>{const p={...d,fontId:f};return np(p),p})},[]),i=I.useCallback(f=>{t(d=>{const p={...d,strokeWidthScale:bd(f)};return np(p),p})},[]),s=I.useCallback(f=>{t(d=>{const p={...d,showToolTooltips:f};return np(p),p})},[]),l=I.useCallback(f=>{t(d=>{if(d.calloutPanelCollapsed===f)return d;const p={...d,calloutPanelCollapsed:f};return np(p),p})},[]),c=I.useCallback(()=>{t(f=>{const d={...f,calloutPanelCollapsed:!f.calloutPanelCollapsed};return np(d),d})},[]);return{settings:e,fontFamily:n,setFontId:r,setStrokeWidthScale:i,setShowToolTooltips:s,setCalloutPanelCollapsed:l,toggleCalloutPanelCollapsed:c}}const D8=[{id:"road-ui",label:"Road UI"}];function L8({open:e,fontId:t,fontFamily:n,strokeWidthScale:r,showToolTooltips:i,onClose:s,onFontIdChange:l,onStrokeWidthScaleChange:c,onShowToolTooltipsChange:f}){if(!e)return null;const d=(r-ml)/(Bu-ml)*100;return A.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"tyts-settings-title",style:{position:"fixed",inset:0,zIndex:5e3,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.55)"},onClick:s,children:A.jsxs("div",{onClick:p=>p.stopPropagation(),style:{width:"min(360px, calc(100vw - 32px))",background:"rgba(10,10,16,0.98)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:12,boxShadow:"0 16px 40px rgba(0,0,0,0.7)",padding:16,color:"#ddd",fontFamily:n},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:14},children:[A.jsx("h2",{id:"tyts-settings-title",style:{margin:0,fontSize:15,fontWeight:800,color:"#fff"},children:"Налаштування"}),A.jsx("button",{type:"button",onClick:s,style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.65)",cursor:"pointer",fontSize:20,lineHeight:1,padding:0},title:"Закрити","aria-label":"Закрити",children:"×"})]}),A.jsxs("fieldset",{style:{border:"none",margin:0,padding:0},children:[A.jsx("legend",{style:{fontSize:12,fontWeight:600,color:"rgba(255,255,255,0.75)",marginBottom:8},children:"Шрифт"}),A.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:D8.map(p=>A.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:8,cursor:"pointer",background:t===p.id?"rgba(255,255,255,0.08)":"transparent",border:`1px solid ${t===p.id?"rgba(255,255,255,0.2)":"rgba(255,255,255,0.08)"}`,fontFamily:p.id==="uaf-sans"?"'UAF Sans', sans-serif":"'Road UI', sans-serif",fontSize:14},children:[A.jsx("input",{type:"radio",name:"tyts-font",value:p.id,checked:t===p.id,onChange:()=>l(p.id)}),p.label]},p.id))})]}),A.jsxs("fieldset",{style:{border:"none",margin:"16px 0 0",padding:0},children:[A.jsx("legend",{style:{fontSize:12,fontWeight:600,color:"rgba(255,255,255,0.75)",marginBottom:8},children:"Товщина ліній"}),A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[A.jsx("input",{type:"range",min:ml,max:Bu,step:K0,value:r,"aria-label":"Товщина ліній",onChange:p=>c(Number(p.target.value)),className:"tyts-range",style:{flex:1,"--tyts-range-accent":bc,"--tyts-range-fill":`${d}%`}}),A.jsxs("span",{style:{minWidth:42,textAlign:"right",fontVariantNumeric:"tabular-nums",fontSize:13},children:["×",J0(r)]}),A.jsx("button",{type:"button",onClick:()=>c(tb),title:"Скинути товщину","aria-label":"Скинути товщину",style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.18)",borderRadius:6,color:"rgba(255,255,255,0.75)",cursor:"pointer",fontSize:12,padding:"4px 8px",fontFamily:"inherit"},children:"Скинути"})]}),A.jsx("p",{style:{margin:"8px 0 0",fontSize:11,lineHeight:1.4,color:"rgba(255,255,255,0.45)"},children:"Діє на контури, лінії-виноски й маркери. Обʼєкти з власною товщиною лишаються незмінними."})]}),A.jsxs("fieldset",{style:{border:"none",margin:"16px 0 0",padding:0},children:[A.jsx("legend",{style:{fontSize:12,fontWeight:600,color:"rgba(255,255,255,0.75)",marginBottom:8},children:"Підказки"}),A.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:8,cursor:"pointer",border:"1px solid rgba(255,255,255,0.08)",fontSize:14},children:[A.jsx("input",{type:"checkbox",checked:i,onChange:p=>f(p.target.checked),style:{accentColor:bc}}),"Показувати підказки на кнопках"]}),A.jsx("p",{style:{margin:"8px 0 0",fontSize:11,lineHeight:1.4,color:"rgba(255,255,255,0.45)"},children:"Назва інструмента й гаряча клавіша при наведенні на кнопку в панелі."})]})]})})}const uA=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],R8=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"];function O8(e){return(e.getDay()+6)%7}function Qf(e){return new Date(e.getFullYear(),e.getMonth(),1)}function i5(e,t){const n=e.getFullYear(),r=e.getMonth()+t,i=e.getDate(),s=new Date(n,r+1,0).getDate();return new Date(n,r,Math.min(i,s),e.getHours(),e.getMinutes(),0,0)}function TS(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function o5(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,Math.trunc(e))):t}function P8(e,t){const n=new Date(e,t,1),r=new Date(e,t+1,0).getDate(),i=O8(n),s=[];for(let l=0;l<i;l+=1)s.push({day:null,date:null});for(let l=1;l<=r;l+=1)s.push({day:l,date:new Date(e,t,l)});for(;s.length%7!==0;)s.push({day:null,date:null});for(;s.length<42;)s.push({day:null,date:null});return s}function j8(e){const t=Qf(e);return[i5(t,-1),t,i5(t,1)]}function I8(e){const t=e.getMonth(),n=uA[t];return t===0||t===11?`${n} ${e.getFullYear()}`:n}function s5(e,t,n){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),o5(t,0,23),o5(n,0,59),0,0)}function z8(e,t){return s5(t,e.getHours(),e.getMinutes())}function B8({monthDate:e,value:t,today:n,onSelectDay:r}){const i=e.getFullYear(),s=e.getMonth(),l=I.useMemo(()=>P8(i,s),[i,s]);return A.jsxs("div",{style:{minWidth:168,flex:"1 1 168px"},children:[A.jsx("div",{style:{textAlign:"center",fontSize:12,fontWeight:600,color:"#cfd3dc",marginBottom:6,textTransform:"capitalize"},children:I8(e)}),A.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2,marginBottom:4},children:R8.map(c=>A.jsx("div",{style:{textAlign:"center",fontSize:10,color:"rgba(255,255,255,0.45)",padding:"2px 0"},children:c},c))}),A.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2},children:l.map((c,f)=>{if(!c.date||c.day==null)return A.jsx("div",{style:{height:24}},`empty-${f}`);const d=TS(c.date,t),p=TS(c.date,n);return A.jsx("button",{type:"button",onClick:()=>r(c.date),style:{height:24,borderRadius:5,border:p&&!d?"1px solid rgba(230,57,70,0.7)":"1px solid transparent",background:d?"rgba(230,57,70,0.28)":"transparent",color:d?"#ffc2c8":"#ddd",fontSize:12,fontFamily:"inherit",cursor:"pointer",padding:0},children:c.day},`${i}-${s}-${c.day}`)})})]})}function NS({id:e,label:t,value:n,min:r,max:i,onChange:s}){const[l,c]=I.useState(null),f=l!==null,d=f?l:rp(n),p=b=>{const y=b.replace(/\D/g,"");if(y===""){c(null);return}const M=o5(Number(y),r,i);s(M),c(null)},g=b=>{const y=i-r+1,M=((n-r+b)%y+y)%y+r;s(M),f&&c(rp(M))};return A.jsxs("div",{style:{display:"inline-flex",alignItems:"stretch",height:30,borderRadius:6,border:f?"1px solid rgba(230,57,70,0.55)":"1px solid rgba(255,255,255,0.12)",background:"rgba(255,255,255,0.06)",overflow:"hidden"},children:[A.jsx("label",{htmlFor:e,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"},children:t}),A.jsx("input",{id:e,className:"tyts-time-input",type:"text",inputMode:"numeric",autoComplete:"off",spellCheck:!1,value:d,onFocus:()=>c(rp(n)),onBlur:()=>p(l??rp(n)),onChange:b=>{const y=b.target.value.replace(/\D/g,"").slice(0,2);c(y)},onKeyDown:b=>{b.key==="ArrowUp"?(b.preventDefault(),g(1)):b.key==="ArrowDown"?(b.preventDefault(),g(-1)):b.key==="Enter"&&(b.preventDefault(),p(l??rp(n)),b.target.blur())},onWheel:b=>{document.activeElement===b.currentTarget&&(b.preventDefault(),g(b.deltaY<0?1:-1))},style:{width:34,border:"none",outline:"none",background:"transparent",color:"#fff",textAlign:"center",fontFamily:"inherit",fontSize:13,fontVariantNumeric:"tabular-nums",fontWeight:600,padding:"0 4px"}}),A.jsxs("div",{style:{display:"flex",flexDirection:"column",borderLeft:"1px solid rgba(255,255,255,0.1)",width:20},children:[A.jsx("button",{type:"button",tabIndex:-1,title:`${t}: +1`,onMouseDown:b=>b.preventDefault(),onClick:()=>g(1),style:LS,children:A.jsx("i",{className:"bi bi-chevron-up",style:{fontSize:9,lineHeight:1},"aria-hidden":!0})}),A.jsx("button",{type:"button",tabIndex:-1,title:`${t}: -1`,onMouseDown:b=>b.preventDefault(),onClick:()=>g(-1),style:{...LS,borderTop:"1px solid rgba(255,255,255,0.1)"},children:A.jsx("i",{className:"bi bi-chevron-down",style:{fontSize:9,lineHeight:1},"aria-hidden":!0})})]})]})}function F8({year:e,selected:t,today:n,onSelectMonth:r}){return A.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(120px, 1fr))",gap:8,minWidth:400,marginBottom:12},children:uA.map((i,s)=>{const l=t.getFullYear()===e&&t.getMonth()===s,c=n.getFullYear()===e&&n.getMonth()===s;return A.jsx("button",{type:"button",onClick:()=>r(s),style:{textAlign:"center",textTransform:"capitalize",borderRadius:8,border:c&&!l?"1px solid rgba(230,57,70,0.7)":"1px solid rgba(255,255,255,0.1)",background:l?"rgba(230,57,70,0.28)":"rgba(255,255,255,0.04)",color:l?"#ffc2c8":"#ddd",fontFamily:"inherit",fontSize:13,fontWeight:600,padding:"12px 8px",cursor:"pointer"},children:i},i)})})}function U8({value:e,viewMonth:t,format:n,locked:r,onChange:i,onViewMonthChange:s,onFormatChange:l,onLockedChange:c,onInsert:f,onNow:d,onClose:p}){const g=I.useId(),b=I.useId(),y=I.useMemo(()=>new Date,[]),M=I.useMemo(()=>j8(t),[t]),E=Zd(e,n),[D,L]=I.useState(!1),[q,$]=I.useState(()=>t.getFullYear()),Y=D?q:t.getFullYear();I.useEffect(()=>{const bt=rt=>{if(rt.key==="Escape"){if(rt.preventDefault(),rt.stopPropagation(),D){L(!1);return}p()}};return window.addEventListener("keydown",bt,!0),()=>window.removeEventListener("keydown",bt,!0)},[p,D]);const ht=()=>{$(t.getFullYear()),L(!0)},Mt=bt=>{if(D){$(rt=>rt+bt);return}s(i5(t,bt))},vt=bt=>{s(Qf(new Date(q,bt,1))),L(!1)};return A.jsxs("div",{role:"dialog","aria-label":"Вибір дати та часу",onClick:bt=>bt.stopPropagation(),style:{background:"rgba(10,10,16,0.97)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:10,boxShadow:"0 12px 32px rgba(0,0,0,0.55)",padding:12,width:"max-content",maxWidth:"min(560px, calc(100vw - 24px))",zIndex:3200,color:"#ddd",fontFamily:"inherit"},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:10},children:[A.jsx("button",{type:"button",title:D?"Попередній рік":"Попередній місяць",onClick:()=>Mt(-1),style:DS,children:A.jsx("i",{className:"bi bi-chevron-left","aria-hidden":!0})}),A.jsx("button",{type:"button",title:D?"Закрити вибір місяця":"Показати всі місяці року",onClick:()=>{D?L(!1):ht()},style:{border:"none",background:"transparent",color:"#e8eaed",fontSize:15,fontWeight:700,fontFamily:"inherit",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"4px 10px",borderRadius:6,textDecoration:D?"underline":"none",textUnderlineOffset:3},children:Y}),A.jsx("button",{type:"button",title:D?"Наступний рік":"Наступний місяць",onClick:()=>Mt(1),style:DS,children:A.jsx("i",{className:"bi bi-chevron-right","aria-hidden":!0})})]}),D?A.jsx(F8,{year:q,selected:t,today:y,onSelectMonth:vt}):A.jsx("div",{style:{display:"flex",gap:12,flexWrap:"wrap",marginBottom:12},children:M.map(bt=>A.jsx(B8,{monthDate:bt,value:e,today:y,onSelectDay:rt=>i(z8(e,rt))},`${bt.getFullYear()}-${bt.getMonth()}`))}),A.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,marginBottom:10,paddingTop:8,borderTop:"1px solid rgba(255,255,255,0.08)"},children:[A.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("span",{style:{fontSize:12,color:"rgba(255,255,255,0.65)"},children:"Час"}),A.jsx(NS,{id:g,label:"Години",value:e.getHours(),min:0,max:23,onChange:bt=>i(s5(e,bt,e.getMinutes()))}),A.jsx("span",{style:{opacity:.6,fontWeight:600},children:":"}),A.jsx(NS,{id:b,label:"Хвилини",value:e.getMinutes(),min:0,max:59,onChange:bt=>i(s5(e,e.getHours(),bt))})]}),A.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[A.jsx("span",{style:{fontSize:12,color:"rgba(255,255,255,0.65)"},children:"Формат"}),A.jsx(_S,{active:n==="iso",label:"ISO",onClick:()=>l("iso")}),A.jsx(_S,{active:n==="ua_full",label:"UA",onClick:()=>l("ua_full")})]}),A.jsx(H8,{locked:r,onToggle:()=>c(!r)}),A.jsx("button",{type:"button",onClick:d,style:{...q8,marginLeft:"auto"},children:"Зараз"})]}),A.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:[A.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.55)",fontVariantNumeric:"tabular-nums"},children:E}),A.jsx("button",{type:"button",onClick:f,style:$8,children:"Вставити"})]})]})}function _S({active:e,label:t,onClick:n}){return A.jsx("button",{type:"button",onClick:n,style:{border:e?"1px solid rgba(230,57,70,0.55)":"1px solid rgba(255,255,255,0.12)",background:e?"rgba(230,57,70,0.18)":"rgba(255,255,255,0.04)",color:e?"#ffc2c8":"#ccc",borderRadius:6,height:30,boxSizing:"border-box",padding:"0 8px",fontSize:12,fontFamily:"inherit",fontWeight:600,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:t})}function H8({locked:e,onToggle:t}){const[n,r]=I.useState(!1),i=e?"Дата й час зафіксовані — основна кнопка «Дата/час» вставляє їх. Натисніть, щоб зняти фіксацію":"Зафіксувати дату й час: основна кнопка «Дата/час» вставлятиме їх замість поточного моменту";return A.jsxs("span",{style:{position:"relative",display:"inline-flex"},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[A.jsx("button",{type:"button",onClick:t,"aria-pressed":e,"aria-label":e?"Зняти фіксацію дати й часу":"Зафіксувати дату й час",style:{width:30,height:30,boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:6,border:e?"1px solid rgba(230,57,70,0.55)":"1px solid rgba(255,255,255,0.12)",background:e?"rgba(230,57,70,0.18)":"rgba(255,255,255,0.04)",color:e?"#ffc2c8":"#ccc",cursor:"pointer",padding:0},children:A.jsx("i",{className:`bi ${e?"bi-lock-fill":"bi-unlock"}`,style:{fontSize:14},"aria-hidden":!0})}),n&&A.jsx("span",{role:"tooltip",style:{position:"absolute",left:"50%",bottom:"100%",transform:"translateX(-50%)",marginBottom:6,padding:"6px 10px",background:"rgba(0,0,0,0.9)",color:"#fff",borderRadius:6,fontSize:12,width:"max-content",maxWidth:280,whiteSpace:"normal",textAlign:"center",zIndex:1e3,pointerEvents:"none",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"},children:i})]})}function rp(e){return e.toString().padStart(2,"0")}const DS={width:28,height:28,display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:6,border:"1px solid rgba(255,255,255,0.1)",background:"rgba(255,255,255,0.06)",color:"#ddd",cursor:"pointer"},LS={flex:1,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",color:"rgba(255,255,255,0.65)",padding:0,cursor:"pointer",minHeight:0},q8={borderRadius:6,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(255,255,255,0.06)",color:"#ddd",padding:"6px 12px",fontFamily:"inherit",fontSize:13,fontWeight:600,cursor:"pointer"},$8={borderRadius:6,border:"1px solid transparent",background:"linear-gradient(135deg, rgb(230, 57, 70), rgb(198, 43, 56))",color:"#fff",padding:"6px 14px",fontFamily:"inherit",fontSize:13,fontWeight:600,cursor:"pointer"},Y8=20,Xy=12,V8=12;function W8(e,t,n){if(e.length===0)return{};const i=tA,s=J2,l=Y8,c=Math.max(0,n-2*l),f=Math.max(1,Math.floor((c+Xy)/(s+Xy))),d={};return e.forEach((p,g)=>{const b=Math.floor(g/f),y=g%f;let M=t-l-i-b*(i+V8),E=l+y*(s+Xy);M=Math.max(l,Math.min(M,t-i-l)),E=Math.max(l,Math.min(E,n-s-l)),d[p]={x:M,y:E,width:i,height:s}}),d}function X8(e,t){const n=Math.min(K2/e,K2/t,Number.POSITIVE_INFINITY);return{w:Math.round(e*n),h:Math.round(t*n)}}function eb(e,t,n,r){const i=Math.max(1,n.width),s=Math.max(1,n.height);return{x:(e-n.x)*(r.w/i),y:(t-n.y)*(r.h/s)}}function RS(e,t,n){const r=(i,s)=>eb(i,s,t,n);switch(e.type){case"linked":return e;case"point":case"standalone":return{...e,...r(e.x,e.y)};case"text":{const i=r(e.x,e.y),s=Math.max(1,t.width),l=Math.max(1,t.height);return{...e,x:i.x,y:i.y,width:e.width*(n.w/s),height:e.height*(n.h/l),...e.point?{point:r(e.point.x,e.point.y)}:{}}}case"image":case"redact":case"rectangle":{const i=r(e.x,e.y),s=Math.max(1,t.width),l=Math.max(1,t.height);return{...e,x:i.x,y:i.y,width:e.width*(n.w/s),height:e.height*(n.h/l)}}case"ellipse":{const i=r(e.cx,e.cy),s=Math.max(1,t.width),l=Math.max(1,t.height);return{...e,cx:i.x,cy:i.y,rx:e.rx*(n.w/s),ry:e.ry*(n.h/l)}}case"compass":{const i=r(e.cx,e.cy),s=Math.max(1,t.width),l=Math.max(1,t.height),c=Math.min(n.w/s,n.h/l);return{...e,cx:i.x,cy:i.y,radius:e.radius*c}}case"polygon":case"polyline":return{...e,points:e.points.map(i=>r(i.x,i.y))};case"numbering":case"arrow":{const i=r(e.start.x,e.start.y),s=r(e.end.x,e.end.y);if(e.type==="numbering")return{...e,start:i,end:s};const l=r(e.control.x,e.control.y);return{...e,start:i,end:s,control:l}}default:return e}}function OS(e){switch(e.type){case"linked":return{x:0,y:0,w:0,h:0};case"point":case"standalone":return{x:e.x,y:e.y,w:0,h:0};case"text":case"image":case"redact":case"rectangle":return{x:e.x,y:e.y,w:e.width,h:e.height};case"ellipse":return{x:e.cx-e.rx,y:e.cy-e.ry,w:e.rx*2,h:e.ry*2};case"compass":return{x:e.cx-e.radius,y:e.cy-e.radius,w:e.radius*2,h:e.radius*2};case"polygon":case"polyline":{if(e.points.length===0)return{x:0,y:0,w:0,h:0};const t=e.points.map(s=>s.x),n=e.points.map(s=>s.y),r=Math.min(...t),i=Math.min(...n);return{x:r,y:i,w:Math.max(...t)-r,h:Math.max(...n)-i}}case"numbering":case"arrow":{const t=[e.start.x,e.end.x],n=[e.start.y,e.end.y];e.type==="arrow"&&(t.push(e.control.x),n.push(e.control.y));const r=Math.min(...t),i=Math.min(...n);return{x:r,y:i,w:Math.max(...t)-r,h:Math.max(...n)-i}}default:return e}}function G8(e,t){const n=e.x+e.w,r=e.y+e.h,i=t.x+t.w,s=t.y+t.h;return e.x<=i&&n>=t.x&&e.y<=s&&r>=t.y}function ig(e,t){return G8(e,{x:0,y:0,w:t.w,h:t.h})}function PS(e,t,n){const r=eb(e.x,e.y,t,n),i=Math.max(1,t.width),s=Math.max(1,t.height);return{x:r.x,y:r.y,width:e.width*(n.w/i),height:e.height*(n.h/s)}}function K8(e,t,n,r){const i=[],s={},l=new Set;for(const c of e){if(c.anchor.type==="linked")continue;const f=RS(c.anchor,n,r),d=t[c.id],p=d?PS(d,n,r):null;(ig(OS(f),r)||p!==null&&ig({x:p.x,y:p.y,w:p.width,h:p.height},r))&&l.add(c.id)}for(const c of e){if(c.anchor.type==="linked"&&!l.has(c.anchor.pinId))continue;const f=RS(c.anchor,n,r),d=OS(f),p=c.anchor.type==="linked"?!0:ig(d,r),g=t[c.id],b=g?PS(g,n,r):null,y=b?ig({x:b.x,y:b.y,w:b.width,h:b.height},r):!1;if(!p&&!y)continue;const M=c.leaderPoints?.map(E=>eb(E.x,E.y,n,r));i.push(M?{...c,anchor:f,leaderPoints:M}:{...c,anchor:f}),b&&(s[c.id]=b)}return{pins:i,cardPositions:s}}function a5(e){const n=(e||"").replace(/<br\s*\/?>/gi,`
87
+ `).replace(/<\/p>/gi,`
88
+ `).replace(/<\/div>/gi,`
89
+ `).replace(/<[^>]+>/g,"").split(`
90
+ `);for(;n.length>1&&n[n.length-1].trim()==="";)n.pop();return n}function fA(e,t){const n=t*$g;return Math.ceil(e*n+Yg*2)}function J8(e,t,n){const r=a5(e),i=n?.fontSize??Va,s=n5*2+Yg*2,l=Math.max(1,...r.map(d=>Math.ceil(t(d||" ")))),c=Math.max(24,l+s),f=Math.max(A8,fA(r.length,i));return{width:c,height:f}}const Z8=4e3,Q8=1;function dA(e,t){return e.b===t.b&&e.i===t.i&&e.u===t.u&&e.s===t.s&&e.fs===t.fs}function tD(e){e.querySelectorAll("script,style,iframe,object,embed,img,svg,link,video,audio,source").forEach(t=>t.remove()),e.querySelectorAll("*").forEach(t=>{for(const n of Array.from(t.attributes))n.name.toLowerCase().startsWith("on")&&t.removeAttribute(n.name)})}function eD(e){e.querySelectorAll("p,div,h1,h2,h3,h4,h5,h6,li,blockquote,pre").forEach(t=>{t.firstChild||t.appendChild(document.createElement("br"))})}function nD(e){return["width:100%",`font-size:${e.fontSize}px`,`line-height:${e.lineHeight}`,`font-family:${e.fontFamily}`,"direction:ltr","unicode-bidi:plaintext","text-align:left","white-space:pre-wrap","word-break:break-word","margin:0","padding:0","border:none"].join(";")}function rD(e){const{html:t,width:n,metrics:r}=e;if(typeof document>"u"||!document.body||!t||!(n>0))return null;const i=document.createElement("div");i.setAttribute("aria-hidden","true"),i.style.cssText=`position:absolute;left:-99999px;top:0;width:${n}px;visibility:hidden;pointer-events:none;`;const s=document.createElement("div");s.style.cssText=nD(e),s.innerHTML=t,tD(s),eD(s),i.appendChild(s),document.body.appendChild(i);try{const l=s.getBoundingClientRect();if(!(l.height>0))return null;const c=new Map,f=L=>{const q=c.get(L);if(q)return q;const $=getComputedStyle(L),Y=Number.parseFloat($.fontSize);let ht=!1,Mt=!1;for(let bt=L;bt;bt=bt.parentElement){const rt=getComputedStyle(bt).textDecorationLine||"";if(rt.includes("underline")&&(ht=!0),rt.includes("line-through")&&(Mt=!0),bt===s)break}const vt={b:(Number.parseInt($.fontWeight,10)||400)>=600,i:$.fontStyle==="italic"||$.fontStyle.startsWith("oblique"),u:ht,s:Mt,fs:Number.isFinite(Y)?Y:e.fontSize};return c.set(L,vt),vt},d=[];let p=null,g=null,b=0;const y=e.maxDomChars??Z8,M=document.createRange(),E=document.createTreeWalker(s,NodeFilter.SHOW_TEXT);let D=E.nextNode();for(;D;){const L=D.textContent??"";if(b+=L.length,b>y)return null;const q=D.parentElement,$=f(q??s);for(let Y=0;Y<L.length;Y+=1){const ht=L[Y];if(ht===`
91
+ `||ht==="\r")continue;M.setStart(D,Y),M.setEnd(D,Y+1);const Mt=M.getClientRects()[0];if(!Mt)continue;const vt=Mt.top-l.top+Mt.height*r.ascentRatio($);(!p||Math.abs(p.baseline-vt)>Q8)&&(p={runs:[],baseline:vt},d.push(p),g=null),(!g||!dA(g,$))&&(g={...$,text:"",x:Mt.left-l.left},p.runs.push(g)),g.text+=ht}D=E.nextNode()}return d.length===0?null:{lines:d,height:l.height,fromDom:!0}}finally{i.remove()}}function iD(e,t){if(typeof document>"u")return[];const n=document.createElement("div");let r=e;r=r.replace(/<br\s*\/?>/gi,`
92
+ `),r=r.replace(/<p[^>]*>/gi,""),r=r.replace(/<\/p>/gi,`
93
+ `),r=r.replace(/<div[^>]*>/gi,""),r=r.replace(/<\/div>/gi,`
94
+ `),n.innerHTML=r;const i=[],s=(l,c,f,d,p,g)=>{if(l.nodeType===Node.TEXT_NODE){l.textContent&&i.push({text:l.textContent,b:c,i:f,u:d,s:p,fs:g});return}if(l.nodeType!==Node.ELEMENT_NODE)return;const b=l,y=b.style||{},M=c||b.tagName==="B"||b.tagName==="STRONG"||y.fontWeight==="bold"||Number.parseInt(y.fontWeight||"0",10)>=600,E=f||b.tagName==="I"||b.tagName==="EM"||y.fontStyle==="italic",D=typeof y.textDecoration=="string"?y.textDecoration:"",L=d||b.tagName==="U"||D.includes("underline"),q=p||b.tagName==="S"||b.tagName==="STRIKE"||D.includes("line-through"),$=y.fontSize?Number.parseFloat(y.fontSize):Number.NaN,Y=Number.isFinite($)?$:g;for(const ht of Array.from(b.childNodes))s(ht,M,E,L,q,Y)};for(const l of Array.from(n.childNodes))s(l,!1,!1,!1,!1,t);return i}function oD(e){const{width:t,fontSize:n,lineHeight:r,metrics:i}=e,s=iD(e.html,n),l=[];for(const y of s)for(const M of y.text.split(/([ \n])/))M&&l.push({...y,text:M});const c=[];let f=[],d=0;const p=()=>{c.push(f),f=[],d=0};for(const y of l){if(y.text===`
95
+ `){p();continue}const M=i.measure(y.text,y);if(y.text===" "){f.push(y),d+=M;continue}if(d+M>t&&f.length>0){for(;f.length>0&&f[f.length-1].text===" ";)f.pop();p(),f=[y],d=M;continue}f.push(y),d+=M}f.length>0&&p();const g=[];let b=0;for(const y of c){const M=y.reduce((ht,Mt)=>Math.max(ht,Mt.fs),n),E={b:!1,i:!1,u:!1,s:!1,fs:M},D=M*r,L=i.contentHeight(E),q=b+(D-L)/2+L*i.ascentRatio(E),$=[];let Y=0;for(const ht of y){const Mt=$[$.length-1];Mt&&dA(Mt,ht)?Mt.text+=ht.text:$.push({...ht,x:Y}),Y+=i.measure(ht.text,ht)}g.push({runs:$,baseline:q}),b+=D}return{lines:g,height:b,fromDom:!1}}function sD(e){return rD(e)??oD(e)}function aD(e,t,n){const r=e.width/2,i=e.height/2,s=Math.abs(Math.cos(t)),l=Math.abs(Math.sin(t));if(s>1e-9){const d=(r+n)/s;if(d*l<=i)return d}if(l>1e-9){const d=(i+n)/l;if(d*s<=r)return d}const c=s*r+l*i,f=r*r+i*i-n*n;return c+Math.sqrt(Math.max(0,c*c-f))}function hA(e,t,n,r=oA){const i=aD(n,t,r);return{x:e.x+Math.cos(t)*i-n.width/2,y:e.y+Math.sin(t)*i-n.height/2}}function lD(e,t,n,r=oA){const i=Math.atan2(t.y-e.y,t.x-e.x);return hA(e,i,n,r)}function cD(e,t,n){const r=n.x+n.width/2,i=n.y+n.height/2,s=e-r,l=t-i,c=n.width/2/Math.abs(s||.001),f=n.height/2/Math.abs(l||.001),d=Math.min(c,f);return{x:r+s*d,y:i+l*d}}function Z0(e,t,n,r,i,s){const l=i-n,c=s-r,f=l*l+c*c;if(f===0)return{x:n,y:r,dist2:(e-n)**2+(t-r)**2};let d=((e-n)*l+(t-r)*c)/f;d=Math.max(0,Math.min(1,d));const p=n+d*l,g=r+d*c;return{x:p,y:g,dist2:(e-p)**2+(t-g)**2}}function uD(e,t,n){if(e.length===0)return{x:t,y:n};if(e.length===1)return{x:e[0].x,y:e[0].y};let r={x:e[0].x,y:e[0].y,dist2:1/0};for(let i=0;i<e.length;i++){const s=e[i],l=e[(i+1)%e.length],c=Z0(t,n,s.x,s.y,l.x,l.y);c.dist2<r.dist2&&(r=c)}return{x:r.x,y:r.y}}function fD(e,t,n){if(e.length===0)return{x:t,y:n};if(e.length===1)return{x:e[0].x,y:e[0].y};let r={x:e[0].x,y:e[0].y,dist2:1/0};for(let i=0;i<e.length-1;i++){const s=e[i],l=e[i+1],c=Z0(t,n,s.x,s.y,l.x,l.y);c.dist2<r.dist2&&(r=c)}return{x:r.x,y:r.y}}function dD(e,t,n,r,i){let l={x:e.x,y:e.y,dist2:1/0},c=e;for(let f=1;f<=24;f+=1){const d=f/24,p=1-d,g={x:p*p*e.x+2*p*d*t.x+d*d*n.x,y:p*p*e.y+2*p*d*t.y+d*d*n.y},b=Z0(r,i,c.x,c.y,g.x,g.y);b.dist2<l.dist2&&(l=b),c=g}return{x:l.x,y:l.y}}function pA(e,t,n){const r=Math.cos(-n),i=Math.sin(-n);return{x:e*r-t*i,y:e*i+t*r}}function mA(e,t,n){const r=Math.cos(n),i=Math.sin(n);return{x:e*r-t*i,y:e*i+t*r}}function Gy(e,t,n,r=0){const{x:i,y:s,width:l,height:c}=e,f=i+l/2,d=s+c/2,p=r*Math.PI/180,g=pA(t-f,n-d,p),b=l/2,y=c/2,M=[[[-b,-y],[b,-y]],[[b,-y],[b,y]],[[b,y],[-b,y]],[[-b,y],[-b,-y]]];let E={x:0,y:0,dist2:1/0};for(const[L,q]of M){const $=Z0(g.x,g.y,L[0],L[1],q[0],q[1]);$.dist2<E.dist2&&(E=$)}const D=mA(E.x,E.y,p);return{x:f+D.x,y:d+D.y}}function jS(e,t,n,r=0){const{cx:i,cy:s,rx:l,ry:c}=e;if(l<=0||c<=0)return{x:i,y:s};const f=r*Math.PI/180,d=pA(t-i,n-s,f),p=Math.atan2(d.y*l,d.x*c),g=l*Math.cos(p),b=c*Math.sin(p),y=mA(g,b,f);return{x:i+y.x,y:s+y.y}}function hD(e,t){const n=t.x+t.width/2,r=t.y+t.height/2;return e.type==="point"?{x:e.x,y:e.y}:e.type==="standalone"?{x:e.x,y:e.y}:e.type==="polygon"?uD(e.points,n,r):e.type==="polyline"?fD(e.points,n,r):e.type==="arrow"?dD(e.start,e.control,e.end,n,r):e.type==="rectangle"?Gy(e,n,r,e.rotation??0):e.type==="image"||e.type==="redact"?Gy(e,n,r):e.type==="ellipse"?jS(e,n,r,e.rotation??0):e.type==="compass"?jS({cx:e.cx,cy:e.cy,rx:e.radius,ry:e.radius},n,r,e.rotation??0):{x:n,y:r}}function _g(e,t,n=[]){const r=(Array.isArray(n)?n:[]).filter(f=>!!f&&Number.isFinite(f.x)&&Number.isFinite(f.y)),i=r[0],s=hD(e,i?{x:i.x,y:i.y,width:0,height:0}:t),l=r.length>0?r[r.length-1]:s,c=cD(l.x,l.y,t);return[s,...r,c]}function pD(e){return e.map((t,n)=>`${n===0?"M":"L"} ${t.x} ${t.y}`).join(" ")}function mD(e){const t=[];for(let n=0;n<e.length-1;n+=1)t.push({x:(e[n].x+e[n+1].x)/2,y:(e[n].y+e[n+1].y)/2});return t}function og(e,t,n,r,i,s,l,c){const f=(n-e)*(s-t)-(r-t)*(i-e),d=(n-e)*(c-t)-(r-t)*(l-e),p=(l-i)*(t-s)-(c-s)*(e-i),g=(l-i)*(r-s)-(c-s)*(n-i);return(f>0!=d>0||f===0||d===0)&&(p>0!=g>0||p===0||g===0)}function gD(e,t,n){const r=n.x+n.width,i=n.y+n.height,s=l=>l.x>=n.x&&l.x<=r&&l.y>=n.y&&l.y<=i;return s(e)||s(t)?!0:og(e.x,e.y,t.x,t.y,n.x,n.y,r,n.y)||og(e.x,e.y,t.x,t.y,r,n.y,r,i)||og(e.x,e.y,t.x,t.y,r,i,n.x,i)||og(e.x,e.y,t.x,t.y,n.x,i,n.x,n.y)}function yD(e,t){for(let n=1;n<e.length;n+=1)if(gD(e[n-1],e[n],t))return!0;return!1}function bD(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Vg(e){const{card:t,panel:n,gap:r,bounds:i,leader:s,margin:l}=e,c=ht=>Math.max(0,Math.min(ht,i.w-n.w)),f=ht=>Math.max(0,Math.min(ht,i.h-n.h)),d=c(t.x+(t.width-n.w)/2),p=f(t.y-n.h-r),g=f(t.y+t.height+r),b=t.y+t.height/2<i.h/2,y={x:d,y:b?g:p,above:!b};if(!s||s.length<2)return y;const M=l?.left??0,E=l?.right??0,D=l?.top??0,L=l?.bottom??0,q=(ht,Mt)=>{const vt={x:ht-M,y:Mt-D,width:n.w+M+E,height:n.h+D+L};return bD(vt,t)||yD(s,vt)},$=b?[{y:g,above:!1},{y:p,above:!0}]:[{y:p,above:!0},{y:g,above:!1}],Y=[d,c(t.x),c(t.x+t.width-n.w)];for(const ht of Y)for(const Mt of $)if(!q(ht,Mt.y))return{x:ht,y:Mt.y,above:Mt.above};return y}function IS(e){return e.z??Number.POSITIVE_INFINITY}function Wg(e){return e.map((t,n)=>({pin:t,index:n})).sort((t,n)=>IS(t.pin)-IS(n.pin)||t.index-n.index).map(t=>t.pin)}function xD(e,t,n){switch(e){case"front":return n;case"back":return 0;case"up":return Math.min(n,t+1);case"down":return Math.max(0,t-1);default:return e}}function gA(e,t){const n=e.find(i=>i.id===t);if(!n)return new Set;const r=G2(n,e)??n;return new Set([r.id,...Z5(r.id,e)])}function vD(e,t,n){if(!e.some(b=>b.id===t))return[...e];const r=gA(e,t),i=Wg(e),s=i.filter(b=>r.has(b.id)),l=i.filter(b=>!r.has(b.id));if(s.length===0)return[...e];const c=i.findIndex(b=>r.has(b.id)),f=i.slice(0,c).filter(b=>!r.has(b.id)).length,d=xD(n,f,l.length),p=[...l.slice(0,d),...s,...l.slice(d)],g=new Map(p.map((b,y)=>[b.id,y]));return e.every(b=>!g.has(b.id)||b.z===g.get(b.id))?[...e]:e.map(b=>g.has(b.id)?{...b,z:g.get(b.id)}:b)}function wD(e,t,n){if(!e.some(f=>f.id===t))return!1;const r=gA(e,t),i=Wg(e),s=i.findIndex(f=>r.has(f.id));if(s<0)return!1;const l=i.filter(f=>!r.has(f.id)).length,c=i.slice(0,s).filter(f=>!r.has(f.id)).length;return n==="front"||n==="up"?c<l:c>0}function SD(e){if(e.type==="linked")return{x:0,y:0};if(e.type==="point")return{x:e.x,y:e.y};if(e.type==="numbering")return{x:e.end.x,y:e.end.y};if(e.type==="standalone")return{x:e.x,y:e.y};if(e.type==="rectangle")return{x:e.x+e.width/2,y:e.y+e.height/2};if(e.type==="text")return{x:e.x+e.width/2,y:e.y+e.height/2};if(e.type==="image")return{x:e.x+e.width/2,y:e.y+e.height/2};if(e.type==="redact")return{x:e.x+e.width/2,y:e.y+e.height/2};if(e.type==="ellipse")return{x:e.cx,y:e.cy};if(e.type==="compass")return{x:e.cx,y:e.cy};if(e.type==="arrow")return{x:(e.start.x+e.end.x+e.control.x)/3,y:(e.start.y+e.end.y+e.control.y)/3};if(e.type==="polygon"||e.type==="polyline"){const t=e.points;if(t.length===0)return{x:0,y:0};const n=t.reduce((i,s)=>i+s.x,0),r=t.reduce((i,s)=>i+s.y,0);return{x:n/t.length,y:r/t.length}}return{x:0,y:0}}function kD(e,t,n){const r=i=>({x:i.x+t,y:i.y+n});switch(e.type){case"linked":return e;case"point":case"standalone":return{...e,...r(e)};case"text":return{...e,...r(e),...e.point?{point:r(e.point)}:{}};case"image":case"redact":case"rectangle":return{...e,...r(e)};case"ellipse":case"compass":{const i=r({x:e.cx,y:e.cy});return{...e,cx:i.x,cy:i.y}}case"polygon":case"polyline":return{...e,points:e.points.map(r)};case"numbering":return{...e,start:r(e.start),end:r(e.end)};case"arrow":return{...e,start:r(e.start),end:r(e.end),control:r(e.control)};default:return e}}function zS(e,t){return{pin:{...e},card:t?{...t}:null}}function AD(e,t,n){const r=SD(e.pin.anchor),i=t.x-r.x,s=t.y-r.y;return yA(e,i,s,n)}function yA(e,t,n,r){return{pin:{...e.pin,id:r,anchor:kD(e.pin.anchor,t,n)},card:e.card?{...e.card,x:e.card.x+t,y:e.card.y+n}:null}}function Q0(e){switch(e.type){case"polygon":case"polyline":case"rectangle":case"ellipse":case"arrow":return!0;case"point":case"numbering":case"standalone":case"compass":case"text":case"image":case"redact":case"linked":return!1;default:return e}}function nb(e){switch(e.type){case"polygon":case"rectangle":case"ellipse":return!0;case"point":case"numbering":case"standalone":case"polyline":case"arrow":case"compass":case"text":case"image":case"redact":case"linked":return!1;default:return e}}function Gc(e){return Q0(e.anchor)&&(e.strokeStyle??ed)==="dashed"}function Dg(e,t){return(t??Fp)==="none"?null:`${e}${u8}`}function Ky(e,t){return Dg(e,t)??"transparent"}const bA=24*hi,MD=12,CD=12*hi,Lg=1.25*hi;function ED(e,t,n,r=bA,i=CD){const s=i+r;switch(e){case"nw":return{cx:s,cy:s};case"ne":return{cx:Math.max(s,t-s),cy:s};case"se":return{cx:Math.max(s,t-s),cy:Math.max(s,n-s)};case"sw":return{cx:s,cy:Math.max(s,n-s)};default:return e}}function rb(e){const t=Math.max(1,e),n=-t*.72,r=-t*.12,i=t*.18,s=Math.max(8,t*.42),l=Math.max(.28,Math.min(.55,s*.55/t)),c=-Math.PI/2;return{arrowPoints:[{x:0,y:n},{x:i,y:r},{x:-i,y:r}],letterY:-t,fontSize:s,arcGapHalfRad:l,arcStartRad:c+l,arcEndRad:c-l+Math.PI*2}}function TD(e,t,n){const{arcStartRad:r,arcEndRad:i}=rb(n),s=e+n*Math.cos(r),l=t+n*Math.sin(r),c=e+n*Math.cos(i),f=t+n*Math.sin(i);return`M ${s} ${l} A ${n} ${n} 0 1 1 ${c} ${f}`}function ND(e,t){const{cx:n,cy:r,radius:i,rotation:s=0,color:l,strokeWidth:c=Lg}=t,f=s*Math.PI/180,d=rb(i);e.save(),e.translate(n,r),e.rotate(f),e.beginPath(),e.arc(0,0,i,d.arcStartRad,d.arcEndRad,!1),e.strokeStyle=l,e.lineWidth=c,e.lineCap="round",e.stroke();const[p,g,b]=d.arrowPoints;e.beginPath(),e.moveTo(p.x,p.y),e.lineTo(g.x,g.y),e.lineTo(b.x,b.y),e.closePath(),e.fillStyle=l,e.fill(),e.fillStyle=l,e.font=`700 ${d.fontSize}px sans-serif`,e.textAlign="center",e.textBaseline="middle",e.fillText("N",0,d.letterY),e.restore()}const xA="tyts-stamp",vA=5,wA=50,Xg=0,Gg=15,SA={logo:null,logoAspect:null,corner:"se",sizePct:15,marginXPct:2,marginYPct:2,autoApply:!1},_D=["nw","ne","sw","se"];function Jy(e,t,n,r){return typeof e=="number"&&Number.isFinite(e)?Math.min(n,Math.max(t,e)):r}function DD(e){const t=SA;if(!e||typeof e!="object")return{...t};const n=e,r=typeof n.logo=="string"&&n.logo.startsWith("data:image/")?n.logo:null,i=r&&typeof n.logoAspect=="number"&&Number.isFinite(n.logoAspect)&&n.logoAspect>0?n.logoAspect:null;return{logo:i?r:null,logoAspect:i,corner:_D.includes(n.corner)?n.corner:t.corner,sizePct:Jy(n.sizePct,vA,wA,t.sizePct),marginXPct:Jy(n.marginXPct??n.marginPct,Xg,Gg,t.marginXPct),marginYPct:Jy(n.marginYPct??n.marginPct,Xg,Gg,t.marginYPct),autoApply:n.autoApply===!0}}function LD(){try{const e=localStorage.getItem(xA);return DD(e?JSON.parse(e):null)}catch{return{...SA}}}function RD(e){try{return localStorage.setItem(xA,JSON.stringify(e)),!0}catch{return!1}}function OD(e,t){return e.logo&&e.logoAspect?{src:e.logo,aspect:e.logoAspect}:t}function PD(e,t,n,r,i,s,l){const c=Number.isFinite(r)&&r>0?r:1,f=c>=1?i:i*c,d=c>=1?i/c:i,p=e==="nw"||e==="sw",g=e==="nw"||e==="ne";return{x:p?s:Math.max(s,t-s-f),y:g?l:Math.max(l,n-l-d),width:f,height:d}}function sg(e,t,n,r,i,s=16){const l=Math.min(r,i),c=Math.max(s,l*e.sizePct/100),f=l*e.marginXPct/100,d=l*e.marginYPct/100;return PD(t,r,i,n,c,f,d)}function Zy(e,t){const n=i=>i.anchor.type==="image"&&i.anchor.stamp===!0,r=t?e.find(i=>i.id===t):void 0;if(r&&n(r))return r;for(let i=e.length-1;i>=0;i-=1)if(n(e[i]))return e[i];return null}function BS(e,t,n,r,i){return{id:e,anchor:{type:"image",...n,src:t.src,aspect:t.aspect,stamp:!0},color:i,label:r,image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}}const _r="bi",vn=hi*Q5,Hr=Math.round(12*vn),Ch="rgba(255,255,255,0.08)",dh="1px solid rgba(255,255,255,0.18)",t1="#ccc",jD="rgba(230,57,70,0.1)",ID="1px solid rgba(230,57,70,0.8)",l5="#ff6b6b",em=4*vn,nm=14*vn,zD=`${3*vn}px ${8*vn}px`,Kg=10*vn,Jg=8*vn,wf=18*vn,kA=Math.round(10*vn),ag=7*vn,AA=8*vn,MA=4*vn,CA=12*vn,EA="rgba(20,20,32,0.95)",TA="1px solid rgba(60,60,80,0.9)",Ap=6*vn,mo=16*vn,Zg=6*vn,Sf=4*vn,ch="2px solid #fff",NA="1px solid rgba(255,255,255,0.2)",Qg="rgba(255,255,255,0.05)",t0="1px solid rgba(255,255,255,0.35)",e0="1.8",_A="2.2 1.8",n0="#fff",DA=10*vn,LA=3*vn,RA=10*vn,OA=32*vn,FS=16*vn,hh="#aaa",PA={width:FS,height:FS,padding:0,margin:0,background:"transparent",border:"none",color:hh,cursor:"pointer",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center"},rm=28*vn,BD=26*vn,jA=`${2*vn}px ${6*vn}px`,FD=4*vn,IA={minWidth:BD,height:rm,cursor:"pointer",borderRadius:em,fontSize:nm,padding:jA,fontFamily:"inherit",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:FD,lineHeight:1,boxSizing:"border-box"},pp={...IA,background:Ch,border:dh,color:hh},mp={...IA,background:jD,border:ID,color:l5},US=22*vn,UD=26*vn,HD=12*vn,zA={display:"inline-flex",alignItems:"stretch",height:rm,background:Ch,border:dh,borderRadius:em,overflow:"hidden",flexShrink:0,boxSizing:"border-box"},r0={width:US,minWidth:US,background:"transparent",border:"none",color:t1,cursor:"pointer",fontSize:nm,fontFamily:"inherit",padding:0,margin:0,lineHeight:1,display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},BA={minWidth:UD,padding:`0 ${3*vn}px`,borderLeft:dh,borderRight:dh,color:t1,fontSize:HD,fontFamily:"inherit",fontVariantNumeric:"tabular-nums",display:"inline-flex",alignItems:"center",justifyContent:"center",userSelect:"none",boxSizing:"border-box"},ph=32*vn,qD=`${3*vn}px`,$D=6,i0="rgba(20, 20, 32, 0.95)",ib="1px solid rgba(255,255,255,0.28)",ob="#cfcfcf",sb="background 0.15s, border 0.15s, color 0.15s",HS="1px solid rgba(230,57,70,0.7)",YD="rgba(230,57,70,0.95)",VD="1px solid #ff6b6b",WD="#fff",gp={position:"absolute",top:"50%",width:ph,height:ph,transform:"translateY(-50%)",background:i0,border:ib,color:ob,cursor:"pointer",borderRadius:"50%",fontSize:nm,padding:qD,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center",transition:sb},XD=eu.memo(function({x:t,y:n,color:r,widthScale:i=1,onClick:s,onMouseDown:l,onPointerDown:c}){const f=hp*i;return A.jsx("g",{transform:`translate(${t}, ${n})`,onClick:s,onPointerDown:c,onMouseDown:l,style:{cursor:l?"grab":"pointer"},children:A.jsx("circle",{r:f,fill:r,stroke:"white",strokeWidth:Ng*i})})},(e,t)=>e.x===t.x&&e.y===t.y&&e.color===t.color&&e.label===t.label&&e.active===t.active&&e.widthScale===t.widthScale),FA=(e,t,n)=>e+(t-e)*Math.min(1,Math.max(0,n));function GD(e){return FA(h8,p8,e)}function KD(e){return FA(m8,g8,e)}function JD(e,t,n){const r=n.w/Math.max(1,t.w),i=n.h/Math.max(1,t.h);return{sx:e.x*r,sy:e.y*i,sw:Math.max(1,e.width*r),sh:Math.max(1,e.height*i)}}function ZD(e,t){let n=0,r=0,i=0,s=0;for(let l=0;l<t;l+=1)for(let c=0;c<t;c+=1){if(l!==0&&l!==t-1&&c!==0&&c!==t-1)continue;const f=(l*t+c)*4;n+=e[f],r+=e[f+1],i+=e[f+2],s+=1}return s?{r:Math.round(n/s),g:Math.round(r/s),b:Math.round(i/s)}:null}const QD=24;function tL(e,t,n,r){const{sx:i,sy:s,sw:l,sh:c}=JD(t,n,r),f=QD,d=document.createElement("canvas");d.width=f,d.height=f;const p=d.getContext("2d",{willReadFrequently:!0});if(!p)return null;try{p.imageSmoothingEnabled=!0,p.drawImage(e,i,s,l,c,0,0,f,f);const g=ZD(p.getImageData(0,0,f,f).data,f);return g?`rgb(${g.r}, ${g.g}, ${g.b})`:null}catch{return null}}function qS(e,t,n,r,i){const s=Math.max(1,Math.round(r)),l=Math.max(1,Math.round(i)),c=document.createElement("canvas");c.width=s,c.height=l;const f=c.getContext("2d");if(!f)return null;try{f.drawImage(e,t,n,r,i,0,0,s,l)}catch{return null}return c}function UA(e,t,n){const{rect:r,mode:i,strength:s,imageSize:l,sourceSize:c}=n;if(r.width<=0||r.height<=0)return;const f=c.w/Math.max(1,l.w),d=c.h/Math.max(1,l.h);if(i==="fill"){const D=tL(t,r,l,c);e.save(),e.fillStyle=D??"#808080",e.fillRect(r.x,r.y,r.width,r.height),e.restore();return}if(i==="blur"){const D=GD(s),L=D*2,q=qS(t,(r.x-L)*f,(r.y-L)*d,(r.width+L*2)*f,(r.height+L*2)*d);if(!q)return;e.save(),e.beginPath(),e.rect(r.x,r.y,r.width,r.height),e.clip(),e.filter=`blur(${D}px)`,e.drawImage(q,r.x-L,r.y-L,r.width+L*2,r.height+L*2),e.filter="none",e.restore();return}const p=qS(t,r.x*f,r.y*d,r.width*f,r.height*d);if(!p)return;const g=KD(s),b=Math.max(1,Math.round(r.width/g)),y=Math.max(1,Math.round(r.height/g)),M=document.createElement("canvas");M.width=b,M.height=y;const E=M.getContext("2d");E&&(E.imageSmoothingEnabled=!0,E.drawImage(p,0,0,b,y),e.save(),e.beginPath(),e.rect(r.x,r.y,r.width,r.height),e.clip(),e.imageSmoothingEnabled=!1,e.drawImage(M,0,0,b,y,r.x,r.y,r.width,r.height),e.imageSmoothingEnabled=!0,e.restore())}const eL=I.memo(function({x:t,y:n,width:r,height:i,mode:s,strength:l,source:c,imageSize:f,resolution:d=2}){const p=I.useRef(null);return I.useEffect(()=>{const g=p.current;if(!g||!c||r<=0||i<=0)return;const b={w:c.naturalWidth,h:c.naturalHeight};if(!b.w||!b.h)return;g.width=Math.max(1,Math.round(r*d)),g.height=Math.max(1,Math.round(i*d));const y=g.getContext("2d");y&&(y.setTransform(d,0,0,d,-t*d,-n*d),y.clearRect(t,n,r,i),UA(y,c,{rect:{x:t,y:n,width:r,height:i},mode:s,strength:l,imageSize:f,sourceSize:b}))},[t,n,r,i,s,l,c,f,d]),A.jsx("foreignObject",{x:t,y:n,width:r,height:i,style:{overflow:"hidden"},children:A.jsx("canvas",{xmlns:"http://www.w3.org/1999/xhtml",ref:p,style:{width:"100%",height:"100%",display:"block",pointerEvents:"none"}})})});var mh=a4();const nL=s4(mh);var Qy={exports:{}},t2={};var $S;function rL(){if($S)return t2;$S=1;var e=Qp();function t(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,s=e.useLayoutEffect,l=e.useDebugValue;function c(g,b){var y=b(),M=r({inst:{value:y,getSnapshot:b}}),E=M[0].inst,D=M[1];return s(function(){E.value=y,E.getSnapshot=b,f(E)&&D({inst:E})},[g,y,b]),i(function(){return f(E)&&D({inst:E}),g(function(){f(E)&&D({inst:E})})},[g]),l(y),y}function f(g){var b=g.getSnapshot;g=g.value;try{var y=b();return!n(g,y)}catch{return!0}}function d(g,b){return b()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return t2.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,t2}var YS;function HA(){return YS||(YS=1,Qy.exports=rL()),Qy.exports}var qA=HA(),VS=Object.defineProperty,iL=(e,t)=>{let n={};for(var r in e)VS(n,r,{get:e[r],enumerable:!0});return VS(n,Symbol.toStringTag,{value:"Module"}),n};function Is(e){this.content=e}Is.prototype={constructor:Is,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),s=r.content.slice();return i==-1?s.push(n||e,t):(s[i+1]=t,n&&(s[i]=n)),new Is(s)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new Is(n)},addToStart:function(e,t){return new Is([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Is(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),s=r.find(e);return i.splice(s==-1?i.length:s,0,t,n),new Is(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Is.from(e),e.size?new Is(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Is.from(e),e.size?new Is(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Is.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}};Is.from=function(e){if(e instanceof Is)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Is(t)};function $A(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),s=t.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){let l=i.text,c=s.text,f=0;for(;l[f]==c[f];f++)n++;return f&&f<l.length&&f<c.length&&WA(l.charCodeAt(f-1))&&VA(l.charCodeAt(f))&&n--,n}if(i.content.size||s.content.size){let l=$A(i.content,s.content,n+1);if(l!=null)return l}n+=i.nodeSize}}function YA(e,t,n,r){for(let i=e.childCount,s=t.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let l=e.child(--i),c=t.child(--s),f=l.nodeSize;if(l==c){n-=f,r-=f;continue}if(!l.sameMarkup(c))return{a:n,b:r};if(l.isText&&l.text!=c.text){let d=l.text,p=c.text,g=d.length,b=p.length;for(;g>0&&b>0&&d[g-1]==p[b-1];)g--,b--,n--,r--;return g&&b&&g<d.length&&WA(d.charCodeAt(g-1))&&VA(d.charCodeAt(g))&&(n++,r++),{a:n,b:r}}if(l.content.size||c.content.size){let d=YA(l.content,c.content,n-1,r-1);if(d)return d}n-=f,r-=f}}function VA(e){return e>=56320&&e<57344}function WA(e){return e>=55296&&e<56320}class ke{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,i=0,s){for(let l=0,c=0;c<n;l++){let f=this.content[l],d=c+f.nodeSize;if(d>t&&r(f,i+c,s||null,l)!==!1&&f.content.size){let p=c+1;f.nodesBetween(Math.max(0,t-p),Math.min(f.content.size,n-p),r,i+p)}c=d}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,i){let s="",l=!0;return this.nodesBetween(t,n,(c,f)=>{let d=c.isText?c.text.slice(Math.max(t,f)-f,n-f):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&d||c.isTextblock)&&r&&(l?l=!1:s+=r),s+=d},0),s}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<t.content.length;s++)i.push(t.content[s]);return new ke(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let s=0,l=0;l<n;s++){let c=this.content[s],f=l+c.nodeSize;f>t&&((l<t||f>n)&&(c.isText?c=c.cut(Math.max(0,t-l),Math.min(c.text.length,n-l)):c=c.cut(Math.max(0,t-l-1),Math.min(c.content.size,n-l-1))),r.push(c),i+=c.nodeSize),l=f}return new ke(r,i)}cutByIndex(t,n){return t==n?ke.empty:t==0&&n==this.content.length?this:new ke(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new ke(i,s)}addToStart(t){return new ke([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new ke(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];t(i,r,n),r+=i.nodeSize}}findDiffStart(t,n=0){return $A(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return YA(this,t,n,r)}findIndex(t){if(t==0)return lg(0,t);if(t==this.size)return lg(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=t)return s==t?lg(n+1,s):lg(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return ke.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return ke.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return ke.empty;let n,r=0;for(let i=0;i<t.length;i++){let s=t[i];r+=s.nodeSize,i&&s.isText&&t[i-1].sameMarkup(s)?(n||(n=t.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new ke(n||t,r)}static from(t){if(!t)return ke.empty;if(t instanceof ke)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new ke([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ke.empty=new ke([],0);const e2={index:0,offset:0};function lg(e,t){return e2.index=e,e2.offset=t,e2}function o0(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!o0(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!o0(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}let bi=class c5{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let i=0;i<t.length;i++){let s=t[i];if(this.eq(s))return t;if(this.type.excludes(s.type))n||(n=t.slice(0,i));else{if(s.type.excludes(this.type))return t;!r&&s.type.rank>this.type.rank&&(n||(n=t.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&o0(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return c5.none;if(t instanceof c5)return[t];let n=t.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};bi.none=[];class Up extends Error{}class Ge{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=GA(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new Ge(r,this.openStart,this.openEnd)}removeBetween(t,n){return new Ge(XA(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return Ge.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ge(ke.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let s=t.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=t.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new Ge(t,r,i)}}Ge.empty=new Ge(ke.empty,0,0);function XA(e,t,n){let{index:r,offset:i}=e.findIndex(t),s=e.maybeChild(r),{index:l,offset:c}=e.findIndex(n);if(i==t||s.isText){if(c!=n&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(r,s.copy(XA(s.content,t-i-1,n-i-1)))}function GA(e,t,n,r,i,s){let{index:l,offset:c}=e.findIndex(t),f=e.maybeChild(l);if(c==t||f.isText)return s&&r<=0&&i<=0&&!s.canReplace(l,l,n)?null:e.cut(0,t).append(n).append(e.cut(t));let d=GA(f.content,t-c-1,n,l==0?r-1:0,l==e.childCount-1?i-1:0,f);return d&&e.replaceChild(l,f.copy(d))}function oL(e,t,n){if(n.openStart>e.depth)throw new Up("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Up("Inconsistent open depths");return KA(e,t,n,0)}function KA(e,t,n,r){let i=e.index(r),s=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let l=KA(e,t,n,r+1);return s.copy(s.content.replaceChild(i,l))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let l=e.parent,c=l.content;return cd(l,c.cut(0,e.parentOffset).append(n.content).append(c.cut(t.parentOffset)))}else{let{start:l,end:c}=sL(n,e);return cd(s,ZA(e,l,c,t,r))}else return cd(s,s0(e,t,r))}function JA(e,t){if(!t.type.compatibleContent(e.type))throw new Up("Cannot join "+t.type.name+" onto "+e.type.name)}function u5(e,t,n){let r=e.node(n);return JA(r,t.node(n)),r}function ld(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Mp(e,t,n,r){let i=(t||e).node(n),s=0,l=t?t.index(n):i.childCount;e&&(s=e.index(n),e.depth>n?s++:e.textOffset&&(ld(e.nodeAfter,r),s++));for(let c=s;c<l;c++)ld(i.child(c),r);t&&t.depth==n&&t.textOffset&&ld(t.nodeBefore,r)}function cd(e,t){if(!e.type.validContent(t))throw new Up("Invalid content for node "+e.type.name);return e.copy(t)}function ZA(e,t,n,r,i){let s=e.depth>i&&u5(e,t,i+1),l=r.depth>i&&u5(n,r,i+1),c=[];return Mp(null,e,i,c),s&&l&&t.index(i)==n.index(i)?(JA(s,l),ld(cd(s,ZA(e,t,n,r,i+1)),c)):(s&&ld(cd(s,s0(e,t,i+1)),c),Mp(t,n,i,c),l&&ld(cd(l,s0(n,r,i+1)),c)),Mp(r,null,i,c),new ke(c)}function s0(e,t,n){let r=[];if(Mp(null,e,n,r),e.depth>n){let i=u5(e,t,n+1);ld(cd(i,s0(e,t,n+1)),r)}return Mp(t,null,n,r),new ke(r)}function sL(e,t){let n=t.depth-e.openStart,i=t.node(n).copy(e.content);for(let s=n-1;s>=0;s--)i=t.node(s).copy(ke.from(i));return{start:i.resolveNoCache(e.openStart+n),end:i.resolveNoCache(i.content.size-e.openEnd-n)}}class Hp{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=t.child(n);return r?t.child(n).cut(r):i}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<t;s++)i+=r.child(s).nodeSize;return i}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return bi.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),i=t.maybeChild(n);if(!r){let c=r;r=i,i=c}let s=r.marks;for(var l=0;l<s.length;l++)s[l].type.spec.inclusive===!1&&(!i||!s[l].isInSet(i.marks))&&(s=s[l--].removeFromSet(s));return s}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=t.parent.maybeChild(t.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new a0(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let l=t;;){let{index:c,offset:f}=l.content.findIndex(s),d=s-f;if(r.push(l,c,i+f),!d||(l=l.child(c),l.isText))break;s=d-1,i+=f+1}return new Hp(n,r,s)}static resolveCached(t,n){let r=WS.get(t);if(r)for(let s=0;s<r.elts.length;s++){let l=r.elts[s];if(l.pos==n)return l}else WS.set(t,r=new aL);let i=r.elts[r.i]=Hp.resolve(t,n);return r.i=(r.i+1)%lL,i}}class aL{constructor(){this.elts=[],this.i=0}}const lL=12,WS=new WeakMap;class a0{constructor(t,n,r){this.$from=t,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const cL=Object.create(null);let ud=class f5{constructor(t,n,r,i=bi.none){this.type=t,this.attrs=n,this.marks=i,this.content=r||ke.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,i=0){this.content.nodesBetween(t,n,r,i,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,i){return this.content.textBetween(t,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&o0(this.attrs,n||t.defaultAttrs||cL)&&bi.sameSet(this.marks,r||bi.none)}copy(t=null){return t==this.content?this:new f5(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new f5(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return Ge.empty;let i=this.resolve(t),s=this.resolve(n),l=r?0:i.sharedDepth(n),c=i.start(l),d=i.node(l).content.cut(i.pos-c,s.pos-c);return new Ge(d,i.depth-l,s.depth-l)}replace(t,n,r){return oL(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(i==t||n.isText)return n;t-=i+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(t){return Hp.resolveCached(this,t)}resolveNoCache(t){return Hp.resolve(this,t)}rangeHasMark(t,n,r){let i=!1;return n>t&&this.nodesBetween(t,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),QA(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=ke.empty,i=0,s=r.childCount){let l=this.contentMatchAt(t).matchFragment(r,i,s),c=l&&l.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let f=i;f<s;f++)if(!this.type.allowsMarks(r.child(f).marks))return!1;return!0}canReplaceWith(t,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(t).matchType(r),l=s&&s.matchFragment(this.content,n);return l?l.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=bi.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!bi.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let i=ke.fromJSON(t,n.content),s=t.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};ud.prototype.text=void 0;class l0 extends ud{constructor(t,n,r,i){if(super(t,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):QA(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new l0(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new l0(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function QA(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class xd{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new uL(t,n);if(r.next==null)return xd.empty;let i=tM(r);r.next&&r.err("Unexpected trailing text");let s=yL(gL(i));return bL(s,r),s}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(t.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let i=[this];function s(l,c){let f=l.matchFragment(t,r);if(f&&(!n||f.validEnd))return ke.from(c.map(d=>d.createAndFill()));for(let d=0;d<l.next.length;d++){let{type:p,next:g}=l.next[d];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(g)==-1){i.push(g);let b=s(g,c.concat(p));if(b)return b}}return null}return s(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(t)){let l=[];for(let c=i;c.type;c=c.via)l.push(c.type);return l.reverse()}for(let l=0;l<s.next.length;l++){let{type:c,next:f}=s.next[l];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in n)&&(!i.type||f.validEnd)&&(r.push({match:c.contentMatch,type:c,via:i}),n[c.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let i=0;i<r.next.length;i++)t.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),t.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let l=0;l<r.next.length;l++)s+=(l?", ":"")+r.next[l].type.name+"->"+t.indexOf(r.next[l].next);return s}).join(`
96
+ `)}}xd.empty=new xd(!0);class uL{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function tM(e){let t=[];do t.push(fL(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function fL(e){let t=[];do t.push(dL(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function dL(e){let t=mL(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=hL(e,t);else break;return t}function XS(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function hL(e,t){let n=XS(e),r=n;return e.eat(",")&&(e.next!="}"?r=XS(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function pL(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let s in n){let l=n[s];l.isInGroup(t)&&i.push(l)}return i.length==0&&e.err("No node type or group '"+t+"' found"),i}function mL(e){if(e.eat("(")){let t=tM(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=pL(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function gL(e){let t=[[]];return i(s(e,0),n()),t;function n(){return t.push([])-1}function r(l,c,f){let d={term:f,to:c};return t[l].push(d),d}function i(l,c){l.forEach(f=>f.to=c)}function s(l,c){if(l.type=="choice")return l.exprs.reduce((f,d)=>f.concat(s(d,c)),[]);if(l.type=="seq")for(let f=0;;f++){let d=s(l.exprs[f],c);if(f==l.exprs.length-1)return d;i(d,c=n())}else if(l.type=="star"){let f=n();return r(c,f),i(s(l.expr,f),f),[r(f)]}else if(l.type=="plus"){let f=n();return i(s(l.expr,c),f),i(s(l.expr,f),f),[r(f)]}else{if(l.type=="opt")return[r(c)].concat(s(l.expr,c));if(l.type=="range"){let f=c;for(let d=0;d<l.min;d++){let p=n();i(s(l.expr,f),p),f=p}if(l.max==-1)i(s(l.expr,f),f);else for(let d=l.min;d<l.max;d++){let p=n();r(f,p),i(s(l.expr,f),p),f=p}return[r(f)]}else{if(l.type=="name")return[r(c,void 0,l.value)];throw new Error("Unknown expr type")}}}}function eM(e,t){return t-e}function GS(e,t){let n=[];return r(t),n.sort(eM);function r(i){let s=e[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let l=0;l<s.length;l++){let{term:c,to:f}=s[l];!c&&n.indexOf(f)==-1&&r(f)}}}function yL(e){let t=Object.create(null);return n(GS(e,0));function n(r){let i=[];r.forEach(l=>{e[l].forEach(({term:c,to:f})=>{if(!c)return;let d;for(let p=0;p<i.length;p++)i[p][0]==c&&(d=i[p][1]);GS(e,f).forEach(p=>{d||i.push([c,d=[]]),d.indexOf(p)==-1&&d.push(p)})})});let s=t[r.join(",")]=new xd(r.indexOf(e.length-1)>-1);for(let l=0;l<i.length;l++){let c=i[l][1].sort(eM);s.next.push({type:i[l][0],next:t[c.join(",")]||n(c)})}return s}}function bL(e,t){for(let n=0,r=[e];n<r.length;n++){let i=r[n],s=!i.validEnd,l=[];for(let c=0;c<i.next.length;c++){let{type:f,next:d}=i.next[c];l.push(f.name),s&&!(f.isText||f.hasRequiredAttrs())&&(s=!1),r.indexOf(d)==-1&&r.push(d)}s&&t.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function nM(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function rM(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let s=e[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function iM(e,t,n,r){for(let i in t)if(!(i in e))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let i in e)e[i].validate&&e[i].validate(t[i])}function oM(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new vL(e,r,t[r]);return n}let KS=class sM{constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=oM(t,r.attrs),this.defaultAttrs=nM(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==xd.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:rM(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ud(this,this.computeAttrs(t),ke.from(n),bi.setFrom(r))}createChecked(t=null,n,r){return n=ke.from(n),this.checkContent(n),new ud(this,this.computeAttrs(t),n,bi.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=ke.from(n),n.size){let l=this.contentMatch.fillBefore(n);if(!l)return null;n=l.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(ke.empty,!0);return s?new ud(this,t,n.append(s),bi.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){iM(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:bi.none:t}static compile(t,n){let r=Object.create(null);t.forEach((s,l)=>r[s]=new sM(s,n,l));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function xL(e,t,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${s}`)}}class vL{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?xL(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class e1{constructor(t,n,r,i){this.name=t,this.rank=n,this.schema=r,this.spec=i,this.attrs=oM(t,i.attrs),this.excluded=null;let s=nM(this.attrs);this.instance=s?new bi(this,s):null}create(t=null){return!t&&this.instance?this.instance:new bi(this,rM(this.attrs,t))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((s,l)=>r[s]=new e1(s,i++,n,l)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}checkAttrs(t){iM(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class aM{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in t)n[i]=t[i];n.nodes=Is.from(t.nodes),n.marks=Is.from(t.marks||{}),this.nodes=KS.compile(this.spec.nodes,this),this.marks=e1.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],l=s.spec.content||"",c=s.spec.marks;if(s.contentMatch=r[l]||(r[l]=xd.parse(l,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=c=="_"?null:c?JS(this,c.split(" ")):c==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],l=s.spec.excludes;s.excluded=l==null?[s]:l==""?[]:JS(this,l.split(" "))}this.nodeFromJSON=i=>ud.fromJSON(this,i),this.markFromJSON=i=>bi.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,i){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof KS){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,i)}text(t,n){let r=this.nodes.text;return new l0(r,r.defaultAttrs,t,bi.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function JS(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],s=e.marks[i],l=s;if(s)n.push(s);else for(let c in e.marks){let f=e.marks[c];(i=="_"||f.spec.group&&f.spec.group.split(" ").indexOf(i)>-1)&&n.push(l=f)}if(!l)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function wL(e){return e.tag!=null}function SL(e){return e.style!=null}let Cp=class d5{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(wL(i))this.tags.push(i);else if(SL(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=t.nodes[i.node];return s.contentMatch.matchType(s)})}parse(t,n={}){let r=new QS(this,n,!1);return r.addAll(t,bi.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new QS(this,n,!0);return r.addAll(t,bi.none,n.from,n.to),Ge.maxOpen(r.finish())}matchTag(t,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(ML(t,s.tag)&&(s.namespace===void 0||t.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let l=s.getAttrs(t);if(l===!1)continue;s.attrs=l||void 0}return s}}}matchStyle(t,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let l=this.styles[s],c=l.style;if(!(c.indexOf(t)!=0||l.context&&!r.matchesContext(l.context)||c.length>t.length&&(c.charCodeAt(t.length)!=61||c.slice(t.length+1)!=n))){if(l.getAttrs){let f=l.getAttrs(n);if(f===!1)continue;l.attrs=f||void 0}return l}}}static schemaRules(t){let n=[];function r(i){let s=i.priority==null?50:i.priority,l=0;for(;l<n.length;l++){let c=n[l];if((c.priority==null?50:c.priority)<s)break}n.splice(l,0,i)}for(let i in t.marks){let s=t.marks[i].spec.parseDOM;s&&s.forEach(l=>{r(l=t3(l)),l.mark||l.ignore||l.clearMark||(l.mark=i)})}for(let i in t.nodes){let s=t.nodes[i].spec.parseDOM;s&&s.forEach(l=>{r(l=t3(l)),l.node||l.ignore||l.mark||(l.node=i)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new d5(t,d5.schemaRules(t)))}};const lM={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},kL={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},cM={ol:!0,ul:!0},qp=1,h5=2,Ep=4;function ZS(e,t,n){return t!=null?(t?qp:0)|(t==="full"?h5:0):e&&e.whitespace=="pre"?qp|h5:n&~Ep}class cg{constructor(t,n,r,i,s,l){this.type=t,this.attrs=n,this.marks=r,this.solid=i,this.options=l,this.content=[],this.activeMarks=bi.none,this.match=s||(l&Ep?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ke.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(t.type))?(this.match=r,i):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&qp)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=ke.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(ke.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!lM.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class QS{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,l=ZS(null,n.preserveWhitespace,0)|(r?Ep:0);i?s=new cg(i.type,i.attrs,bi.none,!0,n.topMatch||i.type.contentMatch,l):r?s=new cg(null,null,bi.none,!0,null,l):s=new cg(t.schema.topNodeType,null,bi.none,!0,null,l),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let r=t.nodeValue,i=this.top,s=i.options&h5?"full":this.localPreserveWS||(i.options&qp)>0,{schema:l}=this.parser;if(s==="full"||i.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
97
+ `);else if(l.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(l.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let f=0;f<c.length;f++)f&&this.insertNode(l.linebreakReplacement.create(),n,!0),c[f]&&this.insertNode(l.text(c[f]),n,!/\S/.test(c[f]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let c=i.content[i.content.length-1],f=t.previousSibling;(!c||f&&f.nodeName=="BR"||c.isText&&/[ \t\r\n\u000c]$/.test(c.text))&&(r=r.slice(1))}r&&this.insertNode(l.text(r),n,!/\S/.test(r)),this.findInText(t)}else this.findInside(t)}addElement(t,n,r){let i=this.localPreserveWS,s=this.top;(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let l=t.nodeName.toLowerCase(),c;cM.hasOwnProperty(l)&&this.parser.normalizeLists&&AL(t);let f=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(c=this.parser.matchTag(t,this,r));t:if(f?f.ignore:kL.hasOwnProperty(l))this.findInside(t),this.ignoreFallback(t,n);else if(!f||f.skip||f.closeParent){f&&f.closeParent?this.open=Math.max(0,this.open-1):f&&f.skip.nodeType&&(t=f.skip);let d,p=this.needsBlock;if(lM.hasOwnProperty(l))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),d=!0,s.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,n);break t}let g=f&&f.skip?n:this.readStyles(t,n);g&&this.addAll(t,g),d&&this.sync(s),this.needsBlock=p}else{let d=this.readStyles(t,n);d&&this.addElementByRule(t,f,d,f.consuming===!1?c:void 0)}this.localPreserveWS=i}leafFallback(t,n){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
98
+ `),n)}ignoreFallback(t,n){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(t,n){let r=t.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],l=r.getPropertyValue(s);if(l)for(let c=void 0;;){let f=this.parser.matchStyle(s,l,this,c);if(!f)break;if(f.ignore)return null;if(f.clearMark?n=n.filter(d=>!f.clearMark(d)):n=n.concat(this.parser.schema.marks[f.mark].create(f.attrs)),f.consuming===!1)c=f;else break}}return n}addElementByRule(t,n,r,i){let s,l;if(n.node)if(l=this.parser.schema.nodes[n.node],l.isLeaf)this.insertNode(l.create(n.attrs),r,t.nodeName=="BR")||this.leafFallback(t,r);else{let f=this.enter(l,n.attrs||null,r,n.preserveWhitespace);f&&(s=!0,r=f)}else{let f=this.parser.schema.marks[n.mark];r=r.concat(f.create(n.attrs))}let c=this.top;if(l&&l.isLeaf)this.findInside(t);else if(i)this.addElement(t,r,i);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(f=>this.insertNode(f,r,!1));else{let f=t;typeof n.contentElement=="string"?f=t.querySelector(n.contentElement):typeof n.contentElement=="function"?f=n.contentElement(t):n.contentElement&&(f=n.contentElement),this.findAround(t,f,!0),this.addAll(f,r),this.findAround(t,f,!1)}s&&this.sync(c)&&this.open--}addAll(t,n,r,i){let s=r||0;for(let l=r?t.childNodes[r]:t.firstChild,c=i==null?null:t.childNodes[i];l!=c;l=l.nextSibling,++s)this.findAtPoint(t,s),this.addDOM(l,n);this.findAtPoint(t,s)}findPlace(t,n,r){let i,s;for(let l=this.open,c=0;l>=0;l--){let f=this.nodes[l],d=f.findWrapping(t);if(d&&(!i||i.length>d.length+c)&&(i=d,s=f,!d.length))break;if(f.solid){if(r)break;c+=2}}if(!i)return null;this.sync(s);for(let l=0;l<i.length;l++)n=this.enterInner(i[l],null,n,!1);return n}insertNode(t,n,r){if(t.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(t,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(t.type));let l=bi.none;for(let c of i.concat(t.marks))(s.type?s.type.allowsMarkType(c.type):e3(c.type,t.type))&&(l=c.addToSet(l));return s.content.push(t.mark(l)),!0}return!1}enter(t,n,r,i){let s=this.findPlace(t.create(n),r,!1);return s&&(s=this.enterInner(t,n,r,!0,i)),s}enterInner(t,n,r,i=!1,s){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(t);let c=ZS(t,s,l.options);l.options&Ep&&l.content.length==0&&(c|=Ep);let f=bi.none;return r=r.filter(d=>(l.type?l.type.allowsMarkType(d.type):e3(d.type,t))?(f=d.addToSet(f),!1):!0),this.nodes.push(new cg(t,n,f,i,null,c)),this.open++,r}closeExtra(t=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(t){for(let n=this.open;n>=0;n--){if(this.nodes[n]==t)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=qp)}return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)t+=r[i].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,r){if(t!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&t.nodeType==1&&t.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),l=(c,f)=>{for(;c>=0;c--){let d=n[c];if(d==""){if(c==n.length-1||c==0)continue;for(;f>=s;f--)if(l(c-1,f))return!0;return!1}else{let p=f>0||f==0&&i?this.nodes[f].type:r&&f>=s?r.node(f-s).type:null;if(!p||p.name!=d&&!p.isInGroup(d))return!1;f--}}return!0};return l(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function AL(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&cM.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function ML(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function t3(e){let t={};for(let n in e)t[n]=e[n];return t}function e3(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let s=[],l=c=>{s.push(c);for(let f=0;f<c.edgeCount;f++){let{type:d,next:p}=c.edge(f);if(d==t||s.indexOf(p)<0&&l(p))return!0}};if(l(i.contentMatch))return!0}}class Cd{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=ug(n).createDocumentFragment());let i=r,s=[];return t.forEach(l=>{if(s.length||l.marks.length){let c=0,f=0;for(;c<s.length&&f<l.marks.length;){let d=l.marks[f];if(!this.marks[d.type.name]){f++;continue}if(!d.eq(s[c][0])||d.type.spec.spanning===!1)break;c++,f++}for(;c<s.length;)i=s.pop()[1];for(;f<l.marks.length;){let d=l.marks[f++],p=this.serializeMark(d,l.isInline,n);p&&(s.push([d,i]),i.appendChild(p.dom),i=p.contentDOM||p.dom)}}i.appendChild(this.serializeNodeInner(l,n))}),r}serializeNodeInner(t,n){if(t.isText)return ug(n).createTextNode(t.text);let{dom:r,contentDOM:i}=Rg(ug(n),this.nodes[t.type.name](t),null,t.attrs);if(i){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,i)}return r}serializeNode(t,n={}){let r=this.serializeNodeInner(t,n);for(let i=t.marks.length-1;i>=0;i--){let s=this.serializeMark(t.marks[i],t.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(t,n,r={}){let i=this.marks[t.type.name];return i&&Rg(ug(r),i(t,n),null,t.attrs)}static renderSpec(t,n,r=null,i){return typeof n=="string"?{dom:t.createTextNode(n)}:Rg(t,n,r,i)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new Cd(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=n3(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return n3(t.marks)}}function n3(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function ug(e){return e.document||window.document}const r3=new WeakMap;function CL(e){let t=r3.get(e);return t===void 0&&r3.set(e,t=EL(e)),t}function EL(e){let t=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")t||(t=[]),t.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(e),t}function Rg(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=CL(r))&&s.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=i.indexOf(" ");l>0&&(n=i.slice(0,l),i=i.slice(l+1));let c,f=n?e.createElementNS(n,i):e.createElement(i),d=t[1],p=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){p=2;for(let g in d)if(d[g]!=null){let b=g.indexOf(" ");b>0?f.setAttributeNS(g.slice(0,b),g.slice(b+1),d[g]):g=="style"&&f.style?f.style.cssText=d[g]:f.setAttribute(g,d[g])}}for(let g=p;g<t.length;g++){let b=t[g];if(b===0){if(g<t.length-1||g>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:f,contentDOM:f}}else if(typeof b=="string")f.appendChild(e.createTextNode(b));else{let{dom:y,contentDOM:M}=Rg(e,b,n,r);if(f.appendChild(y),M){if(c)throw new RangeError("Multiple content holes");c=M}}}return{dom:f,contentDOM:c}}const uM=65535,fM=Math.pow(2,16);function TL(e,t){return e+t*fM}function i3(e){return e&uM}function NL(e){return(e-(e&uM))/fM}const dM=1,hM=2,Og=4,pM=8;class p5{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&pM)>0}get deletedBefore(){return(this.delInfo&(dM|Og))>0}get deletedAfter(){return(this.delInfo&(hM|Og))>0}get deletedAcross(){return(this.delInfo&Og)>0}}class hl{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&hl.empty)return hl.empty}recover(t){let n=0,r=i3(t);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+NL(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let i=0,s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let f=this.ranges[c]-(this.inverted?i:0);if(f>t)break;let d=this.ranges[c+s],p=this.ranges[c+l],g=f+d;if(t<=g){let b=d?t==f?-1:t==g?1:n:n,y=f+i+(b<0?0:p);if(r)return y;let M=t==(n<0?f:g)?null:TL(c/3,t-f),E=t==f?hM:t==g?dM:Og;return(n<0?t!=f:t!=g)&&(E|=pM),new p5(y,E,M)}i+=p-d}return r?t+i:new p5(t+i,0,null)}touches(t,n){let r=0,i=i3(n),s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let f=this.ranges[c]-(this.inverted?r:0);if(f>t)break;let d=this.ranges[c+s],p=f+d;if(t<=p&&c==i*3)return!0;r+=this.ranges[c+l]-d}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let l=this.ranges[i],c=l-(this.inverted?s:0),f=l+(this.inverted?0:s),d=this.ranges[i+n],p=this.ranges[i+r];t(c,c+d,f,f+p),s+=p-d}}invert(){return new hl(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?hl.empty:new hl(t<0?[0,-t,0]:[0,0,t])}}hl.empty=new hl([]);class $p{constructor(t,n,r=0,i=t?t.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=t||[],this.ownData=!(t||n)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new $p(this._maps,this.mirror,t,n)}appendMap(t,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(t){for(let n=0,r=this._maps.length;n<t._maps.length;n++){let i=t.getMirror(n);this.appendMap(t._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this._maps.length+t._maps.length;n>=0;n--){let i=t.getMirror(n);this.appendMap(t._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let t=new $p;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this._maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let i=0;for(let s=this.from;s<this.to;s++){let l=this._maps[s],c=l.mapResult(t,n);if(c.recover!=null){let f=this.getMirror(s);if(f!=null&&f>s&&f<this.to){s=f,t=this._maps[f].recover(c.recover);continue}}i|=c.delInfo,t=c.pos}return r?t:new p5(t,i,null)}}const n2=Object.create(null);class pa{getMap(){return hl.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=n2[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in n2)throw new RangeError("Duplicate use of step JSON ID "+t);return n2[t]=n,n.prototype.jsonID=t,n}}class $o{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new $o(t,null)}static fail(t){return new $o(null,t)}static fromReplace(t,n,r,i){try{return $o.ok(t.replace(n,r,i))}catch(s){if(s instanceof Up)return $o.fail(s.message);throw s}}}function ab(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let s=e.child(i);s.content.size&&(s=s.copy(ab(s.content,t,s))),s.isInline&&(s=t(s,n,i)),r.push(s)}return ke.fromArray(r)}class kf extends pa{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new Ge(ab(n.content,(l,c)=>!l.isAtom||!c.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),i),n.openStart,n.openEnd);return $o.fromReplace(t,this.from,this.to,s)}invert(){return new vc(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new kf(n.pos,r.pos,this.mark)}merge(t){return t instanceof kf&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new kf(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new kf(n.from,n.to,t.markFromJSON(n.mark))}}pa.jsonID("addMark",kf);class vc extends pa{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new Ge(ab(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),n.openStart,n.openEnd);return $o.fromReplace(t,this.from,this.to,r)}invert(){return new kf(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new vc(n.pos,r.pos,this.mark)}merge(t){return t instanceof vc&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new vc(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new vc(n.from,n.to,t.markFromJSON(n.mark))}}pa.jsonID("removeMark",vc);class Af extends pa{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return $o.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return $o.fromReplace(t,this.pos,this.pos+1,new Ge(ke.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Af(this.pos,n.marks[i]);return new Af(this.pos,this.mark)}}return new vd(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Af(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Af(n.pos,t.markFromJSON(n.mark))}}pa.jsonID("addNodeMark",Af);class vd extends pa{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return $o.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return $o.fromReplace(t,this.pos,this.pos+1,new Ge(ke.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Af(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new vd(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new vd(n.pos,t.markFromJSON(n.mark))}}pa.jsonID("removeNodeMark",vd);class Eo extends pa{constructor(t,n,r,i=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=i}apply(t){return this.structure&&m5(t,this.from,this.to)?$o.fail("Structure replace would overwrite content"):$o.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new hl([this.from,this.to-this.from,this.slice.size])}invert(t){return new Eo(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&Eo.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Eo(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof Eo)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?Ge.empty:new Ge(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Eo(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?Ge.empty:new Ge(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Eo(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Eo(n.from,n.to,Ge.fromJSON(t,n.slice),!!n.structure)}}Eo.MAP_BIAS=1;pa.jsonID("replace",Eo);class xs extends pa{constructor(t,n,r,i,s,l,c=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=l,this.structure=c}apply(t){if(this.structure&&(m5(t,this.from,this.gapFrom)||m5(t,this.gapTo,this.to)))return $o.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return $o.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?$o.fromReplace(t,this.from,this.to,r):$o.fail("Content does not fit in gap")}getMap(){return new hl([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new xs(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new xs(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new xs(n.from,n.to,n.gapFrom,n.gapTo,Ge.fromJSON(t,n.slice),n.insert,!!n.structure)}}pa.jsonID("replaceAround",xs);function m5(e,t,n){let r=e.resolve(t),i=n-t,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let l=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,i--}}return!1}function _L(e,t,n,r){let i=[],s=[],l,c;e.doc.nodesBetween(t,n,(f,d,p)=>{if(!f.isInline)return;let g=f.marks;if(!r.isInSet(g)&&p.type.allowsMarkType(r.type)){let b=Math.max(d,t),y=Math.min(d+f.nodeSize,n),M=r.addToSet(g);for(let E=0;E<g.length;E++)g[E].isInSet(M)||(l&&l.to==b&&l.mark.eq(g[E])?l.to=y:i.push(l=new vc(b,y,g[E])));c&&c.to==b?c.to=y:s.push(c=new kf(b,y,r))}}),i.forEach(f=>e.step(f)),s.forEach(f=>e.step(f))}function DL(e,t,n,r){let i=[],s=0;e.doc.nodesBetween(t,n,(l,c)=>{if(!l.isInline)return;s++;let f=null;if(r instanceof e1){let d=l.marks,p;for(;p=r.isInSet(d);)(f||(f=[])).push(p),d=p.removeFromSet(d)}else r?r.isInSet(l.marks)&&(f=[r]):f=l.marks;if(f&&f.length){let d=Math.min(c+l.nodeSize,n);for(let p=0;p<f.length;p++){let g=f[p],b;for(let y=0;y<i.length;y++){let M=i[y];M.step==s-1&&g.eq(i[y].style)&&(b=M)}b?(b.to=d,b.step=s):i.push({style:g,from:Math.max(c,t),to:d,step:s})}}}),i.forEach(l=>e.step(new vc(l.from,l.to,l.style)))}function lb(e,t,n,r=n.contentMatch,i=!0){let s=e.doc.nodeAt(t),l=[],c=t+1;for(let f=0;f<s.childCount;f++){let d=s.child(f),p=c+d.nodeSize,g=r.matchType(d.type);if(!g)l.push(new Eo(c,p,Ge.empty));else{r=g;for(let b=0;b<d.marks.length;b++)n.allowsMarkType(d.marks[b].type)||e.step(new vc(c,p,d.marks[b]));if(i&&d.isText&&n.whitespace!="pre"){let b,y=/\r?\n|\r/g,M;for(;b=y.exec(d.text);)M||(M=new Ge(ke.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),l.push(new Eo(c+b.index,c+b.index+b[0].length,M))}}c=p}if(!r.validEnd){let f=r.fillBefore(ke.empty,!0);e.replace(c,c,new Ge(f,0,0))}for(let f=l.length-1;f>=0;f--)e.step(l[f])}function LL(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Eh(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth,i=0,s=0;;--r){let l=e.$from.node(r),c=e.$from.index(r)+i,f=e.$to.indexAfter(r)-s;if(r<e.depth&&l.canReplace(c,f,n))return r;if(r==0||l.type.spec.isolating||!LL(l,c,f))break;c&&(i=1),f<l.childCount&&(s=1)}return null}function RL(e,t,n){let{$from:r,$to:i,depth:s}=t,l=r.before(s+1),c=i.after(s+1),f=l,d=c,p=ke.empty,g=0;for(let M=s,E=!1;M>n;M--)E||r.index(M)>0?(E=!0,p=ke.from(r.node(M).copy(p)),g++):f--;let b=ke.empty,y=0;for(let M=s,E=!1;M>n;M--)E||i.after(M+1)<i.end(M)?(E=!0,b=ke.from(i.node(M).copy(b)),y++):d++;e.step(new xs(f,d,l,c,new Ge(p.append(b),g,y),p.size-g,!0))}function cb(e,t,n=null,r=e){let i=OL(e,t),s=i&&PL(r,t);return s?i.map(o3).concat({type:t,attrs:n}).concat(s.map(o3)):null}function o3(e){return{type:e,attrs:null}}function OL(e,t){let{parent:n,startIndex:r,endIndex:i}=e,s=n.contentMatchAt(r).findWrapping(t);if(!s)return null;let l=s.length?s[0]:t;return n.canReplaceWith(r,i,l)?s:null}function PL(e,t){let{parent:n,startIndex:r,endIndex:i}=e,s=n.child(r),l=t.contentMatch.findWrapping(s.type);if(!l)return null;let f=(l.length?l[l.length-1]:t).contentMatch;for(let d=r;f&&d<i;d++)f=f.matchType(n.child(d).type);return!f||!f.validEnd?null:l}function jL(e,t,n){let r=ke.empty;for(let l=n.length-1;l>=0;l--){if(r.size){let c=n[l].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=ke.from(n[l].type.create(n[l].attrs,r))}let i=t.start,s=t.end;e.step(new xs(i,s,i,s,new Ge(r,0,0),n.length,!0))}function IL(e,t,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=e.steps.length;e.doc.nodesBetween(t,n,(l,c)=>{let f=typeof i=="function"?i(l):i;if(l.isTextblock&&!l.hasMarkup(r,f)&&zL(e.doc,e.mapping.slice(s).map(c),r)){let d=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",M=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!M?d=!1:!y&&M&&(d=!0)}d===!1&&gM(e,l,c,s),lb(e,e.mapping.slice(s).map(c,1),r,void 0,d===null);let p=e.mapping.slice(s),g=p.map(c,1),b=p.map(c+l.nodeSize,1);return e.step(new xs(g,b,g+1,b-1,new Ge(ke.from(r.create(f,null,l.marks)),0,0),1,!0)),d===!0&&mM(e,l,c,s),!1}})}function mM(e,t,n,r){t.forEach((i,s)=>{if(i.isText){let l,c=/\r?\n|\r/g;for(;l=c.exec(i.text);){let f=e.mapping.slice(r).map(n+1+s+l.index);e.replaceWith(f,f+1,t.type.schema.linebreakReplacement.create())}}})}function gM(e,t,n,r){t.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let l=e.mapping.slice(r).map(n+1+s);e.replaceWith(l,l+1,t.type.schema.text(`
99
+ `))}})}function zL(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function BL(e,t,n,r,i){let s=e.doc.nodeAt(t);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let l=n.create(r,null,i||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,l);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new xs(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new Ge(ke.from(l),0,0),1,!0))}function Iu(e,t,n=1,r){let i=e.resolve(t),s=i.depth-n,l=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!l.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let d=i.depth-1,p=n-2;d>s;d--,p--){let g=i.node(d),b=i.index(d);if(g.type.spec.isolating)return!1;let y=g.content.cutByIndex(b,g.childCount),M=r&&r[p+1];M&&(y=y.replaceChild(0,M.type.create(M.attrs)));let E=r&&r[p]||g;if(!g.canReplace(b+1,g.childCount)||!E.type.validContent(y))return!1}let c=i.indexAfter(s),f=r&&r[0];return i.node(s).canReplaceWith(c,c,f?f.type:i.node(s+1).type)}function FL(e,t,n=1,r){let i=e.doc.resolve(t),s=ke.empty,l=ke.empty;for(let c=i.depth,f=i.depth-n,d=n-1;c>f;c--,d--){s=ke.from(i.node(c).copy(s));let p=r&&r[d];l=ke.from(p?p.type.create(p.attrs,l):i.node(c).copy(l))}e.step(new Eo(t,t,new Ge(s.append(l),n,n),!0))}function Lf(e,t){let n=e.resolve(t),r=n.index();return yM(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function UL(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let s=t.child(i),l=s.type==r?e.type.schema.nodes.text:s.type;if(n=n.matchType(l),!n||!e.type.allowsMarks(s.marks))return!1}return n.validEnd}function yM(e,t){return!!(e&&t&&!e.isLeaf&&UL(e,t))}function n1(e,t,n=-1){let r=e.resolve(t);for(let i=r.depth;;i--){let s,l,c=r.index(i);if(i==r.depth?(s=r.nodeBefore,l=r.nodeAfter):n>0?(s=r.node(i+1),c++,l=r.node(i).maybeChild(c)):(s=r.node(i).maybeChild(c-1),l=r.node(i+1)),s&&!s.isTextblock&&yM(s,l)&&r.node(i).canReplace(c,c+1))return t;if(i==0)break;t=n<0?r.before(i):r.after(i)}}function HL(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,s=e.doc.resolve(t-n),l=s.node().type;if(i&&l.inlineContent){let p=l.whitespace=="pre",g=!!l.contentMatch.matchType(i);p&&!g?r=!1:!p&&g&&(r=!0)}let c=e.steps.length;if(r===!1){let p=e.doc.resolve(t+n);gM(e,p.node(),p.before(),c)}l.inlineContent&&lb(e,t+n-1,l,s.node().contentMatchAt(s.index()),r==null);let f=e.mapping.slice(c),d=f.map(t-n);if(e.step(new Eo(d,f.map(t+n,-1),Ge.empty,!0)),r===!0){let p=e.doc.resolve(d);mM(e,p.node(),p.before(),e.steps.length)}return e}function qL(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function bM(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let l=r.depth;l>=0;l--){let c=l==r.depth?0:r.pos<=(r.start(l+1)+r.end(l+1))/2?-1:1,f=r.index(l)+(c>0?1:0),d=r.node(l),p=!1;if(s==1)p=d.canReplace(f,f,i);else{let g=d.contentMatchAt(f).findWrapping(i.firstChild.type);p=g&&d.canReplaceWith(f,f,g[0])}if(p)return c==0?r.pos:c<0?r.before(l+1):r.after(l+1)}return null}function r1(e,t,n=t,r=Ge.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),s=e.resolve(n);return xM(i,s,r)?new Eo(t,n,r):new $L(i,s,r).fit()}function xM(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class $L{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ke.empty;for(let i=0;i<=t.depth;i++){let s=t.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=ke.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;let s=this.placed,l=r.depth,c=i.depth;for(;l&&c&&s.childCount==1;)s=s.firstChild.content,l--,c--;let f=new Ge(s,l,c);return t>-1?new xs(r.pos,t,this.$to.pos,this.$to.end(),f,n):f.size||r.pos!=this.$to.pos?new Eo(r.pos,i.pos,f):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<t;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){t=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=s3(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let l=i.firstChild;for(let c=this.depth;c>=0;c--){let{type:f,match:d}=this.frontier[c],p,g=null;if(n==1&&(l?d.matchType(l.type)||(g=d.fillBefore(ke.from(l),!1)):s&&f.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:c,parent:s,inject:g};if(n==2&&l&&(p=d.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:c,parent:s,wrap:p};if(s&&d.matchType(s.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced;return a3(t,-1)<=n?!1:(this.unplaced.size>1&&a3(t,1)>r&&r++,this.unplaced=new Ge(t,n+1,r),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=s3(t,n);if(i.childCount<=1&&n>0){let s=t.size-n<=n+i.size;this.unplaced=new Ge(yp(t,n-1,1),n-1,s?n-1:r)}else this.unplaced=new Ge(yp(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let E=0;E<s.length;E++)this.openFrontierNode(s[E]);let l=this.unplaced,c=r?r.content:l.content,f=l.openStart-t,d=0,p=[],{match:g,type:b}=this.frontier[n];if(i){for(let E=0;E<i.childCount;E++)p.push(i.child(E));g=g.matchFragment(i)}let y=c.size+t-(l.content.size-l.openEnd);for(;d<c.childCount;){let E=c.child(d),D=g.matchType(E.type);if(!D)break;d++,(d>1||f==0||E.content.size)&&(g=D,p.push(vM(E.mark(b.allowedMarks(E.marks)),d==1?f:0,d==c.childCount?y:-1)))}let M=d==c.childCount;M||(y=-1),this.placed=bp(this.placed,n,ke.from(p)),this.frontier[n].match=g,M&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let E=0,D=c;E<y;E++){let L=D.lastChild;this.frontier.push({type:L.type,match:L.contentMatchAt(L.childCount)}),D=L.content}this.unplaced=M?t==0?Ge.empty:new Ge(yp(l.content,t-1,1),t-1,y<0?l.openEnd:t-1):new Ge(yp(l.content,t,d),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!r2(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(t){t:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),l=r2(t,n,i,r,s);if(l){for(let c=n-1;c>=0;c--){let{match:f,type:d}=this.frontier[c],p=r2(t,c,d,f,!0);if(!p||p.childCount)continue t}return{depth:n,fit:l,move:s?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=bp(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let i=t.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,t.index(r));this.openFrontierNode(i.type,i.attrs,s)}return t}openFrontierNode(t,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=bp(this.placed,this.depth,ke.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ke.empty,!0);n.childCount&&(this.placed=bp(this.placed,this.frontier.length,n))}}function yp(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(yp(e.firstChild.content,t-1,n)))}function bp(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(bp(e.lastChild.content,t-1,n)))}function s3(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function vM(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,vM(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(ke.empty,!0)))),e.copy(r)}function r2(e,t,n,r,i){let s=e.node(t),l=i?e.indexAfter(t):e.index(t);if(l==s.childCount&&!n.compatibleContent(s.type))return null;let c=r.fillBefore(s.content,!0,l);return c&&!YL(n,s.content,l)?c:null}function YL(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function VL(e){return e.spec.defining||e.spec.definingForContent}function a3(e,t){for(let n=0;;n++){let r=t<0?e.firstChild:e.lastChild;if(!r||r.isAtom)return n;e=r.content}}function WL(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),s=e.doc.resolve(n);if(xM(i,s,r))return e.step(new Eo(t,n,r));let l=SM(i,s);l[l.length-1]==0&&l.pop();let c=-(i.depth+1);l.unshift(c);for(let b=i.depth,y=i.pos-1;b>0;b--,y--){let M=i.node(b).type.spec;if(M.defining||M.definingAsContext||M.isolating)break;l.indexOf(b)>-1?c=b:i.before(b)==y&&l.splice(1,0,-b)}let f=l.indexOf(c),d=[],p=r.openStart;for(let b=r.content,y=0;;y++){let M=b.firstChild;if(d.push(M),y==r.openStart)break;b=M.content}for(let b=p-1;b>=0;b--){let y=d[b],M=VL(y.type);if(M&&!y.sameMarkup(i.node(Math.abs(c)-1)))p=b;else if(M||!y.type.isTextblock)break}for(let b=r.openStart;b>=0;b--){let y=(b+p+1)%(r.openStart+1),M=d[y];if(M)for(let E=0;E<l.length;E++){let D=l[(E+f)%l.length],L=!0;D<0&&(L=!1,D=-D);let q=i.node(D-1),$=i.index(D-1);if(q.canReplaceWith($,$,M.type,M.marks))return e.replace(i.before(D),L?s.after(D):n,new Ge(wM(r.content,0,r.openStart,y),y,r.openEnd))}}let g=e.steps.length;for(let b=l.length-1;b>=0&&(e.replace(t,n,r),!(e.steps.length>g));b--){let y=l[b];y<0||(t=i.before(y),n=s.after(y))}}function wM(e,t,n,r,i){if(t<n){let s=e.firstChild;e=e.replaceChild(0,s.copy(wM(s.content,t+1,n,r,s)))}if(t>r){let s=i.contentMatchAt(0),l=s.fillBefore(e).append(e);e=l.append(s.matchFragment(l).fillBefore(ke.empty,!0))}return e}function XL(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=qL(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new Ge(ke.from(r),0,0))}function GL(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let l=r.sharedDepth(n),c=!1;for(let f=r.depth;f>l;f--)r.node(f).type.spec.isolating&&(c=!0);for(let f=i.depth;f>l;f--)i.node(f).type.spec.isolating&&(c=!0);if(!c){for(let f=r.depth;f>0&&t==r.start(f);f--)t=r.before(f);for(let f=i.depth;f>0&&n==i.start(f);f--)n=i.before(f);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let s=SM(r,i);for(let l=0;l<s.length;l++){let c=s[l],f=l==s.length-1;if(f&&c==0||r.node(c).type.contentMatch.validEnd)return e.delete(r.start(c),i.end(c));if(c>0&&(f||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return e.delete(r.before(c),i.after(c))}for(let l=1;l<=r.depth&&l<=i.depth;l++)if(t-r.start(l)==r.depth-l&&n>r.end(l)&&i.end(l)-n!=i.depth-l&&r.start(l-1)==i.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),i.index(l-1)))return e.delete(r.before(l),n);e.delete(t,n)}function SM(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let s=e.start(i);if(s<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(s==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==s-1)&&n.push(i)}return n}class uh extends pa{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return $o.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return $o.fromReplace(t,this.pos,this.pos+1,new Ge(ke.from(i),0,n.isLeaf?0:1))}getMap(){return hl.empty}invert(t){return new uh(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new uh(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new uh(n.pos,n.attr,n.value)}}pa.jsonID("attr",uh);class Yp extends pa{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let i in t.attrs)n[i]=t.attrs[i];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return $o.ok(r)}getMap(){return hl.empty}invert(t){return new Yp(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Yp(n.attr,n.value)}}pa.jsonID("docAttr",Yp);let gh=class extends Error{};gh=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};gh.prototype=Object.create(Error.prototype);gh.prototype.constructor=gh;gh.prototype.name="TransformError";class kM{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new $p}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new gh(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(t=i.map(t,1),n=i.map(n,-1)),i.forEach((s,l,c,f)=>{t=Math.min(t,c),n=Math.max(n,f)})}return t==1e9?null:{from:t,to:n}}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=Ge.empty){let i=r1(this.doc,t,n,r);return i&&this.step(i),this}replaceWith(t,n,r){return this.replace(t,n,new Ge(ke.from(r),0,0))}delete(t,n){return this.replace(t,n,Ge.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return WL(this,t,n,r),this}replaceRangeWith(t,n,r){return XL(this,t,n,r),this}deleteRange(t,n){return GL(this,t,n),this}lift(t,n){return RL(this,t,n),this}join(t,n=1){return HL(this,t,n),this}wrap(t,n){return jL(this,t,n),this}setBlockType(t,n=t,r,i=null){return IL(this,t,n,r,i),this}setNodeMarkup(t,n,r=null,i){return BL(this,t,n,r,i),this}setNodeAttribute(t,n,r){return this.step(new uh(t,n,r)),this}setDocAttribute(t,n){return this.step(new Yp(t,n)),this}addNodeMark(t,n){return this.step(new Af(t,n)),this}removeNodeMark(t,n){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n instanceof bi)n.isInSet(r.marks)&&this.step(new vd(t,n));else{let i=r.marks,s,l=[];for(;s=n.isInSet(i);)l.push(new vd(t,s)),i=s.removeFromSet(i);for(let c=l.length-1;c>=0;c--)this.step(l[c])}return this}split(t,n=1,r){return FL(this,t,n,r),this}addMark(t,n,r){return _L(this,t,n,r),this}removeMark(t,n,r){return DL(this,t,n,r),this}clearIncompatible(t,n,r){return lb(this,t,n,r),this}}const i2=Object.create(null);class rr{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new KL(t.min(n),t.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let n=0;n<t.length;n++)if(t[n].$from.pos!=t[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,n=Ge.empty){let r=n.content.lastChild,i=null;for(let c=0;c<n.openEnd;c++)i=r,r=r.lastChild;let s=t.steps.length,l=this.ranges;for(let c=0;c<l.length;c++){let{$from:f,$to:d}=l[c],p=t.mapping.slice(s);t.replaceRange(p.map(f.pos),p.map(d.pos),c?Ge.empty:n),c==0&&u3(t,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(t,n){let r=t.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:l,$to:c}=i[s],f=t.mapping.slice(r),d=f.map(l.pos),p=f.map(c.pos);s?t.deleteRange(d,p):(t.replaceRangeWith(d,p,n),u3(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let i=t.parent.inlineContent?new Pn(t):Qd(t.node(0),t.parent,t.pos,t.index(),n,r);if(i)return i;for(let s=t.depth-1;s>=0;s--){let l=n<0?Qd(t.node(0),t.node(s),t.before(s+1),t.index(s),n,r):Qd(t.node(0),t.node(s),t.after(s+1),t.index(s)+1,n,r);if(l)return l}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new gl(t.node(0))}static atStart(t){return Qd(t,t,0,0,1)||new gl(t)}static atEnd(t){return Qd(t,t,t.content.size,t.childCount,-1)||new gl(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=i2[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in i2)throw new RangeError("Duplicate use of selection JSON ID "+t);return i2[t]=n,n.prototype.jsonID=t,n}getBookmark(){return Pn.between(this.$anchor,this.$head).getBookmark()}}rr.prototype.visible=!0;class KL{constructor(t,n){this.$from=t,this.$to=n}}let l3=!1;function c3(e){!l3&&!e.parent.inlineContent&&(l3=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Pn extends rr{constructor(t,n=t){c3(t),c3(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return rr.near(r);let i=t.resolve(n.map(this.anchor));return new Pn(i.parent.inlineContent?i:r,r)}replace(t,n=Ge.empty){if(super.replace(t,n),n==Ge.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof Pn&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new i1(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Pn(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let i=t.resolve(n);return new this(i,r==n?i:t.resolve(r))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=rr.findFrom(n,r,!0)||rr.findFrom(n,-r,!0);if(s)n=s.$head;else return rr.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(rr.findFrom(t,-r,!0)||rr.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new Pn(t,n)}}rr.jsonID("text",Pn);class i1{constructor(t,n){this.anchor=t,this.head=n}map(t){return new i1(t.map(this.anchor),t.map(this.head))}resolve(t){return Pn.between(t.resolve(this.anchor),t.resolve(this.head))}}class Nn extends rr{constructor(t){let n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);super(t,r),this.node=n}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=t.resolve(i);return r?rr.near(s):new Nn(s)}content(){return new Ge(ke.from(this.node),0,0)}eq(t){return t instanceof Nn&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ub(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Nn(t.resolve(n.anchor))}static create(t,n){return new Nn(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}Nn.prototype.visible=!1;rr.jsonID("node",Nn);class ub{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new i1(r,r):new ub(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&Nn.isSelectable(r)?new Nn(n):rr.near(n)}}class gl extends rr{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=Ge.empty){if(n==Ge.empty){t.delete(0,t.doc.content.size);let r=rr.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new gl(t)}map(t){return new gl(t)}eq(t){return t instanceof gl}getBookmark(){return JL}}rr.jsonID("all",gl);const JL={map(){return this},resolve(e){return new gl(e)}};function Qd(e,t,n,r,i,s=!1){if(t.inlineContent)return Pn.create(e,n);for(let l=r-(i>0?0:1);i>0?l<t.childCount:l>=0;l+=i){let c=t.child(l);if(c.isAtom){if(!s&&Nn.isSelectable(c))return Nn.create(e,n-(i<0?c.nodeSize:0))}else{let f=Qd(e,c,n+i,i<0?c.childCount:0,i,s);if(f)return f}n+=c.nodeSize*i}return null}function u3(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Eo||i instanceof xs))return;let s=e.mapping.maps[r],l;s.forEach((c,f,d,p)=>{l==null&&(l=p)}),e.setSelection(rr.near(e.doc.resolve(l),n))}const f3=1,fg=2,d3=4;class ZL extends kM{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|f3)&~fg,this.storedMarks=null,this}get selectionSet(){return(this.updated&f3)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=fg,this}ensureMarks(t){return bi.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&fg)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~fg,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let r=this.selection;return n&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||bi.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,r){let i=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(r==null&&(r=n),!t)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let l=this.doc.resolve(n);s=r==n?l.marks():l.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(t,s)),!this.selection.empty&&this.selection.to==n+t.length&&this.setSelection(rr.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=d3,this}get scrolledIntoView(){return(this.updated&d3)>0}}function h3(e,t){return!t||!e?e:e.bind(t)}class xp{constructor(t,n,r){this.name=t,this.init=h3(n.init,r),this.apply=h3(n.apply,r)}}const QL=[new xp("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new xp("selection",{init(e,t){return e.selection||rr.atStart(t.doc)},apply(e){return e.selection}}),new xp("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new xp("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class o2{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=QL.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new xp(r.key,r.spec.state,r))})}}class nd{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let n=[t],r=this.applyInner(t),i=null;for(;;){let s=!1;for(let l=0;l<this.config.plugins.length;l++){let c=this.config.plugins[l];if(c.spec.appendTransaction){let f=i?i[l].n:0,d=i?i[l].state:this,p=f<n.length&&c.spec.appendTransaction.call(c,f?n.slice(f):n,d,r);if(p&&r.filterTransaction(p,l)){if(p.setMeta("appendedTransaction",t),!i){i=[];for(let g=0;g<this.config.plugins.length;g++)i.push(g<l?{state:r,n:n.length}:{state:this,n:0})}n.push(p),r=r.applyInner(p),s=!0}i&&(i[l]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new nd(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(t,this[s.name],this,n)}return n}get tr(){return new ZL(this)}static create(t){let n=new o2(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new nd(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(t,r);return r}reconfigure(t){let n=new o2(this.schema,t.plugins),r=n.fields,i=new nd(n);for(let s=0;s<r.length;s++){let l=r[s].name;i[l]=this.hasOwnProperty(l)?this[l]:r[s].init(t,i)}return i}toJSON(t){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=t[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new o2(t.schema,t.plugins),s=new nd(i);return i.fields.forEach(l=>{if(l.name=="doc")s.doc=ud.fromJSON(t.schema,n.doc);else if(l.name=="selection")s.selection=rr.fromJSON(s.doc,n.selection);else if(l.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let c in r){let f=r[c],d=f.spec.state;if(f.key==l.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){s[l.name]=d.fromJSON.call(f,t,n[c],s);return}}s[l.name]=l.init(t,s)}}),s}}function AM(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r=="handleDOMEvents"&&(i=AM(i,t,{})),n[r]=i}return n}class Zi{constructor(t){this.spec=t,this.props={},t.props&&AM(t.props,this,this.props),this.key=t.key?t.key.key:MM("plugin")}getState(t){return t[this.key]}}const s2=Object.create(null);function MM(e){return e in s2?e+"$"+ ++s2[e]:(s2[e]=0,e+"$")}class Vo{constructor(t="key"){this.key=MM(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const CM=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function EM(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const TM=(e,t,n)=>{let r=EM(e,n);if(!r)return!1;let i=fb(r);if(!i){let l=r.blockRange(),c=l&&Eh(l);return c==null?!1:(t&&t(e.tr.lift(l,c).scrollIntoView()),!0)}let s=i.nodeBefore;if(IM(e,i,t,-1))return!0;if(r.parent.content.size==0&&(yh(s,"end")||Nn.isSelectable(s)))for(let l=r.depth;;l--){let c=r1(e.doc,r.before(l),r.after(l),Ge.empty);if(c&&c.slice.size<c.to-c.from){if(t){let f=e.tr.step(c);f.setSelection(yh(s,"end")?rr.findFrom(f.doc.resolve(f.mapping.map(i.pos,-1)),-1):Nn.create(f.doc,i.pos-s.nodeSize)),t(f.scrollIntoView())}return!0}if(l==1||r.node(l-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},tR=(e,t,n)=>{let r=EM(e,n);if(!r)return!1;let i=fb(r);return i?NM(e,i,t):!1},eR=(e,t,n)=>{let r=DM(e,n);if(!r)return!1;let i=db(r);return i?NM(e,i,t):!1};function NM(e,t,n){let r=t.nodeBefore,i=r,s=t.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let p=i.lastChild;if(!p)return!1;i=p}let l=t.nodeAfter,c=l,f=t.pos+1;for(;!c.isTextblock;f++){if(c.type.spec.isolating)return!1;let p=c.firstChild;if(!p)return!1;c=p}let d=r1(e.doc,s,f,Ge.empty);if(!d||d.from!=s||d instanceof Eo&&d.slice.size>=f-s)return!1;if(n){let p=e.tr.step(d);p.setSelection(Pn.create(p.doc,s)),n(p.scrollIntoView())}return!0}function yh(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const _M=(e,t,n)=>{let{$head:r,empty:i}=e.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;s=fb(r)}let l=s&&s.nodeBefore;return!l||!Nn.isSelectable(l)?!1:(t&&t(e.tr.setSelection(Nn.create(e.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function fb(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function DM(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const LM=(e,t,n)=>{let r=DM(e,n);if(!r)return!1;let i=db(r);if(!i)return!1;let s=i.nodeAfter;if(IM(e,i,t,1))return!0;if(r.parent.content.size==0&&(yh(s,"start")||Nn.isSelectable(s))){let l=r1(e.doc,r.before(),r.after(),Ge.empty);if(l&&l.slice.size<l.to-l.from){if(t){let c=e.tr.step(l);c.setSelection(yh(s,"start")?rr.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):Nn.create(c.doc,c.mapping.map(i.pos))),t(c.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},RM=(e,t,n)=>{let{$head:r,empty:i}=e.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;s=db(r)}let l=s&&s.nodeAfter;return!l||!Nn.isSelectable(l)?!1:(t&&t(e.tr.setSelection(Nn.create(e.doc,s.pos)).scrollIntoView()),!0)};function db(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const nR=(e,t)=>{let n=e.selection,r=n instanceof Nn,i;if(r){if(n.node.isTextblock||!Lf(e.doc,n.from))return!1;i=n.from}else if(i=n1(e.doc,n.from,-1),i==null)return!1;if(t){let s=e.tr.join(i);r&&s.setSelection(Nn.create(s.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(s.scrollIntoView())}return!0},rR=(e,t)=>{let n=e.selection,r;if(n instanceof Nn){if(n.node.isTextblock||!Lf(e.doc,n.to))return!1;r=n.to}else if(r=n1(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},iR=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),s=i&&Eh(i);return s==null?!1:(t&&t(e.tr.lift(i,s).scrollIntoView()),!0)},OM=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
100
+ `).scrollIntoView()),!0)};function hb(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const oR=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),l=hb(i.contentMatchAt(s));if(!l||!i.canReplaceWith(s,s,l))return!1;if(t){let c=n.after(),f=e.tr.replaceWith(c,c,l.createAndFill());f.setSelection(rr.near(f.doc.resolve(c),1)),t(f.scrollIntoView())}return!0},PM=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof gl||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=hb(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){let l=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,c=e.tr.insert(l,s.createAndFill());c.setSelection(Pn.create(c.doc,l+1)),t(c.scrollIntoView())}return!0},jM=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(Iu(e.doc,s))return t&&t(e.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Eh(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function sR(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof Nn&&t.selection.node.isBlock)return!r.parentOffset||!Iu(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],l,c,f=!1,d=!1;for(let y=r.depth;;y--)if(r.node(y).isBlock){f=r.end(y)==r.pos+(r.depth-y),d=r.start(y)==r.pos-(r.depth-y),c=hb(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),s.unshift(f&&c?{type:c}:null),l=y;break}else{if(y==1)return!1;s.unshift(null)}let p=t.tr;(t.selection instanceof Pn||t.selection instanceof gl)&&p.deleteSelection();let g=p.mapping.map(r.pos),b=Iu(p.doc,g,s.length,s);if(b||(s[0]=c?{type:c}:null,b=Iu(p.doc,g,s.length,s)),!b)return!1;if(p.split(g,s.length,s),!f&&d&&r.node(l).type!=c){let y=p.mapping.map(r.before(l)),M=p.doc.resolve(y);c&&r.node(l-1).canReplaceWith(M.index(),M.index()+1,c)&&p.setNodeMarkup(p.mapping.map(r.before(l)),c)}return n&&n(p.scrollIntoView()),!0}}const aR=sR(),lR=(e,t)=>{let{$from:n,to:r}=e.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),t&&t(e.tr.setSelection(Nn.create(e.doc,i))),!0)};function cR(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,s=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(s-1,s)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(s,s+1)||!(i.isTextblock||Lf(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function IM(e,t,n,r){let i=t.nodeBefore,s=t.nodeAfter,l,c,f=i.type.spec.isolating||s.type.spec.isolating;if(!f&&cR(e,t,n))return!0;let d=!f&&t.parent.canReplace(t.index(),t.index()+1);if(d&&(l=(c=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&c.matchType(l[0]||s.type).validEnd){if(n){let y=t.pos+s.nodeSize,M=ke.empty;for(let L=l.length-1;L>=0;L--)M=ke.from(l[L].create(null,M));M=ke.from(i.copy(M));let E=e.tr.step(new xs(t.pos-1,y,t.pos,y,new Ge(M,1,0),l.length,!0)),D=E.doc.resolve(y+2*l.length);D.nodeAfter&&D.nodeAfter.type==i.type&&Lf(E.doc,D.pos)&&E.join(D.pos),n(E.scrollIntoView())}return!0}let p=s.type.spec.isolating||r>0&&f?null:rr.findFrom(t,1),g=p&&p.$from.blockRange(p.$to),b=g&&Eh(g);if(b!=null&&b>=t.depth)return n&&n(e.tr.lift(g,b).scrollIntoView()),!0;if(d&&yh(s,"start",!0)&&yh(i,"end")){let y=i,M=[];for(;M.push(y),!y.isTextblock;)y=y.lastChild;let E=s,D=1;for(;!E.isTextblock;E=E.firstChild)D++;if(y.canReplace(y.childCount,y.childCount,E.content)){if(n){let L=ke.empty;for(let $=M.length-1;$>=0;$--)L=ke.from(M[$].copy(L));let q=e.tr.step(new xs(t.pos-M.length,t.pos+s.nodeSize,t.pos+D,t.pos+s.nodeSize-D,new Ge(L,M.length,0),0,!0));n(q.scrollIntoView())}return!0}}return!1}function zM(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(t.tr.setSelection(Pn.create(t.doc,e<0?i.start(s):i.end(s)))),!0):!1}}const uR=zM(-1),fR=zM(1);function dR(e,t=null){return function(n,r){let{$from:i,$to:s}=n.selection,l=i.blockRange(s),c=l&&cb(l,e,t);return c?(r&&r(n.tr.wrap(l,c).scrollIntoView()),!0):!1}}function p3(e,t=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[s];n.doc.nodesBetween(l,c,(f,d)=>{if(i)return!1;if(!(!f.isTextblock||f.hasMarkup(e,t)))if(f.type==e)i=!0;else{let p=n.doc.resolve(d),g=p.index();i=p.parent.canReplaceWith(g,g+1,e)}})}if(!i)return!1;if(r){let s=n.tr;for(let l=0;l<n.selection.ranges.length;l++){let{$from:{pos:c},$to:{pos:f}}=n.selection.ranges[l];s.setBlockType(c,f,e,t)}r(s.scrollIntoView())}return!0}}function pb(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}pb(CM,TM,_M);pb(CM,LM,RM);pb(OM,PM,jM,aR);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function hR(e,t=null){return function(n,r){let{$from:i,$to:s}=n.selection,l=i.blockRange(s);if(!l)return!1;let c=r?n.tr:null;return pR(c,l,e,t)?(r&&r(c.scrollIntoView()),!0):!1}}function pR(e,t,n,r=null){let i=!1,s=t,l=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let f=l.resolve(t.start-2);s=new a0(f,f,t.depth),t.endIndex<t.parent.childCount&&(t=new a0(t.$from,l.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let c=cb(s,n,r,t);return c?(e&&mR(e,t,c,i,n),!0):!1}function mR(e,t,n,r,i){let s=ke.empty;for(let p=n.length-1;p>=0;p--)s=ke.from(n[p].type.create(n[p].attrs,s));e.step(new xs(t.start-(r?2:0),t.end,t.start,t.end,new Ge(s,0,0),n.length,!0));let l=0;for(let p=0;p<n.length;p++)n[p].type==i&&(l=p+1);let c=n.length-l,f=t.start+n.length-(r?2:0),d=t.parent;for(let p=t.startIndex,g=t.endIndex,b=!0;p<g;p++,b=!1)!b&&Iu(e.doc,f,c)&&(e.split(f,c),f+=2*c),f+=d.child(p).nodeSize;return e}function gR(e){return function(t,n){let{$from:r,$to:i}=t.selection,s=r.blockRange(i,l=>l.childCount>0&&l.firstChild.type==e);return s?n?r.node(s.depth-1).type==e?yR(t,n,e,s):bR(t,n,s):!0:!1}}function yR(e,t,n,r){let i=e.tr,s=r.end,l=r.$to.end(r.depth);s<l&&(i.step(new xs(s-1,l,s,l,new Ge(ke.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new a0(i.doc.resolve(r.$from.pos),i.doc.resolve(l),r.depth));const c=Eh(r);if(c==null)return!1;i.lift(r,c);let f=i.doc.resolve(i.mapping.map(s,-1)-1);return Lf(i.doc,f.pos)&&f.nodeBefore.type==f.nodeAfter.type&&i.join(f.pos),t(i.scrollIntoView()),!0}function bR(e,t,n){let r=e.tr,i=n.parent;for(let y=n.end,M=n.endIndex-1,E=n.startIndex;M>E;M--)y-=i.child(M).nodeSize,r.delete(y-1,y+1);let s=r.doc.resolve(n.start),l=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,f=n.endIndex==i.childCount,d=s.node(-1),p=s.index(-1);if(!d.canReplace(p+(c?0:1),p+1,l.content.append(f?ke.empty:ke.from(i))))return!1;let g=s.pos,b=g+l.nodeSize;return r.step(new xs(g-(c?1:0),b+(f?1:0),g+1,b-1,new Ge((c?ke.empty:ke.from(i.copy(ke.empty))).append(f?ke.empty:ke.from(i.copy(ke.empty))),c?0:1,f?0:1),c?0:1)),t(r.scrollIntoView()),!0}function xR(e){return function(t,n){let{$from:r,$to:i}=t.selection,s=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==e);if(!s)return!1;let l=s.startIndex;if(l==0)return!1;let c=s.parent,f=c.child(l-1);if(f.type!=e)return!1;if(n){let d=f.lastChild&&f.lastChild.type==c.type,p=ke.from(d?e.create():null),g=new Ge(ke.from(e.create(null,ke.from(c.type.create(null,p)))),d?3:1,0),b=s.start,y=s.end;n(t.tr.step(new xs(b-(d?3:1),y,b,y,g,1,!0)).scrollIntoView())}return!0}}const zs=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},bh=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let g5=null;const Ru=function(e,t,n){let r=g5||(g5=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},vR=function(){g5=null},wd=function(e,t,n,r){return n&&(m3(e,t,n,r,-1)||m3(e,t,n,r,1))},wR=/^(img|br|input|textarea|hr)$/i;function m3(e,t,n,r,i){for(var s;;){if(e==n&&t==r)return!0;if(t==(i<0?0:ql(e))){let l=e.parentNode;if(!l||l.nodeType!=1||im(e)||wR.test(e.nodeName)||e.contentEditable=="false")return!1;t=zs(e)+(i<0?0:1),e=l}else if(e.nodeType==1){let l=e.childNodes[t+(i<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((s=l.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)t+=i;else return!1;else e=l,t=i<0?ql(e):0}else return!1}}function ql(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function SR(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=ql(e)}else if(e.parentNode&&!im(e))t=zs(e),e=e.parentNode;else return null}}function kR(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!im(e))t=zs(e)+1,e=e.parentNode;else return null}}function AR(e,t,n){for(let r=t==0,i=t==ql(e);r||i;){if(e==n)return!0;let s=zs(e);if(e=e.parentNode,!e)return!1;r=r&&s==0,i=i&&s==ql(e)}}function im(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const o1=function(e){return e.focusNode&&wd(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function td(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function MR(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function CR(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(ql(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(ql(r.startContainer),r.startOffset)}}}const nu=typeof navigator<"u"?navigator:null,g3=typeof document<"u"?document:null,Rf=nu&&nu.userAgent||"",y5=/Edge\/(\d+)/.exec(Rf),BM=/MSIE \d/.exec(Rf),b5=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Rf),Ga=!!(BM||b5||y5),Mf=BM?document.documentMode:b5?+b5[1]:y5?+y5[1]:0,$l=!Ga&&/gecko\/(\d+)/i.test(Rf);$l&&+(/Firefox\/(\d+)/.exec(Rf)||[0,0])[1];const x5=!Ga&&/Chrome\/(\d+)/.exec(Rf),Fs=!!x5,FM=x5?+x5[1]:0,ha=!Ga&&!!nu&&/Apple Computer/.test(nu.vendor),xh=ha&&(/Mobile\/\w+/.test(Rf)||!!nu&&nu.maxTouchPoints>2),Ul=xh||(nu?/Mac/.test(nu.platform):!1),UM=nu?/Win/.test(nu.platform):!1,Pu=/Android \d/.test(Rf),om=!!g3&&"webkitFontSmoothing"in g3.documentElement.style,ER=om?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function TR(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Tu(e,t){return typeof e=="number"?e:e[t]}function NR(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function y3(e,t,n){if(!v5(t)&&t.left==0)return;let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,s=e.dom.ownerDocument;for(let l=n||e.dom;l;){if(l.nodeType!=1){l=bh(l);continue}let c=l,f=c==s.body,d=f?TR(s):NR(c),p=0,g=0;if(t.top<d.top+Tu(r,"top")?g=-(d.top-t.top+Tu(i,"top")):t.bottom>d.bottom-Tu(r,"bottom")&&(g=t.bottom-t.top>d.bottom-d.top?t.top+Tu(i,"top")-d.top:t.bottom-d.bottom+Tu(i,"bottom")),t.left<d.left+Tu(r,"left")?p=-(d.left-t.left+Tu(i,"left")):t.right>d.right-Tu(r,"right")&&(p=t.right-d.right+Tu(i,"right")),p||g)if(f)s.defaultView.scrollBy(p,g);else{let y=c.scrollLeft,M=c.scrollTop;g&&(c.scrollTop+=g),p&&(c.scrollLeft+=p);let E=c.scrollLeft-y,D=c.scrollTop-M;t={left:t.left-E,top:t.top-D,right:t.right-E,bottom:t.bottom-D}}let b=f?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(b))break;l=b=="absolute"?l.offsetParent:bh(l)}}function _R(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let s=(t.left+t.right)/2,l=n+1;l<Math.min(innerHeight,t.bottom);l+=5){let c=e.root.elementFromPoint(s,l);if(!c||c==e.dom||!e.dom.contains(c))continue;let f=c.getBoundingClientRect();if(f.top>=n-20){r=c,i=f.top;break}}return{refDOM:r,refTop:i,stack:HM(e.dom)}}function HM(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=bh(r));return t}function DR({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;qM(n,r==0?0:r-t)}function qM(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:s}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Yd=null;function LR(e){if(e.setActive)return e.setActive();if(Yd)return e.focus(Yd);let t=HM(e);e.focus(Yd==null?{get preventScroll(){return Yd={preventScroll:!0},!0}}:void 0),Yd||(Yd=!1,qM(t,0))}function $M(e,t){let n,r=2e8,i,s=0,l=t.top,c=t.top,f,d;for(let p=e.firstChild,g=0;p;p=p.nextSibling,g++){let b;if(p.nodeType==1)b=p.getClientRects();else if(p.nodeType==3)b=Ru(p).getClientRects();else continue;for(let y=0;y<b.length;y++){let M=b[y];if(M.top<=l&&M.bottom>=c){l=Math.max(M.bottom,l),c=Math.min(M.top,c);let E=M.left>t.left?M.left-t.left:M.right<t.left?t.left-M.right:0;if(E<r){n=p,r=E,i=E&&n.nodeType==3?{left:M.right<t.left?M.right:M.left,top:t.top}:t,p.nodeType==1&&E&&(s=g+(t.left>=(M.left+M.right)/2?1:0));continue}}else M.top>t.top&&!f&&M.left<=t.left&&M.right>=t.left&&(f=p,d={left:Math.max(M.left,Math.min(M.right,t.left)),top:M.top});!n&&(t.left>=M.right&&t.top>=M.top||t.left>=M.left&&t.top>=M.bottom)&&(s=g+1)}}return!n&&f&&(n=f,i=d,r=0),n&&n.nodeType==3?RR(n,i):!n||r&&n.nodeType==1?{node:e,offset:s}:$M(n,i)}function RR(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(e,s+1),r.setStart(e,s);let l=pf(r,1);if(l.top!=l.bottom&&mb(t,l)){i={node:e,offset:s+(t.left>=(l.left+l.right)/2?1:0)};break}}return r.detach(),i||{node:e,offset:0}}function mb(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function OR(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function PR(e,t,n){let{node:r,offset:i}=$M(t,n),s=-1;if(r.nodeType==1&&!r.firstChild){let l=r.getBoundingClientRect();s=l.left!=l.right&&n.left>(l.left+l.right)/2?1:-1}return e.docView.posFromDOM(r,i,s)}function jR(e,t,n,r){let i=-1;for(let s=t,l=!1;s!=e.dom;){let c=e.docView.nearestDesc(s,!0),f;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((f=c.dom.getBoundingClientRect()).width||f.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!l&&f.left>r.left||f.top>r.top?i=c.posBefore:(!l&&f.right<r.left||f.bottom<r.top)&&(i=c.posAfter),l=!0),!c.contentDOM&&i<0&&!c.node.isText))return(c.node.isBlock?r.top<(f.top+f.bottom)/2:r.left<(f.left+f.right)/2)?c.posBefore:c.posAfter;s=c.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function YM(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let l=e.childNodes[s];if(l.nodeType==1){let c=l.getClientRects();for(let f=0;f<c.length;f++){let d=c[f];if(mb(t,d))return YM(l,t,d)}}if((s=(s+1)%r)==i)break}return e}function IR(e,t){let n=e.dom.ownerDocument,r,i=0,s=CR(n,t.left,t.top);s&&({node:r,offset:i}=s);let l=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),c;if(!l||!e.dom.contains(l.nodeType!=1?l.parentNode:l)){let d=e.dom.getBoundingClientRect();if(!mb(t,d)||(l=YM(e.dom,t,d),!l))return null}if(ha)for(let d=l;r&&d;d=bh(d))d.draggable&&(r=void 0);if(l=OR(l,t),r){if($l&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let p=r.childNodes[i],g;p.nodeName=="IMG"&&(g=p.getBoundingClientRect()).right<=t.left&&g.bottom>t.top&&i++}let d;om&&i&&r.nodeType==1&&(d=r.childNodes[i-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?c=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(c=jR(e,r,i,t))}c==null&&(c=PR(e,l,t));let f=e.docView.nearestDesc(l,!0);return{pos:c,inside:f?f.posAtStart-f.border:-1}}function v5(e){return e.top<e.bottom||e.left<e.right}function pf(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(v5(r))return r}return Array.prototype.find.call(n,v5)||e.getBoundingClientRect()}const zR=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function VM(e,t,n){let{node:r,offset:i,atom:s}=e.docView.domFromPos(t,n<0?-1:1),l=om||$l;if(r.nodeType==3)if(l&&(zR.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let f=pf(Ru(r,i,i),n);if($l&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=pf(Ru(r,i-1,i-1),-1);if(d.top==f.top){let p=pf(Ru(r,i,i+1),-1);if(p.top!=f.top)return ip(p,p.left<d.left)}}return f}else{let f=i,d=i,p=n<0?1:-1;return n<0&&!i?(d++,p=-1):n>=0&&i==r.nodeValue.length?(f--,p=1):n<0?f--:d++,ip(pf(Ru(r,f,d),p),p<0)}if(!e.state.doc.resolve(t-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==ql(r))){let f=r.childNodes[i-1];if(f.nodeType==1)return a2(f.getBoundingClientRect(),!1)}if(s==null&&i<ql(r)){let f=r.childNodes[i];if(f.nodeType==1)return a2(f.getBoundingClientRect(),!0)}return a2(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==ql(r))){let f=r.childNodes[i-1],d=f.nodeType==3?Ru(f,ql(f)-(l?0:1)):f.nodeType==1&&(f.nodeName!="BR"||!f.nextSibling)?f:null;if(d)return ip(pf(d,1),!1)}if(s==null&&i<ql(r)){let f=r.childNodes[i];for(;f.pmViewDesc&&f.pmViewDesc.ignoreForCoords;)f=f.nextSibling;let d=f?f.nodeType==3?Ru(f,0,l?0:1):f.nodeType==1?f:null:null;if(d)return ip(pf(d,-1),!0)}return ip(pf(r.nodeType==3?Ru(r):r,-n),n>=0)}function ip(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function a2(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function WM(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function BR(e,t,n){let r=t.selection,i=n=="up"?r.$from:r.$to;return WM(e,t,()=>{let{node:s}=e.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let c=e.docView.nearestDesc(s,!0);if(!c)break;if(c.node.isBlock){s=c.contentDOM||c.dom;break}s=c.dom.parentNode}let l=VM(e,i.pos,1);for(let c=s.firstChild;c;c=c.nextSibling){let f;if(c.nodeType==1)f=c.getClientRects();else if(c.nodeType==3)f=Ru(c,0,c.nodeValue.length).getClientRects();else continue;for(let d=0;d<f.length;d++){let p=f[d];if(p.bottom>p.top+1&&(n=="up"?l.top-p.top>(p.bottom-l.top)*2:p.bottom-l.bottom>(l.bottom-p.top)*2))return!1}}return!0})}const FR=/[\u0590-\u08ac]/;function UR(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,l=i==r.parent.content.size,c=e.domSelection();return c?!FR.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?s:l:WM(e,t,()=>{let{focusNode:f,focusOffset:d,anchorNode:p,anchorOffset:g}=e.domSelectionRange(),b=c.caretBidiLevel;c.modify("move",n,"character");let y=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:M,focusOffset:E}=e.domSelectionRange(),D=M&&!y.contains(M.nodeType==1?M:M.parentNode)||f==M&&d==E;try{c.collapse(p,g),f&&(f!=p||d!=g)&&c.extend&&c.extend(f,d)}catch{}return b!=null&&(c.caretBidiLevel=b),D}):r.pos==r.start()||r.pos==r.end()}let b3=null,x3=null,v3=!1;function HR(e,t,n){return b3==t&&x3==n?v3:(b3=t,x3=n,v3=n=="up"||n=="down"?BR(e,t,n):UR(e,t,n))}const Yl=0,w3=1,rd=2,wc=3;class sm{constructor(t,n,r,i){this.parent=t,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Yl,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(t){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;n<this.children.length;n++)t+=this.children[n].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==t)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,n,r){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode))if(r<0){let s,l;if(t==this.contentDOM)s=t.childNodes[n-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;s=t.previousSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(l)+l.size:this.posAtStart}else{let s,l;if(t==this.contentDOM)s=t.childNodes[n];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;s=t.nextSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(l):this.posAtEnd}let i;if(t==this.dom&&this.contentDOM)i=n>zs(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=t;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==t.childNodes.length)for(let s=t;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,i=t;i;i=i.parentNode){let s=this.getDesc(i),l;if(s&&(!n||s.node))if(r&&(l=s.nodeDOM)&&!(l.nodeType==1?l.contains(t.nodeType==1?t:t.parentNode):l==t))r=!1;else return s}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let i=t;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==t&&s!=r){for(;!i.border&&i.children.length;)for(let l=0;l<i.children.length;l++){let c=i.children[l];if(c.size){i=c;break}}return i}if(t<s)return i.descAt(t-r-i.border);r=s}}domFromPos(t,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let l=this.children[r],c=s+l.size;if(c>t||l instanceof GM){i=t-s;break}s=c}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof XM&&s.side>=0;r--);if(n<=0){let s,l=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,l=!1);return s&&n&&l&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?zs(s.dom)+1:0}}else{let s,l=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,l=!1);return s&&l&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?zs(s.dom):this.contentDOM.childNodes.length}}}parseRange(t,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let l=r,c=0;;c++){let f=this.children[c],d=l+f.size;if(i==-1&&t<=d){let p=l+f.border;if(t>=p&&n<=d-f.border&&f.node&&f.contentDOM&&this.contentDOM.contains(f.contentDOM))return f.parseRange(t,n,p);t=l;for(let g=c;g>0;g--){let b=this.children[g-1];if(b.size&&b.dom.parentNode==this.contentDOM&&!b.emptyChildAt(1)){i=zs(b.dom)+1;break}t-=b.size}i==-1&&(i=0)}if(i>-1&&(d>n||c==this.children.length-1)){n=d;for(let p=c+1;p<this.children.length;p++){let g=this.children[p];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(-1)){s=zs(g.dom);break}n+=g.size}s==-1&&(s=this.contentDOM.childNodes.length);break}l=d}return{node:this.contentDOM,from:t,to:n,fromOffset:i,toOffset:s}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[t<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(t)}domAfterPos(t){let{node:n,offset:r}=this.domFromPos(t,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]}setSelection(t,n,r,i=!1){let s=Math.min(t,n),l=Math.max(t,n);for(let y=0,M=0;y<this.children.length;y++){let E=this.children[y],D=M+E.size;if(s>M&&l<D)return E.setSelection(t-M-E.border,n-M-E.border,r,i);M=D}let c=this.domFromPos(t,t?-1:1),f=n==t?c:this.domFromPos(n,n?-1:1),d=r.root.getSelection(),p=r.domSelectionRange(),g=!1;if(($l||ha)&&t==n){let{node:y,offset:M}=c;if(y.nodeType==3){if(g=!!(M&&y.nodeValue[M-1]==`
101
+ `),g&&M==y.nodeValue.length)for(let E=y,D;E;E=E.parentNode){if(D=E.nextSibling){D.nodeName=="BR"&&(c=f={node:D.parentNode,offset:zs(D)+1});break}let L=E.pmViewDesc;if(L&&L.node&&L.node.isBlock)break}}else{let E=y.childNodes[M-1];g=E&&(E.nodeName=="BR"||E.contentEditable=="false")}}if($l&&p.focusNode&&p.focusNode!=f.node&&p.focusNode.nodeType==1){let y=p.focusNode.childNodes[p.focusOffset];y&&y.contentEditable=="false"&&(i=!0)}if(!(i||g&&ha)&&wd(c.node,c.offset,p.anchorNode,p.anchorOffset)&&wd(f.node,f.offset,p.focusNode,p.focusOffset))return;let b=!1;if((d.extend||t==n)&&!(g&&$l)){d.collapse(c.node,c.offset);try{t!=n&&d.extend(f.node,f.offset),b=!0}catch{}}if(!b){if(t>n){let M=c;c=f,f=M}let y=document.createRange();y.setEnd(f.node,f.offset),y.setStart(c.node,c.offset),d.removeAllRanges(),d.addRange(y)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],l=r+s.size;if(r==l?t<=l&&n>=r:t<l&&n>r){let c=r+s.border,f=l-s.border;if(t>=c&&n<=f){this.dirty=t==r||n==l?rd:w3,t==c&&n==f&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=wc:s.markDirty(t-c,n-c);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?rd:wc}r=l}this.dirty=rd}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?rd:w3;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class XM extends sm{constructor(t,n,r,i){let s,l=n.type.toDOM;if(typeof l=="function"&&(l=l(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(l.nodeType!=1){let c=document.createElement("span");c.appendChild(l),l=c}l.hasAttribute("contenteditable")||(l.contentEditable="false"),l.classList.add("ProseMirror-widget")}super(t,[],l,null),this.widget=n,this.widget=n,s=this}matchesWidget(t){return this.dirty==Yl&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class qR extends sm{constructor(t,n,r,i){super(t,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class Cf extends sm{constructor(t,n,r,i,s){super(t,[],r,i),this.mark=n,this.spec=s}static create(t,n,r,i){let s=i.nodeViews[n.type.name],l=s&&s(n,i,r);return(!l||!l.dom)&&(l=Cd.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Cf(t,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&wc||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=wc&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=Yl){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Yl}}slice(t,n,r){let i=Cf.create(this.parent,this.mark,!0,r),s=this.children,l=this.size;n<l&&(s=S5(s,n,l,r)),t>0&&(s=S5(s,0,t,r));for(let c=0;c<s.length;c++)s[c].parent=i;return i.children=s,i}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Ef extends sm{constructor(t,n,r,i,s,l,c){super(t,[],s,l),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=c}static create(t,n,r,i,s,l){let c=s.nodeViews[n.type.name],f,d=c&&c(n,s,()=>{if(!f)return l;if(f.parent)return f.parent.posBeforeChild(f)},r,i),p=d&&d.dom,g=d&&d.contentDOM;if(n.isText){if(!p)p=document.createTextNode(n.text);else if(p.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else p||({dom:p,contentDOM:g}=Cd.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!g&&!n.isText&&p.nodeName!="BR"&&(p.hasAttribute("contenteditable")||(p.contentEditable="false"),n.type.spec.draggable&&(p.draggable=!0));let b=p;return p=ZM(p,r,n),d?f=new $R(t,n,r,i,p,g||null,b,d):n.isText?new s1(t,n,r,i,p,b):new Ef(t,n,r,i,p,g||null,b)}parseRule(t){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let i=this.children[r];if(this.dom.contains(i.dom.parentNode)){n.contentElement=i.dom.parentNode;break}}if(!n.contentElement){let r=t&&t.find(i=>i.nodeType==1&&t.indexOf(i.parentNode)<0&&this.dom.contains(i));r?n.contentElement=r:n.getContent=()=>ke.empty}}return n}matchesNode(t,n,r){return this.dirty==Yl&&t.eq(this.node)&&c0(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let r=this.node.inlineContent,i=n,s=t.composing?this.localCompositionInfo(t,n):null,l=s&&s.pos>-1?s:null,c=s&&s.pos<0,f=new VR(this,l&&l.node,t);GR(this.node,this.innerDeco,(d,p,g)=>{d.spec.marks?f.syncToMarks(d.spec.marks,r,t,p):d.type.side>=0&&!g&&f.syncToMarks(p==this.node.childCount?bi.none:this.node.child(p).marks,r,t,p),f.placeWidget(d,t,i)},(d,p,g,b)=>{f.syncToMarks(d.marks,r,t,b);let y;f.findNodeMatch(d,p,g,b)||c&&t.state.selection.from>i&&t.state.selection.to<i+d.nodeSize&&(y=f.findIndexWithChild(s.node))>-1&&f.updateNodeAt(d,p,g,y,t)||f.updateNextNode(d,p,g,t,b,i)||f.addNode(d,p,g,t,i),i+=d.nodeSize}),f.syncToMarks([],r,t,0),this.node.isTextblock&&f.addTextblockHacks(),f.destroyRest(),(f.changed||this.dirty==rd)&&(l&&this.protectLocalComposition(t,l),KM(this.contentDOM,this.children,t),xh&&KR(this.dom))}localCompositionInfo(t,n){let{from:r,to:i}=t.state.selection;if(!(t.state.selection instanceof Pn)||r<n||i>n+this.node.content.size)return null;let s=t.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let l=s.nodeValue,c=JR(this.node.content,l,r-n,i-n);return c<0?null:{node:s,pos:c,text:l}}else return{node:s,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let l=new qR(this,s,n,i);t.input.compositionNodes.push(l),this.children=S5(this.children,r,r+i.length,t,l)}update(t,n,r,i){return this.dirty==wc||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,r,i),!0)}updateInner(t,n,r,i){this.updateOuterDeco(n),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Yl}updateOuterDeco(t){if(c0(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=JM(this.dom,this.nodeDOM,w5(this.outerDeco,this.node,n),w5(t,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function S3(e,t,n,r,i){ZM(r,t,e);let s=new Ef(void 0,e,t,n,r,r,r);return s.contentDOM&&s.updateChildren(i,0),s}class s1 extends Ef{constructor(t,n,r,i,s,l){super(t,n,r,i,s,null,l)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,r,i){return this.dirty==wc||this.dirty!=Yl&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Yl||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=t,this.dirty=Yl,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,r){let i=this.node.cut(t,n),s=document.createTextNode(i.text);return new s1(this.parent,i,this.outerDeco,this.innerDeco,s,s)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=wc)}get domAtom(){return!1}isText(t){return this.node.text==t}}class GM extends sm{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==Yl&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class $R extends Ef{constructor(t,n,r,i,s,l,c,f){super(t,n,r,i,s,l,c),this.spec=f}update(t,n,r,i){if(this.dirty==wc)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let s=this.spec.update(t,n,r);return s&&this.updateInner(t,n,r,i),s}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,r,i){this.spec.setSelection?this.spec.setSelection(t,n,r.root):super.setSelection(t,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function KM(e,t,n){let r=e.firstChild,i=!1;for(let s=0;s<t.length;s++){let l=t[s],c=l.dom;if(c.parentNode==e){for(;c!=r;)r=k3(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(c,r);if(l instanceof Cf){let f=r?r.previousSibling:e.lastChild;KM(l.contentDOM,l.children,n),r=f?f.nextSibling:e.firstChild}}for(;r;)r=k3(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}const Tp=function(e){e&&(this.nodeName=e)};Tp.prototype=Object.create(null);const id=[new Tp];function w5(e,t,n){if(e.length==0)return id;let r=n?id[0]:new Tp,i=[r];for(let s=0;s<e.length;s++){let l=e[s].type.attrs;if(l){l.nodeName&&i.push(r=new Tp(l.nodeName));for(let c in l){let f=l[c];f!=null&&(n&&i.length==1&&i.push(r=new Tp(t.isInline?"span":"div")),c=="class"?r.class=(r.class?r.class+" ":"")+f:c=="style"?r.style=(r.style?r.style+";":"")+f:c!="nodeName"&&(r[c]=f))}}}return i}function JM(e,t,n,r){if(n==id&&r==id)return t;let i=t;for(let s=0;s<r.length;s++){let l=r[s],c=n[s];if(s){let f;c&&c.nodeName==l.nodeName&&i!=e&&(f=i.parentNode)&&f.nodeName.toLowerCase()==l.nodeName||(f=document.createElement(l.nodeName),f.pmIsDeco=!0,f.appendChild(i),c=id[0]),i=f}YR(i,c||id[0],l)}return i}function YR(e,t,n){for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&e.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&e.classList.add(i[s]);e.classList.length==0&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(t.style);)e.style.removeProperty(i[1])}n.style&&(e.style.cssText+=n.style)}}function ZM(e,t,n){return JM(e,e,id,w5(t,n,e.nodeType!=1))}function c0(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function k3(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class VR{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=WR(t.node.content,t)}destroyBetween(t,n){if(t!=n){for(let r=t;r<n;r++)this.top.children[r].destroy();this.top.children.splice(t,n-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,n,r,i){let s=0,l=this.stack.length>>1,c=Math.min(l,t.length);for(;s<c&&(s==l-1?this.top:this.stack[s+1<<1]).matchesMark(t[s])&&t[s].type.spec.spanning!==!1;)s++;for(;s<l;)this.destroyRest(),this.top.dirty=Yl,this.index=this.stack.pop(),this.top=this.stack.pop(),l--;for(;l<t.length;){this.stack.push(this.top,this.index+1);let f=-1,d=this.top.children.length;i<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let p=this.index;p<d;p++){let g=this.top.children[p];if(g.matchesMark(t[l])&&!this.isLocked(g.dom)){f=p;break}}if(f<0&&this.index<this.top.children.length){let p=this.top.children[this.index];p instanceof Cf&&p.dirty!=wc&&p.mark.type==t[l].type&&p.spec.update&&!this.isLocked(p.dom)&&p.spec.update(t[l])&&(p.mark=t[l],f=this.index,this.changed=!0)}if(f>-1)f>this.index&&(this.changed=!0,this.destroyBetween(this.index,f)),this.top=this.top.children[this.index];else{let p=Cf.create(this.top,t[l],n,r);this.top.children.splice(this.index,0,p),this.top=p,this.changed=!0}this.index=0,l++}}findNodeMatch(t,n,r,i){let s=-1,l;if(i>=this.preMatch.index&&(l=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&l.matchesNode(t,n,r))s=this.top.children.indexOf(l,this.index);else for(let c=this.index,f=Math.min(this.top.children.length,c+5);c<f;c++){let d=this.top.children[c];if(d.matchesNode(t,n,r)&&!this.preMatch.matched.has(d)){s=c;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(t,n,r,i,s){let l=this.top.children[i];return l.dirty==wc&&l.dom==l.contentDOM&&(l.dirty=rd),l.update(t,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(t){for(;;){let n=t.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}t=n}}updateNextNode(t,n,r,i,s,l){for(let c=this.index;c<this.top.children.length;c++){let f=this.top.children[c];if(f instanceof Ef){let d=this.preMatch.matched.get(f);if(d!=null&&d!=s)return!1;let p=f.dom,g,b=this.isLocked(p)&&!(t.isText&&f.node&&f.node.isText&&f.nodeDOM.nodeValue==t.text&&f.dirty!=wc&&c0(n,f.outerDeco));if(!b&&f.update(t,n,r,i))return this.destroyBetween(this.index,c),f.dom!=p&&(this.changed=!0),this.index++,!0;if(!b&&(g=this.recreateWrapper(f,t,n,r,i,l)))return this.destroyBetween(this.index,c),this.top.children[this.index]=g,g.contentDOM&&(g.dirty=rd,g.updateChildren(i,l+1),g.dirty=Yl),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,n,r,i,s,l){if(t.dirty||n.isAtom||!t.children.length||!t.node.content.eq(n.content)||!c0(r,t.outerDeco)||!i.eq(t.innerDeco))return null;let c=Ef.create(this.top,n,r,i,s,l);if(c.contentDOM){c.children=t.children,t.children=[];for(let f of c.children)f.parent=c}return t.destroy(),c}addNode(t,n,r,i,s){let l=Ef.create(this.top,t,n,r,i,s);l.contentDOM&&l.updateChildren(i,s+1),this.top.children.splice(this.index++,0,l),this.changed=!0}placeWidget(t,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(t)&&(t==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new XM(this.top,t,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],n=this.top;for(;t instanceof Cf;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof s1)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((ha||Fs)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(t,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new GM(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function WR(e,t){let n=t,r=n.children.length,i=e.childCount,s=new Map,l=[];t:for(;i>0;){let c;for(;;)if(r){let d=n.children[r-1];if(d instanceof Cf)n=d,r=d.children.length;else{c=d,r--;break}}else{if(n==t)break t;r=n.parent.children.indexOf(n),n=n.parent}let f=c.node;if(f){if(f!=e.child(i-1))break;--i,s.set(c,i),l.push(c)}}return{index:i,matched:s,matches:l.reverse()}}function XR(e,t){return e.type.side-t.type.side}function GR(e,t,n,r){let i=t.locals(e),s=0;if(i.length==0){for(let d=0;d<e.childCount;d++){let p=e.child(d);r(p,i,t.forChild(s,p),d),s+=p.nodeSize}return}let l=0,c=[],f=null;for(let d=0;;){let p,g;for(;l<i.length&&i[l].to==s;){let D=i[l++];D.widget&&(p?(g||(g=[p])).push(D):p=D)}if(p)if(g){g.sort(XR);for(let D=0;D<g.length;D++)n(g[D],d,!!f)}else n(p,d,!!f);let b,y;if(f)y=-1,b=f,f=null;else if(d<e.childCount)y=d,b=e.child(d++);else break;for(let D=0;D<c.length;D++)c[D].to<=s&&c.splice(D--,1);for(;l<i.length&&i[l].from<=s&&i[l].to>s;)c.push(i[l++]);let M=s+b.nodeSize;if(b.isText){let D=M;l<i.length&&i[l].from<D&&(D=i[l].from);for(let L=0;L<c.length;L++)c[L].to<D&&(D=c[L].to);D<M&&(f=b.cut(D-s),b=b.cut(0,D-s),M=D,y=-1)}else for(;l<i.length&&i[l].to<M;)l++;let E=b.isInline&&!b.isLeaf?c.filter(D=>!D.inline):c.slice();r(b,E,t.forChild(s,b),y),s=M}}function KR(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function JR(e,t,n,r){for(let i=0,s=0;i<e.childCount&&s<=r;){let l=e.child(i++),c=s;if(s+=l.nodeSize,!l.isText)continue;let f=l.text;for(;i<e.childCount;){let d=e.child(i++);if(s+=d.nodeSize,!d.isText)break;f+=d.text}if(s>=n){if(s>=r&&f.slice(r-t.length-c,r-c)==t)return r-t.length;let d=c<r?f.lastIndexOf(t,r-c-1):-1;if(d>=0&&d+t.length+c>=n)return c+d;if(n==r&&f.length>=r+t.length-c&&f.slice(r-c,r-c+t.length)==t)return r}}return-1}function S5(e,t,n,r,i){let s=[];for(let l=0,c=0;l<e.length;l++){let f=e[l],d=c,p=c+=f.size;d>=n||p<=t?s.push(f):(d<t&&s.push(f.slice(0,t-d,r)),i&&(s.push(i),i=void 0),p>n&&s.push(f.slice(n-d,f.size,r)))}return s}function gb(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),s=i&&i.size==0,l=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let c=r.resolve(l),f,d;if(o1(n)){for(f=l;i&&!i.node;)i=i.parent;let g=i.node;if(i&&g.isAtom&&Nn.isSelectable(g)&&i.parent&&!(g.isInline&&AR(n.focusNode,n.focusOffset,i.dom))){let b=i.posBefore;d=new Nn(l==b?c:r.resolve(b))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let g=l,b=l;for(let y=0;y<n.rangeCount;y++){let M=n.getRangeAt(y);g=Math.min(g,e.docView.posFromDOM(M.startContainer,M.startOffset,1)),b=Math.max(b,e.docView.posFromDOM(M.endContainer,M.endOffset,-1))}if(g<0)return null;[f,l]=b==e.state.selection.anchor?[b,g]:[g,b],c=r.resolve(l)}else f=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(f<0)return null}let p=r.resolve(f);if(!d){let g=t=="pointer"||e.state.selection.head<c.pos&&!s?1:-1;d=yb(e,p,c,g)}return d}function QM(e){return e.editable?e.hasFocus():eC(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function zu(e,t=!1){let n=e.state.selection;if(tC(e,n),!QM(e))return;let r=e.input.mouseDown;if(!t&&Fs&&r){let i=e.domSelectionRange(),s=e.domObserver.currentSelection;if(i.anchorNode&&s.anchorNode&&wd(i.anchorNode,i.anchorOffset,s.anchorNode,s.anchorOffset)&&r.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)QR(e);else{let{anchor:i,head:s}=n,l,c;A3&&!(n instanceof Pn)&&(n.$from.parent.inlineContent||(l=M3(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(c=M3(e,n.to))),e.docView.setSelection(i,s,e,t),A3&&(l&&C3(l),c&&C3(c)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&ZR(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}const A3=ha||Fs&&FM<63;function M3(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(ha&&i&&i.contentEditable=="false")return l2(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return l2(i);if(s)return l2(s)}}function l2(e){return e.contentEditable="true",ha&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function C3(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function ZR(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!QM(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function QR(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName=="IMG";r?t.collapse(n.parentNode,zs(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&Ga&&Mf<=11&&(n.disabled=!0,n.disabled=!1)}function tC(e,t){if(t instanceof Nn){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(E3(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else E3(e)}function E3(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function yb(e,t,n,r){return e.someProp("createSelectionBetween",i=>i(e,t,n))||Pn.between(t,n,r)}function T3(e){return e.editable&&!e.hasFocus()?!1:eC(e)}function eC(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function tO(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return wd(t.node,t.offset,n.anchorNode,n.anchorOffset)}function k5(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return s&&rr.findFrom(s,t)}function mf(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function N3(e,t,n){let r=e.state.selection;if(r instanceof Pn)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let l=e.state.doc.resolve(i.pos+s.nodeSize*(t<0?-1:1));return mf(e,new Pn(r.$anchor,l))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let i=k5(e.state,t);return i&&i instanceof Nn?mf(e,i):!1}else if(!(Ul&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter,l;if(!s||s.isText)return!1;let c=t<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(l=e.docView.descAt(c))&&!l.contentDOM?Nn.isSelectable(s)?mf(e,new Nn(t<0?e.state.doc.resolve(i.pos-s.nodeSize):i)):om?mf(e,new Pn(e.state.doc.resolve(t<0?c:c+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Nn&&r.node.isInline)return mf(e,new Pn(t>0?r.$to:r.$from));{let i=k5(e.state,t);return i?mf(e,i):!1}}}function u0(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Np(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function Vd(e,t){return t<0?eO(e):nO(e)}function eO(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,s,l=!1;for($l&&n.nodeType==1&&r<u0(n)&&Np(n.childNodes[r],-1)&&(l=!0);;)if(r>0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(Np(c,-1))i=n,s=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(nC(n))break;{let c=n.previousSibling;for(;c&&Np(c,-1);)i=n.parentNode,s=zs(c),c=c.previousSibling;if(c)n=c,r=u0(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}l?A5(e,n,r):i&&A5(e,i,s)}function nO(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=u0(n),s,l;for(;;)if(r<i){if(n.nodeType!=1)break;let c=n.childNodes[r];if(Np(c,1))s=n,l=++r;else break}else{if(nC(n))break;{let c=n.nextSibling;for(;c&&Np(c,1);)s=c.parentNode,l=zs(c)+1,c=c.nextSibling;if(c)n=c,r=0,i=u0(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}}s&&A5(e,s,l)}function nC(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function rO(e,t){for(;e&&t==e.childNodes.length&&!im(e);)t=zs(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=0}}function iO(e,t){for(;e&&!t&&!im(e);)t=zs(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=e.childNodes.length}}function A5(e,t,n){if(t.nodeType!=3){let s,l;(l=rO(t,n))?(t=l,n=0):(s=iO(t,n))&&(t=s,n=s.nodeValue.length)}let r=e.domSelection();if(!r)return;if(o1(r)){let s=document.createRange();s.setEnd(t,n),s.setStart(t,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&zu(e)},50)}function _3(e,t){let n=e.state.doc.resolve(t);if(!(Fs||UM)&&n.parent.inlineContent){let i=e.coordsAtPos(t);if(t>n.start()){let s=e.coordsAtPos(t-1),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(t<n.end()){let s=e.coordsAtPos(t+1),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function D3(e,t,n){let r=e.state.selection;if(r instanceof Pn&&!r.empty||n.indexOf("s")>-1||Ul&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let l=k5(e.state,t);if(l&&l instanceof Nn)return mf(e,l)}if(!i.parent.inlineContent){let l=t<0?i:s,c=r instanceof gl?rr.near(l,t):rr.findFrom(l,t);return c?mf(e,c):!1}return!1}function L3(e,t){if(!(e.state.selection instanceof Pn))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let s=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let l=e.state.tr;return t<0?l.delete(n.pos-s.nodeSize,n.pos):l.delete(n.pos,n.pos+s.nodeSize),e.dispatch(l),!0}return!1}function R3(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function oO(e){if(!ha||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;R3(e,r,"true"),setTimeout(()=>R3(e,r,"false"),20)}return!1}function sO(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function aO(e,t){let n=t.keyCode,r=sO(t);if(n==8||Ul&&n==72&&r=="c")return L3(e,-1)||Vd(e,-1);if(n==46&&!t.shiftKey||Ul&&n==68&&r=="c")return L3(e,1)||Vd(e,1);if(n==13||n==27)return!0;if(n==37||Ul&&n==66&&r=="c"){let i=n==37?_3(e,e.state.selection.from)=="ltr"?-1:1:-1;return N3(e,i,r)||Vd(e,i)}else if(n==39||Ul&&n==70&&r=="c"){let i=n==39?_3(e,e.state.selection.from)=="ltr"?1:-1:1;return N3(e,i,r)||Vd(e,i)}else{if(n==38||Ul&&n==80&&r=="c")return D3(e,-1,r)||Vd(e,-1);if(n==40||Ul&&n==78&&r=="c")return oO(e)||D3(e,1,r)||Vd(e,1);if(r==(Ul?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function bb(e,t){e.someProp("transformCopied",y=>{t=y(t,e)});let n=[],{content:r,openStart:i,openEnd:s}=t;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let y=r.firstChild;n.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let l=e.someProp("clipboardSerializer")||Cd.fromSchema(e.state.schema),c=lC(),f=c.createElement("div");f.appendChild(l.serializeFragment(r,{document:c}));let d=f.firstChild,p,g=0;for(;d&&d.nodeType==1&&(p=aC[d.nodeName.toLowerCase()]);){for(let y=p.length-1;y>=0;y--){let M=c.createElement(p[y]);for(;f.firstChild;)M.appendChild(f.firstChild);f.appendChild(M),g++}d=f.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${i} ${s}${g?` -${g}`:""} ${JSON.stringify(n)}`);let b=e.someProp("clipboardTextSerializer",y=>y(t,e))||t.content.textBetween(0,t.content.size,`
102
+
103
+ `);return{dom:f,text:b,slice:t}}function rC(e,t,n,r,i){let s=i.parent.type.spec.code,l,c;if(!n&&!t)return null;let f=!!t&&(r||s||!n);if(f){if(e.someProp("transformPastedText",b=>{t=b(t,s||r,e)}),s)return c=new Ge(ke.from(e.state.schema.text(t.replace(/\r\n?/g,`
104
+ `))),0,0),e.someProp("transformPasted",b=>{c=b(c,e,!0)}),c;let g=e.someProp("clipboardTextParser",b=>b(t,i,r,e));if(g)c=g;else{let b=i.marks(),{schema:y}=e.state,M=Cd.fromSchema(y);l=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(E=>{let D=l.appendChild(document.createElement("p"));E&&D.appendChild(M.serializeNode(y.text(E,b)))})}}else e.someProp("transformPastedHTML",g=>{n=g(n,e)}),l=fO(n),om&&dO(l);let d=l&&l.querySelector("[data-pm-slice]"),p=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let g=+p[3];g>0;g--){let b=l.firstChild;for(;b&&b.nodeType!=1;)b=b.nextSibling;if(!b)break;l=b}if(c||(c=(e.someProp("clipboardParser")||e.someProp("domParser")||Cp.fromSchema(e.state.schema)).parseSlice(l,{preserveWhitespace:!!(f||p),context:i,ruleFromNode(b){return b.nodeName=="BR"&&!b.nextSibling&&b.parentNode&&!lO.test(b.parentNode.nodeName)?{ignore:!0}:null}})),p)c=hO(O3(c,+p[1],+p[2]),p[4]);else if(c=Ge.maxOpen(cO(c.content,i),!0),c.openStart||c.openEnd){let g=0,b=0;for(let y=c.content.firstChild;g<c.openStart&&!y.type.spec.isolating;g++,y=y.firstChild);for(let y=c.content.lastChild;b<c.openEnd&&!y.type.spec.isolating;b++,y=y.lastChild);c=O3(c,g,b)}return e.someProp("transformPasted",g=>{c=g(c,e,f)}),c}const lO=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function cO(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let i=t.node(n).contentMatchAt(t.index(n)),s,l=[];if(e.forEach(c=>{if(!l)return;let f=i.findWrapping(c.type),d;if(!f)return l=null;if(d=l.length&&s.length&&oC(f,s,c,l[l.length-1],0))l[l.length-1]=d;else{l.length&&(l[l.length-1]=sC(l[l.length-1],s.length));let p=iC(c,f);l.push(p),i=i.matchType(p.type),s=f}}),l)return ke.from(l)}return e}function iC(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,ke.from(e));return e}function oC(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let s=oC(e,t,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(ke.from(iC(n,e,i+1))))}}function sC(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,sC(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(ke.empty,!0);return e.copy(n.append(r))}function M5(e,t,n,r,i,s){let l=t<0?e.firstChild:e.lastChild,c=l.content;return e.childCount>1&&(s=0),i<r-1&&(c=M5(c,t,n,r,i+1,s)),i>=n&&(c=t<0?l.contentMatchAt(0).fillBefore(c,s<=i).append(c):c.append(l.contentMatchAt(l.childCount).fillBefore(ke.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,l.copy(c))}function O3(e,t,n){return t<e.openStart&&(e=new Ge(M5(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Ge(M5(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const aC={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function lC(){return document.implementation.createHTMLDocument("title")}let op=null;function uO(e){let t=window.trustedTypes;if(!t)return e;if(!op){if(op=t.defaultPolicy)try{return op.createHTML(e)}catch{}op=t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})}return op.createHTML(e)}function fO(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=lC(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(e),s;if((s=i&&aC[i[1].toLowerCase()])&&(e=s.map(l=>"<"+l+">").join("")+e+s.map(l=>"</"+l+">").reverse().join("")),r.innerHTML=uO(e),s)for(let l=0;l<s.length;l++)r=r.querySelector(s[l])||r;for(let l=0;l<n.styleSheets.length;l++){let c=n.styleSheets[l];for(let f=0;f<c.rules.length;f++){let d=c.rules[f];if(d instanceof CSSStyleRule){let p=r.querySelectorAll(d.selectorText);for(let g=0;g<p.length;g++)p[g].style.cssText+=d.style.cssText}}}return r}function dO(e){let t=e.querySelectorAll(Fs?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function hO(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:s,openEnd:l}=e;for(let c=r.length-2;c>=0;c-=2){let f=n.nodes[r[c]];if(!f||f.hasRequiredAttrs())break;try{f.checkAttrs(r[c+1])}catch{break}i=ke.from(f.create(r[c+1],i)),s++,l++}return new Ge(i,s,l)}const Sa={},ka={},pO={touchstart:!0,touchmove:!0};class mO{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function gO(e){for(let t in Sa){let n=Sa[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{bO(e,r)&&!xb(e,r)&&(e.editable||!(r.type in ka))&&n(e,r)},pO[t]?{passive:!0}:void 0)}ha&&e.dom.addEventListener("input",()=>null),C5(e)}function ju(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function yO(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function C5(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>xb(e,r))})}function xb(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function bO(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function xO(e,t){!xb(e,t)&&Sa[t.type]&&(e.editable||!(t.type in ka))&&Sa[t.type](e,t)}ka.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!dC(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Pu&&Fs&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),xh&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",i=>i(e,td(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||aO(e,n)?n.preventDefault():ju(e,"key")};ka.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};ka.keypress=(e,t)=>{let n=t;if(dC(e)||!n.charCode||n.ctrlKey&&!n.altKey||Ul&&n.metaKey)return;if(e.someProp("handleKeyPress",i=>i(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Pn)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>e.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!e.someProp("handleTextInput",l=>l(e,r.$from.pos,r.$to.pos,i,s))&&e.dispatch(s()),n.preventDefault()}};function am(e){return{left:e.clientX,top:e.clientY}}function vO(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function vb(e,t,n,r,i){if(r==-1)return!1;let s=e.state.doc.resolve(r);for(let l=s.depth+1;l>0;l--)if(e.someProp(t,c=>l>s.depth?c(e,n,s.nodeAfter,s.before(l),i,!0):c(e,n,s.node(l),s.before(l),i,!1)))return!0;return!1}function lm(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function wO(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&Nn.isSelectable(r)?(lm(e,new Nn(n)),!0):!1}function SO(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof Nn&&(r=n.node);let s=e.state.doc.resolve(t);for(let l=s.depth+1;l>0;l--){let c=l>s.depth?s.nodeAfter:s.node(l);if(Nn.isSelectable(c)){r&&n.$from.depth>0&&l>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(l);break}}return i!=null?(lm(e,Nn.create(e.state.doc,i)),!0):!1}function kO(e,t,n,r,i){return vb(e,"handleClickOn",t,n,r)||e.someProp("handleClick",s=>s(e,t,r))||(i?SO(e,n):wO(e,n))}function AO(e,t,n,r){return vb(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",i=>i(e,t,r))}function MO(e,t,n,r){return vb(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",i=>i(e,t,r))||CO(e,n,r)}function CO(e,t,n){if(n.button!=0)return!1;let r=cC(e,t,!0),i=e.state.doc;return r?(lm(e,r),r instanceof Pn&&i.eq(e.state.doc)&&(e.input.mouseDown=new TO(e,r)),!0):!1}function cC(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?Pn.create(r,0,r.content.size):null;let i=r.resolve(t);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s),c=i.before(s);if(l.inlineContent)return Pn.create(r,c+1,c+1+l.content.size);if(n&&Nn.isSelectable(l))return Nn.create(r,c)}return null}function wb(e){return f0(e)}const uC=Ul?"metaKey":"ctrlKey";Sa.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=wb(e),i=Date.now(),s="singleClick";i-e.input.lastClick.time<500&&vO(n,e.input.lastClick)&&!n[uC]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type=="singleClick"?s="doubleClick":e.input.lastClick.type=="doubleClick"&&(s="tripleClick")),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let l=e.posAtCoords(am(n));l&&(s=="singleClick"?e.input.mouseDown=new EO(e,l,n,!!r):(s=="doubleClick"?AO:MO)(e,l.pos,l.inside,n)?n.preventDefault():ju(e,"pointer"))};class fC{constructor(t){this.view=t,this.mightDrag=null,t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(t){this.done()}move(t){t.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class EO extends fC{constructor(t,n,r,i){super(t),this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=t.state.doc,this.selectNode=!!r[uC],this.allowDefault=r.shiftKey;let s,l;if(n.inside>-1)s=t.state.doc.nodeAt(n.inside),l=n.inside;else{let p=t.state.doc.resolve(n.pos);s=p.parent,l=p.depth?p.before():0}const c=i?null:r.target,f=c?t.docView.nearestDesc(c,!0):null;this.target=f&&f.nodeDOM.nodeType==1?f.nodeDOM:null;let{selection:d}=t.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||d instanceof Nn&&d.from<=l&&d.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&$l&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),ju(t,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||zu(this.view)})}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(am(t))),this.updateAllowDefault(t),this.allowDefault||!n?ju(this.view,"pointer"):kO(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||ha&&this.mightDrag&&!this.mightDrag.node.isAtom||Fs&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(lm(this.view,rr.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):ju(this.view,"pointer")}move(t){this.updateAllowDefault(t),ju(this.view,"pointer"),super.move(t)}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class TO extends fC{constructor(t,n){super(t),this.startSelection=n,this.startDoc=t.state.doc}move(t){if(t.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}t.preventDefault(),ju(this.view,"pointer");let n=this.view.posAtCoords(am(t)),r=n&&cC(this.view,n.inside,!1);if(!r)return;let{doc:i}=this.view.state,s=this.startSelection,[l,c]=r.from<s.from?[s.to,r.from]:[s.from,r.to];lm(this.view,Pn.create(i,l,c))}}Sa.touchstart=e=>{e.input.lastTouch=Date.now(),wb(e),ju(e,"pointer")};Sa.touchmove=e=>{e.input.lastTouch=Date.now(),ju(e,"pointer")};Sa.contextmenu=e=>wb(e);function dC(e,t){return e.composing?!0:ha&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const NO=Pu?5e3:-1;ka.compositionstart=ka.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Pn&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Fs&&UM&&_O(e)))e.markCursor=e.state.storedMarks||n.marks(),f0(e,!0),e.markCursor=null;else if(f0(e,!t.selection.empty),$l&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let l=s<0?i.lastChild:i.childNodes[s-1];if(!l)break;if(l.nodeType==3){let c=e.domSelection();c&&c.collapse(l,l.nodeValue.length);break}else i=l,s=-1}}e.input.composing=!0}hC(e,NO)};function _O(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}ka.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,hC(e,20))};function hC(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>f0(e),t))}function pC(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function DO(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=SR(t.focusNode,t.focusOffset),r=kR(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=e.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let l=n.pmViewDesc;if(!(!l||!l.isText(n.nodeValue)))return r}}return n||r}function f0(e,t=!1){if(!(Pu&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),pC(e),t||e.docView&&e.docView.dirty){let n=gb(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function LO(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const Vp=Ga&&Mf<15||xh&&ER<604;Sa.copy=ka.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type=="cut";if(r.empty)return;let s=Vp?null:n.clipboardData,l=r.content(),{dom:c,text:f}=bb(e,l);s?(n.preventDefault(),s.clearData(),s.setData("text/html",c.innerHTML),s.setData("text/plain",f)):LO(e,c),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function RO(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function OO(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Wp(e,r.value,null,i,t):Wp(e,r.textContent,r.innerHTML,i,t)},50)}function Wp(e,t,n,r,i){let s=rC(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",f=>f(e,i,s||Ge.empty)))return!0;if(!s)return!1;let l=RO(s),c=l?e.state.tr.replaceSelectionWith(l,r):e.state.tr.replaceSelection(s);return e.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function mC(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}ka.paste=(e,t)=>{let n=t;if(e.composing&&!Pu)return;let r=Vp?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Wp(e,mC(r),r.getData("text/html"),i,n)?n.preventDefault():OO(e,n)};class gC{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const PO=Ul?"altKey":"ctrlKey";function yC(e,t){let n;return e.someProp("dragCopies",r=>{n=n||r(t)}),n!=null?!n:!t[PO]}Sa.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,s=i.empty?null:e.posAtCoords(am(n)),l;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Nn?i.to-1:i.to))){if(r&&r.mightDrag)l=Nn.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let g=e.docView.nearestDesc(n.target,!0);g&&g.node.type.spec.draggable&&g!=e.docView&&(l=Nn.create(e.state.doc,g.posBefore))}}let c=(l||e.state.selection).content(),{dom:f,text:d,slice:p}=bb(e,c);(!n.dataTransfer.files.length||!Fs||FM>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Vp?"Text":"text/html",f.innerHTML),n.dataTransfer.effectAllowed="copyMove",Vp||n.dataTransfer.setData("text/plain",d),e.dragging=new gC(p,yC(e,n),l)};Sa.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};ka.dragover=ka.dragenter=(e,t)=>t.preventDefault();ka.drop=(e,t)=>{try{jO(e,t,e.dragging)}finally{e.dragging=null}};function jO(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(am(t));if(!r)return;let i=e.state.doc.resolve(r.pos),s=n&&n.slice;s?e.someProp("transformPasted",y=>{s=y(s,e,!1)}):s=rC(e,mC(t.dataTransfer),Vp?null:t.dataTransfer.getData("text/html"),!1,i);let l=!!(n&&yC(e,t));if(e.someProp("handleDrop",y=>y(e,t,s||Ge.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let c=s?bM(e.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let f=e.state.tr;if(l){let{node:y}=n;y?y.replace(f):f.deleteSelection()}let d=f.mapping.map(c),p=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,g=f.doc;if(p?f.replaceRangeWith(d,d,s.content.firstChild):f.replaceRange(d,d,s),f.doc.eq(g))return;let b=f.doc.resolve(d);if(p&&Nn.isSelectable(s.content.firstChild)&&b.nodeAfter&&b.nodeAfter.sameMarkup(s.content.firstChild))f.setSelection(new Nn(b));else{let y=f.mapping.map(c);f.mapping.maps[f.mapping.maps.length-1].forEach((M,E,D,L)=>y=L),f.setSelection(yb(e,b,f.doc.resolve(y)))}e.focus(),e.dispatch(f.setMeta("uiEvent","drop"))}Sa.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&zu(e)},20))};Sa.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};Sa.beforeinput=(e,t)=>{if(Pu&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",s=>s(e,td(8,"Backspace")))))return;let{$cursor:i}=e.state.selection;i&&i.pos>0&&e.dispatch(e.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let e in ka)Sa[e]=ka[e];function Xp(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class d0{constructor(t,n){this.toDOM=t,this.spec=n||fd,this.side=this.spec.side||0}map(t,n,r,i){let{pos:s,deleted:l}=t.mapResult(n.from+i,this.side<0?-1:1);return l?null:new wa(s-r,s-r,this)}valid(){return!0}eq(t){return this==t||t instanceof d0&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Xp(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Tf{constructor(t,n){this.attrs=t,this.spec=n||fd}map(t,n,r,i){let s=t.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,l=t.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=l?null:new wa(s,l,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof Tf&&Xp(this.attrs,t.attrs)&&Xp(this.spec,t.spec)}static is(t){return t.type instanceof Tf}destroy(){}}class Sb{constructor(t,n){this.attrs=t,this.spec=n||fd}map(t,n,r,i){let s=t.mapResult(n.from+i,1);if(s.deleted)return null;let l=t.mapResult(n.to+i,-1);return l.deleted||l.pos<=s.pos?null:new wa(s.pos-r,l.pos-r,this)}valid(t,n){let{index:r,offset:i}=t.content.findIndex(n.from),s;return i==n.from&&!(s=t.child(r)).isText&&i+s.nodeSize==n.to}eq(t){return this==t||t instanceof Sb&&Xp(this.attrs,t.attrs)&&Xp(this.spec,t.spec)}destroy(){}}class wa{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new wa(t,n,this.type)}eq(t,n=0){return this.type.eq(t.type)&&this.from+n==t.from&&this.to+n==t.to}map(t,n,r){return this.type.map(t,this,n,r)}static widget(t,n,r){return new wa(t,t,new d0(n,r))}static inline(t,n,r,i){return new wa(t,n,new Tf(r,i))}static node(t,n,r,i){return new wa(t,n,new Sb(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Tf}get widget(){return this.type instanceof d0}}const th=[],fd={};class di{constructor(t,n){this.local=t.length?t:th,this.children=n.length?n:th}static create(t,n){return n.length?h0(n,t,0,fd):da}find(t,n,r){let i=[];return this.findInner(t??0,n??1e9,i,0,r),i}findInner(t,n,r,i,s){for(let l=0;l<this.local.length;l++){let c=this.local[l];c.from<=n&&c.to>=t&&(!s||s(c.spec))&&r.push(c.copy(c.from+i,c.to+i))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<n&&this.children[l+1]>t){let c=this.children[l]+1;this.children[l+2].findInner(t-c,n-c,r,i+c,s)}}map(t,n,r){return this==da||t.maps.length==0?this:this.mapInner(t,n,0,0,r||fd)}mapInner(t,n,r,i,s){let l;for(let c=0;c<this.local.length;c++){let f=this.local[c].map(t,r,i);f&&f.type.valid(n,f)?(l||(l=[])).push(f):s.onRemove&&s.onRemove(this.local[c].spec)}return this.children.length?IO(this.children,l||[],t,n,r,i,s):l?new di(l.sort(dd),th):da}add(t,n){return n.length?this==da?di.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,s=0;t.forEach((c,f)=>{let d=f+r,p;if(p=xC(n,c,d)){for(i||(i=this.children.slice());s<i.length&&i[s]<f;)s+=3;i[s]==f?i[s+2]=i[s+2].addInner(c,p,d+1):i.splice(s,0,f,f+c.nodeSize,h0(p,c,d+1,fd)),s+=3}});let l=bC(s?vC(n):n,-r);for(let c=0;c<l.length;c++)l[c].type.valid(t,l[c])||l.splice(c--,1);return new di(l.length?this.local.concat(l).sort(dd):this.local,i||this.children)}remove(t){return t.length==0||this==da?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let l,c=r[s]+n,f=r[s+1]+n;for(let p=0,g;p<t.length;p++)(g=t[p])&&g.from>c&&g.to<f&&(t[p]=null,(l||(l=[])).push(g));if(!l)continue;r==this.children&&(r=this.children.slice());let d=r[s+2].removeInner(l,c+1);d!=da?r[s+2]=d:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,l;s<t.length;s++)if(l=t[s])for(let c=0;c<i.length;c++)i[c].eq(l,n)&&(i==this.local&&(i=this.local.slice()),i.splice(c--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new di(i,r):da}forChild(t,n){if(this==da)return this;if(n.isLeaf)return di.empty;let r,i;for(let c=0;c<this.children.length;c+=3)if(this.children[c]>=t){this.children[c]==t&&(r=this.children[c+2]);break}let s=t+1,l=s+n.content.size;for(let c=0;c<this.local.length;c++){let f=this.local[c];if(f.from<l&&f.to>s&&f.type instanceof Tf){let d=Math.max(s,f.from)-s,p=Math.min(l,f.to)-s;d<p&&(i||(i=[])).push(f.copy(d,p))}}if(i){let c=new di(i.sort(dd),th);return r?new bf([c,r]):c}return r||da}eq(t){if(this==t)return!0;if(!(t instanceof di)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0}locals(t){return kb(this.localsInner(t))}localsInner(t){if(this==da)return th;if(t.inlineContent||!this.local.some(Tf.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Tf||n.push(this.local[r]);return n}forEachSet(t){t(this)}}di.empty=new di([],[]);di.removeOverlap=kb;const da=di.empty;class bf{constructor(t){this.members=t}map(t,n){const r=this.members.map(i=>i.map(t,n,fd));return bf.from(r)}forChild(t,n){if(n.isLeaf)return di.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(t,n);s!=da&&(s instanceof bf?r=r.concat(s.members):r.push(s))}return bf.from(r)}eq(t){if(!(t instanceof bf)||t.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}locals(t){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(t);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let l=0;l<s.length;l++)n.push(s[l])}}return n?kb(r?n:n.sort(dd)):th}static from(t){switch(t.length){case 0:return da;case 1:return t[0];default:return new bf(t.every(n=>n instanceof di)?t:t.reduce((n,r)=>n.concat(r instanceof di?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function IO(e,t,n,r,i,s,l){let c=e.slice();for(let d=0,p=s;d<n.maps.length;d++){let g=0;n.maps[d].forEach((b,y,M,E)=>{let D=E-M-(y-b);for(let L=0;L<c.length;L+=3){let q=c[L+1];if(q<0||b>q+p-g)continue;let $=c[L]+p-g;y>=$?c[L+1]=b<=$?-2:-1:b>=p&&D&&(c[L]+=D,c[L+1]+=D)}g+=D}),p=n.maps[d].map(p,-1)}let f=!1;for(let d=0;d<c.length;d+=3)if(c[d+1]<0){if(c[d+1]==-2){f=!0,c[d+1]=-1;continue}let p=n.map(e[d]+s),g=p-i;if(g<0||g>=r.content.size){f=!0;continue}let b=n.map(e[d+1]+s,-1),y=b-i,{index:M,offset:E}=r.content.findIndex(g),D=r.maybeChild(M);if(D&&E==g&&E+D.nodeSize==y){let L=c[d+2].mapInner(n,D,p+1,e[d]+s+1,l);L!=da?(c[d]=g,c[d+1]=y,c[d+2]=L):(c[d+1]=-2,f=!0)}else f=!0}if(f){let d=zO(c,e,t,n,i,s,l),p=h0(d,r,0,l);t=p.local;for(let g=0;g<c.length;g+=3)c[g+1]<0&&(c.splice(g,3),g-=3);for(let g=0,b=0;g<p.children.length;g+=3){let y=p.children[g];for(;b<c.length&&c[b]<y;)b+=3;c.splice(b,0,p.children[g],p.children[g+1],p.children[g+2])}}return new di(t.sort(dd),c)}function bC(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new wa(i.from+t,i.to+t,i.type))}return n}function zO(e,t,n,r,i,s,l){function c(f,d){for(let p=0;p<f.local.length;p++){let g=f.local[p].map(r,i,d);g?n.push(g):l.onRemove&&l.onRemove(f.local[p].spec)}for(let p=0;p<f.children.length;p+=3)c(f.children[p+2],f.children[p]+d+1)}for(let f=0;f<e.length;f+=3)e[f+1]==-1&&c(e[f+2],t[f]+s+1);return n}function xC(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let s=0,l;s<e.length;s++)(l=e[s])&&l.from>n&&l.to<r&&((i||(i=[])).push(l),e[s]=null);return i}function vC(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function h0(e,t,n,r){let i=[],s=!1;t.forEach((c,f)=>{let d=xC(e,c,f+n);if(d){s=!0;let p=h0(d,c,n+f+1,r);p!=da&&i.push(f,f+c.nodeSize,p)}});let l=bC(s?vC(e):e,-n).sort(dd);for(let c=0;c<l.length;c++)l[c].type.valid(t,l[c])||(r.onRemove&&r.onRemove(l[c].spec),l.splice(c--,1));return l.length||i.length?new di(l,i):da}function dd(e,t){return e.from-t.from||e.to-t.to}function kb(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let s=t[i];if(s.from==r.from){s.to!=r.to&&(t==e&&(t=e.slice()),t[i]=s.copy(s.from,r.to),P3(t,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,s.from),P3(t,i,r.copy(s.from,r.to)));break}}}return t}function P3(e,t,n){for(;t<e.length&&dd(n,e[t])>0;)t++;e.splice(t,0,n)}function c2(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=da&&t.push(r)}),e.cursorWrapper&&t.push(di.create(e.state.doc,[e.cursorWrapper.deco])),bf.from(t)}const BO={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},FO=Ga&&Mf<=11;class UO{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class HO{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new UO,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Ga&&Mf<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():ha&&t.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),FO&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,BO)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(T3(this.view)){if(this.suppressingSelectionUpdates)return zu(this.view);if(Ga&&Mf<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&wd(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,r;for(let s=t.focusNode;s;s=bh(s))n.add(s);for(let s=t.anchorNode;s;s=bh(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&T3(t)&&!this.ignoreSelectionChange(r),s=-1,l=-1,c=!1,f=[];if(t.editable)for(let p=0;p<n.length;p++){let g=this.registerMutation(n[p],f);g&&(s=s<0?g.from:Math.min(g.from,s),l=l<0?g.to:Math.max(g.to,l),g.typeOver&&(c=!0))}if(f.some(p=>p.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46||Fs&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&n.some(p=>p.type=="childList"&&p.removedNodes.length))){for(let p of f)if(p.nodeName=="BR"&&p.parentNode){let g=p.nextSibling;for(;g&&g.nodeType==1;){if(g.contentEditable=="false"){p.parentNode.removeChild(p);break}g=g.firstChild}}}else if($l&&f.length){let p=f.filter(g=>g.nodeName=="BR");if(p.length==2){let[g,b]=p;g.parentNode&&g.parentNode.parentNode==b.parentNode?b.remove():g.remove()}else{let{focusNode:g}=this.currentSelection;for(let b of p){let y=b.parentNode;y&&y.nodeName=="LI"&&(!g||YO(t,g)!=y)&&b.remove()}}}let d=null;s<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&o1(r)&&(d=gb(t))&&d.eq(rr.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,zu(t),this.currentSelection.set(r),t.scrollToSelection()):(s>-1||i)&&(s>-1&&(t.docView.markDirty(s,l),qO(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,VO(t,f)),this.handleDOMChange(s,l,c,f),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||zu(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let p=0;p<t.addedNodes.length;p++){let g=t.addedNodes[p];n.push(g),g.nodeType==3&&(this.lastChangedTextNode=g)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let i=t.previousSibling,s=t.nextSibling;if(Ga&&Mf<=11&&t.addedNodes.length)for(let p=0;p<t.addedNodes.length;p++){let{previousSibling:g,nextSibling:b}=t.addedNodes[p];(!g||Array.prototype.indexOf.call(t.addedNodes,g)<0)&&(i=g),(!b||Array.prototype.indexOf.call(t.addedNodes,b)<0)&&(s=b)}let l=i&&i.parentNode==t.target?zs(i)+1:0,c=r.localPosFromDOM(t.target,l,-1),f=s&&s.parentNode==t.target?zs(s):t.target.childNodes.length,d=r.localPosFromDOM(t.target,f,1);return{from:c,to:d}}else return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=t.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let j3=new WeakMap,I3=!1;function qO(e){if(!j3.has(e)&&(j3.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=$l,I3)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),I3=!0}}function z3(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,s=t.endOffset,l=e.domAtPos(e.state.selection.anchor);return wd(l.node,l.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function $O(e,t){if(t.getComposedRanges){let i=t.getComposedRanges(e.root)[0];if(i)return z3(e,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?z3(e,n):null}function YO(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function VO(e,t){var n;let{focusNode:r,focusOffset:i}=e.domSelectionRange();for(let s of t)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let l=s.nextSibling;for(;l&&l.nodeName!="TD"&&l.nodeName!="TH";)l=l.nextSibling;if(l){let c=l;for(;;){let f=c.firstChild;if(!f||f.nodeType!=1||f.contentEditable=="false"||/^(BR|IMG)$/.test(f.nodeName))break;c=f}c.insertBefore(s,c.firstChild),r==s&&e.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function WO(e,t,n,r){let{node:i,fromOffset:s,toOffset:l,from:c,to:f}=e.docView.parseRange(t,n),d=e.domSelectionRange(),p,g=d.anchorNode;if(g&&e.dom.contains(g.nodeType==1?g:g.parentNode)&&(p=[{node:g,offset:d.anchorOffset}],o1(d)||p.push({node:d.focusNode,offset:d.focusOffset})),Fs&&e.input.lastKeyCode===8)for(let L=l;L>s;L--){let q=i.childNodes[L-1],$=q.pmViewDesc;if(q.nodeName=="BR"&&!$){l=L;break}if(!$||$.size)break}let b=e.state.doc,y=e.someProp("domParser")||Cp.fromSchema(e.state.schema),M=b.resolve(c),E=null,D=y.parse(i,{topNode:M.parent,topMatch:M.parent.contentMatchAt(M.index()),topOpen:!0,from:s,to:l,preserveWhitespace:M.parent.type.whitespace=="pre"?"full":!0,findPositions:p,ruleFromNode:XO(r),context:M});if(p&&p[0].pos!=null){let L=p[0].pos,q=p[1]&&p[1].pos;q==null&&(q=L),E={anchor:L+c,head:q+c}}return{doc:D,sel:E,from:c,to:f}}const XO=e=>t=>{let n=t.pmViewDesc;if(n)return n.parseRule(e);if(t.nodeName=="BR"&&t.parentNode){if(ha&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(t.parentNode.lastChild==t||ha&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null},GO=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function KO(e,t,n,r,i){let s=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let vt=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,bt=gb(e,vt);if(bt&&!e.state.selection.eq(bt)){if(Fs&&Pu&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",Dt=>Dt(e,td(13,"Enter"))))return;let rt=e.state.tr.setSelection(bt);vt=="pointer"?rt.setMeta("pointer",!0):vt=="key"&&rt.scrollIntoView(),s&&rt.setMeta("composition",s),e.dispatch(rt)}return}let l=e.state.doc.resolve(t),c=l.sharedDepth(n);t=l.before(c+1),n=e.state.doc.resolve(n).after(c+1);let f=e.state.selection,d=WO(e,t,n,i),p=e.state.doc,g=p.slice(d.from,d.to),b,y;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(b=e.state.selection.to,y="end"):(b=e.state.selection.from,y="start"),e.input.lastKeyCode=null;let M=QO(g.content,d.doc.content,d.from,b,y);if(M&&e.input.domChangeCount++,(xh&&e.input.lastIOSEnter>Date.now()-225||Pu)&&i.some(vt=>vt.nodeType==1&&!GO.test(vt.nodeName))&&(!M||M.endA>=M.endB)&&e.someProp("handleKeyDown",vt=>vt(e,td(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!M)if(r&&f instanceof Pn&&!f.empty&&f.$head.sameParent(f.$anchor)&&!e.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))M={start:f.from,endA:f.to,endB:f.to};else{if(d.sel){let vt=B3(e,e.state.doc,d.sel);if(vt&&!vt.eq(e.state.selection)){let bt=e.state.tr.setSelection(vt);s&&bt.setMeta("composition",s),e.dispatch(bt)}}return}e.state.selection.from<e.state.selection.to&&M.start==M.endB&&e.state.selection instanceof Pn&&(M.start>e.state.selection.from&&M.start<=e.state.selection.from+2&&e.state.selection.from>=d.from?M.start=e.state.selection.from:M.endA<e.state.selection.to&&M.endA>=e.state.selection.to-2&&e.state.selection.to<=d.to&&(M.endB+=e.state.selection.to-M.endA,M.endA=e.state.selection.to)),Ga&&Mf<=11&&M.endB==M.start+1&&M.endA==M.start&&M.start>d.from&&d.doc.textBetween(M.start-d.from-1,M.start-d.from+1)=="  "&&(M.start--,M.endA--,M.endB--);let E=d.doc.resolveNoCache(M.start-d.from),D=d.doc.resolveNoCache(M.endB-d.from),L=p.resolve(M.start),q=E.sameParent(D)&&E.parent.inlineContent&&L.end()>=M.endA;if((xh&&e.input.lastIOSEnter>Date.now()-225&&(!q||i.some(vt=>vt.nodeName=="DIV"||vt.nodeName=="P"))||!q&&E.pos<d.doc.content.size&&(!E.sameParent(D)||!E.parent.inlineContent)&&E.pos<D.pos&&!/\S/.test(d.doc.textBetween(E.pos,D.pos,"","")))&&e.someProp("handleKeyDown",vt=>vt(e,td(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>M.start&&ZO(p,M.start,M.endA,E,D)&&e.someProp("handleKeyDown",vt=>vt(e,td(8,"Backspace")))){Pu&&Fs&&e.domObserver.suppressSelectionUpdates();return}Fs&&M.endB==M.start&&(e.input.lastChromeDelete=Date.now()),Pu&&!q&&E.start()!=D.start()&&D.parentOffset==0&&E.depth==D.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==M.endA&&(M.endB-=2,D=d.doc.resolveNoCache(M.endB-d.from),setTimeout(()=>{e.someProp("handleKeyDown",function(vt){return vt(e,td(13,"Enter"))})},20));let $=M.start,Y=M.endA,ht=vt=>{let bt=vt||e.state.tr.replace($,Y,d.doc.slice(M.start-d.from,M.endB-d.from));if(d.sel){let rt=B3(e,bt.doc,d.sel);rt&&!(Fs&&e.composing&&rt.empty&&(M.start!=M.endB||e.input.lastChromeDelete<Date.now()-100)&&(rt.head==$||rt.head==bt.mapping.map(Y)-1)||Ga&&rt.empty&&rt.head==$)&&bt.setSelection(rt)}return s&&bt.setMeta("composition",s),bt.scrollIntoView()},Mt;if(q)if(E.pos==D.pos){Ga&&Mf<=11&&E.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>zu(e),20));let vt=ht(e.state.tr.delete($,Y)),bt=p.resolve(M.start).marksAcross(p.resolve(M.endA));bt&&vt.ensureMarks(bt),e.dispatch(vt)}else if(M.endA==M.endB&&(Mt=JO(E.parent.content.cut(E.parentOffset,D.parentOffset),L.parent.content.cut(L.parentOffset,M.endA-L.start())))){let vt=ht(e.state.tr);Mt.type=="add"?vt.addMark($,Y,Mt.mark):vt.removeMark($,Y,Mt.mark),e.dispatch(vt)}else if(E.parent.child(E.index()).isText&&E.index()==D.index()-(D.textOffset?0:1)){let vt=E.parent.textBetween(E.parentOffset,D.parentOffset),bt=()=>ht(e.state.tr.insertText(vt,$,Y));e.someProp("handleTextInput",rt=>rt(e,$,Y,vt,bt))||e.dispatch(bt())}else e.dispatch(ht());else e.dispatch(ht())}function B3(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:yb(e,t.resolve(n.anchor),t.resolve(n.head))}function JO(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,s=r,l,c,f;for(let p=0;p<r.length;p++)i=r[p].removeFromSet(i);for(let p=0;p<n.length;p++)s=n[p].removeFromSet(s);if(i.length==1&&s.length==0)c=i[0],l="add",f=p=>p.mark(c.addToSet(p.marks));else if(i.length==0&&s.length==1)c=s[0],l="remove",f=p=>p.mark(c.removeFromSet(p.marks));else return null;let d=[];for(let p=0;p<t.childCount;p++)d.push(f(t.child(p)));if(ke.from(d).eq(e))return{mark:c,type:l}}function ZO(e,t,n,r,i){if(n-t<=i.pos-r.pos||u2(r,!0,!1)<i.pos)return!1;let s=e.resolve(t);if(!r.parent.isTextblock){let c=s.nodeAfter;return c!=null&&n==t+c.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let l=e.resolve(u2(s,!0,!0));return!l.parent.isTextblock||l.pos>n||u2(l,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function u2(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let s=e.node(r).maybeChild(e.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function QO(e,t,n,r,i){let s=e.findDiffStart(t,n),l=n+e.size,c=n+t.size;if(s==null)return null;let{a:f,b:d}=e.findDiffEnd(t,l,c);if(i=="end"){let p=Math.max(0,s-Math.min(f,d));r-=f+p-s}if(f<s&&l<c){let p=r<=s&&r>=f?s-r:0;s-=p,d=s+(d-f),f=s}else if(d<s){let p=r<=s&&r>=d?s-r:0;s-=p,f=s+(f-d),d=s}return{start:s,endA:f,endB:d}}class wC{constructor(t,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new mO,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach($3),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=H3(this),U3(this),this.nodeViews=q3(this),this.docView=S3(this.state.doc,F3(this),c2(this),this.dom,this),this.domObserver=new HO(this,(r,i,s,l)=>KO(this,r,i,s,l)),this.domObserver.start(),gO(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&C5(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach($3),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var r;let i=this.state,s=!1,l=!1;t.storedMarks&&this.composing&&(pC(this),l=!0),this.state=t;let c=i.plugins!=t.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=q3(this);e7(y,this.nodeViews)&&(this.nodeViews=y,s=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&C5(this),this.editable=H3(this),U3(this);let f=c2(this),d=F3(this),p=i.plugins!=t.plugins&&!i.doc.eq(t.doc)?"reset":t.scrollToSelection>i.scrollToSelection?"to selection":"preserve",g=s||!this.docView.matchesNode(t.doc,d,f);(g||!t.selection.eq(i.selection))&&(l=!0);let b=p=="preserve"&&l&&this.dom.style.overflowAnchor==null&&_R(this);if(l){this.domObserver.stop();let y=g&&(Ga||Fs)&&!this.composing&&!i.selection.empty&&!t.selection.empty&&t7(i.selection,t.selection);if(g){let E=Fs?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=DO(this)),(s||!this.docView.update(t.doc,d,f,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=S3(t.doc,d,f,this.dom,this)),E&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}let M=this.input.mouseDown;y||!(M&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&tO(this)&&M.delaySelUpdate())?zu(this,y):(tC(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,i),p=="reset"?this.dom.scrollTop=0:p=="to selection"?this.scrollToSelection():b&&DR(b)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Nn){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&y3(this,n.getBoundingClientRect(),t)}else y3(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,t)}}updateDraggedNode(t,n){let r=t.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new gC(t.slice,t.move,i<0?void 0:Nn.create(this.state.doc,i))}someProp(t,n){let r=this._props&&this._props[t],i;if(r!=null&&(i=n?n(r):r))return i;for(let l=0;l<this.directPlugins.length;l++){let c=this.directPlugins[l].props[t];if(c!=null&&(i=n?n(c):c))return i}let s=this.state.plugins;if(s)for(let l=0;l<s.length;l++){let c=s[l].props[t];if(c!=null&&(i=n?n(c):c))return i}}hasFocus(){if(Ga){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&LR(this.dom),zu(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return t||document}updateRoot(){this._root=null}posAtCoords(t){return IR(this,t)}coordsAtPos(t,n=1){return VM(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let i=this.docView.posFromDOM(t,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(t,n){return HR(this,n||this.state,t)}pasteHTML(t,n){return Wp(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return Wp(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return bb(this,t)}destroy(){this.docView&&(yO(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],c2(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,vR())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return xO(this,t)}domSelectionRange(){let t=this.domSelection();return t?ha&&this.root.nodeType===11&&MR(this.dom.ownerDocument)==this.dom&&$O(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}wC.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function F3(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[wa.node(0,e.state.doc.content.size,t)]}function U3(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:wa.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function H3(e){return!e.someProp("editable",t=>t(e.state)===!1)}function t7(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function q3(e){let t=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=r[i])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function e7(e,t){let n=0,r=0;for(let i in e){if(e[i]!=t[i])return!0;n++}for(let i in t)r++;return n!=r}function $3(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var _f={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},p0={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},n7=typeof navigator<"u"&&/Mac/.test(navigator.platform),r7=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Bs=0;Bs<10;Bs++)_f[48+Bs]=_f[96+Bs]=String(Bs);for(var Bs=1;Bs<=24;Bs++)_f[Bs+111]="F"+Bs;for(var Bs=65;Bs<=90;Bs++)_f[Bs]=String.fromCharCode(Bs+32),p0[Bs]=String.fromCharCode(Bs);for(var f2 in _f)p0.hasOwnProperty(f2)||(p0[f2]=_f[f2]);function i7(e){var t=n7&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||r7&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?p0:_f)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const o7=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),s7=typeof navigator<"u"&&/Win/.test(navigator.platform);function a7(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,i,s,l;for(let c=0;c<t.length-1;c++){let f=t[c];if(/^(cmd|meta|m)$/i.test(f))l=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))s=!0;else if(/^mod$/i.test(f))o7?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+f)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),l&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function l7(e){let t=Object.create(null);for(let n in e)t[a7(n)]=e[n];return t}function d2(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function c7(e){return new Zi({props:{handleKeyDown:SC(e)}})}function SC(e){let t=l7(e);return function(n,r){let i=i7(r),s,l=t[d2(i,r)];if(l&&l(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=t[d2(i,r,!1)];if(c&&c(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(s7&&r.ctrlKey&&r.altKey)&&(s=_f[r.keyCode])&&s!=i){let c=t[d2(s,r)];if(c&&c(n.state,n.dispatch,n))return!0}}return!1}}function a1(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var fh=class kC{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,l=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([c,f])=>[c,(...p)=>{const g=f(...p)(l);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),g}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:l}=i,c=[],f=!!t,d=t||s.tr,p=()=>(!f&&n&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(d),c.every(b=>b===!0)),g={...Object.fromEntries(Object.entries(r).map(([b,y])=>[b,(...E)=>{const D=this.buildProps(d,n),L=y(...E)(D);return c.push(L),g}])),run:p};return g}static createFakeChain(){const t=new Proxy({},{get:(n,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>t}});return t}createCan(t){const{rawCommands:n,state:r}=this,i=!1,s=t||r.tr,l=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([c,f])=>[c,(...d)=>f(...d)({...l,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}static createFallbackCan(){const t=kC.createFakeChain();return new Proxy({chain:()=>t},{get:(n,r)=>{if(r!=="then")return r==="chain"?n.chain:()=>!1}})}buildProps(t,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:l}=i,c={tr:t,editor:i,view:l,state:a1({state:s,transaction:t}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(t,n),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map(([f,d])=>[f,(...p)=>d(...p)(c)]))}};return c}};const u7=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{if(!e.isDestroyed){var n;t.dom.blur(),(n=window)===null||n===void 0||(n=n.getSelection())===null||n===void 0||n.removeAllRanges()}}),!0),f7=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),d7=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:l})=>{e.doc.nodesBetween(s.pos,l.pos,(c,f)=>{if(c.type.isText)return;const{doc:d,mapping:p}=t,g=d.resolve(p.map(f)),b=d.resolve(p.map(f+c.nodeSize)),y=g.blockRange(b);if(!y)return;const M=Eh(y);if(c.type.isTextblock){const{defaultType:E}=g.parent.contentMatchAt(g.index());t.setNodeMarkup(y.start,E)}(M||M===0)&&t.lift(y,M)})}),!0},h7=e=>t=>e(t),p7=()=>({state:e,dispatch:t})=>PM(e,t),m7=(e,t)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const l=r.mapping.map(t);return r.insert(l,s.content),r.setSelection(new Pn(r.doc.resolve(Math.max(l-1,0)))),!0},g7=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(t){const l=i.before(s),c=i.after(s);e.delete(l,c).scrollIntoView()}return!0}return!1};function Yo(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}const y7=e=>({tr:t,state:n,dispatch:r})=>{const i=Yo(e,n.schema),s=t.selection.$anchor;for(let l=s.depth;l>0;l-=1)if(s.node(l).type===i){if(r){const c=s.before(l),f=s.after(l);t.delete(c,f).scrollIntoView()}return!0}return!1},b7=e=>({tr:t,dispatch:n})=>{const{from:r,to:i}=e;return n&&t.delete(r,i),!0},x7=e=>e.content?/^text(\*|\+)/.test(e.content):!1,Y3=(e,t,n)=>{if(!e.parent.isInline||n==="left"&&e.pos>e.start()||n==="right"&&e.pos<e.end())return e.pos;const r=t.nodes[e.parent.type.name].spec;return x7(r)?n==="left"?e.start()-1:e.end()+1:e.pos},v7=(e,t,n)=>({from:Y3(e,n,"left"),to:Y3(t,n,"right")}),w7=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){const n=e.tr,{ranges:r}=e.selection,i=n.steps.length;r.forEach(s=>{const l=n.mapping.slice(i),c=n.doc.resolve(l.map(s.$from.pos)),f=n.doc.resolve(l.map(s.$to.pos)),{from:d,to:p}=v7(c,f,e.schema);n.deleteRange(d,p)}),n.selection.empty||n.setSelection(Pn.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),t(n)}return!0},S7=()=>({commands:e})=>e.keyboardShortcut("Enter"),k7=()=>({state:e,dispatch:t})=>oR(e,t);function Ab(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function m0(e,t,n={strict:!0}){const r=Object.keys(t);return r.length?r.every(i=>n.strict?t[i]===e[i]:Ab(t[i])?t[i].test(e[i]):t[i]===e[i]):!0}function AC(e,t,n={}){return e.find(r=>r.type===t&&m0(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function V3(e,t,n={}){return!!AC(e,t,n)}function Mb(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(f=>f.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(f=>f.type===t))return;if(!n){const f=r.node.marks.find(d=>d.type===t);f&&(n=f.attrs)}if(!AC([...r.node.marks],t,n))return;let i=r.index,s=e.start()+r.offset,l=i+1,c=s+r.node.nodeSize;for(;i>0&&V3([...e.parent.child(i-1).marks],t,n);)i-=1,s-=e.parent.child(i).nodeSize;for(;l<e.parent.childCount&&V3([...e.parent.child(l).marks],t,n);)c+=e.parent.child(l).nodeSize,l+=1;return{from:s,to:c}}function Fu(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}const A7=(e,t)=>({tr:n,state:r,dispatch:i})=>{const s=Fu(e,r.schema),{doc:l,selection:c}=n,{$from:f,from:d,to:p}=c;if(i){const g=Mb(f,s,t);if(g&&g.from<=d&&g.to>=p){const b=Pn.create(l,g.from,g.to);n.setSelection(b)}}return!0},M7=e=>t=>{const n=typeof e=="function"?e(t):e;for(let r=0;r<n.length;r+=1)if(n[r](t))return!0;return!1};function MC(e){return e instanceof Pn}function od(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function E5(e,t=null){if(!t)return null;const n=rr.atStart(e),r=rr.atEnd(e);if(t==="start"||t===!0)return n;if(t==="end")return r;const i=n.from,s=r.to;return t==="all"?Pn.create(e,od(0,i,s),od(e.content.size,i,s)):Pn.create(e,od(t,i,s),od(t,i,s))}function W3(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function g0(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function C7(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const E7=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:s})=>{t={scrollIntoView:!0,...t};const l=()=>{(g0()||W3())&&r.dom.focus(),C7()&&!g0()&&!W3()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(s&&e===null&&!MC(n.state.selection))return l(),!0;const c=E5(i.doc,e)||n.state.selection,f=n.state.selection.eq(c);return s&&(f||i.setSelection(c),f&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},T7=(e,t)=>n=>e.every((r,i)=>t(r,{...n,index:i})),N7=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),CC=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&CC(r)}return e};function dg(e){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,"text/html").body;return CC(n)}function EC(e){return typeof e?.nodesBetween=="function"}function vh(e,t,n){if(EC(e))return e;const r=typeof e=="object"&&e!==null;n={slice:!0,parseOptions:{},...n};const i=typeof e=="string";if(r)try{if(Array.isArray(e)&&e.length>0)return ke.fromArray(e.map(l=>t.nodeFromJSON(l)));const s=t.nodeFromJSON(e);return n.errorOnInvalidContent&&s.check(),s}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",s),vh("",t,n)}if(i){if(n.errorOnInvalidContent){let l=!1,c="";const f=new aM({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(l=!0,c=typeof d=="string"?d:d.outerHTML,null)}]}})});if(n.slice?Cp.fromSchema(f).parseSlice(dg(e),n.parseOptions):Cp.fromSchema(f).parse(dg(e),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=Cp.fromSchema(t);return n.slice?s.parseSlice(dg(e),n.parseOptions).content:s.parse(dg(e),n.parseOptions)}return vh("",t,n)}function TC(e){return!("type"in e)}function NC(e,t,n){const r=e.steps.length-1;if(r<t)return;const i=e.steps[r];if(!(i instanceof Eo||i instanceof xs))return;const s=e.mapping.maps[r];let l=0;s.forEach((c,f,d,p)=>{l===0&&(l=p)}),e.setSelection(rr.near(e.doc.resolve(l),n))}const _7=(e,t,n)=>({tr:r,dispatch:i,editor:s})=>{if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const f=D=>{s.emit("contentError",{editor:s,error:D,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{vh(t,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(D){f(D)}try{var l;c=vh(t,s.schema,{parseOptions:d,errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:s.options.enableContentCheck})}catch(D){return f(D),!1}let{from:p,to:g}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},b=!0,y=!0;const M=TC(c)?c.content:[c];if(M.forEach(D=>{D.check(),b=b?D.isText&&D.marks.length===0:!1,y=y?D.isBlock:!1}),p===g&&y){const{parent:D}=r.doc.resolve(p);D.isTextblock&&!D.type.spec.code&&!D.childCount&&(p-=1,g+=1)}let E;if(b)Array.isArray(t)?E=t.map(D=>D.text||"").join(""):EC(t)?E=M.map(D=>{var L;return(L=D.text)!==null&&L!==void 0?L:""}).join(""):typeof t=="object"&&t&&t.text?E=t.text:E=t,r.insertText(E,p,g);else{E=ke.from(M);const D=r.doc.resolve(p),L=D.node(),q=D.parentOffset===0,$=L.isText||L.isTextblock,Y=L.content.size>0;q&&$&&Y&&y&&(p=Math.max(0,p-1)),r.replaceWith(p,g,M)}n.updateSelection&&NC(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:p,text:E}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:p,text:E})}return!0};function _C(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const D7=(e={})=>({tr:t,dispatch:n,editor:r})=>{const{pos:i,attrs:s,content:l,updateSelection:c=!0}=e;let f;typeof i=="number"?f=t.doc.resolve(i):i?f=i:f=t.selection.$from;const d=_C(f.parent.contentMatchAt(f.index()));if(!d)return!1;const p=Object.keys(d.spec.attrs||{}),g=s?Object.fromEntries(Object.entries(s).filter(([y])=>p.includes(y))):{};let b;if(l){const y=vh(l,r.schema);b=d.createAndFill(g,y)}else b=d.createAndFill(g);return b?(n&&(t.insert(f.pos,b),c&&NC(t,t.steps.length-1,-1)),!0):!1},L7=()=>({state:e,dispatch:t})=>nR(e,t),R7=()=>({state:e,dispatch:t})=>rR(e,t),O7=()=>({state:e,dispatch:t})=>TM(e,t),P7=()=>({state:e,dispatch:t})=>LM(e,t),j7=()=>({state:e,dispatch:t,tr:n})=>{try{const r=n1(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},I7=()=>({state:e,dispatch:t,tr:n})=>{try{const r=n1(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},z7=()=>({state:e,dispatch:t})=>tR(e,t),B7=()=>({state:e,dispatch:t})=>eR(e,t);function DC(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function F7(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let r,i,s,l;for(let c=0;c<t.length-1;c+=1){const f=t[c];if(/^(cmd|meta|m)$/i.test(f))l=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))s=!0;else if(/^mod$/i.test(f))g0()||DC()?l=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${f}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),l&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const U7=e=>({editor:t,view:n,tr:r,dispatch:i})=>{const s=F7(e).split(/-(?!$)/),l=s.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),c=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),f=t.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,c))});return f?.steps.forEach(d=>{const p=d.map(r.mapping);p&&i&&r.maybeStep(p)}),!0};function Df(e,t,n={}){const{from:r,to:i,empty:s}=e.selection,l=t?Yo(t,e.schema):null,c=[];e.doc.nodesBetween(r,i,(p,g)=>{if(p.isText)return;const b=Math.max(r,g),y=Math.min(i,g+p.nodeSize);c.push({node:p,from:b,to:y})});const f=i-r,d=c.filter(p=>l?l.name===p.node.type.name:!0).filter(p=>m0(p.node.attrs,n,{strict:!1}));return s?!!d.length:d.reduce((p,g)=>p+g.to-g.from,0)>=f}const H7=(e,t={})=>({state:n,dispatch:r})=>Df(n,Yo(e,n.schema),t)?iR(n,r):!1,q7=()=>({state:e,dispatch:t})=>jM(e,t),$7=e=>({state:t,dispatch:n})=>{const r=Yo(e,t.schema);return gR(r)(t,n)},Y7=()=>({state:e,dispatch:t})=>OM(e,t);function l1(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function X3(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((r,i)=>(n.includes(i)||(r[i]=e[i]),r),{})}const V7=(e,t)=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=l1(typeof e=="string"?e:e.name,r.schema);if(!c)return!1;c==="node"&&(s=Yo(e,r.schema)),c==="mark"&&(l=Fu(e,r.schema));let f=!1;return n.selection.ranges.forEach(d=>{r.doc.nodesBetween(d.$from.pos,d.$to.pos,(p,g)=>{s&&s===p.type&&(f=!0,i&&n.setNodeMarkup(g,void 0,X3(p.attrs,t))),l&&p.marks.length&&p.marks.forEach(b=>{l===b.type&&(f=!0,i&&n.addMark(g,g+p.nodeSize,l.create(X3(b.attrs,t))))})})}),f},W7=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),X7=()=>({tr:e,dispatch:t})=>{if(t){const n=new gl(e.doc);e.setSelection(n)}return!0},G7=()=>({state:e,dispatch:t})=>_M(e,t),K7=()=>({state:e,dispatch:t})=>RM(e,t),J7=()=>({state:e,dispatch:t})=>lR(e,t),Z7=()=>({state:e,dispatch:t})=>fR(e,t),Q7=()=>({state:e,dispatch:t})=>uR(e,t);function T5(e,t,n={},r={}){return vh(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const tP=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:l,commands:c})=>{const{doc:f}=s;if(r.preserveWhitespace!=="full"){const d=T5(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});if(l){const p=TC(d)?d.content:[d];s.replaceWith(0,f.content.size,p).setMeta("preventUpdate",!n)}return!0}return l&&s.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:f.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function LC(e,t){const n=Fu(t,e.schema),{from:r,to:i,empty:s}=e.selection,l=[];s?(e.storedMarks&&l.push(...e.storedMarks),l.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,f=>{l.push(...f.marks)});const c=l.find(f=>f.type.name===n.name);return c?{...c.attrs}:{}}function RC(e,t){const n=new kM(e);return t.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function eP(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function nP(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function c1(e){return t=>nP(t.$from,e)}function mn(e,t,n){return e.config[t]===void 0&&e.parent?mn(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?mn(e.parent,t,n):null}):e.config[t]}function Cb(e){return e.map(t=>{const n=mn(t,"addExtensions",{name:t.name,options:t.options,storage:t.storage});return n?[t,...Cb(n())]:t}).flat(10)}function Eb(e,t){const n=Cd.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function OC(e){return typeof e=="function"}function Zr(e,t=void 0,...n){return OC(e)?t?e.bind(t)(...n):e(...n):e}function rP(e={}){return Object.keys(e).length===0&&e.constructor===Object}function wh(e){return{baseExtensions:e.filter(t=>t.type==="extension"),nodeExtensions:e.filter(t=>t.type==="node"),markExtensions:e.filter(t=>t.type==="mark")}}function PC(e){const t=[],{nodeExtensions:n,markExtensions:r}=wh(e),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},l=n.filter(d=>d.name!=="text").map(d=>d.name),c=r.map(d=>d.name),f=[...l,...c];return e.forEach(d=>{const p=mn(d,"addGlobalAttributes",{name:d.name,options:d.options,storage:d.storage,extensions:i});p&&p().forEach(g=>{let b;Array.isArray(g.types)?b=g.types:g.types==="*"?b=f:g.types==="nodes"?b=l:g.types==="marks"?b=c:b=[],b.forEach(y=>{Object.entries(g.attributes).forEach(([M,E])=>{t.push({type:y,name:M,attribute:{...s,...E}})})})})}),i.forEach(d=>{const p=mn(d,"addAttributes",{name:d.name,options:d.options,storage:d.storage});if(!p)return;const g=p();Object.entries(g).forEach(([b,y])=>{const M={...s,...y};typeof M?.default=="function"&&(M.default=M.default()),M?.isRequired&&M?.default===void 0&&delete M.default,t.push({type:d.name,name:b,attribute:M})})}),t}function iP(e){const t=[];let n="",r=!1,i=!1,s=0;const l=e.length;for(let c=0;c<l;c+=1){const f=e[c];if(f==="'"&&!i){r=!r,n+=f;continue}if(f==='"'&&!r){i=!i,n+=f;continue}if(!r&&!i){if(f==="("){s+=1,n+=f;continue}if(f===")"&&s>0){s-=1,n+=f;continue}if(f===";"&&s===0){t.push(n),n="";continue}}n+=f}return n&&t.push(n),t}function G3(e){const t=[],n=iP(e||""),r=n.length;for(let i=0;i<r;i+=1){const s=n[i],l=s.indexOf(":");if(l===-1)continue;const c=s.slice(0,l).trim(),f=s.slice(l+1).trim();c&&f&&t.push([c,f])}return t}function Do(...e){return e.filter(t=>!!t).reduce((t,n)=>{const r={...t};return Object.entries(n).forEach(([i,s])=>{if(i==="__proto__"){Object.defineProperty(r,i,{configurable:!0,enumerable:!0,value:s,writable:!0});return}if(!r[i]){r[i]=s;return}if(i==="class"){const l=s?String(s).split(" "):[],c=r[i]?r[i].split(" "):[],f=l.filter(d=>!c.includes(d));r[i]=[...c,...f].join(" ")}else if(i==="style"){const l=new Map([...G3(r[i]),...G3(s)]);r[i]=Array.from(l.entries()).map(([c,f])=>`${c}: ${f}`).join("; ")}else r[i]=s}),r},{})}function Gp(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,r)=>Do(n,r),{})}function oP(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function K3(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;const i=t.reduce((s,l)=>{const c=l.attribute.parseHTML?l.attribute.parseHTML(n):oP(n.getAttribute(l.name));return c==null?s:{...s,[l.name]:c}},{});return{...r,...i}}}}function J3(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&rP(n)?!1:n!=null))}function Z3(e){var t,n;const r={};return!(!(e==null||(t=e.attribute)===null||t===void 0)&&t.isRequired)&&"default"in(e?.attribute||{})&&(r.default=e.attribute.default),(e==null||(n=e.attribute)===null||n===void 0?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function sP(e,t){var n;const r=PC(e),{nodeExtensions:i,markExtensions:s}=wh(e),l=(n=i.find(d=>mn(d,"topNode")))===null||n===void 0?void 0:n.name,c=Object.fromEntries(i.map(d=>{const p=r.filter(D=>D.type===d.name),g={name:d.name,options:d.options,storage:d.storage,editor:t},b=J3({...e.reduce((D,L)=>{const q=mn(L,"extendNodeSchema",g);return{...D,...q?q(d):{}}},{}),content:Zr(mn(d,"content",g)),marks:Zr(mn(d,"marks",g)),group:Zr(mn(d,"group",g)),inline:Zr(mn(d,"inline",g)),atom:Zr(mn(d,"atom",g)),selectable:Zr(mn(d,"selectable",g)),draggable:Zr(mn(d,"draggable",g)),code:Zr(mn(d,"code",g)),whitespace:Zr(mn(d,"whitespace",g)),linebreakReplacement:Zr(mn(d,"linebreakReplacement",g)),defining:Zr(mn(d,"defining",g)),isolating:Zr(mn(d,"isolating",g)),attrs:Object.fromEntries(p.map(Z3))}),y=Zr(mn(d,"parseHTML",g));y&&(b.parseDOM=y.map(D=>K3(D,p)));const M=mn(d,"renderHTML",g);M&&(b.toDOM=D=>M({node:D,HTMLAttributes:Gp(D,p)}));const E=mn(d,"renderText",g);return E&&(b.toText=E),[d.name,b]})),f=Object.fromEntries(s.map(d=>{const p=r.filter(E=>E.type===d.name),g={name:d.name,options:d.options,storage:d.storage,editor:t},b=J3({...e.reduce((E,D)=>{const L=mn(D,"extendMarkSchema",g);return{...E,...L?L(d):{}}},{}),inclusive:Zr(mn(d,"inclusive",g)),excludes:Zr(mn(d,"excludes",g)),group:Zr(mn(d,"group",g)),spanning:Zr(mn(d,"spanning",g)),code:Zr(mn(d,"code",g)),attrs:Object.fromEntries(p.map(Z3))}),y=Zr(mn(d,"parseHTML",g));y&&(b.parseDOM=y.map(E=>K3(E,p)));const M=mn(d,"renderHTML",g);return M&&(b.toDOM=E=>M({mark:E,HTMLAttributes:Gp(E,p)})),[d.name,b]}));return new aM({topNode:l,nodes:c,marks:f})}function aP(e){const t=e.filter((n,r)=>e.indexOf(n)!==r);return Array.from(new Set(t))}function _p(e){return e.sort((n,r)=>{const i=mn(n,"priority")||100,s=mn(r,"priority")||100;return i>s?-1:i<s?1:0})}function jC(e){const t=_p(Cb(e)),n=aP(t.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),t}function IC(e,t,n){const{from:r,to:i}=t,{blockSeparator:s=`
105
+
106
+ `,textSerializers:l={}}=n||{};let c="";return e.nodesBetween(r,i,(f,d,p,g)=>{f.isBlock&&d>r&&(c+=s);const b=l?.[f.type.name];if(b)return p&&(c+=b({node:f,pos:d,parent:p,index:g,range:t})),!1;if(f.isText){var y;c+=f==null||(y=f.text)===null||y===void 0?void 0:y.slice(Math.max(r,d)-d,i-d)}}),c}function lP(e,t){return IC(e,{from:0,to:e.content.size},t)}function zC(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}function cP(e,t){const n=Yo(t,e.schema),{from:r,to:i}=e.selection,s=[];e.doc.nodesBetween(r,i,c=>{s.push(c)});const l=s.reverse().find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function BC(e,t){const n=l1(typeof t=="string"?t:t.name,e.schema);return n==="node"?cP(e,t):n==="mark"?LC(e,t):{}}function uP(e,t=JSON.stringify){const n={};return e.filter(r=>{const i=t(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function fP(e){const t=uP(e);return t.length===1?t:t.filter((n,r)=>!t.filter((i,s)=>s!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function Tb(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((i,s)=>{const l=[];if(i.ranges.length)i.forEach((c,f)=>{l.push({from:c,to:f})});else{const{from:c,to:f}=n[s];if(c===void 0||f===void 0)return;l.push({from:c,to:f})}l.forEach(({from:c,to:f})=>{const d=t.slice(s).map(c,-1),p=t.slice(s).map(f),g=t.invert().map(d,-1),b=t.invert().map(p);r.push({oldRange:{from:g,to:b},newRange:{from:d,to:p}})})}),fP(r)}function Nb(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(i=>{const s=Mb(n.resolve(e),i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(e,t,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(l=>({from:s,to:s+i.nodeSize,mark:l})))}),r}const dP=(e,t,n,r=20)=>{const i=e.doc.resolve(n);let s=r,l=null;for(;s>0&&l===null;){const c=i.node(s);c?.type.name===t?l=c:s-=1}return[l,s]};function Wd(e,t){return t.nodes[e]||t.marks[e]||null}function Pg(e,t,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=e.find(s=>s.type===t&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}const hP=(e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(i,s,l,c)=>{var f,d;const p=((f=(d=i.type.spec).toText)===null||f===void 0?void 0:f.call(d,{node:i,pos:s,parent:l,index:c}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?p:p.slice(0,Math.max(0,r-s))}),n};function N5(e,t,n={}){const{empty:r,ranges:i}=e.selection,s=t?Fu(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(p=>s?s.name===p.type.name:!0).find(p=>m0(p.attrs,n,{strict:!1}));let l=0;const c=[];if(i.forEach(({$from:p,$to:g})=>{const b=p.pos,y=g.pos;e.doc.nodesBetween(b,y,(M,E)=>{if(s&&M.inlineContent&&!M.type.allowsMarkType(s))return!1;if(!M.isText&&!M.marks.length)return;const D=Math.max(b,E),L=Math.min(y,E+M.nodeSize),q=L-D;l+=q,c.push(...M.marks.map($=>({mark:$,from:D,to:L})))})}),l===0)return!1;const f=c.filter(p=>s?s.name===p.mark.type.name:!0).filter(p=>m0(p.mark.attrs,n,{strict:!1})).reduce((p,g)=>p+g.to-g.from,0),d=c.filter(p=>s?p.mark.type!==s&&p.mark.type.excludes(s):!0).reduce((p,g)=>p+g.to-g.from,0);return(f>0?f+d:f)>=l}function pP(e,t,n={}){if(!t)return Df(e,null,n)||N5(e,null,n);const r=l1(t,e.schema);return r==="node"?Df(e,t,n):r==="mark"?N5(e,t,n):!1}const mP=(e,t)=>{const{$from:n,$to:r,$anchor:i}=e.selection;if(t){const s=c1(c=>c.type.name===t)(e.selection);if(!s)return!1;const l=e.doc.resolve(s.pos+1);return i.pos+1===l.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},gP=e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function Q3(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function h2(e,t){const{nodeExtensions:n}=wh(t),r=n.find(s=>s.name===e);if(!r)return!1;const i=Zr(mn(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof i!="string"?!1:i.split(" ").includes("list")}function u1(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name==="hardBreak")return!0;if(e.isText){var r;return!/\S/.test((r=e.text)!==null&&r!==void 0?r:"")}}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let i=!0;return e.content.forEach(s=>{i!==!1&&(u1(s,{ignoreWhitespace:n,checkChildren:t})||(i=!1))}),i}return!1}function FC(e){return e instanceof Nn}var UC=class HC{constructor(t){this.position=t}static fromJSON(t){return new HC(t.position)}toJSON(){return{position:this.position}}};function yP(e,t){const n=t.mapping.mapResult(e.position);return{position:new UC(n.pos),mapResult:n}}function bP(e){return new UC(e)}function xP(e,t,n){const{selection:r}=t;let i=null;if(MC(r)&&(i=r.$cursor),i){var s;const c=(s=e.storedMarks)!==null&&s!==void 0?s:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(f=>f.type.excludes(n)))}const{ranges:l}=r;return l.some(({$from:c,$to:f})=>{let d=c.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(c.pos,f.pos,(p,g,b)=>{if(d)return!1;if(p.isInline){const y=!b||b.type.allowsMarkType(n),M=!!n.isInSet(p.marks)||!p.marks.some(E=>E.type.excludes(n));d=y&&M}return!d}),d})}const vP=(e,t={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:l,ranges:c}=s,f=Fu(e,r.schema);if(i)if(l){const d=LC(r,f);n.addStoredMark(f.create({...d,...t}))}else c.forEach(d=>{const p=d.$from.pos,g=d.$to.pos;r.doc.nodesBetween(p,g,(b,y)=>{const M=Math.max(y,p),E=Math.min(y+b.nodeSize,g);b.marks.find(D=>D.type===f)?b.marks.forEach(D=>{f===D.type&&n.addMark(M,E,f.create({...D.attrs,...t}))}):n.addMark(M,E,f.create(t))})});return xP(r,n,f)},wP=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),SP=(e,t={})=>({state:n,dispatch:r,chain:i})=>{const s=Yo(e,n.schema);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:c})=>p3(s,{...l,...t})(n)?!0:c.clearNodes()).command(({state:c})=>p3(s,{...l,...t})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},kP=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,i=od(e,0,r.content.size),s=Nn.create(r,i);t.setSelection(s)}return!0},AP=(e,t)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;let l,c;return typeof t=="number"?(l=t,c=t):t&&"from"in t&&"to"in t?(l=t.from,c=t.to):(l=s.from,c=s.to),i&&n.doc.nodesBetween(l,c,(f,d)=>{f.isText||n.setNodeMarkup(d,void 0,{...f.attrs,dir:e})}),!0},MP=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,{from:i,to:s}=typeof e=="number"?{from:e,to:e}:e,l=Pn.atStart(r).from,c=Pn.atEnd(r).to,f=od(i,l,c),d=od(s,l,c),p=Pn.create(r,f,d);t.setSelection(p)}return!0},CP=e=>({state:t,dispatch:n})=>{const r=Yo(e,t.schema);return xR(r)(t,n)};function tk(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(i=>t?.includes(i.type.name));e.tr.ensureMarks(r)}}const EP=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:l}=t,{$from:c,$to:f}=s,d=i.extensionManager.attributes,p=Pg(d,c.node().type.name,c.node().attrs);if(s instanceof Nn&&s.node.isBlock)return!c.parentOffset||!Iu(l,c.pos)?!1:(r&&(e&&tk(n,i.extensionManager.splittableMarks),t.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const g=f.parentOffset===f.parent.content.size,b=c.depth===0?void 0:_C(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=g&&b?[{type:b,attrs:p}]:void 0,M=Iu(t.doc,t.mapping.map(c.pos),1,y);if(!y&&!M&&Iu(t.doc,t.mapping.map(c.pos),1,b?[{type:b}]:void 0)&&(M=!0,y=b?[{type:b,attrs:p}]:void 0),r){if(M&&(s instanceof Pn&&t.deleteSelection(),t.split(t.mapping.map(c.pos),1,y),b&&!g&&!c.parentOffset&&c.parent.type!==b)){const E=t.mapping.map(c.before()),D=t.doc.resolve(E);c.node(-1).canReplaceWith(D.index(),D.index()+1,b)&&t.setNodeMarkup(t.mapping.map(c.before()),b)}e&&tk(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return M},TP=(e,t={})=>({tr:n,state:r,dispatch:i,editor:s})=>{const l=Yo(e,r.schema),{$from:c,$to:f}=r.selection,d=r.selection.node;if(d&&d.isBlock||c.depth<2||!c.sameParent(f))return!1;const p=c.node(-1);if(p.type!==l)return!1;const g=s.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(i){var b;let L=ke.empty;const q=c.index(-1)?1:c.index(-2)?2:3;for(let bt=c.depth-q;bt>=c.depth-3;bt-=1)L=ke.from(c.node(bt).copy(L));const $=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,Y={...Pg(g,c.node().type.name,c.node().attrs),...t},ht=((b=l.contentMatch.defaultType)===null||b===void 0?void 0:b.createAndFill(Y))||void 0;L=L.append(ke.from(l.createAndFill(null,ht)||void 0));const Mt=c.before(c.depth-(q-1));n.replace(Mt,c.after(-$),new Ge(L,4-q,0));let vt=-1;n.doc.nodesBetween(Mt,n.doc.content.size,(bt,rt)=>{if(vt>-1)return!1;bt.isTextblock&&bt.content.size===0&&(vt=rt+1)}),vt>-1&&n.setSelection(Pn.near(n.doc.resolve(vt))),n.scrollIntoView()}return!0}const y=f.pos===c.end()?p.contentMatchAt(0).defaultType:null,M={...Pg(g,p.type.name,p.attrs),...t},E={...Pg(g,c.node().type.name,c.node().attrs),...t};n.delete(c.pos,f.pos);const D=y?[{type:l,attrs:M},{type:y,attrs:E}]:[{type:l,attrs:M}];if(!Iu(n.doc,c.pos,2))return!1;if(i){const{selection:L,storedMarks:q}=r,{splittableMarks:$}=s.extensionManager,Y=q||L.$to.parentOffset&&L.$from.marks();if(n.split(c.pos,2,D).scrollIntoView(),!Y||!i)return!0;const ht=Y.filter(Mt=>$.includes(Mt.type.name));n.ensureMarks(ht)}return!0};function ek(e){return!e||e==="1"?null:e}function qC(e,t){return ek(e)===ek(t)}const p2=(e,t)=>{const n=c1(s=>s.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&Lf(e.doc,n.pos))||!qC(n.node.attrs.type,i?.attrs.type)||e.join(n.pos),!0},m2=(e,t)=>{const n=c1(s=>s.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&Lf(e.doc,r))||!qC(n.node.attrs.type,i?.attrs.type)||e.join(r),!0};function NP(e){const t=e.doc,n=t.firstChild;if(!n)return null;const r=t.resolve(1),i=t.resolve(n.nodeSize-1);return Pn.between(r,i)}const _P=(e,t,n,r={})=>({editor:i,tr:s,state:l,dispatch:c,chain:f,commands:d,can:p})=>{const{extensions:g,splittableMarks:b}=i.extensionManager,y=Yo(e,l.schema),M=Yo(t,l.schema),{selection:E,storedMarks:D}=l,{$from:L,$to:q}=E,$=L.blockRange(q),Y=D||E.$to.parentOffset&&E.$from.marks();if(!$)return!1;const ht=c1(X=>h2(X.type.name,g))(E),Mt=E.from===0&&E.to===l.doc.content.size,vt=l.doc.content.content,bt=vt.length===1?vt[0]:null,rt=Mt&&bt&&h2(bt.type.name,g)?{node:bt,pos:0}:null,Dt=ht??rt,Q=!!ht&&$.depth>=1&&$.depth-ht.depth<=1,lt=!!rt;if((Q||lt)&&Dt){if(Dt.node.type===y)return Mt&&lt?f().command(({tr:X,dispatch:wt})=>{const Tt=NP(X);return Tt?(X.setSelection(Tt),wt&&wt(X),!0):!1}).liftListItem(M).run():d.liftListItem(M);if(h2(Dt.node.type.name,g)&&y.validContent(Dt.node.content))return f().command(()=>(s.setNodeMarkup(Dt.pos,y),!0)).command(()=>p2(s,y)).command(()=>m2(s,y)).run()}return!n||!Y||!c?f().command(()=>p().wrapInList(y,r)?!0:d.clearNodes()).wrapInList(y,r).command(()=>p2(s,y)).command(()=>m2(s,y)).run():f().command(()=>{const X=p().wrapInList(y,r),wt=Y.filter(Tt=>b.includes(Tt.type.name));return s.ensureMarks(wt),X?!0:d.clearNodes()}).wrapInList(y,r).command(()=>p2(s,y)).command(()=>m2(s,y)).run()},DP=(e,t={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,l=Fu(e,r.schema);return N5(r,l,t)?i.unsetMark(l,{extendEmptyMarkRange:s}):i.setMark(l,t)},LP=(e,t,n={})=>({state:r,commands:i})=>{const s=Yo(e,r.schema),l=Yo(t,r.schema),c=Df(r,s,n);let f;return r.selection.$anchor.sameParent(r.selection.$head)&&(f=r.selection.$anchor.parent.attrs),c?i.setNode(l,f):i.setNode(s,{...f,...n})},RP=(e,t={})=>({state:n,commands:r})=>{const i=Yo(e,n.schema);return Df(n,i,t)?r.lift(i):r.wrapIn(i,t)},OP=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(e))){if(t){const l=e.tr,c=s.transform;for(let f=c.steps.length-1;f>=0;f-=1)l.step(c.steps[f].invert(c.docs[f]));if(s.text){const f=l.doc.resolve(s.from).marks();l.replaceWith(s.from,s.to,e.schema.text(s.text,f))}else l.delete(s.from,s.to)}return!0}}return!1},PP=(e={})=>({tr:t,dispatch:n,editor:r})=>{const{ignoreClearable:i=!1}=e,{selection:s}=t,{empty:l,ranges:c}=s;if(l)return!0;const{nonClearableMarks:f}=r.extensionManager;if(n){const d=Object.values(r.schema.marks).filter(p=>i||!f.includes(p.name));c.forEach(p=>{for(const g of d)t.removeMark(p.$from.pos,p.$to.pos,g)})}return!0},jP=(e,t={})=>({tr:n,state:r,dispatch:i})=>{const{extendEmptyMarkRange:s=!1}=t,{selection:l}=n,c=Fu(e,r.schema),{$from:f,empty:d,ranges:p}=l;if(!i)return!0;if(d&&s){var g;let{from:b,to:y}=l;const M=Mb(f,c,(g=f.marks().find(E=>E.type===c))===null||g===void 0?void 0:g.attrs);M&&(b=M.from,y=M.to),n.removeMark(b,y,c)}else p.forEach(b=>{n.removeMark(b.$from.pos,b.$to.pos,c)});return n.removeStoredMark(c),!0},IP=e=>({tr:t,state:n,dispatch:r})=>{const{selection:i}=n;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=i.from,l=i.to),r&&t.doc.nodesBetween(s,l,(c,f)=>{if(c.isText)return;const d={...c.attrs};delete d.dir,t.setNodeMarkup(f,void 0,d)}),!0},zP=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=l1(typeof e=="string"?e:e.name,r.schema);if(!c)return!1;c==="node"&&(s=Yo(e,r.schema)),c==="mark"&&(l=Fu(e,r.schema));let f=!1;return n.selection.ranges.forEach(d=>{const p=d.$from.pos,g=d.$to.pos;let b,y,M,E;n.selection.empty?r.doc.nodesBetween(p,g,(D,L)=>{s&&s===D.type&&(f=!0,M=Math.max(L,p),E=Math.min(L+D.nodeSize,g),b=L,y=D)}):r.doc.nodesBetween(p,g,(D,L)=>{L<p&&s&&s===D.type&&(f=!0,M=Math.max(L,p),E=Math.min(L+D.nodeSize,g),b=L,y=D),L>=p&&L<=g&&(s&&s===D.type&&(f=!0,i&&n.setNodeMarkup(L,void 0,{...D.attrs,...t})),l&&D.marks.length&&D.marks.forEach(q=>{if(l===q.type&&(f=!0,i)){const $=Math.max(L,p),Y=Math.min(L+D.nodeSize,g);n.addMark($,Y,l.create({...q.attrs,...t}))}}))}),y&&(b!==void 0&&i&&n.setNodeMarkup(b,void 0,{...y.attrs,...t}),l&&y.marks.length&&y.marks.forEach(D=>{l===D.type&&i&&n.addMark(M,E,l.create({...D.attrs,...t}))}))}),f},eh=new Vo("__tiptap_decorations__"),BP=e=>({tr:t,dispatch:n})=>(n&&t.setMeta(eh,{type:"force",name:e}),!0),FP=(e,t={})=>({state:n,dispatch:r})=>{const i=Yo(e,n.schema);return dR(i,t)(n,r)},UP=(e,t={})=>({state:n,dispatch:r})=>{const i=Yo(e,n.schema);return hR(i,t)(n,r)};var HP=iL({blur:()=>u7,clearContent:()=>f7,clearNodes:()=>d7,command:()=>h7,createParagraphNear:()=>p7,cut:()=>m7,deleteCurrentNode:()=>g7,deleteNode:()=>y7,deleteRange:()=>b7,deleteSelection:()=>w7,enter:()=>S7,exitCode:()=>k7,extendMarkRange:()=>A7,first:()=>M7,focus:()=>E7,forEach:()=>T7,insertContent:()=>N7,insertContentAt:()=>_7,insertDefaultBlock:()=>D7,joinBackward:()=>O7,joinDown:()=>R7,joinForward:()=>P7,joinItemBackward:()=>j7,joinItemForward:()=>I7,joinTextblockBackward:()=>z7,joinTextblockForward:()=>B7,joinUp:()=>L7,keyboardShortcut:()=>U7,lift:()=>H7,liftEmptyBlock:()=>q7,liftListItem:()=>$7,newlineInCode:()=>Y7,resetAttributes:()=>V7,scrollIntoView:()=>W7,selectAll:()=>X7,selectNodeBackward:()=>G7,selectNodeForward:()=>K7,selectParentNode:()=>J7,selectTextblockEnd:()=>Z7,selectTextblockStart:()=>Q7,setContent:()=>tP,setMark:()=>vP,setMeta:()=>wP,setNode:()=>SP,setNodeSelection:()=>kP,setTextDirection:()=>AP,setTextSelection:()=>MP,sinkListItem:()=>CP,splitBlock:()=>EP,splitListItem:()=>TP,toggleList:()=>_P,toggleMark:()=>DP,toggleNode:()=>LP,toggleWrap:()=>RP,undoInputRule:()=>OP,unsetAllMarks:()=>PP,unsetMark:()=>jP,unsetTextDirection:()=>IP,updateAttributes:()=>zP,updateDecorations:()=>BP,wrapIn:()=>FP,wrapInList:()=>UP});const sp=new WeakMap;function qP(e,t){var n;sp.set(e,((n=sp.get(e))!==null&&n!==void 0?n:0)+1);try{return t()}finally{var r;const i=((r=sp.get(e))!==null&&r!==void 0?r:1)-1;i>0?sp.set(e,i):sp.delete(e)}}var $P=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(r=>r.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(r=>r!==t):delete this.callbacks[e]),this}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}};function YP(e){return e.kind==="widget"}function $C(e,t){const n=[],r=new Set;for(const i of e)i.kind==="widget"&&YP(i)&&r.add(i.key),n.push(i.toPMDecoration(t));return{decorations:n,widgetKeys:r}}function VP(e,t,n){const{decorations:r,widgetKeys:i}=$C(t,n);return{set:di.create(e,r),widgetKeys:i}}function YC({position:e,from:t,to:n,docSize:r}){return e<t?!1:e<n?!0:e===n&&n===r}function WP({decorations:e,from:t,to:n,docSize:r,extensionName:i,warnedExtensions:s}){return e.filter(l=>YC({position:l.anchor,from:t,to:n,docSize:r})?!0:(l.anchor===n||s.has(i)||(s.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)),!1))}function XP(e){var t;const n=(t=e.spec)===null||t===void 0?void 0:t.key;return typeof n=="string"?n:void 0}function VC(e){return e.jsonID==="attr"}function GP(e){let t=!1;if(e.getMap().forEach(()=>{t=!0}),t||VC(e))return!0;const n=e;return typeof n.from=="number"&&typeof n.to=="number"}function KP(e,t){let n=null,r=0,i=0;for(let s=0;s<e.childCount&&!(i>t.to);s+=1){const l=i+e.child(s).nodeSize;l>=t.from&&(n===null&&(n=i),r=l),i=l}return n===null?null:{from:n,to:r}}function JP(e,t){if(e.steps.some(s=>!GP(s)))return{type:"full"};const n=Tb(e).map(({newRange:s})=>s);e.steps.forEach((s,l)=>{if(!VC(s))return;const c=e.mapping.slice(l);n.push({from:c.map(s.pos,-1),to:c.map(s.pos+1)})});const r=[];for(const s of n){const l=KP(t,s);l&&r.push(l)}r.sort((s,l)=>s.from-l.from);const i=[];for(const s of r){const l=i[i.length-1];l&&s.from<=l.to?l.to=Math.max(l.to,s.to):i.push({...s})}return{type:"ranges",ranges:i}}function WC(e,t,n,r){return e.map(t,n,{onRemove:i=>{const s=i?.key;typeof s=="string"&&r.delete(s)}})}function ZP(e,t,n){var r,i;const s=(r=t.decorationSetsByExtension[e])!==null&&r!==void 0?r:di.empty,l=new Set((i=t.widgetKeysByExtension[e])!==null&&i!==void 0?i:[]);return{set:WC(s,n.mapping,n.doc,l),widgetKeys:l}}function nk(e,t){const n=Object.values(t).flatMap(r=>r.find());return di.create(e,n)}function rk(e){const t=new Set;for(const n of Object.values(e))for(const r of n)t.add(r);return t}function QP(e,t){var n;switch((n=t.update)!==null&&n!==void 0?n:"document"){case"document":if(t.createInRange)throw new Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!t.createInRange)throw new Error(`[tiptap error]: Extension "${e}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(t.createInRange)throw new Error(`[tiptap error]: Extension "${e}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(t.shouldUpdate)throw new Error(`[tiptap error]: Extension "${e}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function tj(e,t,n){return n?!0:e.update==="manual"?!1:e.shouldUpdate?e.shouldUpdate(t):t.tr.docChanged}const ej=new Set;var nj=class{constructor(e){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:t})=>{const n=eh.getState(t);n&&this.warnDuplicateWidgetKeys(n)},this.editor=e.editor,this.entries=this.resolveEntries(e.entries),this.entries.forEach(({name:t,spec:n})=>QP(t,n)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var e,t;return(e=(t=eh.getState(this.editor.state))===null||t===void 0?void 0:t.widgetKeys)!==null&&e!==void 0?e:ej}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(e){const t=[];for(const{name:n,addDecorations:r}of e){const i=r();i&&t.push({name:n,spec:i})}return t}createPlugin(){const{editor:e,entries:t}=this;return new Zi({key:eh,state:{init:(n,r)=>{const i={},s={};for(const{name:c,spec:f}of t){const{set:d,widgetKeys:p}=this.buildFullSet(c,f,r);i[c]=d,s[c]=p}const l={decorationSetsByExtension:i,widgetKeysByExtension:s,mergedDecorationSet:this.buildMergedSet(r.doc,i),widgetKeys:rk(s)};return this.warnDuplicateWidgetKeys(l),l},apply:(n,r,i,s)=>{const l=n.getMeta(eh),c=l?.type==="force"&&!l.name,f=l?.type==="force"?l.name:void 0,d={},p={},g=new Set;return qP(e,()=>{for(const{name:b,spec:y}of t){const M=c||f===b;if(tj(y,{editor:e,tr:n,oldState:i,newState:s},M))if(y.update==="changedRanges"&&n.docChanged&&!M){const E=this.applyChangedRangesRecompute(b,y,r,n,s);d[b]=E.set,p[b]=E.widgetKeys,g.add(b)}else{const{set:E,widgetKeys:D}=this.buildFullSet(b,y,s);d[b]=E,p[b]=D,g.add(b)}else{const E=ZP(b,r,n);d[b]=E.set,p[b]=E.widgetKeys}}}),g.size===0&&!n.docChanged?r:{decorationSetsByExtension:d,widgetKeysByExtension:p,mergedDecorationSet:this.mergeAfterApply({entries:t,previous:r,tr:n,decorationSetsByExtension:d,recomputedNames:g}),widgetKeys:rk(p)}}},props:{decorations(n){var r,i;return(r=(i=eh.getState(n))===null||i===void 0?void 0:i.mergedDecorationSet)!==null&&r!==void 0?r:di.empty}}})}applyChangedRangesRecompute(e,t,n,r,i){const s=JP(r,i.doc);return s.type==="full"?this.buildFullSet(e,t,i):this.rebuildRanges(e,t,n,r,i,s.ranges)}rebuildRanges(e,t,n,r,i,s){var l,c;const f=(l=n.decorationSetsByExtension[e])!==null&&l!==void 0?l:di.empty,d=new Set((c=n.widgetKeysByExtension[e])!==null&&c!==void 0?c:[]);let p=WC(f,r.mapping,r.doc,d);const g=i.doc.content.size;for(const{from:b,to:y}of s){const M=p.find(b,y).filter(L=>YC({position:L.from,from:b,to:y,docSize:g}));for(const L of M){const q=XP(L);q&&d.delete(q)}p=p.remove(M);const{decorations:E,widgetKeys:D}=$C(WP({decorations:this.runCreate(e,"createInRange",()=>t.createInRange({editor:this.editor,state:i,view:this.mountedView,from:b,to:y})),from:b,to:y,docSize:g,extensionName:e,warnedExtensions:this.warnedOutOfRangeExtensions}),e);p=p.add(i.doc,E);for(const L of D)d.add(L)}return{set:p,widgetKeys:d}}buildFullSet(e,t,n){const r=this.runCreate(e,"create",()=>t.create({editor:this.editor,state:n,view:this.mountedView}));return VP(n.doc,r,e)}runCreate(e,t,n){try{return n()}catch(r){return console.error(`[tiptap error]: Extension "${e}" threw in \`addDecorations().${t}()\`. Its decorations were dropped for this update.`,r),[]}}warnDuplicateWidgetKeys(e){}buildMergedSet(e,t){const n=Object.keys(t);return n.length===1?t[n[0]]:nk(e,t)}mergeAfterApply({entries:e,previous:t,tr:n,decorationSetsByExtension:r,recomputedNames:i}){return e.length===1?r[e[0].name]:i.size===0?t.mergedDecorationSet.map(n.mapping,n.doc):nk(n.doc,r)}};function rj(e,t){const{selection:n}=e,{$from:r}=n;if(n instanceof Nn){const s=r.index();return r.parent.canReplaceWith(s,s+1,t)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(t))return!0;i-=1}return!1}function ij(e,t,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return t&&i.setAttribute("nonce",t),i.setAttribute("data-tiptap-style",""),i.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(i),i}function oj(e){return typeof e=="number"}function sj(e){return Object.prototype.toString.call(e).slice(8,-1)}function hg(e){return sj(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function ik(e,t,n){const r=e.split(`
107
+ `),i=[];let s="",l=0;const c=t.baseIndentSize||2;for(;l<r.length;){const p=r[l],g=p.match(t.itemPattern);if(!g){if(i.length>0)break;if(p.trim()===""){l+=1,s=`${s}${p}
108
+ `;continue}else return}const b=t.extractItemData(g),{indentLevel:y,mainContent:M}=b;s=`${s}${p}
109
+ `;const E=[M];for(l+=1;l<r.length;){var f;const $=r[l];if($.trim()===""){var d;const Y=r.slice(l+1).findIndex(ht=>ht.trim()!=="");if(Y===-1)break;if((((d=r[l+1+Y].match(/^(\s*)/))===null||d===void 0||(d=d[1])===null||d===void 0?void 0:d.length)||0)>y){E.push($),s=`${s}${$}
110
+ `,l+=1;continue}else break}if((((f=$.match(/^(\s*)/))===null||f===void 0||(f=f[1])===null||f===void 0?void 0:f.length)||0)>y)E.push($),s=`${s}${$}
111
+ `,l+=1;else break}let D;const L=E.slice(1);if(L.length>0){const $=L.map(Y=>Y.slice(y+c)).join(`
112
+ `);$.trim()&&(t.customNestedParser?D=t.customNestedParser($):D=n.blockTokens($))}const q=t.createToken(b,D);i.push(q)}if(i.length!==0)return{items:i,raw:s}}function XC(e,t,n,r,i){if(!e||!Array.isArray(e.content))return"";const s=typeof n=="function"?n(r):n,[l,...c]=e.content;let f=`${s}${t.renderChildren([l])}`;return c&&c.length>0&&c.forEach((d,p)=>{var g,b;const y=(g=(b=t.renderChild)===null||b===void 0?void 0:b.call(t,d,p+1))!==null&&g!==void 0?g:t.renderChildren([d]);if(y!=null){const M=D=>t.indent(D),E=y.split(`
113
+ `).map(D=>M(D||"")).join(`
114
+ `);f+=d.type==="paragraph"?`
115
+
116
+ ${E}`:`
117
+ ${E}`}}),f}function GC(e,t){const n={...e};return hg(e)&&hg(t)&&Object.keys(t).forEach(r=>{hg(t[r])&&hg(e[r])?n[r]=GC(e[r],t[r]):n[r]=t[r]}),n}function aj(e,t,n={}){const{state:r}=t,{doc:i,tr:s}=r,l=e;i.descendants((c,f)=>{const d=s.mapping.map(f),p=s.mapping.map(f)+c.nodeSize;let g=null;if(c.marks.forEach(y=>{if(y!==l)return!1;g=y}),!g)return;let b=!1;if(Object.keys(n).forEach(y=>{n[y]!==g.attrs[y]&&(b=!0)}),b){const y=e.type.create({...e.attrs,...n});s.removeMark(d,p,e.type),s.addMark(d,p,y)}}),s.docChanged&&t.view.dispatch(s)}var f1=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=(t=e.undoable)!==null&&t!==void 0?t:!0}};const lj=(e,t)=>{if(Ab(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function pg(e){var t;const{editor:n,from:r,to:i,text:s,rules:l,plugin:c}=e,{view:f}=n;if(f.composing)return!1;const d=f.state.doc.resolve(r);if(d.parent.type.spec.code||!((t=d.nodeBefore||d.nodeAfter)===null||t===void 0)&&t.marks.find(b=>b.type.spec.code))return!1;let p=!1;const g=hP(d)+s;return l.forEach(b=>{if(p)return;const y=lj(g,b.find);if(!y)return;const M=y[0].length-s.length;if(M>0){const ht=d.parentOffset-M;if(ht<0||d.parent.textBetween(ht,d.parentOffset)!==y[0].slice(0,M))return}const E=f.state.tr,D=a1({state:f.state,transaction:E}),L={from:r-(y[0].length-s.length),to:i},{commands:q,chain:$,can:Y}=new fh({editor:n,state:D});b.handler({state:D,range:L,match:y,commands:q,chain:$,can:Y})===null||!E.steps.length||(b.undoable&&E.setMeta(c,{transform:E,from:r,to:i,text:s}),f.dispatch(E),p=!0)}),p}function cj(e){const{editor:t,rules:n}=e,r=new Zi({state:{init(){return null},apply(i,s,l){const c=i.getMeta(r);if(c)return c;const f=i.getMeta("applyInputRules");return f&&setTimeout(()=>{let{text:d}=f;typeof d=="string"?d=d:d=Eb(ke.from(d),l.schema);const{from:p}=f,g=p+d.length;pg({editor:t,from:p,to:g,text:d,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,l,c){return pg({editor:t,from:s,to:l,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&pg({editor:t,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:l}=i.state.selection;return l?pg({editor:t,from:l.pos,to:l.pos,text:`
118
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var _b=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...Zr(mn(this,"addOptions",{name:this.name}))}}get storage(){return{...Zr(mn(this,"addStorage",{name:this.name,options:this.options}))}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>GC(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Of=class KC extends _b{constructor(...t){super(...t),this.type="mark"}static create(t={}){const n=typeof t=="function"?t():t;return new KC(n)}static handleExit({editor:t,mark:n}){const{tr:r}=t.state,i=t.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!s.find(c=>c?.type.name===n.name))return!1;const l=s.find(c=>c?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),t.view.dispatch(r),!0}return!1}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}},uj=class{constructor(e){this.find=e.find,this.handler=e.handler}};const fj=(e,t,n)=>{if(Ab(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=e,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function dj(e){const{editor:t,state:n,from:r,to:i,rule:s,pasteEvent:l,dropEvent:c}=e,{commands:f,chain:d,can:p}=new fh({editor:t,state:n}),g=[];return n.doc.nodesBetween(r,i,(b,y)=>{var M,E,D,L;if(!((M=b.type)===null||M===void 0||(M=M.spec)===null||M===void 0)&&M.code||!(b.isText||b.isTextblock||b.isInline))return;const q=(E=(D=(L=b.content)===null||L===void 0?void 0:L.size)!==null&&D!==void 0?D:b.nodeSize)!==null&&E!==void 0?E:0,$=Math.max(r,y),Y=Math.min(i,y+q);if($>=Y)return;const ht=b.isText?b.text||"":b.textBetween($-y,Y-y,void 0,"");fj(ht,s.find,l).forEach(Mt=>{if(Mt.index===void 0)return;const vt=$+Mt.index+1,bt=vt+Mt[0].length,rt={from:n.tr.mapping.map(vt),to:n.tr.mapping.map(bt)},Dt=s.handler({state:n,range:rt,match:Mt,commands:f,chain:d,can:p,pasteEvent:l,dropEvent:c});g.push(Dt)})}),g.every(b=>b!==null)}let mg=null;const hj=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)===null||t===void 0||t.setData("text/html",e),n};function pj(e){const{editor:t,rules:n}=e;let r=null,i=!1,s=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const f=({state:d,from:p,to:g,rule:b,pasteEvt:y})=>{const M=d.tr,E=a1({state:d,transaction:M});if(!(!dj({editor:t,state:E,from:Math.max(p-1,0),to:g.b-1,rule:b,pasteEvent:y,dropEvent:c})||!M.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,M}};return n.map(d=>new Zi({view(p){const g=y=>{var M;r=!((M=p.dom.parentElement)===null||M===void 0)&&M.contains(y.target)?p.dom.parentElement:null,r&&(mg=t)},b=()=>{mg&&(mg=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(p,g)=>{if(s=r===p.dom.parentElement,c=g,!s){const b=mg;b?.isEditable&&setTimeout(()=>{const y=b.state.selection;y&&b.commands.deleteRange({from:y.from,to:y.to})},10)}return!1},paste:(p,g)=>{var b;const y=(b=g.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return l=g,i=!!y?.includes("data-pm-slice"),!1}}},appendTransaction:(p,g,b)=>{const y=p[0],M=y.getMeta("uiEvent")==="paste"&&!i,E=y.getMeta("uiEvent")==="drop"&&!s,D=y.getMeta("applyPasteRules"),L=!!D;if(!M&&!E&&!L)return;if(L){let{text:Y}=D;typeof Y=="string"?Y=Y:Y=Eb(ke.from(Y),b.schema);const{from:ht}=D,Mt=ht+Y.length,vt=hj(Y);return f({rule:d,state:b,from:ht,to:{b:Mt},pasteEvt:vt})}const q=g.doc.content.findDiffStart(b.doc.content),$=g.doc.content.findDiffEnd(b.doc.content);if(!(!oj(q)||!$||q===$.b))return f({rule:d,state:b,from:q,to:$,pasteEvt:l})}}))}var d1=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=t,this.baseExtensions=e,this.extensions=jC(e),this.schema=sP(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n=mn(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Wd(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){const{editor:e}=this,t=_p([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Wd(r.name,this.schema)},s=[],l=mn(r,"addKeyboardShortcuts",i);let c={};if(r.type==="mark"&&mn(r,"exitable",i)&&(c.ArrowRight=()=>Of.handleExit({editor:e,mark:r})),l){const b=Object.fromEntries(Object.entries(l()).map(([y,M])=>[y,()=>M({editor:e})]));c={...c,...b}}const f=c7(c);s.push(f);const d=mn(r,"addInputRules",i);if(Q3(r,e.options.enableInputRules)&&d){const b=d();if(b&&b.length){const y=cj({editor:e,rules:b}),M=Array.isArray(y)?y:[y];s.push(...M)}}const p=mn(r,"addPasteRules",i);if(Q3(r,e.options.enablePasteRules)&&p){const b=p();if(b&&b.length){const y=pj({editor:e,rules:b});s.push(...y)}}const g=mn(r,"addProseMirrorPlugins",i);if(g){const b=g();s.push(...b)}return s}),n=this.createDecorationPlugin();return n&&t.push(n),t}createDecorationPlugin(){var e;const{editor:t}=this;(e=this.decorationManager)===null||e===void 0||e.destroy();const n=[];return this.extensions.forEach(r=>{const i=mn(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Wd(r.name,this.schema)});i&&n.push({name:r.name,addDecorations:i})}),this.decorationManager=new nj({editor:t,entries:n}),this.decorationManager.plugin}get attributes(){return PC(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=wh(this.extensions);return Object.fromEntries(t.filter(n=>!!mn(n,"addNodeView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),i=mn(n,"addNodeView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Yo(n.name,this.schema)});if(!i)return[];const s=i();if(!s)return[];const l=(c,f,d,p,g)=>{const b=Gp(c,r);return s({node:c,view:f,getPos:d,decorations:p,innerDecorations:g,editor:e,extension:n,HTMLAttributes:b})};return[n.name,l]}))}dispatchTransaction(e){const{editor:t}=this;return _p([...this.extensions].reverse()).reduceRight((n,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Wd(r.name,this.schema)},s=mn(r,"dispatchTransaction",i);return s?l=>{s.call(i,{transaction:l,next:n})}:n},e)}transformPastedHTML(e){const{editor:t}=this;return _p([...this.extensions]).reduce((n,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Wd(r.name,this.schema)},s=mn(r,"transformPastedHTML",i);return s?(l,c)=>{const f=n(l,c);return s.call(i,f)}:n},e||(n=>n))}get markViews(){const{editor:e}=this,{markExtensions:t}=wh(this.extensions);return Object.fromEntries(t.filter(n=>!!mn(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i=mn(n,"addMarkView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Fu(n.name,this.schema)});if(!i)return[];const s=(l,c,f)=>{const d=Gp(l,r);return i()({mark:l,view:c,inline:f,editor:e,extension:n,HTMLAttributes:d,updateAttributes:p=>{aj(l,e,p)}})};return[n.name,s]}))}destroy(){var e;(e=this.decorationManager)===null||e===void 0||e.destroy(),this.extensions.forEach(t=>{let n=t;for(;n.parent;){const r=n.parent;r.child===n&&(r.child=null),n=r}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(t=>[t.name,t.storage])),e.forEach(t=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Wd(t.name,this.schema)};if(t.type==="mark"){var r,i;(!((r=Zr(mn(t,"keepOnSplit",n)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(t.name),!((i=Zr(mn(t,"clearable",n)))!==null&&i!==void 0)||i||this.nonClearableMarks.push(t.name)}const s=mn(t,"onBeforeCreate",n),l=mn(t,"onCreate",n),c=mn(t,"onUpdate",n),f=mn(t,"onSelectionUpdate",n),d=mn(t,"onTransaction",n),p=mn(t,"onFocus",n),g=mn(t,"onBlur",n),b=mn(t,"onDestroy",n);s&&this.editor.on("beforeCreate",s),l&&this.editor.on("create",l),c&&this.editor.on("update",c),f&&this.editor.on("selectionUpdate",f),d&&this.editor.on("transaction",d),p&&this.editor.on("focus",p),g&&this.editor.on("blur",g),b&&this.editor.on("destroy",b)})}};d1.resolve=jC;d1.sort=_p;d1.flatten=Cb;var xi=class JC extends _b{constructor(...t){super(...t),this.type="extension"}static create(t={}){const n=typeof t=="function"?t():t;return new JC(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}};const mj=xi.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Zi({key:new Vo("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,s=zC(n),{blockSeparator:l}=this.options,c={...l!==void 0?{blockSeparator:l}:{},textSerializers:s};return[...i.ranges].sort((f,d)=>f.$from.pos-d.$from.pos).map(({$from:f,$to:d})=>IC(r,{from:f.pos,to:d.pos},c)).join(l??`
119
+
120
+ `)}}})]}}),gj=xi.create({name:"commands",addCommands(){return{...HP}}}),yj=xi.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r;const i=()=>{var s,l,c;if((s=(l=this.editor.options.coreExtensionOptions)===null||l===void 0||(l=l.delete)===null||l===void 0||(c=l.filterTransaction)===null||c===void 0?void 0:c.call(l,e))!==null&&s!==void 0?s:e.getMeta("y-sync$"))return;const f=RC(e.before,[e,...t]);Tb(f).forEach(p=>{f.mapping.mapResult(p.oldRange.from).deletedAfter&&f.mapping.mapResult(p.oldRange.to).deletedBefore&&f.before.nodesBetween(p.oldRange.from,p.oldRange.to,(g,b)=>{const y=b+g.nodeSize-2,M=p.oldRange.from<=b&&y<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:g,from:b,to:y,newFrom:f.mapping.map(b),newTo:f.mapping.map(y),deletedRange:p.oldRange,newRange:p.newRange,partial:!M,editor:this.editor,transaction:e,combinedTransform:f})})});const d=f.mapping;f.steps.forEach((p,g)=>{if(p instanceof vc){var b,y;const M=d.slice(g).map(p.from,-1),E=d.slice(g).map(p.to),D=d.invert().map(M,-1),L=d.invert().map(E),q=M>0?(b=f.doc.nodeAt(M-1))===null||b===void 0?void 0:b.marks.some(Y=>Y.eq(p.mark)):!1,$=(y=f.doc.nodeAt(E))===null||y===void 0?void 0:y.marks.some(Y=>Y.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:D,to:L},newRange:{from:M,to:E},partial:!!($||q),editor:this.editor,transaction:e,combinedTransform:f})}})};!((n=(r=this.editor.options.coreExtensionOptions)===null||r===void 0||(r=r.delete)===null||r===void 0?void 0:r.async)!==null&&n!==void 0)||n?setTimeout(i,0):i()}}),bj=xi.create({name:"drop",addProseMirrorPlugins(){return[new Zi({key:new Vo("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),xj=xi.create({name:"editable",addProseMirrorPlugins(){return[new Zi({key:new Vo("editable"),props:{editable:()=>this.editor.options.editable}})]}}),vj=new Vo("focusEvents"),wj=xi.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new Zi({key:vj,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),Sj=xi.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:c})=>{const{selection:f,doc:d}=c,{empty:p,$anchor:g}=f,{pos:b,parent:y}=g,M=g.parent.isTextblock&&b>0?c.doc.resolve(b-1):g,E=M.parent.type.spec.isolating,D=g.pos-g.parentOffset,L=E&&M.parent.childCount===1?D===g.pos:rr.atStart(d).from===b;return!p||!y.type.isTextblock||y.textContent.length||!L||L&&g.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return g0()||DC()?s:i},addProseMirrorPlugins(){return[new Zi({key:new Vo("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(y=>y.getMeta("composition")))return;const r=e.some(y=>y.docChanged)&&!t.doc.eq(n.doc),i=e.some(y=>y.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:l,to:c}=t.selection,f=rr.atStart(t.doc).from,d=rr.atEnd(t.doc).to;if(s||!(l===f&&c===d)||!u1(n.doc))return;const p=n.tr,g=a1({state:n,transaction:p}),{commands:b}=new fh({editor:this.editor,state:g});if(b.clearNodes(),!!p.steps.length)return p}})]}}),kj=xi.create({name:"paste",addProseMirrorPlugins(){return[new Zi({key:new Vo("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),Aj=xi.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Zi({key:new Vo("tabindex"),props:{attributes:()=>{var e;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(e=this.options.value)!==null&&e!==void 0?e:"0"}}}})]}}),Mj=xi.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=wh(this.extensions);return[{types:e.filter(t=>t.name!=="text").map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{const n=t.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return[new Zi({key:new Vo("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}});let ok=!1;function Cj(e){if(ok)return;ok=!0;let t;try{t=Eo.fromJSON(e,{from:0,to:0}).slice.content}catch{return}t instanceof ke||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}var Ej=class vp{get name(){return this.node.type.name}constructor(t,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return(t=this.actualDepth)!==null&&t!==void 0?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},t)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new vp(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new vp(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new vp(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,l=n.isInline,c=this.pos+r+(s?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const f=this.resolvedPos.doc.resolve(c);if(!i&&!l&&f.depth<=this.depth)return;const d=new vp(f,this.editor,i,i||l?n:null);i&&(d.actualDepth=this.depth+1),t.push(d)}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===t)if(Object.keys(n).length>0){const s=i.node.attrs,l=Object.keys(n);for(let c=0;c<l.length;c+=1){const f=l[c];if(s[f]!==n[f])break}}else r=i;i=i.parent}return r}querySelector(t,n={}){return this.querySelectorAll(t,n,!0)[0]||null}querySelectorAll(t,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(l=>{r&&i.length>0||(l.node.type.name===t&&s.every(c=>n[c]===l.node.attrs[c])&&i.push(l),!(r&&i.length>0)&&(i=i.concat(l.querySelectorAll(t,n,r))))}),i}setAttribute(t){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}};const Tj=`.ProseMirror {
121
+ position: relative;
122
+ }
123
+
124
+ .ProseMirror {
125
+ word-wrap: break-word;
126
+ white-space: pre-wrap;
127
+ white-space: break-spaces;
128
+ -webkit-font-variant-ligatures: none;
129
+ font-variant-ligatures: none;
130
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
131
+ }
132
+
133
+ .ProseMirror [contenteditable="false"] {
134
+ white-space: normal;
135
+ }
136
+
137
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
138
+ white-space: pre-wrap;
139
+ }
140
+
141
+ .ProseMirror pre {
142
+ white-space: pre-wrap;
143
+ }
144
+
145
+ img.ProseMirror-separator {
146
+ display: inline !important;
147
+ border: none !important;
148
+ margin: 0 !important;
149
+ width: 0 !important;
150
+ height: 0 !important;
151
+ }
152
+
153
+ .ProseMirror-gapcursor {
154
+ display: none;
155
+ pointer-events: none;
156
+ position: absolute;
157
+ margin: 0;
158
+ }
159
+
160
+ .ProseMirror-gapcursor:after {
161
+ content: "";
162
+ display: block;
163
+ position: absolute;
164
+ top: -2px;
165
+ width: 20px;
166
+ border-top: 1px solid black;
167
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
168
+ }
169
+
170
+ @keyframes ProseMirror-cursor-blink {
171
+ to {
172
+ visibility: hidden;
173
+ }
174
+ }
175
+
176
+ .ProseMirror-hideselection *::selection {
177
+ background: transparent;
178
+ }
179
+
180
+ .ProseMirror-hideselection *::-moz-selection {
181
+ background: transparent;
182
+ }
183
+
184
+ .ProseMirror-hideselection * {
185
+ caret-color: transparent;
186
+ }
187
+
188
+ .ProseMirror-focused .ProseMirror-gapcursor {
189
+ display: block;
190
+ }`;var Nj=class extends $P{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:yP,createMappablePosition:bP},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),this.on("delete",this.options.onDelete);const t=this.createDoc();if(!this.editorState){const n=E5(t,this.options.autofocus);this.editorState=nd.create({doc:t,schema:this.schema,selection:n||void 0})}Cj(this.schema),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;const e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():fh.createFakeChain()}can(){return this.commandManager?this.commandManager.can():fh.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=ij(Tj,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const n=OC(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;n=n.filter(l=>!l.key.startsWith(s))}),t.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;const n=[...this.options.enableCoreExtensions?[xj,mj.configure({blockSeparator:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.clipboardTextSerializer)===null||e===void 0?void 0:e.blockSeparator}),gj,wj,Sj,Aj.configure({value:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.tabindex)===null||t===void 0?void 0:t.value}),bj,kj,yj,Mj.configure({direction:this.options.textDirection})].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new d1(n,this)}createCommandManager(){this.commandManager=new fh({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=T5(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;const n=T5(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=nd.create({doc:n,schema:this.schema,selection:E5(n,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,s=t.transformPastedHTML,l=this.extensionManager.transformPastedHTML(s);this.editorView=new wC(e,{...t,attributes:{role:"textbox",...t?.attributes},dispatchTransaction:i,transformPastedHTML:l,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const f=this.view.dom;f.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(d=>{var p;return(p=this.capturedTransaction)===null||p===void 0?void 0:p.step(d)});return}const{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=n.findLast(d=>d.getMeta("focus")||d.getMeta("blur")),c=l?.getMeta("focus"),f=l?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:l}),f&&this.emit("blur",{editor:this,event:f.event,transaction:l}),!(e.getMeta("preventUpdate")||!n.some(d=>d.docChanged)||s.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return BC(this.state,e)}isActive(e,t){const n=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return pP(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Eb(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
191
+
192
+ `,textSerializers:n={}}=e||{};return lP(this.state.doc,{blockSeparator:t,textSerializers:{...zC(this.schema),...n}})}get isEmpty(){return u1(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,t;return(e=(t=this.editorView)===null||t===void 0?void 0:t.isDestroyed)!==null&&e!==void 0?e:!0}$node(e,t){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new Ej(t,this,!1,n)}get $doc(){return this.$pos(0)}};function Sh(e){return new f1({find:e.find,handler:({state:t,range:n,match:r})=>{const i=Zr(e.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=t,l=r[r.length-1],c=r[0];if(l){const f=c.search(/\S/),d=n.from+c.indexOf(l),p=d+l.length;if(Nb(n.from,n.to,t.doc).filter(b=>b.mark.type.excluded.find(y=>y===e.type&&y!==b.mark.type)).filter(b=>b.to>d).length)return null;p<n.to&&s.delete(p,n.to),d>n.from&&s.delete(n.from+f,d);const g=n.from+f+l.length;s.addMark(n.from+f,g,e.type.create(i||{})),s.removeStoredMark(e.type)}},undoable:e.undoable})}function _j(e){return new f1({find:e.find,handler:({state:t,range:n,match:r})=>{const i=Zr(e.getAttributes,void 0,r)||{},{tr:s}=t,l=n.from;let c=n.to;const f=e.type.create(i);if(r[1]){let d=l+r[0].lastIndexOf(r[1]);d>c?d=c:c=d+r[1].length;const p=r[0][r[0].length-1];s.insertText(p,l+r[0].length-1),s.replaceWith(d,c,f)}else if(r[0]){const d=e.type.isInline?l:l-1;s.insert(d,e.type.create(i)).delete(s.mapping.map(l),s.mapping.map(c))}s.scrollIntoView()},undoable:e.undoable})}function _5(e){return new f1({find:e.find,handler:({state:t,range:n,match:r})=>{const i=t.doc.resolve(n.from),s=Zr(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,s)},undoable:e.undoable})}function kh(e){return new f1({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{const s=Zr(e.getAttributes,void 0,r)||{},l=t.tr.delete(n.from,n.to),c=l.doc.resolve(n.from).blockRange(),f=c&&cb(c,e.type,s);if(!f)return null;if(l.wrap(c,f),e.keepMarks&&e.editor){const{selection:p,storedMarks:g}=t,{splittableMarks:b}=e.editor.extensionManager,y=g||p.$to.parentOffset&&p.$from.marks();if(y){const M=y.filter(E=>b.includes(E.type.name));l.ensureMarks(M)}}if(e.keepAttributes){const p=e.type.name==="bulletList"||e.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(p,s).run()}const d=l.doc.resolve(n.from-1).nodeBefore;d&&d.type===e.type&&Lf(l.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,d))&&l.join(n.from-1)},undoable:e.undoable})}var yl=class ZC extends _b{constructor(...t){super(...t),this.type="node"}static create(t={}){const n=typeof t=="function"?t():t;return new ZC(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}};function Sd(e){return new uj({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{const s=Zr(e.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:l}=t,c=r[r.length-1],f=r[0];let d=n.to;if(c){const p=f.search(/\S/),g=n.from+f.indexOf(c),b=g+c.length;if(Nb(n.from,n.to,t.doc).filter(y=>y.mark.type.excluded.find(M=>M===e.type&&M!==y.mark.type)).filter(y=>y.to>g).length)return null;b<n.to&&l.delete(b,n.to),g>n.from&&l.delete(n.from+p,g),d=n.from+p+c.length,l.addMark(n.from+p,d,e.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||l.removeStoredMark(e.type)}}})}const{getOwnPropertyNames:Dj,getOwnPropertySymbols:Lj}=Object,{hasOwnProperty:Rj}=Object.prototype;function g2(e,t){return function(r,i,s){return e(r,i,s)&&t(r,i,s)}}function gg(e){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return e(n,r,i);const{cache:s}=i,l=s.get(n),c=s.get(r);if(l&&c)return l===r&&c===n;s.set(n,r),s.set(r,n);const f=e(n,r,i);return s.delete(n),s.delete(r),f}}function Oj(e){return e?.[Symbol.toStringTag]}function sk(e){return Dj(e).concat(Lj(e))}const Pj=Object.hasOwn||((e,t)=>Rj.call(e,t));function Ed(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const jj="__v",Ij="__o",zj="_owner",{getOwnPropertyDescriptor:ak,keys:lk}=Object;function Bj(e,t){return e.byteLength===t.byteLength&&y0(new Uint8Array(e),new Uint8Array(t))}function Fj(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Uj(e,t){return e.byteLength===t.byteLength&&y0(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Hj(e,t){return Ed(e.getTime(),t.getTime())}function qj(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function $j(e,t){return e===t}function ck(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const i=new Array(r),s=e.entries();let l,c,f=0;for(;(l=s.next())&&!l.done;){const d=t.entries();let p=!1,g=0;for(;(c=d.next())&&!c.done;){if(i[g]){g++;continue}const b=l.value,y=c.value;if(n.equals(b[0],y[0],f,g,e,t,n)&&n.equals(b[1],y[1],b[0],y[0],e,t,n)){p=i[g]=!0;break}g++}if(!p)return!1;f++}return!0}const Yj=Ed;function Vj(e,t,n){const r=lk(e);let i=r.length;if(lk(t).length!==i)return!1;for(;i-- >0;)if(!QC(e,t,n,r[i]))return!1;return!0}function ap(e,t,n){const r=sk(e);let i=r.length;if(sk(t).length!==i)return!1;let s,l,c;for(;i-- >0;)if(s=r[i],!QC(e,t,n,s)||(l=ak(e,s),c=ak(t,s),(l||c)&&(!l||!c||l.configurable!==c.configurable||l.enumerable!==c.enumerable||l.writable!==c.writable)))return!1;return!0}function Wj(e,t){return Ed(e.valueOf(),t.valueOf())}function Xj(e,t){return e.source===t.source&&e.flags===t.flags}function uk(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const i=new Array(r),s=e.values();let l,c;for(;(l=s.next())&&!l.done;){const f=t.values();let d=!1,p=0;for(;(c=f.next())&&!c.done;){if(!i[p]&&n.equals(l.value,c.value,l.value,c.value,e,t,n)){d=i[p]=!0;break}p++}if(!d)return!1}return!0}function y0(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Gj(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function QC(e,t,n,r){return(r===zj||r===Ij||r===jj)&&(e.$$typeof||t.$$typeof)?!0:Pj(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const Kj="[object ArrayBuffer]",Jj="[object Arguments]",Zj="[object Boolean]",Qj="[object DataView]",tI="[object Date]",eI="[object Error]",nI="[object Map]",rI="[object Number]",iI="[object Object]",oI="[object RegExp]",sI="[object Set]",aI="[object String]",lI={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},cI="[object URL]",uI=Object.prototype.toString;function fI({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:l,areNumbersEqual:c,areObjectsEqual:f,arePrimitiveWrappersEqual:d,areRegExpsEqual:p,areSetsEqual:g,areTypedArraysEqual:b,areUrlsEqual:y,unknownTagComparators:M}){return function(D,L,q){if(D===L)return!0;if(D==null||L==null)return!1;const $=typeof D;if($!==typeof L)return!1;if($!=="object")return $==="number"?c(D,L,q):$==="function"?s(D,L,q):!1;const Y=D.constructor;if(Y!==L.constructor)return!1;if(Y===Object)return f(D,L,q);if(Array.isArray(D))return t(D,L,q);if(Y===Date)return r(D,L,q);if(Y===RegExp)return p(D,L,q);if(Y===Map)return l(D,L,q);if(Y===Set)return g(D,L,q);const ht=uI.call(D);if(ht===tI)return r(D,L,q);if(ht===oI)return p(D,L,q);if(ht===nI)return l(D,L,q);if(ht===sI)return g(D,L,q);if(ht===iI)return typeof D.then!="function"&&typeof L.then!="function"&&f(D,L,q);if(ht===cI)return y(D,L,q);if(ht===eI)return i(D,L,q);if(ht===Jj)return f(D,L,q);if(lI[ht])return b(D,L,q);if(ht===Kj)return e(D,L,q);if(ht===Qj)return n(D,L,q);if(ht===Zj||ht===rI||ht===aI)return d(D,L,q);if(M){let Mt=M[ht];if(!Mt){const vt=Oj(D);vt&&(Mt=M[vt])}if(Mt)return Mt(D,L,q)}return!1}}function dI({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Bj,areArraysEqual:n?ap:Fj,areDataViewsEqual:Uj,areDatesEqual:Hj,areErrorsEqual:qj,areFunctionsEqual:$j,areMapsEqual:n?g2(ck,ap):ck,areNumbersEqual:Yj,areObjectsEqual:n?ap:Vj,arePrimitiveWrappersEqual:Wj,areRegExpsEqual:Xj,areSetsEqual:n?g2(uk,ap):uk,areTypedArraysEqual:n?g2(y0,ap):y0,areUrlsEqual:Gj,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const i=gg(r.areArraysEqual),s=gg(r.areMapsEqual),l=gg(r.areObjectsEqual),c=gg(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:l,areSetsEqual:c})}return r}function hI(e){return function(t,n,r,i,s,l,c){return e(t,n,c)}}function pI({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(c,f){const{cache:d=e?new WeakMap:void 0,meta:p}=n();return t(c,f,{cache:d,equals:r,meta:p,strict:i})};if(e)return function(c,f){return t(c,f,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const s={cache:void 0,equals:r,meta:void 0,strict:i};return function(c,f){return t(c,f,s)}}const mI=Pf();Pf({strict:!0});Pf({circular:!0});Pf({circular:!0,strict:!0});Pf({createInternalComparator:()=>Ed});Pf({strict:!0,createInternalComparator:()=>Ed});Pf({circular:!0,createInternalComparator:()=>Ed});Pf({circular:!0,createInternalComparator:()=>Ed,strict:!0});function Pf(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,s=dI(e),l=fI(s),c=n?n(l):hI(l);return pI({circular:t,comparator:l,createState:r,equals:c,strict:i})}var y2={exports:{}},b2={};var fk;function gI(){if(fk)return b2;fk=1;var e=Qp(),t=HA();function n(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,s=e.useRef,l=e.useEffect,c=e.useMemo,f=e.useDebugValue;return b2.useSyncExternalStoreWithSelector=function(d,p,g,b,y){var M=s(null);if(M.current===null){var E={hasValue:!1,value:null};M.current=E}else E=M.current;M=c(function(){function L(Mt){if(!q){if(q=!0,$=Mt,Mt=b(Mt),y!==void 0&&E.hasValue){var vt=E.value;if(y(vt,Mt))return Y=vt}return Y=Mt}if(vt=Y,r($,Mt))return vt;var bt=b(Mt);return y!==void 0&&y(vt,bt)?($=Mt,vt):($=Mt,Y=bt)}var q=!1,$,Y,ht=g===void 0?null:g;return[function(){return L(p())},ht===null?void 0:function(){return L(ht())}]},[p,g,b,y]);var D=i(d,M[0],M[1]);return l(function(){E.hasValue=!0,E.value=D},[D]),f(D),D},b2}var dk;function yI(){return dk||(dk=1,y2.exports=gI()),y2.exports}var bI=yI(),xI=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},vI=({contentComponent:e})=>{const t=qA.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return A.jsx(A.Fragment,{children:Object.values(t)})};function wI(){const e=new Set;let t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:nL.createPortal(r.reactElement,r.element,n)},e.forEach(i=>i())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(i=>i())}}}var SI=class extends eu.Component{constructor(e){var t;super(e),this.editorContentRef=eu.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((t=e.editor)!=null&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;const t=this.props.editor;if(t&&!t.isDestroyed&&((e=t.view.dom)!=null&&e.parentNode)){if(t.contentComponent)return;const n=this.editorContentRef.current;n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n}),t.contentComponent=wI(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;const t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!((e=t.view.dom)!=null&&e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:e,innerRef:t,...n}=this.props;return A.jsxs(A.Fragment,{children:[A.jsx("div",{ref:xI(t,this.editorContentRef),...n}),e?.contentComponent&&A.jsx(vI,{contentComponent:e.contentComponent})]})}},kI=I.forwardRef((e,t)=>{const n=eu.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return eu.createElement(SI,{key:n,innerRef:t,...e})}),t6=eu.memo(kI),AI=typeof window<"u"?I.useLayoutEffect:I.useEffect,MI=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const t=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",t),()=>{n.off("transaction",t)}}}};function CI(e){var t;const[n]=I.useState(()=>new MI(e.editor)),r=bI.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,(t=e.equalityFn)!=null?t:mI);return AI(()=>n.watch(e.editor),[e.editor,n]),I.useDebugValue(r),r}var EI=!1,D5=typeof window>"u",TI=D5||!!(typeof window<"u"&&window.next),NI=class e6{constructor(t){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=t,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(t){this.editor=t,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?D5||TI?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const t={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)==null?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)==null?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)==null?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)==null?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)==null?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)==null?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)==null?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)==null?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)==null?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)==null?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)==null?void 0:s.call(i,...r)},onDelete:(...r)=>{var i,s;return(s=(i=this.options.current).onDelete)==null?void 0:s.call(i,...r)}};return new Nj(t)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}static compareOptions(t,n){return Object.keys(t).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&t.extensions&&n.extensions?t.extensions.length!==n.extensions.length?!1:t.extensions.every((i,s)=>{var l;return i===((l=n.extensions)==null?void 0:l[s])}):t[r]===n[r])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e6.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(t){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=t;return}if(this.previousDeps.length===t.length&&this.previousDeps.every((r,i)=>r===t[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=t}scheduleDestroy(){const t=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===t){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===t&&this.setEditor(null))},1)}};function _I(e={},t=[]){const n=I.useRef(e);n.current=e;const[r]=I.useState(()=>new NI(n)),i=qA.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return I.useDebugValue(i),I.useEffect(r.onRender(t)),CI({editor:i,selector:({transactionNumber:s})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&s===0?0:s+1}),i}var n6=I.createContext({editor:null});n6.Consumer;var DI=I.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),LI=()=>I.useContext(DI);eu.forwardRef((e,t)=>{const{onDragStart:n}=LI(),r=e.as||"div";return A.jsx(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});eu.createContext({markViewContentRef:()=>{}});var Db=I.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Db.displayName="TiptapContext";var RI=()=>I.useContext(Db);function r6({editor:e,instance:t,children:n}){const r=e??t;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=I.useMemo(()=>({editor:r}),[r]),s=I.useMemo(()=>({editor:r}),[r]);return A.jsx(n6.Provider,{value:s,children:A.jsx(Db.Provider,{value:i,children:n})})}r6.displayName="Tiptap";function i6({...e}){const{editor:t}=RI();return A.jsx(t6,{editor:t,...e})}i6.displayName="Tiptap.Content";Object.assign(r6,{Content:i6});const o6=new WeakSet,s6=new WeakSet;function Xf(e){const t=e;return o6.add(t),t}function L5(e){return Array.isArray(e)&&o6.has(e)}function a6(e){return e.flatMap(t=>t==null?[]:Array.isArray(t)&&s6.has(t)&&!L5(t)?a6(t):[t])}function OI(e,t){if(e==="slot")return 0;if(e instanceof Function){const i=e(t);return Array.isArray(i)&&!L5(i)&&!s6.has(i)?Xf(i):i}const{children:n,...r}=t??{};if(e==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(n)){if(L5(n))return Xf([e,r,n]);if(n.length===0)return Xf([e,r]);const i=a6(n);return i.length===0?Xf([e,r]):Xf([e,r,...i])}return n!=null?Xf([e,r,n]):Xf([e,r])}const b0=(e,t)=>OI(e,t);var PI=/^\s*>\s$/,jI=yl.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return b0("blockquote",{...Do(this.options.HTMLAttributes,e),children:b0("slot",{})})},parseMarkdown:(e,t)=>t.createNode("blockquote",void 0,t.parseChildren(e.tokens||[])),renderMarkdown:(e,t)=>{if(!e.content)return"";const n=">",r=[];return e.content.forEach(i=>{const c=t.renderChildren([i]).split(`
193
+ `).map(f=>f.trim()===""?n:`${n} ${f}`);r.push(c.join(`
194
+ `))}),r.join(`
195
+ ${n}
196
+ `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[kh({find:PI,type:this.type})]}}),II=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,zI=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,BI=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,FI=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,UI=Of.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return b0("strong",{...Do(this.options.HTMLAttributes,e),children:b0("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Sh({find:II,type:this.type}),Sh({find:BI,type:this.type})]},addPasteRules(){return[Sd({find:zI,type:this.type}),Sd({find:FI,type:this.type})]}}),HI=/(^|[^`])`([^`]+)`(?!`)$/,qI=/(^|[^`])`([^`]+)`(?!`)/g,$I=Of.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",Do(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Sh({find:HI,type:this.type})]},addPasteRules(){return[Sd({find:qI,type:this.type})]}}),x2=4,YI=/^```([a-z]+)?[\s\n]$/,VI=/^~~~([a-z]+)?[\s\n]$/,WI=yl.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:x2,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options;if(!n)return null;const s=[...((t=e.firstElementChild)==null?void 0:t.classList)||[]].filter(l=>l.startsWith(n)).map(l=>l.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:e,HTMLAttributes:t}){return["pre",Do(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,r;return((n=e.raw)==null?void 0:n.startsWith("```"))===!1&&((r=e.raw)==null?void 0:r.startsWith("~~~"))===!1&&e.codeBlockStyle!=="indented"?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r="";const i=((n=e.attrs)==null?void 0:n.language)||"";return e.content?r=[`\`\`\`${i}`,t.renderChildren(e.content),"```"].join(`
197
+ `):r=`\`\`\`${i}
198
+
199
+ \`\`\``,r},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=(t=this.options.tabSize)!=null?t:x2,{state:r}=e,{selection:i}=r,{$from:s,empty:l}=i;if(s.parent.type!==this.type)return!1;const c=" ".repeat(n);return l?e.commands.insertContent(c):e.commands.command(({tr:f})=>{const{from:d,to:p}=i,y=r.doc.textBetween(d,p,`
200
+ `,`
201
+ `).split(`
202
+ `).map(M=>c+M).join(`
203
+ `);return f.replaceWith(d,p,r.schema.text(y)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=(t=this.options.tabSize)!=null?t:x2,{state:r}=e,{selection:i}=r,{$from:s,empty:l}=i;return s.parent.type!==this.type?!1:l?e.commands.command(({tr:c})=>{var f;const{pos:d}=s,p=s.start(),g=s.end(),y=r.doc.textBetween(p,g,`
204
+ `,`
205
+ `).split(`
206
+ `);let M=0,E=0;const D=d-p;for(let Mt=0;Mt<y.length;Mt+=1){if(E+y[Mt].length>=D){M=Mt;break}E+=y[Mt].length+1}const q=((f=y[M].match(/^ */))==null?void 0:f[0])||"",$=Math.min(q.length,n);if($===0)return!0;let Y=p;for(let Mt=0;Mt<M;Mt+=1)Y+=y[Mt].length+1;return c.delete(Y,Y+$),d-Y<=$&&c.setSelection(Pn.create(c.doc,Y)),!0}):e.commands.command(({tr:c})=>{const{from:f,to:d}=i,b=r.doc.textBetween(f,d,`
207
+ `,`
208
+ `).split(`
209
+ `).map(y=>{var M;const E=((M=y.match(/^ */))==null?void 0:M[0])||"",D=Math.min(E.length,n);return y.slice(D)}).join(`
210
+ `);return c.replaceWith(f,d,r.schema.text(b)),!0})},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,l=r.parent.textContent.endsWith(`
211
+
212
+ `);return!s||!l?!1:e.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const c=i.after();return c===void 0?!1:r.nodeAt(c)?e.commands.command(({tr:d})=>(d.setSelection(rr.near(r.resolve(c))),!0)):e.commands.exitCode()}}},addInputRules(){return[_5({find:YI,type:this.type,getAttributes:e=>({language:e[1]})}),_5({find:VI,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Zi({key:new Vo("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!n||!s)return!1;const{tr:l,schema:c}=e.state,f=c.text(n.replace(/\r\n?/g,`
213
+ `));return l.replaceSelectionWith(this.type.create({language:s},f)),l.selection.$from.parent.type!==this.type&&l.setSelection(Pn.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),e.dispatch(l),!0}}})]}}),XI=yl.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
214
+
215
+ `):""}),GI=yl.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",Do(this.options.HTMLAttributes,e)]},renderText(){return`
216
+ `},renderMarkdown:()=>`
217
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:c}=r.extensionManager,f=s||i.$to.parentOffset&&i.$from.marks();return t().insertContent({type:this.name}).command(({tr:d,dispatch:p})=>{if(p&&f&&l){const g=f.filter(b=>c.includes(b.type.name));d.ensureMarks(g)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),KI=yl.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,Do(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;const r=(n=e.attrs)!=null&&n.level?parseInt(e.attrs.level,10):1,i="#".repeat(r);return e.content?`${i} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>_5({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),JI=yl.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",Do(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!rj(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:r}=n,i=e();return FC(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:l,dispatch:c})=>{if(c){const{$to:f}=l.selection,d=f.end();if(f.nodeAfter)f.nodeAfter.isTextblock?l.setSelection(Pn.create(l.doc,f.pos+1)):f.nodeAfter.isBlock?l.setSelection(Nn.create(l.doc,f.pos)):l.setSelection(Pn.create(l.doc,f.pos));else{const p=s.schema.nodes[this.options.nextNodeType]||f.parent.type.contentMatch.defaultType,g=p?.create();g&&(l.insert(d,g),l.setSelection(Pn.create(l.doc,d+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[_j({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),ZI=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,QI=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,tz=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,ez=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,nz=Of.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",Do(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Sh({find:ZI,type:this.type}),Sh({find:tz,type:this.type})]},addPasteRules(){return[Sd({find:QI,type:this.type}),Sd({find:ez,type:this.type})]}});const rz="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",iz="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",R5="numeric",O5="ascii",P5="alpha",Dp="asciinumeric",wp="alphanumeric",j5="domain",l6="emoji",oz="scheme",sz="slashscheme",v2="whitespace";function az(e,t){return e in t||(t[e]=[]),t[e]}function sd(e,t,n){t[R5]&&(t[Dp]=!0,t[wp]=!0),t[O5]&&(t[Dp]=!0,t[P5]=!0),t[Dp]&&(t[wp]=!0),t[P5]&&(t[wp]=!0),t[wp]&&(t[j5]=!0),t[l6]&&(t[j5]=!0);for(const r in t){const i=az(r,n);i.indexOf(e)<0&&i.push(e)}}function lz(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function Xa(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Xa.groups={};Xa.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let r=0;r<t.jr.length;r++){const i=t.jr[r][0],s=t.jr[r][1];if(s&&i.test(e))return s}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r=r||Xa.groups;let i;return t&&t.j?i=t:(i=new Xa(t),n&&r&&sd(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this;const s=e.length;if(!s)return i;for(let l=0;l<s-1;l++)i=i.tt(e[l]);return i.tt(e[s-1],t,n,r)},tt(e,t,n,r){r=r||Xa.groups;const i=this;if(t&&t.j)return i.j[e]=t,t;const s=t;let l,c=i.go(e);if(c?(l=new Xa,Object.assign(l.j,c.j),l.jr.push.apply(l.jr,c.jr),l.jd=c.jd,l.t=c.t):l=new Xa,s){if(r)if(l.t&&typeof l.t=="string"){const f=Object.assign(lz(l.t,r),n);sd(s,f,r)}else n&&sd(s,n,r);l.t=s}return i.j[e]=l,l}};const nr=(e,t,n,r,i)=>e.ta(t,n,r,i),ho=(e,t,n,r,i)=>e.tr(t,n,r,i),hk=(e,t,n,r,i)=>e.ts(t,n,r,i),Ee=(e,t,n,r,i)=>e.tt(t,n,r,i),Lu="WORD",I5="UWORD",c6="ASCIINUMERICAL",u6="ALPHANUMERICAL",Kp="LOCALHOST",z5="TLD",B5="UTLD",jg="SCHEME",nh="SLASH_SCHEME",Lb="NUM",F5="WS",Rb="NL",Lp="OPENBRACE",Rp="CLOSEBRACE",x0="OPENBRACKET",v0="CLOSEBRACKET",w0="OPENPAREN",S0="CLOSEPAREN",k0="OPENANGLEBRACKET",A0="CLOSEANGLEBRACKET",M0="FULLWIDTHLEFTPAREN",C0="FULLWIDTHRIGHTPAREN",E0="LEFTCORNERBRACKET",T0="RIGHTCORNERBRACKET",N0="LEFTWHITECORNERBRACKET",_0="RIGHTWHITECORNERBRACKET",D0="FULLWIDTHLESSTHAN",L0="FULLWIDTHGREATERTHAN",R0="AMPERSAND",O0="APOSTROPHE",P0="ASTERISK",gf="AT",j0="BACKSLASH",I0="BACKTICK",z0="CARET",xf="COLON",Ob="COMMA",B0="DOLLAR",Jc="DOT",F0="EQUALS",Pb="EXCLAMATION",Fl="HYPHEN",Op="PERCENT",U0="PIPE",H0="PLUS",q0="POUND",Pp="QUERY",jb="QUOTE",f6="FULLWIDTHMIDDLEDOT",Ib="SEMI",Zc="SLASH",jp="TILDE",$0="UNDERSCORE",d6="EMOJI",Y0="SYM";var h6=Object.freeze({__proto__:null,ALPHANUMERICAL:u6,AMPERSAND:R0,APOSTROPHE:O0,ASCIINUMERICAL:c6,ASTERISK:P0,AT:gf,BACKSLASH:j0,BACKTICK:I0,CARET:z0,CLOSEANGLEBRACKET:A0,CLOSEBRACE:Rp,CLOSEBRACKET:v0,CLOSEPAREN:S0,COLON:xf,COMMA:Ob,DOLLAR:B0,DOT:Jc,EMOJI:d6,EQUALS:F0,EXCLAMATION:Pb,FULLWIDTHGREATERTHAN:L0,FULLWIDTHLEFTPAREN:M0,FULLWIDTHLESSTHAN:D0,FULLWIDTHMIDDLEDOT:f6,FULLWIDTHRIGHTPAREN:C0,HYPHEN:Fl,LEFTCORNERBRACKET:E0,LEFTWHITECORNERBRACKET:N0,LOCALHOST:Kp,NL:Rb,NUM:Lb,OPENANGLEBRACKET:k0,OPENBRACE:Lp,OPENBRACKET:x0,OPENPAREN:w0,PERCENT:Op,PIPE:U0,PLUS:H0,POUND:q0,QUERY:Pp,QUOTE:jb,RIGHTCORNERBRACKET:T0,RIGHTWHITECORNERBRACKET:_0,SCHEME:jg,SEMI:Ib,SLASH:Zc,SLASH_SCHEME:nh,SYM:Y0,TILDE:jp,TLD:z5,UNDERSCORE:$0,UTLD:B5,UWORD:I5,WORD:Lu,WS:F5});const Nu=/[a-z]/,lp=new RegExp("\\p{L}","u"),w2=new RegExp("\\p{Emoji}","u"),_u=/\d/,S2=/\s/,pk="\r",k2=`
218
+ `,cz="️",uz="‍",A2="";let yg=null,bg=null;function fz(e=[]){const t={};Xa.groups=t;const n=new Xa;yg==null&&(yg=mk(rz)),bg==null&&(bg=mk(iz)),Ee(n,"'",O0),Ee(n,"{",Lp),Ee(n,"}",Rp),Ee(n,"[",x0),Ee(n,"]",v0),Ee(n,"(",w0),Ee(n,")",S0),Ee(n,"<",k0),Ee(n,">",A0),Ee(n,"(",M0),Ee(n,")",C0),Ee(n,"「",E0),Ee(n,"」",T0),Ee(n,"『",N0),Ee(n,"』",_0),Ee(n,"<",D0),Ee(n,">",L0),Ee(n,"&",R0),Ee(n,"*",P0),Ee(n,"@",gf),Ee(n,"`",I0),Ee(n,"^",z0),Ee(n,":",xf),Ee(n,",",Ob),Ee(n,"$",B0),Ee(n,".",Jc),Ee(n,"=",F0),Ee(n,"!",Pb),Ee(n,"-",Fl),Ee(n,"%",Op),Ee(n,"|",U0),Ee(n,"+",H0),Ee(n,"#",q0),Ee(n,"?",Pp),Ee(n,'"',jb),Ee(n,"/",Zc),Ee(n,";",Ib),Ee(n,"~",jp),Ee(n,"_",$0),Ee(n,"\\",j0),Ee(n,"・",f6);const r=ho(n,_u,Lb,{[R5]:!0});ho(r,_u,r);const i=ho(r,Nu,c6,{[Dp]:!0}),s=ho(r,lp,u6,{[wp]:!0}),l=ho(n,Nu,Lu,{[O5]:!0});ho(l,_u,i),ho(l,Nu,l),ho(i,_u,i),ho(i,Nu,i);const c=ho(n,lp,I5,{[P5]:!0});ho(c,Nu),ho(c,_u,s),ho(c,lp,c),ho(s,_u,s),ho(s,Nu),ho(s,lp,s);const f=Ee(n,k2,Rb,{[v2]:!0}),d=Ee(n,pk,F5,{[v2]:!0}),p=ho(n,S2,F5,{[v2]:!0});Ee(n,A2,p),Ee(d,k2,f),Ee(d,A2,p),ho(d,S2,p),Ee(p,pk),Ee(p,k2),ho(p,S2,p),Ee(p,A2,p);const g=ho(n,w2,d6,{[l6]:!0});Ee(g,"#"),ho(g,w2,g),Ee(g,cz,g);const b=Ee(g,uz);Ee(b,"#"),ho(b,w2,g);const y=[[Nu,l],[_u,i]],M=[[Nu,null],[lp,c],[_u,s]];for(let E=0;E<yg.length;E++)ff(n,yg[E],z5,Lu,y);for(let E=0;E<bg.length;E++)ff(n,bg[E],B5,I5,M);sd(z5,{tld:!0,ascii:!0},t),sd(B5,{utld:!0,alpha:!0},t),ff(n,"file",jg,Lu,y),ff(n,"mailto",jg,Lu,y),ff(n,"http",nh,Lu,y),ff(n,"https",nh,Lu,y),ff(n,"ftp",nh,Lu,y),ff(n,"ftps",nh,Lu,y),sd(jg,{scheme:!0,ascii:!0},t),sd(nh,{slashscheme:!0,ascii:!0},t),e=e.sort((E,D)=>E[0]>D[0]?1:-1);for(let E=0;E<e.length;E++){const D=e[E][0],q=e[E][1]?{[oz]:!0}:{[sz]:!0};D.indexOf("-")>=0?q[j5]=!0:Nu.test(D)?_u.test(D)?q[Dp]=!0:q[O5]=!0:q[R5]=!0,hk(n,D,D,q)}return hk(n,"localhost",Kp,{ascii:!0}),n.jd=new Xa(Y0),{start:n,tokens:Object.assign({groups:t},h6)}}function p6(e,t){const n=dz(t.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,i=[];let s=0,l=0;for(;l<r;){let c=e,f=null,d=0,p=null,g=-1,b=-1;for(;l<r&&(f=c.go(n[l]));)c=f,c.accepts()?(g=0,b=0,p=c):g>=0&&(g+=n[l].length,b++),d+=n[l].length,s+=n[l].length,l++;s-=g,l-=b,d-=g,i.push({t:p.t,v:t.slice(s-d,s),s:s-d,e:s})}return i}function dz(e){const t=[],n=e.length;let r=0;for(;r<n;){let i=e.charCodeAt(r),s,l=i<55296||i>56319||r+1===n||(s=e.charCodeAt(r+1))<56320||s>57343?e[r]:e.slice(r,r+2);t.push(l),r+=l.length}return t}function ff(e,t,n,r,i){let s;const l=t.length;for(let c=0;c<l-1;c++){const f=t[c];e.j[f]?s=e.j[f]:(s=new Xa(r),s.jr=i.slice(),e.j[f]=s),e=s}return s=new Xa(n),s.jr=i.slice(),e.j[t[l-1]]=s,s}function mk(e){const t=[],n=[];let r=0,i="0123456789";for(;r<e.length;){let s=0;for(;i.indexOf(e[r+s])>=0;)s++;if(s>0){t.push(n.join(""));for(let l=parseInt(e.substring(r,r+s),10);l>0;l--)n.pop();r+=s}else n.push(e[r]),r++}return t}const Jp={defaultProtocol:"http",events:null,format:gk,formatHref:gk,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function zb(e,t=null){let n=Object.assign({},Jp);e&&(n=Object.assign(n,e instanceof zb?e.o:e));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}zb.prototype={o:Jp,ignoreTags:[],defaultRender(e){return e},check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=t!=null;let i=this.o[e];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:Jp[e],typeof i=="function"&&r&&(i=i(t,n))):typeof i=="function"&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r=="function"&&t!=null&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}};function gk(e){return e}function m6(e,t){this.t="token",this.v=e,this.tk=t}m6.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=Jp.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),i=e.get("tagName",n,t),s=this.toFormattedString(e),l={},c=e.get("className",n,t),f=e.get("target",n,t),d=e.get("rel",n,t),p=e.getObj("attributes",n,t),g=e.getObj("events",n,t);return l.href=r,c&&(l.class=c),f&&(l.target=f),d&&(l.rel=d),p&&Object.assign(l,p),{tagName:i,attributes:l,content:s,eventListeners:g}}};function h1(e,t){class n extends m6{constructor(i,s){super(i,s),this.t=e}}for(const r in t)n.prototype[r]=t[r];return n.t=e,n}const yk=h1("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),bk=h1("text"),hz=h1("nl"),xg=h1("url",{isLink:!0,toHref(e=Jp.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==Kp&&e[1].t===xf}}),Il=e=>new Xa(e);function pz({groups:e}){const t=e.domain.concat([R0,P0,gf,j0,I0,z0,B0,F0,Fl,Lb,Op,U0,H0,q0,Zc,Y0,jp,$0]),n=[O0,xf,Ob,Jc,Pb,Op,Pp,jb,Ib,k0,A0,Lp,Rp,v0,x0,w0,S0,M0,C0,E0,T0,N0,_0,D0,L0],r=[R0,O0,P0,j0,I0,z0,B0,F0,Fl,Lp,Rp,Op,U0,H0,q0,Pp,Zc,Y0,jp,$0],i=Il(),s=Ee(i,jp);nr(s,r,s),nr(s,e.domain,s);const l=Il(),c=Il(),f=Il();nr(i,e.domain,l),nr(i,e.scheme,c),nr(i,e.slashscheme,f),nr(l,r,s),nr(l,e.domain,l);const d=Ee(l,gf);Ee(s,gf,d),Ee(c,gf,d),Ee(f,gf,d);const p=Ee(s,Jc);nr(p,r,s),nr(p,e.domain,s);const g=Il();nr(d,e.domain,g),nr(g,e.domain,g);const b=Ee(g,Jc);nr(b,e.domain,g);const y=Il(yk);nr(b,e.tld,y),nr(b,e.utld,y),Ee(d,Kp,y);const M=Ee(g,Fl);Ee(M,Fl,M),nr(M,e.domain,g),nr(y,e.domain,g),Ee(y,Jc,b),Ee(y,Fl,M);const E=Ee(y,xf);nr(E,e.numeric,yk);const D=Ee(l,Fl),L=Ee(l,Jc);Ee(D,Fl,D),nr(D,e.domain,l),nr(L,r,s),nr(L,e.domain,l);const q=Il(xg);nr(L,e.tld,q),nr(L,e.utld,q),nr(q,e.domain,l),nr(q,r,s),Ee(q,Jc,L),Ee(q,Fl,D),Ee(q,gf,d);const $=Ee(q,xf),Y=Il(xg);nr($,e.numeric,Y);const ht=Il(xg),Mt=Il();nr(ht,t,ht),nr(ht,n,Mt),nr(Mt,t,ht),nr(Mt,n,Mt),Ee(q,Zc,ht),Ee(Y,Zc,ht);const vt=Ee(c,xf),bt=Ee(f,xf),rt=Ee(bt,Zc),Dt=Ee(rt,Zc);nr(c,e.domain,l),Ee(c,Jc,L),Ee(c,Fl,D),nr(f,e.domain,l),Ee(f,Jc,L),Ee(f,Fl,D),nr(vt,e.domain,ht),Ee(vt,Zc,ht),Ee(vt,Pp,ht),nr(Dt,e.domain,ht),nr(Dt,t,ht),Ee(Dt,Zc,ht);const Q=[[Lp,Rp],[x0,v0],[w0,S0],[k0,A0],[M0,C0],[E0,T0],[N0,_0],[D0,L0]];for(let lt=0;lt<Q.length;lt++){const[X,wt]=Q[lt],Tt=Ee(ht,X);Ee(Mt,X,Tt),Ee(Tt,wt,ht);const yt=Il(xg);nr(Tt,t,yt);const J=Il();nr(Tt,n),nr(yt,t,yt),nr(yt,n,J),nr(J,t,yt),nr(J,n,J),Ee(yt,wt,ht),Ee(J,wt,ht)}return Ee(i,Kp,q),Ee(i,Rb,hz),{start:i,tokens:h6}}function mz(e,t,n){let r=n.length,i=0,s=[],l=[];for(;i<r;){let c=e,f=null,d=null,p=0,g=null,b=-1;for(;i<r&&!(f=c.go(n[i].t));)l.push(n[i++]);for(;i<r&&(d=f||c.go(n[i].t));)f=null,c=d,c.accepts()?(b=0,g=c):b>=0&&b++,i++,p++;if(b<0)i-=p,i<r&&(l.push(n[i]),i++);else{l.length>0&&(s.push(M2(bk,t,l)),l=[]),i-=b,p-=b;const y=g.t,M=n.slice(i-p,i);s.push(M2(y,t,M))}}return l.length>0&&s.push(M2(bk,t,l)),s}function M2(e,t,n){const r=n[0].s,i=n[n.length-1].e,s=t.slice(r,i);return new e(s,n)}const gz=typeof console<"u"&&console&&console.warn||(()=>{}),yz="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ui={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function bz(){return Xa.groups={},Ui.scanner=null,Ui.parser=null,Ui.tokenQueue=[],Ui.pluginQueue=[],Ui.customSchemes=[],Ui.initialized=!1,Ui}function xk(e,t=!1){if(Ui.initialized&&gz(`linkifyjs: already initialized - will not register custom scheme "${e}" ${yz}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format.
219
+ 1. Must only contain digits, lowercase ASCII letters or "-"
220
+ 2. Cannot start or end with "-"
221
+ 3. "-" cannot repeat`);Ui.customSchemes.push([e,t])}function xz(){Ui.scanner=fz(Ui.customSchemes);for(let e=0;e<Ui.tokenQueue.length;e++)Ui.tokenQueue[e][1]({scanner:Ui.scanner});Ui.parser=pz(Ui.scanner.tokens);for(let e=0;e<Ui.pluginQueue.length;e++)Ui.pluginQueue[e][1]({scanner:Ui.scanner,parser:Ui.parser});return Ui.initialized=!0,Ui}function Bb(e){return Ui.initialized||xz(),mz(Ui.parser.start,e,p6(Ui.scanner.start,e))}Bb.scan=p6;function g6(e,t=null,n=null){if(t&&typeof t=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new zb(n),i=Bb(e),s=[];for(let l=0;l<i.length;l++){const c=i[l];c.isLink&&(!t||c.t===t)&&r.check(c)&&s.push(c.toFormattedObject(r))}return s}var Fb="[\0-   ᠎ -\u2029  ]",vz=new RegExp(Fb),wz=new RegExp(`${Fb}$`),Sz=new RegExp(Fb,"g");function kz(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function Az(e){return new Zi({key:new Vo("autolink"),appendTransaction:(t,n,r)=>{const i=t.some(d=>d.docChanged)&&!n.doc.eq(r.doc),s=t.some(d=>d.getMeta("preventAutolink"));if(!i||s)return;const{tr:l}=r,c=RC(n.doc,[...t]);if(Tb(c).forEach(({newRange:d})=>{const p=eP(r.doc,d,y=>y.isTextblock);let g,b;if(p.length>1)g=p[0],b=r.doc.textBetween(g.pos,g.pos+g.node.nodeSize,void 0," ");else if(p.length){const y=r.doc.textBetween(d.from,d.to," "," ");if(!wz.test(y))return;g=p[0],b=r.doc.textBetween(g.pos,d.to,void 0," ")}if(g&&b){const y=b.split(vz).filter(Boolean);if(y.length<=0)return!1;const M=y[y.length-1],E=g.pos+b.lastIndexOf(M);if(!M)return!1;const D=Bb(M).map(L=>L.toObject(e.defaultProtocol));if(!kz(D))return!1;D.filter(L=>L.isLink).map(L=>({...L,from:E+L.start+1,to:E+L.end+1})).filter(L=>r.schema.marks.code?!r.doc.rangeHasMark(L.from,L.to,r.schema.marks.code):!0).filter(L=>e.validate(L.value)).filter(L=>e.shouldAutoLink(L.value)).forEach(L=>{Nb(L.from,L.to,r.doc).some(q=>q.mark.type===e.type)||l.addMark(L.from,L.to,e.type.create({href:L.href}))})}}),!!l.steps.length)return l}})}function Mz(e){return new Zi({key:new Vo("handleClickLink"),props:{handleClick:(t,n,r)=>{var i,s;if(r.button!==0||!t.editable)return!1;let l=null;if(r.target instanceof HTMLAnchorElement)l=r.target;else{const f=r.target;if(!f)return!1;const d=e.editor.view.dom;l=f.closest("a"),l&&!d.contains(l)&&(l=null)}if(!l)return!1;let c=!1;if(e.enableClickSelection&&(c=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){const f=BC(t.state,e.type.name),d=(i=l.href)!=null?i:f.href,p=(s=l.target)!=null?s:f.target;d&&(window.open(d,p),c=!0)}return c}}})}function Cz(e){return new Zi({key:new Vo("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{shouldAutoLink:i}=e,{state:s}=t,{selection:l}=s,{empty:c}=l;if(c)return!1;let f="";r.content.forEach(p=>{f+=p.textContent});const d=g6(f,{defaultProtocol:e.defaultProtocol}).find(p=>p.isLink&&p.value===f);return!f||!d||i!==void 0&&!i(d.value)?!1:e.editor.commands.setMark(e.type,{href:d.href})}}})}function Gf(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!e||e.replace(Sz,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Ez=Of.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e=="string"){xk(e);return}xk(e.scheme,e.optionalSlashes)})},onDestroy(){bz()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!Gf(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;const i=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:n=>!!Gf(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!Gf(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Do(this.options.HTMLAttributes,e),0]:["a",Do(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,i,s;const l=(r=(n=e.attrs)==null?void 0:n.href)!=null?r:"",c=(s=(i=e.attrs)==null?void 0:i.title)!=null?s:"",f=t.renderChildren(e);return c?`[${f}](${l} "${c}")`:`[${f}](${l})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Gf(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Gf(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Sd({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,i=g6(e).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!Gf(l,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&t.push({text:s.value,data:{href:s.href},index:s.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)==null?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(Az({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Gf(i,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(Mz({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(Cz({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),Tz=Object.defineProperty,Nz=(e,t)=>{for(var n in t)Tz(e,n,{get:t[n],enumerable:!0})},_z="listItem",vk="textStyle",wk=/^\s*([-+*])\s$/,y6=yl.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:e}){return["ul",Do(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>e.type!=="list"||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
222
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(_z,this.editor.getAttributes(vk)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=kh({find:wk,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=kh({find:wk,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(vk),editor:this.editor})),[e]}}),b6=yl.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",Do(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{if(e.type!=="list_item")return[];let n=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(i=>i.type==="paragraph"))n=t.parseChildren(e.tokens);else{const i=e.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(n=[{type:"paragraph",content:t.parseInline(i.tokens)}],e.tokens.length>1){const l=e.tokens.slice(1),c=t.parseChildren(l);n.push(...c)}}else n=t.parseChildren(e.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(e,t,n)=>XC(e,t,r=>{var i,s;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((s=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:s.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Dz={};Nz(Dz,{findListItemPos:()=>cm,getNextListDepth:()=>Ub,handleBackspace:()=>U5,handleDelete:()=>H5,hasListBefore:()=>x6,hasListItemAfter:()=>Lz,hasListItemBefore:()=>v6,listItemHasSubList:()=>w6,nextListIsDeeper:()=>S6,nextListIsHigher:()=>k6});var cm=(e,t)=>{const{$from:n}=t.selection,r=Yo(e,t.schema);let i=null,s=n.depth,l=n.pos,c=null;for(;s>0&&c===null;)i=n.node(s),i.type===r?c=s:(s-=1,l-=1);return c===null?null:{$pos:t.doc.resolve(l),depth:c}},Ub=(e,t)=>{const n=cm(e,t);if(!n)return!1;const[,r]=dP(t,e,n.$pos.pos+4);return r},x6=(e,t,n)=>{const{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),s=e.doc.resolve(i).node();return!(!s||!n.includes(s.type.name))},v6=(e,t)=>{var n;const{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==e)},w6=(e,t,n)=>{if(!n)return!1;const r=Yo(e,t.schema);let i=!1;return n.descendants(s=>{s.type===r&&(i=!0)}),i},U5=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!Df(e.state,t)&&x6(e.state,t,n)){const{$anchor:c}=e.state.selection,f=e.state.doc.resolve(c.before()-1),d=[];f.node().descendants((b,y)=>{b.type.name===t&&d.push({node:b,pos:y})});const p=d.at(-1);if(!p)return!1;const g=e.state.doc.resolve(f.start()+p.pos+1);return e.chain().cut({from:c.start()-1,to:c.end()+1},g.end()).joinForward().run()}if(!Df(e.state,t)||!gP(e.state))return!1;const r=cm(t,e.state);if(!r)return!1;const s=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),l=w6(t,e.state,s);return v6(t,e.state)&&!l?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},S6=(e,t)=>{const n=Ub(e,t),r=cm(e,t);return!r||!n?!1:n>r.depth},k6=(e,t)=>{const n=Ub(e,t),r=cm(e,t);return!r||!n?!1:n<r.depth},H5=(e,t)=>{if(!Df(e.state,t)||!mP(e.state,t))return!1;const{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:S6(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():k6(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},Lz=(e,t)=>{var n;const{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==e)},A6=xi.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&H5(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&H5(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&U5(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&U5(e,n,r)&&(t=!0)}),t}}}}),Sk=/^(\s*)(\d+)\.\s+(.*)$/,Rz=/^\s/;function Oz(e){const t=[];let n=0,r=0;for(;n<e.length;){const i=e[n],s=i.match(Sk);if(!s)break;const[,l,c,f]=s,d=l.length;let p=f,g=n+1;const b=[i];for(;g<e.length;){const y=e[g];if(y.match(Sk))break;if(y.trim()==="")b.push(y),p+=`
223
+ `,g+=1;else if(y.match(Rz))b.push(y),p+=`
224
+ ${y.slice(d+2)}`,g+=1;else break}t.push({indent:d,number:parseInt(c,10),content:p.trim(),raw:b.join(`
225
+ `)}),r=g,n=g}return[t,r]}function M6(e,t,n){var r;const i=[];let s=0;for(;s<e.length;){const l=e[s];if(l.indent===t){const c=l.content.split(`
226
+ `),f=((r=c[0])==null?void 0:r.trim())||"",d=[];f&&d.push({type:"paragraph",raw:f,tokens:n.inlineTokens(f)});const p=c.slice(1).join(`
227
+ `).trim();if(p){const y=n.blockTokens(p);d.push(...y)}let g=s+1;const b=[];for(;g<e.length&&e[g].indent>t;)b.push(e[g]),g+=1;if(b.length>0){const y=Math.min(...b.map(E=>E.indent)),M=M6(b,y,n);d.push({type:"list",ordered:!0,start:b[0].number,items:M,raw:b.map(E=>E.raw).join(`
228
+ `)})}i.push({type:"list_item",raw:l.raw,tokens:d}),s=g}else s+=1}return i}function Pz(e,t){return e.map(n=>{if(n.type!=="list_item")return t.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...t.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=t.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=t.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var jz="listItem",kk="textStyle",Ak=/^(\d+)\.\s$/,C6=yl.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",Do(this.options.HTMLAttributes,n),0]:["ol",Do(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{if(e.type!=="list"||!e.ordered)return[];const n=e.start||1,r=e.items?Pz(e.items,t):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
229
+ `):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{const t=e.match(/^(\s*)(\d+)\.\s+/),n=t?.index;return n!==void 0?n:-1},tokenize:(e,t,n)=>{var r;const i=e.split(`
230
+ `),[s,l]=Oz(i);if(s.length===0)return;const c=M6(s,0,n);return c.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:c,raw:i.slice(0,l).join(`
231
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(jz,this.editor.getAttributes(kk)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=kh({find:Ak,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=kh({find:Ak,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(kk)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),Iz=/^\s*(\[([( |x])?\])\s$/,zz=yl.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return t===""||t==="true"},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",Do(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{const n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){const r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;const i=`- [${(n=e.attrs)!=null&&n.checked?"x":" "}] `;return XC(e,t,i)},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),l=document.createElement("span"),c=document.createElement("input"),f=document.createElement("div"),d=g=>{var b,y;c.ariaLabel=((y=(b=this.options.a11y)==null?void 0:b.checkboxLabel)==null?void 0:y.call(b,g,c.checked))||`Task item checkbox for ${g.textContent||"empty task item"}`};d(e),s.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",g=>g.preventDefault()),c.addEventListener("change",g=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:b}=g.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:y})=>{const M=n();if(typeof M!="number")return!1;const E=y.doc.nodeAt(M);return y.setNodeMarkup(M,void 0,{...E?.attrs,checked:b}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,b)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([g,b])=>{i.setAttribute(g,b)}),i.dataset.checked=e.attrs.checked,c.checked=e.attrs.checked,s.append(c,l),i.append(s,f),Object.entries(t).forEach(([g,b])=>{i.setAttribute(g,b)});let p=new Set(Object.keys(t));return{dom:i,contentDOM:f,update:g=>{if(g.type!==this.type)return!1;i.dataset.checked=g.attrs.checked,c.checked=g.attrs.checked,d(g);const b=r.extensionManager.attributes,y=Gp(g,b),M=new Set(Object.keys(y)),E=this.options.HTMLAttributes;return p.forEach(D=>{M.has(D)||(D in E?i.setAttribute(D,E[D]):i.removeAttribute(D))}),Object.entries(y).forEach(([D,L])=>{L==null?D in E?i.setAttribute(D,E[D]):i.removeAttribute(D):i.setAttribute(D,L)}),p=M,!0}}}},addInputRules(){return[kh({find:Iz,type:this.type,getAttributes:e=>({checked:e[e.length-1]==="x"})})]}}),Bz=yl.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",Do(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
232
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;const n=(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:t.index;return n!==void 0?n:-1},tokenize(e,t,n){const r=s=>{const l=ik(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,f)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:n.inlineTokens(c.mainContent),nestedTokens:f}),customNestedParser:r},n);return l?[{type:"taskList",raw:l.raw,items:l.items}]:n.blockTokens(s)},i=ik(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,l)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:l}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});xi.create({name:"listKit",addExtensions(){const e=[];return this.options.bulletList!==!1&&e.push(y6.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(b6.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(A6.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(C6.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(zz.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Bz.configure(this.options.taskList)),e}});var Mk="&nbsp;",Fz=" ",Uz=yl.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",Do(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const n=e.tokens||[];if(n.length===1&&n[0].type==="image")return t.parseChildren([n[0]]);const r=t.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===Mk||r[0].text===Fz)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,r)},renderMarkdown:(e,t)=>{if(!e)return"";const n=Array.isArray(e.content)?e.content:[];return n.length===0?Mk:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Hz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,qz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,$z=Of.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",Do(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Sh({find:Hz,type:this.type})]},addPasteRules(){return[Sd({find:qz,type:this.type})]}}),Yz=yl.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),Vz=Of.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",Do(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,t,n){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Wz(e={}){return new Zi({view(t){return new Xz(t,e)}})}class Xz{constructor(t,n){var r;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=l=>{this[i](l)};return t.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),l=s.width/i.offsetWidth,c=s.height/i.offsetHeight;if(n){let g=t.nodeBefore,b=t.nodeAfter;if(g||b){let y=this.editorView.nodeDOM(this.cursorPos-(g?g.nodeSize:0));if(y){let M=y.getBoundingClientRect(),E=g?M.bottom:M.top;g&&b&&(E=(E+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let D=this.width/2*c;r={left:M.left,right:M.right,top:E-D,bottom:E+D}}}}if(!r){let g=this.editorView.coordsAtPos(this.cursorPos),b=this.width/2*l;r={left:g.left-b,right:g.left+b,top:g.top,bottom:g.bottom}}let f=this.editorView.dom.offsetParent;this.element||(this.element=f.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let d,p;if(!f||f==document.body&&getComputedStyle(f).position=="static")d=-pageXOffset,p=-pageYOffset;else{let g=f.getBoundingClientRect(),b=g.width/f.offsetWidth,y=g.height/f.offsetHeight;d=g.left-f.scrollLeft*b,p=g.top-f.scrollTop*y}this.element.style.left=(r.left-d)/l+"px",this.element.style.top=(r.top-p)/c+"px",this.element.style.width=(r.right-r.left)/l+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,t):i;if(n&&!s){let l=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=bM(this.editorView.state.doc,l,this.editorView.dragging.slice);c!=null&&(l=c)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}class go extends rr{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return go.valid(r)?new go(r):rr.near(r)}content(){return Ge.empty}eq(t){return t instanceof go&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new go(t.resolve(n.pos))}getBookmark(){return new Hb(this.anchor)}static valid(t){let n=t.parent;if(n.inlineContent||!Gz(t)||!Kz(t))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(t.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(t,n,r=!1){t:for(;;){if(!r&&go.valid(t))return t;let i=t.pos,s=null;for(let l=t.depth;;l--){let c=t.node(l);if(n>0?t.indexAfter(l)<c.childCount:t.index(l)>0){s=c.child(n>0?t.indexAfter(l):t.index(l)-1);break}else if(l==0)return null;i+=n;let f=t.doc.resolve(i);if(go.valid(f))return f}for(;;){let l=n>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!Nn.isSelectable(s)){t=t.doc.resolve(i+s.nodeSize*n),r=!1;continue t}break}s=l,i+=n;let c=t.doc.resolve(i);if(go.valid(c))return c}return null}}}go.prototype.visible=!1;go.findFrom=go.findGapCursorFrom;rr.jsonID("gapcursor",go);class Hb{constructor(t){this.pos=t}map(t){return new Hb(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return go.valid(n)?new go(n):rr.near(n)}}function E6(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Gz(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||E6(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Kz(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||E6(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Jz(){return new Zi({props:{decorations:eB,createSelectionBetween(e,t,n){return t.pos==n.pos&&go.valid(n)?new go(n):null},handleClick:Qz,handleKeyDown:Zz,handleDOMEvents:{beforeinput:tB}}})}const Zz=SC({ArrowLeft:vg("horiz",-1),ArrowRight:vg("horiz",1),ArrowUp:vg("vert",-1),ArrowDown:vg("vert",1)});function vg(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,i,s){let l=r.selection,c=t>0?l.$to:l.$from,f=l.empty;if(l instanceof Pn){if(!s.endOfTextblock(n)||c.depth==0)return!1;f=!1,c=r.doc.resolve(t>0?c.after():c.before())}let d=go.findGapCursorFrom(c,t,f);return d?(i&&i(r.tr.setSelection(new go(d))),!0):!1}}function Qz(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!go.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Nn.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new go(r))),!0)}function tB(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof go))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=ke.empty;for(let l=r.length-1;l>=0;l--)i=ke.from(r[l].createAndFill(null,i));let s=e.state.tr.replace(n.pos,n.pos,new Ge(i,0,0));return s.setSelection(Pn.near(s.doc.resolve(n.pos+1))),e.dispatch(s),!1}function eB(e){if(!(e.selection instanceof go))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",di.create(e.doc,[wa.widget(e.selection.head,t,{key:"gapcursor"})])}var V0=200,vs=function(){};vs.prototype.append=function(t){return t.length?(t=vs.from(t),!this.length&&t||t.length<V0&&this.leafAppend(t)||this.length<V0&&t.leafPrepend(this)||this.appendInner(t)):this};vs.prototype.prepend=function(t){return t.length?vs.from(t).append(this):this};vs.prototype.appendInner=function(t){return new nB(this,t)};vs.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?vs.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};vs.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};vs.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};vs.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,l){return i.push(t(s,l))},n,r),i};vs.from=function(t){return t instanceof vs?t:t&&t.length?new T6(t):vs.empty};var T6=(function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new t(this.values.slice(i,s))},t.prototype.getInner=function(i){return this.values[i]},t.prototype.forEachInner=function(i,s,l,c){for(var f=s;f<l;f++)if(i(this.values[f],c+f)===!1)return!1},t.prototype.forEachInvertedInner=function(i,s,l,c){for(var f=s-1;f>=l;f--)if(i(this.values[f],c+f)===!1)return!1},t.prototype.leafAppend=function(i){if(this.length+i.length<=V0)return new t(this.values.concat(i.flatten()))},t.prototype.leafPrepend=function(i){if(this.length+i.length<=V0)return new t(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t})(vs);vs.empty=new T6([]);var nB=(function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,i,s,l){var c=this.left.length;if(i<c&&this.left.forEachInner(r,i,Math.min(s,c),l)===!1||s>c&&this.right.forEachInner(r,Math.max(i-c,0),Math.min(this.length,s)-c,l+c)===!1)return!1},t.prototype.forEachInvertedInner=function(r,i,s,l){var c=this.left.length;if(i>c&&this.right.forEachInvertedInner(r,i-c,Math.max(s,c)-c,l+c)===!1||s<c&&this.left.forEachInvertedInner(r,Math.min(i,c),s,l)===!1)return!1},t.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},t.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new t(this.left,i)},t.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new t(i,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t})(vs);const rB=500;class xc{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let l=t.tr,c,f,d=[],p=[];return this.items.forEach((g,b)=>{if(!g.step){i||(i=this.remapping(r,b+1),s=i.maps.length),s--,p.push(g);return}if(i){p.push(new Qc(g.map));let y=g.step.map(i.slice(s)),M;y&&l.maybeStep(y).doc&&(M=l.mapping.maps[l.mapping.maps.length-1],d.push(new Qc(M,void 0,void 0,d.length+p.length))),s--,M&&i.appendMap(M,s)}else l.maybeStep(g.step);if(g.selection)return c=i?g.selection.map(i.slice(s)):g.selection,f=new xc(this.items.slice(0,r).append(p.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:f,transform:l,selection:c}}addTransform(t,n,r,i){let s=[],l=this.eventCount,c=this.items,f=!i&&c.length?c.get(c.length-1):null;for(let p=0;p<t.steps.length;p++){let g=t.steps[p].invert(t.docs[p]),b=new Qc(t.mapping.maps[p],g,n),y;(y=f&&f.merge(b))&&(b=y,p?s.pop():c=c.slice(0,c.length-1)),s.push(b),n&&(l++,n=void 0),i||(f=b)}let d=l-r.depth;return d>oB&&(c=iB(c,d),l-=d),new xc(c.append(s),l)}remapping(t,n){let r=new $p;return this.items.forEach((i,s)=>{let l=i.mirrorOffset!=null&&s-i.mirrorOffset>=t?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,l)},t,n),r}addMaps(t){return this.eventCount==0?this:new xc(this.items.append(t.map(n=>new Qc(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=t.mapping,l=t.steps.length,c=this.eventCount;this.items.forEach(b=>{b.selection&&c--},i);let f=n;this.items.forEach(b=>{let y=s.getMirror(--f);if(y==null)return;l=Math.min(l,y);let M=s.maps[y];if(b.step){let E=t.steps[y].invert(t.docs[y]),D=b.selection&&b.selection.map(s.slice(f+1,y));D&&c++,r.push(new Qc(M,E,D))}else r.push(new Qc(M))},i);let d=[];for(let b=n;b<l;b++)d.push(new Qc(s.maps[b]));let p=this.items.slice(0,i).append(d).append(r),g=new xc(p,c);return g.emptyItemCount()>rB&&(g=g.compress(this.items.length-r.length)),g}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],s=0;return this.items.forEach((l,c)=>{if(c>=t)i.push(l),l.selection&&s++;else if(l.step){let f=l.step.map(n.slice(r)),d=f&&f.getMap();if(r--,d&&n.appendMap(d,r),f){let p=l.selection&&l.selection.map(n.slice(r));p&&s++;let g=new Qc(d.invert(),f,p),b,y=i.length-1;(b=i.length&&i[y].merge(g))?i[y]=b:i.push(g)}}else l.map&&r--},this.items.length,0),new xc(vs.from(i.reverse()),s)}}xc.empty=new xc(vs.empty,0);function iB(e,t){let n;return e.forEach((r,i)=>{if(r.selection&&t--==0)return n=i,!1}),e.slice(n)}class Qc{constructor(t,n,r,i){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new Qc(n.getMap().invert(),n,this.selection)}}}class yf{constructor(t,n,r,i,s){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const oB=20;function sB(e,t,n,r){let i=n.getMeta(hd),s;if(i)return i.historyState;n.getMeta(cB)&&(e=new yf(e.done,e.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(l&&l.getMeta(hd))return l.getMeta(hd).redo?new yf(e.done.addTransform(n,void 0,r,Ig(t)),e.undone,Ck(n.mapping.maps),e.prevTime,e.prevComposition):new yf(e.done,e.undone.addTransform(n,void 0,r,Ig(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),f=e.prevTime==0||!l&&e.prevComposition!=c&&(e.prevTime<(n.time||0)-r.newGroupDelay||!aB(n,e.prevRanges)),d=l?C2(e.prevRanges,n.mapping):Ck(n.mapping.maps);return new yf(e.done.addTransform(n,f?t.selection.getBookmark():void 0,r,Ig(t)),xc.empty,d,n.time,c??e.prevComposition)}else return(s=n.getMeta("rebased"))?new yf(e.done.rebased(n,s),e.undone.rebased(n,s),C2(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new yf(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),C2(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function aB(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<t.length;s+=2)r<=t[s+1]&&i>=t[s]&&(n=!0)}),n}function Ck(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,i,s,l)=>t.push(s,l));return t}function C2(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),s=t.map(e[r+1],-1);i<=s&&n.push(i,s)}return n}function lB(e,t,n){let r=Ig(t),i=hd.get(t).spec.config,s=(n?e.undone:e.done).popEvent(t,r);if(!s)return null;let l=s.selection.resolve(s.transform.doc),c=(n?e.done:e.undone).addTransform(s.transform,t.selection.getBookmark(),i,r),f=new yf(n?c:s.remaining,n?s.remaining:c,null,0,-1);return s.transform.setSelection(l).setMeta(hd,{redo:n,historyState:f})}let E2=!1,Ek=null;function Ig(e){let t=e.plugins;if(Ek!=t){E2=!1,Ek=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){E2=!0;break}}return E2}const hd=new Vo("history"),cB=new Vo("closeHistory");function uB(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Zi({key:hd,state:{init(){return new yf(xc.empty,xc.empty,null,0,-1)},apply(t,n,r){return sB(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,i=r=="historyUndo"?_6:r=="historyRedo"?D6:null;return!i||!t.editable?!1:(n.preventDefault(),i(t.state,t.dispatch))}}}})}function N6(e,t){return(n,r)=>{let i=hd.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let s=lB(i,n,e);s&&r(t?s.scrollIntoView():s)}return!0}}const _6=N6(!1,!0),D6=N6(!0,!0);xi.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(t=>t!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{const t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)==="textSize"){const r=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(r)}return t.nodeSize},this.storage.words=e=>{const t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Zi({key:new Vo("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;const i=this.options.limit;if(i==null||i===0){e=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const l=s-i,c=0,f=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(c,f);return e=!0,d}e=!0},filterTransaction:(t,n)=>{const r=this.options.limit;if(!t.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),s=this.storage.characters({node:t.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!t.getMeta("paste"))return!1;const c=t.selection.$head.pos,f=s-r,d=c-f,p=c;return t.deleteRange(d,p),!(this.storage.characters({node:t.doc})>r)}})]}});var fB=xi.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Wz(this.options)]}});xi.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Zi({key:new Vo("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,s=[];if(!n||!r)return di.create(e,[]);let l=0;this.options.mode==="deepest"&&e.descendants((f,d)=>{if(f.isText)return;if(!(i>=d&&i<=d+f.nodeSize-1))return!1;l+=1});let c=0;return e.descendants((f,d)=>{if(f.isText||!(i>=d&&i<=d+f.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&l-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";s.push(wa.node(d,d+f.nodeSize,{class:this.options.className}))}),di.create(e,s)}}})]}});var dB=xi.create({name:"gapCursor",addProseMirrorPlugins(){return[Jz()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=Zr(mn(e,"allowGapCursor",n)))!=null?t:null}}}),Tk="placeholder";function hB(e){return e.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}xi.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Tk,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const e=this.options.dataAttribute?`data-${hB(this.options.dataAttribute)}`:`data-${Tk}`;return[new Zi({key:new Vo("placeholder"),props:{decorations:({doc:t,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,s=[];if(!r)return null;const l=this.editor.isEmpty;return t.descendants((c,f)=>{const d=i>=f&&i<=f+c.nodeSize,p=!c.isLeaf&&u1(c);if((d||!this.options.showOnlyCurrent)&&p){const g=[this.options.emptyNodeClass];l&&g.push(this.options.emptyEditorClass);const b=wa.node(f,f+c.nodeSize,{class:g.join(" "),[e]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:f,hasAnchor:d}):this.options.placeholder});s.push(b)}return this.options.includeChildren}),di.create(t,s)}}})]}});xi.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new Zi({key:new Vo("selection"),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||FC(n.selection)||e.view.dragging?null:di.create(n.doc,[wa.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function Nk({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var pB=xi.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var e;const t=new Vo(this.name),n=this.options.node||((e=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new Zi({key:t,appendTransaction:(i,s,l)=>{const{doc:c,tr:f,schema:d}=l,p=t.getState(l),g=c.content.size,b=d.nodes[n];if(p)return f.insert(g,b.create())},state:{init:(i,s)=>{const l=s.tr.doc.lastChild;return!Nk({node:l,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const l=i.doc.lastChild;return!Nk({node:l,types:r})}}})]}}),mB=xi.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>_6(e,t),redo:()=>({state:e,dispatch:t})=>D6(e,t)}},addProseMirrorPlugins(){return[uB(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),gB=xi.create({name:"starterKit",addExtensions(){var e,t,n,r;const i=[];return this.options.bold!==!1&&i.push(UI.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(jI.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(y6.configure(this.options.bulletList)),this.options.code!==!1&&i.push($I.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(WI.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(XI.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(fB.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(dB.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(GI.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(KI.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(mB.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(JI.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(nz.configure(this.options.italic)),this.options.listItem!==!1&&i.push(b6.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(A6.configure((e=this.options)==null?void 0:e.listKeymap)),this.options.link!==!1&&i.push(Ez.configure((t=this.options)==null?void 0:t.link)),this.options.orderedList!==!1&&i.push(C6.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(Uz.configure(this.options.paragraph)),this.options.strike!==!1&&i.push($z.configure(this.options.strike)),this.options.text!==!1&&i.push(Yz.configure(this.options.text)),this.options.underline!==!1&&i.push(Vz.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(pB.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),yB=gB,bB=20,L6=(e,t=0)=>{const n=[];return!e.children.length||t>bB||Array.from(e.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...L6(r,t+1))}),n},xB=e=>{if(!e.children.length)return;const t=L6(e);t&&t.forEach(n=>{var r,i;const s=n.getAttribute("style"),l=(i=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:i.getAttribute("style");n.setAttribute("style",`${l};${s}`)})},R6=Of.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:e=>e.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&xB(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return["span",Do(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{const{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(s=>!!s))||e.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),vB=xi.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>{var t;const n=e.getAttribute("style");if(n){const r=n.split(";").map(i=>i.trim()).filter(Boolean);for(let i=r.length-1;i>=0;i-=1){const s=r[i].split(":");if(s.length>=2){const l=s[0].trim().toLowerCase(),c=s.slice(1).join(":").trim();if(l==="background-color")return c.replace(/['"]+/g,"")}}}return(t=e.style.backgroundColor)==null?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:e=>({chain:t})=>t().setMark("textStyle",{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),wB=xi.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;const n=e.getAttribute("style");if(n){const r=n.split(";").map(i=>i.trim()).filter(Boolean);for(let i=r.length-1;i>=0;i-=1){const s=r[i].split(":");if(s.length>=2){const l=s[0].trim().toLowerCase(),c=s.slice(1).join(":").trim();if(l==="color")return c.replace(/['"]+/g,"")}}}return(t=e.style.color)==null?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),SB=xi.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:e=>({chain:t})=>t().setMark("textStyle",{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),kB=xi.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),AB=xi.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:e=>({chain:t})=>t().setMark("textStyle",{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});xi.create({name:"textStyleKit",addExtensions(){const e=[];return this.options.backgroundColor!==!1&&e.push(vB.configure(this.options.backgroundColor)),this.options.color!==!1&&e.push(wB.configure(this.options.color)),this.options.fontFamily!==!1&&e.push(SB.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(kB.configure(this.options.fontSize)),this.options.lineHeight!==!1&&e.push(AB.configure(this.options.lineHeight)),this.options.textStyle!==!1&&e.push(R6.configure(this.options.textStyle)),e}});const ne={pasteInCallout:{id:"pasteInCallout",label:"Вставити з буфера",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"V"}]},newImage:{id:"newImage",label:"Нове зображення",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"N"}]},replaceBackground:{id:"replaceBackground",label:"Замінити фон",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"B"}]},toolPoint:{id:"toolPoint",label:"Точка",keys:[{kind:"key",value:"1"}]},toolNumbering:{id:"toolNumbering",label:"Нумерація",keys:[{kind:"key",value:"0"}]},toolRegion:{id:"toolRegion",label:"Район",keys:[{kind:"key",value:"2"}]},toolRoute:{id:"toolRoute",label:"Маршрут",keys:[{kind:"key",value:"3"}]},toolRectangle:{id:"toolRectangle",label:"Прямокутник",keys:[{kind:"key",value:"4"}]},toolEllipse:{id:"toolEllipse",label:"Еліпс",keys:[{kind:"key",value:"5"}]},toolArrow:{id:"toolArrow",label:"Стрілка",keys:[{kind:"key",value:"6"}]},toolText:{id:"toolText",label:"Текст",keys:[{kind:"key",value:"7"}]},toolPointText:{id:"toolPointText",label:"Точка з текстом",keys:[{kind:"key",value:"P"}]},toolImageObject:{id:"toolImageObject",label:"Додати зображення",keys:[{kind:"key",value:"I"}]},toolRedact:{id:"toolRedact",label:"Замалювати ділянку фону",keys:[{kind:"key",value:"R"}]},toolDateTime:{id:"toolDateTime",label:"Дата/час",keys:[{kind:"key",value:"8"}]},toolStandaloneCallout:{id:"toolStandaloneCallout",label:"Блок виноски",keys:[{kind:"key",value:"9"}]},toolCompass:{id:"toolCompass",label:"Компас",keys:[{kind:"key",value:"K"}]},toolStamp:{id:"toolStamp",label:"Штамп",keys:[{kind:"key",value:"S"}]},toolCrop:{id:"toolCrop",label:"Кадрування (Crop)",keys:[{kind:"key",value:"C"}]},zoomIn:{id:"zoomIn",label:"Наблизити",keys:[{kind:"plusMinus",value:"+"}]},zoomOut:{id:"zoomOut",label:"Віддалити",keys:[{kind:"plusMinus",value:"-"}]},fitToWindow:{id:"fitToWindow",label:"Припасувати розмір",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"O"}]},undo:{id:"undo",label:"Відмінити",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"Z"}]},redo:{id:"redo",label:"Повернути",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"Z"}]},downloadJpg:{id:"downloadJpg",label:"Завантажити JPG",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"D"}]},openExportMenu:{id:"openExportMenu",label:"Інші опції збереження",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"D"}]},exportMenuChooseByNumber:{id:"exportMenuChooseByNumber",label:"Вибір пункту меню цифрою",keys:[{kind:"digits",value:"1…9"}]},calloutBold:{id:"calloutBold",label:"Жирний текст",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"B"}]},calloutItalic:{id:"calloutItalic",label:"Курсив",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"I"}]},calloutUnderline:{id:"calloutUnderline",label:"Підкреслення",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"U"}]},calloutStrike:{id:"calloutStrike",label:"Закреслення",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"S"}]},calloutFontSizeDown:{id:"calloutFontSizeDown",label:"Менший шрифт",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"-"}]},calloutFontSizeUp:{id:"calloutFontSizeUp",label:"Більший шрифт",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"="}]},calloutAddText:{id:"calloutAddText",label:"Додати текст",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"T"}]},calloutAddImage:{id:"calloutAddImage",label:"Додати / змінити фото",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"I"}]},calloutRemoveText:{id:"calloutRemoveText",label:"Прибрати текст",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"X"}]},calloutRemoveImage:{id:"calloutRemoveImage",label:"Прибрати фото",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"E"}]},calloutToggleDescPos:{id:"calloutToggleDescPos",label:"Текст вгору / вниз",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"P"}]},calloutToggleTheme:{id:"calloutToggleTheme",label:"Світлий / темний фон",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"L"}]},calloutDelete:{id:"calloutDelete",label:"Видалити виноску",keys:[{kind:"key",value:"Delete"}]},calloutTogglePanel:{id:"calloutTogglePanel",label:"Згорнути / розгорнути панель",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"H"}]},calloutBringForward:{id:"calloutBringForward",label:"На рівень вище",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"]"}]},calloutSendBackward:{id:"calloutSendBackward",label:"На рівень нижче",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"["}]},calloutBringToFront:{id:"calloutBringToFront",label:"На передній план",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"]"}]},calloutSendToBack:{id:"calloutSendToBack",label:"На задній план",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"["}]},objectCopy:{id:"objectCopy",label:"Копіювати обʼєкт",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"C"}]},objectDuplicate:{id:"objectDuplicate",label:"Дублювати обʼєкт",keys:[{kind:"cmdOrCtrl"},{kind:"key",value:"J"}]},objectPaste:{id:"objectPaste",label:"Вставити обʼєкт",keys:[{kind:"cmdOrCtrl"},{kind:"shift"},{kind:"key",value:"V"}]}};function kd(){return/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function Qe(e,t){const n=t?.isMac??kd();return e.keys.map(i=>i.kind==="cmdOrCtrl"?n?"⌘":"Ctrl":i.kind==="shift"?n?"⇧":"Shift":i.kind==="plusMinus"||i.kind==="digits"?i.value:i.value.toUpperCase()).join(n?"":"+")}function O6(e,t){if(!t||t.length===0)return e;for(const n of["","+"]){const r=` (${t.join(n)})`;if(e.endsWith(r))return e.slice(0,-r.length)}return e}function Ei(e,t){const n=t?.isMac??kd();return e.keys.map(r=>r.kind==="cmdOrCtrl"?n?"⌘":"Ctrl":r.kind==="shift"?n?"⇧":"Shift":r.kind==="plusMinus"||r.kind==="digits"?r.value:r.value.toUpperCase())}const dl={minWidth:16,height:16,paddingV:0,paddingH:4,borderRadius:4,fontSize:11,translateY:-.5},_k={display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:dl.minWidth,height:dl.height,padding:`0 ${dl.paddingH}px`,borderRadius:dl.borderRadius,border:"1px solid rgba(255,255,255,0.2)",background:"rgba(255,255,255,0.06)",color:"rgba(255,255,255,0.6)",fontSize:dl.fontSize,fontWeight:900,lineHeight:1,letterSpacing:"0.02em",transform:`translateY(${dl.translateY}px)`,userSelect:"none",boxShadow:"0 1px 0 0 rgba(255,255,255,0.2)"};function Hl({children:e,title:t,scale:n=1}){const r=n,i=r===1?_k:{..._k,minWidth:dl.minWidth*r,height:dl.height*r,padding:`${dl.paddingV*r}px ${dl.paddingH*r}px`,borderRadius:dl.borderRadius*r,fontSize:dl.fontSize*r,transform:`translateY(${dl.translateY*r}px)`};return A.jsx("span",{style:i,title:t,children:e})}const W0="tyts-callout-insert-plain-text",q5="application/x-tyts-media",MB=/\.(png|jpe?g|svg|webp|gif|avif|bmp)$/i;function $5(e){return e?(e.items&&e.items.length>0?Array.from(e.items).filter(n=>n.kind==="file").map(n=>n.getAsFile()).filter(n=>!!n):Array.from(e.files??[])).filter(n=>n.type.startsWith("image/")||MB.test(n.name)):[]}function CB(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function EB(e){const t=e.replace(/\r\n?/g,`
233
+ `).replace(/^\n+|\s+$/g,"");return t?t.split(`
234
+ `).map(n=>n.trim()?`<p>${CB(n)}</p>`:"<p></p>").join(""):""}function TB(e){const t={};e.image&&(t.image=e.image,t.imageAspect=e.imageAspect);const n=EB(e.text);return n&&(t.description=n),t}const P6="data-tyts-media-panel";function zg(e){return e instanceof Element&&e.closest(`[${P6}]`)!==null}function NB(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const _B=8,df=18*vn,j6=5*vn,DB=Math.max(j6,18*vn),LB=1.5*vn,RB="#1a1a2e",OB=.45,PB="rgba(0,0,0,0.001)",Dk="blur(12px)",Lk=2*vn,jB=2*vn,IB="88",Rk="33",zB=10*vn,BB="1.5em",FB="#d0d0d0",UB="#111111",HB="rgba(10,10,16,0.88)",qB="rgba(245,245,250,0.98)",Ok=4*vn,$B=4*vn,YB=`${2*vn}px ${6*vn}px`,VB=10*vn,WB=4*vn,XB="rgba(0,0,0,0.6)",GB="#ddd",Pk=8*vn,KB=14*vn,JB="#888",ZB=8*vn,QB=12*vn,t9="rgba(255,255,255,0.5)",e9=2,n9=1*vn,jk={background:Ch,border:dh,color:t1,cursor:"pointer",borderRadius:em,fontSize:nm,padding:zD,fontFamily:"inherit",display:"inline-flex",alignItems:"center",gap:6*vn},I6=rm,r9=4*vn,wg={minWidth:I6,height:rm,background:Ch,border:dh,color:t1,cursor:"pointer",borderRadius:em,fontSize:nm,padding:jA,fontFamily:"inherit",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,boxSizing:"border-box"},i9="1px solid rgba(255,255,255,0.4)",Ik=18*vn,o9=3*vn,s9=10*vn,a9="1px solid rgba(255,255,255,0.25)",l9="#f5f5fa",c9="#111",u9="#111",f9="#fff";function T2(e){return e*(ph+$D)}const d9=[{id:"nw",cx:0,cy:0,cursor:"nwse-resize"},{id:"n",cx:.5,cy:0,cursor:"ns-resize"},{id:"ne",cx:1,cy:0,cursor:"nesw-resize"},{id:"e",cx:1,cy:.5,cursor:"ew-resize"},{id:"se",cx:1,cy:1,cursor:"nwse-resize"},{id:"s",cx:.5,cy:1,cursor:"ns-resize"},{id:"sw",cx:0,cy:1,cursor:"nesw-resize"},{id:"w",cx:0,cy:.5,cursor:"ew-resize"}];function h9(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,r)=>n.x===t[r].x&&n.y===t[r].y)}const p9=eu.memo(function({pin:t,position:n,imageSize:r,active:i,isSelected:s,justCreated:l,fontFamily:c,strokeWidthScale:f=1,controlsLayer:d,leaderPath:p,controlsCollapsed:g=!1,onToggleControlsCollapsed:b,onUpdateDescription:y,onUpdateImage:M,onClearImage:E,onApplyMedia:D,onDragStart:L,onResizeStart:q,onActivate:$,onUpdateColor:Y,onUpdateStrokeStyle:ht,onUpdateFillStyle:Mt,onUpdateStrokeWidthScale:vt,onContextMenu:bt,onToggleDescPos:rt,onToggleTheme:Dt,onHide:Q,onAddLinked:lt,onDelete:X,onUpdateTextStyle:wt,onUpdateTextFontSize:Tt}){const yt=Xt=>Xt,J=I.useRef(null),ct=I.useRef(null),[Bt,te]=I.useState(!1),Z=I.useRef(null),[P,j]=I.useState(()=>t.description.trim().length>0),G=t.description.trim().length>0,ut=!!t.image,xt=Q0(t.anchor),St=nb(t.anchor),Ft=(t.strokeStyle??ed)==="dashed",Rt=(t.fillStyle??Fp)==="none",Qt=aA(t.anchor),ve=t.strokeWidthScale!==void 0,je=(f-ml)/(Bu-ml)*100,Pe=(t.textFontSize??Va)*Q4,Ve=t.anchor.type==="standalone"?"Блок виноски":`Виноска ${t.label}`,ft=t.theme==="light"&&G,Oe=t.textColor??(ft?UB:FB),In=t.textBackgroundColor===null?"transparent":t.textBackgroundColor??(ft?qB:HB),fe=_I({extensions:[yB,R6],content:t.description||"",autofocus:!1,editorProps:{attributes:{style:["width: 100%",`min-height: ${BB}`,"background: transparent","border: none","outline: none",`color: ${Oe}`,`font-size: ${Pe}px`,`line-height: ${$g}`,`font-family: ${c}`,"direction: ltr","unicode-bidi: plaintext","text-align: left","white-space: pre-wrap","word-break: break-word"].join("; ")}},onUpdate({editor:Xt}){let Re=Xt.getHTML();(Re==="<p></p>"||Re===`<p></p>
235
+ `)&&(Re=""),y(t.id,Re),!P&&Re.trim().length>0&&j(!0)}});I.useEffect(()=>{if(!fe)return;const Xt=fe.getHTML();(Xt==="<p></p>"?"":Xt)!==t.description&&fe.commands.setContent(t.description||"",{emitUpdate:!1})},[fe,t.description]);const ge=I.useCallback(Xt=>Math.max(zB,Xt),[]),Te=I.useCallback(Xt=>{if(!G||!fe)return;const Re=fe.state.selection;if(!Re.empty&&Re.from!==Re.to){const De=fe.getAttributes("textStyle"),or=De?.fontSize?Number.parseFloat(De.fontSize):Number.NaN,Hn=Number.isFinite(or)?or:Pe,lr=ge(Hn+Xt*vn);fe.chain().focus().setMark("textStyle",{fontSize:`${lr}px`}).run();return}Tt&&Tt(t.id,Xt)},[G,fe,Pe,ge,Tt,t.id]),[Ne,_e]=I.useState(null);I.useEffect(()=>{if(!fe)return;const Xt=()=>{const Re=fe.state.selection;if(Re.empty||Re.from===Re.to){_e(null);return}const Ae=fe.getAttributes("textStyle"),De=Ae?.fontSize?Number.parseFloat(Ae.fontSize):Number.NaN;_e(Number.isFinite(De)?De:null)};return Xt(),fe.on("selectionUpdate",Xt),fe.on("transaction",Xt),()=>{fe.off("selectionUpdate",Xt),fe.off("transaction",Xt)}},[fe]);const Ye=Math.round((Ne??Pe)/vn),un=I.useCallback(()=>{$(t.id),j(!0),requestAnimationFrame(()=>{fe?.commands.focus("end")})},[$,t.id,fe]);I.useEffect(()=>{if(fe){if(!i&&!s){fe.commands.blur();return}s&&!i&&fe.isFocused&&fe.commands.blur()}},[i,s,fe]),I.useEffect(()=>{if(!i||!fe)return;const Xt=Re=>{const Ae=Re;if(Ae.detail?.pinId!==t.id)return;const De=Ae.detail.text??"";if(!De.trim())return;j(!0);const or=()=>{if(!fe||fe.isDestroyed)return;fe.isFocused||fe.commands.focus("end");const Hn=NB(De);fe.chain().focus().insertContent(Hn).run()};requestAnimationFrame(()=>requestAnimationFrame(or))};return document.addEventListener(W0,Xt),()=>document.removeEventListener(W0,Xt)},[i,fe,t.id]),I.useEffect(()=>{if(!l||!fe)return;$(t.id);const Xt=setTimeout(()=>{document.activeElement?.blur?.(),fe.commands.focus("end")},0);return()=>clearTimeout(Xt)},[l,t.id,$,fe]);const Fn=(i||s)&&!!fe;I.useEffect(()=>{if(!Fn||!fe)return;const Xt=Re=>{const Ae=Re.target;Ae&&(Ae.tagName==="TEXTAREA"||Ae.tagName==="INPUT"&&Ae!==Z.current||Ae.getAttribute?.("contenteditable")==="true")||Re.ctrlKey||Re.metaKey||Re.altKey||Re.key.length===1&&(fe.isFocused||(Re.preventDefault(),Re.stopPropagation(),$(t.id),fe.chain().focus().insertContent(Re.key).run(),j(!0)))};return window.addEventListener("keydown",Xt,!0),()=>window.removeEventListener("keydown",Xt,!0)},[Fn,t.id,$,fe]);const Ue=kd();I.useEffect(()=>{if(!i||!Y||!rt||!X)return;const Xt=Ue?De=>De.metaKey:De=>De.ctrlKey,Re=(De,or)=>De.code===`Key${or.toUpperCase()}`||!De.code&&De.key.toLowerCase()===or,Ae=De=>{const or=De.key,Hn=Xt(De),lr=De.shiftKey;if(Hn&&!lr&&Re(De,"b")){De.preventDefault(),De.stopPropagation(),G&&fe&&fe.chain().focus().toggleBold().run();return}if(Hn&&!lr&&Re(De,"i")){De.preventDefault(),De.stopPropagation(),G&&fe&&fe.chain().focus().toggleItalic().run();return}if(Hn&&!lr&&Re(De,"u")){De.preventDefault(),De.stopPropagation(),G&&fe&&fe.chain().focus().toggleUnderline?.().run?.();return}if(Hn&&lr&&Re(De,"s")){De.preventDefault(),De.stopPropagation(),G&&fe&&fe.chain().focus().toggleStrike?.().run?.();return}if(Hn&&(or==="-"||or==="Minus")){De.preventDefault(),De.stopPropagation(),Te(-2);return}if(Hn&&(or==="="||or==="+")){De.preventDefault(),De.stopPropagation(),Te(2);return}if(Hn&&lr&&Re(De,"t")){De.preventDefault(),De.stopPropagation(),$(t.id),j(!0),requestAnimationFrame(()=>fe?.commands.focus("end"));return}if(Hn&&lr&&Re(De,"i")){De.preventDefault(),De.stopPropagation(),ct.current?.click();return}if(Hn&&lr&&Re(De,"x")){De.preventDefault(),De.stopPropagation(),y(t.id,""),j(!1);return}if(Hn&&lr&&Re(De,"e")){De.preventDefault(),De.stopPropagation(),ut&&E&&E(t.id);return}if(Hn&&lr&&Re(De,"p")){De.preventDefault(),De.stopPropagation(),ut&&(G||P)&&rt(t.id);return}if(Hn&&lr&&Re(De,"l")){De.preventDefault(),De.stopPropagation(),G&&Dt&&Dt(t.id);return}or==="Delete"&&(De.preventDefault(),De.stopPropagation(),X(t.id))};return window.addEventListener("keydown",Ae,!0),()=>window.removeEventListener("keydown",Ae,!0)},[i,t.id,G,ut,P,Ue,$,y,rt,Dt,X,E,Tt,Y,fe,Te]);const{x:_n,y:dn,width:Be,height:We}=n,{w:Ie,h:kr}=r,Cn=T2(1),nn=T2(2),ln=T2(3),Ln=_n+Be+nn+ph>Ie,Ke=I.useCallback(Xt=>["TEXTAREA","BUTTON","INPUT","LABEL"].includes(Xt.tagName)||Xt.getAttribute("contenteditable")==="true"||!!Xt.closest('[contenteditable="true"]')||!!Xt.closest(".ProseMirror"),[]),ar=I.useCallback(Xt=>{L(t.id,yt(Xt))},[L,t.id]),[wn,Sn]=I.useState(1),gr=I.useRef(null),En=I.useCallback(()=>{const Xt=gr.current;if(!Xt)return;const Re=Math.ceil(Xt.getBoundingClientRect().height),Ae=Math.ceil(Xt.scrollHeight),De=Math.max(1,Re,Ae);Sn(or=>or!==De?De:or)},[]);I.useLayoutEffect(()=>{if(!i)return;const Xt=gr.current;if(!Xt)return;En();const Re=requestAnimationFrame(()=>{En(),requestAnimationFrame(En)}),Ae=new ResizeObserver(()=>En());return Ae.observe(Xt),()=>{cancelAnimationFrame(Re),Ae.disconnect()}},[i,g,ut,G,P,t.theme,t.descPos,En]);const en=I.useCallback(()=>{},[]);I.useEffect(()=>{(P||G)&&en()},[P,G,en,We]);const Kn=Xt=>{const Re=Xt.target.files?.[0];if(!Re)return;const Ae=new FileReader;Ae.onload=De=>M(t.id,De.target?.result),Ae.readAsDataURL(Re),Xt.target.value=""},ws=t.image?A.jsx("div",{style:{width:"100%",flex:G||P?"1 1 auto":"1 1 100%",minHeight:nA,background:`url(${t.image}) center/cover no-repeat`,position:"relative",borderTop:t.descPos==="above"&&(G||P)?`1px solid ${t.color}${Rk}`:"none",borderBottom:t.descPos==="below"&&(G||P)?`1px solid ${t.color}${Rk}`:"none",boxSizing:"border-box"},children:A.jsxs("label",{style:{position:"absolute",bottom:Ok,right:Ok,cursor:"pointer",background:XB,borderRadius:$B,padding:YB,fontSize:VB,color:GB,display:"inline-flex",alignItems:"center",gap:WB},children:[A.jsx("i",{className:`${_r} bi-arrow-repeat`,style:{fontSize:Hr},"aria-hidden":!0}),"замінити (",ih(),")",A.jsx("input",{type:"file",accept:"image/*",style:{display:"none"},onChange:Kn})]})}):null,qi=G||P||!ut?A.jsx("div",{style:{flex:ut?"0 0 auto":"1 1 auto",padding:`${t5}px ${e5}px ${iA}px`,overflow:"hidden",minHeight:"1.5em",height:ut?"auto":"100%",display:"flex",flexDirection:"column",boxSizing:"border-box"},children:P||G?A.jsx("div",{style:{position:"relative",width:"100%",height:"100%",flex:"1 1 auto",display:"flex",flexDirection:"column"},children:fe&&A.jsx(t6,{editor:fe,className:"tyts-no-scrollbar",onContextMenu:Xt=>Xt.preventDefault(),onPointerDown:()=>{$(t.id)},onMouseDown:()=>{$(t.id)},onDoubleClick:Xt=>{Xt.stopPropagation(),un()},style:{width:"100%",minHeight:"1.5em",flex:"1 1 auto",height:"100%",overflowY:"auto",boxSizing:"border-box",userSelect:"text",WebkitUserSelect:"text",WebkitTouchCallout:"default"}})}):ut?null:A.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:Pk,color:JB,fontSize:KB},children:[A.jsxs("div",{style:{display:"flex",gap:Pk},children:[!ut&&A.jsxs("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onMouseDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),$(t.id),ct.current?.click()},style:jk,children:[A.jsx("i",{className:`${_r} bi-plus-lg-lg`,style:{fontSize:Hr},"aria-hidden":!0}),A.jsx("i",{className:`${_r} bi-image`,style:{fontSize:Hr},"aria-hidden":!0}),"Фото"]}),A.jsxs("button",{type:"button",onPointerDown:Xt=>Xt.stopPropagation(),onMouseDown:Xt=>Xt.stopPropagation(),onClick:Xt=>{Xt.stopPropagation(),un()},style:jk,children:[A.jsx("i",{className:`${_r} bi-plus-lg`,style:{fontSize:Hr},"aria-hidden":!0}),A.jsx("i",{className:`${_r} bi-type`,style:{fontSize:Hr},"aria-hidden":!0}),"Текст"]})]}),A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:ZB,fontSize:QB,color:t9,marginTop:e9},children:["Або вставте з буфера"," ",Ei(ne.pasteInCallout,{isMac:kd()}).map(Xt=>A.jsx(Hl,{title:ih(),scale:n9,children:Xt},Xt))]})]})}):null;return A.jsxs("g",{onContextMenu:bt?Xt=>bt(t.id,Xt):void 0,children:[A.jsx("foreignObject",{x:_n,y:dn,width:Be,height:We,style:{overflow:"visible"},onPointerDown:Xt=>{Xt.stopPropagation(),$(t.id);const Re=Xt.target;if(Ke(Re)){J.current={pointerId:Xt.pointerId,pointerType:Xt.pointerType,startX:Xt.clientX,startY:Xt.clientY};return}ar(Xt)},onPointerMove:Xt=>{const Re=J.current;if(!Re||Re.pointerId!==Xt.pointerId)return;const Ae=window.getSelection();if(Re.pointerType==="mouse"&&Ae&&!Ae.isCollapsed&&Ae.toString().trim().length>0){J.current=null;return}const De=Xt.clientX-Re.startX,or=Xt.clientY-Re.startY;Math.hypot(De,or)<_B||(J.current=null,ar(Xt))},onPointerUp:Xt=>{J.current?.pointerId===Xt.pointerId&&(J.current=null)},onPointerCancel:Xt=>{J.current?.pointerId===Xt.pointerId&&(J.current=null)},onMouseDown:Xt=>{Xt.stopPropagation(),$(t.id);const Re=Xt.target;Ke(Re)||L(t.id,Xt)},children:A.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{width:"100%",height:"100%",border:`${rA*sA(f)}px solid ${t.color}`,borderRadius:Z2,background:In,backdropFilter:Dk,WebkitBackdropFilter:Dk,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:c,cursor:"grab",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",outline:Bt?`${Lk}px dashed ${t.color}`:i?`${Lk}px solid ${t.color}${IB}`:"none",outlineOffset:jB},onDragOver:Xt=>{Xt.preventDefault(),Xt.stopPropagation(),Xt.dataTransfer.dropEffect="copy",D&&Xt.dataTransfer.types.includes(q5)&&te(!0)},onDragLeave:Xt=>{Xt.currentTarget.contains(Xt.relatedTarget)||te(!1)},onDrop:Xt=>{Xt.preventDefault(),Xt.stopPropagation(),te(!1);const Re=Xt.dataTransfer.getData(q5);if(Re){D?.(t.id,Re);return}$(t.id);const Ae=Xt.dataTransfer.files?.[0];if(Ae?.type.startsWith("image/")){const De=new FileReader;De.onload=or=>{const Hn=or.target?.result;Hn&&M(t.id,Hn)},De.readAsDataURL(Ae)}},children:[A.jsx("input",{ref:Z,type:"text",readOnly:!0,tabIndex:0,"aria-label":Ve,style:{position:"absolute",left:0,top:0,width:1,height:1,opacity:0,pointerEvents:"none",padding:0,margin:0,border:"none",outline:"none"}}),A.jsx("input",{ref:ct,type:"file",accept:"image/*",style:{display:"none"},onChange:Kn}),A.jsxs("div",{style:{display:"flex",flexDirection:t.descPos==="above"?"column":"column-reverse",height:"100%"},children:[qi,ws]}),A.jsx("div",{"data-drag-hit-zone":"top",style:{position:"absolute",top:0,left:0,right:0,height:df,cursor:"grab",background:"transparent"},onPointerDown:Xt=>{Xt.stopPropagation(),Xt.pointerType==="touch"&&($(t.id),ar(Xt))}}),A.jsx("div",{"data-drag-hit-zone":"bottom",style:{position:"absolute",bottom:0,left:0,right:0,height:df,cursor:"grab",background:"transparent"},onPointerDown:Xt=>{Xt.stopPropagation(),Xt.pointerType==="touch"&&($(t.id),ar(Xt))}}),A.jsx("div",{"data-drag-hit-zone":"left",style:{position:"absolute",top:df,bottom:df,left:0,width:df,cursor:"grab",background:"transparent"},onPointerDown:Xt=>{Xt.stopPropagation(),Xt.pointerType==="touch"&&($(t.id),ar(Xt))}}),A.jsx("div",{"data-drag-hit-zone":"right",style:{position:"absolute",top:df,bottom:df,right:0,width:df,cursor:"grab",background:"transparent"},onPointerDown:Xt=>{Xt.stopPropagation(),Xt.pointerType==="touch"&&($(t.id),ar(Xt))}})]})}),i&&Y&&rt&&X&&(()=>{if(g){const Wt=ph,qr=Vg({card:{x:_n,y:dn,width:Be,height:We},panel:{w:Wt,h:Wt},gap:Kg,bounds:{w:Ie,h:kr},leader:p,margin:{top:ag,bottom:ag}}),er=A.jsx("foreignObject",{x:qr.x,y:qr.y,width:Wt,height:Wt,style:{overflow:"visible",outline:"none"},onPointerDown:Rn=>Rn.stopPropagation(),onMouseDown:Rn=>Rn.stopPropagation(),children:A.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",children:A.jsx("button",{type:"button",onPointerDown:Rn=>Rn.stopPropagation(),onClick:Rn=>{Rn.stopPropagation(),b?.()},title:`Показати панель (${Qe(ne.calloutTogglePanel,{isMac:Ue})})`,style:{...gp,position:"static",transform:"none"},children:A.jsx("i",{className:`${_r} bi-sliders`,style:{fontSize:Hr},"aria-hidden":!0})})})});return d?mh.createPortal(er,d):er}const Xt=(xt&&ht?1:0)+(St&&Mt?1:0),Re=Wa.length+Xt,De=Re*mo+(Re-1)*Zg+Jg*2,or=ln,Hn=Vg({card:{x:_n,y:dn,width:Be,height:We},panel:{w:De,h:wn},gap:Kg,bounds:{w:Ie,h:kr},leader:p,margin:{left:Ln?or:0,right:Ln?0:or,top:ag,bottom:ag}}),lr=Hn.above,Wr=Hn.y,Dr=Hn.x,vi=A.jsx("foreignObject",{x:Dr,y:Wr,width:De,height:wn,style:{overflow:"visible",outline:"none"},onPointerDown:Wt=>Wt.stopPropagation(),onMouseDown:Wt=>Wt.stopPropagation(),children:A.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{display:"flex",flexDirection:"column",justifyContent:lr?"flex-end":"flex-start",width:"100%",height:"100%"},children:A.jsxs("div",{ref:gr,style:{display:"flex",flexDirection:"column",gap:AA,width:"100%",padding:Jg,boxSizing:"border-box",background:EA,borderRadius:MA,border:TA,fontFamily:c,fontSize:CA,position:"relative"},children:[b&&A.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),b()},title:`Згорнути панель (${Qe(ne.calloutTogglePanel,{isMac:Ue})})`,style:{position:"absolute",top:-wf/2,right:-wf/2,width:wf,height:wf,borderRadius:"50%",background:i0,border:ib,color:ob,cursor:"pointer",padding:0,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:sb},children:A.jsx("i",{className:`${_r} bi-dash-lg`,style:{fontSize:kA},"aria-hidden":!0})}),A.jsxs("div",{style:{display:"flex",gap:Zg,justifyContent:"center"},children:[Wa.map(Wt=>A.jsx("button",{type:"button",onPointerDown:qr=>qr.stopPropagation(),onClick:qr=>{qr.stopPropagation(),Y(t.id,Wt)},title:Wt,style:{width:mo,height:mo,borderRadius:"50%",background:Wt,border:t.color===Wt?ch:NA,cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0}},Wt)),xt&&ht&&A.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),ht(t.id,Ft?"solid":"dashed")},onMouseDown:Wt=>Wt.preventDefault(),"aria-label":"Перемикач стилю обводки",title:Ft?"Змінити на суцільну обводку":"Змінити на пунктирну обводку",style:{width:mo,height:mo,borderRadius:"50%",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0,background:Qg,border:Ft?ch:t0,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:A.jsx("svg",{width:mo-Sf,height:mo-Sf,viewBox:"0 0 16 16","aria-hidden":!0,children:A.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:n0,strokeWidth:e0,strokeDasharray:_A})})}),St&&Mt&&A.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),Mt(t.id,Rt?"filled":"none")},onMouseDown:Wt=>Wt.preventDefault(),"aria-label":"Перемикач фону фігури",title:Rt?"Додати фон фігури":"Прибрати фон фігури",style:{width:mo,height:mo,borderRadius:"50%",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0,background:Qg,border:Rt?ch:t0,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:A.jsx("svg",{width:mo-Sf,height:mo-Sf,viewBox:"0 0 16 16","aria-hidden":!0,children:A.jsx("rect",{x:"3",y:"3",width:"10",height:"10",fill:"none",stroke:n0,strokeWidth:e0})})})]}),Qt&&vt&&A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:Ap},children:[A.jsx("i",{className:`${_r} bi-border-width`,style:{fontSize:Hr,color:hh,flexShrink:0},"aria-hidden":!0}),A.jsx("input",{type:"range",min:ml,max:Bu,step:K0,value:f,"aria-label":"Товщина ліній виноски",title:"Товщина контуру, лінії та маркера",onPointerDown:Wt=>Wt.stopPropagation(),onMouseDown:Wt=>Wt.stopPropagation(),onChange:Wt=>vt(t.id,Number(Wt.target.value)),className:"tyts-range",style:{flex:1,minWidth:0,"--tyts-range-accent":t.color,"--tyts-range-bg":Ch,"--tyts-range-track":`${LA}px`,"--tyts-range-thumb":`${DA}px`,"--tyts-range-fill":`${je}%`}}),A.jsxs("span",{style:{color:hh,fontSize:RA,fontVariantNumeric:"tabular-nums",minWidth:OA,textAlign:"right",flexShrink:0},children:["×",J0(f)]}),ve&&A.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onMouseDown:Wt=>Wt.preventDefault(),onClick:Wt=>{Wt.stopPropagation(),vt(t.id,null)},title:"Повернути глобальну товщину","aria-label":"Повернути глобальну товщину",style:PA,children:A.jsx("i",{className:`${_r} bi-arrow-counterclockwise`,style:{fontSize:Hr},"aria-hidden":!0})})]}),(ut&&!G||!ut&&G||ut&&(G||P)||G&&wt&&Tt&&fe||G&&Dt)&&A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:Ap,flexShrink:0,flexWrap:"wrap",overflowX:"visible",rowGap:Ap},children:[ut&&!G&&!P&&A.jsxs(A.Fragment,{children:[A.jsxs("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),$(t.id),j(!0)},title:`Додати текст (${Qe(ne.calloutAddText,{isMac:Ue})})`,style:pp,children:[A.jsx("i",{className:`${_r} bi-type`,style:{fontSize:Hr},"aria-hidden":!0}),A.jsx("i",{className:`${_r} bi-plus-lg`,style:{fontSize:Hr},"aria-hidden":!0})]}),E&&A.jsxs("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),E(t.id)},title:`Прибрати фото (${Qe(ne.calloutRemoveImage,{isMac:Ue})})`,style:mp,children:[A.jsx("i",{className:`${_r} bi-image`,style:{fontSize:Hr},"aria-hidden":!0}),A.jsx("i",{className:`${_r} bi-x-lg`,style:{fontSize:Hr},"aria-hidden":!0})]})]}),!ut&&G&&A.jsxs(A.Fragment,{children:[A.jsxs("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),ct.current?.click()},onMouseDown:Wt=>Wt.preventDefault(),title:`Додати фото (${ih()} або ${Qe(ne.calloutAddImage,{isMac:Ue})})`,style:pp,children:[A.jsx("i",{className:`${_r} bi-image`,style:{fontSize:Hr},"aria-hidden":!0}),A.jsx("i",{className:`${_r} bi-plus-lg`,style:{fontSize:Hr},"aria-hidden":!0})]}),A.jsxs("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),y(t.id,""),j(!1)},onMouseDown:Wt=>Wt.preventDefault(),title:`Прибрати текст (${Qe(ne.calloutRemoveText,{isMac:Ue})})`,style:mp,children:[A.jsx("i",{className:`${_r} bi-type`,style:{fontSize:Hr},"aria-hidden":!0}),A.jsx("i",{className:`${_r} bi-x-lg`,style:{fontSize:Hr},"aria-hidden":!0})]})]}),ut&&(G||P)&&A.jsxs(A.Fragment,{children:[A.jsxs("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),ct.current?.click()},onMouseDown:Wt=>Wt.preventDefault(),title:`Змінити фото (${ih()} або ${Qe(ne.calloutAddImage,{isMac:Ue})})`,style:pp,children:[A.jsx("i",{className:`${_r} bi-image`,style:{fontSize:Hr},"aria-hidden":!0}),A.jsx("i",{className:`${_r} bi-arrow-repeat`,style:{fontSize:Hr},"aria-hidden":!0})]}),A.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),rt(t.id)},onMouseDown:Wt=>Wt.preventDefault(),title:`${t.descPos==="above"?"Текст вниз":"Текст вгору"} (${Qe(ne.calloutToggleDescPos,{isMac:Ue})})`,style:pp,children:A.jsx("i",{className:`${_r} ${t.descPos==="above"?"bi-arrow-bar-down":"bi-arrow-bar-up"}`,style:{fontSize:Hr},"aria-hidden":!0})}),A.jsxs("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),y(t.id,""),j(!1)},onMouseDown:Wt=>Wt.preventDefault(),title:`Прибрати текст (${Qe(ne.calloutRemoveText,{isMac:Ue})})`,style:mp,children:[A.jsx("i",{className:`${_r} bi-type`,style:{fontSize:Hr},"aria-hidden":!0}),A.jsx("i",{className:`${_r} bi-x-lg`,style:{fontSize:Hr},"aria-hidden":!0})]}),E&&A.jsxs("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),E(t.id)},title:`Прибрати фото (${Qe(ne.calloutRemoveImage,{isMac:Ue})})`,style:mp,children:[A.jsx("i",{className:`${_r} bi-image`,style:{fontSize:Hr},"aria-hidden":!0}),A.jsx("i",{className:`${_r} bi-x-lg`,style:{fontSize:Hr},"aria-hidden":!0})]})]}),G&&wt&&Tt&&fe&&A.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:r9,flexWrap:"wrap"},children:[A.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),fe.chain().focus().toggleBold().run()},onMouseDown:Wt=>Wt.preventDefault(),title:`Жирний текст (${Qe(ne.calloutBold,{isMac:Ue})})`,style:{...wg,fontWeight:700},children:"B"}),A.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),fe.chain().focus().toggleItalic().run()},onMouseDown:Wt=>Wt.preventDefault(),title:`Курсив (${Qe(ne.calloutItalic,{isMac:Ue})})`,style:{...wg,fontStyle:"italic"},children:"I"}),A.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),fe.chain().focus().toggleUnderline?.().run?.()},onMouseDown:Wt=>Wt.preventDefault(),title:`Підкреслення (${Qe(ne.calloutUnderline,{isMac:Ue})})`,style:{...wg,textDecoration:"underline"},children:"U"}),A.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),fe.chain().focus().toggleStrike?.().run?.()},onMouseDown:Wt=>Wt.preventDefault(),title:`Закреслення (${Qe(ne.calloutStrike,{isMac:Ue})})`,style:{...wg,textDecoration:"line-through"},children:"S"}),A.jsxs("div",{style:zA,role:"group","aria-label":"Розмір шрифту",children:[A.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),Te(-2)},onMouseDown:Wt=>Wt.preventDefault(),title:`Менший шрифт (${Qe(ne.calloutFontSizeDown,{isMac:Ue})})`,"aria-label":"Менший шрифт",style:r0,children:"−"}),A.jsx("span",{style:BA,"aria-live":"polite",children:Ye}),A.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),Te(2)},onMouseDown:Wt=>Wt.preventDefault(),title:`Більший шрифт (${Qe(ne.calloutFontSizeUp,{isMac:Ue})})`,"aria-label":"Більший шрифт",style:r0,children:"+"})]})]}),G&&Dt&&A.jsx("button",{type:"button",onPointerDown:Wt=>Wt.stopPropagation(),onClick:Wt=>{Wt.stopPropagation(),Dt(t.id)},onMouseDown:Wt=>Wt.preventDefault(),title:`${ft?"Світлий фон, темний текст":"Темний фон, світлий текст"} (${Qe(ne.calloutToggleTheme,{isMac:Ue})})`,style:{width:I6,height:rm,borderRadius:em,background:"transparent",border:i9,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,cursor:"pointer",padding:0,boxSizing:"border-box"},children:A.jsx("span",{style:{width:Ik,height:Ik,borderRadius:o9,background:ft?l9:c9,color:ft?u9:f9,border:a9,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:s9,fontWeight:700,lineHeight:1},children:"Aa"})})]}),Q&&A.jsx("button",{type:"button",onPointerDown:Wt=>{Wt.stopPropagation()},onClick:Wt=>{Wt.stopPropagation(),Q(t.id)},title:"Приховати виноску",style:{...gp,right:Ln?"auto":-nn,left:Ln?-nn:"auto"},children:A.jsx("i",{className:`${_r} bi-eye-slash`,style:{fontSize:Hr},"aria-hidden":!0})}),lt&&A.jsx("button",{type:"button",onPointerDown:Wt=>{Wt.stopPropagation()},onClick:Wt=>{Wt.stopPropagation(),lt(t.id)},title:"Додати ще одну виноску до цієї фігури",style:{...gp,right:Ln?"auto":-ln,left:Ln?-ln:"auto"},children:A.jsx("i",{className:`${_r} bi-plus-lg`,style:{fontSize:Hr},"aria-hidden":!0})}),A.jsx("button",{type:"button",onPointerDown:Wt=>{Wt.stopPropagation()},onClick:Wt=>{Wt.stopPropagation(),X(t.id)},title:`Видалити виноску (${Qe(ne.calloutDelete,{isMac:Ue})})`,style:{...gp,right:Ln?"auto":-Cn,left:Ln?-Cn:"auto",border:HS,color:l5},onMouseEnter:Wt=>{Wt.currentTarget.style.background=YD,Wt.currentTarget.style.border=VD,Wt.currentTarget.style.color=WD},onMouseLeave:Wt=>{Wt.currentTarget.style.background=i0,Wt.currentTarget.style.border=HS,Wt.currentTarget.style.color=l5},children:A.jsx("i",{className:`${_r} bi-trash`,style:{fontSize:Hr},"aria-hidden":!0})})]})})});return d?mh.createPortal(vi,d):vi})(),d9.map(Xt=>A.jsxs("g",{children:[A.jsx("circle",{cx:_n+Xt.cx*Be,cy:dn+Xt.cy*We,r:DB,fill:PB,stroke:"none","data-resize-handle-hit":Xt.id,style:{cursor:Xt.cursor},onPointerDown:Re=>{Re.stopPropagation(),$(t.id),q(t.id,Xt.id,yt(Re))},onMouseDown:Re=>{Re.stopPropagation(),$(t.id),q(t.id,Xt.id,Re)}}),A.jsx("circle",{cx:_n+Xt.cx*Be,cy:dn+Xt.cy*We,r:j6,fill:i?t.color:RB,stroke:t.color,strokeWidth:LB,opacity:i?1:OB,pointerEvents:"none"})]},Xt.id))]})},(e,t)=>e.pin===t.pin&&e.position===t.position&&e.active===t.active&&e.isSelected===t.isSelected&&e.imageSize===t.imageSize&&e.justCreated===t.justCreated&&e.controlsCollapsed===t.controlsCollapsed&&h9(e.leaderPath,t.leaderPath)),$a=e=>e.stopPropagation(),zk={xmlns:"http://www.w3.org/1999/xhtml"},m9=eu.memo(function({pin:t,bbox:n,imageSize:r,strokeWidthScale:i,fontFamily:s,controlsLayer:l,controlsCollapsed:c=!1,onToggleControlsCollapsed:f,onUpdateColor:d,onUpdateStrokeStyle:p,onUpdateFillStyle:g,onUpdateStrokeWidthScale:b,onShowCallout:y,onDelete:M}){const E=kd(),D=Q0(t.anchor)&&!!p,L=nb(t.anchor)&&!!g,q=aA(t.anchor)&&!!b,$=(t.strokeStyle??ed)==="dashed",Y=(t.fillStyle??Fp)==="none",ht=t.strokeWidthScale!==void 0,Mt=(i-ml)/(Bu-ml)*100,[vt,bt]=I.useState(1),rt=I.useRef(null),Dt=I.useCallback(()=>{const J=rt.current;if(!J)return;const ct=Math.max(1,Math.ceil(J.getBoundingClientRect().height),Math.ceil(J.scrollHeight));bt(Bt=>Bt!==ct?ct:Bt)},[]);I.useLayoutEffect(()=>{const J=rt.current;if(!J)return;Dt();const ct=requestAnimationFrame(()=>{Dt(),requestAnimationFrame(Dt)}),Bt=new ResizeObserver(Dt);return Bt.observe(J),()=>{cancelAnimationFrame(ct),Bt.disconnect()}},[c,q,Dt]);const Q={x:n.minX,y:n.minY,width:n.maxX-n.minX,height:n.maxY-n.minY},lt={w:r.w,h:r.h};if(c){const J=ph,ct=Vg({card:Q,panel:{w:J,h:J},gap:Kg,bounds:lt}),Bt=A.jsx("foreignObject",{x:ct.x,y:ct.y,width:J,height:J,style:{overflow:"visible",outline:"none"},onPointerDown:$a,onMouseDown:$a,children:A.jsx("div",{...zk,children:A.jsx("button",{type:"button",onPointerDown:$a,onClick:te=>{te.stopPropagation(),f?.()},title:`Показати панель (${Qe(ne.calloutTogglePanel,{isMac:E})})`,style:{...gp,position:"static",transform:"none"},children:A.jsx("i",{className:`${_r} bi-sliders`,style:{fontSize:Hr},"aria-hidden":!0})})})});return l?mh.createPortal(Bt,l):Bt}const X=Wa.length+(D?1:0)+(L?1:0),wt=X*mo+(X-1)*Zg+Jg*2,Tt=Vg({card:Q,panel:{w:wt,h:vt},gap:Kg,bounds:lt}),yt=A.jsx("foreignObject",{x:Tt.x,y:Tt.y,width:wt,height:vt,style:{overflow:"visible",outline:"none"},onPointerDown:$a,onMouseDown:$a,children:A.jsx("div",{...zk,style:{display:"flex",flexDirection:"column",justifyContent:Tt.above?"flex-end":"flex-start",width:"100%",height:"100%"},children:A.jsxs("div",{ref:rt,style:{display:"flex",flexDirection:"column",gap:AA,width:"100%",padding:Jg,boxSizing:"border-box",background:EA,borderRadius:MA,border:TA,fontFamily:s,fontSize:CA,position:"relative"},children:[f&&A.jsx("button",{type:"button",onPointerDown:$a,onClick:J=>{J.stopPropagation(),f()},title:`Згорнути панель (${Qe(ne.calloutTogglePanel,{isMac:E})})`,style:{position:"absolute",top:-wf/2,right:-wf/2,width:wf,height:wf,borderRadius:"50%",background:i0,border:ib,color:ob,cursor:"pointer",padding:0,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:sb},children:A.jsx("i",{className:`${_r} bi-dash-lg`,style:{fontSize:kA},"aria-hidden":!0})}),A.jsxs("div",{style:{display:"flex",gap:Zg,justifyContent:"center"},children:[Wa.map(J=>A.jsx("button",{type:"button",onPointerDown:$a,onClick:ct=>{ct.stopPropagation(),d(t.id,J)},title:J,style:{width:mo,height:mo,borderRadius:"50%",background:J,border:t.color===J?ch:NA,cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0}},J)),D&&A.jsx("button",{type:"button",onPointerDown:$a,onClick:J=>{J.stopPropagation(),p(t.id,$?"solid":"dashed")},onMouseDown:J=>J.preventDefault(),"aria-label":"Перемикач стилю обводки",title:$?"Змінити на суцільну обводку":"Змінити на пунктирну обводку",style:{width:mo,height:mo,borderRadius:"50%",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0,background:Qg,border:$?ch:t0,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:A.jsx("svg",{width:mo-Sf,height:mo-Sf,viewBox:"0 0 16 16","aria-hidden":!0,children:A.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:n0,strokeWidth:e0,strokeDasharray:_A})})}),L&&A.jsx("button",{type:"button",onPointerDown:$a,onClick:J=>{J.stopPropagation(),g(t.id,Y?"filled":"none")},onMouseDown:J=>J.preventDefault(),"aria-label":"Перемикач фону фігури",title:Y?"Додати фон фігури":"Прибрати фон фігури",style:{width:mo,height:mo,borderRadius:"50%",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0,background:Qg,border:Y?ch:t0,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:A.jsx("svg",{width:mo-Sf,height:mo-Sf,viewBox:"0 0 16 16","aria-hidden":!0,children:A.jsx("rect",{x:"3",y:"3",width:"10",height:"10",fill:"none",stroke:n0,strokeWidth:e0})})})]}),q&&A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:Ap},children:[A.jsx("i",{className:`${_r} bi-border-width`,style:{fontSize:Hr,color:hh,flexShrink:0},"aria-hidden":!0}),A.jsx("input",{type:"range",min:ml,max:Bu,step:K0,value:i,"aria-label":"Товщина ліній фігури",title:"Товщина контуру та маркера",onPointerDown:$a,onMouseDown:$a,onChange:J=>b(t.id,Number(J.target.value)),className:"tyts-range",style:{flex:1,minWidth:0,"--tyts-range-accent":t.color,"--tyts-range-bg":Ch,"--tyts-range-track":`${LA}px`,"--tyts-range-thumb":`${DA}px`,"--tyts-range-fill":`${Mt}%`}}),A.jsxs("span",{style:{color:hh,fontSize:RA,fontVariantNumeric:"tabular-nums",minWidth:OA,textAlign:"right",flexShrink:0},children:["×",J0(i)]}),ht&&A.jsx("button",{type:"button",onPointerDown:$a,onMouseDown:J=>J.preventDefault(),onClick:J=>{J.stopPropagation(),b(t.id,null)},title:"Повернути глобальну товщину","aria-label":"Повернути глобальну товщину",style:PA,children:A.jsx("i",{className:`${_r} bi-arrow-counterclockwise`,style:{fontSize:Hr},"aria-hidden":!0})})]}),A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:Ap},children:[A.jsxs("button",{type:"button",onPointerDown:$a,onClick:J=>{J.stopPropagation(),y(t.id)},title:"Показати виноску",style:{...pp,flex:1},children:[A.jsx("i",{className:`${_r} bi-chat-square-text`,style:{fontSize:Hr},"aria-hidden":!0}),A.jsx("i",{className:`${_r} bi-plus-lg`,style:{fontSize:Hr},"aria-hidden":!0})]}),A.jsx("button",{type:"button",onPointerDown:$a,onClick:J=>{J.stopPropagation(),M(t.id)},title:`Видалити (${Qe(ne.calloutDelete,{isMac:E})})`,style:mp,children:A.jsx("i",{className:`${_r} bi-trash`,style:{fontSize:Hr},"aria-hidden":!0})})]})]})})});return l?mh.createPortal(yt,l):yt}),g9=I.memo(function({anchor:t,card:n,color:r,widthScale:i=1,points:s}){if(t.type==="standalone")return null;const l=pD(_g(t,n,s));return A.jsx("g",{children:A.jsx("path",{d:l,fill:"none",stroke:r,strokeWidth:eA*i,strokeLinecap:"round",strokeLinejoin:"round"})})}),z6=I.createContext(!0),Bk=8,cp=8;function Y5({anchorRef:e,label:t,hint:n,hotkeyParts:r}){const i=I.useRef(null),[s,l]=I.useState(null),c=r?.join(" ")??"",f=I.useContext(z6),[d,p]=I.useState(!1);if(I.useEffect(()=>{if(!f)return;const M=window.setTimeout(()=>p(!0),M8);return()=>window.clearTimeout(M)},[f]),I.useLayoutEffect(()=>{const M=e.current,E=i.current;if(!M||!E)return;const D=M.getBoundingClientRect(),L=E.getBoundingClientRect(),q=window.innerWidth,$=window.innerHeight,Y=Math.min(Math.max(D.left+D.width/2-L.width/2,cp),Math.max(cp,q-L.width-cp)),ht=D.bottom+Bk,Mt=ht+L.height<=$-cp?ht:Math.max(cp,D.top-Bk-L.height);l(vt=>vt&&vt.left===Y&&vt.top===Mt?vt:{left:Y,top:Mt})},[e,t,n,c,d]),!f||!d||typeof document>"u")return null;const g=!!r&&r.length>0,b=t||n,y=t&&n&&n!==t?n:null;return mh.createPortal(A.jsxs("div",{ref:i,role:"tooltip",style:{position:"fixed",left:s?.left??0,top:s?.top??0,visibility:s?"visible":"hidden",display:"flex",flexDirection:"column",gap:4,padding:"6px 10px",background:"rgba(0,0,0,0.9)",border:"1px solid rgba(255,255,255,0.08)",color:"#fff",borderRadius:6,fontSize:12,lineHeight:1.35,width:"max-content",maxWidth:320,zIndex:1e4,pointerEvents:"none",boxShadow:"0 4px 14px rgba(0,0,0,0.4)"},children:[(b||g)&&A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,justifyContent:"space-between"},children:[b&&A.jsx("span",{style:{fontWeight:t?700:400},children:b}),g&&A.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:3},children:r.map(M=>A.jsx(Hl,{children:M},M))})]}),y&&A.jsx("div",{style:{color:"rgba(255,255,255,0.65)"},children:y})]}),document.body)}function y9({isMac:e,backgroundImage:t,pinsLength:n,showExportMenu:r,sourceImageSize:i,imageSize:s,activePin:l,calloutControlPinId:c,undo:f,redo:d,handleExport:p,handleExportPdf:g,stepZoom:b,handleFitToWindow:y,deletePin:M,movePinZ:E,copyPin:D,duplicatePin:L,pastePinFromClipboard:q,setMode:$,setPolygonDraft:Y,setPolylineDraft:ht,setShapeDraftType:Mt,setPlacementTool:vt,setShowExportMenu:bt,beginCrop:rt,insertCurrentDateTimeText:Dt,toggleCompassMenu:Q,toggleStampMenu:lt,toggleImageObjectMenu:X,toggleCalloutPanel:wt,newBgFileRef:Tt,replaceBgFileRef:yt,exportMenuOpenedViaHotkeyRef:J}){I.useEffect(()=>{const ct=["range","checkbox","radio","button","color","file","submit","reset"],Bt=j=>j?j.isContentEditable||j.tagName==="TEXTAREA"||zg(j)?!0:j.tagName==="INPUT"?!ct.includes(j.type):!1:!1,te=j=>j.code==="NumpadAdd"||j.key==="+"||j.key==="="||j.code==="Equal"&&j.shiftKey,Z=j=>j.code==="NumpadSubtract"||j.code==="Minus"||j.key==="-"||j.key==="_",P=j=>{const G=j.target,ut=e?j.metaKey:j.ctrlKey;if(ut&&j.shiftKey&&!j.altKey&&j.code==="KeyH"){j.preventDefault(),wt();return}if(!Bt(G)){if(r&&!ut&&!j.altKey&&!j.shiftKey){const xt=/^[1-9]$/.test(j.key)?Number(j.key):null;if(xt!=null){j.preventDefault();const St=[];i&&St.push(()=>{const{w:Rt}=s;if(!Rt)return;const Qt=i.w/Rt/2;p("png",Qt)}),St.push(()=>p("png",1)),St.push(()=>p("png",2)),St.push(()=>p("jpeg",2)),St.push(()=>g()),St.push(()=>{t&&window.print()});const Ft=St[xt-1];Ft&&(bt(!1),J.current=!1,Ft());return}}if(ut&&j.shiftKey&&j.code==="KeyV"){j.preventDefault(),q();return}if(ut&&!j.shiftKey&&(j.code==="KeyC"||j.code==="KeyJ")){const xt=c??l;if(xt){j.preventDefault(),j.code==="KeyC"?D(xt):L(xt);return}}if(ut&&(j.code==="BracketRight"||j.code==="BracketLeft")){const xt=c??l;if(xt){j.preventDefault();const St=j.code==="BracketRight",Ft=j.shiftKey?St?"front":"back":St?"up":"down";E(xt,Ft);return}}if(ut&&(j.code==="KeyZ"||j.key.toLowerCase()==="z")){j.preventDefault(),j.shiftKey?d():f();return}if(!e&&j.ctrlKey&&(j.code==="KeyY"||j.key.toLowerCase()==="y")){j.preventDefault(),d();return}if(ut&&!j.shiftKey&&(j.code==="KeyD"||j.key.toLowerCase()==="d")){j.preventDefault(),t&&p("jpeg");return}if(ut&&j.shiftKey&&j.code==="KeyD"){if(j.preventDefault(),!t)return;J.current=!0,bt(!0);return}if((j.key==="Delete"||j.key==="Backspace")&&(c||l)){j.preventDefault(),M(c??l);return}if(ut&&!j.altKey&&!j.shiftKey){if(j.code==="KeyN"){j.preventDefault(),Tt.current?.click();return}if(j.code==="KeyB"){j.preventDefault(),(yt.current??Tt.current)?.click();return}if(j.code==="KeyO"){j.preventDefault(),t&&y();return}}if(t){if(!ut&&!j.altKey&&!j.shiftKey){if(j.code==="Digit1"||j.code==="Numpad1"){j.preventDefault(),$("place"),Y(null),ht(null),Mt(null),vt("point");return}if(j.code==="Digit0"||j.code==="Numpad0"||j.key==="0"){j.preventDefault(),$("place"),Y(null),ht(null),Mt(null),vt("numbering");return}if(j.code==="Digit2"||j.code==="Numpad2"){j.preventDefault(),$("place"),Y([]),ht(null),Mt(null);return}if(j.code==="Digit3"||j.code==="Numpad3"){j.preventDefault(),$("place"),Y(null),ht([]),Mt(null);return}if(j.code==="Digit4"||j.code==="Numpad4"){j.preventDefault(),$("place"),Y(null),ht(null),Mt("rectangle");return}if(j.code==="Digit5"||j.code==="Numpad5"){j.preventDefault(),$("place"),Y(null),ht(null),Mt("ellipse"),vt("point");return}if(j.code==="Digit6"||j.code==="Numpad6"){j.preventDefault(),$("place"),Y(null),ht(null),Mt(null),vt("text");return}if(j.code==="Digit7"||j.code==="Numpad7"){j.preventDefault(),$("place"),Y(null),ht(null),Mt(null),vt("arrow");return}if(j.code==="Digit8"||j.code==="Numpad8"){j.preventDefault(),Dt();return}if(j.code==="Digit9"||j.code==="Numpad9"){j.preventDefault(),$("place"),Y(null),ht(null),Mt(null),vt("standalone");return}if(j.code==="KeyK"){j.preventDefault(),Q();return}if(j.code==="KeyS"){j.preventDefault(),lt();return}if(j.code==="KeyP"){j.preventDefault(),$("place"),Y(null),ht(null),Mt(null),vt("pointText");return}if(j.code==="KeyR"){j.preventDefault(),$("place"),Y(null),ht(null),Mt("redact");return}if(j.code==="KeyI"){j.preventDefault(),X();return}if(j.code==="KeyC"){j.preventDefault(),rt();return}}if(!ut&&!j.altKey){if(te(j)){j.preventDefault(),b("in");return}if(Z(j)){j.preventDefault(),b("out");return}}}}};return window.addEventListener("keydown",P,!0),()=>window.removeEventListener("keydown",P,!0)},[t,n,f,d,l,c,r,i,s,p,g,b,y,e,M,E,D,L,q,$,Y,ht,Mt,vt,bt,rt,Dt,Q,lt,X,wt,Tt,yt,J])}function b9(){return{past:[],future:[]}}function qb(e){return e.map(t=>({x:t.x,y:t.y}))}function x9(e){e.past=[],e.future=[]}function v9(e,t,n=100){e.past.push(qb(t)),e.past.length>n&&e.past.shift(),e.future=[]}function w9(e,t){if(e.past.length===0)return null;const n=e.past.pop();return e.future.push(qb(t)),n}function S9(e,t){if(e.future.length===0)return null;const n=e.future.pop();return e.past.push(qb(t)),n}const k9=100;function A9(){const e=I.useRef(b9()),[t,n]=I.useState(!1),[r,i]=I.useState(!1),s=I.useCallback(()=>{n(e.current.past.length>0),i(e.current.future.length>0)},[]),l=I.useCallback(()=>{x9(e.current),n(!1),i(!1)},[]),c=I.useCallback(p=>{v9(e.current,p,k9),s()},[s]),f=I.useCallback(p=>{const g=w9(e.current,p);return s(),g},[s]),d=I.useCallback(p=>{const g=S9(e.current,p);return s(),g},[s]);return{canUndo:t,canRedo:r,reset:l,record:c,undo:f,redo:d}}const $b="tyts-collage-autosave",M9=2e3,C9=.82;function mr(e){return typeof e=="number"&&Number.isFinite(e)}function B6(e){if(!e||typeof e!="object")return!1;const t=e;return mr(t.w)&&mr(t.h)&&t.w>0&&t.h>0}function E9(e){return e===null?!0:B6(e)}function T9(e){if(!e||typeof e!="object")return!1;const t=e;return mr(t.x)&&mr(t.y)&&mr(t.width)&&mr(t.height)&&t.width>0&&t.height>0}function hf(e){if(!e||typeof e!="object")return!1;const t=e;return mr(t.x)&&mr(t.y)}function N9(e){if(!e||typeof e!="object")return!1;const t=e;if(typeof t.type!="string")return!1;switch(t.type){case"point":case"standalone":return hf(t);case"linked":{const n=t.pinId;return typeof n=="string"&&n.length>0}case"numbering":return hf(t.start)&&hf(t.end);case"polygon":case"polyline":{const n=t.points;return Array.isArray(n)&&n.every(hf)}case"arrow":{const n=t;return hf(n.start)&&hf(n.end)&&hf(n.control)}case"rectangle":{const n=t;return mr(n.x)&&mr(n.y)&&mr(n.width)&&mr(n.height)}case"ellipse":{const n=t;return mr(n.cx)&&mr(n.cy)&&mr(n.rx)&&mr(n.ry)}case"compass":{const n=t;return mr(n.cx)&&mr(n.cy)&&mr(n.radius)&&n.radius>0}case"redact":{const n=t;return mr(n.x)&&mr(n.y)&&mr(n.width)&&mr(n.height)&&mr(n.strength)&&(n.mode==="blur"||n.mode==="pixelate"||n.mode==="fill")}case"image":{const n=t;return mr(n.x)&&mr(n.y)&&mr(n.width)&&mr(n.height)&&mr(n.aspect)&&typeof n.src=="string"&&n.src.length>0}case"text":{const n=t;return n.point!==void 0&&!hf(n.point)?!1:mr(n.x)&&mr(n.y)&&mr(n.width)&&mr(n.height)}default:return!1}}function _9(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id!="string"||!t.id||typeof t.color!="string"||!t.color||!mr(t.label)||t.label<1||typeof t.description!="string"||t.descPos!=="above"&&t.descPos!=="below"||t.image!==null&&typeof t.image!="string"||t.imageAspect!==null&&t.imageAspect!==void 0&&!mr(t.imageAspect)?!1:N9(t.anchor)}function F6(e){return U6(e)?e:null}function U6(e){if(!e||typeof e!="object")return!1;const t=e;return t.version!==1&&t.version!==2||!mr(t.savedAt)||t.sourceUrl!==void 0&&typeof t.sourceUrl!="string"||t.sourceTitle!==void 0&&typeof t.sourceTitle!="string"||t.capturedAt!==void 0&&!mr(t.capturedAt)||typeof t.backgroundImage!="string"||!t.backgroundImage.startsWith("data:")||!B6(t.imageSize)||!E9(t.sourceImageSize??null)||!Array.isArray(t.pins)||!t.pins.every(_9)||!t.cardPositions||typeof t.cardPositions!="object"?!1:Object.values(t.cardPositions).every(T9)}function D9(e){return new Promise((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=()=>n(new Error("Image load failed")),r.src=e})}function L9(e){return new Promise(t=>{const n=new FileReader;n.onload=()=>{const r=n.result;t(typeof r=="string"?r:null)},n.onerror=()=>t(null),n.readAsDataURL(e)})}async function R9(e){if(e.startsWith("data:"))return e;if(e.startsWith("blob:"))try{const n=await(await fetch(e)).blob();return L9(n)}catch{return null}return e}async function O9(e,t=M9,n=C9){try{const r=await D9(e),i=Math.max(r.naturalWidth,r.naturalHeight),s=i>t?t/i:1,l=Math.max(1,Math.round(r.naturalWidth*s)),c=Math.max(1,Math.round(r.naturalHeight*s)),f=document.createElement("canvas");f.width=l,f.height=c;const d=f.getContext("2d");return d?(d.drawImage(r,0,0,l,c),f.toDataURL("image/jpeg",n)):null}catch{return null}}function Fk(e){try{return localStorage.setItem($b,JSON.stringify(e)),!0}catch(t){if(t instanceof DOMException&&t.name==="QuotaExceededError")return!1;throw t}}function N2(){try{const e=localStorage.getItem($b);if(!e)return null;const t=JSON.parse(e);return U6(t)?t:null}catch{return null}}function P9(){localStorage.removeItem($b)}async function j9(e){const t=await R9(e.backgroundImage);if(!t||!t.startsWith("data:"))return{ok:!1,error:"invalid_background"};const n={version:2,savedAt:Date.now(),backgroundImage:t,imageSize:e.imageSize,sourceImageSize:e.sourceImageSize,pins:e.pins,cardPositions:e.cardPositions,sourceUrl:e.sourceUrl,sourceTitle:e.sourceTitle,capturedAt:e.capturedAt};if(Fk(n))return{ok:!0,compressed:!1};const r=await O9(t);if(!r)return{ok:!1,error:"quota"};const i={...n,backgroundImage:r};return Fk(i)?{ok:!0,compressed:!0}:{ok:!1,error:"quota"}}const I9=800,z9=2e3;function Uk(e){return e.backgroundImage?JSON.stringify({backgroundImage:e.backgroundImage,imageSize:e.imageSize,sourceImageSize:e.sourceImageSize,pins:e.pins,cardPositions:e.cardPositions,sourceUrl:e.sourceUrl??null,sourceTitle:e.sourceTitle??null,capturedAt:e.capturedAt??null}):null}function B9({state:e,onRestore:t,enabled:n=!0}){const[r,i]=I.useState("idle"),[s,l]=I.useState(null),[c,f]=I.useState(null),[d,p]=I.useState(()=>N2()),[g,b]=I.useState(!1),[y,M]=I.useState(!1),E=I.useRef(t),D=I.useRef(e),L=I.useRef(null),q=I.useRef(!1),$=I.useRef(!1),Y=I.useRef(null),ht=I.useRef(null),Mt=I.useRef(async()=>!1);I.useEffect(()=>{E.current=t,D.current=e});const vt=I.useCallback(async(wt=!1)=>{if(!n)return!1;const Tt=D.current;if(!Tt.backgroundImage)return!1;const yt=Uk(Tt);if(!yt)return!1;if(!wt&&yt===L.current)return!0;if(q.current)return $.current=!0,!1;q.current=!0,i("saving"),f(null);const J=await j9({backgroundImage:Tt.backgroundImage,imageSize:Tt.imageSize,sourceImageSize:Tt.sourceImageSize,pins:Tt.pins,cardPositions:Tt.cardPositions,sourceUrl:Tt.sourceUrl,sourceTitle:Tt.sourceTitle,capturedAt:Tt.capturedAt});if(q.current=!1,!J.ok){const Bt=J.error==="quota"?"Чернетка занадто велика для localStorage":"Не вдалося зберегти чернетку";return i("error"),f(Bt),!1}L.current=yt;const ct=Date.now();return l(ct),i("saved"),p(N2()),M(!0),ht.current&&clearTimeout(ht.current),ht.current=setTimeout(()=>M(!1),z9),$.current&&($.current=!1,queueMicrotask(()=>{Mt.current()})),!0},[n]);I.useEffect(()=>{Mt.current=vt},[vt]);const bt=I.useCallback(()=>{n&&D.current.backgroundImage&&(Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{Y.current=null,Mt.current()},I9))},[n]),rt=I.useCallback(()=>{n&&(P9(),p(null),b(!0),L.current=null,i("idle"),l(null),f(null),M(!1))},[n]),Dt=I.useCallback(()=>{const wt=N2();return wt?(E.current(wt),L.current=Uk({backgroundImage:wt.backgroundImage,imageSize:wt.imageSize,sourceImageSize:wt.sourceImageSize,pins:wt.pins,cardPositions:wt.cardPositions,sourceUrl:wt.sourceUrl,sourceTitle:wt.sourceTitle,capturedAt:wt.capturedAt}),p(wt),l(wt.savedAt),i("saved"),f(null),b(!0),!0):(p(null),!1)},[]),Q=I.useCallback(()=>{b(!0)},[]);I.useEffect(()=>{n&&e.backgroundImage&&bt()},[n,e.backgroundImage,e.imageSize,e.sourceImageSize,e.pins,e.cardPositions,e.sourceUrl,e.sourceTitle,e.capturedAt,bt]),I.useEffect(()=>{if(!n)return;const wt=()=>{Y.current&&(clearTimeout(Y.current),Y.current=null),Mt.current()},Tt=()=>wt(),yt=()=>{document.visibilityState==="hidden"&&wt()};return window.addEventListener("beforeunload",Tt),document.addEventListener("visibilitychange",yt),()=>{window.removeEventListener("beforeunload",Tt),document.removeEventListener("visibilitychange",yt),Y.current&&clearTimeout(Y.current),ht.current&&clearTimeout(ht.current)}},[n]);const lt=n&&d!==null,X=n&&lt&&!e.backgroundImage;return{status:r,lastSavedAt:s,errorMessage:c,hasStoredDraft:lt,canRestore:X,showRestorePrompt:X&&!g,storedDraftSavedAt:d?.savedAt??null,saveFlash:y,saveNow:vt,restoreDraft:Dt,clearDraft:rt,dismissRestorePrompt:Q}}function F9(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}function U9(e){return new Promise((t,n)=>{const r=new Image;r.onload=()=>t(r.naturalWidth/r.naturalHeight),r.onerror=()=>n(new Error("image load failed")),r.src=e})}function H9(){const[e,t]=I.useState([]),n=I.useRef(e);I.useEffect(()=>{n.current=e},[e]);const r=I.useCallback(async f=>{const p=(await Promise.all(f.map(async g=>{try{const b=await F9(g),y=await U9(b);return{id:fa(),image:b,imageAspect:y,text:""}}catch{return null}}))).filter(g=>g!==null);p.length&&t(g=>[...g,...p])},[]),i=I.useCallback((f="")=>{const d=fa();return t(p=>[...p,{id:d,image:null,imageAspect:null,text:f}]),d},[]),s=I.useCallback((f,d)=>{t(p=>p.map(g=>g.id===f?{...g,text:d}:g))},[]),l=I.useCallback(f=>{t(d=>d.filter(p=>p.id!==f))},[]),c=I.useCallback(f=>n.current.find(d=>d.id===f)??null,[]);return{items:e,addImageFiles:r,addText:i,updateText:s,remove:l,getItem:c}}const Hk=1024,q9="Лого завелике для сховища браузера: воно діятиме до перезавантаження сторінки. Спробуйте менший файл.";function $9(e){return new Promise(t=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=()=>t(null),n.readAsDataURL(e)})}function Y9(e){return new Promise(t=>{const n=new Image;n.onload=()=>t(n),n.onerror=()=>t(null),n.src=e})}async function V9(e){const t=await $9(e);if(!t)return null;const n=await Y9(t);if(!n)return null;const r=n.naturalWidth||1,i=n.naturalHeight||1,s=r/i;if(e.type==="image/svg+xml"||/\.svg$/i.test(e.name)||Math.max(r,i)<=Hk)return{src:t,aspect:s};const c=Hk/Math.max(r,i),f=document.createElement("canvas");f.width=Math.round(r*c),f.height=Math.round(i*c);const d=f.getContext("2d");return d?(d.drawImage(n,0,0,f.width,f.height),{src:f.toDataURL("image/png"),aspect:s}):{src:t,aspect:s}}function W9(){const[e,t]=I.useState(()=>LD()),n=I.useRef(e),[r,i]=I.useState(null),[s,l]=I.useState(null);I.useEffect(()=>{},[]);const c=I.useCallback(p=>{const g={...n.current,...p};n.current=g,t(g),i(RD(g)?null:q9)},[]),f=I.useCallback(async p=>{const g=await V9(p);return g?(c({logo:g.src,logoAspect:g.aspect}),!0):!1},[c]),d=I.useCallback(()=>c({logo:null,logoAspect:null}),[c]);return{settings:e,logo:OD(e,s),hasOwnLogo:!!e.logo,hasBuiltInLogo:!!s,saveError:r,update:c,setLogoFromFile:f,clearLogo:d}}const H6="#F2D727",q6="rgba(255,255,255,0.6)",Bg="1px solid rgba(255,255,255,0.12)",_2={nw:"Верхній лівий",ne:"Верхній правий",sw:"Нижній лівий",se:"Нижній правий"},qk={height:26,padding:"0 10px",borderRadius:6,border:Bg,background:"rgba(255,255,255,0.06)",color:"#fff",fontSize:12,cursor:"pointer"};function X9({anchorRect:e,anchorEl:t,onClose:n,settings:r,logo:i,hasOwnLogo:s,hasBuiltInLogo:l,saveError:c,canInsert:f,hasStampOnImage:d,onInsert:p,onUpdate:g,onPickFile:b,onClearLogo:y,onPreviewCorner:M}){const E=I.useRef(null),D=f&&(!!i||d),L=I.useRef(null),[q,$]=I.useState(null);return I.useEffect(()=>{const Y=Mt=>{const vt=Mt.target;!vt||L.current?.contains(vt)||t?.contains(vt)||n()},ht=Mt=>{Mt.key==="Escape"&&n()};return window.addEventListener("pointerdown",Y,!0),window.addEventListener("keydown",ht),()=>{window.removeEventListener("pointerdown",Y,!0),window.removeEventListener("keydown",ht)}},[t,n]),A.jsxs("div",{ref:L,role:"dialog","aria-label":"Штамп",style:{position:"fixed",top:e?e.bottom+6:0,left:e?e.left+e.width/2:0,transform:"translateX(-50%)",zIndex:3200,width:288,padding:12,display:"flex",flexDirection:"column",gap:12,background:"rgba(16,16,28,0.98)",border:Bg,borderRadius:10,boxShadow:"0 10px 28px rgba(0,0,0,0.45)",color:"#fff",fontSize:12,lineHeight:1.4},onClick:Y=>Y.stopPropagation(),children:[A.jsx("input",{ref:E,type:"file",accept:"image/png,image/svg+xml,image/webp,image/jpeg",style:{display:"none"},onChange:Y=>{const ht=Y.target.files?.[0];Y.target.value="",ht&&b(ht).then(Mt=>$(Mt?null:"Не вдалося відкрити файл як зображення."))}}),A.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[A.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:["nw","ne","sw","se"].map(Y=>A.jsx("button",{type:"button",title:d?`Перенести штамп: ${_2[Y].toLowerCase()} кут`:_2[Y],"aria-label":_2[Y],disabled:!D,onClick:()=>p(Y),onMouseEnter:()=>M(Y),onMouseLeave:()=>M(null),onFocus:()=>M(Y),onBlur:()=>M(null),style:{width:"100%",height:56,padding:0,borderRadius:8,border:r.corner===Y?`1px solid ${H6}`:Bg,background:"rgba(255,255,255,0.06)",cursor:D?"pointer":"default",opacity:D?1:.4},children:A.jsx(G9,{corner:Y})},Y))}),!D&&A.jsx("span",{style:{color:q6},children:f?"Спершу додайте лого.":"Відкрийте зображення, щоб поставити штамп."})]}),A.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[A.jsx("div",{"aria-hidden":!0,title:s?void 0:l?"Вбудоване лого":void 0,style:{width:72,height:48,flex:"none",borderRadius:6,border:Bg,background:i?`url("${i.src}") center/contain no-repeat, repeating-conic-gradient(#2a2a36 0% 25%, #1f1f29 0% 50%) 0 0/12px 12px`:"rgba(255,255,255,0.04)"}}),A.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:A.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[A.jsx("button",{type:"button",style:qk,onClick:()=>E.current?.click(),title:"PNG, SVG, WEBP або JPG — зберігається в цьому браузері",children:s?"Замінити…":"Завантажити…"}),s&&A.jsx("button",{type:"button",style:{...qk,padding:"0 8px"},onClick:y,title:"Прибрати лого","aria-label":"Прибрати лого",children:A.jsx("i",{className:"bi bi-trash3","aria-hidden":!0})})]})})]}),A.jsx(D2,{label:"Розмір",title:"Довша сторона лого, у відсотках від меншої сторони зображення",value:r.sizePct,min:vA,max:wA,step:1,onChange:Y=>g({sizePct:Y})}),A.jsx(D2,{label:A.jsxs(A.Fragment,{children:["Відступ ",A.jsx("i",{className:"bi bi-arrows","aria-label":"по горизонталі"})]}),title:"Від лівого або правого краю, у відсотках від меншої сторони зображення",value:r.marginXPct,min:Xg,max:Gg,step:.5,onChange:Y=>g({marginXPct:Y})}),A.jsx(D2,{label:A.jsxs(A.Fragment,{children:["Відступ ",A.jsx("i",{className:"bi bi-arrows-vertical","aria-label":"по вертикалі"})]}),title:"Від верхнього або нижнього краю, у відсотках від меншої сторони зображення",value:r.marginYPct,min:Xg,max:Gg,step:.5,onChange:Y=>g({marginYPct:Y})}),A.jsxs("label",{title:"Ставити штамп на кожне нове зображення",style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:8,cursor:"pointer",border:"1px solid rgba(255,255,255,0.08)"},children:[A.jsx("input",{type:"checkbox",checked:r.autoApply,onChange:Y=>g({autoApply:Y.target.checked}),style:{accentColor:bc,margin:0}}),"Ставити автоматично"]}),(q||c)&&A.jsx("span",{style:{color:"#ff8a8a"},children:q??c})]})}function D2({label:e,title:t,value:n,min:r,max:i,step:s,onChange:l}){return A.jsxs("label",{title:t,style:{display:"grid",gridTemplateColumns:"72px 1fr 40px",alignItems:"center",gap:8},children:[A.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:e}),A.jsx("input",{type:"range",min:r,max:i,step:s,value:n,onChange:c=>l(Number(c.target.value)),className:"tyts-range",style:{width:"100%","--tyts-range-accent":bc,"--tyts-range-fill":`${(n-r)/(i-r)*100}%`}}),A.jsxs("span",{style:{textAlign:"right",color:q6,fontVariantNumeric:"tabular-nums"},children:[n,"%"]})]})}function G9({corner:e}){const t=e==="nw"||e==="sw",n=e==="nw"||e==="ne";return A.jsx("span",{"aria-hidden":!0,style:{display:"flex",width:"100%",height:"100%",padding:8,boxSizing:"border-box",justifyContent:t?"flex-start":"flex-end",alignItems:n?"flex-start":"flex-end"},children:A.jsx("span",{style:{width:18,height:11,borderRadius:2,background:H6}})})}const K9=320,J9="rgba(10,10,16,0.97)",Zp="1px solid rgba(255,255,255,0.12)",Z9="rgba(255,255,255,0.04)",Q9="rgb(0, 102, 204)",Ip="rgba(255,255,255,0.55)",tF=220,$k={display:"inline-flex",alignItems:"center",gap:6,height:28,padding:"0 10px",borderRadius:6,border:Zp,background:"rgba(255,255,255,0.06)",color:"#fff",fontSize:13,cursor:"pointer"},$6={width:26,height:26,display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none",borderRadius:6,background:"transparent",color:Ip,cursor:"pointer"};function eF({items:e,onAddImageFiles:t,onAddText:n,onUpdateText:r,onRemove:i,onClose:s}){const l=I.useRef(null),c=I.useRef(null),[f,d]=I.useState(!1),p=I.useRef(null),g=I.useRef(new Map);I.useEffect(()=>{c.current?.focus({preventScroll:!0})},[]),I.useEffect(()=>{const M=p.current;if(!M)return;const E=g.current.get(M);E&&(p.current=null,E.focus())},[e]);const b=M=>{const E=$5(M.clipboardData);if(E.length){M.preventDefault(),t(E);return}if(M.target!==c.current)return;const D=M.clipboardData.getData("text/plain");M.preventDefault(),D.trim()&&n(D)},y=M=>M.dataTransfer.types.includes("Files");return A.jsxs("aside",{[P6]:"","aria-label":"Медіа",style:{width:K9,flex:"none",minHeight:0,display:"flex",flexDirection:"column",background:J9,borderLeft:Zp,color:"#fff",fontSize:13,position:"relative",outline:f?`2px dashed ${Q9}`:"none",outlineOffset:-4},onClick:M=>M.stopPropagation(),onPointerDown:M=>{M.target.closest("textarea, input, button")||c.current?.focus({preventScroll:!0})},onPaste:b,onDragOver:M=>{y(M)&&(M.preventDefault(),M.stopPropagation(),M.dataTransfer.dropEffect="copy",d(!0))},onDragLeave:M=>{M.currentTarget.contains(M.relatedTarget)||d(!1)},onDrop:M=>{if(!y(M))return;M.preventDefault(),M.stopPropagation(),d(!1);const E=$5(M.dataTransfer);E.length&&t(E)},children:[A.jsx("input",{ref:c,type:"text","aria-label":"Вставте зображення або текст з буфера",value:"",onChange:()=>{},style:{position:"absolute",width:1,height:1,opacity:0,pointerEvents:"none",top:0,left:0}}),A.jsx("input",{ref:l,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:M=>{const E=Array.from(M.target.files??[]);M.target.value="",E.length&&t(E)}}),A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",borderBottom:Zp},children:[A.jsx("strong",{style:{fontSize:14,fontWeight:600},children:"Медіа"}),e.length>0&&A.jsx("span",{style:{color:Ip},children:e.length}),A.jsx("span",{style:{flex:1}}),A.jsxs("button",{type:"button",style:$k,onClick:()=>l.current?.click(),title:"Додати картинки",children:[A.jsx("i",{className:"bi bi-image","aria-hidden":!0})," Картинка"]}),A.jsxs("button",{type:"button",style:$k,onClick:()=>{p.current=n()},title:"Додати текст",children:[A.jsx("i",{className:"bi bi-fonts","aria-hidden":!0})," Текст"]}),A.jsx("button",{type:"button",style:$6,onClick:s,title:"Закрити панель","aria-label":"Закрити панель",children:A.jsx("i",{className:"bi bi-x-lg","aria-hidden":!0})})]}),A.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto",padding:12,display:"flex",flexDirection:"column",gap:10},children:e.length===0?A.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10,padding:20,border:"1px dashed rgba(255,255,255,0.2)",borderRadius:10,color:Ip,textAlign:"center",lineHeight:1.45},children:[A.jsx("i",{className:"bi bi-images",style:{fontSize:28},"aria-hidden":!0}),A.jsxs("div",{children:["Перетягніть сюди картинки, вставте їх (⌘V / Ctrl+V) або додайте кнопкою.",A.jsx("br",{}),"Потім перетягуйте елементи на виноски — фото й текст підставляться в картку."]})]}):A.jsxs(A.Fragment,{children:[A.jsx("div",{style:{color:Ip,lineHeight:1.4},children:"Тягніть елемент за картинку на виноску: фото й текст замінять наявні."}),e.map(M=>A.jsx(nF,{item:M,textareaRef:E=>{E?g.current.set(M.id,E):g.current.delete(M.id)},onUpdateText:r,onRemove:i},M.id))]})})]})}function nF({item:e,textareaRef:t,onUpdateText:n,onRemove:r}){const i=I.useRef(null),[s,l]=I.useState(!1);return A.jsxs("div",{ref:i,"data-testid":"media-item",style:{position:"relative",display:"flex",flexDirection:"column",gap:8,padding:8,borderRadius:8,background:Z9,border:Zp,opacity:s?.5:1},children:[A.jsx("div",{draggable:!0,title:"Перетягніть на виноску",onDragStart:c=>{c.dataTransfer.setData(q5,e.id),c.dataTransfer.effectAllowed="copy",i.current&&c.dataTransfer.setDragImage(i.current,20,20),l(!0)},onDragEnd:()=>l(!1),style:{width:"100%",borderRadius:6,cursor:"grab",display:"flex",alignItems:"center",justifyContent:"center",gap:6,color:Ip,...e.image?{aspectRatio:e.imageAspect?String(e.imageAspect):"4 / 3",maxHeight:tF,background:`url("${e.image}") center/contain no-repeat, rgba(0,0,0,0.3)`}:{height:28,background:"rgba(255,255,255,0.06)"}},children:!e.image&&A.jsxs(A.Fragment,{children:[A.jsx("i",{className:"bi bi-grip-horizontal",style:{fontSize:16},"aria-hidden":!0}),A.jsx("span",{style:{fontSize:12},children:"Тягніть на виноску"})]})}),A.jsx("textarea",{ref:t,value:e.text,placeholder:e.image?"Підпис (необовʼязково)":"Текст виноски",onChange:c=>n(e.id,c.target.value),rows:2,style:{width:"100%",minHeight:44,resize:"vertical",boxSizing:"border-box",padding:"6px 8px",borderRadius:6,border:Zp,background:"rgba(0,0,0,0.35)",color:"#fff",font:"inherit",lineHeight:1.4}}),A.jsx("button",{type:"button",style:{...$6,position:"absolute",top:12,right:12,color:"#fff",background:"rgba(0,0,0,0.6)"},onClick:()=>r(e.id),title:"Прибрати з панелі","aria-label":"Прибрати з панелі",children:A.jsx("i",{className:"bi bi-trash3","aria-hidden":!0})})]})}const Yb=1;function rF(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==Yb)return!1;const n={version:2,savedAt:Date.now(),backgroundImage:t.backgroundImage,imageSize:t.imageSize,sourceImageSize:t.sourceImageSize??null,pins:t.pins,cardPositions:t.cardPositions,sourceUrl:t.meta?.sourceUrl,sourceTitle:t.meta?.sourceTitle,capturedAt:t.meta?.capturedAt};return F6(n)!==null}function Yk(e){if(rF(e))return e;const t=F6(e);return t?iF(t):null}function iF(e){return{version:Yb,backgroundImage:e.backgroundImage,imageSize:e.imageSize,sourceImageSize:e.sourceImageSize,pins:e.pins,cardPositions:e.cardPositions,meta:e.sourceUrl!==void 0||e.sourceTitle!==void 0||e.capturedAt!==void 0?{sourceUrl:e.sourceUrl,sourceTitle:e.sourceTitle,capturedAt:e.capturedAt}:void 0}}function oF(e){return{version:2,savedAt:Date.now(),backgroundImage:e.backgroundImage,imageSize:e.imageSize,sourceImageSize:e.sourceImageSize,pins:e.pins,cardPositions:e.cardPositions,sourceUrl:e.meta?.sourceUrl,sourceTitle:e.meta?.sourceTitle,capturedAt:e.meta?.capturedAt}}function sF(e){return!e.backgroundImage||!e.imageSize.w?null:{version:Yb,backgroundImage:e.backgroundImage,imageSize:e.imageSize,sourceImageSize:e.sourceImageSize,pins:e.pins,cardPositions:e.cardPositions,settings:e.settings,meta:e.meta??void 0}}function aF(e){return`${e.length}:${e.slice(0,64)}:${e.slice(-64)}`}function lF(e){return JSON.stringify({...e,backgroundImage:aF(e.backgroundImage)})}async function cF(e){if(typeof e=="string")return e;const t=await uF(e);if(!t)throw new Error("Failed to read image");return t}async function uF(e){return new Promise(t=>{const n=new FileReader;n.onload=()=>{const r=n.result;t(typeof r=="string"?r:null)},n.onerror=()=>t(null),n.readAsDataURL(e)})}const L2=1;function fF(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.type=="string"&&t.type.startsWith("tyts:")}const dF=250;function hF(){if(typeof window>"u")return null;try{if(window.parent===window)return null}catch{return null}return{parentWindow:window.parent,post:(e,t)=>window.parent.postMessage(e,t)}}function pF(e){return(e??[]).map(t=>t.trim()).filter(Boolean)}function zl(e,t){return{code:e,message:t}}function Vk(e,t){return e instanceof Error?e.message:t}function mF(e){const t=e.transport===void 0?hF():e.transport,n=pF(e.config?.allowedOrigins),r=n.length===0||n.includes("*"),i=e.config?.token||void 0,s=e.changeDebounceMs??dF;let l=null,c=!1,f=null,d=null;const p=(q,$)=>{c||t?.post(q,$)},g=(q,$,Y)=>{e.onError?.($),p({type:"tyts:error",requestId:q,error:$},Y)},b=q=>r||n.includes(q),y=()=>{if(f=null,!d||l===null)return;const q=d;d=null,p({type:"tyts:change",document:q.document,dirty:q.dirty},l)},M=()=>{l===null||c||(f&&clearTimeout(f),f=setTimeout(y,s))},E=(q,$)=>{if(!b($)){g(q.requestId,zl("origin_denied",`Origin not allowed: ${$}`),$);return}if(q.protocol!==L2){g(q.requestId,zl("protocol_mismatch","Unsupported embed protocol version"),$);return}if(i&&q.token!==i){g(q.requestId,zl("invalid_token","Invalid embed token"),$);return}l=$,(async()=>{try{if(q.document){const Y=Yk(q.document);if(!Y){g(q.requestId,zl("invalid_document","Invalid initial document"),$);return}await e.editor.loadDocument(Y)}p({type:"tyts:initialized",requestId:q.requestId,protocol:L2},$),e.onReady?.(),d&&M()}catch(Y){g(q.requestId,zl("init_failed",Vk(Y,"Init failed")),$)}})()},D=async(q,$)=>{switch(q.type){case"tyts:loadDocument":{const Y=Yk(q.document);if(!Y){g(q.requestId,zl("invalid_document","Invalid document"),$);return}await e.editor.loadDocument(Y),q.requestId&&p({type:"tyts:done",requestId:q.requestId},$);return}case"tyts:loadImage":await e.editor.loadImage(q.dataUrl),q.requestId&&p({type:"tyts:done",requestId:q.requestId},$);return;case"tyts:getDocument":p({type:"tyts:document",requestId:q.requestId,document:e.editor.getDocument()},$);return;case"tyts:export":{if(q.format==="pdf"){const ht=await e.editor.exportPdf();if(!ht){g(q.requestId,zl("export_failed","PDF export failed"),$);return}const Mt=await yF(ht);p({type:"tyts:exportResult",requestId:q.requestId,format:"pdf",mime:"application/pdf",dataUrl:Mt},$);return}const Y=await e.editor.exportImage(q.format,q.scale??1);if(!Y){g(q.requestId,zl("export_failed","Image export failed"),$);return}p({type:"tyts:exportResult",requestId:q.requestId,format:q.format,mime:Y.mime,dataUrl:Y.dataUrl},$);return}case"tyts:markSaved":e.editor.markSaved(),q.requestId&&p({type:"tyts:done",requestId:q.requestId},$);return;case"tyts:reset":e.editor.reset(),q.requestId&&p({type:"tyts:done",requestId:q.requestId},$);return;case"tyts:init":return;default:{const Y=q;g(Y.requestId,zl("unknown_message",`Unknown message: ${Y.type}`),$)}}};return{handleMessage:q=>{if(c||!t||q.source!==t.parentWindow||!fF(q.data))return;const $=q.data,Y="requestId"in $?$.requestId:void 0;if($.type==="tyts:init"){E($,q.origin);return}if(l===null){g(Y,zl("not_initialized","Editor is not initialized"),q.origin);return}if(q.origin!==l){g(Y,zl("origin_denied",`Origin not allowed: ${q.origin}`),q.origin);return}D($,l).catch(ht=>{g(Y,zl("handler_error",Vk(ht,"Handler error")),q.origin)})},notifyChange(q,$){d={document:q,dirty:$},M()},announceReady(){const q={type:"tyts:ready",protocol:L2};if(r){p(q,"*");return}for(const $ of n)p(q,$)},stop(){c=!0,f&&clearTimeout(f),f=null,d=null}}}function gF(e){const t=mF(e),n=r=>{t.handleMessage({data:r.data,origin:r.origin,source:r.source})};return window.addEventListener("message",n),t.announceReady(),{...t,stop(){window.removeEventListener("message",n),t.stop()}}}async function yF(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const i=r.result;typeof i=="string"?t(i):n(new Error("Failed to encode blob"))},r.onerror=()=>n(new Error("Failed to encode blob")),r.readAsDataURL(e)})}const bF={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_TYTS_EMBED:"1",VITE_TYTS_FTP:"0",VITE_UAF_SANS:"0"};function xF(){return!0}function vF(e=bF){const t=e.VITE_TYTS_EMBED_ALLOWED_ORIGINS,n=typeof t=="string"?t.split(",").map(s=>s.trim()).filter(Boolean):[],r=e.VITE_TYTS_EMBED_TOKEN,i=typeof r=="string"&&r.trim()?r.trim():void 0;return{allowedOrigins:n.length>0?n:void 0,token:i}}function pd(){return typeof window>"u"||window.location.protocol!=="chrome-extension:"?!1:!!globalThis.chrome?.runtime?.id}function wF(e){if(typeof e!="object"||e===null)return!1;const t=e;return!(typeof t.dataUrl!="string"||!t.dataUrl.startsWith("data:image/")||t.sourceUrl!==void 0&&typeof t.sourceUrl!="string"||t.sourceTitle!==void 0&&typeof t.sourceTitle!="string"||t.capturedAt!==void 0&&!(typeof t.capturedAt=="number"&&Number.isFinite(t.capturedAt)))}function Y6(e){const t=new URL(window.location.href);t.searchParams.delete(e),window.history.replaceState(null,"",t.toString())}function SF(){return pd()?new URLSearchParams(window.location.search).has("capture"):!1}function kF(){if(!pd())return!1;const e=new URLSearchParams(window.location.search).get("restore")==="1";return e&&Y6("restore"),e}async function AF(){if(!pd())return null;const e=new URLSearchParams(window.location.search).get("capture");if(!e)return null;Y6("capture");const t=`capture:${e}`,n=[chrome.storage.session,chrome.storage.local].filter(Boolean);for(const r of n)try{const i=(await r.get(t))[t];if(i===void 0)continue;return r.remove(t),wF(i)?i:null}catch{}return null}const Wk="tyts-ext-settings",up={downloadSubfolder:"Tyts",saveAs:!1};function MF(e){return e.trim().replace(/[/\\]/g,"").replace(/\.\./g,"").replace(/[<>:"|?*]/g,"").slice(0,60)}async function CF(){if(!pd())return{...up};try{const e=(await chrome.storage.sync.get(Wk))[Wk];if(!e||typeof e!="object")return{...up};const t=e;return{downloadSubfolder:typeof t.downloadSubfolder=="string"?MF(t.downloadSubfolder):up.downloadSubfolder,saveAs:typeof t.saveAs=="boolean"?t.saveAs:up.saveAs}}catch{return{...up}}}const Xn="bi",Zn=14,EF=2800,TF=.5,NF=250,_F=16*hi,DF={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},LF=400,RF=6,OF=1500,PF=150;function R2(e){return $5(e)[0]??null}const Xk=96,Gk=44,le=hi,sn=hi*Q5,fp=e=>`${Zf[0]*e} ${Zf[1]*e}`;async function Kk(e,t){try{const n=await CF(),r=n.downloadSubfolder?`${n.downloadSubfolder}/${t}`:t;return await chrome.downloads.download({url:e,filename:r,saveAs:n.saveAs}),!0}catch{return!1}}function Jk(e,t){const n=t.x-e.x,r=t.y-e.y;return Math.abs(n)>=Math.abs(r)?{x:t.x,y:e.y}:{x:e.x,y:t.y}}const yc=Wa[0];function jF(e){return e.filter(t=>t.anchor.type==="numbering").length+1}function Du(e){return e.filter(t=>t.anchor.type!=="numbering"&&t.anchor.type!=="linked").length+1}function Zk(e){let t=0,n=0;const r=new Map;return e.map(s=>s.anchor.type==="linked"?s:s.anchor.type==="numbering"?(t+=1,r.set(s.id,t),{...s,label:t}):(n+=1,r.set(s.id,n),{...s,label:n})).map(s=>s.anchor.type==="linked"?{...s,label:r.get(s.anchor.pinId)??s.label}:s)}function IF(e,t){const n=t.x-e.x,r=t.y-e.y;if(n===0&&r===0)return t;const i=Math.max(Math.abs(n),Math.abs(r)),s=n===0?r>=0?1:-1:Math.sign(n),l=r===0?n>=0?1:-1:Math.sign(r);return{x:e.x+s*i,y:e.y+l*i}}function Qk(e,t){return{x:t.x-e.x,y:t.y-e.y}}const V6=5.25*le,Sg=18*sn,O2=6*sn,t4={fontSize:12*sn,color:"#aaa",flexShrink:0},dp={minWidth:28*sn,height:28*sn,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.18)",color:"#ccc",cursor:"pointer",borderRadius:4*sn,fontSize:16*sn,padding:`${3*sn}px ${8*sn}px`,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center"},Bl=4*le,zF=22*le,BF=18*le,FF=12*le,P2=5*le;function Xd(e,t,n,r=1,i=[]){const s=zF*r,l=V6*1.6*r,c=(e.minX+e.maxX)/2,f=(e.minY+e.maxY)/2,d=[{cx:c,cy:e.minY-s},{cx:c,cy:e.maxY+s},{cx:e.maxX+s,cy:f},{cx:e.minX-s,cy:f}],p=g=>{if(g.cx<l||g.cx>t-l||g.cy<l||g.cy>n-l)return!1;for(const b of i)if(g.cx>=b.x-l&&g.cx<=b.x+b.w+l&&g.cy>=b.y-l&&g.cy<=b.y+b.h+l)return!1;return!0};for(const g of d)if(p(g))return g;return{cx:Math.max(l,Math.min(c,t-l)),cy:Math.max(l,Math.min(e.minY+s,n-l))}}function j2(e,t,n=1){const r={nw:[-1,-1],n:[0,-1],ne:[1,-1],e:[1,0],se:[1,1],s:[0,1],sw:[-1,1],w:[-1,0]},i=1/Math.SQRT2,s=l=>l==="n"||l==="s"||l==="e"||l==="w"?1:i;return e.map(l=>{let c=1/0;for(const g of t){const b=Math.hypot(l.cx-g.x,l.cy-g.y);b<c&&(c=b)}if(c>=BF*n)return l;const[f,d]=r[l.handle],p=FF*n*s(l.handle);return{...l,cx:l.cx+f*p,cy:l.cy+d*p}})}function Gd({color:e,scale:t=1}){const n=V6*t,r=`M 0 ${-n} L ${n} 0 L 0 ${n} L ${-n} 0 Z`;return A.jsx("path",{d:r,fill:e,stroke:"#fff",strokeWidth:1.5*le*t})}function e4(e){const t=e.indexOf(",");if(t<0)return null;const n=e.slice(0,t),r=e.slice(t+1),s=n.match(/data:([^;]+)(;base64)?/)?.[1]??"image/png",l=/;base64/i.test(n);try{if(l){const c=atob(r),f=new Uint8Array(c.length);for(let d=0;d<c.length;d+=1)f[d]=c.charCodeAt(d);return new Blob([f],{type:s})}return new Blob([decodeURIComponent(r)],{type:s})}catch{return null}}const UF=new Set(["jpg","jpeg","png","webp","gif","bmp","svg","avif","heic","heif"]),HF=15e3;function V5(e){if(!e)return!1;if(e.type.startsWith("image/"))return!0;if(e.type)return!1;const t=e.name.lastIndexOf(".");if(t<0||t===e.name.length-1)return!1;const n=e.name.slice(t+1).toLowerCase();return UF.has(n)}function qF(e,t,n=HF){const r=Math.max(e,t);return r<=n?null:`Зображення завелике (${r} px по довгій стороні). Зменште до ${n} px або менше.`}async function $F(e){const t=URL.createObjectURL(e),n=new Image;try{return await new Promise((r,i)=>{n.onload=()=>r(),n.onerror=()=>i(new Error("Image decode failed")),n.src=t}),{width:n.naturalWidth,height:n.naturalHeight}}catch{return null}finally{URL.revokeObjectURL(t)}}const Ya=24,n4=[{id:"free",label:"Вільний формат"},{id:"16:9",label:"16:9"},{id:"16:10",label:"16:10"},{id:"4:3",label:"4:3"},{id:"1:1",label:"Квадрат 1:1"},{id:"21:9",label:"21:9"},{id:"3:2",label:"3:2"},{id:"a4-portrait",label:"A4 (вертикальний)"},{id:"a4-landscape",label:"A4 (горизонтальний)"}];function I2(e){switch(e){case"free":return null;case"16:9":return 16/9;case"16:10":return 16/10;case"4:3":return 4/3;case"1:1":return 1;case"21:9":return 21/9;case"3:2":return 3/2;case"a4-portrait":return 1/Math.SQRT2;case"a4-landscape":return Math.SQRT2}}function r4(e,t,n){if(!n)return{x:0,y:0,width:e,height:t};let r=e,i=r/n;return i>t&&(i=t,r=i*n),{x:(e-r)/2,y:(t-i)/2,width:r,height:i}}const YF=I.forwardRef(function(t,n){const{mode:r="standalone",initialDocument:i,embedConfig:s,features:l,onReady:c,onChange:f,onError:d}=t,p=r==="embed"||xF(),g=I.useMemo(()=>({autosave:l?.autosave??!p}),[p,l]),b=kd(),y=typeof window<"u"&&(navigator.maxTouchPoints>0||window.matchMedia?.("(pointer: coarse)").matches===!0),M=typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent),[E,D]=I.useState(null),[L,q]=I.useState(null),[$,Y]=I.useState(!1),[ht,Mt]=I.useState("free"),[vt,bt]=I.useState(!1),[rt,Dt]=I.useState(null),[Q,lt]=I.useState(!1),[X,wt]=I.useState({w:0,h:0}),[Tt,yt]=I.useState(null),[J,ct]=I.useState([]),[Bt,te]=I.useState({}),[Z,P]=I.useState("select"),[j,G]=I.useState(null),[ut,xt]=I.useState(null),[St,Ft]=I.useState(null),[Rt,Qt]=I.useState(null),{canUndo:ve,canRedo:je,reset:Pe,record:Ve,undo:ft,redo:Oe}=A9(),In=I.useRef(Ve);In.current=Ve;const fe=St!==null?"polygon":Rt!==null?"polyline":"none",ge=I.useRef(fe);I.useEffect(()=>{ge.current!==fe&&(Pe(),ge.current=fe)},[fe,Pe]);const[Te,Ne]=I.useState(null),[_e,Ye]=I.useState("point"),[un,Fn]=I.useState(null),[Ue,_n]=I.useState(null),dn=I.useRef(null),[Be,We]=I.useState(null),[Ie,kr]=I.useState(null),Cn=I.useRef(null),nn=I.useRef(null);I.useEffect(()=>{nn.current=rt},[rt]);const ln=I.useRef(null),[Ln,Ke]=I.useState(!1),ar=I.useRef(!1),[wn,Sn]=I.useState(!1),[gr,En]=I.useState(!1),[en,Kn]=I.useState(!1),[ws,qi]=I.useState(null),Xt=W9(),Re=I.useRef(null);I.useEffect(()=>{Re.current=null},[p,Xt.logo,Xt.settings]);const[Ae,De]=I.useState(()=>new Date),[or,Hn]=I.useState(()=>Qf(new Date)),[lr,Wr]=I.useState(Q2),[Dr,vi]=I.useState(!1),[Wt,qr]=I.useState(null);I.useEffect(()=>{(_e!=="numbering"||Z!=="place")&&un&&(Fn(null),_n(null),dn.current=null)},[_e,Z,un]);const{settings:er,fontFamily:Rn,setFontId:oo,setStrokeWidthScale:Wo,setShowToolTooltips:Us,toggleCalloutPanelCollapsed:Ja}=_8(),Hs=er.calloutPanelCollapsed,Lo=I.useRef(Rn);Lo.current=Rn;const is=er.strokeWidthScale,qs=I.useRef(is);qs.current=is;const pi=I.useCallback(w=>ES(w,is),[is]),[Ar,Aa]=I.useState(!1),[Ti,Wl]=I.useState(!1),[Xo,Go]=I.useState(!1),[Ma,Mc]=I.useState(!1),Ca=H9(),Cc=Ca.getItem;I.useEffect(()=>{if(!Xo)return;const w=k=>{k.key==="Escape"&&Go(!1)};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[Xo]);const[jf,$s]=I.useState(!1),[Ea,Ys]=I.useState(!1),[sr,Ec]=I.useState(!1),Ss=typeof window<"u"&&!!navigator.clipboard&&"ClipboardItem"in window,[ss,Ro]=I.useState(null),[yo,bl]=I.useState(null),[Ni,Qi]=I.useState({w:420*sn,h:96*sn}),Tc=I.useRef(null),Za=I.useRef(null),_i=I.useRef(null),as=I.useRef(!1),wi=I.useRef([]),so=I.useRef([]),Mr=I.useRef(J),Ko=I.useRef(Bt),to=I.useRef(E),Jo=I.useRef(null),Cr=I.useRef(X),xl=I.useRef(Tt);I.useEffect(()=>{Mr.current=J,Ko.current=Bt},[J,Bt]),I.useEffect(()=>{to.current=E},[E]),I.useEffect(()=>{Cr.current=X},[X]),I.useEffect(()=>{xl.current=Tt},[Tt]);const ls=20;function $i(w,k=Cr.current){const _=tA,N=J2,{w:z,h:tt}=k;let nt,F;if(w.type==="linked")nt=0,F=0;else if(w.type==="point")nt=w.x,F=w.y;else if(w.type==="polygon"||w.type==="polyline"){const st=w.points;nt=Math.max(...st.map(dt=>dt.x)),F=Math.max(...st.map(dt=>dt.y))}else w.type==="rectangle"?(nt=w.x+w.width,F=w.y+w.height):w.type==="ellipse"?(nt=w.cx+w.rx,F=w.cy+w.ry):w.type==="compass"?(nt=w.cx+w.radius,F=w.cy+w.radius):w.type==="arrow"?(nt=Math.max(w.start.x,w.end.x,w.control.x),F=Math.max(w.start.y,w.end.y,w.control.y)):w.type==="numbering"?(nt=Math.max(w.start.x,w.end.x),F=Math.max(w.start.y,w.end.y)):w.type==="text"||w.type==="image"?(nt=w.x+w.width,F=w.y+w.height):(nt=w.x,F=w.y);let W=nt+ls,ot=F+ls;return W=Math.max(0,Math.min(W,Math.max(0,z-_))),ot=Math.max(0,Math.min(ot,Math.max(0,tt-N))),{x:W,y:ot,width:_,height:N}}const Jt=I.useCallback(()=>{const w={pins:structuredClone(Mr.current),cardPositions:structuredClone(Ko.current),backgroundImage:to.current,imageSize:structuredClone(Cr.current),sourceImageSize:structuredClone(xl.current)};wi.current=[...wi.current.slice(-99),w],so.current=[],bo(wi.current.length),Qa(0)},[]),[iu,bo]=I.useState(0),[An,Qa]=I.useState(0),Nc=St!==null||Rt!==null,Uu=Nc?ve:iu>0,Xl=Nc?je:An>0,Vs=I.useCallback(()=>{if(wi.current.length===0)return;so.current=[{pins:structuredClone(Mr.current),cardPositions:structuredClone(Ko.current),backgroundImage:to.current,imageSize:structuredClone(Cr.current),sourceImageSize:structuredClone(xl.current)},...so.current];const w=wi.current.pop();ct(w.pins),te(w.cardPositions),D(w.backgroundImage),wt(w.imageSize),yt(w.sourceImageSize),bo(wi.current.length),Qa(so.current.length)},[]),Ws=I.useCallback(()=>{if(so.current.length===0)return;wi.current=[...wi.current,{pins:structuredClone(Mr.current),cardPositions:structuredClone(Ko.current),backgroundImage:to.current,imageSize:structuredClone(Cr.current),sourceImageSize:structuredClone(xl.current)}];const w=so.current.shift();ct(w.pins),te(w.cardPositions),D(w.backgroundImage),wt(w.imageSize),yt(w.sourceImageSize),bo(wi.current.length),Qa(so.current.length)},[]),Oo=I.useCallback(()=>{if(St!==null){const w=ft(St);w!==null&&Ft(w);return}if(Rt!==null){const w=ft(Rt);w!==null&&Qt(w);return}Vs()},[St,Rt,Vs,ft]),ks=I.useCallback(()=>{if(St!==null){const w=Oe(St);w!==null&&Ft(w);return}if(Rt!==null){const w=Oe(Rt);w!==null&&Qt(w);return}Ws()},[St,Rt,Ws,Oe]),Gl=I.useRef(null),Xs=I.useRef(null),Kl=I.useRef(null),cs=I.useRef(()=>{}),Jl=I.useRef(null),tl=I.useRef(null),qn=I.useRef(null),As=I.useRef(null),us=I.useRef(!1),Gs=I.useRef(null),Ta=I.useRef(null),Ks=I.useRef(null),Ms=I.useRef(null),Js=I.useRef(null),Zs=I.useRef(null),vl=I.useRef(null),Cs=I.useRef(null),Qs=I.useRef(null),wl=I.useRef(null),Sl=I.useRef(null),Zl=I.useRef(null),ma=I.useRef(null),Ql=I.useRef(null),C=I.useRef(null),U=I.useRef(null),pt=I.useRef(null),Et=I.useRef(null),zt=I.useRef(null),oe=I.useRef(null),me=I.useRef(null),Xe=I.useRef(null),on=I.useRef(null),zn=I.useRef(null),Un=I.useRef(null),cr=I.useRef(null),Yi=I.useRef(null),Si=I.useRef(null),Lr=I.useRef(null),oi=I.useRef(null),Di=I.useRef(null);I.useEffect(()=>{Di.current=St},[St]);const si=I.useRef(null),ao=I.useRef(null),ta=I.useRef(null),kl=I.useRef(null),fs=I.useRef(null),ds=I.useRef(null),ga=I.useRef(null),ya=I.useRef(null),Na=I.useRef(null),Al=I.useRef(null);I.useEffect(()=>{Al.current=Rt},[Rt]),I.useEffect(()=>{ln.current=Be},[Be]),I.useEffect(()=>{dn.current=un&&Ue?{start:un,end:Ue}:null},[un,Ue]);const ce=I.useRef(!1),ba=20,xo=10,On=20,[gn,Zo]=I.useState(!1),[tc,ec]=I.useState(!1),[Er,Li]=I.useState(1),[nc,xa]=I.useState(!1),[rc,_a]=I.useState(null);I.useEffect(()=>{if(!E){_a(null);return}let w=!1;const k=new Image;return k.onload=()=>{w||_a(k)},k.onerror=()=>{w||_a(null)},k.src=E,()=>{w=!0}},[E]),I.useLayoutEffect(()=>{const w=Tc.current;if(!w)return;const k=()=>{const z=Math.max(1,Math.ceil(w.getBoundingClientRect().width),Math.ceil(w.scrollWidth)),tt=Math.max(1,Math.ceil(w.getBoundingClientRect().height),Math.ceil(w.scrollHeight));Qi(nt=>nt.w!==z||nt.h!==tt?{w:z,h:tt}:nt)};k();const _=requestAnimationFrame(k),N=new ResizeObserver(k);return N.observe(w),()=>{cancelAnimationFrame(_),N.disconnect()}},[j,ut,yo]);const Ml=I.useRef(null),Vi=I.useRef(null),Po=I.useRef(null),Cl=I.useRef(null),Da=I.useRef(null),el=I.useRef(null),ic=I.useRef(null),nl=I.useRef(null),Ri=I.useRef(null),[_c,Or]=I.useState(!1),[jo,La]=I.useState(!1),oc=I.useRef(null),hs=I.useRef({isPanning:!1,startX:0,startY:0,startScrollLeft:0,startScrollTop:0}),eo=I.useRef(new Map),ea=I.useRef(null),Qo=I.useRef(!0),ts=I.useRef(null),na=I.useRef(1),ps=I.useCallback(w=>{const k=[.25,.5,.75,1,1.25,1.5,1.75,2,2.5,3,3.5,4,5,6,8,10,12,16,20];ts.current="viewport-center",Li(_=>{const N=Math.min(k[k.length-1],Math.max(k[0],_));let z=0;for(let F=1;F<k.length;F+=1)Math.abs(k[F]-N)<Math.abs(k[z]-N)&&(z=F);const tt=w==="in"?Math.min(k.length-1,z+1):Math.max(0,z-1),nt=k[tt];return Qo.current=!1,nt})},[]),xe=I.useCallback((w,k)=>{if(!As.current)return{x:0,y:0};const _=w,N=k,z=As.current.getBoundingClientRect(),tt=Er||1,nt=(_-z.left)/tt,F=(N-z.top)/tt;return{x:nt,y:F}},[Er]),Pr=I.useCallback((w,k,_)=>{const N=new Image;N.onload=()=>{const z=K2,tt=Math.min(z/N.naturalWidth,z/N.naturalHeight,Number.POSITIVE_INFINITY),nt=Math.round(N.naturalWidth*tt),F=Math.round(N.naturalHeight*tt);if(wt({w:nt,h:F}),yt({w:N.naturalWidth,h:N.naturalHeight}),D(w),G(null),xt(null),Ft(null),Qt(null),Ne(null),kr(null),Y(!1),Dt(null),k){const W=Re.current;if(W){const ot=fa(),st=sg(W.settings,W.settings.corner,W.logo.aspect,nt,F,uf),dt=BS(ot,W.logo,st,1,yc);ct([dt]),te({[ot]:$i(dt.anchor,{w:nt,h:F})})}else ct([]),te({})}us.current=!0,Qo.current=!0,_?.(!0)},N.onerror=()=>{_?.(!1)},N.src=w},[]);I.useEffect(()=>()=>{Jo.current&&(URL.revokeObjectURL(Jo.current),Jo.current=null)},[]),I.useEffect(()=>{if(!E||!qn.current||!X.w||!X.h)return;const w=qn.current,k=X.w*Er,_=X.h*Er,{clientWidth:N,clientHeight:z}=w;if(ts.current==="viewport-center"){const tt=na.current,nt=w.scrollLeft+N/2,F=w.scrollTop+z/2,W=nt/tt,ot=F/tt;w.scrollLeft=Math.max(0,Math.min(k-N,W*Er-N/2)),w.scrollTop=Math.max(0,Math.min(_-z,ot*Er-z/2)),ts.current=null}else Qo.current&&(w.scrollLeft=Math.max(0,(k-N)/2),w.scrollTop=Math.max(0,(_-z)/2));na.current=Er},[E,X.w,X.h,Er]),I.useEffect(()=>{if(!us.current||!E||!X.w||!X.h)return;const w=qn.current,k=X.w,_=X.h,N=()=>{const nt=qn.current;if(!nt?.clientWidth||!nt?.clientHeight)return!1;const F=Math.min(nt.clientWidth/k,nt.clientHeight/_);if(!F||!Number.isFinite(F))return!1;const W=Math.max(Qm,Math.min(tg,+F.toFixed(eg)));return us.current=!1,Li(W),!0};if(N())return;let z=0,tt=null;return z=requestAnimationFrame(()=>{z=0,!N()&&w&&(tt=new ResizeObserver(()=>{N()&&tt?.disconnect()}),tt.observe(w))}),()=>{z&&cancelAnimationFrame(z),tt?.disconnect()}},[E,X.w,X.h]);const vo=I.useCallback(()=>{if(!E||!qn.current||!X.w||!X.h)return;const w=qn.current,{clientWidth:k,clientHeight:_}=w;if(!k||!_)return;const N=Math.min(k/X.w,_/X.h);if(!N||!Number.isFinite(N))return;const z=Math.max(Qm,Math.min(tg,+N.toFixed(eg)));Qo.current=!0,Li(z)},[E,X.w,X.h]);I.useEffect(()=>{const w=qn.current;if(!w)return;const k=_=>{if(!to.current||!(_.ctrlKey||_.metaKey))return;_.preventDefault();const N=w.getBoundingClientRect(),z=_.clientX,tt=_.clientY,nt=z-N.left,F=tt-N.top,W=_.deltaY>0?1/bS:bS;Li(ot=>{const st=Math.min(tg,Math.max(Qm,+(ot*W).toFixed(eg))),dt=w.scrollLeft+nt,B=w.scrollTop+F,Nt=dt/ot,It=B/ot,kt=Cr.current.w*st,Lt=Cr.current.h*st;return w.scrollLeft=Math.max(0,Math.min(kt-w.clientWidth,Nt*st-nt)),w.scrollTop=Math.max(0,Math.min(Lt-w.clientHeight,It*st-F)),Qo.current=!1,st})};return w.addEventListener("wheel",k,{passive:!1}),()=>w.removeEventListener("wheel",k)},[]);const ur=I.useCallback(async w=>{if(!V5(w))return;const k=await $F(w);if(!k){q("Не вдалося відкрити зображення. Спробуйте інший файл.");return}const _=qF(k.width,k.height);if(_){q(_);return}q(null),qr(null);const N=URL.createObjectURL(w);Pr(N,!0,z=>{if(!z){q("Не вдалося завантажити зображення. Спробуйте файл меншого розміру."),URL.revokeObjectURL(N);return}Jo.current&&Jo.current!==N&&URL.revokeObjectURL(Jo.current),Jo.current=N})},[Pr]),jr=I.useCallback(w=>{if(!V5(w)||!to.current)return;Jt(),qr(null);const k=URL.createObjectURL(w);Pr(k,!1,_=>{if(!_){URL.revokeObjectURL(k);return}Jo.current&&Jo.current!==k&&URL.revokeObjectURL(Jo.current),Jo.current=k})},[Pr,Jt]),ai=w=>{const k=w.target.files?.[0];k&&(ur(k),w.target.value="")},Qr=w=>{const k=w.target.files?.[0];k&&(jr(k),w.target.value="")},va=I.useCallback(()=>{if(!to.current)return;const{w,h:k}=Cr.current;if(!w||!k)return;const _=I2(ht);Dt(r4(w,k,_)),Y(!0),bt(!1),P("select")},[ht]),Dc=I.useCallback(()=>{Y(!1),bt(!1),Dt(null),Ks.current=null,Ms.current=null},[]),sc=I.useCallback(w=>{Mt(w);const{w:k,h:_}=Cr.current;!k||!_||Dt(r4(k,_,I2(w)))},[]),ou=I.useCallback(w=>{if(!nn.current)return;w.preventDefault(),w.stopPropagation();const k=xe(w.clientX,w.clientY);Ks.current={startRect:nn.current,startSvgX:k.x,startSvgY:k.y}},[xe]),If=I.useCallback((w,k)=>{if(!nn.current)return;k.preventDefault(),k.stopPropagation();const _=xe(k.clientX,k.clientY);Ms.current={corner:w,startRect:nn.current,startSvgX:_.x,startSvgY:_.y,aspect:I2(ht)}},[ht,xe]),Td=I.useCallback(async()=>{if(!nn.current||!to.current||!xl.current||!Cr.current.w||!Cr.current.h)return;const w=to.current,k=nn.current,_=xl.current,N=Cr.current,z=_.w/N.w,tt=_.h/N.h,nt=Math.max(0,Math.round(k.x*z)),F=Math.max(0,Math.round(k.y*tt)),W=Math.max(1,Math.round(k.width*z)),ot=Math.max(1,Math.round(k.height*tt)),st=new Image;lt(!0);try{await new Promise((At,Ht)=>{st.onload=()=>At(),st.onerror=()=>Ht(new Error("Crop image load failed")),st.src=w});const dt=document.createElement("canvas");dt.width=W,dt.height=ot;const B=dt.getContext("2d");if(!B)return;B.drawImage(st,nt,F,W,ot,0,0,W,ot);const Nt=dt.toDataURL("image/png"),It=X8(W,ot),{pins:kt,cardPositions:Lt}=K8(Mr.current,Ko.current,k,It);Jt(),ct(kt),te(Lt),G(null),xt(null),Ro(null),Pr(Nt,!1),Y(!1),bt(!1),Dt(null)}finally{lt(!1),Ks.current=null,Ms.current=null}},[Pr,Jt]);I.useEffect(()=>{const w=k=>{if(E||zg(k.target))return;const _=k.clipboardData?.items;if(_){for(const N of _)if(N.type.startsWith("image/")){k.preventDefault();const z=N.getAsFile();if(!z)return;const tt=new FileReader;tt.onload=nt=>{const F=nt.target?.result;F&&(qr(null),Pr(F,!0))},tt.readAsDataURL(z);return}}};return document.addEventListener("paste",w),()=>document.removeEventListener("paste",w)},[E,Pr]),I.useEffect(()=>{const w=_=>{_.dataTransfer?.types?.includes("Files")&&(_.preventDefault(),_.dataTransfer.dropEffect="copy")},k=_=>{if(!_.dataTransfer?.files?.length)return;_.preventDefault();const N=_.dataTransfer.files[0];if(N){if(!to.current){ur(N);return}cs.current(N)}};return window.addEventListener("dragover",w),window.addEventListener("drop",k),()=>{window.removeEventListener("dragover",w),window.removeEventListener("drop",k)}},[ur]),I.useEffect(()=>{const w=()=>{if(!Vi.current)return;const N=Vi.current,z=N.scrollWidth>N.clientWidth,tt=typeof window<"u"&&window.innerWidth<(y?1280:EF),nt=z||tt,F=typeof window<"u"&&window.innerWidth<(y?1040:1320),W=N.clientWidth<(y?980:1240);Zo(nt),ec(F||z&&W)};w(),window.addEventListener("resize",w);const k=Vi.current;let _=null;return k&&typeof ResizeObserver<"u"&&(_=new ResizeObserver(()=>w()),_.observe(k)),()=>{window.removeEventListener("resize",w),_&&_.disconnect()}},[y]),I.useEffect(()=>{X.w&&te(w=>{const k=new Set(J.filter(z=>z.anchor.type==="text").map(z=>z.id)),_=Object.fromEntries(Object.entries(w).filter(([z])=>!k.has(z))),N=J.filter(z=>z.anchor.type!=="text").map(z=>z.id);return N.length===0||Object.keys(_).length>0?Object.keys(_).length===Object.keys(w).length?w:_:W8(N,X.w,X.h)})},[J.length,X]);const Hu=I.useCallback(w=>{if($||Z!=="place"||!E)return;const k=w.target;if(k!==Gl.current&&k.getAttribute?.("data-background")!=="true")return;w.preventDefault();const{x:_,y:N}=xe(w.clientX,w.clientY),{w:z,h:tt}=Cr.current,nt=Math.max(0,Math.min(_,z)),F=Math.max(0,Math.min(N,tt));if(_e==="arrow"&&!Te&&St===null&&Rt===null){const W={start:{x:nt,y:F},end:{x:nt,y:F},control:{x:nt,y:F}};ln.current=W,We(W);return}if(_e==="numbering"&&!Te&&St===null&&Rt===null){const W={start:{x:nt,y:F},end:{x:nt,y:F}};dn.current=W,Fn(W.start),_n(W.end);return}Te&&(Cn.current={shape:Te,x1:nt,y1:F,x2:nt,y2:F},kr({x1:nt,y1:F,x2:nt,y2:F}))},[Z,Te,E,xe,_e,St,Rt,$]),El=I.useCallback(w=>{if(w&&(w.preventDefault(),w.stopPropagation()),!St||St.length<2)return;const k=fa(),_=yc,N={type:"polygon",points:[...St],rotation:0},z=$i(N);Jt(),ct(tt=>[...tt,{id:k,anchor:N,color:_,strokeStyle:ed,fillStyle:Fp,label:Du(tt),image:null,imageAspect:null,description:"",descPos:"below"}]),te(tt=>({...tt,[k]:z})),Ft(null),G(k),xt(k),P("select"),_i.current=k,as.current=!0},[St,Jt]),Ra=I.useCallback(w=>{if(w&&(w.preventDefault(),w.stopPropagation()),!Rt||Rt.length<2)return;const k=fa(),_=yc,N={type:"polyline",points:[...Rt],rotation:0},z=$i(N);Jt(),ct(tt=>[...tt,{id:k,anchor:N,color:_,strokeStyle:ed,label:Du(tt),image:null,imageAspect:null,description:"",descPos:"below"}]),te(tt=>({...tt,[k]:z})),Qt(null),G(k),xt(k),P("select"),_i.current=k,as.current=!0},[Rt,Jt]),ra=I.useCallback(w=>{if($)return;const k=w.target;if(Z!=="place"&&(k===Gl.current||k.getAttribute?.("data-background")==="true")){G(null),xt(null);return}if(Z!=="place"||!E)return;if(ce.current){ce.current=!1;return}const{x:_,y:N}=xe(w.clientX,w.clientY),{w:z,h:tt}=Cr.current;if(_<0||N<0||_>z||N>tt)return;let nt=_,F=N;if(St!==null){if(w.shiftKey&&St.length>0){const At=Jk(St[St.length-1],{x:_,y:N});nt=Math.max(0,Math.min(At.x,z)),F=Math.max(0,Math.min(At.y,tt))}if(St.length>=2){const At=St[0];if(Math.hypot(nt-At.x,F-At.y)<18*le){w.preventDefault(),w.stopPropagation(),El(w);return}}Ve(St),Ft(At=>[...At??[],{x:nt,y:F}]);return}if(Rt!==null){if(w.shiftKey&&Rt.length>0){const At=Jk(Rt[Rt.length-1],{x:_,y:N});nt=Math.max(0,Math.min(At.x,z)),F=Math.max(0,Math.min(At.y,tt))}Ve(Rt),Qt(At=>[...At??[],{x:nt,y:F}]);return}if(_e==="arrow"||_e==="numbering")return;w.preventDefault(),w.stopPropagation();const W=fa(),ot=yc,st=_e==="pointText",dt=_e==="text"||st,B=_e==="standalone",Nt={width:Xk,height:Gk},It=st?hA({x:_,y:N},v8,Nt):{x:_,y:N},kt=dt?{type:"text",x:It.x,y:It.y,...Nt,...st?{point:{x:_,y:N}}:{}}:B?{type:"standalone",x:_,y:N}:{type:"point",x:_,y:N},Lt=dt?null:$i(kt);Jt(),ct(At=>[...At,{id:W,anchor:kt,color:ot,label:Du(At),image:null,imageAspect:null,description:dt?Wy:"",descPos:"below",textColor:st?w8:void 0,textBackgroundColor:st?S8:dt?null:void 0}]),Lt&&te(At=>({...At,[W]:Lt})),G(W),xt(W),P("select"),_i.current=W,as.current=!0,dt&&Ro(W)},[Z,E,xe,St,Rt,Jt,El,_e,$,Ve]),Lc=I.useCallback(w=>{if(!E||(ji.current=xe(w.clientX,w.clientY),Z!=="place"||_e!=="numbering"||!un))return;const{x:k,y:_}=xe(w.clientX,w.clientY),{w:N,h:z}=Cr.current;_n({x:Math.max(0,Math.min(k,N)),y:Math.max(0,Math.min(_,z))})},[E,Z,_e,un,xe]);I.useEffect(()=>{const w=k=>{k.key==="Enter"&&(St&&St.length>=2?El():Rt&&Rt.length>=2&&Ra()),k.key==="Escape"&&Z==="place"&&(k.preventDefault(),un&&(Fn(null),_n(null),dn.current=null),St&&St.length>0&&Ft(null),Rt&&Rt.length>0&&Qt(null),Te&&(Ne(null),kr(null),Cn.current=null),ln.current&&(We(null),ln.current=null),P("select"))};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[Z,un,St,Rt,El,Ra,Te]);const Es=I.useCallback((w,k)=>{if(Z==="place")return;k.preventDefault();const _=Bt[w];if(!_)return;Jt();const N=xe(k.clientX,k.clientY);ce.current=!1,Gs.current={pinId:w,startCardX:_.x,startCardY:_.y,startSvgX:N.x,startSvgY:N.y}},[Bt,xe,Z,Jt]),ac=I.useCallback((w,k,_)=>{_.preventDefault();const N=Bt[w];if(!N)return;Jt();const z=xe(_.clientX,_.clientY);ce.current=!1,Ta.current={pinId:w,handle:k,startCardX:N.x,startCardY:N.y,startCardW:N.width,startCardH:N.height,startSvgX:z.x,startSvgY:z.y}},[Bt,xe,Jt]);I.useEffect(()=>{const w=N=>xe(N.clientX,N.clientY),k=N=>{const{w:z,h:tt}=Cr.current;if(Ks.current){const{startRect:nt,startSvgX:F,startSvgY:W}=Ks.current,ot=w(N),st=ot.x-F,dt=ot.y-W;Dt({x:Math.max(0,Math.min(nt.x+st,z-nt.width)),y:Math.max(0,Math.min(nt.y+dt,tt-nt.height)),width:nt.width,height:nt.height});return}if(Ms.current){const{corner:nt,startRect:F,startSvgX:W,startSvgY:ot,aspect:st}=Ms.current,dt=w(N),B=dt.x-W,Nt=dt.y-ot;let It={...F};if(st==null)if(nt==="nw"){const kt=F.x+F.width,Lt=F.y+F.height,At=Math.max(0,Math.min(F.x+B,kt-Ya)),Ht=Math.max(0,Math.min(F.y+Nt,Lt-Ya));It={x:At,y:Ht,width:kt-At,height:Lt-Ht}}else if(nt==="ne"){const kt=F.y+F.height,Lt=Math.max(Ya,Math.min(F.width+B,z-F.x)),At=Math.max(0,Math.min(F.y+Nt,kt-Ya));It={x:F.x,y:At,width:Lt,height:kt-At}}else if(nt==="se"){const kt=Math.max(Ya,Math.min(F.width+B,z-F.x)),Lt=Math.max(Ya,Math.min(F.height+Nt,tt-F.y));It={x:F.x,y:F.y,width:kt,height:Lt}}else{const kt=F.x+F.width,Lt=Math.max(0,Math.min(F.x+B,kt-Ya)),At=Math.max(Ya,Math.min(F.height+Nt,tt-F.y));It={x:Lt,y:F.y,width:kt-Lt,height:At}}else{const kt=nt==="nw"?{x:F.x+F.width,y:F.y+F.height}:nt==="ne"?{x:F.x,y:F.y+F.height}:nt==="se"?{x:F.x,y:F.y}:{x:F.x+F.width,y:F.y},Lt=nt==="nw"||nt==="sw"?Math.max(0,Math.min(F.x+B,kt.x-Ya)):Math.max(kt.x+Ya,Math.min(F.x+F.width+B,z)),At=nt==="nw"||nt==="ne"?Math.max(0,Math.min(F.y+Nt,kt.y-Ya)):Math.max(kt.y+Ya,Math.min(F.y+F.height+Nt,tt)),Ht=Math.abs(Lt-kt.x),Yt=Math.abs(At-kt.y),de=nt==="nw"||nt==="sw"?kt.x:z-kt.x,be=nt==="nw"||nt==="ne"?kt.y:tt-kt.y;let Me=Ht,Je=Yt;Me/Math.max(1,Je)>st?Je=Me/st:Me=Je*st;const kn=Math.max(Ya,Math.min(de,be*st));Me=Math.max(Ya,Math.min(Me,kn)),Je=Me/st,It={x:nt==="nw"||nt==="sw"?kt.x-Me:kt.x,y:nt==="nw"||nt==="ne"?kt.y-Je:kt.y,width:Me,height:Je}}Dt(It);return}if(oi.current){const{pointIndex:nt,startX:F,startY:W,startSvgX:ot,startSvgY:st}=oi.current,dt=w(N),B=dt.x-ot,Nt=dt.y-st;(Math.abs(B)>2||Math.abs(Nt)>2)&&(ce.current=!0);const It=Math.max(0,Math.min(F+B,z)),kt=Math.max(0,Math.min(W+Nt,tt));Ft(Lt=>{if(!Lt||nt<0||nt>=Lt.length)return Lt;const At=[...Lt];return At[nt]={x:It,y:kt},At});return}if(fs.current){const{pointIndex:nt,startX:F,startY:W,startSvgX:ot,startSvgY:st}=fs.current,dt=w(N),B=dt.x-ot,Nt=dt.y-st;(Math.abs(B)>2||Math.abs(Nt)>2)&&(ce.current=!0);const It=Math.max(0,Math.min(F+B,z)),kt=Math.max(0,Math.min(W+Nt,tt));Qt(Lt=>{if(!Lt||nt<0||nt>=Lt.length)return Lt;const At=[...Lt];return At[nt]={x:It,y:kt},At});return}if(Cn.current){const nt=w(N);let F=Math.max(0,Math.min(nt.x,z)),W=Math.max(0,Math.min(nt.y,tt));if(N.shiftKey){const ot=IF({x:Cn.current.x1,y:Cn.current.y1},{x:F,y:W});F=Math.max(0,Math.min(ot.x,z)),W=Math.max(0,Math.min(ot.y,tt))}Cn.current.x2=F,Cn.current.y2=W,kr({x1:Cn.current.x1,y1:Cn.current.y1,x2:F,y2:W});return}if(ln.current){const nt=w(N),F=Math.max(0,Math.min(nt.x,z)),W=Math.max(0,Math.min(nt.y,tt)),ot=ln.current.start;(Math.abs(F-ot.x)>2||Math.abs(W-ot.y)>2)&&(ce.current=!0);const st={start:ot,end:{x:F,y:W},control:{x:(ot.x+F)/2,y:(ot.y+W)/2}};ln.current=st,We(st);return}if(dn.current){const nt=w(N),F=Math.max(0,Math.min(nt.x,z)),W=Math.max(0,Math.min(nt.y,tt)),ot=dn.current.start;(Math.abs(F-ot.x)>2||Math.abs(W-ot.y)>2)&&(ce.current=!0);const st={start:ot,end:{x:F,y:W}};dn.current=st,Fn(ot),_n(st.end);return}if(Zl.current){const{pinId:nt,startCenterX:F,startCenterY:W,startDist:ot,startFontSize:st}=Zl.current,dt=w(N),B=Math.hypot(dt.x-F,dt.y-W);Math.abs(B-ot)>1.5&&(ce.current=!0);const Nt=Math.max(.25,B/Math.max(1,ot)),It=Math.max(10,Math.round(st*Nt));ct(kt=>kt.map(Lt=>{if(Lt.id!==nt||Lt.anchor.type!=="text")return Lt;const At=es(Lt.description||"",{fontSize:It,bold:Lt.textBold??!1,italic:Lt.textItalic??!1}),Ht=At.width,Yt=At.height,de=Math.max(0,Math.min(F-Ht/2,z-Ht)),be=Math.max(0,Math.min(W-Yt/2,tt-Yt));return{...Lt,textFontSize:It,anchor:{...Lt.anchor,x:de,y:be,width:Ht,height:Yt}}}));return}if(C.current){const{pinId:nt,startX:F,startY:W,startSvgX:ot,startSvgY:st}=C.current,dt=w(N),B=dt.x-ot,Nt=dt.y-st;(Math.abs(B)>2||Math.abs(Nt)>2)&&(ce.current=!0),ct(It=>It.map(kt=>kt.id!==nt||kt.anchor.type!=="redact"?kt:{...kt,anchor:{...kt.anchor,x:Math.max(0,Math.min(F+B,z-kt.anchor.width)),y:Math.max(0,Math.min(W+Nt,tt-kt.anchor.height))}}));return}if(U.current){const{pinId:nt,handle:F,startX:W,startY:ot,startW:st,startH:dt,startSvgX:B,startSvgY:Nt}=U.current,It=w(N),kt=It.x-B,Lt=It.y-Nt;(Math.abs(kt)>2||Math.abs(Lt)>2)&&(ce.current=!0);const At=W+st,Ht=ot+dt,Yt=F==="nw"||F==="sw",de=F==="nw"||F==="ne",be=Yt?Math.min(W+kt,At-rg):W,Me=de?Math.min(ot+Lt,Ht-rg):ot,Je=Yt?At-be:Math.max(rg,st+kt),kn=de?Ht-Me:Math.max(rg,dt+Lt);ct(ye=>ye.map(bn=>bn.id!==nt||bn.anchor.type!=="redact"?bn:{...bn,anchor:{...bn.anchor,x:be,y:Me,width:Je,height:kn}}));return}if(pt.current){const{pinId:nt,startX:F,startY:W,startSvgX:ot,startSvgY:st}=pt.current,dt=w(N),B=dt.x-ot,Nt=dt.y-st;(Math.abs(B)>2||Math.abs(Nt)>2)&&(ce.current=!0),ct(It=>It.map(kt=>kt.id!==nt||kt.anchor.type!=="image"?kt:{...kt,anchor:{...kt.anchor,x:Math.max(0,Math.min(F+B,z-kt.anchor.width)),y:Math.max(0,Math.min(W+Nt,tt-kt.anchor.height))}}));return}if(Et.current){const{pinId:nt,handle:F,startX:W,startY:ot,startW:st,startH:dt,startSvgX:B,startSvgY:Nt}=Et.current,It=w(N),kt=It.x-B,Lt=It.y-Nt;(Math.abs(kt)>2||Math.abs(Lt)>2)&&(ce.current=!0);const Ht=Math.max(uf,st+(F==="ne"||F==="se"?1:-1)*kt);ct(Yt=>Yt.map(de=>{if(de.id!==nt||de.anchor.type!=="image")return de;const be=de.anchor.aspect||1,Me=Ht,Je=Math.max(uf,Me/be),kn=F==="nw"||F==="sw"?W+st-Me:W,ye=F==="nw"||F==="ne"?ot+dt-Je:ot;return{...de,anchor:{...de.anchor,x:kn,y:ye,width:Me,height:Je}}}));return}if(Qs.current){const{pinId:nt,startPoint:F,startBox:W,startSvgX:ot,startSvgY:st}=Qs.current,dt=w(N),B=dt.x-ot,Nt=dt.y-st;(Math.abs(B)>2||Math.abs(Nt)>2)&&(ce.current=!0);const It=Math.max(0,Math.min(F.x+B,z)),kt=Math.max(0,Math.min(F.y+Nt,tt));ct(Lt=>Lt.map(At=>At.id!==nt||At.anchor.type!=="text"||!At.anchor.point?At:{...At,anchor:{...At.anchor,point:{x:It,y:kt},x:W.x+(It-F.x),y:W.y+(kt-F.y)}}));return}if(wl.current){const{pinId:nt,startX:F,startY:W,startSvgX:ot,startSvgY:st}=wl.current,dt=w(N),B=dt.x-ot,Nt=dt.y-st;(Math.abs(B)>2||Math.abs(Nt)>2)&&(ce.current=!0),ct(It=>It.map(kt=>{if(kt.id!==nt||kt.anchor.type!=="text")return kt;const Lt={width:kt.anchor.width,height:kt.anchor.height};if(kt.anchor.point){const Yt={x:F+B+Lt.width/2,y:W+Nt+Lt.height/2},de=lD(kt.anchor.point,Yt,Lt);return{...kt,anchor:{...kt.anchor,x:de.x,y:de.y}}}const At=Math.max(0,Math.min(F+B,z-Lt.width)),Ht=Math.max(0,Math.min(W+Nt,tt-Lt.height));return{...kt,anchor:{...kt.anchor,x:At,y:Ht}}}));return}if(Js.current){const{pinId:nt,startPinX:F,startPinY:W,startSvgX:ot,startSvgY:st}=Js.current,dt=w(N),B=dt.x-ot,Nt=dt.y-st;(Math.abs(B)>2||Math.abs(Nt)>2)&&(ce.current=!0),ct(It=>It.map(kt=>kt.id!==nt||kt.anchor.type!=="point"?kt:{...kt,anchor:{type:"point",x:Math.max(0,Math.min(F+B,z)),y:Math.max(0,Math.min(W+Nt,tt))}}));return}if(Zs.current){const{pinId:nt,startStart:F,startEnd:W,startSvgX:ot,startSvgY:st}=Zs.current,dt=w(N),B=dt.x-ot,Nt=dt.y-st;(Math.abs(B)>2||Math.abs(Nt)>2)&&(ce.current=!0),ct(It=>It.map(kt=>kt.id!==nt||kt.anchor.type!=="numbering"?kt:{...kt,anchor:{type:"numbering",start:{x:Math.max(0,Math.min(F.x+B,z)),y:Math.max(0,Math.min(F.y+Nt,tt))},end:{x:Math.max(0,Math.min(W.x+B,z)),y:Math.max(0,Math.min(W.y+Nt,tt))}}}));return}if(vl.current){const{pinId:nt,endpoint:F,startStart:W,startEnd:ot,startSvgX:st,startSvgY:dt}=vl.current,B=w(N),Nt=B.x-st,It=B.y-dt;(Math.abs(Nt)>2||Math.abs(It)>2)&&(ce.current=!0);const kt=F==="start"?{x:Math.max(0,Math.min(W.x+Nt,z)),y:Math.max(0,Math.min(W.y+It,tt))}:W,Lt=F==="end"?{x:Math.max(0,Math.min(ot.x+Nt,z)),y:Math.max(0,Math.min(ot.y+It,tt))}:ot;ct(At=>At.map(Ht=>Ht.id!==nt||Ht.anchor.type!=="numbering"?Ht:{...Ht,anchor:{type:"numbering",start:kt,end:Lt}}));return}if(ma.current){const{pinId:nt,pointIndex:F,startPoints:W,startSvgX:ot,startSvgY:st}=ma.current,dt=w(N),B=dt.x-ot,Nt=dt.y-st;(Math.abs(B)>2||Math.abs(Nt)>2)&&(ce.current=!0),ct(It=>It.map(kt=>{if(kt.id!==nt||kt.anchor.type!=="polygon")return kt;const Lt=[...kt.anchor.points];return Lt[F]={x:Math.max(0,Math.min(W[F].x+B,z)),y:Math.max(0,Math.min(W[F].y+Nt,tt))},{...kt,anchor:{type:"polygon",points:Lt,rotation:kt.anchor.rotation??0}}}));return}if(Ql.current){const{pinId:nt,startPoints:F,startSvgX:W,startSvgY:ot}=Ql.current,st=w(N),dt=st.x-W,B=st.y-ot;(Math.abs(dt)>2||Math.abs(B)>2)&&(ce.current=!0),ct(Nt=>Nt.map(It=>{if(It.id!==nt||It.anchor.type!=="polygon")return It;const kt=F.map(Lt=>({x:Math.max(0,Math.min(Lt.x+dt,z)),y:Math.max(0,Math.min(Lt.y+B,tt))}));return{...It,anchor:{type:"polygon",points:kt,rotation:It.anchor.rotation??0}}}));return}if(si.current){const{pinId:nt,pointIndex:F,startPoints:W,startSvgX:ot,startSvgY:st}=si.current,dt=w(N),B=dt.x-ot,Nt=dt.y-st;(Math.abs(B)>2||Math.abs(Nt)>2)&&(ce.current=!0),ct(It=>It.map(kt=>{if(kt.id!==nt||kt.anchor.type!=="polyline")return kt;const Lt=[...kt.anchor.points];return Lt[F]={x:Math.max(0,Math.min(W[F].x+B,z)),y:Math.max(0,Math.min(W[F].y+Nt,tt))},{...kt,anchor:{type:"polyline",points:Lt,rotation:kt.anchor.rotation??0}}}));return}if(ao.current){const{pinId:nt,startPoints:F,startSvgX:W,startSvgY:ot}=ao.current,st=w(N),dt=st.x-W,B=st.y-ot;(Math.abs(dt)>2||Math.abs(B)>2)&&(ce.current=!0),ct(Nt=>Nt.map(It=>{if(It.id!==nt||It.anchor.type!=="polyline")return It;const kt=F.map(Lt=>({x:Math.max(0,Math.min(Lt.x+dt,z)),y:Math.max(0,Math.min(Lt.y+B,tt))}));return{...It,anchor:{type:"polyline",points:kt,rotation:It.anchor.rotation??0}}}));return}if(kl.current){const{pinId:nt,handle:F,startPoints:W,startMinX:ot,startMinY:st,startMaxX:dt,startMaxY:B,startSvgX:Nt,startSvgY:It}=kl.current,kt=w(N);(Math.abs(kt.x-Nt)>2||Math.abs(kt.y-It)>2)&&(ce.current=!0);const Lt=Math.max(On,dt-ot),At=Math.max(On,B-st);let Ht=ot,Yt=st,de=dt,be=B;switch(F){case"se":de=Math.max(ot+On,kt.x),be=Math.max(st+On,kt.y);break;case"sw":Ht=Math.min(dt-On,kt.x),be=Math.max(st+On,kt.y);break;case"nw":Ht=Math.min(dt-On,kt.x),Yt=Math.min(B-On,kt.y);break;case"ne":de=Math.max(ot+On,kt.x),Yt=Math.min(B-On,kt.y);break;case"n":Yt=Math.min(B-On,kt.y);break;case"s":be=Math.max(st+On,kt.y);break;case"e":de=Math.max(ot+On,kt.x);break;case"w":Ht=Math.min(dt-On,kt.x);break}const Me=de-Ht,Je=be-Yt,kn=W.map(ye=>({x:Ht+(ye.x-ot)/Lt*Me,y:Yt+(ye.y-st)/At*Je}));ct(ye=>ye.map(bn=>bn.id!==nt||bn.anchor.type!=="polyline"?bn:{...bn,anchor:{type:"polyline",points:kn,rotation:bn.anchor.rotation??0}}));return}if(Lr.current){const{pinId:nt,handle:F,startPoints:W,startMinX:ot,startMinY:st,startMaxX:dt,startMaxY:B,startSvgX:Nt,startSvgY:It}=Lr.current,kt=w(N);(Math.abs(kt.x-Nt)>2||Math.abs(kt.y-It)>2)&&(ce.current=!0);const Lt=Math.max(On,dt-ot),At=Math.max(On,B-st);let Ht=ot,Yt=st,de=dt,be=B;switch(F){case"se":de=Math.max(ot+On,kt.x),be=Math.max(st+On,kt.y);break;case"sw":Ht=Math.min(dt-On,kt.x),be=Math.max(st+On,kt.y);break;case"nw":Ht=Math.min(dt-On,kt.x),Yt=Math.min(B-On,kt.y);break;case"ne":de=Math.max(ot+On,kt.x),Yt=Math.min(B-On,kt.y);break;case"n":Yt=Math.min(B-On,kt.y);break;case"s":be=Math.max(st+On,kt.y);break;case"e":de=Math.max(ot+On,kt.x);break;case"w":Ht=Math.min(dt-On,kt.x);break}const Me=de-Ht,Je=be-Yt,kn=W.map(ye=>({x:Ht+(ye.x-ot)/Lt*Me,y:Yt+(ye.y-st)/At*Je}));ct(ye=>ye.map(bn=>bn.id!==nt||bn.anchor.type!=="polygon"?bn:{...bn,anchor:{type:"polygon",points:kn,rotation:bn.anchor.rotation??0}}));return}if(zt.current){const{pinId:nt,startX:F,startY:W,startW:ot,startH:st,startSvgX:dt,startSvgY:B}=zt.current,Nt=w(N),It=Nt.x-dt,kt=Nt.y-B;(Math.abs(It)>2||Math.abs(kt)>2)&&(ce.current=!0);const Lt=Math.max(0,Math.min(F+It,z-ot)),At=Math.max(0,Math.min(W+kt,tt-st));ct(Ht=>Ht.map(Yt=>Yt.id!==nt||Yt.anchor.type!=="rectangle"?Yt:{...Yt,anchor:{type:"rectangle",x:Lt,y:At,width:ot,height:st,rotation:Yt.anchor.rotation??0}}));return}if(oe.current){const{pinId:nt,startCx:F,startCy:W,startRx:ot,startRy:st,startSvgX:dt,startSvgY:B}=oe.current,Nt=w(N),It=Nt.x-dt,kt=Nt.y-B;(Math.abs(It)>2||Math.abs(kt)>2)&&(ce.current=!0);const Lt=Math.max(ot,Math.min(F+It,z-ot)),At=Math.max(st,Math.min(W+kt,tt-st));ct(Ht=>Ht.map(Yt=>Yt.id!==nt||Yt.anchor.type!=="ellipse"?Yt:{...Yt,anchor:{type:"ellipse",cx:Lt,cy:At,rx:ot,ry:st,rotation:Yt.anchor.rotation??0}}));return}if(Un.current){const{pinId:nt,startCx:F,startCy:W,startRadius:ot,startSvgX:st,startSvgY:dt}=Un.current,B=w(N),Nt=B.x-st,It=B.y-dt;(Math.abs(Nt)>2||Math.abs(It)>2)&&(ce.current=!0);const kt=Math.max(ot,Math.min(F+Nt,z-ot)),Lt=Math.max(ot,Math.min(W+It,tt-ot));ct(At=>At.map(Ht=>Ht.id!==nt||Ht.anchor.type!=="compass"?Ht:{...Ht,anchor:{type:"compass",cx:kt,cy:Lt,radius:ot,rotation:Ht.anchor.rotation??0}}));return}if(ds.current){const{pinId:nt,startStart:F,startEnd:W,startControl:ot,startSvgX:st,startSvgY:dt}=ds.current,B=w(N),Nt=B.x-st,It=B.y-dt;(Math.abs(Nt)>2||Math.abs(It)>2)&&(ce.current=!0),ct(kt=>kt.map(Lt=>Lt.id!==nt||Lt.anchor.type!=="arrow"?Lt:{...Lt,anchor:{type:"arrow",start:{x:Math.max(0,Math.min(F.x+Nt,z)),y:Math.max(0,Math.min(F.y+It,tt))},end:{x:Math.max(0,Math.min(W.x+Nt,z)),y:Math.max(0,Math.min(W.y+It,tt))},control:{x:Math.max(0,Math.min(ot.x+Nt,z)),y:Math.max(0,Math.min(ot.y+It,tt))}}}));return}if(ga.current){const{pinId:nt,handle:F,startStart:W,startEnd:ot,startControl:st,startSvgX:dt,startSvgY:B}=ga.current,Nt=w(N),It=Nt.x-dt,kt=Nt.y-B;(Math.abs(It)>2||Math.abs(kt)>2)&&(ce.current=!0),ct(Lt=>Lt.map(At=>{if(At.id!==nt||At.anchor.type!=="arrow")return At;const Ht={...W},Yt={...ot},de={...st};return F==="start"?(Ht.x=Math.max(0,Math.min(Ht.x+It,z)),Ht.y=Math.max(0,Math.min(Ht.y+kt,tt))):F==="end"?(Yt.x=Math.max(0,Math.min(Yt.x+It,z)),Yt.y=Math.max(0,Math.min(Yt.y+kt,tt))):(de.x=Math.max(0,Math.min(de.x+It,z)),de.y=Math.max(0,Math.min(de.y+kt,tt))),{...At,anchor:{type:"arrow",start:Ht,end:Yt,control:de}}}));return}if(Na.current){const{pinId:nt,handle:F,startStart:W,startEnd:ot,startControl:st,startMinX:dt,startMinY:B,startMaxX:Nt,startMaxY:It,startSvgX:kt,startSvgY:Lt}=Na.current,At=w(N);(Math.abs(At.x-kt)>2||Math.abs(At.y-Lt)>2)&&(ce.current=!0);const Ht=Math.max(On,Nt-dt),Yt=Math.max(On,It-B);let de=dt,be=B,Me=Nt,Je=It;switch(F){case"se":Me=Math.max(dt+On,At.x),Je=Math.max(B+On,At.y);break;case"sw":de=Math.min(Nt-On,At.x),Je=Math.max(B+On,At.y);break;case"nw":de=Math.min(Nt-On,At.x),be=Math.min(It-On,At.y);break;case"ne":Me=Math.max(dt+On,At.x),be=Math.min(It-On,At.y);break;case"n":be=Math.min(It-On,At.y);break;case"s":Je=Math.max(B+On,At.y);break;case"e":Me=Math.max(dt+On,At.x);break;case"w":de=Math.min(Nt-On,At.x);break}const kn=Me-de,ye=Je-be,bn=Ce=>({x:de+(Ce.x-dt)/Ht*kn,y:be+(Ce.y-B)/Yt*ye});ct(Ce=>Ce.map(Jn=>Jn.id!==nt||Jn.anchor.type!=="arrow"?Jn:{...Jn,anchor:{type:"arrow",start:bn(W),end:bn(ot),control:bn(st)}}));return}if(ya.current){const{pinId:nt,startStart:F,startEnd:W,startControl:ot,centerX:st,centerY:dt,startAngle:B,startSvgX:Nt,startSvgY:It}=ya.current,kt=w(N);(Math.abs(kt.x-Nt)>2||Math.abs(kt.y-It)>2)&&(ce.current=!0);const At=Math.atan2(kt.y-dt,kt.x-st)-B,Ht=Math.cos(At),Yt=Math.sin(At),de=be=>({x:st+(be.x-st)*Ht-(be.y-dt)*Yt,y:dt+(be.x-st)*Yt+(be.y-dt)*Ht});ct(be=>be.map(Me=>Me.id!==nt||Me.anchor.type!=="arrow"?Me:{...Me,anchor:{type:"arrow",start:de(F),end:de(W),control:de(ot)}}));return}if(on.current){const{pinId:nt,startRotation:F,centerX:W,centerY:ot,startSvgX:st,startSvgY:dt}=on.current,B=w(N);(Math.abs(B.x-st)>2||Math.abs(B.y-dt)>2)&&(ce.current=!0);const Nt=At=>At*180/Math.PI,It=Nt(Math.atan2(dt-ot,st-W)),kt=Nt(Math.atan2(B.y-ot,B.x-W));let Lt=F+(kt-It);for(;Lt<0;)Lt+=360;for(;Lt>=360;)Lt-=360;ct(At=>At.map(Ht=>Ht.id!==nt||Ht.anchor.type!=="rectangle"?Ht:{...Ht,anchor:{...Ht.anchor,rotation:Lt}}));return}if(zn.current){const{pinId:nt,startRotation:F,centerX:W,centerY:ot,startSvgX:st,startSvgY:dt}=zn.current,B=w(N);(Math.abs(B.x-st)>2||Math.abs(B.y-dt)>2)&&(ce.current=!0);const Nt=At=>At*180/Math.PI,It=Nt(Math.atan2(dt-ot,st-W)),kt=Nt(Math.atan2(B.y-ot,B.x-W));let Lt=F+(kt-It);for(;Lt<0;)Lt+=360;for(;Lt>=360;)Lt-=360;ct(At=>At.map(Ht=>Ht.id!==nt||Ht.anchor.type!=="ellipse"?Ht:{...Ht,anchor:{...Ht.anchor,rotation:Lt}}));return}if(Yi.current){const{pinId:nt,startRotation:F,centerX:W,centerY:ot,startSvgX:st,startSvgY:dt}=Yi.current,B=w(N);(Math.abs(B.x-st)>2||Math.abs(B.y-dt)>2)&&(ce.current=!0);const Nt=At=>At*180/Math.PI,It=Nt(Math.atan2(dt-ot,st-W)),kt=Nt(Math.atan2(B.y-ot,B.x-W));let Lt=F+(kt-It);for(;Lt<0;)Lt+=360;for(;Lt>=360;)Lt-=360;ct(At=>At.map(Ht=>Ht.id!==nt||Ht.anchor.type!=="compass"?Ht:{...Ht,anchor:{...Ht.anchor,rotation:Lt}}));return}if(Si.current){const{pinId:nt,startPoints:F,centerX:W,centerY:ot,startAngle:st,startRotation:dt,startSvgX:B,startSvgY:Nt}=Si.current,It=w(N);(Math.abs(It.x-B)>2||Math.abs(It.y-Nt)>2)&&(ce.current=!0);const Lt=Math.atan2(It.y-ot,It.x-W)-st,At=Math.cos(Lt),Ht=Math.sin(Lt),Yt=F.map(Me=>({x:W+(Me.x-W)*At-(Me.y-ot)*Ht,y:ot+(Me.x-W)*Ht+(Me.y-ot)*At}));let be=dt+(Me=>Me*180/Math.PI)(Lt);for(;be<0;)be+=360;for(;be>=360;)be-=360;ct(Me=>Me.map(Je=>Je.id!==nt||Je.anchor.type!=="polygon"?Je:{...Je,anchor:{type:"polygon",points:Yt,rotation:be}}));return}if(ta.current){const{pinId:nt,startPoints:F,centerX:W,centerY:ot,startAngle:st,startRotation:dt,startSvgX:B,startSvgY:Nt}=ta.current,It=w(N);(Math.abs(It.x-B)>2||Math.abs(It.y-Nt)>2)&&(ce.current=!0);const Lt=Math.atan2(It.y-ot,It.x-W)-st,At=Math.cos(Lt),Ht=Math.sin(Lt),Yt=F.map(Me=>({x:W+(Me.x-W)*At-(Me.y-ot)*Ht,y:ot+(Me.x-W)*Ht+(Me.y-ot)*At}));let be=dt+(Me=>Me*180/Math.PI)(Lt);for(;be<0;)be+=360;for(;be>=360;)be-=360;ct(Me=>Me.map(Je=>Je.id!==nt||Je.anchor.type!=="polyline"?Je:{...Je,anchor:{type:"polyline",points:Yt,rotation:be}}));return}if(me.current){const{pinId:nt,handle:F,startX:W,startY:ot,startW:st,startH:dt,startRotation:B,startSvgX:Nt,startSvgY:It}=me.current,kt=w(N);(Math.abs(kt.x-Nt)>2||Math.abs(kt.y-It)>2)&&(ce.current=!0);const Lt=B*Math.PI/180,At=Math.cos(Lt),Ht=Math.sin(Lt),Yt=W+st/2,de=ot+dt/2,be=(qe,pn)=>({x:Yt+qe*At-pn*Ht,y:de+qe*Ht+pn*At}),Me={nw:be(-st/2,-dt/2),ne:be(st/2,-dt/2),se:be(st/2,dt/2),sw:be(-st/2,dt/2)},Je={n:be(0,-dt/2),s:be(0,dt/2),e:be(st/2,0),w:be(-st/2,0)},kn={nw:Me.se,ne:Me.sw,se:Me.nw,sw:Me.ne},ye={n:Je.s,s:Je.n,e:Je.w,w:Je.e},bn=kn[F]??ye[F],Ce=(kt.x+bn.x)/2,Jn=(kt.y+bn.y)/2,$r=bn.x-Ce,Yr=bn.y-Jn,Mo={x:$r*At+Yr*Ht,y:-$r*Ht+Yr*At},Co=F==="n"||F==="e"||F==="s"||F==="w",jt=Co?F==="e"||F==="w"?Math.max(ba,2*Math.abs(Mo.x)):st:Math.max(ba,2*Math.abs(Mo.x)),Fe=Co?F==="n"||F==="s"?Math.max(ba,2*Math.abs(Mo.y)):dt:Math.max(ba,2*Math.abs(Mo.y)),Se=Ce-jt/2,ze=Jn-Fe/2;ct(qe=>qe.map(pn=>pn.id!==nt||pn.anchor.type!=="rectangle"?pn:{...pn,anchor:{type:"rectangle",x:Se,y:ze,width:jt,height:Fe,rotation:B}}));return}if(Xe.current){const{pinId:nt,handle:F,startCx:W,startCy:ot,startRx:st,startRy:dt,startSvgX:B,startSvgY:Nt}=Xe.current,It=w(N);(Math.abs(It.x-B)>2||Math.abs(It.y-Nt)>2)&&(ce.current=!0);const{startRotation:kt}=Xe.current,Lt=kt*Math.PI/180,At=Math.cos(Lt),Ht=Math.sin(Lt),Yt=(ye,bn)=>({x:W+ye*At-bn*Ht,y:ot+ye*Ht+bn*At}),de=F==="nw"||F==="ne"||F==="se"||F==="sw";let be=W,Me=ot,Je=st,kn=dt;if(de){const ye={nw:Yt(-st,-dt),ne:Yt(st,-dt),se:Yt(st,dt),sw:Yt(-st,dt)},Ce={nw:ye.se,ne:ye.sw,se:ye.nw,sw:ye.ne}[F];be=(It.x+Ce.x)/2,Me=(It.y+Ce.y)/2;const Jn=Ce.x-be,$r=Ce.y-Me;Je=Math.max(xo,Math.abs(Jn*At+$r*Ht)),kn=Math.max(xo,Math.abs(-Jn*Ht+$r*At))}else{if(F==="n"){const ye=ot+dt;kn=Math.max(xo,(ye-It.y)/2),Me=ye-kn}else if(F==="s"){const ye=ot-dt;kn=Math.max(xo,(It.y-ye)/2),Me=ye+kn}else if(F==="e"){const ye=W-st;Je=Math.max(xo,(It.x-ye)/2),be=ye+Je}else if(F==="w"){const ye=W+st;Je=Math.max(xo,(ye-It.x)/2),be=ye-Je}be=Math.max(Je,Math.min(be,z-Je)),Me=Math.max(kn,Math.min(Me,tt-kn))}ct(ye=>ye.map(bn=>bn.id!==nt||bn.anchor.type!=="ellipse"?bn:{...bn,anchor:{type:"ellipse",cx:be,cy:Me,rx:Je,ry:kn,rotation:bn.anchor.rotation??0}}));return}if(cr.current){const{pinId:nt,startCx:F,startCy:W,startSvgX:ot,startSvgY:st}=cr.current,dt=w(N);(Math.abs(dt.x-ot)>2||Math.abs(dt.y-st)>2)&&(ce.current=!0);const B=Math.hypot(dt.x-F,dt.y-W),Nt=Math.min(F,W,z-F,tt-W),It=Math.max(MD,Math.min(B,Nt));ct(kt=>kt.map(Lt=>Lt.id!==nt||Lt.anchor.type!=="compass"?Lt:{...Lt,anchor:{type:"compass",cx:F,cy:W,radius:It,rotation:Lt.anchor.rotation??0}}));return}if(Cs.current){const{pinId:nt,pointIndex:F,startPoints:W,startSvgX:ot,startSvgY:st}=Cs.current,dt=w(N),B=dt.x-ot,Nt=dt.y-st;(Math.abs(B)>2||Math.abs(Nt)>2)&&(ce.current=!0);const It=W.map((kt,Lt)=>Lt===F?{x:Math.max(0,Math.min(kt.x+B,z)),y:Math.max(0,Math.min(kt.y+Nt,tt))}:kt);ct(kt=>kt.map(Lt=>Lt.id===nt?{...Lt,leaderPoints:It}:Lt));return}if(Gs.current){const{pinId:nt,startCardX:F,startCardY:W,startSvgX:ot,startSvgY:st}=Gs.current,dt=w(N),B=dt.x-ot,Nt=dt.y-st;(Math.abs(B)>2||Math.abs(Nt)>2)&&(ce.current=!0),te(It=>{const kt=It[nt];return kt?{...It,[nt]:{...kt,x:Math.max(0,Math.min(F+B,z-kt.width)),y:Math.max(0,Math.min(W+Nt,tt-kt.height))}}:It});return}if(Ta.current){const{pinId:nt,handle:F,startCardX:W,startCardY:ot,startCardW:st,startCardH:dt,startSvgX:B,startSvgY:Nt}=Ta.current,It=w(N),kt=It.x-B,Lt=It.y-Nt;(Math.abs(kt)>2||Math.abs(Lt)>2)&&(ce.current=!0);let At=W,Ht=ot,Yt=st,de=dt;F.includes("e")&&(Yt=Math.max(xS,st+kt)),F.includes("s")&&(de=Math.max(vS,dt+Lt)),F.includes("w")&&(Yt=Math.max(xS,st-kt),At=W+st-Yt),F.includes("n")&&(de=Math.max(vS,dt-Lt),Ht=ot+dt-de),At=Math.max(0,Math.min(At,z-Yt)),Ht=Math.max(0,Math.min(Ht,tt-de)),te(be=>({...be,[nt]:{x:At,y:Ht,width:Yt,height:de}}))}},_=()=>{if(Ks.current=null,Ms.current=null,Cn.current){const N=Cn.current,z=20,tt=Math.min(N.x1,N.x2),nt=Math.max(N.x1,N.x2),F=Math.min(N.y1,N.y2),W=Math.max(N.y1,N.y2),ot=Math.max(z,nt-tt),st=Math.max(z,W-F),dt=fa(),B=yc;Jt();const Nt=N.shape==="rectangle"?{type:"rectangle",x:tt,y:F,width:ot,height:st}:N.shape==="redact"?{type:"redact",x:tt,y:F,width:ot,height:st,mode:y8,strength:b8}:{type:"ellipse",cx:(tt+nt)/2,cy:(F+W)/2,rx:ot/2,ry:st/2},It=N.shape==="redact"?null:$i(Nt);ct(kt=>[...kt,{id:dt,anchor:Nt,color:B,strokeStyle:ed,fillStyle:Fp,label:Du(kt),image:null,imageAspect:null,description:"",descPos:"below"}]),It&&te(kt=>({...kt,[dt]:It})),G(dt),xt(dt),P("select"),kr(null),Ne(null),Cn.current=null,_i.current=dt,as.current=!0}if(ln.current){const N=ln.current;if(Math.hypot(N.end.x-N.start.x,N.end.y-N.start.y)>=6){const tt=fa(),nt=yc,F={type:"arrow",start:N.start,end:N.end,control:N.control},W=$i(F);Jt(),ct(ot=>[...ot,{id:tt,anchor:F,color:nt,strokeStyle:ed,label:Du(ot),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),te(ot=>({...ot,[tt]:W})),G(tt),xt(null),P("select"),_i.current=tt,as.current=!0}We(null),ln.current=null}if(dn.current){const N=dn.current;if(Math.hypot(N.end.x-N.start.x,N.end.y-N.start.y)>=6){const tt=fa(),nt=yc;Jt(),ct(F=>[...F,{id:tt,anchor:{type:"numbering",start:N.start,end:N.end},color:nt,label:jF(F),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),G(tt),xt(null),P("select"),_i.current=tt,as.current=!0}Fn(null),_n(null),dn.current=null}Gs.current=null,Ta.current=null,Js.current=null,Zs.current=null,vl.current=null,wl.current=null,Zl.current=null,ma.current=null,oi.current&&ce.current&&In.current(oi.current.startPoints),oi.current=null,Ql.current=null,si.current=null,fs.current&&ce.current&&In.current(fs.current.startPoints),fs.current=null,ao.current=null,ta.current=null,kl.current=null,zt.current=null,oe.current=null,Un.current=null,me.current=null,Xe.current=null,cr.current=null,on.current=null,zn.current=null,Yi.current=null,Si.current=null,Lr.current=null,ds.current=null,ga.current=null,ya.current=null,Na.current=null,dn.current=null,Cs.current=null,Qs.current=null,pt.current=null,Et.current=null,C.current=null,U.current=null};return window.addEventListener("pointermove",k,{passive:!1}),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_),window.addEventListener("mousemove",k),window.addEventListener("mouseup",_),()=>{window.removeEventListener("pointermove",k),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_),window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",_)}},[xe]);const su=I.useCallback((w,k)=>{if(Z==="place")return;const _=J.find(z=>z.id===w);if(!_||_.anchor.type!=="point")return;k.preventDefault(),Jt();const N=xe(k.clientX,k.clientY);ce.current=!1,Js.current={pinId:w,startPinX:_.anchor.x,startPinY:_.anchor.y,startSvgX:N.x,startSvgY:N.y}},[Z,J,xe,Jt]),Rc=I.useCallback((w,k)=>{if(Z==="place")return;const _=J.find(z=>z.id===w);if(!_||_.anchor.type!=="numbering")return;k.preventDefault(),k.stopPropagation(),Jt();const N=xe(k.clientX,k.clientY);ce.current=!1,Zs.current={pinId:w,startStart:{..._.anchor.start},startEnd:{..._.anchor.end},startSvgX:N.x,startSvgY:N.y}},[Z,J,xe,Jt]),Tl=I.useCallback((w,k,_)=>{if(Z==="place")return;const N=J.find(tt=>tt.id===w);if(!N||N.anchor.type!=="numbering")return;_.preventDefault(),_.stopPropagation(),Jt();const z=xe(_.clientX,_.clientY);ce.current=!1,vl.current={pinId:w,endpoint:k,startStart:{...N.anchor.start},startEnd:{...N.anchor.end},startSvgX:z.x,startSvgY:z.y}},[Z,J,xe,Jt]),au=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=Di.current;if(!_||w<0||w>=_.length)return;const N=_[w],{x:z,y:tt}=xe(k.clientX,k.clientY);ce.current=!1,oi.current={pointIndex:w,startX:N.x,startY:N.y,startSvgX:z,startSvgY:tt,startPoints:_.map(nt=>({x:nt.x,y:nt.y}))}},[xe]),Oa=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=Al.current;if(!_||w<0||w>=_.length)return;const N=_[w],{x:z,y:tt}=xe(k.clientX,k.clientY);ce.current=!1,fs.current={pointIndex:w,startX:N.x,startY:N.y,startSvgX:z,startSvgY:tt,startPoints:_.map(nt=>({x:nt.x,y:nt.y}))}},[xe]),Oc=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=Mr.current.find(tt=>tt.id===w);if(!N)return;Jt();const z=xe(_.clientX,_.clientY);ce.current=!1,Cs.current={pinId:w,pointIndex:k,startPoints:(N.leaderPoints??[]).map(tt=>({x:tt.x,y:tt.y})),startSvgX:z.x,startSvgY:z.y}},[xe,Jt]),wo=I.useCallback((w,k,_,N)=>{N.preventDefault(),N.stopPropagation();const z=Mr.current.find(W=>W.id===w);if(!z)return;Jt();const tt=xe(N.clientX,N.clientY);ce.current=!1;const nt=(z.leaderPoints??[]).map(W=>({x:W.x,y:W.y})),F=[...nt.slice(0,k),{x:_.x,y:_.y},...nt.slice(k)];ct(W=>W.map(ot=>ot.id===w?{...ot,leaderPoints:F}:ot)),Cs.current={pinId:w,pointIndex:k,startPoints:F,startSvgX:tt.x,startSvgY:tt.y}},[xe,Jt]),So=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation(),Jt(),ct(N=>N.map(z=>{if(z.id!==w||!z.leaderPoints)return z;const tt=z.leaderPoints.filter((nt,F)=>F!==k);if(tt.length===0){const nt={...z};return delete nt.leaderPoints,nt}return{...z,leaderPoints:tt}}))},[Jt]),lu=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=J.find(tt=>tt.id===w);if(!N||N.anchor.type!=="polygon")return;Jt();const z=xe(_.clientX,_.clientY);ce.current=!1,ma.current={pinId:w,pointIndex:k,startPoints:N.anchor.points.map(tt=>({x:tt.x,y:tt.y})),startSvgX:z.x,startSvgY:z.y}},[J,xe,Jt]),Io=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation(),Jt(),ct(N=>N.map(z=>{if(z.id!==w||z.anchor.type!=="polygon")return z;const tt=z.anchor.points;if(tt.length<=3)return z;const nt=tt.filter((F,W)=>W!==k);return{...z,anchor:{type:"polygon",points:nt,rotation:z.anchor.rotation??0}}}))},[Jt]),cu=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=J.find(dt=>dt.id===w);if(!N||N.anchor.type!=="polygon")return;const z=N.anchor.points,tt=z.length,nt=z[k],F=z[(k+1)%tt],W={x:(nt.x+F.x)/2,y:(nt.y+F.y)/2},ot=[...z.slice(0,k+1),W,...z.slice(k+1)];Jt(),ct(dt=>dt.map(B=>B.id!==w||B.anchor.type!=="polygon"?B:{...B,anchor:{type:"polygon",points:ot,rotation:B.anchor.rotation??0}}));const st=xe(_.clientX,_.clientY);ce.current=!1,ma.current={pinId:w,pointIndex:k+1,startPoints:ot.map(dt=>({x:dt.x,y:dt.y})),startSvgX:st.x,startSvgY:st.y}},[J,xe,Jt]),Ts=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=J.find(z=>z.id===w);if(!_||_.anchor.type!=="polygon")return;Jt();const N=xe(k.clientX,k.clientY);ce.current=!1,Ql.current={pinId:w,startPoints:_.anchor.points.map(z=>({x:z.x,y:z.y})),startSvgX:N.x,startSvgY:N.y}},[J,xe,Jt]),Pc=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=J.find(z=>z.id===w);if(!_||_.anchor.type!=="rectangle")return;Jt();const N=xe(k.clientX,k.clientY);ce.current=!1,zt.current={pinId:w,startX:_.anchor.x,startY:_.anchor.y,startW:_.anchor.width,startH:_.anchor.height,startSvgX:N.x,startSvgY:N.y}},[J,xe,Jt]),lc=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=J.find(z=>z.id===w);if(!_||_.anchor.type!=="ellipse")return;Jt();const N=xe(k.clientX,k.clientY);ce.current=!1,oe.current={pinId:w,startCx:_.anchor.cx,startCy:_.anchor.cy,startRx:_.anchor.rx,startRy:_.anchor.ry,startSvgX:N.x,startSvgY:N.y}},[J,xe,Jt]),rl=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=J.find(tt=>tt.id===w);if(!N||N.anchor.type!=="rectangle")return;Jt();const z=xe(_.clientX,_.clientY);ce.current=!1,me.current={pinId:w,handle:k,startX:N.anchor.x,startY:N.anchor.y,startW:N.anchor.width,startH:N.anchor.height,startRotation:N.anchor.rotation??0,startSvgX:z.x,startSvgY:z.y}},[J,xe,Jt]),jc=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=J.find(tt=>tt.id===w);if(!N||N.anchor.type!=="ellipse")return;Jt();const z=xe(_.clientX,_.clientY);ce.current=!1,Xe.current={pinId:w,handle:k,startCx:N.anchor.cx,startCy:N.anchor.cy,startRx:N.anchor.rx,startRy:N.anchor.ry,startRotation:N.anchor.rotation??0,startSvgX:z.x,startSvgY:z.y}},[J,xe,Jt]),uu=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=J.find(st=>st.id===w);if(!N||N.anchor.type!=="polygon")return;const z=N.anchor.points;if(z.length<2)return;Jt();const tt=xe(_.clientX,_.clientY),nt=Math.min(...z.map(st=>st.x)),F=Math.min(...z.map(st=>st.y)),W=Math.max(...z.map(st=>st.x)),ot=Math.max(...z.map(st=>st.y));ce.current=!1,Lr.current={pinId:w,handle:k,startPoints:z.map(st=>({x:st.x,y:st.y})),startMinX:nt,startMinY:F,startMaxX:W,startMaxY:ot,startSvgX:tt.x,startSvgY:tt.y}},[J,xe,Jt]),cc=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=J.find(nt=>nt.id===w);if(!_||_.anchor.type!=="rectangle")return;Jt();const N=xe(k.clientX,k.clientY),z=_.anchor.x+_.anchor.width/2,tt=_.anchor.y+_.anchor.height/2;ce.current=!1,on.current={pinId:w,startRotation:_.anchor.rotation??0,centerX:z,centerY:tt,startSvgX:N.x,startSvgY:N.y}},[J,xe,Jt]),fu=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=J.find(z=>z.id===w);if(!_||_.anchor.type!=="ellipse")return;Jt();const N=xe(k.clientX,k.clientY);ce.current=!1,zn.current={pinId:w,startRotation:_.anchor.rotation??0,centerX:_.anchor.cx,centerY:_.anchor.cy,startSvgX:N.x,startSvgY:N.y}},[J,xe,Jt]),Ns=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=J.find(z=>z.id===w);if(!_||_.anchor.type!=="compass")return;Jt();const N=xe(k.clientX,k.clientY);ce.current=!1,Un.current={pinId:w,startCx:_.anchor.cx,startCy:_.anchor.cy,startRadius:_.anchor.radius,startSvgX:N.x,startSvgY:N.y}},[J,xe,Jt]),uc=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=J.find(tt=>tt.id===w);if(!N||N.anchor.type!=="compass")return;Jt();const z=xe(_.clientX,_.clientY);ce.current=!1,cr.current={pinId:w,handle:k,startCx:N.anchor.cx,startCy:N.anchor.cy,startRadius:N.anchor.radius,startRotation:N.anchor.rotation??0,startSvgX:z.x,startSvgY:z.y}},[J,xe,Jt]),Nl=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=J.find(z=>z.id===w);if(!_||_.anchor.type!=="compass")return;Jt();const N=xe(k.clientX,k.clientY);ce.current=!1,Yi.current={pinId:w,startRotation:_.anchor.rotation??0,centerX:_.anchor.cx,centerY:_.anchor.cy,startSvgX:N.x,startSvgY:N.y}},[J,xe,Jt]),du=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=J.find(W=>W.id===w);if(!_||_.anchor.type!=="polygon")return;const N=_.anchor.points;if(N.length<2)return;Jt();const z=xe(k.clientX,k.clientY),tt=N.reduce((W,ot)=>W+ot.x,0)/N.length,nt=N.reduce((W,ot)=>W+ot.y,0)/N.length,F=Math.atan2(z.y-nt,z.x-tt);ce.current=!1,Si.current={pinId:w,startPoints:N.map(W=>({x:W.x,y:W.y})),centerX:tt,centerY:nt,startAngle:F,startRotation:_.anchor.rotation??0,startSvgX:z.x,startSvgY:z.y}},[J,xe,Jt]),Ic=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=J.find(tt=>tt.id===w);if(!N||N.anchor.type!=="polyline")return;Jt();const z=xe(_.clientX,_.clientY);ce.current=!1,si.current={pinId:w,pointIndex:k,startPoints:N.anchor.points.map(tt=>({x:tt.x,y:tt.y})),startSvgX:z.x,startSvgY:z.y}},[J,xe,Jt]),ia=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation(),Jt(),ct(N=>N.map(z=>{if(z.id!==w||z.anchor.type!=="polyline")return z;const tt=z.anchor.points;if(tt.length<=2)return z;const nt=tt.filter((F,W)=>W!==k);return{...z,anchor:{type:"polyline",points:nt,rotation:z.anchor.rotation??0}}}))},[Jt]),_s=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=J.find(st=>st.id===w);if(!N||N.anchor.type!=="polyline")return;const z=N.anchor.points;if(k>=z.length-1)return;const tt=z[k],nt=z[k+1],F={x:(tt.x+nt.x)/2,y:(tt.y+nt.y)/2},W=[...z.slice(0,k+1),F,...z.slice(k+1)];Jt(),ct(st=>st.map(dt=>dt.id!==w||dt.anchor.type!=="polyline"?dt:{...dt,anchor:{type:"polyline",points:W,rotation:dt.anchor.rotation??0}}));const ot=xe(_.clientX,_.clientY);ce.current=!1,si.current={pinId:w,pointIndex:k+1,startPoints:W.map(st=>({x:st.x,y:st.y})),startSvgX:ot.x,startSvgY:ot.y}},[J,xe,Jt]),il=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=J.find(z=>z.id===w);if(!_||_.anchor.type!=="polyline")return;Jt();const N=xe(k.clientX,k.clientY);ce.current=!1,ao.current={pinId:w,startPoints:_.anchor.points.map(z=>({x:z.x,y:z.y})),startSvgX:N.x,startSvgY:N.y}},[J,xe,Jt]),Ds=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=J.find(z=>z.id===w);if(!_||_.anchor.type!=="arrow")return;Jt();const N=xe(k.clientX,k.clientY);ce.current=!1,ds.current={pinId:w,startStart:{..._.anchor.start},startEnd:{..._.anchor.end},startControl:{..._.anchor.control},startSvgX:N.x,startSvgY:N.y}},[J,xe,Jt]),ko=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=J.find(tt=>tt.id===w);if(!N||N.anchor.type!=="arrow")return;Jt();const z=xe(_.clientX,_.clientY);ce.current=!1,ga.current={pinId:w,handle:k,startStart:{...N.anchor.start},startEnd:{...N.anchor.end},startControl:{...N.anchor.control},startSvgX:z.x,startSvgY:z.y}},[J,xe,Jt]),ms=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=J.find(st=>st.id===w);if(!N||N.anchor.type!=="arrow")return;Jt();const z=[N.anchor.start,N.anchor.end,N.anchor.control],tt=Math.min(...z.map(st=>st.x)),nt=Math.min(...z.map(st=>st.y)),F=Math.max(...z.map(st=>st.x)),W=Math.max(...z.map(st=>st.y)),ot=xe(_.clientX,_.clientY);ce.current=!1,Na.current={pinId:w,handle:k,startStart:{...N.anchor.start},startEnd:{...N.anchor.end},startControl:{...N.anchor.control},startMinX:tt,startMinY:nt,startMaxX:F,startMaxY:W,startSvgX:ot.x,startSvgY:ot.y}},[J,xe,Jt]),zf=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=J.find(W=>W.id===w);if(!_||_.anchor.type!=="arrow")return;Jt();const N=xe(k.clientX,k.clientY),z=[_.anchor.start,_.anchor.end,_.anchor.control],tt=z.reduce((W,ot)=>W+ot.x,0)/z.length,nt=z.reduce((W,ot)=>W+ot.y,0)/z.length,F=Math.atan2(N.y-nt,N.x-tt);ce.current=!1,ya.current={pinId:w,startStart:{..._.anchor.start},startEnd:{..._.anchor.end},startControl:{..._.anchor.control},centerX:tt,centerY:nt,startAngle:F,startSvgX:N.x,startSvgY:N.y}},[J,xe,Jt]),qu=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=J.find(st=>st.id===w);if(!N||N.anchor.type!=="polyline")return;Jt();const z=N.anchor.points,tt=Math.min(...z.map(st=>st.x)),nt=Math.min(...z.map(st=>st.y)),F=Math.max(...z.map(st=>st.x)),W=Math.max(...z.map(st=>st.y)),ot=xe(_.clientX,_.clientY);ce.current=!1,kl.current={pinId:w,handle:k,startPoints:z.map(st=>({x:st.x,y:st.y})),startMinX:tt,startMinY:nt,startMaxX:F,startMaxY:W,startSvgX:ot.x,startSvgY:ot.y}},[J,xe,Jt]),hu=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=J.find(W=>W.id===w);if(!_||_.anchor.type!=="polyline")return;const N=_.anchor.points;if(N.length<2)return;Jt();const z=xe(k.clientX,k.clientY),tt=N.reduce((W,ot)=>W+ot.x,0)/N.length,nt=N.reduce((W,ot)=>W+ot.y,0)/N.length,F=Math.atan2(z.y-nt,z.x-tt);ce.current=!1,ta.current={pinId:w,startPoints:N.map(W=>({x:W.x,y:W.y})),centerX:tt,centerY:nt,startAngle:F,startRotation:_.anchor.rotation??0,startSvgX:z.x,startSvgY:z.y}},[J,xe,Jt]),Bf=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=J.find(nt=>nt.id===w);if(!_||_.anchor.type!=="text")return;G(w),xt(w);const N=performance.now(),z=Sl.current;if(z&&z.pinId===w&&N-z.time<=LF&&Math.hypot(k.clientX-z.x,k.clientY-z.y)<=RF){Sl.current=null,wl.current=null,Ro(w);return}Sl.current={pinId:w,time:N,x:k.clientX,y:k.clientY},Jt();const tt=xe(k.clientX,k.clientY);ce.current=!1,wl.current={pinId:w,startX:_.anchor.x,startY:_.anchor.y,startSvgX:tt.x,startSvgY:tt.y}},[J,xe,Jt]),Oi=I.useCallback(async w=>{const k=await new Promise(dt=>{const B=new FileReader;B.onload=Nt=>dt(Nt.target?.result??null),B.onerror=()=>dt(null),B.readAsDataURL(w)});if(!k)return;const _=await new Promise(dt=>{const B=new Image;B.onload=()=>dt({w:B.naturalWidth||Vy,h:B.naturalHeight||Vy}),B.onerror=()=>dt(null),B.src=k});if(!_)return;const N=_.w/_.h,z=Vy/Math.max(_.w,_.h),tt=Math.max(uf,_.w*z),nt=Math.max(uf,_.h*z),{w:F,h:W}=Cr.current,ot={type:"image",x:Math.max(0,(F-tt)/2),y:Math.max(0,(W-nt)/2),width:tt,height:nt,src:k,aspect:N},st=fa();Jt(),ct(dt=>[...dt,{id:st,anchor:ot,color:yc,label:Du(dt),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),te(dt=>({...dt,[st]:$i(ot)})),G(st),xt(st),P("select")},[Jt]);cs.current=Oi;const Xr=I.useRef(0),Yn=I.useCallback(w=>{const k=Date.now();k-Xr.current<800||(Xr.current=k,Oi(w),Or(!1))},[Oi]);I.useEffect(()=>{if(!_c)return;oc.current?.focus();const w=_=>{const N=R2(_.clipboardData);N&&(_.preventDefault(),_.stopPropagation(),Yn(N))},k=_=>{if(_.key==="Escape"){Or(!1);return}!(b?_.metaKey:_.ctrlKey)||_.shiftKey||_.altKey||_.code!=="KeyV"||(async()=>{try{const z=await Promise.race([navigator.clipboard?.read?.(),new Promise(tt=>setTimeout(()=>tt(void 0),OF))]);for(const tt of z??[]){const nt=tt.types.find(W=>W.startsWith("image/"));if(!nt)continue;const F=await tt.getType(nt);Yn(new File([F],"clipboard",{type:nt}));return}}catch{}})()};return window.addEventListener("paste",w,!0),window.addEventListener("keydown",k,!0),()=>{window.removeEventListener("paste",w,!0),window.removeEventListener("keydown",k,!0)}},[_c,b,Yn]);const zo=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=Mr.current.find(z=>z.id===w);if(!_||_.anchor.type!=="redact")return;Jt();const N=xe(k.clientX,k.clientY);ce.current=!1,C.current={pinId:w,startX:_.anchor.x,startY:_.anchor.y,startSvgX:N.x,startSvgY:N.y}},[xe,Jt]),mi=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=Mr.current.find(tt=>tt.id===w);if(!N||N.anchor.type!=="redact")return;Jt();const z=xe(_.clientX,_.clientY);ce.current=!1,U.current={pinId:w,handle:k,startX:N.anchor.x,startY:N.anchor.y,startW:N.anchor.width,startH:N.anchor.height,startSvgX:z.x,startSvgY:z.y}},[xe,Jt]),oa=I.useCallback((w,k)=>{Jt(),ct(_=>_.map(N=>N.id===w&&N.anchor.type==="redact"?{...N,anchor:{...N.anchor,...k}}:N))},[Jt]),ol=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=Mr.current.find(z=>z.id===w);if(!_||_.anchor.type!=="image")return;Jt();const N=xe(k.clientX,k.clientY);ce.current=!1,pt.current={pinId:w,startX:_.anchor.x,startY:_.anchor.y,startSvgX:N.x,startSvgY:N.y}},[xe,Jt]),$u=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=Mr.current.find(tt=>tt.id===w);if(!N||N.anchor.type!=="image")return;Jt();const z=xe(_.clientX,_.clientY);ce.current=!1,Et.current={pinId:w,handle:k,startX:N.anchor.x,startY:N.anchor.y,startW:N.anchor.width,startH:N.anchor.height,startSvgX:z.x,startSvgY:z.y}},[xe,Jt]),Pa=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation();const _=Mr.current.find(z=>z.id===w);if(!_||_.anchor.type!=="text"||!_.anchor.point)return;Jt();const N=xe(k.clientX,k.clientY);ce.current=!1,G(w),Qs.current={pinId:w,startPoint:{..._.anchor.point},startBox:{x:_.anchor.x,y:_.anchor.y},startSvgX:N.x,startSvgY:N.y}},[xe,Jt]),lo=I.useCallback((w,k,_)=>{_.preventDefault(),_.stopPropagation();const N=J.find(F=>F.id===w);if(!N||N.anchor.type!=="text")return;Jt();const z=xe(_.clientX,_.clientY),tt=N.anchor.x+N.anchor.width/2,nt=N.anchor.y+N.anchor.height/2;Zl.current={pinId:w,handle:k,startCenterX:tt,startCenterY:nt,startDist:Math.max(1,Math.hypot(z.x-tt,z.y-nt)),startFontSize:N.textFontSize??Va},ce.current=!1},[J,Jt,xe]),es=I.useCallback((w,k)=>{const _=k?.fontSize??Va,N=k?.bold?"700":"400",z=k?.italic?"italic ":"",nt=document.createElement("canvas").getContext("2d");return nt?(nt.font=`${z}${N} ${_}px ${Lo.current}`,J8(w,F=>nt.measureText(F).width,k)):{width:Xk,height:Gk}},[]),zc=I.useCallback((w,k)=>{const _=Mr.current.find(nt=>nt.id===w);if(!_||_.anchor.type!=="text")return;const N=es(k,{fontSize:_.textFontSize??Va,bold:_.textBold??!1,italic:_.textItalic??!1}),z=N.width,tt=N.height;ct(nt=>nt.map(F=>{if(F.id!==w||F.anchor.type!=="text")return F;const W=Math.max(0,Cr.current.w-z),ot=Math.max(0,Cr.current.h-tt);return{...F,anchor:{...F.anchor,width:z,height:tt,x:Math.max(0,Math.min(F.anchor.x,W)),y:Math.max(0,Math.min(F.anchor.y,ot))}}}))},[es]),gs=I.useCallback(w=>{const k=w.trim()?w:Wy;if(typeof document>"u")return k;const _=document.createElement("div");return _.innerHTML=k,_.querySelectorAll("p").forEach(N=>{N.style.margin="0",N.style.padding="0"}),_.innerHTML},[]),fc=I.useCallback((w=new Date,k=Q2)=>{if(!E)return;const{w:_,h:N}=Cr.current;if(!_||!N)return;const z=Zd(w,k),tt=gs(`<p>${z}</p>`),nt=es(tt,{fontSize:Va,bold:!1,italic:!1}),F=12*le,W=Math.max(0,Math.min(F,_-nt.width)),ot=Math.max(0,Math.min(N-nt.height-F,N-nt.height)),st=fa(),dt=yc;Jt(),ct(B=>[...B,{id:st,anchor:{type:"text",x:W,y:ot,width:nt.width,height:nt.height},color:dt,label:Du(B),image:null,imageAspect:null,description:tt,descPos:"below",textColor:"#FFFFFF",textBackgroundColor:"#000000"}]),G(st),xt(st),Ro(st),P("select"),_i.current=st,as.current=!0,Sn(!1)},[E,es,gs,Jt]),sl=I.useCallback((w,k)=>{Jt(),ct(_=>_.map(N=>{if(N.id!==w||N.anchor.type!=="text")return N;const z={...N,textFontSize:Math.max(MS,(N.textFontSize??Va)+k)},tt=N.anchor,nt=es(z.description||"",{fontSize:z.textFontSize,bold:z.textBold??!1,italic:z.textItalic??!1}),F=Math.max(0,X.w-nt.width),W=Math.max(0,X.h-nt.height);return{...z,anchor:{...tt,width:nt.width,height:nt.height,x:Math.max(0,Math.min(tt.x,F)),y:Math.max(0,Math.min(tt.y,W))}}}))},[X.h,X.w,es,Jt]),ja=I.useCallback(w=>{if(!E)return;const{w:k,h:_}=Cr.current;if(!k||!_)return;const N=bA,{cx:z,cy:tt}=ED(w,k,_,N),nt=fa(),F=yc;Jt(),ct(W=>[...W,{id:nt,anchor:{type:"compass",cx:z,cy:tt,radius:N,rotation:0},color:F,label:Du(W),image:null,imageAspect:null,description:"",descPos:"below",calloutHidden:!0}]),G(nt),xt(nt),P("select"),_i.current=nt,as.current=!0,En(!1)},[E,Jt]),_l=I.useCallback(()=>{Or(w=>!w)},[]),Ls=I.useCallback(()=>{E&&(Sn(!1),En(w=>!w))},[E]),dc=I.useCallback(()=>{En(!1),Sn(!1),Kn(w=>!w)},[]),hc=I.useCallback(()=>{Kn(!1),qi(null)},[]),Dl=I.useCallback(w=>{if(!E)return;const{w:k,h:_}=Cr.current;if(!k||!_)return;const N=Zy(Mr.current,ut??j),z=Xt.logo;if(!N&&!z)return;Xt.update({corner:w}),Jt();let tt;if(N&&N.anchor.type==="image"){tt=N.id;const nt=sg(Xt.settings,w,N.anchor.aspect,k,_,uf);ct(F=>F.map(W=>W.id===tt&&W.anchor.type==="image"?{...W,anchor:{...W.anchor,...nt}}:W))}else{if(!z)return;tt=fa();const nt=tt,F=sg(Xt.settings,w,z.aspect,k,_,uf);ct(W=>{const ot=BS(nt,z,F,Du(W),yc);return te(st=>({...st,[nt]:$i(ot.anchor)})),[...W,ot]})}G(tt),xt(tt),P("select"),_i.current=tt,as.current=!0,Kn(!1),qi(null)},[E,Xt,Jt,ut,j]),Yu=I.useCallback(()=>{E&&(En(!1),Sn(w=>{if(w)return!1;if(Dr)Hn(Qf(Ae));else{const k=new Date;De(k),Hn(Qf(k))}return!0}))},[E,Ae,Dr]),Ll=I.useCallback(()=>{const w=new Date;De(w),Hn(Qf(w))},[]),co=I.useCallback(()=>{fc(Dr?Ae:new Date,lr)},[Ae,lr,Dr,fc]),Vu=I.useCallback(()=>{fc(Ae,lr)},[Ae,lr,fc]),pu=I.useCallback((w,k)=>{const _=document.querySelector(`div[data-text-pin-id="${w}"]`);if(!_)return!1;const N=window.getSelection();if(!N||N.rangeCount===0)return!1;const z=N.getRangeAt(0);if(z.collapsed||!_.contains(z.commonAncestorContainer))return!1;Jt(),_.focus(),document.execCommand(k,!1);const tt=gs(_.innerHTML);return _.innerHTML=tt,ct(nt=>nt.map(F=>F.id===w?{...F,description:tt}:F)),zc(w,tt),!0},[Jt,zc,gs]),Bc=I.useCallback((w,k)=>{const _=Mr.current.find(N=>N.id===w);!_||_.description===k||(Jt(),ct(N=>N.map(z=>z.id===w?{...z,description:k}:z)))},[Jt]),Ff=I.useCallback(w=>{const k=Za.current;if(!k)return;const _=gs(k.innerHTML);Bc(w,_),zc(w,_)},[zc,gs,Bc]);I.useEffect(()=>{if(!yo)return;const w=k=>{k.target?.closest('[data-text-bg-picker="true"]')||bl(null)};return window.addEventListener("pointerdown",w,!0),()=>window.removeEventListener("pointerdown",w,!0)},[yo]),I.useEffect(()=>{if(!ss){Za.current=null;return}const w=Mr.current.find(N=>N.id===ss);if(!w||w.anchor.type!=="text")return;const k=gs(w.description),_=!w.description.trim()||w.description===Wy;requestAnimationFrame(()=>{const N=Za.current;if(!N)return;N.innerHTML!==k&&(N.innerHTML=k),N.focus();const z=document.createRange();z.selectNodeContents(N),_||z.collapse(!1);const tt=window.getSelection();tt?.removeAllRanges(),tt?.addRange(z)})},[ss,gs]),I.useEffect(()=>{if(!ss)return;const w=k=>{const _=k.target,N=Za.current;!N||_&&N.contains(_)||(Ff(ss),Ro(null))};return window.addEventListener("pointerdown",w,!0),()=>window.removeEventListener("pointerdown",w,!0)},[ss,Ff]);const Uf=I.useCallback((w,k)=>{const _=new Image;_.onload=()=>{const N=_.naturalWidth/_.naturalHeight;Jt(),ct(z=>z.map(tt=>tt.id===w?{...tt,image:k,imageAspect:N}:tt))},_.src=k},[Jt]),Pi=I.useCallback((w,k)=>{const _=Cc(k),N=Mr.current.find(tt=>tt.id===w);if(!_||!N)return;const z=TB(_);Object.keys(z).length!==0&&(Jt(),ct(tt=>tt.map(nt=>nt.id===w?{...nt,...z}:nt)),zg(document.activeElement)&&document.activeElement.blur(),G(w),xt(w))},[Cc,Jt]);I.useEffect(()=>{const w=k=>{if(zg(k.target))return;const _=ut??j;if(!_){if(!to.current)return;const st=R2(k.clipboardData);if(!st)return;k.preventDefault(),Yn(st);return}const N=Mr.current.find(st=>st.id===_)??null,z=k.target,tt=z?.tagName,nt=tt==="TEXTAREA"||tt==="INPUT"&&!z.readOnly&&!z.disabled,F=!!z&&(z.isContentEditable||z.closest(".ProseMirror")!==null||nt),W=k.clipboardData?.items;if(W){for(const st of W)if(st.type.startsWith("image/")){k.preventDefault(),k.stopPropagation();const dt=st.getAsFile();if(!dt)return;const B=new FileReader;B.onload=Nt=>{const It=Nt.target?.result;It&&Uf(_,It)},B.readAsDataURL(dt);return}}let ot=k.clipboardData?.getData("text/plain")??"";if(!ot&&k.clipboardData?.items?.length){for(const dt of k.clipboardData.items)if(dt.kind==="string"&&dt.type==="text/plain"){k.preventDefault();const B=_,Nt=ut;dt.getAsString(It=>{const kt=It??"";if(kt.trim()){if(Nt&&B===Nt&&N?.anchor.type!=="text"){document.dispatchEvent(new CustomEvent(W0,{detail:{pinId:Nt,text:kt},bubbles:!0}));return}Bc(B,kt)}});return}const st=k.clipboardData.getData("text/html");if(st)try{ot=new DOMParser().parseFromString(st,"text/html").body?.textContent??""}catch{ot=""}}if(ot.trim().length>0){if(ut&&_===ut&&N?.anchor.type!=="text"){k.preventDefault(),k.stopPropagation(),document.dispatchEvent(new CustomEvent(W0,{detail:{pinId:ut,text:ot},bubbles:!0}));return}if(F)return;k.preventDefault(),Bc(_,ot)}};return document.addEventListener("paste",w,!0),()=>document.removeEventListener("paste",w,!0)},[ut,j,Uf,Bc,Yn]);const Ia=I.useCallback((w,k)=>{Jt(),ct(_=>_.map(N=>N.id===w?{...N,color:k}:N))},[Jt]),Fc=I.useCallback((w,k)=>{Jt(),ct(_=>_.map(N=>N.id!==w||!Q0(N.anchor)?N:{...N,strokeStyle:k}))},[Jt]),Uc=I.useCallback((w,k)=>{Jt(),ct(_=>_.map(N=>N.id!==w||!nb(N.anchor)?N:{...N,fillStyle:k}))},[Jt]),Hc=I.useCallback((w,k)=>{Jt(),ct(_=>_.map(N=>{if(N.id!==w)return N;if(k===null){const z={...N};return delete z.strokeWidthScale,z}return{...N,strokeWidthScale:bd(k)}}))},[Jt]),m=I.useCallback((w,k)=>{Jt(),ct(_=>vD(_,w,k))},[Jt]),v=I.useCallback(w=>{Jt(),ct(k=>k.map(_=>_.id===w?{..._,descPos:_.descPos==="above"?"below":"above"}:_))},[Jt]),T=I.useCallback(w=>{Jt();const k=i8(w,Mr.current);ct(_=>Zk(_.filter(N=>!k.has(N.id)))),te(_=>{const N={..._};for(const z of k)delete N[z];return N}),G(null),xt(null),Ro(_=>_===w?null:_)},[Jt]),R=I.useCallback(w=>{const k=Mr.current.find(Nt=>Nt.id===w),_=k?G2(k,Mr.current):null;if(!_||!yS(_))return;const N=_.id;Jt();const z=fa(),nt=[N,...Z5(N,Mr.current)].map(Nt=>Ko.current[Nt]).filter(Nt=>!!Nt),F=nt.length>0?nt.reduce((Nt,It)=>It.y+It.height>Nt.y+Nt.height?It:Nt):$i(_.anchor),{w:W,h:ot}=Cr.current,st=F.width,dt=J2,B={x:Math.max(0,Math.min(F.x+ls,Math.max(0,W-st))),y:Math.max(0,Math.min(F.y+F.height+ls,Math.max(0,ot-dt))),width:st,height:dt};ct(Nt=>[...Nt,{id:z,anchor:{type:"linked",pinId:N},color:_.color,label:_.label,image:null,imageAspect:null,description:"",descPos:_.descPos,theme:_.theme,textFontSize:_.textFontSize}]),te(Nt=>({...Nt,[z]:B})),_i.current=z,G(z),xt(z)},[Jt]),H=I.useCallback((w,k)=>{Jt(),ct(_=>_.map(N=>N.id===w?{...N,calloutHidden:k}:N)),k?(G(w),xt(null)):(G(w),xt(w))},[Jt]),V=I.useCallback(async(w="png",k=1,_)=>{if(!to.current||!Cr.current.w)return;const N=jt=>new Promise((Fe,Se)=>{const ze=new Image;ze.onload=()=>Fe(ze),ze.onerror=Se,ze.src=jt});let z=null;try{z=await N(to.current)}catch{z=null}const tt=Mr.current,nt=Ko.current,{w:F,h:W}=Cr.current;if(!F)return;const st=2*(k||1),dt=document.createElement("canvas");dt.width=F*st,dt.height=W*st;const B=dt.getContext("2d");B.scale(st,st);const Nt=(jt,Fe,Se,ze,qe)=>{B.beginPath(),B.moveTo(jt+qe,Fe),B.lineTo(jt+Se-qe,Fe),B.arcTo(jt+Se,Fe,jt+Se,Fe+qe,qe),B.lineTo(jt+Se,Fe+ze-qe),B.arcTo(jt+Se,Fe+ze,jt+Se-qe,Fe+ze,qe),B.lineTo(jt+qe,Fe+ze),B.arcTo(jt,Fe+ze,jt,Fe+ze-qe,qe),B.lineTo(jt,Fe+qe),B.arcTo(jt,Fe,jt+qe,Fe,qe),B.closePath()},It=await Promise.allSettled(tt.map(jt=>jt.image?N(jt.image):Promise.resolve(null))),kt=await Promise.all(tt.filter(jt=>jt.anchor.type==="image").map(async jt=>{const Fe=jt.anchor.type==="image"?jt.anchor.src:"";try{return[jt.id,await N(Fe)]}catch{return[jt.id,null]}})),Lt=new Map(kt),At=new Map(It.map((jt,Fe)=>[tt[Fe].id,jt.status==="fulfilled"?jt.value:null]));z&&B.drawImage(z,0,0,F,W);const Ht=jt=>ES(jt,qs.current),Yt=jt=>`${jt.i?"italic ":""}${jt.b?"700":"400"} ${jt.fs}px ${Lo.current}`,de=new Map,be=jt=>{const Fe=Yt(jt),Se=de.get(Fe);if(Se)return Se;B.font=Fe;const ze=B.measureText("Hg"),qe=ze.fontBoundingBoxAscent||jt.fs*.8,pn=ze.fontBoundingBoxDescent||jt.fs*.2,Jr={asc:qe,desc:pn};return de.set(Fe,Jr),Jr},Me={measure:(jt,Fe)=>(B.font=Yt(Fe),B.measureText(jt).width),contentHeight:jt=>{const{asc:Fe,desc:Se}=be(jt);return Fe+Se},ascentRatio:jt=>{const{asc:Fe,desc:Se}=be(jt);return Fe+Se>0?Fe/(Fe+Se):.8}},Je=Wg(tt);B.lineCap="round";const kn=jt=>{if(jt.calloutHidden||jt.anchor.type==="text"||jt.anchor.type==="standalone"||jt.anchor.type==="redact")return;const Fe=nt[jt.id];if(!Fe)return;const Se=Zm(jt,tt);if(!Se)return;const ze=_g(Se,Fe,jt.leaderPoints);B.beginPath(),ze.forEach((qe,pn)=>pn===0?B.moveTo(qe.x,qe.y):B.lineTo(qe.x,qe.y)),B.strokeStyle=jt.color,B.lineJoin="round",B.lineWidth=eA*Ht(jt),B.stroke()},ye=jt=>{const Fe=Ht(jt);if(jt.anchor.type==="redact"){if(_?.skipRedaction)return;UA(B,dt,{rect:jt.anchor,mode:jt.anchor.mode,strength:jt.anchor.strength,imageSize:{w:F,h:W},sourceSize:{w:dt.width,h:dt.height}});return}if(jt.anchor.type==="image"){const Se=Lt.get(jt.id);if(Se){const{x:ze,y:qe,width:pn,height:Jr}=jt.anchor;B.drawImage(Se,ze,qe,pn,Jr)}return}if(jt.anchor.type==="point"){const{x:Se,y:ze}=jt.anchor,qe=hp*Fe;B.beginPath(),B.arc(Se+wS*Fe,ze+SS*Fe,qe+kS*Fe,0,Math.PI*2),B.fillStyle=AS,B.fill(),B.beginPath(),B.arc(Se,ze,qe,0,Math.PI*2),B.fillStyle=jt.color,B.fill(),B.strokeStyle="white",B.lineWidth=Ng*Fe,B.stroke()}else if(jt.anchor.type==="numbering"){const{start:Se,end:ze}=jt.anchor;B.beginPath(),B.moveTo(Se.x,Se.y),B.lineTo(ze.x,ze.y),B.strokeStyle=jt.color,B.lineWidth=Wf*Fe,B.stroke();const qe=String(jt.label),pn=14*le,Jr=0*pn,Mi=.4*pn,ei=.35*pn;B.font=`700 ${pn}px ${Lo.current}`;const Gi=Math.max(pn*.62,B.measureText(qe).width)+Mi*2,io=pn+Jr+ei,Ci=ze.x-Gi/2,Rr=ze.y-io/2,Fo=4*le;B.beginPath(),B.moveTo(Ci+Fo,Rr),B.lineTo(Ci+Gi-Fo,Rr),B.quadraticCurveTo(Ci+Gi,Rr,Ci+Gi,Rr+Fo),B.lineTo(Ci+Gi,Rr+io-Fo),B.quadraticCurveTo(Ci+Gi,Rr+io,Ci+Gi-Fo,Rr+io),B.lineTo(Ci+Fo,Rr+io),B.quadraticCurveTo(Ci,Rr+io,Ci,Rr+io-Fo),B.lineTo(Ci,Rr+Fo),B.quadraticCurveTo(Ci,Rr,Ci+Fo,Rr),B.closePath(),B.fillStyle="rgba(10,10,16,0.95)",B.fill(),B.strokeStyle=jt.color,B.lineWidth=1.5*le,B.stroke(),B.textAlign="center",B.textBaseline="middle",B.fillStyle="#ffffff",B.fillText(qe,ze.x,ze.y),B.textAlign="left",B.textBaseline="alphabetic"}else if(jt.anchor.type==="polygon"){const ze=jt.anchor.points;if(ze.length>=2){B.beginPath(),B.moveTo(ze[0].x,ze[0].y);for(let pn=1;pn<ze.length;pn++)B.lineTo(ze[pn].x,ze[pn].y);B.closePath();const qe=Dg(jt.color,jt.fillStyle);qe&&(B.fillStyle=qe,B.fill()),B.setLineDash(Gc(jt)?Zf.map(pn=>pn*Fe):[]),B.strokeStyle=jt.color,B.lineWidth=Wf*Fe,B.stroke(),B.setLineDash([])}}else if(jt.anchor.type==="polyline"){const ze=jt.anchor.points;if(ze.length>=2){B.beginPath(),B.moveTo(ze[0].x,ze[0].y);for(let qe=1;qe<ze.length;qe++)B.lineTo(ze[qe].x,ze[qe].y);B.setLineDash(Gc(jt)?Zf.map(qe=>qe*Fe):[]),B.strokeStyle=jt.color,B.lineWidth=Wf*Fe,B.stroke(),B.setLineDash([])}}else if(jt.anchor.type==="rectangle"){const{x:Se,y:ze,width:qe,height:pn,rotation:Jr=0}=jt.anchor,Mi=Se+qe/2,ei=ze+pn/2,Rs=Jr*Math.PI/180;B.save(),B.translate(Mi,ei),B.rotate(Rs),B.translate(-qe/2,-pn/2),B.beginPath(),B.rect(0,0,qe,pn);const Gi=Dg(jt.color,jt.fillStyle);Gi&&(B.fillStyle=Gi,B.fill()),B.setLineDash(Gc(jt)?Zf.map(io=>io*Fe):[]),B.strokeStyle=jt.color,B.lineWidth=Wf*Fe,B.stroke(),B.setLineDash([]),B.restore()}else if(jt.anchor.type==="ellipse"){const{cx:Se,cy:ze,rx:qe,ry:pn,rotation:Jr=0}=jt.anchor,Mi=Jr*Math.PI/180;B.save(),B.translate(Se,ze),B.rotate(Mi),B.beginPath(),B.ellipse(0,0,qe,pn,0,0,Math.PI*2);const ei=Dg(jt.color,jt.fillStyle);ei&&(B.fillStyle=ei,B.fill()),B.setLineDash(Gc(jt)?Zf.map(Rs=>Rs*Fe):[]),B.strokeStyle=jt.color,B.lineWidth=Wf*Fe,B.stroke(),B.setLineDash([]),B.restore()}else if(jt.anchor.type==="compass")ND(B,{cx:jt.anchor.cx,cy:jt.anchor.cy,radius:jt.anchor.radius,rotation:jt.anchor.rotation??0,color:jt.color,strokeWidth:Lg*Fe});else if(jt.anchor.type==="arrow"){const{start:Se,end:ze,control:qe}=jt.anchor;B.beginPath(),B.moveTo(Se.x,Se.y),B.quadraticCurveTo(qe.x,qe.y,ze.x,ze.y),B.setLineDash(Gc(jt)?Zf.map(Rr=>Rr*Fe):[]),B.strokeStyle=jt.color,B.lineWidth=Wf*Fe,B.stroke(),B.setLineDash([]);const pn=Qk(qe,ze),Jr=Math.atan2(pn.y,pn.x),Mi=8*le,ei=Math.PI/7,Rs=ze.x-Math.cos(Jr-ei)*Mi,Gi=ze.y-Math.sin(Jr-ei)*Mi,io=ze.x-Math.cos(Jr+ei)*Mi,Ci=ze.y-Math.sin(Jr+ei)*Mi;B.beginPath(),B.moveTo(ze.x,ze.y),B.lineTo(Rs,Gi),B.lineTo(io,Ci),B.closePath(),B.fillStyle=jt.color,B.fill(),B.stroke()}},bn=jt=>{if(jt.anchor.type!=="text")return;if(jt.anchor.point){const Rr=Ht(jt),{x:Fo,y:al}=jt.anchor.point;B.beginPath(),B.arc(Fo+wS*Rr,al+SS*Rr,hp*Rr+kS*Rr,0,Math.PI*2),B.fillStyle=AS,B.fill(),B.beginPath(),B.arc(Fo,al,hp*Rr,0,Math.PI*2),B.fillStyle=jt.color,B.fill(),B.strokeStyle="white",B.lineWidth=Ng*Rr,B.stroke()}const{x:Fe,y:Se,width:ze}=jt.anchor,qe=jt.textBackgroundColor,pn=jt.textColor??"#ffffff",Jr=jt.textFontSize??Va,Mi=jt.textBold?700:400,ei=jt.textItalic?"italic ":"",Rs=a5(jt.description||""),Gi=fA(Rs.length,Jr);qe!=null&&qe!=="transparent"&&(B.fillStyle=qe,Nt(Fe,Se,ze,Gi,CS),B.fill()),B.font=`${ei}${Mi} ${Jr}px ${Lo.current}`,B.fillStyle=pn,B.textBaseline="top";const io=Fe+Yg+n5;let Ci=Se+Yg+k8;for(const Rr of Rs){B.fillText(Rr,io,Ci);const Fo=Ci+Jr*.9,al=B.measureText(Rr).width;jt.textUnderline&&(B.strokeStyle=pn,B.lineWidth=1,B.beginPath(),B.moveTo(io,Fo+1),B.lineTo(io+al,Fo+1),B.stroke()),jt.textStrike&&(B.strokeStyle=pn,B.lineWidth=1,B.beginPath(),B.moveTo(io,Ci+Jr*.55),B.lineTo(io+al,Ci+Jr*.55),B.stroke()),Ci+=Jr*$g}},Ce=jt=>{if(jt.calloutHidden||jt.anchor.type==="text"||jt.anchor.type==="redact")return;const Fe=nt[jt.id];if(!Fe)return;const{x:Se,y:ze,width:qe,height:pn}=Fe,Jr=rA*sA(Ht(jt)),Mi=Jr,ei=Se+Mi,Rs=ze+Mi,Gi=Math.max(0,qe-2*Mi),io=Math.max(0,pn-2*Mi),Ci=(jt.textFontSize??Va)*Q4,Rr=jt.description?sD({html:jt.description,width:Math.max(0,Gi-e5*2),fontSize:Ci,fontFamily:Lo.current,lineHeight:$g,metrics:Me}):null,Fo=Rr?Rr.height+t5+iA:0,al=!!jt.description,Th=jt.image?nA:0;let Hf=al?Fo:jt.image?0:io,mu=jt.image?io-Hf:0;jt.image&&mu<Th&&(mu=Th,Hf=Math.max(0,io-mu));const Nd=jt.descPos==="above"?Rs+Hf:Rs,qf=jt.descPos==="above"?Rs:Rs+mu;B.save(),Nt(Se,ze,qe,pn,Z2),B.clip();const Nh=jt.theme==="light"&&al,_h=jt.textColor??(Nh?"#111111":"#d0d0d0"),p1=jt.textBackgroundColor===null?"rgba(0,0,0,0)":jt.textBackgroundColor??(Nh?"rgba(245,245,250,0.98)":"rgba(10,10,16,0.88)");if(B.fillStyle=p1,B.fillRect(Se,ze,qe,pn),jt.image){const za=At.get(jt.id)??null;if(za){const qc=za.width/za.height,gu=Gi/mu;let $c=0,Uo=0,Yc=za.width,Ol=za.height;qc>gu?(Yc=Ol*gu,$c=(za.width-Yc)/2):(Ol=Yc/gu,Uo=(za.height-Ol)/2),B.drawImage(za,$c,Uo,Yc,Ol,ei,Nd,Gi,mu)}B.strokeStyle=jt.color+"44",B.lineWidth=1*le,B.beginPath(),jt.descPos==="above"?al&&(B.moveTo(ei,Nd),B.lineTo(ei+Gi,Nd)):al&&(B.moveTo(ei,qf),B.lineTo(ei+Gi,qf)),B.stroke()}if(Rr){const za=qf+t5,qc=ei+e5;B.textAlign="left",B.textBaseline="alphabetic";for(const gu of Rr.lines){const $c=za+gu.baseline;for(const Uo of gu.runs)if(B.font=Yt(Uo),B.fillStyle=_h,B.fillText(Uo.text,qc+Uo.x,$c),Uo.u||Uo.s){const Yc=B.measureText(Uo.text).width;if(B.strokeStyle=_h,B.lineWidth=1*le,B.beginPath(),Uo.u){const Ol=$c+Uo.fs*.1;B.moveTo(qc+Uo.x,Ol),B.lineTo(qc+Uo.x+Yc,Ol)}if(Uo.s){const Ol=$c-Uo.fs*.3;B.moveTo(qc+Uo.x,Ol),B.lineTo(qc+Uo.x+Yc,Ol)}B.stroke()}}}B.restore(),Nt(Se,ze,qe,pn,Z2),B.strokeStyle=jt.color,B.lineWidth=Jr,B.stroke()};for(const jt of Je)kn(jt),jt.anchor.type==="text"?bn(jt):ye(jt),Ce(jt);const Jn=w==="jpeg"?"image/jpeg":"image/png",$r=dt.toDataURL(Jn,w==="jpeg"?.92:void 0);if(_?.returnDataUrl)return $r;const Yr=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),Mo=w==="jpeg"?`img_${Yr}.jpg`:`img_${Yr}.png`;if(pd()&&await Kk($r,Mo))return;const Co=document.createElement("a");if(Co.href=$r,Co.download=Mo,M){window.open($r,"_blank","noopener,noreferrer");return}Co.click()},[M]);Kl.current=V;const K=I.useCallback(async()=>{if(!E||!X.w)return null;const w=await V("png",1,{returnDataUrl:!0});if(!w||typeof w!="string")return null;const{w:k,h:_}=X,N=new xn({orientation:k>_?"landscape":"portrait",unit:"mm",format:"a4"}),z=N.internal.pageSize.getWidth(),tt=N.internal.pageSize.getHeight(),nt=25.4/96,F=k*nt,W=_*nt,ot=Math.min(z/F,tt/W),st=F*ot,dt=W*ot,B=(z-st)/2,Nt=(tt-dt)/2;return N.addImage(w,"PNG",B,Nt,st,dt),N.output("blob")},[E,X,V]),it=I.useCallback(async()=>{const w=await K();if(!w)return;const _=`collage_${new Date().toISOString().replace(/[:.]/g,"-").slice(0,19)}.pdf`,N=URL.createObjectURL(w);if(setTimeout(()=>URL.revokeObjectURL(N),6e4),pd()&&await Kk(N,_))return;const z=document.createElement("a");z.href=N,z.download=_,z.click()},[K]),at=I.useCallback(async()=>{if(!(!E||!X.w||sr)){Ec(!0);try{const k=window.ClipboardItem;if(!Ss||!k)return;const _=await V("png",1,{returnDataUrl:!0});if(!_||typeof _!="string")return;const N=e4(_);if(!N)return;const z=new k({[N.type]:N});await navigator.clipboard.write([z]),Ys(!0),setTimeout(()=>Ys(!1),1500)}catch{}finally{Ec(!1)}}},[E,X.w,sr,V,Ss]),mt=I.useCallback(w=>{const k=new Date(w);De(k),Hn(Qf(k)),vi(!0)},[]),_t=I.useCallback(w=>{qr(w.sourceUrl!==void 0||w.sourceTitle!==void 0||w.capturedAt!==void 0?{sourceUrl:w.sourceUrl,sourceTitle:w.sourceTitle,capturedAt:w.capturedAt}:null),w.capturedAt!==void 0&&mt(w.capturedAt),D(w.backgroundImage),wt(w.imageSize),yt(w.sourceImageSize),ct(w.pins),te(w.cardPositions),G(null),xt(null),Ro(null),Ft(null),Qt(null),Ne(null),kr(null),We(null),Y(!1),Dt(null),us.current=!0,Qo.current=!0,wi.current=[],so.current=[],bo(0),Qa(0)},[mt]),Vt=I.useCallback(()=>sF({backgroundImage:E,imageSize:X,sourceImageSize:Tt,pins:J,cardPositions:Bt,settings:{fontId:er.fontId,strokeWidthScale:is},meta:Wt}),[E,X,Tt,J,Bt,er.fontId,is,Wt]),gt=I.useCallback(()=>{D(null),wt({w:0,h:0}),yt(null),ct([]),te({}),qr(null),G(null),xt(null),Ro(null),Ft(null),Qt(null),Ne(null),kr(null),We(null),Y(!1),Dt(null),wi.current=[],so.current=[],bo(0),Qa(0),Pt.current=null,ie.current=null},[]),Pt=I.useRef(null),qt=I.useRef(0),ie=I.useRef(null),$t=I.useRef(null),re=I.useCallback(()=>{Pt.current=null,qt.current=performance.now()+PF},[]),se=I.useRef(f);se.current=f;const we=I.useRef(c);we.current=c;const he=I.useRef(d);he.current=d;const tn=I.useCallback(w=>{w&&((w.fontId==="road-ui"||w.fontId==="uaf-sans"&&lA)&&oo(w.fontId),typeof w.strokeWidthScale=="number"&&Wo(w.strokeWidthScale))},[oo,Wo]),He=I.useCallback(async w=>{_t(oF(w)),tn(w.settings),re()},[_t,tn,re]),jn=I.useCallback(async w=>{const k=await cF(w);await new Promise((_,N)=>{Pr(k,!0,z=>{z?_():N(new Error("Failed to load image"))})}),re()},[Pr,re]),Ze=I.useCallback(()=>{const w=ie.current;w&&(Pt.current=w.fingerprint,se.current?.(w.document,{dirty:!1}),$t.current?.notifyChange(w.document,!1))},[]),Bn=I.useRef({loadDocument:async()=>{},loadImage:async()=>{},getDocument:()=>null,exportImage:async()=>null,exportPdf:async()=>null,markSaved:()=>{},reset:()=>{}});Bn.current.loadDocument=He,Bn.current.loadImage=jn,Bn.current.getDocument=Vt,Bn.current.exportImage=async(w,k=1)=>{const _=await V(w,k,{returnDataUrl:!0});if(!_||typeof _!="string")return null;const N=w==="jpeg"?"image/jpeg":"image/png",z=e4(_);return z?{mime:N,dataUrl:_,blob:z}:null},Bn.current.exportPdf=K,Bn.current.markSaved=Ze,Bn.current.reset=gt,I.useImperativeHandle(n,()=>Bn.current,[]);const Gr=I.useRef(!1);I.useEffect(()=>{Gr.current||!i||(Gr.current=!0,He(i))},[i,He]),I.useEffect(()=>{const w=Vt();if(!w){ie.current=null;return}const k=lF(w);(Pt.current===null||performance.now()<qt.current)&&(Pt.current=k),ie.current={document:w,fingerprint:k};const _=k!==Pt.current;se.current?.(w,{dirty:_}),$t.current?.notifyChange(w,_)},[Vt]),I.useEffect(()=>{const w=gF({editor:Bn.current,config:{...vF(),...s},onReady:()=>we.current?.(),onError:k=>he.current?.(k)});return $t.current=w,()=>{w.stop(),$t.current===w&&($t.current=null)}},[p,s]);const cn=B9({state:{backgroundImage:E,imageSize:X,sourceImageSize:Tt,pins:J,cardPositions:Bt,sourceUrl:Wt?.sourceUrl,sourceTitle:Wt?.sourceTitle,capturedAt:Wt?.capturedAt},onRestore:_t,enabled:g.autosave}),{restoreDraft:$e,dismissRestorePrompt:Le}=cn,li=I.useRef(!1);I.useEffect(()=>{if(!li.current&&(li.current=!0,!!pd())){if(kF()){$e();return}SF()&&(Le(),AF().then(w=>{if(!w){q("Не вдалося отримати знімок від розширення.");return}Pr(w.dataUrl,!0,k=>{if(!k){q("Не вдалося завантажити знімок.");return}qr({sourceUrl:w.sourceUrl,sourceTitle:w.sourceTitle,capturedAt:w.capturedAt}),w.capturedAt!==void 0&&mt(w.capturedAt)})}))}},[$e,Le,Pr,mt]);const Mn=cn.errorMessage??(cn.status==="saving"?"Збереження чернетки…":cn.status==="saved"&&cn.lastSavedAt?`Чернетка збережена: ${Zd(new Date(cn.lastSavedAt))}`:cn.canRestore&&cn.storedDraftSavedAt?`Знайдено чернетку від ${Zd(new Date(cn.storedDraftSavedAt))}`:null),$n=cn.status==="error"?"#E63946":"#555",[ir,ki]=I.useState(null),no=I.useRef(null),Ir=I.useRef(null),ji=I.useRef(null),[Bo,Wi]=I.useState(!1),Vn=I.useCallback((w,k)=>{k.preventDefault(),k.stopPropagation(),w&&G(w),ki({pinId:w,x:k.clientX,y:k.clientY,at:xe(k.clientX,k.clientY)})},[xe]),fr=I.useCallback(w=>{const k=Mr.current.find(z=>z.id===w);if(!k)return;no.current=zS(k,Ko.current[w]),Wi(!0);const N=a5(k.description||"").join(`
236
+ `).trim()||`ТИЦЬ: ${k.label}`;Ir.current=null,navigator.clipboard?.writeText?.(N).then(()=>{Ir.current=N}).catch(()=>{})},[]),Kr=I.useCallback(w=>{Jt(),ct(k=>Zk([...k,w.pin])),w.card&&te(k=>({...k,[w.pin.id]:w.card})),G(w.pin.id),xt(w.pin.id),_i.current=null},[Jt]),yr=I.useCallback(w=>{const k=Mr.current.find(N=>N.id===w);if(!k)return;const _=_F;Kr(yA(zS(k,Ko.current[w]),_,_,fa()))},[Kr]),Ii=I.useCallback(w=>{const k=no.current;k&&Kr(AD(k,w,fa()))},[Kr]),ti=I.useCallback(()=>{const{w,h:k}=Cr.current;Ii(ji.current??{x:w/2,y:k/2})},[Ii]);I.useEffect(()=>{const w=k=>{const _=Ir.current;if(_===null||!no.current||!to.current)return;const N=k.target;N&&(N.isContentEditable||N.closest(".ProseMirror")!==null||N.tagName==="TEXTAREA"||N.tagName==="INPUT")||(k.clipboardData?.getData("text/plain")??"")!==_||(k.preventDefault(),k.stopPropagation(),ti())};return window.addEventListener("paste",w,!0),()=>window.removeEventListener("paste",w,!0)},[ti]),y9({isMac:b,backgroundImage:E,pinsLength:J.length,showExportMenu:Ln,sourceImageSize:Tt,imageSize:X,activePin:j,calloutControlPinId:ut,undo:Oo,redo:ks,handleExport:V,handleExportPdf:it,stepZoom:ps,handleFitToWindow:vo,deletePin:T,movePinZ:m,copyPin:fr,duplicatePin:yr,pastePinFromClipboard:ti,setMode:P,setPolygonDraft:Ft,setPolylineDraft:Qt,setShapeDraftType:Ne,setPlacementTool:Ye,setShowExportMenu:Ke,beginCrop:va,insertCurrentDateTimeText:co,toggleCompassMenu:Ls,toggleStampMenu:dc,toggleImageObjectMenu:_l,toggleCalloutPanel:Ja,newBgFileRef:Xs,replaceBgFileRef:tl,exportMenuOpenedViaHotkeyRef:ar}),I.useEffect(()=>{if(!_i.current)return;const w=setTimeout(()=>{_i.current=null},500);return()=>clearTimeout(w)},[ut]);const br=I.useMemo(()=>Wg(J),[J]),[zi,Tr]=I.useState(null),Bi=J.some(w=>w.anchor.type==="redact"),Xi=I.useMemo(()=>JSON.stringify(J.filter(w=>w.anchor.type!=="redact").map(w=>[w.id,w.anchor,w.color,w.description,w.calloutHidden,w.z])),[J]);I.useEffect(()=>{if(!Bi||!E||!X.w){Tr(null);return}let w=!1;const k=setTimeout(async()=>{const _=await Kl.current?.("png",TF,{returnDataUrl:!0,skipRedaction:!0});if(w||typeof _!="string")return;const N=new Image;N.onload=()=>{w||Tr(N)},N.src=_},NF);return()=>{w=!0,clearTimeout(k)}},[Bi,E,X.w,X.h,Xi,Bt]);const[zr,dr]=I.useState(null);I.useEffect(()=>{if(!ir)return;const w=()=>ki(null),k=_=>{_.key==="Escape"&&w()};return window.addEventListener("pointerdown",w),window.addEventListener("wheel",w,{passive:!0}),window.addEventListener("resize",w),window.addEventListener("keydown",k),()=>{window.removeEventListener("pointerdown",w),window.removeEventListener("wheel",w),window.removeEventListener("resize",w),window.removeEventListener("keydown",k)}},[ir]);const ro=I.useMemo(()=>{const w={};for(const k of J)if(k.anchor.type==="polygon"||k.anchor.type==="polyline"){const _=k.anchor.points;if(!_.length)continue;let N=_[0].x,z=_[0].y,tt=_[0].x,nt=_[0].y;for(let F=1;F<_.length;F++)_[F].x<N&&(N=_[F].x),_[F].y<z&&(z=_[F].y),_[F].x>tt&&(tt=_[F].x),_[F].y>nt&&(nt=_[F].y);w[k.id]={minX:N,minY:z,maxX:tt,maxY:nt}}return w},[J]),Ai=I.useCallback(w=>{const k=12*le,_=k,N=k,z=Math.max(_,X.w-k),tt=Math.max(N,X.h-k),nt=(ot,st,dt)=>Math.max(st,Math.min(ot,dt));let F=k,W=k;if(w.anchor.type==="point")F=w.anchor.x+k,W=w.anchor.y+k;else if(w.anchor.type==="image")F=w.anchor.x+w.anchor.width+k,W=w.anchor.y+k;else if(w.anchor.type==="polygon"||w.anchor.type==="polyline"){const ot=ro[w.id];ot&&(F=ot.maxX+k,W=ot.maxY+k)}else if(w.anchor.type==="rectangle"){const{x:ot,y:st,width:dt,height:B,rotation:Nt=0}=w.anchor,It=ot+dt/2,kt=st+B/2,Lt=Nt*Math.PI/180,At=Math.cos(Lt),Ht=Math.sin(Lt),Yt=[{lx:-dt/2,ly:-B/2},{lx:dt/2,ly:-B/2},{lx:dt/2,ly:B/2},{lx:-dt/2,ly:B/2}].map(Me=>({x:It+Me.lx*At-Me.ly*Ht,y:kt+Me.lx*Ht+Me.ly*At})),de=Math.max(...Yt.map(Me=>Me.x)),be=Math.max(...Yt.map(Me=>Me.y));F=de+k,W=be+k}else if(w.anchor.type==="ellipse"){const{cx:ot,cy:st,rx:dt,ry:B,rotation:Nt=0}=w.anchor,It=Nt*Math.PI/180,kt=Math.cos(It),Lt=Math.sin(It),At=Math.sqrt((dt*kt)**2+(B*Lt)**2),Ht=Math.sqrt((dt*Lt)**2+(B*kt)**2);F=ot+At+k,W=st+Ht+k}else if(w.anchor.type==="compass")F=w.anchor.cx+w.anchor.radius+k,W=w.anchor.cy+w.anchor.radius+k;else if(w.anchor.type==="arrow"){const ot=[w.anchor.start,w.anchor.end,w.anchor.control],st=Math.max(...ot.map(B=>B.x)),dt=Math.max(...ot.map(B=>B.y));F=st+k,W=dt+k}return{x:nt(F,_,z),y:nt(W,N,tt)}},[X.h,X.w,ro]),yn=w=>{const k=G2(w,J);return k!==null&&yS(k)},hn=tc,xr=tc,Ao=Po.current?.getBoundingClientRect()??null,ns=Cl.current?.getBoundingClientRect()??null,uo=Da.current?.getBoundingClientRect()??null,ci=el.current?.getBoundingClientRect()??null,Br=!!E&&X.w>0,Rl=ic.current?.getBoundingClientRect()??null,Wu=nl.current?.getBoundingClientRect()??null,Nr=Ri.current?.getBoundingClientRect()??null;return A.jsx(z6.Provider,{value:er.showToolTooltips,children:A.jsxs("div",{ref:Ml,style:{display:"flex",flexDirection:"column",height:"100dvh",minHeight:"100vh",background:"#08080d",color:"#ddd",fontFamily:Rn},onClick:()=>{if(as.current){as.current=!1;return}G(null),xt(null),Ke(!1),Go(!1),bt(!1),Sn(!1),En(!1),Kn(!1),Or(!1)},onDragOver:w=>{w.dataTransfer?.types?.includes("Files")&&(w.preventDefault(),w.dataTransfer.dropEffect="copy",xa(!0))},onDragLeave:w=>{const k=w.relatedTarget;k&&Ml.current?.contains(k)||xa(!1)},onDrop:()=>{xa(!1)},children:[A.jsxs("div",{ref:Vi,style:{display:"flex",alignItems:"center",gap:16,padding:"8px 16px",background:"rgba(16,16,24,0.97)",borderBottom:"1px solid rgba(255,255,255,0.06)",flexShrink:0,position:"relative",zIndex:200,fontSize:14,overflow:"visible",scrollbarWidth:"thin"},onClick:w=>w.stopPropagation(),children:[A.jsx("div",{className:"tyts-no-scrollbar",style:{flex:1,minWidth:0,overflowX:"auto",overflowY:"hidden",display:"flex",alignItems:"center"},children:A.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,minWidth:"100%",width:"max-content"},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[A.jsx("img",{src:"./favicon/favicon.svg",alt:"",width:24,height:24,style:{flexShrink:0},"aria-hidden":!0}),!tc&&A.jsx("span",{style:{fontWeight:700,letterSpacing:"0.03em"},children:"Тиць"}),E?A.jsxs(A.Fragment,{children:[A.jsx(Sr,{title:"Створити новий колаж (виноски будуть видалені)",onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),cn.clearDraft(),D(null),wt({w:0,h:0}),yt(null),ct([]),te({}),G(null),xt(null),Ro(null),Ft(null),Qt(null),Ne(null),We(null),Ye("point"),We(null),kr(null),Y(!1),bt(!1),Dt(null),Ke(!1),xa(!1),wi.current=[],so.current=[],bo(0),Qa(0),P("select"),Ye("point"),Li(1)},children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-file-earmark-plus`,style:{fontSize:Zn},"aria-hidden":!0}),!gn&&"Нове"]})}),A.jsx(Sr,{title:"Замінити фон, зберегти виноски",onClick:()=>tl.current?.click(),children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-arrow-repeat`,style:{fontSize:Zn},"aria-hidden":!0}),!gn&&"Замінити"]})}),A.jsxs("div",{ref:Po,style:{position:"relative"},children:[A.jsx(Sr,{title:`Обрізати фон (${Qe(ne.toolCrop,{isMac:b})})`,tooltip:`Обрізати фон (${Qe(ne.toolCrop,{isMac:b})})`,onClick:va,disabled:!E,active:$,tooltipLabel:"Обрізати фон",hotkeyParts:Ei(ne.toolCrop,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-crop`,style:{fontSize:Zn,display:"block",lineHeight:1,transform:"translate(-1px, -1px)"},"aria-hidden":!0}),!gn&&"Crop"]})}),$&&A.jsxs("div",{style:{position:"fixed",top:Ao?Ao.bottom+6:0,left:Ao?Ao.left:0,display:"inline-flex",alignItems:"center",gap:6,background:"rgba(10,10,16,0.97)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.35)",padding:6,zIndex:30},children:[A.jsx(Sr,{title:"Обрати формат обрізки",onClick:()=>bt(w=>!w),children:A.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:128,whiteSpace:"nowrap"},children:A.jsx("span",{children:`${n4.find(w=>w.id===ht)?.label??"Вільний формат"}`})})}),vt&&A.jsx("div",{onClick:w=>w.stopPropagation(),style:{position:"absolute",top:"calc(100% + 6px)",left:0,minWidth:170,background:"rgba(10,10,16,0.97)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.35)",padding:4,zIndex:30},children:n4.map(w=>{const k=w.id===ht;return A.jsxs("button",{type:"button",onClick:()=>{sc(w.id),bt(!1)},style:{width:"100%",textAlign:"left",border:"none",background:k?"rgba(78,205,196,0.16)":"transparent",color:k?"#bdf8f3":"#ddd",borderRadius:6,padding:"6px 8px",cursor:"pointer",fontFamily:Rn,fontSize:13,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[A.jsx("span",{children:w.label}),k&&A.jsx("span",{style:{opacity:.9},children:"✓"})]},w.id)})}),A.jsx(Sr,{title:"Скасувати crop",onClick:Dc,children:A.jsx("i",{className:`${Xn} bi-x-lg`,style:{fontSize:Zn-1},"aria-hidden":!0})}),A.jsx(Sr,{primary:!0,title:"Застосувати crop",onClick:()=>{Td()},disabled:Q,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-check-lg`,style:{fontSize:Zn},"aria-hidden":!0}),!gn&&(Q?"Обробка…":"Застосувати")]})})]})]}),A.jsx("input",{ref:Xs,type:"file",accept:"image/*",style:{display:"none"},onChange:ai}),A.jsx("input",{ref:tl,type:"file",accept:"image/*",style:{display:"none"},onChange:Qr})]}):A.jsxs(A.Fragment,{children:[A.jsx(Sr,{title:"Завантажити фонове зображення",onClick:()=>Xs.current?.click(),children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-image`,style:{fontSize:Zn},"aria-hidden":!0}),!gn&&"Нове зображення"]})}),A.jsx("input",{ref:Xs,type:"file",accept:"image/*",style:{display:"none"},onChange:ai})]})]}),A.jsx("div",{style:{display:"flex",justifyContent:"center",flexShrink:0,margin:"0 auto"},children:A.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[A.jsx(Sr,{disabled:!E,active:Z==="place"&&St===null&&Rt===null&&Te===null&&_e==="point",onClick:()=>{P("place"),Ft(null),Qt(null),Ne(null),Ye("point")},title:`${Z==="place"&&St===null&&!Te?"Клікніть на фото, щоб поставити точку":"Додати точку на фото"} (${Qe(ne.toolPoint,{isMac:b})})`,tooltip:`${Z==="place"&&St===null&&!Te?"Клікніть на фото, щоб поставити точку":"Додати точку на фото"} (${Qe(ne.toolPoint,{isMac:b})})`,tooltipLabel:"Точка",hotkeyParts:Ei(ne.toolPoint,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-pin-map`,style:{fontSize:Zn-1},"aria-hidden":!0}),!gn&&"Точка"]})}),A.jsxs("div",{ref:Cl,style:{position:"relative"},children:[A.jsx(Sr,{disabled:!E,active:Z==="place"&&St!==null,onClick:()=>{P("place"),Ft([]),Qt(null),Ne(null),We(null),Ye("point")},title:`${Z==="place"&&St!==null?"Клік — додати вершину; тягніть вершину — перемістити; «Готово» — закрити":"Додати район (полігон)"} (${Qe(ne.toolRegion,{isMac:b})})`,tooltip:`${Z==="place"&&St!==null?"Клік — додати вершину; тягніть вершину — перемістити; подвійний клік, клік на першу точку або «Готово» — закрити район":"Додати район (полігон). Кліки задають вершини."} (${Qe(ne.toolRegion,{isMac:b})})`,tooltipLabel:"Район",hotkeyParts:Ei(ne.toolRegion,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-hexagon`,style:{fontSize:Zn},"aria-hidden":!0}),!gn&&"Район"]})}),St!==null&&A.jsxs("div",{onClick:w=>w.stopPropagation(),style:{position:"fixed",top:ns?ns.bottom+6:0,left:ns?ns.left:0,display:"inline-flex",alignItems:"center",gap:6,background:"rgba(10,10,16,0.97)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.35)",padding:6,zIndex:30},children:[A.jsx(Sr,{title:"Скасувати район",onClick:()=>Ft(null),children:A.jsx("i",{className:`${Xn} bi-x-lg`,style:{fontSize:Zn-1},"aria-hidden":!0})}),A.jsx(o4,{canUndo:ve,canRedo:je,onUndo:Oo,onRedo:ks,isMac:b}),A.jsx(Sr,{accent:!0,title:"Завершити район із поточних вершин",tooltip:"Завершити район із поточних вершин",onClick:El,disabled:St.length<2,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-check-lg`,style:{fontSize:Zn},"aria-hidden":!0}),!hn&&`Готово (${St.length})`]})})]})]}),A.jsxs("div",{ref:Da,style:{position:"relative"},children:[A.jsx(Sr,{disabled:!E,active:Z==="place"&&Rt!==null,onClick:()=>{P("place"),Ft(null),Qt([]),Ne(null),We(null),Ye("point")},title:`${Z==="place"&&Rt!==null?"Клік — додати точку маршруту; «Готово» — завершити":"Додати маршрут (полілінія)"} (${Qe(ne.toolRoute,{isMac:b})})`,tooltip:`${Z==="place"&&Rt!==null?"Клік — додати точку; тягніть вершину — перемістити; подвійний клік або «Готово» — завершити маршрут (без замикання)":"Додати маршрут (полілінія). Кліки задають точки; лінія не замикається."} (${Qe(ne.toolRoute,{isMac:b})})`,tooltipLabel:"Маршрут",hotkeyParts:Ei(ne.toolRoute,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("svg",{width:Zn,height:Zn,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:A.jsx("path",{d:"M1.00007 15L6 8L10 8L15 1.00002",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})}),!gn&&"Маршрут"]})}),Rt!==null&&A.jsxs("div",{onClick:w=>w.stopPropagation(),style:{position:"fixed",top:uo?uo.bottom+6:0,left:uo?uo.left:0,display:"inline-flex",alignItems:"center",gap:6,background:"rgba(10,10,16,0.97)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.35)",padding:6,zIndex:30},children:[A.jsx(Sr,{title:"Скасувати маршрут",onClick:()=>Qt(null),children:A.jsx("i",{className:`${Xn} bi-x-lg`,style:{fontSize:Zn-1},"aria-hidden":!0})}),A.jsx(o4,{canUndo:ve,canRedo:je,onUndo:Oo,onRedo:ks,isMac:b}),A.jsx(Sr,{accent:!0,title:"Завершити маршрут",tooltip:"Завершити маршрут із поточних точок",onClick:Ra,disabled:Rt.length<2,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-check-lg`,style:{fontSize:Zn},"aria-hidden":!0}),!hn&&`Готово (${Rt.length})`]})})]})]}),A.jsx(Sr,{disabled:!E,active:Z==="place"&&Te==="rectangle",onClick:()=>{P("place"),Ft(null),Qt(null),Ne("rectangle"),We(null),Ye("point")},title:`${Te==="rectangle"?"Потягніть на фото, щоб намалювати прямокутник":"Додати прямокутну область"} (${Qe(ne.toolRectangle,{isMac:b})})`,tooltip:`${Te==="rectangle"?"Потягніть на фото, щоб намалювати прямокутник":"Додати прямокутну область. Потягніть на фото для малювання."} (${Qe(ne.toolRectangle,{isMac:b})})`,tooltipLabel:"Прямокутник",hotkeyParts:Ei(ne.toolRectangle,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-square`,style:{fontSize:Zn-2},"aria-hidden":!0}),!gn&&"Прямокутник"]})}),A.jsx(Sr,{disabled:!E,active:Z==="place"&&Te==="ellipse",onClick:()=>{P("place"),Ft(null),Qt(null),Ne("ellipse"),We(null),Ye("point")},title:`${Te==="ellipse"?"Потягніть на фото, щоб намалювати еліпс":"Додати еліптичну область"} (${Qe(ne.toolEllipse,{isMac:b})})`,tooltip:`${Te==="ellipse"?"Потягніть на фото, щоб намалювати еліпс":"Додати еліптичну область. Потягніть на фото для малювання."} (${Qe(ne.toolEllipse,{isMac:b})})`,tooltipLabel:"Еліпс",hotkeyParts:Ei(ne.toolEllipse,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-circle`,style:{fontSize:Zn-2},"aria-hidden":!0}),!gn&&"Еліпс"]})}),A.jsx(Sr,{disabled:!E,active:Z==="place"&&St===null&&Rt===null&&Te===null&&_e==="arrow",onClick:()=>{P("place"),Ft(null),Qt(null),Ne(null),We(null),Ye("arrow")},title:`${_e==="arrow"&&Z==="place"?"Потягніть на фото, щоб намалювати стрілку":"Додати стрілку"} (${Qe(ne.toolArrow,{isMac:b})})`,tooltip:`${_e==="arrow"&&Z==="place"?"Потягніть на фото, щоб намалювати стрілку; центральний важіль згинає лінію":"Додати стрілку (drag для створення, центральний важіль для вигину)."} (${Qe(ne.toolArrow,{isMac:b})})`,tooltipLabel:"Стрілка",hotkeyParts:Ei(ne.toolArrow,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-arrow-right`,style:{fontSize:Zn-1},"aria-hidden":!0}),!gn&&"Стрілка"]})}),A.jsx(Sr,{disabled:!E,active:Z==="place"&&St===null&&Rt===null&&Te===null&&_e==="text",onClick:()=>{P("place"),Ft(null),Qt(null),Ne(null),We(null),Ye("text")},title:`${_e==="text"&&Z==="place"?"Клікніть на фото, щоб додати текст":"Додати текст"} (${Qe(ne.toolText,{isMac:b})})`,tooltip:`${_e==="text"&&Z==="place"?"Клікніть на фото, щоб додати текстову виноску":"Додати текстову виноску"} (${Qe(ne.toolText,{isMac:b})})`,tooltipLabel:"Текст",hotkeyParts:Ei(ne.toolText,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-type`,style:{fontSize:Zn-1},"aria-hidden":!0}),!gn&&"Текст"]})}),A.jsx(Sr,{disabled:!E,active:Z==="place"&&St===null&&Rt===null&&Te===null&&_e==="pointText",onClick:()=>{P("place"),Ft(null),Qt(null),Ne(null),We(null),Ye("pointText")},title:`${_e==="pointText"&&Z==="place"?"Клікніть на фото, щоб поставити точку з текстом":"Точка з текстом"} (${Qe(ne.toolPointText,{isMac:b})})`,tooltip:`${_e==="pointText"&&Z==="place"?"Клікніть на фото, щоб поставити точку з підписом":"Точка з підписом, без виноски"} (${Qe(ne.toolPointText,{isMac:b})})`,tooltipLabel:"Точка з текстом",hotkeyParts:Ei(ne.toolPointText,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsxs("svg",{width:Zn,height:Zn,viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,style:{display:"block",flexShrink:0},children:[A.jsx("circle",{cx:"3.4",cy:"12.6",r:"1.5",fill:"currentColor"}),A.jsx("rect",{x:"6.6",y:"1.1",width:"8.8",height:"7.4",rx:"1.6",stroke:"currentColor",strokeWidth:"1.2"}),A.jsx("text",{x:"11",y:"4.8",textAnchor:"middle",dominantBaseline:"central",fontSize:"5.6",fontWeight:"700",fill:"currentColor",children:"А"})]}),!gn&&"Точка з текстом"]})}),A.jsx(Sr,{disabled:!E,active:Z==="place"&&Te==="redact",onClick:()=>{P("place"),Ft(null),Qt(null),We(null),Ne("redact")},title:`Замалювати ділянку фону (${Qe(ne.toolRedact,{isMac:b})})`,tooltip:`Виділіть ділянку — її можна розмити, пікселізувати або залити середнім кольором (${Qe(ne.toolRedact,{isMac:b})})`,tooltipLabel:"Замалювати",hotkeyParts:Ei(ne.toolRedact,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-droplet-half`,style:{fontSize:Zn-1},"aria-hidden":!0}),!gn&&"Замалювати"]})}),A.jsxs("div",{ref:Ri,style:{position:"relative"},onClick:w=>w.stopPropagation(),children:[A.jsx(Sr,{disabled:!E,active:_c,onClick:()=>Or(w=>!w),title:`Додати зображення (${Qe(ne.toolImageObject,{isMac:b})})`,tooltip:`Покласти зображення поверх фото — можна совати й масштабувати (${Qe(ne.toolImageObject,{isMac:b})})`,tooltipLabel:"Картинка",hotkeyParts:Ei(ne.toolImageObject,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-image`,style:{fontSize:Zn-1},"aria-hidden":!0}),!gn&&"Картинка"]})}),_c&&A.jsxs("div",{style:{position:"fixed",top:Nr?Nr.bottom+6:0,left:Nr?Nr.left+Nr.width/2:0,transform:"translateX(-50%)",zIndex:3200,padding:8,background:"rgba(16,16,28,0.98)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:10,boxShadow:"0 10px 28px rgba(0,0,0,0.45)"},onClick:w=>w.stopPropagation(),children:[A.jsx("input",{ref:oc,type:"text","aria-label":"Вставте зображення з буфера",onChange:()=>{},value:"",onPaste:w=>{const k=R2(w.clipboardData);k&&(w.preventDefault(),Yn(k))},style:{position:"absolute",width:1,height:1,opacity:0,border:"none",outline:"none",padding:0,margin:0}}),A.jsxs("button",{type:"button",onClick:()=>Jl.current?.click(),onDragOver:w=>{w.preventDefault(),La(!0)},onDragLeave:()=>La(!1),onDrop:w=>{w.preventDefault(),w.stopPropagation(),La(!1);const k=Array.from(w.dataTransfer.files).find(_=>_.type.startsWith("image/"));k&&(Oi(k),Or(!1))},style:{width:260,minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:6,padding:14,borderRadius:8,border:`2px dashed ${jo?bc:"rgba(255,255,255,0.28)"}`,background:jo?"rgba(230,57,70,0.10)":"rgba(255,255,255,0.04)",color:"#ccc",cursor:"pointer",fontFamily:"inherit",fontSize:13,textAlign:"center",transition:"background 0.15s, border-color 0.15s"},children:[A.jsx("i",{className:`${Xn} bi-file-earmark-image`,style:{fontSize:22},"aria-hidden":!0}),A.jsx("span",{children:"Перетягніть зображення сюди"}),A.jsx("span",{style:{color:"rgba(255,255,255,0.55)",fontSize:11,letterSpacing:.2},children:d8.join(" · ")}),A.jsxs("span",{style:{color:"rgba(255,255,255,0.45)",fontSize:11,lineHeight:1.5},children:["або клікніть, щоб вибрати файл",A.jsx("br",{}),"чи вставте з буфера (",ih(),")"]})]})]})]}),A.jsx(Sr,{disabled:!E,active:Z==="place"&&St===null&&Rt===null&&Te===null&&_e==="standalone",onClick:()=>{P("place"),Ft(null),Qt(null),Ne(null),We(null),Ye("standalone")},title:`${_e==="standalone"&&Z==="place"?"Клікніть на фото, щоб додати блок виноски":"Додати блок виноски"} (${Qe(ne.toolStandaloneCallout,{isMac:b})})`,tooltip:`${_e==="standalone"&&Z==="place"?"Клікніть на фото, щоб додати блок виноски без лінії та фігури":"Додати блок виноски без лінії та фігури"} (${Qe(ne.toolStandaloneCallout,{isMac:b})})`,tooltipLabel:"Блок",hotkeyParts:Ei(ne.toolStandaloneCallout,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-chat-square-text`,style:{fontSize:Zn-1},"aria-hidden":!0}),!gn&&"Блок"]})}),A.jsxs("div",{ref:el,style:{position:"relative"},children:[A.jsx(GF,{disabled:!E,menuOpen:wn,onMainClick:co,onMenuClick:Yu,mainTitle:Dr?`Вставити зафіксовані дату та час (${Qe(ne.toolDateTime,{isMac:b})})`:`Вставити поточні дату та час (${Qe(ne.toolDateTime,{isMac:b})})`,mainTooltip:Dr?`Вставляє зафіксовані дату й час: ${Zd(Ae,lr)}`:"Додає редагований текст із поточними датою й часом у лівому нижньому куті",menuTitle:"Відкрити календар і вибір часу",menuTooltip:"Відкрити календар (3 місяці) та вибрати дату й час",mainTooltipLabel:"Дата/час",hotkeyParts:Ei(ne.toolDateTime,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,whiteSpace:"nowrap"},children:[A.jsx("i",{className:`${Xn} bi-clock`,style:{fontSize:Zn-1},"aria-hidden":!0}),Dr&&A.jsx("i",{className:`${Xn} bi-lock-fill`,style:{fontSize:Zn-3,opacity:.85},"aria-hidden":!0}),!gn&&"Дата/час"]})}),wn&&A.jsx("div",{style:{position:"fixed",top:ci?ci.bottom+6:0,left:ci?ci.left+ci.width/2:0,transform:"translateX(-50%)",zIndex:3200},onClick:w=>w.stopPropagation(),children:A.jsx(U8,{value:Ae,viewMonth:or,format:lr,locked:Dr,onChange:De,onViewMonthChange:Hn,onFormatChange:Wr,onLockedChange:vi,onInsert:Vu,onNow:Ll,onClose:()=>Sn(!1)})})]}),A.jsx(Sr,{disabled:!E,active:Z==="place"&&St===null&&Rt===null&&Te===null&&_e==="numbering",onClick:()=>{P("place"),Ft(null),Qt(null),Ne(null),We(null),Ye("numbering")},title:`${_e==="numbering"&&Z==="place"?un?"Клікніть кінцеву точку лінії нумерації":"Клікніть початкову точку лінії нумерації":"Нумерація (2 точки: початок -> кінець)"} (${Qe(ne.toolNumbering,{isMac:b})})`,tooltip:`${_e==="numbering"&&Z==="place"?un?"Другий клік поставить кінець і номер на кінці":"Перший клік задає старт лінії":"Поставте старт і фініш лінії, номер буде на кінці"} (${Qe(ne.toolNumbering,{isMac:b})})`,tooltipLabel:"Нумерація",hotkeyParts:Ei(ne.toolNumbering,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-123`,style:{fontSize:Zn-1},"aria-hidden":!0}),!gn&&"Нумерація"]})}),A.jsxs("div",{ref:ic,style:{position:"relative"},onClick:w=>w.stopPropagation(),children:[A.jsx(Sr,{disabled:!E,active:gr,onClick:Ls,title:`Додати компас (${Qe(ne.toolCompass,{isMac:b})})`,tooltip:`Оберіть кут, щоб додати компас на зображення (${Qe(ne.toolCompass,{isMac:b})})`,tooltipLabel:"Компас",hotkeyParts:Ei(ne.toolCompass,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-compass`,style:{fontSize:Zn-1},"aria-hidden":!0}),!gn&&"Компас"]})}),gr&&A.jsx(WF,{anchorRect:Rl,onPick:ja,renderPreview:w=>A.jsx(XF,{corner:w})})]}),A.jsxs("div",{ref:nl,style:{position:"relative"},onClick:w=>w.stopPropagation(),children:[A.jsx(Sr,{active:en,onClick:dc,title:`Штамп: лого в кут зображення (${Qe(ne.toolStamp,{isMac:b})})`,tooltip:"Лого в кут зображення; можна ставити автоматично на кожне нове",tooltipLabel:"Штамп",hotkeyParts:Ei(ne.toolStamp,{isMac:b}),showHotkeyBadge:Ar&&!gn,hideTooltip:en,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("svg",{width:Zn,height:Zn,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:A.jsxs("g",{stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",children:[A.jsx("path",{d:"M6.5 8V6.2a2.5 2.5 0 1 1 3 0V8"}),A.jsx("path",{d:"M3 8.5h10a.5.5 0 0 1 .5.5v2.5h-11V9a.5.5 0 0 1 .5-.5z"}),A.jsx("path",{d:"M2.5 14.5h11"})]})}),!gn&&"Штамп"]})}),en&&A.jsx(X9,{anchorRect:Wu,anchorEl:nl.current,onClose:hc,settings:Xt.settings,logo:Xt.logo,hasOwnLogo:Xt.hasOwnLogo,hasBuiltInLogo:Xt.hasBuiltInLogo,saveError:Xt.saveError,canInsert:!!E,hasStampOnImage:!!Zy(J,ut??j),onInsert:Dl,onUpdate:Xt.update,onPickFile:Xt.setLogoFromFile,onClearLogo:Xt.clearLogo,onPreviewCorner:qi})]}),A.jsx("span",{style:{width:1,height:20,background:"rgba(255,255,255,0.2)",flexShrink:0,marginLeft:10,marginRight:10},"aria-hidden":!0}),A.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[A.jsx(Sr,{disabled:!E,title:`Зменшити масштаб (${Qe(ne.zoomOut,{isMac:b})})`,onClick:()=>ps("out"),tooltipLabel:"Зменшити масштаб",hotkeyParts:Ei(ne.zoomOut,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:A.jsx("i",{className:`${Xn} bi-zoom-out`,style:{fontSize:Zn-2},"aria-hidden":!0})})}),!hn&&A.jsxs("span",{style:{minWidth:52,textAlign:"center",color:"#888",fontVariantNumeric:"tabular-nums"},children:[Math.round(Er*100),"%"]}),A.jsx(Sr,{disabled:!E,title:`Збільшити масштаб (${Qe(ne.zoomIn,{isMac:b})})`,onClick:()=>ps("in"),tooltipLabel:"Збільшити масштаб",hotkeyParts:Ei(ne.zoomIn,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:A.jsx("i",{className:`${Xn} bi-zoom-in`,style:{fontSize:Zn-2},"aria-hidden":!0})})}),A.jsx(Sr,{disabled:!E,title:`Припасувати розмір зображення під розмір вікна (${Qe(ne.fitToWindow,{isMac:b})})`,tooltip:`Припасувати розмір зображення під розмір вікна (${Qe(ne.fitToWindow,{isMac:b})})`,onClick:vo,hotkeyParts:Ei(ne.fitToWindow,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:A.jsx("i",{className:`${Xn} bi-aspect-ratio`,style:{fontSize:Zn-2},"aria-hidden":!0})})})]}),A.jsx("span",{style:{width:1,height:20,background:"rgba(255,255,255,0.2)",flexShrink:0,marginLeft:10,marginRight:10},"aria-hidden":!0}),A.jsx(Sr,{title:`Відмінити останню дію (${Qe(ne.undo,{isMac:b})})`,tooltip:`Відмінити останню дію (${Qe(ne.undo,{isMac:b})})`,onClick:Oo,disabled:!E||!Uu,hotkeyParts:Ei(ne.undo,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:A.jsx("i",{className:`${Xn} bi-arrow-counterclockwise`,style:{fontSize:Zn},"aria-hidden":!0})})}),A.jsx(Sr,{title:`Повернути скасовану дію (${Qe(ne.redo,{isMac:b})})`,tooltip:`Повернути скасовану дію (${Qe(ne.redo,{isMac:b})})`,onClick:ks,disabled:!E||!Xl,hotkeyParts:Ei(ne.redo,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:A.jsx("i",{className:`${Xn} bi-arrow-clockwise`,style:{fontSize:Zn},"aria-hidden":!0})})})]})})]})}),A.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",flexShrink:0,position:"relative",zIndex:1},children:[A.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:10},children:[A.jsx(Sr,{tooltipLabel:"Медіа",tooltip:"Панель заготовок: фото й текст, які перетягують на виноски",active:Ma,onClick:()=>Mc(w=>!w),children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsxs("svg",{width:Zn,height:Zn,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:[A.jsxs("g",{stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",children:[A.jsx("rect",{x:"0.5",y:"5.5",width:"10",height:"10",rx:"1.5"}),A.jsx("path",{d:"M3 3.5h8.5a1 1 0 0 1 1 1V13"}),A.jsx("path",{d:"M5 1.5h8.5a1 1 0 0 1 1 1V11"}),A.jsx("path",{d:"M0.5 13.5l3-3 2 2 2.5-3 2.5 3"})]}),A.jsx("circle",{cx:"3.5",cy:"8.5",r:"1",fill:"currentColor"})]}),!gn&&"Медіа"]})}),A.jsx(Sr,{title:E?`Швидке збереження у форматі JPEG (${Qe(ne.downloadJpg,{isMac:b})})`:"Спочатку завантажте фонове зображення",onClick:()=>V("jpeg"),disabled:!Br,hotkeyParts:Ei(ne.downloadJpg,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} bi-download`,style:{fontSize:Zn},"aria-hidden":!0}),!xr&&"JPG"]})}),A.jsx(Sr,{title:Ss?"Скопіювати зображення в буфер обміну":"Ваш браузер не підтримує копіювання зображення в буфер",onClick:at,disabled:!Br||sr||!Ss,success:Ea,children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[A.jsx("i",{className:`${Xn} ${sr?"bi-arrow-repeat tyts-spin":Ea?"bi-check-lg":"bi-clipboard-plus"}`,style:{fontSize:Zn-2},"aria-hidden":!0}),!gn&&"Копіювати"]})}),A.jsx(Sr,{title:`Більше опцій збереження (${Qe(ne.openExportMenu,{isMac:b})})`,onClick:()=>{Ke(w=>!w)},disabled:!Br,hotkeyParts:Ei(ne.openExportMenu,{isMac:b}),showHotkeyBadge:Ar&&!gn,children:A.jsx("i",{className:`${Xn} bi-caret-down-fill`,style:{fontSize:Zn-4},"aria-hidden":!0})})]}),Ln&&A.jsxs("div",{style:{position:"absolute",right:0,top:"100%",marginTop:6,background:"rgba(10,10,16,0.97)",borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",boxShadow:"0 8px 24px rgba(0,0,0,0.6)",padding:"6px 0",width:"max-content",display:"flex",flexDirection:"column",zIndex:3e3},onClick:w=>w.stopPropagation(),children:[Tt&&A.jsx("button",{type:"button",disabled:!Br,onClick:()=>{if(!Tt)return;Ke(!1);const{w}=X;if(!w)return;const k=Tt.w/w/2;V("png",k)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:Br?"#fff":"rgba(255,255,255,0.35)",fontFamily:Rn,fontSize:13,cursor:Br?"pointer":"not-allowed"},children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[A.jsx(Hl,{children:"1"}),A.jsxs("span",{children:["PNG оригінал"," ",A.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:[Tt.w,"×",Tt.h," px"]})]})]})}),A.jsx("button",{type:"button",disabled:!Br,onClick:()=>{Ke(!1),V("png",1)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:Br?"#fff":"rgba(255,255,255,0.35)",fontFamily:Rn,fontSize:13,cursor:Br?"pointer":"not-allowed"},children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[A.jsx(Hl,{children:Tt?"2":"1"}),A.jsxs("span",{children:["PNG"," ",A.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:["– ",X.w,"×",X.h," px"]})]})]})}),A.jsx("button",{type:"button",disabled:!Br,onClick:()=>{Ke(!1),V("png",2)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:Br?"#fff":"rgba(255,255,255,0.35)",fontFamily:Rn,fontSize:13,cursor:Br?"pointer":"not-allowed"},children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[A.jsx(Hl,{children:Tt?"3":"2"}),A.jsxs("span",{children:["PNG ×2"," ",A.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:["– ",X.w*2,"×",X.h*2," px"]})]})]})}),A.jsx("button",{type:"button",disabled:!Br,onClick:()=>{Ke(!1),V("jpeg",2)},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:Br?"#fff":"rgba(255,255,255,0.35)",fontFamily:Rn,fontSize:13,cursor:Br?"pointer":"not-allowed"},children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[A.jsx(Hl,{children:Tt?"4":"3"}),A.jsxs("span",{children:["JPG ×2"," ",A.jsxs("span",{style:{color:"rgba(255,255,255,0.6)",fontWeight:600},children:["– ",X.w*2,"×",X.h*2," px"]})]})]})}),A.jsx("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),A.jsx("button",{type:"button",disabled:!Br,onClick:()=>{Ke(!1),it()},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:Br?"#fff":"rgba(255,255,255,0.35)",fontFamily:Rn,fontSize:13,cursor:Br?"pointer":"not-allowed"},children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[A.jsx(Hl,{children:Tt?"5":"4"}),A.jsx("span",{children:"PDF"})]})}),A.jsx("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),A.jsx("button",{type:"button",disabled:!Br,onClick:()=>{Ke(!1),J.length>0&&window.print()},style:{width:"100%",padding:"6px 14px",textAlign:"left",background:"transparent",border:"none",color:Br?"#fff":"rgba(255,255,255,0.35)",fontFamily:Rn,fontSize:13,cursor:Br?"pointer":"not-allowed"},children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[A.jsx(Hl,{children:Tt?"6":"5"}),A.jsx("span",{children:"Друк… (діалог друку)"})]})})]})]})]}),A.jsxs("div",{style:{flex:1,minHeight:0,display:"flex"},children:[A.jsx("div",{ref:qn,style:{flex:1,minHeight:0,minWidth:0,overflow:E?"auto":"hidden",position:"relative",touchAction:"none"},onClick:w=>w.stopPropagation(),onPointerDown:w=>{if(!E||!qn.current)return;const k=w.target,_=y&&w.pointerType!=="mouse";if(_&&(eo.current.set(w.pointerId,{x:w.clientX,y:w.clientY}),eo.current.size>=2)){const F=Array.from(eo.current.values()),W=F[0],ot=F[1],st=Math.hypot(ot.x-W.x,ot.y-W.y);if(st>0){const dt=qn.current.getBoundingClientRect(),B=(W.x+ot.x)/2,Nt=(W.y+ot.y)/2,It=B-dt.left,kt=Nt-dt.top,Lt=Er||1,At=(qn.current.scrollLeft+It)/Lt,Ht=(qn.current.scrollTop+kt)/Lt;ea.current={active:!0,startDistance:st,startZoom:Lt,anchorImageX:At,anchorImageY:Ht},hs.current.isPanning=!1,qn.current.style.cursor="default",w.preventDefault();return}}const N=w.button===1,z=w.button===0&&(k.getAttribute("data-background")==="true"||!!k.closest('[data-background="true"]'));(_||N||z&&!(Z==="place"&&Te))&&(w.preventDefault(),Qo.current=!1,hs.current={isPanning:!0,startX:w.clientX,startY:w.clientY,startScrollLeft:qn.current.scrollLeft,startScrollTop:qn.current.scrollTop},qn.current.style.cursor="grabbing")},onPointerMove:w=>{const k=qn.current;if(!k)return;y&&w.pointerType!=="mouse"&&eo.current.has(w.pointerId)&&eo.current.set(w.pointerId,{x:w.clientX,y:w.clientY});const N=ea.current;if(N?.active&&eo.current.size>=2){const F=Array.from(eo.current.values()),W=F[0],ot=F[1],st=Math.hypot(ot.x-W.x,ot.y-W.y);if(st>0&&N.startDistance>0){const dt=k.getBoundingClientRect(),B=(W.x+ot.x)/2-dt.left,Nt=(W.y+ot.y)/2-dt.top,It=st/N.startDistance,kt=Math.min(tg,Math.max(Qm,+(N.startZoom*It).toFixed(eg))),Lt=Cr.current.w*kt,At=Cr.current.h*kt;k.scrollLeft=Math.max(0,Math.min(Lt-k.clientWidth,N.anchorImageX*kt-B)),k.scrollTop=Math.max(0,Math.min(At-k.clientHeight,N.anchorImageY*kt-Nt)),Qo.current=!1,Li(kt)}w.preventDefault();return}const z=hs.current;if(!z.isPanning)return;w.preventDefault();const tt=w.clientX-z.startX,nt=w.clientY-z.startY;k.scrollLeft=z.startScrollLeft-tt,k.scrollTop=z.startScrollTop-nt},onPointerUp:w=>{const k=qn.current;k&&(eo.current.has(w.pointerId)&&eo.current.delete(w.pointerId),eo.current.size<2&&(ea.current=null),hs.current.isPanning=!1,k.style.cursor="default")},onPointerCancel:w=>{const k=qn.current;k&&(eo.current.has(w.pointerId)&&eo.current.delete(w.pointerId),eo.current.size<2&&(ea.current=null),hs.current.isPanning=!1,k.style.cursor="default")},onMouseDown:w=>{if(!E||!qn.current)return;const k=w.target,_=w.button===1,N=w.button===0&&(k.getAttribute("data-background")==="true"||!!k.closest('[data-background="true"]'));!_&&(!N||Z==="place"&&Te)||(w.preventDefault(),Qo.current=!1,hs.current={isPanning:!0,startX:w.clientX,startY:w.clientY,startScrollLeft:qn.current.scrollLeft,startScrollTop:qn.current.scrollTop},qn.current.style.cursor="grabbing")},onMouseMove:w=>{const k=hs.current,_=qn.current;if(!k.isPanning||!_)return;w.preventDefault();const N=w.clientX-k.startX,z=w.clientY-k.startY;_.scrollLeft=k.startScrollLeft-N,_.scrollTop=k.startScrollTop-z},onMouseUp:()=>{const w=qn.current;w&&(hs.current.isPanning=!1,w.style.cursor="default")},onMouseLeave:()=>{const w=qn.current;w&&(hs.current.isPanning=!1,w.style.cursor="default")},children:E?A.jsx(A.Fragment,{children:A.jsx("div",{style:{minWidth:"100%",minHeight:"100%",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"},children:A.jsx("div",{style:{width:X.w*Er,height:X.h*Er,position:"relative"},children:A.jsx("div",{ref:As,style:{transform:`scale(${Er})`,transformOrigin:"top left",width:X.w,height:X.h},children:A.jsxs("svg",{ref:Gl,width:X.w,height:X.h,viewBox:`0 0 ${X.w} ${X.h}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",cursor:$?"default":Z==="place"?"crosshair":"default",touchAction:"none",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"},onContextMenu:w=>{$||Vn(null,w)},onPointerDown:w=>Hu(w),onMouseDown:Hu,onPointerMove:w=>Lc(w),onMouseMove:Lc,onClick:ra,onDoubleClick:()=>{St&&St.length>=2&&El(),Rt&&Rt.length>=2&&Ra()},children:[A.jsx("image",{href:E,x:0,y:0,width:X.w,height:X.h,preserveAspectRatio:"xMidYMid meet","data-background":"true",style:{userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"}}),A.jsx("defs",{children:A.jsxs("radialGradient",{id:"vignette",cx:"50%",cy:"50%",r:"70%",children:[A.jsx("stop",{offset:"60%",stopColor:"transparent"}),A.jsx("stop",{offset:"100%",stopColor:"rgba(0,0,0,0.18)"})]})}),A.jsx("rect",{x:0,y:0,width:X.w,height:X.h,fill:"url(#vignette)",pointerEvents:"none","data-background":"true"}),$&&rt&&A.jsxs("g",{children:[A.jsx("rect",{x:0,y:0,width:X.w,height:rt.y,fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),A.jsx("rect",{x:0,y:rt.y+rt.height,width:X.w,height:Math.max(0,X.h-rt.y-rt.height),fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),A.jsx("rect",{x:0,y:rt.y,width:rt.x,height:rt.height,fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),A.jsx("rect",{x:rt.x+rt.width,y:rt.y,width:Math.max(0,X.w-rt.x-rt.width),height:rt.height,fill:"rgba(0,0,0,0.45)",pointerEvents:"none"}),A.jsx("rect",{x:rt.x,y:rt.y,width:rt.width,height:rt.height,fill:"rgba(78,205,196,0.12)",stroke:"#4ECDC4",strokeWidth:2*le,style:{cursor:"move"},onPointerDown:w=>ou(w),onMouseDown:ou}),[{key:"nw",x:rt.x,y:rt.y,cursor:"nwse-resize"},{key:"ne",x:rt.x+rt.width,y:rt.y,cursor:"nesw-resize"},{key:"se",x:rt.x+rt.width,y:rt.y+rt.height,cursor:"nwse-resize"},{key:"sw",x:rt.x,y:rt.y+rt.height,cursor:"nesw-resize"}].map(w=>A.jsx("rect",{x:w.x-6*le,y:w.y-6*le,width:12*le,height:12*le,fill:"#4ECDC4",stroke:"#fff",strokeWidth:1.2*le,style:{cursor:w.cursor},onPointerDown:k=>If(w.key,k),onMouseDown:k=>If(w.key,k)},w.key))]}),St&&St.length>0&&A.jsxs("g",{stroke:"#4ECDC4",strokeWidth:2*le,fill:"none",children:[St.length>=2&&A.jsx("polyline",{points:St.map(w=>`${w.x},${w.y}`).join(" "),strokeDasharray:`${6*le} ${4*le}`,pointerEvents:"none"}),St.map((w,k)=>A.jsx("circle",{cx:w.x,cy:w.y,r:8*le,fill:"#4ECDC4",stroke:"#fff",strokeWidth:1.5*le,style:{cursor:"move"},onPointerDown:_=>au(k,_),onMouseDown:_=>au(k,_)},k))]}),Rt&&Rt.length>0&&A.jsxs("g",{stroke:"#9B59B6",strokeWidth:2*le,fill:"none",children:[Rt.length>=2&&A.jsx("polyline",{points:Rt.map(w=>`${w.x},${w.y}`).join(" "),strokeDasharray:`${6*le} ${4*le}`,pointerEvents:"none"}),Rt.map((w,k)=>A.jsx("circle",{cx:w.x,cy:w.y,r:8*le,fill:"#9B59B6",stroke:"#fff",strokeWidth:1.5*le,style:{cursor:"move"},onPointerDown:_=>Oa(k,_),onMouseDown:_=>Oa(k,_)},k))]}),Ie&&Te&&A.jsx("g",{stroke:"#4ECDC4",strokeWidth:2*le,fill:"#4ECDC444",strokeDasharray:`${6*le} ${4*le}`,pointerEvents:"none",children:Te==="rectangle"||Te==="redact"?A.jsx("rect",{x:Math.min(Ie.x1,Ie.x2),y:Math.min(Ie.y1,Ie.y2),width:Math.abs(Ie.x2-Ie.x1),height:Math.abs(Ie.y2-Ie.y1)}):A.jsx("ellipse",{cx:(Ie.x1+Ie.x2)/2,cy:(Ie.y1+Ie.y2)/2,rx:Math.abs(Ie.x2-Ie.x1)/2,ry:Math.abs(Ie.y2-Ie.y1)/2})}),Be&&A.jsx("g",{stroke:"#4ECDC4",strokeWidth:2*le,fill:"none",pointerEvents:"none",children:A.jsx("path",{d:`M ${Be.start.x} ${Be.start.y} Q ${Be.control.x} ${Be.control.y} ${Be.end.x} ${Be.end.y}`,strokeDasharray:`${6*le} ${4*le}`})}),un&&Ue&&Z==="place"&&_e==="numbering"&&A.jsx("g",{stroke:"#4ECDC4",fill:"none",pointerEvents:"none",children:A.jsx("line",{x1:un.x,y1:un.y,x2:Ue.x,y2:Ue.y,strokeWidth:2*le,strokeDasharray:`${6*le} ${4*le}`})}),br.map(w=>A.jsxs("g",{onContextMenu:k=>Vn(w.id,k),children:[[w].map(k=>{if(k.anchor.type==="text"||k.anchor.type==="standalone"||k.anchor.type==="redact"||k.calloutHidden)return null;const _=Bt[k.id];if(!_)return null;const N=Zm(k,J);return N?A.jsx(g9,{anchor:N,card:_,color:k.color,widthScale:pi(k),points:k.leaderPoints},k.id+"-line"):null}),J.filter(k=>k.id===w.id&&k.anchor.type==="point").map(k=>{const{x:_,y:N}=k.anchor;return A.jsx(XD,{x:_,y:N,color:k.color,label:k.label,widthScale:pi(k),active:j===k.id,onPointerDown:z=>su(k.id,z),onMouseDown:z=>su(k.id,z),onClick:z=>{if(z.stopPropagation(),ce.current){ce.current=!1;return}G(tt=>tt===k.id?null:k.id),xt(null)}},k.id+"-pin")}),J.filter(k=>k.id===w.id&&k.anchor.type==="numbering").map(k=>{const{start:_,end:N}=k.anchor,z=j===k.id,tt=pi(k),nt=String(k.label),F=14*le,W=.075*F,ot=.4*F,st=.35*F,B=Math.max(F*.62,nt.length*.62*F)+ot*2,Nt=F+W+st,It=N.x-B/2,kt=N.y-Nt/2,Lt=14*le,At=4*le,Ht=7*le,Yt=6*le,de=Ht*2+Lt*Wa.length+At*Math.max(0,Wa.length-1),be=Yt*2+Lt,Me=10*le,Je=N.x-de/2,kn=Math.max(0,Math.min(Je,X.w-de)),ye=kt-Me-be,bn=Math.max(0,Math.min(ye,X.h-be)),Ce=24*le,Jn=6*le,$r=kn+de+Jn,Yr=kn-Ce-Jn,Mo=$r+Ce<=X.w?$r:Yr>=0?Yr:Math.max(0,Math.min($r,X.w-Ce)),Co=Math.max(0,Math.min(bn+be/2-Ce/2,X.h-Ce));return A.jsxs("g",{style:{cursor:"pointer"},children:[A.jsx("line",{x1:_.x,y1:_.y,x2:N.x,y2:N.y,stroke:k.color,strokeWidth:(z?3*le:Wf)*tt,style:{cursor:"grab"},onPointerDown:jt=>Rc(k.id,jt),onMouseDown:jt=>Rc(k.id,jt),onClick:jt=>{if(jt.stopPropagation(),ce.current){ce.current=!1;return}G(Fe=>Fe===k.id?null:k.id),xt(null)}}),A.jsx("rect",{x:It,y:kt,width:B,height:Nt,rx:4*le,ry:4*le,fill:"rgba(10,10,16,0.95)",stroke:k.color,strokeWidth:1.5*le,pointerEvents:"none"}),A.jsx("text",{x:N.x,y:N.y,textAnchor:"middle",dominantBaseline:"middle",fill:"#ffffff",style:{fontSize:`${F}px`,fontWeight:700,userSelect:"none",pointerEvents:"none"},children:nt}),z&&A.jsxs(A.Fragment,{children:[A.jsx("circle",{cx:_.x,cy:_.y,r:6*le,fill:k.color,stroke:"#fff",strokeWidth:1.5*le,style:{cursor:"grab"},onPointerDown:jt=>Tl(k.id,"start",jt),onMouseDown:jt=>Tl(k.id,"start",jt)}),A.jsx("circle",{cx:N.x,cy:N.y,r:6*le,fill:k.color,stroke:"#fff",strokeWidth:1.5*le,style:{cursor:"grab"},onPointerDown:jt=>Tl(k.id,"end",jt),onMouseDown:jt=>Tl(k.id,"end",jt)})]}),z&&A.jsx("foreignObject",{x:kn,y:bn,width:de,height:be,children:A.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:jt=>jt.stopPropagation(),onMouseDown:jt=>jt.stopPropagation(),onClick:jt=>jt.stopPropagation(),style:{width:de,height:be,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",padding:`${Yt}px ${Ht}px`,borderRadius:8*le,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)"},children:A.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:`${At}px`},children:Wa.map(jt=>A.jsx("button",{type:"button",title:`Колір ${jt}`,onClick:()=>Ia(k.id,jt),style:{width:Lt,height:Lt,borderRadius:"50%",border:k.color===jt?"2px solid #fff":"1px solid rgba(255,255,255,0.3)",background:jt,padding:0,cursor:"pointer",boxSizing:"border-box"}},`${k.id}-num-color-${jt}`))})})}),z&&A.jsx("foreignObject",{x:Mo,y:Co,width:Ce,height:Ce,children:A.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:jt=>jt.stopPropagation(),onMouseDown:jt=>jt.stopPropagation(),onClick:jt=>jt.stopPropagation(),children:A.jsx("button",{type:"button",title:"Видалити",onClick:()=>T(k.id),style:{width:Ce,height:Ce,borderRadius:"50%",border:"1px solid rgba(230,57,70,0.7)",background:"rgba(20, 20, 32, 0.95)",color:"#ff6b6b",cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0},children:A.jsx("i",{className:`${Xn} bi-trash`,style:{fontSize:12*le},"aria-hidden":!0})})})})]},k.id+"-numbering")}),J.filter(k=>k.id===w.id&&k.anchor.type==="polygon"&&k.anchor.points.length>=2).map(k=>{const _=k.anchor.points,N=1/Math.max(Er,1e-4),z=1.5*le*N,tt=ut===k.id,nt=pi(k),{minX:F,minY:W,maxX:ot,maxY:st}=ro[k.id],dt=ot-F,B=st-W,Nt=Xd({minX:F,minY:W,maxX:ot,maxY:st},X.w,X.h,N),It=[{cx:F,cy:W,handle:"nw"},{cx:F+dt/2,cy:W,handle:"n"},{cx:ot,cy:W,handle:"ne"},{cx:ot,cy:W+B/2,handle:"e"},{cx:ot,cy:st,handle:"se"},{cx:F+dt/2,cy:st,handle:"s"},{cx:F,cy:st,handle:"sw"},{cx:F,cy:W+B/2,handle:"w"}],kt=j2(It,_,N),Lt=At=>At==="n"||At==="s"?"ns-resize":At==="e"||At==="w"?"ew-resize":At==="nw"||At==="se"?"nwse-resize":"nesw-resize";return A.jsxs("g",{style:{cursor:"default"},children:[A.jsx("polygon",{points:_.map(At=>`${At.x},${At.y}`).join(" "),fill:Ky(k.color,k.fillStyle),stroke:k.color,strokeWidth:(tt?3:2.5)*le*nt,strokeDasharray:Gc(k)?fp(nt):void 0,style:tt?{cursor:"grab"}:void 0,onPointerDown:At=>{tt&&(At.stopPropagation(),Ts(k.id,At))},onMouseDown:At=>{tt&&(At.stopPropagation(),Ts(k.id,At))},onClick:At=>{if(At.stopPropagation(),ce.current){ce.current=!1;return}G(Ht=>Ht===k.id?null:k.id),xt(k.id)}}),tt&&_.map((At,Ht)=>A.jsx("circle",{cx:At.x,cy:At.y,r:8*le*N,fill:k.color,stroke:"white",strokeWidth:2*le*N,style:{cursor:"grab"},onPointerDown:Yt=>lu(k.id,Ht,Yt),onMouseDown:Yt=>lu(k.id,Ht,Yt),onDoubleClick:Yt=>Io(k.id,Ht,Yt)},`v-${Ht}`)),tt&&_.map((At,Ht)=>{const Yt=_.length,de=_[Ht],be=_[(Ht+1)%Yt],Me=(de.x+be.x)/2,Je=(de.y+be.y)/2;return A.jsx("circle",{cx:Me,cy:Je,r:6*le*N,fill:"white",stroke:k.color,strokeWidth:z,style:{cursor:"pointer"},onPointerDown:kn=>cu(k.id,Ht,kn),onMouseDown:kn=>cu(k.id,Ht,kn)},`m-${Ht}`)}),tt&&A.jsxs(A.Fragment,{children:[A.jsx("rect",{x:F,y:W,width:dt,height:B,fill:"none",stroke:k.color,strokeWidth:z,strokeDasharray:`${6*le*N} ${4*le*N}`,opacity:.8,style:{pointerEvents:"none"}}),kt.map(({cx:At,cy:Ht,handle:Yt})=>A.jsx("rect",{x:At-Bl*N,y:Ht-Bl*N,width:Bl*2*N,height:Bl*2*N,fill:"white",stroke:k.color,strokeWidth:z,style:{cursor:Lt(Yt)},onPointerDown:de=>uu(k.id,Yt,de),onMouseDown:de=>uu(k.id,Yt,de)},`bbox-${Yt}`))]}),tt&&A.jsx("g",{transform:`translate(${Nt.cx}, ${Nt.cy})`,style:{cursor:"move"},onPointerDown:At=>du(k.id,At),onMouseDown:At=>du(k.id,At),children:A.jsx(Gd,{color:k.color,scale:N})})]},k.id+"-poly")}),J.filter(k=>k.id===w.id&&k.anchor.type==="polyline"&&k.anchor.points.length>=2).map(k=>{const _=k.anchor.points,N=1/Math.max(Er,1e-4),z=1.5*le*N,tt=ut===k.id,nt=pi(k),{minX:F,minY:W,maxX:ot,maxY:st}=ro[k.id],dt=ot-F,B=st-W,Nt=Xd({minX:F,minY:W,maxX:ot,maxY:st},X.w,X.h,N),It=[{cx:F,cy:W,handle:"nw"},{cx:F+dt/2,cy:W,handle:"n"},{cx:ot,cy:W,handle:"ne"},{cx:ot,cy:W+B/2,handle:"e"},{cx:ot,cy:st,handle:"se"},{cx:F+dt/2,cy:st,handle:"s"},{cx:F,cy:st,handle:"sw"},{cx:F,cy:W+B/2,handle:"w"}],kt=j2(It,_,N),Lt=At=>At==="n"||At==="s"?"ns-resize":At==="e"||At==="w"?"ew-resize":At==="nw"||At==="se"?"nwse-resize":"nesw-resize";return A.jsxs("g",{style:{cursor:"default"},children:[A.jsx("polyline",{points:_.map(At=>`${At.x},${At.y}`).join(" "),fill:"none",stroke:k.color,strokeWidth:(tt?3:2.5)*le*nt,strokeDasharray:Gc(k)?fp(nt):void 0,style:tt?{cursor:"grab"}:void 0,onPointerDown:At=>{tt&&(At.stopPropagation(),il(k.id,At))},onMouseDown:At=>{tt&&(At.stopPropagation(),il(k.id,At))},onClick:At=>{if(At.stopPropagation(),ce.current){ce.current=!1;return}G(Ht=>Ht===k.id?null:k.id),xt(k.id)}}),tt&&_.map((At,Ht)=>A.jsx("circle",{cx:At.x,cy:At.y,r:8*le*N,fill:k.color,stroke:"white",strokeWidth:2*le*N,style:{cursor:"grab"},onPointerDown:Yt=>Ic(k.id,Ht,Yt),onMouseDown:Yt=>Ic(k.id,Ht,Yt),onDoubleClick:Yt=>ia(k.id,Ht,Yt)},`v-${Ht}`)),tt&&_.slice(0,-1).map((At,Ht)=>{const Yt=_[Ht],de=_[Ht+1],be=(Yt.x+de.x)/2,Me=(Yt.y+de.y)/2;return A.jsx("circle",{cx:be,cy:Me,r:6*le*N,fill:"white",stroke:k.color,strokeWidth:z,style:{cursor:"pointer"},onPointerDown:Je=>_s(k.id,Ht,Je),onMouseDown:Je=>_s(k.id,Ht,Je)},`m-${Ht}`)}),tt&&A.jsxs(A.Fragment,{children:[A.jsx("rect",{x:F,y:W,width:dt,height:B,fill:"none",stroke:k.color,strokeWidth:z,strokeDasharray:`${6*le*N} ${4*le*N}`,opacity:.8,style:{pointerEvents:"none"}}),kt.map(({cx:At,cy:Ht,handle:Yt})=>A.jsx("rect",{x:At-Bl*N,y:Ht-Bl*N,width:Bl*2*N,height:Bl*2*N,fill:"white",stroke:k.color,strokeWidth:z,style:{cursor:Lt(Yt)},onPointerDown:de=>qu(k.id,Yt,de),onMouseDown:de=>qu(k.id,Yt,de)},`bbox-${Yt}`))]}),tt&&A.jsx("g",{transform:`translate(${Nt.cx}, ${Nt.cy})`,style:{cursor:"move"},onPointerDown:At=>hu(k.id,At),onMouseDown:At=>hu(k.id,At),children:A.jsx(Gd,{color:k.color,scale:N})})]},k.id+"-polyline")}),J.filter(k=>k.id===w.id&&k.anchor.type==="arrow").map(k=>{const{start:_,end:N,control:z}=k.anchor,tt=1/Math.max(Er,1e-4),nt=ut===k.id,F=pi(k),W=[_,N,z],ot=Math.min(...W.map(Ce=>Ce.x)),st=Math.min(...W.map(Ce=>Ce.y)),dt=Math.max(...W.map(Ce=>Ce.x)),B=Math.max(...W.map(Ce=>Ce.y)),Nt=dt-ot,It=B-st,kt=Xd({minX:ot,minY:st,maxX:dt,maxY:B},X.w,X.h,tt),Lt=[{cx:ot,cy:st,handle:"nw"},{cx:ot+Nt/2,cy:st,handle:"n"},{cx:dt,cy:st,handle:"ne"},{cx:dt,cy:st+It/2,handle:"e"},{cx:dt,cy:B,handle:"se"},{cx:ot+Nt/2,cy:B,handle:"s"},{cx:ot,cy:B,handle:"sw"},{cx:ot,cy:st+It/2,handle:"w"}],At=j2(Lt,W,tt),Ht=Ce=>Ce==="n"||Ce==="s"?"ns-resize":Ce==="e"||Ce==="w"?"ew-resize":Ce==="nw"||Ce==="se"?"nwse-resize":"nesw-resize",Yt=Qk(z,N),de=Math.atan2(Yt.y,Yt.x),be=12*le*tt,Me=Math.PI/7,Je=N.x-Math.cos(de-Me)*be,kn=N.y-Math.sin(de-Me)*be,ye=N.x-Math.cos(de+Me)*be,bn=N.y-Math.sin(de+Me)*be;return A.jsxs("g",{style:{cursor:"default"},children:[A.jsx("path",{d:`M ${_.x} ${_.y} Q ${z.x} ${z.y} ${N.x} ${N.y}`,fill:"none",stroke:k.color,strokeWidth:(nt?3:2.5)*le*F,strokeDasharray:Gc(k)?fp(F):void 0,style:nt?{cursor:"grab"}:void 0,onPointerDown:Ce=>{nt&&Ds(k.id,Ce)},onMouseDown:Ce=>{nt&&Ds(k.id,Ce)},onClick:Ce=>{if(Ce.stopPropagation(),ce.current){ce.current=!1;return}G(Jn=>Jn===k.id?null:k.id),xt(k.id)}}),A.jsx("path",{d:`M ${N.x} ${N.y} L ${Je} ${kn} L ${ye} ${bn} Z`,fill:k.color,stroke:k.color,strokeWidth:(nt?3:2.5)*le*F,pointerEvents:"none"}),nt&&A.jsxs(A.Fragment,{children:[A.jsx("rect",{x:ot,y:st,width:Nt,height:It,fill:"none",stroke:k.color,strokeWidth:1.5*le*tt,strokeDasharray:`${6*le*tt} ${4*le*tt}`,opacity:.8,style:{pointerEvents:"none"}}),At.map(({cx:Ce,cy:Jn,handle:$r})=>A.jsx("rect",{x:Ce-Bl*tt,y:Jn-Bl*tt,width:Bl*2*tt,height:Bl*2*tt,fill:"white",stroke:k.color,strokeWidth:1.5*le*tt,style:{cursor:Ht($r)},onPointerDown:Yr=>ms(k.id,$r,Yr),onMouseDown:Yr=>ms(k.id,$r,Yr)},`arrow-bbox-${$r}`)),A.jsx("g",{transform:`translate(${kt.cx}, ${kt.cy})`,style:{cursor:"move"},onPointerDown:Ce=>zf(k.id,Ce),onMouseDown:Ce=>zf(k.id,Ce),children:A.jsx(Gd,{color:k.color,scale:tt})}),A.jsx("circle",{cx:_.x,cy:_.y,r:7*le*tt,fill:k.color,stroke:"#fff",strokeWidth:1.5*le*tt,style:{cursor:"grab"},onPointerDown:Ce=>ko(k.id,"start",Ce),onMouseDown:Ce=>ko(k.id,"start",Ce)}),A.jsx("circle",{cx:N.x,cy:N.y,r:7*le*tt,fill:k.color,stroke:"#fff",strokeWidth:1.5*le*tt,style:{cursor:"grab"},onPointerDown:Ce=>ko(k.id,"end",Ce),onMouseDown:Ce=>ko(k.id,"end",Ce)}),A.jsx("circle",{cx:z.x,cy:z.y,r:6*le*tt,fill:"#fff",stroke:k.color,strokeWidth:1.5*le*tt,style:{cursor:"grab"},onPointerDown:Ce=>ko(k.id,"control",Ce),onMouseDown:Ce=>ko(k.id,"control",Ce)})]})]},k.id+"-arrow")}),J.filter(k=>k.id===w.id&&k.anchor.type==="rectangle").map(k=>{const{x:_,y:N,width:z,height:tt,rotation:nt=0}=k.anchor,F=1/Math.max(Er,1e-4),W=ut===k.id,ot=pi(k),st=_+z/2,dt=N+tt/2,B=nt*Math.PI/180,Nt=Math.cos(B),It=Math.sin(B),kt=(Yt,de)=>({cx:st+Yt*Nt-de*It,cy:dt+Yt*It+de*Nt}),Lt=[{...kt(-z/2,-tt/2),handle:"nw"},{...kt(0,-tt/2),handle:"n"},{...kt(z/2,-tt/2),handle:"ne"},{...kt(z/2,0),handle:"e"},{...kt(z/2,tt/2),handle:"se"},{...kt(0,tt/2),handle:"s"},{...kt(-z/2,tt/2),handle:"sw"},{...kt(-z/2,0),handle:"w"}],At=Xd({minX:Math.min(...Lt.map(Yt=>Yt.cx)),minY:Math.min(...Lt.map(Yt=>Yt.cy)),maxX:Math.max(...Lt.map(Yt=>Yt.cx)),maxY:Math.max(...Lt.map(Yt=>Yt.cy))},X.w,X.h,F),Ht=Yt=>Yt==="n"||Yt==="s"?"ns-resize":Yt==="e"||Yt==="w"?"ew-resize":Yt==="nw"||Yt==="se"?"nwse-resize":"nesw-resize";return A.jsxs("g",{style:{cursor:"default"},children:[A.jsx("g",{transform:`rotate(${nt} ${st} ${dt})`,children:A.jsx("rect",{x:_,y:N,width:z,height:tt,fill:Ky(k.color,k.fillStyle),stroke:k.color,strokeWidth:(W?3:2.5)*le*ot,strokeDasharray:Gc(k)?fp(ot):void 0,style:W?{cursor:"grab"}:void 0,onPointerDown:Yt=>{W&&(Yt.stopPropagation(),Pc(k.id,Yt))},onMouseDown:Yt=>{W&&(Yt.stopPropagation(),Pc(k.id,Yt))},onClick:Yt=>{if(Yt.stopPropagation(),ce.current){ce.current=!1;return}G(de=>de===k.id?null:k.id),xt(k.id)}})}),W&&Lt.map(({cx:Yt,cy:de,handle:be})=>A.jsx("circle",{cx:Yt,cy:de,r:P2*F,fill:k.color,stroke:"white",strokeWidth:1.5*le*F,style:{cursor:Ht(be)},onPointerDown:Me=>rl(k.id,be,Me),onMouseDown:Me=>rl(k.id,be,Me)},be)),W&&A.jsx("g",{transform:`translate(${At.cx}, ${At.cy})`,style:{cursor:"move"},onPointerDown:Yt=>cc(k.id,Yt),onMouseDown:Yt=>cc(k.id,Yt),children:A.jsx(Gd,{color:k.color,scale:F})})]},k.id+"-rect")}),J.filter(k=>k.id===w.id&&k.anchor.type==="ellipse").map(k=>{const{cx:_,cy:N,rx:z,ry:tt,rotation:nt=0}=k.anchor,F=1/Math.max(Er,1e-4),W=ut===k.id,ot=pi(k),st=nt*Math.PI/180,dt=Math.cos(st),B=Math.sin(st),Nt=(At,Ht)=>({cx:_+At*dt-Ht*B,cy:N+At*B+Ht*dt}),It=[{...Nt(-z,-tt),handle:"nw"},{...Nt(0,-tt),handle:"n"},{...Nt(z,-tt),handle:"ne"},{...Nt(z,0),handle:"e"},{...Nt(z,tt),handle:"se"},{...Nt(0,tt),handle:"s"},{...Nt(-z,tt),handle:"sw"},{...Nt(-z,0),handle:"w"}],kt=Xd({minX:Math.min(...It.map(At=>At.cx)),minY:Math.min(...It.map(At=>At.cy)),maxX:Math.max(...It.map(At=>At.cx)),maxY:Math.max(...It.map(At=>At.cy))},X.w,X.h,F),Lt=At=>At==="n"||At==="s"?"ns-resize":At==="e"||At==="w"?"ew-resize":At==="nw"||At==="se"?"nwse-resize":"nesw-resize";return A.jsxs("g",{style:{cursor:"default"},children:[A.jsx("g",{transform:`rotate(${nt} ${_} ${N})`,children:A.jsx("ellipse",{cx:_,cy:N,rx:z,ry:tt,fill:Ky(k.color,k.fillStyle),stroke:k.color,strokeWidth:(W?3:2.5)*le*ot,strokeDasharray:Gc(k)?fp(ot):void 0,style:W?{cursor:"grab"}:void 0,onPointerDown:At=>{W&&(At.stopPropagation(),lc(k.id,At))},onMouseDown:At=>{W&&(At.stopPropagation(),lc(k.id,At))},onClick:At=>{if(At.stopPropagation(),ce.current){ce.current=!1;return}G(Ht=>Ht===k.id?null:k.id),xt(k.id)}})}),W&&It.map(({cx:At,cy:Ht,handle:Yt})=>A.jsx("circle",{cx:At,cy:Ht,r:P2*F,fill:k.color,stroke:"white",strokeWidth:1.5*le*F,style:{cursor:Lt(Yt)},onPointerDown:de=>jc(k.id,Yt,de),onMouseDown:de=>jc(k.id,Yt,de)},Yt)),W&&A.jsx("g",{transform:`translate(${kt.cx}, ${kt.cy})`,style:{cursor:"move"},onPointerDown:At=>fu(k.id,At),onMouseDown:At=>fu(k.id,At),children:A.jsx(Gd,{color:k.color,scale:F})})]},k.id+"-ellipse")}),J.filter(k=>k.id===w.id&&k.anchor.type==="text").map(k=>{const _=j===k.id||ut===k.id,N=ss===k.id,z=k.textColor??"#ffffff",tt=k.textBackgroundColor,nt=`${k.textUnderline?" underline":""}${k.textStrike?" line-through":""}`.trim(),F=k.textBold?700:400,W=k.textItalic?"italic":"normal",ot=k.textFontSize??Va,{x:st,y:dt,width:B,height:Nt}=k.anchor,It=1/Math.max(Er,1e-4),kt=pi(k);return A.jsxs("g",{children:[k.anchor.point&&A.jsx("circle",{cx:k.anchor.point.x,cy:k.anchor.point.y,r:hp*kt,fill:k.color,stroke:"white",strokeWidth:Ng*kt,style:{cursor:"grab"},onPointerDown:Lt=>Pa(k.id,Lt),onMouseDown:Lt=>Pa(k.id,Lt)}),A.jsx("foreignObject",{x:st,y:dt,width:B,height:Nt,onPointerDown:Lt=>Bf(k.id,Lt),children:A.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",ref:N?Lt=>{Za.current=Lt}:void 0,"data-text-pin-id":k.id,contentEditable:N,suppressContentEditableWarning:!0,onContextMenu:Lt=>Lt.preventDefault(),onPointerDown:Lt=>{if(!N){Bf(k.id,Lt);return}Lt.stopPropagation()},onDoubleClick:Lt=>{Lt.preventDefault(),Lt.stopPropagation(),G(k.id),xt(k.id),Ro(k.id)},onBlur:()=>{N&&(Ff(k.id),Ro(Lt=>Lt===k.id?null:Lt))},onInput:Lt=>{if(!N)return;const At=Lt.currentTarget,Ht=At.innerHTML,Yt=es(Ht,{fontSize:k.textFontSize??Va,bold:k.textBold??!1,italic:k.textItalic??!1}),de=At.closest("foreignObject");de&&(de.setAttribute("width",String(Yt.width)),de.setAttribute("height",String(Yt.height)))},style:{width:"100%",height:"auto",overflow:"hidden",whiteSpace:"pre",wordBreak:"normal",overflowWrap:"normal",color:z,background:tt??"transparent",border:_?`1px dashed ${k.color}`:"1px dashed transparent",borderRadius:CS,padding:`0 ${n5}px`,boxSizing:"border-box",fontFamily:Rn,fontSize:ot,lineHeight:1.4,fontWeight:F,fontStyle:W,textDecoration:nt||"none",outline:"none",cursor:N?"text":"move",userSelect:"text"},...N?{}:{dangerouslySetInnerHTML:{__html:gs(k.description)}}})}),_&&!N&&(()=>{const Lt=5*It;return[{cx:st,cy:dt,key:"nw",cursor:"nwse-resize"},{cx:st+B,cy:dt,key:"ne",cursor:"nesw-resize"},{cx:st+B,cy:dt+Nt,key:"se",cursor:"nwse-resize"},{cx:st,cy:dt+Nt,key:"sw",cursor:"nesw-resize"}].map(Ht=>A.jsx("circle",{cx:Ht.cx,cy:Ht.cy,r:Lt,fill:k.color,stroke:"#ffffff",strokeWidth:1.2*It,style:{cursor:Ht.cursor},onPointerDown:Yt=>lo(k.id,Ht.key,Yt),onMouseDown:Yt=>lo(k.id,Ht.key,Yt)},`${k.id}-text-resize-${Ht.key}`))})()]},`${k.id}-text`)}),J.filter(k=>k.id===w.id&&k.anchor.type==="redact").map(k=>{const{x:_,y:N,width:z,height:tt,mode:nt,strength:F}=k.anchor,W=j===k.id||ut===k.id,ot=1/Math.max(Er,1e-4),st=5*le*ot,dt=[{id:"nw",cx:_,cy:N,cursor:"nwse-resize"},{id:"ne",cx:_+z,cy:N,cursor:"nesw-resize"},{id:"se",cx:_+z,cy:N+tt,cursor:"nwse-resize"},{id:"sw",cx:_,cy:N+tt,cursor:"nesw-resize"}];return A.jsxs("g",{children:[A.jsx(eL,{x:_,y:N,width:z,height:tt,mode:nt,strength:F,source:zi??rc,imageSize:X}),A.jsx("rect",{x:_,y:N,width:z,height:tt,fill:"rgba(0,0,0,0.001)",style:{cursor:"grab"},onPointerDown:B=>zo(k.id,B),onMouseDown:B=>zo(k.id,B),onClick:B=>{if(B.stopPropagation(),ce.current){ce.current=!1;return}G(k.id),xt(k.id)}}),W&&A.jsxs(A.Fragment,{children:[A.jsx("rect",{x:_,y:N,width:z,height:tt,fill:"none",stroke:bc,strokeWidth:1.5*le*ot,strokeDasharray:`${5*le*ot} ${3*le*ot}`,pointerEvents:"none"}),dt.map(B=>A.jsx("circle",{cx:B.cx,cy:B.cy,r:st,fill:bc,stroke:"#fff",strokeWidth:1.2*le*ot,style:{cursor:B.cursor},onPointerDown:Nt=>mi(k.id,B.id,Nt),onMouseDown:Nt=>mi(k.id,B.id,Nt)},`${k.id}-redact-${B.id}`))]})]},`${k.id}-redact`)}),J.filter(k=>k.id===w.id&&k.anchor.type==="image").map(k=>{const{x:_,y:N,width:z,height:tt,src:nt}=k.anchor,F=j===k.id||ut===k.id,W=1/Math.max(Er,1e-4),ot=5*le*W,st=[{id:"nw",cx:_,cy:N,cursor:"nwse-resize"},{id:"ne",cx:_+z,cy:N,cursor:"nesw-resize"},{id:"se",cx:_+z,cy:N+tt,cursor:"nwse-resize"},{id:"sw",cx:_,cy:N+tt,cursor:"nesw-resize"}];return A.jsxs("g",{children:[A.jsx("image",{href:nt,x:_,y:N,width:z,height:tt,preserveAspectRatio:"xMidYMid meet",style:{cursor:"grab"},onPointerDown:dt=>ol(k.id,dt),onMouseDown:dt=>ol(k.id,dt),onClick:dt=>{if(dt.stopPropagation(),ce.current){ce.current=!1;return}G(k.id),xt(k.id)}}),F&&A.jsxs(A.Fragment,{children:[A.jsx("rect",{x:_,y:N,width:z,height:tt,fill:"none",stroke:bc,strokeWidth:1.5*le*W,strokeDasharray:`${5*le*W} ${3*le*W}`,pointerEvents:"none"}),st.map(dt=>A.jsx("circle",{cx:dt.cx,cy:dt.cy,r:ot,fill:bc,stroke:"#fff",strokeWidth:1.2*le*W,style:{cursor:dt.cursor},onPointerDown:B=>$u(k.id,dt.id,B),onMouseDown:B=>$u(k.id,dt.id,B)},`${k.id}-img-${dt.id}`))]})]},`${k.id}-image`)}),J.filter(k=>k.id===w.id&&k.anchor.type==="compass").map(k=>{const{cx:_,cy:N,radius:z,rotation:tt=0}=k.anchor,nt=1/Math.max(Er,1e-4),F=ut===k.id,W=pi(k),ot=tt*Math.PI/180,st=Math.cos(ot),dt=Math.sin(ot),B=(Se,ze)=>({cx:_+Se*st-ze*dt,cy:N+Se*dt+ze*st}),Nt=[{...B(0,-z),handle:"n"},{...B(z,0),handle:"e"},{...B(0,z),handle:"s"},{...B(-z,0),handle:"w"}],It=rb(z),kt=Se=>Se==="n"||Se==="s"?"ns-resize":"ew-resize",Lt=14*le,At=4*le,Ht=7*le,Yt=6*le,de=Ht*2+Lt*Wa.length+At*Math.max(0,Wa.length-1),be=Yt*2+Lt,Me=10*le,Je=_-de/2,kn=Math.max(0,Math.min(Je,X.w-de)),bn=N<X.h/2?N+z+Me:N-z-Me-be,Ce=Math.max(0,Math.min(bn,X.h-be)),Jn=24*le,$r=6*le,Yr=kn+de+$r,Mo=kn-Jn-$r,Co=Yr+Jn<=X.w?Yr:Mo>=0?Mo:Math.max(0,Math.min(Yr,X.w-Jn)),jt=Math.max(0,Math.min(Ce+be/2-Jn/2,X.h-Jn)),Fe=Xd({minX:_-z,minY:N-z,maxX:_+z,maxY:N+z},X.w,X.h,nt,[{x:kn,y:Ce,w:de,h:be},{x:Co,y:jt,w:Jn,h:Jn}]);return A.jsxs("g",{style:{cursor:"default"},children:[A.jsxs("g",{transform:`rotate(${tt} ${_} ${N})`,children:[A.jsx("circle",{cx:_,cy:N,r:z,fill:"transparent",stroke:"none",style:F?{cursor:"grab"}:void 0,onPointerDown:Se=>{F&&(Se.stopPropagation(),Ns(k.id,Se))},onMouseDown:Se=>{F&&(Se.stopPropagation(),Ns(k.id,Se))},onClick:Se=>{if(Se.stopPropagation(),ce.current){ce.current=!1;return}G(ze=>ze===k.id?null:k.id),xt(k.id)}}),A.jsx("path",{d:TD(_,N,z),fill:"none",stroke:k.color,strokeWidth:(F?Lg*1.35:Lg)*W,strokeLinecap:"round",pointerEvents:"none"}),A.jsx("polygon",{points:It.arrowPoints.map(Se=>`${_+Se.x},${N+Se.y}`).join(" "),fill:k.color,pointerEvents:"none"}),A.jsx("text",{x:_,y:N+It.letterY,textAnchor:"middle",dominantBaseline:"middle",fill:k.color,style:{fontSize:`${It.fontSize}px`,fontWeight:700,userSelect:"none",pointerEvents:"none"},children:"N"})]}),F&&Nt.map(({cx:Se,cy:ze,handle:qe})=>A.jsx("circle",{cx:Se,cy:ze,r:P2*nt,fill:k.color,stroke:"white",strokeWidth:1.5*le*nt,style:{cursor:kt(qe)},onPointerDown:pn=>uc(k.id,qe,pn),onMouseDown:pn=>uc(k.id,qe,pn)},qe)),F&&A.jsx("g",{transform:`translate(${Fe.cx}, ${Fe.cy})`,style:{cursor:"move"},onPointerDown:Se=>Nl(k.id,Se),onMouseDown:Se=>Nl(k.id,Se),children:A.jsx(Gd,{color:k.color,scale:nt})}),F&&A.jsx("foreignObject",{x:kn,y:Ce,width:de,height:be,children:A.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:Se=>Se.stopPropagation(),onMouseDown:Se=>Se.stopPropagation(),onClick:Se=>Se.stopPropagation(),style:{width:de,height:be,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",padding:`${Yt}px ${Ht}px`,borderRadius:8*le,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)"},children:A.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:`${At}px`},children:Wa.map(Se=>A.jsx("button",{type:"button",title:`Колір ${Se}`,onClick:()=>Ia(k.id,Se),style:{width:Lt,height:Lt,borderRadius:"50%",border:k.color===Se?"2px solid #fff":"1px solid rgba(255,255,255,0.3)",background:Se,padding:0,cursor:"pointer",boxSizing:"border-box"}},`${k.id}-compass-color-${Se}`))})})}),F&&A.jsx("foreignObject",{x:Co,y:jt,width:Jn,height:Jn,children:A.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:Se=>Se.stopPropagation(),onMouseDown:Se=>Se.stopPropagation(),onClick:Se=>Se.stopPropagation(),children:A.jsx("button",{type:"button",title:"Видалити",onClick:()=>T(k.id),style:{width:Jn,height:Jn,borderRadius:"50%",border:"1px solid rgba(230,57,70,0.7)",background:"rgba(20, 20, 32, 0.95)",color:"#ff6b6b",cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0},children:A.jsx("i",{className:`${Xn} bi-trash`,style:{fontSize:12*le},"aria-hidden":!0})})})})]},k.id+"-compass")}),[w].map(k=>{if(k.anchor.type==="text"||k.anchor.type==="redact"||k.calloutHidden)return null;const _=Bt[k.id];if(!_)return null;const N=k.anchor.type==="standalone"?null:Zm(k,J),z=N?_g(N,_,k.leaderPoints):void 0;return A.jsx(p9,{pin:k,leaderPath:z,fontFamily:Rn,justCreated:_i.current===k.id,position:_,imageSize:X,active:ut===k.id,isSelected:ut===k.id||j===k.id,onUpdateDescription:Bc,onUpdateImage:Uf,onApplyMedia:Pi,onClearImage:tt=>{Jt(),ct(nt=>nt.map(F=>F.id===tt?{...F,image:null,imageAspect:null}:F))},onDragStart:Es,onResizeStart:ac,onActivate:tt=>{G(tt),xt(tt)},onUpdateColor:Ia,onUpdateStrokeStyle:Fc,onUpdateFillStyle:Uc,strokeWidthScale:pi(k),onUpdateStrokeWidthScale:Hc,onContextMenu:Vn,controlsLayer:zr,controlsCollapsed:Hs,onToggleControlsCollapsed:Ja,onToggleDescPos:v,onToggleTheme:tt=>{Jt(),ct(nt=>nt.map(F=>F.id===tt?{...F,theme:F.theme==="light"?"dark":"light"}:F))},onHide:tt=>H(tt,!0),onAddLinked:yn(k)?R:void 0,onDelete:T,onUpdateTextStyle:(tt,nt)=>{Jt(),ct(F=>F.map(W=>W.id===tt?{...W,textBold:nt.bold??W.textBold??!1,textItalic:nt.italic??W.textItalic??!1,textUnderline:nt.underline??W.textUnderline??!1,textStrike:nt.strike??W.textStrike??!1}:W))},onUpdateTextFontSize:(tt,nt)=>{Jt(),ct(F=>F.map(W=>{if(W.id!==tt)return W;let st=(W.textFontSize??Va)+nt;return st=Math.max(MS,st),{...W,textFontSize:st}}))}},k.id+"-card")})]},w.id+"-z")),J.filter(w=>w.anchor.type==="text"&&(j===w.id||ut===w.id)).map(w=>{const k=Ni.w,_=Ni.h,N=4*sn,z=Math.max(0,Math.min(w.anchor.x,X.w-k)),tt=w.anchor.y+w.anchor.height/2,nt=X.h/2,W=tt<nt?w.anchor.y+w.anchor.height+N:w.anchor.y-_-N,ot=Math.max(0,Math.min(W,X.h-_)),st=yo===w.id,dt=ot,B=_,Nt=32*sn,It=6*sn,kt=z+k+It,Lt=z-Nt-It,At=kt+Nt<=X.w?kt:Lt>=0?Lt:Math.max(0,Math.min(kt,X.w-Nt)),Ht=168*sn,Yt=132*sn,de=Math.max(0,Math.min(z+k-Ht,X.w-Ht)),be=Math.max(0,ot-Yt-6*sn),Me=ye=>{Jt(),ct(bn=>bn.map(Ce=>Ce.id===w.id?{...Ce,textColor:ye}:Ce))},Je=ye=>{Jt(),ct(bn=>bn.map(Ce=>Ce.id===w.id?{...Ce,textBackgroundColor:ye}:Ce)),bl(null)},kn=ye=>{Jt(),ct(bn=>bn.map(Ce=>{if(Ce.id!==w.id||Ce.anchor.type!=="text")return Ce;const Jn={...Ce,...ye},$r=Ce.anchor,Yr=es(Jn.description||"",{fontSize:Jn.textFontSize??Va,bold:Jn.textBold??!1,italic:Jn.textItalic??!1}),Mo=Math.max(0,X.w-Yr.width),Co=Math.max(0,X.h-Yr.height);return{...Jn,anchor:{...$r,width:Yr.width,height:Yr.height,x:Math.max(0,Math.min($r.x,Mo)),y:Math.max(0,Math.min($r.y,Co))}}}))};return A.jsxs("g",{children:[A.jsx("foreignObject",{x:z,y:dt,width:k,height:B,children:A.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:ye=>ye.stopPropagation(),onMouseDown:ye=>ye.stopPropagation(),style:{width:"100%",height:_,boxSizing:"border-box",display:"flex",alignItems:"flex-start"},children:A.jsxs("div",{ref:Tc,style:{width:"max-content",minWidth:300*sn,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)",borderRadius:10*sn,padding:`${8*sn}px ${10*sn}px`,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7*sn},children:[w.anchor.point&&(()=>{const ye=pi(w),bn=(ye-ml)/(Bu-ml)*100;return A.jsxs(A.Fragment,{children:[A.jsxs("div",{style:{display:"flex",gap:O2,alignItems:"center",justifyContent:"center",flexWrap:"nowrap",flexShrink:0},children:[A.jsx("i",{className:`${Xn} bi-record-circle`,style:t4,"aria-hidden":!0}),Wa.map(Ce=>A.jsx("button",{type:"button",title:`Колір точки ${Ce}`,onClick:()=>Ia(w.id,Ce),style:{width:Sg,height:Sg,borderRadius:"50%",background:Ce,border:w.color===Ce?"2px solid #fff":"1px solid rgba(255,255,255,0.25)",cursor:"pointer",padding:0,boxSizing:"border-box",flexShrink:0}},`${w.id}-pointc-${Ce}`))]}),A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:O2},children:[A.jsx("input",{type:"range",className:"tyts-range",min:ml,max:Bu,step:K0,value:ye,"aria-label":"Розмір точки",title:"Розмір точки",onChange:Ce=>Hc(w.id,Number(Ce.target.value)),style:{flex:1,minWidth:0,"--tyts-range-accent":w.color,"--tyts-range-fill":`${bn}%`}}),A.jsxs("span",{style:{color:"#aaa",fontSize:11*sn,minWidth:30*sn,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:["×",J0(ye)]})]})]})})(),A.jsxs("div",{style:{display:"flex",gap:O2,alignItems:"center",justifyContent:"center",flexWrap:"nowrap",flexShrink:0},children:[A.jsx("i",{className:`${Xn} bi-type`,style:t4,"aria-hidden":!0}),Wa.map(ye=>A.jsx("button",{type:"button",onClick:()=>Me(ye),style:{width:Sg,height:Sg,borderRadius:"50%",border:w.textColor===ye?"2px solid #fff":"1px solid rgba(255,255,255,0.25)",background:ye,padding:0,cursor:"pointer",boxSizing:"border-box"}},`${w.id}-tc-${ye}`))]}),A.jsxs("div",{style:{display:"flex",gap:4*sn,alignItems:"center",justifyContent:"space-between",position:"relative",flexWrap:"nowrap"},children:[A.jsx("button",{type:"button",style:{...dp,fontWeight:700},onClick:()=>{pu(w.id,"bold")||kn({textBold:!(w.textBold??!1)})},children:"B"}),A.jsx("button",{type:"button",style:{...dp,fontStyle:"italic"},onClick:()=>{pu(w.id,"italic")||kn({textItalic:!(w.textItalic??!1)})},children:"I"}),A.jsx("button",{type:"button",style:{...dp,textDecoration:"underline"},onClick:()=>{pu(w.id,"underline")||kn({textUnderline:!(w.textUnderline??!1)})},children:"U"}),A.jsx("button",{type:"button",style:{...dp,textDecoration:"line-through"},onClick:()=>{pu(w.id,"strikeThrough")||kn({textStrike:!(w.textStrike??!1)})},children:"S"}),A.jsxs("div",{style:zA,role:"group","aria-label":"Розмір шрифту",children:[A.jsx("button",{type:"button",style:r0,title:"Менший шрифт","aria-label":"Менший шрифт",onClick:()=>sl(w.id,-2),children:"−"}),A.jsx("span",{style:BA,"aria-live":"polite",children:w.textFontSize??Va}),A.jsx("button",{type:"button",style:r0,title:"Більший шрифт","aria-label":"Більший шрифт",onClick:()=>sl(w.id,2),children:"+"})]}),A.jsx("div",{"data-text-bg-picker":"true",style:{position:"relative"},children:A.jsxs("button",{type:"button",onClick:()=>bl(ye=>ye===w.id?null:w.id),style:{...dp,minWidth:42*sn,justifyContent:"space-between",gap:6*sn,padding:`0 ${7*sn}px`,color:"#e8e8e8"},title:"Колір фону тексту",children:[A.jsx("span",{style:{width:18*sn,height:18*sn,borderRadius:3*sn,border:"1px solid rgba(255,255,255,0.35)",background:w.textBackgroundColor??"transparent",boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center",color:w.textBackgroundColor?"#111":"#f0f0f0",fontSize:10*sn,fontWeight:700},children:"A"}),A.jsx("i",{className:`${Xn} bi-chevron-down`,style:{fontSize:11*sn},"aria-hidden":!0})]})})]})]})})},`${w.id}-text-tools`),st&&A.jsx("foreignObject",{x:de,y:be,width:Ht,height:Yt,style:{overflow:"visible"},children:A.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml","data-text-bg-picker":"true",onPointerDown:ye=>ye.stopPropagation(),onMouseDown:ye=>ye.stopPropagation(),style:{width:"100%",background:"rgba(18, 20, 30, 0.98)",border:"1px solid rgba(255,255,255,0.18)",borderRadius:8*sn,padding:8*sn,boxSizing:"border-box",display:"grid",gridTemplateColumns:`repeat(4, ${30*sn}px)`,gap:6*sn},children:[A.jsx("button",{type:"button",onClick:()=>Je(null),style:{gridColumn:"1 / -1",height:24*sn,borderRadius:5*sn,border:"1px solid rgba(255,255,255,0.22)",background:"rgba(255,255,255,0.06)",color:"#ddd",cursor:"pointer",fontSize:12*sn},children:"Без фону"}),Wa.map(ye=>A.jsx("button",{type:"button",onClick:()=>Je(ye),style:{width:30*sn,height:24*sn,borderRadius:5*sn,border:w.textBackgroundColor===ye?"2px solid #fff":"1px solid rgba(255,255,255,0.3)",background:ye,cursor:"pointer",boxSizing:"border-box"},title:ye},`${w.id}-bg-${ye}`))]})},`${w.id}-text-bg-picker`),A.jsx("foreignObject",{x:At,y:Math.max(0,Math.min(ot+_/2-Nt/2,X.h-Nt)),width:Nt,height:Nt,children:A.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:ye=>ye.stopPropagation(),onMouseDown:ye=>ye.stopPropagation(),children:A.jsx("button",{type:"button",title:"Видалити",onClick:()=>T(w.id),style:{width:Nt,height:Nt,background:"rgba(20, 20, 32, 0.95)",border:"1px solid rgba(230,57,70,0.7)",color:"#ff6b6b",cursor:"pointer",borderRadius:"50%",fontSize:16*sn,padding:`${3*sn}px`,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:A.jsx("i",{className:`${Xn} bi-trash`,style:{fontSize:Zn},"aria-hidden":!0})})})},`${w.id}-text-tools-delete`)]},`${w.id}-text-tools-wrap`)}),J.map(w=>{if(w.anchor.type==="text"||w.anchor.type==="standalone"||w.anchor.type==="redact"||w.calloutHidden||ut!==w.id&&j!==w.id)return null;const k=Bt[w.id];if(!k)return null;const _=Zm(w,J);if(!_)return null;const N=Array.isArray(w.leaderPoints)?w.leaderPoints:[],z=_g(_,k,N),tt=1/Math.max(Er,1e-4),nt=5*le*tt,F=3.5*le*tt;return A.jsxs("g",{children:[mD(z).map((W,ot)=>A.jsx("circle",{cx:W.x,cy:W.y,r:F,fill:"rgba(255,255,255,0.8)",stroke:w.color,strokeWidth:1.2*le*tt,style:{cursor:"crosshair"},onPointerDown:st=>wo(w.id,ot,W,st),onMouseDown:st=>wo(w.id,ot,W,st),children:A.jsx("title",{children:"Потягніть, щоб зламати лінію"})},`${w.id}-leader-mid-${ot}`)),N.map((W,ot)=>A.jsx("circle",{cx:W.x,cy:W.y,r:nt,fill:w.color,stroke:"#fff",strokeWidth:1.5*le*tt,style:{cursor:"grab"},onPointerDown:st=>Oc(w.id,ot,st),onMouseDown:st=>Oc(w.id,ot,st),onDoubleClick:st=>So(w.id,ot,st),children:A.jsx("title",{children:"Подвійний клік — прибрати злам"})},`${w.id}-leader-pt-${ot}`))]},w.id+"-leader-handles")}),J.filter(w=>w.anchor.type==="redact"&&(j===w.id||ut===w.id)).map(w=>{const{x:k,y:_,width:N,height:z,mode:tt,strength:nt}=w.anchor,F=250*sn,W=8*sn,ot=24*sn,st=7*sn,dt=12*sn,B=W*2+ot+(tt==="fill"?0:st+dt),Nt=8*sn,It=Math.max(0,Math.min(k+N/2-F/2,X.w-F)),kt=_<X.h/2,Lt=Math.max(0,Math.min(kt?_+z+Nt:_-Nt-B,X.h-B)),At=32*sn,Ht=6*sn,Yt=It+F+Ht,de=It-At-Ht,be=Yt+At<=X.w?Yt:de>=0?de:Math.max(0,Math.min(Yt,X.w-At)),Me=Math.max(0,Math.min(Lt+B/2-At/2,X.h-At)),Je=[{id:"blur",label:"Розмити",icon:"bi-droplet-half"},{id:"pixelate",label:"Пікселі",icon:"bi-grid-3x3"},{id:"fill",label:"Заливка",icon:"bi-square-fill"}],kn=nt*100;return A.jsxs("g",{children:[A.jsx("foreignObject",{x:It,y:Lt,width:F,height:B,children:A.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:ye=>ye.stopPropagation(),onMouseDown:ye=>ye.stopPropagation(),onClick:ye=>ye.stopPropagation(),style:{width:F,height:B,boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"center",gap:st,padding:`${W}px ${10*sn}px`,background:"rgba(12, 15, 24, 0.96)",border:"1px solid rgba(255,255,255,0.16)",borderRadius:10*sn,fontFamily:Rn},children:[A.jsx("div",{style:{display:"flex",gap:6*sn},children:Je.map(ye=>A.jsxs("button",{type:"button",title:ye.label,onClick:()=>oa(w.id,{mode:ye.id}),style:{flex:1,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4*sn,height:24*sn,borderRadius:6*sn,cursor:"pointer",fontFamily:"inherit",fontSize:11*sn,background:tt===ye.id?"rgba(255,255,255,0.14)":"rgba(255,255,255,0.06)",border:`1px solid ${tt===ye.id?bc:"rgba(255,255,255,0.18)"}`,color:tt===ye.id?"#fff":"#bbb"},children:[A.jsx("i",{className:`${Xn} ${ye.icon}`,style:{fontSize:11*sn},"aria-hidden":!0}),ye.label]},ye.id))}),tt!=="fill"&&A.jsx("input",{type:"range",className:"tyts-range",min:0,max:1,step:x8,value:nt,"aria-label":"Сила ефекту",title:"Сила ефекту",onChange:ye=>oa(w.id,{strength:Number(ye.target.value)}),style:{width:"100%",height:dt,minWidth:0,"--tyts-range-accent":bc,"--tyts-range-thumb":`${dt}px`,"--tyts-range-track":`${4*sn}px`,"--tyts-range-fill":`${kn}%`}})]})}),A.jsx("foreignObject",{x:be,y:Me,width:At,height:At,children:A.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",onPointerDown:ye=>ye.stopPropagation(),onMouseDown:ye=>ye.stopPropagation(),onClick:ye=>ye.stopPropagation(),children:A.jsx("button",{type:"button",title:"Видалити ділянку","aria-label":"Видалити ділянку",onClick:()=>T(w.id),style:{width:At,height:At,borderRadius:"50%",border:"1px solid rgba(230,57,70,0.7)",background:"rgba(20, 20, 32, 0.95)",color:"#ff6b6b",cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:`${3*sn}px`},children:A.jsx("i",{className:`${Xn} bi-trash`,style:{fontSize:Math.round(12*sn)},"aria-hidden":!0})})})})]},`${w.id}-redact-panel`)}),en&&X.w>0&&X.h>0&&(()=>{const w=Zy(J,ut??j),k=w&&w.anchor.type==="image"?{src:w.anchor.src,aspect:w.anchor.aspect}:Xt.logo;if(!k)return null;const _=ws??Xt.settings.corner,N=sg(Xt.settings,_,k.aspect,X.w,X.h,uf),z=_==="nw"||_==="sw",tt=_==="nw"||_==="ne",nt=z?{x1:0,x2:N.x}:{x1:N.x+N.width,x2:X.w},F=tt?{y1:0,y2:N.y}:{y1:N.y+N.height,y2:X.h},W=N.x+N.width/2,ot=N.y+N.height/2,st={stroke:"#F2D727",strokeWidth:1.25*le,strokeDasharray:`${3*le} ${3*le}`};return A.jsxs("g",{pointerEvents:"none","data-stamp-preview":"true",children:[A.jsx("image",{href:k.src,x:N.x,y:N.y,width:N.width,height:N.height,opacity:.85,preserveAspectRatio:"xMidYMid meet"}),A.jsx("rect",{x:N.x,y:N.y,width:N.width,height:N.height,fill:"none",stroke:"#F2D727",strokeWidth:1.5*le,strokeDasharray:`${6*le} ${4*le}`}),nt.x2-nt.x1>.5&&A.jsx("line",{x1:nt.x1,x2:nt.x2,y1:ot,y2:ot,...st}),F.y2-F.y1>.5&&A.jsx("line",{x1:W,x2:W,y1:F.y1,y2:F.y2,...st})]})})(),A.jsx("g",{ref:dr}),J.filter(w=>w.anchor.type==="arrow"&&!!w.calloutHidden&&(j===w.id||ut===w.id)).map(w=>{const k=[w.anchor.start,w.anchor.end,w.anchor.control];return A.jsx(m9,{pin:w,bbox:{minX:Math.min(...k.map(_=>_.x)),minY:Math.min(...k.map(_=>_.y)),maxX:Math.max(...k.map(_=>_.x)),maxY:Math.max(...k.map(_=>_.y))},imageSize:X,strokeWidthScale:pi(w),fontFamily:Rn,controlsLayer:zr,controlsCollapsed:Hs,onToggleControlsCollapsed:Ja,onUpdateColor:Ia,onUpdateStrokeStyle:Fc,onUpdateFillStyle:Uc,onUpdateStrokeWidthScale:Hc,onShowCallout:_=>H(_,!1),onDelete:T},`${w.id}-shape-controls`)}),J.filter(w=>w.calloutHidden&&w.anchor.type!=="numbering"&&w.anchor.type!=="compass"&&w.anchor.type!=="redact"&&w.anchor.type!=="arrow").filter(w=>w.anchor.type==="standalone"||w.anchor.type==="linked"||j===w.id||ut===w.id).map(w=>{const k=Ai(w);return A.jsxs("g",{transform:`translate(${k.x}, ${k.y})`,style:{cursor:"pointer"},onMouseDown:_=>_.stopPropagation(),onClick:_=>{_.stopPropagation(),H(w.id,!1)},children:[A.jsx("circle",{cx:0,cy:0,r:11*le,fill:"rgba(20,20,32,0.95)",stroke:w.color,strokeWidth:2*le}),A.jsx("text",{x:0,y:1*le,textAnchor:"middle",dominantBaseline:"middle",fill:w.color,style:{fontSize:`${14*le}px`,fontWeight:700,userSelect:"none"},children:"+"})]},`${w.id}-restore-callout`)})]})})})})}):A.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16},children:[A.jsx(KF,{onFile:ai,highlight:nc,warning:L}),cn.showRestorePrompt&&cn.storedDraftSavedAt&&A.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",justifyContent:"center",gap:10,maxWidth:440,padding:"10px 14px",borderRadius:8,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.04)",color:"#888",fontSize:13,lineHeight:1.5},children:[A.jsxs("span",{children:["Знайдено збережену чернетку від"," ",Zd(new Date(cn.storedDraftSavedAt))]}),A.jsx("button",{type:"button",onClick:()=>cn.restoreDraft(),style:{border:"1px solid rgba(255,255,255,0.12)",borderRadius:5,background:"rgba(255,255,255,0.08)",color:"#ccc",fontWeight:600,fontSize:13,padding:"5px 12px",cursor:"pointer"},children:"Відновити"}),A.jsx("button",{type:"button",onClick:()=>cn.clearDraft(),style:{border:"1px solid rgba(255,255,255,0.08)",borderRadius:5,background:"transparent",color:"#777",fontWeight:600,fontSize:13,padding:"5px 12px",cursor:"pointer"},children:"Відкинути"})]})]})}),Ma&&A.jsx(eF,{items:Ca.items,onAddImageFiles:w=>{Ca.addImageFiles(w)},onAddText:Ca.addText,onUpdateText:Ca.updateText,onRemove:Ca.remove,onClose:()=>Mc(!1)})]}),A.jsxs("div",{style:{padding:"3px 16px",background:"#0a0a14",borderTop:"1px solid #1a1a28",fontSize:10,color:"#444",display:"flex",gap:16,flexShrink:0,alignItems:"center",minWidth:0,position:"relative"},children:[A.jsxs("div",{style:{...DF,flex:1},children:[A.jsxs("span",{title:`полотно: ${X.w} × ${X.h}px`,children:["полотно: ",X.w," × ",X.h,"px"]}),Tt&&A.jsxs("span",{title:`оригінал: ${Tt.w} × ${Tt.h}px`,style:{marginLeft:16},children:["оригінал: ",Tt.w," × ",Tt.h,"px"]}),j&&(()=>{const w=Bt[j];if(!w)return null;const k=`картка: ${Math.round(w.width)} × ${Math.round(w.height)}px`;return A.jsx("span",{title:k,style:{marginLeft:16},children:k})})(),Mn&&A.jsxs("span",{title:Mn,style:{color:$n,display:"inline-flex",alignItems:"center",gap:5,marginLeft:16,verticalAlign:"bottom"},children:[A.jsx("i",{className:`${Xn} ${cn.status==="error"?"bi-exclamation-triangle":cn.status==="saving"?"bi-cloud-arrow-up tyts-spin":"bi-cloud-check"}`,style:{fontSize:11,flexShrink:0},"aria-hidden":!0}),A.jsx("span",{children:Mn})]})]}),A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:10,flexShrink:0},children:[!p,A.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),Go(!0),Wl(!1)},style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.55)",fontFamily:"inherit",fontSize:10,cursor:"pointer",padding:0},title:"Налаштування",children:"Налаштування"}),A.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),Wl(k=>!k),Go(!1)},style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.55)",fontFamily:"inherit",fontSize:10,cursor:"pointer",padding:0},title:"Показати список гарячих клавіш",children:"Гарячі клавіші"}),!p,A.jsxs("span",{children:["v",o8]})]}),Ti&&A.jsxs("div",{onClick:w=>w.stopPropagation(),style:{position:"absolute",right:12,bottom:"100%",marginBottom:8,width:600,fontSize:12,maxWidth:"calc(100vw - 24px)",background:"rgba(10,10,16,0.97)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:10,boxShadow:"0 10px 28px rgba(0,0,0,0.65)",padding:12,color:"#ddd",zIndex:2e3},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:[A.jsx("div",{style:{fontWeight:800,color:"#fff"},children:"Гарячі клавіші"}),A.jsx("button",{type:"button",onClick:()=>Wl(!1),style:{background:"transparent",border:"none",color:"rgba(255,255,255,0.65)",cursor:"pointer",fontSize:16,lineHeight:1},title:"Закрити",children:"×"})]}),A.jsxs("div",{style:{display:"flex",gap:16,fontSize:12},children:[A.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:4},children:[ne.newImage,ne.replaceBackground,ne.toolPoint,ne.toolRegion,ne.toolRoute,ne.toolRectangle,ne.toolEllipse,ne.toolArrow,ne.toolText,ne.toolPointText,ne.toolImageObject,ne.toolRedact,ne.toolDateTime,ne.toolStandaloneCallout,ne.toolNumbering,ne.toolCompass,ne.toolStamp,ne.toolCrop,ne.zoomIn,ne.zoomOut,ne.fitToWindow,ne.undo,ne.redo,ne.downloadJpg,ne.openExportMenu,ne.exportMenuChooseByNumber].map(w=>A.jsx(i4,{shortcut:w,isMac:b},w.id))}),A.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:4},children:[ne.calloutBold,ne.calloutItalic,ne.calloutUnderline,ne.calloutStrike,ne.calloutFontSizeDown,ne.calloutFontSizeUp,ne.calloutAddText,ne.calloutAddImage,ne.calloutRemoveText,ne.calloutRemoveImage,ne.calloutToggleDescPos,ne.calloutToggleTheme,ne.calloutDelete,ne.calloutTogglePanel,ne.calloutBringForward,ne.calloutSendBackward,ne.calloutBringToFront,ne.calloutSendToBack,ne.objectCopy,ne.objectDuplicate,ne.objectPaste].map(w=>A.jsx(i4,{shortcut:w,isMac:b},w.id))})]}),A.jsx("div",{style:{marginTop:10,paddingTop:10,borderTop:"1px solid rgba(255,255,255,0.08)"},children:A.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer",fontSize:12,color:"rgba(255,255,255,0.8)"},children:[A.jsx("input",{type:"checkbox",checked:Ar,onChange:w=>Aa(w.target.checked)}),"Показувати бейджі хоткеїв на кнопках"]})})]})]}),ir&&(()=>{const w=ir.pinId,k=[{move:"front",label:"На передній план",shortcut:"calloutBringToFront"},{move:"up",label:"На рівень вище",shortcut:"calloutBringForward"},{move:"down",label:"На рівень нижче",shortcut:"calloutSendBackward"},{move:"back",label:"На задній план",shortcut:"calloutSendToBack"}],_=[...w?[{key:"copy",label:"Копіювати",shortcut:"objectCopy",enabled:!0,run:()=>fr(w)},{key:"duplicate",label:"Дублювати",shortcut:"objectDuplicate",enabled:!0,run:()=>yr(w)}]:[],{key:"paste",label:"Вставити сюди",shortcut:"objectPaste",enabled:Bo,run:()=>Ii(ir.at)}],N=_.length+(w?k.length:0),z=230,tt=8+N*30+(w?9:0),nt=Math.max(8,Math.min(ir.x,window.innerWidth-z-8)),F=Math.max(8,Math.min(ir.y,window.innerHeight-tt-8));return A.jsxs("div",{role:"menu",onPointerDown:W=>W.stopPropagation(),onContextMenu:W=>W.preventDefault(),style:{position:"fixed",left:nt,top:F,zIndex:6e3,width:z,padding:4,borderRadius:8,background:"rgba(20,20,32,0.98)",border:"1px solid rgba(255,255,255,0.14)",boxShadow:"0 12px 32px rgba(0,0,0,0.6)",fontFamily:Rn,fontSize:13},children:[_.map(({key:W,label:ot,shortcut:st,enabled:dt,run:B})=>A.jsxs("button",{type:"button",role:"menuitem",disabled:!dt,onClick:()=>{B(),ki(null)},style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,width:"100%",padding:"6px 8px",borderRadius:6,border:"none",background:"transparent",color:dt?"#ddd":"rgba(255,255,255,0.28)",cursor:dt?"pointer":"default",fontFamily:"inherit",fontSize:"inherit",textAlign:"left"},onMouseEnter:Nt=>{dt&&(Nt.currentTarget.style.background="rgba(255,255,255,0.08)")},onMouseLeave:Nt=>{Nt.currentTarget.style.background="transparent"},children:[A.jsx("span",{children:ot}),A.jsx("span",{style:{color:"rgba(255,255,255,0.35)",fontSize:11},children:Qe(ne[st],{isMac:b})})]},W)),w&&A.jsx("div",{style:{height:1,margin:"4px 6px",background:"rgba(255,255,255,0.12)"}}),w&&k.map(({move:W,label:ot,shortcut:st})=>{const dt=wD(J,w,W);return A.jsxs("button",{type:"button",role:"menuitem",disabled:!dt,onClick:()=>{m(w,W),ki(null)},style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,width:"100%",padding:"6px 8px",borderRadius:6,border:"none",background:"transparent",color:dt?"#ddd":"rgba(255,255,255,0.28)",cursor:dt?"pointer":"default",fontFamily:"inherit",fontSize:"inherit",textAlign:"left"},onMouseEnter:B=>{dt&&(B.currentTarget.style.background="rgba(255,255,255,0.08)")},onMouseLeave:B=>{B.currentTarget.style.background="transparent"},children:[A.jsx("span",{children:ot}),A.jsx("span",{style:{color:"rgba(255,255,255,0.35)",fontSize:11},children:Qe(ne[st],{isMac:b})})]},W)})]})})(),A.jsx("input",{ref:Jl,type:"file",accept:f8,style:{display:"none"},onChange:w=>{const k=w.target.files?.[0];w.target.value="",k&&(Oi(k),Or(!1))}}),A.jsx(L8,{open:Xo,fontId:er.fontId,fontFamily:Rn,strokeWidthScale:is,showToolTooltips:er.showToolTooltips,onClose:()=>Go(!1),onFontIdChange:oo,onStrokeWidthScaleChange:Wo,onShowToolTooltipsChange:Us})]})})}),VF={nw:"Верхній лівий",ne:"Верхній правий",sw:"Нижній лівий",se:"Нижній правий"};function WF({anchorRect:e,onPick:t,renderPreview:n}){return A.jsx("div",{style:{position:"fixed",top:e?e.bottom+6:0,left:e?e.left+e.width/2:0,transform:"translateX(-50%)",zIndex:3200,display:"grid",gridTemplateColumns:"1fr 1fr",gap:6,padding:8,background:"rgba(16,16,28,0.98)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:10,boxShadow:"0 10px 28px rgba(0,0,0,0.45)"},onClick:r=>r.stopPropagation(),children:["nw","ne","sw","se"].map(r=>A.jsx("button",{type:"button",title:VF[r],onClick:()=>t(r),style:{width:56,height:56,padding:0,borderRadius:8,border:"none",background:"rgba(255,255,255,0.06)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:n(r)},r))})}function XF({corner:e}){const i=e==="nw"||e==="sw"?12:32,s=e==="nw"||e==="ne"?12:32;return A.jsx("svg",{width:44,height:44,viewBox:"0 0 44 44","aria-hidden":!0,children:A.jsx("circle",{cx:i,cy:s,r:7,fill:"none",stroke:"#F2D727",strokeWidth:1.6})})}function i4({shortcut:e,isMac:t}){const[n,r]=I.useState(!1);return A.jsxs("div",{onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,padding:"4px 6px",borderRadius:6,background:n?"rgba(255,255,255,0.08)":"transparent",transition:"background 0.15s"},children:[A.jsx("span",{style:{color:"rgba(255,255,255,0.85)"},children:e.label}),A.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:Ei(e,{isMac:t}).map(i=>A.jsx(Hl,{children:i},i))})]})}function o4({canUndo:e,canRedo:t,onUndo:n,onRedo:r,isMac:i}){return A.jsxs(A.Fragment,{children:[A.jsx(Sr,{title:`Відмінити (${Qe(ne.undo,{isMac:i})})`,tooltip:`Відмінити останню точку або переміщення (${Qe(ne.undo,{isMac:i})})`,onClick:n,disabled:!e,children:A.jsx("i",{className:`${Xn} bi-arrow-counterclockwise`,style:{fontSize:Zn},"aria-hidden":!0})}),A.jsx(Sr,{title:`Повернути (${Qe(ne.redo,{isMac:i})})`,tooltip:`Повернути скасовану дію (${Qe(ne.redo,{isMac:i})})`,onClick:r,disabled:!t,children:A.jsx("i",{className:`${Xn} bi-arrow-clockwise`,style:{fontSize:Zn},"aria-hidden":!0})})]})}function Sr({children:e,onClick:t,active:n,accent:r,primary:i,title:s,tooltip:l,tooltipLabel:c,disabled:f,hotkeyParts:d,showHotkeyBadge:p,success:g,hideTooltip:b}){const[y,M]=I.useState(!1),[E,D]=I.useState(!1),L=I.useRef(null),q=typeof window<"u"&&(navigator.maxTouchPoints>0||window.matchMedia?.("(pointer: coarse)").matches===!0),$=typeof window<"u"&&window.innerWidth<(q?1040:1320),Y=l!=null&&l!==""||!!c,ht=E&&!f,Mt=i?ht?"rgb(30, 90, 180)":"rgb(0, 102, 204)":null,vt=r?ht?"rgb(210, 50, 60)":"rgb(230, 57, 70)":null,bt=!!g&&!f;return A.jsxs("span",{ref:L,style:{position:"relative",display:"inline-block"},onMouseEnter:()=>{M(!0),D(!0)},onMouseLeave:()=>{M(!1),D(!1)},children:[A.jsx("button",{onClick:t,disabled:f,title:Y?void 0:s,"aria-label":Y?c??s??l:void 0,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:q?40:30,boxSizing:"border-box",background:Mt??vt??(n?"linear-gradient(135deg, rgb(230, 57, 70), rgb(198, 43, 56))":ht?"rgba(255,255,255,0.12)":"rgba(255,255,255,0.06)"),border:bt?"1px solid #2ecc71":`1px solid ${Mt??vt??(n?"transparent":"rgba(255,255,255,0.08)")}`,borderRadius:5,color:f?"rgba(255,255,255,0.55)":bt?"#2ecc71":i||r||n?"#fff":"#bbb",fontFamily:"inherit",fontSize:"inherit",fontWeight:600,padding:q?$?"7px 10px":"8px 14px":$?"4px 8px":"5px 12px",transition:"all 0.15s",cursor:f?"not-allowed":"pointer",opacity:f?.6:1},children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:$?6:8},children:[e,p&&d&&d.length>0&&A.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:d.map(rt=>A.jsx(Hl,{title:`Гаряча клавіша: ${rt}`,children:rt},rt))})]})}),Y&&y&&!b&&A.jsx(Y5,{anchorRef:L,label:c,hint:l?O6(l,d):void 0,hotkeyParts:d})]})}function GF({children:e,onMainClick:t,onMenuClick:n,menuOpen:r,disabled:i,mainTitle:s,mainTooltip:l,mainTooltipLabel:c,menuTitle:f,menuTooltip:d,hotkeyParts:p,showHotkeyBadge:g}){const[b,y]=I.useState(!1),[M,E]=I.useState(!1),[D,L]=I.useState(!1),[q,$]=I.useState(!1),Y=I.useRef(null),ht=I.useRef(null),Mt=typeof window<"u"&&(navigator.maxTouchPoints>0||window.matchMedia?.("(pointer: coarse)").matches===!0),vt=typeof window<"u"&&window.innerWidth<(Mt?1040:1320),bt=Mt?40:30,rt=Mt?vt?7:8:vt?4:5,Dt=Mt?vt?10:14:vt?8:12,Q="rgba(255,255,255,0.06)",lt="rgba(255,255,255,0.12)",X="linear-gradient(135deg, rgb(230, 57, 70), rgb(198, 43, 56))",wt=r?"transparent":"rgba(255,255,255,0.08)";return A.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"stretch",opacity:i?.6:1,border:`1px solid ${wt}`,borderRadius:5,overflow:"hidden",background:Q},children:[A.jsxs("span",{ref:Y,style:{position:"relative",display:"inline-flex"},onMouseEnter:()=>{y(!0),L(!0)},onMouseLeave:()=>{y(!1),L(!1)},children:[A.jsx("button",{type:"button",onClick:t,disabled:i,title:l||c?void 0:s,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:bt,boxSizing:"border-box",background:b&&!i?lt:"transparent",border:"none",borderRadius:0,color:i?"rgba(255,255,255,0.55)":"#bbb",fontFamily:"inherit",fontSize:"inherit",fontWeight:600,padding:`${rt}px ${Dt}px`,transition:"background 0.15s",cursor:i?"not-allowed":"pointer"},children:A.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:vt?6:8},children:[e,g&&p&&p.length>0&&A.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:p.map(Tt=>A.jsx(Hl,{title:`Гаряча клавіша: ${Tt}`,children:Tt},Tt))})]})}),(l||c)&&D&&A.jsx(Y5,{anchorRef:Y,label:c,hint:l?O6(l,p):void 0,hotkeyParts:p})]}),A.jsxs("span",{ref:ht,style:{position:"relative",display:"inline-flex"},onMouseEnter:()=>{E(!0),$(!0)},onMouseLeave:()=>{E(!1),$(!1)},children:[A.jsx("button",{type:"button",onClick:n,disabled:i,"aria-expanded":!!r,"aria-haspopup":"dialog",title:d?void 0:f,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:bt,minWidth:Mt?32:26,boxSizing:"border-box",background:r?X:M&&!i?lt:"transparent",border:"none",borderLeft:`1px solid ${r?"rgba(255,255,255,0.18)":"rgba(255,255,255,0.12)"}`,borderRadius:0,color:i?"rgba(255,255,255,0.55)":r?"#fff":"#bbb",fontFamily:"inherit",fontSize:"inherit",fontWeight:600,padding:`${rt}px ${vt?6:8}px`,transition:"background 0.15s, color 0.15s",cursor:i?"not-allowed":"pointer"},children:A.jsx("i",{className:"bi bi-chevron-down",style:{fontSize:Zn-2},"aria-hidden":!0})}),d&&q&&A.jsx(Y5,{anchorRef:ht,hint:d})]})]})}function KF({onFile:e,highlight:t=!1,warning:n=null}){const r=I.useRef(null),[i,s]=I.useState(!1),l=i||t,c=f=>{f.preventDefault(),f.stopPropagation(),s(!1);const d=f.dataTransfer.files[0];if(!V5(d))return;const p=new DataTransfer;p.items.add(d),r.current&&(Object.defineProperty(r.current,"files",{value:p.files,configurable:!0}),r.current.dispatchEvent(new Event("change",{bubbles:!0})))};return A.jsxs("div",{onDragOver:f=>{f.preventDefault(),s(!0)},onDragLeave:()=>s(!1),onDrop:c,onClick:()=>r.current?.click(),style:{border:`2px dashed ${l?"#4ecdc4":"rgba(255,255,255,0.08)"}`,borderRadius:14,padding:"60px 80px",textAlign:"center",cursor:"pointer",transition:"all 0.2s",background:l?"rgba(78,205,196,0.05)":"transparent",maxWidth:440},children:[A.jsx("div",{style:{marginBottom:14,opacity:.5,display:"flex",justifyContent:"center",color:"#555"},children:A.jsx("i",{className:`${Xn} bi-image`,style:{fontSize:48},"aria-hidden":!0})}),A.jsx("p",{style:{fontSize:16,color:"#777",lineHeight:1.7,fontWeight:700,margin:0},children:"Завантажте фонове зображення"}),A.jsxs("p",{style:{fontSize:14,color:"#555",margin:0,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,flexWrap:"wrap"},children:["або вставте з буфера",Ei(ne.pasteInCallout,{isMac:kd()}).map(f=>A.jsx(Hl,{title:ih(),children:f},f))]}),A.jsx("div",{style:{display:"inline-block",marginTop:18,borderRadius:7,background:"linear-gradient(135deg, #E63946, #c62b38)",color:"#fff",fontSize:14,fontWeight:700,padding:"7px 24px 9px"},children:"Обрати файл"}),n&&A.jsx("p",{style:{marginTop:14,marginBottom:0,color:"#E63946",fontSize:13,lineHeight:1.5},children:n}),A.jsx("input",{ref:r,type:"file",accept:"image/*",style:{display:"none"},onChange:e})]})}oT.createRoot(document.getElementById("root")).render(A.jsx(I.StrictMode,{children:A.jsx(YF,{mode:"embed"})}));export{ii as _,JF as c,s4 as g};